summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2017-04-22 09:47:24 +0200
committerAnthon van der Neut <anthon@mnt.org>2017-04-22 09:47:24 +0200
commitfacf4079b482304199f44a6f04865d8aa1f1f819 (patch)
tree32b2402d96d935998d1163ccee64c8fc8c8a70fa
parent4f8475e4592ed1430815b1c2d4e40c95a536d156 (diff)
downloadruamel.yaml-facf4079b482304199f44a6f04865d8aa1f1f819.tar.gz
typing no longer needed, fix issue #117 (2.6 support)0.14.9
-rw-r--r--CHANGES5
-rw-r--r--README.rst5
-rw-r--r--__init__.py12
-rw-r--r--_doc/pyyaml.rst15
-rw-r--r--comments.py3
-rw-r--r--compat.py4
-rw-r--r--composer.py3
-rw-r--r--configobjwalker.py3
-rw-r--r--constructor.py2
-rw-r--r--cyaml.py5
-rw-r--r--dumper.py4
-rw-r--r--emitter.py5
-rw-r--r--error.py4
-rw-r--r--events.py3
-rw-r--r--loader.py3
-rw-r--r--main.py6
-rw-r--r--nodes.py3
-rw-r--r--parser.py3
-rw-r--r--reader.py3
-rw-r--r--representer.py2
-rw-r--r--resolver.py3
-rw-r--r--scalarint.py4
-rw-r--r--scalarstring.py4
-rw-r--r--scanner.py4
-rw-r--r--serializer.py4
-rw-r--r--timestamp.py3
-rw-r--r--tokens.py3
-rw-r--r--util.py4
28 files changed, 49 insertions, 73 deletions
diff --git a/CHANGES b/CHANGES
index dd6c8ba..65afded 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,8 @@
+[0, 14, 9]: 2017-04-22
+ - remove dependency on ``typing`` while still supporting ``mypy``
+ (http://stackoverflow.com/a/43516781/1307905)
+ - fix unclarity in doc that stated 2.6 is supported (reported by feetdust)
+
[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/>`_)
diff --git a/README.rst b/README.rst
index a5dda6e..a81e99d 100644
--- a/README.rst
+++ b/README.rst
@@ -18,6 +18,11 @@ ChangeLog
.. should insert NEXT: at the beginning of line for next key
+0.14.9 (2017-04-22):
+ - remove dependency on ``typing`` while still supporting ``mypy``
+ (http://stackoverflow.com/a/43516781/1307905)
+ - fix unclarity in doc that stated 2.6 is supported (reported by feetdust)
+
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/>`_)
diff --git a/__init__.py b/__init__.py
index 1ed58dc..42b7378 100644
--- a/__init__.py
+++ b/__init__.py
@@ -6,24 +6,20 @@ 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
-import sys
-if sys.version_info >= (3, 5, 2):
+if False: # MYPY
from typing import Dict, Any # NOQA
_package_data = dict(
full_package_name='ruamel.yaml',
- version_info=(0, 14, 8),
- __version__='0.14.8',
+ version_info=(0, 14, 9),
+ __version__='0.14.9',
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
entry_points=None,
install_requires=dict(
any=[],
- py33=['typing'],
- py34=['typing'],
- py27=['ruamel.ordereddict', 'typing'],
- pypy=['typing'],
+ py27=['ruamel.ordereddict'],
),
ext_modules=[dict(
name='_ruamel_yaml',
diff --git a/_doc/pyyaml.rst b/_doc/pyyaml.rst
index 7182021..93dcd65 100644
--- a/_doc/pyyaml.rst
+++ b/_doc/pyyaml.rst
@@ -24,7 +24,7 @@ PyYAML supports the `YAML 1.1`_ standard, ``ruamel.yaml`` supports
- YAML 1.2 dropped support for several features unquoted ``Yes``,
``No``, ``On``, ``Off``
-- YAML 1.2 no longer accepts strings that start with a ``0`` and solely
+- YAML 1.2 no longer accepts strings that start with a ``0`` and solely
consist of number characters as octal, you need to specify such strings with
``0o[0-7]+`` (zero + lower-case o for octal + one or more octal characters).
- YAML 1.2 no longer supports `sexagesimals
@@ -45,24 +45,27 @@ PY2/PY3 reintegration
---------------------
``ruamel.yaml`` re-integrates the Python 2 and 3 sources, running on
-Python 2.6, 2.7 (CPython, PyPy), 3.3, 3.4, 3.5. It is more easy to
-extend and maintain as only a miniscule part of the code is version
-specific.
+Python 2.7 (CPython, PyPy), 3.3, 3.4, 3.5 (support for 2.6 has been
+dropped mid 2016). It is more easy to extend and maintain as only a
+miniscule part of the code is version specific.
Fixes
-----
- ``ruamel.yaml`` follows the ``indent`` keyword argument on scalars
when dumping.
+- ``ruamel.yaml`` allows ``:`` in plain scalars, as long as these are not
+ followed by a space (as per the specification)
+
Testing
-------
``ruamel.yaml`` is tested using `tox`_ and `py.test`_. In addition to
-new tests the original PyYAML
+new tests, the original PyYAML
test framework is called from within ``tox`` runs.
Before versions are pushed to PyPI, ``tox`` is invoked, and has to pass, on all
-Python versions, PyPI as well as flake8/pep8
+supported Python versions, on PyPI as well as flake8/pep8
.. include:: links.rst
diff --git a/comments.py b/comments.py
index 6f6d3ee..307ec61 100644
--- a/comments.py
+++ b/comments.py
@@ -14,8 +14,7 @@ from collections import MutableSet, Sized, Set
from ruamel.yaml.compat import ordereddict, PY2
-import sys
-if sys.version_info >= (3, 5, 2):
+if False: # MYPY
from typing import Any, Dict, Optional, List, Union # NOQA
__all__ = ["CommentedSeq", "CommentedKeySeq",
diff --git a/compat.py b/compat.py
index 4747fdb..c9f6373 100644
--- a/compat.py
+++ b/compat.py
@@ -8,7 +8,7 @@ import sys
import os
import types
-if sys.version_info >= (3, 5, 2):
+if False: # MYPY
from typing import Any, Dict, Optional, List, Union, BinaryIO, IO, Text, Tuple # NOQA
@@ -95,7 +95,7 @@ else:
import cStringIO
BytesIO = cStringIO.StringIO
-if sys.version_info >= (3, 5, 2):
+if False: # MYPY
# StreamType = Union[BinaryIO, IO[str], IO[unicode], StringIO]
StreamType = Union[BinaryIO, IO[str], StringIO]
diff --git a/composer.py b/composer.py
index 9eb5229..e706145 100644
--- a/composer.py
+++ b/composer.py
@@ -16,8 +16,7 @@ from ruamel.yaml.nodes import (
MappingNode, ScalarNode, SequenceNode,
)
-import sys
-if sys.version_info >= (3, 5, 2):
+if False: # MYPY
from typing import Any, Dict, Optional, List # NOQA
__all__ = ['Composer', 'ComposerError']
diff --git a/configobjwalker.py b/configobjwalker.py
index 1e44d6f..c0ab608 100644
--- a/configobjwalker.py
+++ b/configobjwalker.py
@@ -4,8 +4,7 @@ import warnings
from ruamel.yaml.util import configobj_walker as new_configobj_walker
-import sys
-if sys.version_info >= (3, 5, 2):
+if False: # MYPY
from typing import Any # NOQA
diff --git a/constructor.py b/constructor.py
index 42877e4..fd37ddd 100644
--- a/constructor.py
+++ b/constructor.py
@@ -24,7 +24,7 @@ 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):
+if False: # MYPY
from typing import Any, Dict, List, Set, Generator # NOQA
diff --git a/cyaml.py b/cyaml.py
index 41d2d08..b39303c 100644
--- a/cyaml.py
+++ b/cyaml.py
@@ -2,9 +2,6 @@
from __future__ import absolute_import
-import sys
-
-
from _ruamel_yaml import CParser, CEmitter # type: ignore
from ruamel.yaml.constructor import Constructor, BaseConstructor, SafeConstructor
@@ -12,7 +9,7 @@ from ruamel.yaml.serializer import Serializer
from ruamel.yaml.representer import Representer, SafeRepresenter, BaseRepresenter
from ruamel.yaml.resolver import Resolver, BaseResolver
-if sys.version_info >= (3, 5, 2):
+if False: # MYPY
from typing import Any, Union # NOQA
from ruamel.yaml.compat import StreamTextType, StreamType, VersionType # NOQA
diff --git a/dumper.py b/dumper.py
index da64056..b43260c 100644
--- a/dumper.py
+++ b/dumper.py
@@ -2,15 +2,13 @@
from __future__ import absolute_import
-import sys
-
from ruamel.yaml.emitter import Emitter
from ruamel.yaml.serializer import Serializer
from ruamel.yaml.representer import Representer, SafeRepresenter, BaseRepresenter, \
RoundTripRepresenter
from ruamel.yaml.resolver import Resolver, BaseResolver, VersionedResolver
-if sys.version_info >= (3, 5, 2):
+if False: # MYPY
from typing import Any, Dict, List, Union # NOQA
from ruamel.yaml.compat import StreamType, VersionType # NOQA
diff --git a/emitter.py b/emitter.py
index e0ea980..44dfe05 100644
--- a/emitter.py
+++ b/emitter.py
@@ -10,15 +10,12 @@ from __future__ import print_function
# sequence ::= SEQUENCE-START node* SEQUENCE-END
# mapping ::= MAPPING-START (node node)* MAPPING-END
-import sys
-
-
from ruamel.yaml.error import YAMLError
from ruamel.yaml.events import * # NOQA
from ruamel.yaml.compat import utf8, text_type, PY2, nprint, dbg, DBG_EVENT, \
check_anchorname_char
-if sys.version_info >= (3, 5, 2):
+if False: # MYPY
from typing import Any, Dict, List, Union, Text # NOQA
from ruamel.yaml.compat import StreamType # NOQA
diff --git a/error.py b/error.py
index 9de0b60..65a7a97 100644
--- a/error.py
+++ b/error.py
@@ -4,11 +4,9 @@ from __future__ import absolute_import
import warnings
-import sys
-
from ruamel.yaml.compat import utf8
-if sys.version_info >= (3, 5, 2):
+if False: # MYPY
from typing import Any, Dict, Optional, List, Text # NOQA
diff --git a/events.py b/events.py
index 0f37ea9..515274a 100644
--- a/events.py
+++ b/events.py
@@ -2,8 +2,7 @@
# Abstract classes.
-import sys
-if sys.version_info >= (3, 5, 2):
+if False: # MYPY
from typing import Any, Dict, Optional, List # NOQA
diff --git a/loader.py b/loader.py
index f99ade7..725c326 100644
--- a/loader.py
+++ b/loader.py
@@ -2,7 +2,6 @@
from __future__ import absolute_import
-import sys
from ruamel.yaml.reader import Reader
from ruamel.yaml.scanner import Scanner, RoundTripScanner
@@ -12,7 +11,7 @@ from ruamel.yaml.constructor import BaseConstructor, SafeConstructor, Constructo
RoundTripConstructor
from ruamel.yaml.resolver import VersionedResolver
-if sys.version_info >= (3, 5, 2):
+if False: # MYPY
from typing import Any, Dict, List # NOQA
from ruamel.yaml.compat import StreamTextType, VersionType # NOQA
diff --git a/main.py b/main.py
index 3c17915..93482ca 100644
--- a/main.py
+++ b/main.py
@@ -4,8 +4,6 @@ from __future__ import absolute_import, unicode_literals
import warnings
-import sys
-
import ruamel.yaml
from ruamel.yaml.error import * # NOQA
@@ -23,8 +21,8 @@ from ruamel.yaml.constructor import (BaseConstructor, SafeConstructor, Construct
RoundTripConstructor)
from ruamel.yaml.loader import Loader as UnsafeLoader
-if sys.version_info >= (3, 5, 2):
- from typing import List, Set, Dict, Union, Any # NOQA
+if False: # MYPY
+ from typing import List, Set, Dict, Union, Any # NOQA
from ruamel.yaml.compat import StreamType, StreamTextType, VersionType # NOQA
# import io
diff --git a/nodes.py b/nodes.py
index 7f1cf88..75cefb6 100644
--- a/nodes.py
+++ b/nodes.py
@@ -2,8 +2,7 @@
from __future__ import print_function
-import sys
-if sys.version_info >= (3, 5, 2):
+if False: # MYPY
from typing import Dict, Any, Text # NOQA
diff --git a/parser.py b/parser.py
index 197c417..ec5c6ee 100644
--- a/parser.py
+++ b/parser.py
@@ -82,8 +82,7 @@ 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):
+if False: # MYPY
from typing import Any, Dict, Optional, List # NOQA
__all__ = ['Parser', 'RoundTripParser', 'ParserError']
diff --git a/reader.py b/reader.py
index 4a0fa2f..2ececae 100644
--- a/reader.py
+++ b/reader.py
@@ -23,11 +23,10 @@ from __future__ import absolute_import
import codecs
import re
-import sys
from ruamel.yaml.error import YAMLError, FileMark, StringMark
from ruamel.yaml.compat import text_type, binary_type, PY3
-if sys.version_info >= (3, 5, 2):
+if False: # MYPY
from typing import Any, Dict, Optional, List, Union, Text # NOQA
from ruamel.yaml.compat import StreamTextType # NOQA
diff --git a/representer.py b/representer.py
index 464d505..8d20617 100644
--- a/representer.py
+++ b/representer.py
@@ -20,7 +20,7 @@ if PY3:
else:
import copy_reg as copyreg # type: ignore
-if sys.version_info >= (3, 5, 2):
+if False: # MYPY
from typing import Dict, List, Any, Union, Text # NOQA
diff --git a/resolver.py b/resolver.py
index 25385c2..15fb55f 100644
--- a/resolver.py
+++ b/resolver.py
@@ -4,8 +4,7 @@ from __future__ import absolute_import
import re
-import sys
-if sys.version_info >= (3, 5, 2):
+if False: # MYPY
from typing import Any, Dict, List, Union # NOQA
from ruamel.yaml.compat import string_types, VersionType # NOQA
diff --git a/scalarint.py b/scalarint.py
index 11c8e2e..9f17b0c 100644
--- a/scalarint.py
+++ b/scalarint.py
@@ -2,9 +2,7 @@
from __future__ import print_function, absolute_import, division, unicode_literals
-import sys
-
-if sys.version_info >= (3, 5, 2):
+if False: # MYPY
from typing import Text, Any, Dict, List # NOQA
__all__ = ["ScalarInt", "BinaryInt", "OctalInt", "HexInt", "HexCapsInt"]
diff --git a/scalarstring.py b/scalarstring.py
index 05e4593..570240b 100644
--- a/scalarstring.py
+++ b/scalarstring.py
@@ -2,11 +2,9 @@
from __future__ import print_function, absolute_import, division, unicode_literals
-import sys
-
from ruamel.yaml.compat import text_type
-if sys.version_info >= (3, 5, 2):
+if False: # MYPY
from typing import Text, Any, Dict, List # NOQA
__all__ = ["ScalarString", "PreservedScalarString", "SingleQuotedScalarString",
diff --git a/scanner.py b/scanner.py
index 3a95d4e..2f083f5 100644
--- a/scanner.py
+++ b/scanner.py
@@ -30,13 +30,11 @@ from __future__ import print_function, absolute_import, division, unicode_litera
# Read comments in the Scanner code for more details.
#
-import sys
-
from ruamel.yaml.error import MarkedYAMLError
from ruamel.yaml.tokens import * # NOQA
from ruamel.yaml.compat import utf8, unichr, PY3, check_anchorname_char
-if sys.version_info >= (3, 5, 2):
+if False: # MYPY
from typing import Any, Dict, Optional, List, Union, Text # NOQA
__all__ = ['Scanner', 'RoundTripScanner', 'ScannerError']
diff --git a/serializer.py b/serializer.py
index 30348f3..bda778f 100644
--- a/serializer.py
+++ b/serializer.py
@@ -4,8 +4,6 @@ from __future__ import absolute_import
import re
-import sys
-
from ruamel.yaml.error import YAMLError
from ruamel.yaml.compat import nprint, DBG_NODE, dbg, string_types
@@ -18,7 +16,7 @@ from ruamel.yaml.nodes import (
MappingNode, ScalarNode, SequenceNode,
)
-if sys.version_info >= (3, 5, 2):
+if False: # MYPY
from typing import Any, Dict, Union, Text # NOQA
from ruamel.yaml.compat import VersionType # NOQA
diff --git a/timestamp.py b/timestamp.py
index 0d01727..7035c0f 100644
--- a/timestamp.py
+++ b/timestamp.py
@@ -5,8 +5,7 @@ from __future__ import print_function, absolute_import, division, unicode_litera
import datetime
import copy
-import sys
-if sys.version_info >= (3, 5, 2):
+if False: # MYPY
from typing import Any, Dict, Optional, List # NOQA
diff --git a/tokens.py b/tokens.py
index 5fd5fe1..3f9c33b 100644
--- a/tokens.py
+++ b/tokens.py
@@ -1,8 +1,7 @@
# # header
# coding: utf-8
-import sys
-if sys.version_info >= (3, 5, 2):
+if False: # MYPY
from typing import Any, Dict, Optional, List # NOQA
diff --git a/util.py b/util.py
index 3d44230..b7be3e1 100644
--- a/util.py
+++ b/util.py
@@ -6,11 +6,9 @@ some helper functions that might be generally useful
from __future__ import absolute_import, print_function
-import sys
-
from .compat import text_type, binary_type
-if sys.version_info >= (3, 5, 2):
+if False: # MYPY
from typing import Any, Dict, Optional, List, Text # NOQA
from .compat import StreamTextType # NOQA