summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2018-06-28 05:24:09 +0300
committerDevaev Maxim <[email protected]>2018-06-28 05:24:09 +0300
commit0a3ab57639c403fc50eacdc0bb9ad59ee5942c58 (patch)
treec8d9ee8c4c656de336a5ce9ee51fadccd8ae7c9b
parentab87784b75d6e51704f4314d7354e0051be8cd24 (diff)
kvmd extra package
-rw-r--r--kvmd/kvmd/__init__.py15
-rw-r--r--kvmd/kvmd/application.py22
-rw-r--r--kvmd/kvmd/extra/__init__.py0
-rw-r--r--[-rwxr-xr-x]kvmd/kvmd/extra/wscli.py (renamed from kvmd/wscli.py)0
-rw-r--r--kvmd/tox.ini8
5 files changed, 28 insertions, 17 deletions
diff --git a/kvmd/kvmd/__init__.py b/kvmd/kvmd/__init__.py
index 0074f6bf..d303747c 100644
--- a/kvmd/kvmd/__init__.py
+++ b/kvmd/kvmd/__init__.py
@@ -1,7 +1,5 @@
import asyncio
-import argparse
import logging
-import logging.config
import time
from typing import List
@@ -14,7 +12,7 @@ from RPi import GPIO
import aiohttp
-import yaml
+from .application import init
from .atx import Atx
from .streamer import Streamer
@@ -191,13 +189,4 @@ class _Application:
def main() -> None:
- parser = argparse.ArgumentParser()
- parser.add_argument("-c", "--config", default="kvmd.yaml", metavar="<path>")
- options = parser.parse_args()
-
- with open(options.config) as config_file:
- config = yaml.load(config_file)
- logging.captureWarnings(True)
- logging.config.dictConfig(config["logging"])
-
- _Application(config["kvmd"]).run()
+ _Application(init()).run()
diff --git a/kvmd/kvmd/application.py b/kvmd/kvmd/application.py
new file mode 100644
index 00000000..bdadf443
--- /dev/null
+++ b/kvmd/kvmd/application.py
@@ -0,0 +1,22 @@
+import argparse
+import logging
+import logging.config
+
+from typing import Dict
+
+import yaml
+
+
+# =====
+def init() -> Dict:
+ parser = argparse.ArgumentParser()
+ parser.add_argument("-c", "--config", default="kvmd.yaml", metavar="<path>")
+ options = parser.parse_args()
+
+ with open(options.config) as config_file:
+ config = yaml.load(config_file)
+
+ logging.captureWarnings(True)
+ logging.config.dictConfig(config["logging"])
+
+ return config["kvmd"]
diff --git a/kvmd/kvmd/extra/__init__.py b/kvmd/kvmd/extra/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/kvmd/kvmd/extra/__init__.py
diff --git a/kvmd/wscli.py b/kvmd/kvmd/extra/wscli.py
index f4b261a7..f4b261a7 100755..100644
--- a/kvmd/wscli.py
+++ b/kvmd/kvmd/extra/wscli.py
diff --git a/kvmd/tox.ini b/kvmd/tox.ini
index 69ab7011..d627345f 100644
--- a/kvmd/tox.ini
+++ b/kvmd/tox.ini
@@ -6,26 +6,26 @@ skipsdist = True
basepython = python3.6
[testenv:flake8]
-commands = flake8 kvmd wscli.py
+commands = flake8 kvmd
deps =
flake8
flake8-double-quotes
-rdev_requirements.txt
[testenv:pylint]
-commands = pylint --output-format=colorized --reports=no kvmd wscli.py
+commands = pylint --output-format=colorized --reports=no kvmd
deps =
pylint
-rdev_requirements.txt
[testenv:mypy]
-commands = mypy kvmd wscli.py
+commands = mypy kvmd
deps =
mypy
-rdev_requirements.txt
[testenv:vulture]
-commands = vulture kvmd wscli.py
+commands = vulture kvmd
deps =
vulture
-rdev_requirements.txt