# =========================
# New errors in Python 3.11
# =========================

# =======
# >= 3.11
# =======

# Only exists for an error message.
typing.NewType.__mro_entries__


# =========
# 3.11 only
# =========

# Not strictly speaking a staticmethod on 3.11, but it acts like one:
enum.StrEnum._generate_next_value_


# ====================================
# Pre-existing errors from Python 3.10
# ====================================


# ============
# 3.10 to 3.11
# ============

importlib.metadata._meta.SimplePath.__truediv__  # Runtime definition of protocol is incorrect


# =======
# <= 3.11
# =======

enum.Enum._generate_next_value_
importlib.abc.Finder.find_module
urllib.request.HTTPPasswordMgrWithPriorAuth.__init__  # Args are passed as is to super, so super args are specified
xml.etree.ElementTree.Element.__bool__  # Doesn't really exist; see comments in stub


# =======
# <= 3.12
# =======

# Exists at runtime, but missing from stubs
lib2to3.btm_utils
lib2to3.fixer_util
lib2to3.patcomp
lib2to3.pgen2.grammar.Grammar.loads
lib2to3.pygram.pattern_symbols
lib2to3.pygram.python_symbols
lib2to3.pytree.Base.__new__
lib2to3.pytree.Base.children
lib2to3.pytree.Base.type
lib2to3.pytree.BasePattern.__new__
lib2to3.pytree.BasePattern.type
lib2to3.pytree.NegatedPattern.match
lib2to3.pytree.NegatedPattern.match_seq
tkinter.tix.[A-Z_]+
tkinter.tix.CObjView
tkinter.tix.DialogShell
tkinter.tix.ExFileSelectDialog
tkinter.tix.FileSelectDialog
tkinter.tix.FileTypeList
tkinter.tix.Grid
tkinter.tix.NoteBookFrame
tkinter.tix.OptionName
tkinter.tix.ResizeHandle
tkinter.tix.ScrolledGrid
tkinter.tix.ScrolledHList
tkinter.tix.ScrolledListBox
tkinter.tix.ScrolledTList
tkinter.tix.ScrolledText
tkinter.tix.ScrolledWindow
tkinter.tix.Shell
tkinter.tix.TclVersion
tkinter.tix.TkVersion

# Details of runtime definition don't need to be in stubs
typing_extensions\.ParamSpec.*
typing_extensions\.TypeVar.*

# These are typing._SpecialGenericAlias at runtime, which is not a real type, but it
# behaves like one in most cases
typing(_extensions)?\.(Async)?ContextManager


# =======
# <= 3.13
# =======

ast.Ellipsis.__new__  # Implementation has *args, but shouldn't allow any

_?hashlib.scrypt  # Raises TypeError if salt, n, r or p are None

# Will always raise. Not included to avoid type checkers inferring that
# TypeAliasType instances are callable.
typing_extensions.TypeAliasType.__call__


# ============
# 3.11 to 3.13
# ============

enum.Enum.__init__


# =====
# <3.15
# =====

tkinter.simpledialog.[A-Z_]+
tkinter.simpledialog.TclVersion
tkinter.simpledialog.TkVersion

# The runtime does some hacks to deprecate passing various parameters
# positionally or by keyword. We just present a signature in the stub
# that describes the way users are supposed to call the constructor.
typing_extensions.sentinel.__init__


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

# typing.IO uses positional-or-keyword arguments, but in the stubs we prefer
# to mark these as positional-only for compatibility with existing sub-classes.
typing(_extensions)?\.BinaryIO\.write
typing(_extensions)?\.IO\.read
typing(_extensions)?\.IO\.readline
typing(_extensions)?\.IO\.readlines
typing(_extensions)?\.IO\.seek
typing(_extensions)?\.IO\.truncate
typing(_extensions)?\.IO\.write
typing(_extensions)?\.IO\.writelines

# These have a pos-or-keyword first parameter at runtime, but deliberately have a pos-only first parameter in the stub. #6812
posixpath.join
ntpath.join


# =============================================================
# 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\._SpecialForm.*  # Super-special typing primitive
typing\.LiteralString  # Super-special typing primitive


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

# We pretend it's a read-only property for forward compatibility with 3.12
typing\.TypeVar\.__.*__
typing\.ParamSpec\.__.*__


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

configparser.LegacyInterpolation.__init__  # runtime is *args, **kwargs, but it's just a passthrough


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

# Deprecation wrapper classes; their methods are just pass-through, so we can ignore them.
importlib.metadata.DeprecatedList.reverse
importlib.metadata.DeprecatedList.sort

# We pretend it's a read-only property for forward compatibility with 3.12
typing.ParamSpec(Args|Kwargs).__origin__


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

argparse._MutuallyExclusiveGroup.add_mutually_exclusive_group  # deprecated, forwards arguments to super


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

.*.__buffer__  # We lie about the existence of these methods
.*.__release_buffer__  # We lie about the existence of these methods
asynchat.async_chat.encoding  # Removed in 3.12
asynchat.async_chat.use_encoding  # Removed in 3.12
asynchat.find_prefix_at_end  # Removed in 3.12
asyncore.dispatcher.addr  # Removed in 3.12
asyncore.dispatcher.handle_accepted  # Removed in 3.12
ctypes.test  # Modules that exist at runtime, but shouldn't be added to typeshed
ctypes\.test\..+  # Modules that exist at runtime, but shouldn't be added to typeshed
distutils\..*  # Removed in 3.12
lib2to3.tests  # Modules that exist at runtime, but shouldn't be added to typeshed
lib2to3\.tests\..+  # Modules that exist at runtime, but shouldn't be added to typeshed
pkgutil.ImpImporter\..*  # Removed in 3.12
pkgutil.ImpLoader\..*  # Removed in 3.12
platform.platform  # runtime default is 0, we pretend it's a bool
poplib.POP3_SSL.stls  # bad declaration of inherited function. See poplib.pyi
tkinter.test  # Modules that exist at runtime, but shouldn't be added to typeshed
tkinter\.test\..+  # Modules that exist at runtime, but shouldn't be added to typeshed

# We call them read-only properties, runtime implementation is slightly different
typing_extensions\.TypeAliasType\.__(parameters|type_params|name|module|value)__

unittest.test  # Modules that exist at runtime, but shouldn't be added to typeshed
unittest\.test\..+  # Modules that exist at runtime, but shouldn't be added to typeshed


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

# Undocumented implementation details
cgi.FieldStorage.bufsize
cgi.FieldStorage.read_binary
cgi.FieldStorage.read_lines
cgi.FieldStorage.read_lines_to_eof
cgi.FieldStorage.read_lines_to_outerboundary
cgi.FieldStorage.read_multi
cgi.FieldStorage.read_single
cgi.FieldStorage.read_urlencoded
cgi.FieldStorage.skip_lines

ctypes._endian.DEFAULT_MODE  # Incorrectly star import.
ctypes._endian.RTLD_GLOBAL  # Incorrectly star import.
ctypes._endian.RTLD_LOCAL  # Incorrectly star import.

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

# Runtime signature is incorrect (https://github.com/python/cpython/issues/93021)
multiprocessing.managers.DictProxy.clear
multiprocessing.managers.DictProxy.popitem

# Undocumented implementation details
pipes.Template.makepipeline
pipes.Template.open_r
pipes.Template.open_w
sunau.Au_read.initfp
sunau.Au_write.initfp

threading.Lock  # Factory function at runtime, but that wouldn't let us use it in type hints
types.SimpleNamespace.__init__  # class doesn't accept positional arguments but has default C signature
typing_extensions\.Annotated  # Undocumented implementation details
typing\.Annotated  # Super-special typing primitive

# These methods have no default implementation for Python < 3.13.
_pickle.Pickler.persistent_id
_pickle.Unpickler.persistent_load
