Skip to content

Commit

Permalink
[script.module.future] 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
L2501 committed Apr 29, 2024
1 parent d222179 commit 9011fb4
Show file tree
Hide file tree
Showing 22 changed files with 195 additions and 226 deletions.
2 changes: 1 addition & 1 deletion script.module.future/addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.module.future" name="future" version="0.18.3+matrix.1" provider-name="Ed Schofield">
<addon id="script.module.future" name="future" version="1.0.0+matrix.1" provider-name="Ed Schofield">
<requires>
<import addon="xbmc.python" version="3.0.0" />
</requires>
Expand Down
19 changes: 9 additions & 10 deletions script.module.future/lib/future/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
--------------------
An included script called `futurize
<http://python-future.org/automatic_conversion.html>`_ aids in converting
<https://python-future.org/automatic_conversion.html>`_ aids in converting
code (from either Python 2 or Python 3) to code compatible with both
platforms. It is similar to ``python-modernize`` but goes further in
providing Python 3 compatibility through the use of the backported types
Expand All @@ -62,32 +62,31 @@
Documentation
-------------
See: http://python-future.org
See: https://python-future.org
Credits
-------
:Author: Ed Schofield, Jordan M. Adler, et al
:Sponsor: Python Charmers Pty Ltd, Australia, and Python Charmers Pte
Ltd, Singapore. http://pythoncharmers.com
:Others: See docs/credits.rst or http://python-future.org/credits.html
:Sponsor: Python Charmers: https://pythoncharmers.com
:Others: See docs/credits.rst or https://python-future.org/credits.html
Licensing
---------
Copyright 2013-2019 Python Charmers Pty Ltd, Australia.
Copyright 2013-2024 Python Charmers, Australia.
The software is distributed under an MIT licence. See LICENSE.txt.
"""

__title__ = 'future'
__author__ = 'Ed Schofield'
__license__ = 'MIT'
__copyright__ = 'Copyright 2013-2019 Python Charmers Pty Ltd'
__ver_major__ = 0
__ver_minor__ = 18
__ver_patch__ = 3
__copyright__ = 'Copyright 2013-2024 Python Charmers (https://pythoncharmers.com)'
__ver_major__ = 1
__ver_minor__ = 0
__ver_patch__ = 0
__ver_sub__ = ''
__version__ = "%d.%d.%d%s" % (__ver_major__, __ver_minor__,
__ver_patch__, __ver_sub__)
2 changes: 1 addition & 1 deletion script.module.future/lib/future/backports/datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ def today(cls):

@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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions script.module.future/lib/future/backports/email/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __init__(self, _class=Message, **_3to2kwargs):
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.
Expand Down Expand Up @@ -92,7 +92,7 @@ def __init__(self, *args, **kw):
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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1851,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.
Expand Down
32 changes: 0 additions & 32 deletions script.module.future/lib/future/backports/test/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
# import collections.abc # not present on Py2.7
import re
import subprocess
import imp
import time
try:
import sysconfig
Expand Down Expand Up @@ -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'.
Expand Down
9 changes: 5 additions & 4 deletions script.module.future/lib/future/backports/xmlrpc/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,11 @@
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
Expand Down Expand Up @@ -1251,7 +1252,7 @@ def close(self):
# 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.
Expand Down
2 changes: 1 addition & 1 deletion script.module.future/lib/future/builtins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
A module that brings in equivalents of the new and modified Python 3
builtins into Py2. Has no effect on Py3.
See the docs `here <http://python-future.org/what-else.html>`_
See the docs `here <https://python-future.org/what-else.html>`_
(``docs/what-else.rst``) for more information.
"""
Expand Down
11 changes: 8 additions & 3 deletions script.module.future/lib/future/moves/_dummy_thread.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
from __future__ import absolute_import
from future.utils import PY3
from future.utils import PY3, PY39_PLUS

if PY3:
from _dummy_thread import *

if PY39_PLUS:
# _dummy_thread and dummy_threading modules were both deprecated in
# Python 3.7 and removed in Python 3.9
from _thread import *
elif PY3:
from _dummy_thread import *
else:
__future_module__ = True
from dummy_thread import *
7 changes: 7 additions & 0 deletions script.module.future/lib/future/moves/multiprocessing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from __future__ import absolute_import
from future.utils import PY3

from multiprocessing import *
if not PY3:
__future_module__ = True
from multiprocessing.queues import SimpleQueue
9 changes: 9 additions & 0 deletions script.module.future/lib/future/moves/test/support.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
from __future__ import absolute_import

import sys

from future.standard_library import suspend_hooks
from future.utils import PY3

if PY3:
from test.support import *
if sys.version_info[:2] >= (3, 10):
from test.support.os_helper import (
EnvironmentVarGuard,
TESTFN,
)
from test.support.warnings_helper import check_warnings
else:
__future_module__ = True
with suspend_hooks():
Expand Down
14 changes: 10 additions & 4 deletions script.module.future/lib/future/standard_library/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import socketserver
import winreg # on Windows only
import test.support
import html, html.parser, html.entites
import html, html.parser, html.entities
import http, http.client, http.server
import http.cookies, http.cookiejar
import urllib.parse, urllib.request, urllib.response, urllib.error, urllib.robotparser
Expand All @@ -33,6 +33,7 @@
from collections import OrderedDict, Counter, ChainMap # even on Py2.6
from subprocess import getoutput, getstatusoutput
from subprocess import check_output # even on Py2.6
from multiprocessing import SimpleQueue
(The renamed modules and functions are still available under their old
names on Python 2.)
Expand Down Expand Up @@ -62,9 +63,12 @@

import sys
import logging
import imp
# imp was deprecated in python 3.6
if sys.version_info >= (3, 6):
import importlib as imp
else:
import imp
import contextlib
import types
import copy
import os

Expand Down Expand Up @@ -108,6 +112,7 @@
'future.moves.socketserver': 'socketserver',
'ConfigParser': 'configparser',
'repr': 'reprlib',
'multiprocessing.queues': 'multiprocessing',
# 'FileDialog': 'tkinter.filedialog',
# 'tkFileDialog': 'tkinter.filedialog',
# 'SimpleDialog': 'tkinter.simpledialog',
Expand All @@ -125,7 +130,7 @@
# 'Tkinter': 'tkinter',
'_winreg': 'winreg',
'thread': '_thread',
'dummy_thread': '_dummy_thread',
'dummy_thread': '_dummy_thread' if sys.version_info < (3, 9) else '_thread',
# 'anydbm': 'dbm', # causes infinite import loop
# 'whichdb': 'dbm', # causes infinite import loop
# anydbm and whichdb are handled by fix_imports2
Expand Down Expand Up @@ -184,6 +189,7 @@
('itertools', 'filterfalse','itertools', 'ifilterfalse'),
('itertools', 'zip_longest','itertools', 'izip_longest'),
('sys', 'intern','__builtin__', 'intern'),
('multiprocessing', 'SimpleQueue', 'multiprocessing.queues', 'SimpleQueue'),
# The re module has no ASCII flag in Py2, but this is the default.
# Set re.ASCII to a zero constant. stat.ST_MODE just happens to be one
# (and it exists on Py2.6+).
Expand Down
8 changes: 5 additions & 3 deletions script.module.future/lib/future/types/newint.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,11 @@ def __pow__(self, other):

def __rpow__(self, other):
value = super(newint, self).__rpow__(other)
if value is NotImplemented:
if isint(value):
return newint(value)
elif value is NotImplemented:
return other ** long(self)
return newint(value)
return value

def __lshift__(self, other):
if not isint(other):
Expand Down Expand Up @@ -318,7 +320,7 @@ def to_bytes(self, length, byteorder='big', signed=False):
bits = length * 8
num = (2**bits) + self
if num <= 0:
raise OverflowError("int too smal to convert")
raise OverflowError("int too small to convert")
else:
if self < 0:
raise OverflowError("can't convert negative int to unsigned")
Expand Down
2 changes: 1 addition & 1 deletion script.module.future/lib/future/types/newrange.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def index(self, value):
raise ValueError('%r is not in range' % value)

def count(self, value):
"""Return the number of ocurrences of integer `value`
"""Return the number of occurrences of integer `value`
in the sequence this range represents."""
# a value can occur exactly zero or one times
return int(value in self)
Expand Down
12 changes: 5 additions & 7 deletions script.module.future/lib/libfuturize/fixer_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
"""

from lib2to3.fixer_util import (FromImport, Newline, is_import,
find_root, does_tree_import, Comma)
find_root, does_tree_import,
Call, Name, Comma)
from lib2to3.pytree import Leaf, Node
from lib2to3.pygram import python_symbols as syms, python_grammar
from lib2to3.pygram import python_symbols as syms
from lib2to3.pygram import token
from lib2to3.fixer_util import (Node, Call, Name, syms, Comma, Number)
import re


Expand Down Expand Up @@ -116,7 +116,7 @@ def suitify(parent):
"""
for node in parent.children:
if node.type == syms.suite:
# already in the prefered format, do nothing
# already in the preferred format, do nothing
return

# One-liners have no suite node, we have to fake one up
Expand Down Expand Up @@ -390,6 +390,7 @@ def touch_import_top(package, name_to_import, node):
break
insert_pos = idx

children_hooks = []
if package is None:
import_ = Node(syms.import_name, [
Leaf(token.NAME, u"import"),
Expand All @@ -413,8 +414,6 @@ def touch_import_top(package, name_to_import, node):
]
)
children_hooks = [install_hooks, Newline()]
else:
children_hooks = []

# FromImport(package, [Leaf(token.NAME, name_to_import, prefix=u" ")])

Expand Down Expand Up @@ -448,7 +447,6 @@ def check_future_import(node):
else:
node = node.children[3]
# now node is the import_as_name[s]
# print(python_grammar.number2symbol[node.type]) # breaks sometimes
if node.type == syms.import_as_names:
result = set()
for n in node.children:
Expand Down
4 changes: 2 additions & 2 deletions script.module.future/lib/libfuturize/fixes/fix_metaclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

def has_metaclass(parent):
""" we have to check the cls_node without changing it.
There are two possiblities:
There are two possibilities:
1) clsdef => suite => simple_stmt => expr_stmt => Leaf('__meta')
2) clsdef => simple_stmt => expr_stmt => Leaf('__meta')
"""
Expand All @@ -63,7 +63,7 @@ def fixup_parse_tree(cls_node):
# already in the preferred format, do nothing
return

# !%@#! oneliners have no suite node, we have to fake one up
# !%@#! one-liners have no suite node, we have to fake one up
for i, node in enumerate(cls_node.children):
if node.type == token.COLON:
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
u"winreg": u"_winreg",
u"configparser": u"ConfigParser",
u"copyreg": u"copy_reg",
u"multiprocessing.SimpleQueue": u"multiprocessing.queues.SimpleQueue",
u"queue": u"Queue",
u"socketserver": u"SocketServer",
u"_markupbase": u"markupbase",
Expand Down
Loading

0 comments on commit 9011fb4

Please sign in to comment.