Skip to content

Commit

Permalink
vendors: sync packages and update tomlkit
Browse files Browse the repository at this point in the history
  • Loading branch information
abn authored and finswimmer committed Aug 25, 2020
1 parent d2bb112 commit d04d1a9
Show file tree
Hide file tree
Showing 24 changed files with 497 additions and 244 deletions.
4 changes: 2 additions & 2 deletions poetry/core/_vendor/packaging/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
__summary__ = "Core utilities for Python packages"
__uri__ = "https://github.com/pypa/packaging"

__version__ = "20.3"
__version__ = "20.4"

__author__ = "Donald Stufft and individual contributors"
__email__ = "[email protected]"

__license__ = "BSD or Apache License, Version 2.0"
__license__ = "BSD-2-Clause or Apache-2.0"
__copyright__ = "Copyright 2014-2019 %s" % __author__
4 changes: 2 additions & 2 deletions poetry/core/_vendor/packaging/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

import sys

from ._typing import MYPY_CHECK_RUNNING
from ._typing import TYPE_CHECKING

if MYPY_CHECK_RUNNING: # pragma: no cover
if TYPE_CHECKING: # pragma: no cover
from typing import Any, Dict, Tuple, Type


Expand Down
29 changes: 19 additions & 10 deletions poetry/core/_vendor/packaging/_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,31 @@
In packaging, all static-typing related imports should be guarded as follows:
from packaging._typing import MYPY_CHECK_RUNNING
from packaging._typing import TYPE_CHECKING
if MYPY_CHECK_RUNNING:
if TYPE_CHECKING:
from typing import ...
Ref: https://github.com/python/mypy/issues/3216
"""

MYPY_CHECK_RUNNING = False
__all__ = ["TYPE_CHECKING", "cast"]

if MYPY_CHECK_RUNNING: # pragma: no cover
import typing

cast = typing.cast
# The TYPE_CHECKING constant defined by the typing module is False at runtime
# but True while type checking.
if False: # pragma: no cover
from typing import TYPE_CHECKING
else:
TYPE_CHECKING = False

# typing's cast syntax requires calling typing.cast at runtime, but we don't
# want to import typing at runtime. Here, we inform the type checkers that
# we're importing `typing.cast` as `cast` and re-implement typing.cast's
# runtime behavior in a block that is ignored by type checkers.
if TYPE_CHECKING: # pragma: no cover
# not executed at runtime
from typing import cast
else:
# typing's cast() is needed at runtime, but we don't want to import typing.
# Thus, we use a dummy no-op version, which we tell mypy to ignore.
def cast(type_, value): # type: ignore
# executed at runtime
def cast(type_, value): # noqa
return value
4 changes: 2 additions & 2 deletions poetry/core/_vendor/packaging/markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
from pyparsing import Literal as L # noqa

from ._compat import string_types
from ._typing import MYPY_CHECK_RUNNING
from ._typing import TYPE_CHECKING
from .specifiers import Specifier, InvalidSpecifier

if MYPY_CHECK_RUNNING: # pragma: no cover
if TYPE_CHECKING: # pragma: no cover
from typing import Any, Callable, Dict, List, Optional, Tuple, Union

Operator = Callable[[str, str], bool]
Expand Down
4 changes: 2 additions & 2 deletions poetry/core/_vendor/packaging/requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
from pyparsing import Literal as L # noqa
from six.moves.urllib import parse as urlparse

from ._typing import MYPY_CHECK_RUNNING
from ._typing import TYPE_CHECKING
from .markers import MARKER_EXPR, Marker
from .specifiers import LegacySpecifier, Specifier, SpecifierSet

if MYPY_CHECK_RUNNING: # pragma: no cover
if TYPE_CHECKING: # pragma: no cover
from typing import List


Expand Down
26 changes: 20 additions & 6 deletions poetry/core/_vendor/packaging/specifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
import re

from ._compat import string_types, with_metaclass
from ._typing import MYPY_CHECK_RUNNING
from ._typing import TYPE_CHECKING
from .utils import canonicalize_version
from .version import Version, LegacyVersion, parse

if MYPY_CHECK_RUNNING: # pragma: no cover
if TYPE_CHECKING: # pragma: no cover
from typing import (
List,
Dict,
Expand Down Expand Up @@ -132,9 +133,14 @@ def __str__(self):
# type: () -> str
return "{0}{1}".format(*self._spec)

@property
def _canonical_spec(self):
# type: () -> Tuple[str, Union[Version, str]]
return self._spec[0], canonicalize_version(self._spec[1])

def __hash__(self):
# type: () -> int
return hash(self._spec)
return hash(self._canonical_spec)

def __eq__(self, other):
# type: (object) -> bool
Expand All @@ -146,7 +152,7 @@ def __eq__(self, other):
elif not isinstance(other, self.__class__):
return NotImplemented

return self._spec == other._spec
return self._canonical_spec == other._canonical_spec

def __ne__(self, other):
# type: (object) -> bool
Expand Down Expand Up @@ -510,12 +516,20 @@ def _compare_not_equal(self, prospective, spec):
@_require_version_compare
def _compare_less_than_equal(self, prospective, spec):
# type: (ParsedVersion, str) -> bool
return prospective <= Version(spec)

# NB: Local version identifiers are NOT permitted in the version
# specifier, so local version labels can be universally removed from
# the prospective version.
return Version(prospective.public) <= Version(spec)

@_require_version_compare
def _compare_greater_than_equal(self, prospective, spec):
# type: (ParsedVersion, str) -> bool
return prospective >= Version(spec)

# NB: Local version identifiers are NOT permitted in the version
# specifier, so local version labels can be universally removed from
# the prospective version.
return Version(prospective.public) >= Version(spec)

@_require_version_compare
def _compare_less_than(self, prospective, spec_str):
Expand Down
18 changes: 15 additions & 3 deletions poetry/core/_vendor/packaging/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import sysconfig
import warnings

from ._typing import MYPY_CHECK_RUNNING, cast
from ._typing import TYPE_CHECKING, cast

if MYPY_CHECK_RUNNING: # pragma: no cover
if TYPE_CHECKING: # pragma: no cover
from typing import (
Dict,
FrozenSet,
Expand Down Expand Up @@ -58,6 +58,12 @@


class Tag(object):
"""
A representation of the tag triple for a wheel.
Instances are considered immutable and thus are hashable. Equality checking
is also supported.
"""

__slots__ = ["_interpreter", "_abi", "_platform"]

Expand Down Expand Up @@ -108,6 +114,12 @@ def __repr__(self):

def parse_tag(tag):
# type: (str) -> FrozenSet[Tag]
"""
Parses the provided tag (e.g. `py3-none-any`) into a frozenset of Tag instances.
Returning a set is required due to the possibility that the tag is a
compressed tag set.
"""
tags = set()
interpreters, abis, platforms = tag.split("-")
for interpreter in interpreters.split("."):
Expand Down Expand Up @@ -541,7 +553,7 @@ def __init__(self, file):
def unpack(fmt):
# type: (str) -> int
try:
result, = struct.unpack(
(result,) = struct.unpack(
fmt, file.read(struct.calcsize(fmt))
) # type: (int, )
except struct.error:
Expand Down
13 changes: 8 additions & 5 deletions poetry/core/_vendor/packaging/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,22 @@

import re

from ._typing import MYPY_CHECK_RUNNING
from ._typing import TYPE_CHECKING, cast
from .version import InvalidVersion, Version

if MYPY_CHECK_RUNNING: # pragma: no cover
from typing import Union
if TYPE_CHECKING: # pragma: no cover
from typing import NewType, Union

NormalizedName = NewType("NormalizedName", str)

_canonicalize_regex = re.compile(r"[-_.]+")


def canonicalize_name(name):
# type: (str) -> str
# type: (str) -> NormalizedName
# This is taken from PEP 503.
return _canonicalize_regex.sub("-", name).lower()
value = _canonicalize_regex.sub("-", name).lower()
return cast("NormalizedName", value)


def canonicalize_version(_version):
Expand Down
4 changes: 2 additions & 2 deletions poetry/core/_vendor/packaging/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import re

from ._structures import Infinity, NegativeInfinity
from ._typing import MYPY_CHECK_RUNNING
from ._typing import TYPE_CHECKING

if MYPY_CHECK_RUNNING: # pragma: no cover
if TYPE_CHECKING: # pragma: no cover
from typing import Callable, Iterator, List, Optional, SupportsInt, Tuple, Union

from ._structures import InfinityType, NegativeInfinityType
Expand Down
45 changes: 31 additions & 14 deletions poetry/core/_vendor/pyparsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@
namespace class
"""

__version__ = "2.4.6"
__versionTime__ = "24 Dec 2019 04:27 UTC"
__version__ = "2.4.7"
__versionTime__ = "30 Mar 2020 00:43 UTC"
__author__ = "Paul McGuire <[email protected]>"

import string
Expand Down Expand Up @@ -1391,6 +1391,12 @@ def inlineLiteralsUsing(cls):
"""
ParserElement._literalStringClass = cls

@classmethod
def _trim_traceback(cls, tb):
while tb.tb_next:
tb = tb.tb_next
return tb

def __init__(self, savelist=False):
self.parseAction = list()
self.failAction = None
Expand Down Expand Up @@ -1943,7 +1949,9 @@ def parseString(self, instring, parseAll=False):
if ParserElement.verbose_stacktrace:
raise
else:
# catch and re-raise exception from here, clears out pyparsing internal stack trace
# catch and re-raise exception from here, clearing out pyparsing internal stack trace
if getattr(exc, '__traceback__', None) is not None:
exc.__traceback__ = self._trim_traceback(exc.__traceback__)
raise exc
else:
return tokens
Expand Down Expand Up @@ -2017,7 +2025,9 @@ def scanString(self, instring, maxMatches=_MAX_INT, overlap=False):
if ParserElement.verbose_stacktrace:
raise
else:
# catch and re-raise exception from here, clears out pyparsing internal stack trace
# catch and re-raise exception from here, clearing out pyparsing internal stack trace
if getattr(exc, '__traceback__', None) is not None:
exc.__traceback__ = self._trim_traceback(exc.__traceback__)
raise exc

def transformString(self, instring):
Expand Down Expand Up @@ -2063,7 +2073,9 @@ def transformString(self, instring):
if ParserElement.verbose_stacktrace:
raise
else:
# catch and re-raise exception from here, clears out pyparsing internal stack trace
# catch and re-raise exception from here, clearing out pyparsing internal stack trace
if getattr(exc, '__traceback__', None) is not None:
exc.__traceback__ = self._trim_traceback(exc.__traceback__)
raise exc

def searchString(self, instring, maxMatches=_MAX_INT):
Expand Down Expand Up @@ -2093,7 +2105,9 @@ def searchString(self, instring, maxMatches=_MAX_INT):
if ParserElement.verbose_stacktrace:
raise
else:
# catch and re-raise exception from here, clears out pyparsing internal stack trace
# catch and re-raise exception from here, clearing out pyparsing internal stack trace
if getattr(exc, '__traceback__', None) is not None:
exc.__traceback__ = self._trim_traceback(exc.__traceback__)
raise exc

def split(self, instring, maxsplit=_MAX_INT, includeSeparators=False):
Expand Down Expand Up @@ -2565,7 +2579,9 @@ def parseFile(self, file_or_filename, parseAll=False):
if ParserElement.verbose_stacktrace:
raise
else:
# catch and re-raise exception from here, clears out pyparsing internal stack trace
# catch and re-raise exception from here, clearing out pyparsing internal stack trace
if getattr(exc, '__traceback__', None) is not None:
exc.__traceback__ = self._trim_traceback(exc.__traceback__)
raise exc

def __eq__(self, other):
Expand Down Expand Up @@ -2724,7 +2740,7 @@ def runTests(self, tests, parseAll=True, comment='#',
continue
if not t:
continue
out = ['\n'.join(comments), t]
out = ['\n' + '\n'.join(comments) if comments else '', t]
comments = []
try:
# convert newline marks to actual newlines, and strip leading BOM if present
Expand Down Expand Up @@ -3312,7 +3328,7 @@ def __init__(self, pattern, flags=0, asGroupList=False, asMatch=False):
self.name = _ustr(self)
self.errmsg = "Expected " + self.name
self.mayIndexError = False
self.mayReturnEmpty = True
self.mayReturnEmpty = self.re_match("") is not None
self.asGroupList = asGroupList
self.asMatch = asMatch
if self.asGroupList:
Expand Down Expand Up @@ -3993,6 +4009,7 @@ def __init__(self, *args, **kwargs):
self.leaveWhitespace()

def __init__(self, exprs, savelist=True):
exprs = list(exprs)
if exprs and Ellipsis in exprs:
tmp = []
for i, expr in enumerate(exprs):
Expand Down Expand Up @@ -4358,7 +4375,7 @@ def parseImpl(self, instring, loc, doActions=True):
if self.initExprGroups:
self.opt1map = dict((id(e.expr), e) for e in self.exprs if isinstance(e, Optional))
opt1 = [e.expr for e in self.exprs if isinstance(e, Optional)]
opt2 = [e for e in self.exprs if e.mayReturnEmpty and not isinstance(e, Optional)]
opt2 = [e for e in self.exprs if e.mayReturnEmpty and not isinstance(e, (Optional, Regex))]
self.optionals = opt1 + opt2
self.multioptionals = [e.expr for e in self.exprs if isinstance(e, ZeroOrMore)]
self.multirequired = [e.expr for e in self.exprs if isinstance(e, OneOrMore)]
Expand Down Expand Up @@ -5435,8 +5452,8 @@ def mustMatchTheseTokens(s, l, t):
return rep

def _escapeRegexRangeChars(s):
# ~ escape these chars: ^-]
for c in r"\^-]":
# ~ escape these chars: ^-[]
for c in r"\^-[]":
s = s.replace(c, _bslash + c)
s = s.replace("\n", r"\n")
s = s.replace("\t", r"\t")
Expand Down Expand Up @@ -6550,10 +6567,10 @@ class pyparsing_common:
"""mixed integer of the form 'integer - fraction', with optional leading integer, returns float"""
mixed_integer.addParseAction(sum)

real = Regex(r'[+-]?(:?\d+\.\d*|\.\d+)').setName("real number").setParseAction(convertToFloat)
real = Regex(r'[+-]?(?:\d+\.\d*|\.\d+)').setName("real number").setParseAction(convertToFloat)
"""expression that parses a floating point number and returns a float"""

sci_real = Regex(r'[+-]?(:?\d+(:?[eE][+-]?\d+)|(:?\d+\.\d*|\.\d+)(:?[eE][+-]?\d+)?)').setName("real number with scientific notation").setParseAction(convertToFloat)
sci_real = Regex(r'[+-]?(?:\d+(?:[eE][+-]?\d+)|(?:\d+\.\d*|\.\d+)(?:[eE][+-]?\d+)?)').setName("real number with scientific notation").setParseAction(convertToFloat)
"""expression that parses a floating point number with optional
scientific notation and returns a float"""

Expand Down
Loading

0 comments on commit d04d1a9

Please sign in to comment.