mirror of
https://github.com/JimmXinu/FanFicFare.git
synced 2025-12-06 00:43:00 +01:00
Update six.py to 1.16 for Python 3.12 compatibility. #1006
This commit is contained in:
parent
016452ec89
commit
af163c27e0
1 changed files with 18 additions and 2 deletions
|
|
@ -29,7 +29,7 @@ import sys
|
|||
import types
|
||||
|
||||
__author__ = "Benjamin Peterson <benjamin@python.org>"
|
||||
__version__ = "1.15.0fff" # for version included in fanficfare
|
||||
__version__ = "1.16.0fff" # for version included in fanficfare
|
||||
|
||||
|
||||
# Useful for very coarse version differentiation.
|
||||
|
|
@ -71,6 +71,11 @@ else:
|
|||
MAXSIZE = int((1 << 63) - 1)
|
||||
del X
|
||||
|
||||
if PY34:
|
||||
from importlib.util import spec_from_loader
|
||||
else:
|
||||
spec_from_loader = None
|
||||
|
||||
|
||||
def _add_doc(func, doc):
|
||||
"""Add documentation to a function."""
|
||||
|
|
@ -186,6 +191,11 @@ class _SixMetaPathImporter(object):
|
|||
return self
|
||||
return None
|
||||
|
||||
def find_spec(self, fullname, path, target=None):
|
||||
if fullname in self.known_modules:
|
||||
return spec_from_loader(fullname, self)
|
||||
return None
|
||||
|
||||
def __get_module(self, fullname):
|
||||
try:
|
||||
return self.known_modules[fullname]
|
||||
|
|
@ -223,6 +233,12 @@ class _SixMetaPathImporter(object):
|
|||
return None
|
||||
get_source = get_code # same as get_code
|
||||
|
||||
def create_module(self, spec):
|
||||
return self.load_module(spec.name)
|
||||
|
||||
def exec_module(self, module):
|
||||
pass
|
||||
|
||||
_importer = _SixMetaPathImporter(__name__)
|
||||
|
||||
|
||||
|
|
@ -247,7 +263,7 @@ _moved_attributes = [
|
|||
MovedAttribute("reduce", "__builtin__", "functools"),
|
||||
MovedAttribute("shlex_quote", "pipes", "shlex", "quote"),
|
||||
MovedAttribute("StringIO", "StringIO", "io"),
|
||||
MovedAttribute("UserDict", "UserDict", "collections"),
|
||||
MovedAttribute("UserDict", "UserDict", "collections", "IterableUserDict", "UserDict"),
|
||||
MovedAttribute("UserList", "UserList", "collections"),
|
||||
MovedAttribute("UserString", "UserString", "collections"),
|
||||
MovedAttribute("xrange", "__builtin__", "builtins", "xrange", "range"),
|
||||
|
|
|
|||
Loading…
Reference in a new issue