Skip to content

Commit acd72c2

Browse files
Add files via upload
1 parent 63ed686 commit acd72c2

1 file changed

Lines changed: 18 additions & 23 deletions

File tree

pycatfile.py

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10744,27 +10744,7 @@ def _add(cat, name, fid):
1074410744
return out
1074510745

1074610746

10747-
def RePackCatFile(
10748-
infile,
10749-
outfile,
10750-
fmttype="auto",
10751-
compression="auto",
10752-
compresswholefile=True,
10753-
compressionlevel=None,
10754-
compressionuselist=None, # was: compressionlistalt at def time
10755-
followlink=False,
10756-
filestart=0,
10757-
seekstart=0,
10758-
seekend=0,
10759-
checksumtype=None, # was: ["crc32", ...] (mutable)
10760-
skipchecksum=False,
10761-
extradata=None, # was: [] (mutable)
10762-
jsondata=None, # was: {} (mutable)
10763-
formatspecs=None, # was: __file_format_dict__ at def time
10764-
seektoend=False,
10765-
verbose=False,
10766-
returnfp=False,
10767-
):
10747+
def RePackCatFile(infile, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=None, followlink=False, filestart=0, seekstart=0, seekend=0, checksumtype=None, skipchecksum=False, extradata=None, jsondata=None, formatspecs=None, seektoend=False, verbose=False, returnfp=False):
1076810748
# ---------- Safe defaults ----------
1076910749
if compressionuselist is None:
1077010750
compressionuselist = compressionlistalt
@@ -10787,7 +10767,7 @@ def RePackCatFile(
1078710767
listarrayfiles = CatFileToArray(
1078810768
infile, "auto", filestart, seekstart, seekend,
1078910769
False, True, True, skipchecksum, formatspecs, seektoend, returnfp
10790-
)
10770+
)[0]
1079110771

1079210772
# Light guard on required structure
1079310773
if not listarrayfiles or 'ffilelist' not in listarrayfiles or 'fnumfiles' not in listarrayfiles:
@@ -10843,6 +10823,8 @@ def RePackCatFile(
1084310823
if outfile == "-" or outfile is None:
1084410824
verbose = False
1084510825
fp = MkTempFile()
10826+
elif(isinstance(outfile, FileLikeAdapter)):
10827+
fp = outfile
1084610828
elif hasattr(outfile, "read") or hasattr(outfile, "write"):
1084710829
fp = outfile
1084810830
elif re.findall(__upload_proto_support__, outfile):
@@ -11104,7 +11086,6 @@ def RePackCatFile(
1110411086
upload_file_to_internet_file(fp, outfile)
1110511087

1110611088
if returnfp:
11107-
fp.seek(0, 0)
1110811089
return fp
1110911090
else:
1111011091
try:
@@ -11113,6 +11094,20 @@ def RePackCatFile(
1111311094
pass
1111411095
return True
1111511096

11097+
def RePackMultipleCatFile(infiles, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=None, followlink=False, filestart=0, seekstart=0, seekend=0, checksumtype=None, skipchecksum=False, extradata=None, jsondata=None, formatspecs=None, seektoend=False, verbose=False, returnfp=False):
11098+
if not isinstance(infiles, list):
11099+
infiles = [infiles]
11100+
returnout = False
11101+
for infileslist in infiles:
11102+
returnout = RePackArchiveFile(infileslist, outfile, fmttype, compression, compresswholefile, compressionlevel, compressionuselist, followlink, filestart, seekstart, seekend, checksumtype, skipchecksum, extradata, jsondata, formatspecs, seektoend, verbose, True)
11103+
if(not returnout):
11104+
break
11105+
else:
11106+
outfile = returnout
11107+
if(not returnfp and returnout):
11108+
returnout.close()
11109+
return True
11110+
return returnout
1111611111

1111711112
def RePackCatFileFromString(instr, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, followlink=False, filestart=0, seekstart=0, seekend=0, checksumtype=["crc32", "crc32", "crc32"], skipchecksum=False, extradata=[], jsondata={}, formatspecs=__file_format_dict__, seektoend=False, verbose=False, returnfp=False):
1111811113
fp = MkTempFile(instr)

0 commit comments

Comments
 (0)