Code improvements from new Ruff checks (#11498)

This commit is contained in:
Avasam
2024-02-29 01:30:18 -05:00
committed by GitHub
parent c75ecf0bca
commit da69247514
9 changed files with 12 additions and 14 deletions

View File

@@ -48,7 +48,7 @@ class ActionLevel(enum.IntEnum):
try:
return cls[cmd_arg]
except KeyError:
raise argparse.ArgumentTypeError(f'Argument must be one of "{list(cls.__members__)}"')
raise argparse.ArgumentTypeError(f'Argument must be one of "{list(cls.__members__)}"') from None
nothing = 0, "make no changes"
local = 1, "make changes that affect local repo"
@@ -516,7 +516,7 @@ async def determine_action(stub_path: Path, session: aiohttp.ClientSession) -> U
)
@functools.lru_cache()
@functools.lru_cache
def get_origin_owner() -> str:
output = subprocess.check_output(["git", "remote", "get-url", "origin"], text=True).strip()
match = re.match(r"(git@github.com:|https://github.com/)(?P<owner>[^/]+)/(?P<repo>[^/\s]+)", output)