mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-11 14:35:06 +00:00
use f-strings in module utils (#10901)
* use f-strings in module utils * Apply suggestions from code review Co-authored-by: Felix Fontein <felix@fontein.de> * remove unused imports --------- Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
74b6a0294a
commit
b85e263466
51 changed files with 270 additions and 382 deletions
|
|
@ -37,7 +37,7 @@ def initialize_dialect(dialect, **kwargs):
|
|||
csv.register_dialect("unix", unix_dialect)
|
||||
|
||||
if dialect not in csv.list_dialects():
|
||||
raise DialectNotAvailableError("Dialect '%s' is not supported by your version of python." % dialect)
|
||||
raise DialectNotAvailableError(f"Dialect '{dialect}' is not supported by your version of python.")
|
||||
|
||||
# Create a dictionary from only set options
|
||||
dialect_params = {k: v for k, v in kwargs.items() if v is not None}
|
||||
|
|
@ -45,7 +45,7 @@ def initialize_dialect(dialect, **kwargs):
|
|||
try:
|
||||
csv.register_dialect('custom', dialect, **dialect_params)
|
||||
except TypeError as e:
|
||||
raise CustomDialectFailureError("Unable to create custom dialect: %s" % to_native(e))
|
||||
raise CustomDialectFailureError(f"Unable to create custom dialect: {e}")
|
||||
dialect = 'custom'
|
||||
|
||||
return dialect
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue