Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update flake8 additional dependencies #6095

Merged
merged 4 commits into from
Jul 31, 2022
Merged

Update flake8 additional dependencies #6095

merged 4 commits into from
Jul 31, 2022

Conversation

mkniewallner
Copy link
Member

@mkniewallner mkniewallner commented Jul 29, 2022

Pull Request Check List

  • Added tests for changed code.
  • Updated documentation for changed code.

Update flake8 additional dependencies and update code to comply with:

return (
f"<c1>{d.name}</c1> <fg=default>(<c2>{d.pretty_constraint}</c2>)</>"
f" with markers <b>{marker}</b>"
f" with markers <b>{'*' if d.marker.is_any() else d.marker}</b>"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this change is not strictly needed, it raised a B023 as well.

As marker is also defined outside of fmt_warning, I believe it confused the plugin (because renaming marker to dependency_marker made it pass).

Since the variable is only used once, I though it wasn't worth having one anyway, but if we prefer the current version, it's fine by me to just rename marker to dependency_marker instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's good the way it is

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, squashed into a84feef by only renaming marker to dependency_marker.

@@ -24,4 +24,6 @@ def commands(self) -> list[type[Command]]:
def activate(self, application: Application) -> None:
for command in self.commands:
assert command.name is not None
application.command_loader.register_factory(command.name, lambda: command())
application.command_loader.register_factory(
command.name, lambda: command() # noqa: B023
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one can, I think, be considered as a false positive, since we do want late binding here.

@mkniewallner mkniewallner changed the title Update pre-commit additional dependencies Update flake8 additional dependencies Jul 29, 2022
return (
f"<c1>{d.name}</c1> <fg=default>(<c2>{d.pretty_constraint}</c2>)</>"
f" with markers <b>{marker}</b>"
f" with markers <b>{'*' if d.marker.is_any() else d.marker}</b>"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's good the way it is

tests/compat.py Outdated
@@ -4,7 +4,7 @@
try:
import zipp # nopycln: import
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While you are at it, you could rewrite it to if sys.version < (3, x), that way it will be recognized by pyupgrade (link) and will be removed when we upgrade Python versions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I didn't know that pyupgrade handled that, thanks!

except ImportError:
import zipfile as zipp # noqa: F401, TC002

if sys.version_info < (3, 8):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on

zipp = { version = "^3.4", python = "<3.8" }

Took the opportunity to export as zipfile rather than zipp as well, since zipfile is the one in stdlib, and zipp will most likely go away when we will remove support for 3.7.

@Secrus Secrus merged commit b5c46f5 into python-poetry:master Jul 31, 2022
@mkniewallner mkniewallner deleted the chore/update-pre-commit-additional-dependencies branch July 31, 2022 12:53
efugier pushed a commit to efugier/poetry that referenced this pull request Aug 4, 2022
* build(deps): update pre-commit additional dependencies

* chore: comply with `flake8-type-checking` following update

* chore: comply with `flake8-bugbear` following update

* refactor(tests): import `zipp` only on < 3.8
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants