Skip to content

Commit

Permalink
Updates for Pylint 1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyh committed Feb 7, 2016
1 parent ead7c5a commit 71b9049
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions eodatasets/serialise.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
import time
import uuid

import pathlib
import yaml
from pathlib import Path

import eodatasets.type as ptype
from eodatasets import compat


_LOG = logging.getLogger(__name__)


Expand Down Expand Up @@ -137,6 +135,7 @@ def _create_relative_dumper(folder):
:type folder: str
:rtype: yaml.Dumper
"""

# We can't control how many ancestors this dumper API uses, Pylint.
# pylint: disable=too-many-ancestors
class RelativeDumper(yaml.Dumper):
Expand All @@ -152,7 +151,7 @@ def path_representer(dumper, data):
data = Path(folder).joinpath(data)
return dumper.represent_scalar(u'tag:yaml.org,2002:str', str(data.relative_to(folder)))

RelativeDumper.add_multi_representer(pathlib.Path, path_representer)
RelativeDumper.add_multi_representer(Path, path_representer)
RelativeDumper.ignore_aliases = lambda self, data: True

return RelativeDumper
Expand Down Expand Up @@ -201,7 +200,7 @@ def read_dict_metadata(dict_):

def write_property_metadata(d, metadata_file, target_directory):
def _clean_val(v):
if isinstance(v, pathlib.Path):
if isinstance(v, Path):
return str(v.relative_to(target_directory))

return v
Expand Down

0 comments on commit 71b9049

Please sign in to comment.