Home
last modified time | relevance | path

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

1234

/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 filename = getattr(fileobj, 'name', '')
102 if hasattr(fileobj, 'mode'): mode = fileobj.mode
130 self.fileobj = fileobj
146 s = repr(self.fileobj)
164 self.fileobj.write('\037\213') # magic header
165 self.fileobj.write('\010') # compression method
179 self.fileobj.write(chr(flags))
[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/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.py146 f = gzip.GzipFile(fileobj=io.BytesIO(compressed), mode='rb')
156 fileobj = f.fileobj
157 self.assertFalse(fileobj.closed)
159 self.assertTrue(fileobj.closed)
168 fileobj = f.fileobj
169 self.assertFalse(fileobj.closed)
171 self.assertTrue(fileobj.closed)
302 self.assertTrue(hasattr(f.fileobj, "name"))
303 self.assertEqual(f.fileobj.name, self.filename)
397 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
/external/python/cpython3/Lib/
Dselectors.py21 def _fileobj_to_fd(fileobj): argument
33 if isinstance(fileobj, int):
34 fd = fileobj
37 fd = int(fileobj.fileno())
40 "{!r}".format(fileobj)) from None
54 SelectorKey.fileobj.__doc__ = 'File object registered.'
69 def __getitem__(self, fileobj): argument
71 fd = self._selector._fileobj_lookup(fileobj)
74 raise KeyError("{!r} is not registered".format(fileobj)) from None
96 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.py345 def __init__(self, name, mode, comptype, fileobj, bufsize): argument
349 if fileobj is None:
350 fileobj = _LowLevelFile(name, mode)
356 fileobj = _StreamProxy(fileobj)
357 comptype = fileobj.getcomptype()
362 self.fileobj = fileobj
411 self.fileobj.close()
449 self.fileobj.write(self.buf[:self.bufsize])
465 self.fileobj.write(self.buf)
468 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_gzip.py56 gzip.GzipFile(fileobj=fobj, mode="rb") as f:
332 with gzip.GzipFile(fileobj=f, mode="w") as g:
338 with gzip.GzipFile(fileobj=f, mode="w") as g:
344 with gzip.GzipFile(fileobj=f, mode='r') as g:
346 with gzip.GzipFile(fileobj=f, mode='w') as g:
348 with gzip.GzipFile(fileobj=f, mode='a') as g:
351 gzip.GzipFile(fileobj=f, mode='z')
354 with gzip.GzipFile(fileobj=f) as g:
358 with gzip.GzipFile(fileobj=f) as g:
366 with gzip.GzipFile(fileobj=io.BytesIO(gzdata)) as f:
[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/libaom/libaom/tools/
Dwrap-commit-msg.py44 def main(fileobj): argument
48 line = fileobj.readline()
61 if fileobj == sys.stdin:
62 fileobj = sys.stdout
64 fileobj.seek(0)
65 fileobj.truncate(0)
66 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/dateutil/dateutil/tz/
Dtz.py396 def __init__(self, fileobj, filename=None): argument
400 if isinstance(fileobj, string_types):
401 self._filename = fileobj
402 fileobj = open(fileobj, 'rb')
406 elif hasattr(fileobj, "name"):
407 self._filename = fileobj.name
409 self._filename = repr(fileobj)
411 if fileobj is not None:
413 fileobj = _ContextWrapper(fileobj)
415 with fileobj as file_stream:
[all …]
/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.c522 PyObject *fileobj; in PyModule_GetFilenameObject() local
529 (fileobj = _PyDict_GetItemId(d, &PyId___file__)) == NULL || in PyModule_GetFilenameObject()
530 !PyUnicode_Check(fileobj)) in PyModule_GetFilenameObject()
535 Py_INCREF(fileobj); in PyModule_GetFilenameObject()
536 return fileobj; in PyModule_GetFilenameObject()
542 PyObject *fileobj; in PyModule_GetFilename() local
544 fileobj = PyModule_GetFilenameObject(m); in PyModule_GetFilename()
545 if (fileobj == NULL) in PyModule_GetFilename()
547 utf8 = PyUnicode_AsUTF8(fileobj); in PyModule_GetFilename()
548 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/libkmsxx/py/tests/
Ddb.py76 def readdrm(fileobj, mask): argument
83 def readkey(fileobj, mask): argument
96 callback(key.fileobj, mask)
/external/python/apitools/
Dsetup.py58 with open('README.rst') as fileobj:
59 README = fileobj.read()
/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/fonttools/Lib/fontTools/feaLib/
Dlexer.py244 fileobj, closing = file_or_path, False
247 fileobj = open(filename, "r", encoding="utf-8")
248 data = fileobj.read()
249 filename = getattr(fileobj, "name", None)
251 fileobj.close()

1234