use relative imports
This commit is contained in:
parent
be98e94355
commit
d1357bc195
|
@ -5,7 +5,7 @@ from collections import OrderedDict
|
||||||
from functools import update_wrapper
|
from functools import update_wrapper
|
||||||
from hashlib import sha1
|
from hashlib import sha1
|
||||||
|
|
||||||
from . import DotDict
|
from .dotdict import DotDict
|
||||||
|
|
||||||
|
|
||||||
def parse_ttl(ttl):
|
def parse_ttl(ttl):
|
||||||
|
|
|
@ -5,14 +5,18 @@ from dasbus.error import DBusError
|
||||||
from dasbus.identifier import DBusServiceIdentifier
|
from dasbus.identifier import DBusServiceIdentifier
|
||||||
from dasbus.loop import EventLoop
|
from dasbus.loop import EventLoop
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from izzylib import DotDict, Path, logging
|
|
||||||
from pathlib import Path as Pathlib
|
from pathlib import Path as Pathlib
|
||||||
from xml.etree import ElementTree
|
from xml.etree import ElementTree
|
||||||
|
|
||||||
|
from . import izzylog
|
||||||
|
from .dotdict import DotDict
|
||||||
|
from .exceptions import DBusClientError, DBusServerError
|
||||||
|
from .path import Path
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from .template import Template
|
from .template import Template
|
||||||
except ImportError:
|
except ImportError:
|
||||||
logging.verbose('Failed to import IzzyLib.template.Template. HAML templates will not be available')
|
izzylog.verbose('Failed to import IzzyLib.template.Template. HAML templates will not be available')
|
||||||
Template = None
|
Template = None
|
||||||
|
|
||||||
|
|
||||||
|
@ -80,7 +84,7 @@ class DBusClientBase(DBusBase):
|
||||||
if not self.proxy:
|
if not self.proxy:
|
||||||
raise ConnectionError('Not connected')
|
raise ConnectionError('Not connected')
|
||||||
|
|
||||||
logging.debug(f'Running dbus command: {command}, {args}, {kwargs}')
|
izzylog.debug(f'Running dbus command: {command}, {args}, {kwargs}')
|
||||||
|
|
||||||
func = getattr(self.proxy, command)
|
func = getattr(self.proxy, command)
|
||||||
return func(*args, **kwargs)
|
return func(*args, **kwargs)
|
||||||
|
@ -112,7 +116,7 @@ class DBusClientBase(DBusBase):
|
||||||
name = e.attrib['name']
|
name = e.attrib['name']
|
||||||
|
|
||||||
if getattr(self, name, None):
|
if getattr(self, name, None):
|
||||||
logging.verbose('Tried to add an existing method or signal:', name)
|
izzylog.verbose('Tried to add an existing method or signal:', name)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if e.tag == 'method':
|
if e.tag == 'method':
|
||||||
|
@ -131,7 +135,7 @@ class DBusServerBase(DBusBase):
|
||||||
|
|
||||||
if type(xmlfile) in [Path, Pathlib]:
|
if type(xmlfile) in [Path, Pathlib]:
|
||||||
if not Template:
|
if not Template:
|
||||||
raise ServerError('Cannot use Template class since it failed to import')
|
raise DBusServerError('Cannot use Template class since it failed to import')
|
||||||
|
|
||||||
xmlpath = Path(xmlfile)
|
xmlpath = Path(xmlfile)
|
||||||
self.filename = xmlpath.name
|
self.filename = xmlpath.name
|
||||||
|
@ -183,7 +187,7 @@ class DBusJsonClientBase(DBusClientBase):
|
||||||
message = data.get('message')
|
message = data.get('message')
|
||||||
|
|
||||||
if error:
|
if error:
|
||||||
raise ServerError(error)
|
raise DBusServerError(error)
|
||||||
|
|
||||||
return message
|
return message
|
||||||
|
|
||||||
|
@ -207,7 +211,7 @@ class DBusJsonClientBase(DBusClientBase):
|
||||||
setattr(self, name, lambda *args, **kwargs: self.cmd(name, *args, **kwargs))
|
setattr(self, name, lambda *args, **kwargs: self.cmd(name, *args, **kwargs))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
logging.warning('Tried to add an existing method:', name)
|
izzylog.warning('Tried to add an existing method:', name)
|
||||||
|
|
||||||
|
|
||||||
def Introspect(self):
|
def Introspect(self):
|
||||||
|
@ -298,11 +302,3 @@ class DBusSessionJsonServer(DBusJsonServerBase):
|
||||||
class DBusSystemJsonServer(DBusJsonServerBase):
|
class DBusSystemJsonServer(DBusJsonServerBase):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(SystemMessageBus, *args, **kwargs)
|
super().__init__(SystemMessageBus, *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class ClientError(Exception):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class ServerError(Exception):
|
|
||||||
pass
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from . import Path
|
from .path import Path
|
||||||
|
|
||||||
|
|
||||||
class DotDict(dict):
|
class DotDict(dict):
|
||||||
|
|
|
@ -1,2 +1,10 @@
|
||||||
|
class DBusClientError(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class DBusServerError(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class HttpFileDownloadedError(Exception):
|
class HttpFileDownloadedError(Exception):
|
||||||
'raise when a download failed for any reason'
|
'raise when a download failed for any reason'
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import argon2, os
|
import argon2, os
|
||||||
|
|
||||||
from izzylib import time_function_pprint
|
from .misc import time_function_pprint
|
||||||
|
|
||||||
|
|
||||||
class PasswordHasher:
|
class PasswordHasher:
|
||||||
|
|
|
@ -7,10 +7,13 @@ from functools import cached_property
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from ssl import SSLCertVerificationError
|
from ssl import SSLCertVerificationError
|
||||||
from urllib.error import HTTPError
|
from urllib.error import HTTPError
|
||||||
from urllib.parse import urlparse
|
|
||||||
from urllib.request import Request, urlopen
|
from urllib.request import Request, urlopen
|
||||||
|
|
||||||
from . import DefaultDotDict, DotDict, Path, exceptions, izzylog, __version__
|
from . import izzylog, __version__
|
||||||
|
from .dotdict import DefaultDotDict, DotDict
|
||||||
|
from .exceptions import HttpFileDownloadedError
|
||||||
|
from .misc import Url
|
||||||
|
from .path import Path
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
@ -92,10 +95,10 @@ class HttpClient:
|
||||||
resp = self.request(url, *args, stream=True, **kwargs)
|
resp = self.request(url, *args, stream=True, **kwargs)
|
||||||
|
|
||||||
if not resp.headers.get('content-length'):
|
if not resp.headers.get('content-length'):
|
||||||
raise exceptions.HttpFileDownloadedError('File already downloaded fully')
|
raise HttpFileDownloadedError('File already downloaded fully')
|
||||||
|
|
||||||
if resp.status != 200:
|
if resp.status != 200:
|
||||||
raise exceptions.HttpFileDownloadedError(f'Failed to download {url}: {resp.status}, body: {resp.body}')
|
raise HttpFileDownloadedError(f'Failed to download {url}: {resp.status}, body: {resp.body}')
|
||||||
|
|
||||||
with filepath.open('ab') as fd:
|
with filepath.open('ab') as fd:
|
||||||
for chunk in resp.chunks(size):
|
for chunk in resp.chunks(size):
|
||||||
|
@ -119,7 +122,7 @@ class HttpClient:
|
||||||
resp = self.request(url, *args, **kwargs)
|
resp = self.request(url, *args, **kwargs)
|
||||||
|
|
||||||
if resp.status != 200:
|
if resp.status != 200:
|
||||||
raise exceptions.HttpFileDownloadedError(f'Failed to download {url}: {resp.status}, body: {resp.body}')
|
raise HttpFileDownloadedError(f'Failed to download {url}: {resp.status}, body: {resp.body}')
|
||||||
|
|
||||||
if not filename:
|
if not filename:
|
||||||
filename = Path(url).stem
|
filename = Path(url).stem
|
||||||
|
@ -146,7 +149,7 @@ class HttpResponse(object):
|
||||||
self.body = response.read()
|
self.body = response.read()
|
||||||
self.headers = DefaultDotDict({k.lower(): v.lower() for k,v in response.headers.items()})
|
self.headers = DefaultDotDict({k.lower(): v.lower() for k,v in response.headers.items()})
|
||||||
self.status = response.status
|
self.status = response.status
|
||||||
self.url = response.url
|
self.url = Url(response.url)
|
||||||
|
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
from datetime import datetime
|
|
||||||
|
|
||||||
start_time = datetime.now()
|
|
||||||
|
|
||||||
from .application import Application
|
from .application import Application
|
||||||
from .config import Config, UserLevel
|
from .config import Config, UserLevel
|
||||||
from .middleware import MiddlewareBase, Headers, AccessLog
|
from .middleware import MiddlewareBase, Headers, AccessLog
|
||||||
|
|
|
@ -1,19 +1,20 @@
|
||||||
import multiprocessing, sanic, signal, traceback
|
import logging,multiprocessing, sanic, signal, traceback
|
||||||
import logging as pylog
|
|
||||||
|
|
||||||
|
|
||||||
from multidict import CIMultiDict
|
from multidict import CIMultiDict
|
||||||
from multiprocessing import cpu_count, current_process
|
from multiprocessing import cpu_count, current_process
|
||||||
from urllib.parse import parse_qsl, urlparse
|
from urllib.parse import parse_qsl
|
||||||
|
|
||||||
from izzylib import DotDict, Path, izzylog as logging
|
|
||||||
from izzylib.template import Template
|
|
||||||
|
|
||||||
from .config import Config, UserLevel
|
from .config import Config, UserLevel
|
||||||
from .error_handlers import GenericError, MissingTemplateError
|
from .error_handlers import GenericError, MissingTemplateError
|
||||||
from .middleware import AccessLog, Headers
|
from .middleware import AccessLog, Headers
|
||||||
from .view import Manifest, Robots, Style
|
from .view import Manifest, Robots, Style
|
||||||
|
|
||||||
|
from .. import izzylog
|
||||||
|
from ..dotdict import DotDict
|
||||||
|
from ..path import Path
|
||||||
|
from ..template import Template
|
||||||
|
|
||||||
|
|
||||||
log_path_ignore = [
|
log_path_ignore = [
|
||||||
'/media',
|
'/media',
|
||||||
|
@ -39,7 +40,7 @@ class Application(sanic.Sanic):
|
||||||
super().__init__(self.cfg.name, request_class=self.cfg.request_class)
|
super().__init__(self.cfg.name, request_class=self.cfg.request_class)
|
||||||
|
|
||||||
for log in ['sanic.root', 'sanic.access']:
|
for log in ['sanic.root', 'sanic.access']:
|
||||||
pylog.getLogger(log).setLevel(pylog.WARNING)
|
logging.getLogger(log).setLevel(logging.WARNING)
|
||||||
|
|
||||||
self.template = Template(
|
self.template = Template(
|
||||||
self.cfg.tpl_search,
|
self.cfg.tpl_search,
|
||||||
|
@ -153,7 +154,7 @@ class Application(sanic.Sanic):
|
||||||
if self.cfg.workers > 1:
|
if self.cfg.workers > 1:
|
||||||
msg += f' with {self.cfg.workers} workers'
|
msg += f' with {self.cfg.workers} workers'
|
||||||
|
|
||||||
logging.info(msg)
|
izzylog.info(msg)
|
||||||
super().run(
|
super().run(
|
||||||
host = self.cfg.listen,
|
host = self.cfg.listen,
|
||||||
port = self.cfg.port,
|
port = self.cfg.port,
|
||||||
|
@ -168,7 +169,7 @@ class Application(sanic.Sanic):
|
||||||
self.cfg.sig_handler(*self.cfg.sig_handler_args, **self.cfg.sig_handler_kwargs)
|
self.cfg.sig_handler(*self.cfg.sig_handler_args, **self.cfg.sig_handler_kwargs)
|
||||||
|
|
||||||
self.stop()
|
self.stop()
|
||||||
logging.info('Bye! :3')
|
izzylog.info('Bye! :3')
|
||||||
|
|
||||||
|
|
||||||
def parse_level(level):
|
def parse_level(level):
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
from enum import IntEnum
|
from enum import IntEnum
|
||||||
from izzylib import DotDict
|
|
||||||
from multiprocessing import cpu_count
|
from multiprocessing import cpu_count
|
||||||
|
|
||||||
from .request import Request
|
from .request import Request
|
||||||
from .response import Response
|
from .response import Response
|
||||||
|
|
||||||
|
from ..dotdict import DotDict
|
||||||
|
|
||||||
|
|
||||||
class UserLevel(IntEnum):
|
class UserLevel(IntEnum):
|
||||||
GUEST = 0
|
GUEST = 0
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from izzylib import izzylog as logging
|
|
||||||
from jinja2.exceptions import TemplateNotFound
|
from jinja2.exceptions import TemplateNotFound
|
||||||
|
|
||||||
from .response import Response
|
from .response import Response
|
||||||
|
|
||||||
|
from .. import izzylog
|
||||||
|
|
||||||
|
|
||||||
class GenericError:
|
class GenericError:
|
||||||
error = Exception
|
error = Exception
|
||||||
|
@ -45,5 +46,5 @@ class MissingTemplateError(GenericError):
|
||||||
|
|
||||||
|
|
||||||
def handler(self, request, response, exception):
|
def handler(self, request, response, exception):
|
||||||
logging.error('TEMPLATE_ERROR:', f'{exception.__class__.__name__}: {str(exception)}')
|
izzylog.error('TEMPLATE_ERROR:', f'{exception.__class__.__name__}: {str(exception)}')
|
||||||
return response.error('I\'m a dingleberry and forgot to create a template for this page', 500)
|
return response.error('I\'m a dingleberry and forgot to create a template for this page', 500)
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
|
|
||||||
from datetime import datetime, timedelta, timezone
|
from datetime import datetime, timedelta, timezone
|
||||||
from izzylib import izzylog as logging, logging as applog
|
|
||||||
|
|
||||||
from . import start_time
|
|
||||||
from .response import Response
|
from .response import Response
|
||||||
|
|
||||||
|
from .. import logging
|
||||||
|
|
||||||
|
|
||||||
cache_types = [
|
cache_types = [
|
||||||
'text/css',
|
'text/css',
|
||||||
|
@ -79,4 +79,4 @@ class AccessLog(MiddlewareBase):
|
||||||
async def handler(self, request, response):
|
async def handler(self, request, response):
|
||||||
uagent = request.headers.get('user-agent', 'None')
|
uagent = request.headers.get('user-agent', 'None')
|
||||||
|
|
||||||
applog.info(f'({multiprocessing.current_process().name}) {request.address} {request.method} {request.path} {response.status} "{uagent}"')
|
logging.info(f'({multiprocessing.current_process().name}) {request.address} {request.method} {request.path} {response.status} "{uagent}"')
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from izzylib import LowerDotDict
|
from ..dotdict import LowerDotDict
|
||||||
|
|
||||||
|
|
||||||
def ReplaceHeader(headers, key, value):
|
def ReplaceHeader(headers, key, value):
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
import sanic
|
import sanic
|
||||||
|
|
||||||
from functools import cached_property
|
from functools import cached_property
|
||||||
from izzylib import DotDict
|
|
||||||
from urllib.parse import parse_qsl
|
from urllib.parse import parse_qsl
|
||||||
|
|
||||||
from .misc import Headers
|
from .misc import Headers
|
||||||
|
|
||||||
|
from ..dotdict import DotDict
|
||||||
|
|
||||||
|
|
||||||
class Request(sanic.request.Request):
|
class Request(sanic.request.Request):
|
||||||
_extra = DotDict()
|
_extra = DotDict()
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
import json, sanic
|
import json, sanic
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from izzylib import DotDict, izzylog
|
|
||||||
from izzylib.template import Color
|
|
||||||
from sanic.compat import Header
|
from sanic.compat import Header
|
||||||
from sanic.cookies import CookieJar
|
from sanic.cookies import CookieJar
|
||||||
from sanic.response import text as Raw
|
from sanic.response import text as Raw
|
||||||
|
|
||||||
|
from .. import izzylog
|
||||||
|
from ..dotdict import DotDict
|
||||||
|
from ..template import Color
|
||||||
|
|
||||||
|
|
||||||
class Response:
|
class Response:
|
||||||
content_types = DotDict({
|
content_types = DotDict({
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
from izzylib.template import Color
|
|
||||||
from sanic.views import HTTPMethodView
|
from sanic.views import HTTPMethodView
|
||||||
|
|
||||||
from .response import Response
|
from .response import Response
|
||||||
|
|
||||||
|
from ..template import Color
|
||||||
|
|
||||||
|
|
||||||
class View(HTTPMethodView):
|
class View(HTTPMethodView):
|
||||||
routes = []
|
routes = []
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
import json, requests, sys
|
import json, sys
|
||||||
|
|
||||||
from PIL import Image
|
|
||||||
|
|
||||||
from Crypto.Hash import SHA256
|
from Crypto.Hash import SHA256
|
||||||
from Crypto.PublicKey import RSA
|
from Crypto.PublicKey import RSA
|
||||||
|
@ -8,10 +6,11 @@ from Crypto.Signature import PKCS1_v1_5
|
||||||
from base64 import b64decode, b64encode
|
from base64 import b64decode, b64encode
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from functools import lru_cache
|
from functools import lru_cache
|
||||||
from izzylib import DefaultDotDict, DotDict
|
|
||||||
from izzylib import izzylog
|
|
||||||
from tldextract import extract
|
from tldextract import extract
|
||||||
from urllib.parse import urlparse
|
|
||||||
|
from . import izzylog
|
||||||
|
from .dotdict import DefaultDotDict, DotDict
|
||||||
|
from .misc import Url
|
||||||
|
|
||||||
|
|
||||||
def generate_rsa_key():
|
def generate_rsa_key():
|
||||||
|
@ -36,7 +35,7 @@ def parse_signature(signature: str):
|
||||||
sig[key.lower()] = value.replace('"', '')
|
sig[key.lower()] = value.replace('"', '')
|
||||||
|
|
||||||
sig.headers = sig.headers.split()
|
sig.headers = sig.headers.split()
|
||||||
sig.domain = urlparse(sig.keyid).netloc
|
sig.domain = Url(sig.keyid).host
|
||||||
sig.top_domain = '.'.join(extract(sig.domain)[1:])
|
sig.top_domain = '.'.join(extract(sig.domain)[1:])
|
||||||
sig.actor = sig.keyid.split('#')[0]
|
sig.actor = sig.keyid.split('#')[0]
|
||||||
|
|
||||||
|
|
|
@ -6,14 +6,17 @@ from base64 import b64encode
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from functools import cached_property, lru_cache
|
from functools import cached_property, lru_cache
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from izzylib import DefaultDotDict, DotDict, LowerDotDict, Path, izzylog as logging, __version__
|
|
||||||
from izzylib.exceptions import HttpFileDownloadedError
|
|
||||||
from ssl import SSLCertVerificationError
|
from ssl import SSLCertVerificationError
|
||||||
from urllib.parse import urlparse
|
|
||||||
|
|
||||||
from .request import HttpUrllibRequest
|
from .request import HttpUrllibRequest
|
||||||
from .response import HttpUrllibResponse
|
from .response import HttpUrllibResponse
|
||||||
|
|
||||||
|
from .. import __version__
|
||||||
|
from ..dotdict import DefaultDotDict, DotDict, LowerDotDict
|
||||||
|
from ..exceptions import HttpFileDownloadedError
|
||||||
|
from ..misc import Url
|
||||||
|
from ..path import Path
|
||||||
|
|
||||||
|
|
||||||
Client = None
|
Client = None
|
||||||
|
|
||||||
|
@ -145,7 +148,7 @@ def fetch_actor(url):
|
||||||
izzylog.debug(f'HTTP {resp.status}: {resp.body}')
|
izzylog.debug(f'HTTP {resp.status}: {resp.body}')
|
||||||
raise e from None
|
raise e from None
|
||||||
|
|
||||||
actor.web_domain = urlparse(url).netloc
|
actor.web_domain = Url(url).host
|
||||||
actor.shared_inbox = actor.inbox
|
actor.shared_inbox = actor.inbox
|
||||||
actor.pubkey = None
|
actor.pubkey = None
|
||||||
actor.handle = actor.preferredUsername
|
actor.handle = actor.preferredUsername
|
||||||
|
|
|
@ -2,7 +2,6 @@ import json, pkgutil, sys, threading, time
|
||||||
|
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from izzylib import LruCache, DotDict, Path, nfs_check, izzylog
|
|
||||||
from sqlalchemy import Table, create_engine
|
from sqlalchemy import Table, create_engine
|
||||||
from sqlalchemy.exc import OperationalError, ProgrammingError
|
from sqlalchemy.exc import OperationalError, ProgrammingError
|
||||||
from sqlalchemy.engine import URL
|
from sqlalchemy.engine import URL
|
||||||
|
@ -11,6 +10,11 @@ from sqlalchemy.schema import MetaData
|
||||||
from .rows import RowClasses
|
from .rows import RowClasses
|
||||||
from .session import Session
|
from .session import Session
|
||||||
|
|
||||||
|
from .. import izzylog
|
||||||
|
from ..cache import LruCache
|
||||||
|
from ..dotdict import DotDict
|
||||||
|
from ..misc import nfs_check
|
||||||
|
|
||||||
|
|
||||||
modules = dict(
|
modules = dict(
|
||||||
postgresql = ['pygresql', 'pg8000', 'psycopg2', 'psycopg3']
|
postgresql = ['pygresql', 'pg8000', 'psycopg2', 'psycopg3']
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
from izzylib import DotDict, random_gen, izzylog
|
|
||||||
from sqlalchemy import text
|
from sqlalchemy import text
|
||||||
from sqlalchemy.orm import sessionmaker
|
from sqlalchemy.orm import sessionmaker
|
||||||
from sqlalchemy.orm.session import Session as sqlalchemy_session
|
from sqlalchemy.orm.session import Session as sqlalchemy_session
|
||||||
|
|
||||||
|
from .. import izzylog
|
||||||
|
from ..dotdict import DotDict
|
||||||
|
from ..misc import random_gen
|
||||||
|
|
||||||
|
|
||||||
class Session(sqlalchemy_session):
|
class Session(sqlalchemy_session):
|
||||||
def __init__(self, db, trans=False):
|
def __init__(self, db, trans=False):
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
import asyncio, json, socket, sqlite3, ssl, time, traceback
|
import asyncio, json, socket, sqlite3, ssl, time, traceback
|
||||||
|
|
||||||
from izzylib import DotDict, JsonEncoder, Path, izzylog
|
from .database import Database
|
||||||
|
from .rows import RowClasses
|
||||||
|
|
||||||
from . import CustomRows, SqlDatabase
|
from .. import izzylib
|
||||||
|
from ..dotdict import DotDict, JsonEncoder
|
||||||
|
from ..path import Path
|
||||||
|
|
||||||
|
|
||||||
commands = [
|
commands = [
|
||||||
|
@ -22,7 +25,7 @@ class SqliteClient(object):
|
||||||
})
|
})
|
||||||
|
|
||||||
self.session_class = session_class or SqliteSession
|
self.session_class = session_class or SqliteSession
|
||||||
self.classes = CustomRows()
|
self.classes = RowClasses()
|
||||||
|
|
||||||
self._setup()
|
self._setup()
|
||||||
|
|
||||||
|
@ -183,7 +186,7 @@ class SqliteServer(DotDict):
|
||||||
|
|
||||||
|
|
||||||
def open(self, database, new=False):
|
def open(self, database, new=False):
|
||||||
db = SqlDatabase(dbtype='sqlite', database=self.path.join(database + '.sqlite3'))
|
db = Database(dbtype='sqlite', database=self.path.join(database + '.sqlite3'))
|
||||||
|
|
||||||
if database != 'metadata' and not new:
|
if database != 'metadata' and not new:
|
||||||
with self.get_database('metadata').session() as s:
|
with self.get_database('metadata').session() as s:
|
||||||
|
|
|
@ -3,12 +3,15 @@ import codecs, traceback, os, json, xml
|
||||||
from colour import Color as Colour
|
from colour import Color as Colour
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from hamlish_jinja import HamlishExtension
|
from hamlish_jinja import HamlishExtension
|
||||||
from izzylib import izzylog, DotDict, Path
|
|
||||||
from jinja2 import Environment, FileSystemLoader, ChoiceLoader, select_autoescape, Markup
|
from jinja2 import Environment, FileSystemLoader, ChoiceLoader, select_autoescape, Markup
|
||||||
from os import listdir, makedirs
|
from os import listdir, makedirs
|
||||||
from os.path import isfile, isdir, getmtime, abspath
|
from os.path import isfile, isdir, getmtime, abspath
|
||||||
from xml.dom import minidom
|
from xml.dom import minidom
|
||||||
|
|
||||||
|
from . import izzylog
|
||||||
|
from .dotdict import DotDict
|
||||||
|
from .path import Path
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from sanic import response as Response
|
from sanic import response as Response
|
||||||
|
|
||||||
|
|
|
@ -48,10 +48,10 @@ http_server =
|
||||||
envbash == 1.2.0
|
envbash == 1.2.0
|
||||||
http_signatures =
|
http_signatures =
|
||||||
pycryptodome == 3.10.1
|
pycryptodome == 3.10.1
|
||||||
|
tldextract == 3.1.2
|
||||||
http_urllib_client =
|
http_urllib_client =
|
||||||
pillow == 8.3.2
|
pillow == 8.3.2
|
||||||
urllib3 == 1.26.6
|
urllib3 == 1.26.6
|
||||||
tldextract == 3.1.2
|
|
||||||
sql =
|
sql =
|
||||||
SQLAlchemy == 1.4.23
|
SQLAlchemy == 1.4.23
|
||||||
SQLAlchemy-Paginator == 0.2
|
SQLAlchemy-Paginator == 0.2
|
||||||
|
|
Loading…
Reference in a new issue