Skip to content

Commit

Permalink
Release v3.6.7 (#187)
Browse files Browse the repository at this point in the history
Bug Fixes:
* Release 3.6.6 had a broken package; it was unexpectedly missing the required
  ruamel.yaml patch found in yamlpath.patches.timestamp.  Thanks to
  https://github.com/tsinggggg and https://github.com/kaniblu for reporting it!
  • Loading branch information
wwkimball authored Sep 27, 2022
1 parent 6bd0188 commit 9148aac
Show file tree
Hide file tree
Showing 12 changed files with 156 additions and 461 deletions.
6 changes: 6 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
3.6.7
Bug Fixes:
* Release 3.6.6 had a broken package; it was unexpectedly missing the required
ruamel.yaml patch found in yamlpath.patches.timestamp. Thanks to
https://github.com/tsinggggg and https://github.com/kaniblu for reporting it!

3.6.6
Enhancements:
* Support ruamel.yaml up to version 0.17.21.
Expand Down
3 changes: 0 additions & 3 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,3 @@ ignore_missing_imports = True

[mypy-dateutil.*]
ignore_missing_imports = True

[mypy-yamlpath.patches.*]
ignore_missing_imports = True
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
},
python_requires=">3.6.0",
install_requires=[
"ruamel.yaml>=0.15.96,!=0.17.0,!=0.17.1,!=0.17.2,!=0.17.5,!=0.17.18,<=0.17.21",
"ruamel.yaml>0.17.5,!=0.17.18,<=0.17.21",
"python-dateutil<=3"
],
tests_require=[
Expand Down
2 changes: 1 addition & 1 deletion yamlpath/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Core YAML Path classes."""
# Establish the version number common to all components
__version__ = "3.6.6"
__version__ = "3.6.7"

from yamlpath.yamlpath import YAMLPath
from yamlpath.processor import Processor
17 changes: 4 additions & 13 deletions yamlpath/commands/yaml_get.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,10 @@
from os.path import isfile

from ruamel.yaml.comments import CommentedSet
# pylint: disable=wrong-import-position,ungrouped-imports
from ruamel.yaml import version_info as ryversion
if ryversion < (0, 17, 22): # pragma: no cover
from yamlpath.patches.timestamp import (
AnchoredTimeStamp,
AnchoredDate,
) # type: ignore
else: # pragma: no cover
# Temporarily fool MYPY into resolving the future-case imports
from ruamel.yaml.timestamp import TimeStamp as AnchoredTimeStamp
AnchoredDate = AnchoredTimeStamp
#from ruamel.yaml.timestamp import AnchoredTimeStamp
# From whence shall come AnchoredDate?
from yamlpath.patches.timestamp import (
AnchoredTimeStamp,
AnchoredDate,
)

from yamlpath import __version__ as YAMLPATH_VERSION
from yamlpath.common import Parsers, Nodes
Expand Down
30 changes: 11 additions & 19 deletions yamlpath/common/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,17 @@
FoldedScalarString,
LiteralScalarString,
)
# pylint: disable=wrong-import-position,ungrouped-imports
from ruamel.yaml import version_info as ryversion
if ryversion < (0, 17, 22): # pragma: no cover
from yamlpath.patches.timestamp import (
AnchoredTimeStamp,
AnchoredDate,
) # type: ignore
else: # pragma: no cover
# Temporarily fool MYPY into resolving the future-case imports
from ruamel.yaml.timestamp import TimeStamp as AnchoredTimeStamp
AnchoredDate = AnchoredTimeStamp
#from ruamel.yaml.timestamp import AnchoredTimeStamp
# From whence shall come AnchoredDate?
from yamlpath.patches.timestamp import (
AnchoredTimeStamp,
AnchoredDate,
)

from yamlpath.enums import (
PathSegmentTypes,
YAMLValueFormats,
)
from yamlpath.wrappers import NodeCoords
from yamlpath import YAMLPath
# pylint: enable=wrong-import-position,ungrouped-imports


class Nodes:
Expand Down Expand Up @@ -660,7 +650,7 @@ def typed_value(value: str) -> Any:
return typed_value

@staticmethod
def get_timestamp_with_tzinfo(data: AnchoredTimeStamp) -> datetime:
def get_timestamp_with_tzinfo(data: AnchoredTimeStamp) -> Any:
"""
Get an AnchoredTimeStamp with time-zone info correctly applied.
Expand All @@ -675,7 +665,9 @@ def get_timestamp_with_tzinfo(data: AnchoredTimeStamp) -> datetime:
Parameters:
1. value (AnchoredTimeStamp) the value to correct
Returns: (datetime) time-zone aware non-pre-calculated value
Returns: One of:
* (datetime) time-zone aware non-pre-calculated value
* (AnchoredTimeStamp) original value when it had no time-zone data
"""
# As stated in the method comments, ruamel.yaml hides the time-zone
# details in a private dict after forcibly normalizing the datetime;
Expand All @@ -697,6 +689,6 @@ def get_timestamp_with_tzinfo(data: AnchoredTimeStamp) -> datetime:
sign = -1 if sign_mark == '-' else 1
tdelta = timedelta(hours=int(hours), minutes=int(minutes))
tzinfo = timezone(sign * tdelta)
data = (data + tdelta * sign).replace(
tzinfo=tzinfo)
return data # type: ignore
return ((data + tdelta * sign).replace(
tzinfo=tzinfo))
return data
28 changes: 4 additions & 24 deletions yamlpath/common/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,14 @@
from ruamel.yaml.comments import (
CommentedMap, CommentedSet, CommentedSeq, TaggedScalar
)
# pylint: disable=wrong-import-position,ungrouped-imports
from ruamel.yaml import version_info as ryversion
if ryversion < (0, 17, 22): # pragma: no cover
from yamlpath.patches.timestamp import (
AnchoredTimeStamp,
AnchoredDate,
) # type: ignore
else: # pragma: no cover
# Temporarily fool MYPY into resolving the future-case imports
from ruamel.yaml.timestamp import TimeStamp as AnchoredTimeStamp
AnchoredDate = AnchoredTimeStamp
#from ruamel.yaml.timestamp import AnchoredTimeStamp
# From whence shall come AnchoredDate?
from yamlpath.patches.timestamp import (
AnchoredTimeStamp,
AnchoredDate,
)

from yamlpath.wrappers import ConsolePrinter
from yamlpath.common import Nodes

if ruamel.yaml.version_info < (0, 17, 5): # pragma: no cover
from yamlpath.patches.aliasstyle import MySerializer # type: ignore
from yamlpath.patches.aliasstyle import MyEmitter # type: ignore
# pylint: enable=wrong-import-position,ungrouped-imports


class Parsers:
"""Helper methods for common YAML/JSON/Compatible parser operations."""
Expand Down Expand Up @@ -76,12 +62,6 @@ def get_yaml_editor(**kwargs: Any) -> YAML:
# these valid assignments cannot be type-checked.
yaml = YAML()

# Import Anthon's patch for Aliased entries in Unordered Sets per
# https://sourceforge.net/p/ruamel-yaml/tickets/384/
if ruamel.yaml.version_info < (0, 17, 5): # pragma: no cover
yaml.Serializer = MySerializer # type: ignore
yaml.Emitter = MyEmitter # type: ignore

yaml.indent(mapping=2, sequence=4, offset=2)
yaml.explicit_start = explicit_start # type: ignore
yaml.preserve_quotes = preserve_quotes # type: ignore
Expand Down
18 changes: 4 additions & 14 deletions yamlpath/enums/yamlvalueformats.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,10 @@
from ruamel.yaml.scalarbool import ScalarBoolean
from ruamel.yaml.scalarfloat import ScalarFloat
from ruamel.yaml.scalarint import ScalarInt
# pylint: disable=wrong-import-position,ungrouped-imports
from ruamel.yaml import version_info as ryversion
if ryversion < (0, 17, 22): # pragma: no cover
from yamlpath.patches.timestamp import (
AnchoredTimeStamp,
AnchoredDate,
) # type: ignore
else: # pragma: no cover
# Temporarily fool MYPY into resolving the future-case imports
from ruamel.yaml.timestamp import TimeStamp as AnchoredTimeStamp
AnchoredDate = AnchoredTimeStamp
#from ruamel.yaml.timestamp import AnchoredTimeStamp
# From whence shall come AnchoredDate?
# pylint: enable=wrong-import-position,ungrouped-imports
from yamlpath.patches.timestamp import (
AnchoredTimeStamp,
AnchoredDate,
)


class YAMLValueFormats(Enum):
Expand Down
1 change: 1 addition & 0 deletions yamlpath/patches/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Include ruamel.yaml patches."""
Loading

0 comments on commit 9148aac

Please sign in to comment.