summaryrefslogtreecommitdiff
path: root/git/objects/util.py
diff options
context:
space:
mode:
authorYobmod <yobmod@gmail.com>2021-05-20 21:34:33 +0100
committerYobmod <yobmod@gmail.com>2021-05-20 21:34:33 +0100
commitc51f93823d46f0882b49822ce6f9e668228e5b8d (patch)
tree8f435f0565b3834aded4cff60e841f28618038bc /git/objects/util.py
parent76bcd7081265f1d72fcc3101bfda62c67d8a7f32 (diff)
downloadgitpython-c51f93823d46f0882b49822ce6f9e668228e5b8d.tar.gz
Add types to objects _serialize() and _deserialize()
Diffstat (limited to 'git/objects/util.py')
-rw-r--r--git/objects/util.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/git/objects/util.py b/git/objects/util.py
index 106bab0e..b94e9f12 100644
--- a/git/objects/util.py
+++ b/git/objects/util.py
@@ -5,7 +5,6 @@
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
"""Module for general utility functions"""
-
from git.util import (
IterableList,
Actor
@@ -20,9 +19,10 @@ import calendar
from datetime import datetime, timedelta, tzinfo
# typing ------------------------------------------------------------
-from typing import Any, Callable, Deque, IO, Iterator, Sequence, TYPE_CHECKING, Tuple, Type, Union, cast, overload
+from typing import (Any, Callable, Deque, IO, Iterator, Sequence, TYPE_CHECKING, Tuple, Type, Union, cast, overload)
if TYPE_CHECKING:
+ from io import BytesIO
from .submodule.base import Submodule
from .commit import Commit
from .blob import Blob
@@ -412,14 +412,14 @@ class Serializable(object):
"""Defines methods to serialize and deserialize objects from and into a data stream"""
__slots__ = ()
- def _serialize(self, stream):
+ def _serialize(self, stream: 'BytesIO') -> 'Serializable':
"""Serialize the data of this object into the given data stream
:note: a serialized object would ``_deserialize`` into the same object
:param stream: a file-like object
:return: self"""
raise NotImplementedError("To be implemented in subclass")
- def _deserialize(self, stream):
+ def _deserialize(self, stream: 'BytesIO') -> 'Serializable':
"""Deserialize all information regarding this object from the stream
:param stream: a file-like object
:return: self"""