comparison mercurial/archival.py @ 43487:d5bef33ab83c

archival: suppress some incorrect pytype failures Again, I suspect some missing coverage in type stubs for the stdlib. I'll revisit these later. Differential Revision: https://phab.mercurial-scm.org/D7288
author Augie Fackler <augie@google.com>
date Wed, 06 Nov 2019 16:26:53 -0500
parents d783f945a701
children 9f70512ae2cf
comparison
equal deleted inserted replaced
43486:3b581ad59459 43487:d5bef33ab83c
152 fname = self.name 152 fname = self.name
153 if fname and fname.endswith(b'.gz'): 153 if fname and fname.endswith(b'.gz'):
154 fname = fname[:-3] 154 fname = fname[:-3]
155 flags = 0 155 flags = 0
156 if fname: 156 if fname:
157 flags = gzip.FNAME 157 flags = gzip.FNAME # pytype: disable=module-attr
158 self.fileobj.write(pycompat.bytechr(flags)) 158 self.fileobj.write(pycompat.bytechr(flags))
159 gzip.write32u(self.fileobj, int(self.timestamp)) 159 gzip.write32u( # pytype: disable=module-attr
160 self.fileobj, int(self.timestamp)
161 )
160 self.fileobj.write(b'\002') 162 self.fileobj.write(b'\002')
161 self.fileobj.write(b'\377') 163 self.fileobj.write(b'\377')
162 if fname: 164 if fname:
163 self.fileobj.write(fname + b'\000') 165 self.fileobj.write(fname + b'\000')
164 166
177 zlib.Z_BEST_COMPRESSION, 179 zlib.Z_BEST_COMPRESSION,
178 fileobj, 180 fileobj,
179 timestamp=mtime, 181 timestamp=mtime,
180 ) 182 )
181 self.fileobj = gzfileobj 183 self.fileobj = gzfileobj
182 return tarfile.TarFile.taropen( 184 return tarfile.TarFile.taropen( # pytype: disable=attribute-error
183 name, pycompat.sysstr(mode), gzfileobj 185 name, pycompat.sysstr(mode), gzfileobj
184 ) 186 )
185 else: 187 else:
186 return tarfile.open(name, pycompat.sysstr(mode + kind), fileobj) 188 return tarfile.open(name, pycompat.sysstr(mode + kind), fileobj)
187 189
232 self.mtime = mtime 234 self.mtime = mtime
233 self.date_time = time.gmtime(mtime)[:6] 235 self.date_time = time.gmtime(mtime)[:6]
234 236
235 def addfile(self, name, mode, islink, data): 237 def addfile(self, name, mode, islink, data):
236 i = zipfile.ZipInfo(pycompat.fsdecode(name), self.date_time) 238 i = zipfile.ZipInfo(pycompat.fsdecode(name), self.date_time)
237 i.compress_type = self.z.compression 239 i.compress_type = self.z.compression # pytype: disable=attribute-error
238 # unzip will not honor unix file modes unless file creator is 240 # unzip will not honor unix file modes unless file creator is
239 # set to unix (id 3). 241 # set to unix (id 3).
240 i.create_system = 3 242 i.create_system = 3
241 ftype = _UNX_IFREG 243 ftype = _UNX_IFREG
242 if islink: 244 if islink: