summaryrefslogtreecommitdiff
path: root/gitlab/cli.py
diff options
context:
space:
mode:
authorNejc Habjan <hab.nejc@gmail.com>2021-11-01 19:22:18 +0100
committerJohn Villalovos <john@sodarock.com>2021-11-05 20:45:01 -0700
commit7925c902d15f20abaecdb07af213f79dad91355b (patch)
tree4c6766bfac4965590570c1b22ec5a56918461e1c /gitlab/cli.py
parentf51d9be224ab509a62efe05e9f8ffb561af62df5 (diff)
downloadgitlab-7925c902d15f20abaecdb07af213f79dad91355b.tar.gz
refactor: use f-strings for string formatting
Diffstat (limited to 'gitlab/cli.py')
-rw-r--r--gitlab/cli.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/gitlab/cli.py b/gitlab/cli.py
index c053a38..a0134ec 100644
--- a/gitlab/cli.py
+++ b/gitlab/cli.py
@@ -85,8 +85,8 @@ def register_custom_action(
def die(msg: str, e: Optional[Exception] = None) -> None:
if e:
- msg = "%s (%s)" % (msg, e)
- sys.stderr.write(msg + "\n")
+ msg = f"{msg} ({e})"
+ sys.stderr.write(f"{msg}\n")
sys.exit(1)
@@ -172,7 +172,7 @@ def _parse_value(v: Any) -> Any:
with open(v[1:]) as fl:
return fl.read()
except Exception as e:
- sys.stderr.write("%s\n" % e)
+ sys.stderr.write(f"{e}\n")
sys.exit(1)
return v
@@ -209,7 +209,7 @@ def main() -> None:
sys.exit(e)
# We only support v4 API at this time
if config.api_version not in ("4",):
- raise ModuleNotFoundError(name="gitlab.v%s.cli" % config.api_version)
+ raise ModuleNotFoundError(name=f"gitlab.v{config.api_version}.cli")
# Now we build the entire set of subcommands and do the complete parsing
parser = _get_parser()