Files
pipenv/tasks/vendoring/patches/patched/prettytoml.patch
Dan Ryan 6e463c3cb0 Update safety.zip, re-update vendored deps
- Move patches to separate subdirectories
- Refactor vendoring scripts

Signed-off-by: Dan Ryan <dan@danryan.co>
2018-04-22 09:48:36 -04:00

79 lines
3.0 KiB
Diff

diff --git a/pipenv/patched/prettytoml/_version.py b/pipenv/patched/prettytoml/_version.py
index 4f146e6..e0f1547 100644
--- a/pipenv/patched/prettytoml/_version.py
+++ b/pipenv/patched/prettytoml/_version.py
@@ -1 +1 @@
-VERSION = '0.03'
+VERSION = 'master'
diff --git a/pipenv/patched/prettytoml/elements/table.py b/pipenv/patched/prettytoml/elements/table.py
index f78a6d1..cdc3ed4 100644
--- a/pipenv/patched/prettytoml/elements/table.py
+++ b/pipenv/patched/prettytoml/elements/table.py
@@ -94,9 +94,9 @@ class TableElement(abstracttable.AbstractTable):
value_element,
factory.create_newline_element(),
]
-
+
insertion_index = self._find_insertion_index()
-
+
self._sub_elements = \
self.sub_elements[:insertion_index] + inserted_elements + self.sub_elements[insertion_index:]
@@ -105,11 +105,16 @@ class TableElement(abstracttable.AbstractTable):
preceding_newline = self._find_preceding_newline(begin)
if preceding_newline >= 0:
begin = preceding_newline
- end = self._find_following_newline(begin)
+ end = self._find_following_line_terminator(begin)
if end < 0:
end = len(tuple(self._sub_elements))
self._sub_elements = self.sub_elements[:begin] + self.sub_elements[end:]
+ def pop(self, key):
+ v = self[key]
+ del self[key]
+ return v
+
def value(self):
return self
diff --git a/pipenv/patched/prettytoml/tokens/py2toml.py b/pipenv/patched/prettytoml/tokens/py2toml.py
index 3db97b4..8299195 100644
--- a/pipenv/patched/prettytoml/tokens/py2toml.py
+++ b/pipenv/patched/prettytoml/tokens/py2toml.py
@@ -5,11 +5,8 @@ A converter of python values to TOML Token instances.
import codecs
import datetime
import six
-import strict_rfc3339
-import timestamp
from prettytoml import tokens
import re
-from prettytoml.elements.metadata import NewlineElement
from prettytoml.errors import TOMLError
from prettytoml.tokens import Token
from prettytoml.util import chunkate_string
@@ -49,15 +46,17 @@ def create_primitive_token(value, multiline_strings_allowed=True):
elif isinstance(value, float):
return tokens.Token(tokens.TYPE_FLOAT, u'{}'.format(value))
elif isinstance(value, (datetime.datetime, datetime.date, datetime.time)):
- ts = timestamp(value) // 1000
- return tokens.Token(tokens.TYPE_DATE, strict_rfc3339.timestamp_to_rfc3339_utcoffset(ts))
+ s = value.isoformat()
+ if s.endswith('+00:00'):
+ s = s[:-6] + 'Z'
+ return tokens.Token(tokens.TYPE_DATE, s)
elif isinstance(value, six.string_types):
return create_string_token(value, multiline_strings_allowed=multiline_strings_allowed)
raise NotPrimitiveError("{} of type {}".format(value, type(value)))
-_bare_string_regex = re.compile('^[a-zA-Z0-9_-]*$')
+_bare_string_regex = re.compile('^[a-zA-Z_-]*$')
def create_string_token(text, bare_string_allowed=False, multiline_strings_allowed=True):