Skip to content

Commit

Permalink
Typo and small fixes for the LoadFileMixin _file attribute.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmilloy committed Jul 9, 2020
1 parent 69a640d commit 2a1677d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions podpac/core/data/file_source.py
Expand Up @@ -79,6 +79,7 @@ class LoadFileMixin(S3Mixin):
"""

cache_dataset = tl.Bool(False)
_file = None

@cached_property
def _dataset_caching_node(self):
Expand All @@ -94,7 +95,7 @@ def dataset(self):
self._file = BytesIO(data)
return self._open(self._file, cache=False)

# otherwise, open the file
# otherwise, open the file (and cache it if desired)
if self.source.startswith("s3://"):
_logger.info("Loading AWS resource: %s" % self.source)
self._file = self.s3.open(self.source, "rb")
Expand Down Expand Up @@ -125,7 +126,8 @@ def open_dataset(self, f):
raise NotImplementedError()

def close_dataset(self):
self._file.close()
if self._file is not None:
self._file.close()


@common_doc(COMMON_DATA_DOC)
Expand Down
2 changes: 1 addition & 1 deletion podpac/core/data/h5py_source.py
Expand Up @@ -54,7 +54,7 @@ def dataset(self):

def close_dataset(self):
"""Closes the file. """
super(Dataset, self).close_dataset()
super(H5PY, self).close_dataset()
self.dataset.close()

# -------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Expand Up @@ -10,6 +10,7 @@ filterwarnings =
ignore:Using or importing the ABCs:DeprecationWarning:bs4
ignore:The truth value of an empty array is ambiguous:DeprecationWarning:traitlets
ignore:The truth value of an empty array is ambiguous:DeprecationWarning:xarray
ignore:dropping variables using `drop` will be deprecated:PendingDeprecationWarning:xarray

[coverage:run]
omit=*/test/*,podpac/datalib/*,podpac/core/managers/aws*

0 comments on commit 2a1677d

Please sign in to comment.