Skip to content

Commit

Permalink
Merge branch 'release/1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Very1Fake committed Oct 21, 2020
2 parents 767f371 + 19aba8b commit 727ec14
Show file tree
Hide file tree
Showing 17 changed files with 509 additions and 236 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
cache/
logs/
storage/
scripts/
reports/


Expand Down
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

8 changes: 5 additions & 3 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ event_handler:
tick: 0.1
wait: 3.0
logger:
content: 2
level: 4
message_content: 2
mode: 1
utc_time: true
main:
logs_path: logs
production: false
Expand Down Expand Up @@ -53,17 +52,20 @@ priority:
provider:
max_bad: 25
proxy_timeout: 3.0
test_url: http://google.com/
test_url: http://ip-api.com/json?fields=2154502
queues:
catalog_queue_put_wait: 8.0
catalog_queue_size: 256
target_queue_put_wait: 8.0
target_queue_size: 512
sub_provider:
comp_type: gzip, deflate, br
compression: false
connect_timeout: 1.0
max_redirects: 5
max_retries: 3
read_timeout: 2.0
verify: false
thread_manager:
lock_ticks: 16
tick: 1.0
Expand Down
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ urllib3==1.25.10
termcolor==1.1.0
requests==2.24.0
packaging==20.4
ujson==3.2.0
ujson==4.0.1
uctp==1.0.0a6.dev1
checksumdir==1.2.0
pycryptodome==3.9.8
PyYAML==5.3.1
PyYAML==5.3.1
tomlkit==0.7.0
1 change: 0 additions & 1 deletion scripts
Submodule scripts deleted from 54ef66
4 changes: 2 additions & 2 deletions source/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
__copyright__ = "Copyright (c) 2020 Sellars"
__credits__ = ["very1fake"]

__license__ = "All Right Reserved"
__version__ = "0.9.1"
__license__ = "All Rights Reserved"
__version__ = "1.0"
__maintainer__ = "very1fake"

version = Version(__version__)
8 changes: 4 additions & 4 deletions source/analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import ujson

from . import storage, core, __version__
from .tools import ReportStorage


class Analytics:
Expand Down Expand Up @@ -147,8 +148,7 @@ def dump(cls, type_: int = 1) -> None:
elif type_ == 2:
suffix = 'final_'

ujson.dump(cls.snapshot(type_), open(
storage.analytics.path + f'/report_{suffix}'
f'{datetime.utcnow().strftime("%Y-%m-%d_%H:%M:%S")}.json',
ujson.dump(cls.snapshot(type_), ReportStorage().file(
f'/report_{suffix}_{datetime.utcnow().strftime("%Y-%m-%d_%H:%M:%S")}.json',
'w+'
), indent=2 if storage.analytics.beautify else None)
), indent=2 if storage.analytics.beautify else 0)
3 changes: 2 additions & 1 deletion source/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

from . import codes
from . import logger
from .library import Interval, Scheduled, Smart, SubProvider, ScriptStorage
from .library import Interval, Scheduled, Smart, SubProvider
from .tools import ScriptStorage

# Constants

Expand Down
6 changes: 3 additions & 3 deletions source/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import ujson

from . import storage
from . import tools
from .api import Size, Sizes, Item, ItemType
from .tools import get_time, CacheStorage


class UniquenessError(Exception):
Expand Down Expand Up @@ -105,7 +105,7 @@ def dump(cls) -> None:
"""
with cls._lock, cls.__db as c:
check()
f = open(f'{storage.cache.path}/hash_{tools.get_time(name=True)}.sql', 'w+')
f = CacheStorage().file(f'hash_{get_time(name=True)}.sql', 'w+')
for i in c.iterdump():
f.write(i + '\n')
f.flush()
Expand All @@ -119,7 +119,7 @@ def backup(cls) -> None:
"""
with cls._lock, cls.__db as c:
check()
c.backup(sqlite3.connect(f'{storage.cache.path}/hash_{tools.get_time(name=True)}.db.backup'))
c.backup(sqlite3.connect(f'{storage.cache.path}/hash_{get_time(name=True)}.db.backup'))

@classmethod
def delete(cls, table: str) -> None:
Expand Down
22 changes: 22 additions & 0 deletions source/codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,16 @@
21202: 'Checking proxy',
21203: 'Checking proxy (OK)',

# Keywords (215xx)
21501: 'Dumping keywords(started)',
21502: 'Dumping keywords(complete)',
21503: 'Clearing keywords(started)',
21504: 'Clearing keywords(complete)',
21505: 'Syncing keywords(started)',
21506: 'Syncing keywords(complete)',
21507: 'Loading keywords(started)',
21508: 'Loading keywords(complete)',

# Warning (3xxxx)
# System (300xx)
30000: 'Test warning',
Expand Down Expand Up @@ -150,6 +160,15 @@
31204: 'Proxies statistics reset',
31205: 'Proxies list cleared',

# Keywords (315xx)
31501: 'Keywords file not found',
31511: 'Absolute keyword not loaded (TypeError)',
31512: 'Absolute keyword not loaded (UniquenessError)',
31521: 'Positive keyword not loaded (TypeError)',
31522: 'Positive keyword not loaded (UniquenessError)',
31531: 'Negative keyword not loaded (TypeError)',
31532: 'Negative keyword not loaded (UniquenessError)',

# Error (4xxxx)
# System (400xx)
40000: 'Unknown error',
Expand Down Expand Up @@ -195,6 +214,9 @@
# SubProvider (413xx)
41301: 'Severe exception while sending request',

# Keywords (415xx)
41501: 'Loading keywords (Failed)',

# Fatal (5xxxx)
# System (500xx)
50000: 'Test fatal',
Expand Down
Loading

0 comments on commit 727ec14

Please sign in to comment.