From 0327f8f8cb07bc09070468fbf5b242fbc63a1589 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Wed, 18 Oct 2023 12:18:33 -0400 Subject: [PATCH] Make all one-element __slots__ be tuples Most already were, but a few were strings. --- git/index/typ.py | 2 +- git/objects/tree.py | 5 +++-- git/util.py | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/git/index/typ.py b/git/index/typ.py index 7b86cae55..9f57f067b 100644 --- a/git/index/typ.py +++ b/git/index/typ.py @@ -40,7 +40,7 @@ class BlobFilter: The given paths are given relative to the repository. """ - __slots__ = "paths" + __slots__ = ("paths",) def __init__(self, paths: Sequence[PathLike]) -> None: """ diff --git a/git/objects/tree.py b/git/objects/tree.py index b33da3709..c91c01807 100644 --- a/git/objects/tree.py +++ b/git/objects/tree.py @@ -109,7 +109,7 @@ class TreeModifier: the cache of a tree, will be sorted. This ensures it will be in a serializable state. """ - __slots__ = "_cache" + __slots__ = ("_cache",) def __init__(self, cache: List[TreeCacheTup]) -> None: self._cache = cache @@ -214,7 +214,8 @@ class Tree(IndexObject, git_diff.Diffable, util.Traversable, util.Serializable): """ type: Literal["tree"] = "tree" - __slots__ = "_cache" + + __slots__ = ("_cache",) # Actual integer IDs for comparison. commit_id = 0o16 # Equals stat.S_IFDIR | stat.S_IFLNK - a directory link. diff --git a/git/util.py b/git/util.py index e61e3c6f5..4e96f7394 100644 --- a/git/util.py +++ b/git/util.py @@ -713,7 +713,7 @@ def update( class CallableRemoteProgress(RemoteProgress): """An implementation forwarding updates to any callable.""" - __slots__ = "_callable" + __slots__ = ("_callable",) def __init__(self, fn: Callable) -> None: self._callable = fn