Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ PgLOG.pglog("hello", PgLOG.LOGWRN)
python -c "import rda_python_common; print(rda_python_common.__version__)"
```

You should see the installed version (currently `3.0.16`). If the import
You should see the installed version (currently `3.0.17`). If the import
fails, double-check that the active Python environment is the one where you
ran `pip install`.

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "rda_python_common"
version = "3.0.16"
version = "3.0.17"
authors = [
{ name="Zaihua Ji", email="zji@ucar.edu" },
]
Expand Down
2 changes: 1 addition & 1 deletion src/rda_python_common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

from . import PgLOG, PgUtil, PgDBI, PgFile, PgLock, PgCMD, PgSIG, PgOPT, PgSplit

__version__ = "3.0.16"
__version__ = "3.0.17"

__all__ = [
"PgLOG",
Expand Down
23 changes: 12 additions & 11 deletions src/rda_python_common/pg_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -2357,22 +2357,23 @@ def check_object_file(self, file, bucket = None, opt = 0, logact = 0):
if re.match(r'^\[\]', buf): break
if re.match(r'^\[\{', buf):
ary = json.loads(buf)
hash = ary[0]
cnt = len(ary)
isdir = (cnt > 1 or ary[0]['Key'] != file)
# a key prefix has no timestamp of its own; report the newest member's
hash = max(ary, key = lambda a: a['LastModified']) if isdir else ary[0]
uhash = None
if ucmd:
ubuf = self.pgsystem(ucmd, self.LOGWRN, self.CMDRET)
if ubuf and re.match(r'^\{', ubuf): uhash = json.loads(ubuf)
ret = self.object_file_stat(hash, uhash, opt)
if ret:
cnt = len(ary)
if cnt > 1 or hash['Key'] != file:
ret['count'] = cnt
ret['fname'] = op.basename(file)
ret['isfile'] = 0
size = 0
for a in ary:
size += int(a['Size'])
ret['data_size'] = size
if ret and isdir:
ret['count'] = cnt
ret['fname'] = op.basename(file)
ret['isfile'] = 0
size = 0
for a in ary:
size += int(a['Size'])
ret['data_size'] = size
uhash = None
break
if opt&64: return self.FAILURE
Expand Down
Loading