[Python-modules-commits] [ropemode] 01/09: Import ropemode_0.3.orig.tar.gz
Arnaud Fontaine
arnau at moszumanska.debian.org
Thu Dec 1 08:29:51 UTC 2016
This is an automated email from the git hooks/post-receive script.
arnau pushed a commit to annotated tag debian/0.3-1
in repository ropemode.
commit 6d51cc2f199ac2fb5058d9f3186cb3231593fc17
Author: Arnaud Fontaine <arnaud.fontaine at nexedi.com>
Date: Thu Dec 1 17:13:51 2016 +0900
Import ropemode_0.3.orig.tar.gz
---
PKG-INFO | 2 +-
README.rst | 6 ++++++
ropemode.egg-info/PKG-INFO | 2 +-
ropemode.egg-info/SOURCES.txt | 1 +
ropemode.egg-info/requires.txt | 2 +-
ropemode/__init__.py | 2 +-
ropemode/decorators.py | 21 +++++++++++++++------
ropemode/interface.py | 22 +++++++++++++++++-----
8 files changed, 43 insertions(+), 15 deletions(-)
diff --git a/PKG-INFO b/PKG-INFO
index 44cf592..b08c0ce 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: ropemode
-Version: 0.2
+Version: 0.3
Summary: ropemode, a helper for using rope refactoring library in IDEs
Home-page: http://rope.sf.net/
Author: Ali Gholami Rudi
diff --git a/README.rst b/README.rst
new file mode 100644
index 0000000..e9f8df0
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,6 @@
+
+**Note:** *Please note that this project has been moved to* `GitHub python-rope / ropemode`_
+
+.. _GitHub python-rope / ropemode: https://github.com/python-rope/ropemode
+
+
diff --git a/ropemode.egg-info/PKG-INFO b/ropemode.egg-info/PKG-INFO
index 44cf592..b08c0ce 100644
--- a/ropemode.egg-info/PKG-INFO
+++ b/ropemode.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: ropemode
-Version: 0.2
+Version: 0.3
Summary: ropemode, a helper for using rope refactoring library in IDEs
Home-page: http://rope.sf.net/
Author: Ali Gholami Rudi
diff --git a/ropemode.egg-info/SOURCES.txt b/ropemode.egg-info/SOURCES.txt
index dec7198..19ba93c 100644
--- a/ropemode.egg-info/SOURCES.txt
+++ b/ropemode.egg-info/SOURCES.txt
@@ -1,3 +1,4 @@
+README.rst
setup.py
ropemode/__init__.py
ropemode/decorators.py
diff --git a/ropemode.egg-info/requires.txt b/ropemode.egg-info/requires.txt
index a7eb5d5..07188ad 100644
--- a/ropemode.egg-info/requires.txt
+++ b/ropemode.egg-info/requires.txt
@@ -1 +1 @@
-rope >= 0.9.4
\ No newline at end of file
+rope >= 0.9.4
diff --git a/ropemode/__init__.py b/ropemode/__init__.py
index e1bf29d..9927422 100644
--- a/ropemode/__init__.py
+++ b/ropemode/__init__.py
@@ -1,7 +1,7 @@
"""ropemode, a helper for using rope refactoring library in IDEs"""
INFO = __doc__
-VERSION = '0.2'
+VERSION = '0.3'
COPYRIGHT = """\
Copyright (C) 2007-2012 Ali Gholami Rudi
diff --git a/ropemode/decorators.py b/ropemode/decorators.py
index 21eaaf0..ec1321c 100644
--- a/ropemode/decorators.py
+++ b/ropemode/decorators.py
@@ -47,13 +47,15 @@ input_exceptions = (exceptions.RefactoringError,
exceptions.ModuleSyntaxError,
exceptions.BadIdentifierError)
-def _exception_handler(func):
+def _exception_handler(func, raise_exceptions, error_return):
def newfunc(*args, **kwds):
try:
return func(*args, **kwds)
except exceptions.RopeError, e:
short = None
if isinstance(e, input_exceptions):
+ if not raise_exceptions:
+ return error_return
short = _exception_message(e)
logger(str(traceback.format_exc()), short)
newfunc.__name__ = func.__name__
@@ -72,10 +74,12 @@ def rope_hook(hook):
return func
return decorator
-
-def local_command(key=None, prefix=False, shortcut=None, name=None):
+def local_command(key=None, prefix=False, shortcut=None,
+ name=None, raise_exceptions=True,
+ error_return=None):
def decorator(func, name=name):
- func = _exception_handler(func)
+ func = _exception_handler(func, raise_exceptions,
+ error_return)
func.kind = 'local'
func.prefix = prefix
func.local_key = key
@@ -86,10 +90,15 @@ def local_command(key=None, prefix=False, shortcut=None, name=None):
return func
return decorator
+def local_function(error_return=None):
+ return local_command(raise_exceptions=False,
+ error_return=error_return)
-def global_command(key=None, prefix=False):
+def global_command(key=None, prefix=False, raise_exceptions=True,
+ error_return=None):
def decorator(func):
- func = _exception_handler(func)
+ func = _exception_handler(func, raise_exceptions,
+ error_return)
func.kind = 'global'
func.prefix = prefix
func.global_key = key
diff --git a/ropemode/interface.py b/ropemode/interface.py
index c02615a..0e617c9 100644
--- a/ropemode/interface.py
+++ b/ropemode/interface.py
@@ -157,7 +157,7 @@ class RopeMode(object):
def pop_mark(self):
self.env.pop_mark()
- @decorators.local_command()
+ @decorators.local_function()
def definition_location(self):
definition = self._base_definition_location()
if definition:
@@ -182,7 +182,7 @@ class RopeMode(object):
self._check_project()
self._base_show_doc(prefix, self._base_get_doc(codeassist.get_doc))
- @decorators.local_command()
+ @decorators.local_function()
def get_calltip(self):
self._check_project()
def _get_doc(project, text, offset, *args, **kwds):
@@ -203,7 +203,7 @@ class RopeMode(object):
else:
self.env.message('No docs available!')
- @decorators.local_command()
+ @decorators.local_function()
def get_doc(self):
self._check_project()
return self._base_get_doc(codeassist.get_doc)
@@ -275,11 +275,11 @@ class RopeMode(object):
def auto_import(self):
_CodeAssist(self, self.env).auto_import()
- @decorators.local_command()
+ @decorators.local_function([])
def completions(self):
return _CodeAssist(self, self.env).completions()
- @decorators.local_command()
+ @decorators.local_function([])
def extended_completions(self):
return _CodeAssist(self, self.env).extended_completions()
@@ -552,6 +552,18 @@ class Location(object):
return self.location.lineno
return self.location.resource.read().count('\n', 0, self.offset) + 1
+ @property
+ def line_content(self):
+ resource_contents = self.location.resource.read()
+ # rfind returns -1 for start of string, so by adding 1 we get the start
+ # of the string. When a match is found we want to exclude the matching
+ # character so again we add 1.
+ line_start = resource_contents.rfind("\n", 0, self.offset) + 1
+ line_end = resource_contents.find("\n", self.offset)
+ if line_end < 0:
+ line_end = len(resource_contents)
+ return resource_contents[line_start:line_end]
+
class _CodeAssist(object):
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/ropemode.git
More information about the Python-modules-commits
mailing list