# ============================================
# TODO: Allowlist entries that should be fixed
# ============================================

_frozen_importlib.BuiltinImporter.load_module
_frozen_importlib.FrozenImporter.load_module
_frozen_importlib_external.FileFinder.discover
_frozen_importlib_external.NamespaceLoader.load_module
_frozen_importlib_external.NamespacePath
_frozen_importlib_external.PathFinder.discover
_frozen_importlib_external.SourceFileLoader.source_to_code
_frozen_importlib_external.SourceLoader.source_to_code
_frozen_importlib_external._LoaderBasics.load_module
_frozen_importlib_external.cache_from_source
_struct.Struct.pack_into
_struct.pack
_struct.pack_into
_thread.RLock.__exit__
_thread.lock.__exit__
dataclasses.MISSING
dataclasses._MISSING_TYPE
dataclasses.field
importlib._abc.Loader.load_module
importlib._bootstrap_external.NamespacePath
importlib.abc.MetaPathFinder.discover
importlib.abc.PathEntryFinder.discover
importlib.resources._common.package_to_anchor
mailbox._ProxyFile.__class_getitem__
multiprocessing.process.BaseProcess.__init__
threading.Condition.locked
tkinter.Image.__iter__
tkinter.Misc.__iter__
tkinter.font.Font.__iter__

# =============================================================
# Allowlist entries that cannot or should not be fixed; >= 3.15
# =============================================================

# runtime default is a list object used as a sentinel
base64.b64decode
urllib.parse.urlunparse
urllib.parse.urlunsplit

# Internal implementation details of the sampling profiler.
profiling.sampling.binary_collector
profiling.sampling.binary_reader
profiling.sampling.cli
profiling.sampling.constants
profiling.sampling.dump
profiling.sampling.errors
profiling.sampling.heatmap_collector.FileStats
profiling.sampling.heatmap_collector.TreeNode
profiling.sampling.module_utils
profiling.sampling.opcode_utils
profiling.sampling.sample

# These aliases are just like the aliases named "slaves" instead of "content".
# See common.txt.
tkinter.Grid.content
tkinter.Grid.grid_content
tkinter.Pack.content
tkinter.Pack.pack_content
tkinter.Place.content
tkinter.Place.place_content


# =============================================================
# Allowlist entries that cannot or should not be fixed; >= 3.14
# =============================================================

# Undocumented private attributes
.*\.ForwardRef\.__arg__
.*\.ForwardRef\.__ast_node__
.*\.ForwardRef\.__cell__
.*\.ForwardRef\.__code__
.*\.ForwardRef\.__extra_names__
.*\.ForwardRef\.__globals__
.*\.ForwardRef\.__init_subclass__
.*\.ForwardRef\.__owner__
.*\.ForwardRef\.__stringifier_dict__

# Runtime AST node runtime constructor behaviour is too loose.
# For static typing, the loose behaviour is undesirable (https://github.com/python/typeshed/issues/8378).
# For the runtime, the loose behaviour is deprecated in Python 3.13 (https://github.com/python/cpython/issues/105858).
_?ast.type_param.__init__

# Decorator approximated by classmethod
concurrent.interpreters._crossinterp.classonly.*
# Method using this decorator
concurrent.interpreters._crossinterp.UnboundItem.singleton

# object() sentinels at runtime represented by NewTypes in the stubs
concurrent.interpreters._crossinterp.UNBOUND_ERROR
concurrent.interpreters._crossinterp.UNBOUND_REMOVE

# Assigning `__new__` causes `func` not to get recognized.
functools.partialmethod.__new__

# These protocols use ABC hackery at runtime.
(io|typing_extensions)\.Reader\.__class_getitem__
(io|typing_extensions)\.Reader\.read
(io|typing_extensions)\.Writer\.__class_getitem__
(io|typing_extensions)\.Writer\.write

# These multiprocessing proxy methods have *args, **kwargs signatures at runtime,
# but have more precise (accurate) signatures in the stub.
multiprocessing.managers.BaseListProxy.clear
multiprocessing.managers.BaseListProxy.copy
multiprocessing.managers._BaseDictProxy.__reversed__
multiprocessing.managers._BaseSetProxy.__iter__
multiprocessing.managers._BaseSetProxy.__len__
multiprocessing.managers._BaseSetProxy.clear
multiprocessing.managers._BaseSetProxy.copy
multiprocessing.managers._BaseSetProxy.pop

# Union and UnionType are aliases in 3.14 but type checkers need some changes.
typing.Union
types.UnionType.__class_getitem__
types.UnionType.__mro_entries__
types.UnionType.__name__
types.UnionType.__qualname__


# =============================================================
# Allowlist entries that cannot or should not be fixed; >= 3.13
# =============================================================

_pyrepl\..+  # The internal implementation of the REPL on py313+; not for public consumption
codecs.backslashreplace_errors  # Runtime incorrectly has `self`
codecs.ignore_errors  # Runtime incorrectly has `self`
codecs.namereplace_errors  # Runtime incorrectly has `self`
codecs.replace_errors  # Runtime incorrectly has `self`
codecs.strict_errors  # Runtime incorrectly has `self`
codecs.xmlcharrefreplace_errors  # Runtime incorrectly has `self`

# These multiprocessing proxy methods have *args, **kwargs signatures at runtime,
# but have more precise (accurate) signatures in the stub.
multiprocessing.managers._BaseDictProxy.__iter__
multiprocessing.managers._BaseDictProxy.__len__
multiprocessing.managers._BaseDictProxy.clear
multiprocessing.managers._BaseDictProxy.copy
multiprocessing.managers._BaseDictProxy.items
multiprocessing.managers._BaseDictProxy.keys
multiprocessing.managers._BaseDictProxy.popitem
multiprocessing.managers._BaseDictProxy.values

# To match `dict`, we lie about the runtime, but use overloads to match the correct behavior.
types.MappingProxyType.get

typing_extensions.Protocol  # Super-special typing primitive


# =============================================================
# Allowlist entries that cannot or should not be fixed; >= 3.12
# =============================================================

# Deprecated argument is supported at runtime by renaming it through a decorator.
importlib.resources._common.files

sys._monitoring  # Doesn't really exist. See comments in the stub.
sys.__jit  # Similar to sys._monitoring
sys.last_exc  # Not always defined.

# Types that require `__setattr__` and `__delattr__` for typing purposes.
types.SimpleNamespace.__delattr__
types.SimpleNamespace.__setattr__

# These only exist to give a better error message if you try to subclass an instance.
typing.ParamSpec.__mro_entries__
typing.ParamSpecArgs.__mro_entries__
typing.ParamSpecKwargs.__mro_entries__
typing.TypeVar.__mro_entries__
typing.TypeVarTuple.__mro_entries__

# These exist at runtime because the protocol uses PEP 695 syntax in CPython.
typing.SupportsAbs.__type_params__
typing.SupportsRound.__type_params__


# =============================================================
# Allowlist entries that cannot or should not be fixed; >= 3.11
# =============================================================

enum.auto.__init__  # The stub for enum.auto is nothing like the implementation
enum.auto.value  # The stub for enum.auto is nothing like the implementation
http.HTTPMethod.description  # Mutable instance attribute at runtime but we pretend it's a property
importlib.resources.abc.Traversable.open  # Problematic protocol signature at runtime, see source code comments.
inspect._ParameterKind.description  # Still exists, but stubtest can't see it
typing.LiteralString  # Super-special typing primitive
typing.NewType.__mro_entries__  # Only exists for an error message.
typing._SpecialForm.__mro_entries__  # Super-special typing primitive
