diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 11c41a2..8c52696 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,35 +2,15 @@ - - - - - - - - - - - - + + + + - - - - - - - - + - - - - - - + @@ -378,29 +359,7 @@ \ No newline at end of file diff --git a/core/api/__pycache__/actor.cpython-36.pyc b/core/api/__pycache__/actor.cpython-36.pyc new file mode 100644 index 0000000..723db33 Binary files /dev/null and b/core/api/__pycache__/actor.cpython-36.pyc differ diff --git a/core/api/__pycache__/extension.cpython-36.pyc b/core/api/__pycache__/extension.cpython-36.pyc new file mode 100644 index 0000000..ff1f04a Binary files /dev/null and b/core/api/__pycache__/extension.cpython-36.pyc differ diff --git a/core/api/actor.py b/core/api/actor.py index 12cde68..8945e31 100644 --- a/core/api/actor.py +++ b/core/api/actor.py @@ -2,7 +2,7 @@ import logging from core.api.extension import CBPiExtension -from core.helper.utils import load_config as load +from core.utils.utils import load_config as load logger = logging.getLogger(__file__) class CBPiActor(CBPiExtension): diff --git a/core/api/extension.py b/core/api/extension.py index c67f3e0..e29e462 100644 --- a/core/api/extension.py +++ b/core/api/extension.py @@ -1,6 +1,9 @@ import logging +import os -from core.helper.utils import load_config as load +import sys + +from core.utils.utils import load_config as load logger = logging.getLogger(__file__) logging.basicConfig(level=logging.INFO) diff --git a/core/extension/dummy/__pycache__/__init__.cpython-36.pyc b/core/extension/dummy/__pycache__/__init__.cpython-36.pyc index 3cf58a6..8e9a7bb 100644 Binary files a/core/extension/dummy/__pycache__/__init__.cpython-36.pyc and b/core/extension/dummy/__pycache__/__init__.cpython-36.pyc differ diff --git a/core/helper/__pycache__/jsondump.cpython-36.pyc b/core/helper/__pycache__/jsondump.cpython-36.pyc deleted file mode 100644 index 573acf4..0000000 Binary files a/core/helper/__pycache__/jsondump.cpython-36.pyc and /dev/null differ diff --git a/core/helper/__pycache__/utils.cpython-36.pyc b/core/helper/__pycache__/utils.cpython-36.pyc deleted file mode 100644 index 35907cb..0000000 Binary files a/core/helper/__pycache__/utils.cpython-36.pyc and /dev/null differ diff --git a/core/helper/utils.py b/core/helper/utils.py deleted file mode 100644 index eb0bc36..0000000 --- a/core/helper/utils.py +++ /dev/null @@ -1,8 +0,0 @@ -import yaml - - -def load_config(fname): - with open(fname, 'rt') as f: - data = yaml.load(f) - # TODO: add config validation - return data \ No newline at end of file diff --git a/core/http_endpoints/__pycache__/http_api.cpython-36.pyc b/core/http_endpoints/__pycache__/http_api.cpython-36.pyc index 58170c2..c99cfad 100644 Binary files a/core/http_endpoints/__pycache__/http_api.cpython-36.pyc and b/core/http_endpoints/__pycache__/http_api.cpython-36.pyc differ diff --git a/core/http_endpoints/http_api.py b/core/http_endpoints/http_api.py index 84e5f40..47c467d 100644 --- a/core/http_endpoints/http_api.py +++ b/core/http_endpoints/http_api.py @@ -3,7 +3,7 @@ from aiohttp import web from aiojobs.aiohttp import get_scheduler_from_app from core.api.decorator import request_mapping -from core.helper.jsondump import json_dumps +from core.utils.utils import json_dumps class HttpAPI(): diff --git a/core/http_endpoints/http_login.py b/core/http_endpoints/http_login.py index 557add5..06a53c4 100644 --- a/core/http_endpoints/http_login.py +++ b/core/http_endpoints/http_login.py @@ -4,7 +4,7 @@ from aiohttp import web from aiohttp_auth import auth from core.api.decorator import request_mapping -from core.helper.utils import load_config +from core.utils.utils import load_config class Login(): diff --git a/core/helper/__init__.py b/core/utils/__init__.py similarity index 100% rename from core/helper/__init__.py rename to core/utils/__init__.py diff --git a/core/helper/__pycache__/__init__.cpython-36.pyc b/core/utils/__pycache__/__init__.cpython-36.pyc similarity index 100% rename from core/helper/__pycache__/__init__.cpython-36.pyc rename to core/utils/__pycache__/__init__.cpython-36.pyc diff --git a/core/utils/__pycache__/utils.cpython-36.pyc b/core/utils/__pycache__/utils.cpython-36.pyc new file mode 100644 index 0000000..50be1f0 Binary files /dev/null and b/core/utils/__pycache__/utils.cpython-36.pyc differ diff --git a/core/helper/jsondump.py b/core/utils/utils.py similarity index 72% rename from core/helper/jsondump.py rename to core/utils/utils.py index 762524d..d7d05a5 100644 --- a/core/helper/jsondump.py +++ b/core/utils/utils.py @@ -1,9 +1,18 @@ import json from json import JSONEncoder +import yaml + from core.database.model import DBModel, ActorModel +def load_config(fname): + with open(fname, 'rt') as f: + data = yaml.load(f) + # TODO: add config validation + return data + + class ComplexEncoder(JSONEncoder): def default(self, obj): @@ -22,5 +31,6 @@ class ComplexEncoder(JSONEncoder): pass return None + def json_dumps(obj): - return json.dumps(obj, cls=ComplexEncoder) \ No newline at end of file + return json.dumps(obj, cls=ComplexEncoder) diff --git a/logs/first_logfile2.log b/logs/first_logfile2.log index c4032f1..ed8f241 100644 --- a/logs/first_logfile2.log +++ b/logs/first_logfile2.log @@ -1,15 +1,12 @@ -2018-11-01 21:25:19,670,1,WOOHO -2018-11-01 21:25:20,673,1,WOOHO -2018-11-01 21:25:21,677,1,WOOHO -2018-11-01 21:25:22,682,1,WOOHO -2018-11-01 21:25:23,686,1,WOOHO -2018-11-01 21:25:24,690,1,WOOHO -2018-11-01 21:25:25,693,1,WOOHO -2018-11-01 21:25:26,698,1,WOOHO -2018-11-01 21:25:27,702,1,WOOHO -2018-11-01 21:25:28,707,1,WOOHO -2018-11-01 21:25:29,710,1,WOOHO -2018-11-01 21:25:30,713,1,WOOHO -2018-11-01 21:25:31,715,1,WOOHO -2018-11-01 21:25:32,719,1,WOOHO -2018-11-01 21:25:33,723,1,WOOHO +2018-11-01 21:26:19,915,1,WOOHO +2018-11-01 21:26:20,922,1,WOOHO +2018-11-01 21:26:21,928,1,WOOHO +2018-11-01 21:26:22,933,1,WOOHO +2018-11-01 21:26:23,938,1,WOOHO +2018-11-01 21:26:24,944,1,WOOHO +2018-11-01 21:26:25,946,1,WOOHO +2018-11-01 21:26:26,950,1,WOOHO +2018-11-01 21:26:27,954,1,WOOHO +2018-11-01 21:26:28,958,1,WOOHO +2018-11-01 21:26:29,962,1,WOOHO +2018-11-01 21:26:30,966,1,WOOHO diff --git a/logs/first_logfile2.log.2018-11-01_21-20 b/logs/first_logfile2.log.2018-11-01_21-20 deleted file mode 100644 index cd16989..0000000 --- a/logs/first_logfile2.log.2018-11-01_21-20 +++ /dev/null @@ -1,60 +0,0 @@ -2018-11-01 21:20:19,492,1,WOOHO -2018-11-01 21:20:20,498,1,WOOHO -2018-11-01 21:20:21,501,1,WOOHO -2018-11-01 21:20:22,505,1,WOOHO -2018-11-01 21:20:23,507,1,WOOHO -2018-11-01 21:20:24,511,1,WOOHO -2018-11-01 21:20:25,512,1,WOOHO -2018-11-01 21:20:26,514,1,WOOHO -2018-11-01 21:20:27,516,1,WOOHO -2018-11-01 21:20:28,521,1,WOOHO -2018-11-01 21:20:29,526,1,WOOHO -2018-11-01 21:20:30,530,1,WOOHO -2018-11-01 21:20:31,533,1,WOOHO -2018-11-01 21:20:32,534,1,WOOHO -2018-11-01 21:20:33,539,1,WOOHO -2018-11-01 21:20:34,542,1,WOOHO -2018-11-01 21:20:35,547,1,WOOHO -2018-11-01 21:20:36,548,1,WOOHO -2018-11-01 21:20:37,553,1,WOOHO -2018-11-01 21:20:38,556,1,WOOHO -2018-11-01 21:20:39,563,1,WOOHO -2018-11-01 21:20:40,568,1,WOOHO -2018-11-01 21:20:41,572,1,WOOHO -2018-11-01 21:20:42,574,1,WOOHO -2018-11-01 21:20:43,576,1,WOOHO -2018-11-01 21:20:44,581,1,WOOHO -2018-11-01 21:20:45,585,1,WOOHO -2018-11-01 21:20:46,588,1,WOOHO -2018-11-01 21:20:47,593,1,WOOHO -2018-11-01 21:20:48,599,1,WOOHO -2018-11-01 21:20:49,602,1,WOOHO -2018-11-01 21:20:50,603,1,WOOHO -2018-11-01 21:20:51,604,1,WOOHO -2018-11-01 21:20:52,608,1,WOOHO -2018-11-01 21:20:53,612,1,WOOHO -2018-11-01 21:20:54,616,1,WOOHO -2018-11-01 21:20:55,621,1,WOOHO -2018-11-01 21:20:56,625,1,WOOHO -2018-11-01 21:20:57,626,1,WOOHO -2018-11-01 21:20:58,631,1,WOOHO -2018-11-01 21:20:59,635,1,WOOHO -2018-11-01 21:21:00,637,1,WOOHO -2018-11-01 21:21:01,639,1,WOOHO -2018-11-01 21:21:02,643,1,WOOHO -2018-11-01 21:21:03,648,1,WOOHO -2018-11-01 21:21:04,653,1,WOOHO -2018-11-01 21:21:05,657,1,WOOHO -2018-11-01 21:21:06,662,1,WOOHO -2018-11-01 21:21:07,666,1,WOOHO -2018-11-01 21:21:08,671,1,WOOHO -2018-11-01 21:21:09,676,1,WOOHO -2018-11-01 21:21:10,682,1,WOOHO -2018-11-01 21:21:11,684,1,WOOHO -2018-11-01 21:21:12,685,1,WOOHO -2018-11-01 21:21:13,690,1,WOOHO -2018-11-01 21:21:14,695,1,WOOHO -2018-11-01 21:21:15,700,1,WOOHO -2018-11-01 21:21:16,702,1,WOOHO -2018-11-01 21:21:17,707,1,WOOHO -2018-11-01 21:21:18,712,1,WOOHO diff --git a/logs/first_logfile2.log.2018-11-01_21-25 b/logs/first_logfile2.log.2018-11-01_21-25 new file mode 100644 index 0000000..eae4689 --- /dev/null +++ b/logs/first_logfile2.log.2018-11-01_21-25 @@ -0,0 +1,60 @@ +2018-11-01 21:25:19,670,1,WOOHO +2018-11-01 21:25:20,673,1,WOOHO +2018-11-01 21:25:21,677,1,WOOHO +2018-11-01 21:25:22,682,1,WOOHO +2018-11-01 21:25:23,686,1,WOOHO +2018-11-01 21:25:24,690,1,WOOHO +2018-11-01 21:25:25,693,1,WOOHO +2018-11-01 21:25:26,698,1,WOOHO +2018-11-01 21:25:27,702,1,WOOHO +2018-11-01 21:25:28,707,1,WOOHO +2018-11-01 21:25:29,710,1,WOOHO +2018-11-01 21:25:30,713,1,WOOHO +2018-11-01 21:25:31,715,1,WOOHO +2018-11-01 21:25:32,719,1,WOOHO +2018-11-01 21:25:33,723,1,WOOHO +2018-11-01 21:25:34,725,1,WOOHO +2018-11-01 21:25:35,729,1,WOOHO +2018-11-01 21:25:36,733,1,WOOHO +2018-11-01 21:25:37,737,1,WOOHO +2018-11-01 21:25:38,742,1,WOOHO +2018-11-01 21:25:39,750,1,WOOHO +2018-11-01 21:25:40,756,1,WOOHO +2018-11-01 21:25:41,759,1,WOOHO +2018-11-01 21:25:42,764,1,WOOHO +2018-11-01 21:25:43,767,1,WOOHO +2018-11-01 21:25:44,773,1,WOOHO +2018-11-01 21:25:45,775,1,WOOHO +2018-11-01 21:25:46,780,1,WOOHO +2018-11-01 21:25:47,786,1,WOOHO +2018-11-01 21:25:48,788,1,WOOHO +2018-11-01 21:25:49,792,1,WOOHO +2018-11-01 21:25:50,796,1,WOOHO +2018-11-01 21:25:51,802,1,WOOHO +2018-11-01 21:25:52,805,1,WOOHO +2018-11-01 21:25:53,809,1,WOOHO +2018-11-01 21:25:54,811,1,WOOHO +2018-11-01 21:25:55,816,1,WOOHO +2018-11-01 21:25:56,818,1,WOOHO +2018-11-01 21:25:57,823,1,WOOHO +2018-11-01 21:25:58,827,1,WOOHO +2018-11-01 21:25:59,831,1,WOOHO +2018-11-01 21:26:00,835,1,WOOHO +2018-11-01 21:26:01,840,1,WOOHO +2018-11-01 21:26:02,843,1,WOOHO +2018-11-01 21:26:03,846,1,WOOHO +2018-11-01 21:26:04,852,1,WOOHO +2018-11-01 21:26:05,856,1,WOOHO +2018-11-01 21:26:06,860,1,WOOHO +2018-11-01 21:26:07,865,1,WOOHO +2018-11-01 21:26:08,870,1,WOOHO +2018-11-01 21:26:09,878,1,WOOHO +2018-11-01 21:26:10,883,1,WOOHO +2018-11-01 21:26:11,885,1,WOOHO +2018-11-01 21:26:12,889,1,WOOHO +2018-11-01 21:26:13,891,1,WOOHO +2018-11-01 21:26:14,892,1,WOOHO +2018-11-01 21:26:15,898,1,WOOHO +2018-11-01 21:26:16,903,1,WOOHO +2018-11-01 21:26:17,908,1,WOOHO +2018-11-01 21:26:18,911,1,WOOHO