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

Bump black from 22.12.0 to 24.3.0 #240

Merged
merged 2 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ max-line-length = 120
# W503 talks about operator formatting which is too opinionated.
# C901 I like long functions
# F403 should turn this on for ghstack/, lookup exclude format TODO
ignore = E127, E128, E203, E265, E266, E402, E501, E722, P207, P208, W503, C901, F403, F405
# E704 see https://github.com/PyCQA/flake8/issues/1925
ignore = E127, E128, E203, E265, E266, E402, E501, E722, P207, P208, W503, C901, F403, F405, E704
exclude =
.git,
.hg,
Expand Down
1 change: 1 addition & 0 deletions ghstack/gpg_sign.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
We will attempt to sign as long as `commit.gpgsign` is true.
If not key is configure, error will occur
"""

from typing import Tuple, Union

import ghstack.shell
Expand Down
2 changes: 1 addition & 1 deletion ghstack/rage.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def main(latest: bool = False) -> None:
if not latest:
print("Which invocation would you like to report?")
print()
for (i, fn) in enumerate(logs):
for i, fn in enumerate(logs):
if next_index > 10:
break

Expand Down
24 changes: 7 additions & 17 deletions ghstack/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,23 +233,16 @@ def _maybe_rstrip(self, s: _SHELL_RET) -> _SHELL_RET:
return s

@overload # noqa: F811
def git(self, *args: str) -> str:
...
def git(self, *args: str) -> str: ...

@overload # noqa: F811
def git(self, *args: str, input: str) -> str:

...
def git(self, *args: str, input: str) -> str: ...

@overload # noqa: F811
def git(self, *args: str, input: str, env: Dict[str, str]) -> str:

...
def git(self, *args: str, input: str, env: Dict[str, str]) -> str: ...

@overload # noqa: F811
def git(self, *args: str, **kwargs: Any) -> _SHELL_RET:

...
def git(self, *args: str, **kwargs: Any) -> _SHELL_RET: ...

def git(self, *args: str, **kwargs: Any) -> _SHELL_RET: # noqa: F811
"""
Expand Down Expand Up @@ -288,16 +281,13 @@ def git(self, *args: str, **kwargs: Any) -> _SHELL_RET: # noqa: F811
return self._maybe_rstrip(self.sh(*(("git",) + args), **kwargs))

@overload # noqa: F811
def hg(self, *args: str) -> str:
...
def hg(self, *args: str) -> str: ...

@overload # noqa: F811
def hg(self, *args: str, input: str) -> str:
...
def hg(self, *args: str, input: str) -> str: ...

@overload # noqa: F811
def hg(self, *args: str, **kwargs: Any) -> _SHELL_RET:
...
def hg(self, *args: str, **kwargs: Any) -> _SHELL_RET: ...

def hg(self, *args: str, **kwargs: Any) -> _SHELL_RET: # noqa: F811
"""
Expand Down
22 changes: 13 additions & 9 deletions ghstack/submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,9 @@ class Submitter:
# did not exist on the stack at all), because they were associated
# with a patch that contains no changes. GhNumber may be false
# if the diff was never associated with a PR.
ignored_diffs: List[
Tuple[ghstack.diff.Diff, Optional[DiffWithGitHubMetadata]]
] = dataclasses.field(default_factory=list)
ignored_diffs: List[Tuple[ghstack.diff.Diff, Optional[DiffWithGitHubMetadata]]] = (
dataclasses.field(default_factory=list)
)

# Set of seen ghnums
seen_ghnums: Set[Tuple[str, GhNumber]] = dataclasses.field(default_factory=set)
Expand Down Expand Up @@ -692,9 +692,11 @@ def prepare_updates(
parent_commit,
parent_diff_meta,
diff,
self.elaborate_diff(diff)
if diff.pull_request_resolved is not None
else None,
(
self.elaborate_diff(diff)
if diff.pull_request_resolved is not None
else None
),
submit,
)
if diff_meta is not None:
Expand Down Expand Up @@ -952,9 +954,11 @@ def process_commit(
[
f"{strip_mentions(diff.summary.rstrip())}\n\n",
f"ghstack-source-id: {diff.source_id}\n",
f"ghstack-comment-id: {elab_diff.comment_id}\n"
if self.direct
else "",
(
f"ghstack-comment-id: {elab_diff.comment_id}\n"
if self.direct
else ""
),
f"Pull Request resolved: {pull_request_resolved.url()}",
]
)
Expand Down
62 changes: 36 additions & 26 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ python = "^3.8.1"
requests = "^2"
typing-extensions = ">=3 <5"
click = "^8"
flake8 = "^7.0.0"

[tool.poetry.dev-dependencies]
black = "^22.12.0"
flake8 = "^6"
black = "^24.3.0"
flake8 = "^7"
graphql-core = "^3"
hypothesis = "^6"
mypy = "^1"
Expand Down
26 changes: 15 additions & 11 deletions tools/linter/adapters/flake8_linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,11 @@ def check_files(
try:
proc = run_command(
[sys.executable, "-mflake8", "--exit-zero"] + filenames,
extra_env={"FLAKE8_PLUGINS_PATH": flake8_plugins_path}
if flake8_plugins_path
else None,
extra_env=(
{"FLAKE8_PLUGINS_PATH": flake8_plugins_path}
if flake8_plugins_path
else None
),
retries=retries,
)
except (OSError, subprocess.CalledProcessError) as err:
Expand Down Expand Up @@ -291,9 +293,11 @@ def check_files(
name=match["code"],
description=f"{match['message']}\nSee {get_issue_documentation_url(match['code'])}",
line=int(match["line"]),
char=int(match["column"])
if match["column"] is not None and not match["column"].startswith("-")
else None,
char=(
int(match["column"])
if match["column"] is not None and not match["column"].startswith("-")
else None
),
code="FLAKE8",
severity=severities.get(match["code"]) or get_issue_severity(match["code"]),
original=None,
Expand Down Expand Up @@ -337,11 +341,11 @@ def main() -> None:

logging.basicConfig(
format="<%(threadName)s:%(levelname)s> %(message)s",
level=logging.NOTSET
if args.verbose
else logging.DEBUG
if len(args.filenames) < 1000
else logging.INFO,
level=(
logging.NOTSET
if args.verbose
else logging.DEBUG if len(args.filenames) < 1000 else logging.INFO
),
stream=sys.stderr,
)

Expand Down
18 changes: 10 additions & 8 deletions tools/linter/adapters/mypy_linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,11 @@ def check_files(
name=match["code"],
description=match["message"],
line=int(match["line"]),
char=int(match["column"])
if match["column"] is not None and not match["column"].startswith("-")
else None,
char=(
int(match["column"])
if match["column"] is not None and not match["column"].startswith("-")
else None
),
code=code,
severity=severities.get(match["severity"], LintSeverity.ERROR),
original=None,
Expand Down Expand Up @@ -211,11 +213,11 @@ def main() -> None:

logging.basicConfig(
format="<%(threadName)s:%(levelname)s> %(message)s",
level=logging.NOTSET
if args.verbose
else logging.DEBUG
if len(args.filenames) < 1000
else logging.INFO,
level=(
logging.NOTSET
if args.verbose
else logging.DEBUG if len(args.filenames) < 1000 else logging.INFO
),
stream=sys.stderr,
)

Expand Down
10 changes: 5 additions & 5 deletions tools/linter/adapters/ufmt_linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ def main() -> None:

logging.basicConfig(
format="<%(processName)s:%(levelname)s> %(message)s",
level=logging.NOTSET
if args.verbose
else logging.DEBUG
if len(args.filenames) < 1000
else logging.INFO,
level=(
logging.NOTSET
if args.verbose
else logging.DEBUG if len(args.filenames) < 1000 else logging.INFO
),
stream=sys.stderr,
)

Expand Down
Loading