Exemplo n.º 1
0
@decorator.decorator
def mac(f, *args, **kwargs):
    """`@only.mac` decorator. raise OSError in not MacOS"""
    _raise_if(not detect.mac, f, "is MacOS only :(")
    return f(*args, **kwargs)


@decorator.decorator
def osx(f, *args, **kwargs):
    """`@only.osx` decorator. raise OSError in not OSX"""
    _raise_if(not detect.mac, f, "is OSX only :(")
    return f(*args, **kwargs)


@decorator.decorator
def windows(f, *args, **kwargs):
    """`@only.windows` decorator. raise OSError in not Windows"""
    _raise_if(not detect.mac, f, "is OSX only :(")
    return f(*args, **kwargs)


@decorator.decorator
def unix(f, *args, **kwargs):
    """`@only.unix` decorator. raise OSError in not Unix"""
    _raise_if(not detect.unix, f, "is OSX only :(")
    return f(*args, **kwargs)


public.add(linux, mac, osx, unix, windows)
Exemplo n.º 2
0
#!/usr/bin/env python
from shields.abstract import Abstract
from shields._badge import Badge
from shields import npm
from shields import pypi
import public


public.add(Badge)
Exemplo n.º 3
0
#!/usr/bin/env python
import pkgutil
import os
import public
import pydoc
import setupcfg.metadata
import setupcfg.options
import setupcfg.values
from setupcfg.cfg import Setupcfg

public.add(Setupcfg)


@public.add
def get(section, option, default=None):
    """return the value for option if option is in the `setup.cfg`, else default"""
    cfg = Setupcfg().load("setup.cfg")
    return cfg.get(section, {}).get(option, default)


@public.add
def load(path="setup.cfg"):
    """return dictionary with `setup.cfg` sections dictionaries"""
    return Setupcfg().load(path)


@public.add
def getmodules():
    """return a list of module objects"""
    if not os.path.exists("setup.cfg"):
        raise OSError("setup.cfg NOT EXISTS")
Exemplo n.º 4
0
'''
Domain model package, all his inner modules have direact accesss
'''
from importlib import import_module
import public  # type: ignore

module_register = ('poll', 'question', 'answer_option', 'answer')

for register in module_register:
    mod = import_module(f'core.entities.{register}')
    public.add(mod.__all__)  # type: ignore