Mercurial > ~astiob > upreckon > hgweb
view 2.00/files.py @ 16:f2279b7602d3
Initial 2.00 commit
author | Oleg Oshmyan <chortos@inbox.lv> |
---|---|
date | Mon, 07 Jun 2010 23:36:52 +0000 |
parents | |
children | ec6f1a132109 |
line wrap: on
line source
#!/usr/bin/python # Copyright (c) 2010 Chortos-2 <chortos@inbox.lv> import os tasknames = (os.path.curdir,) class Files(object): __slots__ = 'name', 'paths' stdpaths = '%/', '%/^:%/', '%/^:', 'tests/%/', 'tests/', '^:%/', '^:', '' def __init__(self, name, paths = stdpaths): self.name = name self.paths = paths def __iter__(self): for path in paths: p = getpath(path, self.name) if isfile(p): yield p def isfile(path): return os.path.isfile(path) def getpath(path, name): return path + name