from ally.design.priority import Priority, PRIORITY_NORMAL, sortByPriorities from ..support.util_sys import callerLocals from ._impl._assembly import Assembly from ._impl._call import CallEntity, CallConfig, CallEventControlled from ._impl._setup import register, SetupConfig, SetupStart, SetupFunction from ._impl._support import SetupEntityListen, SetupEntityListenAfterBinding, \ classesFrom, SetupEntityCreate from .error import SetupError from .event import ITrigger, createEvents from .impl.config import Config from .wire import createWirings from __setup__.ally.notifier import PRIORITY_NOTIFIER # -------------------------------------------------------------------- PRIORITY_LOAD_ENTITIES = Priority('Load all entities', before=PRIORITY_NOTIFIER) # The priority for @see: loadAllEntities. # -------------------------------------------------------------------- def nameEntity(target, location=None): ''' Provides the setup names to be used setup modules based on a setup target and name. @param target: class|SetupFunction The target that is considered the entity source. @param location: string|module|SetupFunction|None The group, setup or setup module to consider as setup container, if not provided then the name is provided without location. '''
from ally.core.impl.processor.content import AssemblerContentHandler from ally.design.priority import Priority from ally.design.processor.assembly import Assembly from ally.design.processor.handler import Handler from .decode import assemblyDecode, assemblyDecodeExport, \ updateAssemblyDecodeExport from .definition import definitions from .encode import assemblyEncode from ally.core.impl.processor.assembler.check_validation import CheckValidationHandler # -------------------------------------------------------------------- log = logging.getLogger(__name__) PRIORITY_REGISTER = Priority('Register services', after=PRIORITY_LOAD_ENTITIES) # The register priority. # -------------------------------------------------------------------- @ioc.entity def assemblyAssembler() -> Assembly: ''' The assembly containing the handlers to be used in the assembly of invokers into the root node. ''' return Assembly('Assemblers') # -------------------------------------------------------------------- @ioc.entity def services() -> list:
import sys import unittest from ally.container import event, ioc, context, aop, support, deploy from ally.container.impl.config import load, save from ally.design.priority import Priority, PRIORITY_NORMAL from application import parser, options from .logging import format, debug_for, info_for, warning_for, log_file # -------------------------------------------------------------------- log = logging.getLogger(__name__) # -------------------------------------------------------------------- PRIORITY_PREFERENCE = Priority('Preference', after=PRIORITY_NORMAL) # The priority for setting the application preference arguments. PRIORITY_LOGGING = Priority('Logging', before=PRIORITY_NORMAL) # The priority for setting up logging. PRIORITY_CONFIGURATION = Priority('Configure', before=PRIORITY_LOGGING) # The priority for setting the application configurations. FLAG_CONFIGURE = 'configure' # Flag indicating the application configurations. FLAG_START = 'start' # Flag indicating the application start. FLAG_DUMP = 'dump' # Flag indicating the application should dump configurations. FLAG_TEST = 'test' # Flag indicating the application should perform unit testing.
Provides the distribution controlled events for the plugins. ''' import logging from os.path import isfile from ally.container import ioc, app, support from ally.container.event import ITrigger from ally.container.impl.config import load, save, Config from ally.design.priority import Priority, PRIORITY_LAST # -------------------------------------------------------------------- log = logging.getLogger(__name__) PRIORITY_PERSIST_MARKERS = Priority('Persist events markers', before=PRIORITY_LAST) # The persist markers priority. APP_NORMAL = 'normal' # Name used for normal application mode. APP_DEVEL = 'devel' # Name used for development application mode. # -------------------------------------------------------------------- @ioc.config def distribution_file_path(): ''' The name of the distribution file for the plugins deployments''' return 'distribution.properties'
from sqlalchemy.engine.base import Engine from sqlalchemy.orm.session import sessionmaker from sqlalchemy import event import logging from urllib.parse import urlparse import os # -------------------------------------------------------------------- log = logging.getLogger(__name__) # -------------------------------------------------------------------- if __name__ == 'sql_alchemy.database_config': PRIORITY_CREATE_TABLES = PRIORITY_NORMAL else: PRIORITY_CREATE_TABLES = Priority('Create %s tables' % __name__[__name__.rindex('.') + 1:], before=PRIORITY_NORMAL) # The create tables priority. # -------------------------------------------------------------------- @ioc.config def database_url(): ''' The database URL, something like: "sqlite:///{database}.db" "mysql+mysqlconnector://{user}:{password}@localhost/{database}" ''' raise ConfigError('A database URL is required') @ioc.config def alchemy_pool_recycle():
from ally.container.impl.config import save, load from ally.design.priority import Priority, PRIORITY_FIRST from ally.support.util_sys import isPackage from application import parser, options import application from package_extender import PACKAGE_EXTENDER from ..ally.deploy import PRIORITY_PREFERENCE, dump, FLAG_DUMP, \ preparePreferences from .distribution import application_mode, PRIORITY_PERSIST_MARKERS, \ triggerEvents # -------------------------------------------------------------------- log = logging.getLogger(__name__) PRIORITY_PREPARE_PLUGIN = Priority('Prepare plugin', after=PRIORITY_PREFERENCE) # The priority for setting the application preference arguments. PRIORITY_DEPLOY = Priority('Deploy plugin', after=PRIORITY_FIRST) # The deploy priority. PRIORITY_TRIGGER_EVENTS = Priority('Deploy plugin events', before=PRIORITY_PERSIST_MARKERS) # The deploy event priority. # -------------------------------------------------------------------- @ioc.after(preparePreferences) def preparePluginPreferences(): options.mode = None
@copyright: 2012 Sourcefabric o.p.s. @license: http://www.gnu.org/licenses/gpl-3.0.txt @author: Mihai Gociu Provides the general notifier system setup. ''' from ally.container import ioc from ally.design.processor.assembly import Assembly from ally.design.processor.execution import Processing, FILL_ALL from ally.design.processor.handler import Handler from ally.notifier.impl.processor.scanner_file_system import FileSystemScanner from ally.design.priority import Priority, PRIORITY_NORMAL # -------------------------------------------------------------------- PRIORITY_NOTIFIER = Priority('Start notifier', after=PRIORITY_NORMAL) # The priority for @see: loadAllEntities. # -------------------------------------------------------------------- @ioc.entity def registersListeners() -> list: ''' The list of register like handlers that push the listeners for notifying''' return [] @ioc.entity def assemblyNotifier() -> Assembly: ''' The assembly used for notifying changes on resources''' return Assembly('Notifier')