Reorganizes sources

This commit is contained in:
Oleg Silkin 2019-07-24 01:43:50 -04:00
parent 30812b2479
commit 99ff987dad
8 changed files with 50 additions and 23 deletions

28
setup.py Normal file
View file

@ -0,0 +1,28 @@
import os
from setuptools import setup, find_packages
ROOT = os.path.dirname(__name__)
setup(
name='CommentServer',
version='0.0.1',
packages=find_packages(exclude=('tests',)),
entry_points={
'console_scripts': 'commentserv=src.main:main'
},
zip_safe=False,
data_files=[('config', ['config/conf.json',])],
include_package_data=True,
install_requires=[
'Faker>=1.0.7',
'asyncio>=3.4.3',
'aiohttp==3.5.4',
'aiojobs==0.2.2',
'ecdsa==0.13',
'cryptography==2.5',
'aiosqlite==0.10.0',
'PyNaCl>=1.3.0',
'requests',
'cython', # Not really needed anymore but w/e
]
)

View file

@ -2,8 +2,7 @@ import logging.config
import logging
import os
from src.settings import config
from src.app import run_app
from src.server.app import run_app
def config_logging_from_settings(conf):

0
src/server/__init__.py Normal file
View file

View file

@ -11,8 +11,8 @@ import asyncio
from aiohttp import web
from src.schema.db_helpers import setup_database, backup_database
from src.database import obtain_connection, DatabaseWriter
from src.handles import api_endpoint, get_api_endpoint
from src.server.database import obtain_connection, DatabaseWriter
from src.server.handles import api_endpoint, get_api_endpoint
logger = logging.getLogger(__name__)

View file

@ -6,15 +6,15 @@ import asyncio
from aiohttp import web
from aiojobs.aiohttp import atomic
from src.misc import clean_input_params
from src.database import get_claim_comments
from src.database import get_comments_by_id, get_comment_ids
from src.database import get_channel_id_from_comment_id
from src.database import obtain_connection
from src.misc import is_valid_base_comment
from src.misc import is_valid_credential_input
from src.misc import make_error
from src.writes import delete_comment_if_authorized, write_comment
from src.server.misc import clean_input_params
from src.server.database import get_claim_comments
from src.server.database import get_comments_by_id, get_comment_ids
from src.server.database import get_channel_id_from_comment_id
from src.server.database import obtain_connection
from src.server.misc import is_valid_base_comment
from src.server.misc import is_valid_credential_input
from src.server.misc import make_error
from src.server.writes import delete_comment_if_authorized, write_comment
logger = logging.getLogger(__name__)
@ -25,22 +25,22 @@ def ping(*args):
def handle_get_channel_from_comment_id(app, kwargs: dict):
with obtain_connection(app['db_path']) as conn:
with app['reader'] as conn:
return get_channel_id_from_comment_id(conn, **kwargs)
def handle_get_comment_ids(app, kwargs):
with obtain_connection(app['db_path']) as conn:
with app['reader'] as conn:
return get_comment_ids(conn, **kwargs)
def handle_get_claim_comments(app, kwargs):
with obtain_connection(app['db_path']) as conn:
with app['reader'] as conn:
return get_claim_comments(conn, **kwargs)
def handle_get_comments_by_id(app, kwargs):
with obtain_connection(app['db_path']) as conn:
with app['reader'] as conn:
return get_comments_by_id(conn, **kwargs)

View file

@ -3,13 +3,13 @@ import sqlite3
from asyncio import coroutine
from src.database import delete_comment_by_id
from src.misc import is_authentic_delete_signal
from src.server.database import delete_comment_by_id
from src.server.misc import is_authentic_delete_signal
from src.database import get_comment_or_none
from src.database import insert_comment
from src.database import insert_channel
from src.misc import channel_matches_pattern_or_error
from src.server.database import get_comment_or_none
from src.server.database import insert_comment
from src.server.database import insert_channel
from src.server.misc import channel_matches_pattern_or_error
logger = logging.getLogger(__name__)