Compare commits

...

3 commits

Author SHA1 Message Date
c94e713b1d moving data to new repo 2023-03-03 18:29:39 -08:00
8d2bb67499 naking stuff 2023-03-01 10:14:04 -08:00
62d1d9baca no change? 2023-02-28 18:13:53 -08:00
8 changed files with 145 additions and 5 deletions

View file

@ -1,5 +1,23 @@
# -*- coding: utf-8 -*-
from . import config from . import config
from . import output from . import output
import logging import logging
def main(): import sys
__author__ = "arris kathery"
__copyright__ = "copyright 2023 brendan berger"
__license__ = ""
__maintainer__ = "arris kathery"
__email__ = "whotookelburg@hotmail.com"
__version__ = "0.0.0-alpha0"
def main() -> dict:
out=output.OutputObject()
try:
# do shit
except KeyboardInterrupt:
return {'_kbi':True}

View file

@ -1 +1,9 @@
raise "nononono u can't do that! >~<" import owo, sys
if __name__ == "__main__":
output=owo.main()
del owo
if output._kb:
sys.exit()
else:
# output results

View file

@ -1,2 +1,6 @@
def loadConfig(confLocation = "$HOME/.config/owo.yaml"): confDict = {}
def loadConfig(confLocation = "$HOME/.config/owo.yaml"):
from os import path
if not path.exists(confLocation):

55
src/datafiles/__init__.py Normal file
View file

@ -0,0 +1,55 @@
from pathlib import Path
from sys import platform
from yaml import load, dump
import os
from re import search, IGNORECASE
import collections.abc
_config={}
_files=[]
_configloaded = False
_LOCATIONS = {
'_YAMLCONFPATH':{
'_DIR':[
"{}/owo/".format(os.environ["XDG_CONFIG_HOME"]) if "XDG_CONFIG_HOME" in os.environ else str(Path.home())+"/.config/owo/",
"{}/".format(os.environ["XDG_CONFIG_HOME"]) if "XDG_CONFIG_HOME" in os.environ else str(Path.home())+"/.config/",
str(Path('~').resolve()),
str(Path().resolve()) if str(Path.cwd()) not in self._DIRS else None
],
'_FNAME_RE':
r"([ou^>]w[ou^<]|config)\.(ya?ml|c(on)?fi?g?)$"
}
}
def _updateConf(toAdd: dict):
for key, value in toAdd.items():
if isinstance(value, collections.abc.Mapping):
def _loadYAMLConf(path: str):
try:
conf = yaml.load(file.read_text())
except Exception as exc:
# do an err
else:
if not _config:
_config = conf
else:
def initConfig(path: str) -> bool:
if _configloaded:
return True# If config already loaded, do not reload.
else:
try:
file = Path(path)
if file.exists() and not file.is_dir():
try:
conf = yaml.load(file.read_text())
except Exception as exc:
# do an err
else:
if not _config

31
src/format.py Normal file
View file

@ -0,0 +1,31 @@
_DEFAULT = {
'_DATETEMP':'%a, %d %b %Y %H:%M:%S %Z%z',
'_INCLUDE':[
'env',
]
}
def dateFormat(input: str = _DEFAULT._DATETEMP,use_local:bool=True) -> str:
from time import strftime
if use_local:
from time import localtime
return strftime(input,localtime())
else:
from time import gmtime
return strftime(input,gmtime())
def stringformat(
input: str,
include: list = _DEFAULT._INCLUDE
) -> str:
imap = {
'time': dateFormat()
}
if 'env' in include:
import os
imap['env'] = os.environ
del os
return input.format_map(imap)

View file

@ -1 +0,0 @@
import logging

View file

@ -0,0 +1,24 @@
import logging
# outputDict={
# 'status': 1,
# 'input': {
# 'argsRaw': sys.argv,
# 'streamObjects': []
# },
# 'output': [],
# 'errors': []
# }
class OutputObject:
def __init__(self):
self.status = 1
import sys
self.input = {
'argsRaw': sys.argv,
'streamObjects': []
}
del sys
self.output = []
self.errors = []

1
src/output/__init__.py Normal file
View file

@ -0,0 +1 @@
from . import OutputObject