How to use the clu.typespace.namespace.SimpleNamespace function in clu

To help you get started, we’ve selected a few clu examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fish2000 / instakit / instakit / utils / misc.py View on Github external
try:
    import six
except ImportError:
    class FakeSix(object):
        @property
        def string_types(self):
            return tuple()
    six = FakeSix()

export(wrap_value,              name='wrap_value')
export(none_function,           name='none_function')
export(tuplize,                 name='tuplize')
export(uniquify,                name='uniquify')
export(listify,                 name='listify')

export(SimpleNamespace)
export(Namespace)

export(stringify,               name='stringify')
export(string_types)
export(byte_types)

export(suffix_searcher)
export(u8encode)
export(u8bytes)
export(u8str)

# Assign the modules’ `__all__` and `__dir__` using the exporter:
__all__, __dir__ = exporter.all_and_dir()
github fish2000 / instakit / instakit / utils / static.py View on Github external
def static_namespace(name):
    """ Configure and return a clu.typespace.namespace.Namespace instance,
        festooning it with shortcuts allowing for accesing static files
        within subdirectories of the Instakit project package tree.
    """
    from clu.typespace.namespace import SimpleNamespace as Namespace
    ns = Namespace()
    ns.name = str(name)
    ns.root = os.path.join(projectdir, ns.name)
    ns.data = os.path.join(ns.root, 'data')
    ns.relative = lambda p: os.path.relpath(p, start=ns.root)
    ns.listfiles = lambda *p: os.listdir(os.path.join(ns.data, *p))
    ns.path = lambda *p: os.path.abspath(os.path.join(ns.data, *p))
    namespaces.add(ns)
    return ns