MCPcopy
hub / github.com/python/mypy / is_dunder

Function is_dunder

mypy/util.py:66–75  ·  view source on GitHub ↗

Returns whether name is a dunder name. Args: exclude_special: Whether to return False for a couple special dunder methods.

(name: str, exclude_special: bool = False)

Source from the content-addressed store, hash-verified

64
65
66def is_dunder(name: str, exclude_special: bool = False) -> bool:
67 """Returns whether name is a dunder name.
68
69 Args:
70 exclude_special: Whether to return False for a couple special dunder methods.
71
72 """
73 if exclude_special and name in SPECIAL_DUNDERS:
74 return False
75 return name.startswith("__") and name.endswith("__")
76
77
78def is_sunder(name: str) -> bool:

Callers 9

is_final_enum_valueMethod · 0.90
infer_variable_typeMethod · 0.90
store_final_statusMethod · 0.90
verify_typeinfoFunction · 0.90
_verify_arg_nameFunction · 0.90
_verify_signatureFunction · 0.90
is_probably_privateFunction · 0.90
is_sunderFunction · 0.85

Calls 2

startswithMethod · 0.45
endswithMethod · 0.45

Tested by 5

verify_typeinfoFunction · 0.72
_verify_arg_nameFunction · 0.72
_verify_signatureFunction · 0.72
is_probably_privateFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…