Commit eab3579e authored by Arnaud Fontaine's avatar Arnaud Fontaine

merge patched-debian-experimental into debian-experimental

parents 78f7d39c da4b3278
Metadata-Version: 1.1 Metadata-Version: 1.1
Name: rope Name: rope
Version: 0.10.3 Version: 0.10.5
Summary: a python refactoring library... Summary: a python refactoring library...
Home-page: http://rope.sf.net/ Home-page: https://github.com/python-rope/rope
Author: Ali Gholami Rudi Author: Ali Gholami Rudi
Author-email: aligrudi@users.sourceforge.net Author-email: aligrudi@users.sourceforge.net
License: GNU GPL License: GNU GPL
...@@ -24,13 +24,12 @@ Description: ...@@ -24,13 +24,12 @@ Description:
.. _`rope`: https://github.com/python-rope/rope .. _`rope`: https://github.com/python-rope/rope
New Features Notes
============ ============
* Under new management! Matěj Cepl <mcepl@cepl.eu> takes it hesitantly * Nick Smith <nicks@fastmail.fm> takes over maintaining rope. Many thanks to
over Matěj Cepl for his work maintaining rope for the past few years!!
* Merged all availables pull requests and patches to the main codebase * Full python3 support is in progress... stay tuned
* Tests are green again
Platform: UNKNOWN Platform: UNKNOWN
...@@ -43,4 +42,11 @@ Classifier: Intended Audience :: Developers ...@@ -43,4 +42,11 @@ Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU General Public License (GPL) Classifier: License :: OSI Approved :: GNU General Public License (GPL)
Classifier: Natural Language :: English Classifier: Natural Language :: English
Classifier: Programming Language :: Python Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Topic :: Software Development Classifier: Topic :: Software Development
...@@ -15,13 +15,12 @@ Overview ...@@ -15,13 +15,12 @@ Overview
.. _`rope`: https://github.com/python-rope/rope .. _`rope`: https://github.com/python-rope/rope
New Features Notes
============ ============
* Under new management! Matěj Cepl <mcepl@cepl.eu> takes it hesitantly * Nick Smith <nicks@fastmail.fm> takes over maintaining rope. Many thanks to
over Matěj Cepl for his work maintaining rope for the past few years!!
* Merged all availables pull requests and patches to the main codebase * Full python3 support is in progress... stay tuned
* Tests are green again
Getting Started Getting Started
=============== ===============
...@@ -49,14 +48,15 @@ googlegroups.com`_. ...@@ -49,14 +48,15 @@ googlegroups.com`_.
License License
======= =======
This program is under the terms of GPL (GNU General Public License). This program is under the terms of GPL v2 (GNU General Public License).
Have a look at ``COPYING`` file for more information. Have a look at `COPYING`_ for more information.
.. _`docs/rope.rst`: docs/rope.html .. _`docs/rope.rst`: docs/rope.html
.. _`docs/overview.rst`: docs/overview.html .. _`docs/overview.rst`: docs/overview.html
.. _`docs/contributing.rst`: docs/contributing.html .. _`docs/contributing.rst`: docs/contributing.html
.. _`docs/library.rst`: docs/library.html .. _`docs/library.rst`: docs/library.html
.. _`COPYING`: COPYING
.. image:: https://secure.travis-ci.org/python-rope/rope.png .. image:: https://secure.travis-ci.org/python-rope/rope.png
:alt: Build Status :alt: Build Status
# see git-dpm(1) from git-dpm package # see git-dpm(1) from git-dpm package
7f19bb6d79d2426f4b29e531f12116398efce357 da4b3278b40a1cf16798771e5b67d918d8693393
7f19bb6d79d2426f4b29e531f12116398efce357 da4b3278b40a1cf16798771e5b67d918d8693393
835afd55ba93a1632462d454b5be0985b6ca9794 0d2c73dafa27bdee016a7008b8f15afec48ffe20
0d2c73dafa27bdee016a7008b8f15afec48ffe20 0d2c73dafa27bdee016a7008b8f15afec48ffe20
rope_0.10.5.orig.tar.gz rope_0.10.5.orig.tar.gz
9e4dd71acbdd45cbaf3d6493c2298d1e1d5f786c 9e4dd71acbdd45cbaf3d6493c2298d1e1d5f786c
......
From 7f19bb6d79d2426f4b29e531f12116398efce357 Mon Sep 17 00:00:00 2001 From da4b3278b40a1cf16798771e5b67d918d8693393 Mon Sep 17 00:00:00 2001
From: Arnaud Fontaine <arnau@debian.org> From: Arnaud Fontaine <arnau@debian.org>
Date: Thu, 26 Jan 2017 13:38:11 +0900 Date: Thu, 26 Jan 2017 13:38:11 +0900
Subject: =?UTF-8?q?Mitigations=20for=20CVE-2014-3539=20from=20the=20upstre?= Subject: =?UTF-8?q?Mitigations=20for=20CVE-2014-3539=20from=20the=20upstre?=
...@@ -41,7 +41,7 @@ Patch-Name: CVE-2014-3539.patch ...@@ -41,7 +41,7 @@ Patch-Name: CVE-2014-3539.patch
create mode 100644 ropetest/CVE20143539/run_reproducer.sh create mode 100644 ropetest/CVE20143539/run_reproducer.sh
diff --git a/rope/base/oi/doa.py b/rope/base/oi/doa.py diff --git a/rope/base/oi/doa.py b/rope/base/oi/doa.py
index de45902..ed44d25 100644 index 3f314c6..65e3e26 100644
--- a/rope/base/oi/doa.py --- a/rope/base/oi/doa.py
+++ b/rope/base/oi/doa.py +++ b/rope/base/oi/doa.py
@@ -116,7 +116,7 @@ class _SocketReceiver(_MessageReceiver): @@ -116,7 +116,7 @@ class _SocketReceiver(_MessageReceiver):
...@@ -193,10 +193,10 @@ index 0000000..b1f7fac ...@@ -193,10 +193,10 @@ index 0000000..b1f7fac
+python CVE-2014-3539.py 2>/dev/null +python CVE-2014-3539.py 2>/dev/null
+exit $? +exit $?
diff --git a/ropetest/__init__.py b/ropetest/__init__.py diff --git a/ropetest/__init__.py b/ropetest/__init__.py
index f1cb459..744beee 100644 index 699f8c6..d2e3aaf 100644
--- a/ropetest/__init__.py --- a/ropetest/__init__.py
+++ b/ropetest/__init__.py +++ b/ropetest/__init__.py
@@ -16,6 +16,8 @@ import ropetest.simplifytest @@ -20,6 +20,8 @@ import ropetest.simplifytest
import ropetest.contrib import ropetest.contrib
import ropetest.refactor import ropetest.refactor
...@@ -205,7 +205,7 @@ index f1cb459..744beee 100644 ...@@ -205,7 +205,7 @@ index f1cb459..744beee 100644
def suite(): def suite():
result = unittest.TestSuite() result = unittest.TestSuite()
@@ -33,6 +35,7 @@ def suite(): @@ -38,6 +40,7 @@ def suite():
result.addTests(ropetest.refactor.suite()) result.addTests(ropetest.refactor.suite())
result.addTests(ropetest.contrib.suite()) result.addTests(ropetest.contrib.suite())
......
...@@ -1209,6 +1209,129 @@ Rope uses this feature by default but you can disable it by editing ...@@ -1209,6 +1209,129 @@ Rope uses this feature by default but you can disable it by editing
``config.py``. ``config.py``.
Type Hinting
------------
Currently supported type hinting for:
- function parameter type, using function doctring (:type or @type)
- function return type, using function doctring (:rtype or @rtype)
- class attribute type, using class docstring (:type or @type). Attribute should by set to None or NotImplemented in class.
- any assignment, using type comments of PEP 0484 (in limited form).
If rope cannot detect the type of a function argument correctly (due to the
dynamic nature of Python), you can help it by hinting the type using
one of the following docstring syntax styles.
**Sphinx style**
http://sphinx-doc.org/domains.html#info-field-lists
::
def myfunction(node, foo):
"""Do something with a ``node``.
:type node: ProgramNode
:param str foo: foo parameter description
"""
node.| # complete here
**Epydoc**
http://epydoc.sourceforge.net/manual-fields.html
::
def myfunction(node):
"""Do something with a ``node``.
@type node: ProgramNode
"""
node.| # complete here
**Numpydoc**
https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt
In order to support the numpydoc format, you need to install the `numpydoc
<https://pypi.python.org/pypi/numpydoc>`__ package.
::
def foo(var1, var2, long_var_name='hi'):
r"""A one-line summary that does not use variable names or the
function name.
...
Parameters
----------
var1 : array_like
Array_like means all those objects -- lists, nested lists,
etc. -- that can be converted to an array. We can also
refer to variables like `var1`.
var2 : int
The type above can either refer to an actual Python type
(e.g. ``int``), or describe the type of the variable in more
detail, e.g. ``(N,) ndarray`` or ``array_like``.
long_variable_name : {'hi', 'ho'}, optional
Choices in brackets, default first when optional.
...
"""
var2.| # complete here
**PEP 0484**
https://www.python.org/dev/peps/pep-0484/#type-comments
::
class Sample(object):
def __init__(self):
self.x = None # type: random.Random
self.x.| # complete here
Supported syntax of type hinting
''''''''''''''''''''''''''''''''
Currently rope supports the following syntax of type-hinting.
Parametrized objects:
- Foo
- foo.bar.Baz
- list[Foo] or list[foo.bar.Baz] etc.
- set[Foo]
- tuple[Foo]
- dict[Foo, Bar]
- collections.Iterable[Foo]
- collections.Iterator[Foo]
Nested expressions also allowed:
- collections.Iterable[list[Foo]]
TODO:
Callable objects:
- (Foo, Bar) -> Baz
Multiple interfaces implementation:
- Foo | Bar
Custom Source Folders Custom Source Folders
===================== =====================
......
...@@ -44,6 +44,7 @@ Features implemented so far: ...@@ -44,6 +44,7 @@ Features implemented so far:
* Static and dynamic object analysis * Static and dynamic object analysis
* Handling built-in container types * Handling built-in container types
* Saving object information on disk and validating them * Saving object information on disk and validating them
* Type hints using docstring or type comments PEP 0484
For more information see `overview.rst`_. For more information see `overview.rst`_.
......
Metadata-Version: 1.1
Name: rope
Version: 0.10.5
Summary: a python refactoring library...
Home-page: https://github.com/python-rope/rope
Author: Ali Gholami Rudi
Author-email: aligrudi@users.sourceforge.net
License: GNU GPL
Description:
.. _GitHub python-rope / rope: https://github.com/python-rope/rope
========================================
rope, a python refactoring library ...
========================================
Overview
========
`Rope`_ is a python refactoring library.
.. _`rope`: https://github.com/python-rope/rope
Notes
============
* Nick Smith <nicks@fastmail.fm> takes over maintaining rope. Many thanks to
Matěj Cepl for his work maintaining rope for the past few years!!
* Full python3 support is in progress... stay tuned
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Operating System :: OS Independent
Classifier: Environment :: X11 Applications
Classifier: Environment :: Win32 (MS Windows)
Classifier: Environment :: MacOS X
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU General Public License (GPL)
Classifier: Natural Language :: English
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Topic :: Software Development
COPYING
MANIFEST.in
README.rst
setup.py
docs/contributing.rst
docs/done.rst
docs/library.rst
docs/overview.rst
docs/rope.rst
docs/dev/issues.rst
docs/dev/todo.rst
rope/__init__.py
rope.egg-info/PKG-INFO
rope.egg-info/SOURCES.txt
rope.egg-info/dependency_links.txt
rope.egg-info/top_level.txt
rope/base/__init__.py
rope/base/arguments.py
rope/base/ast.py
rope/base/astutils.py
rope/base/builtins.py
rope/base/change.py
rope/base/codeanalyze.py
rope/base/default_config.py
rope/base/evaluate.py
rope/base/exceptions.py
rope/base/fscommands.py
rope/base/history.py
rope/base/libutils.py
rope/base/prefs.py
rope/base/project.py
rope/base/pycore.py
rope/base/pynames.py
rope/base/pynamesdef.py
rope/base/pyobjects.py
rope/base/pyobjectsdef.py
rope/base/pyscopes.py
rope/base/resourceobserver.py
rope/base/resources.py
rope/base/simplify.py
rope/base/stdmods.py
rope/base/taskhandle.py
rope/base/worder.py
rope/base/oi/__init__.py
rope/base/oi/doa.py
rope/base/oi/memorydb.py
rope/base/oi/objectdb.py
rope/base/oi/objectinfo.py
rope/base/oi/runmod.py
rope/base/oi/soa.py
rope/base/oi/soi.py
rope/base/oi/transform.py
rope/base/oi/type_hinting/__init__.py
rope/base/oi/type_hinting/evaluate.py
rope/base/oi/type_hinting/factory.py
rope/base/oi/type_hinting/interfaces.py
rope/base/oi/type_hinting/utils.py
rope/base/oi/type_hinting/providers/__init__.py
rope/base/oi/type_hinting/providers/composite.py
rope/base/oi/type_hinting/providers/docstrings.py
rope/base/oi/type_hinting/providers/inheritance.py
rope/base/oi/type_hinting/providers/interfaces.py
rope/base/oi/type_hinting/providers/numpydocstrings.py
rope/base/oi/type_hinting/providers/pep0484_type_comments.py
rope/base/oi/type_hinting/resolvers/__init__.py
rope/base/oi/type_hinting/resolvers/composite.py
rope/base/oi/type_hinting/resolvers/interfaces.py
rope/base/oi/type_hinting/resolvers/types.py
rope/base/utils/__init__.py
rope/base/utils/datastructures.py
rope/base/utils/pycompat.py
rope/contrib/__init__.py
rope/contrib/autoimport.py
rope/contrib/changestack.py
rope/contrib/codeassist.py
rope/contrib/finderrors.py
rope/contrib/findit.py
rope/contrib/fixmodnames.py
rope/contrib/fixsyntax.py
rope/contrib/generate.py
rope/refactor/__init__.py
rope/refactor/change_signature.py
rope/refactor/encapsulate_field.py
rope/refactor/extract.py
rope/refactor/functionutils.py
rope/refactor/inline.py
rope/refactor/introduce_factory.py
rope/refactor/introduce_parameter.py
rope/refactor/localtofield.py
rope/refactor/method_object.py
rope/refactor/move.py
rope/refactor/multiproject.py
rope/refactor/occurrences.py
rope/refactor/patchedast.py
rope/refactor/rename.py
rope/refactor/restructure.py
rope/refactor/similarfinder.py
rope/refactor/sourceutils.py
rope/refactor/suites.py
rope/refactor/topackage.py
rope/refactor/usefunction.py
rope/refactor/wildcards.py
rope/refactor/importutils/__init__.py
rope/refactor/importutils/actions.py
rope/refactor/importutils/importinfo.py
rope/refactor/importutils/module_imports.py
ropetest/__init__.py
ropetest/advanced_oi_test.py
ropetest/builtinstest.py
ropetest/codeanalyzetest.py
ropetest/historytest.py
ropetest/objectdbtest.py
ropetest/objectinfertest.py
ropetest/projecttest.py
ropetest/pycoretest.py
ropetest/pyscopestest.py
ropetest/runmodtest.py
ropetest/simplifytest.py
ropetest/testutils.py
ropetest/type_hinting_test.py
ropetest/contrib/__init__.py
ropetest/contrib/autoimporttest.py
ropetest/contrib/changestacktest.py
ropetest/contrib/codeassisttest.py
ropetest/contrib/finderrorstest.py
ropetest/contrib/findittest.py
ropetest/contrib/fixmodnamestest.py
ropetest/contrib/generatetest.py
ropetest/refactor/__init__.py
ropetest/refactor/change_signature_test.py
ropetest/refactor/extracttest.py
ropetest/refactor/importutilstest.py
ropetest/refactor/inlinetest.py
ropetest/refactor/movetest.py
ropetest/refactor/multiprojecttest.py
ropetest/refactor/patchedasttest.py
ropetest/refactor/renametest.py
ropetest/refactor/restructuretest.py
ropetest/refactor/similarfindertest.py
ropetest/refactor/suitestest.py
ropetest/refactor/usefunctiontest.py
\ No newline at end of file
"""rope, a python refactoring library""" """rope, a python refactoring library"""
INFO = __doc__ INFO = __doc__
VERSION = '0.10.3' VERSION = '0.10.5'
COPYRIGHT = """\ COPYRIGHT = """\
Copyright (C) 2015-2016 Nicholas Smith
Copyright (C) 2014-2015 Matej Cepl Copyright (C) 2014-2015 Matej Cepl
Copyright (C) 2006-2012 Ali Gholami Rudi Copyright (C) 2006-2012 Ali Gholami Rudi
Copyright (C) 2009-2012 Anton Gritsay Copyright (C) 2009-2012 Anton Gritsay
......
...@@ -40,6 +40,9 @@ class _NodeNameCollector(object): ...@@ -40,6 +40,9 @@ class _NodeNameCollector(object):
def _Name(self, node): def _Name(self, node):
self._add_node(node) self._add_node(node)
def _ExceptHandler(self, node):
self.names.append((node.name, []))
def _Tuple(self, node): def _Tuple(self, node):
new_levels = [] new_levels = []
if self.levels is not None: if self.levels is not None:
......
...@@ -6,7 +6,8 @@ except NameError: ...@@ -6,7 +6,8 @@ except NameError:
raw_input = input raw_input = input
import rope.base.evaluate import rope.base.evaluate
from rope.base import pynames, pyobjects, arguments, utils, ast from rope.base.utils import pycompat
from rope.base import pynames, pyobjects, arguments, utils
class BuiltinModule(pyobjects.AbstractModule): class BuiltinModule(pyobjects.AbstractModule):
...@@ -86,6 +87,9 @@ class BuiltinClass(_BuiltinElement, pyobjects.AbstractClass): ...@@ -86,6 +87,9 @@ class BuiltinClass(_BuiltinElement, pyobjects.AbstractClass):
result.update(self.initial) result.update(self.initial)
return result return result
def get_module(self):
return builtins
class BuiltinFunction(_BuiltinElement, pyobjects.AbstractFunction): class BuiltinFunction(_BuiltinElement, pyobjects.AbstractFunction):
...@@ -271,7 +275,7 @@ class List(BuiltinClass): ...@@ -271,7 +275,7 @@ class List(BuiltinClass):
collector('__getitem__', function=self._list_get) collector('__getitem__', function=self._list_get)
collector('pop', function=self._list_get) collector('pop', function=self._list_get)
try: try:
collector('__getslice__', function=self._self_get) collector('__getslice__', function=self._list_get)
except AttributeError: except AttributeError:
pass pass
...@@ -297,6 +301,10 @@ class List(BuiltinClass): ...@@ -297,6 +301,10 @@ class List(BuiltinClass):
def _list_get(self, context): def _list_get(self, context):
if self.holding is not None: if self.holding is not None:
args = context.get_arguments(['self', 'key'])
if (len(args) > 1 and args[1] is not None and
args[1].get_type() == builtins['slice'].get_object()):
return get_list(self.holding)
return self.holding return self.holding
return context.get_per_name() return context.get_per_name()
...@@ -414,7 +422,7 @@ class Tuple(BuiltinClass): ...@@ -414,7 +422,7 @@ class Tuple(BuiltinClass):
if objects: if objects:
first = objects[0] first = objects[0]
attributes = { attributes = {
'__getitem__': BuiltinName(BuiltinFunction(first)), '__getitem__': BuiltinName(BuiltinFunction(first)), # TODO: add slice support
'__getslice__': '__getslice__':
BuiltinName(BuiltinFunction(pyobjects.PyObject(self))), BuiltinName(BuiltinFunction(pyobjects.PyObject(self))),
'__new__': BuiltinName(BuiltinFunction(function=self._new_tuple)), '__new__': BuiltinName(BuiltinFunction(function=self._new_tuple)),
...@@ -656,12 +664,12 @@ class Lambda(pyobjects.AbstractFunction): ...@@ -656,12 +664,12 @@ class Lambda(pyobjects.AbstractFunction):
return 'lambda' return 'lambda'
def get_param_names(self, special_args=True): def get_param_names(self, special_args=True):
result = [node.id for node in self.arguments.args result = [pycompat.get_ast_arg_arg(node) for node in self.arguments.args
if isinstance(node, ast.Name)] if isinstance(node, pycompat.ast_arg_type)]
if self.arguments.vararg: if self.arguments.vararg:
result.append('*' + self.arguments.vararg) result.append('*' + pycompat.get_ast_arg_arg(self.arguments.vararg))
if self.arguments.kwarg: if self.arguments.kwarg:
result.append('**' + self.arguments.kwarg) result.append('**' + pycompat.get_ast_arg_arg(self.arguments.kwarg))
return result return result
@property @property
...@@ -801,4 +809,4 @@ _initial_builtins = { ...@@ -801,4 +809,4 @@ _initial_builtins = {
builtin=raw_input)), builtin=raw_input)),
} }
builtins = BuiltinModule('__builtin__', initial=_initial_builtins) builtins = BuiltinModule(pycompat.builtins.__name__, initial=_initial_builtins)
...@@ -129,31 +129,31 @@ class _CustomGenerator(object): ...@@ -129,31 +129,31 @@ class _CustomGenerator(object):
i += 1 i += 1
return result return result
_main_chars = re.compile(r'[\'|"|#|\\|\[|\]|\{|\}|\(|\)]') # Matches all backslashes before the token, to detect escaped quotes
_main_tokens = re.compile(r'(\\*)((\'\'\'|"""|\'|")|#|\[|\]|\{|\}|\(|\))')
def _analyze_line(self, line): def _analyze_line(self, line):
char = None token = None
for match in self._main_chars.finditer(line): for match in self._main_tokens.finditer(line):
char = match.group() prefix = match.group(1)
i = match.start() token = match.group(2)
if char in '\'"': # Skip any tokens which are escaped
if len(prefix) % 2 == 1:
continue
if token in ["'''", '"""', "'", '"']:
if not self.in_string: if not self.in_string:
self.in_string = char self.in_string = token
if char * 3 == line[i:i + 3]: elif self.in_string == token:
self.in_string = char * 3
elif self.in_string == line[i:i + len(self.in_string)] and \
not (i > 0 and line[i - 1] == '\\' and
not (i > 1 and line[i - 2] == '\\')):
self.in_string = '' self.in_string = ''
if self.in_string: if self.in_string:
continue continue
if char == '#': if token == '#':
break break
if char in '([{': if token in '([{':
self.open_count += 1 self.open_count += 1
elif char in ')]}': elif token in ')]}':
self.open_count -= 1 self.open_count -= 1
if line and char != '#' and line.endswith('\\'): if line and token != '#' and line.endswith('\\'):
self.continuation = True self.continuation = True
else: else:
self.continuation = False self.continuation = False
......
# The default ``config.py`` # The default ``config.py``
# flake8: noqa
def set_prefs(prefs): def set_prefs(prefs):
...@@ -79,16 +80,32 @@ def set_prefs(prefs): ...@@ -79,16 +80,32 @@ def set_prefs(prefs):
# appear in the importing namespace. # appear in the importing namespace.
prefs['ignore_bad_imports'] = False prefs['ignore_bad_imports'] = False
# If `True`, rope will insert new module imports as
# `from <package> import <module>` by default.
prefs['prefer_module_from_imports'] = False
# If `True`, rope will transform a comma list of imports into # If `True`, rope will transform a comma list of imports into
# multiple separate import statements when organizing # multiple separate import statements when organizing
# imports. # imports.
prefs['split_imports'] = False prefs['split_imports'] = False
# If `True`, rope will sort imports alphabetically by module name # If `True`, rope will remove all top-level import statements and
# instead of alphabetically by import statement, with from imports # reinsert them at the top of the module when making changes.