@@ -3139,6 +3139,8 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
31393139 GetDirList = ListDirAdvanced (infilelist , followlink , False )
31403140 else :
31413141 GetDirList = ListDir (infilelist , followlink , False )
3142+ if (not isinstance (infiles , (list , tuple , ))):
3143+ return False
31423144 FullSizeFiles = GetTotalSize (GetDirList )
31433145 if (not GetDirList ):
31443146 return False
@@ -3869,10 +3871,6 @@ def UncompressArchiveFile(fp, formatspecs=__file_format_dict__):
38693871 return catfp
38703872
38713873
3872- create_alias_function ("Uncompress" , __file_format_name__ ,
3873- "" , UncompressArchiveFile )
3874-
3875-
38763874def UncompressFile (infile , formatspecs = __file_format_dict__ , mode = "rb" ):
38773875 formatspecs = FormatSpecsListToDict (formatspecs )
38783876 compresscheck = CheckCompressionType (infile , formatspecs , False )
@@ -4187,10 +4185,6 @@ def CompressArchiveFile(fp, compression="auto", compressionlevel=None, formatspe
41874185 return catfp
41884186
41894187
4190- create_alias_function ("Compress" , __file_format_name__ ,
4191- "" , CompressArchiveFile )
4192-
4193-
41944188def CompressOpenFile (outfile , compressionenable = True , compressionlevel = None ):
41954189 if (outfile is None ):
41964190 return False
@@ -4368,6 +4362,8 @@ def PackArchiveFile(infiles, outfile, dirlistfromtxt=False, compression="auto",
43684362 GetDirList = ListDirAdvanced (infilelist , followlink , False )
43694363 else :
43704364 GetDirList = ListDir (infilelist , followlink , False )
4365+ if (not isinstance (infiles , (list , tuple , ))):
4366+ return False
43714367 FullSizeFiles = GetTotalSize (GetDirList )
43724368 if (not GetDirList ):
43734369 return False
@@ -4655,25 +4651,16 @@ def PackArchiveFile(infiles, outfile, dirlistfromtxt=False, compression="auto",
46554651 return True
46564652
46574653
4658- create_alias_function ("Pack" , __file_format_name__ , "" , PackArchiveFile )
4659-
4660-
46614654if (hasattr (shutil , "register_archive_format" )):
46624655 def PackArchiveFileFunc (archive_name , source_dir , ** kwargs ):
46634656 return PackArchiveFile (source_dir , archive_name , False , "auto" , True , None , compressionlistalt , False , "crc32" , [], __file_format_dict__ ['format_delimiter' ], False , False )
4664- create_alias_function ("Pack" , __file_format_name__ ,
4665- "Func" , PackArchiveFileFunc )
46664657
46674658
46684659def PackArchiveFileFromDirList (infiles , outfile , dirlistfromtxt = False , compression = "auto" , compresswholefile = True , compressionlevel = None , compressionuselist = compressionlistalt , followlink = False , checksumtype = "crc32" , extradata = [], formatspecs = __file_format_dict__ , verbose = False , returnfp = False ):
46694660 formatspecs = FormatSpecsListToDict (formatspecs )
46704661 return PackArchiveFile (infiles , outfile , dirlistfromtxt , compression , compresswholefile , compressionlevel , compressionuselist , followlink , checksumtype , extradata , formatspecs , verbose , returnfp )
46714662
46724663
4673- create_alias_function ("Pack" , __file_format_name__ ,
4674- "FromDirList" , PackArchiveFileFromDirList )
4675-
4676-
46774664def PackArchiveFileFromTarFile (infile , outfile , compression = "auto" , compresswholefile = True , compressionlevel = None , compressionuselist = compressionlistalt , checksumtype = "crc32" , extradata = [], formatspecs = __file_format_dict__ , verbose = False , returnfp = False ):
46784665 formatspecs = FormatSpecsListToDict (formatspecs )
46794666 if (outfile != "-" and outfile is not None and not hasattr (outfile , "read" ) and not hasattr (outfile , "write" )):
@@ -4946,10 +4933,6 @@ def PackArchiveFileFromTarFile(infile, outfile, compression="auto", compresswhol
49464933 return True
49474934
49484935
4949- create_alias_function ("Pack" , __file_format_name__ ,
4950- "FromTarFile" , PackArchiveFileFromTarFile )
4951-
4952-
49534936def PackArchiveFileFromZipFile (infile , outfile , compression = "auto" , compresswholefile = True , compressionlevel = None , compressionuselist = compressionlistalt , checksumtype = "crc32" , extradata = [], formatspecs = __file_format_dict__ , verbose = False , returnfp = False ):
49544937 formatspecs = FormatSpecsListToDict (formatspecs )
49554938 if (outfile != "-" and outfile is not None and not hasattr (outfile , "read" ) and not hasattr (outfile , "write" )):
@@ -5221,9 +5204,6 @@ def PackArchiveFileFromZipFile(infile, outfile, compression="auto", compresswhol
52215204 return True
52225205
52235206
5224- create_alias_function ("Pack" , __file_format_name__ ,
5225- "FromZipFile" , PackArchiveFileFromZipFile )
5226-
52275207if (not rarfile_support ):
52285208 def PackArchiveFileFromRarFile (infile , outfile , compression = "auto" , compresswholefile = True , compressionlevel = None , compressionuselist = compressionlistalt , checksumtype = "crc32" , extradata = [], formatspecs = __file_format_dict__ , verbose = False , returnfp = False ):
52295209 return False
@@ -5524,8 +5504,6 @@ def PackArchiveFileFromRarFile(infile, outfile, compression="auto", compresswhol
55245504 catfp .close ()
55255505 return True
55265506
5527- create_alias_function ("Pack" , __file_format_name__ ,
5528- "FromRarFile" , PackArchiveFileFromRarFile )
55295507
55305508if (not py7zr_support ):
55315509 def PackArchiveFileFromSevenZipFile (infile , outfile , compression = "auto" , compresswholefile = True , compressionlevel = None , compressionuselist = compressionlistalt , checksumtype = "crc32" , extradata = [], formatspecs = __file_format_dict__ , verbose = False , returnfp = False ):
@@ -5760,9 +5738,6 @@ def PackArchiveFileFromSevenZipFile(infile, outfile, compression="auto", compres
57605738 catfp .close ()
57615739 return True
57625740
5763- create_alias_function ("Pack" , __file_format_name__ ,
5764- "FromSevenZipFile" , PackArchiveFileFromSevenZipFile )
5765-
57665741
57675742def PackArchiveFileFromInFile (infile , outfile , compression = "auto" , compresswholefile = True , compressionlevel = None , compressionuselist = compressionlistalt , checksumtype = "crc32" , extradata = [], formatspecs = __file_format_dict__ , verbose = False , returnfp = False ):
57685743 formatspecs = FormatSpecsListToDict (formatspecs )
@@ -5785,10 +5760,6 @@ def PackArchiveFileFromInFile(infile, outfile, compression="auto", compresswhole
57855760 return False
57865761
57875762
5788- create_alias_function ("Pack" , __file_format_name__ ,
5789- "FromInFile" , PackArchiveFileFromInFile )
5790-
5791-
57925763def ArchiveFileSeekToFileNum (infile , seekto = 0 , listonly = False , contentasfile = True , skipchecksum = False , formatspecs = __file_format_dict__ , returnfp = False ):
57935764 formatspecs = FormatSpecsListToDict (formatspecs )
57945765 if (hasattr (infile , "read" ) or hasattr (infile , "write" )):
@@ -6099,10 +6070,6 @@ def ArchiveFileSeekToFileNum(infile, seekto=0, listonly=False, contentasfile=Tru
60996070 return catlist
61006071
61016072
6102- create_alias_function ("" , __file_format_name__ ,
6103- "SeekToFileNum" , ArchiveFileSeekToFileNum )
6104-
6105-
61066073def ArchiveFileSeekToFileName (infile , seekfile = None , listonly = False , contentasfile = True , skipchecksum = False , formatspecs = __file_format_dict__ , returnfp = False ):
61076074 formatspecs = FormatSpecsListToDict (formatspecs )
61086075 if (hasattr (infile , "read" ) or hasattr (infile , "write" )):
@@ -6379,10 +6346,6 @@ def ArchiveFileSeekToFileName(infile, seekfile=None, listonly=False, contentasfi
63796346 return catlist
63806347
63816348
6382- create_alias_function ("" , __file_format_name__ ,
6383- "SeekToFileName" , ArchiveFileSeekToFileName )
6384-
6385-
63866349def ArchiveFileValidate (infile , formatspecs = __file_format_dict__ , verbose = False , returnfp = False ):
63876350 formatspecs = FormatSpecsListToDict (formatspecs )
63886351 if (verbose ):
@@ -6694,10 +6657,6 @@ def ArchiveFileValidate(infile, formatspecs=__file_format_dict__, verbose=False,
66946657 return False
66956658
66966659
6697- create_alias_function ("" , __file_format_name__ ,
6698- "Validate" , ArchiveFileValidate )
6699-
6700-
67016660def ArchiveFileToArray (infile , seekstart = 0 , seekend = 0 , listonly = False , contentasfile = True , uncompress = True , skipchecksum = False , formatspecs = __file_format_dict__ , returnfp = False ):
67026661 formatspecs = FormatSpecsListToDict (formatspecs )
67036662 if (hasattr (infile , "read" ) or hasattr (infile , "write" )):
@@ -7104,9 +7063,6 @@ def ArchiveFileToArray(infile, seekstart=0, seekend=0, listonly=False, contentas
71047063 return catlist
71057064
71067065
7107- create_alias_function ("" , __file_format_name__ , "ToArray" , ArchiveFileToArray )
7108-
7109-
71107066def ArchiveFileStringToArray (catstr , seekstart = 0 , seekend = 0 , listonly = False , contentasfile = True , skipchecksum = False , formatspecs = __file_format_dict__ , returnfp = False ):
71117067 formatspecs = FormatSpecsListToDict (formatspecs )
71127068 catfp = BytesIO (catstr )
@@ -7115,10 +7071,6 @@ def ArchiveFileStringToArray(catstr, seekstart=0, seekend=0, listonly=False, con
71157071 return listcatfiles
71167072
71177073
7118- create_alias_function ("" , __file_format_name__ ,
7119- "StringToArray" , ArchiveFileStringToArray )
7120-
7121-
71227074def TarFileToArray (infile , seekstart = 0 , seekend = 0 , listonly = False , contentasfile = True , skipchecksum = False , formatspecs = __file_format_dict__ , returnfp = False ):
71237075 formatspecs = FormatSpecsListToDict (formatspecs )
71247076 catfp = BytesIO ()
@@ -7217,6 +7169,8 @@ def ListDirToArrayAlt(infiles, dirlistfromtxt=False, followlink=False, listonly=
72177169 GetDirList = ListDirAdvanced (infilelist , followlink , False )
72187170 else :
72197171 GetDirList = ListDir (infilelist , followlink , False )
7172+ if (not isinstance (infiles , (list , tuple , ))):
7173+ return False
72207174 FullSizeFiles = GetTotalSize (GetDirList )
72217175 if (not GetDirList ):
72227176 return False
@@ -8481,10 +8435,6 @@ def ArchiveFileArrayToArrayIndex(inarray, seekstart=0, seekend=0, listonly=False
84818435 return catarray
84828436
84838437
8484- create_alias_function ("" , __file_format_name__ ,
8485- "ArrayToArrayIndex" , ArchiveFileArrayToArrayIndex )
8486-
8487-
84888438def RePackArchiveFile (infile , outfile , compression = "auto" , compresswholefile = True , compressionlevel = None , compressionuselist = compressionlistalt , followlink = False , seekstart = 0 , seekend = 0 , checksumtype = "crc32" , skipchecksum = False , extradata = [], formatspecs = __file_format_dict__ , verbose = False , returnfp = False ):
84898439 formatspecs = FormatSpecsListToDict (formatspecs )
84908440 if (isinstance (infile , dict )):
@@ -8749,9 +8699,6 @@ def RePackArchiveFile(infile, outfile, compression="auto", compresswholefile=Tru
87498699 return True
87508700
87518701
8752- create_alias_function ("RePack" , __file_format_name__ , "" , RePackArchiveFile )
8753-
8754-
87558702def RePackArchiveFileFromString (catstr , outfile , compression = "auto" , compresswholefile = True , compressionlevel = None , compressionuselist = compressionlistalt , checksumtype = "crc32" , skipchecksum = False , extradata = [], formatspecs = __file_format_dict__ , verbose = False , returnfp = False ):
87568703 formatspecs = FormatSpecsListToDict (formatspecs )
87578704 catfp = BytesIO (catstr )
@@ -8760,10 +8707,6 @@ def RePackArchiveFileFromString(catstr, outfile, compression="auto", compresswho
87608707 return listcatfiles
87618708
87628709
8763- create_alias_function ("RePack" , __file_format_name__ ,
8764- "FromString" , RePackArchiveFileFromString )
8765-
8766-
87678710def PackArchiveFileFromListDir (infiles , outfile , dirlistfromtxt = False , compression = "auto" , compresswholefile = True , compressionlevel = None , compressionuselist = compressionlistalt , followlink = False , skipchecksum = False , checksumtype = "crc32" , extradata = [], formatspecs = __file_format_dict__ , verbose = False , returnfp = False ):
87688711 formatspecs = FormatSpecsListToDict (formatspecs )
87698712 outarray = BytesIO ()
@@ -8774,10 +8717,6 @@ def PackArchiveFileFromListDir(infiles, outfile, dirlistfromtxt=False, compressi
87748717 return listcatfiles
87758718
87768719
8777- create_alias_function ("Pack" , __file_format_name__ ,
8778- "FromListDir" , PackArchiveFileFromListDir )
8779-
8780-
87818720def UnPackArchiveFile (infile , outdir = None , followlink = False , seekstart = 0 , seekend = 0 , skipchecksum = False , formatspecs = __file_format_dict__ , preservepermissions = True , preservetime = True , verbose = False , returnfp = False ):
87828721 formatspecs = FormatSpecsListToDict (formatspecs )
87838722 if (outdir is not None ):
@@ -9039,13 +8978,9 @@ def UnPackArchiveFile(infile, outdir=None, followlink=False, seekstart=0, seeken
90398978 return True
90408979
90418980
9042- create_alias_function ("UnPack" , __file_format_name__ , "" , UnPackArchiveFile )
9043-
90448981if (hasattr (shutil , "register_unpack_format" )):
90458982 def UnPackArchiveFileFunc (archive_name , extract_dir = None , ** kwargs ):
90468983 return UnPackArchiveFile (archive_name , extract_dir , False , 0 , 0 , False , __file_format_dict__ ['format_delimiter' ], False , False )
9047- create_alias_function ("UnPack" , __file_format_name__ ,
9048- "Func" , UnPackArchiveFileFunc )
90498984
90508985
90518986def UnPackArchiveFileString (catstr , outdir = None , followlink = False , seekstart = 0 , seekend = 0 , skipchecksum = False , formatspecs = __file_format_dict__ , verbose = False , returnfp = False ):
@@ -9056,10 +8991,6 @@ def UnPackArchiveFileString(catstr, outdir=None, followlink=False, seekstart=0,
90568991 return listcatfiles
90578992
90588993
9059- create_alias_function ("UnPack" , __file_format_name__ ,
9060- "String" , UnPackArchiveFileString )
9061-
9062-
90638994def ArchiveFileListFiles (infile , seekstart = 0 , seekend = 0 , skipchecksum = False , formatspecs = __file_format_dict__ , verbose = False , returnfp = False ):
90648995 formatspecs = FormatSpecsListToDict (formatspecs )
90658996 logging .basicConfig (format = "%(message)s" ,
@@ -9111,10 +9042,6 @@ def ArchiveFileListFiles(infile, seekstart=0, seekend=0, skipchecksum=False, for
91119042 return True
91129043
91139044
9114- create_alias_function ("" , __file_format_name__ ,
9115- "ListFiles" , ArchiveFileListFiles )
9116-
9117-
91189045def ArchiveFileStringListFiles (catstr , seekstart = 0 , seekend = 0 , skipchecksum = False , formatspecs = __file_format_dict__ , verbose = False , returnfp = False ):
91199046 formatspecs = FormatSpecsListToDict (formatspecs )
91209047 catfp = BytesIO (catstr )
@@ -9123,10 +9050,6 @@ def ArchiveFileStringListFiles(catstr, seekstart=0, seekend=0, skipchecksum=Fals
91239050 return listcatfiles
91249051
91259052
9126- create_alias_function ("" , __file_format_name__ ,
9127- "StringListFiles" , ArchiveFileStringListFiles )
9128-
9129-
91309053def TarFileListFiles (infile , verbose = False , returnfp = False ):
91319054 logging .basicConfig (format = "%(message)s" ,
91329055 stream = sys .stdout , level = logging .DEBUG )
@@ -9674,10 +9597,6 @@ def PackArchiveFileFromListDirAlt(infiles, outfile, dirlistfromtxt=False, compre
96749597 return listcatfiles
96759598
96769599
9677- create_alias_function ("Pack" , __file_format_name__ ,
9678- "FromListDirAlt" , PackArchiveFileFromListDirAlt )
9679-
9680-
96819600def PackArchiveFileFromTarFileAlt (infile , outfile , compression = "auto" , compresswholefile = True , compressionlevel = None , compressionuselist = compressionlistalt , checksumtype = "crc32" , extradata = [], formatspecs = __file_format_dict__ , verbose = False , returnfp = False ):
96829601 formatspecs = FormatSpecsListToDict (formatspecs )
96839602 outarray = TarFileToArrayAlt (
@@ -9687,10 +9606,6 @@ def PackArchiveFileFromTarFileAlt(infile, outfile, compression="auto", compressw
96879606 return listcatfiles
96889607
96899608
9690- create_alias_function ("Pack" , __file_format_name__ ,
9691- "FromTarFileAlt" , PackArchiveFileFromTarFileAlt )
9692-
9693-
96949609def PackArchiveFileFromZipFileAlt (infile , outfile , compression = "auto" , compresswholefile = True , compressionlevel = None , compressionuselist = compressionlistalt , checksumtype = "crc32" , extradata = [], formatspecs = __file_format_dict__ , verbose = False , returnfp = False ):
96959610 formatspecs = FormatSpecsListToDict (formatspecs )
96969611 outarray = ZipFileToArrayAlt (
@@ -9700,9 +9615,6 @@ def PackArchiveFileFromZipFileAlt(infile, outfile, compression="auto", compressw
97009615 return listcatfiles
97019616
97029617
9703- create_alias_function ("Pack" , __file_format_name__ ,
9704- "FromZipFileAlt" , PackArchiveFileFromZipFileAlt )
9705-
97069618if (not rarfile_support ):
97079619 def PackArchiveFileFromRarFileAlt (infile , outfile , compression = "auto" , compresswholefile = True , compressionlevel = None , compressionuselist = compressionlistalt , checksumtype = "crc32" , extradata = [], formatspecs = __file_format_dict__ , verbose = False , returnfp = False ):
97089620 return False
@@ -9716,8 +9628,6 @@ def PackArchiveFileFromRarFileAlt(infile, outfile, compression="auto", compressw
97169628 compressionlevel , compressionuselist , False , checksumtype , False , extradata , formatspecs , verbose , returnfp )
97179629 return listcatfiles
97189630
9719- create_alias_function ("Pack" , __file_format_name__ ,
9720- "FromRarFileAlt" , PackArchiveFileFromRarFileAlt )
97219631
97229632if (not py7zr_support ):
97239633 def PackArchiveFileFromSevenZipFileAlt (infile , outfile , compression = "auto" , compresswholefile = True , compressionlevel = None , compressionuselist = compressionlistalt , checksumtype = "crc32" , extradata = [], formatspecs = __file_format_dict__ , verbose = False , returnfp = False ):
@@ -9732,9 +9642,6 @@ def PackArchiveFileFromSevenZipFileAlt(infile, outfile, compression="auto", comp
97329642 compressionlevel , compressionuselist , False , checksumtype , False , extradata , formatspecs , verbose , returnfp )
97339643 return listcatfiles
97349644
9735- create_alias_function ("Pack" , __file_format_name__ ,
9736- "FromSevenZipFileAlt" , PackArchiveFileFromSevenZipFileAlt )
9737-
97389645
97399646def download_file_from_ftp_file (url ):
97409647 urlparts = urlparse (url )
0 commit comments