Commit eab3579e authored by Arnaud Fontaine's avatar Arnaud Fontaine

merge patched-debian-experimental into debian-experimental

parents 78f7d39c da4b3278
Metadata-Version: 1.1
Name: rope
Version: 0.10.3
Version: 0.10.5
Summary: a python refactoring library...
Home-page: http://rope.sf.net/
Home-page: https://github.com/python-rope/rope
Author: Ali Gholami Rudi
Author-email: aligrudi@users.sourceforge.net
License: GNU GPL
......@@ -24,13 +24,12 @@ Description:
.. _`rope`: https://github.com/python-rope/rope
New Features
Notes
============
* Under new management! Matěj Cepl <mcepl@cepl.eu> takes it hesitantly
over
* Merged all availables pull requests and patches to the main codebase
* Tests are green again
* 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
......@@ -43,4 +42,11 @@ 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
......@@ -15,13 +15,12 @@ Overview
.. _`rope`: https://github.com/python-rope/rope
New Features
Notes
============
* Under new management! Matěj Cepl <mcepl@cepl.eu> takes it hesitantly
over
* Merged all availables pull requests and patches to the main codebase
* Tests are green again
* 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
Getting Started
===============
......@@ -49,14 +48,15 @@ googlegroups.com`_.
License
=======
This program is under the terms of GPL (GNU General Public License).
Have a look at ``COPYING`` file for more information.
This program is under the terms of GPL v2 (GNU General Public License).
Have a look at `COPYING`_ for more information.
.. _`docs/rope.rst`: docs/rope.html
.. _`docs/overview.rst`: docs/overview.html
.. _`docs/contributing.rst`: docs/contributing.html
.. _`docs/library.rst`: docs/library.html
.. _`COPYING`: COPYING
.. image:: https://secure.travis-ci.org/python-rope/rope.png
:alt: Build Status
# see git-dpm(1) from git-dpm package
7f19bb6d79d2426f4b29e531f12116398efce357
7f19bb6d79d2426f4b29e531f12116398efce357
835afd55ba93a1632462d454b5be0985b6ca9794
da4b3278b40a1cf16798771e5b67d918d8693393
da4b3278b40a1cf16798771e5b67d918d8693393
0d2c73dafa27bdee016a7008b8f15afec48ffe20
0d2c73dafa27bdee016a7008b8f15afec48ffe20
rope_0.10.5.orig.tar.gz
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>
Date: Thu, 26 Jan 2017 13:38:11 +0900
Subject: =?UTF-8?q?Mitigations=20for=20CVE-2014-3539=20from=20the=20upstre?=
......@@ -41,7 +41,7 @@ Patch-Name: CVE-2014-3539.patch
create mode 100644 ropetest/CVE20143539/run_reproducer.sh
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
+++ b/rope/base/oi/doa.py
@@ -116,7 +116,7 @@ class _SocketReceiver(_MessageReceiver):
......@@ -193,10 +193,10 @@ index 0000000..b1f7fac
+python CVE-2014-3539.py 2>/dev/null
+exit $?
diff --git a/ropetest/__init__.py b/ropetest/__init__.py
index f1cb459..744beee 100644
index 699f8c6..d2e3aaf 100644
--- a/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.refactor
......@@ -205,7 +205,7 @@ index f1cb459..744beee 100644
def suite():
result = unittest.TestSuite()
@@ -33,6 +35,7 @@ def suite():
@@ -38,6 +40,7 @@ def suite():
result.addTests(ropetest.refactor.suite())
result.addTests(ropetest.contrib.suite())
......
......@@ -1209,6 +1209,129 @@ Rope uses this feature by default but you can disable it by editing
``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
=====================
......
......@@ -44,6 +44,7 @@ Features implemented so far:
* Static and dynamic object analysis
* Handling built-in container types
* Saving object information on disk and validating them
* Type hints using docstring or type comments PEP 0484
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"""
INFO = __doc__
VERSION = '0.10.3'
VERSION = '0.10.5'
COPYRIGHT = """\
Copyright (C) 2015-2016 Nicholas Smith
Copyright (C) 2014-2015 Matej Cepl
Copyright (C) 2006-2012 Ali Gholami Rudi
Copyright (C) 2009-2012 Anton Gritsay
......
......@@ -40,6 +40,9 @@ class _NodeNameCollector(object):
def _Name(self, node):
self._add_node(node)
def _ExceptHandler(self, node):
self.names.append((node.name, []))
def _Tuple(self, node):
new_levels = []
if self.levels is not None:
......
......@@ -6,7 +6,8 @@ except NameError:
raw_input = input
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):
......@@ -86,6 +87,9 @@ class BuiltinClass(_BuiltinElement, pyobjects.AbstractClass):
result.update(self.initial)
return result
def get_module(self):
return builtins
class BuiltinFunction(_BuiltinElement, pyobjects.AbstractFunction):
......@@ -271,7 +275,7 @@ class List(BuiltinClass):
collector('__getitem__', function=self._list_get)
collector('pop', function=self._list_get)
try:
collector('__getslice__', function=self._self_get)
collector('__getslice__', function=self._list_get)
except AttributeError:
pass
......@@ -297,6 +301,10 @@ class List(BuiltinClass):
def _list_get(self, context):
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 context.get_per_name()
......@@ -414,7 +422,7 @@ class Tuple(BuiltinClass):
if objects:
first = objects[0]
attributes = {
'__getitem__': BuiltinName(BuiltinFunction(first)),
'__getitem__': BuiltinName(BuiltinFunction(first)), # TODO: add slice support
'__getslice__':
BuiltinName(BuiltinFunction(pyobjects.PyObject(self))),
'__new__': BuiltinName(BuiltinFunction(function=self._new_tuple)),
......@@ -656,12 +664,12 @@ class Lambda(pyobjects.AbstractFunction):
return 'lambda'
def get_param_names(self, special_args=True):
result = [node.id for node in self.arguments.args
if isinstance(node, ast.Name)]
result = [pycompat.get_ast_arg_arg(node) for node in self.arguments.args
if isinstance(node, pycompat.ast_arg_type)]
if self.arguments.vararg:
result.append('*' + self.arguments.vararg)
result.append('*' + pycompat.get_ast_arg_arg(self.arguments.vararg))
if self.arguments.kwarg:
result.append('**' + self.arguments.kwarg)
result.append('**' + pycompat.get_ast_arg_arg(self.arguments.kwarg))
return result
@property
......@@ -801,4 +809,4 @@ _initial_builtins = {
builtin=raw_input)),
}
builtins = BuiltinModule('__builtin__', initial=_initial_builtins)
builtins = BuiltinModule(pycompat.builtins.__name__, initial=_initial_builtins)
......@@ -129,31 +129,31 @@ class _CustomGenerator(object):
i += 1
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):
char = None
for match in self._main_chars.finditer(line):
char = match.group()
i = match.start()
if char in '\'"':
token = None
for match in self._main_tokens.finditer(line):
prefix = match.group(1)
token = match.group(2)
# Skip any tokens which are escaped
if len(prefix) % 2 == 1:
continue
if token in ["'''", '"""', "'", '"']:
if not self.in_string:
self.in_string = char
if char * 3 == line[i:i + 3]:
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 = token
elif self.in_string == token:
self.in_string = ''
if self.in_string:
continue
if char == '#':
if token == '#':
break
if char in '([{':
if token in '([{':
self.open_count += 1
elif char in ')]}':
elif token in ')]}':
self.open_count -= 1
if line and char != '#' and line.endswith('\\'):
if line and token != '#' and line.endswith('\\'):
self.continuation = True
else:
self.continuation = False
......
# The default ``config.py``
# flake8: noqa
def set_prefs(prefs):
......@@ -79,16 +80,32 @@ def set_prefs(prefs):
# appear in the importing namespace.
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
# multiple separate import statements when organizing
# imports.
prefs['split_imports'] = False
# If `True`, rope will sort imports alphabetically by module name
# instead of alphabetically by import statement, with from imports
# after normal imports.
# If `True`, rope will remove all top-level import statements and
# reinsert them at the top of the module when making changes.
prefs['pull_imports_to_top'] = True
# If `True`, rope will sort imports alphabetically by module name instead of
# alphabetically by import statement, with from imports after normal
# imports.
prefs['sort_imports_alphabetically'] = False
# Location of implementation of rope.base.oi.type_hinting.interfaces.ITypeHintingFactory
# In general case, you don't have to change this value, unless you're an rope expert.
# Change this value to inject you own implementations of interfaces
# listed in module rope.base.oi.type_hinting.providers.interfaces
# For example, you can add you own providers for Django Models, or disable the search
# type-hinting in a class hierarchy, etc.
prefs['type_hinting_factory'] = 'rope.base.oi.type_hinting.factory.default_type_hinting_factory'
def project_opened(project):
"""This function is called after opening the project"""
......
......@@ -2,6 +2,7 @@ import rope.base.builtins
import rope.base.pynames
import rope.base.pyobjects
from rope.base import ast, astutils, exceptions, pyobjects, arguments, worder
from rope.base.utils import pycompat
BadIdentifierError = exceptions.BadIdentifierError
......@@ -290,7 +291,11 @@ class StatementEvaluator(object):
self._call_function(node.value, '__getitem__',
[node.slice.value])
elif isinstance(node.slice, ast.Slice):
self._call_function(node.value, '__getslice__')
self._call_function(node.value, '__getitem__',
[node.slice])
def _Slice(self, node):
self.result = self._get_builtin_name('slice')
def _call_function(self, node, function_name, other_args=None):
pyname = eval_node(self.scope, node)
......
......@@ -10,6 +10,8 @@ import os
import shutil
import subprocess
import rope.base.utils.pycompat as pycompat
try:
unicode
except NameError:
......@@ -261,23 +263,26 @@ def read_str_coding(source):
def _find_coding(text):
if type(text) == bytes:
if isinstance(text, pycompat.str):
text = text.encode('utf-8')
coding = b'coding'
else:
coding = "coding"
to_chr = chr if pycompat.PY3 else lambda x: x
try:
start = text.index(coding) + len(coding)
if text[start] not in '=:':
if text[start] not in b'=:':
return
start += 1
while start < len(text) and text[start].isspace():
while start < len(text) and to_chr(text[start]).isspace():
start += 1
end = start
while end < len(text):
c = text[end]
if not c.isalnum() and c not in '-_':
if not to_chr(c).isalnum() and c not in b'-_':
break
end += 1
return text[start:end]
result = text[start:end]
if isinstance(result, bytes):
result = result.decode('utf-8')
return result
except ValueError:
pass
......@@ -65,7 +65,7 @@ class PythonFileRunner(object):
self.receiving_thread.start()
def _receive_information(self):
#temp = open('/dev/shm/info', 'w')
#temp = open('/dev/shm/info', 'wb')
for data in self.receiver.receive_data():
self.analyze_data(data)
#temp.write(str(data) + '\n')
......@@ -128,7 +128,7 @@ class _SocketReceiver(_MessageReceiver):
def receive_data(self):
conn, addr = self.server_socket.accept()
self.server_socket.close()
my_file = conn.makefile('r')
my_file = conn.makefile('rb')
while True:
try:
yield pickle.load(my_file)
......
try:
execfile
except NameError: