id
int64
1
6.07M
name
stringlengths
1
295
code
stringlengths
12
426k
language
stringclasses
1 value
source_file
stringlengths
5
202
start_line
int64
1
158k
end_line
int64
1
158k
repo
dict
6,068,001
detach_callable
def detach_callable(typ: CallableType) -> CallableType: """Ensures that the callable's type variables are 'detached' and independent of the context. A callable normally keeps track of the type variables it uses within its 'variables' field. However, if the callable is from a method and that method is using...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,525
6,569
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,002
overload_can_never_match
def overload_can_never_match(signature: CallableType, other: CallableType) -> bool: """Check if the 'other' method can never be matched due to 'signature'. This can happen if signature's parameters are all strictly broader then other's parameters. Assumes that both signatures have overlapping argument...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,572
6,594
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,003
is_more_general_arg_prefix
def is_more_general_arg_prefix(t: FunctionLike, s: FunctionLike) -> bool: """Does t have wider arguments than s?""" # TODO should an overload with additional items be allowed to be more # general than one with fewer items (or just one item)? if isinstance(t, CallableType): if isinstance(s, ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,597
6,610
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,004
is_same_arg_prefix
def is_same_arg_prefix(t: CallableType, s: CallableType) -> bool: return is_callable_compatible( t, s, is_compat=is_same_type, ignore_return=True, check_args_covariantly=True, ignore_pos_arg_names=True, )
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,613
6,621
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,005
infer_operator_assignment_method
def infer_operator_assignment_method(typ: Type, operator: str) -> tuple[bool, str]: """Determine if operator assignment on given value type is in-place, and the method name. For example, if operator is '+', return (True, '__iadd__') or (False, '__add__') depending on which method is supported by the type. ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,624
6,637
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,006
is_valid_inferred_type
def is_valid_inferred_type(typ: Type) -> bool: """Is an inferred type valid? Examples of invalid types include the None type or List[<uninhabited>]. When not doing strict Optional checking, all types containing None are invalid. When doing strict Optional checking, only None and types that are in...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,640
6,655
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,007
__init__
def __init__(self) -> None: super().__init__(any)
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,661
6,662
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,008
visit_uninhabited_type
def visit_uninhabited_type(self, t: UninhabitedType) -> bool: return t.ambiguous
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,664
6,665
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,009
visit_uninhabited_type
def visit_uninhabited_type(self, t: UninhabitedType) -> Type: if t.ambiguous: return AnyType(TypeOfAny.from_error) return t
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,671
6,674
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,010
visit_type_alias_type
def visit_type_alias_type(self, t: TypeAliasType) -> Type: # Target of the alias cannot by an ambiguous <nothing>, so we just # replace the arguments. return t.copy_modified(args=[a.accept(self) for a in t.args])
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,676
6,679
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,011
is_node_static
def is_node_static(node: Node | None) -> bool | None: """Find out if a node describes a static function method.""" if isinstance(node, FuncDef): return node.is_static if isinstance(node, Var): return node.is_staticmethod return None
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,682
6,691
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,012
__init__
def __init__(self, module: MypyFile) -> None: self.stack = [module]
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,698
6,699
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,013
top_function
def top_function(self) -> FuncItem | None: for e in reversed(self.stack): if isinstance(e, FuncItem): return e return None
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,701
6,705
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,014
top_non_lambda_function
def top_non_lambda_function(self) -> FuncItem | None: for e in reversed(self.stack): if isinstance(e, FuncItem) and not isinstance(e, LambdaExpr): return e return None
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,707
6,711
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,015
active_class
def active_class(self) -> TypeInfo | None: if isinstance(self.stack[-1], TypeInfo): return self.stack[-1] return None
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,713
6,716
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,016
enclosing_class
def enclosing_class(self) -> TypeInfo | None: """Is there a class *directly* enclosing this function?""" top = self.top_function() assert top, "This method must be called from inside a function" index = self.stack.index(top) assert index, "CheckerScope stack must always start wit...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,718
6,727
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,017
active_self_type
def active_self_type(self) -> Instance | TupleType | None: """An instance or tuple type representing the current class. This returns None unless we are in class body or in a method. In particular, inside a function nested in method this returns None. """ info = self.active_class...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,729
6,740
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,018
push_function
def push_function(self, item: FuncItem) -> Iterator[None]: self.stack.append(item) yield self.stack.pop()
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,743
6,746
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,019
push_class
def push_class(self, info: TypeInfo) -> Iterator[None]: self.stack.append(info) yield self.stack.pop()
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,749
6,752
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,020
__init__
def __init__(self) -> None: # Each key maps to a unique ID self._key_to_id: dict[TKey, int] = {} # Each id points to the parent id, forming a forest of upwards-pointing trees. If the # current id already is the root, it points to itself. We gradually flatten these trees # as we ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,786
6,796
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,021
add_mapping
def add_mapping(self, keys: set[TKey], values: set[TValue]) -> None: """Adds a 'Set[TKey] -> Set[TValue]' mapping. If there already exists a mapping containing one or more of the given keys, we merge the input mapping with the old one. Note that the given set of keys must be non-empty -- otherw...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,798
6,816
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,022
items
def items(self) -> list[tuple[set[TKey], set[TValue]]]: """Returns all disjoint mappings in key-value pairs.""" root_id_to_keys: dict[int, set[TKey]] = {} for key in self._key_to_id: root_id = self._lookup_root_id(key) if root_id not in root_id_to_keys: ro...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,818
6,831
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,023
_lookup_or_make_root_id
def _lookup_or_make_root_id(self, key: TKey) -> int: if key in self._key_to_id: return self._lookup_root_id(key) else: new_id = len(self._key_to_id) self._key_to_id[key] = new_id self._id_to_parent_id[new_id] = new_id self._root_id_to_values[ne...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,833
6,841
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,024
_lookup_root_id
def _lookup_root_id(self, key: TKey) -> int: i = self._key_to_id[key] while i != self._id_to_parent_id[i]: # Optimization: make keys directly point to their grandparents to speed up # future traversals. This prevents degenerate trees of height n from forming. new_pare...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,843
6,851
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,025
group_comparison_operands
def group_comparison_operands( pairwise_comparisons: Iterable[tuple[str, Expression, Expression]], operand_to_literal_hash: Mapping[int, Key], operators_to_group: set[str], ) -> list[tuple[str, list[int]]]: """Group a series of comparison operands together chained by any operand in the 'operators_to...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,854
6,951
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,026
is_typed_callable
def is_typed_callable(c: Type | None) -> bool: c = get_proper_type(c) if not c or not isinstance(c, CallableType): return False return not all( isinstance(t, AnyType) and t.type_of_any == TypeOfAny.unannotated for t in get_proper_types(c.arg_types + [c.ret_type]) )
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,954
6,961
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,027
is_untyped_decorator
def is_untyped_decorator(typ: Type | None) -> bool: typ = get_proper_type(typ) if not typ: return True elif isinstance(typ, CallableType): return not is_typed_callable(typ) elif isinstance(typ, Instance): method = typ.type.get_method("__call__") if method: if ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,964
6,986
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,028
is_static
def is_static(func: FuncBase | Decorator) -> bool: if isinstance(func, Decorator): return is_static(func.func) elif isinstance(func, FuncBase): return func.is_static assert False, f"Unexpected func type: {type(func)}"
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,989
6,994
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,029
is_subtype_no_promote
def is_subtype_no_promote(left: Type, right: Type) -> bool: return is_subtype(left, right, ignore_promotions=True)
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
6,997
6,998
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,030
is_overlapping_types_no_promote_no_uninhabited
def is_overlapping_types_no_promote_no_uninhabited(left: Type, right: Type) -> bool: # For the purpose of unsafe overload checks we consider list[<nothing>] and list[int] # non-overlapping. This is consistent with how we treat list[int] and list[str] as # non-overlapping, despite [] belongs to both. Also th...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
7,001
7,006
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,031
is_private
def is_private(node_name: str) -> bool: """Check if node is private to class definition.""" return node_name.startswith("__") and not node_name.endswith("__")
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
7,009
7,011
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,032
is_string_literal
def is_string_literal(typ: Type) -> bool: strs = try_getting_str_literals_from_type(typ) return strs is not None and len(strs) == 1
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
7,014
7,016
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,033
has_bool_item
def has_bool_item(typ: ProperType) -> bool: """Return True if type is 'bool' or a union with a 'bool' item.""" if is_named_instance(typ, "builtins.bool"): return True if isinstance(typ, UnionType): return any(is_named_instance(item, "builtins.bool") for item in typ.items) return False
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
7,019
7,025
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,034
collapse_walrus
def collapse_walrus(e: Expression) -> Expression: """If an expression is an AssignmentExpr, pull out the assignment target. We don't make any attempt to pull out all the targets in code like `x := (y := z)`. We could support narrowing those if that sort of code turns out to be common. """ if isinst...
python
python-3.10.8.amd64/Lib/site-packages/mypy/checker.py
7,028
7,036
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,035
__init__
def __init__(self) -> None: # The package root is not flushed with the caches. # It is set by set_package_root() below. self.package_root: list[str] = [] self.flush()
python
python-3.10.8.amd64/Lib/site-packages/mypy/fscache.py
43
47
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,036
set_package_root
def set_package_root(self, package_root: list[str]) -> None: self.package_root = package_root
python
python-3.10.8.amd64/Lib/site-packages/mypy/fscache.py
49
50
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,037
flush
def flush(self) -> None: """Start another transaction and empty all caches.""" self.stat_cache: dict[str, os.stat_result] = {} self.stat_error_cache: dict[str, OSError] = {} self.listdir_cache: dict[str, list[str]] = {} self.listdir_error_cache: dict[str, OSError] = {} se...
python
python-3.10.8.amd64/Lib/site-packages/mypy/fscache.py
52
63
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,038
stat
def stat(self, path: str) -> os.stat_result: if path in self.stat_cache: return self.stat_cache[path] if path in self.stat_error_cache: raise copy_os_error(self.stat_error_cache[path]) try: st = os.stat(path) except OSError as err: if self....
python
python-3.10.8.amd64/Lib/site-packages/mypy/fscache.py
65
83
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,039
init_under_package_root
def init_under_package_root(self, path: str) -> bool: """Is this path an __init__.py under a package root? This is used to detect packages that don't contain __init__.py files, which is needed to support Bazel. The function should only be called for non-existing files. It will...
python
python-3.10.8.amd64/Lib/site-packages/mypy/fscache.py
85
135
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,040
_fake_init
def _fake_init(self, path: str) -> os.stat_result: """Prime the cache with a fake __init__.py file. This makes code that looks for path believe an empty file by that name exists. Should only be called after init_under_package_root() returns True. """ dirname, basename =...
python
python-3.10.8.amd64/Lib/site-packages/mypy/fscache.py
137
159
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,041
listdir
def listdir(self, path: str) -> list[str]: path = os.path.normpath(path) if path in self.listdir_cache: res = self.listdir_cache[path] # Check the fake cache. if path in self.fake_package_cache and "__init__.py" not in res: res.append("__init__.py") #...
python
python-3.10.8.amd64/Lib/site-packages/mypy/fscache.py
161
181
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,042
isfile
def isfile(self, path: str) -> bool: try: st = self.stat(path) except OSError: return False return stat.S_ISREG(st.st_mode)
python
python-3.10.8.amd64/Lib/site-packages/mypy/fscache.py
183
188
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,043
isfile_case
def isfile_case(self, path: str, prefix: str) -> bool: """Return whether path exists and is a file. On case-insensitive filesystems (like Mac or Windows) this returns False if the case of path's last component does not exactly match the case found in the filesystem. We check al...
python
python-3.10.8.amd64/Lib/site-packages/mypy/fscache.py
190
224
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,044
exists_case
def exists_case(self, path: str, prefix: str) -> bool: """Return whether path exists - checking path components in case sensitive fashion, up to prefix. """ if path in self.exists_case_cache: return self.exists_case_cache[path] head, tail = os.path.split(path) ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/fscache.py
226
248
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,045
isdir
def isdir(self, path: str) -> bool: try: st = self.stat(path) except OSError: return False return stat.S_ISDIR(st.st_mode)
python
python-3.10.8.amd64/Lib/site-packages/mypy/fscache.py
250
255
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,046
exists
def exists(self, path: str) -> bool: try: self.stat(path) except FileNotFoundError: return False return True
python
python-3.10.8.amd64/Lib/site-packages/mypy/fscache.py
257
262
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,047
read
def read(self, path: str) -> bytes: if path in self.read_cache: return self.read_cache[path] if path in self.read_error_cache: raise self.read_error_cache[path] # Need to stat first so that the contents of file are from no # earlier instant than the mtime reporte...
python
python-3.10.8.amd64/Lib/site-packages/mypy/fscache.py
264
289
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,048
hash_digest
def hash_digest(self, path: str) -> str: if path not in self.hash_cache: self.read(path) return self.hash_cache[path]
python
python-3.10.8.amd64/Lib/site-packages/mypy/fscache.py
291
294
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,049
samefile
def samefile(self, f1: str, f2: str) -> bool: s1 = self.stat(f1) s2 = self.stat(f2) return os.path.samestat(s1, s2)
python
python-3.10.8.amd64/Lib/site-packages/mypy/fscache.py
296
299
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,050
copy_os_error
def copy_os_error(e: OSError) -> OSError: new = OSError(*e.args) new.errno = e.errno new.strerror = e.strerror new.filename = e.filename if e.filename2: new.filename2 = e.filename2 return new
python
python-3.10.8.amd64/Lib/site-packages/mypy/fscache.py
302
309
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,051
__init__
def __init__(self, strict_optional: bool) -> None: # Value varies by file being processed self.strict_optional = strict_optional
python
python-3.10.8.amd64/Lib/site-packages/mypy/state.py
14
16
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,052
strict_optional_set
def strict_optional_set(self, value: bool) -> Iterator[None]: saved = self.strict_optional self.strict_optional = value try: yield finally: self.strict_optional = saved
python
python-3.10.8.amd64/Lib/site-packages/mypy/state.py
19
25
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,053
__init__
def __init__( self, modules: dict[str, MypyFile], missing_modules: set[str], incomplete_namespaces: set[str], errors: Errors, plugin: Plugin, ) -> None: """Construct semantic analyzer. We reuse the same semantic analyzer instance across multiple modul...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
389
454
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,054
is_stub_file
def is_stub_file(self) -> bool: return self._is_stub_file
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
459
460
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,055
is_typeshed_stub_file
def is_typeshed_stub_file(self) -> bool: return self._is_typeshed_stub_file
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
463
464
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,056
final_iteration
def final_iteration(self) -> bool: return self._final_iteration
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
467
468
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,057
prepare_file
def prepare_file(self, file_node: MypyFile) -> None: """Prepare a freshly parsed file for semantic analysis.""" if "builtins" in self.modules: file_node.names["__builtins__"] = SymbolTableNode(GDEF, self.modules["builtins"]) if file_node.fullname == "builtins": self.prepa...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
474
483
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,058
prepare_typing_namespace
def prepare_typing_namespace(self, file_node: MypyFile, aliases: dict[str, str]) -> None: """Remove dummy alias definitions such as List = TypeAlias(object) from typing. They will be replaced with real aliases when corresponding targets are ready. """ # This is all pretty unfortunate. t...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
485
513
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,059
helper
def helper(defs: list[Statement]) -> None: for stmt in defs.copy(): if isinstance(stmt, IfStmt): for body in stmt.body: helper(body.body) if stmt.else_body: helper(stmt.else_body.body) if ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
497
511
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,060
prepare_builtins_namespace
def prepare_builtins_namespace(self, file_node: MypyFile) -> None: """Add certain special-cased definitions to the builtins module. Some definitions are too special or fundamental to be processed normally from the AST. """ names = file_node.names # Add empty definition ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
515
551
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,061
refresh_partial
def refresh_partial( self, node: MypyFile | FuncDef | OverloadedFuncDef, patches: list[tuple[int, Callable[[], None]]], final_iteration: bool, file_node: MypyFile, options: Options, active_type: TypeInfo | None = None, ) -> None: """Refresh a stale tar...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
557
579
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,062
refresh_top_level
def refresh_top_level(self, file_node: MypyFile) -> None: """Reanalyze a stale module top-level in fine-grained incremental mode.""" self.recurse_into_functions = False self.add_implicit_module_attrs(file_node) for d in file_node.defs: self.accept(d) if file_node.full...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
581
593
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,063
add_implicit_module_attrs
def add_implicit_module_attrs(self, file_node: MypyFile) -> None: """Manually add implicit definitions of module '__name__' etc.""" for name, t in implicit_module_attrs.items(): if name == "__doc__": typ: Type = UnboundType("__builtins__.str") elif name == "__path...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
595
638
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,064
add_builtin_aliases
def add_builtin_aliases(self, tree: MypyFile) -> None: """Add builtin type aliases to typing module. For historical reasons, the aliases like `List = list` are not defined in typeshed stubs for typing module. Instead we need to manually add the corresponding nodes on the fly. We explici...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
640
656
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,065
add_typing_extension_aliases
def add_typing_extension_aliases(self, tree: MypyFile) -> None: """Typing extensions module does contain some type aliases. We need to analyze them as such, because in typeshed they are just defined as `_Alias()` call. Which is not supported natively. """ assert tree.ful...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
658
676
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,066
create_alias
def create_alias(self, tree: MypyFile, target_name: str, alias: str, name: str) -> None: tag = self.track_incomplete_refs() n = self.lookup_fully_qualified_or_none(target_name) if n: if isinstance(n.node, PlaceholderNode): self.mark_incomplete(name, tree) ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
678
707
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,067
adjust_public_exports
def adjust_public_exports(self) -> None: """Adjust the module visibility of globals due to __all__.""" if "__all__" in self.globals: for name, g in self.globals.items(): # Being included in __all__ explicitly exports and makes public. if name in self.all_expor...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
709
720
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,068
file_context
def file_context( self, file_node: MypyFile, options: Options, active_type: TypeInfo | None = None ) -> Iterator[None]: """Configure analyzer for analyzing targets within a file/class. Args: file_node: target file options: options specific to the file act...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
723
769
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,069
visit_func_def
def visit_func_def(self, defn: FuncDef) -> None: self.statement = defn # Visit default values because they may contain assignment expressions. for arg in defn.arguments: if arg.initializer: arg.initializer.accept(self) defn.is_conditional = self.block_depth[...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
775
801
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,070
analyze_func_def
def analyze_func_def(self, defn: FuncDef) -> None: self.function_stack.append(defn) if defn.type: assert isinstance(defn.type, CallableType) self.update_function_type_variables(defn.type, defn) self.function_stack.pop() if self.is_class_scope(): # Me...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
803
878
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,071
remove_unpack_kwargs
def remove_unpack_kwargs(self, defn: FuncDef, typ: CallableType) -> CallableType: if not typ.arg_kinds or typ.arg_kinds[-1] is not ArgKind.ARG_STAR2: return typ last_type = get_proper_type(typ.arg_types[-1]) if not isinstance(last_type, UnpackType): return typ las...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
880
901
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,072
prepare_method_signature
def prepare_method_signature(self, func: FuncDef, info: TypeInfo) -> None: """Check basic signature validity and tweak annotation of self/cls argument.""" # Only non-static methods are special. functype = func.type if not func.is_static: if func.name in ["__init_subclass__", ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
903
918
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,073
set_original_def
def set_original_def(self, previous: Node | None, new: FuncDef | Decorator) -> bool: """If 'new' conditionally redefine 'previous', set 'previous' as original We reject straight redefinitions of functions, as they are usually a programming error. For example: def f(): ... d...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
920
941
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,074
update_function_type_variables
def update_function_type_variables(self, fun_type: CallableType, defn: FuncItem) -> None: """Make any type variables in the signature of defn explicit. Update the signature of defn to contain type variable definitions if defn is generic. """ with self.tvar_scope_frame(self.tvar_...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
943
951
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,075
visit_overloaded_func_def
def visit_overloaded_func_def(self, defn: OverloadedFuncDef) -> None: self.statement = defn self.add_function_to_symbol_table(defn) if not self.recurse_into_functions: return # NB: Since _visit_overloaded_func_def will call accept on the # underlying FuncDefs, the f...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
953
965
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,076
analyze_overloaded_func_def
def analyze_overloaded_func_def(self, defn: OverloadedFuncDef) -> None: # OverloadedFuncDef refers to any legitimate situation where you have # more than one declaration for the same function in a row. This occurs # with a @property with a setter or a deleter, and for a classic # @overl...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
967
1,022
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,077
process_overload_impl
def process_overload_impl(self, defn: OverloadedFuncDef) -> None: """Set flags for an overload implementation. Currently, this checks for a trivial body in protocols classes, where it makes the method implicitly abstract. """ if defn.impl is None: return impl...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
1,024
1,036
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,078
analyze_overload_sigs_and_impl
def analyze_overload_sigs_and_impl( self, defn: OverloadedFuncDef ) -> tuple[list[CallableType], OverloadPart | None, list[int]]: """Find overload signatures, the implementation, and items with missing @overload. Assume that the first was already analyzed. As a side effect: analyzes...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
1,038
1,077
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,079
handle_missing_overload_decorators
def handle_missing_overload_decorators( self, defn: OverloadedFuncDef, non_overload_indexes: list[int], some_overload_decorators: bool, ) -> None: """Generate errors for overload items without @overload. Side effect: remote non-overload items. """ if ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
1,079
1,110
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,080
handle_missing_overload_implementation
def handle_missing_overload_implementation(self, defn: OverloadedFuncDef) -> None: """Generate error about missing overload implementation (only if needed).""" if not self.is_stub_file: if self.type and self.type.is_protocol and not self.is_func_scope(): # An overloaded proto...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
1,112
1,128
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,081
process_final_in_overload
def process_final_in_overload(self, defn: OverloadedFuncDef) -> None: """Detect the @final status of an overloaded function (and perform checks).""" # If the implementation is marked as @final (or the first overload in # stubs), then the whole overloaded definition if @final. if any(item...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
1,130
1,147
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,082
process_static_or_class_method_in_overload
def process_static_or_class_method_in_overload(self, defn: OverloadedFuncDef) -> None: class_status = [] static_status = [] for item in defn.items: if isinstance(item, Decorator): inner = item.func elif isinstance(item, FuncDef): inner = it...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
1,149
1,178
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,083
analyze_property_with_multi_part_definition
def analyze_property_with_multi_part_definition(self, defn: OverloadedFuncDef) -> None: """Analyze a property defined using multiple methods (e.g., using @x.setter). Assume that the first method (@property) has already been analyzed. """ defn.is_property = True items = defn.item...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
1,180
1,208
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,084
add_function_to_symbol_table
def add_function_to_symbol_table(self, func: FuncDef | OverloadedFuncDef) -> None: if self.is_class_scope(): assert self.type is not None func.info = self.type func._fullname = self.qualified_name(func.name) self.add_symbol(func.name, func, func)
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
1,210
1,215
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,085
analyze_arg_initializers
def analyze_arg_initializers(self, defn: FuncItem) -> None: with self.tvar_scope_frame(self.tvar_scope.method_frame()): # Analyze default arguments for arg in defn.arguments: if arg.initializer: arg.initializer.accept(self)
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
1,217
1,222
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,086
analyze_function_body
def analyze_function_body(self, defn: FuncItem) -> None: is_method = self.is_class_scope() with self.tvar_scope_frame(self.tvar_scope.method_frame()): # Bind the type variables again to visit the body. if defn.type: a = self.type_analyzer() a.bind_...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
1,224
1,243
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,087
check_classvar_in_signature
def check_classvar_in_signature(self, typ: ProperType) -> None: if isinstance(typ, Overloaded): for t in typ.items: # type: ProperType self.check_classvar_in_signature(t) return if not isinstance(typ, CallableType): return for t in get_proper_...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
1,245
1,256
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,088
check_function_signature
def check_function_signature(self, fdef: FuncItem) -> None: sig = fdef.type assert isinstance(sig, CallableType) if len(sig.arg_types) < len(fdef.arguments): self.fail("Type signature has too few arguments", fdef) # Add dummy Any arguments to prevent crashes later. ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
1,258
1,268
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,089
visit_decorator
def visit_decorator(self, dec: Decorator) -> None: self.statement = dec # TODO: better don't modify them at all. dec.decorators = dec.original_decorators.copy() dec.func.is_conditional = self.block_depth[-1] > 0 if not dec.is_overload: self.add_symbol(dec.name, dec, d...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
1,270
1,344
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,090
check_decorated_function_is_method
def check_decorated_function_is_method(self, decorator: str, context: Context) -> None: if not self.type or self.is_func_scope(): self.fail(f'"{decorator}" used with a non-method', context)
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
1,346
1,348
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,091
visit_class_def
def visit_class_def(self, defn: ClassDef) -> None: self.statement = defn self.incomplete_type_stack.append(not defn.info) namespace = self.qualified_name(defn.name) with self.tvar_scope_frame(self.tvar_scope.class_frame(namespace)): self.analyze_class(defn) self.incom...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
1,354
1,360
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,092
analyze_class
def analyze_class(self, defn: ClassDef) -> None: fullname = self.qualified_name(defn.name) if not defn.info and not self.is_core_builtin_class(defn): # Add placeholder so that self-references in base classes can be # resolved. We don't want this to cause a deferral, since if the...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
1,362
1,430
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,093
setup_type_vars
def setup_type_vars(self, defn: ClassDef, tvar_defs: list[TypeVarLikeType]) -> None: defn.type_vars = tvar_defs defn.info.type_vars = [] # we want to make sure any additional logic in add_type_vars gets run defn.info.add_type_vars()
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
1,432
1,436
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,094
setup_alias_type_vars
def setup_alias_type_vars(self, defn: ClassDef) -> None: assert defn.info.special_alias is not None defn.info.special_alias.alias_tvars = list(defn.info.type_vars) target = defn.info.special_alias.target assert isinstance(target, ProperType) if isinstance(target, TypedDictType): ...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
1,438
1,448
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,095
is_core_builtin_class
def is_core_builtin_class(self, defn: ClassDef) -> bool: return self.cur_mod_id == "builtins" and defn.name in CORE_BUILTIN_CLASSES
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
1,450
1,451
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,096
analyze_class_body_common
def analyze_class_body_common(self, defn: ClassDef) -> None: """Parts of class body analysis that are common to all kinds of class defs.""" self.enter_class(defn.info) defn.defs.accept(self) self.apply_class_plugin_hooks(defn) self.leave_class()
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
1,453
1,458
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,097
analyze_typeddict_classdef
def analyze_typeddict_classdef(self, defn: ClassDef) -> bool: if ( defn.info and defn.info.typeddict_type and not has_placeholder(defn.info.typeddict_type) ): # This is a valid TypedDict, and it is fully analyzed. return True is_typeddi...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
1,460
1,480
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,098
analyze_namedtuple_classdef
def analyze_namedtuple_classdef( self, defn: ClassDef, tvar_defs: list[TypeVarLikeType] ) -> bool: """Check if this class can define a named tuple.""" if ( defn.info and defn.info.is_named_tuple and defn.info.tuple_type and not has_placeholder(...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
1,482
1,510
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,099
apply_class_plugin_hooks
def apply_class_plugin_hooks(self, defn: ClassDef) -> None: """Apply a plugin hook that may infer a more precise definition for a class.""" for decorator in defn.decorators: decorator_name = self.get_fullname_for_hook(decorator) if decorator_name: hook = self.plu...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
1,512
1,534
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }
6,068,100
get_fullname_for_hook
def get_fullname_for_hook(self, expr: Expression) -> str | None: if isinstance(expr, CallExpr): return self.get_fullname_for_hook(expr.callee) elif isinstance(expr, IndexExpr): return self.get_fullname_for_hook(expr.base) elif isinstance(expr, RefExpr): if exp...
python
python-3.10.8.amd64/Lib/site-packages/mypy/semanal.py
1,536
1,550
{ "name": "PortablePy/3.10.8.0", "url": "https://github.com/PortablePy/3.10.8.0.git", "license": "NOASSERTION", "stars": 0, "forks": 0 }