Repository Analysis

python/mypy

Optional static typing for Python

13.0 Low AI signal View on GitHub
13.0
Adjusted Score
13.0
Raw Score
100%
Time Factor
2026-05-29
Last Push
20,452
Stars
Python
Language
238,088
Lines of Code
634
Files
3016
Pattern Hits
2026-05-31
Scan Date

Score History

Severity Breakdown

CRITICAL 2HIGH 52MEDIUM 64LOW 2898

Pattern Findings

3016 matches across 15 categories. Click a row to expand file-level details.

Hyper-Verbose Identifiers1200 hits · 1045 pts
SeverityFileLineSnippet
LOWsetup.py30def is_list_of_setuptools_extension(items: list[Any]) -> TypeGuard[list[Extension]]:
LOWmisc/incremental_checker.py86def ensure_environment_is_ready(mypy_path: str, temp_repo_path: str, mypy_cache_path: str) -> None:
LOWmisc/generate_changelog.py12def find_all_release_branches() -> list[tuple[int, int]]:
LOWmisc/generate_changelog.py108def filter_out_commits_from_old_release_branch(
LOWmisc/generate_changelog.py126def find_changes_between_releases(old_branch: str, new_branch: str) -> list[CommitInfo]:
LOWmisc/upload-pypi.py65def download_all_release_assets(release: dict[str, Any], dst: Path) -> None:
LOWmisc/sync-typeshed.py90def create_or_update_pull_request(*, title: str, body: str, branch_name: str) -> None:
LOWmypyc/build.py249def generate_c_extension_shim(
LOWmypyc/build.py457def _patch_setuptools_copy_extensions_to_source() -> None:
LOWmypyc/annotate.py275 def visit_dictionary_comprehension(self, o: DictionaryComprehension, /) -> None:
LOWmypyc/namegen.py104def make_module_translation_map(names: list[str]) -> dict[str, str]:
LOWmypyc/irbuild/vec.py281def vec_check_and_adjust_index(
LOWmypyc/irbuild/ll_builder.py512 def coerce_int_to_fixed_width(self, src: Value, target_type: RType, line: int) -> Value:
LOWmypyc/irbuild/ll_builder.py607 def coerce_tagged_to_fixed_width_with_range_check(
LOWmypyc/irbuild/ll_builder.py658 def emit_fixed_width_overflow_error(self, target_type: RType, line: int) -> None:
LOWmypyc/irbuild/ll_builder.py670 def coerce_short_int_to_fixed_width(self, src: Value, target_type: RType, line: int) -> Value:
LOWmypyc/irbuild/ll_builder.py697 def coerce_fixed_width_to_int(self, src: Value, line: int) -> Value:
LOWmypyc/irbuild/ll_builder.py1301 def native_args_to_positional(
LOWmypyc/irbuild/ll_builder.py1844 def translate_instance_contains(self, inst: Value, item: Value, op: str, line: int) -> Value:
LOWmypyc/irbuild/ll_builder.py1867 def _non_specialized_unary_op(self, value: Value, op: str, line: int) -> Value:
LOWmypyc/irbuild/ll_builder.py2607 def inline_fixed_width_divide(self, type: RType, lhs: Value, rhs: Value, line: int) -> Value:
LOWmypyc/irbuild/ll_builder.py2741 def set_immortal_if_free_threaded(self, v: Value, line: int) -> None:
LOWmypyc/irbuild/ll_builder.py2811 def translate_special_method_call(
LOWmypyc/irbuild/ll_builder.py2839 def _translate_special_low_level_method_call(
LOWmypyc/irbuild/ll_builder.py2921 def _translate_fast_optional_eq_cmp(
LOWmypyc/irbuild/util.py191def get_explicit_native_class(path: str, cdef: ClassDef, errors: Errors) -> bool | None:
LOWmypyc/irbuild/util.py222def is_implicit_extension_class(cdef: ClassDef) -> tuple[bool, str]:
LOWmypyc/irbuild/mapper.py243 def is_native_module_ref_expr(self, expr: RefExpr) -> bool:
LOWmypyc/irbuild/prebuildvisitor.py36def _comprehension_has_lambda(node: GeneratorExpr | DictionaryComprehension) -> bool:
LOWmypyc/irbuild/prebuildvisitor.py200 def _visit_comprehension_with_scope(self, o: GeneratorExpr | DictionaryComprehension) -> None:
LOWmypyc/irbuild/prebuildvisitor.py243 def visit_dictionary_comprehension(self, o: DictionaryComprehension) -> None:
LOWmypyc/irbuild/env_class.py277def setup_func_for_recursive_call(
LOWmypyc/irbuild/format_str_tokenizer.py135def convert_format_expr_to_str(
LOWmypyc/irbuild/format_str_tokenizer.py211def convert_format_expr_to_bytes(
LOWmypyc/irbuild/statement.py158def transform_expression_stmt(builder: IRBuilder, stmt: ExpressionStmt) -> None:
LOWmypyc/irbuild/statement.py177def check_unsupported_cls_assignment(builder: IRBuilder, stmt: AssignmentStmt) -> None:
LOWmypyc/irbuild/statement.py209def transform_assignment_stmt(builder: IRBuilder, stmt: AssignmentStmt) -> None:
LOWmypyc/irbuild/statement.py285def transform_operator_assignment_stmt(builder: IRBuilder, stmt: OperatorAssignmentStmt) -> None:
LOWmypyc/irbuild/statement.py310def import_globals_id_and_name(module_id: str, as_name: str | None) -> tuple[str, str]:
LOWmypyc/irbuild/statement.py371def split_import_group_to_python_and_native(
LOWmypyc/irbuild/statement.py398def transform_imports_without_grouping(
LOWmypyc/irbuild/statement.py414def transform_non_native_import_group(
LOWmypyc/irbuild/statement.py525def transform_import_from_buckets(
LOWmypyc/irbuild/statement.py754def transform_try_except_stmt(builder: IRBuilder, t: TryStmt) -> None:
LOWmypyc/irbuild/statement.py842def try_finally_resolve_control(
LOWmypyc/irbuild/statement.py892def transform_try_finally_stmt(
LOWmypyc/irbuild/statement.py929def transform_try_finally_stmt_async(
LOWmypyc/irbuild/statement.py1423def transform_yield_from_expr(builder: IRBuilder, o: YieldFromExpr) -> Value:
LOWmypyc/irbuild/statement.py1435def transform_type_alias_stmt(builder: IRBuilder, s: TypeAliasStmt) -> None:
LOWmypyc/irbuild/constant_fold.py80def constant_fold_binary_op_extended(
LOWmypyc/irbuild/ast_helpers.py56def maybe_process_conditional_comparison(
LOWmypyc/irbuild/builder.py360 def load_bytes_from_str_literal(self, value: str, line: int = -1) -> Value:
LOWmypyc/irbuild/builder.py465 def set_immortal_if_free_threaded(self, v: Value, line: int) -> None:
LOWmypyc/irbuild/builder.py593 def maybe_add_implicit_return(self) -> None:
LOWmypyc/irbuild/builder.py611 def disallow_class_assignments(self, lvalues: list[Lvalue], line: int) -> None:
LOWmypyc/irbuild/builder.py881 def process_sequence_assignment(
LOWmypyc/irbuild/builder.py911 def process_iterator_tuple_assignment_helper(
LOWmypyc/irbuild/builder.py926 def process_iterator_tuple_assignment(
LOWmypyc/irbuild/builder.py1057 def get_sequence_type_from_type(self, target_type: Type) -> RType:
LOWmypyc/irbuild/builder.py1093 def get_dict_base_type_from_type(self, target_type: Type) -> list[Instance]:
1140 more matches not shown…
Deep Nesting645 hits · 514 pts
SeverityFileLineSnippet
LOWmisc/apply-cache-diff.py34
LOWmisc/diff-cache.py154
LOWmisc/gen_blog_post_html.py40
LOWmypyc/build.py619
LOWmypyc/build.py678
LOWmypyc/build.py772
LOWmypyc/build.py862
LOWmypyc/subtype.py27
LOWmypyc/subtype.py65
LOWmypyc/annotate.py182
LOWmypyc/annotate.py299
LOWmypyc/annotate.py315
LOWmypyc/annotate.py359
LOWmypyc/build_setup.py35
LOWmypyc/sametype.py57
LOWmypyc/irbuild/vec.py209
LOWmypyc/irbuild/ll_builder.py405
LOWmypyc/irbuild/ll_builder.py896
LOWmypyc/irbuild/ll_builder.py1301
LOWmypyc/irbuild/ll_builder.py1566
LOWmypyc/irbuild/ll_builder.py1950
LOWmypyc/irbuild/ll_builder.py1990
LOWmypyc/irbuild/ll_builder.py2131
LOWmypyc/irbuild/ll_builder.py2303
LOWmypyc/irbuild/ll_builder.py2401
LOWmypyc/irbuild/ll_builder.py2539
LOWmypyc/irbuild/ll_builder.py2657
LOWmypyc/irbuild/util.py67
LOWmypyc/irbuild/util.py105
LOWmypyc/irbuild/util.py133
LOWmypyc/irbuild/util.py191
LOWmypyc/irbuild/mapper.py73
LOWmypyc/irbuild/prebuildvisitor.py148
LOWmypyc/irbuild/env_class.py236
LOWmypyc/irbuild/format_str_tokenizer.py48
LOWmypyc/irbuild/format_str_tokenizer.py135
LOWmypyc/irbuild/format_str_tokenizer.py211
LOWmypyc/irbuild/statement.py525
LOWmypyc/irbuild/statement.py1222
LOWmypyc/irbuild/constant_fold.py39
LOWmypyc/irbuild/builder.py1610
LOWmypyc/irbuild/builder.py684
LOWmypyc/irbuild/builder.py706
LOWmypyc/irbuild/builder.py824
LOWmypyc/irbuild/builder.py1057
LOWmypyc/irbuild/builder.py1301
LOWmypyc/irbuild/classdef.py90
LOWmypyc/irbuild/classdef.py567
LOWmypyc/irbuild/classdef.py743
LOWmypyc/irbuild/classdef.py836
LOWmypyc/irbuild/specialize.py720
LOWmypyc/irbuild/specialize.py809
LOWmypyc/irbuild/specialize.py872
LOWmypyc/irbuild/specialize.py940
LOWmypyc/irbuild/specialize.py992
LOWmypyc/irbuild/specialize.py1053
LOWmypyc/irbuild/specialize.py1073
LOWmypyc/irbuild/specialize.py1097
LOWmypyc/irbuild/specialize.py1307
LOWmypyc/irbuild/main.py58
585 more matches not shown…
Over-Commented Block536 hits · 480 pts
SeverityFileLineSnippet
LOWCHANGELOG.md2361 # Mypy will now issue a warning if it detects this
LOWtest-requirements.txt1#
LOWtest-requirements.txt21 # -r test-requirements.in
LOWtest-requirements.txt41 # via
LOWmisc/find_type.py1#!/usr/bin/env python3
LOWmisc/docker/run.sh1#!/bin/bash
LOWmypyc/options.py41 # even when its return type is just `bool`.
LOWmypyc/options.py61 # experimental mode (e.g. use _experimental suffix in librt run test).
LOWmypyc/irbuild/statement.py341 #
LOWmypyc/irbuild/callable_class.py221 # - A nested function: the callable class is instantiated
LOWmypyc/irbuild/specialize.py161# function. Specializers can return None to indicate that they failed
LOWmypyc/irbuild/for_helpers.py801 def init(self, expr_reg: Value, target_type: RType) -> None:
LOWmypyc/irbuild/function.py921 # typ.fullname contains the module where the class object was defined. However, it is possible
LOWmypyc/lib-rt/dict_ops.c1// Dict primitive operations
LOWmypyc/lib-rt/misc_ops.c1#include "pythoncapi_compat.h"
LOWmypyc/lib-rt/misc_ops.c1281 Py_DECREF(file);
LOWmypyc/lib-rt/CPy.h1// Mypyc C API
LOWmypyc/lib-rt/CPy.h21
LOWmypyc/lib-rt/pythoncapi_compat.h1// Header file providing new C API functions to old Python versions.
LOWmypyc/lib-rt/pythoncapi_compat.h21#include <Python.h>
LOWmypyc/lib-rt/pythoncapi_compat.h41# else
LOWmypyc/lib-rt/pythoncapi_compat.h101
LOWmypyc/lib-rt/pythoncapi_compat.h121# define Py_IsTrue(x) Py_Is(x, Py_True)
LOWmypyc/lib-rt/pythoncapi_compat.h541 return Py_NewRef(code->co_cellvars);
LOWmypyc/lib-rt/pythoncapi_compat.h1201
LOWmypyc/lib-rt/pythoncapi_compat.h1221
LOWmypyc/lib-rt/pythoncapi_compat.h1921 Py_DECREF(obj);
LOWmypyc/lib-rt/pythoncapi_compat.h1941# define Py_T_USHORT 10
LOWmypyc/lib-rt/str_extra_ops.c1#include "str_extra_ops.h"
LOWmypyc/lib-rt/stringwriter_extra_ops.c1// Primitives related to librt.strings.StringWriter that get linked statically
LOWmypyc/lib-rt/str_ops.c1#include "pythoncapi_compat.h"
LOWmypyc/lib-rt/getargs.c21 * programmatically and can be assumed valid.
LOWmypyc/lib-rt/getargs.c41#else
LOWmypyc/lib-rt/vecs_extra_ops.c1// Primitives related to librt.vecs that get linked statically
LOWmypyc/lib-rt/generic_ops.c1// Generic primitive operations
LOWmypyc/lib-rt/bytearray_extra_ops.h1#ifndef MYPYC_BYTEARRAY_EXTRA_OPS_H
LOWmypyc/lib-rt/pythonsupport.h1// Collects code that was copied in from cpython, for a couple of different reasons:
LOWmypyc/lib-rt/pythonsupport.h21#include "internal/pycore_genobject.h" // _PyGen_FetchStopIterationValue
LOWmypyc/lib-rt/int_ops.c1// Int primitive operations (tagged arbitrary-precision integers)
LOWmypyc/lib-rt/int_ops.c21
LOWmypyc/lib-rt/exc_ops.c201// to the internal C API: to the pycore_frame.h header file.
LOWmypyc/lib-rt/mypyc_util.h1#ifndef MYPYC_UTIL_H
LOWmypyc/lib-rt/mypyc_util.h21#define CPy_NOINLINE __declspec(noinline)
LOWmypyc/lib-rt/mypyc_util.h41// 3. GNU thread local storage for GCC/Clang targets that still need it
LOWmypyc/lib-rt/mypyc_util.h61 #define CPY_UNROLL_LOOP(n)
LOWmypyc/lib-rt/mypyc_util.h101
LOWmypyc/lib-rt/mypyc_util.h161#define CPY_3_12_FEATURES (PY_VERSION_HEX >= 0x030c0000)
LOWmypyc/lib-rt/mypyc_util.h181#define CPY_LONG_SIZE_SIGNED(o) (CPY_LONG_IS_NEGATIVE(o) ? -CPY_LONG_SIZE(o) : CPY_LONG_SIZE(o))
LOWmypyc/lib-rt/strings/librt_strings.c1#include "pythoncapi_compat.h"
LOWmypyc/lib-rt/strings/librt_strings_common.h1#ifndef LIBRT_STRINGS_COMMON_H
LOWmypyc/lib-rt/strings/librt_strings.h1#ifndef LIBRT_STRINGS_H
LOWmypyc/lib-rt/strings/librt_strings_api.h1#ifndef LIBRT_STRINGS_API_H
LOWmypyc/lib-rt/vecs/vec_i32.c1#define VEC VecI32
LOWmypyc/lib-rt/vecs/librt_vecs.c1// Definition of the mypyc.vecs module, which implements 'vec' and related functionality.
LOWmypyc/lib-rt/vecs/librt_vecs.c21// * In native code, a vec instance is an immutable value type with two fields
LOWmypyc/lib-rt/vecs/librt_vecs.c41// Implementation summary:
LOWmypyc/lib-rt/vecs/librt_vecs.c61// * A vec with a reference item type, such as vec[str], is often faster than a list,
LOWmypyc/lib-rt/vecs/vec_nested.c1// Implementation of nested vec[t], when t is a vec type.
LOWmypyc/lib-rt/vecs/vec_t.c1// Implementation of generic vec[t], when t is a plain type object (possibly optional).
LOWmypyc/lib-rt/vecs/vec_u8.c1#define VEC VecU8
476 more matches not shown…
Unused Imports372 hits · 366 pts
SeverityFileLineSnippet
LOWconftest.py1
LOWsetup.py3
LOWruntests.py3
LOWmisc/cherry-pick-typeshed.py8
LOWmisc/profile_check.py28
LOWmisc/incremental_checker.py34
LOWmisc/dump-ast.py6
LOWmisc/generate_changelog.py3
LOWmisc/apply-cache-diff.py10
LOWmisc/analyze_cache.py3
LOWmisc/upload-pypi.py8
LOWmisc/convert-cache.py8
LOWmisc/sync-typeshed.py10
LOWmisc/perf_compare.py20
LOWmisc/log_trace_check.py10
LOWmisc/perf_checker.py3
LOWmisc/diff-cache.py8
LOWmisc/find_type.py26
LOWmypyc/build.py21
LOWmypyc/build.py31
LOWmypyc/subtype.py3
LOWmypyc/options.py1
LOWmypyc/crash.py1
LOWmypyc/common.py1
LOWmypyc/build_setup.py11
LOWmypyc/errors.py1
LOWmypyc/sametype.py3
LOWmypyc/namegen.py1
LOWmypyc/rt_subtype.py16
LOWmypyc/__main__.py13
LOWmypyc/irbuild/vec.py3
LOWmypyc/irbuild/targets.py1
LOWmypyc/irbuild/ll_builder.py7
LOWmypyc/irbuild/util.py3
LOWmypyc/irbuild/vtable.py3
LOWmypyc/irbuild/mapper.py3
LOWmypyc/irbuild/prebuildvisitor.py1
LOWmypyc/irbuild/env_class.py18
LOWmypyc/irbuild/format_str_tokenizer.py3
LOWmypyc/irbuild/statement.py9
LOWmypyc/irbuild/constant_fold.py11
LOWmypyc/irbuild/ast_helpers.py7
LOWmypyc/irbuild/builder.py6
LOWmypyc/irbuild/classdef.py3
LOWmypyc/irbuild/generator.py11
LOWmypyc/irbuild/missingtypevisitor.py1
LOWmypyc/irbuild/visitor.py6
LOWmypyc/irbuild/context.py3
LOWmypyc/irbuild/nonlocalcontrol.py6
LOWmypyc/irbuild/callable_class.py7
LOWmypyc/irbuild/specialize.py15
LOWmypyc/irbuild/main.py23
LOWmypyc/irbuild/for_helpers.py8
LOWmypyc/irbuild/expression.py7
LOWmypyc/irbuild/prepare.py14
LOWmypyc/irbuild/function.py13
LOWmypyc/irbuild/match.py1
LOWmypyc/lib-rt/setup.py6
LOWmypyc/lib-rt/setup.py17
LOWmypyc/lib-rt/build_setup.py11
312 more matches not shown…
Cross-Language Confusion37 hits · 215 pts
SeverityFileLineSnippet
HIGHmypyc/irbuild/ll_builder.py1777 ComparisonOp(check_error_result, null, ComparisonOp.NEQ, line)
HIGHmypyc/irbuild/ll_builder.py918 null, don't put it in the dict.
HIGHmypyc/irbuild/function.py412 ComparisonOp(generic_getattr_result, null, ComparisonOp.NEQ, line)
HIGHmypyc/irbuild/function.py455 is_delattr = builder.add(ComparisonOp(value_arg, null, ComparisonOp.EQ, line))
HIGHmypyc/irbuild/function.py470 builder.call_c(generic_setattr, [builder.self(), attr_arg, null], line)
HIGHmypyc/analysis/attrdefined.py209 # If an attribute we *read* may be undefined, it isn't always defined.
HIGHmypyc/ir/rtypes.py83 # undefined, we can't just rely on the error value to signal this.
HIGHmypyc/codegen/emitmodule.py1551 return f"{emitter.ctype_spaced(typ)}{static_name} = {undefined};"
HIGHmypyc/codegen/emitfunc.py537 # previously undefined), so decref the old value.
HIGHmypyc/codegen/emit.py1100 self.emit_lines(f"if ({dest} == -1.0 && PyErr_Occurred()) {{", failure, "}")
HIGHmypyc/transform/spill.py81 block.ops.extend([null, SetAttr(env_reg, spill_locs[op.src], null, op.line)])
HIGHmypyc/transform/refcount.py197 # null).
HIGHmypy/meet.py770 n = r.length() if isinstance(r, TupleType) else 1
HIGHmypy/meet.py1017 if s.length() == t.length():
HIGHmypy/meet.py1019 for i in range(t.length()):
HIGHmypy/meet.py1030 if s.length() == t.length() and s_unpack_index == t_unpack_index:
HIGHmypy/meet.py1066 if fixed.length() < variadic.length() - 1:
HIGHmypy/meet.py1069 suffix_len = variadic.length() - prefix_len - 1
HIGHmypy/types.py2848 return self.length() > 0
HIGHmypy/types.py2855 if self.length() == 0:
HIGHmypy/types.py2857 if self.length() > 1:
HIGHmypy/join.py480 if s.length() == t.length():
HIGHmypy/join.py482 for i in range(t.length()):
HIGHmypy/join.py494 if s.length() == t.length() and s_unpack_index == t_unpack_index:
HIGHmypy/join.py499 suffix_len = t.length() - t_unpack_index - 1
HIGHmypy/join.py526 if s.length() == 1 or t.length() == 1:
HIGHmypy/join.py558 if fixed.length() < variadic.length() - 1:
HIGHmypy/join.py562 suffix_len = variadic.length() - prefix_len - 1
HIGHmypy/partially_defined.py272 """If name has previously been reported as undefined, the NameExpr that was called will be returned."""
HIGHmypy/checkexpr.py4620 return left.length()
HIGHmypy/checkexpr.py4624 return left.length() - 1 + unpack.type.min_len
HIGHmypy/checkexpr.py4625 return left.length() - 1
HIGHmypy/checkexpr.py4651 extra_items = self.min_tuple_length(left) - left.length() + 1
HIGHmypy/checker.py7532 if method(typ.length(), size):
HIGHmypy/checker.py7542 min_len = typ.length() - 1 + unpacked.min_len
HIGHmypy/checker.py7554 unpack = UnpackType(unpacked.copy_modified(min_len=size - typ.length() + 1))
HIGHmypy/checker.py7563 min_len = typ.length() - 1
Self-Referential Comments34 hits · 100 pts
SeverityFileLineSnippet
MEDIUMmisc/sync-typeshed.py188 # Create a commit
MEDIUMmypyc/build.py973 # Create a compiler object so we can make decisions based on what
MEDIUMmypyc/irbuild/vec.py112 # Create an integer which will hold the type object * as an integral value.
MEDIUMmypyc/irbuild/vec.py395 # Create an integer which will hold the type object * as an integral value.
MEDIUMmypyc/irbuild/ll_builder.py1182 # Create a C array containing all arguments as boxed values.
MEDIUMmypyc/irbuild/statement.py1259 # Create a new block for the instructions immediately following the yield expression, and
MEDIUMmypyc/irbuild/classdef.py487 # Create the class
MEDIUMmypyc/irbuild/generator.py424 # Define a variable representing the label to go to the next time
MEDIUMmypyc/irbuild/callable_class.py64 # Define the actual callable class ClassIR, and set its
MEDIUMmypyc/irbuild/for_helpers.py653 # Create a new block to handle cleanup after loop exit.
MEDIUMmypyc/irbuild/for_helpers.py693 # Create a new cleanup block for when the loop is finished.
MEDIUMmypyc/irbuild/for_helpers.py742 # Create a new cleanup block for when the loop is finished.
MEDIUMmypyc/irbuild/for_helpers.py1184 # Create a register to store the state of the loop index and
MEDIUMmypyc/test/test_serialization.py3# This file is named test_serialization.py even though it doesn't
MEDIUMmypyc/codegen/literals.py121 # The following methods return the C encodings of literal values
MEDIUMmypyc/codegen/emitwrapper.py160 # Define the arguments the function accepts (but no types yet)
MEDIUMmypyc/primitives/misc_ops.py260# Create a heap type based on a template non-heap type.
MEDIUMmypyc/primitives/misc_ops.py278# Create a dataclass from an extension class. See
MEDIUMdocs/source/conf.py6# This file is execfile()d with the current directory set to its
MEDIUMmypy/build.py1892# This file is a cache directory tag automatically created by mypy.
MEDIUMmypy/stubgen.py2019 # Create the output folder if it doesn't already exist.
MEDIUMmypy/treetransform.py477 # This method is used when the transform result must be a NameExpr.
MEDIUMmypy/semanal_newtype.py89 # Create the corresponding class definition if the aliased type is subtypeable
MEDIUMmypy/typeanal.py968 # Create a named TypedDictType
MEDIUMmypy/typeops.py397 # Create the type of self in subtype, of form t[a1, ...].
MEDIUMmypy/applytype.py109 # Create a map from type variable id to target type.
MEDIUMmypy/nodes.py4628 # Create an Instance similar to fill_typevars().
MEDIUMmypy/nodes.py4650 # Create an Instance similar to fill_typevars().
MEDIUMmypy/typestate.py30 """This class provides subtype caching to improve performance of subtype checks.
MEDIUMmypy/checker.py6019 # Create a dummy subject expression to handle cases where a match statement's subject
MEDIUMmypy/checker.py2542 # This method is a subtype of at least one union variant.
MEDIUMmypy/checker.py8578 # This method is currently only used to decide whether to pair
MEDIUMmypy/plugins/functools.py241 # Create a valid context for various ad-hoc inspections in check_call().
MEDIUMmypy/plugins/common.py292 # Create the final OverloadedFuncDef node:
AI Slop Vocabulary45 hits · 83 pts
SeverityFileLineSnippet
MEDIUMmypyc/build.py710 # We let the test harness just pass in the c file contents instead
LOWmypyc/build.py710 # We let the test harness just pass in the c file contents instead
LOWmypyc/irbuild/ll_builder.py2910 # There's no __eq__ defined, so just use object identity.
LOWmypyc/irbuild/callable_class.py185 # If accessed through the class, just return the callable
LOWmypyc/irbuild/function.py620 # If there are no decorators associated with the function, then just return the
LOWmypyc/irbuild/function.py1106 # the generated C code seems to expect that __init__ returns a char, so just return 1
LOWmypyc/codegen/emitmodule.py159 # If we aren't doing validity checks, just return the cache data
LOWmypyc/codegen/emitwrapper.py963 # Nothing special needs to done to handle errors, so just return.
LOWmypyc/primitives/int_ops.py58 # Native ints don't have a separate type object -- we just use 'builtins.int'.
MEDIUM…c/external/googletest/include/gtest/gtest-death-test.h146// This implementation is *not* meant to be as highly tuned or robust
MEDIUM…c/external/googletest/include/gtest/gtest-death-test.h218// In practice, this can be used to test functions that utilize the
LOWmypy/fastparse.py2089 # RawExpressionType so we just pass in 'None' for now. We'll report the
MEDIUMmypy/build.py4598 # to leverage parallelism as much as possible.
LOWmypy/stubgen.py920 # just use Incomplete as the base class.
LOWmypy/checkmember.py1082 # This is pretty bad, so just return the original signature if
MEDIUMmypy/inspections.py552 # We are using a bit slower but robust way to find a module by path,
MEDIUMmypy/meet.py724 # TODO: write a more robust algorithm for cases where both types are variadic.
LOWmypy/meet.py607 # that came as fallbacks, so simply call is_subtype() to avoid code duplication.
LOWmypy/types.py3336 # some other type, we just return that string repr directly.
LOWmypy/types.py4014 # For bytes literals, the value is already escaped, just add quotes and b prefix
LOWmypy/join.py356 # in join_instances_via_supertype). Otherwise, just return the nominal join.
LOWmypy/types_utils.py164 # Instead of using Tuple[Unpack[Tuple[...]]], just use Tuple[...]
LOWmypy/typeanal.py1332 # fine to just return it as-is.
LOWmypy/typeanal.py1829 # Types that we can just add directly to the literal/potential union of literals.
LOWmypy/typeanal.py2868 # TypeAliasTypes are analyzed separately already, just return it
LOWmypy/typeops.py726 # with the same fallback, we can skip doing that work again and just add the type
LOWmypy/messages.py2729 # No type arguments, just return the type name
LOWmypy/messages.py3158 # For other TypeVarLikeTypes, just use the repr
LOWmypy/messages.py1842 # Nothing special here; just create the note:
LOWmypy/plugin.py446# A no-op callback would just return the inferred return type, but a useful
LOWmypy/solve.py276 # ...unless this is the only information we have, then we just pass it on.
LOWmypy/nodes.py1307# TODO: we want to remove this at some point and just use `FuncBase` ideally.
LOWmypy/checkexpr.py2084 # So we give up and just use function arguments for type inference, with just two
LOWmypy/checkexpr.py3058 # We try returning a precise type if we can. If not, we give up and just return 'Any'.
LOWmypy/checkexpr.py3699 # type of the left operand, as the operation will simply return False if the union's container/iterator
LOWmypy/checkexpr.py4640 # indexing it seems benign to just return the upper bound item, similar
MEDIUMmypy/checker.py7560 # Homogeneous variadic item is the case where we are most flexible. Essentially,
MEDIUMmypy/semanal.py4149 # TODO: find a more robust way to track the order of definitions.
MEDIUMmypy/semanal.py6580 # TODO: this is not 100% robust for type variables nested within a class
LOWmypy/checkpattern.py308 # into individual items, so we just use its upper bound for the whole
MEDIUMmypy/subtypes.py2216 # TODO: Implement more robust support for runtime isinstance() checks, see issue #3827.
LOWmypy/stubtest.py392 # But we can't just return True here, because symtable doesn't know about symbols
LOWmypy/plugins/enums.py221 # If this is the case, we simply return this type.
MEDIUMmypy/plugins/dataclasses.py751 """Converts all attributes to @property methods in order to
LOWmypy/server/deps.py580 # dependencies from this so just return something. (The first,
Cross-File Repetition15 hits · 75 pts
SeverityFileLineSnippet
HIGHmypyc/test/test_annotate.py0perform a runtime checking transformation test case.
HIGHmypyc/test/test_irbuild.py0perform a runtime checking transformation test case.
HIGHmypyc/test/test_refcount.py0perform a runtime checking transformation test case.
HIGHmypyc/test/test_exceptions.py0perform a runtime checking transformation test case.
HIGHmypyc/test/test_alwaysdefined.py0perform a runtime checking transformation test case.
HIGHmypyc/test/test_emitfunc.py0\ if (likely(pydict_check(cpy_r_r))) cpy_r_r0 = cpy_r_r; else { cpy_typeerror("dict", cpy_r_r); cpy_r_r0 = null; }
HIGHmypyc/test/test_emitfunc.py0\ if (likely(pydict_check(cpy_r_r))) cpy_r_r0 = cpy_r_r; else { cpy_typeerror("dict", cpy_r_r); cpy_r_r0 = null; }
HIGHmypyc/test/test_emitfunc.py0\ if (likely(pydict_check(cpy_r_r))) cpy_r_r0 = cpy_r_r; else { cpy_typeerror("dict", cpy_r_r); cpy_r_r0 = null; }
HIGHmypyc/test/test_emitfunc.py0\ if (likely(pydict_check(cpy_r_r))) cpy_r_r0 = cpy_r_r; else { cpy_typeerror("dict", cpy_r_r); cpy_r_r0 = null; }
HIGHmypy/util.py0return true if initialization was successful and we can use colors, false otherwise
HIGHmypy/util.py0return true if initialization was successful and we can use colors, false otherwise
HIGHmypy/util.py0return true if initialization was successful and we can use colors, false otherwise
HIGHmypy/test/typefixture.py0callable(a1, ..., an, r) constructs a callable with argument types a1, ... an and return type r.
HIGHmypy/test/testtypes.py0callable(a1, ..., an, r) constructs a callable with argument types a1, ... an and return type r.
HIGHmypy/test/testtypes.py0callable(a1, ..., an, r) constructs a callable with argument types a1, ... an and return type r.
Redundant / Tautological Comments48 hits · 73 pts
SeverityFileLineSnippet
LOWmisc/test-stubgenc.sh25 # Check if generated stubs can actually be type checked by mypy
LOWmypyc/build_setup.py49 # Check if the matching argument contains a source filename.
LOWmypyc/irbuild/ll_builder.py587 # Check if value < upper_bound
LOWmypyc/irbuild/ll_builder.py595 # Check if value >= lower_bound
LOWmypyc/irbuild/prebuildvisitor.py294 # Check if child is nested within fdef (possibly indirectly
LOWmypyc/irbuild/statement.py1000 # Check if we have a return value
LOWmypyc/irbuild/statement.py1017 # Check if we need to reraise the original exception from sys.exc_info
LOWmypyc/irbuild/statement.py1021 # Check if exc_type is None
LOWmypyc/irbuild/statement.py1057 # Check if we're in an async function with a finally block that contains await
LOWmypyc/irbuild/classdef.py645 # Check if the metaclass defines a __prepare__ method, and if so, call it.
LOWmypyc/irbuild/specialize.py275 # Check if there's a specializer for this dunder method and type
LOWmypyc/irbuild/specialize.py801 # Return the result
LOWmypyc/irbuild/specialize.py1419 # Check if the adjusted index is in valid range
LOWmypyc/irbuild/specialize.py1479 # Check if the adjusted index is in valid range
LOWmypyc/lib-rt/build_setup.py49 # Check if the matching argument contains a source filename.
LOWmypyc/analysis/attrdefined.py182 # Check if __init__ can run unpredictable code (leak 'self').
LOWmypyc/primitives/misc_ops.py113# Check if the current exception is a StopIteration and return its value if so.
LOWmypy/fastparse.py674 # Check if stmts are reachable and add them to current_overload,
LOWmypy/build.py2073 # Check if plugins are still the same.
LOWmypy/expandtype.py253 # Set prefix to something empty, so we don't duplicate it below.
LOWmypy/exprtotype.py115 # Check if the type is Annotated[...]. For this we need the fullname,
LOWmypy/checkmember.py1242 # Check if original variable type has type variables. For example:
LOWmypy/ipc.py94 # Check if we already have a message in the buffer before
LOWmypy/ipc.py128 # Check if we already have a message in the buffer before
LOWmypy/util.py618 # Check if we are in a human-facing terminal on a supported platform.
LOWmypy/checkstrformat.py608 # Check if there are any other errors (like missing members).
LOWmypy/nativeparse.py1257 # Check if this is a super() call - if so, convert to SuperExpr
LOWmypy/nativeparse.py1872 # Check if stmts are reachable and add them to current_overload,
LOWmypy/stubgenc.py321 # Check if the argument has a default value
LOWmypy/semanal_main.py507 # Check if the class definition itself triggers a dataclass transform (via a parent class/
LOWmypy/constraints.py1575 # Set TypeVarTuple to empty to improve error messages.
LOWmypy/semanal_shared.py438 # Check if there is a metaclass that is decorated with `typing.dataclass_transform`
LOWmypy/checker.py784 # Check if assignment widened the inferred type of a variable; in this case we
LOWmypy/checker.py859 # Check if the setter can accept two positional arguments.
LOWmypy/checker.py1668 # Check if __init__ has an invalid return type.
LOWmypy/checker.py2521 # Check if this override is covariant.
LOWmypy/checker.py3477 # Check if the nearest common ancestor frame for the definition site
LOWmypy/checker.py3657 # Check if we are a class variable with at least one base class
LOWmypy/semanal.py3949 # Check if there is a definition in supertype. If yes, we can't safely
LOWmypy/semanal.py2228 # Check if the class definition itself triggers a dataclass transform (via a parent class/
LOWmypy/checkpattern.py184 # Check if other subpatterns capture the same names
LOWmypy/test/test_nativeparse.py96 # Check if we should skip function bodies (when ignoring errors)
LOWmypy/test/helpers.py186 # Display message that helps visualize the differences between two
LOWmypy/plugins/attrs.py362 # Check if attribute types are ready.
LOWmypy/plugins/attrs.py526 # Check if the right hand side is a call to an attribute maker.
LOWmypy/plugins/attrs.py562 # Check if the right hand side is a call to an attribute maker.
LOWmypy/server/update.py947 # Add it to the queue of files that need to be processed fully.
LOWmypy/server/update.py1043 # Check if any attribute types were changed and need to be propagated further.
Excessive Try-Catch Wrapping44 hits · 48 pts
SeverityFileLineSnippet
MEDIUMmisc/analyze_typeform_stats.py45 print("Error: Could not find all required counters in output")
LOWmypyc/crash.py14 except Exception:
LOWmypyc/test/test_external.py61 except Exception as err:
LOWmypyc/test-data/driver/driver.py29 except Exception as e:
MEDIUMmypy/build.py703 print(f"Error calling the plugin(version) entry point of {plugin_path}\n", file=stdout)
MEDIUMmypy/build.py721 print(f"Error constructing plugin instance of {plugin_type.__name__}\n", file=stdout)
MEDIUMmypy/build.py3583 print(f"Error serializing {self.id}", file=self.manager.stdout)
LOWmypy/build.py309 except Exception as exc:
LOWmypy/build.py686 except Exception as exc:
LOWmypy/build.py702 except Exception:
LOWmypy/build.py720 except Exception:
LOWmypy/build.py1754 except Exception as e:
LOWmypy/build.py3066 except Exception as err:
LOWmypy/build.py3582 except Exception:
LOWmypy/moduleinspect.py65 except Exception:
LOWmypy/ipc.py369 except Exception as e:
LOWmypy/dmypy_util.py30 except Exception as e:
LOWmypy/dmypy_server.py244 except Exception:
LOWmypy/dmypy_server.py1118 except Exception:
LOWmypy/errors.py1345 except Exception as e:
LOWmypy/stubutil.py149 except Exception as e:
LOWmypy/checkexpr.py6195 except Exception as err:
LOWmypy/__main__.py36 except Exception as e:
LOWmypy/__main__.py43 except Exception:
MEDIUMmypy/__main__.py14def console_entry() -> None:
LOWmypy/checker.py766 except Exception as err:
LOWmypy/semanal.py7733 except Exception as err:
LOWmypy/stubtest.py1486 except Exception:
LOWmypy/stubtest.py264 except Exception as e:
LOWmypy/stubtest.py402 except Exception:
LOWmypy/stubtest.py455 except Exception:
LOWmypy/stubtest.py493 except Exception:
LOWmypy/stubtest.py501 except Exception:
LOWmypy/stubtest.py715 except Exception:
LOWmypy/stubtest.py883 except Exception:
LOWmypy/stubtest.py1896 except Exception:
LOWmypy/stubtest.py1934 except Exception:
LOWmypy/stubtest.py1961 except Exception:
LOWmypy/build_worker/worker.py109 except Exception as exc:
MEDIUMmypy/build_worker/worker.py110 print(f"Error writing status file {status_file}:", exc)
MEDIUMmypy/build_worker/worker.py129 print("Error communicating with coordinator:", exc)
LOWmypy/build_worker/worker.py130 except Exception as exc:
LOWmypy/dmypy/client.py275 except Exception:
LOWmypy/test/data.py336 except Exception:
Verbosity Indicators20 hits · 33 pts
SeverityFileLineSnippet
LOWmypy/typeops.py637 # Step 1: expand all nested unions
LOWmypy/typeops.py640 # Step 2: fast path for single item
LOWmypy/typeops.py644 # Step 3: remove redundant unions
LOWmypy/typeops.py647 # Step 4: If more than one literal exists in the union, try to simplify
LOWmypy/typeops.py660 # Step 5: At last, we erase any (inconsistent) extra attributes on instances.
LOWmypy/checkexpr.py2806 # Step 1: Filter call targets to remove ones where the argument counts don't match
LOWmypy/checkexpr.py2811 # Step 2: If the arguments contain a union, we try performing union math first,
LOWmypy/checkexpr.py2856 # Step 3: We try checking each branch one-by-one.
LOWmypy/checkexpr.py2889 # Step 4: Failure. At this point, we know there is no match. We fall back to trying
LOWmypy/checkexpr.py2902 # Step 5: We try and infer a second-best alternative if possible. If not, fall back
LOWmypy/checkexpr.py3158 # Step 1: If we are already too deep, then stop immediately. Otherwise mypy might
LOWmypy/checkexpr.py3164 # Step 2: Find position of the first union in arguments. Return the normal inferred
LOWmypy/checkexpr.py3186 # Step 3: Try a direct match before splitting to avoid unnecessary union splits
LOWmypy/checkexpr.py3206 # Step 4: Split the first remaining union type in arguments into items and
LOWmypy/checkexpr.py3232 # Step 5: If splitting succeeded, then filter out duplicate items before returning.
LOWmypy/checkexpr.py4296 # Step 1: We first try leaving the right arguments alone and destructure
LOWmypy/checkexpr.py4320 # Step 2: If that fails, we try again but also destructure the right argument.
LOWmypy/checker.py6693 # Step 1: Obtain the types of each operand and whether or not we can
LOWmypy/checker.py6727 # Step 2: Group operands chained by either the 'is' or '==' operands
LOWmypy/checker.py6747 # Step 3: Analyze each group and infer more precise type maps for each
Decorative Section Separators10 hits · 30 pts
SeverityFileLineSnippet
MEDIUMmypy/main.py412 # =====================
MEDIUMmypy/main.py414 # =====================
MEDIUMmypy/main.py431 # ===============
MEDIUMmypy/main.py433 # ===============
MEDIUMmypy/stubtest.py213# ====================
MEDIUMmypy/stubtest.py215# ====================
MEDIUMmypy/stubtest.py1756# ====================
MEDIUMmypy/stubtest.py1758# ====================
MEDIUMmypy/stubtest.py2158# ====================
MEDIUMmypy/stubtest.py2160# ====================
Hallucination Indicators2 hits · 20 pts
SeverityFileLineSnippet
CRITICALmypy/plugins/common.py252 cls.info.defn.defs.body.append(func)
CRITICALmypy/plugins/common.py301 cls.info.defn.defs.body.append(overload_def)
Slop Phrases4 hits · 9 pts
SeverityFileLineSnippet
LOWmypyc/irbuild/env_class.py137 # If this is a FuncDef, then make sure to load the FuncDef into its own environment
LOWmypy/types.py80# make sure to audit the following methods:
MEDIUMmypy/errors.py110 # For errors on the same line you can use this to customize their sorting
MEDIUMmypy/subtypes.py978 # because you can use `B` everywhere you use `A`, but not the other way around.
Overly Generic Function Names4 hits · 4 pts
SeverityFileLineSnippet
LOWmisc/analyze_cache.py92 def helper(chunk: JsonDict) -> JsonDict:
LOWmisc/analyze_cache.py124 def helper(chunk: JsonDict) -> JsonDict:
LOWmypy/semanal_pass1.py48 def do_stuff() -> None:
LOWmypy/semanal.py628 def helper(defs: list[Statement]) -> None: