Skip to content

Commit

Permalink
Revert "update: add size in jupyter file model (danielfrg#176)"
Browse files Browse the repository at this point in the history
This reverts commit 3c1cf92.
  • Loading branch information
maximethebault authored May 6, 2024
1 parent 456e886 commit 8d842f7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
3 changes: 0 additions & 3 deletions s3contents/gcs/gcs_fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,6 @@ def lstat(self, path):
ret = {}
if "updated" in info:
ret["ST_MTIME"] = info["updated"]

ret['SIZE'] = info.get("size", 0)

return ret

def write(self, path, content, format):
Expand Down
13 changes: 6 additions & 7 deletions s3contents/genericmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ def convert_s3_details_to_models(self, s3_details):
microsecond=0, tzinfo=tzutc()
)
model["created"] = model["last_modified"]
model["size"] = s3_detail.get("Size", 0)
model["type"] = (
"notebook" if model_path.endswith(".ipynb") else "file"
)
Expand All @@ -294,9 +293,9 @@ def _notebook_model_from_path(self, path, content=False, format=None):
model = base_model(path)
model["type"] = "notebook"
if self.fs.isfile(path):
info = self.fs.lstat(path)
model["created"] = model["last_modified"] = info["ST_MTIME"]
model["size"] = info["SIZE"]
model["created"] = model["last_modified"] = self.fs.lstat(path)[
"ST_MTIME"
]
else:
self.do_error("Not Found", 404)
if content:
Expand All @@ -320,9 +319,9 @@ def _file_model_from_path(self, path, content=False, format=None):
model = base_model(path)
model["type"] = "file"
if self.fs.isfile(path):
info = self.fs.lstat(path)
model["created"] = model["last_modified"] = info["ST_MTIME"]
model["size"] = info["SIZE"]
model["created"] = model["last_modified"] = self.fs.lstat(path)[
"ST_MTIME"
]
else:
model["created"] = model["last_modified"] = DUMMY_CREATED_DATE
if content:
Expand Down
6 changes: 2 additions & 4 deletions s3contents/s3_fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,12 @@ def lstat(self, path):
path_ = self.path(path, self.dir_keep_file)

st_time = None
size = 0
try:
self.fs.invalidate_cache(path_)
info = self.fs.info(path_)
st_time = info["LastModified"]
size = info.get("size", 0)
except FileNotFoundError:
return {"ST_MTIME": None, "SIZE": 0}
return {"ST_MTIME": None}

# Remove the microsend information to match Jupyter base tests
st_time = datetime.datetime(
Expand All @@ -252,7 +250,7 @@ def lstat(self, path):
st_time.second,
tzinfo=st_time.tzinfo,
)
return {"ST_MTIME": st_time, "SIZE": size}
return {"ST_MTIME": st_time}

def write(self, path, content, format):
path_ = self.path(self.remove_prefix(path))
Expand Down

0 comments on commit 8d842f7

Please sign in to comment.