From d8cf64edb65ff5c03804796553c7817bb87d9b39 Mon Sep 17 00:00:00 2001 From: ArjunSahlot Date: Tue, 11 May 2021 17:13:20 -0700 Subject: [PATCH 1/2] Fix typos in comments. --- mypy/build.py | 4 ++-- mypy/checker.py | 10 +++++----- mypy/checkexpr.py | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/mypy/build.py b/mypy/build.py index 494dfdf3ae01..4a97d6479022 100644 --- a/mypy/build.py +++ b/mypy/build.py @@ -1741,7 +1741,7 @@ class State: # iteration over dependencies. # They should be managed with add_dependency and suppress_dependency. dependencies = None # type: List[str] # Modules directly imported by the module - dependencies_set = None # type: Set[str] # The same but as a set for deduplication purposes + dependencies_set = None # type: Set[str] # The same but as a set for duplication purposes suppressed = None # type: List[str] # Suppressed/missing dependencies suppressed_set = None # type: Set[str] # Suppressed/missing dependencies priorities = None # type: Dict[str, int] @@ -2098,7 +2098,7 @@ def semantic_analysis_pass1(self) -> None: analyzer = SemanticAnalyzerPreAnalysis() with self.wrap_context(): analyzer.visit_file(self.tree, self.xpath, self.id, options) - # TODO: Do this while contructing the AST? + # TODO: Do this while constructing the AST? self.tree.names = SymbolTable() if options.allow_redefinition: # Perform renaming across the AST to allow variable redefinitions diff --git a/mypy/checker.py b/mypy/checker.py index 18a7cfdac93f..6b2019b66875 100644 --- a/mypy/checker.py +++ b/mypy/checker.py @@ -2188,7 +2188,7 @@ def try_infer_partial_generic_type_from_assignment(self, if op != '=' and (typ.type.fullname, op) not in self.partial_type_augmented_ops: return # TODO: some logic here duplicates the None partial type counterpart - # inlined in check_assignment(), see # 8043. + # inlined in check_assignment(), see #8043 (https://github.com/python/mypy/issues/8043). partial_types = self.find_partial_types(var) if partial_types is None: return @@ -2905,7 +2905,7 @@ def infer_partial_type(self, name: Var, lvalue: Lvalue, init_type: Type) -> bool return True def is_valid_defaultdict_partial_value_type(self, t: ProperType) -> bool: - """Check if t can be used as the basis for a partial defaultddict value type. + """Check if t can be used as the basis for a partial defaultdict value type. Examples: @@ -4499,7 +4499,7 @@ def refine_identity_comparison_expression(self, if target is None: return {}, {} - # If possible, use an unassignable expression as the target. + # If possible, use an nonassignable expression as the target. # We skip refining the type of the target below, so ideally we'd # want to pick an expression we were going to skip anyways. singleton_index = -1 @@ -4507,7 +4507,7 @@ def refine_identity_comparison_expression(self, if i not in narrowable_operand_indices: singleton_index = i - # But if none of the possible singletons are unassignable ones, we give up + # But if none of the possible singletons are nonassignable ones, we give up # and arbitrarily pick the last item, mostly because other parts of the # type narrowing logic bias towards picking the rightmost item and it'd be # nice to stay consistent. @@ -5477,7 +5477,7 @@ def overload_can_never_match(signature: CallableType, other: CallableType) -> bo def is_more_general_arg_prefix(t: FunctionLike, s: FunctionLike) -> bool: - """Does t have wider arguments than s?""" + """Does it have wider arguments than s?""" # TODO should an overload with additional items be allowed to be more # general than one with fewer items (or just one item)? if isinstance(t, CallableType): diff --git a/mypy/checkexpr.py b/mypy/checkexpr.py index 3bfe0a306446..a45f8a3a769b 100644 --- a/mypy/checkexpr.py +++ b/mypy/checkexpr.py @@ -90,7 +90,7 @@ MAX_UNIONS = 5 # type: Final -# Types considered safe for comparisons with --strict-equality due to known behaviour of __eq__. +# Types considered safe for comparisons with --strict-equality due to known behavior of __eq__. # NOTE: All these types are subtypes of AbstractSet. OVERLAPPING_TYPES_WHITELIST = ['builtins.set', 'builtins.frozenset', 'typing.KeysView', 'typing.ItemsView'] # type: Final From d1f7f7721d7f686d97a6054db46ec85914c0ea86 Mon Sep 17 00:00:00 2001 From: ArjunSahlot Date: Tue, 11 May 2021 17:44:50 -0700 Subject: [PATCH 2/2] Fix mistakes. --- mypy/build.py | 2 +- mypy/checker.py | 8 ++++---- mypy/checkexpr.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mypy/build.py b/mypy/build.py index 4a97d6479022..c8648785089b 100644 --- a/mypy/build.py +++ b/mypy/build.py @@ -1741,7 +1741,7 @@ class State: # iteration over dependencies. # They should be managed with add_dependency and suppress_dependency. dependencies = None # type: List[str] # Modules directly imported by the module - dependencies_set = None # type: Set[str] # The same but as a set for duplication purposes + dependencies_set = None # type: Set[str] # The same but as a set for deduplication purposes suppressed = None # type: List[str] # Suppressed/missing dependencies suppressed_set = None # type: Set[str] # Suppressed/missing dependencies priorities = None # type: Dict[str, int] diff --git a/mypy/checker.py b/mypy/checker.py index 6b2019b66875..dde8a3441c35 100644 --- a/mypy/checker.py +++ b/mypy/checker.py @@ -2188,7 +2188,7 @@ def try_infer_partial_generic_type_from_assignment(self, if op != '=' and (typ.type.fullname, op) not in self.partial_type_augmented_ops: return # TODO: some logic here duplicates the None partial type counterpart - # inlined in check_assignment(), see #8043 (https://github.com/python/mypy/issues/8043). + # inlined in check_assignment(), see #8043. partial_types = self.find_partial_types(var) if partial_types is None: return @@ -4499,7 +4499,7 @@ def refine_identity_comparison_expression(self, if target is None: return {}, {} - # If possible, use an nonassignable expression as the target. + # If possible, use an unassignable expression as the target. # We skip refining the type of the target below, so ideally we'd # want to pick an expression we were going to skip anyways. singleton_index = -1 @@ -4507,7 +4507,7 @@ def refine_identity_comparison_expression(self, if i not in narrowable_operand_indices: singleton_index = i - # But if none of the possible singletons are nonassignable ones, we give up + # But if none of the possible singletons are unassignable ones, we give up # and arbitrarily pick the last item, mostly because other parts of the # type narrowing logic bias towards picking the rightmost item and it'd be # nice to stay consistent. @@ -5477,7 +5477,7 @@ def overload_can_never_match(signature: CallableType, other: CallableType) -> bo def is_more_general_arg_prefix(t: FunctionLike, s: FunctionLike) -> bool: - """Does it have wider arguments than s?""" + """Does t have wider arguments than s?""" # TODO should an overload with additional items be allowed to be more # general than one with fewer items (or just one item)? if isinstance(t, CallableType): diff --git a/mypy/checkexpr.py b/mypy/checkexpr.py index a45f8a3a769b..3bfe0a306446 100644 --- a/mypy/checkexpr.py +++ b/mypy/checkexpr.py @@ -90,7 +90,7 @@ MAX_UNIONS = 5 # type: Final -# Types considered safe for comparisons with --strict-equality due to known behavior of __eq__. +# Types considered safe for comparisons with --strict-equality due to known behaviour of __eq__. # NOTE: All these types are subtypes of AbstractSet. OVERLAPPING_TYPES_WHITELIST = ['builtins.set', 'builtins.frozenset', 'typing.KeysView', 'typing.ItemsView'] # type: Final