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

Fix typos #18317

Merged
merged 1 commit into from
Dec 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ This was contributed by Marc Mueller (PR [18014](https://github.com/python/mypy/
* Improve contributor documentation for Windows (ag-tafe, PR [18097](https://github.com/python/mypy/pull/18097))
* Correct note about `--disallow-any-generics` flag in documentation (Abel Sen, PR [18055](https://github.com/python/mypy/pull/18055))
* Further caution against `--follow-imports=skip` (Shantanu, PR [18048](https://github.com/python/mypy/pull/18048))
* Fix the edit page buttton link in documentation (Kanishk Pachauri, PR [17933](https://github.com/python/mypy/pull/17933))
* Fix the edit page button link in documentation (Kanishk Pachauri, PR [17933](https://github.com/python/mypy/pull/17933))

### Other Notables Fixes and Improvements

Expand Down Expand Up @@ -751,7 +751,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 CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ articulated in the [Python Community Code of Conduct](https://www.python.org/psf

#### (1) Fork the mypy repository

Within Github, navigate to <https://github.com/python/mypy> and fork the repository.
Within GitHub, navigate to <https://github.com/python/mypy> and fork the repository.

#### (2) Clone the mypy repository and enter into it

Expand Down
2 changes: 1 addition & 1 deletion docs/source/common_issues.rst
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ type check such code. Consider this example:
x: int = 'abc' # Unreachable -- no error

It's easy to see that any statement after ``return`` is unreachable,
and hence mypy will not complain about the mis-typed code below
and hence mypy will not complain about the mistyped code below
it. For a more subtle example, consider this code:

.. code-block:: python
Expand Down
2 changes: 1 addition & 1 deletion misc/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Why use Docker?
Mypyc tests can be significantly faster in a Docker container than
running natively on macOS.

Also, if it's inconvient to install the necessary dependencies on the
Also, if it's inconvenient to install the necessary dependencies on the
host operating system, or there are issues getting some tests to pass
on the host operating system, using a container can be an easy
workaround.
Expand Down
2 changes: 1 addition & 1 deletion misc/trigger_wheel_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Trigger a build of mypyc compiled mypy wheels by updating the mypy
# submodule in the git repo that drives those builds.

# $WHEELS_PUSH_TOKEN is stored in Github Settings and is an API token
# $WHEELS_PUSH_TOKEN is stored in GitHub Settings and is an API token
# for the mypy-build-bot account.

git config --global user.email "nobody"
Expand Down
6 changes: 3 additions & 3 deletions mypy/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -2594,7 +2594,7 @@ def check_enum(self, defn: ClassDef) -> None:
if isinstance(sym.node, Var) and sym.node.has_explicit_value:
# `__members__` will always be overwritten by `Enum` and is considered
# read-only so we disallow assigning a value to it
self.fail(message_registry.ENUM_MEMBERS_ATTR_WILL_BE_OVERRIDEN, sym.node)
self.fail(message_registry.ENUM_MEMBERS_ATTR_WILL_BE_OVERRIDDEN, sym.node)
for base in defn.info.mro[1:-1]: # we don't need self and `object`
if base.is_enum and base.fullname not in ENUM_BASES:
self.check_final_enum(defn, base)
Expand Down Expand Up @@ -3642,7 +3642,7 @@ def is_assignable_slot(self, lvalue: Lvalue, typ: Type | None) -> bool:

typ = get_proper_type(typ)
if typ is None or isinstance(typ, AnyType):
return True # Any can be literally anything, like `@propery`
return True # Any can be literally anything, like `@property`
if isinstance(typ, Instance):
# When working with instances, we need to know if they contain
# `__set__` special method. Like `@property` does.
Expand Down Expand Up @@ -8519,7 +8519,7 @@ def group_comparison_operands(

x0 == x1 == x2 < x3 < x4 is x5 is x6 is not x7 is not x8

If we get these expressions in a pairwise way (e.g. by calling ComparisionExpr's
If we get these expressions in a pairwise way (e.g. by calling ComparisonExpr's
'pairwise()' method), we get the following as input:

[('==', x0, x1), ('==', x1, x2), ('<', x2, x3), ('<', x3, x4),
Expand Down
4 changes: 2 additions & 2 deletions mypy/checkexpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,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 Expand Up @@ -5353,7 +5353,7 @@ def visit_lambda_expr(self, e: LambdaExpr) -> Type:
can_skip=True, fall_through=0
), self.chk.scope.push_function(e):
# Lambdas can have more than one element in body,
# when we add "fictional" AssigmentStatement nodes, like in:
# when we add "fictional" AssignmentStatement nodes, like in:
# `lambda (a, b): a`
for stmt in e.body.body[:-1]:
stmt.accept(self.chk)
Expand Down
2 changes: 1 addition & 1 deletion mypy/dmypy_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ def refresh_file(module: str, path: str) -> list[str]:
find_changes_time=t1 - t0,
fg_update_time=t2 - t1,
refresh_suppressed_time=t3 - t2,
find_added_supressed_time=t4 - t3,
find_added_suppressed_time=t4 - t3,
cleanup_time=t5 - t4,
)

Expand Down
2 changes: 1 addition & 1 deletion mypy/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ class Errors:
show_column_numbers: bool = False

# Set to True to show end line and end column in error messages.
# Ths implies `show_column_numbers`.
# This implies `show_column_numbers`.
show_error_end: bool = False

# Set to True to show absolute file paths in error messages.
Expand Down
2 changes: 1 addition & 1 deletion mypy/inspections.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ def expr_attrs(self, expression: Expression) -> tuple[str, bool]:
node = expression.node
names = sorted(node.names)
if "__builtins__" in names:
# This is just to make tests stable. No one will really need ths name.
# This is just to make tests stable. No one will really need this name.
names.remove("__builtins__")
mod_dict = {f'"<{node.fullname}>"': [f'"{name}"' for name in names]}
else:
Expand Down
2 changes: 1 addition & 1 deletion mypy/message_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def with_additional_msg(self, info: str) -> ErrorMessage:
CANNOT_MAKE_DELETABLE_FINAL: Final = ErrorMessage("Deletable attribute cannot be final")

# Enum
ENUM_MEMBERS_ATTR_WILL_BE_OVERRIDEN: Final = ErrorMessage(
ENUM_MEMBERS_ATTR_WILL_BE_OVERRIDDEN: Final = ErrorMessage(
'Assigned "__members__" will be overridden by "Enum" internally'
)

Expand Down
2 changes: 1 addition & 1 deletion mypy/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1179,7 +1179,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 backward 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
6 changes: 3 additions & 3 deletions mypy/semanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -4169,7 +4169,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 @@ -4435,7 +4435,7 @@ def make_name_lvalue_var(
if kind != LDEF:
v._fullname = self.qualified_name(name)
else:
# fullanme should never stay None
# fullname should never stay None
v._fullname = name
v.is_ready = False # Type not inferred yet
v.has_explicit_value = has_explicit_value
Expand Down Expand Up @@ -6217,7 +6217,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/solve.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def solve_with_dependent(
* Find dependencies between type variables, group them in SCCs, and sort topologically
* Check that all SCC are intrinsically linear, we can't solve (express) T <: List[T]
* Variables in leaf SCCs that don't have constant bounds are free (choose one per SCC)
* Solve constraints iteratively starting from leafs, updating bounds after each step.
* Solve constraints iteratively starting from leaves, updating bounds after each step.
"""
graph, lowers, uppers = transitive_closure(vars, constraints)

Expand Down
2 changes: 1 addition & 1 deletion 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
4 changes: 2 additions & 2 deletions mypy/test/testconstraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def test_type_var_tuple_with_prefix_and_suffix(self) -> None:
Constraint(type_var=fx.s, op=SUPERTYPE_OF, target=fx.d),
}

def test_unpack_homogenous_tuple(self) -> None:
def test_unpack_homogeneous_tuple(self) -> None:
fx = self.fx
assert set(
infer_constraints(
Expand All @@ -77,7 +77,7 @@ def test_unpack_homogenous_tuple(self) -> None:
Constraint(type_var=fx.t, op=SUBTYPE_OF, target=fx.b),
}

def test_unpack_homogenous_tuple_with_prefix_and_suffix(self) -> None:
def test_unpack_homogeneous_tuple_with_prefix_and_suffix(self) -> None:
fx = self.fx
assert set(
infer_constraints(
Expand Down
2 changes: 1 addition & 1 deletion mypy/test/testinfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ def test_single_pair(self) -> None:
)

def test_empty_pair_list(self) -> None:
# This case should never occur in practice -- ComparisionExprs
# This case should never occur in practice -- ComparisonExprs
# always contain at least one comparison. But in case it does...

self.assertEqual(group_comparison_operands([], {}, set()), [])
Expand Down
6 changes: 3 additions & 3 deletions mypy/test/testpythoneval.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ def test_python_evaluation(testcase: DataDrivenTestCase, cache_dir: str) -> None
additional_flags = m.group(1).split()
for flag in additional_flags:
if flag.startswith("--python-version="):
targetted_python_version = flag.split("=")[1]
targetted_major, targetted_minor = targetted_python_version.split(".")
if (int(targetted_major), int(targetted_minor)) > (
targeted_python_version = flag.split("=")[1]
targeted_major, targeted_minor = targeted_python_version.split(".")
if (int(targeted_major), int(targeted_minor)) > (
sys.version_info.major,
sys.version_info.minor,
):
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 @@ -1000,7 +1000,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 mypy/typeshed/stdlib/_tkinter.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class TkappType:
def mainloop(self, threshold: int = 0, /): ...
def quit(self): ...
def record(self, script, /): ...
def setvar(self, *ags, **kwargs): ...
def setvar(self, *args, **kwargs): ...
if sys.version_info < (3, 11):
def split(self, arg, /): ...

Expand Down
2 changes: 1 addition & 1 deletion mypy/typeshed/stdlib/email/message.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class MIMEPart(Message[_HeaderRegistryT, _HeaderRegistryParamT]):
def attach(self, payload: Self) -> None: ... # type: ignore[override]
# The attachments are created via type(self) in the attach method. It's theoretically
# possible to sneak other attachment types into a MIMEPart instance, but could cause
# cause unforseen consequences.
# cause unforeseen consequences.
def iter_attachments(self) -> Iterator[Self]: ...
def iter_parts(self) -> Iterator[MIMEPart[_HeaderRegistryT]]: ...
def get_content(self, *args: Any, content_manager: ContentManager | None = None, **kw: Any) -> Any: ...
Expand Down
4 changes: 2 additions & 2 deletions mypyc/analysis/attrdefined.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def analyze_always_defined_attrs_in_class(cl: ClassIR, seen: set[ClassIR]) -> No
m.blocks, self_reg, maybe_defined, dirty
)

mark_attr_initialiation_ops(m.blocks, self_reg, maybe_defined, dirty)
mark_attr_initialization_ops(m.blocks, self_reg, maybe_defined, dirty)

# Check if __init__ can run unpredictable code (leak 'self').
any_dirty = False
Expand Down Expand Up @@ -260,7 +260,7 @@ def find_sometimes_defined_attributes(
return attrs


def mark_attr_initialiation_ops(
def mark_attr_initialization_ops(
blocks: list[BasicBlock],
self_reg: Register,
maybe_defined: AnalysisResult[str],
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
4 changes: 2 additions & 2 deletions mypyc/irbuild/ll_builder.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""A "low-level" IR builder class.

See the docstring of class LowLevelIRBuiler for more information.
See the docstring of class LowLevelIRBuilder for more information.

"""

Expand Down Expand Up @@ -439,7 +439,7 @@ def coerce_int_to_fixed_width(self, src: Value, target_type: RType, line: int) -

size = target_type.size
if size < int_rprimitive.size:
# Add a range check when the target type is smaller than the source tyoe
# Add a range check when the target type is smaller than the source type
fast2, fast3 = BasicBlock(), BasicBlock()
upper_bound = 1 << (size * 8 - 1)
if not target_type.is_signed:
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
4 changes: 2 additions & 2 deletions mypyc/lib-rt/CPy.h
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ static inline PyObject *_CPy_FromDummy(PyObject *p) {
return p;
}

static int CPy_NoErrOccured(void) {
static int CPy_NoErrOccurred(void) {
return PyErr_Occurred() == NULL;
}

Expand Down Expand Up @@ -856,7 +856,7 @@ PyObject *CPy_FetchStopIterationValue(void);
PyObject *CPyType_FromTemplate(PyObject *template_,
PyObject *orig_bases,
PyObject *modname);
PyObject *CPyType_FromTemplateWarpper(PyObject *template_,
PyObject *CPyType_FromTemplateWrapper(PyObject *template_,
PyObject *orig_bases,
PyObject *modname);
int CPyDataclass_SleightOfHand(PyObject *dataclass_dec, PyObject *tp,
Expand Down
2 changes: 1 addition & 1 deletion mypyc/lib-rt/int_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ CPyTagged CPyTagged_Add_(CPyTagged left, CPyTagged right) {
return CPyTagged_StealFromObject(result);
}

// Tagged int subraction slow path, where the result may be a long integer
// Tagged int subtraction slow path, where the result may be a long integer
CPyTagged CPyTagged_Subtract_(CPyTagged left, CPyTagged right) {
PyObject *left_obj = CPyTagged_AsObject(left);
PyObject *right_obj = CPyTagged_AsObject(right);
Expand Down
4 changes: 2 additions & 2 deletions mypyc/lib-rt/misc_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ PyObject *CPySingledispatch_RegisterFunction(PyObject *singledispatch_func,

}

// Adapated from ceval.c GET_AITER
// Adapted from ceval.c GET_AITER
PyObject *CPy_GetAIter(PyObject *obj)
{
unaryfunc getter = NULL;
Expand Down Expand Up @@ -935,7 +935,7 @@ PyObject *CPy_GetAIter(PyObject *obj)
return iter;
}

// Adapated from ceval.c GET_ANEXT
// Adapted from ceval.c GET_ANEXT
PyObject *CPy_GetANext(PyObject *aiter)
{
unaryfunc getter = NULL;
Expand Down
2 changes: 1 addition & 1 deletion mypyc/primitives/exc_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
no_err_occurred_op = custom_op(
arg_types=[],
return_type=bit_rprimitive,
c_function_name="CPy_NoErrOccured",
c_function_name="CPy_NoErrOccurred",
error_kind=ERR_FALSE,
)

Expand Down
2 changes: 1 addition & 1 deletion mypyc/primitives/set_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# Get the 'builtins.set' type object.
load_address_op(name="builtins.set", type=object_rprimitive, src="PySet_Type")

# Get the 'builtins.frozenset' tyoe object.
# Get the 'builtins.frozenset' type object.
load_address_op(name="builtins.frozenset", type=object_rprimitive, src="PyFrozenSet_Type")

# Construct an empty set.
Expand Down
Loading
Loading