Commit d049d8fd by Branch Vincent

chore: remove unused type ignores

parent 0f747917
...@@ -149,7 +149,7 @@ class GitRepoLocalInfo: ...@@ -149,7 +149,7 @@ class GitRepoLocalInfo:
class Git: class Git:
@staticmethod @staticmethod
def as_repo(repo: Path | str) -> Repo: def as_repo(repo: Path | str) -> Repo:
return Repo(str(repo)) # type: ignore[no-untyped-call] return Repo(str(repo))
@staticmethod @staticmethod
def get_remote_url(repo: Repo, remote: str = "origin") -> str: def get_remote_url(repo: Repo, remote: str = "origin") -> str:
...@@ -158,8 +158,8 @@ class Git: ...@@ -158,8 +158,8 @@ class Git:
section = (b"remote", remote.encode("utf-8")) section = (b"remote", remote.encode("utf-8"))
url = "" url = ""
if config.has_section(section): # type: ignore[no-untyped-call] if config.has_section(section):
value = config.get(section, b"url") # type: ignore[no-untyped-call] value = config.get(section, b"url")
assert value is not None assert value is not None
url = value.decode("utf-8") url = value.decode("utf-8")
...@@ -195,12 +195,10 @@ class Git: ...@@ -195,12 +195,10 @@ class Git:
kwargs["username"] = credentials.username kwargs["username"] = credentials.username
kwargs["password"] = credentials.password kwargs["password"] = credentials.password
client, path = get_transport_and_path( # type: ignore[no-untyped-call] client, path = get_transport_and_path(url, **kwargs)
url, **kwargs
)
with local: with local:
result: FetchPackResult = client.fetch( # type: ignore[no-untyped-call] result: FetchPackResult = client.fetch(
path, path,
local, local,
determine_wants=local.object_store.determine_wants_all, determine_wants=local.object_store.determine_wants_all,
...@@ -241,7 +239,7 @@ class Git: ...@@ -241,7 +239,7 @@ class Git:
f"Failed to checkout {url} at '{revision}'" f"Failed to checkout {url} at '{revision}'"
) )
repo = Repo(str(target)) # type: ignore[no-untyped-call] repo = Repo(str(target))
return repo return repo
@classmethod @classmethod
...@@ -252,10 +250,10 @@ class Git: ...@@ -252,10 +250,10 @@ class Git:
""" """
local: Repo local: Repo
if not target.exists(): if not target.exists():
local = Repo.init(str(target), mkdir=True) # type: ignore[no-untyped-call] local = Repo.init(str(target), mkdir=True)
porcelain.remote_add(local, "origin", url) # type: ignore[no-untyped-call] porcelain.remote_add(local, "origin", url)
else: else:
local = Repo(str(target)) # type: ignore[no-untyped-call] local = Repo(str(target))
remote_refs = cls._fetch_remote_refs(url=url, local=local) remote_refs = cls._fetch_remote_refs(url=url, local=local)
...@@ -282,7 +280,7 @@ class Git: ...@@ -282,7 +280,7 @@ class Git:
(b"refs/remotes/origin", b"refs/heads/"), (b"refs/remotes/origin", b"refs/heads/"),
(b"refs/tags", b"refs/tags"), (b"refs/tags", b"refs/tags"),
}: }:
local.refs.import_refs( # type: ignore[no-untyped-call] local.refs.import_refs(
base=base, base=base,
other={ other={
n[len(prefix) :]: v n[len(prefix) :]: v
...@@ -293,7 +291,7 @@ class Git: ...@@ -293,7 +291,7 @@ class Git:
try: try:
with local: with local:
local.reset_index() # type: ignore[no-untyped-call] local.reset_index()
except (AssertionError, KeyError) as e: except (AssertionError, KeyError) as e:
# this implies the ref we need does not exist or is invalid # this implies the ref we need does not exist or is invalid
if isinstance(e, KeyError): if isinstance(e, KeyError):
...@@ -335,7 +333,7 @@ class Git: ...@@ -335,7 +333,7 @@ class Git:
url: bytes url: bytes
path: bytes path: bytes
submodules = parse_submodules(config) # type: ignore[no-untyped-call] submodules = parse_submodules(config)
for path, url, _ in submodules: for path, url, _ in submodules:
path_relative = Path(path.decode("utf-8")) path_relative = Path(path.decode("utf-8"))
path_absolute = repo_root.joinpath(path_relative) path_absolute = repo_root.joinpath(path_relative)
...@@ -395,7 +393,7 @@ class Git: ...@@ -395,7 +393,7 @@ class Git:
else: else:
# check if the current local copy matches the requested ref spec # check if the current local copy matches the requested ref spec
try: try:
current_repo = Repo(str(target)) # type: ignore[no-untyped-call] current_repo = Repo(str(target))
with current_repo: with current_repo:
current_sha = current_repo.head().decode("utf-8") current_sha = current_repo.head().decode("utf-8")
......
...@@ -48,7 +48,7 @@ class SystemGit: ...@@ -48,7 +48,7 @@ class SystemGit:
folder.as_posix(), folder.as_posix(),
) + args ) + args
git_command = find_git_command() # type: ignore[no-untyped-call] git_command = find_git_command()
return ( return (
subprocess.check_output(git_command + list(args), stderr=subprocess.STDOUT) subprocess.check_output(git_command + list(args), stderr=subprocess.STDOUT)
.decode() .decode()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment