Skip to content

Commit fbd0bc7

Browse files
Add files via upload
1 parent aa243d0 commit fbd0bc7

1 file changed

Lines changed: 50 additions & 3 deletions

File tree

pyfoxfile.py

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ def _get(section_dict, key, default=None):
588588
__version_date__ = str(__version_date_info__[0]) + "." + str(
589589
__version_date_info__[1]).zfill(2) + "." + str(__version_date_info__[2]).zfill(2)
590590
__revision__ = __version_info__[3]
591-
__revision_id__ = "$Id: a38e58d7eb4204ddfc3bb9a945fc416d6093c62a $"
591+
__revision_id__ = "$Id: e94eeef2419c9994e8bb037a8ed028c39445c5a4 $"
592592
if(__version_info__[4] is not None):
593593
__version_date_plusrc__ = __version_date__ + \
594594
"-" + str(__version_date_info__[4])
@@ -2806,6 +2806,21 @@ def from_bytes(cls, data, mode='rb', **kw):
28062806
bio = io.BytesIO(bytes(data) if not isinstance(data, bytes) else data)
28072807
return cls(fileobj=bio, mode=mode, **kw)
28082808

2809+
# compatibility aliases for unwrapping utilities
2810+
@property
2811+
def fileobj(self):
2812+
return self.file
2813+
2814+
@property
2815+
def myfileobj(self):
2816+
return self.file
2817+
2818+
# if some code expects ._fp to be “the stream itself”:
2819+
@property
2820+
def _fp(self):
2821+
# OR return self.file if callers intend the raw file
2822+
return self
2823+
28092824
# ---------- Top-level helpers (optional) ----------
28102825
def decompress_bytes(blob, **kw):
28112826
"""
@@ -3254,6 +3269,21 @@ def from_bytes(cls, data, mode='rb', **kw):
32543269
bio = io.BytesIO(bytes(data) if not isinstance(data, bytes) else data)
32553270
return cls(fileobj=bio, mode=mode, **kw)
32563271

3272+
# compatibility aliases for unwrapping utilities
3273+
@property
3274+
def fileobj(self):
3275+
return self.file
3276+
3277+
@property
3278+
def myfileobj(self):
3279+
return self.file
3280+
3281+
# if some code expects ._fp to be “the stream itself”:
3282+
@property
3283+
def _fp(self):
3284+
# OR return self.file if callers intend the raw file
3285+
return self
3286+
32573287

32583288
# ---------- Top-level helpers ----------
32593289
def gzip_decompress_bytes(blob, mode='rb', multi=True, **kw):
@@ -3776,6 +3806,21 @@ def from_bytes(cls, data, mode='rb', **kw):
37763806
bio = io.BytesIO(bytes(data) if not isinstance(data, bytes) else data)
37773807
return cls(fileobj=bio, mode=mode, **kw)
37783808

3809+
# compatibility aliases for unwrapping utilities
3810+
@property
3811+
def fileobj(self):
3812+
return self.file
3813+
3814+
@property
3815+
def myfileobj(self):
3816+
return self.file
3817+
3818+
# if some code expects ._fp to be “the stream itself”:
3819+
@property
3820+
def _fp(self):
3821+
# OR return self.file if callers intend the raw file
3822+
return self
3823+
37793824

37803825
# ---------- Top-level helpers ----------
37813826
def lzop_compress_bytes(payload, level=9, text=False, **kw):
@@ -5908,7 +5953,6 @@ def ReadInFileWithContentToArray(infile, fmttype="auto", filestart=0, seekstart=
59085953
infp.seek(oldinfppos, 0)
59095954
ArchiveList.append(ReadFileDataWithContentToArray(infp, currentinfilepos, seekstart, seekend, listonly, contentasfile, uncompress, skipchecksum, informatspecs, seektoend))
59105955
currentinfilepos = infp.tell()
5911-
infp.close()
59125956
currentfilepos = fp.tell()
59135957
return ArchiveList
59145958

@@ -8929,7 +8973,10 @@ def UncompressFileAlt(fp, formatspecs=__file_format_multi_dict__, filestart=0,
89298973
return False
89308974

89318975
# Always operate on the raw source for probe/wrap
8932-
src = getattr(fp, "_fp", fp)
8976+
if hasattr(fp, "_fp"):
8977+
src = getattr(fp, "_fp", fp)
8978+
else:
8979+
src = fp
89338980

89348981
# Probe at filestart using RAW handle
89358982
try:

0 commit comments

Comments
 (0)