diff --git a/mypy/nodes.py b/mypy/nodes.py index 377678213a5b..19f908661d49 100644 --- a/mypy/nodes.py +++ b/mypy/nodes.py @@ -184,15 +184,15 @@ class Node(Context): __slots__ = () def __str__(self) -> str: - and = self.accept(mypy.strconv.StrConv(options=Options())) - if and is None: + ans = self.accept(mypy.strconv.StrConv(options=Options())) + if ans is None: return repr(self) - return and + return ans def str_with_options(self, options: Options) -> str: - and = self.accept(mypy.strconv.StrConv(options=options)) - assert and - return and + ans = self.accept(mypy.strconv.StrConv(options=options)) + assert ans + return ans def accept(self, visitor: NodeVisitor[T]) -> T: raise RuntimeError("Not implemented", type(self)) diff --git a/mypy/test/teststubgen.py b/mypy/test/teststubgen.py index e3e20fee73d5..e65a16c8f395 100644 --- a/mypy/test/teststubgen.py +++ b/mypy/test/teststubgen.py @@ -587,10 +587,10 @@ def test_common_dir_prefix_unix(self) -> None: assert common_dir_prefix(["foo/bar/x.pyi", "foo/bar/y.pyi"]) == "foo/bar" assert common_dir_prefix(["foo/bar/x.pyi", "foo/y.pyi"]) == "foo" assert common_dir_prefix(["foo/x.pyi", "foo/bar/y.pyi"]) == "foo" - assert common_dir_prefix(["foo/bar/czar/x.pyi", "foo/y.pyi"]) == "foo" - assert common_dir_prefix(["foo/x.pyi", "foo/bar/czar/y.pyi"]) == "foo" - assert common_dir_prefix(["foo/bar/czar/x.pyi", "foo/bar/y.pyi"]) == "foo/bar" - assert common_dir_prefix(["foo/bar/x.pyi", "foo/bar/czar/y.pyi"]) == "foo/bar" + assert common_dir_prefix(["foo/bar/zar/x.pyi", "foo/y.pyi"]) == "foo" + assert common_dir_prefix(["foo/x.pyi", "foo/bar/zar/y.pyi"]) == "foo" + assert common_dir_prefix(["foo/bar/zar/x.pyi", "foo/bar/y.pyi"]) == "foo/bar" + assert common_dir_prefix(["foo/bar/x.pyi", "foo/bar/zar/y.pyi"]) == "foo/bar" assert common_dir_prefix([r"foo/bar\x.pyi"]) == "foo" assert common_dir_prefix([r"foo\bar/x.pyi"]) == r"foo\bar" @@ -604,10 +604,10 @@ def test_common_dir_prefix_win(self) -> None: assert common_dir_prefix([r"foo\bar\x.pyi", r"foo\bar\y.pyi"]) == r"foo\bar" assert common_dir_prefix([r"foo\bar\x.pyi", r"foo\y.pyi"]) == "foo" assert common_dir_prefix([r"foo\x.pyi", r"foo\bar\y.pyi"]) == "foo" - assert common_dir_prefix([r"foo\bar\czar\x.pyi", r"foo\y.pyi"]) == "foo" - assert common_dir_prefix([r"foo\x.pyi", r"foo\bar\czar\y.pyi"]) == "foo" - assert common_dir_prefix([r"foo\bar\czar\x.pyi", r"foo\bar\y.pyi"]) == r"foo\bar" - assert common_dir_prefix([r"foo\bar\x.pyi", r"foo\bar\czar\y.pyi"]) == r"foo\bar" + assert common_dir_prefix([r"foo\bar\zar\x.pyi", r"foo\y.pyi"]) == "foo" + assert common_dir_prefix([r"foo\x.pyi", r"foo\bar\zar\y.pyi"]) == "foo" + assert common_dir_prefix([r"foo\bar\zar\x.pyi", r"foo\bar\y.pyi"]) == r"foo\bar" + assert common_dir_prefix([r"foo\bar\x.pyi", r"foo\bar\zar\y.pyi"]) == r"foo\bar" assert common_dir_prefix([r"foo/bar\x.pyi"]) == r"foo\bar" assert common_dir_prefix([r"foo\bar/x.pyi"]) == r"foo\bar" assert common_dir_prefix([r"foo/bar/x.pyi"]) == r"foo\bar" diff --git a/mypy/test/testtypes.py b/mypy/test/testtypes.py index 5dd3b78c9498..0218d33cc124 100644 --- a/mypy/test/testtypes.py +++ b/mypy/test/testtypes.py @@ -867,7 +867,7 @@ def test_generics_contravariant(self) -> None: def test_generics_with_multiple_args(self) -> None: self.assert_join(self.fx_co.hab, self.fx_co.hab, self.fx_co.hab) self.assert_join(self.fx_co.hab, self.fx_co.hbb, self.fx_co.hab) - self.assert_join(self.fx_co.had, self.fx_co.has, self.fx_co.hao) + self.assert_join(self.fx_co.had, self.fx_co.haa, self.fx_co.hao) def test_generics_with_inheritance(self) -> None: self.assert_join(self.fx_co.gsab, self.fx_co.gb, self.fx_co.gb) @@ -1208,7 +1208,7 @@ def test_simple_generics(self) -> None: def test_generics_with_multiple_args(self) -> None: self.assert_meet(self.fx.hab, self.fx.hab, self.fx.hab) - self.assert_meet(self.fx.hab, self.fx.has, self.fx.hab) + self.assert_meet(self.fx.hab, self.fx.haa, self.fx.hab) self.assert_meet(self.fx.hab, self.fx.had, self.fx.nonet) self.assert_meet(self.fx.hab, self.fx.hbb, self.fx.hbb) diff --git a/mypy/test/typefixture.py b/mypy/test/typefixture.py index 73af11b45327..5a813f70117c 100644 --- a/mypy/test/typefixture.py +++ b/mypy/test/typefixture.py @@ -182,7 +182,7 @@ def make_type_var( self.gs2d = Instance(self.gs2i, [self.d]) # GS2[D] self.hab = Instance(self.hi, [self.a, self.b]) # H[A, B] - self.has = Instance(self.hi, [self.a, self.a]) # H[A, A] + self.haa = Instance(self.hi, [self.a, self.a]) # H[A, A] self.hbb = Instance(self.hi, [self.b, self.b]) # H[B, B] self.hts = Instance(self.hi, [self.t, self.s]) # H[T, S] self.had = Instance(self.hi, [self.a, self.d]) # H[A, D] diff --git a/mypyc/ir/ops.py b/mypyc/ir/ops.py index a1ab322a36be..896ba3ac091c 100644 --- a/mypyc/ir/ops.py +++ b/mypyc/ir/ops.py @@ -780,7 +780,7 @@ def accept(self, visitor: OpVisitor[T]) -> T: return visitor.visit_set_attr(self) -# Default name space for statistics, variables +# Default name space for statics, variables NAMESPACE_STATIC: Final = "static" # Static namespace for pointers to native type objects @@ -796,12 +796,12 @@ def accept(self, visitor: OpVisitor[T]) -> T: class LoadStatic(RegisterOp): """Load a static name (name :: static). - Load a C static variable/pointer. The namespace for statistics is shared + Load a C static variable/pointer. The namespace for statics is shared for the entire compilation group. You can optionally provide a module name and a sub-namespace identifier for additional namespacing to avoid name conflicts. The static namespace does not overlap with other C names, since the final C name will get a prefix, so conflicts only must be - avoided with other statistics. + avoided with other statics. """ error_kind = ERR_NEVER @@ -1451,7 +1451,7 @@ class LoadAddress(RegisterOp): type: Type of the loaded address(e.g. ptr/object_ptr) src: Source value (str for globals like 'PyList_Type', Register for temporary values or locals, LoadStatic - for statistics.) + for statics.) """ error_kind = ERR_NEVER diff --git a/mypyc/irbuild/classdef.py b/mypyc/irbuild/classdef.py index daea4a249c81..7e0a842b1b41 100644 --- a/mypyc/irbuild/classdef.py +++ b/mypyc/irbuild/classdef.py @@ -519,7 +519,7 @@ def populate_non_ext_bases(builder: IRBuilder, cdef: ClassDef) -> Value: "typing.Container", "typing.Sized", ): - # HEX: Synthesized base classes added by mypy don't exist at runtime, so skip them. + # HAX: Synthesized base classes added by mypy don't exist at runtime, so skip them. # This could break if they were added explicitly, though... continue # Add the current class to the base classes list of concrete subclasses @@ -529,7 +529,7 @@ def populate_non_ext_bases(builder: IRBuilder, cdef: ClassDef) -> Value: base_ir.children.append(ir) if cls.fullname in MAGIC_TYPED_DICT_CLASSES: - # HEX: Mypy internally represents TypedDict classes differently from what + # HAX: Mypy internally represents TypedDict classes differently from what # should happen at runtime. Replace with something that works. module = "typing" if builder.options.capi_version < (3, 9): diff --git a/mypyc/irbuild/expression.py b/mypyc/irbuild/expression.py index 31a7be405bbd..8d7c089e20cd 100644 --- a/mypyc/irbuild/expression.py +++ b/mypyc/irbuild/expression.py @@ -109,7 +109,7 @@ def transform_name_expr(builder: IRBuilder, expr: NameExpr) -> Value: if isinstance(expr.node, TypeVarLikeExpr) and expr.node.is_new_style: # Reference to Python 3.12 implicit TypeVar/TupleVarTuple/... object. - # These are stored in C statistics and not visible in Python namespaces. + # These are stored in C statics and not visible in Python namespaces. return builder.load_type_var(expr.node.name, expr.node.line) if expr.node is None: builder.add( diff --git a/mypyc/irbuild/function.py b/mypyc/irbuild/function.py index 1294de2b319c..c985e88b0e0c 100644 --- a/mypyc/irbuild/function.py +++ b/mypyc/irbuild/function.py @@ -514,7 +514,7 @@ def calculate_arg_defaults( ) -> None: """Calculate default argument values and store them. - They are stored in statistics for top level functions and in + They are stored in statics for top level functions and in the function objects for nested functions (while constants are still stored computed on demand). """ diff --git a/mypyc/test/test_namegen.py b/mypyc/test/test_namegen.py index d6c3e78bb82e..509018b4c3bd 100644 --- a/mypyc/test/test_namegen.py +++ b/mypyc/test/test_namegen.py @@ -25,10 +25,10 @@ def test_make_module_translation_map(self) -> None: "foo.bar": "bar.", "foo.baz": "baz.", } - assert make_module_translation_map(["czar", "foo.bar", "foo.baz"]) == { + assert make_module_translation_map(["zar", "foo.bar", "foo.baz"]) == { "foo.bar": "bar.", "foo.baz": "baz.", - "czar": "czar.", + "zar": "zar.", } assert make_module_translation_map(["foo.bar", "fu.bar", "foo.baz"]) == { "foo.bar": "foo.bar.", @@ -37,11 +37,11 @@ def test_make_module_translation_map(self) -> None: } def test_name_generator(self) -> None: - g = NameGenerator([["foo", "foo.czar"]]) + g = NameGenerator([["foo", "foo.zar"]]) assert g.private_name("foo", "f") == "foo___f" assert g.private_name("foo", "C.x.y") == "foo___C___x___y" assert g.private_name("foo", "C.x.y") == "foo___C___x___y" - assert g.private_name("foo.czar", "C.x.y") == "zar___C___x___y" + assert g.private_name("foo.zar", "C.x.y") == "zar___C___x___y" assert g.private_name("foo", "C.x_y") == "foo___C___x_y" assert g.private_name("foo", "C_x_y") == "foo___C_x_y" assert g.private_name("foo", "C_x_y") == "foo___C_x_y" diff --git a/mypyc/transform/refcount.py b/mypyc/transform/refcount.py index 455935b7a6ba..f2ab438f6576 100644 --- a/mypyc/transform/refcount.py +++ b/mypyc/transform/refcount.py @@ -187,7 +187,7 @@ def f(a: int) -> None term = block.terminator for i, target in enumerate(term.targets()): - # HEX: After we've checked against an error value the value we must not touch the + # HAX: After we've checked against an error value the value we must not touch the # refcount since it will be a null pointer. The correct way to do this would be # to perform data flow analysis on whether a value can be null (or is always # null).