Compare commits
2 commits
Author | SHA1 | Date | |
---|---|---|---|
fc80fc9b84 | |||
43d21deeed |
11 changed files with 56 additions and 38 deletions
16
README.md
16
README.md
|
@ -17,7 +17,9 @@ specified depencencies are not hosted on that index.
|
|||
|
||||
## Usage
|
||||
|
||||
`skyeweave` is a CLI application, meaning it needs to be accessed via the commandline.
|
||||
### commandline
|
||||
|
||||
`skyeweave` is primarily a CLI application.
|
||||
|
||||
The following options are available:
|
||||
|
||||
|
@ -39,6 +41,18 @@ skyeweave --output out --id 70
|
|||
|
||||
This would generate the expressions for Scathach (Servant Id 70) in the folder out, using subfolders to better separate the outputs of multiple runs.
|
||||
|
||||
### python scripts [EXPERIMENTAL]
|
||||
|
||||
`skyeweave` can also be used in other Python scripts.
|
||||
|
||||
```python
|
||||
from skyeweave import compose
|
||||
|
||||
compose(70)
|
||||
```
|
||||
|
||||
This feature will be expanded upon in future releases.
|
||||
|
||||
## Issues / Support
|
||||
|
||||
If there are any issues with `skyeweave`, feel free to reach out to me using the AtlasAcademy discord (`#dev-corner`) or create an issue in this repo.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[project]
|
||||
name = "skyeweave"
|
||||
version = "1.0.0-c.1"
|
||||
version = "1.0.0-c.2"
|
||||
requires-python = ">= 3.10"
|
||||
authors = [{name = "Firq", email = "firelp42@gmail.com"}]
|
||||
maintainers = [{name = "Firq", email = "firelp42@gmail.com"}]
|
||||
|
@ -47,11 +47,13 @@ disable = [
|
|||
"missing-class-docstring",
|
||||
"logging-fstring-interpolation",
|
||||
]
|
||||
ignore-paths="test/*"
|
||||
|
||||
[tool.mypy]
|
||||
python_version = "3.11"
|
||||
warn_return_any = true
|
||||
warn_unused_configs = true
|
||||
exclude = [ "test" ]
|
||||
|
||||
[build-system]
|
||||
requires = ["setuptools >= 61.0"]
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import importlib.metadata
|
||||
|
||||
__version__ = importlib.metadata.version(__package__ or "skyeweave")
|
||||
|
||||
from .service import compose
|
||||
|
|
|
@ -5,15 +5,14 @@ import sys
|
|||
from typing import List
|
||||
|
||||
from .. import __version__
|
||||
from ..backend import compose
|
||||
from ..service import compose
|
||||
from ..config import AtlasAPIConfig, LoggingConfig, PathConfig
|
||||
from ..utils.filesystem import rmdir
|
||||
from ..utils.disables import disable_tqdm
|
||||
from ..utils import rmdir, disable_tqdm
|
||||
|
||||
LOGGER = logging.getLogger(LoggingConfig.NAME)
|
||||
|
||||
# pylint: disable=too-few-public-methods
|
||||
class Arguments(argparse.Namespace):
|
||||
class CLIArguments(argparse.Namespace):
|
||||
"""
|
||||
Default Arguments when calling the CLI
|
||||
"""
|
||||
|
@ -25,7 +24,7 @@ class Arguments(argparse.Namespace):
|
|||
timeout: int
|
||||
quiet: bool
|
||||
|
||||
def parse_arguments():
|
||||
def parse_arguments(arguments):
|
||||
"""
|
||||
Create a parser and parse the arguments of sys.argv based on the Arguments Namespace
|
||||
Returns arguments and extra arguments separately
|
||||
|
@ -44,12 +43,9 @@ def parse_arguments():
|
|||
parser.add_argument("--reset", action="store_true", default=False, dest="reset", help="Delete any already downloaded assets")
|
||||
parser.add_argument("--quiet", "-q", action="store_true", default=False, dest="quiet", help="Mute output and hide progress bars")
|
||||
|
||||
return parser.parse_known_args(arguments, namespace=CLIArguments)
|
||||
|
||||
args = Arguments()
|
||||
args, extra_args = parser.parse_known_args(sys.argv[1:], namespace=args)
|
||||
return args, extra_args
|
||||
|
||||
def welcome():
|
||||
def __welcome():
|
||||
print("-------------------------------------------")
|
||||
print(" Welcome to skyeweave, an expression sheet ")
|
||||
print(" composer developed by Firq ")
|
||||
|
@ -68,18 +64,16 @@ def validate_id(input_id: None | str) -> int:
|
|||
return int(input_id)
|
||||
|
||||
def run():
|
||||
args, _ = parse_arguments()
|
||||
args, _ = parse_arguments(sys.argv[1:])
|
||||
if args.output:
|
||||
PathConfig.OUTPUT = pathlib.Path(args.output)
|
||||
|
||||
if args.timeout and args.timeout >= 0:
|
||||
AtlasAPIConfig.TIMEOUT = args.timeout
|
||||
|
||||
if args.quiet:
|
||||
disable_tqdm()
|
||||
LOGGER.disabled = True
|
||||
else:
|
||||
welcome()
|
||||
__welcome()
|
||||
|
||||
input_id = validate_id(args.id)
|
||||
|
||||
|
@ -93,9 +87,8 @@ def run():
|
|||
else:
|
||||
LOGGER.info("No cache to clear was found, continuing")
|
||||
|
||||
if args.reset:
|
||||
if PathConfig.IMAGES.exists():
|
||||
rmdir(PathConfig.IMAGES)
|
||||
LOGGER.info("Successfully reset local storage")
|
||||
if args.reset and PathConfig.IMAGES.exists():
|
||||
rmdir(PathConfig.IMAGES)
|
||||
LOGGER.info("Successfully reset local storage")
|
||||
|
||||
compose(input_id, args.filter)
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
from .logger import init_logger
|
||||
LOGGER = init_logger()
|
||||
from .filesystem import rmdir
|
||||
from .logger import LOGGER, disable_tqdm
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
# pylint: disable=import-outside-toplevel
|
||||
def disable_tqdm():
|
||||
from tqdm import tqdm
|
||||
from functools import partialmethod
|
||||
tqdm.__init__ = partialmethod(tqdm.__init__, disable=True)
|
|
@ -1,18 +1,27 @@
|
|||
|
||||
# pylint: disable=import-outside-toplevel
|
||||
import logging
|
||||
import sys
|
||||
from ..config import LoggingConfig
|
||||
from .disables import disable_tqdm
|
||||
|
||||
def init_logger():
|
||||
from ..config import LoggingConfig
|
||||
|
||||
def disable_tqdm():
|
||||
from tqdm import tqdm
|
||||
from functools import partialmethod
|
||||
tqdm.__init__ = partialmethod(tqdm.__init__, disable=True)
|
||||
|
||||
def __init_logger():
|
||||
if LoggingConfig.LEVEL == "DEBUG":
|
||||
disable_tqdm()
|
||||
|
||||
logger = logging.getLogger(LoggingConfig.NAME)
|
||||
logger.setLevel(LoggingConfig.LEVEL)
|
||||
handler = logging.StreamHandler(stream=sys.stdout)
|
||||
formatter = logging.Formatter('[%(levelname)s] [%(name)s] %(message)s')
|
||||
handler.setFormatter(formatter)
|
||||
logger.addHandler(handler)
|
||||
default_logger = logging.getLogger(LoggingConfig.NAME)
|
||||
default_logger.setLevel(LoggingConfig.LEVEL)
|
||||
|
||||
return logger
|
||||
default_handler = logging.StreamHandler(stream=sys.stdout)
|
||||
default_formatter = logging.Formatter('[%(levelname)s] [%(name)s] %(message)s')
|
||||
|
||||
default_handler.setFormatter(default_formatter)
|
||||
default_logger.addHandler(default_handler)
|
||||
|
||||
return default_logger
|
||||
|
||||
LOGGER = __init_logger()
|
||||
|
|
3
test.py
Normal file
3
test.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from skyeweave import compose
|
||||
|
||||
compose(70)
|
Loading…
Reference in a new issue