streamlit-octostar-utils 0.2.4__py3-none-any.whl → 0.2.6__py3-none-any.whl
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.
- streamlit_octostar_utils/api_crafter/nifi.py +4 -2
- streamlit_octostar_utils/core/filetypes.py +22 -16
- streamlit_octostar_utils/nlp/language.py +1 -1
- {streamlit_octostar_utils-0.2.4.dist-info → streamlit_octostar_utils-0.2.6.dist-info}/METADATA +1 -1
- {streamlit_octostar_utils-0.2.4.dist-info → streamlit_octostar_utils-0.2.6.dist-info}/RECORD +7 -7
- {streamlit_octostar_utils-0.2.4.dist-info → streamlit_octostar_utils-0.2.6.dist-info}/LICENSE +0 -0
- {streamlit_octostar_utils-0.2.4.dist-info → streamlit_octostar_utils-0.2.6.dist-info}/WHEEL +0 -0
@@ -214,6 +214,8 @@ class NifiEntityProxy(object):
|
|
214
214
|
class NifiFragmenter(object):
|
215
215
|
def as_nifi_fragments(fragments, fragmenter_keylist):
|
216
216
|
count = len(fragments)
|
217
|
+
if count < 2:
|
218
|
+
raise ValueError("Must have at least 2 entities for fragmentation")
|
217
219
|
identifier = str(uuid.uuid4())
|
218
220
|
for i, entity in enumerate(fragments):
|
219
221
|
travel_dict(
|
@@ -289,10 +291,10 @@ class NifiContextManager(object):
|
|
289
291
|
def get_client(self, json_data):
|
290
292
|
all_jwts = [e["request"].get("jwt") for e in json_data]
|
291
293
|
all_jwts = [j for j in all_jwts if j]
|
292
|
-
assert len(set(all_jwts))
|
294
|
+
assert len(set(all_jwts)) <= 1 # jwt must be unique
|
293
295
|
all_ontology_names = [e["request"].get("ontology_name") for e in json_data]
|
294
296
|
all_ontology_names = [j for j in all_ontology_names if j]
|
295
|
-
assert len(set(all_ontology_names))
|
297
|
+
assert len(set(all_ontology_names)) <= 1 # ontology name must be unique
|
296
298
|
curr_user_jwt = all_jwts[0]
|
297
299
|
curr_user_ontology = all_ontology_names[0]
|
298
300
|
client = make_client(fixed_jwt=curr_user_jwt, ontology_name=curr_user_ontology)
|
@@ -6,20 +6,26 @@ def add_filetypes():
|
|
6
6
|
mimetypes.add_type("text/csv", ".csv")
|
7
7
|
|
8
8
|
|
9
|
-
def recognize_filetype(file, filename):
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
def recognize_filetype(file=None, filename=None):
|
10
|
+
if not (file or filename):
|
11
|
+
raise ValueError("Must provide either file content or filename")
|
12
|
+
from_name_guess = None
|
13
|
+
from_file_guess = None
|
14
|
+
if filename:
|
15
|
+
from_name_guess, _ = mimetypes.guess_type(filename)
|
16
|
+
if file:
|
17
|
+
ft = filetype.guess(file)
|
18
|
+
from_file_guess = ft.mime if ft else None
|
19
|
+
def _family(m):
|
20
|
+
return m.split("/", 1)[0] if isinstance(m, str) and "/" in m else None
|
21
|
+
def _subtype(m):
|
22
|
+
return m.split("/", 1)[-1] if isinstance(m, str) and "/" in m else None
|
15
23
|
if not from_file_guess and not from_name_guess:
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
recognized_filetype = from_name_guess
|
25
|
-
return recognized_filetype
|
24
|
+
return "unknown"
|
25
|
+
if not (from_file_guess and from_name_guess):
|
26
|
+
return from_file_guess or from_name_guess
|
27
|
+
if _family(from_file_guess) != _family(from_name_guess):
|
28
|
+
return from_file_guess
|
29
|
+
if _subtype(from_file_guess) != _subtype(from_name_guess):
|
30
|
+
return from_name_guess
|
31
|
+
return from_name_guess
|
@@ -9,7 +9,7 @@ def detect_language(text, min_confidence=None):
|
|
9
9
|
)
|
10
10
|
detected_lang, confidence = detector.classify(text)
|
11
11
|
if min_confidence and confidence < min_confidence:
|
12
|
-
return None
|
12
|
+
return None, confidence
|
13
13
|
detected_lang = re.sub("[^A-Za-z]", "", detected_lang).lower()
|
14
14
|
detected_lang = languages.to_name(detected_lang).lower()
|
15
15
|
return detected_lang, confidence
|
{streamlit_octostar_utils-0.2.4.dist-info → streamlit_octostar_utils-0.2.6.dist-info}/RECORD
RENAMED
@@ -2,7 +2,7 @@ streamlit_octostar_utils/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-Y
|
|
2
2
|
streamlit_octostar_utils/api_crafter/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
3
3
|
streamlit_octostar_utils/api_crafter/celery.py,sha256=bQq8P95j0XDWqx6Hdnm96PJL8kcp9ZcSKjveZUCQTVk,29874
|
4
4
|
streamlit_octostar_utils/api_crafter/fastapi.py,sha256=2bktT5Mwjs9XixWcOqUKMoLM_cgKl-cqZDUa2Imf4xA,14357
|
5
|
-
streamlit_octostar_utils/api_crafter/nifi.py,sha256=
|
5
|
+
streamlit_octostar_utils/api_crafter/nifi.py,sha256=x1ILnuz4oHq8Qg8nRcGcV9NkuUccAsFRZuzEqmnNM04,45313
|
6
6
|
streamlit_octostar_utils/api_crafter/parser/__init__.py,sha256=YeYWF6sdQiCFV_RKNW2t9Vs6KJExE2pbXxWTe_DOayY,107
|
7
7
|
streamlit_octostar_utils/api_crafter/parser/combine_fields.py,sha256=ddc44xkajw8MU0peAX_263DL7rPXbTKbHUjpOhRgvyU,8790
|
8
8
|
streamlit_octostar_utils/api_crafter/parser/entities_parser.py,sha256=zOQoN-p1Gz6ZzxvoX4M1b4Fi3mfmQr5zaNUcp_8gCjw,30016
|
@@ -15,12 +15,12 @@ streamlit_octostar_utils/api_crafter/parser/rules.py,sha256=hY2saX-CYpDBoxfK7BqZ
|
|
15
15
|
streamlit_octostar_utils/api_crafter/parser/signals.py,sha256=cX1mHHGoolls7DBUwBZNHItlkKNYImEIUrr4M3btQko,4408
|
16
16
|
streamlit_octostar_utils/core/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
17
17
|
streamlit_octostar_utils/core/dict.py,sha256=b-gOCXLNuTY6WePCOeq20QLYHAPHpfivG6sxZZMw-b8,2802
|
18
|
-
streamlit_octostar_utils/core/filetypes.py,sha256=
|
18
|
+
streamlit_octostar_utils/core/filetypes.py,sha256=kOcEnQUj4RKkyIekhrBzDBQsgWHDNe12JiQjt3mlUNc,1104
|
19
19
|
streamlit_octostar_utils/core/threading/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
20
20
|
streamlit_octostar_utils/core/threading/key_queue.py,sha256=7CJpj0gvZMQd8eC5wKQi3Ak5SQQ4zQ1OPTs_OP_kD20,2255
|
21
21
|
streamlit_octostar_utils/core/timestamp.py,sha256=a3s4xfm1nctLzYsHOJxqoWIDTdbNY_yN1OByl8ahLc8,383
|
22
22
|
streamlit_octostar_utils/nlp/__init__.py,sha256=BtlYDZK_xaEbc7Ju_7MznXbCVPZcdLn26xwR9qf_UhM,336
|
23
|
-
streamlit_octostar_utils/nlp/language.py,sha256=
|
23
|
+
streamlit_octostar_utils/nlp/language.py,sha256=BBBT8wtwWtVrCin5fNLMqGg5WdgHVotFkIvouk2qKh0,561
|
24
24
|
streamlit_octostar_utils/nlp/ner.py,sha256=EAx4WNCH3jO9KQlK47hG3RMjnNpFadGl7CKfCQmSM7c,13326
|
25
25
|
streamlit_octostar_utils/octostar/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
26
26
|
streamlit_octostar_utils/octostar/client.py,sha256=NUvHe9asd65g4-hJ4CuUvUns-9dNWes1XZRJlO9eAAc,1690
|
@@ -36,7 +36,7 @@ streamlit_octostar_utils/threading/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzp
|
|
36
36
|
streamlit_octostar_utils/threading/async_task_manager.py,sha256=q7N6YZwUvIYMzkSHmsJNheNVCv93c03H6Hyg9uH8pvk,4747
|
37
37
|
streamlit_octostar_utils/threading/session_callback_manager.py,sha256=LvZVP4g6tvKtYmI13f2j1sX_7hm61Groqp5xJine9_k,3973
|
38
38
|
streamlit_octostar_utils/threading/session_state_hot_swapper.py,sha256=6eeCQI6A42hp4DmW2NQw2rbeR-k9N8DhfBKQdN_fbLU,811
|
39
|
-
streamlit_octostar_utils-0.2.
|
40
|
-
streamlit_octostar_utils-0.2.
|
41
|
-
streamlit_octostar_utils-0.2.
|
42
|
-
streamlit_octostar_utils-0.2.
|
39
|
+
streamlit_octostar_utils-0.2.6.dist-info/LICENSE,sha256=dkwVPyV03fPHHtERnF6RnvRXcll__tud9gWca1RcgnQ,1073
|
40
|
+
streamlit_octostar_utils-0.2.6.dist-info/METADATA,sha256=XkPbtVKoxfk-qVdbjioRmd0Ctf8D9MQLdcXdaEZAkTQ,2256
|
41
|
+
streamlit_octostar_utils-0.2.6.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
42
|
+
streamlit_octostar_utils-0.2.6.dist-info/RECORD,,
|
{streamlit_octostar_utils-0.2.4.dist-info → streamlit_octostar_utils-0.2.6.dist-info}/LICENSE
RENAMED
File without changes
|
File without changes
|