| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -187,9 +187,7 @@ def parse_date(string_date: Union[str, datetime]) -> Tuple[int, int]: | |||
| 187 | 187 | offset = -int(utcoffset.total_seconds()) | |
| 188 | 188 | return int(string_date.astimezone(utc).timestamp()), offset | |
| 189 | 189 | else: | |
| 190 | - # should just return timestamp, 0? | ||
| 191 | - return int(string_date.astimezone(utc).timestamp()), 0 | ||
| 192 | - # raise ValueError(f"string_date datetime object without tzinfo, {string_date}") | ||
| 190 | + raise ValueError(f"string_date datetime object without tzinfo, {string_date}") | ||
| 193 | 191 | ||
| 194 | 192 | # git time | |
| 195 | 193 | try: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -72,12 +72,13 @@ def __str__(self) -> str: | |||
| 72 | 72 | def __repr__(self) -> str: | |
| 73 | 73 | return '<git.%s "%s">' % (self.__class__.__name__, self.path) | |
| 74 | 74 | ||
| 75 | - def __eq__(self, other: Any) -> bool: | ||
| 75 | + def __eq__(self, other: object) -> bool: | ||
| 76 | 76 | if hasattr(other, 'path'): | |
| 77 | + other = cast(SymbolicReference, other) | ||
| 77 | 78 | return self.path == other.path | |
| 78 | 79 | return False | |
| 79 | 80 | ||
| 80 | - def __ne__(self, other: Any) -> bool: | ||
| 81 | + def __ne__(self, other: object) -> bool: | ||
| 81 | 82 | return not (self == other) | |
| 82 | 83 | ||
| 83 | 84 | def __hash__(self) -> int: | |
@@ -364,8 +365,9 @@ def set_reference(self, ref: Union[Commit_ish, 'SymbolicReference', str], | |||
| 364 | 365 | return self | |
| 365 | 366 | ||
| 366 | 367 | # aliased reference | |
| 368 | + reference: Union['Head', 'TagReference', 'RemoteReference', 'Reference'] | ||
| 367 | 369 | reference = property(_get_reference, set_reference, doc="Returns the Reference we point to") # type: ignore | |
| 368 | - ref: Union['Head', 'TagReference', 'RemoteReference', 'Reference'] = reference # type: ignore | ||
| 370 | + ref = reference | ||
| 369 | 371 | ||
| 370 | 372 | def is_valid(self) -> bool: | |
| 371 | 373 | """ | |
@@ -699,7 +701,9 @@ def from_path(cls, repo: 'Repo', path: PathLike) -> Union['Head', 'TagReference' | |||
| 699 | 701 | instance = ref_type(repo, path) | |
| 700 | 702 | if instance.__class__ == SymbolicReference and instance.is_detached: | |
| 701 | 703 | raise ValueError("SymbolRef was detached, we drop it") | |
| 702 | - return instance | ||
| 704 | + else: | ||
| 705 | + assert isinstance(instance, Reference), "instance should be Reference or subtype" | ||
| 706 | + return instance | ||
| 703 | 707 | except ValueError: | |
| 704 | 708 | pass | |
| 705 | 709 | # END exception handling | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,3 @@ | |||
| 1 | 1 | """Initialize the Repo package""" | |
| 2 | 2 | # flake8: noqa | |
| 3 | - from .base import * | ||
| 3 | + from .base import Repo as Repo | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,6 +3,7 @@ | |||
| 3 | 3 | # | |
| 4 | 4 | # This module is part of GitPython and is released under | |
| 5 | 5 | # the BSD License: http://www.opensource.org/licenses/bsd-license.php | |
| 6 | + from __future__ import annotations | ||
| 6 | 7 | import logging | |
| 7 | 8 | import os | |
| 8 | 9 | import re | |
@@ -384,13 +385,13 @@ def create_submodule(self, *args: Any, **kwargs: Any) -> Submodule: | |||
| 384 | 385 | :return: created submodules""" | |
| 385 | 386 | return Submodule.add(self, *args, **kwargs) | |
| 386 | 387 | ||
| 387 | - def iter_submodules(self, *args: Any, **kwargs: Any) -> Iterator: | ||
| 388 | + def iter_submodules(self, *args: Any, **kwargs: Any) -> Iterator[Submodule]: | ||
| 388 | 389 | """An iterator yielding Submodule instances, see Traversable interface | |
| 389 | 390 | for a description of args and kwargs | |
| 390 | 391 | :return: Iterator""" | |
| 391 | 392 | return RootModule(self).traverse(*args, **kwargs) | |
| 392 | 393 | ||
| 393 | - def submodule_update(self, *args: Any, **kwargs: Any) -> Iterator: | ||
| 394 | + def submodule_update(self, *args: Any, **kwargs: Any) -> Iterator[Submodule]: | ||
| 394 | 395 | """Update the submodules, keeping the repository consistent as it will | |
| 395 | 396 | take the previous state into consideration. For more information, please | |
| 396 | 397 | see the documentation of RootModule.update""" | |
@@ -774,15 +775,15 @@ def _get_untracked_files(self, *args: Any, **kwargs: Any) -> List[str]: | |||
| 774 | 775 | finalize_process(proc) | |
| 775 | 776 | return untracked_files | |
| 776 | 777 | ||
| 777 | - def ignored(self, *paths: PathLike) -> List[PathLike]: | ||
| 778 | + def ignored(self, *paths: PathLike) -> List[str]: | ||
| 778 | 779 | """Checks if paths are ignored via .gitignore | |
| 779 | 780 | Doing so using the "git check-ignore" method. | |
| 780 | 781 | ||
| 781 | 782 | :param paths: List of paths to check whether they are ignored or not | |
| 782 | 783 | :return: subset of those paths which are ignored | |
| 783 | 784 | """ | |
| 784 | 785 | try: | |
| 785 | - proc = self.git.check_ignore(*paths) | ||
| 786 | + proc: str = self.git.check_ignore(*paths) | ||
| 786 | 787 | except GitCommandError: | |
| 787 | 788 | return [] | |
| 788 | 789 | return proc.replace("\\\\", "\\").replace('"', "").split("\n") | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -70,7 +70,7 @@ | |||
| 70 | 70 | # Most of these are unused here, but are for use by git-python modules so these | |
| 71 | 71 | # don't see gitdb all the time. Flake of course doesn't like it. | |
| 72 | 72 | __all__ = ["stream_copy", "join_path", "to_native_path_linux", | |
| 73 | - "join_path_native", "Stats", "IndexFileSHA1Writer", "Iterable", "IterableList", | ||
| 73 | + "join_path_native", "Stats", "IndexFileSHA1Writer", "IterableObj", "IterableList", | ||
| 74 | 74 | "BlockingLockFile", "LockFile", 'Actor', 'get_user_id', 'assure_directory_exists', | |
| 75 | 75 | 'RemoteProgress', 'CallableRemoteProgress', 'rmtree', 'unbare_repo', | |
| 76 | 76 | 'HIDE_WINDOWS_KNOWN_ERRORS'] | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,10 +22,11 @@ filterwarnings = 'ignore::DeprecationWarning' | |||
| 22 | 22 | disallow_untyped_defs = true | |
| 23 | 23 | no_implicit_optional = true | |
| 24 | 24 | warn_redundant_casts = true | |
| 25 | - implicit_reexport = true | ||
| 26 | 25 | # warn_unused_ignores = true | |
| 27 | 26 | warn_unreachable = true | |
| 28 | 27 | show_error_codes = true | |
| 28 | + implicit_reexport = true | ||
| 29 | + # strict = true | ||
| 29 | 30 | ||
| 30 | 31 | # TODO: remove when 'gitdb' is fully annotated | |
| 31 | 32 | [[tool.mypy.overrides]] | |
| Back | FazBrowse Home | New Git URL |
0 commit comments