summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2017-04-19 15:13:02 +0200
committerAnthon van der Neut <anthon@mnt.org>2017-04-19 15:13:02 +0200
commit870b961a3a6d72d8c7569cbc637c6cc553c1d907 (patch)
tree4185c36062b9b8c504075658b8dd5303285f3a20
parente3663d2b81399576b5a4edca9820971bf801e66a (diff)
downloadruamel.yaml-870b961a3a6d72d8c7569cbc637c6cc553c1d907.tar.gz
fix issue #116: Text not available in 3.5.0/3.5.10.14.8
If this solves the issue for you, please close it.
-rw-r--r--CHANGES4
-rw-r--r--README.rst4
-rw-r--r--__init__.py8
-rw-r--r--comments.py5
-rw-r--r--composer.py6
-rw-r--r--configobjwalker.py6
-rw-r--r--constructor.py23
-rw-r--r--events.py4
-rw-r--r--parser.py5
-rw-r--r--representer.py4
-rw-r--r--scalarint.py20
-rw-r--r--timestamp.py4
-rw-r--r--tokens.py4
13 files changed, 63 insertions, 34 deletions
diff --git a/CHANGES b/CHANGES
index 2bd6d23..dd6c8ba 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+[0, 14, 8]: 2017-04-19
+ - fix Text not available on 3.5.0 and 3.5.1, now proactively setting version guards
+ on all files (reported by `João Paulo Magalhães <https://bitbucket.org/jpmag/>`_)
+
[0, 14, 7]: 2017-04-18
- round trip of integers (decimal, octal, hex, binary) now preserve
leading zero(s) padding and underscores. Underscores are presumed
diff --git a/README.rst b/README.rst
index fcdefc6..a5dda6e 100644
--- a/README.rst
+++ b/README.rst
@@ -18,6 +18,10 @@ ChangeLog
.. should insert NEXT: at the beginning of line for next key
+0.14.8 (2017-04-19):
+ - fix Text not available on 3.5.0 and 3.5.1, now proactively setting version guards
+ on all files (reported by `João Paulo Magalhães <https://bitbucket.org/jpmag/>`_)
+
0.14.7 (2017-04-18):
- round trip of integers (decimal, octal, hex, binary) now preserve
leading zero(s) padding and underscores. Underscores are presumed
diff --git a/__init__.py b/__init__.py
index 9982d17..1ed58dc 100644
--- a/__init__.py
+++ b/__init__.py
@@ -6,12 +6,14 @@ from __future__ import print_function, absolute_import, division, unicode_litera
# ruamel.base installed __init__.py, and thus a new version should
# be installed at some point
-from typing import Dict, Any # NOQA
+import sys
+if sys.version_info >= (3, 5, 2):
+ from typing import Dict, Any # NOQA
_package_data = dict(
full_package_name='ruamel.yaml',
- version_info=(0, 14, 7),
- __version__='0.14.7',
+ version_info=(0, 14, 8),
+ __version__='0.14.8',
author='Anthon van der Neut',
author_email='a.van.der.neut@ruamel.eu',
description='ruamel.yaml is a YAML parser/emitter that supports roundtrip preservation of comments, seq/map flow style, and map key order', # NOQA
diff --git a/comments.py b/comments.py
index 1aa6222..6f6d3ee 100644
--- a/comments.py
+++ b/comments.py
@@ -8,13 +8,16 @@ these are not really related, formatting could be factored out as
a separate base
"""
-from typing import Any, Dict, Optional, List, Union # NOQA
import copy
from collections import MutableSet, Sized, Set
from ruamel.yaml.compat import ordereddict, PY2
+import sys
+if sys.version_info >= (3, 5, 2):
+ from typing import Any, Dict, Optional, List, Union # NOQA
+
__all__ = ["CommentedSeq", "CommentedKeySeq",
"CommentedMap", "CommentedOrderedMap",
"CommentedSet", 'comment_attrib', 'merge_attrib']
diff --git a/composer.py b/composer.py
index 1cfd3af..9eb5229 100644
--- a/composer.py
+++ b/composer.py
@@ -5,8 +5,6 @@ from __future__ import print_function
import warnings
-from typing import Any, Dict, Optional, List # NOQA
-
from ruamel.yaml.error import MarkedYAMLError, ReusedAnchorWarning
from ruamel.yaml.compat import utf8
@@ -18,6 +16,10 @@ from ruamel.yaml.nodes import (
MappingNode, ScalarNode, SequenceNode,
)
+import sys
+if sys.version_info >= (3, 5, 2):
+ from typing import Any, Dict, Optional, List # NOQA
+
__all__ = ['Composer', 'ComposerError']
diff --git a/configobjwalker.py b/configobjwalker.py
index f1005a0..1e44d6f 100644
--- a/configobjwalker.py
+++ b/configobjwalker.py
@@ -2,10 +2,12 @@
import warnings
-from typing import Any # NOQA
-
from ruamel.yaml.util import configobj_walker as new_configobj_walker
+import sys
+if sys.version_info >= (3, 5, 2):
+ from typing import Any # NOQA
+
def configobj_walker(cfg):
# type: (Any) -> Any
diff --git a/constructor.py b/constructor.py
index a4c9331..42877e4 100644
--- a/constructor.py
+++ b/constructor.py
@@ -10,9 +10,6 @@ import re
import sys
import types
-from typing import Any, Dict, List, Set, Generator # NOQA
-
-
from ruamel.yaml.error import (MarkedYAMLError)
from ruamel.yaml.nodes import * # NOQA
from ruamel.yaml.nodes import (SequenceNode, MappingNode, ScalarNode)
@@ -27,6 +24,10 @@ from ruamel.yaml.scalarstring import (PreservedScalarString, SingleQuotedScalarS
from ruamel.yaml.scalarint import ScalarInt, BinaryInt, OctalInt, HexInt, HexCapsInt
from ruamel.yaml.timestamp import TimeStamp
+if sys.version_info >= (3, 5, 2):
+ from typing import Any, Dict, List, Set, Generator # NOQA
+
+
__all__ = ['BaseConstructor', 'SafeConstructor', 'Constructor',
'ConstructorError', 'RoundTripConstructor']
@@ -933,8 +934,8 @@ class RoundTripConstructor(SafeConstructor):
if underscore is not None:
underscore[1] = value_su[2] == '_'
underscore[2] = len(value_su[2:]) > 1 and value_su[-1] == '_'
- return BinaryInt(sign*int(value_s[2:], 2), width=width,
- underscore=underscore) # type: ignore
+ return BinaryInt(sign*int(value_s[2:], 2), width=width, # type: ignore
+ underscore=underscore)
elif value_s.startswith('0x'):
# default to lower-case if no a-fA-F in string
if self.resolver.processing_version > (1, 1) and value_s[2] == '0':
@@ -956,8 +957,8 @@ class RoundTripConstructor(SafeConstructor):
if underscore is not None:
underscore[1] = value_su[2] == '_'
underscore[2] = len(value_su[2:]) > 1 and value_su[-1] == '_'
- return OctalInt(sign*int(value_s[2:], 8), width=width,
- underscore=underscore) # type: ignore
+ return OctalInt(sign*int(value_s[2:], 8), width=width, # type: ignore
+ underscore=underscore)
elif self.resolver.processing_version != (1, 2) and value_s[0] == '0':
return sign*int(value_s, 8)
elif self.resolver.processing_version != (1, 2) and ':' in value_s:
@@ -974,13 +975,13 @@ class RoundTripConstructor(SafeConstructor):
if underscore is not None:
# cannot have a leading underscore
underscore[2] = len(value_su) > 1 and value_su[-1] == '_'
- return ScalarInt(sign*int(value_s), width=len(value_s),
- underscore=underscore) # type: ignore
+ return ScalarInt(sign*int(value_s), width=len(value_s), # type: ignore
+ underscore=underscore)
elif underscore:
# cannot have a leading underscore
underscore[2] = len(value_su) > 1 and value_su[-1] == '_'
- return ScalarInt(sign*int(value_s), width=None,
- underscore=underscore) # type: ignore
+ return ScalarInt(sign*int(value_s), width=None, # type: ignore
+ underscore=underscore)
else:
return sign*int(value_s)
diff --git a/events.py b/events.py
index 8c5c127..0f37ea9 100644
--- a/events.py
+++ b/events.py
@@ -2,7 +2,9 @@
# Abstract classes.
-from typing import Any, Dict, Optional, List # NOQA
+import sys
+if sys.version_info >= (3, 5, 2):
+ from typing import Any, Dict, Optional, List # NOQA
def CommentCheck():
diff --git a/parser.py b/parser.py
index 653eb68..197c417 100644
--- a/parser.py
+++ b/parser.py
@@ -75,7 +75,6 @@ from __future__ import absolute_import
# only to not do anything with the package afterwards
# and for Jython too
-from typing import Any, Dict, Optional, List # NOQA
from ruamel.yaml.error import MarkedYAMLError
from ruamel.yaml.tokens import * # NOQA
@@ -83,6 +82,10 @@ from ruamel.yaml.events import * # NOQA
from ruamel.yaml.scanner import Scanner, RoundTripScanner, ScannerError # NOQA
from ruamel.yaml.compat import utf8 # NOQA
+import sys
+if sys.version_info >= (3, 5, 2):
+ from typing import Any, Dict, Optional, List # NOQA
+
__all__ = ['Parser', 'RoundTripParser', 'ParserError']
diff --git a/representer.py b/representer.py
index 5e8ce51..464d505 100644
--- a/representer.py
+++ b/representer.py
@@ -2,7 +2,6 @@
from __future__ import print_function, absolute_import, division
-from typing import Dict, List, Any, Union, Text # NOQA
from ruamel.yaml.error import * # NOQA
from ruamel.yaml.nodes import * # NOQA
@@ -21,6 +20,9 @@ if PY3:
else:
import copy_reg as copyreg # type: ignore
+if sys.version_info >= (3, 5, 2):
+ from typing import Dict, List, Any, Union, Text # NOQA
+
__all__ = ['BaseRepresenter', 'SafeRepresenter', 'Representer',
'RepresenterError', 'RoundTripRepresenter']
diff --git a/scalarint.py b/scalarint.py
index 48f1962..11c8e2e 100644
--- a/scalarint.py
+++ b/scalarint.py
@@ -23,36 +23,36 @@ class ScalarInt(int):
def __iadd__(self, a): # type: ignore
# type: (Any) -> Any
x = type(self)(self + a)
- x._width = self._width
- x._underscore = self._underscore[:] if self._underscore is not None else None
+ x._width = self._width # type: ignore
+ x._underscore = self._underscore[:] if self._underscore is not None else None # type: ignore # NOQA
return x
def __ifloordiv__(self, a): # type: ignore
# type: (Any) -> Any
x = type(self)(self // a)
- x._width = self._width
- x._underscore = self._underscore[:] if self._underscore is not None else None
+ x._width = self._width # type: ignore
+ x._underscore = self._underscore[:] if self._underscore is not None else None # type: ignore # NOQA
return x
def __imul__(self, a): # type: ignore
# type: (Any) -> Any
x = type(self)(self * a)
- x._width = self._width
- x._underscore = self._underscore[:] if self._underscore is not None else None
+ x._width = self._width # type: ignore
+ x._underscore = self._underscore[:] if self._underscore is not None else None # type: ignore # NOQA
return x
def __ipow__(self, a): # type: ignore
# type: (Any) -> Any
x = type(self)(self ** a)
- x._width = self._width
- x._underscore = self._underscore[:] if self._underscore is not None else None
+ x._width = self._width # type: ignore
+ x._underscore = self._underscore[:] if self._underscore is not None else None # type: ignore # NOQA
return x
def __isub__(self, a): # type: ignore
# type: (Any) -> Any
x = type(self)(self - a)
- x._width = self._width
- x._underscore = self._underscore[:] if self._underscore is not None else None
+ x._width = self._width # type: ignore
+ x._underscore = self._underscore[:] if self._underscore is not None else None # type: ignore # NOQA
return x
diff --git a/timestamp.py b/timestamp.py
index 02ea085..0d01727 100644
--- a/timestamp.py
+++ b/timestamp.py
@@ -5,7 +5,9 @@ from __future__ import print_function, absolute_import, division, unicode_litera
import datetime
import copy
-from typing import Any, Dict, Optional, List # NOQA
+import sys
+if sys.version_info >= (3, 5, 2):
+ from typing import Any, Dict, Optional, List # NOQA
class TimeStamp(datetime.datetime):
diff --git a/tokens.py b/tokens.py
index ed572e7..5fd5fe1 100644
--- a/tokens.py
+++ b/tokens.py
@@ -1,7 +1,9 @@
# # header
# coding: utf-8
-from typing import Any, Dict, Optional, List # NOQA
+import sys
+if sys.version_info >= (3, 5, 2):
+ from typing import Any, Dict, Optional, List # NOQA
class Token(object):