From 815f25102e3ab2ff1756c86487c6cd7ffdd4c0ce Mon Sep 17 00:00:00 2001 From: Steven Troxler Date: Mon, 27 Nov 2023 09:30:01 -0800 Subject: [PATCH 1/2] Add missing type comment. Added a type comment for the `newline` argument of `from_filename`, which is passed down to `open`. --- unidiff/patch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unidiff/patch.py b/unidiff/patch.py index bee28fc..c1f83ef 100644 --- a/unidiff/patch.py +++ b/unidiff/patch.py @@ -602,7 +602,7 @@ def _parse(self, diff, encoding, metadata_only): @classmethod def from_filename(cls, filename, encoding=DEFAULT_ENCODING, errors=None, newline=None): - # type: (str, str, Optional[str]) -> PatchSet + # type: (str, str, Optional[str], Optional[str]) -> PatchSet """Return a PatchSet instance given a diff filename.""" with open_file(filename, 'r', encoding=encoding, errors=errors, newline=newline) as f: instance = cls(f) From 43e1e244e773a80540749f9521c43ffb6b231538 Mon Sep 17 00:00:00 2001 From: Steven Troxler Date: Tue, 28 Nov 2023 08:07:38 -0800 Subject: [PATCH 2/2] Fix another type annotation comment --- unidiff/patch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unidiff/patch.py b/unidiff/patch.py index c1f83ef..fbfc418 100644 --- a/unidiff/patch.py +++ b/unidiff/patch.py @@ -238,7 +238,7 @@ class PatchedFile(list): def __init__(self, patch_info=None, source='', target='', source_timestamp=None, target_timestamp=None, is_binary_file=False): - # type: (Optional[PatchInfo], str, str, Optional[str], Optional[str], bool, bool) -> None + # type: (Optional[PatchInfo], str, str, Optional[str], Optional[str], bool) -> None super(PatchedFile, self).__init__() self.patch_info = patch_info self.source_file = source