diff --git a/git/config.py b/git/config.py index 8f68c4e66..1931f142d 100644 --- a/git/config.py +++ b/git/config.py @@ -150,6 +150,7 @@ class SectionConstraint(Generic[T_ConfigParser]): """ __slots__ = ("_config", "_section_name") + _valid_attrs_ = ( "get_value", "set_value", diff --git a/git/objects/base.py b/git/objects/base.py index a771f9fbf..6d2efa32a 100644 --- a/git/objects/base.py +++ b/git/objects/base.py @@ -137,7 +137,7 @@ def __repr__(self) -> str: @property def hexsha(self) -> str: """:return: 40 byte hex version of our 20 byte binary sha""" - # b2a_hex produces bytes + # b2a_hex produces bytes. return bin_to_hex(self.binsha).decode("ascii") @property @@ -206,7 +206,7 @@ def __hash__(self) -> int: def _set_cache_(self, attr: str) -> None: if attr in IndexObject.__slots__: - # they cannot be retrieved lateron ( not without searching for them ) + # They cannot be retrieved later on (not without searching for them). raise AttributeError( "Attribute '%s' unset: path and mode attributes must have been set during %s object creation" % (attr, type(self).__name__) diff --git a/git/refs/symbolic.py b/git/refs/symbolic.py index 6e4b657d6..73f64a57b 100644 --- a/git/refs/symbolic.py +++ b/git/refs/symbolic.py @@ -215,7 +215,7 @@ def _check_ref_name_valid(ref_path: PathLike) -> None: elif any(component.endswith(".lock") for component in str(ref_path).split("/")): raise ValueError( f"Invalid reference '{ref_path}': references cannot have slash-separated components that end with" - f" '.lock'" + " '.lock'" ) @classmethod @@ -309,8 +309,8 @@ def set_commit( ) -> "SymbolicReference": """As set_object, but restricts the type of object to be a Commit. - :raise ValueError: If commit is not a Commit object or doesn't point to - a commit + :raise ValueError: If commit is not a :class:`~git.objects.commit.Commit` object + or doesn't point to a commit :return: self """ # Check the type - assume the best if it is a base-string.