id
stringlengths
24
24
repo
stringlengths
7
52
path
stringlengths
5
138
func_name
stringlengths
1
134
url
stringlengths
89
242
split
stringclasses
3 values
language
stringclasses
1 value
docstring
stringlengths
1
46.9k
code
stringlengths
87
104k
text
stringlengths
100
112k
token_count
int32
25
38.1k
doc_chars
int32
1
46.9k
code_chars
int32
87
104k
license_basis
stringclasses
1 value
source
stringclasses
1 value
added
stringdate
2026-12-05 00:00:00
2026-12-05 00:00:00
record_sha256
stringlengths
64
64
license
stringclasses
9 values
license_class
stringclasses
1 value
license_source
stringlengths
46
99
7f21c0ba33657e7ad559ea4e
jamescooke/flake8-aaa
src/flake8_aaa/helpers.py
add_node_parents
https://github.com/jamescooke/flake8-aaa/blob/29938b96845fe32ced4358ba66af3b3be2a37794/src/flake8_aaa/helpers.py#L146-L154
train
python
Adds "parent" attribute to all child nodes of passed node. Code taken from https://stackoverflow.com/a/43311383/1286705
def add_node_parents(root: ast.AST) -> None: """ Adds "parent" attribute to all child nodes of passed node. Code taken from https://stackoverflow.com/a/43311383/1286705 """ for node in ast.walk(root): for child in ast.iter_child_nodes(node): child.parent = node
Adds "parent" attribute to all child nodes of passed node. Code taken from https://stackoverflow.com/a/43311383/1286705 def add_node_parents(root: ast.AST) -> None: """ Adds "parent" attribute to all child nodes of passed node. Code taken from https://stackoverflow.com/a/43311383/1286705 """ ...
103
124
302
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
0848b1847e67d529ca2853ae7f36e60757c418d60a03f2c0cb01d77dc08cbc30
MIT
permissive
https://github.com/jamescooke/flake8-aaa/blob/master/LICENSE
36cf9dba962d2a3184729474
jamescooke/flake8-aaa
src/flake8_aaa/helpers.py
build_footprint
https://github.com/jamescooke/flake8-aaa/blob/29938b96845fe32ced4358ba66af3b3be2a37794/src/flake8_aaa/helpers.py#L157-L167
train
python
Generates a list of lines that the passed node covers, relative to the marked lines list - i.e. start of function is line 0.
def build_footprint(node: ast.AST, first_line_no: int) -> Set[int]: """ Generates a list of lines that the passed node covers, relative to the marked lines list - i.e. start of function is line 0. """ return set( range( get_first_token(node).start[0] - first_line_no, ...
Generates a list of lines that the passed node covers, relative to the marked lines list - i.e. start of function is line 0. def build_footprint(node: ast.AST, first_line_no: int) -> Set[int]: """ Generates a list of lines that the passed node covers, relative to the marked lines list - i.e. start of f...
132
128
384
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
923ee81bdfeb447107e97b53bb944dc7eee56fc1c6df5b00613850c62df3608b
MIT
permissive
https://github.com/jamescooke/flake8-aaa/blob/master/LICENSE
e772f0216826bbd190de9a1d
jamescooke/flake8-aaa
src/flake8_aaa/helpers.py
filter_arrange_nodes
https://github.com/jamescooke/flake8-aaa/blob/29938b96845fe32ced4358ba66af3b3be2a37794/src/flake8_aaa/helpers.py#L170-L178
train
python
Finds all nodes that are before the ``max_line_number`` and are not docstrings or ``pass``.
def filter_arrange_nodes(nodes: List[ast.stmt], max_line_number: int) -> List[ast.stmt]: """ Finds all nodes that are before the ``max_line_number`` and are not docstrings or ``pass``. """ return [ node for node in nodes if node.lineno < max_line_number and not isinstance(node, ast.Pass) ...
Finds all nodes that are before the ``max_line_number`` and are not docstrings or ``pass``. def filter_arrange_nodes(nodes: List[ast.stmt], max_line_number: int) -> List[ast.stmt]: """ Finds all nodes that are before the ``max_line_number`` and are not docstrings or ``pass``. """ return [ ...
126
95
403
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
6fe0ba0f035eda3f6f4ff43321e520e7331005f5cb915f126157401622b974e9
MIT
permissive
https://github.com/jamescooke/flake8-aaa/blob/master/LICENSE
d839807913988b15613968a9
jamescooke/flake8-aaa
src/flake8_aaa/helpers.py
filter_assert_nodes
https://github.com/jamescooke/flake8-aaa/blob/29938b96845fe32ced4358ba66af3b3be2a37794/src/flake8_aaa/helpers.py#L181-L185
train
python
Finds all nodes that are after the ``min_line_number``
def filter_assert_nodes(nodes: List[ast.stmt], min_line_number: int) -> List[ast.stmt]: """ Finds all nodes that are after the ``min_line_number`` """ return [node for node in nodes if node.lineno > min_line_number]
Finds all nodes that are after the ``min_line_number`` def filter_assert_nodes(nodes: List[ast.stmt], min_line_number: int) -> List[ast.stmt]: """ Finds all nodes that are after the ``min_line_number`` """ return [node for node in nodes if node.lineno > min_line_number]
73
54
231
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
1ac2db282f8a95f5d38c4295e66722a651ce0a82f37fe0840b7039626f537266
MIT
permissive
https://github.com/jamescooke/flake8-aaa/blob/master/LICENSE
a2c532289c8914d29a0a9388
jamescooke/flake8-aaa
src/flake8_aaa/helpers.py
find_stringy_lines
https://github.com/jamescooke/flake8-aaa/blob/29938b96845fe32ced4358ba66af3b3be2a37794/src/flake8_aaa/helpers.py#L188-L197
train
python
Finds all lines that contain a string in a tree, usually a function. These lines will be ignored when searching for blank lines.
def find_stringy_lines(tree: ast.AST, first_line_no: int) -> Set[int]: """ Finds all lines that contain a string in a tree, usually a function. These lines will be ignored when searching for blank lines. """ str_footprints = set() for node in ast.walk(tree): if isinstance(node, ast.Str):...
Finds all lines that contain a string in a tree, usually a function. These lines will be ignored when searching for blank lines. def find_stringy_lines(tree: ast.AST, first_line_no: int) -> Set[int]: """ Finds all lines that contain a string in a tree, usually a function. These lines will be ignored wh...
125
132
418
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
2a1b4b0cf28ff0ef0e523cd44993c787c6be303041a3d17447b478ec64a6cd9c
MIT
permissive
https://github.com/jamescooke/flake8-aaa/blob/master/LICENSE
8120435d8f7e358b4848ba51
jamescooke/flake8-aaa
src/flake8_aaa/function.py
Function.check_all
https://github.com/jamescooke/flake8-aaa/blob/29938b96845fe32ced4358ba66af3b3be2a37794/src/flake8_aaa/function.py#L64-L99
train
python
Run everything required for checking this function. Returns: A generator of errors. Raises: ValidationError: A non-recoverable linting error is found.
def check_all(self) -> Generator[AAAError, None, None]: """ Run everything required for checking this function. Returns: A generator of errors. Raises: ValidationError: A non-recoverable linting error is found. """ # Function def if funct...
Run everything required for checking this function. Returns: A generator of errors. Raises: ValidationError: A non-recoverable linting error is found. def check_all(self) -> Generator[AAAError, None, None]: """ Run everything required for checking this function...
333
192
1,444
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
223ee2ac4b65cf8b5380ef1ac1e84d362c4e05c8a681e274634cf9da9e4cd175
MIT
permissive
https://github.com/jamescooke/flake8-aaa/blob/master/LICENSE
e2d919fdd2769bc23a6c4620
jamescooke/flake8-aaa
src/flake8_aaa/function.py
Function.load_act_node
https://github.com/jamescooke/flake8-aaa/blob/29938b96845fe32ced4358ba66af3b3be2a37794/src/flake8_aaa/function.py#L101-L122
train
python
Raises: ValidationError: AAA01 when no act block is found and AAA02 when multiple act blocks are found.
def load_act_node(self) -> ActNode: """ Raises: ValidationError: AAA01 when no act block is found and AAA02 when multiple act blocks are found. """ act_nodes = ActNode.build_body(self.node.body) if not act_nodes: raise ValidationError(self...
Raises: ValidationError: AAA01 when no act block is found and AAA02 when multiple act blocks are found. def load_act_node(self) -> ActNode: """ Raises: ValidationError: AAA01 when no act block is found and AAA02 when multiple act blocks are found....
204
131
898
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
bfe20337497d72e7411e43bc32f0982834f1d362eefa412865f6e04ab1e6c5f7
MIT
permissive
https://github.com/jamescooke/flake8-aaa/blob/master/LICENSE
cd686e19eb4831439dccca74
jamescooke/flake8-aaa
src/flake8_aaa/function.py
Function.get_line_relative_to_node
https://github.com/jamescooke/flake8-aaa/blob/29938b96845fe32ced4358ba66af3b3be2a37794/src/flake8_aaa/function.py#L124-L130
train
python
Raises: IndexError: when ``offset`` takes the request out of bounds of this Function's lines.
def get_line_relative_to_node(self, target_node: ast.AST, offset: int) -> str: """ Raises: IndexError: when ``offset`` takes the request out of bounds of this Function's lines. """ return self.lines[target_node.lineno - self.node.lineno + offset]
Raises: IndexError: when ``offset`` takes the request out of bounds of this Function's lines. def get_line_relative_to_node(self, target_node: ast.AST, offset: int) -> str: """ Raises: IndexError: when ``offset`` takes the request out of bounds of this ...
89
121
306
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
aa5898ce4edbfdf03e05913f0b294c9450e22f05e639f6df05d5721589f943fb
MIT
permissive
https://github.com/jamescooke/flake8-aaa/blob/master/LICENSE
f53bf0ba034afd187825bd38
jamescooke/flake8-aaa
src/flake8_aaa/function.py
Function.mark_def
https://github.com/jamescooke/flake8-aaa/blob/29938b96845fe32ced4358ba66af3b3be2a37794/src/flake8_aaa/function.py#L132-L157
train
python
Marks up this Function's definition lines (including decorators) into the ``line_markers`` attribute. Returns: Number of lines found for the definition. Note: Does not spot the closing ``):`` of a function when it occurs on its own line. Note: ...
def mark_def(self) -> int: """ Marks up this Function's definition lines (including decorators) into the ``line_markers`` attribute. Returns: Number of lines found for the definition. Note: Does not spot the closing ``):`` of a function when it occurs on...
Marks up this Function's definition lines (including decorators) into the ``line_markers`` attribute. Returns: Number of lines found for the definition. Note: Does not spot the closing ``):`` of a function when it occurs on its own line. Note: ...
327
506
1,071
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
f633eac8ec7e66a43a7003f9451c94e0812262c88aa97edb762cc5a9cb721d90
MIT
permissive
https://github.com/jamescooke/flake8-aaa/blob/master/LICENSE
76817f51e27c69b988f8c975
jamescooke/flake8-aaa
src/flake8_aaa/function.py
Function.mark_bl
https://github.com/jamescooke/flake8-aaa/blob/29938b96845fe32ced4358ba66af3b3be2a37794/src/flake8_aaa/function.py#L159-L174
train
python
Mark unprocessed lines that have no content and no string nodes covering them as blank line BL. Returns: Number of blank lines found with no stringy parent node.
def mark_bl(self) -> int: """ Mark unprocessed lines that have no content and no string nodes covering them as blank line BL. Returns: Number of blank lines found with no stringy parent node. """ counter = 0 stringy_lines = find_stringy_lines(self.nod...
Mark unprocessed lines that have no content and no string nodes covering them as blank line BL. Returns: Number of blank lines found with no stringy parent node. def mark_bl(self) -> int: """ Mark unprocessed lines that have no content and no string nodes covering t...
162
190
619
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
657ecbebd8da31ee9fecb095fe4ac5b8a3e75d2ae31c4c808c8a9790b048d259
MIT
permissive
https://github.com/jamescooke/flake8-aaa/blob/master/LICENSE
e6251eb6f60494eeec9a5e04
MatterMiners/cobald
cobald/daemon/runners/meta_runner.py
MetaRunner.register_payload
https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/daemon/runners/meta_runner.py#L35-L39
train
python
Queue one or more payload for execution after its runner is started
def register_payload(self, *payloads, flavour: ModuleType): """Queue one or more payload for execution after its runner is started""" for payload in payloads: self._logger.debug('registering payload %s (%s)', NameRepr(payload), NameRepr(flavour)) self.runners[flavour].register_pa...
Queue one or more payload for execution after its runner is started def register_payload(self, *payloads, flavour: ModuleType): """Queue one or more payload for execution after its runner is started""" for payload in payloads: self._logger.debug('registering payload %s (%s)', NameRepr(paylo...
84
67
334
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
aa03ac12277b3c944407840a3eda5e944471b94af6b1d5ab4b90fee9f3188bc0
MIT
permissive
https://github.com/MatterMiners/cobald/blob/master/LICENSE
ed5933cf2e1ab41d017dcd3a
MatterMiners/cobald
cobald/daemon/runners/meta_runner.py
MetaRunner.run_payload
https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/daemon/runners/meta_runner.py#L41-L43
train
python
Execute one payload after its runner is started and return its output
def run_payload(self, payload, *, flavour: ModuleType): """Execute one payload after its runner is started and return its output""" return self.runners[flavour].run_payload(payload)
Execute one payload after its runner is started and return its output def run_payload(self, payload, *, flavour: ModuleType): """Execute one payload after its runner is started and return its output""" return self.runners[flavour].run_payload(payload)
53
69
197
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
f5603c2a4723bc3461878f9bf28fa48f8b5b88b7fed1ecd55ab0748366aa0058
MIT
permissive
https://github.com/MatterMiners/cobald/blob/master/LICENSE
57c31769b573b77bb4658362
MatterMiners/cobald
cobald/daemon/runners/meta_runner.py
MetaRunner.run
https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/daemon/runners/meta_runner.py#L45-L66
train
python
Run all runners, blocking until completion or error
def run(self): """Run all runners, blocking until completion or error""" self._logger.info('starting all runners') try: with self._lock: assert not self.running.set(), 'cannot re-run: %s' % self self.running.set() thread_runner = self.runne...
Run all runners, blocking until completion or error def run(self): """Run all runners, blocking until completion or error""" self._logger.info('starting all runners') try: with self._lock: assert not self.running.set(), 'cannot re-run: %s' % self self...
182
51
951
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
3735bc8f4854d22dc98b8344c06bf98f344026b8cd40ae3c0bc0b15811a80ac0
MIT
permissive
https://github.com/MatterMiners/cobald/blob/master/LICENSE
ca1c7f3da9b27b8948a6c6ef
developersociety/django-glitter
glitter/blocks/image/admin.py
ImageBlockAdmin.formfield_for_dbfield
https://github.com/developersociety/django-glitter/blob/2c0280ec83afee80deee94ee3934fc54239c2e87/glitter/blocks/image/admin.py#L21-L34
train
python
Hook for specifying the form Field instance for a given database Field instance. If kwargs are given, they're passed to the form Field's constructor.
def formfield_for_dbfield(self, db_field, **kwargs): """ Hook for specifying the form Field instance for a given database Field instance. If kwargs are given, they're passed to the form Field's constructor. """ formfield = super().formfield_for_dbfield(db_field, **kwargs...
Hook for specifying the form Field instance for a given database Field instance. If kwargs are given, they're passed to the form Field's constructor. def formfield_for_dbfield(self, db_field, **kwargs): """ Hook for specifying the form Field instance for a given database Field ...
149
166
585
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
c6e8020965055a7d324f84624ad84033c53bfa22705f0ba5810b370d4050d26d
BSD-3-Clause
permissive
https://github.com/developersociety/django-glitter/blob/master/LICENSE
b963757ee66e97e52103646a
beregond/jsonmodels
jsonmodels/utilities.py
compare_schemas
https://github.com/beregond/jsonmodels/blob/97a1a6b90a49490fc5a6078f49027055d2e13541/jsonmodels/utilities.py#L60-L90
train
python
Compare two structures that represents JSON schemas. For comparison you can't use normal comparison, because in JSON schema lists DO NOT keep order (and Python lists do), so this must be taken into account during comparison. Note this wont check all configurations, only first one that seems to mat...
def compare_schemas(one, two): """Compare two structures that represents JSON schemas. For comparison you can't use normal comparison, because in JSON schema lists DO NOT keep order (and Python lists do), so this must be taken into account during comparison. Note this wont check all configurations...
Compare two structures that represents JSON schemas. For comparison you can't use normal comparison, because in JSON schema lists DO NOT keep order (and Python lists do), so this must be taken into account during comparison. Note this wont check all configurations, only first one that seems to mat...
321
459
984
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
9670efc5e622d143060039a19394df1f7429fb71befd66a904421fc46bf8a705
BSD-3-Clause
permissive
https://github.com/beregond/jsonmodels/blob/main/LICENSE
b4b1df4b1dd489537b969299
beregond/jsonmodels
jsonmodels/utilities.py
is_ecma_regex
https://github.com/beregond/jsonmodels/blob/97a1a6b90a49490fc5a6078f49027055d2e13541/jsonmodels/utilities.py#L93-L112
train
python
Check if given regex is of type ECMA 262 or not. :rtype: bool
def is_ecma_regex(regex): """Check if given regex is of type ECMA 262 or not. :rtype: bool """ parts = regex.split('/') if len(parts) == 1: return False if len(parts) < 3: raise ValueError('Given regex isn\'t ECMA regex nor Python regex.') parts.pop() parts.append('')...
Check if given regex is of type ECMA 262 or not. :rtype: bool def is_ecma_regex(regex): """Check if given regex is of type ECMA 262 or not. :rtype: bool """ parts = regex.split('/') if len(parts) == 1: return False if len(parts) < 3: raise ValueError('Given regex isn\'t...
133
66
452
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
b3d4843084dd55a39d03bce8532d4f94752cc229333b107da8ac78b788efb219
BSD-3-Clause
permissive
https://github.com/beregond/jsonmodels/blob/main/LICENSE
5bfab2772609b3fcc57d50b0
beregond/jsonmodels
jsonmodels/utilities.py
convert_ecma_regex_to_python
https://github.com/beregond/jsonmodels/blob/97a1a6b90a49490fc5a6078f49027055d2e13541/jsonmodels/utilities.py#L115-L136
train
python
Convert ECMA 262 regex to Python tuple with regex and flags. If given value is already Python regex it will be returned unchanged. :param string value: ECMA regex. :return: 2-tuple with `regex` and `flags` :rtype: namedtuple
def convert_ecma_regex_to_python(value): """Convert ECMA 262 regex to Python tuple with regex and flags. If given value is already Python regex it will be returned unchanged. :param string value: ECMA regex. :return: 2-tuple with `regex` and `flags` :rtype: namedtuple """ if not is_ecma_r...
Convert ECMA 262 regex to Python tuple with regex and flags. If given value is already Python regex it will be returned unchanged. :param string value: ECMA regex. :return: 2-tuple with `regex` and `flags` :rtype: namedtuple def convert_ecma_regex_to_python(value): """Convert ECMA 262 regex to Py...
213
242
638
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
abc53efc6dead26f47249adcb4219e90fb834eafa2d3f565e40e242405745378
BSD-3-Clause
permissive
https://github.com/beregond/jsonmodels/blob/main/LICENSE
14eb869ac740e97c5846b633
beregond/jsonmodels
jsonmodels/utilities.py
convert_python_regex_to_ecma
https://github.com/beregond/jsonmodels/blob/97a1a6b90a49490fc5a6078f49027055d2e13541/jsonmodels/utilities.py#L139-L156
train
python
Convert Python regex to ECMA 262 regex. If given value is already ECMA regex it will be returned unchanged. :param string value: Python regex. :param list flags: List of flags (allowed flags: `re.I`, `re.M`) :return: ECMA 262 regex :rtype: str
def convert_python_regex_to_ecma(value, flags=[]): """Convert Python regex to ECMA 262 regex. If given value is already ECMA regex it will be returned unchanged. :param string value: Python regex. :param list flags: List of flags (allowed flags: `re.I`, `re.M`) :return: ECMA 262 regex :rtype: ...
Convert Python regex to ECMA 262 regex. If given value is already ECMA regex it will be returned unchanged. :param string value: Python regex. :param list flags: List of flags (allowed flags: `re.I`, `re.M`) :return: ECMA 262 regex :rtype: str def convert_python_regex_to_ecma(value, flags=[]): ...
212
265
555
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
f3cb3da96d790cfa6ca43c111ae3b0b34e968e55432c5bca0820bb796aefb4b9
BSD-3-Clause
permissive
https://github.com/beregond/jsonmodels/blob/main/LICENSE
6ffbfe7cf4b0ff026f44f16b
beregond/jsonmodels
jsonmodels/models.py
Base.populate
https://github.com/beregond/jsonmodels/blob/97a1a6b90a49490fc5a6078f49027055d2e13541/jsonmodels/models.py#L36-L45
train
python
Populate values to fields. Skip non-existing.
def populate(self, **values): """Populate values to fields. Skip non-existing.""" values = values.copy() fields = list(self.iterate_with_name()) for _, structure_name, field in fields: if structure_name in values: field.__set__(self, values.pop(structure_name)...
Populate values to fields. Skip non-existing. def populate(self, **values): """Populate values to fields. Skip non-existing.""" values = values.copy() fields = list(self.iterate_with_name()) for _, structure_name, field in fields: if structure_name in values: ...
101
45
444
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
0dfcdd9c88913d94a6ea579d6bad7a38a5bf93e313a65fac494c2098196c5a3f
BSD-3-Clause
permissive
https://github.com/beregond/jsonmodels/blob/main/LICENSE
5986636c3269cee6423561f4
beregond/jsonmodels
jsonmodels/models.py
Base.get_field
https://github.com/beregond/jsonmodels/blob/97a1a6b90a49490fc5a6078f49027055d2e13541/jsonmodels/models.py#L47-L53
train
python
Get field associated with given attribute.
def get_field(self, field_name): """Get field associated with given attribute.""" for attr_name, field in self: if field_name == attr_name: return field raise errors.FieldNotFound('Field not found', field_name)
Get field associated with given attribute. def get_field(self, field_name): """Get field associated with given attribute.""" for attr_name, field in self: if field_name == attr_name: return field raise errors.FieldNotFound('Field not found', field_name)
58
42
263
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
e75ef49627b449a4cdfa0220a7527e8a451f6c0e4d0b74a189b0b23be491df67
BSD-3-Clause
permissive
https://github.com/beregond/jsonmodels/blob/main/LICENSE
95b9d882c5039303c58c2988
beregond/jsonmodels
jsonmodels/models.py
Base.validate
https://github.com/beregond/jsonmodels/blob/97a1a6b90a49490fc5a6078f49027055d2e13541/jsonmodels/models.py#L60-L69
train
python
Explicitly validate all the fields.
def validate(self): """Explicitly validate all the fields.""" for name, field in self: try: field.validate_for_object(self) except ValidationError as error: raise ValidationError( "Error for field '{name}'.".format(name=name), ...
Explicitly validate all the fields. def validate(self): """Explicitly validate all the fields.""" for name, field in self: try: field.validate_for_object(self) except ValidationError as error: raise ValidationError( "Error for ...
66
35
363
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
d521ac99b037158e09f62015f8425cbaeb0175b142e5837db581ed8833528896
BSD-3-Clause
permissive
https://github.com/beregond/jsonmodels/blob/main/LICENSE
984276f9911fd23d1de6086e
beregond/jsonmodels
jsonmodels/models.py
Base.iterate_over_fields
https://github.com/beregond/jsonmodels/blob/97a1a6b90a49490fc5a6078f49027055d2e13541/jsonmodels/models.py#L72-L77
train
python
Iterate through fields as `(attribute_name, field_instance)`.
def iterate_over_fields(cls): """Iterate through fields as `(attribute_name, field_instance)`.""" for attr in dir(cls): clsattr = getattr(cls, attr) if isinstance(clsattr, BaseField): yield attr, clsattr
Iterate through fields as `(attribute_name, field_instance)`. def iterate_over_fields(cls): """Iterate through fields as `(attribute_name, field_instance)`.""" for attr in dir(cls): clsattr = getattr(cls, attr) if isinstance(clsattr, BaseField): yield attr, clsat...
65
61
259
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
9b13abad9b321c98726dba4a8f7566275a7400adf6087184eab6de6a3e7b3a61
BSD-3-Clause
permissive
https://github.com/beregond/jsonmodels/blob/main/LICENSE
02eff54c6f6a1712b864b951
beregond/jsonmodels
jsonmodels/models.py
Base.iterate_with_name
https://github.com/beregond/jsonmodels/blob/97a1a6b90a49490fc5a6078f49027055d2e13541/jsonmodels/models.py#L80-L89
train
python
Iterate over fields, but also give `structure_name`. Format is `(attribute_name, structue_name, field_instance)`. Structure name is name under which value is seen in structure and schema (in primitives) and only there.
def iterate_with_name(cls): """Iterate over fields, but also give `structure_name`. Format is `(attribute_name, structue_name, field_instance)`. Structure name is name under which value is seen in structure and schema (in primitives) and only there. """ for attr_name, fi...
Iterate over fields, but also give `structure_name`. Format is `(attribute_name, structue_name, field_instance)`. Structure name is name under which value is seen in structure and schema (in primitives) and only there. def iterate_with_name(cls): """Iterate over fields, but also give `...
145
243
464
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
6e0c47f6396e3c2a164bc9d8d6b9b17ab47c710d45b8576c8d4384424892516e
BSD-3-Clause
permissive
https://github.com/beregond/jsonmodels/blob/main/LICENSE
48457574bb51de25744ab770
beregond/jsonmodels
jsonmodels/fields.py
IntField.parse_value
https://github.com/beregond/jsonmodels/blob/97a1a6b90a49490fc5a6078f49027055d2e13541/jsonmodels/fields.py#L157-L162
train
python
Cast value to `int`, e.g. from string or long
def parse_value(self, value): """Cast value to `int`, e.g. from string or long""" parsed = super(IntField, self).parse_value(value) if parsed is None: return parsed return int(parsed)
Cast value to `int`, e.g. from string or long def parse_value(self, value): """Cast value to `int`, e.g. from string or long""" parsed = super(IntField, self).parse_value(value) if parsed is None: return parsed return int(parsed)
65
45
227
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
b48c542da3d94bcedbd129c2096b2568474106a2349e1e88f9e682f0772efe5f
BSD-3-Clause
permissive
https://github.com/beregond/jsonmodels/blob/main/LICENSE
d9732351ca990ad46b7b392d
beregond/jsonmodels
jsonmodels/fields.py
BoolField.parse_value
https://github.com/beregond/jsonmodels/blob/97a1a6b90a49490fc5a6078f49027055d2e13541/jsonmodels/fields.py#L178-L181
train
python
Cast value to `bool`.
def parse_value(self, value): """Cast value to `bool`.""" parsed = super(BoolField, self).parse_value(value) return bool(parsed) if parsed is not None else None
Cast value to `bool`. def parse_value(self, value): """Cast value to `bool`.""" parsed = super(BoolField, self).parse_value(value) return bool(parsed) if parsed is not None else None
48
21
184
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
5944afb1b81a24e4eebbff85bbc74d1290c970a7942913389d05bc3b987bb970
BSD-3-Clause
permissive
https://github.com/beregond/jsonmodels/blob/main/LICENSE
c503140662a164666666b736
beregond/jsonmodels
jsonmodels/fields.py
ListField.parse_value
https://github.com/beregond/jsonmodels/blob/97a1a6b90a49490fc5a6078f49027055d2e13541/jsonmodels/fields.py#L245-L255
train
python
Cast value to proper collection.
def parse_value(self, values): """Cast value to proper collection.""" result = self.get_default_value() if not values: return result if not isinstance(values, list): return values return [self._cast_value(value) for value in values]
Cast value to proper collection. def parse_value(self, values): """Cast value to proper collection.""" result = self.get_default_value() if not values: return result if not isinstance(values, list): return values return [self._cast_value(value) for val...
64
32
299
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
37699435c753395d3f7c473d5c8fa157814eaca4398e7171b6ac1c3ad095bfa7
BSD-3-Clause
permissive
https://github.com/beregond/jsonmodels/blob/main/LICENSE
939810454b8c2694773abf00
beregond/jsonmodels
jsonmodels/fields.py
EmbeddedField.parse_value
https://github.com/beregond/jsonmodels/blob/97a1a6b90a49490fc5a6078f49027055d2e13541/jsonmodels/fields.py#L329-L335
train
python
Parse value to proper model type.
def parse_value(self, value): """Parse value to proper model type.""" if not isinstance(value, dict): return value embed_type = self._get_embed_type() return embed_type(**value)
Parse value to proper model type. def parse_value(self, value): """Parse value to proper model type.""" if not isinstance(value, dict): return value embed_type = self._get_embed_type() return embed_type(**value)
52
33
222
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
d78df84dcdbd8f4c1eb0ea4ae6b7014b1631b2d1e6abe4cbec7bdc1c557b8208
BSD-3-Clause
permissive
https://github.com/beregond/jsonmodels/blob/main/LICENSE
9b34a7ec13daaf5feefcf495
beregond/jsonmodels
jsonmodels/fields.py
TimeField.to_struct
https://github.com/beregond/jsonmodels/blob/97a1a6b90a49490fc5a6078f49027055d2e13541/jsonmodels/fields.py#L412-L416
train
python
Cast `time` object to string.
def to_struct(self, value): """Cast `time` object to string.""" if self.str_format: return value.strftime(self.str_format) return value.isoformat()
Cast `time` object to string. def to_struct(self, value): """Cast `time` object to string.""" if self.str_format: return value.strftime(self.str_format) return value.isoformat()
45
29
183
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
104957f8505b6aed3c4ac4d9e4b48fb6b363b52a7e47a58d2f132e4523544dea
BSD-3-Clause
permissive
https://github.com/beregond/jsonmodels/blob/main/LICENSE
a65599e9fbd65a48895fe856
beregond/jsonmodels
jsonmodels/fields.py
TimeField.parse_value
https://github.com/beregond/jsonmodels/blob/97a1a6b90a49490fc5a6078f49027055d2e13541/jsonmodels/fields.py#L418-L424
train
python
Parse string into instance of `time`.
def parse_value(self, value): """Parse string into instance of `time`.""" if value is None: return value if isinstance(value, datetime.time): return value return parse(value).timetz()
Parse string into instance of `time`. def parse_value(self, value): """Parse string into instance of `time`.""" if value is None: return value if isinstance(value, datetime.time): return value return parse(value).timetz()
56
37
239
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
93d6018eda34eeea4083e2ddc800802439b21c0451bd039aafb6b455ffcabd07
BSD-3-Clause
permissive
https://github.com/beregond/jsonmodels/blob/main/LICENSE
38cf9d335d4a9e93b2875da3
beregond/jsonmodels
jsonmodels/fields.py
DateField.to_struct
https://github.com/beregond/jsonmodels/blob/97a1a6b90a49490fc5a6078f49027055d2e13541/jsonmodels/fields.py#L444-L448
train
python
Cast `date` object to string.
def to_struct(self, value): """Cast `date` object to string.""" if self.str_format: return value.strftime(self.str_format) return value.strftime(self.default_format)
Cast `date` object to string. def to_struct(self, value): """Cast `date` object to string.""" if self.str_format: return value.strftime(self.str_format) return value.strftime(self.default_format)
47
29
201
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
eb78a869b7539ce48dc5e23f99f72c455a319a92067ebbb48ded16ce972568d3
BSD-3-Clause
permissive
https://github.com/beregond/jsonmodels/blob/main/LICENSE
d005070ebe718105f76b33ea
beregond/jsonmodels
jsonmodels/fields.py
DateTimeField.parse_value
https://github.com/beregond/jsonmodels/blob/97a1a6b90a49490fc5a6078f49027055d2e13541/jsonmodels/fields.py#L481-L488
train
python
Parse string into instance of `datetime`.
def parse_value(self, value): """Parse string into instance of `datetime`.""" if isinstance(value, datetime.datetime): return value if value: return parse(value) else: return None
Parse string into instance of `datetime`. def parse_value(self, value): """Parse string into instance of `datetime`.""" if isinstance(value, datetime.datetime): return value if value: return parse(value) else: return None
53
41
247
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
3cc2a877e4d95bba490c7555a2a5b415b226613021ecf9a6651153f2695d06e1
BSD-3-Clause
permissive
https://github.com/beregond/jsonmodels/blob/main/LICENSE
4e62ede2ebf3809dfc13a7e2
beregond/jsonmodels
jsonmodels/validators.py
Min.validate
https://github.com/beregond/jsonmodels/blob/97a1a6b90a49490fc5a6078f49027055d2e13541/jsonmodels/validators.py#L25-L36
train
python
Validate value.
def validate(self, value): """Validate value.""" if self.exclusive: if value <= self.minimum_value: tpl = "'{value}' is lower or equal than minimum ('{min}')." raise ValidationError( tpl.format(value=value, min=self.minimum_value)) ...
Validate value. def validate(self, value): """Validate value.""" if self.exclusive: if value <= self.minimum_value: tpl = "'{value}' is lower or equal than minimum ('{min}')." raise ValidationError( tpl.format(value=value, min=self.minimum...
103
15
542
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
a59062720b9325081fcf234072909809b61ab7ae3914f1a48ddb293c7b33f9fe
BSD-3-Clause
permissive
https://github.com/beregond/jsonmodels/blob/main/LICENSE
24805f86f5cd019a8d4c38ff
beregond/jsonmodels
jsonmodels/validators.py
Min.modify_schema
https://github.com/beregond/jsonmodels/blob/97a1a6b90a49490fc5a6078f49027055d2e13541/jsonmodels/validators.py#L38-L42
train
python
Modify field schema.
def modify_schema(self, field_schema): """Modify field schema.""" field_schema['minimum'] = self.minimum_value if self.exclusive: field_schema['exclusiveMinimum'] = True
Modify field schema. def modify_schema(self, field_schema): """Modify field schema.""" field_schema['minimum'] = self.minimum_value if self.exclusive: field_schema['exclusiveMinimum'] = True
44
20
205
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
f55c48622773a97e0ea6bd92fe4fe00e4a7d57fea022f91a4865290685f0e0a1
BSD-3-Clause
permissive
https://github.com/beregond/jsonmodels/blob/main/LICENSE
dfe932d25954b5d8da3d460c
beregond/jsonmodels
jsonmodels/validators.py
Max.validate
https://github.com/beregond/jsonmodels/blob/97a1a6b90a49490fc5a6078f49027055d2e13541/jsonmodels/validators.py#L60-L71
train
python
Validate value.
def validate(self, value): """Validate value.""" if self.exclusive: if value >= self.maximum_value: tpl = "'{val}' is bigger or equal than maximum ('{max}')." raise ValidationError( tpl.format(val=value, max=self.maximum_value)) els...
Validate value. def validate(self, value): """Validate value.""" if self.exclusive: if value >= self.maximum_value: tpl = "'{val}' is bigger or equal than maximum ('{max}')." raise ValidationError( tpl.format(val=value, max=self.maximum_va...
103
15
540
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
d44a7d89c8cfc5300ddcacbf25e4f81180cb6bdafe56119e1501e1b2323f4446
BSD-3-Clause
permissive
https://github.com/beregond/jsonmodels/blob/main/LICENSE
1b98b186404d23bbceb89bb0
beregond/jsonmodels
jsonmodels/validators.py
Max.modify_schema
https://github.com/beregond/jsonmodels/blob/97a1a6b90a49490fc5a6078f49027055d2e13541/jsonmodels/validators.py#L73-L77
train
python
Modify field schema.
def modify_schema(self, field_schema): """Modify field schema.""" field_schema['maximum'] = self.maximum_value if self.exclusive: field_schema['exclusiveMaximum'] = True
Modify field schema. def modify_schema(self, field_schema): """Modify field schema.""" field_schema['maximum'] = self.maximum_value if self.exclusive: field_schema['exclusiveMaximum'] = True
44
20
205
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
962c1186e1eb170bb1f01d38cf4cb40fd2f3b7fb5d287d48ab14bb2a8a4fcb34
BSD-3-Clause
permissive
https://github.com/beregond/jsonmodels/blob/main/LICENSE
2250648790d6a2a2ecab6353
beregond/jsonmodels
jsonmodels/validators.py
Regex.validate
https://github.com/beregond/jsonmodels/blob/97a1a6b90a49490fc5a6078f49027055d2e13541/jsonmodels/validators.py#L112-L125
train
python
Validate value.
def validate(self, value): """Validate value.""" flags = self._calculate_flags() try: result = re.search(self.pattern, value, flags) except TypeError as te: raise ValidationError(*te.args) if not result: raise ValidationError( ...
Validate value. def validate(self, value): """Validate value.""" flags = self._calculate_flags() try: result = re.search(self.pattern, value, flags) except TypeError as te: raise ValidationError(*te.args) if not result: raise ValidationError...
85
15
454
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
49a20f454d2860baa9b279230a4d480c7aced76115fba2f96b18f0d7cd13cff7
BSD-3-Clause
permissive
https://github.com/beregond/jsonmodels/blob/main/LICENSE
81f16d9db9ca917c25cfce44
beregond/jsonmodels
jsonmodels/validators.py
Regex.modify_schema
https://github.com/beregond/jsonmodels/blob/97a1a6b90a49490fc5a6078f49027055d2e13541/jsonmodels/validators.py#L130-L133
train
python
Modify field schema.
def modify_schema(self, field_schema): """Modify field schema.""" field_schema['pattern'] = utilities.convert_python_regex_to_ecma( self.pattern, self.flags)
Modify field schema. def modify_schema(self, field_schema): """Modify field schema.""" field_schema['pattern'] = utilities.convert_python_regex_to_ecma( self.pattern, self.flags)
40
20
185
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
a8f657a15081bcfc2762d7b2b574f531f4a96b7dd02df7a0c235a4915980c561
BSD-3-Clause
permissive
https://github.com/beregond/jsonmodels/blob/main/LICENSE
d214ce594c9b8b7cd84f2b74
beregond/jsonmodels
jsonmodels/validators.py
Length.validate
https://github.com/beregond/jsonmodels/blob/97a1a6b90a49490fc5a6078f49027055d2e13541/jsonmodels/validators.py#L157-L173
train
python
Validate value.
def validate(self, value): """Validate value.""" len_ = len(value) if self.minimum_value is not None and len_ < self.minimum_value: tpl = "Value '{val}' length is lower than allowed minimum '{min}'." raise ValidationError(tpl.format( val=value, min=self.m...
Validate value. def validate(self, value): """Validate value.""" len_ = len(value) if self.minimum_value is not None and len_ < self.minimum_value: tpl = "Value '{val}' length is lower than allowed minimum '{min}'." raise ValidationError(tpl.format( val=...
126
15
656
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
ee34863cd7981ae3ab8ee0f6b3f150bb063b526c5010569f2ab7a07a304a87c9
BSD-3-Clause
permissive
https://github.com/beregond/jsonmodels/blob/main/LICENSE
573b24cef8979480298dc43c
beregond/jsonmodels
jsonmodels/validators.py
Length.modify_schema
https://github.com/beregond/jsonmodels/blob/97a1a6b90a49490fc5a6078f49027055d2e13541/jsonmodels/validators.py#L175-L181
train
python
Modify field schema.
def modify_schema(self, field_schema): """Modify field schema.""" if self.minimum_value: field_schema['minLength'] = self.minimum_value if self.maximum_value: field_schema['maxLength'] = self.maximum_value
Modify field schema. def modify_schema(self, field_schema): """Modify field schema.""" if self.minimum_value: field_schema['minLength'] = self.minimum_value if self.maximum_value: field_schema['maxLength'] = self.maximum_value
52
20
254
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
0679c5686e581598d5ddc05f57902b011c2ee7ac32e1a8295dc1bdffdd8ea1c7
BSD-3-Clause
permissive
https://github.com/beregond/jsonmodels/blob/main/LICENSE
e72fb2d3ef802216c2cb721d
beregond/jsonmodels
jsonmodels/parsers.py
to_struct
https://github.com/beregond/jsonmodels/blob/97a1a6b90a49490fc5a6078f49027055d2e13541/jsonmodels/parsers.py#L7-L24
train
python
Cast instance of model to python structure. :param model: Model to be casted. :rtype: ``dict``
def to_struct(model): """Cast instance of model to python structure. :param model: Model to be casted. :rtype: ``dict`` """ model.validate() resp = {} for _, name, field in model.iterate_with_name(): value = field.__get__(model) if value is None: continue ...
Cast instance of model to python structure. :param model: Model to be casted. :rtype: ``dict`` def to_struct(model): """Cast instance of model to python structure. :param model: Model to be casted. :rtype: ``dict`` """ model.validate() resp = {} for _, name, field in model.itera...
120
103
397
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
414af7e749cb20e69b55a1c3583faf5b1c72087b7911eccd8a12aeb214e5537b
BSD-3-Clause
permissive
https://github.com/beregond/jsonmodels/blob/main/LICENSE
df1e73a95d593633b243f73f
frictionlessdata/tableschema-sql-py
tableschema_sql/writer.py
Writer.write
https://github.com/frictionlessdata/tableschema-sql-py/blob/81ca4b564f6dac5fe3adc6553b353826190df6f8/tableschema_sql/writer.py#L32-L52
train
python
Write rows/keyed_rows to table
def write(self, rows, keyed=False): """Write rows/keyed_rows to table """ for row in rows: keyed_row = row if not keyed: keyed_row = dict(zip(self.__schema.field_names, row)) keyed_row = self.__convert_row(keyed_row) if self.__check...
Write rows/keyed_rows to table def write(self, rows, keyed=False): """Write rows/keyed_rows to table """ for row in rows: keyed_row = row if not keyed: keyed_row = dict(zip(self.__schema.field_names, row)) keyed_row = self.__convert_row(keyed_...
176
30
839
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
819d7304147f2a47e9ac5f822b9779451f0dd0a878afa9c7806a0851d8a608cd
MIT
permissive
https://github.com/frictionlessdata/tableschema-sql-py/blob/main/LICENSE.md
6be6a2a6c2264e4dbf379082
frictionlessdata/tableschema-sql-py
tableschema_sql/writer.py
Writer.__prepare_bloom
https://github.com/frictionlessdata/tableschema-sql-py/blob/81ca4b564f6dac5fe3adc6553b353826190df6f8/tableschema_sql/writer.py#L56-L63
train
python
Prepare bloom for existing checks
def __prepare_bloom(self): """Prepare bloom for existing checks """ self.__bloom = pybloom_live.ScalableBloomFilter() columns = [getattr(self.__table.c, key) for key in self.__update_keys] keys = select(columns).execution_options(stream_results=True).execute() for key in ...
Prepare bloom for existing checks def __prepare_bloom(self): """Prepare bloom for existing checks """ self.__bloom = pybloom_live.ScalableBloomFilter() columns = [getattr(self.__table.c, key) for key in self.__update_keys] keys = select(columns).execution_options(stream_results=...
89
33
366
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
4062289881182941788f731258f9404332e69e30797daddceaa6c4749c7c128b
MIT
permissive
https://github.com/frictionlessdata/tableschema-sql-py/blob/main/LICENSE.md
56403b3b77de15cbc8a92880
frictionlessdata/tableschema-sql-py
tableschema_sql/writer.py
Writer.__insert
https://github.com/frictionlessdata/tableschema-sql-py/blob/81ca4b564f6dac5fe3adc6553b353826190df6f8/tableschema_sql/writer.py#L65-L84
train
python
Insert rows to table
def __insert(self): """Insert rows to table """ if len(self.__buffer) > 0: # Insert data statement = self.__table.insert() if self.__autoincrement: statement = statement.returning( getattr(self.__table.c, self.__autoincremen...
Insert rows to table def __insert(self): """Insert rows to table """ if len(self.__buffer) > 0: # Insert data statement = self.__table.insert() if self.__autoincrement: statement = statement.returning( getattr(self.__table....
150
20
779
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
6f4af4984e3ae6e367e7689577136a91b3d2f7e0b5df4868b8a726262af19b78
MIT
permissive
https://github.com/frictionlessdata/tableschema-sql-py/blob/main/LICENSE.md
7b6ed2226384f9484f04613d
frictionlessdata/tableschema-sql-py
tableschema_sql/writer.py
Writer.__update
https://github.com/frictionlessdata/tableschema-sql-py/blob/81ca4b564f6dac5fe3adc6553b353826190df6f8/tableschema_sql/writer.py#L86-L101
train
python
Update rows in table
def __update(self, row): """Update rows in table """ expr = self.__table.update().values(row) for key in self.__update_keys: expr = expr.where(getattr(self.__table.c, key) == row[key]) if self.__autoincrement: expr = expr.returning(getattr(self.__table.c, ...
Update rows in table def __update(self, row): """Update rows in table """ expr = self.__table.update().values(row) for key in self.__update_keys: expr = expr.where(getattr(self.__table.c, key) == row[key]) if self.__autoincrement: expr = expr.returning(ge...
136
20
592
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
eff5aed85e70426b70bc79e3ccd088dbc65731dfee95b162b61c06f83e8f9783
MIT
permissive
https://github.com/frictionlessdata/tableschema-sql-py/blob/main/LICENSE.md
34eb2960973da9e4e2416639
frictionlessdata/tableschema-sql-py
tableschema_sql/writer.py
Writer.__check_existing
https://github.com/frictionlessdata/tableschema-sql-py/blob/81ca4b564f6dac5fe3adc6553b353826190df6f8/tableschema_sql/writer.py#L103-L112
train
python
Check if row exists in table
def __check_existing(self, row): """Check if row exists in table """ if self.__update_keys is not None: key = tuple(row[key] for key in self.__update_keys) if key in self.__bloom: return True self.__bloom.add(key) return False ...
Check if row exists in table def __check_existing(self, row): """Check if row exists in table """ if self.__update_keys is not None: key = tuple(row[key] for key in self.__update_keys) if key in self.__bloom: return True self.__bloom.add(key) ...
79
28
335
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
e2815f3ac6b992abcce4a3c474bd48c5efe508a78015a731d94d98b077249bf9
MIT
permissive
https://github.com/frictionlessdata/tableschema-sql-py/blob/main/LICENSE.md
a965175b59a4524a55393586
frictionlessdata/tableschema-sql-py
tableschema_sql/storage.py
Storage.buckets
https://github.com/frictionlessdata/tableschema-sql-py/blob/81ca4b564f6dac5fe3adc6553b353826190df6f8/tableschema_sql/storage.py#L57-L65
train
python
https://github.com/frictionlessdata/tableschema-sql-py#storage
def buckets(self): """https://github.com/frictionlessdata/tableschema-sql-py#storage """ buckets = [] for table in self.__metadata.sorted_tables: bucket = self.__mapper.restore_bucket(table.name) if bucket is not None: buckets.append(bucket) ...
https://github.com/frictionlessdata/tableschema-sql-py#storage def buckets(self): """https://github.com/frictionlessdata/tableschema-sql-py#storage """ buckets = [] for table in self.__metadata.sorted_tables: bucket = self.__mapper.restore_bucket(table.name) if b...
82
62
336
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
2b6815edc4e63c67240226e102403c70ee8de599aa9c152cb68f0b9609ad5f18
MIT
permissive
https://github.com/frictionlessdata/tableschema-sql-py/blob/main/LICENSE.md
cb878994578c196f548ca4e3
frictionlessdata/tableschema-sql-py
tableschema_sql/storage.py
Storage.create
https://github.com/frictionlessdata/tableschema-sql-py/blob/81ca4b564f6dac5fe3adc6553b353826190df6f8/tableschema_sql/storage.py#L67-L107
train
python
https://github.com/frictionlessdata/tableschema-sql-py#storage
def create(self, bucket, descriptor, force=False, indexes_fields=None): """https://github.com/frictionlessdata/tableschema-sql-py#storage """ # Make lists buckets = bucket if isinstance(bucket, six.string_types): buckets = [bucket] descriptors = descriptor ...
ERROR: type should be string, got "https://github.com/frictionlessdata/tableschema-sql-py#storage\n\ndef create(self, bucket, descriptor, force=False, indexes_fields=None):\n \"\"\"https://github.com/frictionlessdata/tableschema-sql-py#storage\n \"\"\"\n\n # Make lists\n buckets = bucket\n if isinstance(bucket, six.string_types):\n buckets = [bucket]\n descriptors = descriptor\n if isinstance(descriptor, dict):\n descriptors = [descriptor]\n if indexes_fields is None or len(indexes_fields) == 0:\n indexes_fields = [()] * len(descriptors)\n elif type(indexes_fields[0][0]) not in {list, tuple}:\n indexes_fields = [indexes_fields]\n\n # Check dimensions\n if not (len(buckets) == len(descriptors) == len(indexes_fields)):\n raise tableschema.exceptions.StorageError('Wrong argument dimensions')\n\n # Check buckets for existence\n for bucket in reversed(self.buckets):\n if bucket in buckets:\n if not force:\n message = 'Bucket \"%s\" already exists.' % bucket\n raise tableschema.exceptions.StorageError(message)\n self.delete(bucket)\n\n # Define buckets\n for bucket, descriptor, index_fields in zip(buckets, descriptors, indexes_fields):\n tableschema.validate(descriptor)\n table_name = self.__mapper.convert_bucket(bucket)\n columns, constraints, indexes, fallbacks, table_comment = self.__mapper \\\n .convert_descriptor(bucket, descriptor, index_fields, self.__autoincrement)\n Table(table_name, self.__metadata, *(columns + constraints + indexes),\n comment=table_comment)\n self.__descriptors[bucket] = descriptor\n self.__fallbacks[bucket] = fallbacks\n\n # Create tables, update metadata\n self.__metadata.create_all()"
374
62
1,837
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
a6cfcafe09d23dc34bd3031e686ebf18a1d3e1f68c2fcf45d9d6d89fbd77cec8
MIT
permissive
https://github.com/frictionlessdata/tableschema-sql-py/blob/main/LICENSE.md
a9746f7410d9095db1b19706
frictionlessdata/tableschema-sql-py
tableschema_sql/storage.py
Storage.delete
https://github.com/frictionlessdata/tableschema-sql-py/blob/81ca4b564f6dac5fe3adc6553b353826190df6f8/tableschema_sql/storage.py#L109-L142
train
python
https://github.com/frictionlessdata/tableschema-sql-py#storage
def delete(self, bucket=None, ignore=False): """https://github.com/frictionlessdata/tableschema-sql-py#storage """ # Make lists buckets = bucket if isinstance(bucket, six.string_types): buckets = [bucket] elif bucket is None: buckets = reversed(se...
ERROR: type should be string, got "https://github.com/frictionlessdata/tableschema-sql-py#storage\n\ndef delete(self, bucket=None, ignore=False):\n \"\"\"https://github.com/frictionlessdata/tableschema-sql-py#storage\n \"\"\"\n\n # Make lists\n buckets = bucket\n if isinstance(bucket, six.string_types):\n buckets = [bucket]\n elif bucket is None:\n buckets = reversed(self.buckets)\n\n # Iterate\n tables = []\n for bucket in buckets:\n\n # Check existent\n if bucket not in self.buckets:\n if not ignore:\n message = 'Bucket \"%s\" doesn\\'t exist.' % bucket\n raise tableschema.exceptions.StorageError(message)\n return\n\n # Remove from buckets\n if bucket in self.__descriptors:\n del self.__descriptors[bucket]\n\n # Add table to tables\n table = self.__get_table(bucket)\n tables.append(table)\n\n # Drop tables, update metadata\n self.__metadata.drop_all(tables=tables)\n self.__metadata.clear()\n self.__reflect()"
224
62
1,053
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
253b95ad4e3cc70aa420e3b752a885b67dbce9122f589317b5e0638d3b4f2d5b
MIT
permissive
https://github.com/frictionlessdata/tableschema-sql-py/blob/main/LICENSE.md
bbe93fab351a1ec758c89209
frictionlessdata/tableschema-sql-py
tableschema_sql/storage.py
Storage.describe
https://github.com/frictionlessdata/tableschema-sql-py/blob/81ca4b564f6dac5fe3adc6553b353826190df6f8/tableschema_sql/storage.py#L144-L160
train
python
https://github.com/frictionlessdata/tableschema-sql-py#storage
def describe(self, bucket, descriptor=None): """https://github.com/frictionlessdata/tableschema-sql-py#storage """ # Set descriptor if descriptor is not None: self.__descriptors[bucket] = descriptor # Get descriptor else: descriptor = self.__desc...
https://github.com/frictionlessdata/tableschema-sql-py#storage def describe(self, bucket, descriptor=None): """https://github.com/frictionlessdata/tableschema-sql-py#storage """ # Set descriptor if descriptor is not None: self.__descriptors[bucket] = descriptor # G...
130
62
601
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
2caae4ab02d50020e1f1d94102d8cc4668f9c38b0f2e82cec1baeb8e17285480
MIT
permissive
https://github.com/frictionlessdata/tableschema-sql-py/blob/main/LICENSE.md
2fb5f9eaa2e02e1c676d1382
frictionlessdata/tableschema-sql-py
tableschema_sql/storage.py
Storage.iter
https://github.com/frictionlessdata/tableschema-sql-py/blob/81ca4b564f6dac5fe3adc6553b353826190df6f8/tableschema_sql/storage.py#L162-L178
train
python
https://github.com/frictionlessdata/tableschema-sql-py#storage
def iter(self, bucket): """https://github.com/frictionlessdata/tableschema-sql-py#storage """ # Get table and fallbacks table = self.__get_table(bucket) schema = tableschema.Schema(self.describe(bucket)) # Open and close transaction with self.__connection.begin(...
https://github.com/frictionlessdata/tableschema-sql-py#storage def iter(self, bucket): """https://github.com/frictionlessdata/tableschema-sql-py#storage """ # Get table and fallbacks table = self.__get_table(bucket) schema = tableschema.Schema(self.describe(bucket)) # ...
153
62
697
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
6e2777c5e6cf539be86424e52562e7ea4471879d6d7008ca4b2f4f2314938f51
MIT
permissive
https://github.com/frictionlessdata/tableschema-sql-py/blob/main/LICENSE.md
7a3f1db1f0b17f3565d19757
frictionlessdata/tableschema-sql-py
tableschema_sql/storage.py
Storage.write
https://github.com/frictionlessdata/tableschema-sql-py/blob/81ca4b564f6dac5fe3adc6553b353826190df6f8/tableschema_sql/storage.py#L186-L207
train
python
https://github.com/frictionlessdata/tableschema-sql-py#storage
def write(self, bucket, rows, keyed=False, as_generator=False, update_keys=None): """https://github.com/frictionlessdata/tableschema-sql-py#storage """ # Check update keys if update_keys is not None and len(update_keys) == 0: message = 'Argument "update_keys" cannot be an em...
https://github.com/frictionlessdata/tableschema-sql-py#storage def write(self, bucket, rows, keyed=False, as_generator=False, update_keys=None): """https://github.com/frictionlessdata/tableschema-sql-py#storage """ # Check update keys if update_keys is not None and len(update_keys) == ...
225
62
984
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
68a7976803ae786254e1bdfec6b5f17faf71bd70f52e08dcabc177e74a5da3a0
MIT
permissive
https://github.com/frictionlessdata/tableschema-sql-py/blob/main/LICENSE.md
d9f62f6253beda5e256b913d
frictionlessdata/tableschema-sql-py
tableschema_sql/storage.py
Storage.__get_table
https://github.com/frictionlessdata/tableschema-sql-py/blob/81ca4b564f6dac5fe3adc6553b353826190df6f8/tableschema_sql/storage.py#L211-L217
train
python
Get table by bucket
def __get_table(self, bucket): """Get table by bucket """ table_name = self.__mapper.convert_bucket(bucket) if self.__dbschema: table_name = '.'.join((self.__dbschema, table_name)) return self.__metadata.tables[table_name]
Get table by bucket def __get_table(self, bucket): """Get table by bucket """ table_name = self.__mapper.convert_bucket(bucket) if self.__dbschema: table_name = '.'.join((self.__dbschema, table_name)) return self.__metadata.tables[table_name]
67
19
274
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
897b52ae761c6767fdd5a0ea1fcbf892005e7bad19a3e78c51f5c2b2ab290d37
MIT
permissive
https://github.com/frictionlessdata/tableschema-sql-py/blob/main/LICENSE.md
60e7d8d52e82bad315ef1cdb
frictionlessdata/tableschema-sql-py
tableschema_sql/storage.py
Storage.__reflect
https://github.com/frictionlessdata/tableschema-sql-py/blob/81ca4b564f6dac5fe3adc6553b353826190df6f8/tableschema_sql/storage.py#L219-L226
train
python
Reflect metadata
def __reflect(self): """Reflect metadata """ def only(name, _): return self.__only(name) and self.__mapper.restore_bucket(name) is not None self.__metadata.reflect(only=only)
Reflect metadata def __reflect(self): """Reflect metadata """ def only(name, _): return self.__only(name) and self.__mapper.restore_bucket(name) is not None self.__metadata.reflect(only=only)
51
16
220
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
f531a55f80d65c0a1bf46c26a9821e2cabb82b8262c5fc9fc8dbec06c10d7352
MIT
permissive
https://github.com/frictionlessdata/tableschema-sql-py/blob/main/LICENSE.md
059cbb45e8981351763a55c1
frictionlessdata/tableschema-sql-py
tableschema_sql/mapper.py
_get_field_comment
https://github.com/frictionlessdata/tableschema-sql-py/blob/81ca4b564f6dac5fe3adc6553b353826190df6f8/tableschema_sql/mapper.py#L281-L300
train
python
Create SQL comment from field's title and description :param field: tableschema-py Field, with optional 'title' and 'description' values :param separator: :return: >>> _get_field_comment(tableschema.Field({'title': 'my_title', 'description': 'my_desc'})) 'my_title - my_desc' >>> _get_field_com...
def _get_field_comment(field, separator=' - '): """ Create SQL comment from field's title and description :param field: tableschema-py Field, with optional 'title' and 'description' values :param separator: :return: >>> _get_field_comment(tableschema.Field({'title': 'my_title', 'description': ...
Create SQL comment from field's title and description :param field: tableschema-py Field, with optional 'title' and 'description' values :param separator: :return: >>> _get_field_comment(tableschema.Field({'title': 'my_title', 'description': 'my_desc'})) 'my_title - my_desc' >>> _get_field_com...
334
574
805
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
19854e52d3fb919bc2b1f5a6a366dc265618a5e31a8ff16aa9300d2ba0549312
MIT
permissive
https://github.com/frictionlessdata/tableschema-sql-py/blob/main/LICENSE.md
9adbd5801dd60effb87ab8f4
frictionlessdata/tableschema-sql-py
tableschema_sql/mapper.py
Mapper.convert_descriptor
https://github.com/frictionlessdata/tableschema-sql-py/blob/81ca4b564f6dac5fe3adc6553b353826190df6f8/tableschema_sql/mapper.py#L32-L104
train
python
Convert descriptor to SQL
def convert_descriptor(self, bucket, descriptor, index_fields=[], autoincrement=None): """Convert descriptor to SQL """ # Prepare columns = [] indexes = [] fallbacks = [] constraints = [] column_mapping = {} table_name = self.convert_bucket(bucket...
Convert descriptor to SQL def convert_descriptor(self, bucket, descriptor, index_fields=[], autoincrement=None): """Convert descriptor to SQL """ # Prepare columns = [] indexes = [] fallbacks = [] constraints = [] column_mapping = {} table_name =...
560
25
3,001
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
dd74dcf7f60122c1c87e800b2003a5df51a107fe8ae79b7aa585ccd5d6a271fa
MIT
permissive
https://github.com/frictionlessdata/tableschema-sql-py/blob/main/LICENSE.md
35cded8dd58f7c26981155bd
frictionlessdata/tableschema-sql-py
tableschema_sql/mapper.py
Mapper.convert_row
https://github.com/frictionlessdata/tableschema-sql-py/blob/81ca4b564f6dac5fe3adc6553b353826190df6f8/tableschema_sql/mapper.py#L106-L118
train
python
Convert row to SQL
def convert_row(self, keyed_row, schema, fallbacks): """Convert row to SQL """ for key, value in list(keyed_row.items()): field = schema.get_field(key) if not field: del keyed_row[key] if key in fallbacks: value = _uncast_value(...
Convert row to SQL def convert_row(self, keyed_row, schema, fallbacks): """Convert row to SQL """ for key, value in list(keyed_row.items()): field = schema.get_field(key) if not field: del keyed_row[key] if key in fallbacks: va...
101
18
465
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
125c213131ddc0a786ec48bf8cd1fb556660e37a3af43a0f25d69cbe5841cbc2
MIT
permissive
https://github.com/frictionlessdata/tableschema-sql-py/blob/main/LICENSE.md
5aa39184190ca769b23752e0
frictionlessdata/tableschema-sql-py
tableschema_sql/mapper.py
Mapper.convert_type
https://github.com/frictionlessdata/tableschema-sql-py/blob/81ca4b564f6dac5fe3adc6553b353826190df6f8/tableschema_sql/mapper.py#L120-L157
train
python
Convert type to SQL
def convert_type(self, type): """Convert type to SQL """ # Default dialect mapping = { 'any': sa.Text, 'array': None, 'boolean': sa.Boolean, 'date': sa.Date, 'datetime': sa.DateTime, 'duration': None, 'g...
Convert type to SQL def convert_type(self, type): """Convert type to SQL """ # Default dialect mapping = { 'any': sa.Text, 'array': None, 'boolean': sa.Boolean, 'date': sa.Date, 'datetime': sa.DateTime, 'duration':...
229
19
1,065
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
1dd9a515d3c126278c90244ce21b66c2dc2d49131ba9e95b3470cc65bef61bd9
MIT
permissive
https://github.com/frictionlessdata/tableschema-sql-py/blob/main/LICENSE.md
cd747d7982abf365422bdefd
frictionlessdata/tableschema-sql-py
tableschema_sql/mapper.py
Mapper.restore_bucket
https://github.com/frictionlessdata/tableschema-sql-py/blob/81ca4b564f6dac5fe3adc6553b353826190df6f8/tableschema_sql/mapper.py#L159-L164
train
python
Restore bucket from SQL
def restore_bucket(self, table_name): """Restore bucket from SQL """ if table_name.startswith(self.__prefix): return table_name.replace(self.__prefix, '', 1) return None
Restore bucket from SQL def restore_bucket(self, table_name): """Restore bucket from SQL """ if table_name.startswith(self.__prefix): return table_name.replace(self.__prefix, '', 1) return None
47
23
213
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
bd8f931bc6d2770d297cf6fde8aeecd73940e14d5185b56027951fc5949b32d3
MIT
permissive
https://github.com/frictionlessdata/tableschema-sql-py/blob/main/LICENSE.md
c951317f6a586ec06719e80e
frictionlessdata/tableschema-sql-py
tableschema_sql/mapper.py
Mapper.restore_descriptor
https://github.com/frictionlessdata/tableschema-sql-py/blob/81ca4b564f6dac5fe3adc6553b353826190df6f8/tableschema_sql/mapper.py#L166-L221
train
python
Restore descriptor from SQL
def restore_descriptor(self, table_name, columns, constraints, autoincrement_column=None): """Restore descriptor from SQL """ # Fields fields = [] for column in columns: if column.name == autoincrement_column: continue field_type = self.re...
Restore descriptor from SQL def restore_descriptor(self, table_name, columns, constraints, autoincrement_column=None): """Restore descriptor from SQL """ # Fields fields = [] for column in columns: if column.name == autoincrement_column: continue ...
384
27
2,184
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
b1c664caff400453fc2c3f5fb6cd3a6c9e723afd9e4d6f6972330212f1b127a6
MIT
permissive
https://github.com/frictionlessdata/tableschema-sql-py/blob/main/LICENSE.md
423a6541a6dacaaed7c6558c
frictionlessdata/tableschema-sql-py
tableschema_sql/mapper.py
Mapper.restore_row
https://github.com/frictionlessdata/tableschema-sql-py/blob/81ca4b564f6dac5fe3adc6553b353826190df6f8/tableschema_sql/mapper.py#L223-L232
train
python
Restore row from SQL
def restore_row(self, row, schema): """Restore row from SQL """ row = list(row) for index, field in enumerate(schema.fields): if self.__dialect == 'postgresql': if field.type in ['array', 'object']: continue row[index] = field.c...
Restore row from SQL def restore_row(self, row, schema): """Restore row from SQL """ row = list(row) for index, field in enumerate(schema.fields): if self.__dialect == 'postgresql': if field.type in ['array', 'object']: continue ...
77
20
360
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
5d447b650238b0dbd365395fed65009036a456e58d957fe35a77035bdb82bfb4
MIT
permissive
https://github.com/frictionlessdata/tableschema-sql-py/blob/main/LICENSE.md
2dc680366f053866cddfed02
frictionlessdata/tableschema-sql-py
tableschema_sql/mapper.py
Mapper.restore_type
https://github.com/frictionlessdata/tableschema-sql-py/blob/81ca4b564f6dac5fe3adc6553b353826190df6f8/tableschema_sql/mapper.py#L234-L266
train
python
Restore type from SQL
def restore_type(self, type): """Restore type from SQL """ # All dialects mapping = { ARRAY: 'array', sa.Boolean: 'boolean', sa.Date: 'date', sa.DateTime: 'datetime', sa.Float: 'number', sa.Integer: 'integer', ...
Restore type from SQL def restore_type(self, type): """Restore type from SQL """ # All dialects mapping = { ARRAY: 'array', sa.Boolean: 'boolean', sa.Date: 'date', sa.DateTime: 'datetime', sa.Float: 'number', sa.In...
196
21
909
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
f88b573bdcb7ffa3237ad5001f9d9b60ec15994bd547bdb29376a3880ad9fb96
MIT
permissive
https://github.com/frictionlessdata/tableschema-sql-py/blob/main/LICENSE.md
db6e2b8246f472ecbd40af22
GGiecold/Cluster_Ensembles
src/Cluster_Ensembles/Cluster_Ensembles.py
memory
https://github.com/GGiecold/Cluster_Ensembles/blob/d1b1ce9f541fc937ac7c677e964520e0e9163dc7/src/Cluster_Ensembles/Cluster_Ensembles.py#L69-L83
train
python
Determine memory specifications of the machine. Returns ------- mem_info : dictonary Holds the current values for the total, free and used memory of the system.
def memory(): """Determine memory specifications of the machine. Returns ------- mem_info : dictonary Holds the current values for the total, free and used memory of the system. """ mem_info = dict() for k, v in psutil.virtual_memory()._asdict().items(): mem_info[k] = i...
Determine memory specifications of the machine. Returns ------- mem_info : dictonary Holds the current values for the total, free and used memory of the system. def memory(): """Determine memory specifications of the machine. Returns ------- mem_info : dictonary Holds the ...
119
181
357
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
1efbb25d9f71713157720aadc2baeb86096a8b040ba7c0df88bc9dd016891284
MIT
permissive
https://github.com/GGiecold-zz/Cluster_Ensembles/blob/master/LICENSE
d29c78524dde8d5360797181
GGiecold/Cluster_Ensembles
src/Cluster_Ensembles/Cluster_Ensembles.py
get_chunk_size
https://github.com/GGiecold/Cluster_Ensembles/blob/d1b1ce9f541fc937ac7c677e964520e0e9163dc7/src/Cluster_Ensembles/Cluster_Ensembles.py#L86-L127
train
python
Given a two-dimensional array with a dimension of size 'N', determine the number of rows or columns that can fit into memory. Parameters ---------- N : int The size of one of the dimensions of a two-dimensional array. n : int The number of arrays of size 'N' times 'chunk_siz...
def get_chunk_size(N, n): """Given a two-dimensional array with a dimension of size 'N', determine the number of rows or columns that can fit into memory. Parameters ---------- N : int The size of one of the dimensions of a two-dimensional array. n : int The number of ar...
Given a two-dimensional array with a dimension of size 'N', determine the number of rows or columns that can fit into memory. Parameters ---------- N : int The size of one of the dimensions of a two-dimensional array. n : int The number of arrays of size 'N' times 'chunk_siz...
527
461
1,501
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
715c946335e9647cd5ab337ed9b4bd976a8b6b3fdbc84f66f5fe33bac5aa2875
MIT
permissive
https://github.com/GGiecold-zz/Cluster_Ensembles/blob/master/LICENSE
067a1aaceef5c2a756863554
GGiecold/Cluster_Ensembles
src/Cluster_Ensembles/Cluster_Ensembles.py
get_compression_filter
https://github.com/GGiecold/Cluster_Ensembles/blob/d1b1ce9f541fc937ac7c677e964520e0e9163dc7/src/Cluster_Ensembles/Cluster_Ensembles.py#L130-L157
train
python
Determine whether or not to use a compression on the array stored in a hierarchical data format, and which compression library to use to that purpose. Compression reduces the HDF5 file size and also helps improving I/O efficiency for large datasets. Parameters ---------- byte_co...
def get_compression_filter(byte_counts): """Determine whether or not to use a compression on the array stored in a hierarchical data format, and which compression library to use to that purpose. Compression reduces the HDF5 file size and also helps improving I/O efficiency for large datasets...
Determine whether or not to use a compression on the array stored in a hierarchical data format, and which compression library to use to that purpose. Compression reduces the HDF5 file size and also helps improving I/O efficiency for large datasets. Parameters ---------- byte_co...
295
410
1,008
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
4c5c901124db76f7df611d27332ff870ddab5bf2fc73a45c38f84a12dee782c4
MIT
permissive
https://github.com/GGiecold-zz/Cluster_Ensembles/blob/master/LICENSE
f9d8a405bd250d98d188f2ab
GGiecold/Cluster_Ensembles
src/Cluster_Ensembles/Cluster_Ensembles.py
build_hypergraph_adjacency
https://github.com/GGiecold/Cluster_Ensembles/blob/d1b1ce9f541fc937ac7c677e964520e0e9163dc7/src/Cluster_Ensembles/Cluster_Ensembles.py#L160-L183
train
python
Return the adjacency matrix to a hypergraph, in sparse matrix representation. Parameters ---------- cluster_runs : array of shape (n_partitions, n_samples) Returns ------- hypergraph_adjacency : compressed sparse row matrix Represents the hypergraph associated with an ensemble ...
def build_hypergraph_adjacency(cluster_runs): """Return the adjacency matrix to a hypergraph, in sparse matrix representation. Parameters ---------- cluster_runs : array of shape (n_partitions, n_samples) Returns ------- hypergraph_adjacency : compressed sparse row matrix R...
Return the adjacency matrix to a hypergraph, in sparse matrix representation. Parameters ---------- cluster_runs : array of shape (n_partitions, n_samples) Returns ------- hypergraph_adjacency : compressed sparse row matrix Represents the hypergraph associated with an ensemble ...
249
435
903
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
af10269ebdb3d31232b2fd711a1dcac997bc745ec1ffae97ac8b1eb90264e2d2
MIT
permissive
https://github.com/GGiecold-zz/Cluster_Ensembles/blob/master/LICENSE
47543a5a7d487fd0e581345a
GGiecold/Cluster_Ensembles
src/Cluster_Ensembles/Cluster_Ensembles.py
store_hypergraph_adjacency
https://github.com/GGiecold/Cluster_Ensembles/blob/d1b1ce9f541fc937ac7c677e964520e0e9163dc7/src/Cluster_Ensembles/Cluster_Ensembles.py#L186-L215
train
python
Write an hypergraph adjacency to disk to disk in an HDF5 data structure. Parameters ---------- hypergraph_adjacency : compressed sparse row matrix hdf5_file_name : file handle or string
def store_hypergraph_adjacency(hypergraph_adjacency, hdf5_file_name): """Write an hypergraph adjacency to disk to disk in an HDF5 data structure. Parameters ---------- hypergraph_adjacency : compressed sparse row matrix hdf5_file_name : file handle or string """ assert(hypergra...
Write an hypergraph adjacency to disk to disk in an HDF5 data structure. Parameters ---------- hypergraph_adjacency : compressed sparse row matrix hdf5_file_name : file handle or string def store_hypergraph_adjacency(hypergraph_adjacency, hdf5_file_name): """Write an hypergraph adjacency ...
294
211
1,132
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
683a26d770c7868e1babf71c77b22375f24e684a126c01f6a32a369d0315b55a
MIT
permissive
https://github.com/GGiecold-zz/Cluster_Ensembles/blob/master/LICENSE
b25e1bcb5c9f72e8d581c04e
GGiecold/Cluster_Ensembles
src/Cluster_Ensembles/Cluster_Ensembles.py
load_hypergraph_adjacency
https://github.com/GGiecold/Cluster_Ensembles/blob/d1b1ce9f541fc937ac7c677e964520e0e9163dc7/src/Cluster_Ensembles/Cluster_Ensembles.py#L218-L237
train
python
Parameters ---------- hdf5_file_name : file handle or string Returns ------- hypergraph_adjacency : compressed sparse row matrix
def load_hypergraph_adjacency(hdf5_file_name): """ Parameters ---------- hdf5_file_name : file handle or string Returns ------- hypergraph_adjacency : compressed sparse row matrix """ with tables.open_file(hdf5_file_name, 'r+') as fileh: pars = [] for par i...
Parameters ---------- hdf5_file_name : file handle or string Returns ------- hypergraph_adjacency : compressed sparse row matrix def load_hypergraph_adjacency(hdf5_file_name): """ Parameters ---------- hdf5_file_name : file handle or string Returns ------- ...
165
153
557
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
a5fe0d48cc3c39f45be8b96874e4bacaab2fc7fd044c1018e46b435bbdd87e04
MIT
permissive
https://github.com/GGiecold-zz/Cluster_Ensembles/blob/master/LICENSE
db2f4de5a7c907377ced6d04
GGiecold/Cluster_Ensembles
src/Cluster_Ensembles/Cluster_Ensembles.py
cluster_ensembles
https://github.com/GGiecold/Cluster_Ensembles/blob/d1b1ce9f541fc937ac7c677e964520e0e9163dc7/src/Cluster_Ensembles/Cluster_Ensembles.py#L240-L315
train
python
Call up to three different functions for heuristic ensemble clustering (namely CSPA, HGPA and MCLA) then select as the definitive consensus clustering the one with the highest average mutual information score between its vector of consensus labels and the vectors of labels associated to each ...
def cluster_ensembles(cluster_runs, hdf5_file_name = None, verbose = False, N_clusters_max = None): """Call up to three different functions for heuristic ensemble clustering (namely CSPA, HGPA and MCLA) then select as the definitive consensus clustering the one with the highest average mutual informat...
Call up to three different functions for heuristic ensemble clustering (namely CSPA, HGPA and MCLA) then select as the definitive consensus clustering the one with the highest average mutual information score between its vector of consensus labels and the vectors of labels associated to each ...
1,211
1,984
3,489
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
ecbba7767b4ae914147f730681fb2a1b4f869b16effb03ba0da3b157b970ff74
MIT
permissive
https://github.com/GGiecold-zz/Cluster_Ensembles/blob/master/LICENSE
1feda426a4f2b6318908c11f
GGiecold/Cluster_Ensembles
src/Cluster_Ensembles/Cluster_Ensembles.py
ceEvalMutual
https://github.com/GGiecold/Cluster_Ensembles/blob/d1b1ce9f541fc937ac7c677e964520e0e9163dc7/src/Cluster_Ensembles/Cluster_Ensembles.py#L318-L368
train
python
Compute a weighted average of the mutual information with the known labels, the weights being proportional to the fraction of known labels. Parameters ---------- cluster_runs : array of shape (n_partitions, n_samples) Each row of this matrix is such that the i-th entry corresponds to the ...
def ceEvalMutual(cluster_runs, cluster_ensemble = None, verbose = False): """Compute a weighted average of the mutual information with the known labels, the weights being proportional to the fraction of known labels. Parameters ---------- cluster_runs : array of shape (n_partitions, n_samples)...
Compute a weighted average of the mutual information with the known labels, the weights being proportional to the fraction of known labels. Parameters ---------- cluster_runs : array of shape (n_partitions, n_samples) Each row of this matrix is such that the i-th entry corresponds to the ...
649
1,127
2,021
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
14bd30e16f2a857bbaf16257f75584f0f3a6564b92bc0b6e0720d6f48871da36
MIT
permissive
https://github.com/GGiecold-zz/Cluster_Ensembles/blob/master/LICENSE
ff98762bae9fb9422ad3bb0e
GGiecold/Cluster_Ensembles
src/Cluster_Ensembles/Cluster_Ensembles.py
checkcl
https://github.com/GGiecold/Cluster_Ensembles/blob/d1b1ce9f541fc937ac7c677e964520e0e9163dc7/src/Cluster_Ensembles/Cluster_Ensembles.py#L371-L430
train
python
Ensure that a cluster labelling is in a valid format. Parameters ---------- cluster_run : array of shape (n_samples,) A vector of cluster IDs for each of the samples selected for a given round of clustering. The samples not selected are labelled with NaN. verbose : Boolean, optional (...
def checkcl(cluster_run, verbose = False): """Ensure that a cluster labelling is in a valid format. Parameters ---------- cluster_run : array of shape (n_samples,) A vector of cluster IDs for each of the samples selected for a given round of clustering. The samples not selected are lab...
Ensure that a cluster labelling is in a valid format. Parameters ---------- cluster_run : array of shape (n_samples,) A vector of cluster IDs for each of the samples selected for a given round of clustering. The samples not selected are labelled with NaN. verbose : Boolean, optional (...
668
714
2,465
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
d5689b0cab4433d1e2937512e415754944c3bc914fec31bf3868cedb0a0a058e
MIT
permissive
https://github.com/GGiecold-zz/Cluster_Ensembles/blob/master/LICENSE
659d6a2dcc438d29c1c04551
GGiecold/Cluster_Ensembles
src/Cluster_Ensembles/Cluster_Ensembles.py
one_to_max
https://github.com/GGiecold/Cluster_Ensembles/blob/d1b1ce9f541fc937ac7c677e964520e0e9163dc7/src/Cluster_Ensembles/Cluster_Ensembles.py#L433-L469
train
python
Alter a vector of cluster labels to a dense mapping. Given that this function is herein always called after passing a vector to the function checkcl, one_to_max relies on the assumption that cluster_run does not contain any NaN entries. Parameters ---------- array_in : a list or ...
def one_to_max(array_in): """Alter a vector of cluster labels to a dense mapping. Given that this function is herein always called after passing a vector to the function checkcl, one_to_max relies on the assumption that cluster_run does not contain any NaN entries. Parameters ---...
Alter a vector of cluster labels to a dense mapping. Given that this function is herein always called after passing a vector to the function checkcl, one_to_max relies on the assumption that cluster_run does not contain any NaN entries. Parameters ---------- array_in : a list or ...
347
524
1,069
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
ec99030879c2abd17442c70525c207c99029cced44d46c62cfb031ff7d7afd63
MIT
permissive
https://github.com/GGiecold-zz/Cluster_Ensembles/blob/master/LICENSE
a41ed356280d1822ced9b00a
GGiecold/Cluster_Ensembles
src/Cluster_Ensembles/Cluster_Ensembles.py
checks
https://github.com/GGiecold/Cluster_Ensembles/blob/d1b1ce9f541fc937ac7c677e964520e0e9163dc7/src/Cluster_Ensembles/Cluster_Ensembles.py#L472-L551
train
python
Check that a matrix is a proper similarity matrix and bring appropriate changes if applicable. Parameters ---------- similarities : array of shape (n_samples, n_samples) A matrix of pairwise similarities between (sub)-samples of the data-set. verbose : Boolean, optional (default = Fa...
def checks(similarities, verbose = False): """Check that a matrix is a proper similarity matrix and bring appropriate changes if applicable. Parameters ---------- similarities : array of shape (n_samples, n_samples) A matrix of pairwise similarities between (sub)-samples of the data-se...
Check that a matrix is a proper similarity matrix and bring appropriate changes if applicable. Parameters ---------- similarities : array of shape (n_samples, n_samples) A matrix of pairwise similarities between (sub)-samples of the data-set. verbose : Boolean, optional (default = Fa...
827
456
3,506
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
f03afc0b58cfda4627e3c0c0a8b83f4fa2d06515c0026965cec161c2e049f4c1
MIT
permissive
https://github.com/GGiecold-zz/Cluster_Ensembles/blob/master/LICENSE
72138d8739b55af766209e2d
GGiecold/Cluster_Ensembles
src/Cluster_Ensembles/Cluster_Ensembles.py
CSPA
https://github.com/GGiecold/Cluster_Ensembles/blob/d1b1ce9f541fc937ac7c677e964520e0e9163dc7/src/Cluster_Ensembles/Cluster_Ensembles.py#L554-L623
train
python
Cluster-based Similarity Partitioning Algorithm for a consensus function. Parameters ---------- hdf5_file_name : file handle or string cluster_runs : array of shape (n_partitions, n_samples) verbose : bool, optional (default = False) N_clusters_max : int, optional (default = ...
def CSPA(hdf5_file_name, cluster_runs, verbose = False, N_clusters_max = None): """Cluster-based Similarity Partitioning Algorithm for a consensus function. Parameters ---------- hdf5_file_name : file handle or string cluster_runs : array of shape (n_partitions, n_samples) verbose...
Cluster-based Similarity Partitioning Algorithm for a consensus function. Parameters ---------- hdf5_file_name : file handle or string cluster_runs : array of shape (n_partitions, n_samples) verbose : bool, optional (default = False) N_clusters_max : int, optional (default = ...
757
701
2,480
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
864818780718d073e9ee5923a11ecf1094dd223f6ff35ee4a80d2081223836e9
MIT
permissive
https://github.com/GGiecold-zz/Cluster_Ensembles/blob/master/LICENSE
60eed09d69cb3d5abd8d9dc1
GGiecold/Cluster_Ensembles
src/Cluster_Ensembles/Cluster_Ensembles.py
HGPA
https://github.com/GGiecold/Cluster_Ensembles/blob/d1b1ce9f541fc937ac7c677e964520e0e9163dc7/src/Cluster_Ensembles/Cluster_Ensembles.py#L626-L657
train
python
HyperGraph-Partitioning Algorithm for a consensus function. Parameters ---------- hdf5_file_name : string or file handle cluster_runs: array of shape (n_partitions, n_samples) verbose : bool, optional (default = False) N_clusters_max : int, optional (default = None) ...
def HGPA(hdf5_file_name, cluster_runs, verbose = False, N_clusters_max = None): """HyperGraph-Partitioning Algorithm for a consensus function. Parameters ---------- hdf5_file_name : string or file handle cluster_runs: array of shape (n_partitions, n_samples) verbose : bool, option...
HyperGraph-Partitioning Algorithm for a consensus function. Parameters ---------- hdf5_file_name : string or file handle cluster_runs: array of shape (n_partitions, n_samples) verbose : bool, optional (default = False) N_clusters_max : int, optional (default = None) ...
410
699
1,038
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
529d1fb94d55508f463bfa63aee43dbf408241d7f8323b6453273d182096a533
MIT
permissive
https://github.com/GGiecold-zz/Cluster_Ensembles/blob/master/LICENSE
41fc4b4a96a66285376d5bbc
GGiecold/Cluster_Ensembles
src/Cluster_Ensembles/Cluster_Ensembles.py
MCLA
https://github.com/GGiecold/Cluster_Ensembles/blob/d1b1ce9f541fc937ac7c677e964520e0e9163dc7/src/Cluster_Ensembles/Cluster_Ensembles.py#L660-L881
train
python
Meta-CLustering Algorithm for a consensus function. Parameters ---------- hdf5_file_name : file handle or string cluster_runs : array of shape (n_partitions, n_samples) verbose : bool, optional (default = False) N_clusters_max : int, optional (default = None) Returns...
def MCLA(hdf5_file_name, cluster_runs, verbose = False, N_clusters_max = None): """Meta-CLustering Algorithm for a consensus function. Parameters ---------- hdf5_file_name : file handle or string cluster_runs : array of shape (n_partitions, n_samples) verbose : bool, optional (def...
Meta-CLustering Algorithm for a consensus function. Parameters ---------- hdf5_file_name : file handle or string cluster_runs : array of shape (n_partitions, n_samples) verbose : bool, optional (default = False) N_clusters_max : int, optional (default = None) Returns...
2,483
692
9,184
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
f019461b2356905fe31115ded55761dee556d304cf753cb62d2f19c81d4e70cb
MIT
permissive
https://github.com/GGiecold-zz/Cluster_Ensembles/blob/master/LICENSE
c2c3f9261ae4e17f0e5179d0
GGiecold/Cluster_Ensembles
src/Cluster_Ensembles/Cluster_Ensembles.py
create_membership_matrix
https://github.com/GGiecold/Cluster_Ensembles/blob/d1b1ce9f541fc937ac7c677e964520e0e9163dc7/src/Cluster_Ensembles/Cluster_Ensembles.py#L884-L919
train
python
For a label vector represented by cluster_run, constructs the binary membership indicator matrix. Such matrices, when concatenated, contribute to the adjacency matrix for a hypergraph representation of an ensemble of clusterings. Parameters ---------- cluster_run : array of s...
def create_membership_matrix(cluster_run): """For a label vector represented by cluster_run, constructs the binary membership indicator matrix. Such matrices, when concatenated, contribute to the adjacency matrix for a hypergraph representation of an ensemble of clusterings. Para...
For a label vector represented by cluster_run, constructs the binary membership indicator matrix. Such matrices, when concatenated, contribute to the adjacency matrix for a hypergraph representation of an ensemble of clusterings. Parameters ---------- cluster_run : array of s...
378
434
1,404
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
47e29c4da7d138fe18b9992b663fad62502047813ce561809e04a98aa814dd3d
MIT
permissive
https://github.com/GGiecold-zz/Cluster_Ensembles/blob/master/LICENSE
0f9992eb55628dc338bebb6d
GGiecold/Cluster_Ensembles
src/Cluster_Ensembles/Cluster_Ensembles.py
metis
https://github.com/GGiecold/Cluster_Ensembles/blob/d1b1ce9f541fc937ac7c677e964520e0e9163dc7/src/Cluster_Ensembles/Cluster_Ensembles.py#L922-L949
train
python
METIS algorithm by Karypis and Kumar. Partitions the induced similarity graph passed by CSPA. Parameters ---------- hdf5_file_name : string or file handle N_clusters_max : int Returns ------- labels : array of shape (n_samples,) A vector of labels denoting the clu...
def metis(hdf5_file_name, N_clusters_max): """METIS algorithm by Karypis and Kumar. Partitions the induced similarity graph passed by CSPA. Parameters ---------- hdf5_file_name : string or file handle N_clusters_max : int Returns ------- labels : array of shape (n_sam...
METIS algorithm by Karypis and Kumar. Partitions the induced similarity graph passed by CSPA. Parameters ---------- hdf5_file_name : string or file handle N_clusters_max : int Returns ------- labels : array of shape (n_samples,) A vector of labels denoting the clu...
377
657
860
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
efe0da257436a0fa9042383fa3b8e147280d269411367ba6ad454718b506155c
MIT
permissive
https://github.com/GGiecold-zz/Cluster_Ensembles/blob/master/LICENSE
75ca2f03b0aafcdb5469408f
GGiecold/Cluster_Ensembles
src/Cluster_Ensembles/Cluster_Ensembles.py
hmetis
https://github.com/GGiecold/Cluster_Ensembles/blob/d1b1ce9f541fc937ac7c677e964520e0e9163dc7/src/Cluster_Ensembles/Cluster_Ensembles.py#L952-L987
train
python
Gives cluster labels ranging from 1 to N_clusters_max for hypergraph partitioning required for HGPA. Parameters ---------- hdf5_file_name : file handle or string N_clusters_max : int w : array, optional (default = None) Returns ------- labels : array of shape (n_...
def hmetis(hdf5_file_name, N_clusters_max, w = None): """Gives cluster labels ranging from 1 to N_clusters_max for hypergraph partitioning required for HGPA. Parameters ---------- hdf5_file_name : file handle or string N_clusters_max : int w : array, optional (default = None)...
Gives cluster labels ranging from 1 to N_clusters_max for hypergraph partitioning required for HGPA. Parameters ---------- hdf5_file_name : file handle or string N_clusters_max : int w : array, optional (default = None) Returns ------- labels : array of shape (n_...
484
767
1,104
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
4b597ba5063d7689a265e0a828d4e81e8e8f0fe36913efd13b2285b6927416d2
MIT
permissive
https://github.com/GGiecold-zz/Cluster_Ensembles/blob/master/LICENSE
7e5d854d48c26085c9910cbb
GGiecold/Cluster_Ensembles
src/Cluster_Ensembles/Cluster_Ensembles.py
wgraph
https://github.com/GGiecold/Cluster_Ensembles/blob/d1b1ce9f541fc937ac7c677e964520e0e9163dc7/src/Cluster_Ensembles/Cluster_Ensembles.py#L1024-L1154
train
python
Write a graph file in a format apposite to later use by METIS or HMETIS. Parameters ---------- hdf5_file_name : file handle or string w : list or array, optional (default = None) method : int, optional (default = 0) Returns ------- file_name : string
def wgraph(hdf5_file_name, w = None, method = 0): """Write a graph file in a format apposite to later use by METIS or HMETIS. Parameters ---------- hdf5_file_name : file handle or string w : list or array, optional (default = None) method : int, optional (default = 0) Ret...
Write a graph file in a format apposite to later use by METIS or HMETIS. Parameters ---------- hdf5_file_name : file handle or string w : list or array, optional (default = None) method : int, optional (default = 0) Returns ------- file_name : string def wgraph(hdf5_...
1,261
302
4,762
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
cc9e3b04e7ce5a4b036ce7b30d19de9607fb719c5c81f7d75fd9ca142995ad09
MIT
permissive
https://github.com/GGiecold-zz/Cluster_Ensembles/blob/master/LICENSE
f10753eeb2cf37d65057d15c
GGiecold/Cluster_Ensembles
src/Cluster_Ensembles/Cluster_Ensembles.py
sgraph
https://github.com/GGiecold/Cluster_Ensembles/blob/d1b1ce9f541fc937ac7c677e964520e0e9163dc7/src/Cluster_Ensembles/Cluster_Ensembles.py#L1157-L1221
train
python
Runs METIS or hMETIS and returns the labels found by those (hyper-)graph partitioning algorithms. Parameters ---------- N_clusters_max : int file_name : string Returns ------- labels : array of shape (n_samples,) A vector of labels denoting the cluster to ...
def sgraph(N_clusters_max, file_name): """Runs METIS or hMETIS and returns the labels found by those (hyper-)graph partitioning algorithms. Parameters ---------- N_clusters_max : int file_name : string Returns ------- labels : array of shape (n_samples,) ...
Runs METIS or hMETIS and returns the labels found by those (hyper-)graph partitioning algorithms. Parameters ---------- N_clusters_max : int file_name : string Returns ------- labels : array of shape (n_samples,) A vector of labels denoting the cluster to ...
665
482
2,485
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
2f485bb8e1cd056cb98202ec280d0eff941d5b70f806122ecee863206ad524e8
MIT
permissive
https://github.com/GGiecold-zz/Cluster_Ensembles/blob/master/LICENSE
3130901a9df177dbed5ecc69
GGiecold/Cluster_Ensembles
src/Cluster_Ensembles/Cluster_Ensembles.py
overlap_matrix
https://github.com/GGiecold/Cluster_Ensembles/blob/d1b1ce9f541fc937ac7c677e964520e0e9163dc7/src/Cluster_Ensembles/Cluster_Ensembles.py#L1224-L1322
train
python
Writes on disk (in an HDF5 file whose handle is provided as the first argument to this function) a stack of matrices, each describing for a particular run the overlap of cluster ID's that are matching each of the cluster ID's stored in 'consensus_labels' (the vector of labels obtained by e...
def overlap_matrix(hdf5_file_name, consensus_labels, cluster_runs): """Writes on disk (in an HDF5 file whose handle is provided as the first argument to this function) a stack of matrices, each describing for a particular run the overlap of cluster ID's that are matching each of the cluster ID...
Writes on disk (in an HDF5 file whose handle is provided as the first argument to this function) a stack of matrices, each describing for a particular run the overlap of cluster ID's that are matching each of the cluster ID's stored in 'consensus_labels' (the vector of labels obtained by e...
1,029
845
3,899
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
7ab36687e7492732ac65d86b6ce61efcdf1a193108a1ff8720c1fae2c07ff9b6
MIT
permissive
https://github.com/GGiecold-zz/Cluster_Ensembles/blob/master/LICENSE
fda256d72ae8e009c42a7f03
ramses-tech/ramses
ramses/models.py
get_existing_model
https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/models.py#L45-L56
train
python
Try to find existing model class named `model_name`. :param model_name: String name of the model class.
def get_existing_model(model_name): """ Try to find existing model class named `model_name`. :param model_name: String name of the model class. """ try: model_cls = engine.get_document_cls(model_name) log.debug('Model `{}` already exists. Using existing one'.format( model_na...
Try to find existing model class named `model_name`. :param model_name: String name of the model class. def get_existing_model(model_name): """ Try to find existing model class named `model_name`. :param model_name: String name of the model class. """ try: model_cls = engine.get_document_...
117
108
438
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
effc52df7c7f06163f52dfaa2a4e5f4f29a7b10773cb98d4674c55254811e9c6
Apache-2.0
permissive
https://github.com/ramses-tech/ramses/blob/master/LICENSE
a67f9e9baa79d0a1c395c686
ramses-tech/ramses
ramses/models.py
prepare_relationship
https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/models.py#L59-L82
train
python
Create referenced model if it doesn't exist. When preparing a relationship, we check to see if the model that will be referenced already exists. If not, it is created so that it will be possible to use it in a relationship. Thus the first usage of this model in RAML file must provide its schema in POST...
def prepare_relationship(config, model_name, raml_resource): """ Create referenced model if it doesn't exist. When preparing a relationship, we check to see if the model that will be referenced already exists. If not, it is created so that it will be possible to use it in a relationship. Thus the first...
Create referenced model if it doesn't exist. When preparing a relationship, we check to see if the model that will be referenced already exists. If not, it is created so that it will be possible to use it in a relationship. Thus the first usage of this model in RAML file must provide its schema in POST...
362
532
1,167
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
69112cfc217971db46473629aea7e61507a13f96965bd28ffc3052da3cdd007e
Apache-2.0
permissive
https://github.com/ramses-tech/ramses/blob/master/LICENSE
1a5a26f92dd67393f71538ef
ramses-tech/ramses
ramses/models.py
generate_model_cls
https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/models.py#L85-L169
train
python
Generate model class. Engine DB field types are determined using `type_fields` and only those types may be used. :param schema: Model schema dict parsed from RAML. :param model_name: String that is used as new model's name. :param raml_resource: Instance of ramlfications.raml.ResourceNode. :pa...
def generate_model_cls(config, schema, model_name, raml_resource, es_based=True): """ Generate model class. Engine DB field types are determined using `type_fields` and only those types may be used. :param schema: Model schema dict parsed from RAML. :param model_name: String...
Generate model class. Engine DB field types are determined using `type_fields` and only those types may be used. :param schema: Model schema dict parsed from RAML. :param model_name: String that is used as new model's name. :param raml_resource: Instance of ramlfications.raml.ResourceNode. :pa...
813
545
3,337
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
39216b67440f46d26e40310640cb9a77b21b048cdb13f6bf26e0924b754b7f6c
Apache-2.0
permissive
https://github.com/ramses-tech/ramses/blob/master/LICENSE
50c9993db61dacfdd13c393e
ramses-tech/ramses
ramses/models.py
setup_data_model
https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/models.py#L172-L198
train
python
Setup storage/data model and return generated model class. Process follows these steps: * Resource schema is found and restructured by `resource_schema`. * Model class is generated from properties dict using util function `generate_model_cls`. :param raml_resource: Instance of ramlfication...
def setup_data_model(config, raml_resource, model_name): """ Setup storage/data model and return generated model class. Process follows these steps: * Resource schema is found and restructured by `resource_schema`. * Model class is generated from properties dict using util function `generat...
Setup storage/data model and return generated model class. Process follows these steps: * Resource schema is found and restructured by `resource_schema`. * Model class is generated from properties dict using util function `generate_model_cls`. :param raml_resource: Instance of ramlfication...
279
395
953
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
c6b31c61a4bd28f7eb557c039701dcb0aefc5590c720ce7a54d491cd1d8e4b61
Apache-2.0
permissive
https://github.com/ramses-tech/ramses/blob/master/LICENSE
9157ca019dd6bf3018bc3e56
ramses-tech/ramses
ramses/models.py
handle_model_generation
https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/models.py#L201-L211
train
python
Generates model name and runs `setup_data_model` to get or generate actual model class. :param raml_resource: Instance of ramlfications.raml.ResourceNode.
def handle_model_generation(config, raml_resource): """ Generates model name and runs `setup_data_model` to get or generate actual model class. :param raml_resource: Instance of ramlfications.raml.ResourceNode. """ model_name = generate_model_name(raml_resource) try: return setup_data_m...
Generates model name and runs `setup_data_model` to get or generate actual model class. :param raml_resource: Instance of ramlfications.raml.ResourceNode. def handle_model_generation(config, raml_resource): """ Generates model name and runs `setup_data_model` to get or generate actual model class. ...
139
163
451
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
f58e750fc2f4ae97ee1360b97fb6ea9d511b0005feaf05e7b632287b783d8d7d
Apache-2.0
permissive
https://github.com/ramses-tech/ramses/blob/master/LICENSE
d12d232b6ee118dcddd62a12
ramses-tech/ramses
ramses/models.py
setup_model_event_subscribers
https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/models.py#L214-L235
train
python
Set up model event subscribers. :param config: Pyramid Configurator instance. :param model_cls: Model class for which handlers should be connected. :param schema: Dict of model JSON schema.
def setup_model_event_subscribers(config, model_cls, schema): """ Set up model event subscribers. :param config: Pyramid Configurator instance. :param model_cls: Model class for which handlers should be connected. :param schema: Dict of model JSON schema. """ events_map = get_events_map() m...
Set up model event subscribers. :param config: Pyramid Configurator instance. :param model_cls: Model class for which handlers should be connected. :param schema: Dict of model JSON schema. def setup_model_event_subscribers(config, model_cls, schema): """ Set up model event subscribers. :param co...
213
202
840
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
7ff58e4ee01d184db91a509c6ed7252b298287b5b9e996ec2aab34ddbd52eadb
Apache-2.0
permissive
https://github.com/ramses-tech/ramses/blob/master/LICENSE
6929ffa8dc791897e6bb837a
ramses-tech/ramses
ramses/models.py
setup_fields_processors
https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/models.py#L238-L274
train
python
Set up model fields' processors. :param config: Pyramid Configurator instance. :param model_cls: Model class for field of which processors should be set up. :param schema: Dict of model JSON schema.
def setup_fields_processors(config, model_cls, schema): """ Set up model fields' processors. :param config: Pyramid Configurator instance. :param model_cls: Model class for field of which processors should be set up. :param schema: Dict of model JSON schema. """ properties = schema.get(...
Set up model fields' processors. :param config: Pyramid Configurator instance. :param model_cls: Model class for field of which processors should be set up. :param schema: Dict of model JSON schema. def setup_fields_processors(config, model_cls, schema): """ Set up model fields' processors. ...
332
219
1,478
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
8365d18a15f92f254552b238ad7b4c72e735a324fe3761d4bc4c80152632d35e
Apache-2.0
permissive
https://github.com/ramses-tech/ramses/blob/master/LICENSE
bdb6232ffc713005765f86db
ramses-tech/ramses
ramses/auth.py
_setup_ticket_policy
https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/auth.py#L46-L102
train
python
Setup Pyramid AuthTktAuthenticationPolicy. Notes: * Initial `secret` params value is considered to be a name of config param that represents a cookie name. * `auth_model.get_groups_by_userid` is used as a `callback`. * Also connects basic routes to perform authentication actions. :pa...
def _setup_ticket_policy(config, params): """ Setup Pyramid AuthTktAuthenticationPolicy. Notes: * Initial `secret` params value is considered to be a name of config param that represents a cookie name. * `auth_model.get_groups_by_userid` is used as a `callback`. * Also connects basic ...
Setup Pyramid AuthTktAuthenticationPolicy. Notes: * Initial `secret` params value is considered to be a name of config param that represents a cookie name. * `auth_model.get_groups_by_userid` is used as a `callback`. * Also connects basic routes to perform authentication actions. :pa...
530
450
2,027
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
2a3bd649a9771d7471d9afdf96e1c15965faa3c3dab5467d8b2052ad02e8b97b
Apache-2.0
permissive
https://github.com/ramses-tech/ramses/blob/master/LICENSE
672ad7e21043cbd3411d00b8
ramses-tech/ramses
ramses/auth.py
_setup_apikey_policy
https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/auth.py#L105-L160
train
python
Setup `nefertari.ApiKeyAuthenticationPolicy`. Notes: * User may provide model name in :params['user_model']: do define the name of the user model. * `auth_model.get_groups_by_token` is used to perform username and token check * `auth_model.get_token_credentials` is used to get use...
def _setup_apikey_policy(config, params): """ Setup `nefertari.ApiKeyAuthenticationPolicy`. Notes: * User may provide model name in :params['user_model']: do define the name of the user model. * `auth_model.get_groups_by_token` is used to perform username and token check * `au...
Setup `nefertari.ApiKeyAuthenticationPolicy`. Notes: * User may provide model name in :params['user_model']: do define the name of the user model. * `auth_model.get_groups_by_token` is used to perform username and token check * `auth_model.get_token_credentials` is used to get use...
562
567
1,987
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
e00ecd467e389aa9e4166be8916c779819e47ba7df3f953b3b8736c994d40c30
Apache-2.0
permissive
https://github.com/ramses-tech/ramses/blob/master/LICENSE
3a6bb08a38e23a5cc9c540dc
ramses-tech/ramses
ramses/auth.py
setup_auth_policies
https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/auth.py#L178-L217
train
python
Setup authentication, authorization policies. Performs basic validation to check all the required values are present and performs authentication, authorization policies generation using generator functions from `AUTHENTICATION_POLICIES`. :param config: Pyramid Configurator instance. :param raml_ro...
def setup_auth_policies(config, raml_root): """ Setup authentication, authorization policies. Performs basic validation to check all the required values are present and performs authentication, authorization policies generation using generator functions from `AUTHENTICATION_POLICIES`. :param confi...
Setup authentication, authorization policies. Performs basic validation to check all the required values are present and performs authentication, authorization policies generation using generator functions from `AUTHENTICATION_POLICIES`. :param config: Pyramid Configurator instance. :param raml_ro...
386
364
1,548
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
3c32b4da082989bcd106352a70e9e898aa8984a4590e65c728ab6f6ba9d223bf
Apache-2.0
permissive
https://github.com/ramses-tech/ramses/blob/master/LICENSE
b97b409e210a852fd5ae663d
ramses-tech/ramses
ramses/auth.py
get_authuser_model
https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/auth.py#L245-L253
train
python
Define and return AuthUser model using nefertari base classes
def get_authuser_model(): """ Define and return AuthUser model using nefertari base classes """ from nefertari.authentication.models import AuthUserMixin from nefertari import engine class AuthUser(AuthUserMixin, engine.BaseDocument): __tablename__ = 'ramses_authuser' return AuthUser
Define and return AuthUser model using nefertari base classes def get_authuser_model(): """ Define and return AuthUser model using nefertari base classes """ from nefertari.authentication.models import AuthUserMixin from nefertari import engine class AuthUser(AuthUserMixin, engine.BaseDocument): ...
81
61
314
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
739940c166725765c0f7319b058c06bcd0d82968e23afdc3f43086c9fec59131
Apache-2.0
permissive
https://github.com/ramses-tech/ramses/blob/master/LICENSE
99dc1defd7d12107d7bbb2d0
ramses-tech/ramses
ramses/acl.py
validate_permissions
https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/acl.py#L29-L43
train
python
Validate :perms: contains valid permissions. :param perms: List of permission names or ALL_PERMISSIONS.
def validate_permissions(perms): """ Validate :perms: contains valid permissions. :param perms: List of permission names or ALL_PERMISSIONS. """ if not isinstance(perms, (list, tuple)): perms = [perms] valid_perms = set(PERMISSIONS.values()) if ALL_PERMISSIONS in perms: return p...
Validate :perms: contains valid permissions. :param perms: List of permission names or ALL_PERMISSIONS. def validate_permissions(perms): """ Validate :perms: contains valid permissions. :param perms: List of permission names or ALL_PERMISSIONS. """ if not isinstance(perms, (list, tuple)): ...
134
108
517
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
1faf39e357611e424c7a5b83b1facf0c0a3ea3317202d9af1a41c501911a2e23
Apache-2.0
permissive
https://github.com/ramses-tech/ramses/blob/master/LICENSE
269eb8e9df28cbecb431602e
ramses-tech/ramses
ramses/acl.py
parse_permissions
https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/acl.py#L46-L58
train
python
Parse permissions ("perms") which are either exact permission names or the keyword 'all'. :param perms: List or comma-separated string of nefertari permission names, or 'all'
def parse_permissions(perms): """ Parse permissions ("perms") which are either exact permission names or the keyword 'all'. :param perms: List or comma-separated string of nefertari permission names, or 'all' """ if isinstance(perms, six.string_types): perms = perms.split(',') p...
Parse permissions ("perms") which are either exact permission names or the keyword 'all'. :param perms: List or comma-separated string of nefertari permission names, or 'all' def parse_permissions(perms): """ Parse permissions ("perms") which are either exact permission names or the keyword 'a...
145
191
460
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
5902173a90df5c36c774995cdb3db6a8e6ff0403cffb96f2bcce63b5fae49074
Apache-2.0
permissive
https://github.com/ramses-tech/ramses/blob/master/LICENSE
278deade420dcdc3279a8866
ramses-tech/ramses
ramses/acl.py
parse_acl
https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/acl.py#L61-L107
train
python
Parse raw string :acl_string: of RAML-defined ACLs. If :acl_string: is blank or None, all permissions are given. Values of ACL action and principal are parsed using `actions` and `special_principals` maps and are looked up after `strip()` and `lower()`. ACEs in :acl_string: may be separated by new...
def parse_acl(acl_string): """ Parse raw string :acl_string: of RAML-defined ACLs. If :acl_string: is blank or None, all permissions are given. Values of ACL action and principal are parsed using `actions` and `special_principals` maps and are looked up after `strip()` and `lower()`. ACEs in :...
Parse raw string :acl_string: of RAML-defined ACLs. If :acl_string: is blank or None, all permissions are given. Values of ACL action and principal are parsed using `actions` and `special_principals` maps and are looked up after `strip()` and `lower()`. ACEs in :acl_string: may be separated by new...
537
595
1,727
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
756ce56c8c082b44f753e63455248fde6c6559f8373e2d690f14ce0870d49e6f
Apache-2.0
permissive
https://github.com/ramses-tech/ramses/blob/master/LICENSE
358a5a4f3047bd22c8774bbd
ramses-tech/ramses
ramses/acl.py
generate_acl
https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/acl.py#L217-L264
train
python
Generate an ACL. Generated ACL class has a `item_model` attribute set to :model_cls:. ACLs used for collection and item access control are generated from a first security scheme with type `x-ACL`. If :raml_resource: has no x-ACL security schemes defined then ALLOW_ALL ACL is used. If the `...
def generate_acl(config, model_cls, raml_resource, es_based=True): """ Generate an ACL. Generated ACL class has a `item_model` attribute set to :model_cls:. ACLs used for collection and item access control are generated from a first security scheme with type `x-ACL`. If :raml_resource: has no ...
Generate an ACL. Generated ACL class has a `item_model` attribute set to :model_cls:. ACLs used for collection and item access control are generated from a first security scheme with type `x-ACL`. If :raml_resource: has no x-ACL security schemes defined then ALLOW_ALL ACL is used. If the `...
588
656
1,864
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
75c20a1535067a51afff2b2bb91a9f9bb749d3e89eca3f052fcde8b019c85a36
Apache-2.0
permissive
https://github.com/ramses-tech/ramses/blob/master/LICENSE
59919f8cc8d97689f0491ec4
ramses-tech/ramses
ramses/acl.py
BaseACL._apply_callables
https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/acl.py#L117-L144
train
python
Iterate over ACEs from :acl: and apply callable principals if any. Principals are passed 3 arguments on call: :ace: Single ACE object that looks like (action, callable, permission or [permission]) :request: Current request object :obj: Object instance...
def _apply_callables(self, acl, obj=None): """ Iterate over ACEs from :acl: and apply callable principals if any. Principals are passed 3 arguments on call: :ace: Single ACE object that looks like (action, callable, permission or [permission]) :request: C...
Iterate over ACEs from :acl: and apply callable principals if any. Principals are passed 3 arguments on call: :ace: Single ACE object that looks like (action, callable, permission or [permission]) :request: Current request object :obj: Object instance...
361
540
1,134
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
8bcdaa09721a9b711164787ee3e923b113071411a675983888aa1cc858917604
Apache-2.0
permissive
https://github.com/ramses-tech/ramses/blob/master/LICENSE
6f99bca2494b29f30132a3f1
ramses-tech/ramses
ramses/acl.py
DatabaseACLMixin.item_acl
https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/acl.py#L189-L196
train
python
Objectify ACL if ES is used or call item.get_acl() if db is used.
def item_acl(self, item): """ Objectify ACL if ES is used or call item.get_acl() if db is used. """ if self.es_based: from nefertari_guards.elasticsearch import get_es_item_acl return get_es_item_acl(item) return super(DatabaseACLMixin, self).item_acl(item...
Objectify ACL if ES is used or call item.get_acl() if db is used. def item_acl(self, item): """ Objectify ACL if ES is used or call item.get_acl() if db is used. """ if self.es_based: from nefertari_guards.elasticsearch import get_es_item_acl return get_e...
93
73
321
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
0aa50797781a1029f0fe3df7005e7b47a0c94a2974c5765fa298d74360484053
Apache-2.0
permissive
https://github.com/ramses-tech/ramses/blob/master/LICENSE
814510dcb3b71c778d83e0e8
ramses-tech/ramses
ramses/acl.py
DatabaseACLMixin.getitem_es
https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/acl.py#L198-L214
train
python
Override to support ACL filtering. To do so: passes `self.request` to `get_item` and uses `ACLFilterES`.
def getitem_es(self, key): """ Override to support ACL filtering. To do so: passes `self.request` to `get_item` and uses `ACLFilterES`. """ from nefertari_guards.elasticsearch import ACLFilterES es = ACLFilterES(self.item_model.__name__) params = { 'i...
Override to support ACL filtering. To do so: passes `self.request` to `get_item` and uses `ACLFilterES`. def getitem_es(self, key): """ Override to support ACL filtering. To do so: passes `self.request` to `get_item` and uses `ACLFilterES`. """ from nefertari_g...
155
121
528
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
e7bca81c1a4ad7bd96997c69017fa5396833e9b37eaefcbf35c87c43e07236be
Apache-2.0
permissive
https://github.com/ramses-tech/ramses/blob/master/LICENSE
a80158e720165f79420af49a
ramses-tech/ramses
ramses/utils.py
convert_schema
https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/utils.py#L22-L54
train
python
Restructure `raml_schema` to a dictionary that has 'properties' as well as other schema keys/values. The resulting dictionary looks like this:: { "properties": { "field1": { "required": boolean, "type": ..., ...more field options ...
def convert_schema(raml_schema, mime_type): """ Restructure `raml_schema` to a dictionary that has 'properties' as well as other schema keys/values. The resulting dictionary looks like this:: { "properties": { "field1": { "required": boolean, "type":...
Restructure `raml_schema` to a dictionary that has 'properties' as well as other schema keys/values. The resulting dictionary looks like this:: { "properties": { "field1": { "required": boolean, "type": ..., ...more field options ...
362
636
1,058
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
e8dda80010ee2986b679c195d8122e8c20e5956dff19ca1e04d4fb63623e05d7
Apache-2.0
permissive
https://github.com/ramses-tech/ramses/blob/master/LICENSE