Skip to content

Commit

Permalink
Update cfgenvy
Browse files Browse the repository at this point in the history
  • Loading branch information
jlubken committed Jan 13, 2022
1 parent 4572f33 commit e54f35d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 19 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
(
"cfgenvy@"
"git+https://github.com/pennsignals/cfgenvy.git"
"@1.2.2#egg=cfgenvy"
"@1.3.1#egg=cfgenvy"
),
"numpy>=1.15.4",
"pandas>=0.23.4",
Expand Down
24 changes: 6 additions & 18 deletions src/dsdk/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
Sequence,
)

from cfgenvy import Parser, yaml_type
from cfgenvy import Parser, YamlMapping
from numpy import allclose
from pandas import DataFrame
from pkg_resources import DistributionNotFound, get_distribution
Expand Down Expand Up @@ -182,7 +182,10 @@ def __setitem__(self, key, value):
super().__setitem__(key, value)


class Service(Parser): # pylint: disable=too-many-instance-attributes
class Service( # pylint: disable=too-many-instance-attributes
Parser,
YamlMapping,
):
"""Service."""

ON = dumps({"key": "%s.on"})
Expand All @@ -206,12 +209,7 @@ def as_yaml_type(cls, tag: Optional[str] = None) -> None:
"""As yaml type."""
Asset.as_yaml_type()
Interval.as_yaml_type()
yaml_type(
cls,
tag or cls.YAML,
init=cls._yaml_init,
repr=cls._yaml_repr,
)
super().as_yaml_type(tag)

@classmethod
@contextmanager
Expand Down Expand Up @@ -249,16 +247,6 @@ def validate_gold(cls):
with cls.context("validate_gold") as service:
service.on_validate_gold()

@classmethod
def _yaml_init(cls, loader, node):
"""Yaml init."""
return cls(**loader.construct_mapping(node, deep=True))

@classmethod
def _yaml_repr(cls, dumper, self, *, tag: str):
"""Yaml repr."""
return dumper.represent_mapping(tag, self.as_yaml())

def __init__(
self,
*,
Expand Down

0 comments on commit e54f35d

Please sign in to comment.