Home
last modified time | relevance | path

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

12

/third_party/python/Lib/test/
Dtest_csv.py136 with TemporaryFile("w+", encoding="utf-8", newline='') as fileobj:
137 writer = csv.writer(fileobj, **kwargs)
139 fileobj.seek(0)
140 self.assertEqual(fileobj.read(),
144 with TemporaryFile("w+", encoding="utf-8", newline='') as fileobj:
145 writer = csv.writer(fileobj, **kwargs)
148 fileobj.seek(0)
149 self.assertEqual(fileobj.read(), '')
235 with TemporaryFile("w+", encoding="utf-8", newline='') as fileobj:
236 writer = csv.writer(fileobj)
[all …]
Dtest_gzip.py147 f = gzip.GzipFile(fileobj=io.BytesIO(compressed), mode='rb')
157 fileobj = f.fileobj
158 self.assertFalse(fileobj.closed)
160 self.assertTrue(fileobj.closed)
169 fileobj = f.fileobj
170 self.assertFalse(fileobj.closed)
172 self.assertTrue(fileobj.closed)
303 self.assertTrue(hasattr(f.fileobj, "name"))
304 self.assertEqual(f.fileobj.name, self.filename)
437 with gzip.GzipFile(fileobj=buf, mode="wb") as f:
[all …]
Dtest_telnetlib.py128 def register(self, fileobj, events, data=None): argument
129 key = selectors.SelectorKey(fileobj, 0, events, data)
130 self.keys[fileobj] = key
133 def unregister(self, fileobj): argument
134 return self.keys.pop(fileobj)
138 for fileobj in self.keys:
139 if isinstance(fileobj, TelnetAlike):
140 block = fileobj.sock.block
Dtest_tarfile.py452 with tarfile.open(fileobj=fobj, mode=self.mode) as tar:
461 tar = tarfile.open(fileobj=fobj, mode=self.mode)
469 with tarfile.open(fileobj=fobj, mode=self.mode) as tar:
478 with tarfile.open(fileobj=fobj, mode=self.mode) as tar:
486 with tarfile.open(fileobj=fobj, mode=self.mode) as tar:
535 with tar.open(self.tarname, mode="r:", fileobj=fobj) as tar:
549 fileobj=fobj, mode=self.mode)
680 self.assertTrue(tar.fileobj.closed)
802 tar = tarfile.open(name, mode, fileobj=f)
974 self.tar.fileobj.seek(offset)
[all …]
Dtest_imp.py242 fileobj, pathname, description = imp.find_module(m)
243 fileobj.close()
Dtest_sax.py205 fileobj = None
208 nonlocal fileobj
209 fileobj = builtin_open(*args)
210 return fileobj
216 self.assertTrue(fileobj.closed)
Dtest_selectors.py48 match.append(key.fileobj)
68 self.assertEqual(key.fileobj, rd)
/third_party/python/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.'
70 def __getitem__(self, fileobj): argument
72 fd = self._selector._fileobj_lookup(fileobj)
75 raise KeyError("{!r} is not registered".format(fileobj)) from None
97 def register(self, fileobj, events, data=None): argument
[all …]
Dtarfile.py339 def __init__(self, name, mode, comptype, fileobj, bufsize): argument
343 if fileobj is None:
344 fileobj = _LowLevelFile(name, mode)
350 fileobj = _StreamProxy(fileobj)
351 comptype = fileobj.getcomptype()
356 self.fileobj = fileobj
405 self.fileobj.close()
445 self.fileobj.write(self.buf[:self.bufsize])
461 self.fileobj.write(self.buf)
464 self.fileobj.write(struct.pack("<L", self.crc))
[all …]
Dgzip.py135 compresslevel=_COMPRESS_LEVEL_BEST, fileobj=None, mtime=None): argument
173 if fileobj is None:
174 fileobj = self.myfileobj = builtins.open(filename, mode or 'rb')
176 filename = getattr(fileobj, 'name', '')
183 mode = getattr(fileobj, 'mode', 'rb')
187 raw = _GzipReader(fileobj)
210 self.fileobj = fileobj
229 s = repr(self.fileobj)
241 self.fileobj.write(b'\037\213') # magic header
242 self.fileobj.write(b'\010') # compression method
[all …]
Dsubprocess.py2007 if key.fileobj is self.stdin:
2013 selector.unregister(key.fileobj)
2014 key.fileobj.close()
2017 selector.unregister(key.fileobj)
2018 key.fileobj.close()
2019 elif key.fileobj in (self.stdout, self.stderr):
2022 selector.unregister(key.fileobj)
2023 key.fileobj.close()
2024 self._fileobj2output[key.fileobj].append(data)
Dtelnetlib.py548 if key.fileobj is self:
557 elif key.fileobj is sys.stdin:
Dzipfile.py751 fileobj = self._file
753 self._close(fileobj)
790 def __init__(self, fileobj, mode, zipinfo, pwd=None, argument
792 self._fileobj = fileobj
819 if fileobj.seekable():
820 self._orig_compress_start = fileobj.tell()
/third_party/python/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)
/third_party/python/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.rst70 .. class:: GzipFile(filename=None, mode=None, compresslevel=9, fileobj=None, mtime=None)
74 method. At least one of *fileobj* and *filename* must be given a non-trivial
77 The new class instance is based on *fileobj*, which can be a regular file, an
82 When *fileobj* is not ``None``, the *filename* argument is only used to be
84 filename of the uncompressed file. It defaults to the filename of *fileobj*, if
90 written. The default is the mode of *fileobj* if discernible; otherwise, the
91 default is ``'rb'``. In future Python releases the mode of *fileobj* will
109 *fileobj*, since you might wish to append more material after the compressed
111 writing as *fileobj*, and retrieve the resulting memory buffer using the
130 *fileobj* parameter).
Dtarfile.rst40 .. function:: open(name=None, mode='r', fileobj=None, bufsize=10240, **kwargs)
98 If *fileobj* is specified, it is used as an alternative to a :term:`file object`
111 be done on the file. If given, *fileobj* may be any object that has a
279 .. class:: TarFile(name=None, mode='r', fileobj=None, format=DEFAULT_FORMAT, tarinfo=TarInfo, deref…
285 It can be omitted if *fileobj* is given.
292 If *fileobj* is given, it is used for reading or writing data. If it can be
293 determined, *mode* is overridden by *fileobj*'s mode. *fileobj* will be used
298 *fileobj* is not closed, when :class:`TarFile` is closed.
481 .. method:: TarFile.addfile(tarinfo, fileobj=None)
483 Add the :class:`TarInfo` object *tarinfo* to the archive. If *fileobj* is given,
[all …]
/third_party/python/Objects/
Dmoduleobject.c512 PyObject *fileobj; in PyModule_GetFilenameObject() local
519 (fileobj = _PyDict_GetItemIdWithError(d, &PyId___file__)) == NULL || in PyModule_GetFilenameObject()
520 !PyUnicode_Check(fileobj)) in PyModule_GetFilenameObject()
527 Py_INCREF(fileobj); in PyModule_GetFilenameObject()
528 return fileobj; in PyModule_GetFilenameObject()
534 PyObject *fileobj; in PyModule_GetFilename() local
536 fileobj = PyModule_GetFilenameObject(m); in PyModule_GetFilename()
537 if (fileobj == NULL) in PyModule_GetFilename()
539 utf8 = PyUnicode_AsUTF8(fileobj); in PyModule_GetFilename()
540 Py_DECREF(fileobj); /* module dict has still a reference */ in PyModule_GetFilename()
/third_party/skia/third_party/externals/dawn/scripts/
Dextract.py39 def __init__(self, path, mode, fileobj): argument
42 self.fileobj = fileobj
155 shutil.copyfileobj(entry.fileobj, out)
/third_party/python/Lib/test/test_asyncio/
Dutils.py299 def register(self, fileobj, events, data=None): argument
300 key = selectors.SelectorKey(fileobj, 0, events, data)
301 self.keys[fileobj] = key
304 def unregister(self, fileobj): argument
305 return self.keys.pop(fileobj)
/third_party/python/Python/
Derrors.c1706 PyObject *fileobj; in PyErr_SyntaxLocationEx() local
1708 fileobj = PyUnicode_DecodeFSDefault(filename); in PyErr_SyntaxLocationEx()
1709 if (fileobj == NULL) { in PyErr_SyntaxLocationEx()
1714 fileobj = NULL; in PyErr_SyntaxLocationEx()
1716 PyErr_SyntaxLocationObject(fileobj, lineno, col_offset); in PyErr_SyntaxLocationEx()
1717 Py_XDECREF(fileobj); in PyErr_SyntaxLocationEx()
/third_party/python/Lib/asyncio/
Dselector_events.py596 fileobj, (reader, writer) = key.fileobj, key.data
599 self._remove_reader(fileobj)
604 self._remove_writer(fileobj)
/third_party/node/tools/inspector_protocol/jinja2/
Dext.py542 def babel_extract(fileobj, keywords, comment_tags, options): argument
607 source = fileobj.read().decode(options.get('encoding', 'utf-8'))
/third_party/skia/third_party/externals/jinja2/
Dext.py619 def babel_extract(fileobj, keywords, comment_tags, options): argument
683 source = fileobj.read().decode(options.get("encoding", "utf-8"))
/third_party/python/Lib/xmlrpc/
Dclient.py1049 with gzip.GzipFile(mode="wb", fileobj=f, compresslevel=1) as gzf:
1072 with gzip.GzipFile(mode="rb", fileobj=BytesIO(data)) as gzf:
1101 gzip.GzipFile.__init__(self, mode="rb", fileobj=self.io)

12