Skip to content

Commit

Permalink
Py2 fix for DataFrameCache - see apache#3302
Browse files Browse the repository at this point in the history
  • Loading branch information
rhunwicks committed Oct 5, 2017
1 parent 878c7c4 commit 2826876
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions contrib/connectors/pandas/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def _prune(self):
for idx, cname in enumerate(entries):
mname = os.path.splitext(cname)[0] + self._fs_metadata_suffix
try:
with open(mname, 'r', encoding='utf-8') as f:
with open(mname, 'r') as f:
metadata = json.load(f)
except (IOError, OSError):
metadata = {'expires': -1}
Expand Down Expand Up @@ -84,7 +84,7 @@ def get(self, key):
cname = filename + self._fs_cache_suffix
mname = filename + self._fs_metadata_suffix
try:
with open(mname, 'r', encoding='utf-8') as f:
with open(mname, 'r') as f:
metadata = json.load(f)
except (IOError, OSError):
metadata = {'expires': -1}
Expand Down Expand Up @@ -134,7 +134,7 @@ def set(self, key, value, timeout=None):
metadata['format'] = 'pickle'
rename(tmp, cname)
os.chmod(cname, self._mode)
with open(mname, 'w', encoding='utf-8') as f:
with open(mname, 'w') as f:
json.dump(metadata, f)
os.chmod(mname, self._mode)
except (IOError, OSError):
Expand All @@ -159,7 +159,7 @@ def has(self, key):
cname = filename + self._fs_cache_suffix
mname = filename + self._fs_metadata_suffix
try:
with open(mname, 'r', encoding='utf-8') as f:
with open(mname, 'r') as f:
metadata = json.load(f)
except (IOError, OSError):
metadata = {'expires': -1}
Expand Down

0 comments on commit 2826876

Please sign in to comment.