mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-14 16:05:04 +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
|
|
@ -26,7 +26,7 @@ __channel_map = {
|
|||
|
||||
def __map_channel(channel_name):
|
||||
if channel_name not in __channel_map:
|
||||
raise ValueError("Unknown channel name '%s'" % channel_name)
|
||||
raise ValueError(f"Unknown channel name '{channel_name}'")
|
||||
return __channel_map[channel_name]
|
||||
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ def sdkmanager_runner(module, **kwargs):
|
|||
list=cmd_runner_fmt.as_fixed('--list'),
|
||||
newer=cmd_runner_fmt.as_fixed("--newer"),
|
||||
sdk_root=cmd_runner_fmt.as_opt_eq_val("--sdk_root"),
|
||||
channel=cmd_runner_fmt.as_func(lambda x: ["{0}={1}".format("--channel", __map_channel(x))])
|
||||
channel=cmd_runner_fmt.as_func(lambda x: [f"--channel={__map_channel(x)}"])
|
||||
),
|
||||
force_lang="C.UTF-8", # Without this, sdkmanager binary crashes
|
||||
**kwargs
|
||||
|
|
@ -126,7 +126,7 @@ class AndroidSdkManager(object):
|
|||
unknown_package_regex = self._RE_UNKNOWN_PACKAGE.match(line)
|
||||
if unknown_package_regex:
|
||||
package = unknown_package_regex.group('package')
|
||||
raise SdkManagerException("Unknown package %s" % package)
|
||||
raise SdkManagerException(f"Unknown package {package}")
|
||||
|
||||
@staticmethod
|
||||
def _parse_packages(stdout, header_regexp, row_regexp):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue