From d2af0105687cf6245472b569726950eedfb5b53d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 20 Mar 2024 16:38:00 +0000 Subject: [PATCH 1/2] Bump black from 22.12.0 to 24.3.0 Bumps [black](https://github.com/psf/black) from 22.12.0 to 24.3.0. - [Release notes](https://github.com/psf/black/releases) - [Changelog](https://github.com/psf/black/blob/main/CHANGES.md) - [Commits](https://github.com/psf/black/compare/22.12.0...24.3.0) --- updated-dependencies: - dependency-name: black dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- poetry.lock | 47 +++++++++++++++++++++++++++++------------------ pyproject.toml | 2 +- 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/poetry.lock b/poetry.lock index 6d71b65..3b163df 100644 --- a/poetry.lock +++ b/poetry.lock @@ -141,36 +141,47 @@ tests-no-zope = ["cloudpickle", "hypothesis", "mypy (>=1.1.1)", "pympler", "pyte [[package]] name = "black" -version = "22.12.0" +version = "24.3.0" description = "The uncompromising code formatter." optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "black-22.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9eedd20838bd5d75b80c9f5487dbcb06836a43833a37846cf1d8c1cc01cef59d"}, - {file = "black-22.12.0-cp310-cp310-win_amd64.whl", hash = "sha256:159a46a4947f73387b4d83e87ea006dbb2337eab6c879620a3ba52699b1f4351"}, - {file = "black-22.12.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d30b212bffeb1e252b31dd269dfae69dd17e06d92b87ad26e23890f3efea366f"}, - {file = "black-22.12.0-cp311-cp311-win_amd64.whl", hash = "sha256:7412e75863aa5c5411886804678b7d083c7c28421210180d67dfd8cf1221e1f4"}, - {file = "black-22.12.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c116eed0efb9ff870ded8b62fe9f28dd61ef6e9ddd28d83d7d264a38417dcee2"}, - {file = "black-22.12.0-cp37-cp37m-win_amd64.whl", hash = "sha256:1f58cbe16dfe8c12b7434e50ff889fa479072096d79f0a7f25e4ab8e94cd8350"}, - {file = "black-22.12.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:77d86c9f3db9b1bf6761244bc0b3572a546f5fe37917a044e02f3166d5aafa7d"}, - {file = "black-22.12.0-cp38-cp38-win_amd64.whl", hash = "sha256:82d9fe8fee3401e02e79767016b4907820a7dc28d70d137eb397b92ef3cc5bfc"}, - {file = "black-22.12.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:101c69b23df9b44247bd88e1d7e90154336ac4992502d4197bdac35dd7ee3320"}, - {file = "black-22.12.0-cp39-cp39-win_amd64.whl", hash = "sha256:559c7a1ba9a006226f09e4916060982fd27334ae1998e7a38b3f33a37f7a2148"}, - {file = "black-22.12.0-py3-none-any.whl", hash = "sha256:436cc9167dd28040ad90d3b404aec22cedf24a6e4d7de221bec2730ec0c97bcf"}, - {file = "black-22.12.0.tar.gz", hash = "sha256:229351e5a18ca30f447bf724d007f890f97e13af070bb6ad4c0a441cd7596a2f"}, + {file = "black-24.3.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:7d5e026f8da0322b5662fa7a8e752b3fa2dac1c1cbc213c3d7ff9bdd0ab12395"}, + {file = "black-24.3.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9f50ea1132e2189d8dff0115ab75b65590a3e97de1e143795adb4ce317934995"}, + {file = "black-24.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e2af80566f43c85f5797365077fb64a393861a3730bd110971ab7a0c94e873e7"}, + {file = "black-24.3.0-cp310-cp310-win_amd64.whl", hash = "sha256:4be5bb28e090456adfc1255e03967fb67ca846a03be7aadf6249096100ee32d0"}, + {file = "black-24.3.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:4f1373a7808a8f135b774039f61d59e4be7eb56b2513d3d2f02a8b9365b8a8a9"}, + {file = "black-24.3.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:aadf7a02d947936ee418777e0247ea114f78aff0d0959461057cae8a04f20597"}, + {file = "black-24.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:65c02e4ea2ae09d16314d30912a58ada9a5c4fdfedf9512d23326128ac08ac3d"}, + {file = "black-24.3.0-cp311-cp311-win_amd64.whl", hash = "sha256:bf21b7b230718a5f08bd32d5e4f1db7fc8788345c8aea1d155fc17852b3410f5"}, + {file = "black-24.3.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:2818cf72dfd5d289e48f37ccfa08b460bf469e67fb7c4abb07edc2e9f16fb63f"}, + {file = "black-24.3.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:4acf672def7eb1725f41f38bf6bf425c8237248bb0804faa3965c036f7672d11"}, + {file = "black-24.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c7ed6668cbbfcd231fa0dc1b137d3e40c04c7f786e626b405c62bcd5db5857e4"}, + {file = "black-24.3.0-cp312-cp312-win_amd64.whl", hash = "sha256:56f52cfbd3dabe2798d76dbdd299faa046a901041faf2cf33288bc4e6dae57b5"}, + {file = "black-24.3.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:79dcf34b33e38ed1b17434693763301d7ccbd1c5860674a8f871bd15139e7837"}, + {file = "black-24.3.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:e19cb1c6365fd6dc38a6eae2dcb691d7d83935c10215aef8e6c38edee3f77abd"}, + {file = "black-24.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:65b76c275e4c1c5ce6e9870911384bff5ca31ab63d19c76811cb1fb162678213"}, + {file = "black-24.3.0-cp38-cp38-win_amd64.whl", hash = "sha256:b5991d523eee14756f3c8d5df5231550ae8993e2286b8014e2fdea7156ed0959"}, + {file = "black-24.3.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:c45f8dff244b3c431b36e3224b6be4a127c6aca780853574c00faf99258041eb"}, + {file = "black-24.3.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:6905238a754ceb7788a73f02b45637d820b2f5478b20fec82ea865e4f5d4d9f7"}, + {file = "black-24.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d7de8d330763c66663661a1ffd432274a2f92f07feeddd89ffd085b5744f85e7"}, + {file = "black-24.3.0-cp39-cp39-win_amd64.whl", hash = "sha256:7bb041dca0d784697af4646d3b62ba4a6b028276ae878e53f6b4f74ddd6db99f"}, + {file = "black-24.3.0-py3-none-any.whl", hash = "sha256:41622020d7120e01d377f74249e677039d20e6344ff5851de8a10f11f513bf93"}, + {file = "black-24.3.0.tar.gz", hash = "sha256:a0c9c4a0771afc6919578cec71ce82a3e31e054904e7197deacbc9382671c41f"}, ] [package.dependencies] click = ">=8.0.0" mypy-extensions = ">=0.4.3" +packaging = ">=22.0" pathspec = ">=0.9.0" platformdirs = ">=2" -tomli = {version = ">=1.1.0", markers = "python_full_version < \"3.11.0a7\""} -typing-extensions = {version = ">=3.10.0.0", markers = "python_version < \"3.10\""} +tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} +typing-extensions = {version = ">=4.0.1", markers = "python_version < \"3.11\""} [package.extras] colorama = ["colorama (>=0.4.3)"] -d = ["aiohttp (>=3.7.4)"] +d = ["aiohttp (>=3.7.4)", "aiohttp (>=3.7.4,!=3.9.0)"] jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] uvloop = ["uvloop (>=0.15.2)"] @@ -1223,4 +1234,4 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" python-versions = "^3.8.1" -content-hash = "01f5e9d780da385da4bc3f05fa805f41d3fbd26b7d9231e2ff8ec87c474b0f08" +content-hash = "de1eb16566f515b618a7997b6f55ee71cbb680266269e6186d937e44f0d58035" diff --git a/pyproject.toml b/pyproject.toml index 2a71d09..7587369 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,7 +25,7 @@ typing-extensions = ">=3 <5" click = "^8" [tool.poetry.dev-dependencies] -black = "^22.12.0" +black = "^24.3.0" flake8 = "^6" graphql-core = "^3" hypothesis = "^6" From 0b131ec140eec76cec1d6c8dd50effef27f276ec Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Wed, 20 Mar 2024 22:04:26 -0400 Subject: [PATCH 2/2] Upgrade black and flake8 Signed-off-by: Edward Z. Yang --- .flake8 | 3 ++- ghstack/gpg_sign.py | 1 + ghstack/rage.py | 2 +- ghstack/shell.py | 24 +++++++----------------- ghstack/submit.py | 22 +++++++++++++--------- poetry.lock | 17 ++++++++--------- pyproject.toml | 3 ++- tools/linter/adapters/flake8_linter.py | 26 +++++++++++++++----------- tools/linter/adapters/mypy_linter.py | 18 ++++++++++-------- tools/linter/adapters/ufmt_linter.py | 10 +++++----- 10 files changed, 64 insertions(+), 62 deletions(-) diff --git a/.flake8 b/.flake8 index ba747cf..5047f29 100644 --- a/.flake8 +++ b/.flake8 @@ -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, diff --git a/ghstack/gpg_sign.py b/ghstack/gpg_sign.py index 318a2ad..f4c01f2 100644 --- a/ghstack/gpg_sign.py +++ b/ghstack/gpg_sign.py @@ -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 diff --git a/ghstack/rage.py b/ghstack/rage.py index 1674823..d0c9fe8 100644 --- a/ghstack/rage.py +++ b/ghstack/rage.py @@ -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 diff --git a/ghstack/shell.py b/ghstack/shell.py index 682294d..0de4548 100644 --- a/ghstack/shell.py +++ b/ghstack/shell.py @@ -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 """ @@ -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 """ diff --git a/ghstack/submit.py b/ghstack/submit.py index 02fc1ca..d5204e0 100644 --- a/ghstack/submit.py +++ b/ghstack/submit.py @@ -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) @@ -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: @@ -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()}", ] ) diff --git a/poetry.lock b/poetry.lock index 3b163df..6d71785 100644 --- a/poetry.lock +++ b/poetry.lock @@ -361,19 +361,19 @@ files = [ [[package]] name = "flake8" -version = "6.1.0" +version = "7.0.0" description = "the modular source code checker: pep8 pyflakes and co" optional = false python-versions = ">=3.8.1" files = [ - {file = "flake8-6.1.0-py2.py3-none-any.whl", hash = "sha256:ffdfce58ea94c6580c77888a86506937f9a1a227dfcd15f245d694ae20a6b6e5"}, - {file = "flake8-6.1.0.tar.gz", hash = "sha256:d5b3857f07c030bdb5bf41c7f53799571d75c4491748a3adcd47de929e34cd23"}, + {file = "flake8-7.0.0-py2.py3-none-any.whl", hash = "sha256:a6dfbb75e03252917f2473ea9653f7cd799c3064e54d4c8140044c5c065f53c3"}, + {file = "flake8-7.0.0.tar.gz", hash = "sha256:33f96621059e65eec474169085dc92bf26e7b2d47366b70be2f67ab80dc25132"}, ] [package.dependencies] mccabe = ">=0.7.0,<0.8.0" pycodestyle = ">=2.11.0,<2.12.0" -pyflakes = ">=3.1.0,<3.2.0" +pyflakes = ">=3.2.0,<3.3.0" [[package]] name = "frozenlist" @@ -818,13 +818,13 @@ files = [ [[package]] name = "pyflakes" -version = "3.1.0" +version = "3.2.0" description = "passive checker of Python programs" optional = false python-versions = ">=3.8" files = [ - {file = "pyflakes-3.1.0-py2.py3-none-any.whl", hash = "sha256:4132f6d49cb4dae6819e5379898f2b8cce3c5f23994194c24b77d5da2e36f774"}, - {file = "pyflakes-3.1.0.tar.gz", hash = "sha256:a0aae034c444db0071aa077972ba4768d40c830d9539fd45bf4cd3f8f6992efc"}, + {file = "pyflakes-3.2.0-py2.py3-none-any.whl", hash = "sha256:84b5be138a2dfbb40689ca07e2152deb896a65c3a3e24c251c5c62489568074a"}, + {file = "pyflakes-3.2.0.tar.gz", hash = "sha256:1c61603ff154621fb2a9172037d84dca3500def8c8b630657d1701f026f8af3f"}, ] [[package]] @@ -894,7 +894,6 @@ files = [ {file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"}, {file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"}, {file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"}, - {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a08c6f0fe150303c1c6b71ebcd7213c2858041a7e01975da3a99aed1e7a378ef"}, {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"}, {file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"}, {file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"}, @@ -1234,4 +1233,4 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" python-versions = "^3.8.1" -content-hash = "de1eb16566f515b618a7997b6f55ee71cbb680266269e6186d937e44f0d58035" +content-hash = "3ca086f6e3b8d4869a952a7cd5bf84c762f2111dff5141a8308d5622dc04148b" diff --git a/pyproject.toml b/pyproject.toml index 7587369..25e1302 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 = "^24.3.0" -flake8 = "^6" +flake8 = "^7" graphql-core = "^3" hypothesis = "^6" mypy = "^1" diff --git a/tools/linter/adapters/flake8_linter.py b/tools/linter/adapters/flake8_linter.py index 20c9c7c..ccf47f4 100644 --- a/tools/linter/adapters/flake8_linter.py +++ b/tools/linter/adapters/flake8_linter.py @@ -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: @@ -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, @@ -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, ) diff --git a/tools/linter/adapters/mypy_linter.py b/tools/linter/adapters/mypy_linter.py index 11466e8..64e5ed1 100644 --- a/tools/linter/adapters/mypy_linter.py +++ b/tools/linter/adapters/mypy_linter.py @@ -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, @@ -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, ) diff --git a/tools/linter/adapters/ufmt_linter.py b/tools/linter/adapters/ufmt_linter.py index c31dc10..936f4f9 100644 --- a/tools/linter/adapters/ufmt_linter.py +++ b/tools/linter/adapters/ufmt_linter.py @@ -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, )