Skip to content

Commit 78055a8

Browse files
committed
Pick a consistent type for __all__ (for now, list)
This makes all __all__ everywhere in the git package lists. Before, roughly half were lists and half were tuples. There are reasonable theoretical arguments for both, and in practice all tools today support both. Traditionally using a list is far more common, and it remains at least somewhat more common. Furthermore, git/util.py uses a list and is currently written to append an element to it that is conditionally defined on Windows (though it would probably be fine for that to be the only list, since it reflects an actual relevant difference about it). The goal here is just to remove inconsistency that does not signify anything and is the result of drift over time. If a reason (even preference) arises to make them all tuples in the future, then that is also probably fine.
1 parent fcc7418 commit 78055a8

19 files changed

+24
-24
lines changed

git/cmd.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from __future__ import annotations
77

8-
__all__ = ("Git",)
8+
__all__ = ["Git"]
99

1010
import contextlib
1111
import io

git/config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
"""Parser for reading and writing configuration files."""
77

8-
__all__ = ("GitConfigParser", "SectionConstraint")
8+
__all__ = ["GitConfigParser", "SectionConstraint"]
99

1010
import abc
1111
import configparser as cp

git/db.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
"""Module with our own gitdb implementation - it uses the git command."""
55

6-
__all__ = ("GitCmdObjectDB", "GitDB")
6+
__all__ = ["GitCmdObjectDB", "GitDB"]
77

88
from gitdb.base import OInfo, OStream
99
from gitdb.db import GitDB, LooseObjectDB

git/diff.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# This module is part of GitPython and is released under the
44
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/
55

6-
__all__ = ("DiffConstants", "NULL_TREE", "INDEX", "Diffable", "DiffIndex", "Diff")
6+
__all__ = ["DiffConstants", "NULL_TREE", "INDEX", "Diffable", "DiffIndex", "Diff"]
77

88
import enum
99
import re

git/index/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"""Module containing :class:`IndexFile`, an Index implementation facilitating all kinds
77
of index manipulations such as querying and merging."""
88

9-
__all__ = ("IndexFile", "CheckoutError", "StageType")
9+
__all__ = ["IndexFile", "CheckoutError", "StageType"]
1010

1111
import contextlib
1212
import datetime

git/index/fun.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"""Standalone functions to accompany the index implementation and make it more
55
versatile."""
66

7-
__all__ = (
7+
__all__ = [
88
"write_cache",
99
"read_cache",
1010
"write_tree_from_cache",
@@ -13,7 +13,7 @@
1313
"S_IFGITLINK",
1414
"run_commit_hook",
1515
"hook_path",
16-
)
16+
]
1717

1818
from io import BytesIO
1919
import os

git/index/typ.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
"""Additional types used by the index."""
55

6-
__all__ = ("BlobFilter", "BaseIndexEntry", "IndexEntry", "StageType")
6+
__all__ = ["BlobFilter", "BaseIndexEntry", "IndexEntry", "StageType"]
77

88
from binascii import b2a_hex
99
from pathlib import Path

git/index/util.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
"""Index utilities."""
55

6-
__all__ = ("TemporaryFileSwap", "post_clear_cache", "default_index", "git_working_dir")
6+
__all__ = ["TemporaryFileSwap", "post_clear_cache", "default_index", "git_working_dir"]
77

88
import contextlib
99
from functools import wraps

git/objects/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# This module is part of GitPython and is released under the
44
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/
55

6-
__all__ = ("Object", "IndexObject")
6+
__all__ = ["Object", "IndexObject"]
77

88
import os.path as osp
99

git/objects/blob.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# This module is part of GitPython and is released under the
44
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/
55

6-
__all__ = ("Blob",)
6+
__all__ = ["Blob"]
77

88
from mimetypes import guess_type
99
import sys

git/objects/commit.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# This module is part of GitPython and is released under the
44
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/
55

6-
__all__ = ("Commit",)
6+
__all__ = ["Commit"]
77

88
from collections import defaultdict
99
import datetime

git/objects/fun.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33

44
"""Functions that are supposed to be as fast as possible."""
55

6-
__all__ = (
6+
__all__ = [
77
"tree_to_stream",
88
"tree_entries_from_data",
99
"traverse_trees_recursive",
1010
"traverse_tree_recursive",
11-
)
11+
]
1212

1313
from stat import S_ISDIR
1414

git/objects/submodule/util.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# This module is part of GitPython and is released under the
22
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/
33

4-
__all__ = (
4+
__all__ = [
55
"sm_section",
66
"sm_name",
77
"mkhead",
88
"find_first_remote_branch",
99
"SubmoduleConfigParser",
10-
)
10+
]
1111

1212
from io import BytesIO
1313
import weakref

git/objects/tag.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
For lightweight tags, see the :mod:`git.refs.tag` module.
1010
"""
1111

12-
__all__ = ("TagObject",)
12+
__all__ = ["TagObject"]
1313

1414
import sys
1515

git/objects/tree.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# This module is part of GitPython and is released under the
44
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/
55

6-
__all__ = ("TreeModifier", "Tree")
6+
__all__ = ["TreeModifier", "Tree"]
77

88
import sys
99

git/objects/util.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
"""Utility functions for working with git objects."""
77

8-
__all__ = (
8+
__all__ = [
99
"get_object_type_by_name",
1010
"parse_date",
1111
"parse_actor_and_date",
@@ -17,7 +17,7 @@
1717
"Actor",
1818
"tzoffset",
1919
"utc",
20-
)
20+
]
2121

2222
from abc import ABC, abstractmethod
2323
import calendar

git/remote.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
"""Module implementing a remote object allowing easy access to git remotes."""
77

8-
__all__ = ("RemoteProgress", "PushInfo", "FetchInfo", "Remote")
8+
__all__ = ["RemoteProgress", "PushInfo", "FetchInfo", "Remote"]
99

1010
import contextlib
1111
import logging

git/repo/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from __future__ import annotations
77

8-
__all__ = ("Repo",)
8+
__all__ = ["Repo"]
99

1010
import gc
1111
import logging

git/repo/fun.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from __future__ import annotations
77

8-
__all__ = (
8+
__all__ = [
99
"rev_parse",
1010
"is_git_dir",
1111
"touch",
@@ -15,7 +15,7 @@
1515
"deref_tag",
1616
"to_commit",
1717
"find_worktree_git_dir",
18-
)
18+
]
1919

2020
import os
2121
import os.path as osp

0 commit comments

Comments
 (0)