From 68d394952a8d37fae23abcadc54ca76dffacb376 Mon Sep 17 00:00:00 2001 From: Ian Cordasco Date: Mon, 17 Dec 2012 20:19:11 -0500 Subject: [PATCH] A bit of linting. Mostly removed a whole bunch of unused imports. --- requests/adapters.py | 4 ---- requests/auth.py | 2 +- requests/models.py | 22 +++++++++------------- requests/utils.py | 3 +-- 4 files changed, 11 insertions(+), 20 deletions(-) diff --git a/requests/adapters.py b/requests/adapters.py index dc18dee..f06dd47 100644 --- a/requests/adapters.py +++ b/requests/adapters.py @@ -8,11 +8,9 @@ This module contains the transport adapters that Requests uses to define and maintain connections. """ -import os import socket from .models import Response -from .auth import HTTPProxyAuth from .packages.urllib3.poolmanager import PoolManager, proxy_from_url from .hooks import dispatch_hook from .compat import urlparse @@ -83,7 +81,6 @@ class HTTPAdapter(BaseAdapter): else: conn.cert_file = cert - def build_response(self, req, resp): response = Response() @@ -125,7 +122,6 @@ class HTTPAdapter(BaseAdapter): return conn - def close(self): """Dispose of any internal state. diff --git a/requests/auth.py b/requests/auth.py index 9d33e5f..277e601 100644 --- a/requests/auth.py +++ b/requests/auth.py @@ -165,4 +165,4 @@ class HTTPDigestAuth(AuthBase): if self.last_nonce: r.headers['Authorization'] = self.build_digest_header(r.method, r.url) r.register_hook('response', self.handle_401) - return r \ No newline at end of file + return r diff --git a/requests/models.py b/requests/models.py index 372d7ce..a85ed25 100644 --- a/requests/models.py +++ b/requests/models.py @@ -11,24 +11,21 @@ import collections import logging from io import BytesIO -from .hooks import dispatch_hook, default_hooks +from .hooks import default_hooks from .structures import CaseInsensitiveDict from .status_codes import codes -from .auth import HTTPBasicAuth, HTTPProxyAuth -from .cookies import cookiejar_from_dict, extract_cookies_to_jar, get_cookie_header +from .auth import HTTPBasicAuth +from .cookies import cookiejar_from_dict, get_cookie_header from .packages.urllib3.filepost import encode_multipart_formdata -from .exceptions import ( - ConnectionError, HTTPError, RequestException, Timeout, TooManyRedirects, - URLRequired, SSLError, MissingSchema, InvalidSchema, InvalidURL) +from .exceptions import HTTPError, RequestException, MissingSchema, InvalidURL from .utils import ( - get_encoding_from_headers, stream_untransfer, guess_filename, requote_uri, - stream_decode_response_unicode, get_netrc_auth, get_environ_proxies, - to_key_val_list, DEFAULT_CA_BUNDLE_PATH, parse_header_links, iter_slices, - guess_json_utf) + stream_untransfer, guess_filename, requote_uri, + stream_decode_response_unicode, to_key_val_list, parse_header_links, + iter_slices, guess_json_utf) from .compat import ( - cookielib, urlparse, urlunparse, urljoin, urlsplit, urlencode, str, bytes, - StringIO, is_py2, is_py3, chardet, json, builtin_str, urldefrag, basestring) + cookielib, urlparse, urlunparse, urlsplit, urlencode, str, bytes, StringIO, + is_py2, chardet, json, builtin_str, basestring) REDIRECT_STATI = (codes.moved, codes.found, codes.other, codes.temporary_moved) CONTENT_CHUNK_SIZE = 10 * 1024 @@ -385,7 +382,6 @@ class Response(object): #: up here. The list is sorted from the oldest to the most recent request. self.history = [] - self.reason = None #: A CookieJar of Cookies the server sent back. diff --git a/requests/utils.py b/requests/utils.py index fb098aa..c94bd6c 100644 --- a/requests/utils.py +++ b/requests/utils.py @@ -20,7 +20,7 @@ from netrc import netrc, NetrcParseError from . import __version__ from .compat import parse_http_list as _parse_list_header -from .compat import quote, quote_plus, urlparse, basestring, bytes, str, OrderedDict +from .compat import quote, urlparse, bytes, str, OrderedDict from .cookies import RequestsCookieJar, cookiejar_from_dict _hush_pyflakes = (RequestsCookieJar,) @@ -254,7 +254,6 @@ def unquote_header_value(value, is_filename=False): return value - def dict_from_cookiejar(cj): """Returns a key/value dictionary from a CookieJar. -- 2.7.4