mirror of
https://github.com/python/cpython.git
synced 2025-11-17 09:30:10 +00:00
Cleanup: the in operator already returns a bool, no need to bool() it again
Cleanup: use condition to be consistent with code above CookieJar is in cookielib
This commit is contained in:
parent
492faa5505
commit
1cdd3632a0
1 changed files with 4 additions and 4 deletions
|
|
@ -263,8 +263,8 @@ class Request:
|
||||||
self.unredirected_hdrs[key.capitalize()] = val
|
self.unredirected_hdrs[key.capitalize()] = val
|
||||||
|
|
||||||
def has_header(self, header_name):
|
def has_header(self, header_name):
|
||||||
return bool(header_name in self.headers or
|
return (header_name in self.headers or
|
||||||
header_name in self.unredirected_hdrs)
|
header_name in self.unredirected_hdrs)
|
||||||
|
|
||||||
def get_header(self, header_name, default=None):
|
def get_header(self, header_name, default=None):
|
||||||
return self.headers.get(
|
return self.headers.get(
|
||||||
|
|
@ -295,7 +295,7 @@ class OpenerDirector:
|
||||||
condition = meth[i+1:]
|
condition = meth[i+1:]
|
||||||
|
|
||||||
if condition.startswith("error"):
|
if condition.startswith("error"):
|
||||||
j = meth[i+1:].find("_") + i + 1
|
j = condition.find("_") + i + 1
|
||||||
kind = meth[j+1:]
|
kind = meth[j+1:]
|
||||||
try:
|
try:
|
||||||
kind = int(kind)
|
kind = int(kind)
|
||||||
|
|
@ -1026,7 +1026,7 @@ if hasattr(httplib, 'HTTPS'):
|
||||||
class HTTPCookieProcessor(BaseHandler):
|
class HTTPCookieProcessor(BaseHandler):
|
||||||
def __init__(self, cookiejar=None):
|
def __init__(self, cookiejar=None):
|
||||||
if cookiejar is None:
|
if cookiejar is None:
|
||||||
cookiejar = CookieJar()
|
cookiejar = cookielib.CookieJar()
|
||||||
self.cookiejar = cookiejar
|
self.cookiejar = cookiejar
|
||||||
|
|
||||||
def http_request(self, request):
|
def http_request(self, request):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue