wide-energy-11069
04/27/2016, 12:27 AMclass Collection(object):
@classmethod
@memoized
def of(cls, ext):
type_name = b'Collection({!r})'.format(ext)
class_dict = {'ext': ext,
# # We need custom serialization for the dynamic class type.
# '__reduce__': lambda self: (_create_sources, ext)
}
ext_type = type(type_name, (cls, datatype("{}s".format(ext.__name__), ['dependencies'])), class_dict)
# Expose the custom class type at the module level to be pickle compatible.
setattr(sys.modules[cls.__module__], type_name, ext_type)
return ext_type
Files = Collection.of(File)
Dirs = Collection.of(Dir)
def create_fs_tasks():
"""Creates tasks that consume the native filesystem Node type."""
return [
# Glob execution.
(Stats,
[SelectProjection(Stats, Dir, ('directory',), PathWildcard),
Select(PathWildcard)],
apply_path_wildcard),…