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
ce6fd0b4cd07e7e76419cb8a
Parquery/icontract
icontract/_recompute.py
Visitor.visit_GeneratorExp
https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_recompute.py#L366-L374
train
python
Compile the generator expression as a function and call it.
def visit_GeneratorExp(self, node: ast.GeneratorExp) -> Any: """Compile the generator expression as a function and call it.""" result = self._execute_comprehension(node=node) for generator in node.generators: self.visit(generator.iter) # Do not set the computed value of the...
Compile the generator expression as a function and call it. def visit_GeneratorExp(self, node: ast.GeneratorExp) -> Any: """Compile the generator expression as a function and call it.""" result = self._execute_comprehension(node=node) for generator in node.generators: self.visit(ge...
91
59
398
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
24d88eb33cd3ad8fc9aca0f93e52feb52186ac81a3ea072b7e15cf61dfd7ae41
MIT
permissive
https://github.com/Parquery/icontract/blob/master/LICENSE.txt
520c77d97372441e5768c4ba
Parquery/icontract
icontract/_recompute.py
Visitor.visit_ListComp
https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_recompute.py#L376-L384
train
python
Compile the list comprehension as a function and call it.
def visit_ListComp(self, node: ast.ListComp) -> Any: """Compile the list comprehension as a function and call it.""" result = self._execute_comprehension(node=node) for generator in node.generators: self.visit(generator.iter) self.recomputed_values[node] = result re...
Compile the list comprehension as a function and call it. def visit_ListComp(self, node: ast.ListComp) -> Any: """Compile the list comprehension as a function and call it.""" result = self._execute_comprehension(node=node) for generator in node.generators: self.visit(generator.iter...
78
57
331
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
2266e0a9e36a0ce317ac93fe8dfb9fbf6f27310fcbd46fa4fbba8fa273aab85e
MIT
permissive
https://github.com/Parquery/icontract/blob/master/LICENSE.txt
d5a7d3be1b2b7961e81e6d37
Parquery/icontract
icontract/_recompute.py
Visitor.visit_SetComp
https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_recompute.py#L386-L394
train
python
Compile the set comprehension as a function and call it.
def visit_SetComp(self, node: ast.SetComp) -> Any: """Compile the set comprehension as a function and call it.""" result = self._execute_comprehension(node=node) for generator in node.generators: self.visit(generator.iter) self.recomputed_values[node] = result retur...
Compile the set comprehension as a function and call it. def visit_SetComp(self, node: ast.SetComp) -> Any: """Compile the set comprehension as a function and call it.""" result = self._execute_comprehension(node=node) for generator in node.generators: self.visit(generator.iter) ...
78
56
328
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
fef55fce4d2d877f1f93f19030878c6c9dde8a695e6af56d4cfed8a08b16539f
MIT
permissive
https://github.com/Parquery/icontract/blob/master/LICENSE.txt
3762cd14c6196567e625fa89
Parquery/icontract
icontract/_recompute.py
Visitor.visit_DictComp
https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_recompute.py#L396-L404
train
python
Compile the dictionary comprehension as a function and call it.
def visit_DictComp(self, node: ast.DictComp) -> Any: """Compile the dictionary comprehension as a function and call it.""" result = self._execute_comprehension(node=node) for generator in node.generators: self.visit(generator.iter) self.recomputed_values[node] = result ...
Compile the dictionary comprehension as a function and call it. def visit_DictComp(self, node: ast.DictComp) -> Any: """Compile the dictionary comprehension as a function and call it.""" result = self._execute_comprehension(node=node) for generator in node.generators: self.visit(ge...
79
63
337
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
203c155e3119c5bb7ca02d63be14bb46b64c2662169ab0e561138ac9d06e3f30
MIT
permissive
https://github.com/Parquery/icontract/blob/master/LICENSE.txt
f20a6a1fd904781e8ce07885
Parquery/icontract
icontract/_recompute.py
Visitor.visit_Return
https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_recompute.py#L413-L415
train
python
Raise an exception that this node is unexpected.
def visit_Return(self, node: ast.Return) -> Any: # pylint: disable=no-self-use """Raise an exception that this node is unexpected.""" raise AssertionError("Unexpected return node during the re-computation: {}".format(ast.dump(node)))
Raise an exception that this node is unexpected. def visit_Return(self, node: ast.Return) -> Any: # pylint: disable=no-self-use """Raise an exception that this node is unexpected.""" raise AssertionError("Unexpected return node during the re-computation: {}".format(ast.dump(node)))
61
48
250
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
c1441ccabbc91fe502623ef04a317bac8300e69ee714269f9904f5afa112793a
MIT
permissive
https://github.com/Parquery/icontract/blob/master/LICENSE.txt
cc1eba47158a1e06ba59ca51
Parquery/icontract
icontract/_recompute.py
Visitor.generic_visit
https://github.com/Parquery/icontract/blob/846e3187869a9ba790e9b893c98e5055e1cce274/icontract/_recompute.py#L417-L419
train
python
Raise an exception that this node has not been handled.
def generic_visit(self, node: ast.AST) -> None: """Raise an exception that this node has not been handled.""" raise NotImplementedError("Unhandled recomputation of the node: {} {}".format(type(node), node))
Raise an exception that this node has not been handled. def generic_visit(self, node: ast.AST) -> None: """Raise an exception that this node has not been handled.""" raise NotImplementedError("Unhandled recomputation of the node: {} {}".format(type(node), node))
57
55
222
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
6f95a37201632323cb77298c6af9dc1105f28f3e16ebfd26d303fd2d5decb849
MIT
permissive
https://github.com/Parquery/icontract/blob/master/LICENSE.txt
7b32e254e1d97ef0b36d4b67
gamechanger/schemer
schemer/extension_types.py
Mixed
https://github.com/gamechanger/schemer/blob/1d1dd7da433d3b84ce5a80ded5a84ab4a65825ee/schemer/extension_types.py#L1-L28
train
python
Mixed type, used to indicate a field in a schema can be one of many types. Use as a last resort only. The Mixed type can be used directly as a class to indicate any type is permitted for a given field: `"my_field": {"type": Mixed}` It can also be instantiated with list of specific types the fiel...
def Mixed(*types): """Mixed type, used to indicate a field in a schema can be one of many types. Use as a last resort only. The Mixed type can be used directly as a class to indicate any type is permitted for a given field: `"my_field": {"type": Mixed}` It can also be instantiated with list of s...
Mixed type, used to indicate a field in a schema can be one of many types. Use as a last resort only. The Mixed type can be used directly as a class to indicate any type is permitted for a given field: `"my_field": {"type": Mixed}` It can also be instantiated with list of specific types the fiel...
323
409
988
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
65df01dff62267413a44731326f33d943cb0d9e517d03a82fde6eb351a6b311e
MIT
permissive
https://github.com/gamechanger/schemer/blob/master/LICENSE
5d6f4e1a1507ff3cdaac5dc2
gamechanger/schemer
schemer/validators.py
one_of
https://github.com/gamechanger/schemer/blob/1d1dd7da433d3b84ce5a80ded5a84ab4a65825ee/schemer/validators.py#L8-L21
train
python
Validates that a field value matches one of the values given to this validator.
def one_of(*args): """ Validates that a field value matches one of the values given to this validator. """ if len(args) == 1 and isinstance(args[0], list): items = args[0] else: items = list(args) def validate(value): if not value in items: return e("{} i...
Validates that a field value matches one of the values given to this validator. def one_of(*args): """ Validates that a field value matches one of the values given to this validator. """ if len(args) == 1 and isinstance(args[0], list): items = args[0] else: items = list(args...
107
83
376
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
242f843b4f4ce39efce9c91b5b394294ab58c0500756522e6d5bd97b77a39252
MIT
permissive
https://github.com/gamechanger/schemer/blob/master/LICENSE
826c86ce4bd8878f364741d4
gamechanger/schemer
schemer/validators.py
gte
https://github.com/gamechanger/schemer/blob/1d1dd7da433d3b84ce5a80ded5a84ab4a65825ee/schemer/validators.py#L24-L32
train
python
Validates that a field value is greater than or equal to the value given to this validator.
def gte(min_value): """ Validates that a field value is greater than or equal to the value given to this validator. """ def validate(value): if value < min_value: return e("{} is not greater than or equal to {}", value, min_value) return validate
Validates that a field value is greater than or equal to the value given to this validator. def gte(min_value): """ Validates that a field value is greater than or equal to the value given to this validator. """ def validate(value): if value < min_value: return e("{} is not ...
84
95
290
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
6a44320a43add6431eff73e6e9cb140a262586cf9a816827d264c28844ef154c
MIT
permissive
https://github.com/gamechanger/schemer/blob/master/LICENSE
ff727c82c30ffa1d60cd20c6
gamechanger/schemer
schemer/validators.py
lte
https://github.com/gamechanger/schemer/blob/1d1dd7da433d3b84ce5a80ded5a84ab4a65825ee/schemer/validators.py#L35-L43
train
python
Validates that a field value is less than or equal to the value given to this validator.
def lte(max_value): """ Validates that a field value is less than or equal to the value given to this validator. """ def validate(value): if value > max_value: return e("{} is not less than or equal to {}", value, max_value) return validate
Validates that a field value is less than or equal to the value given to this validator. def lte(max_value): """ Validates that a field value is less than or equal to the value given to this validator. """ def validate(value): if value > max_value: return e("{} is not less t...
84
92
284
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
3045c0ccefc78a168c5141945a0baa3efe3f5e0d3c1131b3348ddff83e46a071
MIT
permissive
https://github.com/gamechanger/schemer/blob/master/LICENSE
c6a39316c1a009fe3ee55572
gamechanger/schemer
schemer/validators.py
gt
https://github.com/gamechanger/schemer/blob/1d1dd7da433d3b84ce5a80ded5a84ab4a65825ee/schemer/validators.py#L46-L54
train
python
Validates that a field value is greater than the value given to this validator.
def gt(gt_value): """ Validates that a field value is greater than the value given to this validator. """ def validate(value): if value <= gt_value: return e("{} is not greater than {}", value, gt_value) return validate
Validates that a field value is greater than the value given to this validator. def gt(gt_value): """ Validates that a field value is greater than the value given to this validator. """ def validate(value): if value <= gt_value: return e("{} is not greater than {}", value, g...
74
83
263
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
30fce1e4ce682242231142865aebbd5cf53b70eb9059e2b0179a07124d89b16c
MIT
permissive
https://github.com/gamechanger/schemer/blob/master/LICENSE
87a70ba9870f0f264f448709
gamechanger/schemer
schemer/validators.py
lt
https://github.com/gamechanger/schemer/blob/1d1dd7da433d3b84ce5a80ded5a84ab4a65825ee/schemer/validators.py#L57-L65
train
python
Validates that a field value is less than the value given to this validator.
def lt(lt_value): """ Validates that a field value is less than the value given to this validator. """ def validate(value): if value >= lt_value: return e("{} is not less than {}", value, lt_value) return validate
Validates that a field value is less than the value given to this validator. def lt(lt_value): """ Validates that a field value is less than the value given to this validator. """ def validate(value): if value >= lt_value: return e("{} is not less than {}", value, lt_value) ...
75
80
257
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
a345dacb62e2aba733195e4a1a4b6b6fd57470cc670b43ccb643bc08209787c3
MIT
permissive
https://github.com/gamechanger/schemer/blob/master/LICENSE
a176d1019b7150f2c47b9f70
gamechanger/schemer
schemer/validators.py
between
https://github.com/gamechanger/schemer/blob/1d1dd7da433d3b84ce5a80ded5a84ab4a65825ee/schemer/validators.py#L68-L80
train
python
Validates that a field value is between the two values given to this validator.
def between(min_value, max_value): """ Validates that a field value is between the two values given to this validator. """ def validate(value): if value < min_value: return e("{} is not greater than or equal to {}", value, min_value) if value > max_value: ...
Validates that a field value is between the two values given to this validator. def between(min_value, max_value): """ Validates that a field value is between the two values given to this validator. """ def validate(value): if value < min_value: return e("{} is not greater t...
108
83
432
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
19b295058a8073fe4ad0a789ea3e3498eb9231415fdb0904b40c7fdd388a2670
MIT
permissive
https://github.com/gamechanger/schemer/blob/master/LICENSE
658a9a43abcd078a54633f88
gamechanger/schemer
schemer/validators.py
length
https://github.com/gamechanger/schemer/blob/1d1dd7da433d3b84ce5a80ded5a84ab4a65825ee/schemer/validators.py#L83-L94
train
python
Validates that a field value's length is between the bounds given to this validator.
def length(min=None, max=None): """ Validates that a field value's length is between the bounds given to this validator. """ def validate(value): if min and len(value) < min: return e("{} does not have a length of at least {}", value, min) if max and len(value) > max: ...
Validates that a field value's length is between the bounds given to this validator. def length(min=None, max=None): """ Validates that a field value's length is between the bounds given to this validator. """ def validate(value): if min and len(value) < min: return e("{} d...
112
88
413
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
2e1ca1a57c92fbb76ec1ae8d8b3203b6ced52514d8be72c7023fa4999069d2e6
MIT
permissive
https://github.com/gamechanger/schemer/blob/master/LICENSE
c36874af7dd7d202563a529e
gamechanger/schemer
schemer/validators.py
match
https://github.com/gamechanger/schemer/blob/1d1dd7da433d3b84ce5a80ded5a84ab4a65825ee/schemer/validators.py#L97-L106
train
python
Validates that a field value matches the regex given to this validator.
def match(pattern): """ Validates that a field value matches the regex given to this validator. """ regex = re.compile(pattern) def validate(value): if not regex.match(value): return e("{} does not match the pattern {}", value, pattern) return validate
Validates that a field value matches the regex given to this validator. def match(pattern): """ Validates that a field value matches the regex given to this validator. """ regex = re.compile(pattern) def validate(value): if not regex.match(value): return e("{} does not match th...
72
71
297
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
eb5e0084fd8d5255b0cffcc0cfa6b9954eb5bd484991805391fea1345160daa1
MIT
permissive
https://github.com/gamechanger/schemer/blob/master/LICENSE
f4231303bc88c053699d05c7
gamechanger/schemer
schemer/validators.py
is_email
https://github.com/gamechanger/schemer/blob/1d1dd7da433d3b84ce5a80ded5a84ab4a65825ee/schemer/validators.py#L108-L129
train
python
Validates that a fields value is a valid email address.
def is_email(): """ Validates that a fields value is a valid email address. """ email = ( ur'(?!^\.)' # No dot at start ur'(?!.*\.@)' # No dot before at sign ur'(?!.*@\.)' # No dot after at sign ur'(?!.*\.$)' # No dot at the end ur'(?!.*\.\.)' # No dou...
Validates that a fields value is a valid email address. def is_email(): """ Validates that a fields value is a valid email address. """ email = ( ur'(?!^\.)' # No dot at start ur'(?!.*\.@)' # No dot before at sign ur'(?!.*@\.)' # No dot after at sign ur'(?!.*\.$...
207
55
742
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
2b37bdb99a209180c15dab10503e076d97a78585377d4126168e5acbac369cb9
MIT
permissive
https://github.com/gamechanger/schemer/blob/master/LICENSE
d33fa0e4b71d633ee0fd4e00
gamechanger/schemer
schemer/validators.py
is_url
https://github.com/gamechanger/schemer/blob/1d1dd7da433d3b84ce5a80ded5a84ab4a65825ee/schemer/validators.py#L131-L147
train
python
Validates that a fields value is a valid URL.
def is_url(): """ Validates that a fields value is a valid URL. """ # Stolen from Django regex = re.compile( r'^(?:http|ftp)s?://' # http:// or https:// r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|' #domain... r'localhost|' #localhost......
Validates that a fields value is a valid URL. def is_url(): """ Validates that a fields value is a valid URL. """ # Stolen from Django regex = re.compile( r'^(?:http|ftp)s?://' # http:// or https:// r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|'...
226
45
592
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
64c7cd3d686f255b12611ebcbb0c2cd3b28bec519e42e81c4bc51131641cb7cd
MIT
permissive
https://github.com/gamechanger/schemer/blob/master/LICENSE
ce75e8dc763512f30981eb53
gamechanger/schemer
schemer/validators.py
each_item
https://github.com/gamechanger/schemer/blob/1d1dd7da433d3b84ce5a80ded5a84ab4a65825ee/schemer/validators.py#L150-L166
train
python
A wrapper which applies the given validators to each item in a field value of type `list`. Example usage in a Schema: "my_list_field": {"type": Array(int), "validates": each_item(lte(10))}
def each_item(*validators): """ A wrapper which applies the given validators to each item in a field value of type `list`. Example usage in a Schema: "my_list_field": {"type": Array(int), "validates": each_item(lte(10))} """ def validate(value): for item in value: for v...
A wrapper which applies the given validators to each item in a field value of type `list`. Example usage in a Schema: "my_list_field": {"type": Array(int), "validates": each_item(lte(10))} def each_item(*validators): """ A wrapper which applies the given validators to each item in a field val...
152
202
482
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
d9d0f2bc56f352a4618d6d527f79469bf952cf0b255b8ac0bc9a05d86a31c75d
MIT
permissive
https://github.com/gamechanger/schemer/blob/master/LICENSE
abe676dbe08c0e095a9c5d59
gamechanger/schemer
schemer/validators.py
distinct
https://github.com/gamechanger/schemer/blob/1d1dd7da433d3b84ce5a80ded5a84ab4a65825ee/schemer/validators.py#L169-L178
train
python
Validates that all items in the given field list value are distinct, i.e. that the list contains no duplicates.
def distinct(): """ Validates that all items in the given field list value are distinct, i.e. that the list contains no duplicates. """ def validate(value): for i, item in enumerate(value): if item in value[i+1:]: return e("{} is not a distinct set of values", val...
Validates that all items in the given field list value are distinct, i.e. that the list contains no duplicates. def distinct(): """ Validates that all items in the given field list value are distinct, i.e. that the list contains no duplicates. """ def validate(value): for i, item in enu...
97
115
343
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
8b2689540061ebb44d8f0721f9a1963fe667bcfbb4feb31af54ed21513c5a693
MIT
permissive
https://github.com/gamechanger/schemer/blob/master/LICENSE
1e92d1f4fdbd288f2549b517
gamechanger/schemer
schemer/__init__.py
Schema.apply_defaults
https://github.com/gamechanger/schemer/blob/1d1dd7da433d3b84ce5a80ded5a84ab4a65825ee/schemer/__init__.py#L26-L49
train
python
Applies the defaults described by the this schema to the given document instance as appropriate. Defaults are only applied to fields which are currently unset.
def apply_defaults(self, instance): """Applies the defaults described by the this schema to the given document instance as appropriate. Defaults are only applied to fields which are currently unset.""" for field, spec in self.doc_spec.iteritems(): field_type = spec['type'] ...
Applies the defaults described by the this schema to the given document instance as appropriate. Defaults are only applied to fields which are currently unset. def apply_defaults(self, instance): """Applies the defaults described by the this schema to the given document instance as appr...
230
175
1,179
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
e36e36830903e55b96a1255a9f90f14dfc1385088311783b7f9cc03864941840
MIT
permissive
https://github.com/gamechanger/schemer/blob/master/LICENSE
41250b457087c57c978fa166
gamechanger/schemer
schemer/__init__.py
Schema.validate
https://github.com/gamechanger/schemer/blob/1d1dd7da433d3b84ce5a80ded5a84ab4a65825ee/schemer/__init__.py#L51-L58
train
python
Validates the given document against this schema. Raises a ValidationException if there are any failures.
def validate(self, instance): """Validates the given document against this schema. Raises a ValidationException if there are any failures.""" errors = {} self._validate_instance(instance, errors) if len(errors) > 0: raise ValidationException(errors)
Validates the given document against this schema. Raises a ValidationException if there are any failures. def validate(self, instance): """Validates the given document against this schema. Raises a ValidationException if there are any failures.""" errors = {} self._validate_inst...
78
113
302
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
341e7e6b4308f07883dbf7023128be922797f81db2742933cb739f93709b2525
MIT
permissive
https://github.com/gamechanger/schemer/blob/master/LICENSE
95e10a536e0cc5d978d66675
gamechanger/schemer
schemer/__init__.py
Schema._verify
https://github.com/gamechanger/schemer/blob/1d1dd7da433d3b84ce5a80ded5a84ab4a65825ee/schemer/__init__.py#L67-L76
train
python
Verifies that this schema's doc spec is valid and makes sense.
def _verify(self, path_prefix=None): """Verifies that this schema's doc spec is valid and makes sense.""" for field, spec in self.doc_spec.iteritems(): path = self._append_path(path_prefix, field) # Standard dict-based spec if isinstance(spec, dict): ...
Verifies that this schema's doc spec is valid and makes sense. def _verify(self, path_prefix=None): """Verifies that this schema's doc spec is valid and makes sense.""" for field, spec in self.doc_spec.iteritems(): path = self._append_path(path_prefix, field) # Standard dict-ba...
101
62
458
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
c10b0ecb2a5ed4d28e5a52d8b73c27488e9cda2fc5afd033df98e313dd9504f8
MIT
permissive
https://github.com/gamechanger/schemer/blob/master/LICENSE
b3c6dac69d7a25a2ba67b66e
gamechanger/schemer
schemer/__init__.py
Schema._verify_field_spec
https://github.com/gamechanger/schemer/blob/1d1dd7da433d3b84ce5a80ded5a84ab4a65825ee/schemer/__init__.py#L79-L106
train
python
Verifies a given field specification is valid, recursing into nested schemas if required.
def _verify_field_spec(self, spec, path): """Verifies a given field specification is valid, recursing into nested schemas if required.""" # Required should be a boolean if 'required' in spec and not isinstance(spec['required'], bool): raise SchemaFormatException("{} required declara...
Verifies a given field specification is valid, recursing into nested schemas if required. def _verify_field_spec(self, spec, path): """Verifies a given field specification is valid, recursing into nested schemas if required.""" # Required should be a boolean if 'required' in spec and not isins...
284
89
1,309
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
81f33a80e6dcad9a7dd8e89ebf0e52138c31a0e525323f867afa285db503cb08
MIT
permissive
https://github.com/gamechanger/schemer/blob/master/LICENSE
f7ff59dadaa8396e3e99bee0
gamechanger/schemer
schemer/__init__.py
Schema._verify_type
https://github.com/gamechanger/schemer/blob/1d1dd7da433d3b84ce5a80ded5a84ab4a65825ee/schemer/__init__.py#L108-L123
train
python
Verify that the 'type' in the spec is valid
def _verify_type(self, spec, path): """Verify that the 'type' in the spec is valid""" field_type = spec['type'] if isinstance(field_type, Schema): # Nested documents cannot have validation if not set(spec.keys()).issubset(set(['type', 'required', 'nullable', 'default']))...
Verify that the 'type' in the spec is valid def _verify_type(self, spec, path): """Verify that the 'type' in the spec is valid""" field_type = spec['type'] if isinstance(field_type, Schema): # Nested documents cannot have validation if not set(spec.keys()).issubset(set(...
198
43
940
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
6a6b17b22ce75694b6c66a7e97207d6837bc8c720f2e3b9ffd8106d095bf5da5
MIT
permissive
https://github.com/gamechanger/schemer/blob/master/LICENSE
08e204be1312e79d77d11931
gamechanger/schemer
schemer/__init__.py
Schema._verify_default
https://github.com/gamechanger/schemer/blob/1d1dd7da433d3b84ce5a80ded5a84ab4a65825ee/schemer/__init__.py#L128-L156
train
python
Verifies that the default specified in the given spec is valid.
def _verify_default(self, spec, path): """Verifies that the default specified in the given spec is valid.""" field_type = spec['type'] default = spec['default'] # If it's a function there's nothing we can really do except assume its valid if callable(default): return...
Verifies that the default specified in the given spec is valid. def _verify_default(self, spec, path): """Verifies that the default specified in the given spec is valid.""" field_type = spec['type'] default = spec['default'] # If it's a function there's nothing we can really do except ...
285
63
1,483
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
969d9d29f7c9a1975e877d2c0e2d8e6b0b1a439f1fe1b9cf4cc66cdf34434073
MIT
permissive
https://github.com/gamechanger/schemer/blob/master/LICENSE
5e8790e3e324d0961db887ae
gamechanger/schemer
schemer/__init__.py
Schema._verify_validates
https://github.com/gamechanger/schemer/blob/1d1dd7da433d3b84ce5a80ded5a84ab4a65825ee/schemer/__init__.py#L159-L167
train
python
Verify thats the 'validates' argument is valid.
def _verify_validates(self, spec, path): """Verify thats the 'validates' argument is valid.""" validates = spec['validates'] if isinstance(validates, list): for validator in validates: self._verify_validator(validator, path) else: self._verify_val...
Verify thats the 'validates' argument is valid. def _verify_validates(self, spec, path): """Verify thats the 'validates' argument is valid.""" validates = spec['validates'] if isinstance(validates, list): for validator in validates: self._verify_validator(validator,...
80
47
343
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
538764750cf17d4173c6ff1038bae54fdaab5f45acc4d7789be65b458b77a184
MIT
permissive
https://github.com/gamechanger/schemer/blob/master/LICENSE
89248ce97caa7ab1bed3b942
gamechanger/schemer
schemer/__init__.py
Schema._verify_validator
https://github.com/gamechanger/schemer/blob/1d1dd7da433d3b84ce5a80ded5a84ab4a65825ee/schemer/__init__.py#L170-L180
train
python
Verifies that a given validator associated with the field at the given path is legitimate.
def _verify_validator(self, validator, path): """Verifies that a given validator associated with the field at the given path is legitimate.""" # Validator should be a function if not callable(validator): raise SchemaFormatException("Invalid validations for {}", path) # Vali...
Verifies that a given validator associated with the field at the given path is legitimate. def _verify_validator(self, validator, path): """Verifies that a given validator associated with the field at the given path is legitimate.""" # Validator should be a function if not callable(validator):...
119
90
528
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
ad9b143352ba4f026dfb8c8f095e9861c636df425f4dce541cfe9ac4180738b2
MIT
permissive
https://github.com/gamechanger/schemer/blob/master/LICENSE
0f61853d31a2edd475eeb856
gamechanger/schemer
schemer/__init__.py
Schema._validate_instance
https://github.com/gamechanger/schemer/blob/1d1dd7da433d3b84ce5a80ded5a84ab4a65825ee/schemer/__init__.py#L183-L215
train
python
Validates that the given instance of a document conforms to the given schema's structure and validations. Any validation errors are added to the given errors collection. The caller should assume the instance is considered valid if the errors collection is empty when this method returns.
def _validate_instance(self, instance, errors, path_prefix=''): """Validates that the given instance of a document conforms to the given schema's structure and validations. Any validation errors are added to the given errors collection. The caller should assume the instance is considered valid i...
Validates that the given instance of a document conforms to the given schema's structure and validations. Any validation errors are added to the given errors collection. The caller should assume the instance is considered valid if the errors collection is empty when this method returns. def _va...
380
311
1,680
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
f98023f7b1c7c93cea11a0e5b42b67484a565ff98e25040c1623d37700ecdcd9
MIT
permissive
https://github.com/gamechanger/schemer/blob/master/LICENSE
63d77b0e35acb674389d2b49
gamechanger/schemer
schemer/__init__.py
Schema._validate_value
https://github.com/gamechanger/schemer/blob/1d1dd7da433d3b84ce5a80ded5a84ab4a65825ee/schemer/__init__.py#L217-L274
train
python
Validates that the given field value is valid given the associated field spec and path. Any validation failures are added to the given errors collection.
def _validate_value(self, value, field_spec, path, errors): """Validates that the given field value is valid given the associated field spec and path. Any validation failures are added to the given errors collection.""" # Check if the value is None and add an error if the field is not n...
Validates that the given field value is valid given the associated field spec and path. Any validation failures are added to the given errors collection. def _validate_value(self, value, field_spec, path, errors): """Validates that the given field value is valid given the associated fie...
555
169
2,820
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
a9e47b63ab1a20908cdd53b70bcb09524ccb2deffec946c1ae792a1964b14cf1
MIT
permissive
https://github.com/gamechanger/schemer/blob/master/LICENSE
22d4b093644d4da1bf8faf33
GaretJax/lancet
lancet/settings.py
load_config
https://github.com/GaretJax/lancet/blob/cf438c5c6166b18ee0dc5ffce55220793019bb95/lancet/settings.py#L37-L61
train
python
Loads and parses an INI style configuration file using Python's built-in configparser module. If path is specified, load it. If ``defaults`` (a list of strings) is given, try to load each entry as a file, without throwing any error if the operation fails. If ``defaults`` is not given, the following loca...
def load_config(path=None, defaults=None): """ Loads and parses an INI style configuration file using Python's built-in configparser module. If path is specified, load it. If ``defaults`` (a list of strings) is given, try to load each entry as a file, without throwing any error if the operation fail...
Loads and parses an INI style configuration file using Python's built-in configparser module. If path is specified, load it. If ``defaults`` (a list of strings) is given, try to load each entry as a file, without throwing any error if the operation fails. If ``defaults`` is not given, the following loca...
300
533
848
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
d17515fa3e93b9646d13340e28434738d7cee47cdb6208e90bcaa4cf7377736d
MIT
permissive
https://github.com/GaretJax/lancet/blob/master/LICENSE
010a496e2309b04a107865eb
GaretJax/lancet
lancet/settings.py
as_dict
https://github.com/GaretJax/lancet/blob/cf438c5c6166b18ee0dc5ffce55220793019bb95/lancet/settings.py#L85-L96
train
python
Converts a ConfigParser object into a dictionary. The resulting dictionary has sections as keys which point to a dict of the sections options as key => value pairs.
def as_dict(config): """ Converts a ConfigParser object into a dictionary. The resulting dictionary has sections as keys which point to a dict of the sections options as key => value pairs. """ settings = defaultdict(lambda: {}) for section in config.sections(): for key, val in conf...
Converts a ConfigParser object into a dictionary. The resulting dictionary has sections as keys which point to a dict of the sections options as key => value pairs. def as_dict(config): """ Converts a ConfigParser object into a dictionary. The resulting dictionary has sections as keys which point...
115
173
399
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
f387bdd9a8cca099e244472a572454e22d3cd8e1bd0b57cf7a899d1ae5babf90
MIT
permissive
https://github.com/GaretJax/lancet/blob/master/LICENSE
932ea1bf6e6bdc1ddab91ecc
walkr/nanoservice
nanoservice/core.py
Endpoint.initialize
https://github.com/walkr/nanoservice/blob/e2098986b1baa5f283167ae487d14f3c6c21961a/nanoservice/core.py#L67-L77
train
python
Bind or connect the nanomsg socket to some address
def initialize(self, timeouts): """ Bind or connect the nanomsg socket to some address """ # Bind or connect to address if self.bind is True: self.socket.bind(self.address) else: self.socket.connect(self.address) # Set send and recv timeouts self...
Bind or connect the nanomsg socket to some address def initialize(self, timeouts): """ Bind or connect the nanomsg socket to some address """ # Bind or connect to address if self.bind is True: self.socket.bind(self.address) else: self.socket.connect(self.address...
81
50
344
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
a77d3b040fd09c20a7aa23551675b66170ecdd1f2d33e93b1167c774a1a62619
MIT
permissive
https://github.com/walkr/nanoservice/blob/master/LICENSE
3db07beb769197b908e9abef
walkr/nanoservice
nanoservice/core.py
Endpoint._set_timeouts
https://github.com/walkr/nanoservice/blob/e2098986b1baa5f283167ae487d14f3c6c21961a/nanoservice/core.py#L79-L97
train
python
Set socket timeouts for send and receive respectively
def _set_timeouts(self, timeouts): """ Set socket timeouts for send and receive respectively """ (send_timeout, recv_timeout) = (None, None) try: (send_timeout, recv_timeout) = timeouts except TypeError: raise EndpointError( '`timeouts` must be a...
Set socket timeouts for send and receive respectively def _set_timeouts(self, timeouts): """ Set socket timeouts for send and receive respectively """ (send_timeout, recv_timeout) = (None, None) try: (send_timeout, recv_timeout) = timeouts except TypeError: rai...
165
53
725
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
09cc26fc24400c3cb09c04d929a41c995d90c3eb2d54d03ea083568c8e624389
MIT
permissive
https://github.com/walkr/nanoservice/blob/master/LICENSE
ad32b39da57cdc27d276dfc0
walkr/nanoservice
nanoservice/core.py
Endpoint.send
https://github.com/walkr/nanoservice/blob/e2098986b1baa5f283167ae487d14f3c6c21961a/nanoservice/core.py#L99-L103
train
python
Encode and sign (optional) the send through socket
def send(self, payload): """ Encode and sign (optional) the send through socket """ payload = self.encode(payload) payload = self.sign(payload) self.socket.send(payload)
Encode and sign (optional) the send through socket def send(self, payload): """ Encode and sign (optional) the send through socket """ payload = self.encode(payload) payload = self.sign(payload) self.socket.send(payload)
50
50
201
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
9d2c1cb8c69c8ae5d92b6d372757150bb64f22ca8296c19569293f146c563f05
MIT
permissive
https://github.com/walkr/nanoservice/blob/master/LICENSE
a4998df4f2077508b8de036a
walkr/nanoservice
nanoservice/core.py
Endpoint.receive
https://github.com/walkr/nanoservice/blob/e2098986b1baa5f283167ae487d14f3c6c21961a/nanoservice/core.py#L105-L111
train
python
Receive from socket, authenticate and decode payload
def receive(self, decode=True): """ Receive from socket, authenticate and decode payload """ payload = self.socket.recv() payload = self.verify(payload) if decode: payload = self.decode(payload) return payload
Receive from socket, authenticate and decode payload def receive(self, decode=True): """ Receive from socket, authenticate and decode payload """ payload = self.socket.recv() payload = self.verify(payload) if decode: payload = self.decode(payload) return payload
55
52
261
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
cfb1dbae315b4f77a1c3b1a2d7898bccfe4d498c17e52189896eb9079ba84cfc
MIT
permissive
https://github.com/walkr/nanoservice/blob/master/LICENSE
9d28478d5994901e87b2f406
walkr/nanoservice
nanoservice/core.py
Endpoint.sign
https://github.com/walkr/nanoservice/blob/e2098986b1baa5f283167ae487d14f3c6c21961a/nanoservice/core.py#L113-L117
train
python
Sign payload using the supplied authenticator
def sign(self, payload): """ Sign payload using the supplied authenticator """ if self.authenticator: return self.authenticator.signed(payload) return payload
Sign payload using the supplied authenticator def sign(self, payload): """ Sign payload using the supplied authenticator """ if self.authenticator: return self.authenticator.signed(payload) return payload
42
45
194
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
a335f1a9c52275a3cf18add11715fe62432c4f69b43003f420ba8ace56d905d6
MIT
permissive
https://github.com/walkr/nanoservice/blob/master/LICENSE
cbf2633c4954485ed6a92480
walkr/nanoservice
nanoservice/core.py
Endpoint.verify
https://github.com/walkr/nanoservice/blob/e2098986b1baa5f283167ae487d14f3c6c21961a/nanoservice/core.py#L119-L129
train
python
Verify payload authenticity via the supplied authenticator
def verify(self, payload): """ Verify payload authenticity via the supplied authenticator """ if not self.authenticator: return payload try: self.authenticator.auth(payload) return self.authenticator.unsigned(payload) except AuthenticatorInvalidSignatu...
Verify payload authenticity via the supplied authenticator def verify(self, payload): """ Verify payload authenticity via the supplied authenticator """ if not self.authenticator: return payload try: self.authenticator.auth(payload) return self.authenticator....
79
58
432
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
3ff7d68bcc639aa6423e9307ff72b69efdbc3342b9198303b2da50b8fe1c5610
MIT
permissive
https://github.com/walkr/nanoservice/blob/master/LICENSE
d69aae3721a67728033a5c70
walkr/nanoservice
nanoservice/core.py
Endpoint.decode
https://github.com/walkr/nanoservice/blob/e2098986b1baa5f283167ae487d14f3c6c21961a/nanoservice/core.py#L131-L136
train
python
Decode payload
def decode(self, payload): """ Decode payload """ try: return self.encoder.decode(payload) except Exception as exception: raise DecodeError(str(exception))
Decode payload def decode(self, payload): """ Decode payload """ try: return self.encoder.decode(payload) except Exception as exception: raise DecodeError(str(exception))
37
14
203
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
ef0cc10a514096bacbffd8fce3ba6a038c194fb857eb384309e56d40f922ec56
MIT
permissive
https://github.com/walkr/nanoservice/blob/master/LICENSE
536ce613b8051fa5c0bc07c4
walkr/nanoservice
nanoservice/core.py
Endpoint.encode
https://github.com/walkr/nanoservice/blob/e2098986b1baa5f283167ae487d14f3c6c21961a/nanoservice/core.py#L138-L143
train
python
Encode payload
def encode(self, payload): """ Encode payload """ try: return self.encoder.encode(payload) except Exception as exception: raise EncodeError(str(exception))
Encode payload def encode(self, payload): """ Encode payload """ try: return self.encoder.encode(payload) except Exception as exception: raise EncodeError(str(exception))
37
14
203
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
a33afd12998e79fab8bcff13b7acc78f0e23b92f68d69dc29279f1cf27fbe95e
MIT
permissive
https://github.com/walkr/nanoservice/blob/master/LICENSE
3186c79c9645e825388b50d6
walkr/nanoservice
nanoservice/core.py
Process.start
https://github.com/walkr/nanoservice/blob/e2098986b1baa5f283167ae487d14f3c6c21961a/nanoservice/core.py#L149-L158
train
python
Start and listen for calls
def start(self): """ Start and listen for calls """ if threading.current_thread().name == 'MainThread': signal.signal(signal.SIGINT, self.stop) logging.info('Started on {}'.format(self.address)) while True: self.process()
Start and listen for calls def start(self): """ Start and listen for calls """ if threading.current_thread().name == 'MainThread': signal.signal(signal.SIGINT, self.stop) logging.info('Started on {}'.format(self.address)) while True: self.process()
58
26
280
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
ff328e472dcbc8e56f776432dcc2185c407dc2dec49f2212a8ee157ed02c32fc
MIT
permissive
https://github.com/walkr/nanoservice/blob/master/LICENSE
3814b13c2daa608df83ebe3a
walkr/nanoservice
nanoservice/core.py
Process.stop
https://github.com/walkr/nanoservice/blob/e2098986b1baa5f283167ae487d14f3c6c21961a/nanoservice/core.py#L160-L164
train
python
Shutdown process (this method is also a signal handler)
def stop(self, dummy_signum=None, dummy_frame=None): """ Shutdown process (this method is also a signal handler) """ logging.info('Shutting down ...') self.socket.close() sys.exit(0)
Shutdown process (this method is also a signal handler) def stop(self, dummy_signum=None, dummy_frame=None): """ Shutdown process (this method is also a signal handler) """ logging.info('Shutting down ...') self.socket.close() sys.exit(0)
58
55
214
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
ab0427cdcf0cb453b97d2528ab23c4d8b69889bd69a705f768233cfb347af40a
MIT
permissive
https://github.com/walkr/nanoservice/blob/master/LICENSE
43127e31889dec7468c4cca5
RockFeng0/rtsf
rtsf/p_report.py
HtmlReporter.get_summary
https://github.com/RockFeng0/rtsf/blob/fbc0d57edaeca86418af3942472fcc6d3e9ce591/rtsf/p_report.py#L134-L193
train
python
summarize the report data @param list_all: a list which save the report data @param kwargs: such as show_all: True/False report show all status cases proj_name: project name home_page: home page url
def get_summary(list_all=[], **kwargs): ''' summarize the report data @param list_all: a list which save the report data @param kwargs: such as show_all: True/False report show all status cases proj_name: project name home_pag...
summarize the report data @param list_all: a list which save the report data @param kwargs: such as show_all: True/False report show all status cases proj_name: project name home_page: home page url def get_summary(list_all=[], **kw...
650
285
2,930
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
72248d41036f887084cafae6c4738a3ec2487d9c5142e905f3b6dc641db03036
MIT
permissive
https://github.com/RockFeng0/rtsf/blob/master/LICENSE
ef922756bfd120b31f9cf029
RockFeng0/rtsf
rtsf/p_report.py
HtmlReporter.add_report_data
https://github.com/RockFeng0/rtsf/blob/fbc0d57edaeca86418af3942472fcc6d3e9ce591/rtsf/p_report.py#L196-L241
train
python
add report data to a list @param list_all: a list which save the report data @param module_name: test set name or test module name @param kwargs: such as case_name: testcase name status: test result, Pass or Fail resp_teste...
def add_report_data(list_all=[], module_name="TestModule", **kwargs): ''' add report data to a list @param list_all: a list which save the report data @param module_name: test set name or test module name @param kwargs: such as case_name: testcase name ...
add report data to a list @param list_all: a list which save the report data @param module_name: test set name or test module name @param kwargs: such as case_name: testcase name status: test result, Pass or Fail resp_teste...
515
539
2,040
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
eee05d21ffc61268d8e24bc1d2839000aa8d6d360b31f1ef2f80e580b380780c
MIT
permissive
https://github.com/RockFeng0/rtsf/blob/master/LICENSE
3ab105b6faf66109ce5e39ce
walkr/nanoservice
nanoservice/pubsub.py
Subscriber.parse
https://github.com/walkr/nanoservice/blob/e2098986b1baa5f283167ae487d14f3c6c21961a/nanoservice/pubsub.py#L57-L66
train
python
Fetch the function registered for a certain subscription
def parse(self, subscription): """ Fetch the function registered for a certain subscription """ for name in self.methods: tag = bytes(name.encode('utf-8')) if subscription.startswith(tag): fun = self.methods.get(name) message = subscription[len(ta...
Fetch the function registered for a certain subscription def parse(self, subscription): """ Fetch the function registered for a certain subscription """ for name in self.methods: tag = bytes(name.encode('utf-8')) if subscription.startswith(tag): fun = self.metho...
81
56
397
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
a33751c34b7845771624df9a03671253bd7676ffdf552b6b3d83716554709559
MIT
permissive
https://github.com/walkr/nanoservice/blob/master/LICENSE
cf2e2baa271387328fee38a4
walkr/nanoservice
nanoservice/pubsub.py
Subscriber.subscribe
https://github.com/walkr/nanoservice/blob/e2098986b1baa5f283167ae487d14f3c6c21961a/nanoservice/pubsub.py#L72-L76
train
python
Subscribe to something and register a function
def subscribe(self, tag, fun, description=None): """ Subscribe to something and register a function """ self.methods[tag] = fun self.descriptions[tag] = description self.socket.set_string_option(nanomsg.SUB, nanomsg.SUB_SUBSCRIBE, tag)
Subscribe to something and register a function def subscribe(self, tag, fun, description=None): """ Subscribe to something and register a function """ self.methods[tag] = fun self.descriptions[tag] = description self.socket.set_string_option(nanomsg.SUB, nanomsg.SUB_SUBSCRIBE, tag)
67
46
267
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
8a0be53ca80de3ce22c362b53c8cde61fec507e8190a84476165d94e896249da
MIT
permissive
https://github.com/walkr/nanoservice/blob/master/LICENSE
6806ff4a48b3f3a1d80a0038
walkr/nanoservice
nanoservice/pubsub.py
Subscriber.process
https://github.com/walkr/nanoservice/blob/e2098986b1baa5f283167ae487d14f3c6c21961a/nanoservice/pubsub.py#L80-L124
train
python
Receive a subscription from the socket and process it
def process(self): """ Receive a subscription from the socket and process it """ subscription = None result = None try: subscription = self.socket.recv() except AuthenticateError as exception: logging.error( 'Subscriber error while authe...
Receive a subscription from the socket and process it def process(self): """ Receive a subscription from the socket and process it """ subscription = None result = None try: subscription = self.socket.recv() except AuthenticateError as exception: loggi...
266
53
1,455
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
5ca1bfc1030ba3e9e5363c8ed9969b84dbcbd34bb9685a8d34b19e9581496333
MIT
permissive
https://github.com/walkr/nanoservice/blob/master/LICENSE
bbf336c3d00dfcf6185c06ee
walkr/nanoservice
nanoservice/pubsub.py
Publisher.build_payload
https://github.com/walkr/nanoservice/blob/e2098986b1baa5f283167ae487d14f3c6c21961a/nanoservice/pubsub.py#L142-L147
train
python
Encode, sign payload(optional) and attach subscription tag
def build_payload(self, tag, message): """ Encode, sign payload(optional) and attach subscription tag """ message = self.encode(message) message = self.sign(message) payload = bytes(tag.encode('utf-8')) + message return payload
Encode, sign payload(optional) and attach subscription tag def build_payload(self, tag, message): """ Encode, sign payload(optional) and attach subscription tag """ message = self.encode(message) message = self.sign(message) payload = bytes(tag.encode('utf-8')) + message return ...
64
58
267
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
66f31017110ce863d1c576cf992369caa2d2be7b6007725945471b15af9ea4a0
MIT
permissive
https://github.com/walkr/nanoservice/blob/master/LICENSE
a53574e0ec7fed007885ff18
walkr/nanoservice
nanoservice/pubsub.py
Publisher.publish
https://github.com/walkr/nanoservice/blob/e2098986b1baa5f283167ae487d14f3c6c21961a/nanoservice/pubsub.py#L149-L152
train
python
Publish a message down the socket
def publish(self, tag, message): """ Publish a message down the socket """ payload = self.build_payload(tag, message) self.socket.send(payload)
Publish a message down the socket def publish(self, tag, message): """ Publish a message down the socket """ payload = self.build_payload(tag, message) self.socket.send(payload)
40
33
167
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
d5b1905ad8168df38d86d23788387e7d2c84bfe7c76911527402c5e5969351d0
MIT
permissive
https://github.com/walkr/nanoservice/blob/master/LICENSE
1a64d46852f14c49eb64ede1
walkr/nanoservice
benchmarks/bench_pub_sub_auth.py
start_service
https://github.com/walkr/nanoservice/blob/e2098986b1baa5f283167ae487d14f3c6c21961a/benchmarks/bench_pub_sub_auth.py#L13-L31
train
python
Start a service
def start_service(addr, n, authenticator): """ Start a service """ s = Subscriber(addr, authenticator=authenticator) def do_something(line): pass s.subscribe('test', do_something) started = time.time() for _ in range(n): s.process() s.socket.close() duration = time.ti...
Start a service def start_service(addr, n, authenticator): """ Start a service """ s = Subscriber(addr, authenticator=authenticator) def do_something(line): pass s.subscribe('test', do_something) started = time.time() for _ in range(n): s.process() s.socket.close() d...
100
15
419
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
24d30990c017a7cd56817e10da4caf283c0bc4eec158df1eaecdbdafebd0ff75
MIT
permissive
https://github.com/walkr/nanoservice/blob/master/LICENSE
1357a82493393b973129ba40
walkr/nanoservice
benchmarks/bench_pub_sub_auth.py
bench
https://github.com/walkr/nanoservice/blob/e2098986b1baa5f283167ae487d14f3c6c21961a/benchmarks/bench_pub_sub_auth.py#L34-L46
train
python
Benchmark n requests
def bench(client, n): """ Benchmark n requests """ items = list(range(n)) # Time client publish operations # ------------------------------ started = time.time() for i in items: client.publish('test', i) duration = time.time() - started print('Publisher client stats:') util...
Benchmark n requests def bench(client, n): """ Benchmark n requests """ items = list(range(n)) # Time client publish operations # ------------------------------ started = time.time() for i in items: client.publish('test', i) duration = time.time() - started print('Publisher cl...
78
20
345
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
748ad27528936d6be624391a1466d66768bba0c1b8f917a7c2492963dc3eb277
MIT
permissive
https://github.com/walkr/nanoservice/blob/master/LICENSE
a5d54bcfa35b62b22beb6a69
VisTrails/tej
tej/submission.py
_unique_names
https://github.com/VisTrails/tej/blob/b8dedaeb6bdeb650b46cfe6d85e5aa9284fc7f0b/tej/submission.py#L31-L40
train
python
Generates unique sequences of bytes.
def _unique_names(): """Generates unique sequences of bytes. """ characters = ("abcdefghijklmnopqrstuvwxyz" "0123456789") characters = [characters[i:i + 1] for i in irange(len(characters))] rng = random.Random() while True: letters = [rng.choice(characters) for i in ira...
Generates unique sequences of bytes. def _unique_names(): """Generates unique sequences of bytes. """ characters = ("abcdefghijklmnopqrstuvwxyz" "0123456789") characters = [characters[i:i + 1] for i in irange(len(characters))] rng = random.Random() while True: letters ...
90
36
359
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
3f9e86d1395dce3909085eb0863349143436d5703f6798cbf0b587df88cd99a8
BSD-3-Clause
permissive
https://github.com/VisTrails/tej/blob/master/LICENSE.txt
466e77eb89dba41451b3e929
VisTrails/tej
tej/submission.py
escape_queue
https://github.com/VisTrails/tej/blob/b8dedaeb6bdeb650b46cfe6d85e5aa9284fc7f0b/tej/submission.py#L52-L62
train
python
Escapes the path to a queue, e.g. preserves ~ at the begining.
def escape_queue(s): """Escapes the path to a queue, e.g. preserves ~ at the begining. """ if isinstance(s, PosixPath): s = unicode_(s) elif isinstance(s, bytes): s = s.decode('utf-8') if s.startswith('~/'): return '~/' + shell_escape(s[2:]) else: return shell_esc...
Escapes the path to a queue, e.g. preserves ~ at the begining. def escape_queue(s): """Escapes the path to a queue, e.g. preserves ~ at the begining. """ if isinstance(s, PosixPath): s = unicode_(s) elif isinstance(s, bytes): s = s.decode('utf-8') if s.startswith('~/'): retu...
105
62
326
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
ac1d52b9bd923542c86eb280773f13e0122c6cad15e7efa50f26a8eccaaa7da6
BSD-3-Clause
permissive
https://github.com/VisTrails/tej/blob/master/LICENSE.txt
1ea1934f0a9b44b6a2987486
VisTrails/tej
tej/submission.py
parse_ssh_destination
https://github.com/VisTrails/tej/blob/b8dedaeb6bdeb650b46cfe6d85e5aa9284fc7f0b/tej/submission.py#L75-L93
train
python
Parses the SSH destination argument.
def parse_ssh_destination(destination): """Parses the SSH destination argument. """ match = _re_ssh.match(destination) if not match: raise InvalidDestination("Invalid destination: %s" % destination) user, password, host, port = match.groups() info = {} if user: info['username...
Parses the SSH destination argument. def parse_ssh_destination(destination): """Parses the SSH destination argument. """ match = _re_ssh.match(destination) if not match: raise InvalidDestination("Invalid destination: %s" % destination) user, password, host, port = match.groups() info = ...
132
36
528
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
fe84d44981326513f7512a6e75df175de063e277cf2e4eb0b0049a72ba15c5c7
BSD-3-Clause
permissive
https://github.com/VisTrails/tej/blob/master/LICENSE.txt
d970850d7145ad7515132c32
VisTrails/tej
tej/submission.py
RemoteQueue._ssh_client
https://github.com/VisTrails/tej/blob/b8dedaeb6bdeb650b46cfe6d85e5aa9284fc7f0b/tej/submission.py#L201-L207
train
python
Gets an SSH client to connect with.
def _ssh_client(self): """Gets an SSH client to connect with. """ ssh = paramiko.SSHClient() ssh.load_system_host_keys() ssh.set_missing_host_key_policy(paramiko.RejectPolicy()) return ssh
Gets an SSH client to connect with. def _ssh_client(self): """Gets an SSH client to connect with. """ ssh = paramiko.SSHClient() ssh.load_system_host_keys() ssh.set_missing_host_key_policy(paramiko.RejectPolicy()) return ssh
58
35
236
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
b965b5ccfc5e04bfe5b9eabf02e9dfdf2217eb9278c225e3b699e515c1c0f16d
BSD-3-Clause
permissive
https://github.com/VisTrails/tej/blob/master/LICENSE.txt
9f4402b04de513c9bea165ff
VisTrails/tej
tej/submission.py
RemoteQueue._connect
https://github.com/VisTrails/tej/blob/b8dedaeb6bdeb650b46cfe6d85e5aa9284fc7f0b/tej/submission.py#L209-L218
train
python
Connects via SSH.
def _connect(self): """Connects via SSH. """ ssh = self._ssh_client() logger.debug("Connecting with %s", ', '.join('%s=%r' % (k, v if k != "password" else "***") for k, v in iteritems(self.destination))) ssh.connect(**self.desti...
Connects via SSH. def _connect(self): """Connects via SSH. """ ssh = self._ssh_client() logger.debug("Connecting with %s", ', '.join('%s=%r' % (k, v if k != "password" else "***") for k, v in iteritems(self.destination))) ssh.c...
97
17
421
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
75fef1c849e34cd6e022931e2ad7ee863e93bd85f5eed38cc5d91dc6aba59bc9
BSD-3-Clause
permissive
https://github.com/VisTrails/tej/blob/master/LICENSE.txt
7341a84f52c12c52ca512b13
VisTrails/tej
tej/submission.py
RemoteQueue.get_client
https://github.com/VisTrails/tej/blob/b8dedaeb6bdeb650b46cfe6d85e5aa9284fc7f0b/tej/submission.py#L220-L238
train
python
Gets the SSH client. This will check that the connection is still alive first, and reconnect if necessary.
def get_client(self): """Gets the SSH client. This will check that the connection is still alive first, and reconnect if necessary. """ if self._ssh is None: self._connect() return self._ssh else: try: chan = self._ssh....
Gets the SSH client. This will check that the connection is still alive first, and reconnect if necessary. def get_client(self): """Gets the SSH client. This will check that the connection is still alive first, and reconnect if necessary. """ if self._ssh is No...
139
123
617
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
07d5e8e26f73e1a2ab7ce46871f17b4f3ad8aad94d3a9825a1dead37e307bac5
BSD-3-Clause
permissive
https://github.com/VisTrails/tej/blob/master/LICENSE.txt
af7df899fa4b3856ea96a0e8
VisTrails/tej
tej/submission.py
RemoteQueue._call
https://github.com/VisTrails/tej/blob/b8dedaeb6bdeb650b46cfe6d85e5aa9284fc7f0b/tej/submission.py#L243-L277
train
python
Calls a command through the SSH connection. Remote stderr gets printed to this program's stderr. Output is captured and may be returned.
def _call(self, cmd, get_output): """Calls a command through the SSH connection. Remote stderr gets printed to this program's stderr. Output is captured and may be returned. """ server_err = self.server_logger() chan = self.get_client().get_transport().open_session() ...
Calls a command through the SSH connection. Remote stderr gets printed to this program's stderr. Output is captured and may be returned. def _call(self, cmd, get_output): """Calls a command through the SSH connection. Remote stderr gets printed to this program's stderr. Output is capt...
285
153
1,340
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
de762ec7293cffbaa15a2c9c4a8c50f8c7c3d90f58e06e8cabc4e6260977a2e9
BSD-3-Clause
permissive
https://github.com/VisTrails/tej/blob/master/LICENSE.txt
acea72818ea2650c7dd99504
VisTrails/tej
tej/submission.py
RemoteQueue.check_call
https://github.com/VisTrails/tej/blob/b8dedaeb6bdeb650b46cfe6d85e5aa9284fc7f0b/tej/submission.py#L279-L284
train
python
Calls a command through SSH.
def check_call(self, cmd): """Calls a command through SSH. """ ret, _ = self._call(cmd, False) if ret != 0: # pragma: no cover raise RemoteCommandFailure(command=cmd, ret=ret)
Calls a command through SSH. def check_call(self, cmd): """Calls a command through SSH. """ ret, _ = self._call(cmd, False) if ret != 0: # pragma: no cover raise RemoteCommandFailure(command=cmd, ret=ret)
62
28
220
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
6ff3fcaa1b674d15c8363617bf9a1e351effd6b703178b7527582f04e3d8ab6c
BSD-3-Clause
permissive
https://github.com/VisTrails/tej/blob/master/LICENSE.txt
0b55cfc2b6dc504d1bbea700
VisTrails/tej
tej/submission.py
RemoteQueue.check_output
https://github.com/VisTrails/tej/blob/b8dedaeb6bdeb650b46cfe6d85e5aa9284fc7f0b/tej/submission.py#L286-L293
train
python
Calls a command through SSH and returns its output.
def check_output(self, cmd): """Calls a command through SSH and returns its output. """ ret, output = self._call(cmd, True) if ret != 0: # pragma: no cover raise RemoteCommandFailure(command=cmd, ret=ret) logger.debug("Output: %r", output) return output
Calls a command through SSH and returns its output. def check_output(self, cmd): """Calls a command through SSH and returns its output. """ ret, output = self._call(cmd, True) if ret != 0: # pragma: no cover raise RemoteCommandFailure(command=cmd, ret=ret) logger.de...
84
51
314
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
eb5374fc50250b7df50752322fcf4a8c7ce0a3da8448d36c200d03bf70ff2086
BSD-3-Clause
permissive
https://github.com/VisTrails/tej/blob/master/LICENSE.txt
aff42ef9a60c58c39421b8a8
VisTrails/tej
tej/submission.py
RemoteQueue._resolve_queue
https://github.com/VisTrails/tej/blob/b8dedaeb6bdeb650b46cfe6d85e5aa9284fc7f0b/tej/submission.py#L295-L353
train
python
Finds the location of tej's queue directory on the server. The `queue` set when constructing this `RemoteQueue` might be relative to the home directory and might contain ``~user`` placeholders. Also, each queue may in fact be a link to another path (a file containing the string ``tejdir...
def _resolve_queue(self, queue, depth=0, links=None): """Finds the location of tej's queue directory on the server. The `queue` set when constructing this `RemoteQueue` might be relative to the home directory and might contain ``~user`` placeholders. Also, each queue may in fact be a li...
Finds the location of tej's queue directory on the server. The `queue` set when constructing this `RemoteQueue` might be relative to the home directory and might contain ``~user`` placeholders. Also, each queue may in fact be a link to another path (a file containing the string ``tejdir...
668
396
2,776
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
01adffaea9dff33c140a984866e119294f67b784f0530aa5cf6892d8c7a03bf2
BSD-3-Clause
permissive
https://github.com/VisTrails/tej/blob/master/LICENSE.txt
620f9ebd23c2eeda98256796
VisTrails/tej
tej/submission.py
RemoteQueue._get_queue
https://github.com/VisTrails/tej/blob/b8dedaeb6bdeb650b46cfe6d85e5aa9284fc7f0b/tej/submission.py#L355-L364
train
python
Gets the actual location of the queue, or None.
def _get_queue(self): """Gets the actual location of the queue, or None. """ if self._queue is None: self._links = [] queue, depth = self._resolve_queue(self.queue, links=self._links) if queue is None and depth > 0: raise QueueLinkBroken ...
Gets the actual location of the queue, or None. def _get_queue(self): """Gets the actual location of the queue, or None. """ if self._queue is None: self._links = [] queue, depth = self._resolve_queue(self.queue, links=self._links) if queue is None and depth ...
92
47
372
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
7501e74e9fb70e6b2a3d1697dc785b68c8f80d4945f98c12802b55d9b524350f
BSD-3-Clause
permissive
https://github.com/VisTrails/tej/blob/master/LICENSE.txt
33754c30cf14f1d35de0a31e
VisTrails/tej
tej/submission.py
RemoteQueue.setup
https://github.com/VisTrails/tej/blob/b8dedaeb6bdeb650b46cfe6d85e5aa9284fc7f0b/tej/submission.py#L366-L411
train
python
Installs the runtime at the target location. This will not replace an existing installation, unless `force` is True. After installation, creates links to this installation at the specified locations.
def setup(self, links=None, force=False, only_links=False): """Installs the runtime at the target location. This will not replace an existing installation, unless `force` is True. After installation, creates links to this installation at the specified locations. """ if ...
Installs the runtime at the target location. This will not replace an existing installation, unless `force` is True. After installation, creates links to this installation at the specified locations. def setup(self, links=None, force=False, only_links=False): """Installs the runtime a...
397
225
1,888
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
f6318aa0f59edad9ec0ec93c1194ded49fe956ff707a7fc599fb9e4eaad333ad
BSD-3-Clause
permissive
https://github.com/VisTrails/tej/blob/master/LICENSE.txt
9d3a8501013ac653c371aa7d
VisTrails/tej
tej/submission.py
RemoteQueue._setup
https://github.com/VisTrails/tej/blob/b8dedaeb6bdeb650b46cfe6d85e5aa9284fc7f0b/tej/submission.py#L413-L462
train
python
Actually installs the runtime.
def _setup(self): """Actually installs the runtime. """ # Expands ~user in queue if self.queue.path[0:1] == b'/': queue = self.queue else: if self.queue.path[0:1] == b'~': output = self.check_output('echo %s' % ...
Actually installs the runtime. def _setup(self): """Actually installs the runtime. """ # Expands ~user in queue if self.queue.path[0:1] == b'/': queue = self.queue else: if self.queue.path[0:1] == b'~': output = self.check_output('echo %s'...
403
30
1,954
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
544169696dadd9a65ee444a4e4f35ab3c1c418d9190f497a23ded63878fdc533
BSD-3-Clause
permissive
https://github.com/VisTrails/tej/blob/master/LICENSE.txt
34bccf973c004f9eaecef2a0
VisTrails/tej
tej/submission.py
RemoteQueue.submit
https://github.com/VisTrails/tej/blob/b8dedaeb6bdeb650b46cfe6d85e5aa9284fc7f0b/tej/submission.py#L464-L516
train
python
Submits a job to the queue. If the runtime is not there, it will be installed. If it is a broken chain of links, error.
def submit(self, job_id, directory, script=None): """Submits a job to the queue. If the runtime is not there, it will be installed. If it is a broken chain of links, error. """ if job_id is None: job_id = '%s_%s_%s' % (Path(directory).unicodename, ...
Submits a job to the queue. If the runtime is not there, it will be installed. If it is a broken chain of links, error. def submit(self, job_id, directory, script=None): """Submits a job to the queue. If the runtime is not there, it will be installed. If it is a broken chain o...
382
136
1,803
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
83de484dba59cc26c749bdf712541609c9e8c9e237f12285d224425585814310
BSD-3-Clause
permissive
https://github.com/VisTrails/tej/blob/master/LICENSE.txt
f4fa0334662538f965fc3aa7
VisTrails/tej
tej/submission.py
RemoteQueue.status
https://github.com/VisTrails/tej/blob/b8dedaeb6bdeb650b46cfe6d85e5aa9284fc7f0b/tej/submission.py#L518-L542
train
python
Gets the status of a previously-submitted job.
def status(self, job_id): """Gets the status of a previously-submitted job. """ check_jobid(job_id) queue = self._get_queue() if queue is None: raise QueueDoesntExist ret, output = self._call('%s %s' % ( shell_escape(queue / ...
Gets the status of a previously-submitted job. def status(self, job_id): """Gets the status of a previously-submitted job. """ check_jobid(job_id) queue = self._get_queue() if queue is None: raise QueueDoesntExist ret, output = self._call('%s %s' % ( ...
192
46
929
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
ae1eca5d7ad886bb527c66074da279591807c833d0657b398e71d4e6b3b1bcbc
BSD-3-Clause
permissive
https://github.com/VisTrails/tej/blob/master/LICENSE.txt
d4e0392319a3081a0af2c978
VisTrails/tej
tej/submission.py
RemoteQueue.download
https://github.com/VisTrails/tej/blob/b8dedaeb6bdeb650b46cfe6d85e5aa9284fc7f0b/tej/submission.py#L544-L582
train
python
Downloads files from server.
def download(self, job_id, files, **kwargs): """Downloads files from server. """ check_jobid(job_id) if not files: return if isinstance(files, string_types): files = [files] directory = False recursive = kwargs.pop('recursive', True) ...
Downloads files from server. def download(self, job_id, files, **kwargs): """Downloads files from server. """ check_jobid(job_id) if not files: return if isinstance(files, string_types): files = [files] directory = False recursive = kwarg...
276
28
1,531
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
cd41b8cb896e0d30ea9e393308d64bb28312f0e9b85b8b8e084e8d734fb8a7b4
BSD-3-Clause
permissive
https://github.com/VisTrails/tej/blob/master/LICENSE.txt
27ef3cc6f163313f347746e6
VisTrails/tej
tej/submission.py
RemoteQueue.kill
https://github.com/VisTrails/tej/blob/b8dedaeb6bdeb650b46cfe6d85e5aa9284fc7f0b/tej/submission.py#L584-L601
train
python
Kills a job on the server.
def kill(self, job_id): """Kills a job on the server. """ check_jobid(job_id) queue = self._get_queue() if queue is None: raise QueueDoesntExist ret, output = self._call('%s %s' % ( shell_escape(queue / 'commands/kill'), ...
Kills a job on the server. def kill(self, job_id): """Kills a job on the server. """ check_jobid(job_id) queue = self._get_queue() if queue is None: raise QueueDoesntExist ret, output = self._call('%s %s' % ( shell_escape(qu...
122
26
583
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
a7f093b97c01d6400edbb265e8d48bec74281ce19906f333a159242cd3e53dc7
BSD-3-Clause
permissive
https://github.com/VisTrails/tej/blob/master/LICENSE.txt
1a686da0bae5c23a2407fd2e
VisTrails/tej
tej/submission.py
RemoteQueue.list
https://github.com/VisTrails/tej/blob/b8dedaeb6bdeb650b46cfe6d85e5aa9284fc7f0b/tej/submission.py#L624-L646
train
python
Lists the jobs on the server.
def list(self): """Lists the jobs on the server. """ queue = self._get_queue() if queue is None: raise QueueDoesntExist output = self.check_output('%s' % shell_escape(queue / 'commands/list')) job_id, info = None, None ...
Lists the jobs on the server. def list(self): """Lists the jobs on the server. """ queue = self._get_queue() if queue is None: raise QueueDoesntExist output = self.check_output('%s' % shell_escape(queue / 'commands/list')) ...
162
29
737
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
ab50e01406a5e41791f1a277f3c5ec294bf29cf7e571aa6cecd99b6597f64a81
BSD-3-Clause
permissive
https://github.com/VisTrails/tej/blob/master/LICENSE.txt
88f53d01e9dfada7f1a43ca8
GaretJax/lancet
lancet/commands/workflow.py
activate
https://github.com/GaretJax/lancet/blob/cf438c5c6166b18ee0dc5ffce55220793019bb95/lancet/commands/workflow.py#L24-L56
train
python
Switch to this project.
def activate(lancet, method, project): """Switch to this project.""" with taskstatus("Looking up project") as ts: if method == "key": func = get_project_keys elif method == "dir": func = get_project_keys for key, project_path in func(lancet): if key.l...
Switch to this project. def activate(lancet, method, project): """Switch to this project.""" with taskstatus("Looking up project") as ts: if method == "key": func = get_project_keys elif method == "dir": func = get_project_keys for key, project_path in func(lanc...
256
23
1,109
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
5fba49b2799a9bfc83af82b902429b38537ef1a9d7248072358cf657f7c7624a
MIT
permissive
https://github.com/GaretJax/lancet/blob/master/LICENSE
ea11578c6ac9107f09dee08e
GaretJax/lancet
lancet/commands/workflow.py
workon
https://github.com/GaretJax/lancet/blob/cf438c5c6166b18ee0dc5ffce55220793019bb95/lancet/commands/workflow.py#L78-L135
train
python
Start work on a given issue. This command retrieves the issue from the issue tracker, creates and checks out a new aptly-named branch, puts the issue in the configured active, status, assigns it to you and starts a correctly linked Harvest timer. If a branch with the same name as the one to be created...
def workon(ctx, issue_id, new, base_branch): """ Start work on a given issue. This command retrieves the issue from the issue tracker, creates and checks out a new aptly-named branch, puts the issue in the configured active, status, assigns it to you and starts a correctly linked Harvest timer. ...
Start work on a given issue. This command retrieves the issue from the issue tracker, creates and checks out a new aptly-named branch, puts the issue in the configured active, status, assigns it to you and starts a correctly linked Harvest timer. If a branch with the same name as the one to be created...
633
658
2,145
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
aae5208f2c375a138de88dc1cf31c3315fd3b6fb810dca3dbc26ca47a02cf633
MIT
permissive
https://github.com/GaretJax/lancet/blob/master/LICENSE
45aec0e1e10cae92c9d523fb
GaretJax/lancet
lancet/commands/workflow.py
time
https://github.com/GaretJax/lancet/blob/cf438c5c6166b18ee0dc5ffce55220793019bb95/lancet/commands/workflow.py#L141-L153
train
python
Start an Harvest timer for the given issue. This command takes care of linking the timer with the issue tracker page for the given issue. If the issue is not passed to command it's taken from currently active branch.
def time(lancet, issue): """ Start an Harvest timer for the given issue. This command takes care of linking the timer with the issue tracker page for the given issue. If the issue is not passed to command it's taken from currently active branch. """ issue = get_issue(lancet, issue) wit...
Start an Harvest timer for the given issue. This command takes care of linking the timer with the issue tracker page for the given issue. If the issue is not passed to command it's taken from currently active branch. def time(lancet, issue): """ Start an Harvest timer for the given issue. Thi...
147
229
438
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
9e2f828eac54c54d19ac808e94f229f815b1c5711f87668f206bffecde486b07
MIT
permissive
https://github.com/GaretJax/lancet/blob/master/LICENSE
d8447529cd65287a90731343
GaretJax/lancet
lancet/commands/workflow.py
pause
https://github.com/GaretJax/lancet/blob/cf438c5c6166b18ee0dc5ffce55220793019bb95/lancet/commands/workflow.py#L158-L179
train
python
Pause work on the current issue. This command puts the issue in the configured paused status and stops the current Harvest timer.
def pause(ctx): """ Pause work on the current issue. This command puts the issue in the configured paused status and stops the current Harvest timer. """ lancet = ctx.obj paused_status = lancet.config.get("tracker", "paused_status") # Get the issue issue = get_issue(lancet) # ...
Pause work on the current issue. This command puts the issue in the configured paused status and stops the current Harvest timer. def pause(ctx): """ Pause work on the current issue. This command puts the issue in the configured paused status and stops the current Harvest timer. """ l...
175
138
640
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
17a4a60cefa8b025acc5d1055c2b725de934a28ef5d06b8753a1643c551f2cec
MIT
permissive
https://github.com/GaretJax/lancet/blob/master/LICENSE
271f75ba204df467e2e5c789
GaretJax/lancet
lancet/commands/workflow.py
resume
https://github.com/GaretJax/lancet/blob/cf438c5c6166b18ee0dc5ffce55220793019bb95/lancet/commands/workflow.py#L184-L209
train
python
Resume work on the currently active issue. The issue is retrieved from the currently active branch name.
def resume(ctx): """ Resume work on the currently active issue. The issue is retrieved from the currently active branch name. """ lancet = ctx.obj username = lancet.tracker.whoami() active_status = lancet.config.get("tracker", "active_status") # Get the issue issue = get_issue(lan...
Resume work on the currently active issue. The issue is retrieved from the currently active branch name. def resume(ctx): """ Resume work on the currently active issue. The issue is retrieved from the currently active branch name. """ lancet = ctx.obj username = lancet.tracker.whoami() ...
198
109
761
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
7daae80e9e837f9850d33740485ce67ed9147bec7739a14f044541d1d3d5e1a4
MIT
permissive
https://github.com/GaretJax/lancet/blob/master/LICENSE
1b3fd2b7d602e1c7ff2e3042
GaretJax/lancet
lancet/contrib/dploi.py
ssh
https://github.com/GaretJax/lancet/blob/cf438c5c6166b18ee0dc5ffce55220793019bb95/lancet/contrib/dploi.py#L11-L28
train
python
SSH into the given environment, based on the dploi configuration.
def ssh(lancet, print_cmd, environment): """ SSH into the given environment, based on the dploi configuration. """ namespace = {} with open(lancet.config.get('dploi', 'deployment_spec')) as fh: code = compile(fh.read(), 'deployment.py', 'exec') exec(code, {}, namespace) config ...
SSH into the given environment, based on the dploi configuration. def ssh(lancet, print_cmd, environment): """ SSH into the given environment, based on the dploi configuration. """ namespace = {} with open(lancet.config.get('dploi', 'deployment_spec')) as fh: code = compile(fh.read(), 'dep...
164
65
594
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
5f2fa0355f082a655120b61e3dc95c6cbde29674ad103fc0e9fb66af2f39938d
MIT
permissive
https://github.com/GaretJax/lancet/blob/master/LICENSE
b392e6ceb159c6d3493cba7c
GaretJax/lancet
lancet/cli.py
_setup_helper
https://github.com/GaretJax/lancet/blob/cf438c5c6166b18ee0dc5ffce55220793019bb95/lancet/cli.py#L273-L278
train
python
Print the shell integration code.
def _setup_helper(): """Print the shell integration code.""" base = os.path.abspath(os.path.dirname(__file__)) helper = os.path.join(base, "helper.sh") with open(helper) as fh: click.echo(fh.read())
Print the shell integration code. def _setup_helper(): """Print the shell integration code.""" base = os.path.abspath(os.path.dirname(__file__)) helper = os.path.join(base, "helper.sh") with open(helper) as fh: click.echo(fh.read())
57
33
222
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
157c2af5dfd50f13543617dc04a14d51f49690ea1ce4d03364cf2b96ef44e202
MIT
permissive
https://github.com/GaretJax/lancet/blob/master/LICENSE
e721c487a6a9a3a0046e29da
GaretJax/lancet
lancet/cli.py
_commands
https://github.com/GaretJax/lancet/blob/cf438c5c6166b18ee0dc5ffce55220793019bb95/lancet/cli.py#L283-L294
train
python
Prints a list of commands for shell completion hooks.
def _commands(ctx): """Prints a list of commands for shell completion hooks.""" ctx = ctx.parent ctx.show_hidden_subcommands = False main = ctx.command for subcommand in main.list_commands(ctx): cmd = main.get_command(ctx, subcommand) if cmd is None: continue hel...
Prints a list of commands for shell completion hooks. def _commands(ctx): """Prints a list of commands for shell completion hooks.""" ctx = ctx.parent ctx.show_hidden_subcommands = False main = ctx.command for subcommand in main.list_commands(ctx): cmd = main.get_command(ctx, subcommand) ...
100
53
397
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
37d7ea0d2d47b5be4b6fd2953374ec1f6a7eac9f259116c10f97e66398d8be66
MIT
permissive
https://github.com/GaretJax/lancet/blob/master/LICENSE
0cb82b5114119ca47a91e047
GaretJax/lancet
lancet/cli.py
_arguments
https://github.com/GaretJax/lancet/blob/cf438c5c6166b18ee0dc5ffce55220793019bb95/lancet/cli.py#L300-L338
train
python
Prints a list of arguments for shell completion hooks. If a command name is given, returns the arguments for that subcommand. The command name has to refer to a command; aliases are not supported.
def _arguments(ctx, command_name=None): """Prints a list of arguments for shell completion hooks. If a command name is given, returns the arguments for that subcommand. The command name has to refer to a command; aliases are not supported. """ ctx = ctx.parent main = ctx.command if command_...
Prints a list of arguments for shell completion hooks. If a command name is given, returns the arguments for that subcommand. The command name has to refer to a command; aliases are not supported. def _arguments(ctx, command_name=None): """Prints a list of arguments for shell completion hooks. If a c...
323
205
1,302
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
5a20cd7d94024e3a5e7a01ec0a9004ee7d59ec5fc157562ca59ef1fc12cba49f
MIT
permissive
https://github.com/GaretJax/lancet/blob/master/LICENSE
b3bead9b70b3587dd7add8b8
GaretJax/lancet
lancet/cli.py
_autocomplete
https://github.com/GaretJax/lancet/blob/cf438c5c6166b18ee0dc5ffce55220793019bb95/lancet/cli.py#L344-L369
train
python
Print the shell autocompletion code.
def _autocomplete(ctx, shell): """Print the shell autocompletion code.""" if not shell: shell = os.environ.get("SHELL", "") shell = os.path.basename(shell).lower() if not shell: click.secho( "Your shell could not be detected, please pass its name " "as the arg...
Print the shell autocompletion code. def _autocomplete(ctx, shell): """Print the shell autocompletion code.""" if not shell: shell = os.environ.get("SHELL", "") shell = os.path.basename(shell).lower() if not shell: click.secho( "Your shell could not be detected, please p...
184
36
788
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
8b632d8b4112e7e6b039104f9da722d13abdeec35944aa30928cee36e346d1d6
MIT
permissive
https://github.com/GaretJax/lancet/blob/master/LICENSE
9bebf357d56fc7ff70944aff
OCHA-DAP/hdx-python-utilities
src/hdx/utilities/__init__.py
raisefrom
https://github.com/OCHA-DAP/hdx-python-utilities/blob/9c89e0aa5afac2c002b02a2d8f0e5b91eeb3d2a3/src/hdx/utilities/__init__.py#L7-L23
train
python
Call Python 3 raise from or emulate it for Python 2 Args: exc_type (Any): Type of Exception message (str): Error message to display exc (BaseException): original exception Returns: None
def raisefrom(exc_type, message, exc): # type: (Any, str, BaseException) -> None """Call Python 3 raise from or emulate it for Python 2 Args: exc_type (Any): Type of Exception message (str): Error message to display exc (BaseException): original exception Returns: None ...
Call Python 3 raise from or emulate it for Python 2 Args: exc_type (Any): Type of Exception message (str): Error message to display exc (BaseException): original exception Returns: None def raisefrom(exc_type, message, exc): # type: (Any, str, BaseException) -> None ""...
188
227
501
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
0ffb8c760c85ad9a980573e378c60d09fd97b14a0aeaa40503595a6609865a48
MIT
permissive
https://github.com/OCHA-DAP/hdx-python-utilities/blob/main/LICENSE
74f135284c09b1f08d6fcce4
RockFeng0/rtsf
rtsf/p_executer.py
Runner.init_runner
https://github.com/RockFeng0/rtsf/blob/fbc0d57edaeca86418af3942472fcc6d3e9ce591/rtsf/p_executer.py#L227-L243
train
python
initial some instances for preparing to run test case @note: should not override @param parser: instance of TestCaseParser @param tracers: dict type for the instance of Tracer. Such as {"":tracer_obj} or {"192.168.0.1:5555":tracer_obj1, "192.168.0.2:5555":tracer_obj2} @param proj_i...
def init_runner(self, parser, tracers, projinfo): ''' initial some instances for preparing to run test case @note: should not override @param parser: instance of TestCaseParser @param tracers: dict type for the instance of Tracer. Such as {"":tracer_obj} or {"192.168.0.1:5555":trace...
initial some instances for preparing to run test case @note: should not override @param parser: instance of TestCaseParser @param tracers: dict type for the instance of Tracer. Such as {"":tracer_obj} or {"192.168.0.1:5555":tracer_obj1, "192.168.0.2:5555":tracer_obj2} @param proj_i...
346
621
824
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
54f1d8cb014b77ee344563b76d923f69784f92eb242809583490d4dddff1fc6e
MIT
permissive
https://github.com/RockFeng0/rtsf/blob/master/LICENSE
c78887e1b77658ccce1fd86b
RockFeng0/rtsf
rtsf/p_executer.py
Runner._run_grid_multiprocess
https://github.com/RockFeng0/rtsf/blob/fbc0d57edaeca86418af3942472fcc6d3e9ce591/rtsf/p_executer.py#L282-L294
train
python
running case with mutil process to support selenium grid-mode(multiple web) and appium grid-mode(multiple devices). @param func: function object @param iterables: iterable objects
def _run_grid_multiprocess(self, func, iterables): ''' running case with mutil process to support selenium grid-mode(multiple web) and appium grid-mode(multiple devices). @param func: function object @param iterables: iterable objects ''' multiprocessing.freeze_support() ...
running case with mutil process to support selenium grid-mode(multiple web) and appium grid-mode(multiple devices). @param func: function object @param iterables: iterable objects def _run_grid_multiprocess(self, func, iterables): ''' running case with mutil process to support selenium gr...
192
200
611
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
19219e4c9c5e3beb8f4f1a6d9f1c8bcf307215fa6dba55add92d09d59a66c892
MIT
permissive
https://github.com/RockFeng0/rtsf/blob/master/LICENSE
76e76fa8f4a4254485853149
RockFeng0/rtsf
rtsf/p_executer.py
Runner._run_grid_multithread
https://github.com/RockFeng0/rtsf/blob/fbc0d57edaeca86418af3942472fcc6d3e9ce591/rtsf/p_executer.py#L296-L307
train
python
running case with mutil process to support selenium grid-mode(multiple web) and appium grid-mode(multiple devices). @param func: function object @param iterables: iterable objects
def _run_grid_multithread(self, func, iterables): ''' running case with mutil process to support selenium grid-mode(multiple web) and appium grid-mode(multiple devices). @param func: function object @param iterables: iterable objects ''' f = lambda x: threading....
running case with mutil process to support selenium grid-mode(multiple web) and appium grid-mode(multiple devices). @param func: function object @param iterables: iterable objects def _run_grid_multithread(self, func, iterables): ''' running case with mutil process to support selenium gri...
151
200
513
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
1d9ef2f05f6c019c91674050c7c05ed6c550424a5a5dcb97354c3d760001583e
MIT
permissive
https://github.com/RockFeng0/rtsf/blob/master/LICENSE
2147c6cfcd2dbe8eb6631e52
RockFeng0/rtsf
rtsf/p_common.py
init_project_env
https://github.com/RockFeng0/rtsf/blob/fbc0d57edaeca86418af3942472fcc6d3e9ce591/rtsf/p_common.py#L76-L111
train
python
Set the environment for pyrunner
def init_project_env(subject='Automation', proj_path = None, sysencoding = "utf-8", debug = False): ''' Set the environment for pyrunner ''' # if sysencoding: # set_sys_encode(sysencoding) if not proj_path: try: executable_file_path = os.path.dirname(os....
Set the environment for pyrunner def init_project_env(subject='Automation', proj_path = None, sysencoding = "utf-8", debug = False): ''' Set the environment for pyrunner ''' # if sysencoding: # set_sys_encode(sysencoding) if not proj_path: try: executab...
335
32
1,446
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
c6d272b4312f9745ab952c8067ff01bd308f866b9edd47d3d8434d3937c34b0e
MIT
permissive
https://github.com/RockFeng0/rtsf/blob/master/LICENSE
e879e821ee963045214b9030
RockFeng0/rtsf
rtsf/p_common.py
seqfy
https://github.com/RockFeng0/rtsf/blob/fbc0d57edaeca86418af3942472fcc6d3e9ce591/rtsf/p_common.py#L786-L807
train
python
序列化 字符串--->实际效果是,为字符串,添加行号,返回字符串 Sampe usage: strs = ["", None, u"First-line\nSecond-line\nThird-line", u"没有换行符"] for s in strs: print "---" result = seqfy(s) print result print unseqfy(result)
def seqfy(strs): ''' 序列化 字符串--->实际效果是,为字符串,添加行号,返回字符串 Sampe usage: strs = ["", None, u"First-line\nSecond-line\nThird-line", u"没有换行符"] for s in strs: print "---" result = seqfy(s) print result print unseqfy(result) ''' if no...
序列化 字符串--->实际效果是,为字符串,添加行号,返回字符串 Sampe usage: strs = ["", None, u"First-line\nSecond-line\nThird-line", u"没有换行符"] for s in strs: print "---" result = seqfy(s) print result print unseqfy(result) def seqfy(strs): ''' 序列化 字符串--->实际效果是,为字符串,添加...
242
268
561
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
29a5115aeca1692c2b33325c94ab2eb8c418eabaedbf751a106a95cca3abb9db
MIT
permissive
https://github.com/RockFeng0/rtsf/blob/master/LICENSE
0abba6064fabe35d14a026ab
RockFeng0/rtsf
rtsf/p_common.py
stepfy
https://github.com/RockFeng0/rtsf/blob/fbc0d57edaeca86418af3942472fcc6d3e9ce591/rtsf/p_common.py#L830-L865
train
python
步骤化 字符串 --->实际效果是, 依据 序列化的字符串,转换为 Step_%s_info 的字典, 返回字典 Sample usage: test_strs = [ "", None, u"First-line\nSecond-line\nThird-line", u'1.First-line\n2.Second-line\n3.Third-line\n', u'3.没有换行符', u'3.有换行符\n', "asdfasdfsdf", "1.asdf...
def stepfy(strs): ''' 步骤化 字符串 --->实际效果是, 依据 序列化的字符串,转换为 Step_%s_info 的字典, 返回字典 Sample usage: test_strs = [ "", None, u"First-line\nSecond-line\nThird-line", u'1.First-line\n2.Second-line\n3.Third-line\n', u'3.没有换行符', u'3.有换行符\n', "asdfasd...
步骤化 字符串 --->实际效果是, 依据 序列化的字符串,转换为 Step_%s_info 的字典, 返回字典 Sample usage: test_strs = [ "", None, u"First-line\nSecond-line\nThird-line", u'1.First-line\n2.Second-line\n3.Third-line\n', u'3.没有换行符', u'3.有换行符\n', "asdfasdfsdf", "1.asdf...
605
671
1,050
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
7ff08fc3496e2071faa87789ed72b634b7fa838299cf45cbd1802aa2593cd1ae
MIT
permissive
https://github.com/RockFeng0/rtsf/blob/master/LICENSE
e9469fce2ec5111c02c246ed
RockFeng0/rtsf
rtsf/p_common.py
map_function
https://github.com/RockFeng0/rtsf/blob/fbc0d57edaeca86418af3942472fcc6d3e9ce591/rtsf/p_common.py#L886-L912
train
python
Sample usage: print map_function('set',alias_func = "ini_items");# -> ini_items print map_function('set',fw_action_addtion="action_steps_",bw_action_addtion="_for_upd",alias_func = "ini_items"); # -> action_steps_ini_items_for_upd print map_function('set(a=1,b=2,c=Test())',"action_steps_","_f...
def map_function(func_str, fw_action_addtion=None,bw_action_addtion=None, alias_func=None): ''' Sample usage: print map_function('set',alias_func = "ini_items");# -> ini_items print map_function('set',fw_action_addtion="action_steps_",bw_action_addtion="_for_upd",alias_func = "ini_items"); # -> a...
Sample usage: print map_function('set',alias_func = "ini_items");# -> ini_items print map_function('set',fw_action_addtion="action_steps_",bw_action_addtion="_for_upd",alias_func = "ini_items"); # -> action_steps_ini_items_for_upd print map_function('set(a=1,b=2,c=Test())',"action_steps_","_f...
454
540
1,247
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
65e8d0c85d22e6489b2434d79d789ed3e95373e34f85ce6118402a661944a65f
MIT
permissive
https://github.com/RockFeng0/rtsf/blob/master/LICENSE
f378fa4245078936140e7e30
RockFeng0/rtsf
rtsf/p_common.py
IntelligentWaitUtils.until_cmd
https://github.com/RockFeng0/rtsf/blob/fbc0d57edaeca86418af3942472fcc6d3e9ce591/rtsf/p_common.py#L118-L151
train
python
执行系统命令,并等待执行完 @param listcmd: 执行的命令,列表格式 @param end_expects: 命令执行结束,在输出的最后一行,正则搜素期望值,并设置 结果标志 @param save2logfile: 设置执行过程,保存的日志 @param coding: 设置输出编码
def until_cmd(listcmd, end_expects=None, save2logfile=None, coding = encoding): ''' 执行系统命令,并等待执行完 @param listcmd: 执行的命令,列表格式 @param end_expects: 命令执行结束,在输出的最后一行,正则搜素期望值,并设置 结果标志 @param save2logfile: 设置执行过程,保存的日志 @param coding: 设置输出编码 ''' ...
执行系统命令,并等待执行完 @param listcmd: 执行的命令,列表格式 @param end_expects: 命令执行结束,在输出的最后一行,正则搜素期望值,并设置 结果标志 @param save2logfile: 设置执行过程,保存的日志 @param coding: 设置输出编码 def until_cmd(listcmd, end_expects=None, save2logfile=None, coding = encoding): ''' 执行系统命令,并等待执行完 ...
407
202
1,331
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
5860a787ee10e72ace805524db172cbde0c033c150614db97ad7bb396ab2bc0c
MIT
permissive
https://github.com/RockFeng0/rtsf/blob/master/LICENSE
4f5223a083fe311a3a0cc8bc
RockFeng0/rtsf
rtsf/p_common.py
IntelligentWaitUtils.until
https://github.com/RockFeng0/rtsf/blob/fbc0d57edaeca86418af3942472fcc6d3e9ce591/rtsf/p_common.py#L154-L167
train
python
Calls the method until the return value is not False.
def until(method, timeout = 30, message=''): """Calls the method until the return value is not False.""" end_time = time.time() + timeout while True: try: value = method() if value: return value except: ...
Calls the method until the return value is not False. def until(method, timeout = 30, message=''): """Calls the method until the return value is not False.""" end_time = time.time() + timeout while True: try: value = method() if value: ...
96
53
468
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
b536a4ab4cc0530141c2c3560b2aff3adcb16d243fe4d1bbda7fe180bc2a1873
MIT
permissive
https://github.com/RockFeng0/rtsf/blob/master/LICENSE
f295dd3b56c75e457067ebc0
RockFeng0/rtsf
rtsf/p_common.py
FileUtils._check_format
https://github.com/RockFeng0/rtsf/blob/fbc0d57edaeca86418af3942472fcc6d3e9ce591/rtsf/p_common.py#L222-L233
train
python
check testcase format if valid
def _check_format(file_path, content): """ check testcase format if valid """ if not content: # testcase file content is empty err_msg = u"Testcase file content is empty: {}".format(file_path) raise p_exception.FileFormatError(err_msg) elif no...
check testcase format if valid def _check_format(file_path, content): """ check testcase format if valid """ if not content: # testcase file content is empty err_msg = u"Testcase file content is empty: {}".format(file_path) raise p_exception.FileFormatE...
116
30
565
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
6ec653045be3239351b1f6d684421fd0119cb4ef620f5a229ce27ddc9d55a437
MIT
permissive
https://github.com/RockFeng0/rtsf/blob/master/LICENSE
3a8a7ccab3a7e216d2466092
RockFeng0/rtsf
rtsf/p_common.py
FileUtils._load_yaml_file
https://github.com/RockFeng0/rtsf/blob/fbc0d57edaeca86418af3942472fcc6d3e9ce591/rtsf/p_common.py#L236-L242
train
python
load yaml file and check file content format
def _load_yaml_file(yaml_file): """ load yaml file and check file content format """ with io.open(yaml_file, 'r', encoding='utf-8') as stream: yaml_content = yaml.load(stream) FileUtils._check_format(yaml_file, yaml_content) return yaml_content
load yaml file and check file content format def _load_yaml_file(yaml_file): """ load yaml file and check file content format """ with io.open(yaml_file, 'r', encoding='utf-8') as stream: yaml_content = yaml.load(stream) FileUtils._check_format(yaml_file, yaml_conte...
75
44
310
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
fac6f89eb636d4a2fed480cfc9767c4bc5e644afc9c6da6fc132abcf5b02484d
MIT
permissive
https://github.com/RockFeng0/rtsf/blob/master/LICENSE
b4ee056c03a0635ac93c5c89
RockFeng0/rtsf
rtsf/p_common.py
FileUtils._load_json_file
https://github.com/RockFeng0/rtsf/blob/fbc0d57edaeca86418af3942472fcc6d3e9ce591/rtsf/p_common.py#L245-L256
train
python
load json file and check file content format
def _load_json_file(json_file): """ load json file and check file content format """ with io.open(json_file, encoding='utf-8') as data_file: try: json_content = json.load(data_file) except p_exception.JSONDecodeError: err_msg = u"JSO...
load json file and check file content format def _load_json_file(json_file): """ load json file and check file content format """ with io.open(json_file, encoding='utf-8') as data_file: try: json_content = json.load(data_file) except p_exception.JSO...
112
44
536
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
abb275863ac02f6f7fa416d451c6c0161e184cf130c5a5ec298b3b6e1bd5f326
MIT
permissive
https://github.com/RockFeng0/rtsf/blob/master/LICENSE
b4c89a449c954d3822e5525b
RockFeng0/rtsf
rtsf/p_common.py
FileUtils._load_csv_file
https://github.com/RockFeng0/rtsf/blob/fbc0d57edaeca86418af3942472fcc6d3e9ce591/rtsf/p_common.py#L259-L284
train
python
load csv file and check file content format @param csv_file: csv file path e.g. csv file content: username,password test1,111111 test2,222222 test3,333333 @return list of parameter, each paramete...
def _load_csv_file(csv_file): """ load csv file and check file content format @param csv_file: csv file path e.g. csv file content: username,password test1,111111 test2,222222 test3,333333 @return ...
load csv file and check file content format @param csv_file: csv file path e.g. csv file content: username,password test1,111111 test2,222222 test3,333333 @return list of parameter, each paramete...
309
572
882
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
77f5b01c8e7c72f0dfa944f9f4f78b36865642b4a735e509fc045616d8a133d2
MIT
permissive
https://github.com/RockFeng0/rtsf/blob/master/LICENSE
4a92ffff5d3005856b3ca1f7
RockFeng0/rtsf
rtsf/p_common.py
FileSystemUtils.force_delete_file
https://github.com/RockFeng0/rtsf/blob/fbc0d57edaeca86418af3942472fcc6d3e9ce591/rtsf/p_common.py#L403-L412
train
python
force delete a file
def force_delete_file(file_path): ''' force delete a file ''' if os.path.isfile(file_path): try: os.remove(file_path) return file_path except: return FileSystemUtils.add_unique_postfix(file_path) else: ...
force delete a file def force_delete_file(file_path): ''' force delete a file ''' if os.path.isfile(file_path): try: os.remove(file_path) return file_path except: return FileSystemUtils.add_unique_postfix(file_pat...
63
19
346
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
d3061e2c9a2ea387cf49b90ecdc8a858079a467b059552e4525445e064100608
MIT
permissive
https://github.com/RockFeng0/rtsf/blob/master/LICENSE
4fef2556247d0710bb323ef0
RockFeng0/rtsf
rtsf/p_common.py
ZipUtils.mkzip
https://github.com/RockFeng0/rtsf/blob/fbc0d57edaeca86418af3942472fcc6d3e9ce591/rtsf/p_common.py#L418-L431
train
python
Usage: p = r'D:\auto\env\ttest\ins\build\lib\rock4\softtest\support' mkzip(os.path.join(p, "appiumroot"),os.path.join(p, "appiumroot.zip")) unzip(os.path.join(p, "appiumroot.zip"),os.path.join(p, "appiumroot2"))
def mkzip(source_dir, output_filename): '''Usage: p = r'D:\auto\env\ttest\ins\build\lib\rock4\softtest\support' mkzip(os.path.join(p, "appiumroot"),os.path.join(p, "appiumroot.zip")) unzip(os.path.join(p, "appiumroot.zip"),os.path.join(p, "appiumroot2")) ''' ...
Usage: p = r'D:\auto\env\ttest\ins\build\lib\rock4\softtest\support' mkzip(os.path.join(p, "appiumroot"),os.path.join(p, "appiumroot.zip")) unzip(os.path.join(p, "appiumroot.zip"),os.path.join(p, "appiumroot2")) def mkzip(source_dir, output_filename): '''Usage: ...
263
250
750
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
92e03f74f3eb80c870a2be8262113dd03bce0f3deb364fe626825417b5715b71
MIT
permissive
https://github.com/RockFeng0/rtsf/blob/master/LICENSE
1fa9e54af727fa6e0d9acd79
RockFeng0/rtsf
rtsf/p_common.py
ModuleUtils.get_imported_module_from_file
https://github.com/RockFeng0/rtsf/blob/fbc0d57edaeca86418af3942472fcc6d3e9ce591/rtsf/p_common.py#L498-L508
train
python
import module from python file path and return imported module
def get_imported_module_from_file(file_path): """ import module from python file path and return imported module """ if p_compat.is_py3: imported_module = importlib.machinery.SourceFileLoader('module_name', file_path).load_module() elif p_compat.is_py2: impo...
import module from python file path and return imported module def get_imported_module_from_file(file_path): """ import module from python file path and return imported module """ if p_compat.is_py3: imported_module = importlib.machinery.SourceFileLoader('module_name', file_path...
108
62
494
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
4427fe40d60f502d15101b48d3bd697c0647e9ef01016205eac069f8a08143d4
MIT
permissive
https://github.com/RockFeng0/rtsf/blob/master/LICENSE
86d818f23688da1a25d2efa1
RockFeng0/rtsf
rtsf/p_common.py
ModuleUtils.filter_module
https://github.com/RockFeng0/rtsf/blob/fbc0d57edaeca86418af3942472fcc6d3e9ce591/rtsf/p_common.py#L511-L519
train
python
filter functions or variables from import module @params module: imported module filter_type: "function" or "variable"
def filter_module(module, filter_type): """ filter functions or variables from import module @params module: imported module filter_type: "function" or "variable" """ filter_type = ModuleUtils.is_function if filter_type == "function" else ModuleUtils.is_vari...
filter functions or variables from import module @params module: imported module filter_type: "function" or "variable" def filter_module(module, filter_type): """ filter functions or variables from import module @params module: imported module ...
111
153
443
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
41bbb63a88af8cf565299483f834acd6986c625ebf21be6607d488d0c1616314
MIT
permissive
https://github.com/RockFeng0/rtsf/blob/master/LICENSE
d11447afcc889933b001003e
RockFeng0/rtsf
rtsf/p_common.py
ModuleUtils.search_conf_item
https://github.com/RockFeng0/rtsf/blob/fbc0d57edaeca86418af3942472fcc6d3e9ce591/rtsf/p_common.py#L522-L550
train
python
search expected function or variable recursive upward @param start_path: search start path item_type: "function" or "variable" item_name: function name or variable name e.g. search_conf_item('C:/Users/RockFeng/Desktop/s/preference.py','function','tes...
def search_conf_item(start_path, item_type, item_name): """ search expected function or variable recursive upward @param start_path: search start path item_type: "function" or "variable" item_name: function name or variable name e.g. search_...
search expected function or variable recursive upward @param start_path: search start path item_type: "function" or "variable" item_name: function name or variable name e.g. search_conf_item('C:/Users/RockFeng/Desktop/s/preference.py','function','tes...
333
328
1,369
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
7704e2fa31b2a455ff46247b6274f1837cc5fe7835f220c25bfeed890241f1b8
MIT
permissive
https://github.com/RockFeng0/rtsf/blob/master/LICENSE
c80ee463f22f617dd3e1aa52
RockFeng0/rtsf
rtsf/p_common.py
SetupUtils.find_data_files
https://github.com/RockFeng0/rtsf/blob/fbc0d57edaeca86418af3942472fcc6d3e9ce591/rtsf/p_common.py#L555-L582
train
python
Locates the specified data-files and returns the matches; filesystem tree for setup's data_files in setup.py Usage: data_files = find_data_files(r"C:\Python27\Lib\site-packages\numpy\core","numpy/core",["*.dll","*.pyd"]) data_files = find_data_files(r"d:\auto...
def find_data_files(source,target,patterns,isiter=False): """Locates the specified data-files and returns the matches; filesystem tree for setup's data_files in setup.py Usage: data_files = find_data_files(r"C:\Python27\Lib\site-packages\numpy\core","numpy/core",["*....
Locates the specified data-files and returns the matches; filesystem tree for setup's data_files in setup.py Usage: data_files = find_data_files(r"C:\Python27\Lib\site-packages\numpy\core","numpy/core",["*.dll","*.pyd"]) data_files = find_data_files(r"d:\auto...
512
704
1,738
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
c51972a1c61ab32e1e80abd7c96e80a4bf9e09b5c2e2df24f4e28d32db425087
MIT
permissive
https://github.com/RockFeng0/rtsf/blob/master/LICENSE
c96085b304ee1f11bb2bc3f2
RockFeng0/rtsf
rtsf/p_common.py
CommonUtils.convert_to_order_dict
https://github.com/RockFeng0/rtsf/blob/fbc0d57edaeca86418af3942472fcc6d3e9ce591/rtsf/p_common.py#L626-L643
train
python
convert mapping in list to ordered dict @param (list) map_list [ {"a": 1}, {"b": 2} ] @return (OrderDict) OrderDict({ "a": 1, "b": 2 })
def convert_to_order_dict(map_list): """ convert mapping in list to ordered dict @param (list) map_list [ {"a": 1}, {"b": 2} ] @return (OrderDict) OrderDict({ "a": 1, "b": 2 ...
convert mapping in list to ordered dict @param (list) map_list [ {"a": 1}, {"b": 2} ] @return (OrderDict) OrderDict({ "a": 1, "b": 2 }) def convert_to_order_dict(map_list): ...
162
273
491
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
d75e42f7dd99ae67e1c00ead44f14834c499be52deb406a1c1d6804ae1e0932d
MIT
permissive
https://github.com/RockFeng0/rtsf/blob/master/LICENSE
4a93dbb9934085ea2fa66bc7
RockFeng0/rtsf
rtsf/p_common.py
CommonUtils.get_value_from_cfg
https://github.com/RockFeng0/rtsf/blob/fbc0d57edaeca86418af3942472fcc6d3e9ce591/rtsf/p_common.py#L646-L669
train
python
initial the configuration with file that you specify Sample usage: config = get_value_from_cfg() return: return a dict -->config[section][option] such as config["twsm"]["dut_ip"]
def get_value_from_cfg(cfg_file): ''' initial the configuration with file that you specify Sample usage: config = get_value_from_cfg() return: return a dict -->config[section][option] such as config["twsm"]["dut_ip"] ...
initial the configuration with file that you specify Sample usage: config = get_value_from_cfg() return: return a dict -->config[section][option] such as config["twsm"]["dut_ip"] def get_value_from_cfg(cfg_file): ''' ...
223
271
940
CodeSearchNet permissive-repo filter (dataset-level)
code_search_net
2026-12-05
f662ff87041478eca6a8c42daa0abd279040c6187e26295c1f92ddf591664a65
MIT
permissive
https://github.com/RockFeng0/rtsf/blob/master/LICENSE