From 434306e7d09300b62763b7ebd797d08e7b99ea77 Mon Sep 17 00:00:00 2001 From: Yobmod Date: Tue, 18 May 2021 14:14:11 +0100 Subject: Add types to objects.blob.py --- git/objects/blob.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'git/objects/blob.py') diff --git a/git/objects/blob.py b/git/objects/blob.py index 897f892b..b027adab 100644 --- a/git/objects/blob.py +++ b/git/objects/blob.py @@ -4,6 +4,7 @@ # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php from mimetypes import guess_type +from typing import Tuple, Union from . import base __all__ = ('Blob', ) @@ -23,7 +24,7 @@ class Blob(base.IndexObject): __slots__ = () @property - def mime_type(self): + def mime_type(self) -> Union[None, Tuple[Union[None, str], Union[None, str]]]: """ :return: String describing the mime type of this file (based on the filename) :note: Defaults to 'text/plain' in case the actual file type is unknown. """ -- cgit v1.2.1 From 01c8d59e426ae097e486a0bffa5b21d2118a48c3 Mon Sep 17 00:00:00 2001 From: Yobmod Date: Tue, 18 May 2021 14:39:47 +0100 Subject: Add initial types to objects.util.py --- git/objects/blob.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'git/objects/blob.py') diff --git a/git/objects/blob.py b/git/objects/blob.py index b027adab..a6a5b224 100644 --- a/git/objects/blob.py +++ b/git/objects/blob.py @@ -24,7 +24,7 @@ class Blob(base.IndexObject): __slots__ = () @property - def mime_type(self) -> Union[None, Tuple[Union[None, str], Union[None, str]]]: + def mime_type(self) -> Union[None, str, Tuple[Union[None, str], Union[None, str]]]: """ :return: String describing the mime type of this file (based on the filename) :note: Defaults to 'text/plain' in case the actual file type is unknown. """ -- cgit v1.2.1 From c5c69071fd6c730d29c31759caddb0ba8b8e92c3 Mon Sep 17 00:00:00 2001 From: Yobmod Date: Thu, 20 May 2021 14:34:57 +0100 Subject: Mypy fixes --- git/objects/blob.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'git/objects/blob.py') diff --git a/git/objects/blob.py b/git/objects/blob.py index a6a5b224..013eaf8c 100644 --- a/git/objects/blob.py +++ b/git/objects/blob.py @@ -30,5 +30,5 @@ class Blob(base.IndexObject): :note: Defaults to 'text/plain' in case the actual file type is unknown. """ guesses = None if self.path: - guesses = guess_type(self.path) + guesses = guess_type(str(self.path)) return guesses and guesses[0] or self.DEFAULT_MIME_TYPE -- cgit v1.2.1 From 90f0fb8f449b6d3e4f12c28d8699ee79a6763b80 Mon Sep 17 00:00:00 2001 From: Yobmod Date: Thu, 20 May 2021 21:51:56 +0100 Subject: change IO[str] to stringIO --- git/objects/blob.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'git/objects/blob.py') diff --git a/git/objects/blob.py b/git/objects/blob.py index 013eaf8c..017178f0 100644 --- a/git/objects/blob.py +++ b/git/objects/blob.py @@ -4,7 +4,6 @@ # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php from mimetypes import guess_type -from typing import Tuple, Union from . import base __all__ = ('Blob', ) @@ -24,7 +23,7 @@ class Blob(base.IndexObject): __slots__ = () @property - def mime_type(self) -> Union[None, str, Tuple[Union[None, str], Union[None, str]]]: + def mime_type(self) -> str: """ :return: String describing the mime type of this file (based on the filename) :note: Defaults to 'text/plain' in case the actual file type is unknown. """ -- cgit v1.2.1