Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
272 changes: 146 additions & 126 deletions 272 Doc/howto/enum.rst

Large diffs are not rendered by default.

265 changes: 92 additions & 173 deletions 265 Doc/library/enum.rst

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions 4 Doc/library/ssl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2070,7 +2070,7 @@ to speed up repeated connections from the same clients.
:attr:`SSLContext.verify_flags` returns :class:`VerifyFlags` flags:

>>> ssl.create_default_context().verify_flags # doctest: +SKIP
<VerifyFlags.VERIFY_X509_TRUSTED_FIRST: 32768>
ssl.VERIFY_X509_TRUSTED_FIRST

.. attribute:: SSLContext.verify_mode

Expand All @@ -2082,7 +2082,7 @@ to speed up repeated connections from the same clients.
:attr:`SSLContext.verify_mode` returns :class:`VerifyMode` enum:

>>> ssl.create_default_context().verify_mode
<VerifyMode.CERT_REQUIRED: 2>
ssl.CERT_REQUIRED

.. index:: single: certificates

Expand Down
603 changes: 232 additions & 371 deletions 603 Lib/enum.py

Large diffs are not rendered by default.

30 changes: 16 additions & 14 deletions 30 Lib/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -2567,28 +2567,30 @@ class _empty:


class _ParameterKind(enum.IntEnum):
POSITIONAL_ONLY = 'positional-only'
POSITIONAL_OR_KEYWORD = 'positional or keyword'
VAR_POSITIONAL = 'variadic positional'
KEYWORD_ONLY = 'keyword-only'
VAR_KEYWORD = 'variadic keyword'

def __new__(cls, description):
value = len(cls.__members__)
member = int.__new__(cls, value)
member._value_ = value
member.description = description
return member
POSITIONAL_ONLY = 0
POSITIONAL_OR_KEYWORD = 1
VAR_POSITIONAL = 2
KEYWORD_ONLY = 3
VAR_KEYWORD = 4

def __str__(self):
return self.name
@property
def description(self):
return _PARAM_NAME_MAPPING[self]

_POSITIONAL_ONLY = _ParameterKind.POSITIONAL_ONLY
_POSITIONAL_OR_KEYWORD = _ParameterKind.POSITIONAL_OR_KEYWORD
_VAR_POSITIONAL = _ParameterKind.VAR_POSITIONAL
_KEYWORD_ONLY = _ParameterKind.KEYWORD_ONLY
_VAR_KEYWORD = _ParameterKind.VAR_KEYWORD

_PARAM_NAME_MAPPING = {
_POSITIONAL_ONLY: 'positional-only',
_POSITIONAL_OR_KEYWORD: 'positional or keyword',
_VAR_POSITIONAL: 'variadic positional',
_KEYWORD_ONLY: 'keyword-only',
_VAR_KEYWORD: 'variadic keyword'
}


class Parameter:
"""Represents a parameter in a function signature.
Expand Down
3 changes: 1 addition & 2 deletions 3 Lib/plistlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@
from xml.parsers.expat import ParserCreate


PlistFormat = enum.Enum('PlistFormat', 'FMT_XML FMT_BINARY', module=__name__)
globals().update(PlistFormat.__members__)
PlistFormat = enum.global_enum(enum.Enum('PlistFormat', 'FMT_XML FMT_BINARY', module=__name__))


class UID:
Expand Down
2 changes: 0 additions & 2 deletions 2 Lib/re.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,6 @@ class RegexFlag:
# sre extensions (experimental, don't rely on these)
TEMPLATE = T = sre_compile.SRE_FLAG_TEMPLATE # disable backtracking
DEBUG = sre_compile.SRE_FLAG_DEBUG # dump pattern after compilation
__str__ = object.__str__
_numeric_repr_ = hex

# sre exception
error = sre_compile.error
Expand Down
1 change: 1 addition & 0 deletions 1 Lib/ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
)
from _ssl import _DEFAULT_CIPHERS, _OPENSSL_API_VERSION


_IntEnum._convert_(
'_SSLMethod', __name__,
lambda name: name.startswith('PROTOCOL_') and name != 'PROTOCOL_SSLv23',
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.