8000 improvement: teach mypy that Object.type is not always supposed to be… · gitpython-developers/GitPython@c885781 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c885781

Browse files
committed
improvement: teach mypy that Object.type is not always supposed to be None
1 parent 6a23335 commit c885781

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

git/objects/base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import gitdb.typ as dbtyp
99
import os.path as osp
10+
from typing import Optional # noqa: F401 unused import
1011

1112
from .util import get_object_type_by_name
1213

@@ -24,7 +25,7 @@ class Object(LazyMixin):
2425

2526
TYPES = (dbtyp.str_blob_type, dbtyp.str_tree_type, dbtyp.str_commit_type, dbtyp.str_tag_type)
2627
__slots__ = ("repo", "binsha", "size")
27-
type = None # to be set by subclass
28+
type = None # type: Optional[str] # to be set by subclass
2829

2930
def __init__(self, repo, binsha):
3031
"""Initialize an object by identifying it by its binary sha.

0 commit comments

Comments
 (0)
0