Upgrade toml to 0.10.2

This commit is contained in:
Pradyun Gedam 2020-11-19 14:22:01 +00:00
parent 910b304a97
commit 74b1db4f64
No known key found for this signature in database
GPG Key ID: FF99710C4332258E
7 changed files with 13 additions and 10 deletions

1
news/toml.vendor.rst Normal file
View File

@ -0,0 +1 @@
Upgrade toml to 0.10.2

View File

@ -6,7 +6,7 @@ Released under the MIT license.
from pip._vendor.toml import encoder
from pip._vendor.toml import decoder
__version__ = "0.10.1"
__version__ = "0.10.2"
_spec_ = "0.5.0"
load = decoder.load

View File

@ -1,6 +0,0 @@
# content after the \
escapes = ['0', 'b', 'f', 'n', 'r', 't', '"']
# What it should be replaced by
escapedchars = ['\0', '\b', '\f', '\n', '\r', '\t', '\"']
# Used for substitution
escape_to_escapedchars = dict(zip(_escapes, _escapedchars))

View File

@ -440,7 +440,8 @@ def loads(s, _dict=dict, decoder=None):
groups[i][0] == "'"):
groupstr = groups[i]
j = i + 1
while not groupstr[0] == groupstr[-1]:
while ((not groupstr[0] == groupstr[-1]) or
len(groupstr) == 1):
j += 1
if j > len(groups) + 2:
raise TomlDecodeError("Invalid group name '" +
@ -811,8 +812,12 @@ class TomlDecoder(object):
raise ValueError("Empty value is invalid")
if v == 'true':
return (True, "bool")
elif v.lower() == 'true':
raise ValueError("Only all lowercase booleans allowed")
elif v == 'false':
return (False, "bool")
elif v.lower() == 'false':
raise ValueError("Only all lowercase booleans allowed")
elif v[0] == '"' or v[0] == "'":
quotechar = v[0]
testv = v[1:].split(quotechar)

View File

@ -61,7 +61,7 @@ def dumps(o, encoder=None):
retval += addtoretval
outer_objs = [id(o)]
while sections:
section_ids = [id(section) for section in sections]
section_ids = [id(section) for section in sections.values()]
for outer_obj in outer_objs:
if outer_obj in section_ids:
raise ValueError("Circular reference detected")

View File

@ -11,6 +11,9 @@ class TomlTz(tzinfo):
self._hours = int(self._raw_offset[1:3])
self._minutes = int(self._raw_offset[4:6])
def __deepcopy__(self, memo):
return self.__class__(self._raw_offset)
def tzname(self, dt):
return "UTC" + self._raw_offset

View File

@ -20,5 +20,5 @@ resolvelib==0.5.2
retrying==1.3.3
setuptools==44.0.0
six==1.15.0
toml==0.10.1
toml==0.10.2
webencodings==0.5.1