Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed spelling issues. #17774

Closed
wants to merge 12 commits into from
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."""
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this refers to "yield from" (https://docs.python.org/3/whatsnew/3.3.html#pep-380), so it's written as intended?

Copy link
Sponsor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like "from" is the correct terminology as per PEP 380 (https://docs.python.org/3/whatsnew/3.3.html#pep-380), so the original phrasing is accurate. The update might not be necessary.


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
2 changes: 1 addition & 1 deletion mypy/nodes.py
Original file line number Diff line number Diff line change
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
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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this refers to "C statics" as in "C static variables". That terminology is used elsewhere in mypyc (example), so I think this is written as intended

Copy link
Sponsor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing that out! I'll leave it as is since "statics" seems to be the correct terminology.

# These are only visible in the module that defined them, so no need
# to serialize.
self.type_var_names = type_var_names
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