Home
last modified time | relevance | path

Searched refs:fileobj (Results 1 – 25 of 63) sorted by relevance

123

/external/python/cpython2/Lib/
Dgzip.py46 compresslevel=9, fileobj=None, mtime=None): argument
93 if fileobj is None:
94 fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb')
98 if hasattr(fileobj, 'name') and fileobj.name != '<fdopen>':
99 filename = fileobj.name
103 if hasattr(fileobj, 'mode'): mode = fileobj.mode
131 self.fileobj = fileobj
147 s = repr(self.fileobj)
165 self.fileobj.write('\037\213') # magic header
166 self.fileobj.write('\010') # compression method
[all …]
Dtarfile.py398 def __init__(self, name, mode, comptype, fileobj, bufsize): argument
402 if fileobj is None:
403 fileobj = _LowLevelFile(name, mode)
409 fileobj = _StreamProxy(fileobj)
410 comptype = fileobj.getcomptype()
415 self.fileobj = fileobj
446 self.fileobj.close()
485 self.fileobj.write(self.buf[:self.bufsize])
501 self.fileobj.write(self.buf)
510 self.fileobj.write(struct.pack("<L", self.crc & 0xffffffffL))
[all …]
/external/python/cpython3/Lib/
Dselectors.py20 def _fileobj_to_fd(fileobj): argument
32 if isinstance(fileobj, int):
33 fd = fileobj
36 fd = int(fileobj.fileno())
39 "{!r}".format(fileobj)) from None
53 SelectorKey.fileobj.__doc__ = 'File object registered.'
68 def __getitem__(self, fileobj): argument
70 fd = self._selector._fileobj_lookup(fileobj)
73 raise KeyError("{!r} is not registered".format(fileobj)) from None
95 def register(self, fileobj, events, data=None): argument
[all …]
Dgzip.py124 compresslevel=9, fileobj=None, mtime=None): argument
162 if fileobj is None:
163 fileobj = self.myfileobj = builtins.open(filename, mode or 'rb')
165 filename = getattr(fileobj, 'name', '')
171 mode = getattr(fileobj, 'mode', 'rb')
175 raw = _GzipReader(fileobj)
191 self.fileobj = fileobj
210 s = repr(self.fileobj)
222 self.fileobj.write(b'\037\213') # magic header
223 self.fileobj.write(b'\010') # compression method
[all …]
Dtarfile.py346 def __init__(self, name, mode, comptype, fileobj, bufsize): argument
350 if fileobj is None:
351 fileobj = _LowLevelFile(name, mode)
357 fileobj = _StreamProxy(fileobj)
358 comptype = fileobj.getcomptype()
363 self.fileobj = fileobj
412 self.fileobj.close()
450 self.fileobj.write(self.buf[:self.bufsize])
466 self.fileobj.write(self.buf)
469 self.fileobj.write(struct.pack("<L", self.crc))
[all …]
/external/python/cpython2/Lib/test/
Dtest_csv.py124 fileobj = os.fdopen(fd, "w+b")
126 writer = csv.writer(fileobj, **kwargs)
128 fileobj.seek(0)
129 self.assertEqual(fileobj.read(),
132 fileobj.close()
137 fileobj = os.fdopen(fd, "w+b")
139 writer = csv.writer(fileobj, **kwargs)
142 fileobj.seek(0)
143 self.assertEqual(fileobj.read(), '')
145 fileobj.close()
[all …]
Dtest_tarfile.py330 tar = tarfile.open(fileobj=fobj, mode=self.mode)
338 tar = tarfile.open(fileobj=fobj, mode=self.mode)
346 tar = tarfile.open(fileobj=fobj, mode=self.mode)
385 tar = tar.open(self.tarname, mode="r:", fileobj=fobj)
404 fileobj=fobj, mode=self.mode)
483 self.assertTrue(tar.fileobj.closed)
552 tar = tarfile.open(name, mode, fileobj=open(name, "rb"))
711 self.tar.fileobj.seek(offset)
712 fobj = StringIO.StringIO(self.tar.fileobj.read(3 * 512))
713 self.assertRaises(tarfile.ReadError, tarfile.open, name="foo.tar", fileobj=fobj)
[all …]
/external/python/cpython3/Lib/test/
Dtest_csv.py123 with TemporaryFile("w+", newline='') as fileobj:
124 writer = csv.writer(fileobj, **kwargs)
126 fileobj.seek(0)
127 self.assertEqual(fileobj.read(),
131 with TemporaryFile("w+", newline='') as fileobj:
132 writer = csv.writer(fileobj, **kwargs)
135 fileobj.seek(0)
136 self.assertEqual(fileobj.read(), '')
207 with TemporaryFile("w+", newline='') as fileobj:
208 writer = csv.writer(fileobj)
[all …]
Dtest_gzip.py138 f = gzip.GzipFile(fileobj=io.BytesIO(compressed), mode='rb')
148 fileobj = f.fileobj
149 self.assertFalse(fileobj.closed)
151 self.assertTrue(fileobj.closed)
160 fileobj = f.fileobj
161 self.assertFalse(fileobj.closed)
163 self.assertTrue(fileobj.closed)
294 self.assertTrue(hasattr(f.fileobj, "name"))
295 self.assertEqual(f.fileobj.name, self.filename)
389 with gzip.GzipFile(fileobj=buf, mode="wb") as f:
[all …]
Dtest_telnetlib.py127 def register(self, fileobj, events, data=None): argument
128 key = selectors.SelectorKey(fileobj, 0, events, data)
129 self.keys[fileobj] = key
132 def unregister(self, fileobj): argument
133 return self.keys.pop(fileobj)
137 for fileobj in self.keys:
138 if isinstance(fileobj, TelnetAlike):
139 block = fileobj.sock.block
Dtest_tarfile.py405 with tarfile.open(fileobj=fobj, mode=self.mode) as tar:
414 tar = tarfile.open(fileobj=fobj, mode=self.mode)
422 with tarfile.open(fileobj=fobj, mode=self.mode) as tar:
431 with tarfile.open(fileobj=fobj, mode=self.mode) as tar:
439 with tarfile.open(fileobj=fobj, mode=self.mode) as tar:
472 tar = tar.open(self.tarname, mode="r:", fileobj=fobj)
487 fileobj=fobj, mode=self.mode)
598 self.assertTrue(tar.fileobj.closed)
710 tar = tarfile.open(name, mode, fileobj=f)
882 self.tar.fileobj.seek(offset)
[all …]
/external/libvpx/libvpx/tools/
Dwrap-commit-msg.py42 def main(fileobj): argument
46 line = fileobj.readline()
59 if fileobj == sys.stdin:
60 fileobj = sys.stdout
62 fileobj.seek(0)
63 fileobj.truncate(0)
64 fileobj.write(output)
/external/python/cpython3/Tools/tz/
Dzdump.py18 def fromfile(cls, fileobj): argument
19 if fileobj.read(4).decode() != "TZif":
21 fileobj.seek(20)
22 header = fileobj.read(24)
26 transitions.fromfile(fileobj, tzh_timecnt)
31 type_indices.fromfile(fileobj, tzh_timecnt)
35 ttis.append(ttinfo._make(struct.unpack(">lbb", fileobj.read(6))))
37 abbrs = fileobj.read(tzh_charcnt)
79 with open(filepath, 'rb') as fileobj:
80 tzi = TZInfo.fromfile(fileobj)
/external/python/cpython2/Lib/plat-mac/
Dapplesingle.py51 def __init__(self, fileobj, verbose=False): argument
52 header = fileobj.read(AS_HEADER_LENGTH)
67 headers = [fileobj.read(AS_ENTRY_LENGTH) for i in xrange(nentry)]
76 fileobj.seek(offset)
77 data = fileobj.read(length)
/external/python/cpython3/Doc/library/
Dselectors.rst75 .. attribute:: fileobj
105 .. abstractmethod:: register(fileobj, events, data=None)
109 *fileobj* is the file object to monitor. It may either be an integer
118 .. abstractmethod:: unregister(fileobj)
123 *fileobj* must be a file object previously registered.
126 :exc:`KeyError` if *fileobj* is not registered. It will raise
127 :exc:`ValueError` if *fileobj* is invalid (e.g. it has no ``fileno()``
130 .. method:: modify(fileobj, events, data=None)
134 This is equivalent to :meth:`BaseSelector.unregister(fileobj)` followed
135 by :meth:`BaseSelector.register(fileobj, events, data)`, except that it
[all …]
Dgzip.rst62 .. class:: GzipFile(filename=None, mode=None, compresslevel=9, fileobj=None, mtime=None)
66 method. At least one of *fileobj* and *filename* must be given a non-trivial
69 The new class instance is based on *fileobj*, which can be a regular file, an
74 When *fileobj* is not ``None``, the *filename* argument is only used to be
76 filename of the uncompressed file. It defaults to the filename of *fileobj*, if
82 written. The default is the mode of *fileobj* if discernible; otherwise, the
100 *fileobj*, since you might wish to append more material after the compressed
102 writing as *fileobj*, and retrieve the resulting memory buffer using the
121 *fileobj* parameter).
/external/python/cpython2/Doc/library/
Dgzip.rst28 .. class:: GzipFile([filename[, mode[, compresslevel[, fileobj[, mtime]]]]])
32 :meth:`truncate` methods. At least one of *fileobj* and *filename* must be
35 The new class instance is based on *fileobj*, which can be a regular file, a
40 When *fileobj* is not ``None``, the *filename* argument is only used to be
42 filename of the uncompressed file. It defaults to the filename of *fileobj*, if
48 is the mode of *fileobj* if discernible; otherwise, the default is ``'rb'``. If
67 *fileobj*, since you might wish to append more material after the compressed
69 writing as *fileobj*, and retrieve the resulting memory buffer using the
/external/python/cpython3/Objects/
Dmoduleobject.c494 PyObject *fileobj; in PyModule_GetFilenameObject() local
501 (fileobj = _PyDict_GetItemId(d, &PyId___file__)) == NULL || in PyModule_GetFilenameObject()
502 !PyUnicode_Check(fileobj)) in PyModule_GetFilenameObject()
507 Py_INCREF(fileobj); in PyModule_GetFilenameObject()
508 return fileobj; in PyModule_GetFilenameObject()
514 PyObject *fileobj; in PyModule_GetFilename() local
516 fileobj = PyModule_GetFilenameObject(m); in PyModule_GetFilename()
517 if (fileobj == NULL) in PyModule_GetFilename()
519 utf8 = PyUnicode_AsUTF8(fileobj); in PyModule_GetFilename()
520 Py_DECREF(fileobj); /* module dict has still a reference */ in PyModule_GetFilename()
/external/boringssl/src/util/bot/
Dextract.py41 def __init__(self, path, mode, fileobj): argument
44 self.fileobj = fileobj
154 shutil.copyfileobj(entry.fileobj, out)
/external/python/cpython2/Objects/
Dmoduleobject.c83 PyObject *fileobj; in PyModule_GetFilename() local
90 (fileobj = PyDict_GetItemString(d, "__file__")) == NULL || in PyModule_GetFilename()
91 !PyString_Check(fileobj)) in PyModule_GetFilename()
96 return PyString_AsString(fileobj); in PyModule_GetFilename()
/external/python/cpython3/Parser/
Dparsetok.c144 PyObject *fileobj = NULL; in PyParser_ParseFileFlagsEx() local
147 fileobj = PyUnicode_DecodeFSDefault(filename); in PyParser_ParseFileFlagsEx()
148 if (fileobj == NULL) { in PyParser_ParseFileFlagsEx()
154 n = PyParser_ParseFileObject(fp, fileobj, enc, g, in PyParser_ParseFileFlagsEx()
157 Py_XDECREF(fileobj); in PyParser_ParseFileFlagsEx()
/external/autotest/client/bin/
Dtest_config.py107 fileobj = file(self.cfg, 'w')
109 self.parser.write(fileobj)
111 fileobj.close()
/external/python/cpython3/Lib/asyncio/
Dtest_utils.py250 def register(self, fileobj, events, data=None): argument
251 key = selectors.SelectorKey(fileobj, 0, events, data)
252 self.keys[fileobj] = key
255 def unregister(self, fileobj): argument
256 return self.keys.pop(fileobj)
/external/jsoncpp/scons-tools/
Dtargz.py44 fileobj = gzip.GzipFile( target_path, 'wb', compression )
45 tar = tarfile.TarFile(os.path.splitext(target_path)[0], 'w', fileobj)
/external/libmojo/build/android/gyp/util/
Dmd5_check.py253 def FromFile(cls, fileobj): argument
256 obj = json.load(fileobj)
263 def ToFile(self, fileobj): argument
271 json.dump(obj, fileobj, indent=2)

123