Merge ~cjwatson/launchpadlib:pyupgrade into launchpadlib:main

Proposed by Colin Watson
Status: Merged
Merged at revision: 5ecb0dd8bc968420496fe33bbf0130bc1046a758
Proposed branch: ~cjwatson/launchpadlib:pyupgrade
Merge into: launchpadlib:main
Diff against target: 46 lines (+7/-6)
3 files modified
.pre-commit-config.yaml (+5/-0)
src/launchpadlib/launchpad.py (+1/-3)
src/launchpadlib/testing/launchpad.py (+1/-3)
Reviewer Review Type Date Requested Status
Jürgen Gmach Approve
Review via email: mp+412003@code.launchpad.net

Commit message

Apply pyupgrade

To post a comment you must log in.
Revision history for this message
Jürgen Gmach (jugmac00) wrote :

Personally I like the % and f-string formatting and the format thing not so much.

I would have ran pyupgrade with `--keep-percent-format` until we are on Python 3.6 and use f-strings, but as I said this is a very personal thing, and certainly no blocker :-)

LGTM!

review: Approve
Revision history for this message
Colin Watson (cjwatson) wrote :

Fine by me. I've added `--keep-percent-format` - how's this?

Revision history for this message
Jürgen Gmach (jugmac00) wrote :

Excellent :-)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index fe333f3..7304ab5 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -15,6 +15,11 @@ repos:
15 rev: 3.9.215 rev: 3.9.2
16 hooks:16 hooks:
17 - id: flake817 - id: flake8
18- repo: https://github.com/asottile/pyupgrade
19 rev: v2.29.0
20 hooks:
21 - id: pyupgrade
22 args: [--keep-percent-format]
18- repo: https://github.com/psf/black23- repo: https://github.com/psf/black
19 rev: 21.9b024 rev: 21.9b0
20 hooks:25 hooks:
diff --git a/src/launchpadlib/launchpad.py b/src/launchpadlib/launchpad.py
index cbe5cbd..9363d9b 100644
--- a/src/launchpadlib/launchpad.py
+++ b/src/launchpadlib/launchpad.py
@@ -243,9 +243,7 @@ class Launchpad(ServiceRoot):
243243
244 @classmethod244 @classmethod
245 def _is_sudo(cls):245 def _is_sudo(cls):
246 return set(["SUDO_USER", "SUDO_UID", "SUDO_GID"]) & set(246 return {"SUDO_USER", "SUDO_UID", "SUDO_GID"} & set(os.environ.keys())
247 os.environ.keys()
248 )
249247
250 @classmethod248 @classmethod
251 def authorization_engine_factory(cls, *args):249 def authorization_engine_factory(cls, *args):
diff --git a/src/launchpadlib/testing/launchpad.py b/src/launchpadlib/testing/launchpad.py
index c3d65bc..a97b995 100644
--- a/src/launchpadlib/testing/launchpad.py
+++ b/src/launchpadlib/testing/launchpad.py
@@ -411,9 +411,7 @@ class FakeResource(object):
411 name or if C{value}'s type is not valid for the attribute.411 name or if C{value}'s type is not valid for the attribute.
412 """412 """
413 representation = self._application.representation_definitions[xml_id]413 representation = self._application.representation_definitions[xml_id]
414 parameters = dict(414 parameters = {child.get("name"): child for child in representation.tag}
415 (child.get("name"), child) for child in representation.tag
416 )
417 if name not in parameters:415 if name not in parameters:
418 raise IntegrityError("%s not found" % name)416 raise IntegrityError("%s not found" % name)
419 parameter = parameters[name]417 parameter = parameters[name]

Subscribers

People subscribed via source and target branches