MetaList 0.1.7__tar.gz → 0.1.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of MetaList might be problematic. Click here for more details.
- {MetaList-0.1.7 → MetaList-0.1.8/MetaList.egg-info}/PKG-INFO +2 -1
- {MetaList-0.1.7 → MetaList-0.1.8}/MetaList.egg-info/requires.txt +1 -0
- {MetaList-0.1.7/MetaList.egg-info → MetaList-0.1.8}/PKG-INFO +2 -1
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/app.py +10 -9
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/utils/crud.py +2 -2
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/utils/decorate_single_item.py +2 -2
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/utils/initialize.py +3 -3
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/utils/ontology.py +4 -4
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/utils/search_filters.py +5 -9
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/utils/search_index.py +4 -4
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/utils/search_suggestions.py +6 -7
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/utils/server.py +10 -11
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/utils/snapshots.py +12 -12
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/utils/tags_suggestions.py +4 -4
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/utils/update_multiple_items.py +5 -5
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/utils/update_single_item.py +2 -2
- {MetaList-0.1.7 → MetaList-0.1.8}/setup.py +1 -1
- {MetaList-0.1.7 → MetaList-0.1.8}/LICENSE +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/MetaList.egg-info/SOURCES.txt +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/MetaList.egg-info/dependency_links.txt +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/MetaList.egg-info/entry_points.txt +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/MetaList.egg-info/top_level.txt +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/README.md +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/__init__.py +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/config.py +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/css/app.css +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/css/components/chat-ui.css +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/css/components/items-list.css +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/css/components/search-bar.css +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/css/components/suggestions-list.css +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/css/components/tags-bar.css +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/css/dark-theme.css +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/css/reserved-tags.css +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/css/unreset.css +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/html/index.html +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/img/caret-down-filled.svg +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/img/caret-right-filled.svg +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/img/chat-left-svgrepo-com.svg +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/img/checkbox-checked.svg +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/img/checkbox-unchecked.svg +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/img/favicon.ico +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/img/search.svg +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/img/tag.svg +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/js/app-state.js +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/js/components/chat-ui.js +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/js/components/items-list.js +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/js/components/search-bar.js +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/js/components/suggestions-list.js +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/js/components/tags-bar.js +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/js/config.js +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/js/misc/item-formatter.js +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/js/misc/logging.js +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/js/misc/parsing.js +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/js/misc/scrolling.js +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/js/misc/server-proxy.js +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/js/misc/vdom.js +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/js/pub-sub-events.js +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/libs/PubSubJS/LICENSE.md +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/libs/PubSubJS/pubsub.js +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/libs/katex/LICENSE +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/libs/katex/contrib/auto-render.min.js +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/libs/katex/contrib/copy-tex.min.css +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/libs/katex/contrib/copy-tex.min.js +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/libs/katex/contrib/mathtex-script-type.min.js +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/libs/katex/katex.min.css +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/libs/katex/katex.min.js +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/libs/lodash/LICENSE +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/libs/lodash/lodash.js +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/libs/markdown-it/LICENSE +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/libs/markdown-it/markdown-it.min.js +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/libs/micronitjs/LICENSE +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/libs/micronitjs/micronit.js +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/libs/the-new-css-reset/LICENSE +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/libs/the-new-css-reset/reset.css +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/libs/voca/LICENSE.md +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/libs/voca/voca.min.js +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/tests/unit-tests/run-tests.html +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/tests/unit-tests/test-search-bar.js +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/utils/__init__.py +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/utils/chat_prompts.py +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/utils/find.py +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/utils/generate.py +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/utils/misc/__init__.py +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/utils/misc/crypto-test.py +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/metalist/utils/reporting.py +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/setup.cfg +0 -0
- {MetaList-0.1.7 → MetaList-0.1.8}/tests/test_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: MetaList
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.8
|
|
4
4
|
Summary: A PKM web app integrated with LLMs
|
|
5
5
|
Home-page: https://github.com/evolvingstuff/MetaList
|
|
6
6
|
Author: Thomas Lahore
|
|
@@ -14,6 +14,7 @@ License-File: LICENSE
|
|
|
14
14
|
Requires-Dist: bottle==0.12.25
|
|
15
15
|
Requires-Dist: bottle-sqlite==0.2.0
|
|
16
16
|
Requires-Dist: beautifulsoup4~=4.12.2
|
|
17
|
+
Requires-Dist: requests==2.31.0
|
|
17
18
|
Requires-Dist: tqdm==4.66.1
|
|
18
19
|
|
|
19
20
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: MetaList
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.8
|
|
4
4
|
Summary: A PKM web app integrated with LLMs
|
|
5
5
|
Home-page: https://github.com/evolvingstuff/MetaList
|
|
6
6
|
Author: Thomas Lahore
|
|
@@ -14,6 +14,7 @@ License-File: LICENSE
|
|
|
14
14
|
Requires-Dist: bottle==0.12.25
|
|
15
15
|
Requires-Dist: bottle-sqlite==0.2.0
|
|
16
16
|
Requires-Dist: beautifulsoup4~=4.12.2
|
|
17
|
+
Requires-Dist: requests==2.31.0
|
|
17
18
|
Requires-Dist: tqdm==4.66.1
|
|
18
19
|
|
|
19
20
|
|
|
@@ -3,7 +3,8 @@ from typing import List
|
|
|
3
3
|
from bottle import Bottle, run, static_file, request, response
|
|
4
4
|
import bottle_sqlite
|
|
5
5
|
import requests
|
|
6
|
-
|
|
6
|
+
|
|
7
|
+
from metalist import config
|
|
7
8
|
from metalist.utils.chat_prompts import build_initial_prompts, build_selection_prompt
|
|
8
9
|
from metalist.utils.crud import get_database_path
|
|
9
10
|
from metalist.utils.search_suggestions import calculate_search_suggestions
|
|
@@ -27,10 +28,10 @@ app.install(plugin)
|
|
|
27
28
|
|
|
28
29
|
|
|
29
30
|
def run_app():
|
|
30
|
-
if development_mode:
|
|
31
|
-
print('
|
|
31
|
+
if config.development_mode:
|
|
32
|
+
print('config.development_mode = True')
|
|
32
33
|
initialize_cache(cache)
|
|
33
|
-
run(app, port=port, debug=False)
|
|
34
|
+
run(app, port=config.port, debug=False)
|
|
34
35
|
|
|
35
36
|
|
|
36
37
|
@app.route("/tests/<filepath:path>", method="GET")
|
|
@@ -352,7 +353,7 @@ def search(db):
|
|
|
352
353
|
# TODO why recreate context?
|
|
353
354
|
context = Context(context.app_state, search_text=context.search_text, search_filter=context.search_filter)
|
|
354
355
|
filtered_items, reached_scroll_end = filter_and_sort_items(cache, context, updated_search=True, dirty_ranking=True)
|
|
355
|
-
if reset_undo_stack_on_search:
|
|
356
|
+
if config.reset_undo_stack_on_search:
|
|
356
357
|
snapshots.reset()
|
|
357
358
|
else:
|
|
358
359
|
crud.rollback()
|
|
@@ -605,7 +606,7 @@ def chat_send_message(db):
|
|
|
605
606
|
|
|
606
607
|
# Prepare the payload for the OpenAI API
|
|
607
608
|
data = {
|
|
608
|
-
"model": open_ai_model,
|
|
609
|
+
"model": config.open_ai_model,
|
|
609
610
|
"messages": chat_history
|
|
610
611
|
}
|
|
611
612
|
headers = {
|
|
@@ -614,7 +615,7 @@ def chat_send_message(db):
|
|
|
614
615
|
}
|
|
615
616
|
|
|
616
617
|
# Make a synchronous POST request to the OpenAI Chat API # TODO FastAPI
|
|
617
|
-
openai_response = requests.post(open_ai_url, json=data, headers=headers)
|
|
618
|
+
openai_response = requests.post(config.open_ai_url, json=data, headers=headers)
|
|
618
619
|
|
|
619
620
|
# Check if the request was successful and process the response
|
|
620
621
|
if openai_response.status_code == 200:
|
|
@@ -631,6 +632,6 @@ def chat_send_message(db):
|
|
|
631
632
|
|
|
632
633
|
|
|
633
634
|
if __name__ == '__main__':
|
|
634
|
-
|
|
635
|
-
development_mode = True
|
|
635
|
+
print('setting config.development_mode = True')
|
|
636
|
+
config.development_mode = True
|
|
636
637
|
run_app()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import os
|
|
3
|
-
from metalist
|
|
3
|
+
from metalist import config
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
def clean_item(item):
|
|
@@ -13,7 +13,7 @@ def clean_item(item):
|
|
|
13
13
|
|
|
14
14
|
def get_database_path():
|
|
15
15
|
home_dir = os.path.expanduser("~")
|
|
16
|
-
database_path = os.path.join(home_dir, db_dir, db_name)
|
|
16
|
+
database_path = os.path.join(home_dir, config.db_dir, config.db_name)
|
|
17
17
|
os.makedirs(os.path.dirname(database_path), exist_ok=True)
|
|
18
18
|
return database_path
|
|
19
19
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import re
|
|
2
2
|
import json
|
|
3
3
|
import hashlib
|
|
4
|
-
from metalist
|
|
4
|
+
from metalist import config
|
|
5
5
|
from metalist.utils.search_filters import filter_subitem_negative, filter_subitem_positive
|
|
6
6
|
from metalist.utils.generate import generate_timestamp
|
|
7
7
|
|
|
@@ -79,7 +79,7 @@ def decorate_item(item, cache, dirty_edit=True, dirty_text=True, dirty_tags=True
|
|
|
79
79
|
if tag not in subitem['_tags']:
|
|
80
80
|
subitem['_tags'].append(tag)
|
|
81
81
|
if dirty_text:
|
|
82
|
-
if inherit_text:
|
|
82
|
+
if config.inherit_text:
|
|
83
83
|
subitem['_searchable_text_full'] += ' ' + parent['_searchable_text']
|
|
84
84
|
|
|
85
85
|
parent_stack.append(subitem)
|
|
@@ -4,7 +4,7 @@ import os
|
|
|
4
4
|
import sqlite3
|
|
5
5
|
import time
|
|
6
6
|
import tqdm
|
|
7
|
-
from metalist
|
|
7
|
+
from metalist import config
|
|
8
8
|
from metalist.utils.crud import get_database_path
|
|
9
9
|
from metalist.utils.decorate_single_item import decorate_item
|
|
10
10
|
from metalist.utils.ontology import *
|
|
@@ -31,7 +31,7 @@ def initialize_cache(cache):
|
|
|
31
31
|
db = sqlite3.connect(db_path)
|
|
32
32
|
sql = 'CREATE TABLE IF NOT EXISTS items (id INTEGER PRIMARY KEY, value TEXT NOT NULL);'
|
|
33
33
|
db.execute(sql)
|
|
34
|
-
if development_mode:
|
|
34
|
+
if config.development_mode:
|
|
35
35
|
print('created new items table for empty database')
|
|
36
36
|
else:
|
|
37
37
|
db = sqlite3.connect(db_path)
|
|
@@ -49,6 +49,6 @@ def initialize_cache(cache):
|
|
|
49
49
|
cache['hash_to_item'][item['_hash']] = copy.deepcopy(item)
|
|
50
50
|
cache['search_index'].add_item(item)
|
|
51
51
|
t2 = time.time()
|
|
52
|
-
if development_mode:
|
|
52
|
+
if config.development_mode:
|
|
53
53
|
print(f'warmed up {len(rows)} items in {((t2-t1)*1000):.2f} ms')
|
|
54
54
|
cache['search_index'].show()
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from metalist
|
|
1
|
+
from metalist import config
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
def extract_ontology(cache, item):
|
|
@@ -18,7 +18,7 @@ def extract_ontology(cache, item):
|
|
|
18
18
|
parts = line.split(' ')
|
|
19
19
|
if '=' in parts:
|
|
20
20
|
if '=>' in parts:
|
|
21
|
-
if development_mode:
|
|
21
|
+
if config.development_mode:
|
|
22
22
|
print(f'weird rule (skipping): {parts}')
|
|
23
23
|
continue
|
|
24
24
|
indx = parts.index('=')
|
|
@@ -35,7 +35,7 @@ def extract_ontology(cache, item):
|
|
|
35
35
|
cache['ontology'][left].add(right)
|
|
36
36
|
elif '=>' in parts:
|
|
37
37
|
if '=' in parts:
|
|
38
|
-
if development_mode:
|
|
38
|
+
if config.development_mode:
|
|
39
39
|
print(f'weird rule (skipping): {parts}')
|
|
40
40
|
continue
|
|
41
41
|
indx = parts.index('=>')
|
|
@@ -68,7 +68,7 @@ def propagate_implications(cache):
|
|
|
68
68
|
if new_implications:
|
|
69
69
|
implications[tag].update(new_implications)
|
|
70
70
|
new_implications_added = True
|
|
71
|
-
if development_mode:
|
|
71
|
+
if config.development_mode:
|
|
72
72
|
print(f'ontology calculated in {total_passes} passes')
|
|
73
73
|
cache['implications'] = implications
|
|
74
74
|
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
from metalist
|
|
2
|
-
use_partial_tag_matches_negative, \
|
|
3
|
-
use_partial_text_matches_negative, \
|
|
4
|
-
use_partial_tag_matches_positive, \
|
|
5
|
-
use_partial_text_matches_positive
|
|
1
|
+
from metalist import config
|
|
6
2
|
|
|
7
3
|
|
|
8
4
|
def filter_subitem_negative(subitem, search_filter: str) -> bool:
|
|
@@ -15,7 +11,7 @@ def filter_subitem_negative(subitem, search_filter: str) -> bool:
|
|
|
15
11
|
if search_filter['negated_partial_tag'] is not None:
|
|
16
12
|
# TODO: apply use_partial_tag_matches logic
|
|
17
13
|
for subitem_tag in subitem_tags:
|
|
18
|
-
if use_partial_tag_matches_negative:
|
|
14
|
+
if config.use_partial_tag_matches_negative:
|
|
19
15
|
if subitem_tag.lower().startswith(search_filter['negated_partial_tag'].lower()):
|
|
20
16
|
return True
|
|
21
17
|
else:
|
|
@@ -24,7 +20,7 @@ def filter_subitem_negative(subitem, search_filter: str) -> bool:
|
|
|
24
20
|
for negated_text in search_filter['negated_texts']:
|
|
25
21
|
if negated_text.lower() in subitem_text:
|
|
26
22
|
return True
|
|
27
|
-
if use_partial_text_matches_negative and \
|
|
23
|
+
if config.use_partial_text_matches_negative and \
|
|
28
24
|
search_filter['negated_partial_text'] is not None and \
|
|
29
25
|
search_filter['negated_partial_text'].lower() in subitem_text:
|
|
30
26
|
return True
|
|
@@ -41,7 +37,7 @@ def filter_subitem_positive(subitem, search_filter: str) -> bool:
|
|
|
41
37
|
if search_filter['partial_tag'] is not None:
|
|
42
38
|
one_match = False
|
|
43
39
|
for subitem_tag in subitem_tags:
|
|
44
|
-
if use_partial_tag_matches_positive:
|
|
40
|
+
if config.use_partial_tag_matches_positive:
|
|
45
41
|
if subitem_tag.lower().startswith(search_filter['partial_tag'].lower()):
|
|
46
42
|
one_match = True
|
|
47
43
|
break
|
|
@@ -54,7 +50,7 @@ def filter_subitem_positive(subitem, search_filter: str) -> bool:
|
|
|
54
50
|
for required_text in search_filter['texts']:
|
|
55
51
|
if required_text.lower() not in subitem_text:
|
|
56
52
|
return False
|
|
57
|
-
if use_partial_text_matches_positive and \
|
|
53
|
+
if config.use_partial_text_matches_positive and \
|
|
58
54
|
search_filter['partial_text'] is not None and \
|
|
59
55
|
search_filter['partial_text'].lower() not in subitem_text:
|
|
60
56
|
return False
|
|
@@ -38,23 +38,23 @@ class SearchIndex:
|
|
|
38
38
|
full_match_item_ids = set(self.item_id_to_tags.keys())
|
|
39
39
|
for tag in search_filter['tags']:
|
|
40
40
|
full_match_item_ids.intersection_update(self.tag_to_item_ids[tag])
|
|
41
|
-
print(f'{len(full_match_item_ids)} full match item ids')
|
|
41
|
+
# print(f'{len(full_match_item_ids)} full match item ids')
|
|
42
42
|
|
|
43
43
|
continuation_item_ids = None
|
|
44
44
|
if search_filter['partial_tag'] is not None:
|
|
45
45
|
continuations = self.possible_tag_continuations(search_filter['partial_tag'])
|
|
46
|
-
print(continuations)
|
|
46
|
+
# print(continuations)
|
|
47
47
|
continuation_item_ids = set()
|
|
48
48
|
for tag in continuations:
|
|
49
49
|
continuation_item_ids.update(self.tag_to_item_ids[tag])
|
|
50
|
-
print(f'{len(continuation_item_ids)} continuation item ids')
|
|
50
|
+
# print(f'{len(continuation_item_ids)} continuation item ids')
|
|
51
51
|
|
|
52
52
|
candidate_item_ids = set(self.item_id_to_tags.keys())
|
|
53
53
|
if continuation_item_ids is not None:
|
|
54
54
|
candidate_item_ids.intersection_update(continuation_item_ids)
|
|
55
55
|
if full_match_item_ids is not None:
|
|
56
56
|
candidate_item_ids.intersection_update(full_match_item_ids)
|
|
57
|
-
print(f'{len(candidate_item_ids)} candidate item ids')
|
|
57
|
+
# print(f'{len(candidate_item_ids)} candidate item ids')
|
|
58
58
|
|
|
59
59
|
return candidate_item_ids
|
|
60
60
|
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import time
|
|
2
|
-
|
|
3
|
-
from metalist.config import max_search_suggestions, development_mode
|
|
2
|
+
from metalist import config
|
|
4
3
|
|
|
5
4
|
|
|
6
5
|
def calculate_search_suggestions(cache, context):
|
|
7
6
|
t1 = time.time()
|
|
8
7
|
current_search = context.search_text
|
|
9
|
-
if development_mode:
|
|
8
|
+
if config.development_mode:
|
|
10
9
|
print(f'current_search: `{current_search}`')
|
|
11
10
|
|
|
12
11
|
if context.search_filter['partial_text'] is not None or context.search_filter['negated_partial_text'] is not None:
|
|
13
|
-
if development_mode:
|
|
12
|
+
if config.development_mode:
|
|
14
13
|
print('text completion mode... no suggestions')
|
|
15
14
|
return []
|
|
16
15
|
|
|
17
16
|
if context.search_filter['negated_partial_tag'] is not None:
|
|
18
|
-
if development_mode:
|
|
17
|
+
if config.development_mode:
|
|
19
18
|
print('negated partial tag... no suggestions... for now (TODO)')
|
|
20
19
|
return []
|
|
21
20
|
|
|
@@ -102,9 +101,9 @@ def calculate_search_suggestions(cache, context):
|
|
|
102
101
|
already_suggested.add(tag)
|
|
103
102
|
full_suggestion = prefix + tag + ' '
|
|
104
103
|
full_suggestions.append(full_suggestion)
|
|
105
|
-
if len(full_suggestions) >= max_search_suggestions:
|
|
104
|
+
if len(full_suggestions) >= config.max_search_suggestions:
|
|
106
105
|
break
|
|
107
106
|
t2 = time.time()
|
|
108
|
-
if development_mode:
|
|
107
|
+
if config.development_mode:
|
|
109
108
|
print(f'search suggestions took {(t2-t1)*1000:.4f} ms to calculate')
|
|
110
109
|
return full_suggestions
|
|
@@ -2,8 +2,7 @@ import copy
|
|
|
2
2
|
import time
|
|
3
3
|
from dataclasses import dataclass
|
|
4
4
|
from typing import List
|
|
5
|
-
|
|
6
|
-
from metalist.config import development_mode, simulated_lag_seconds
|
|
5
|
+
from metalist import config
|
|
7
6
|
from metalist.utils.decorate_single_item import calculate_matches_per_item, hash_dictionary
|
|
8
7
|
|
|
9
8
|
|
|
@@ -76,7 +75,7 @@ def error_response(message):
|
|
|
76
75
|
|
|
77
76
|
|
|
78
77
|
def noop_response(message):
|
|
79
|
-
if development_mode:
|
|
78
|
+
if config.development_mode:
|
|
80
79
|
print(f'NOOP: {message}')
|
|
81
80
|
return {
|
|
82
81
|
'noop': message
|
|
@@ -93,7 +92,7 @@ def recalculate_item_ranks(cache, dirty_rank):
|
|
|
93
92
|
global prev_sorting_order
|
|
94
93
|
|
|
95
94
|
if len(cache['id_to_item']) == 0:
|
|
96
|
-
if development_mode:
|
|
95
|
+
if config.development_mode:
|
|
97
96
|
print('no items to rank')
|
|
98
97
|
return []
|
|
99
98
|
|
|
@@ -101,14 +100,14 @@ def recalculate_item_ranks(cache, dirty_rank):
|
|
|
101
100
|
t1 = time.time()
|
|
102
101
|
|
|
103
102
|
if not dirty_rank and prev_sorting_order is not None:
|
|
104
|
-
if development_mode:
|
|
103
|
+
if config.development_mode:
|
|
105
104
|
print('using previous sorting order')
|
|
106
105
|
# TODO this could be more efficient
|
|
107
106
|
for id in prev_sorting_order:
|
|
108
107
|
node = cache['id_to_item'][id]
|
|
109
108
|
sorted_items.append(node)
|
|
110
109
|
else:
|
|
111
|
-
if development_mode:
|
|
110
|
+
if config.development_mode:
|
|
112
111
|
print('dirty_rank == True')
|
|
113
112
|
head = None
|
|
114
113
|
for item in cache['id_to_item'].values():
|
|
@@ -128,7 +127,7 @@ def recalculate_item_ranks(cache, dirty_rank):
|
|
|
128
127
|
assert len(sorted_items) == len(cache['id_to_item']), f'mismatch when calculating item ranks, location 2: {len(sorted_items)} vs {len(cache["id_to_item"])}'
|
|
129
128
|
assert len(prev_sorting_order) == len(sorted_items), f'mismatch with prev_sorting_order'
|
|
130
129
|
t2 = time.time()
|
|
131
|
-
if development_mode:
|
|
130
|
+
if config.development_mode:
|
|
132
131
|
print(f're/calculating item ranks took {((t2-t1)*1000):.2f} ms')
|
|
133
132
|
return sorted_items
|
|
134
133
|
|
|
@@ -136,9 +135,9 @@ def recalculate_item_ranks(cache, dirty_rank):
|
|
|
136
135
|
def filter_and_sort_items(cache, context, updated_search=False, dirty_ranking=False):
|
|
137
136
|
|
|
138
137
|
t1 = time.time()
|
|
139
|
-
if development_mode and simulated_lag_seconds is not None and simulated_lag_seconds > 0:
|
|
140
|
-
print(f'simulating lag of {simulated_lag_seconds} seconds')
|
|
141
|
-
time.sleep(simulated_lag_seconds)
|
|
138
|
+
if config.development_mode and config.simulated_lag_seconds is not None and config.simulated_lag_seconds > 0:
|
|
139
|
+
print(f'simulating lag of {config.simulated_lag_seconds} seconds')
|
|
140
|
+
time.sleep(config.simulated_lag_seconds)
|
|
142
141
|
filtered_items = []
|
|
143
142
|
total_precomputed = 0
|
|
144
143
|
total_processed = 0
|
|
@@ -147,7 +146,7 @@ def filter_and_sort_items(cache, context, updated_search=False, dirty_ranking=Fa
|
|
|
147
146
|
all_sorted_items = recalculate_item_ranks(cache, dirty_ranking)
|
|
148
147
|
|
|
149
148
|
if updated_search:
|
|
150
|
-
if development_mode:
|
|
149
|
+
if config.development_mode:
|
|
151
150
|
print('updated search, therefore all item matches are dirty')
|
|
152
151
|
for item in all_sorted_items:
|
|
153
152
|
item['_dirty_matches'] = True
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from typing import List
|
|
2
|
-
from metalist
|
|
2
|
+
from metalist import config
|
|
3
3
|
from metalist.utils.reporting import analyze_cache
|
|
4
4
|
|
|
5
5
|
|
|
@@ -25,7 +25,7 @@ class Snapshots:
|
|
|
25
25
|
self.stack_pointer: int = -1
|
|
26
26
|
|
|
27
27
|
def test(self):
|
|
28
|
-
if not development_mode:
|
|
28
|
+
if not config.development_mode:
|
|
29
29
|
return
|
|
30
30
|
try:
|
|
31
31
|
for i in range(len(self.stack)-1):
|
|
@@ -42,7 +42,7 @@ class Snapshots:
|
|
|
42
42
|
else:
|
|
43
43
|
result = self.stack[self.stack_pointer]
|
|
44
44
|
self.stack_pointer -= 1
|
|
45
|
-
if development_mode:
|
|
45
|
+
if config.development_mode:
|
|
46
46
|
self.show()
|
|
47
47
|
return result
|
|
48
48
|
|
|
@@ -52,23 +52,23 @@ class Snapshots:
|
|
|
52
52
|
self.stack_pointer += 1
|
|
53
53
|
result = self.stack[self.stack_pointer]
|
|
54
54
|
else:
|
|
55
|
-
if development_mode:
|
|
55
|
+
if config.development_mode:
|
|
56
56
|
print('end of stack')
|
|
57
|
-
if development_mode:
|
|
57
|
+
if config.development_mode:
|
|
58
58
|
self.show()
|
|
59
59
|
return result
|
|
60
60
|
|
|
61
61
|
def reset(self):
|
|
62
62
|
self.stack = []
|
|
63
63
|
self.stack_pointer = -1
|
|
64
|
-
if development_mode:
|
|
64
|
+
if config.development_mode:
|
|
65
65
|
self.show()
|
|
66
66
|
|
|
67
67
|
def push(self, snapshot: Snapshot):
|
|
68
68
|
self.stack = self.stack[:self.stack_pointer+1]
|
|
69
69
|
self.stack.append(snapshot)
|
|
70
70
|
self.stack_pointer += 1
|
|
71
|
-
if development_mode:
|
|
71
|
+
if config.development_mode:
|
|
72
72
|
self.show()
|
|
73
73
|
|
|
74
74
|
def show(self):
|
|
@@ -110,7 +110,7 @@ def double_merge(op1, op2, cache, snapshots):
|
|
|
110
110
|
if a.item_subitem_id != b.item_subitem_id:
|
|
111
111
|
return False
|
|
112
112
|
if a.op_name == op1 and b.op_name == op2:
|
|
113
|
-
if development_mode:
|
|
113
|
+
if config.development_mode:
|
|
114
114
|
snapshots.show()
|
|
115
115
|
merged_snapshot = Snapshot(op1, a.pre, b.post, b.item_subitem_id)
|
|
116
116
|
# point at new desired location
|
|
@@ -208,7 +208,7 @@ quad_patterns = [
|
|
|
208
208
|
|
|
209
209
|
|
|
210
210
|
def compress_snapshots(cache: dict, snapshots: Snapshots):
|
|
211
|
-
if development_mode:
|
|
211
|
+
if config.development_mode:
|
|
212
212
|
print('compress_snapshots()')
|
|
213
213
|
analyze_cache(cache)
|
|
214
214
|
snapshots.test()
|
|
@@ -227,12 +227,12 @@ def compress_snapshots(cache: dict, snapshots: Snapshots):
|
|
|
227
227
|
matches += 1
|
|
228
228
|
continue
|
|
229
229
|
if matches == 0:
|
|
230
|
-
if development_mode:
|
|
230
|
+
if config.development_mode:
|
|
231
231
|
print('no compression matches found')
|
|
232
232
|
else:
|
|
233
|
-
if development_mode:
|
|
233
|
+
if config.development_mode:
|
|
234
234
|
snapshots.show()
|
|
235
|
-
if development_mode:
|
|
235
|
+
if config.development_mode:
|
|
236
236
|
snapshots.test()
|
|
237
237
|
analyze_cache(cache)
|
|
238
238
|
return
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import time
|
|
2
|
-
from metalist
|
|
2
|
+
from metalist import config
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
def jaccard_index(tags1, tags2):
|
|
@@ -148,7 +148,7 @@ def calculate_tags_suggestions(cache, context):
|
|
|
148
148
|
prefix = ' '.join(selected_subitem['tags'].split()[:-1]) + ' '
|
|
149
149
|
else:
|
|
150
150
|
prefix = ' '.join(selected_subitem['tags'].split()) + ' '
|
|
151
|
-
if development_mode:
|
|
151
|
+
if config.development_mode:
|
|
152
152
|
print(f'{len(sorted_specific_tags)} specific suggestions | {len(sorted_generic_tags)} less-specific suggestions')
|
|
153
153
|
already_suggested = set(selected_subitem['_tags'])
|
|
154
154
|
for tag in combined_sorted_tags:
|
|
@@ -161,9 +161,9 @@ def calculate_tags_suggestions(cache, context):
|
|
|
161
161
|
already_suggested.add(tag)
|
|
162
162
|
full_suggestion = prefix + tag + ' '
|
|
163
163
|
full_suggestions.append(full_suggestion)
|
|
164
|
-
if len(full_suggestions) >= max_tags_suggestions:
|
|
164
|
+
if len(full_suggestions) >= config.max_tags_suggestions:
|
|
165
165
|
break
|
|
166
166
|
t2 = time.time()
|
|
167
|
-
if development_mode:
|
|
167
|
+
if config.development_mode:
|
|
168
168
|
print(f'calculate tags suggestions took {(t2 - t1)*1000:.4f} ms')
|
|
169
169
|
return full_suggestions
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import copy
|
|
2
2
|
import time
|
|
3
3
|
import tqdm
|
|
4
|
-
from metalist
|
|
4
|
+
from metalist import config
|
|
5
5
|
from metalist.utils.decorate_single_item import decorate_item
|
|
6
6
|
from metalist.utils.find import find_prev_visible_item, find_next_visible_item
|
|
7
7
|
from metalist.utils.generate import generate_unplaced_new_item
|
|
@@ -149,7 +149,7 @@ def add_item_sibling(db, cache, context):
|
|
|
149
149
|
def add_item_top(db, cache, context):
|
|
150
150
|
new_item = generate_unplaced_new_item(cache, context.search_filter)
|
|
151
151
|
crud.create(db, new_item)
|
|
152
|
-
if always_add_to_global_top:
|
|
152
|
+
if config.always_add_to_global_top:
|
|
153
153
|
if len(cache['id_to_item'].keys()) == 0:
|
|
154
154
|
new_item['prev'] = None
|
|
155
155
|
new_item['next'] = None
|
|
@@ -249,7 +249,7 @@ def paste_sibling(db, cache, context):
|
|
|
249
249
|
|
|
250
250
|
|
|
251
251
|
def recalculate_ontology(db, cache: dict, context):
|
|
252
|
-
if development_mode:
|
|
252
|
+
if config.development_mode:
|
|
253
253
|
print('----------------------------------')
|
|
254
254
|
print('RECALCUATING ONTOLOGY')
|
|
255
255
|
print('----------------------------------')
|
|
@@ -261,7 +261,7 @@ def recalculate_ontology(db, cache: dict, context):
|
|
|
261
261
|
extract_ontology(cache, item)
|
|
262
262
|
propagate_implications(cache)
|
|
263
263
|
t2 = time.time()
|
|
264
|
-
if development_mode:
|
|
264
|
+
if config.development_mode:
|
|
265
265
|
print(f'recalculating ontology took {(t2 - t1):.6f} seconds')
|
|
266
266
|
t1 = time.time()
|
|
267
267
|
# TODO: this could be made more efficient by only updating affected items
|
|
@@ -276,5 +276,5 @@ def recalculate_ontology(db, cache: dict, context):
|
|
|
276
276
|
cache['hash_to_item'][item['_hash']] = copy.deepcopy(item)
|
|
277
277
|
tot_updated += 1
|
|
278
278
|
t2 = time.time()
|
|
279
|
-
if development_mode:
|
|
279
|
+
if config.development_mode:
|
|
280
280
|
print(f'decorating items took {(t2-t1):.6f} seconds. {tot_updated} updated items')
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import copy
|
|
2
|
-
from metalist
|
|
2
|
+
from metalist import config
|
|
3
3
|
from metalist.utils import crud
|
|
4
4
|
from metalist.utils.decorate_single_item import decorate_item
|
|
5
5
|
from metalist.utils.find import find_sibling_index_above, find_subtree_bounds, find_sibling_index_below, \
|
|
@@ -133,7 +133,7 @@ def outdent(db, context, cache):
|
|
|
133
133
|
subitem = context.item['subitems'][context.subitem_index]
|
|
134
134
|
indent = subitem['indent']
|
|
135
135
|
assert indent >= 2, 'cannot outdent any further'
|
|
136
|
-
if outdent_all_siblings_below:
|
|
136
|
+
if config.outdent_all_siblings_below:
|
|
137
137
|
upper_bound, lower_bound = find_subtree_bounds_all_siblings_below(context.item, context.subitem_index)
|
|
138
138
|
else:
|
|
139
139
|
upper_bound, lower_bound = find_subtree_bounds(context.item, context.subitem_index)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{MetaList-0.1.7 → MetaList-0.1.8}/metalist/static/libs/katex/contrib/mathtex-script-type.min.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|