latest version
This commit is contained in:
Regular → Executable
Regular → Executable
Regular → Executable
+1
-1
@@ -689,7 +689,7 @@ class date(object):
|
||||
|
||||
@classmethod
|
||||
def fromordinal(cls, n):
|
||||
"""Contruct a date from a proleptic Gregorian ordinal.
|
||||
"""Construct a date from a proleptic Gregorian ordinal.
|
||||
|
||||
January 1 of year 1 is day 1. Only the year, month and day are
|
||||
non-zero in the result.
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
+1
-1
@@ -2867,7 +2867,7 @@ def parse_content_type_header(value):
|
||||
_find_mime_parameters(ctype, value)
|
||||
return ctype
|
||||
ctype.append(token)
|
||||
# XXX: If we really want to follow the formal grammer we should make
|
||||
# XXX: If we really want to follow the formal grammar we should make
|
||||
# mantype and subtype specialized TokenLists here. Probably not worth it.
|
||||
if not value or value[0] != '/':
|
||||
ctype.defects.append(errors.InvalidHeaderDefect(
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
+2
-2
@@ -26,7 +26,7 @@ class Parser(object):
|
||||
textual representation of the message.
|
||||
|
||||
The string must be formatted as a block of RFC 2822 headers and header
|
||||
continuation lines, optionally preceeded by a `Unix-from' header. The
|
||||
continuation lines, optionally preceded by a `Unix-from' header. The
|
||||
header block is terminated either by the end of the string or by a
|
||||
blank line.
|
||||
|
||||
@@ -92,7 +92,7 @@ class BytesParser(object):
|
||||
textual representation of the message.
|
||||
|
||||
The input must be formatted as a block of RFC 2822 headers and header
|
||||
continuation lines, optionally preceeded by a `Unix-from' header. The
|
||||
continuation lines, optionally preceded by a `Unix-from' header. The
|
||||
header block is terminated either by the end of the input or by a
|
||||
blank line.
|
||||
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
+13
-7
@@ -225,10 +225,14 @@ LOOSE_HTTP_DATE_RE = re.compile(
|
||||
(?::(\d\d))? # optional seconds
|
||||
)? # optional clock
|
||||
\s*
|
||||
([-+]?\d{2,4}|(?![APap][Mm]\b)[A-Za-z]+)? # timezone
|
||||
(?:
|
||||
([-+]?\d{2,4}|(?![APap][Mm]\b)[A-Za-z]+) # timezone
|
||||
\s*
|
||||
(?:\(\w+\))? # ASCII representation of timezone in parens.
|
||||
\s*$""", re.X | re.ASCII)
|
||||
)?
|
||||
(?:
|
||||
\(\w+\) # ASCII representation of timezone in parens.
|
||||
\s*
|
||||
)?$""", re.X | re.ASCII)
|
||||
def http2time(text):
|
||||
"""Returns time in seconds since epoch of time represented by a string.
|
||||
|
||||
@@ -298,9 +302,11 @@ ISO_DATE_RE = re.compile(
|
||||
(?::?(\d\d(?:\.\d*)?))? # optional seconds (and fractional)
|
||||
)? # optional clock
|
||||
\s*
|
||||
([-+]?\d\d?:?(:?\d\d)?
|
||||
|Z|z)? # timezone (Z is "zero meridian", i.e. GMT)
|
||||
\s*$""", re.X | re. ASCII)
|
||||
(?:
|
||||
([-+]?\d\d?:?(:?\d\d)?
|
||||
|Z|z) # timezone (Z is "zero meridian", i.e. GMT)
|
||||
\s*
|
||||
)?$""", re.X | re. ASCII)
|
||||
def iso2time(text):
|
||||
"""
|
||||
As for http2time, but parses the ISO 8601 formats:
|
||||
@@ -1845,7 +1851,7 @@ def lwp_cookie_str(cookie):
|
||||
class LWPCookieJar(FileCookieJar):
|
||||
"""
|
||||
The LWPCookieJar saves a sequence of "Set-Cookie3" lines.
|
||||
"Set-Cookie3" is the format used by the libwww-perl libary, not known
|
||||
"Set-Cookie3" is the format used by the libwww-perl library, not known
|
||||
to be compatible with any browser, but which is easy to read and
|
||||
doesn't lose information about RFC 2965 cookies.
|
||||
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
+14
@@ -46,6 +46,16 @@ def ceil(x):
|
||||
|
||||
from itertools import islice
|
||||
|
||||
if PY26:
|
||||
# itertools.count in Py 2.6 doesn't accept a step parameter
|
||||
def count(start=0, step=1):
|
||||
while True:
|
||||
yield start
|
||||
start += step
|
||||
else:
|
||||
from itertools import count
|
||||
|
||||
|
||||
if PY3:
|
||||
try:
|
||||
from _thread import get_ident
|
||||
@@ -85,6 +95,10 @@ def recursive_repr(fillvalue='...'):
|
||||
return decorating_function
|
||||
|
||||
|
||||
# OrderedDict Shim from Raymond Hettinger, python core dev
|
||||
# http://code.activestate.com/recipes/576693-ordered-dictionary-for-py24/
|
||||
# here to support version 2.6.
|
||||
|
||||
################################################################################
|
||||
### OrderedDict
|
||||
################################################################################
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
-32
@@ -28,7 +28,6 @@ import importlib
|
||||
# import collections.abc # not present on Py2.7
|
||||
import re
|
||||
import subprocess
|
||||
import imp
|
||||
import time
|
||||
try:
|
||||
import sysconfig
|
||||
@@ -341,37 +340,6 @@ def rmtree(path):
|
||||
if error.errno != errno.ENOENT:
|
||||
raise
|
||||
|
||||
def make_legacy_pyc(source):
|
||||
"""Move a PEP 3147 pyc/pyo file to its legacy pyc/pyo location.
|
||||
|
||||
The choice of .pyc or .pyo extension is done based on the __debug__ flag
|
||||
value.
|
||||
|
||||
:param source: The file system path to the source file. The source file
|
||||
does not need to exist, however the PEP 3147 pyc file must exist.
|
||||
:return: The file system path to the legacy pyc file.
|
||||
"""
|
||||
pyc_file = imp.cache_from_source(source)
|
||||
up_one = os.path.dirname(os.path.abspath(source))
|
||||
legacy_pyc = os.path.join(up_one, source + ('c' if __debug__ else 'o'))
|
||||
os.rename(pyc_file, legacy_pyc)
|
||||
return legacy_pyc
|
||||
|
||||
def forget(modname):
|
||||
"""'Forget' a module was ever imported.
|
||||
|
||||
This removes the module from sys.modules and deletes any PEP 3147 or
|
||||
legacy .pyc and .pyo files.
|
||||
"""
|
||||
unload(modname)
|
||||
for dirname in sys.path:
|
||||
source = os.path.join(dirname, modname + '.py')
|
||||
# It doesn't matter if they exist or not, unlink all possible
|
||||
# combinations of PEP 3147 and legacy pyc and pyo files.
|
||||
unlink(source + 'c')
|
||||
unlink(source + 'o')
|
||||
unlink(imp.cache_from_source(source, debug_override=True))
|
||||
unlink(imp.cache_from_source(source, debug_override=False))
|
||||
|
||||
# On some platforms, should not run gui test even if it is allowed
|
||||
# in `use_resources'.
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
+1
-11
@@ -2498,17 +2498,7 @@ def _proxy_bypass_macosx_sysconf(host, proxy_settings):
|
||||
|
||||
|
||||
if sys.platform == 'darwin':
|
||||
try:
|
||||
from _scproxy import _get_proxy_settings, _get_proxies
|
||||
except Exception as e:
|
||||
from platformcode import logger
|
||||
logger.error(str(e))
|
||||
|
||||
def _get_proxy_settings():
|
||||
return {}
|
||||
|
||||
def _get_proxies():
|
||||
return {}
|
||||
from _scproxy import _get_proxy_settings, _get_proxies
|
||||
|
||||
def proxy_bypass_macosx_sysconf(host):
|
||||
proxy_settings = _get_proxy_settings()
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
+5
-4
@@ -134,10 +134,11 @@ from __future__ import (absolute_import, division, print_function,
|
||||
from future.builtins import bytes, dict, int, range, str
|
||||
|
||||
import base64
|
||||
# Py2.7 compatibility hack
|
||||
base64.encodebytes = base64.encodestring
|
||||
base64.decodebytes = base64.decodestring
|
||||
import sys
|
||||
if sys.version_info < (3, 9):
|
||||
# Py2.7 compatibility hack
|
||||
base64.encodebytes = base64.encodestring
|
||||
base64.decodebytes = base64.decodestring
|
||||
import time
|
||||
from datetime import datetime
|
||||
from future.backports.http import client as http_client
|
||||
@@ -1251,7 +1252,7 @@ class Transport(object):
|
||||
# Send HTTP request.
|
||||
#
|
||||
# @param host Host descriptor (URL or (URL, x509 info) tuple).
|
||||
# @param handler Targer RPC handler (a path relative to host)
|
||||
# @param handler Target RPC handler (a path relative to host)
|
||||
# @param request_body The XML-RPC request body
|
||||
# @param debug Enable debugging if debug is true.
|
||||
# @return An HTTPConnection.
|
||||
|
||||
Regular → Executable
Reference in New Issue
Block a user