Skip to content

Commit

Permalink
Fixed spelling issues
Browse files Browse the repository at this point in the history
  • Loading branch information
clintaire committed Sep 15, 2024
1 parent 72c413d commit 5c33478
Show file tree
Hide file tree
Showing 31 changed files with 54 additions and 54 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ This feature was contributed by Jukka Lehtosalo (PR [17404](https://github.com/p

#### Mypyc Improvements

Mypyc now supports the new syntax for generics introduced in Python 3.12 (see above). Another notable improvement is signficantly faster basic operations on `int` values.
Mypyc now supports the new syntax for generics introduced in Python 3.12 (see above). Another notable improvement is significantly faster basic operations on `int` values.

* Support Python 3.12 syntax for generic functions and classes (Jukka Lehtosalo, PR [17357](https://github.com/python/mypy/pull/17357))
* Support Python 3.12 type alias syntax (Jukka Lehtosalo, PR [17384](https://github.com/python/mypy/pull/17384))
Expand Down
2 changes: 1 addition & 1 deletion mypy/argmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def expand_actual_type(
self.tuple_index += 1
item = actual_type.items[self.tuple_index - 1]
if isinstance(item, UnpackType) and not allow_unpack:
# An upack item that doesn't have special handling, use upper bound as above.
# An unpack item that doesn't have special handling, use upper bound as above.
unpacked = get_proper_type(item.type)
if isinstance(unpacked, TypeVarTupleType):
fallback = get_proper_type(unpacked.upper_bound)
Expand Down
2 changes: 1 addition & 1 deletion mypy/checkexpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ def validate_typeddict_kwargs(
# Having an optional key not explicitly declared by a ** unpacked
# TypedDict is unsafe, it may be an (incompatible) subtype at runtime.
# TODO: catch the cases where a declared key is overridden by a subsequent
# ** item without it (and not again overriden with complete ** item).
# ** item without it (and not again overridden with complete ** item).
self.msg.non_required_keys_absent_with_star(absent_keys, last_star_found)
return result, always_present_keys

Expand Down
2 changes: 1 addition & 1 deletion mypy/fastparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -2249,7 +2249,7 @@ def visit_member_expr(self, e: MemberExpr) -> None:


class FindYield(TraverserVisitor):
"""Check if an AST contains yields or yield froms."""
"""Check if an AST contains yields or yield forms."""

def __init__(self) -> None:
self.found = False
Expand Down
2 changes: 1 addition & 1 deletion mypy/join.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ def join_tuples(self, s: TupleType, t: TupleType) -> list[Type] | None:
return items
return None
if s_unpack_index is not None and t_unpack_index is not None:
# The most complex case: both tuples have an upack item.
# The most complex case: both tuples have an unpack item.
s_unpack = s.items[s_unpack_index]
assert isinstance(s_unpack, UnpackType)
s_unpacked = get_proper_type(s_unpack.type)
Expand Down
2 changes: 1 addition & 1 deletion mypy/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def are_type_names_disabled(self) -> bool:
def prefer_simple_messages(self) -> bool:
"""Should we generate simple/fast error messages?
If errors aren't shown to the user, we don't want to waste cyles producing
If errors aren't shown to the user, we don't want to waste cycles producing
complex error messages.
"""
return self.errors.prefer_simple_messages()
Expand Down
14 changes: 7 additions & 7 deletions mypy/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,15 @@ class Node(Context):
__slots__ = ()

def __str__(self) -> str:
ans = self.accept(mypy.strconv.StrConv(options=Options()))
if ans is None:
and = self.accept(mypy.strconv.StrConv(options=Options()))
if and is None:
return repr(self)
return ans
return and

def str_with_options(self, options: Options) -> str:
ans = self.accept(mypy.strconv.StrConv(options=options))
assert ans
return ans
and = self.accept(mypy.strconv.StrConv(options=options))
assert and
return and

def accept(self, visitor: NodeVisitor[T]) -> T:
raise RuntimeError("Not implemented", type(self))
Expand Down Expand Up @@ -1166,7 +1166,7 @@ def __init__(
self.keywords = dict(keywords) if keywords else {}
self.analyzed = None
self.has_incompatible_baseclass = False
# Used for error reporting (to keep backwad compatibility with pre-3.8)
# Used for error reporting (to keep backwards compatibility with pre-3.8)
self.deco_line: int | None = None
self.docstring: str | None = None
self.removed_statements = []
Expand Down
2 changes: 1 addition & 1 deletion mypy/plugins/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def find_shallow_matching_overload_item(overload: Overloaded, call: CallExpr) ->


def _get_callee_type(call: CallExpr) -> CallableType | None:
"""Return the type of the callee, regardless of its syntatic form."""
"""Return the type of the callee, regardless of its syntactic form."""

callee_node: Node | None = call.callee

Expand Down
2 changes: 1 addition & 1 deletion mypy/plugins/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def _implements_new(info: TypeInfo) -> bool:


def enum_member_callback(ctx: mypy.plugin.FunctionContext) -> Type:
"""By default `member(1)` will be infered as `member[int]`,
"""By default `member(1)` will be inferred as `member[int]`,
we want to improve the inference to be `Literal[1]` here."""
if ctx.arg_types or ctx.arg_types[0]:
arg = get_proper_type(ctx.arg_types[0][0])
Expand Down
4 changes: 2 additions & 2 deletions mypy/semanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -4034,7 +4034,7 @@ def analyze_type_alias_type_params(
) -> tuple[TypeVarLikeList, list[str]]:
"""Analyze type_params of TypeAliasType.
Returns declared unbound type variable expressions and a list of all decalred type
Returns declared unbound type variable expressions and a list of all declared type
variable names for error reporting.
"""
if "type_params" in rvalue.arg_names:
Expand Down Expand Up @@ -6038,7 +6038,7 @@ def visit_yield_expr(self, e: YieldExpr) -> None:
def visit_await_expr(self, expr: AwaitExpr) -> None:
if not self.is_func_scope() or not self.function_stack:
# We check both because is_function_scope() returns True inside comprehensions.
# This is not a blocker, because some enviroments (like ipython)
# This is not a blocker, because some environments (like ipython)
# support top level awaits.
self.fail('"await" outside function', expr, serious=True, code=codes.TOP_LEVEL_AWAIT)
elif not self.function_stack[-1].is_coroutine:
Expand Down
2 changes: 1 addition & 1 deletion mypy/semanal_namedtuple.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def check_namedtuple_classdef(
# Something is incomplete. We need to defer this named tuple.
return None
types.append(analyzed)
# ...despite possible minor failures that allow further analyzis.
# ...despite possible minor failures that allow further analysis.
if name.startswith("_"):
self.fail(
f"NamedTuple field name cannot start with an underscore: {name}", stmt
Expand Down
2 changes: 1 addition & 1 deletion mypy/semanal_newtype.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def analyze_newtype_declaration(self, s: AssignmentStmt) -> tuple[str | None, Ca
def check_newtype_args(
self, name: str, call: CallExpr, context: Context
) -> tuple[Type | None, bool]:
"""Ananlyze base type in NewType call.
"""Analyze base type in NewType call.
Return a tuple (type, should defer).
"""
Expand Down
4 changes: 2 additions & 2 deletions mypy/stubgenc.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def __init__(
self.module_name = module_name
if self.is_c_module:
# Add additional implicit imports.
# C-extensions are given more lattitude since they do not import the typing module.
# C-extensions are given more latitude since they do not import the typing module.
self.known_imports.update(
{
"typing": [
Expand Down Expand Up @@ -340,7 +340,7 @@ def get_pos_default(i: int, _arg: str) -> Any | None:
# Add *args if present
if varargs:
arglist.append(ArgSig(f"*{varargs}", get_annotation(varargs)))
# if we have keyword only args, then wee need to add "*"
# if we have keyword only args, then we need to add "*"
elif kwonlyargs:
arglist.append(ArgSig("*"))

Expand Down
2 changes: 1 addition & 1 deletion mypy/suggestions.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ def get_guesses_from_parent(self, node: FuncDef) -> list[CallableType]:
pnode = parent.names.get(node.name)
if pnode and isinstance(pnode.node, (FuncDef, Decorator)):
typ = get_proper_type(pnode.node.type)
# FIXME: Doesn't work right with generic tyeps
# FIXME: Doesn't work right with generic types
if isinstance(typ, CallableType) and len(typ.arg_types) == len(node.arguments):
# Return the first thing we find, since it probably doesn't make sense
# to grab things further up in the chain if an earlier parent has it.
Expand Down
16 changes: 8 additions & 8 deletions mypy/test/teststubgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/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(["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([r"foo/bar\x.pyi"]) == "foo"
assert common_dir_prefix([r"foo\bar/x.pyi"]) == r"foo\bar"

Expand All @@ -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\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\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\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"
Expand Down
4 changes: 2 additions & 2 deletions mypy/test/testtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.haa, self.fx_co.hao)
self.assert_join(self.fx_co.had, self.fx_co.has, 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)
Expand Down Expand Up @@ -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.haa, self.fx.hab)
self.assert_meet(self.fx.hab, self.fx.has, 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)

Expand Down
2 changes: 1 addition & 1 deletion mypy/test/typefixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.haa = Instance(self.hi, [self.a, self.a]) # H[A, A]
self.has = 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]
Expand Down
2 changes: 1 addition & 1 deletion mypy/test/update_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def _iter_fixes(
source_line = source_line[: comment_match.start("indent")] # strip old comment
if reports:
indent = comment_match.group("indent") if comment_match else " "
# multiline comments are on the first line and then on subsequent lines emtpy lines
# multiline comments are on the first line and then on subsequent lines empty lines
# with a continuation backslash
for j, (severity, msg) in enumerate(reports):
out_l = source_line if j == 0 else " " * len(source_line)
Expand Down
2 changes: 1 addition & 1 deletion mypy/typeanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,7 @@ def analyze_unbound_type_without_type_info(
elif unbound_tvar:
assert isinstance(sym.node, TypeVarLikeExpr)
if sym.node.is_new_style:
# PEP 695 type paramaters are never considered unbound -- they are undefined
# PEP 695 type parameters are never considered unbound -- they are undefined
# in contexts where they aren't valid, such as in argument default values.
message = 'Name "{}" is not defined'
name = name.split(".")[-1]
Expand Down
2 changes: 1 addition & 1 deletion mypyc/codegen/emit.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def attr(self, name: str) -> str:
return ATTR_PREFIX + name

def object_annotation(self, obj: object, line: str) -> str:
"""Build a C comment with an object's string represention.
"""Build a C comment with an object's string representation.
If the comment exceeds the line length limit, it's wrapped into a
multiline string (with the extra lines indented to be aligned with
Expand Down
2 changes: 1 addition & 1 deletion mypyc/codegen/emitmodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ def generate_export_table(self, decl_emitter: Emitter, code_emitter: Emitter) ->
copy the contents into a local copy of the table (to eliminate
the need for a pointer indirection when accessing it).
Then, all calls to functions in another group and accesses to statics
Then, all calls to functions in another group and accesses to statistics
from another group are done indirectly via the export table.
For example, a group containing a module b, where b contains a class B
Expand Down
2 changes: 1 addition & 1 deletion mypyc/doc/dev-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ under `mypyc/lib-rt`.

## Inspecting Generated C

It's often useful to inspect the C code genenerate by mypyc to debug
It's often useful to inspect the C code generate by mypyc to debug
issues. Mypyc stores the generated C code as `build/__native.c`.
Compiled native functions have the prefix `CPyDef_`, while wrapper
functions used for calling functions from interpreted Python code have
Expand Down
2 changes: 1 addition & 1 deletion mypyc/ir/module_ir.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __init__(
self.functions = functions
self.classes = classes
self.final_names = final_names
# Names of C statics used for Python 3.12 type variable objects.
# Names of C statistics used for Python 3.12 type variable objects.
# These are only visible in the module that defined them, so no need
# to serialize.
self.type_var_names = type_var_names
Expand Down
8 changes: 4 additions & 4 deletions mypyc/ir/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ def accept(self, visitor: OpVisitor[T]) -> T:
return visitor.visit_set_attr(self)


# Default name space for statics, variables
# Default name space for statistics, variables
NAMESPACE_STATIC: Final = "static"

# Static namespace for pointers to native type objects
Expand All @@ -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 statics is shared
Load a C static variable/pointer. The namespace for statistics 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 statics.
avoided with other statistics.
"""

error_kind = ERR_NEVER
Expand Down Expand Up @@ -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 statics.)
for statistics.)
"""

error_kind = ERR_NEVER
Expand Down
4 changes: 2 additions & 2 deletions mypyc/irbuild/classdef.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ def populate_non_ext_bases(builder: IRBuilder, cdef: ClassDef) -> Value:
"typing.Container",
"typing.Sized",
):
# HAX: Synthesized base classes added by mypy don't exist at runtime, so skip them.
# HEX: 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
Expand All @@ -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:
# HAX: Mypy internally represents TypedDict classes differently from what
# HEX: 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):
Expand Down
2 changes: 1 addition & 1 deletion mypyc/irbuild/expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 statics and not visible in Python namespaces.
# These are stored in C statistics and not visible in Python namespaces.
return builder.load_type_var(expr.node.name, expr.node.line)
if expr.node is None:
builder.add(
Expand Down
2 changes: 1 addition & 1 deletion mypyc/irbuild/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ def calculate_arg_defaults(
) -> None:
"""Calculate default argument values and store them.
They are stored in statics for top level functions and in
They are stored in statistics for top level functions and in
the function objects for nested functions (while constants are
still stored computed on demand).
"""
Expand Down
2 changes: 1 addition & 1 deletion mypyc/irbuild/ll_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1908,7 +1908,7 @@ def primitive_op(
)
return self.call_c(c_desc, args, line, result_type)

# This primitve gets transformed in a lowering pass to
# This primitive gets transformed in a lowering pass to
# lower-level IR ops using a custom transform function.

coerced = []
Expand Down
2 changes: 1 addition & 1 deletion mypyc/irbuild/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def visit_or_pattern(self, pattern: OrPattern) -> None:

def visit_class_pattern(self, pattern: ClassPattern) -> None:
# TODO: use faster instance check for native classes (while still
# making sure to account for inheritence)
# making sure to account for inheritance)
isinstance_op = (
fast_isinstance_op
if self.builder.is_builtin_ref_expr(pattern.class_ref)
Expand Down
Loading

0 comments on commit 5c33478

Please sign in to comment.