1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
"""
This package extends the GPS.Search class with a number of high-level
python constructs. See the documentation of GPS.Search for more information.
"""
import GPS
GPS.Search.FUZZY = 1
GPS.Search.SUBSTRINGS = 2
GPS.Search.REGEXP = 4
GPS.Search.CASE_SENSITIVE = 8
GPS.Search.WHOLE_WORD = 16
GPS.Search.FILE_NAMES = "File names"
GPS.Search.ACTIONS = "Actions"
GPS.Search.BUILDS = "Build"
GPS.Search.OPENED = "Opened"
GPS.Search.ENTITIES = "Entities"
GPS.Search.SOURCES = "Sources"
GPS.Search.BOOKMARKS = "Bookmarks"
GPS.Search.PREFERENCES = "Preferences"
GPS.Search.PLUGINS = "Plugins"
def __iter__(self):
return self
def __next__(self):
"""
See documentation in the GPS user's guide.
"""
while True:
(has_next, result) = self.get()
if result:
return result
if not has_next:
raise StopIteration
def search(context, pattern, flags=GPS.Search.SUBSTRINGS):
"""
See documentation in the GPS user's guide.
"""
s = GPS.Search.lookup(context)
if s:
s.set_pattern(pattern, flags)
return s
GPS.Search.__iter__ = __iter__
GPS.Search.__next__ = __next__
GPS.Search.search = staticmethod(search)
|