Skip to content

Commit 4dfd480

Browse files
committed
Fix how Remote annotates dynamic config-backed url attribute
This fixes a mypy error by replacing an annotation on `self.url`, which is a mypy error, by adding an annotation at the class level for a `url` instance attribute. This adds a corresponding brief docstring for it as well, which may slightly improve usability, but the main impact is one less mypy error.
1 parent c34a466 commit 4dfd480

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

git/remote.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,9 @@ class Remote(LazyMixin, IterableObj):
559559
"--exec",
560560
]
561561

562+
url: str # Obtained dynamically from _config_reader. See __getattr__ below.
563+
"""The URL configured for the remote."""
564+
562565
def __init__(self, repo: "Repo", name: str) -> None:
563566
"""Initialize a remote instance.
564567
@@ -570,7 +573,6 @@ def __init__(self, repo: "Repo", name: str) -> None:
570573
"""
571574
self.repo = repo
572575
self.name = name
573-
self.url: str
574576

575577
def __getattr__(self, attr: str) -> Any:
576578
"""Allows to call this instance like ``remote.special(*args, **kwargs)`` to

0 commit comments

Comments
 (0)