Anonymous avatar Anonymous committed 9a89b9b

codeassist: removing docs for deprecated classes

Comments (0)

Files changed (1)

rope/contrib/codeassist.py

         return str(self)
 
 
-class TemplateProposal(CodeAssistProposal):
-    """A template proposal
-
-    The `template` attribute is a `Template` object.
-    """
-
-    def __init__(self, name, template):
-        super(TemplateProposal, self).__init__(name, 'template')
-        self.template = template
-
-
-class Template(object):
-    """Templates that are used in code assists
-
-    Variables in templates are in ``${variable}`` format. To put a
-    dollar sign in the template put $$.  To specify cursor position
-    use ${cursor}.
-
-    """
-
-    def __init__(self, template):
-        self.template = template
-
-    var_pattern = re.compile(r'((?<=[^\$])|^)\${(?P<variable>\w+)}')
-
-    def variables(self):
-        """Get template variables
-
-        Return the list of variables sorted by their order of
-        occurence in the template.
-
-        """
-        result = []
-        for match in self.var_pattern.finditer(self.template):
-            new_var = match.group('variable')
-            if new_var not in result and new_var != 'cursor':
-                result.append(new_var)
-        return result
-
-    def _substitute(self, input_string, mapping):
-        import string
-        single_dollar = re.compile('((?<=[^\$])|^)\$((?=[^{\$])|$)')
-        template = single_dollar.sub('$$', input_string)
-        t = string.Template(template)
-        return t.substitute(mapping, cursor='')
-
-    def substitute(self, mapping):
-        return self._substitute(self.template, mapping)
-
-    def get_cursor_location(self, mapping):
-        cursor_index = len(self.template)
-        for match in self.var_pattern.finditer(self.template):
-            new_var = match.group('variable')
-            if new_var == 'cursor':
-                cursor_index = match.start('variable') - 2
-        new_template = self.template[0:cursor_index]
-        start = len(self._substitute(new_template, mapping))
-        return start
-
-
 def sorted_proposals(proposals, kindpref=None, typepref=None):
     """Sort a list of proposals
 
             trimmed.pop(0)
         # Return a single string:
         return '\n'.join((' ' * indents + line for line in trimmed))
+
+
+# Deprecated classes
+
+class TemplateProposal(CodeAssistProposal):
+    def __init__(self, name, template):
+        warnings.warn('TemplateProposal is deprecated.',
+                      DeprecationWarning, stacklevel=2)
+        super(TemplateProposal, self).__init__(name, 'template')
+        self.template = template
+
+
+class Template(object):
+
+    def __init__(self, template):
+        self.template = template
+        warnings.warn('Template is deprecated.',
+                      DeprecationWarning, stacklevel=2)
+
+    def variables(self):
+        return []
+
+    def substitute(self, mapping):
+        return self.template
+
+    def get_cursor_location(self, mapping):
+        return len(self.template)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.