@@ -77,12 +77,8 @@ def add_files(self, *paths, **kw):
7777
7878 def add_file_from_memory (
7979 self , entry_path , entry_size , entry_data ,
80- filetype = REGULAR_FILE ,
81- permission = DEFAULT_UNIX_PERMISSION ,
82- atime = None ,
83- mtime = None ,
84- ctime = None ,
85- birthtime = None ,
80+ filetype = REGULAR_FILE , permission = DEFAULT_UNIX_PERMISSION ,
81+ atime = None , mtime = None , ctime = None , birthtime = None ,
8682 ):
8783 """"Add file from memory to archive.
8884
@@ -124,21 +120,21 @@ def add_file_from_memory(
124120 entry_set_perm (archive_entry_pointer , permission )
125121
126122 if atime is not None :
127- archive_entry . set_atime ( * (
128- (atime , 0 )
129- if isinstance ( atime , ( int , float )) else atime ) )
123+ if not isinstance ( atime , tuple ):
124+ atime = (atime , 0 )
125+ archive_entry . set_atime ( * atime )
130126 if mtime is not None :
131- archive_entry . set_mtime ( * (
132- (mtime , 0 )
133- if isinstance ( mtime , ( int , float )) else mtime ) )
127+ if not isinstance ( mtime , tuple ):
128+ mtime = (mtime , 0 )
129+ archive_entry . set_mtime ( * mtime )
134130 if ctime is not None :
135- archive_entry . set_ctime ( * (
136- (ctime , 0 )
137- if isinstance ( ctime , ( int , float )) else ctime ) )
131+ if not isinstance ( ctime , tuple ):
132+ ctime = (ctime , 0 )
133+ archive_entry . set_ctime ( * ctime )
138134 if birthtime is not None :
139- archive_entry . set_birthtime ( * (
140- (birthtime , 0 )
141- if isinstance ( birthtime , ( int , float )) else birthtime ) )
135+ if not isinstance ( birthtime , tuple ):
136+ birthtime = (birthtime , 0 )
137+ archive_entry . set_birthtime ( * birthtime )
142138 write_header (archive_pointer , archive_entry_pointer )
143139
144140 for chunk in entry_data :
0 commit comments