summaryrefslogtreecommitdiffstats
path: root/Python/Dependencies/future-0.18.2/src/future/backports/urllib/response.py
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2023-01-01 21:05:27 -0800
committeryum <yum.food.vr@gmail.com>2023-01-01 21:44:45 -0800
commite25bdba3a3a53b09be5269d8b065c13b73ab55c3 (patch)
tree1d1dc1d94cde92c2f4f8ce86017395054787515d /Python/Dependencies/future-0.18.2/src/future/backports/urllib/response.py
parent0d408cc812a094a708edbe4baf536e928731cfc3 (diff)
Embed git in package
package.ps1 fetches PortableGit and embeds it in the package. This eliminates all but one runtime dependency (MSVC++ Redistributable). * Move Python into a new FOSS folder.
Diffstat (limited to 'Python/Dependencies/future-0.18.2/src/future/backports/urllib/response.py')
-rw-r--r--Python/Dependencies/future-0.18.2/src/future/backports/urllib/response.py103
1 files changed, 0 insertions, 103 deletions
diff --git a/Python/Dependencies/future-0.18.2/src/future/backports/urllib/response.py b/Python/Dependencies/future-0.18.2/src/future/backports/urllib/response.py
deleted file mode 100644
index adbf6e5..0000000
--- a/Python/Dependencies/future-0.18.2/src/future/backports/urllib/response.py
+++ /dev/null
@@ -1,103 +0,0 @@
-"""Response classes used by urllib.
-
-The base class, addbase, defines a minimal file-like interface,
-including read() and readline(). The typical response object is an
-addinfourl instance, which defines an info() method that returns
-headers and a geturl() method that returns the url.
-"""
-from __future__ import absolute_import, division, unicode_literals
-from future.builtins import object
-
-class addbase(object):
- """Base class for addinfo and addclosehook."""
-
- # XXX Add a method to expose the timeout on the underlying socket?
-
- def __init__(self, fp):
- # TODO(jhylton): Is there a better way to delegate using io?
- self.fp = fp
- self.read = self.fp.read
- self.readline = self.fp.readline
- # TODO(jhylton): Make sure an object with readlines() is also iterable
- if hasattr(self.fp, "readlines"):
- self.readlines = self.fp.readlines
- if hasattr(self.fp, "fileno"):
- self.fileno = self.fp.fileno
- else:
- self.fileno = lambda: None
-
- def __iter__(self):
- # Assigning `__iter__` to the instance doesn't work as intended
- # because the iter builtin does something like `cls.__iter__(obj)`
- # and thus fails to find the _bound_ method `obj.__iter__`.
- # Returning just `self.fp` works for built-in file objects but
- # might not work for general file-like objects.
- return iter(self.fp)
-
- def __repr__(self):
- return '<%s at %r whose fp = %r>' % (self.__class__.__name__,
- id(self), self.fp)
-
- def close(self):
- if self.fp:
- self.fp.close()
- self.fp = None
- self.read = None
- self.readline = None
- self.readlines = None
- self.fileno = None
- self.__iter__ = None
- self.__next__ = None
-
- def __enter__(self):
- if self.fp is None:
- raise ValueError("I/O operation on closed file")
- return self
-
- def __exit__(self, type, value, traceback):
- self.close()
-
-class addclosehook(addbase):
- """Class to add a close hook to an open file."""
-
- def __init__(self, fp, closehook, *hookargs):
- addbase.__init__(self, fp)
- self.closehook = closehook
- self.hookargs = hookargs
-
- def close(self):
- if self.closehook:
- self.closehook(*self.hookargs)
- self.closehook = None
- self.hookargs = None
- addbase.close(self)
-
-class addinfo(addbase):
- """class to add an info() method to an open file."""
-
- def __init__(self, fp, headers):
- addbase.__init__(self, fp)
- self.headers = headers
-
- def info(self):
- return self.headers
-
-class addinfourl(addbase):
- """class to add info() and geturl() methods to an open file."""
-
- def __init__(self, fp, headers, url, code=None):
- addbase.__init__(self, fp)
- self.headers = headers
- self.url = url
- self.code = code
-
- def info(self):
- return self.headers
-
- def getcode(self):
- return self.code
-
- def geturl(self):
- return self.url
-
-del absolute_import, division, unicode_literals, object