예제 #1
0
    def get_items(self):
        iterators = []
        ui = datatools.UniqueIterator(S.toplevel_source()
                                      for S in self.sources)
        for S in ui:
            it = S.get_leaves()
            iterators.append(it)

        return itertools.chain(*iterators)
예제 #2
0
파일: plugin.py 프로젝트: jchtt/kupfer-adds
def get_vim_files(filepath):
    """
	Read ~/.viminfo from @filepath

	Look for a line like this:
	*encoding=<encoding>

	Return an iterator of unicode string file paths
	"""
    encoding = "UTF-8"
    recents = []
    with open(filepath, "r") as f:
        for line in f:
            if line.startswith("*encoding="):
                _, enc = line.split("=")
                encoding = enc.strip()
            us_line = line.decode(encoding, "replace")
            ## Now find the jumplist
            if us_line.startswith("-'  "):
                parts = us_line.split(None, 3)
                recentfile = os.path.expanduser(parts[-1].strip())
                if recentfile:
                    recents.append(recentfile)
    return datatools.UniqueIterator(recents)
예제 #3
0
파일: data.py 프로젝트: jchtt/kupfer-adds
 def as_set_iter(seq):
     key = operator.attrgetter("object")
     return datatools.UniqueIterator(seq, key=key)
예제 #4
0
 def __init__(self, obj, name=_("Multiple Objects")):
     # modifying the list of objects is strictly forbidden
     robj = list(datatools.UniqueIterator(obj))
     Leaf.__init__(self, robj, name)