mirror of
https://git.zavage.net/Zavage-Software/app_skellington.git
synced 2025-04-19 09:59:20 -06:00
fix: moved some imports and code to fix an import error
This commit is contained in:
parent
10e873d2d6
commit
d15517623d
@ -1 +1 @@
|
|||||||
3.8.19
|
3.8.8
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
# flake8: noqa
|
# flake8: noqa
|
||||||
|
|
||||||
|
from .cfg import Config, EnvironmentVariables
|
||||||
|
|
||||||
from .app_container import (
|
from .app_container import (
|
||||||
DEFAULT_APP_AUTHOR,
|
DEFAULT_APP_AUTHOR,
|
||||||
DEFAULT_APP_NAME,
|
DEFAULT_APP_NAME,
|
||||||
ApplicationContainer,
|
ApplicationContainer,
|
||||||
ApplicationContext,
|
ApplicationContext,
|
||||||
NoCommandSpecified,
|
|
||||||
ServiceNotFound,
|
|
||||||
)
|
)
|
||||||
from .cfg import Config, EnvironmentVariables
|
from ._util import ServiceNotFound, NoCommandSpecified
|
||||||
from .cli import (
|
from .cli import (
|
||||||
EXPLICIT_FAIL_ON_UNKNOWN_ARGS,
|
EXPLICIT_FAIL_ON_UNKNOWN_ARGS,
|
||||||
CommandEntry,
|
CommandEntry,
|
||||||
|
@ -124,3 +124,15 @@ def create_func(constructor, cls_method):
|
|||||||
return cls_method(cmd_class_instance, *args, **kwargs)
|
return cls_method(cmd_class_instance, *args, **kwargs)
|
||||||
|
|
||||||
return func
|
return func
|
||||||
|
|
||||||
|
|
||||||
|
class ServiceNotFound(Exception):
|
||||||
|
"""
|
||||||
|
Application framework error: unable to find and inject dependency.
|
||||||
|
"""
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class NoCommandSpecified(Exception):
|
||||||
|
pass
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
# file generated by setuptools_scm
|
# file generated by setuptools-scm
|
||||||
# don't change, don't track in version control
|
# don't change, don't track in version control
|
||||||
|
|
||||||
|
__all__ = ["__version__", "__version_tuple__", "version", "version_tuple"]
|
||||||
|
|
||||||
TYPE_CHECKING = False
|
TYPE_CHECKING = False
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Tuple, Union
|
from typing import Tuple
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
||||||
else:
|
else:
|
||||||
@ -13,5 +17,5 @@ __version__: str
|
|||||||
__version_tuple__: VERSION_TUPLE
|
__version_tuple__: VERSION_TUPLE
|
||||||
version_tuple: VERSION_TUPLE
|
version_tuple: VERSION_TUPLE
|
||||||
|
|
||||||
__version__ = version = "0.2.2"
|
__version__ = version = '0.3.0.dev6+g10e873d.d20250223'
|
||||||
__version_tuple__ = version_tuple = (0, 2, 2)
|
__version_tuple__ = version_tuple = (0, 3, 0, 'dev6', 'g10e873d.d20250223')
|
||||||
|
@ -4,7 +4,10 @@ import os
|
|||||||
|
|
||||||
import appdirs
|
import appdirs
|
||||||
|
|
||||||
from . import _util, cfg, cli, log
|
from ._util import ServiceNotFound, NoCommandSpecified, get_root_asset
|
||||||
|
from . import log
|
||||||
|
from .cfg import Config
|
||||||
|
from .cli import CommandTree
|
||||||
|
|
||||||
# Application scaffolding:
|
# Application scaffolding:
|
||||||
from ._bootstrap import _bootstrap_logger
|
from ._bootstrap import _bootstrap_logger
|
||||||
@ -49,7 +52,7 @@ class ApplicationContainer:
|
|||||||
# global state, configuration, loggers, and runtime args.
|
# global state, configuration, loggers, and runtime args.
|
||||||
self._dependencies = {}
|
self._dependencies = {}
|
||||||
|
|
||||||
config = cfg.Config(configspec_filepath, configini_filepath)
|
config = Config(configspec_filepath, configini_filepath)
|
||||||
|
|
||||||
logger = log.LoggingLayer(self.appname, self.appauthor)
|
logger = log.LoggingLayer(self.appname, self.appauthor)
|
||||||
# Try and load logging configuration if provided
|
# Try and load logging configuration if provided
|
||||||
@ -67,7 +70,7 @@ class ApplicationContainer:
|
|||||||
# Reference to context service avail. in root_app
|
# Reference to context service avail. in root_app
|
||||||
self["ctx"] = lambda: self.ctx
|
self["ctx"] = lambda: self.ctx
|
||||||
|
|
||||||
self.cli = cli.CommandTree() # Command-line interface
|
self.cli = CommandTree() # Command-line interface
|
||||||
|
|
||||||
# Run methods if subclass implemented them:
|
# Run methods if subclass implemented them:
|
||||||
if callable(getattr(self, "_cli_options", None)):
|
if callable(getattr(self, "_cli_options", None)):
|
||||||
@ -144,7 +147,7 @@ class ApplicationContainer:
|
|||||||
"""
|
"""
|
||||||
Attempt to find config.spec inside the installed package directory.
|
Attempt to find config.spec inside the installed package directory.
|
||||||
"""
|
"""
|
||||||
return _util.get_root_asset(configspec_filename)
|
return get_root_asset(configspec_filename)
|
||||||
|
|
||||||
def _inject_service_dependencies(self, constructor):
|
def _inject_service_dependencies(self, constructor):
|
||||||
"""
|
"""
|
||||||
@ -188,13 +191,3 @@ class ApplicationContainer:
|
|||||||
# Applications need a default usage
|
# Applications need a default usage
|
||||||
|
|
||||||
|
|
||||||
class ServiceNotFound(Exception):
|
|
||||||
"""
|
|
||||||
Application framework error: unable to find and inject dependency.
|
|
||||||
"""
|
|
||||||
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class NoCommandSpecified(Exception):
|
|
||||||
pass
|
|
||||||
|
@ -3,7 +3,7 @@ import inspect
|
|||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from . import NoCommandSpecified, app_container
|
from ._util import NoCommandSpecified
|
||||||
from ._bootstrap import _bootstrap_logger
|
from ._bootstrap import _bootstrap_logger
|
||||||
|
|
||||||
# If explicit fail is enabled, any command with at least one unknown
|
# If explicit fail is enabled, any command with at least one unknown
|
||||||
@ -280,7 +280,7 @@ class CommandTree:
|
|||||||
# return self._invoke_command(lookup, args)
|
# return self._invoke_command(lookup, args)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise app_container.NoCommandSpecified("No command specified.")
|
raise NoCommandSpecified("No command specified.")
|
||||||
|
|
||||||
def _invoke_command(self, cmd, args):
|
def _invoke_command(self, cmd, args):
|
||||||
command_to_be_invoked = cmd.callback
|
command_to_be_invoked = cmd.callback
|
||||||
|
Loading…
Reference in New Issue
Block a user