コード例 #1
0
ファイル: sos.py プロジェクト: Tapyr/tapyr
def listdir_exts (in_dir, * extensions) :
    """Returns a list of all files with one of the extensions specified by
       `extensions` contained in directory `in_dir`.

       Unlike the result of `listdir`, the files returned by this function
       are full-blown pathes (i.e., they include `in_dir`).
    """
    from _TFL.predicate import un_nested
    extensions = un_nested (extensions)
    if extensions and ("*" not in extensions) :
        global __extension_dict
        __extension_dict = {}
        for e in extensions :
            __extension_dict [e] = 1
        return list (p for p in listdir_full (in_dir) if _ext_filter (p))
    else :
        return [f for f in listdir_full (in_dir) if not path.isdir (f)]
コード例 #2
0
def listdir_exts(in_dir, *extensions):
    """Returns a list of all files with one of the extensions specified by
       `extensions` contained in directory `in_dir`.

       Unlike the result of `listdir`, the files returned by this function
       are full-blown pathes (i.e., they include `in_dir`).
    """
    from _TFL.predicate import un_nested
    extensions = un_nested(extensions)
    if extensions and ("*" not in extensions):
        global __extension_dict
        __extension_dict = {}
        for e in extensions:
            __extension_dict[e] = 1
        return list(p for p in listdir_full(in_dir) if _ext_filter(p))
    else:
        return [f for f in listdir_full(in_dir) if not path.isdir(f)]
コード例 #3
0
ファイル: Arg_List.py プロジェクト: xiaochang91/tapyr
 def __init__ (self, * children, ** kw) :
     children = un_nested              (children)
     children = self._convert_children (children)
     self.__super.__init__ (* children, ** kw)