kodexa 7.0.1a8003164156__tar.gz → 7.0.1a9194120328__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.
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/PKG-INFO +4 -15
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/README.md +0 -12
- kodexa-7.0.1a9194120328/kodexa/model/entities/product.py +126 -0
- kodexa-7.0.1a9194120328/kodexa/model/entities/product_subscription.py +122 -0
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/kodexa/model/model.py +26 -7
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/kodexa/model/objects.py +140 -57
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/kodexa/model/persistence.py +96 -34
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/kodexa/pipeline/pipeline.py +30 -10
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/kodexa/platform/client.py +277 -40
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/kodexa/platform/kodexa.py +117 -32
- kodexa-7.0.1a9194120328/kodexa/testing/test_components.py +45 -0
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/kodexa/testing/test_utils.py +3 -1
- kodexa-7.0.1a9194120328/kodexa/training/train_utils.py +0 -0
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/pyproject.toml +9 -8
- kodexa-7.0.1a8003164156/kodexa/testing/test_components.py +0 -85
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/LICENSE +0 -0
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/kodexa/__init__.py +0 -0
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/kodexa/assistant/__init__.py +0 -0
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/kodexa/assistant/assistant.py +0 -0
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/kodexa/connectors/__init__.py +0 -0
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/kodexa/connectors/connectors.py +0 -0
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/kodexa/model/__init__.py +0 -0
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/kodexa/model/base.py +0 -0
- {kodexa-7.0.1a8003164156/kodexa/spatial → kodexa-7.0.1a9194120328/kodexa/model/entities}/__init__.py +0 -0
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/kodexa/pipeline/__init__.py +0 -0
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/kodexa/platform/__init__.py +0 -0
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/kodexa/platform/interaction.py +0 -0
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/kodexa/selectors/__init__.py +0 -0
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/kodexa/selectors/ast.py +0 -0
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/kodexa/selectors/core.py +0 -0
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/kodexa/selectors/lexrules.py +0 -0
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/kodexa/selectors/lextab.py +0 -0
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/kodexa/selectors/lextab.pyi +0 -0
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/kodexa/selectors/parserules.py +0 -0
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/kodexa/selectors/parserules.pyi +0 -0
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/kodexa/selectors/parsetab.py +0 -0
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/kodexa/selectors/parsetab.pyi +0 -0
- /kodexa-7.0.1a8003164156/kodexa/training/train_utils.py → /kodexa-7.0.1a9194120328/kodexa/spatial/__init__.py +0 -0
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/kodexa/spatial/azure_models.py +0 -0
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/kodexa/spatial/bbox_common.py +0 -0
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/kodexa/spatial/table_form_common.py +0 -0
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/kodexa/steps/__init__.py +0 -0
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/kodexa/steps/common.py +0 -0
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/kodexa/testing/__init__.py +0 -0
- {kodexa-7.0.1a8003164156 → kodexa-7.0.1a9194120328}/kodexa/training/__init__.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: kodexa
|
3
|
-
Version: 7.0.
|
3
|
+
Version: 7.0.1a9194120328
|
4
4
|
Summary: Python SDK for the Kodexa Platform
|
5
5
|
Author: Austin Redenbaugh
|
6
6
|
Author-email: austin@kodexa.com
|
@@ -17,16 +17,17 @@ Requires-Dist: addict (>=2.4.0,<3.0.0)
|
|
17
17
|
Requires-Dist: appdirs (>=1.4.4,<2.0.0)
|
18
18
|
Requires-Dist: better-exceptions (>=0.3.3,<0.4.0)
|
19
19
|
Requires-Dist: chevron (>=0.14.0,<0.15.0)
|
20
|
-
Requires-Dist: deepdiff (>=
|
20
|
+
Requires-Dist: deepdiff (>=7.0.1,<8.0.0)
|
21
21
|
Requires-Dist: msgpack (>=1.0.6,<2.0.0)
|
22
22
|
Requires-Dist: ply (>=3.11,<4.0)
|
23
23
|
Requires-Dist: pydantic (>=2.5.3,<3.0.0)
|
24
24
|
Requires-Dist: pydantic-yaml (>=1.0.0,<2.0.0)
|
25
|
-
Requires-Dist: pyfunctional (
|
25
|
+
Requires-Dist: pyfunctional (==1.5.0)
|
26
26
|
Requires-Dist: python-dateutil (>=2.8.2,<3.0.0)
|
27
27
|
Requires-Dist: pyyaml (>=6.0,<7.0)
|
28
28
|
Requires-Dist: requests (>=2.28.1,<3.0.0)
|
29
29
|
Requires-Dist: semver (>=3.0.1,<4.0.0)
|
30
|
+
Requires-Dist: simpleeval (>=0.9.13,<0.10.0)
|
30
31
|
Requires-Dist: urllib3 (>=2.0.0,<3.0.0)
|
31
32
|
Description-Content-Type: text/markdown
|
32
33
|
|
@@ -66,18 +67,6 @@ working with a Kodexa platform instance.
|
|
66
67
|
|
67
68
|
Documentation is available at the [Kodexa Documentation Portal](https://docs.kodexa.com)
|
68
69
|
|
69
|
-
## Current Development
|
70
|
-
|
71
|
-
[//]: # (Replace it with the diagrams and descriptions for build releases)
|
72
|
-
**BUILD VERSION FLOW**
|
73
|
-

|
74
|
-
Build version will differ based on the branches that are published to pypi.
|
75
|
-
|
76
|
-
**GITHUB PROCESS**
|
77
|
-

|
78
|
-
Changes that contain bugs, features, and fixes should first be pushed to the test branch.
|
79
|
-
Once these changes are thoroughly tested, they can be submitted as a pull request to the main branch. The pull request should be reviewed and approved by an appropriate person before the changes can be merged.
|
80
|
-
|
81
70
|
## Set-up
|
82
71
|
|
83
72
|
We use poetry to manage our dependencies, so you can install them with:
|
@@ -34,18 +34,6 @@ working with a Kodexa platform instance.
|
|
34
34
|
|
35
35
|
Documentation is available at the [Kodexa Documentation Portal](https://docs.kodexa.com)
|
36
36
|
|
37
|
-
## Current Development
|
38
|
-
|
39
|
-
[//]: # (Replace it with the diagrams and descriptions for build releases)
|
40
|
-
**BUILD VERSION FLOW**
|
41
|
-

|
42
|
-
Build version will differ based on the branches that are published to pypi.
|
43
|
-
|
44
|
-
**GITHUB PROCESS**
|
45
|
-

|
46
|
-
Changes that contain bugs, features, and fixes should first be pushed to the test branch.
|
47
|
-
Once these changes are thoroughly tested, they can be submitted as a pull request to the main branch. The pull request should be reviewed and approved by an appropriate person before the changes can be merged.
|
48
|
-
|
49
37
|
## Set-up
|
50
38
|
|
51
39
|
We use poetry to manage our dependencies, so you can install them with:
|
@@ -0,0 +1,126 @@
|
|
1
|
+
from typing import Optional, List
|
2
|
+
|
3
|
+
from pydantic import BaseModel, ConfigDict, Field
|
4
|
+
from kodexa.model.base import StandardDateTime
|
5
|
+
from kodexa.platform.client import EntityEndpoint, PageEndpoint, EntitiesEndpoint
|
6
|
+
|
7
|
+
|
8
|
+
class Product(BaseModel):
|
9
|
+
"""
|
10
|
+
|
11
|
+
"""
|
12
|
+
model_config = ConfigDict(
|
13
|
+
populate_by_name=True,
|
14
|
+
use_enum_values=True,
|
15
|
+
arbitrary_types_allowed=True,
|
16
|
+
protected_namespaces=("model_config",),
|
17
|
+
)
|
18
|
+
"""
|
19
|
+
A product
|
20
|
+
"""
|
21
|
+
|
22
|
+
|
23
|
+
id: Optional[str] = None
|
24
|
+
uuid: Optional[str] = None
|
25
|
+
change_sequence: Optional[int] = Field(None, alias="changeSequence")
|
26
|
+
created_on: Optional[StandardDateTime] = Field(None, alias="createdOn")
|
27
|
+
updated_on: Optional[StandardDateTime] = Field(None, alias="updatedOn")
|
28
|
+
name: str
|
29
|
+
description: Optional[str] = None
|
30
|
+
overview_markdown: Optional[str] = Field(None, alias="overviewMarkdown")
|
31
|
+
|
32
|
+
|
33
|
+
class ProductEndpoint(Product, EntityEndpoint):
|
34
|
+
"""Handles the endpoint for a product
|
35
|
+
|
36
|
+
This class is a combination of DataException and EntityEndpoint. It is used
|
37
|
+
to manage the endpoint for data exceptions.
|
38
|
+
|
39
|
+
Methods:
|
40
|
+
get_type: Returns the type of the endpoint.
|
41
|
+
"""
|
42
|
+
|
43
|
+
def get_type(self) -> str:
|
44
|
+
"""Gets the type of the endpoint.
|
45
|
+
|
46
|
+
This method returns the type of the endpoint which is "exceptions".
|
47
|
+
|
48
|
+
Returns:
|
49
|
+
str: The type of the endpoint.
|
50
|
+
"""
|
51
|
+
return "products"
|
52
|
+
|
53
|
+
|
54
|
+
class PageProduct(BaseModel):
|
55
|
+
"""
|
56
|
+
|
57
|
+
"""
|
58
|
+
model_config = ConfigDict(
|
59
|
+
populate_by_name=True,
|
60
|
+
use_enum_values=True,
|
61
|
+
arbitrary_types_allowed=True,
|
62
|
+
protected_namespaces=("model_config",),
|
63
|
+
)
|
64
|
+
total_pages: Optional[int] = Field(None, alias="totalPages")
|
65
|
+
total_elements: Optional[int] = Field(None, alias="totalElements")
|
66
|
+
size: Optional[int] = None
|
67
|
+
content: Optional[List[Product]] = None
|
68
|
+
number: Optional[int] = None
|
69
|
+
|
70
|
+
number_of_elements: Optional[int] = Field(None, alias="numberOfElements")
|
71
|
+
first: Optional[bool] = None
|
72
|
+
last: Optional[bool] = None
|
73
|
+
empty: Optional[bool] = None
|
74
|
+
|
75
|
+
|
76
|
+
class PageProductEndpoint(PageProduct, PageEndpoint):
|
77
|
+
def get_type(self) -> Optional[str]:
|
78
|
+
return "product"
|
79
|
+
|
80
|
+
|
81
|
+
class ProductsEndpoint(EntitiesEndpoint):
|
82
|
+
"""Represents the products endpoint
|
83
|
+
|
84
|
+
This class is used to represent the products endpoint in the system.
|
85
|
+
|
86
|
+
Attributes:
|
87
|
+
object_dict: A dictionary containing the object data.
|
88
|
+
"""
|
89
|
+
|
90
|
+
"""Represents a assistants endpoint"""
|
91
|
+
|
92
|
+
def get_type(self) -> str:
|
93
|
+
"""Get the type of the endpoint
|
94
|
+
|
95
|
+
This method is used to get the type of the endpoint.
|
96
|
+
|
97
|
+
Returns:
|
98
|
+
str: The type of the endpoint.
|
99
|
+
"""
|
100
|
+
return "products"
|
101
|
+
|
102
|
+
def get_instance_class(self, object_dict=None):
|
103
|
+
"""Get the instance class of the endpoint
|
104
|
+
|
105
|
+
This method is used to get the instance class of the endpoint.
|
106
|
+
|
107
|
+
Args:
|
108
|
+
object_dict (dict, optional): A dictionary containing the object data.
|
109
|
+
|
110
|
+
Returns:
|
111
|
+
AssistantEndpoint: The instance class of the endpoint.
|
112
|
+
"""
|
113
|
+
return ProductEndpoint
|
114
|
+
|
115
|
+
def get_page_class(self, object_dict=None):
|
116
|
+
"""Get the page class of the endpoint
|
117
|
+
|
118
|
+
This method is used to get the page class of the endpoint.
|
119
|
+
|
120
|
+
Args:
|
121
|
+
object_dict (dict, optional): A dictionary containing the object data.
|
122
|
+
|
123
|
+
Returns:
|
124
|
+
PageAssistantEndpoint: The page class of the endpoint.
|
125
|
+
"""
|
126
|
+
return PageProductEndpoint
|
@@ -0,0 +1,122 @@
|
|
1
|
+
from typing import Optional, List
|
2
|
+
|
3
|
+
from pydantic import BaseModel, ConfigDict, Field
|
4
|
+
|
5
|
+
from kodexa.model.base import StandardDateTime
|
6
|
+
from kodexa.model.entities.product import Product
|
7
|
+
from kodexa.model.objects import Organization
|
8
|
+
from kodexa.platform.client import EntityEndpoint, PageEndpoint, EntitiesEndpoint
|
9
|
+
|
10
|
+
|
11
|
+
class ProductSubscription(BaseModel):
|
12
|
+
"""
|
13
|
+
A product subscription
|
14
|
+
"""
|
15
|
+
model_config = ConfigDict(
|
16
|
+
populate_by_name=True,
|
17
|
+
use_enum_values=True,
|
18
|
+
arbitrary_types_allowed=True,
|
19
|
+
protected_namespaces=("model_config",),
|
20
|
+
)
|
21
|
+
|
22
|
+
id: Optional[str] = Field(None)
|
23
|
+
uuid: Optional[str] = None
|
24
|
+
change_sequence: Optional[int] = Field(None, alias="changeSequence")
|
25
|
+
created_on: Optional[StandardDateTime] = Field(None, alias="createdOn")
|
26
|
+
updated_on: Optional[StandardDateTime] = Field(None, alias="updatedOn")
|
27
|
+
product: Optional[Product] = None
|
28
|
+
organization: Optional[Organization] = None
|
29
|
+
|
30
|
+
|
31
|
+
class ProductSubscriptionEndpoint(ProductSubscription, EntityEndpoint):
|
32
|
+
"""Handles the endpoint for a product subscription
|
33
|
+
|
34
|
+
This class is a combination of ProductSubscription and EntityEndpoint. It is used
|
35
|
+
to manage the endpoint for product subscriptions.
|
36
|
+
|
37
|
+
Methods:
|
38
|
+
get_type: Returns the type of the endpoint.
|
39
|
+
"""
|
40
|
+
|
41
|
+
def get_type(self) -> str:
|
42
|
+
"""Gets the type of the endpoint.
|
43
|
+
|
44
|
+
This method returns the type of the endpoint which is "product_subscriptions".
|
45
|
+
|
46
|
+
Returns:
|
47
|
+
str: The type of the endpoint.
|
48
|
+
"""
|
49
|
+
return "productSubscription"
|
50
|
+
|
51
|
+
|
52
|
+
class PageProductSubscription(BaseModel):
|
53
|
+
"""
|
54
|
+
A page of product subscriptions
|
55
|
+
"""
|
56
|
+
model_config = ConfigDict(
|
57
|
+
populate_by_name=True,
|
58
|
+
use_enum_values=True,
|
59
|
+
arbitrary_types_allowed=True,
|
60
|
+
protected_namespaces=("model_config",),
|
61
|
+
)
|
62
|
+
total_pages: Optional[int] = Field(None, alias="totalPages")
|
63
|
+
total_elements: Optional[int] = Field(None, alias="totalElements")
|
64
|
+
size: Optional[int] = None
|
65
|
+
content: Optional[List[ProductSubscription]] = None
|
66
|
+
number: Optional[int] = None
|
67
|
+
|
68
|
+
number_of_elements: Optional[int] = Field(None, alias="numberOfElements")
|
69
|
+
first: Optional[bool] = None
|
70
|
+
last: Optional[bool] = None
|
71
|
+
empty: Optional[bool] = None
|
72
|
+
|
73
|
+
|
74
|
+
class PageProductSubscriptionEndpoint(PageProductSubscription, PageEndpoint):
|
75
|
+
def get_type(self) -> Optional[str]:
|
76
|
+
return "productSubscription"
|
77
|
+
|
78
|
+
|
79
|
+
class ProductSubscriptionsEndpoint(EntitiesEndpoint):
|
80
|
+
"""Represents the product subscriptions endpoint
|
81
|
+
|
82
|
+
This class is used to represent the product subscriptions endpoint in the system.
|
83
|
+
|
84
|
+
Attributes:
|
85
|
+
object_dict: A dictionary containing the object data.
|
86
|
+
"""
|
87
|
+
|
88
|
+
def get_type(self) -> str:
|
89
|
+
"""Get the type of the endpoint
|
90
|
+
|
91
|
+
This method is used to get the type of the endpoint.
|
92
|
+
|
93
|
+
Returns:
|
94
|
+
str: The type of the endpoint.
|
95
|
+
"""
|
96
|
+
return "productSubscriptions"
|
97
|
+
|
98
|
+
def get_instance_class(self, object_dict=None):
|
99
|
+
"""Get the instance class of the endpoint
|
100
|
+
|
101
|
+
This method is used to get the instance class of the endpoint.
|
102
|
+
|
103
|
+
Args:
|
104
|
+
object_dict (dict, optional): A dictionary containing the object data.
|
105
|
+
|
106
|
+
Returns:
|
107
|
+
ProductSubscriptionEndpoint: The instance class of the endpoint.
|
108
|
+
"""
|
109
|
+
return ProductSubscriptionEndpoint
|
110
|
+
|
111
|
+
def get_page_class(self, object_dict=None):
|
112
|
+
"""Get the page class of the endpoint
|
113
|
+
|
114
|
+
This method is used to get the page class of the endpoint.
|
115
|
+
|
116
|
+
Args:
|
117
|
+
object_dict (dict, optional): A dictionary containing the object data.
|
118
|
+
|
119
|
+
Returns:
|
120
|
+
PageProductSubscriptionEndpoint: The page class of the endpoint.
|
121
|
+
"""
|
122
|
+
return PageProductSubscriptionEndpoint
|
@@ -8,8 +8,8 @@ import os
|
|
8
8
|
import re
|
9
9
|
import uuid
|
10
10
|
from enum import Enum
|
11
|
-
from typing import Any, List, Optional
|
12
|
-
|
11
|
+
from typing import Any, List, Optional
|
12
|
+
from addict import Dict
|
13
13
|
import deepdiff
|
14
14
|
import msgpack
|
15
15
|
from pydantic import BaseModel, ConfigDict
|
@@ -67,6 +67,7 @@ class Ref:
|
|
67
67
|
|
68
68
|
import addict
|
69
69
|
|
70
|
+
|
70
71
|
class DocumentMetadata(addict.Dict):
|
71
72
|
"""A flexible dict based approach to capturing metadata for the document.
|
72
73
|
|
@@ -114,6 +115,7 @@ class ContentException(dict):
|
|
114
115
|
exception_details: Optional[str] = None,
|
115
116
|
node_uuid: Optional[str] = None,
|
116
117
|
value: Optional[str] = None,
|
118
|
+
boolean_value: Optional[bool] = None,
|
117
119
|
*args,
|
118
120
|
**kwargs,
|
119
121
|
):
|
@@ -128,9 +130,10 @@ class ContentException(dict):
|
|
128
130
|
self.severity = severity
|
129
131
|
self.value = value
|
130
132
|
self.exception_type_id = exception_type_id
|
133
|
+
self.boolean_value = boolean_value
|
131
134
|
|
132
135
|
|
133
|
-
class Tag(
|
136
|
+
class Tag(Dict):
|
134
137
|
"""A class to represent the metadata for a label that is applied as a feature on a content node.
|
135
138
|
|
136
139
|
Attributes:
|
@@ -173,6 +176,8 @@ class Tag(dict):
|
|
173
176
|
**kwargs,
|
174
177
|
):
|
175
178
|
super().__init__(*args, **kwargs)
|
179
|
+
|
180
|
+
import uuid as uuid_gen
|
176
181
|
self.start: Optional[int] = start
|
177
182
|
"""The start position (zero indexed) of the content within the node, if None then label is applied to the whole node"""
|
178
183
|
self.end: Optional[int] = end
|
@@ -181,7 +186,7 @@ class Tag(dict):
|
|
181
186
|
"""A string representing the value that was labelled in the node"""
|
182
187
|
self.data: Optional[Any] = data
|
183
188
|
"""Any data object (JSON serializable) that you wish to associate with the label"""
|
184
|
-
self.uuid: Optional[str] = uuid or str(
|
189
|
+
self.uuid: Optional[str] = uuid or str(uuid_gen.uuid4())
|
185
190
|
"""The UUID for this tag instance, this allows tags that are on different content nodes to be related through the same UUID"""
|
186
191
|
self.confidence: Optional[float] = confidence
|
187
192
|
"""The confidence of the tag in a range of 0-1"""
|
@@ -798,6 +803,7 @@ class ContentNode(object):
|
|
798
803
|
>>> document.get_root().select('//*[hasTag($tagName)]', {"tagName": "div"})
|
799
804
|
[ContentNode]
|
800
805
|
"""
|
806
|
+
|
801
807
|
if variables is None:
|
802
808
|
variables = {}
|
803
809
|
from kodexa.selectors import parse
|
@@ -2438,6 +2444,19 @@ class Document(object):
|
|
2438
2444
|
for node in tag_instance.nodes:
|
2439
2445
|
node.remove_tag(tag)
|
2440
2446
|
|
2447
|
+
def get_nodes_by_type(self, node_type: str) -> List[ContentNode]:
|
2448
|
+
"""
|
2449
|
+
Get all the nodes of a specific type
|
2450
|
+
|
2451
|
+
Args:
|
2452
|
+
node_type: the type of the node
|
2453
|
+
|
2454
|
+
Returns:
|
2455
|
+
a list of nodes
|
2456
|
+
|
2457
|
+
"""
|
2458
|
+
return self._persistence_layer.get_nodes_by_type(node_type)
|
2459
|
+
|
2441
2460
|
def get_node_by_uuid(self, uuid: int) -> ContentNode:
|
2442
2461
|
"""
|
2443
2462
|
Get a node by its uuid
|
@@ -2612,7 +2631,7 @@ class Document(object):
|
|
2612
2631
|
return self
|
2613
2632
|
|
2614
2633
|
@classmethod
|
2615
|
-
def from_text(cls, text, separator=None):
|
2634
|
+
def from_text(cls, text, separator=None, inmemory=False):
|
2616
2635
|
"""Creates a new Document from the text provided.
|
2617
2636
|
|
2618
2637
|
Args:
|
@@ -2623,7 +2642,7 @@ class Document(object):
|
|
2623
2642
|
the document
|
2624
2643
|
|
2625
2644
|
"""
|
2626
|
-
new_document = Document()
|
2645
|
+
new_document = Document(inmemory=inmemory)
|
2627
2646
|
new_document.source.original_filename = f"text-{uuid.uuid4()}"
|
2628
2647
|
new_document.content_node = new_document.create_node(node_type="text", index=0)
|
2629
2648
|
if text:
|
@@ -2939,7 +2958,7 @@ class Document(object):
|
|
2939
2958
|
)
|
2940
2959
|
fp.write(source)
|
2941
2960
|
fp.close()
|
2942
|
-
return Document(kddb_path=fp.name, delete_on_close=True)
|
2961
|
+
return Document(kddb_path=fp.name, delete_on_close=True, inmemory=inmemory)
|
2943
2962
|
|
2944
2963
|
@classmethod
|
2945
2964
|
def from_file(cls, file, unpack: bool = False):
|