Anonymous avatar Anonymous committed 6b57305

patchedast: removed _Source.get()

Comments (0)

Files changed (1)

rope/refactor/patchedast.py

                     region = self.source.consume_not_equal()
                 else:
                     region = self.source.consume(child)
-                child = self.source.get(region[0], region[1])
+                child = self.source[region[0]:region[1]]
                 token_start = region[0]
             if not first_token:
-                formats.append(self.source.get(offset, token_start))
+                formats.append(self.source[offset:token_start])
                 if self.children:
-                    children.append(self.source.get(offset, token_start))
+                    children.append(self.source[offset:token_start])
             else:
                 first_token = False
                 start = token_start
             new_end = self.source.consume(')')[1]
         if new_end is not None:
             if self.children:
-                children.append(self.source.get(old_end, new_end))
+                children.append(self.source[old_end:new_end])
         new_start = start
         for i in range(opens):
             new_start = self.source.rfind_token('(', 0, new_start)
         if new_start != start:
             if self.children:
-                children.appendleft(self.source.get(new_start, start))
+                children.appendleft(self.source[new_start:start])
             start = new_start
         return start
 
 
     def till_token(self, token):
         new_offset = self.source.index(token, self.offset)
-        return self.get(self.offset, new_offset)
-
-    def get(self, start, end):
-        return self.source[start:end]
+        return self[self.offset:new_offset]
 
     def rfind_token(self, token, start, end):
         index = start
                 return None
 
     def from_offset(self, offset):
-        return self.get(offset, self.offset)
+        return self[offset:self.offset]
 
     def find_backwards(self, pattern, offset):
         return self.source.rindex(pattern, 0, offset)
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.