From 6e25bcab812806d2908d470046ddb3f81b82a706 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sun, 9 Feb 2025 14:58:06 +0100 Subject: [PATCH] Fix spelling Co-authored-by: Christian Clauss --- docs/source/generics.rst | 2 +- docs/source/more_types.rst | 2 +- docs/source/runtime_troubles.rst | 2 +- mypy/argmap.py | 2 +- mypy/checkexpr.py | 2 +- mypy/constraints.py | 2 +- mypy/inspections.py | 2 +- mypy/join.py | 2 +- mypy/messages.py | 2 +- mypy/semanal_namedtuple.py | 2 +- mypy/semanal_newtype.py | 2 +- mypy/stubgenc.py | 2 +- mypy/suggestions.py | 2 +- mypy/type_visitor.py | 4 ++-- mypyc/codegen/emitfunc.py | 2 +- mypyc/doc/dev-intro.md | 8 ++++---- mypyc/irbuild/prebuildvisitor.py | 2 +- mypyc/test/test_run.py | 2 +- test-data/unit/stubgen.test | 2 +- 19 files changed, 23 insertions(+), 23 deletions(-) diff --git a/docs/source/generics.rst b/docs/source/generics.rst index 731365d3789b..15538dea13bf 100644 --- a/docs/source/generics.rst +++ b/docs/source/generics.rst @@ -999,7 +999,7 @@ similarly supported via generics (Python 3.12 syntax): .. code-block:: python - from colletions.abc import Callable + from collections.abc import Callable from typing import Any def route[F: Callable[..., Any]](url: str) -> Callable[[F], F]: diff --git a/docs/source/more_types.rst b/docs/source/more_types.rst index cbf40d5dcaa5..0383c3448d06 100644 --- a/docs/source/more_types.rst +++ b/docs/source/more_types.rst @@ -390,7 +390,7 @@ program: The ``summarize([])`` call matches both variants: an empty list could be either a ``list[int]`` or a ``list[str]``. In this case, mypy will break the tie by picking the first matching variant: ``output`` -will have an inferred type of ``float``. The implementor is responsible +will have an inferred type of ``float``. The implementer is responsible for making sure ``summarize`` breaks ties in the same way at runtime. However, there are two exceptions to the "pick the first match" rule. diff --git a/docs/source/runtime_troubles.rst b/docs/source/runtime_troubles.rst index d63d0f9a74ae..b61f0048dd0a 100644 --- a/docs/source/runtime_troubles.rst +++ b/docs/source/runtime_troubles.rst @@ -274,7 +274,7 @@ libraries if types are generic only in stubs. Using types defined in stubs but not at runtime ----------------------------------------------- -Sometimes stubs that you're using may define types you wish to re-use that do +Sometimes stubs that you're using may define types you wish to reuse that do not exist at runtime. Importing these types naively will cause your code to fail at runtime with ``ImportError`` or ``ModuleNotFoundError``. Similar to previous sections, these can be dealt with by using :ref:`typing.TYPE_CHECKING diff --git a/mypy/argmap.py b/mypy/argmap.py index c863844f90ad..8db78b5413e8 100644 --- a/mypy/argmap.py +++ b/mypy/argmap.py @@ -220,7 +220,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) diff --git a/mypy/checkexpr.py b/mypy/checkexpr.py index 286ef0dab6ae..963667188d6c 100644 --- a/mypy/checkexpr.py +++ b/mypy/checkexpr.py @@ -3184,7 +3184,7 @@ def combine_function_signatures(self, types: list[ProperType]) -> AnyType | Call new_type_narrowers.append(target.type_is) if new_type_guards and new_type_narrowers: - # They cannot be definined at the same time, + # They cannot be defined at the same time, # declaring this function as too complex! too_complex = True union_type_guard = None diff --git a/mypy/constraints.py b/mypy/constraints.py index defcac21bc66..3c0d08089722 100644 --- a/mypy/constraints.py +++ b/mypy/constraints.py @@ -385,7 +385,7 @@ def _infer_constraints( res = [] for a_item in actual.items: # `orig_template` has to be preserved intact in case it's recursive. - # If we unwraped ``type[...]`` previously, wrap the item back again, + # If we unwrapped ``type[...]`` previously, wrap the item back again, # as ``type[...]`` can't be removed from `orig_template`. if type_type_unwrapped: a_item = TypeType.make_normalized(a_item) diff --git a/mypy/inspections.py b/mypy/inspections.py index bc76ab247901..ac48fac56fa4 100644 --- a/mypy/inspections.py +++ b/mypy/inspections.py @@ -564,7 +564,7 @@ def run_inspection( ) -> dict[str, object]: """Top-level logic to inspect expression(s) at a location. - This can be re-used by various simple inspections. + This can be reused by various simple inspections. """ try: file, pos = parse_location(location) diff --git a/mypy/join.py b/mypy/join.py index a5c30b4b835d..9a13dfb42b64 100644 --- a/mypy/join.py +++ b/mypy/join.py @@ -451,7 +451,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) diff --git a/mypy/messages.py b/mypy/messages.py index 3beb287bcc21..9315e77dfd98 100644 --- a/mypy/messages.py +++ b/mypy/messages.py @@ -215,7 +215,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() diff --git a/mypy/semanal_namedtuple.py b/mypy/semanal_namedtuple.py index a18d0591364c..b67747d16887 100644 --- a/mypy/semanal_namedtuple.py +++ b/mypy/semanal_namedtuple.py @@ -198,7 +198,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 diff --git a/mypy/semanal_newtype.py b/mypy/semanal_newtype.py index c9c0c46f7aee..0c717b5d9a0e 100644 --- a/mypy/semanal_newtype.py +++ b/mypy/semanal_newtype.py @@ -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). """ diff --git a/mypy/stubgenc.py b/mypy/stubgenc.py index 694be8e4beda..b5bb4f8f727b 100755 --- a/mypy/stubgenc.py +++ b/mypy/stubgenc.py @@ -341,7 +341,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("*")) diff --git a/mypy/suggestions.py b/mypy/suggestions.py index 36dc7e8e2acd..16e630bf8c6e 100644 --- a/mypy/suggestions.py +++ b/mypy/suggestions.py @@ -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. diff --git a/mypy/type_visitor.py b/mypy/type_visitor.py index d935b9a47a51..ab1ec8b46fdd 100644 --- a/mypy/type_visitor.py +++ b/mypy/type_visitor.py @@ -344,7 +344,7 @@ class TypeQuery(SyntheticTypeVisitor[T]): common use cases involve a boolean query using `any` or `all`. Note: this visitor keeps an internal state (tracks type aliases to avoid - recursion), so it should *never* be re-used for querying different types, + recursion), so it should *never* be reused for querying different types, create a new visitor instance instead. # TODO: check that we don't have existing violations of this rule. @@ -467,7 +467,7 @@ class BoolTypeQuery(SyntheticTypeVisitor[bool]): be ANY_STRATEGY or ALL_STRATEGY. Note: This visitor keeps an internal state (tracks type aliases to avoid - recursion), so it should *never* be re-used for querying different types + recursion), so it should *never* be reused for querying different types unless you call reset() first. """ diff --git a/mypyc/codegen/emitfunc.py b/mypyc/codegen/emitfunc.py index 7239e0835da0..c854516825af 100644 --- a/mypyc/codegen/emitfunc.py +++ b/mypyc/codegen/emitfunc.py @@ -152,7 +152,7 @@ def generate_native_function( # generates them will add instructions between the branch and the # next label, causing the label to be wrongly removed. A better # solution would be to change the IR so that it adds a basic block - # inbetween the calls. + # in between the calls. is_problematic_op = isinstance(terminator, Branch) and any( isinstance(s, GetAttr) for s in terminator.sources() ) diff --git a/mypyc/doc/dev-intro.md b/mypyc/doc/dev-intro.md index a8a04a297688..5f6c064dac37 100644 --- a/mypyc/doc/dev-intro.md +++ b/mypyc/doc/dev-intro.md @@ -229,7 +229,7 @@ pretty-printed IR into `build/ops.txt`. This is the final IR that includes the output from exception and reference count handling insertion passes. -We also have tests that verify the generate IR +We also have tests that verify the generated IR (`mypyc/test-data/irbuild-*.text`). ## Type-checking Mypyc @@ -290,7 +290,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 generated 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 @@ -386,7 +386,7 @@ Test cases can also have a `[out]` section, which specifies the expected contents of stdout the test case should produce. New test cases should prefer assert statements to `[out]` sections. -### Debuggging Segfaults +### Debugging Segfaults If you experience a segfault, it's recommended to use a debugger that supports C, such as gdb or lldb, to look into the segfault. @@ -409,7 +409,7 @@ Program received signal SIGSEGV, Segmentation fault. ``` You must use `-n0 -s` to enable interactive input to the debugger. -Instad of `gdb`, you can also try `lldb` (especially on macOS). +Instead of `gdb`, you can also try `lldb` (especially on macOS). To get better C stack tracebacks and more assertions in the Python runtime, you can build Python in debug mode and use that to run tests, diff --git a/mypyc/irbuild/prebuildvisitor.py b/mypyc/irbuild/prebuildvisitor.py index 17f907d42111..5f178a290138 100644 --- a/mypyc/irbuild/prebuildvisitor.py +++ b/mypyc/irbuild/prebuildvisitor.py @@ -73,7 +73,7 @@ def __init__( self.decorators_to_remove: dict[FuncDef, list[int]] = decorators_to_remove # A mapping of import groups (a series of Import nodes with - # nothing inbetween) where each group is keyed by its first + # nothing in between) where each group is keyed by its first # import node. self.module_import_groups: dict[Import, list[Import]] = {} self._current_import_group: Import | None = None diff --git a/mypyc/test/test_run.py b/mypyc/test/test_run.py index 6dfa7819e585..35598b24bce8 100644 --- a/mypyc/test/test_run.py +++ b/mypyc/test/test_run.py @@ -344,7 +344,7 @@ def run_case_step(self, testcase: DataDrivenTestCase, incremental_step: int) -> f'hint: Use "pytest -n0 -s --mypyc-debug={debugger} -k " to run test in debugger' ) print("hint: You may need to build a debug version of Python first and use it") - print('hint: See also "Debuggging Segfaults" in mypyc/doc/dev-intro.md') + print('hint: See also "Debugging Segfaults" in mypyc/doc/dev-intro.md') copy_output_files(mypyc_output_dir) # Verify output. diff --git a/test-data/unit/stubgen.test b/test-data/unit/stubgen.test index 5c0d2d6f8e00..bf17c34b99a7 100644 --- a/test-data/unit/stubgen.test +++ b/test-data/unit/stubgen.test @@ -4270,7 +4270,7 @@ class Y(missing.Base): generated_kwargs_: float [case testDataclassTransform] -# dataclass_transform detection only works with sementic analysis. +# dataclass_transform detection only works with semantic analysis. # Test stubgen doesn't break too badly without it. from typing_extensions import dataclass_transform