Accept suggestions from new toolchain · rec/pullman@96265e3
@@ -6,17 +6,17 @@
66import os
77import re
88import stat
9-import subprocess
109import sys
10+import time
1111import webbrowser
1212from argparse import Namespace
13+from collections.abc import Sequence
1314from contextlib import nullcontext, suppress
1415from functools import cache, cached_property
1516from operator import attrgetter
1617from pathlib import Path
1718from subprocess import CalledProcessError, run
18-from typing import Any, Optional, Sequence
19-19+from typing import Any, Optional
20202121try:
2222import bs4
@@ -174,7 +174,7 @@ def _get_ghstack_message(ref: str) -> tuple[str, list[str]]:
174174175175@dc.dataclass
176176class PullRequests:
177-argv: Optional[Sequence[str]] = None
177+argv: Sequence[str] | None = None
178178path: Path = DEFAULT_CACHE_PATH
179179180180def load(self) -> None:
@@ -225,7 +225,7 @@ def __call__(self) -> None:
225225or ()
226226 )
227227msg = e.args[0]
228-if arg and not arg in msg:
228+if arg and arg not in msg:
229229msg = f'{msg} for {arg}'
230230error(msg)
231231@@ -239,7 +239,7 @@ def _checkout(self):
239239error(f'At most one of {set_flags} can be set')
240240241241_run(f'ghstack checkout {self._matching_pull().url}')
242-if rebase := (
242+if (
243243self.args.rebase_against
244244or (self.args.rebase_main and 'upstream/main')
245245or (self.args.rebase_strict and 'upstream/viable/strict')
@@ -265,7 +265,6 @@ def clean_and_sort(user: str) -> list[PullRequest]:
265265pulls = []
266266for p in self.pulls.get(user, ()):
267267with suppress(PullError):
268-p.pull_number
269268if search in p.subject and (self.args.closed or p.is_open):
270269pulls.append(p)
271270@@ -339,6 +338,7 @@ def _errors(self) -> None:
339338340339if self.args.python or (self.args.python_default and sys.executable):
341340if not os.path.isdir(self.args.python):
341+# TODO!
342342python = os.path.dirname(self.args.python)
343343print(f'export PATH={self.args.python}:$PATH\n', file=file)
344344run_error_command(pull.pull_number, self.args, file)
@@ -375,7 +375,7 @@ def remotes(self):
375375@cached_property
376376def user(self) -> str:
377377if user := getattr(self.args, 'user', None):
378-return self.args.user
378+return user
379379if len(self.remotes) != 1:
380380return self.remotes['origin']
381381for r in self.remotes.values():
@@ -426,7 +426,7 @@ class ArgumentParser(argparse.ArgumentParser):
426426427427_epilog: str = HELP
428428429-def exit(self, status: int = 0, message: Optional[str] = None):
429+def exit(self, status: int = 0, message: str | None = None):
430430"""
431431 Overriding this method is a workaround for argparse throwing away all
432432 line breaks when printing the `epilog` section of the help message.