Transfer changes

oop-refactor
Thor 4 years ago
parent 75c3913563
commit df3b3efc8f
  1. 6
      .gitmodules
  2. 14
      .pylintrc
  3. 1
      dependencies.txt
  4. 1
      packages/apscheduler
  5. 1
      packages/ptpython
  6. 9
      src/test.py
  7. 2
      src/zasd/__init__.py
  8. 0
      src/zasd/config/__init__.py
  9. 24
      src/zasd/config/loader.py
  10. 6
      src/zasd/repl.py
  11. 8
      vs.code-workspace

6
.gitmodules vendored

@ -0,0 +1,6 @@
[submodule "packages/apscheduler"]
path = packages/apscheduler
url = https://github.com/agronholm/apscheduler
[submodule "packages/ptpython"]
path = packages/ptpython
url = https://github.com/prompt-toolkit/ptpython.git

@ -0,0 +1,14 @@
[MASTER]
init-hook=
import sys;
sys.path.insert(0, '${workspaceFolder}/src')
sys.path.insert(1, '${workspaceFolder}/packages');
disable=
invalid-name,
useless-super-delegation,
pointless-string-statement,
exec-used,
bad-whitespace,
missing-final-newline

@ -0,0 +1 @@
Subproject commit cb50f0dab93fccf39c091062f48899ab4ac53a51

@ -0,0 +1 @@
Subproject commit 89017ba158ed1d95319233fa5aedf3931c3b8b77

@ -1,12 +1,13 @@
import os
import sys
import pprint
import dateutil
from zasd.filesystems.zfs import ZFSFilesystem
from zasd.apsched import AsyncIOPriorityScheduler
#from zasd.filesystems.zfs import ZFSFilesystem
#from zasd.apsched import AsyncIOPriorityScheduler
fs = ZFSFilesystem()
fs.label()
#fs = ZFSFilesystem()
#fs.label()
pprint.pprint(dict(os.environ), indent=2)
pprint.pprint(sys.path)

@ -15,7 +15,7 @@ from apscheduler.triggers.interval import IntervalTrigger # type: ignore
from zasd.apsched import AsyncIOPriorityScheduler, \
AsyncIOPriorityExecutor
from zasd.config_loader import load_config
from zasd.config.loader import load_config
import zasd.config as config
from zasd.filesystems.zfs import ZFSFilesystem
from zasd.filesystem import FilesystemRegistry

@ -2,7 +2,7 @@
from typing import MutableMapping, Any
from sys import argv, executable
from sys import argv, executable, stdout
from os import environ, getcwd, sep as psep
from os.path import dirname, abspath, join as joinpath, \
expanduser, splitdrive, isfile
@ -28,6 +28,9 @@ import zasd.config as _config
_CONFIG_BASENAME = 'zasd.conf.py'
_CONFIG_FILENAMES = [_CONFIG_BASENAME, '.' + _CONFIG_BASENAME]
_WARNING_WAIT = 3
#_WARNING_WAIT = 10
# Default configuration
_DEFAULT_CONFIG = dict(
zfs_path = '/usr/local/bin/zfs',
@ -142,20 +145,23 @@ async def load_config():
log.debug('Loaded configuration')
#if _config.get('log_level') <= logging.DEBUG:
log.debug('')
for line in pprint.pformat(_config.reference()).split('\n'):
logging.debug(_config.get('tab_size') * ' ' + line)
log.debug('')
if _config.get('log_level') <= logging.DEBUG:
log.debug('')
for line in pprint.pformat(_config).split('\n'):
logging.debug(_config.get('tab_size') * ' ' + line)
log.debug('')
async def _warn_default():
log.warning('')
log.warning('Waiting 10 seconds before loading default configuration...')
log.warning(
'Waiting %s seconds before loading default configuration...',
_WARNING_WAIT)
log.warning('')
await asyncio.sleep(10)
await asyncio.sleep(_WARNING_WAIT)
stdout.write('\r')
log.warning('Loading default configuration')
log.warning('')
return deepcopy(_DEFAULT_CONFIG)
_config.change(deepcopy(_DEFAULT_CONFIG))
# pylint: disable=dangerous-default-value
def _merge_configs(base, diff, path=[]):

@ -50,13 +50,13 @@ class DictObject:
@asyncio.coroutine
def repl():
globals = dict(
_globals = dict(
config = DictObject(config.reference(), 'config')
)
locals = dict()
_locals = dict()
try:
yield from ptpython.repl.embed(
globals=globals, locals=locals, return_asyncio_coroutine=True,
globals=_globals, locals=_locals, return_asyncio_coroutine=True,
patch_stdout=True, vi_mode=True)
except EOFError:
asyncio.get_event_loop().stop()

@ -7,13 +7,9 @@
"settings": {
"editor.rulers": [80],
"terminal.integrated.env.osx": {
"PYTHONPATH": "${workspaceFolder}/src",
"MYPYPATH": "${workspaceFolder}/src"
"PYTHONPATH": "${workspaceFolder}/src:${workspaceFolder}/packages/apscheduler",
"MYPYPATH": "${workspaceFolder}/src:${workspaceFolder}/packages"
},
"python.linting.pylintArgs": [
"--init-hook", "import sys; sys.path.insert(0, '${workspaceFolder}/src')",
"-d", "invalid-name,useless-super-delegation,pointless-string-statement,exec-used,bad-whitespace,missing-final-newline"
],
"python.pythonPath": "/usr/local/bin/python"
}
}
Loading…
Cancel
Save