cmem-plugin-random 0.5.0__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.
- cmem_plugin_random/__init__.py +1 -0
- cmem_plugin_random/common.py +20 -0
- cmem_plugin_random/generate_entities.py +158 -0
- cmem_plugin_random/generate_values.py +42 -0
- cmem_plugin_random/random.svg +83 -0
- cmem_plugin_random/select_entities.py +66 -0
- cmem_plugin_random-0.5.0.dist-info/METADATA +45 -0
- cmem_plugin_random-0.5.0.dist-info/RECORD +10 -0
- cmem_plugin_random-0.5.0.dist-info/WHEEL +4 -0
- cmem_plugin_random-0.5.0.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""cmem-plugin-random"""
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""Shared code for random values generation"""
|
|
2
|
+
|
|
3
|
+
from collections import OrderedDict
|
|
4
|
+
from secrets import token_hex, token_urlsafe
|
|
5
|
+
|
|
6
|
+
RANDOM_FUNCTIONS = OrderedDict(
|
|
7
|
+
[
|
|
8
|
+
("token_urlsafe", "Return a random URL-safe text string."),
|
|
9
|
+
("token_hex", "Return a random text string, in hexadecimal."),
|
|
10
|
+
]
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def random_value(random_function: str, string_length: int) -> str:
|
|
15
|
+
"""Generate a single random value."""
|
|
16
|
+
if random_function == "token_urlsafe":
|
|
17
|
+
return token_urlsafe(string_length)
|
|
18
|
+
if random_function == "token_hex":
|
|
19
|
+
return token_hex(string_length)
|
|
20
|
+
raise ValueError("Unknown random function value.")
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"""Workflow Task: Generate Entities"""
|
|
2
|
+
|
|
3
|
+
import uuid
|
|
4
|
+
from collections.abc import Generator, Sequence
|
|
5
|
+
|
|
6
|
+
from cmem_plugin_base.dataintegration.context import ExecutionContext
|
|
7
|
+
from cmem_plugin_base.dataintegration.description import Icon, Plugin, PluginParameter
|
|
8
|
+
from cmem_plugin_base.dataintegration.entity import Entities, Entity, EntityPath, EntitySchema
|
|
9
|
+
from cmem_plugin_base.dataintegration.parameter.choice import ChoiceParameterType
|
|
10
|
+
from cmem_plugin_base.dataintegration.plugins import WorkflowPlugin
|
|
11
|
+
from cmem_plugin_base.dataintegration.ports import FixedNumberOfInputs, FixedSchemaPort
|
|
12
|
+
|
|
13
|
+
from cmem_plugin_random.common import RANDOM_FUNCTIONS, random_value
|
|
14
|
+
|
|
15
|
+
param_noe = PluginParameter(
|
|
16
|
+
name="number_of_entities",
|
|
17
|
+
label="Number of Entities (Rows)",
|
|
18
|
+
description="""How many rows will be created per run.
|
|
19
|
+
|
|
20
|
+
Depending on your output dataset, this will result in different number of resources
|
|
21
|
+
(Knowledge Graph),rows (CSV) or objects (JSON).
|
|
22
|
+
""",
|
|
23
|
+
)
|
|
24
|
+
param_nov = PluginParameter(
|
|
25
|
+
name="number_of_values",
|
|
26
|
+
label="Number of Values (Columns)",
|
|
27
|
+
description="""How many values are created per entity / row.
|
|
28
|
+
|
|
29
|
+
Depending on your output dataset, this will result in different number of
|
|
30
|
+
datatype properties (Knowledge Graph), columns (CSV) or attributes (JSON).
|
|
31
|
+
""",
|
|
32
|
+
)
|
|
33
|
+
param_sl = PluginParameter(
|
|
34
|
+
name="string_length",
|
|
35
|
+
label="String Length",
|
|
36
|
+
description="How long (in characters) should each value be.",
|
|
37
|
+
)
|
|
38
|
+
param_rf = PluginParameter(
|
|
39
|
+
name="random_function",
|
|
40
|
+
default_value="token_urlsafe",
|
|
41
|
+
label="Random Function",
|
|
42
|
+
param_type=ChoiceParameterType(RANDOM_FUNCTIONS),
|
|
43
|
+
advanced=True,
|
|
44
|
+
)
|
|
45
|
+
param_property_ns = PluginParameter(
|
|
46
|
+
name="property_namespace",
|
|
47
|
+
advanced=True,
|
|
48
|
+
default_value="https://example.org/vocab/RandomValuePath",
|
|
49
|
+
label="Property Namespace",
|
|
50
|
+
description="Output properties will have this namespace (following a number).",
|
|
51
|
+
)
|
|
52
|
+
param_type_id = PluginParameter(
|
|
53
|
+
name="type_id",
|
|
54
|
+
advanced=True,
|
|
55
|
+
default_value="https://example.org/vocab/RandomValueRow",
|
|
56
|
+
label="Type Identifier",
|
|
57
|
+
description="Output entities will have this type identifier (IRI).",
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
documentation = """This workflow task generates entities with random values.
|
|
61
|
+
|
|
62
|
+
The plugin generates X entities with Y values, each value has a length of Z.
|
|
63
|
+
|
|
64
|
+
All parameters can be configured with the parameters.
|
|
65
|
+
|
|
66
|
+
Warning: Please note that high numbers in any of the parameters will result in more
|
|
67
|
+
computational time as well as disk usage to save the entities.
|
|
68
|
+
For example, while a configuration of 100 entities with 100 values / 100 characters
|
|
69
|
+
results in a 1.4 MB CSV file (which is generated in milliseconds),
|
|
70
|
+
a configuration of 1000 entities with 1000 values / 1000 characters will result
|
|
71
|
+
already in a 1.3 GB CSV file.
|
|
72
|
+
"""
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
@Plugin(
|
|
76
|
+
label="Generate random values",
|
|
77
|
+
icon=Icon(file_name="random.svg", package=__package__),
|
|
78
|
+
plugin_id="cmem_plugin_random-GenerateEntities",
|
|
79
|
+
description="Generates entities with random values.",
|
|
80
|
+
documentation=documentation,
|
|
81
|
+
parameters=[param_noe, param_nov, param_sl, param_rf, param_property_ns, param_type_id],
|
|
82
|
+
)
|
|
83
|
+
class GenerateEntities(WorkflowPlugin):
|
|
84
|
+
"""Workflow Task: Generate Entities"""
|
|
85
|
+
|
|
86
|
+
def __init__( # noqa: PLR0913
|
|
87
|
+
self,
|
|
88
|
+
random_function: str,
|
|
89
|
+
number_of_entities: int = 10,
|
|
90
|
+
number_of_values: int = 5,
|
|
91
|
+
string_length: int = 16,
|
|
92
|
+
property_namespace: str = param_property_ns.default_value,
|
|
93
|
+
type_id: str = param_type_id.default_value,
|
|
94
|
+
) -> None:
|
|
95
|
+
if random_function not in RANDOM_FUNCTIONS:
|
|
96
|
+
raise ValueError("Unknown random function value.")
|
|
97
|
+
self.random_function = random_function
|
|
98
|
+
|
|
99
|
+
if string_length < 1:
|
|
100
|
+
raise ValueError("String Length needs to be a positive integer.")
|
|
101
|
+
self.string_length = string_length
|
|
102
|
+
|
|
103
|
+
if number_of_entities < 1:
|
|
104
|
+
raise ValueError("Entities (Rows) needs to be a positive integer.")
|
|
105
|
+
self.number_of_entities = number_of_entities
|
|
106
|
+
|
|
107
|
+
if number_of_values < 1:
|
|
108
|
+
raise ValueError("Values (Columns) needs to be a positive integer.")
|
|
109
|
+
self.number_of_values = number_of_values
|
|
110
|
+
|
|
111
|
+
# Output schema
|
|
112
|
+
self.property_namespace = property_namespace
|
|
113
|
+
self.type_id = type_id
|
|
114
|
+
self.schema = self.generate_output_schema()
|
|
115
|
+
|
|
116
|
+
# Input and output ports
|
|
117
|
+
self.input_ports = FixedNumberOfInputs([])
|
|
118
|
+
self.output_port = FixedSchemaPort(self.schema)
|
|
119
|
+
|
|
120
|
+
def execute(
|
|
121
|
+
self,
|
|
122
|
+
inputs: Sequence[Entities], # noqa: ARG002
|
|
123
|
+
context: ExecutionContext, # noqa: ARG002
|
|
124
|
+
) -> Entities:
|
|
125
|
+
"""Execute the workflow plugin on a given collection of entities."""
|
|
126
|
+
self.log.info("Start creating random values.")
|
|
127
|
+
|
|
128
|
+
# create the entities
|
|
129
|
+
entities = self.generate_entities()
|
|
130
|
+
number_of_values = self.number_of_entities * self.number_of_values
|
|
131
|
+
self.log.info(f"Happy to serve {number_of_values} random values.")
|
|
132
|
+
|
|
133
|
+
return Entities(entities=entities, schema=self.schema)
|
|
134
|
+
|
|
135
|
+
def generate_output_schema(self) -> EntitySchema:
|
|
136
|
+
"""Generate the output schema."""
|
|
137
|
+
paths = []
|
|
138
|
+
for path_no in range(self.number_of_values):
|
|
139
|
+
path_uri = f"{self.property_namespace!s}{path_no!s}"
|
|
140
|
+
paths.append(EntityPath(path=path_uri))
|
|
141
|
+
return EntitySchema(
|
|
142
|
+
type_uri=f"{self.type_id!s}",
|
|
143
|
+
paths=paths,
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
def generate_entities(self) -> Generator[Entity, None, None]:
|
|
147
|
+
"""Generate entities"""
|
|
148
|
+
for _ in range(self.number_of_entities):
|
|
149
|
+
entity_uri = f"urn:uuid:{uuid.uuid4()!s}"
|
|
150
|
+
values = [
|
|
151
|
+
[
|
|
152
|
+
random_value(
|
|
153
|
+
random_function=self.random_function, string_length=self.string_length
|
|
154
|
+
)
|
|
155
|
+
]
|
|
156
|
+
for _ in range(self.number_of_values)
|
|
157
|
+
]
|
|
158
|
+
yield Entity(uri=entity_uri, values=values)
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""Transform Task: Generate Values"""
|
|
2
|
+
|
|
3
|
+
from collections.abc import Sequence
|
|
4
|
+
|
|
5
|
+
from cmem_plugin_base.dataintegration.description import Icon, Plugin, PluginParameter
|
|
6
|
+
from cmem_plugin_base.dataintegration.parameter.choice import ChoiceParameterType
|
|
7
|
+
from cmem_plugin_base.dataintegration.plugins import TransformPlugin
|
|
8
|
+
|
|
9
|
+
from cmem_plugin_random.common import RANDOM_FUNCTIONS, random_value
|
|
10
|
+
|
|
11
|
+
param_rf = PluginParameter(
|
|
12
|
+
name="random_function",
|
|
13
|
+
default_value="token_urlsafe",
|
|
14
|
+
label="Random Function",
|
|
15
|
+
param_type=ChoiceParameterType(RANDOM_FUNCTIONS),
|
|
16
|
+
)
|
|
17
|
+
param_sl = PluginParameter(
|
|
18
|
+
name="string_length",
|
|
19
|
+
label="String Length",
|
|
20
|
+
description="How long (in characters) should each value be.",
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@Plugin(
|
|
25
|
+
label="Random value",
|
|
26
|
+
icon=Icon(file_name="random.svg", package=__package__),
|
|
27
|
+
plugin_id="cmem_plugin_random-GenerateValues",
|
|
28
|
+
description="Generates random values.",
|
|
29
|
+
parameters=[param_rf, param_sl],
|
|
30
|
+
)
|
|
31
|
+
class GenerateValues(TransformPlugin):
|
|
32
|
+
"""Transform Task: Generate Values"""
|
|
33
|
+
|
|
34
|
+
def __init__(self, random_function: str, string_length: int = 16):
|
|
35
|
+
self.random_function = random_function
|
|
36
|
+
self.string_length = string_length
|
|
37
|
+
|
|
38
|
+
def transform(self, inputs: Sequence[Sequence[str]]) -> Sequence[str]: # noqa: ARG002
|
|
39
|
+
"""Transform a collection of values."""
|
|
40
|
+
return [
|
|
41
|
+
random_value(random_function=self.random_function, string_length=self.string_length)
|
|
42
|
+
]
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
3
|
+
|
|
4
|
+
<svg
|
|
5
|
+
width="90.858604mm"
|
|
6
|
+
height="97.2108mm"
|
|
7
|
+
viewBox="0 0 90.858605 97.210801"
|
|
8
|
+
version="1.1"
|
|
9
|
+
id="svg5"
|
|
10
|
+
sodipodi:docname="custom.svg"
|
|
11
|
+
inkscape:version="1.1.2 (b8e25be8, 2022-02-05)"
|
|
12
|
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
13
|
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
14
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
+
xmlns:svg="http://www.w3.org/2000/svg">
|
|
16
|
+
<sodipodi:namedview
|
|
17
|
+
id="namedview836"
|
|
18
|
+
pagecolor="#ffffff"
|
|
19
|
+
bordercolor="#666666"
|
|
20
|
+
borderopacity="1.0"
|
|
21
|
+
inkscape:pageshadow="2"
|
|
22
|
+
inkscape:pageopacity="0.0"
|
|
23
|
+
inkscape:pagecheckerboard="0"
|
|
24
|
+
inkscape:document-units="mm"
|
|
25
|
+
showgrid="false"
|
|
26
|
+
inkscape:zoom="2.6931851"
|
|
27
|
+
inkscape:cx="159.10529"
|
|
28
|
+
inkscape:cy="168.75929"
|
|
29
|
+
inkscape:window-width="1920"
|
|
30
|
+
inkscape:window-height="1027"
|
|
31
|
+
inkscape:window-x="1728"
|
|
32
|
+
inkscape:window-y="25"
|
|
33
|
+
inkscape:window-maximized="0"
|
|
34
|
+
inkscape:current-layer="svg5"
|
|
35
|
+
fit-margin-top="10"
|
|
36
|
+
fit-margin-left="10"
|
|
37
|
+
fit-margin-right="10"
|
|
38
|
+
fit-margin-bottom="10" />
|
|
39
|
+
<defs
|
|
40
|
+
id="defs2" />
|
|
41
|
+
<g
|
|
42
|
+
id="layer1"
|
|
43
|
+
transform="translate(-56.954971,-106.54271)"
|
|
44
|
+
style="fill-rule:evenodd">
|
|
45
|
+
<g
|
|
46
|
+
id="g836"
|
|
47
|
+
transform="translate(-2.1038961,41.025974)"
|
|
48
|
+
style="fill-rule:evenodd">
|
|
49
|
+
<path
|
|
50
|
+
style="fill-opacity:1;fill-rule:evenodd;stroke-width:0.264583"
|
|
51
|
+
d="m 102.72071,125.51025 c 0,-0.80036 0.0496,-1.12778 0.11022,-0.7276 0.0606,0.40018 0.0606,1.05503 0,1.45521 -0.0606,0.40018 -0.11022,0.0728 -0.11022,-0.72761 z m 3.40207,-3.43958 c 0,-0.3638 0.0601,-0.51263 0.13346,-0.33073 0.0734,0.1819 0.0734,0.47956 0,0.66146 -0.0734,0.1819 -0.13346,0.0331 -0.13346,-0.33073 z m -28.066718,-6.50434 c 0.01269,-0.30822 0.07539,-0.37092 0.159852,-0.15985 0.07643,0.19099 0.06703,0.4192 -0.02089,0.50712 -0.08792,0.0879 -0.150453,-0.0684 -0.138964,-0.34727 z m 26.106718,-2.13755 c 0.1819,-0.0734 0.47956,-0.0734 0.66146,0 0.1819,0.0734 0.0331,0.13345 -0.33073,0.13345 -0.36381,0 -0.51263,-0.0601 -0.33073,-0.13345 z"
|
|
52
|
+
id="path852" />
|
|
53
|
+
<path
|
|
54
|
+
style="fill-opacity:1;fill-rule:evenodd;stroke-width:0.264583"
|
|
55
|
+
d="m 139.70398,130.11842 c 0.0127,-0.30823 0.0754,-0.37092 0.15985,-0.15986 0.0764,0.191 0.067,0.4192 -0.0209,0.50712 -0.0879,0.0879 -0.15045,-0.0683 -0.13896,-0.34726 z m -36.97787,-1.69775 c 0,-0.94588 0.048,-1.33284 0.10671,-0.85989 0.0587,0.47294 0.0587,1.24684 0,1.71979 -0.0587,0.47294 -0.10671,0.086 -0.10671,-0.8599 z m -33.665882,0.63941 c 0.0127,-0.30822 0.07539,-0.37092 0.159853,-0.15985 0.07643,0.19099 0.06703,0.4192 -0.02089,0.50712 -0.08792,0.0879 -0.150453,-0.0684 -0.138963,-0.34727 z M 106.12278,123.129 c 0,-0.3638 0.0601,-0.51263 0.13346,-0.33072 0.0734,0.1819 0.0734,0.47955 0,0.66145 -0.0734,0.1819 -0.13346,0.0331 -0.13346,-0.33073 z m -28.066718,-8.35642 c 0.01269,-0.30822 0.07539,-0.37092 0.159852,-0.15985 0.07643,0.19099 0.06703,0.4192 -0.02089,0.50712 -0.08792,0.0879 -0.150453,-0.0683 -0.138964,-0.34727 z m -8.995834,-12.43541 c 0.0127,-0.30823 0.07539,-0.37092 0.159853,-0.15986 0.07643,0.191 0.06703,0.4192 -0.02089,0.50712 -0.08792,0.0879 -0.150453,-0.0684 -0.138963,-0.34726 z m 25.908279,-9.238374 c 0.341776,-0.363802 0.68094,-0.661458 0.7537,-0.661458 0.07276,0 -0.147341,0.297656 -0.489117,0.661458 -0.341775,0.363802 -0.680939,0.661459 -0.7537,0.661459 -0.07276,0 0.147341,-0.297657 0.489117,-0.661459 z"
|
|
56
|
+
id="path850" />
|
|
57
|
+
<path
|
|
58
|
+
style="fill-opacity:1;fill-rule:evenodd;stroke-width:0.264583"
|
|
59
|
+
d="m 102.66231,148.90383 c 0.0127,-0.30822 0.0754,-0.37092 0.15985,-0.15985 0.0764,0.19099 0.067,0.4192 -0.0209,0.50712 -0.0879,0.0879 -0.15046,-0.0684 -0.13897,-0.34727 z m 3.43959,0 c 0.0127,-0.30822 0.0754,-0.37092 0.15985,-0.15985 0.0764,0.19099 0.067,0.4192 -0.0209,0.50712 -0.0879,0.0879 -0.15045,-0.0684 -0.13896,-0.34727 z m -3.37152,-17.04358 c 0,-1.0914 0.0467,-1.53789 0.10378,-0.99218 0.0571,0.5457 0.0571,1.43867 0,1.98437 -0.0571,0.54571 -0.10378,0.0992 -0.10378,-0.99219 z m -33.649263,-3.70416 c 0,-0.3638 0.06005,-0.51263 0.133452,-0.33073 0.0734,0.1819 0.0734,0.47956 0,0.66146 -0.0734,0.1819 -0.133452,0.0331 -0.133452,-0.33073 z m 37.041663,-3.96875 c 0,-0.3638 0.0601,-0.51263 0.13346,-0.33073 0.0734,0.1819 0.0734,0.47956 0,0.66146 -0.0734,0.1819 -0.13346,0.0331 -0.13346,-0.33073 z M 78.056062,113.97883 c 0.01269,-0.30822 0.07539,-0.37092 0.159852,-0.15985 0.07643,0.19099 0.06703,0.4192 -0.02089,0.50712 -0.08792,0.0879 -0.150453,-0.0683 -0.138964,-0.34727 z m -8.995834,-10.84791 c 0.0127,-0.30823 0.07539,-0.37092 0.159853,-0.15986 0.07643,0.191 0.06703,0.4192 -0.02089,0.50712 -0.08792,0.0879 -0.150453,-0.0683 -0.138963,-0.34726 z m 70.643752,-0.26459 c 0.0127,-0.30822 0.0754,-0.37092 0.15985,-0.15985 0.0764,0.19099 0.067,0.4192 -0.0209,0.50712 -0.0879,0.0879 -0.15045,-0.0683 -0.13896,-0.34727 z"
|
|
60
|
+
id="path848" />
|
|
61
|
+
<path
|
|
62
|
+
style="fill-opacity:1;fill-rule:evenodd;stroke-width:0.264583"
|
|
63
|
+
d="m 102.66231,148.11008 c 0.0127,-0.30822 0.0754,-0.37092 0.15985,-0.15985 0.0764,0.19099 0.067,0.4192 -0.0209,0.50712 -0.0879,0.0879 -0.15046,-0.0683 -0.13897,-0.34727 z m 0.0659,-12.67795 c 10e-4,-1.01865 0.049,-1.40294 0.10628,-0.854 0.0573,0.54895 0.0563,1.38239 -0.002,1.85209 -0.0585,0.4697 -0.10531,0.0206 -0.10414,-0.99809 z m 36.99663,-6.74688 c 0,-0.3638 0.06,-0.51263 0.13345,-0.33072 0.0734,0.1819 0.0734,0.47955 0,0.66145 -0.0734,0.1819 -0.13345,0.0331 -0.13345,-0.33073 z m -70.643753,-1.5875 c 0,-0.3638 0.06005,-0.51263 0.133452,-0.33072 0.0734,0.1819 0.0734,0.47955 0,0.66145 -0.0734,0.1819 -0.133452,0.0331 -0.133452,-0.33073 z m 37.051473,-1.71979 c 0.005,-0.43656 0.0647,-0.58312 0.13177,-0.32569 0.0671,0.25743 0.0627,0.61462 -0.01,0.79375 -0.0725,0.17913 -0.12736,-0.0315 -0.12197,-0.46806 z m 24.88063,-8.86354 c 0,-0.50932 0.0545,-0.71768 0.12101,-0.46302 0.0665,0.25466 0.0665,0.67138 0,0.92604 -0.0666,0.25466 -0.12101,0.0463 -0.12101,-0.46302 z m -52.957158,-3.32934 c 0.01269,-0.30822 0.07539,-0.37092 0.159852,-0.15985 0.07643,0.19099 0.06703,0.4192 -0.02089,0.50712 -0.08792,0.0879 -0.150453,-0.0683 -0.138964,-0.34727 z m -8.965141,-8.97378 c 0.0054,-0.43657 0.06469,-0.58313 0.131773,-0.3257 0.06708,0.25743 0.06267,0.61462 -0.0098,0.79375 -0.07248,0.17913 -0.127363,-0.0315 -0.12197,-0.46805 z m 70.613059,-0.55122 c 0.0127,-0.30822 0.0754,-0.37092 0.15985,-0.15985 0.0764,0.19099 0.067,0.4192 -0.0209,0.50712 -0.0879,0.0879 -0.15045,-0.0684 -0.13896,-0.34727 z"
|
|
64
|
+
id="path846" />
|
|
65
|
+
<path
|
|
66
|
+
style="fill-opacity:1;fill-rule:evenodd;stroke-width:0.264583"
|
|
67
|
+
d="m 106.1019,147.58092 c 0.0127,-0.30823 0.0754,-0.37092 0.15985,-0.15986 0.0764,0.191 0.067,0.4192 -0.0209,0.50712 -0.0879,0.0879 -0.15045,-0.0684 -0.13896,-0.34726 z m -3.4187,-0.37483 c 0,-0.3638 0.0601,-0.51263 0.13345,-0.33073 0.0734,0.1819 0.0734,0.47956 0,0.66146 -0.0734,0.1819 -0.13345,0.0331 -0.13345,-0.33073 z m 0.0429,-8.46667 c 0,-0.94588 0.048,-1.33284 0.10671,-0.85989 0.0587,0.47294 0.0587,1.24684 0,1.71979 -0.0587,0.47294 -0.10671,0.086 -0.10671,-0.8599 z m 37.00856,-11.24479 c 0.005,-0.43656 0.0647,-0.58313 0.13177,-0.32569 0.0671,0.25743 0.0627,0.61461 -0.01,0.79375 -0.0725,0.17913 -0.12736,-0.0315 -0.12197,-0.46806 z m -33.60208,-0.79375 c 0.005,-0.43656 0.0647,-0.58313 0.13177,-0.32569 0.0671,0.25743 0.0627,0.61461 -0.01,0.79375 -0.0725,0.17913 -0.12736,-0.0315 -0.12197,-0.46806 z m 13.57446,-4.89479 c 0.26339,-0.29104 0.53842,-0.52917 0.61118,-0.52917 0.0728,0 -0.0832,0.23813 -0.3466,0.52917 -0.26339,0.29104 -0.53842,0.52916 -0.61118,0.52916 -0.0728,0 0.0832,-0.23812 0.3466,-0.52916 z m -50.595647,-15.875 c 0,-0.65485 0.0516,-0.92274 0.114663,-0.59531 0.06306,0.32742 0.06306,0.8632 0,1.19062 -0.06307,0.32742 -0.114663,0.0595 -0.114663,-0.59531 z m 70.613467,-1.32292 c 0,-0.3638 0.06,-0.51263 0.13345,-0.33073 0.0734,0.1819 0.0734,0.47956 0,0.66146 -0.0734,0.1819 -0.13345,0.0331 -0.13345,-0.33073 z m -36.2688,-13.118922 c 0.0127,-0.308225 0.0754,-0.37092 0.15985,-0.159853 0.0764,0.190996 0.067,0.4192 -0.0209,0.507118 -0.0879,0.08792 -0.15046,-0.06835 -0.13897,-0.347265 z"
|
|
68
|
+
id="path844" />
|
|
69
|
+
<path
|
|
70
|
+
style="fill-opacity:1;fill-rule:evenodd;stroke-width:0.264583"
|
|
71
|
+
d="m 106.12278,146.67692 c 0,-0.3638 0.0601,-0.51263 0.13346,-0.33073 0.0734,0.1819 0.0734,0.47956 0,0.66146 -0.0734,0.1819 -0.13346,0.0331 -0.13346,-0.33073 z m -3.3794,-3.175 c 0,-1.81901 0.0423,-2.56315 0.0939,-1.65364 0.0517,0.9095 0.0517,2.39778 0,3.30729 -0.0517,0.9095 -0.0939,0.16536 -0.0939,-1.65365 z m 3.39901,-15.34583 c 0,-0.50932 0.0544,-0.71768 0.121,-0.46302 0.0665,0.25466 0.0665,0.67138 0,0.92604 -0.0666,0.25466 -0.121,0.0463 -0.121,-0.46302 z m 33.61637,-2.51354 c 0.002,-0.72761 0.0534,-0.99386 0.11419,-0.59168 0.0608,0.40218 0.0592,0.9975 -0.004,1.32292 -0.0628,0.32542 -0.11256,-0.004 -0.11057,-0.73124 z m -70.626971,-4.8948 c 0,-1.23692 0.04558,-1.74294 0.101281,-1.12447 0.0557,0.61846 0.0557,1.63049 0,2.24895 -0.0557,0.61847 -0.101281,0.11245 -0.101281,-1.12448 z m 0,-7.9375 c 0,-1.23692 0.04558,-1.74294 0.101281,-1.12447 0.0557,0.61846 0.0557,1.63049 0,2.24895 -0.0557,0.61847 -0.101281,0.11245 -0.101281,-1.12448 z m 8.924273,-0.94808 c 0.01269,-0.30823 0.07539,-0.37092 0.159852,-0.15986 0.07643,0.191 0.06703,0.4192 -0.02089,0.50712 -0.08792,0.0879 -0.150453,-0.0683 -0.138964,-0.34726 z m -8.995834,-4.49792 c 0.0127,-0.30823 0.07539,-0.37092 0.159853,-0.15985 0.07643,0.19099 0.06703,0.41919 -0.02089,0.50711 -0.08792,0.0879 -0.150453,-0.0684 -0.138963,-0.34726 z m 70.698532,-1.03629 c 0.002,-0.7276 0.0534,-0.99385 0.11419,-0.59167 0.0608,0.40218 0.0592,0.99749 -0.004,1.32292 -0.0628,0.32542 -0.11256,-0.004 -0.11057,-0.73125 z"
|
|
72
|
+
id="path842" />
|
|
73
|
+
<path
|
|
74
|
+
style="fill-opacity:1;fill-rule:evenodd;stroke-width:0.264583"
|
|
75
|
+
d="m 106.14773,145.22171 c 0.003,-0.58208 0.0571,-0.78905 0.12041,-0.45993 0.0633,0.32912 0.0609,0.80537 -0.005,1.05833 -0.0662,0.25297 -0.118,-0.0163 -0.11507,-0.5984 z M 81.271558,135.03525 c 0,-0.50932 0.05445,-0.71768 0.121,-0.46302 0.06655,0.25467 0.06655,0.67138 0,0.92605 -0.06655,0.25466 -0.121,0.0463 -0.121,-0.46303 z m 24.891432,-4.6302 c 0.002,-0.87313 0.0509,-1.19842 0.10977,-0.72287 0.0589,0.47555 0.0577,1.18992 -0.003,1.5875 -0.0604,0.39758 -0.10855,0.008 -0.10707,-0.86463 z m 33.63833,-14.4198 c 0,-4.72942 0.0359,-6.66419 0.0797,-4.29947 0.0439,2.36471 0.0439,6.23424 0,8.59895 -0.0438,2.36472 -0.0797,0.42995 -0.0797,-4.29948 z M 101.2689,89.875347 c 0.19099,-0.07643 0.4192,-0.06703 0.50712,0.02089 0.0879,0.08792 -0.0684,0.150453 -0.34727,0.138965 -0.30823,-0.01269 -0.37092,-0.07539 -0.15985,-0.159853 z"
|
|
76
|
+
id="path840" />
|
|
77
|
+
<path
|
|
78
|
+
style="fill-opacity:1;fill-rule:evenodd;stroke-width:0.264583"
|
|
79
|
+
d="m 100.63084,152.58085 c -0.693797,-0.13671 -27.056953,-15.34154 -28.676755,-16.5392 -0.652464,-0.48242 -1.485901,-1.41223 -1.852083,-2.06624 l -0.665787,-1.18911 -0.07411,-15.97543 c -0.06532,-14.08073 -0.02537,-16.04982 0.336829,-16.60261 0.885173,-1.350942 0.90521,-1.34129 19.576664,9.42994 10.964042,6.32496 12.531602,7.45424 13.077782,9.42132 0.18902,0.68076 0.28559,6.35431 0.28657,16.83563 0.001,15.45709 -0.0103,15.82063 -0.52769,16.33802 -0.29104,0.29104 -0.61847,0.51295 -0.72761,0.49314 -0.10914,-0.0198 -0.44835,-0.0853 -0.75381,-0.14546 z m -13.961669,-19.0049 c -0.128201,-0.33409 -4.757612,-3.03861 -5.201281,-3.03861 -0.178662,0 -0.249201,1.0001 -0.200522,2.84297 l 0.0751,2.84298 2.645834,1.52426 2.645833,1.52426 0.07594,-2.6957 c 0.04176,-1.48264 0.02336,-2.83271 -0.0409,-3.00016 z m 0.505558,-3.36498 c 0.205533,-0.69459 0.618871,-1.0561 2.19734,-1.92178 2.489211,-1.36517 2.784811,-1.89682 2.635502,-4.74006 -0.09481,-1.80553 -0.254688,-2.4075 -1.023115,-3.85228 -1.116891,-2.09997 -3.117921,-4.14331 -5.722771,-5.84378 -2.062447,-1.34638 -6.038373,-2.83827 -6.792665,-2.54882 -0.357759,0.13728 -0.433846,0.58556 -0.433846,2.55604 0,1.31425 0.0893,2.39191 0.198437,2.39479 0.109141,0.003 1.006276,0.12205 1.993635,0.26482 3.483251,0.50366 6.010011,2.46578 6.010011,4.667 0,1.24395 -0.32653,1.57018 -2.838188,2.83559 -1.592971,0.80256 -2.2593,1.82791 -2.137773,3.28961 0.0779,0.93695 0.182439,1.03221 2.594711,2.36444 1.382448,0.76349 2.637748,1.38857 2.789555,1.38907 0.15181,5.2e-4 0.389935,-0.38409 0.529167,-0.85464 z m 19.746061,22.06823 c -0.43825,-0.43825 -0.51129,-1.15081 -0.67758,-6.61106 -0.10251,-3.36592 -0.10486,-10.61787 -0.005,-16.11544 0.23854,-13.15996 -0.40802,-11.8516 8.35935,-16.91576 2.81034,-1.62329 8.44346,-4.8804 12.51804,-7.23802 10.72417,-6.20519 11.16569,-6.399341 12.12982,-5.33398 0.39722,0.43892 0.43789,1.95815 0.43789,16.35673 v 15.87286 l -0.72761,1.43651 c -0.46818,0.92434 -1.15946,1.75449 -1.93888,2.32838 -2.28233,1.68051 -27.81681,16.31254 -28.88105,16.54972 -0.51115,0.11392 -0.86777,0.0171 -1.21477,-0.32994 z m 18.14407,-14.00021 0.8599,-0.43133 v -3.01896 -3.01896 l -1.38907,0.78589 c -0.76398,0.43223 -1.98437,1.13628 -2.71197,1.56454 l -1.32292,0.77865 -0.0749,2.97247 -0.0749,2.97247 1.92702,-1.08672 c 1.05986,-0.5977 2.31398,-1.28082 2.78692,-1.51805 z m -1.80571,-7.10792 c 2.52463,-1.46615 2.5571,-1.49786 2.86652,-2.80046 0.17213,-0.72463 1.1454,-2.70645 2.16282,-4.40404 2.03303,-3.39217 2.58651,-4.72101 2.83029,-6.7952 0.30748,-2.61618 -0.83433,-4.36112 -2.85371,-4.36112 -2.11823,0 -6.05706,2.18612 -9.55021,5.30051 l -1.52135,1.3564 v 2.54113 2.54111 l 2.47625,-2.42837 c 3.2662,-3.20305 5.41336,-4.18425 5.81291,-2.65635 0.22908,0.87601 -0.44264,2.6041 -1.93859,4.98724 -0.77645,1.23693 -1.75417,2.98004 -2.17271,3.87358 -0.81817,1.74668 -1.37115,4.3285 -0.92709,4.3285 0.14373,0 1.41042,-0.66732 2.81487,-1.48293 z M 101.4508,112.58395 C 99.799949,111.79876 75.711992,97.930252 73.127407,96.276913 71.730216,95.38314 71.658252,95.283863 71.735746,94.357073 71.835835,93.160052 70.991945,93.700885 89.012109,83.28498 l 13.225891,-7.64475 1.86112,-0.09398 c 1.7751,-0.08964 1.96477,-0.03928 4.10431,1.089739 4.49807,2.373597 27.6636,15.881123 28.37081,16.542659 1.26737,1.185515 0.89147,2.058082 -1.53419,3.561291 -2.45181,1.519414 -24.76707,14.392771 -26.7827,15.450561 -2.78112,1.45951 -4.37184,1.55146 -6.80655,0.39345 z m 14.37812,-12.30552 3.00104,-1.682264 -0.88437,-0.527209 c -2.15806,-1.286499 -3.88403,-2.192036 -4.17806,-2.192036 -0.41545,0 -6.09996,3.167296 -6.09596,3.396544 0.004,0.2432 4.27121,2.628945 4.75944,2.661095 0.21828,0.0144 1.74734,-0.73088 3.39791,-1.65613 z m -8.61464,-2.976164 c 0.75915,-0.380225 2.06625,-1.104056 2.90468,-1.60851 l 1.52441,-0.917192 -0.54838,-0.770125 c -0.49642,-0.69715 -0.53161,-1.002279 -0.37138,-3.220134 0.16358,-2.264369 0.13327,-2.505154 -0.40007,-3.1778 -0.31739,-0.400285 -1.13391,-1.054199 -1.81449,-1.453141 -1.09715,-0.643128 -1.55745,-0.736319 -4.06072,-0.822114 -2.38638,-0.08179 -3.10292,-0.0048 -4.630204,0.497688 -2.224839,0.731947 -4.904745,2.030131 -6.832806,3.309905 -1.530646,1.015984 -4.102563,3.22278 -4.101756,3.519451 5.29e-4,0.194206 1.970143,1.476817 3.341441,2.175947 l 0.891837,0.454684 1.89399,-1.953282 c 2.31707,-2.389603 3.966242,-3.284952 6.028898,-3.27314 2.3568,0.0135 2.4964,0.231492 2.27052,3.545468 l -0.18993,2.786552 0.79853,0.798531 c 0.97755,0.977548 1.52236,0.995273 3.29543,0.107212 z"
|
|
80
|
+
id="path838" />
|
|
81
|
+
</g>
|
|
82
|
+
</g>
|
|
83
|
+
</svg>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"""Workflow Task: Select Entities"""
|
|
2
|
+
|
|
3
|
+
import random
|
|
4
|
+
from collections.abc import Sequence
|
|
5
|
+
|
|
6
|
+
from cmem_plugin_base.dataintegration.context import ExecutionContext
|
|
7
|
+
from cmem_plugin_base.dataintegration.description import Icon, Plugin, PluginParameter
|
|
8
|
+
from cmem_plugin_base.dataintegration.entity import Entities
|
|
9
|
+
from cmem_plugin_base.dataintegration.plugins import WorkflowPlugin
|
|
10
|
+
from cmem_plugin_base.dataintegration.ports import (
|
|
11
|
+
FixedNumberOfInputs,
|
|
12
|
+
FlexibleSchemaPort,
|
|
13
|
+
UnknownSchemaPort,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
param_count = PluginParameter(
|
|
17
|
+
name="number_of_entities",
|
|
18
|
+
label="Number of Entities",
|
|
19
|
+
description="""How many entities should be selected.""",
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
documentation = """This workflow task selects X random entities from an input dataset
|
|
23
|
+
using the standard pseudo-random generator (reservoir sampling).
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@Plugin(
|
|
28
|
+
label="Select random entities",
|
|
29
|
+
icon=Icon(file_name="random.svg", package=__package__),
|
|
30
|
+
plugin_id="cmem_plugin_random-SelectEntities",
|
|
31
|
+
description="Select X random entities from an input dataset.",
|
|
32
|
+
documentation=documentation,
|
|
33
|
+
parameters=[param_count],
|
|
34
|
+
)
|
|
35
|
+
class SelectEntities(WorkflowPlugin):
|
|
36
|
+
"""Workflow Task: Select Entities"""
|
|
37
|
+
|
|
38
|
+
def __init__(
|
|
39
|
+
self,
|
|
40
|
+
number_of_entities: int = 10,
|
|
41
|
+
) -> None:
|
|
42
|
+
if number_of_entities < 1:
|
|
43
|
+
raise ValueError("Entities (Rows) needs to be a positive integer.")
|
|
44
|
+
self.number_of_entities = number_of_entities
|
|
45
|
+
|
|
46
|
+
# Input and output ports
|
|
47
|
+
self.input_ports = FixedNumberOfInputs([UnknownSchemaPort()])
|
|
48
|
+
self.output_port = FlexibleSchemaPort()
|
|
49
|
+
|
|
50
|
+
def execute(
|
|
51
|
+
self,
|
|
52
|
+
inputs: Sequence[Entities],
|
|
53
|
+
context: ExecutionContext, # noqa: ARG002
|
|
54
|
+
) -> Entities:
|
|
55
|
+
"""Execute the workflow plugin on a given collection of entities."""
|
|
56
|
+
self.log.info("Start selecting random entities.")
|
|
57
|
+
output_entities = []
|
|
58
|
+
for i, entity in enumerate(inputs[0].entities):
|
|
59
|
+
if i < self.number_of_entities:
|
|
60
|
+
output_entities.append(entity)
|
|
61
|
+
else:
|
|
62
|
+
random_int = random.randrange(i + 1) # noqa: S311
|
|
63
|
+
if random_int < self.number_of_entities:
|
|
64
|
+
output_entities[random_int] = entity
|
|
65
|
+
|
|
66
|
+
return Entities(entities=iter(output_entities), schema=inputs[0].schema)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cmem-plugin-random
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary: Select random samples and generate random values.
|
|
5
|
+
License: Apache-2.0
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Keywords: eccenca Corporate Memory,plugin
|
|
8
|
+
Author: eccenca GmbH
|
|
9
|
+
Author-email: cmempy-developer@eccenca.com
|
|
10
|
+
Requires-Python: >=3.13,<4.0
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: Plugins
|
|
13
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Requires-Dist: cmem-plugin-base (>=4.15.0,<5.0.0)
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
# cmem-plugin-random
|
|
21
|
+
|
|
22
|
+
Select random samples and generate random values.
|
|
23
|
+
|
|
24
|
+
[![eccenca Corporate Memory][cmem-shield]][cmem-link]
|
|
25
|
+
|
|
26
|
+
This is a plugin for [eccenca](https://eccenca.com) [Corporate Memory](https://documentation.eccenca.com). You can install it with the [cmemc](https://eccenca.com/go/cmemc) command line client like this:
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
cmemc admin workspace python install cmem-plugin-random
|
|
30
|
+
```
|
|
31
|
+
[](https://pypi.org/project/cmem-plugin-random) [](https://pypi.org/project/cmem-plugin-random)
|
|
32
|
+
[![poetry][poetry-shield]][poetry-link] [![ruff][ruff-shield]][ruff-link] [![mypy][mypy-shield]][mypy-link] [![copier][copier-shield]][copier]
|
|
33
|
+
|
|
34
|
+
[cmem-link]: https://documentation.eccenca.com
|
|
35
|
+
[cmem-shield]: https://img.shields.io/endpoint?url=https://dev.documentation.eccenca.com/badge.json
|
|
36
|
+
[poetry-link]: https://python-poetry.org/
|
|
37
|
+
[poetry-shield]: https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json
|
|
38
|
+
[ruff-link]: https://docs.astral.sh/ruff/
|
|
39
|
+
[ruff-shield]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json&label=Code%20Style
|
|
40
|
+
[mypy-link]: https://mypy-lang.org/
|
|
41
|
+
[mypy-shield]: https://www.mypy-lang.org/static/mypy_badge.svg
|
|
42
|
+
[copier]: https://copier.readthedocs.io/
|
|
43
|
+
[copier-shield]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/copier-org/copier/master/img/badge/badge-grayscale-inverted-border-purple.json
|
|
44
|
+
|
|
45
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
cmem_plugin_random/__init__.py,sha256=w-O8QSj8f6RhfE1bQqjc1-PsPN73AH80irzfc7wU4cI,25
|
|
2
|
+
cmem_plugin_random/common.py,sha256=18QSj8AtTnG1NafyyaMgUR3zYEQqYfzsUj9fjUB6UB8,647
|
|
3
|
+
cmem_plugin_random/generate_entities.py,sha256=8FhZ6R1zVsGg3_A9jf-K0rt7EP5TC31MBtVo8Yv1NY4,5954
|
|
4
|
+
cmem_plugin_random/generate_values.py,sha256=MKwO_W2E_H0osSpEV4G-KapSzYAVl3jbHCXewWk61uI,1449
|
|
5
|
+
cmem_plugin_random/random.svg,sha256=XK6gTFeD7BJQYbMXr9BBBS6NXCCDfJ5dp6D5ucN3KRY,15411
|
|
6
|
+
cmem_plugin_random/select_entities.py,sha256=OS9cZZJ4iMB5S7AEWUze2aB3cZ5SMAMpkajC60HO-Nk,2322
|
|
7
|
+
cmem_plugin_random-0.5.0.dist-info/METADATA,sha256=q8mTxUW6bMSlXYqgGr7oEWsVjm-5BLRLzc7FQnfnG1M,2221
|
|
8
|
+
cmem_plugin_random-0.5.0.dist-info/WHEEL,sha256=Vz2fHgx6HFtSwhs8KvkHLqH5Ea4w1_rner5uNVGCeIE,88
|
|
9
|
+
cmem_plugin_random-0.5.0.dist-info/licenses/LICENSE,sha256=5t6lcWcFU3TBO5wwq9PYNbgzfVfFUuL-80v5BTGuuMQ,11334
|
|
10
|
+
cmem_plugin_random-0.5.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2021 CMEM
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|