Search is not available for this dataset
identifier stringlengths 1 155 | parameters stringlengths 2 6.09k | docstring stringlengths 11 63.4k | docstring_summary stringlengths 0 63.4k | function stringlengths 29 99.8k | function_tokens list | start_point list | end_point list | language stringclasses 1
value | docstring_language stringlengths 2 7 | docstring_language_predictions stringlengths 18 23 | is_langid_reliable stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
declaration_t._get__cmp__data | (self) |
Implementation detail.
|
Implementation detail. | def _get__cmp__data(self):
"""
Implementation detail.
"""
if self._cache.cmp_data is None:
cmp_data = [
declaration_utils.declaration_path(self.parent),
self.name,
self.location]
cmp_data.extend(self._get__cmp__item... | [
"def",
"_get__cmp__data",
"(",
"self",
")",
":",
"if",
"self",
".",
"_cache",
".",
"cmp_data",
"is",
"None",
":",
"cmp_data",
"=",
"[",
"declaration_utils",
".",
"declaration_path",
"(",
"self",
".",
"parent",
")",
",",
"self",
".",
"name",
",",
"self",
... | [
81,
4
] | [
94,
35
] | python | en | ['en', 'error', 'th'] | False |
declaration_t.__eq__ | (self, other) |
This function will return true, if both declarations refers to the same
object.
This function could be implemented in terms of _get__cmp__data, but in
this case it will downgrade performance. self.mangled property is not
compared, because it could be changed from one compilation... |
This function will return true, if both declarations refers to the same
object.
This function could be implemented in terms of _get__cmp__data, but in
this case it will downgrade performance. self.mangled property is not
compared, because it could be changed from one compilation... | def __eq__(self, other):
"""
This function will return true, if both declarations refers to the same
object.
This function could be implemented in terms of _get__cmp__data, but in
this case it will downgrade performance. self.mangled property is not
compared, because it c... | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"self",
".",
"__class__",
")",
":",
"return",
"False",
"return",
"self",
".",
"name",
"==",
"other",
".",
"name",
"and",
"self",
".",
"location",
"=="... | [
96,
4
] | [
112,
63
] | python | en | ['en', 'error', 'th'] | False |
declaration_t.__ne__ | (self, other) |
Return not self.__eq__( other ).
|
Return not self.__eq__( other ). | def __ne__(self, other):
"""
Return not self.__eq__( other ).
"""
return not self.__eq__(other) | [
"def",
"__ne__",
"(",
"self",
",",
"other",
")",
":",
"return",
"not",
"self",
".",
"__eq__",
"(",
"other",
")"
] | [
119,
4
] | [
125,
37
] | python | en | ['en', 'error', 'th'] | False |
declaration_t.__lt__ | (self, other) |
.. code-block:: python
if not isinstance( other, self.__class__ ):
return self.__class__.__name__ < other.__class__.__name__
return self._get__cmp__data() < other._get__cmp__data()
|
.. code-block:: python | def __lt__(self, other):
"""
.. code-block:: python
if not isinstance( other, self.__class__ ):
return self.__class__.__name__ < other.__class__.__name__
return self._get__cmp__data() < other._get__cmp__data()
"""
if not isinstance(other, self.__cl... | [
"def",
"__lt__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"self",
".",
"__class__",
")",
":",
"return",
"self",
".",
"__class__",
".",
"__name__",
"<",
"other",
".",
"__class__",
".",
"__name__",
"return",
"sel... | [
127,
4
] | [
139,
63
] | python | en | ['en', 'error', 'th'] | False |
declaration_t._on_rename | (self) |
Placeholder method, is redefined in child class.
|
Placeholder method, is redefined in child class. | def _on_rename(self):
"""
Placeholder method, is redefined in child class.
"""
pass | [
"def",
"_on_rename",
"(",
"self",
")",
":",
"pass"
] | [
144,
4
] | [
150,
12
] | python | en | ['en', 'error', 'th'] | False |
declaration_t.name | (self) |
Declaration name
@type: str
|
Declaration name
@type: str | def name(self):
"""
Declaration name
@type: str
"""
return self._get_name_impl() | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_get_name_impl",
"(",
")"
] | [
153,
4
] | [
160,
36
] | python | en | ['en', 'error', 'th'] | False |
declaration_t.partial_name | (self) |
Declaration name, without template default arguments.
Right now std containers is the only classes that support this
functionality.
|
Declaration name, without template default arguments. | def partial_name(self):
"""
Declaration name, without template default arguments.
Right now std containers is the only classes that support this
functionality.
"""
if None is self._partial_name:
self._partial_name = self._get_partial_name_impl()
re... | [
"def",
"partial_name",
"(",
"self",
")",
":",
"if",
"None",
"is",
"self",
".",
"_partial_name",
":",
"self",
".",
"_partial_name",
"=",
"self",
".",
"_get_partial_name_impl",
"(",
")",
"return",
"self",
".",
"_partial_name"
] | [
176,
4
] | [
188,
33
] | python | en | ['en', 'error', 'th'] | False |
declaration_t.parent | (self) |
Reference to parent declaration.
@type: declaration_t
|
Reference to parent declaration. | def parent(self):
"""
Reference to parent declaration.
@type: declaration_t
"""
return self._parent | [
"def",
"parent",
"(",
"self",
")",
":",
"return",
"self",
".",
"_parent"
] | [
191,
4
] | [
199,
27
] | python | en | ['en', 'error', 'th'] | False |
declaration_t.top_parent | (self) |
Reference to top parent declaration.
@type: declaration_t
|
Reference to top parent declaration. | def top_parent(self):
"""
Reference to top parent declaration.
@type: declaration_t
"""
parent = self.parent
while parent is not None:
if parent.parent is None:
return parent
else:
parent = parent.parent
... | [
"def",
"top_parent",
"(",
"self",
")",
":",
"parent",
"=",
"self",
".",
"parent",
"while",
"parent",
"is",
"not",
"None",
":",
"if",
"parent",
".",
"parent",
"is",
"None",
":",
"return",
"parent",
"else",
":",
"parent",
"=",
"parent",
".",
"parent",
... | [
209,
4
] | [
222,
19
] | python | en | ['en', 'error', 'th'] | False |
declaration_t.location | (self) |
Location of the declaration within source file
@type: :class:`location_t`
|
Location of the declaration within source file | def location(self):
"""
Location of the declaration within source file
@type: :class:`location_t`
"""
return self._location | [
"def",
"location",
"(",
"self",
")",
":",
"return",
"self",
".",
"_location"
] | [
225,
4
] | [
233,
29
] | python | en | ['en', 'error', 'th'] | False |
declaration_t.is_artificial | (self) |
Describes whether declaration is compiler generated or not
@type: bool
|
Describes whether declaration is compiler generated or not | def is_artificial(self):
"""
Describes whether declaration is compiler generated or not
@type: bool
"""
return self._is_artificial | [
"def",
"is_artificial",
"(",
"self",
")",
":",
"return",
"self",
".",
"_is_artificial"
] | [
240,
4
] | [
248,
34
] | python | en | ['en', 'error', 'th'] | False |
declaration_t.mangled | (self) |
Unique declaration name generated by the compiler.
For GCCXML, you can get the mangled name for all the declarations.
When using CastXML, calling mangled is only allowed on functions
and variables. For other declarations it will raise an exception.
:return: the mangled name
... |
Unique declaration name generated by the compiler. | def mangled(self):
"""
Unique declaration name generated by the compiler.
For GCCXML, you can get the mangled name for all the declarations.
When using CastXML, calling mangled is only allowed on functions
and variables. For other declarations it will raise an exception.
... | [
"def",
"mangled",
"(",
"self",
")",
":",
"return",
"self",
".",
"_mangled"
] | [
258,
4
] | [
271,
28
] | python | en | ['en', 'error', 'th'] | False |
declaration_t.demangled | (self) |
Declaration name, reconstructed from GCCXML generated unique name.
@type: str
|
Declaration name, reconstructed from GCCXML generated unique name. | def demangled(self):
"""
Declaration name, reconstructed from GCCXML generated unique name.
@type: str
"""
return self._demangled | [
"def",
"demangled",
"(",
"self",
")",
":",
"return",
"self",
".",
"_demangled"
] | [
278,
4
] | [
285,
30
] | python | en | ['en', 'error', 'th'] | False |
declaration_t.decorated_name | (self) |
Unique declaration name extracted from a binary file
( .map, .dll, .so, etc ).
@type: str
|
Unique declaration name extracted from a binary file
( .map, .dll, .so, etc ). | def decorated_name(self):
"""
Unique declaration name extracted from a binary file
( .map, .dll, .so, etc ).
@type: str
"""
warnings.warn(
"The decorated_name attribute is deprecated. See the changelog.",
DeprecationWarning)
# Deprecat... | [
"def",
"decorated_name",
"(",
"self",
")",
":",
"warnings",
".",
"warn",
"(",
"\"The decorated_name attribute is deprecated. See the changelog.\"",
",",
"DeprecationWarning",
")",
"# Deprecated since 1.9.0, will be removed in 2.0.0",
"return",
"self",
".",
"_decorated_name"
] | [
292,
4
] | [
304,
35
] | python | en | ['en', 'error', 'th'] | False |
declaration_t.attributes | (self) |
GCCXML attributes, set using __attribute__((gccxml("...")))
@type: str
|
GCCXML attributes, set using __attribute__((gccxml("..."))) | def attributes(self):
"""
GCCXML attributes, set using __attribute__((gccxml("...")))
@type: str
"""
return self._attributes | [
"def",
"attributes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_attributes"
] | [
315,
4
] | [
323,
31
] | python | en | ['en', 'error', 'th'] | False |
declaration_t.decl_string | (self) |
Declaration full name.
|
Declaration full name. | def decl_string(self):
"""
Declaration full name.
"""
return self.create_decl_string() | [
"def",
"decl_string",
"(",
"self",
")",
":",
"return",
"self",
".",
"create_decl_string",
"(",
")"
] | [
333,
4
] | [
339,
40
] | python | en | ['en', 'error', 'th'] | False |
declaration_t.partial_decl_string | (self) |
Declaration full name.
|
Declaration full name. | def partial_decl_string(self):
"""
Declaration full name.
"""
return self.create_decl_string(with_defaults=False) | [
"def",
"partial_decl_string",
"(",
"self",
")",
":",
"return",
"self",
".",
"create_decl_string",
"(",
"with_defaults",
"=",
"False",
")"
] | [
342,
4
] | [
348,
59
] | python | en | ['en', 'error', 'th'] | False |
declaration_t.cache | (self) |
Implementation detail.
Reference to instance of :class:`algorithms_cache_t` class.
|
Implementation detail. | def cache(self):
"""
Implementation detail.
Reference to instance of :class:`algorithms_cache_t` class.
"""
return self._cache | [
"def",
"cache",
"(",
"self",
")",
":",
"return",
"self",
".",
"_cache"
] | [
351,
4
] | [
359,
26
] | python | en | ['en', 'error', 'th'] | False |
declaration_t.i_depend_on_them | (self, recursive=True) |
Return list of all types and declarations the declaration depends on
|
Return list of all types and declarations the declaration depends on | def i_depend_on_them(self, recursive=True):
"""
Return list of all types and declarations the declaration depends on
"""
raise NotImplementedError() | [
"def",
"i_depend_on_them",
"(",
"self",
",",
"recursive",
"=",
"True",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | [
361,
4
] | [
366,
35
] | python | en | ['en', 'error', 'th'] | False |
would_confuse_urlparse | (url: str) | Returns whether an URL-ish string would be interpretted by urlparse()
differently than we want, by parsing it as a non-URL URI ("scheme:path")
instead of as a URL ("[scheme:]//authority[:port]/path"). We don't want to
interpret "myhost:8080" as "ParseResult(scheme='myhost', path='8080')"!
| Returns whether an URL-ish string would be interpretted by urlparse()
differently than we want, by parsing it as a non-URL URI ("scheme:path")
instead of as a URL ("[scheme:]//authority[:port]/path"). We don't want to
interpret "myhost:8080" as "ParseResult(scheme='myhost', path='8080')"! | def would_confuse_urlparse(url: str) -> bool:
"""Returns whether an URL-ish string would be interpretted by urlparse()
differently than we want, by parsing it as a non-URL URI ("scheme:path")
instead of as a URL ("[scheme:]//authority[:port]/path"). We don't want to
interpret "myhost:8080" as "ParseRes... | [
"def",
"would_confuse_urlparse",
"(",
"url",
":",
"str",
")",
"->",
"bool",
":",
"if",
"url",
".",
"find",
"(",
"':'",
")",
">",
"0",
"and",
"url",
".",
"lstrip",
"(",
"scheme_chars",
")",
".",
"startswith",
"(",
"\"://\"",
")",
":",
"# has a scheme",
... | [
14,
0
] | [
27,
15
] | python | en | ['en', 'en', 'en'] | True |
IRBaseMapping.status | (self) |
Return the new status we should have. Subclasses would typically override
this.
:return: new status (may be None)
|
Return the new status we should have. Subclasses would typically override
this. | def status(self) -> Optional[Dict[str, Any]]:
"""
Return the new status we should have. Subclasses would typically override
this.
:return: new status (may be None)
"""
return None | [
"def",
"status",
"(",
"self",
")",
"->",
"Optional",
"[",
"Dict",
"[",
"str",
",",
"Any",
"]",
"]",
":",
"return",
"None"
] | [
204,
4
] | [
211,
19
] | python | en | ['en', 'error', 'th'] | False |
IRBaseMapping._group_id | (self) | Compute the group ID for this Mapping. Must be defined by subclasses. | Compute the group ID for this Mapping. Must be defined by subclasses. | def _group_id(self) -> str:
""" Compute the group ID for this Mapping. Must be defined by subclasses. """
raise NotImplementedError("%s._group_id is not implemented?" % self.__class__.__name__) | [
"def",
"_group_id",
"(",
"self",
")",
"->",
"str",
":",
"raise",
"NotImplementedError",
"(",
"\"%s._group_id is not implemented?\"",
"%",
"self",
".",
"__class__",
".",
"__name__",
")"
] | [
227,
4
] | [
229,
96
] | python | en | ['en', 'en', 'en'] | True |
IRBaseMapping._route_weight | (self) | Compute the route weight for this Mapping. Must be defined by subclasses. | Compute the route weight for this Mapping. Must be defined by subclasses. | def _route_weight(self) -> List[Union[str, int]]:
""" Compute the route weight for this Mapping. Must be defined by subclasses. """
raise NotImplementedError("%s._route_weight is not implemented?" % self.__class__.__name__) | [
"def",
"_route_weight",
"(",
"self",
")",
"->",
"List",
"[",
"Union",
"[",
"str",
",",
"int",
"]",
"]",
":",
"raise",
"NotImplementedError",
"(",
"\"%s._route_weight is not implemented?\"",
"%",
"self",
".",
"__class__",
".",
"__name__",
")"
] | [
231,
4
] | [
233,
100
] | python | en | ['en', 'en', 'en'] | True |
DatasourceAnonymizer.anonymize_simple_sqlalchemy_datasource | (self, name, config) |
SimpleSqlalchemyDatasource requires a separate anonymization scheme.
|
SimpleSqlalchemyDatasource requires a separate anonymization scheme.
| def anonymize_simple_sqlalchemy_datasource(self, name, config):
"""
SimpleSqlalchemyDatasource requires a separate anonymization scheme.
"""
anonymized_info_dict = dict()
anonymized_info_dict["anonymized_name"] = self.anonymize(name)
if config.get("module_name") is None:
... | [
"def",
"anonymize_simple_sqlalchemy_datasource",
"(",
"self",
",",
"name",
",",
"config",
")",
":",
"anonymized_info_dict",
"=",
"dict",
"(",
")",
"anonymized_info_dict",
"[",
"\"anonymized_name\"",
"]",
"=",
"self",
".",
"anonymize",
"(",
"name",
")",
"if",
"co... | [
77,
4
] | [
145,
35
] | python | en | ['en', 'error', 'th'] | False |
parse | (
files,
config=None,
compilation_mode=COMPILATION_MODE.FILE_BY_FILE,
cache=None) |
Parse header files.
:param files: The header files that should be parsed
:type files: list of str
:param config: Configuration object or None
:type config: :class:`parser.xml_generator_configuration_t`
:param compilation_mode: Determines whether the files are parsed
... |
Parse header files. | def parse(
files,
config=None,
compilation_mode=COMPILATION_MODE.FILE_BY_FILE,
cache=None):
"""
Parse header files.
:param files: The header files that should be parsed
:type files: list of str
:param config: Configuration object or None
:type config: :class:`par... | [
"def",
"parse",
"(",
"files",
",",
"config",
"=",
"None",
",",
"compilation_mode",
"=",
"COMPILATION_MODE",
".",
"FILE_BY_FILE",
",",
"cache",
"=",
"None",
")",
":",
"if",
"not",
"config",
":",
"config",
"=",
"xml_generator_configuration_t",
"(",
")",
"parse... | [
28,
0
] | [
52,
23
] | python | en | ['en', 'error', 'th'] | False |
ConfiguredAssetS3DataConnector.__init__ | (
self,
name: str,
datasource_name: str,
bucket: str,
assets: dict,
execution_engine: Optional[ExecutionEngine] = None,
default_regex: Optional[dict] = None,
sorters: Optional[list] = None,
prefix: Optional[str] = "",
delimiter: Optional[st... |
ConfiguredAssetDataConnector for connecting to S3.
Args:
name (str): required name for DataConnector
datasource_name (str): required name for datasource
bucket (str): bucket for S3
assets (dict): dict of asset configuration (required for ConfiguredAssetD... |
ConfiguredAssetDataConnector for connecting to S3. | def __init__(
self,
name: str,
datasource_name: str,
bucket: str,
assets: dict,
execution_engine: Optional[ExecutionEngine] = None,
default_regex: Optional[dict] = None,
sorters: Optional[list] = None,
prefix: Optional[str] = "",
delimiter:... | [
"def",
"__init__",
"(",
"self",
",",
"name",
":",
"str",
",",
"datasource_name",
":",
"str",
",",
"bucket",
":",
"str",
",",
"assets",
":",
"dict",
",",
"execution_engine",
":",
"Optional",
"[",
"ExecutionEngine",
"]",
"=",
"None",
",",
"default_regex",
... | [
37,
4
] | [
93,
13
] | python | en | ['en', 'error', 'th'] | False |
ConfiguredAssetS3DataConnector.build_batch_spec | (self, batch_definition: BatchDefinition) |
Build BatchSpec from batch_definition by calling DataConnector's build_batch_spec function.
Args:
batch_definition (BatchDefinition): to be used to build batch_spec
Returns:
BatchSpec built from batch_definition
|
Build BatchSpec from batch_definition by calling DataConnector's build_batch_spec function. | def build_batch_spec(self, batch_definition: BatchDefinition) -> S3BatchSpec:
"""
Build BatchSpec from batch_definition by calling DataConnector's build_batch_spec function.
Args:
batch_definition (BatchDefinition): to be used to build batch_spec
Returns:
BatchS... | [
"def",
"build_batch_spec",
"(",
"self",
",",
"batch_definition",
":",
"BatchDefinition",
")",
"->",
"S3BatchSpec",
":",
"batch_spec",
":",
"PathBatchSpec",
"=",
"super",
"(",
")",
".",
"build_batch_spec",
"(",
"batch_definition",
"=",
"batch_definition",
")",
"ret... | [
95,
4
] | [
108,
38
] | python | en | ['en', 'error', 'th'] | False |
build_evaluation_parameters | (
expectation_args,
evaluation_parameters=None,
interactive_evaluation=True,
data_context=None,
) | Build a dictionary of parameters to evaluate, using the provided evaluation_parameters,
AND mutate expectation_args by removing any parameter values passed in as temporary values during
exploratory work.
| Build a dictionary of parameters to evaluate, using the provided evaluation_parameters,
AND mutate expectation_args by removing any parameter values passed in as temporary values during
exploratory work.
| def build_evaluation_parameters(
expectation_args,
evaluation_parameters=None,
interactive_evaluation=True,
data_context=None,
):
"""Build a dictionary of parameters to evaluate, using the provided evaluation_parameters,
AND mutate expectation_args by removing any parameter values passed in as t... | [
"def",
"build_evaluation_parameters",
"(",
"expectation_args",
",",
"evaluation_parameters",
"=",
"None",
",",
"interactive_evaluation",
"=",
"True",
",",
"data_context",
"=",
"None",
",",
")",
":",
"evaluation_args",
"=",
"copy",
".",
"deepcopy",
"(",
"expectation_... | [
164,
0
] | [
206,
50
] | python | en | ['en', 'en', 'en'] | True |
find_evaluation_parameter_dependencies | (parameter_expression) | Parse a parameter expression to identify dependencies including GE URNs.
Args:
parameter_expression: the parameter to parse
Returns:
a dictionary including:
- "urns": set of strings that are valid GE URN objects
- "other": set of non-GE URN strings that are required to eval... | Parse a parameter expression to identify dependencies including GE URNs. | def find_evaluation_parameter_dependencies(parameter_expression):
"""Parse a parameter expression to identify dependencies including GE URNs.
Args:
parameter_expression: the parameter to parse
Returns:
a dictionary including:
- "urns": set of strings that are valid GE URN objects... | [
"def",
"find_evaluation_parameter_dependencies",
"(",
"parameter_expression",
")",
":",
"expr",
"=",
"EvaluationParameterParser",
"(",
")",
"dependencies",
"=",
"{",
"\"urns\"",
":",
"set",
"(",
")",
",",
"\"other\"",
":",
"set",
"(",
")",
"}",
"# Calling get_pars... | [
212,
0
] | [
270,
23
] | python | en | ['en', 'en', 'en'] | True |
parse_evaluation_parameter | (
parameter_expression, evaluation_parameters=None, data_context=None
) | Use the provided evaluation_parameters dict to parse a given parameter expression.
Args:
parameter_expression (str): A string, potentially containing basic arithmetic operations and functions,
and variables to be substituted
evaluation_parameters (dict): A dictionary of name-value pairs... | Use the provided evaluation_parameters dict to parse a given parameter expression. | def parse_evaluation_parameter(
parameter_expression, evaluation_parameters=None, data_context=None
):
"""Use the provided evaluation_parameters dict to parse a given parameter expression.
Args:
parameter_expression (str): A string, potentially containing basic arithmetic operations and functions,
... | [
"def",
"parse_evaluation_parameter",
"(",
"parameter_expression",
",",
"evaluation_parameters",
"=",
"None",
",",
"data_context",
"=",
"None",
")",
":",
"if",
"evaluation_parameters",
"is",
"None",
":",
"evaluation_parameters",
"=",
"{",
"}",
"# Calling get_parser clear... | [
273,
0
] | [
357,
17
] | python | en | ['en', 'en', 'en'] | True |
is_generator | (obj) | Return True if ``obj`` is a generator | Return True if ``obj`` is a generator | def is_generator(obj) -> bool:
"""Return True if ``obj`` is a generator"""
return inspect.isgeneratorfunction(obj) or inspect.isgenerator(obj) | [
"def",
"is_generator",
"(",
"obj",
")",
"->",
"bool",
":",
"return",
"inspect",
".",
"isgeneratorfunction",
"(",
"obj",
")",
"or",
"inspect",
".",
"isgenerator",
"(",
"obj",
")"
] | [
44,
0
] | [
46,
71
] | python | en | ['en', 'mt', 'en'] | True |
is_iterable_but_not_string | (obj) | Return True if ``obj`` is an iterable object that isn't a string. | Return True if ``obj`` is an iterable object that isn't a string. | def is_iterable_but_not_string(obj) -> bool:
"""Return True if ``obj`` is an iterable object that isn't a string."""
return (hasattr(obj, "__iter__") and not hasattr(obj, "strip")) or is_generator(obj) | [
"def",
"is_iterable_but_not_string",
"(",
"obj",
")",
"->",
"bool",
":",
"return",
"(",
"hasattr",
"(",
"obj",
",",
"\"__iter__\"",
")",
"and",
"not",
"hasattr",
"(",
"obj",
",",
"\"strip\"",
")",
")",
"or",
"is_generator",
"(",
"obj",
")"
] | [
49,
0
] | [
51,
88
] | python | en | ['en', 'en', 'en'] | True |
is_collection | (obj) | Return True if ``obj`` is a collection type, e.g list, tuple, queryset. | Return True if ``obj`` is a collection type, e.g list, tuple, queryset. | def is_collection(obj) -> bool:
"""Return True if ``obj`` is a collection type, e.g list, tuple, queryset."""
return is_iterable_but_not_string(obj) and not isinstance(obj, Mapping) | [
"def",
"is_collection",
"(",
"obj",
")",
"->",
"bool",
":",
"return",
"is_iterable_but_not_string",
"(",
"obj",
")",
"and",
"not",
"isinstance",
"(",
"obj",
",",
"Mapping",
")"
] | [
54,
0
] | [
56,
75
] | python | en | ['en', 'en', 'en'] | True |
is_instance_or_subclass | (val, class_) | Return True if ``val`` is either a subclass or instance of ``class_``. | Return True if ``val`` is either a subclass or instance of ``class_``. | def is_instance_or_subclass(val, class_) -> bool:
"""Return True if ``val`` is either a subclass or instance of ``class_``."""
try:
return issubclass(val, class_)
except TypeError:
return isinstance(val, class_) | [
"def",
"is_instance_or_subclass",
"(",
"val",
",",
"class_",
")",
"->",
"bool",
":",
"try",
":",
"return",
"issubclass",
"(",
"val",
",",
"class_",
")",
"except",
"TypeError",
":",
"return",
"isinstance",
"(",
"val",
",",
"class_",
")"
] | [
59,
0
] | [
64,
38
] | python | en | ['en', 'en', 'en'] | True |
is_keyed_tuple | (obj) | Return True if ``obj`` has keyed tuple behavior, such as
namedtuples or SQLAlchemy's KeyedTuples.
| Return True if ``obj`` has keyed tuple behavior, such as
namedtuples or SQLAlchemy's KeyedTuples.
| def is_keyed_tuple(obj) -> bool:
"""Return True if ``obj`` has keyed tuple behavior, such as
namedtuples or SQLAlchemy's KeyedTuples.
"""
return isinstance(obj, tuple) and hasattr(obj, "_fields") | [
"def",
"is_keyed_tuple",
"(",
"obj",
")",
"->",
"bool",
":",
"return",
"isinstance",
"(",
"obj",
",",
"tuple",
")",
"and",
"hasattr",
"(",
"obj",
",",
"\"_fields\"",
")"
] | [
67,
0
] | [
71,
61
] | python | en | ['en', 'cy', 'en'] | True |
pprint | (obj, *args, **kwargs) | Pretty-printing function that can pretty-print OrderedDicts
like regular dictionaries. Useful for printing the output of
:meth:`marshmallow.Schema.dump`.
| Pretty-printing function that can pretty-print OrderedDicts
like regular dictionaries. Useful for printing the output of
:meth:`marshmallow.Schema.dump`.
| def pprint(obj, *args, **kwargs) -> None:
"""Pretty-printing function that can pretty-print OrderedDicts
like regular dictionaries. Useful for printing the output of
:meth:`marshmallow.Schema.dump`.
"""
warnings.warn(
"marshmallow's pprint function is deprecated and will be removed in marshm... | [
"def",
"pprint",
"(",
"obj",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"warnings",
".",
"warn",
"(",
"\"marshmallow's pprint function is deprecated and will be removed in marshmallow 4.\"",
",",
"RemovedInMarshmallow4Warning",
",",
")",
"if",
... | [
74,
0
] | [
86,
39
] | python | en | ['en', 'en', 'en'] | True |
from_rfc | (datestring: str) | Parse a RFC822-formatted datetime string and return a datetime object.
https://stackoverflow.com/questions/885015/how-to-parse-a-rfc-2822-date-time-into-a-python-datetime # noqa: B950
| Parse a RFC822-formatted datetime string and return a datetime object. | def from_rfc(datestring: str) -> dt.datetime:
"""Parse a RFC822-formatted datetime string and return a datetime object.
https://stackoverflow.com/questions/885015/how-to-parse-a-rfc-2822-date-time-into-a-python-datetime # noqa: B950
"""
return parsedate_to_datetime(datestring) | [
"def",
"from_rfc",
"(",
"datestring",
":",
"str",
")",
"->",
"dt",
".",
"datetime",
":",
"return",
"parsedate_to_datetime",
"(",
"datestring",
")"
] | [
96,
0
] | [
101,
44
] | python | en | ['en', 'en', 'en'] | True |
rfcformat | (datetime: dt.datetime) | Return the RFC822-formatted representation of a datetime object.
:param datetime datetime: The datetime.
| Return the RFC822-formatted representation of a datetime object. | def rfcformat(datetime: dt.datetime) -> str:
"""Return the RFC822-formatted representation of a datetime object.
:param datetime datetime: The datetime.
"""
return format_datetime(datetime) | [
"def",
"rfcformat",
"(",
"datetime",
":",
"dt",
".",
"datetime",
")",
"->",
"str",
":",
"return",
"format_datetime",
"(",
"datetime",
")"
] | [
104,
0
] | [
109,
36
] | python | en | ['en', 'en', 'en'] | True |
get_fixed_timezone | (offset: typing.Union[int, float, dt.timedelta]) | Return a tzinfo instance with a fixed offset from UTC. | Return a tzinfo instance with a fixed offset from UTC. | def get_fixed_timezone(offset: typing.Union[int, float, dt.timedelta]) -> dt.timezone:
"""Return a tzinfo instance with a fixed offset from UTC."""
if isinstance(offset, dt.timedelta):
offset = offset.total_seconds() // 60
sign = "-" if offset < 0 else "+"
hhmm = "%02d%02d" % divmod(abs(offset),... | [
"def",
"get_fixed_timezone",
"(",
"offset",
":",
"typing",
".",
"Union",
"[",
"int",
",",
"float",
",",
"dt",
".",
"timedelta",
"]",
")",
"->",
"dt",
".",
"timezone",
":",
"if",
"isinstance",
"(",
"offset",
",",
"dt",
".",
"timedelta",
")",
":",
"off... | [
129,
0
] | [
136,
58
] | python | en | ['en', 'en', 'en'] | True |
from_iso_datetime | (value) | Parse a string and return a datetime.datetime.
This function supports time zone offsets. When the input contains one,
the output uses a timezone with a fixed offset from UTC.
| Parse a string and return a datetime.datetime. | def from_iso_datetime(value):
"""Parse a string and return a datetime.datetime.
This function supports time zone offsets. When the input contains one,
the output uses a timezone with a fixed offset from UTC.
"""
match = _iso8601_datetime_re.match(value)
if not match:
raise ValueError("N... | [
"def",
"from_iso_datetime",
"(",
"value",
")",
":",
"match",
"=",
"_iso8601_datetime_re",
".",
"match",
"(",
"value",
")",
"if",
"not",
"match",
":",
"raise",
"ValueError",
"(",
"\"Not a valid ISO8601-formatted datetime string\"",
")",
"kw",
"=",
"match",
".",
"... | [
139,
0
] | [
161,
28
] | python | en | ['en', 'en', 'en'] | True |
from_iso_time | (value) | Parse a string and return a datetime.time.
This function doesn't support time zone offsets.
| Parse a string and return a datetime.time. | def from_iso_time(value):
"""Parse a string and return a datetime.time.
This function doesn't support time zone offsets.
"""
match = _iso8601_time_re.match(value)
if not match:
raise ValueError("Not a valid ISO8601-formatted time string")
kw = match.groupdict()
kw["microsecond"] = k... | [
"def",
"from_iso_time",
"(",
"value",
")",
":",
"match",
"=",
"_iso8601_time_re",
".",
"match",
"(",
"value",
")",
"if",
"not",
"match",
":",
"raise",
"ValueError",
"(",
"\"Not a valid ISO8601-formatted time string\"",
")",
"kw",
"=",
"match",
".",
"groupdict",
... | [
164,
0
] | [
175,
24
] | python | en | ['en', 'en', 'en'] | True |
from_iso_date | (value) | Parse a string and return a datetime.date. | Parse a string and return a datetime.date. | def from_iso_date(value):
"""Parse a string and return a datetime.date."""
match = _iso8601_date_re.match(value)
if not match:
raise ValueError("Not a valid ISO8601-formatted date string")
kw = {k: int(v) for k, v in match.groupdict().items()}
return dt.date(**kw) | [
"def",
"from_iso_date",
"(",
"value",
")",
":",
"match",
"=",
"_iso8601_date_re",
".",
"match",
"(",
"value",
")",
"if",
"not",
"match",
":",
"raise",
"ValueError",
"(",
"\"Not a valid ISO8601-formatted date string\"",
")",
"kw",
"=",
"{",
"k",
":",
"int",
"... | [
178,
0
] | [
184,
24
] | python | en | ['en', 'en', 'en'] | True |
isoformat | (datetime: dt.datetime) | Return the ISO8601-formatted representation of a datetime object.
:param datetime datetime: The datetime.
| Return the ISO8601-formatted representation of a datetime object. | def isoformat(datetime: dt.datetime) -> str:
"""Return the ISO8601-formatted representation of a datetime object.
:param datetime datetime: The datetime.
"""
return datetime.isoformat() | [
"def",
"isoformat",
"(",
"datetime",
":",
"dt",
".",
"datetime",
")",
"->",
"str",
":",
"return",
"datetime",
".",
"isoformat",
"(",
")"
] | [
187,
0
] | [
192,
31
] | python | en | ['en', 'en', 'en'] | True |
pluck | (dictlist: typing.List[typing.Dict[str, typing.Any]], key: str) | Extracts a list of dictionary values from a list of dictionaries.
::
>>> dlist = [{'id': 1, 'name': 'foo'}, {'id': 2, 'name': 'bar'}]
>>> pluck(dlist, 'id')
[1, 2]
| Extracts a list of dictionary values from a list of dictionaries.
:: | def pluck(dictlist: typing.List[typing.Dict[str, typing.Any]], key: str):
"""Extracts a list of dictionary values from a list of dictionaries.
::
>>> dlist = [{'id': 1, 'name': 'foo'}, {'id': 2, 'name': 'bar'}]
>>> pluck(dlist, 'id')
[1, 2]
"""
return [d[key] for d in dictlist] | [
"def",
"pluck",
"(",
"dictlist",
":",
"typing",
".",
"List",
"[",
"typing",
".",
"Dict",
"[",
"str",
",",
"typing",
".",
"Any",
"]",
"]",
",",
"key",
":",
"str",
")",
":",
"return",
"[",
"d",
"[",
"key",
"]",
"for",
"d",
"in",
"dictlist",
"]"
] | [
205,
0
] | [
213,
37
] | python | en | ['en', 'en', 'en'] | True |
get_value | (obj, key: typing.Union[int, str], default=missing) | Helper for pulling a keyed value off various types of objects. Fields use
this method by default to access attributes of the source object. For object `x`
and attribute `i`, this method first tries to access `x[i]`, and then falls back to
`x.i` if an exception is raised.
.. warning::
If an obje... | Helper for pulling a keyed value off various types of objects. Fields use
this method by default to access attributes of the source object. For object `x`
and attribute `i`, this method first tries to access `x[i]`, and then falls back to
`x.i` if an exception is raised. | def get_value(obj, key: typing.Union[int, str], default=missing):
"""Helper for pulling a keyed value off various types of objects. Fields use
this method by default to access attributes of the source object. For object `x`
and attribute `i`, this method first tries to access `x[i]`, and then falls back to
... | [
"def",
"get_value",
"(",
"obj",
",",
"key",
":",
"typing",
".",
"Union",
"[",
"int",
",",
"str",
"]",
",",
"default",
"=",
"missing",
")",
":",
"if",
"not",
"isinstance",
"(",
"key",
",",
"int",
")",
"and",
"\".\"",
"in",
"key",
":",
"return",
"_... | [
219,
0
] | [
233,
52
] | python | en | ['en', 'en', 'en'] | True |
set_value | (dct: typing.Dict[str, typing.Any], key: str, value: typing.Any) | Set a value in a dict. If `key` contains a '.', it is assumed
be a path (i.e. dot-delimited string) to the value's location.
::
>>> d = {}
>>> set_value(d, 'foo.bar', 42)
>>> d
{'foo': {'bar': 42}}
| Set a value in a dict. If `key` contains a '.', it is assumed
be a path (i.e. dot-delimited string) to the value's location. | def set_value(dct: typing.Dict[str, typing.Any], key: str, value: typing.Any):
"""Set a value in a dict. If `key` contains a '.', it is assumed
be a path (i.e. dot-delimited string) to the value's location.
::
>>> d = {}
>>> set_value(d, 'foo.bar', 42)
>>> d
{'foo': {'bar':... | [
"def",
"set_value",
"(",
"dct",
":",
"typing",
".",
"Dict",
"[",
"str",
",",
"typing",
".",
"Any",
"]",
",",
"key",
":",
"str",
",",
"value",
":",
"typing",
".",
"Any",
")",
":",
"if",
"\".\"",
"in",
"key",
":",
"head",
",",
"rest",
"=",
"key",... | [
255,
0
] | [
278,
24
] | python | en | ['en', 'en', 'en'] | True |
callable_or_raise | (obj) | Check that an object is callable, else raise a :exc:`ValueError`. | Check that an object is callable, else raise a :exc:`ValueError`. | def callable_or_raise(obj):
"""Check that an object is callable, else raise a :exc:`ValueError`."""
if not callable(obj):
raise ValueError("Object {!r} is not callable.".format(obj))
return obj | [
"def",
"callable_or_raise",
"(",
"obj",
")",
":",
"if",
"not",
"callable",
"(",
"obj",
")",
":",
"raise",
"ValueError",
"(",
"\"Object {!r} is not callable.\"",
".",
"format",
"(",
"obj",
")",
")",
"return",
"obj"
] | [
281,
0
] | [
285,
14
] | python | en | ['en', 'en', 'en'] | True |
get_func_args | (func: typing.Callable) | Given a callable, return a list of argument names. Handles
`functools.partial` objects and class-based callables.
.. versionchanged:: 3.0.0a1
Do not return bound arguments, eg. ``self``.
| Given a callable, return a list of argument names. Handles
`functools.partial` objects and class-based callables. | def get_func_args(func: typing.Callable) -> typing.List[str]:
"""Given a callable, return a list of argument names. Handles
`functools.partial` objects and class-based callables.
.. versionchanged:: 3.0.0a1
Do not return bound arguments, eg. ``self``.
"""
if inspect.isfunction(func) or insp... | [
"def",
"get_func_args",
"(",
"func",
":",
"typing",
".",
"Callable",
")",
"->",
"typing",
".",
"List",
"[",
"str",
"]",
":",
"if",
"inspect",
".",
"isfunction",
"(",
"func",
")",
"or",
"inspect",
".",
"ismethod",
"(",
"func",
")",
":",
"return",
"_si... | [
292,
0
] | [
304,
27
] | python | en | ['en', 'en', 'en'] | True |
resolve_field_instance | (cls_or_instance) | Return a Schema instance from a Schema class or instance.
:param type|Schema cls_or_instance: Marshmallow Schema class or instance.
| Return a Schema instance from a Schema class or instance. | def resolve_field_instance(cls_or_instance):
"""Return a Schema instance from a Schema class or instance.
:param type|Schema cls_or_instance: Marshmallow Schema class or instance.
"""
if isinstance(cls_or_instance, type):
if not issubclass(cls_or_instance, FieldABC):
raise FieldInst... | [
"def",
"resolve_field_instance",
"(",
"cls_or_instance",
")",
":",
"if",
"isinstance",
"(",
"cls_or_instance",
",",
"type",
")",
":",
"if",
"not",
"issubclass",
"(",
"cls_or_instance",
",",
"FieldABC",
")",
":",
"raise",
"FieldInstanceResolutionError",
"return",
"... | [
307,
0
] | [
319,
30
] | python | en | ['en', 'lb', 'en'] | True |
_merge_meta | (base, child) | Merge the base and the child meta attributes.
List entries, such as ``indexes`` are concatenated.
``abstract`` value is set to ``True`` only if defined as such
in the child class.
Args:
base (dict):
``meta`` attribute from the base class.
child (dict):
``meta`` ... | Merge the base and the child meta attributes. | def _merge_meta(base, child):
"""Merge the base and the child meta attributes.
List entries, such as ``indexes`` are concatenated.
``abstract`` value is set to ``True`` only if defined as such
in the child class.
Args:
base (dict):
``meta`` attribute from the base class.
... | [
"def",
"_merge_meta",
"(",
"base",
",",
"child",
")",
":",
"base",
"=",
"copy",
".",
"deepcopy",
"(",
"base",
")",
"child",
".",
"setdefault",
"(",
"'abstract'",
",",
"False",
")",
"for",
"key",
",",
"value",
"in",
"child",
".",
"items",
"(",
")",
... | [
40,
0
] | [
65,
15
] | python | en | ['en', 'en', 'en'] | True |
key_has_dollar | (d) | Recursively check if any key in a dict contains a dollar sign. | Recursively check if any key in a dict contains a dollar sign. | def key_has_dollar(d):
"""Recursively check if any key in a dict contains a dollar sign."""
for k, v in d.items():
if k.startswith('$') or (isinstance(v, dict) and key_has_dollar(v)):
return True | [
"def",
"key_has_dollar",
"(",
"d",
")",
":",
"for",
"k",
",",
"v",
"in",
"d",
".",
"items",
"(",
")",
":",
"if",
"k",
".",
"startswith",
"(",
"'$'",
")",
"or",
"(",
"isinstance",
"(",
"v",
",",
"dict",
")",
"and",
"key_has_dollar",
"(",
"v",
")... | [
214,
0
] | [
218,
23
] | python | en | ['en', 'en', 'en'] | True |
PipelineField.validate | (self, value) | Make sure that a list of valid fields is being used. | Make sure that a list of valid fields is being used. | def validate(self, value):
"""Make sure that a list of valid fields is being used."""
if not isinstance(value, dict):
self.error('Only dictionaries may be used in a PipelineField')
if fields.key_not_string(value):
msg = ('Invalid dictionary key - documents must '
... | [
"def",
"validate",
"(",
"self",
",",
"value",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"dict",
")",
":",
"self",
".",
"error",
"(",
"'Only dictionaries may be used in a PipelineField'",
")",
"if",
"fields",
".",
"key_not_string",
"(",
"value",
... | [
231,
4
] | [
245,
53
] | python | en | ['en', 'en', 'en'] | True |
clean_xgboost_objective | (objective) |
Translate objective to be compatible with loaded xgboost version
Args
----
objective : string
The objective to translate.
Returns
-------
The translated objective, or original if no translation was required.
|
Translate objective to be compatible with loaded xgboost version | def clean_xgboost_objective(objective):
"""
Translate objective to be compatible with loaded xgboost version
Args
----
objective : string
The objective to translate.
Returns
-------
The translated objective, or original if no translation was required.
"""
compat_before... | [
"def",
"clean_xgboost_objective",
"(",
"objective",
")",
":",
"compat_before_v83",
"=",
"{",
"'reg:squarederror'",
":",
"'reg:linear'",
"}",
"compat_v83_or_later",
"=",
"{",
"'reg:linear'",
":",
"'reg:squarederror'",
"}",
"if",
"version",
".",
"parse",
"(",
"xgboost... | [
50,
0
] | [
72,
20
] | python | en | ['en', 'error', 'th'] | False |
get_xgboost_objective_metric | (objective) |
Get the xgboost version-compatible objective and evaluation metric from a potentially version-incompatible input.
Args
----
objective : string
An xgboost objective that may be incompatible with the installed version.
Returns
-------
A tuple with the translated objective and evalu... |
Get the xgboost version-compatible objective and evaluation metric from a potentially version-incompatible input. | def get_xgboost_objective_metric(objective):
"""
Get the xgboost version-compatible objective and evaluation metric from a potentially version-incompatible input.
Args
----
objective : string
An xgboost objective that may be incompatible with the installed version.
Returns
-------... | [
"def",
"get_xgboost_objective_metric",
"(",
"objective",
")",
":",
"def",
"clean_dict_keys",
"(",
"orig",
")",
":",
"return",
"{",
"clean_xgboost_objective",
"(",
"k",
")",
":",
"v",
"for",
"(",
"k",
",",
"v",
")",
"in",
"orig",
".",
"items",
"(",
")",
... | [
75,
0
] | [
101,
47
] | python | en | ['en', 'error', 'th'] | False |
matcher_base_t.__invert__ | (self) | not-operator (~) | not-operator (~) | def __invert__(self):
"""not-operator (~)"""
return not_matcher_t(self) | [
"def",
"__invert__",
"(",
"self",
")",
":",
"return",
"not_matcher_t",
"(",
"self",
")"
] | [
27,
4
] | [
29,
34
] | python | en | ['en', 'zh', 'en'] | False |
matcher_base_t.__and__ | (self, other) | and-operator (&) | and-operator (&) | def __and__(self, other):
"""and-operator (&)"""
return and_matcher_t([self, other]) | [
"def",
"__and__",
"(",
"self",
",",
"other",
")",
":",
"return",
"and_matcher_t",
"(",
"[",
"self",
",",
"other",
"]",
")"
] | [
31,
4
] | [
33,
43
] | python | en | ['en', 'en', 'en'] | False |
matcher_base_t.__or__ | (self, other) | or-operator (|) | or-operator (|) | def __or__(self, other):
"""or-operator (|)"""
return or_matcher_t([self, other]) | [
"def",
"__or__",
"(",
"self",
",",
"other",
")",
":",
"return",
"or_matcher_t",
"(",
"[",
"self",
",",
"other",
"]",
")"
] | [
35,
4
] | [
37,
42
] | python | en | ['en', 'yo', 'en'] | False |
regex_matcher_t.__init__ | (self, regex, function=None) |
:param regex: regular expression
:type regex: string, an instance of this class will compile it for you
:param function: function that will be called to get an information
from declaration as string. As input this function
takes single argument... |
:param regex: regular expression
:type regex: string, an instance of this class will compile it for you | def __init__(self, regex, function=None):
"""
:param regex: regular expression
:type regex: string, an instance of this class will compile it for you
:param function: function that will be called to get an information
from declaration as string. As input this fu... | [
"def",
"__init__",
"(",
"self",
",",
"regex",
",",
"function",
"=",
"None",
")",
":",
"matcher_base_t",
".",
"__init__",
"(",
"self",
")",
"self",
".",
"regex",
"=",
"re",
".",
"compile",
"(",
"regex",
")",
"self",
".",
"function",
"=",
"function",
"... | [
129,
4
] | [
145,
50
] | python | en | ['en', 'error', 'th'] | False |
custom_matcher_t.__init__ | (self, function) |
:param function: callable, that takes single argument -
declaration instance should return True or False
|
:param function: callable, that takes single argument -
declaration instance should return True or False
| def __init__(self, function):
"""
:param function: callable, that takes single argument -
declaration instance should return True or False
"""
matcher_base_t.__init__(self)
self.function = function | [
"def",
"__init__",
"(",
"self",
",",
"function",
")",
":",
"matcher_base_t",
".",
"__init__",
"(",
"self",
")",
"self",
".",
"function",
"=",
"function"
] | [
161,
4
] | [
167,
32
] | python | en | ['en', 'error', 'th'] | False |
access_type_matcher_t.__init__ | (self, access_type) |
:param access_type: declaration access type, could be "public",
"private", "protected"
:type access_type: :class: `str`
|
:param access_type: declaration access type, could be "public",
"private", "protected"
:type access_type: :class: `str`
| def __init__(self, access_type):
"""
:param access_type: declaration access type, could be "public",
"private", "protected"
:type access_type: :class: `str`
"""
matcher_base_t.__init__(self)
self.access_type = access_type | [
"def",
"__init__",
"(",
"self",
",",
"access_type",
")",
":",
"matcher_base_t",
".",
"__init__",
"(",
"self",
")",
"self",
".",
"access_type",
"=",
"access_type"
] | [
184,
4
] | [
191,
38
] | python | en | ['en', 'error', 'th'] | False |
virtuality_type_matcher_t.__init__ | (self, virtuality_type) |
:param access_type: declaration access type
:type access_type: :class:VIRTUALITY_TYPES defines few constants for
your convenience.
|
:param access_type: declaration access type
:type access_type: :class:VIRTUALITY_TYPES defines few constants for
your convenience.
| def __init__(self, virtuality_type):
"""
:param access_type: declaration access type
:type access_type: :class:VIRTUALITY_TYPES defines few constants for
your convenience.
"""
matcher_base_t.__init__(self)
self.virtuality_type = virtuality_type | [
"def",
"__init__",
"(",
"self",
",",
"virtuality_type",
")",
":",
"matcher_base_t",
".",
"__init__",
"(",
"self",
")",
"self",
".",
"virtuality_type",
"=",
"virtuality_type"
] | [
212,
4
] | [
219,
46
] | python | en | ['en', 'error', 'th'] | False |
make_query_packet | () | Construct a UDP packet suitable for querying an NTP server to ask for
the current time. | Construct a UDP packet suitable for querying an NTP server to ask for
the current time. | def make_query_packet():
"""Construct a UDP packet suitable for querying an NTP server to ask for
the current time."""
# The structure of an NTP packet is described here:
# https://tools.ietf.org/html/rfc5905#page-19
# They're always 48 bytes long, unless you're using extensions, which we
# a... | [
"def",
"make_query_packet",
"(",
")",
":",
"# The structure of an NTP packet is described here:",
"# https://tools.ietf.org/html/rfc5905#page-19",
"# They're always 48 bytes long, unless you're using extensions, which we",
"# aren't.",
"packet",
"=",
"bytearray",
"(",
"48",
")",
"# T... | [
9,
0
] | [
27,
17
] | python | en | ['en', 'en', 'en'] | True |
extract_transmit_timestamp | (ntp_packet) | Given an NTP packet, extract the "transmit timestamp" field, as a
Python datetime. | Given an NTP packet, extract the "transmit timestamp" field, as a
Python datetime. | def extract_transmit_timestamp(ntp_packet):
"""Given an NTP packet, extract the "transmit timestamp" field, as a
Python datetime."""
# The transmit timestamp is the time that the server sent its response.
# It's stored in bytes 40-47 of the NTP packet. See:
# https://tools.ietf.org/html/rfc5905#p... | [
"def",
"extract_transmit_timestamp",
"(",
"ntp_packet",
")",
":",
"# The transmit timestamp is the time that the server sent its response.",
"# It's stored in bytes 40-47 of the NTP packet. See:",
"# https://tools.ietf.org/html/rfc5905#page-19",
"encoded_transmit_timestamp",
"=",
"ntp_packet... | [
29,
0
] | [
49,
29
] | python | en | ['en', 'en', 'en'] | True |
ExpectColumnWassersteinDistanceToBeLessThan.validate_configuration | (self, configuration: Optional[ExpectationConfiguration]) |
Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that
necessary configuration arguments have been provided for the validation of the expectation.
Args:
configuration (OPTIONAL[ExpectationConfiguration]): \
An opt... |
Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that
necessary configuration arguments have been provided for the validation of the expectation. | def validate_configuration(self, configuration: Optional[ExpectationConfiguration]):
"""
Validates that a configuration has been set, and sets a configuration if it has yet to be set. Ensures that
necessary configuration arguments have been provided for the validation of the expectation.
... | [
"def",
"validate_configuration",
"(",
"self",
",",
"configuration",
":",
"Optional",
"[",
"ExpectationConfiguration",
"]",
")",
":",
"super",
"(",
")",
".",
"validate_configuration",
"(",
"configuration",
")",
"self",
".",
"validate_metric_value_between_configuration",
... | [
241,
4
] | [
253,
85
] | python | en | ['en', 'error', 'th'] | False |
_calc_validation_statistics | (validation_results) |
Calculate summary statistics for the validation results and
return ``ExpectationStatistics``.
|
Calculate summary statistics for the validation results and
return ``ExpectationStatistics``.
| def _calc_validation_statistics(validation_results):
"""
Calculate summary statistics for the validation results and
return ``ExpectationStatistics``.
"""
# calc stats
successful_expectations = sum(exp.success for exp in validation_results)
evaluated_expectations = len(validation_results)
... | [
"def",
"_calc_validation_statistics",
"(",
"validation_results",
")",
":",
"# calc stats",
"successful_expectations",
"=",
"sum",
"(",
"exp",
".",
"success",
"for",
"exp",
"in",
"validation_results",
")",
"evaluated_expectations",
"=",
"len",
"(",
"validation_results",
... | [
1279,
0
] | [
1301,
5
] | python | en | ['en', 'error', 'th'] | False |
DataAsset.__init__ | (self, *args, **kwargs) |
Initialize the DataAsset.
:param profiler (profiler class) = None: The profiler that should be run on the data_asset to
build a baseline expectation suite.
Note: DataAsset is designed to support multiple inheritance (e.g. PandasDataset inherits from both a
Pandas DataFrame... |
Initialize the DataAsset. | def __init__(self, *args, **kwargs):
"""
Initialize the DataAsset.
:param profiler (profiler class) = None: The profiler that should be run on the data_asset to
build a baseline expectation suite.
Note: DataAsset is designed to support multiple inheritance (e.g. PandasDatas... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"interactive_evaluation",
"=",
"kwargs",
".",
"pop",
"(",
"\"interactive_evaluation\"",
",",
"True",
")",
"profiler",
"=",
"kwargs",
".",
"pop",
"(",
"\"profiler\"",
",",
... | [
46,
4
] | [
93,
73
] | python | en | ['en', 'error', 'th'] | False |
DataAsset.autoinspect | (self, profiler) | Deprecated: use profile instead.
Use the provided profiler to evaluate this data_asset and assign the resulting expectation suite as its own.
Args:
profiler: The profiler to use
Returns:
tuple(expectation_suite, validation_results)
| Deprecated: use profile instead. | def autoinspect(self, profiler):
"""Deprecated: use profile instead.
Use the provided profiler to evaluate this data_asset and assign the resulting expectation suite as its own.
Args:
profiler: The profiler to use
Returns:
tuple(expectation_suite, validation_re... | [
"def",
"autoinspect",
"(",
"self",
",",
"profiler",
")",
":",
"warnings",
".",
"warn",
"(",
"\"The term autoinspect is deprecated and will be removed in a future release. Please use 'profile'\\\n instead.\"",
")",
"expectation_suite",
",",
"validation_results",
"=",
"profi... | [
101,
4
] | [
117,
52
] | python | en | ['en', 'ro', 'en'] | True |
DataAsset.profile | (self, profiler, profiler_configuration=None) | Use the provided profiler to evaluate this data_asset and assign the resulting expectation suite as its own.
Args:
profiler: The profiler to use
profiler_configuration: Optional profiler configuration dict
Returns:
tuple(expectation_suite, validation_results)
... | Use the provided profiler to evaluate this data_asset and assign the resulting expectation suite as its own. | def profile(self, profiler, profiler_configuration=None):
"""Use the provided profiler to evaluate this data_asset and assign the resulting expectation suite as its own.
Args:
profiler: The profiler to use
profiler_configuration: Optional profiler configuration dict
Ret... | [
"def",
"profile",
"(",
"self",
",",
"profiler",
",",
"profiler_configuration",
"=",
"None",
")",
":",
"expectation_suite",
",",
"validation_results",
"=",
"profiler",
".",
"profile",
"(",
"self",
",",
"profiler_configuration",
")",
"return",
"expectation_suite",
"... | [
119,
4
] | [
133,
52
] | python | en | ['en', 'en', 'en'] | True |
DataAsset.expectation | (cls, method_arg_names) | Manages configuration and running of expectation objects.
Expectation builds and saves a new expectation configuration to the DataAsset object. It is the core decorator \
used by great expectations to manage expectation configurations.
Args:
method_arg_names (List) : An ordered lis... | Manages configuration and running of expectation objects. | def expectation(cls, method_arg_names):
"""Manages configuration and running of expectation objects.
Expectation builds and saves a new expectation configuration to the DataAsset object. It is the core decorator \
used by great expectations to manage expectation configurations.
Args:
... | [
"def",
"expectation",
"(",
"cls",
",",
"method_arg_names",
")",
":",
"def",
"outer_wrapper",
"(",
"func",
")",
":",
"@",
"wraps",
"(",
"func",
")",
"def",
"wrapper",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Get the name of t... | [
142,
4
] | [
336,
28
] | python | en | ['en', 'en', 'en'] | True |
DataAsset._initialize_expectations | (
self, expectation_suite=None, expectation_suite_name=None
) | Instantiates `_expectation_suite` as empty by default or with a specified expectation `config`.
In addition, this always sets the `default_expectation_args` to:
`include_config`: False,
`catch_exceptions`: False,
`output_format`: 'BASIC'
By default, initializes data_... | Instantiates `_expectation_suite` as empty by default or with a specified expectation `config`.
In addition, this always sets the `default_expectation_args` to:
`include_config`: False,
`catch_exceptions`: False,
`output_format`: 'BASIC' | def _initialize_expectations(
self, expectation_suite=None, expectation_suite_name=None
):
"""Instantiates `_expectation_suite` as empty by default or with a specified expectation `config`.
In addition, this always sets the `default_expectation_args` to:
`include_config`: False,
... | [
"def",
"_initialize_expectations",
"(",
"self",
",",
"expectation_suite",
"=",
"None",
",",
"expectation_suite_name",
"=",
"None",
")",
":",
"if",
"expectation_suite",
"is",
"not",
"None",
":",
"if",
"isinstance",
"(",
"expectation_suite",
",",
"dict",
")",
":",... | [
338,
4
] | [
395,
9
] | python | en | ['en', 'en', 'en'] | True |
DataAsset.append_expectation | (self, expectation_config) | This method is a thin wrapper for ExpectationSuite.append_expectation | This method is a thin wrapper for ExpectationSuite.append_expectation | def append_expectation(self, expectation_config):
"""This method is a thin wrapper for ExpectationSuite.append_expectation"""
warnings.warn(
"append_expectation is deprecated, and will be removed in a future release. "
+ "Please use ExpectationSuite.add_expectation instead.",
... | [
"def",
"append_expectation",
"(",
"self",
",",
"expectation_config",
")",
":",
"warnings",
".",
"warn",
"(",
"\"append_expectation is deprecated, and will be removed in a future release. \"",
"+",
"\"Please use ExpectationSuite.add_expectation instead.\"",
",",
"DeprecationWarning",
... | [
397,
4
] | [
404,
70
] | python | en | ['en', 'en', 'en'] | True |
DataAsset.find_expectation_indexes | (
self,
expectation_configuration: ExpectationConfiguration,
match_type: str = "domain",
) | This method is a thin wrapper for ExpectationSuite.find_expectation_indexes | This method is a thin wrapper for ExpectationSuite.find_expectation_indexes | def find_expectation_indexes(
self,
expectation_configuration: ExpectationConfiguration,
match_type: str = "domain",
) -> List[int]:
"""This method is a thin wrapper for ExpectationSuite.find_expectation_indexes"""
warnings.warn(
"find_expectation_indexes is depre... | [
"def",
"find_expectation_indexes",
"(",
"self",
",",
"expectation_configuration",
":",
"ExpectationConfiguration",
",",
"match_type",
":",
"str",
"=",
"\"domain\"",
",",
")",
"->",
"List",
"[",
"int",
"]",
":",
"warnings",
".",
"warn",
"(",
"\"find_expectation_ind... | [
406,
4
] | [
419,
9
] | python | en | ['en', 'en', 'en'] | True |
DataAsset.find_expectations | (
self,
expectation_configuration: ExpectationConfiguration,
match_type: str = "domain",
) | This method is a thin wrapper for ExpectationSuite.find_expectations() | This method is a thin wrapper for ExpectationSuite.find_expectations() | def find_expectations(
self,
expectation_configuration: ExpectationConfiguration,
match_type: str = "domain",
) -> List[ExpectationConfiguration]:
"""This method is a thin wrapper for ExpectationSuite.find_expectations()"""
warnings.warn(
"find_expectations is dep... | [
"def",
"find_expectations",
"(",
"self",
",",
"expectation_configuration",
":",
"ExpectationConfiguration",
",",
"match_type",
":",
"str",
"=",
"\"domain\"",
",",
")",
"->",
"List",
"[",
"ExpectationConfiguration",
"]",
":",
"warnings",
".",
"warn",
"(",
"\"find_e... | [
421,
4
] | [
434,
9
] | python | en | ['en', 'en', 'en'] | True |
DataAsset.remove_expectation | (
self,
expectation_configuration: ExpectationConfiguration,
match_type: str = "domain",
remove_multiple_matches: bool = False,
) | This method is a thin wrapper for ExpectationSuite.remove() | This method is a thin wrapper for ExpectationSuite.remove() | def remove_expectation(
self,
expectation_configuration: ExpectationConfiguration,
match_type: str = "domain",
remove_multiple_matches: bool = False,
) -> List[ExpectationConfiguration]:
"""This method is a thin wrapper for ExpectationSuite.remove()"""
warnings.warn(
... | [
"def",
"remove_expectation",
"(",
"self",
",",
"expectation_configuration",
":",
"ExpectationConfiguration",
",",
"match_type",
":",
"str",
"=",
"\"domain\"",
",",
"remove_multiple_matches",
":",
"bool",
"=",
"False",
",",
")",
"->",
"List",
"[",
"ExpectationConfigu... | [
436,
4
] | [
452,
9
] | python | en | ['en', 'en', 'en'] | True |
DataAsset.get_default_expectation_arguments | (self) | Fetch default expectation arguments for this data_asset
Returns:
A dictionary containing all the current default expectation arguments for a data_asset
Ex::
{
"include_config" : True,
"catch_exceptions" : False,
... | Fetch default expectation arguments for this data_asset | def get_default_expectation_arguments(self):
"""Fetch default expectation arguments for this data_asset
Returns:
A dictionary containing all the current default expectation arguments for a data_asset
Ex::
{
"include_config" : True,
... | [
"def",
"get_default_expectation_arguments",
"(",
"self",
")",
":",
"return",
"self",
".",
"default_expectation_args"
] | [
486,
4
] | [
503,
44
] | python | en | ['en', 'fr', 'en'] | True |
DataAsset.set_default_expectation_argument | (self, argument, value) | Set a default expectation argument for this data_asset
Args:
argument (string): The argument to be replaced
value : The New argument to use for replacement
Returns:
None
See also:
get_default_expectation_arguments
| Set a default expectation argument for this data_asset | def set_default_expectation_argument(self, argument, value):
"""Set a default expectation argument for this data_asset
Args:
argument (string): The argument to be replaced
value : The New argument to use for replacement
Returns:
None
See also:
... | [
"def",
"set_default_expectation_argument",
"(",
"self",
",",
"argument",
",",
"value",
")",
":",
"# !!! Maybe add a validation check here?",
"self",
".",
"default_expectation_args",
"[",
"argument",
"]",
"=",
"value"
] | [
505,
4
] | [
520,
55
] | python | en | ['en', 'fr', 'en'] | True |
DataAsset.get_expectation_suite | (
self,
discard_failed_expectations=True,
discard_result_format_kwargs=True,
discard_include_config_kwargs=True,
discard_catch_exceptions_kwargs=True,
suppress_warnings=False,
suppress_logging=False,
) | Returns _expectation_config as a JSON object, and perform some cleaning along the way.
Args:
discard_failed_expectations (boolean): \
Only include expectations with success_on_last_run=True in the exported config. Defaults to `True`.
discard_result_format_kwargs (boolea... | Returns _expectation_config as a JSON object, and perform some cleaning along the way. | def get_expectation_suite(
self,
discard_failed_expectations=True,
discard_result_format_kwargs=True,
discard_include_config_kwargs=True,
discard_catch_exceptions_kwargs=True,
suppress_warnings=False,
suppress_logging=False,
):
"""Returns _expectation_... | [
"def",
"get_expectation_suite",
"(",
"self",
",",
"discard_failed_expectations",
"=",
"True",
",",
"discard_result_format_kwargs",
"=",
"True",
",",
"discard_include_config_kwargs",
"=",
"True",
",",
"discard_catch_exceptions_kwargs",
"=",
"True",
",",
"suppress_warnings",
... | [
543,
4
] | [
646,
32
] | python | en | ['en', 'en', 'en'] | True |
DataAsset.save_expectation_suite | (
self,
filepath=None,
discard_failed_expectations=True,
discard_result_format_kwargs=True,
discard_include_config_kwargs=True,
discard_catch_exceptions_kwargs=True,
suppress_warnings=False,
) | Writes ``_expectation_config`` to a JSON file.
Writes the DataAsset's expectation config to the specified JSON ``filepath``. Failing expectations \
can be excluded from the JSON expectations config with ``discard_failed_expectations``. The kwarg key-value \
pairs :ref:`result_format`, ... | Writes ``_expectation_config`` to a JSON file. | def save_expectation_suite(
self,
filepath=None,
discard_failed_expectations=True,
discard_result_format_kwargs=True,
discard_include_config_kwargs=True,
discard_catch_exceptions_kwargs=True,
suppress_warnings=False,
):
"""Writes ``_expectation_config`... | [
"def",
"save_expectation_suite",
"(",
"self",
",",
"filepath",
"=",
"None",
",",
"discard_failed_expectations",
"=",
"True",
",",
"discard_result_format_kwargs",
"=",
"True",
",",
"discard_include_config_kwargs",
"=",
"True",
",",
"discard_catch_exceptions_kwargs",
"=",
... | [
648,
4
] | [
704,
13
] | python | en | ['en', 'en', 'en'] | True |
DataAsset.validate | (
self,
expectation_suite=None,
run_id=None,
data_context=None,
evaluation_parameters=None,
catch_exceptions=True,
result_format=None,
only_return_failures=False,
run_name=None,
run_time=None,
) | Generates a JSON-formatted report describing the outcome of all expectations.
Use the default expectation_suite=None to validate the expectations config associated with the DataAsset.
Args:
expectation_suite (json or None): \
If None, uses the expectations config generated ... | Generates a JSON-formatted report describing the outcome of all expectations. | def validate(
self,
expectation_suite=None,
run_id=None,
data_context=None,
evaluation_parameters=None,
catch_exceptions=True,
result_format=None,
only_return_failures=False,
run_name=None,
run_time=None,
):
"""Generates a JSON-... | [
"def",
"validate",
"(",
"self",
",",
"expectation_suite",
"=",
"None",
",",
"run_id",
"=",
"None",
",",
"data_context",
"=",
"None",
",",
"evaluation_parameters",
"=",
"None",
",",
"catch_exceptions",
"=",
"True",
",",
"result_format",
"=",
"None",
",",
"onl... | [
706,
4
] | [
1020,
21
] | python | en | ['en', 'en', 'en'] | True |
DataAsset.get_evaluation_parameter | (self, parameter_name, default_value=None) | Get an evaluation parameter value that has been stored in meta.
Args:
parameter_name (string): The name of the parameter to store.
default_value (any): The default value to be returned if the parameter is not found.
Returns:
The current value of the evaluation param... | Get an evaluation parameter value that has been stored in meta. | def get_evaluation_parameter(self, parameter_name, default_value=None):
"""Get an evaluation parameter value that has been stored in meta.
Args:
parameter_name (string): The name of the parameter to store.
default_value (any): The default value to be returned if the parameter is... | [
"def",
"get_evaluation_parameter",
"(",
"self",
",",
"parameter_name",
",",
"default_value",
"=",
"None",
")",
":",
"if",
"parameter_name",
"in",
"self",
".",
"_expectation_suite",
".",
"evaluation_parameters",
":",
"return",
"self",
".",
"_expectation_suite",
".",
... | [
1022,
4
] | [
1035,
32
] | python | en | ['en', 'en', 'en'] | True |
DataAsset.set_evaluation_parameter | (self, parameter_name, parameter_value) | Provide a value to be stored in the data_asset evaluation_parameters object and used to evaluate
parameterized expectations.
Args:
parameter_name (string): The name of the kwarg to be replaced at evaluation time
parameter_value (any): The value to be used
| Provide a value to be stored in the data_asset evaluation_parameters object and used to evaluate
parameterized expectations. | def set_evaluation_parameter(self, parameter_name, parameter_value):
"""Provide a value to be stored in the data_asset evaluation_parameters object and used to evaluate
parameterized expectations.
Args:
parameter_name (string): The name of the kwarg to be replaced at evaluation time... | [
"def",
"set_evaluation_parameter",
"(",
"self",
",",
"parameter_name",
",",
"parameter_value",
")",
":",
"self",
".",
"_expectation_suite",
".",
"evaluation_parameters",
".",
"update",
"(",
"{",
"parameter_name",
":",
"parameter_value",
"}",
")"
] | [
1037,
4
] | [
1047,
9
] | python | en | ['en', 'en', 'en'] | True |
DataAsset.expectation_suite_name | (self) | Gets the current expectation_suite name of this data_asset as stored in the expectations configuration. | Gets the current expectation_suite name of this data_asset as stored in the expectations configuration. | def expectation_suite_name(self):
"""Gets the current expectation_suite name of this data_asset as stored in the expectations configuration."""
return self._expectation_suite.expectation_suite_name | [
"def",
"expectation_suite_name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_expectation_suite",
".",
"expectation_suite_name"
] | [
1072,
4
] | [
1074,
61
] | python | en | ['en', 'en', 'en'] | True |
DataAsset.expectation_suite_name | (self, expectation_suite_name) | Sets the expectation_suite name of this data_asset as stored in the expectations configuration. | Sets the expectation_suite name of this data_asset as stored in the expectations configuration. | def expectation_suite_name(self, expectation_suite_name):
"""Sets the expectation_suite name of this data_asset as stored in the expectations configuration."""
self._expectation_suite.expectation_suite_name = expectation_suite_name | [
"def",
"expectation_suite_name",
"(",
"self",
",",
"expectation_suite_name",
")",
":",
"self",
".",
"_expectation_suite",
".",
"expectation_suite_name",
"=",
"expectation_suite_name"
] | [
1077,
4
] | [
1079,
79
] | python | en | ['en', 'en', 'en'] | True |
DataAsset._format_map_output | (
self,
result_format,
success,
element_count,
nonnull_count,
unexpected_count,
unexpected_list,
unexpected_index_list,
) | Helper function to construct expectation result objects for map_expectations (such as column_map_expectation
and file_lines_map_expectation).
Expectations support four result_formats: BOOLEAN_ONLY, BASIC, SUMMARY, and COMPLETE.
In each case, the object returned has a different set of populated ... | Helper function to construct expectation result objects for map_expectations (such as column_map_expectation
and file_lines_map_expectation). | def _format_map_output(
self,
result_format,
success,
element_count,
nonnull_count,
unexpected_count,
unexpected_list,
unexpected_index_list,
):
"""Helper function to construct expectation result objects for map_expectations (such as column_map... | [
"def",
"_format_map_output",
"(",
"self",
",",
"result_format",
",",
"success",
",",
"element_count",
",",
"nonnull_count",
",",
"unexpected_count",
",",
"unexpected_list",
",",
"unexpected_index_list",
",",
")",
":",
"# NB: unexpected_count parameter is explicit some imple... | [
1087,
4
] | [
1195,
9
] | python | en | ['en', 'en', 'en'] | True |
DataAsset._calc_map_expectation_success | (self, success_count, nonnull_count, mostly) | Calculate success and percent_success for column_map_expectations
Args:
success_count (int): \
The number of successful values in the column
nonnull_count (int): \
The number of nonnull values in the column
mostly (float or None): \
... | Calculate success and percent_success for column_map_expectations | def _calc_map_expectation_success(self, success_count, nonnull_count, mostly):
"""Calculate success and percent_success for column_map_expectations
Args:
success_count (int): \
The number of successful values in the column
nonnull_count (int): \
T... | [
"def",
"_calc_map_expectation_success",
"(",
"self",
",",
"success_count",
",",
"nonnull_count",
",",
"mostly",
")",
":",
"if",
"isinstance",
"(",
"success_count",
",",
"decimal",
".",
"Decimal",
")",
":",
"raise",
"ValueError",
"(",
"\"success_count must not be a d... | [
1197,
4
] | [
1234,
39
] | python | en | ['en', 'en', 'en'] | True |
DataAsset.test_expectation_function | (self, function, *args, **kwargs) | Test a generic expectation function
Args:
function (func): The function to be tested. (Must be a valid expectation function.)
*args : Positional arguments to be passed the the function
**kwargs : Keyword arguments to be passed the the function
Returns... | Test a generic expectation function | def test_expectation_function(self, function, *args, **kwargs):
"""Test a generic expectation function
Args:
function (func): The function to be tested. (Must be a valid expectation function.)
*args : Positional arguments to be passed the the function
**kwar... | [
"def",
"test_expectation_function",
"(",
"self",
",",
"function",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"argspec",
"=",
"inspect",
".",
"getfullargspec",
"(",
"function",
")",
"[",
"0",
"]",
"[",
"1",
":",
"]",
"new_function",
"=",
"self... | [
1242,
4
] | [
1264,
50
] | python | en | ['ro', 'en', 'en'] | True |
test_get_available_data_asset_names_with_multiple_datasources_with_and_without_generators | (
empty_data_context, sa
) | Test datasources with and without generators. | Test datasources with and without generators. | def test_get_available_data_asset_names_with_multiple_datasources_with_and_without_generators(
empty_data_context, sa
):
"""Test datasources with and without generators."""
# requires sqlalchemy because it instantiates sqlalchemydatasource
context = empty_data_context
connection_kwargs = {"credentia... | [
"def",
"test_get_available_data_asset_names_with_multiple_datasources_with_and_without_generators",
"(",
"empty_data_context",
",",
"sa",
")",
":",
"# requires sqlalchemy because it instantiates sqlalchemydatasource",
"context",
"=",
"empty_data_context",
"connection_kwargs",
"=",
"{",
... | [
116,
0
] | [
156,
5
] | python | en | ['en', 'en', 'en'] | True |
test_data_context_get_validation_result | (titanic_data_context) |
Test that validation results can be correctly fetched from the configured results store
|
Test that validation results can be correctly fetched from the configured results store
| def test_data_context_get_validation_result(titanic_data_context):
"""
Test that validation results can be correctly fetched from the configured results store
"""
run_id = RunIdentifier(run_name="profiling")
profiling_results = titanic_data_context.profile_datasource(
"mydatasource", run_id=... | [
"def",
"test_data_context_get_validation_result",
"(",
"titanic_data_context",
")",
":",
"run_id",
"=",
"RunIdentifier",
"(",
"run_name",
"=",
"\"profiling\"",
")",
"profiling_results",
"=",
"titanic_data_context",
".",
"profile_datasource",
"(",
"\"mydatasource\"",
",",
... | [
370,
0
] | [
389,
53
] | python | en | ['en', 'error', 'th'] | False |
test_get_batch_multiple_datasources_do_not_scan_all | (
data_context_with_bad_datasource,
) |
What does this test and why?
A DataContext can have "stale" datasources in its configuration (ie. connections to DBs that are now offline).
If we configure a new datasource and are only using it (like the PandasDatasource below), then we don't
want to be dependent on all the "stale" datasources workin... |
What does this test and why? | def test_get_batch_multiple_datasources_do_not_scan_all(
data_context_with_bad_datasource,
):
"""
What does this test and why?
A DataContext can have "stale" datasources in its configuration (ie. connections to DBs that are now offline).
If we configure a new datasource and are only using it (like ... | [
"def",
"test_get_batch_multiple_datasources_do_not_scan_all",
"(",
"data_context_with_bad_datasource",
",",
")",
":",
"context",
"=",
"data_context_with_bad_datasource",
"context",
".",
"create_expectation_suite",
"(",
"expectation_suite_name",
"=",
"\"local_test.default\"",
")",
... | [
1715,
0
] | [
1743,
26
] | python | en | ['en', 'error', 'th'] | False |
test_add_checkpoint_from_yaml | (mock_emit, empty_data_context_stats_enabled) |
What does this test and why?
We should be able to add a checkpoint directly from a valid yaml configuration.
test_yaml_config() should not automatically save a checkpoint if valid.
checkpoint yaml in a store should match the configuration, even if created from SimpleCheckpoints
Note: This tests mul... |
What does this test and why?
We should be able to add a checkpoint directly from a valid yaml configuration.
test_yaml_config() should not automatically save a checkpoint if valid.
checkpoint yaml in a store should match the configuration, even if created from SimpleCheckpoints
Note: This tests mul... | def test_add_checkpoint_from_yaml(mock_emit, empty_data_context_stats_enabled):
"""
What does this test and why?
We should be able to add a checkpoint directly from a valid yaml configuration.
test_yaml_config() should not automatically save a checkpoint if valid.
checkpoint yaml in a store should m... | [
"def",
"test_add_checkpoint_from_yaml",
"(",
"mock_emit",
",",
"empty_data_context_stats_enabled",
")",
":",
"context",
":",
"DataContext",
"=",
"empty_data_context_stats_enabled",
"checkpoint_name",
":",
"str",
"=",
"\"my_new_checkpoint\"",
"assert",
"checkpoint_name",
"not"... | [
1749,
0
] | [
1929,
36
] | python | en | ['en', 'error', 'th'] | False |
test_add_checkpoint_from_yaml_fails_for_unrecognized_class_name | (
mock_emit, empty_data_context_stats_enabled
) |
What does this test and why?
Checkpoint yaml should have a valid class_name
|
What does this test and why?
Checkpoint yaml should have a valid class_name
| def test_add_checkpoint_from_yaml_fails_for_unrecognized_class_name(
mock_emit, empty_data_context_stats_enabled
):
"""
What does this test and why?
Checkpoint yaml should have a valid class_name
"""
context: DataContext = empty_data_context_stats_enabled
checkpoint_name: str = "my_new_chec... | [
"def",
"test_add_checkpoint_from_yaml_fails_for_unrecognized_class_name",
"(",
"mock_emit",
",",
"empty_data_context_stats_enabled",
")",
":",
"context",
":",
"DataContext",
"=",
"empty_data_context_stats_enabled",
"checkpoint_name",
":",
"str",
"=",
"\"my_new_checkpoint\"",
"ass... | [
1935,
0
] | [
1984,
62
] | python | en | ['en', 'error', 'th'] | False |
test_add_datasource_from_yaml | (mock_emit, empty_data_context_stats_enabled) |
What does this test and why?
Adding a datasource using context.add_datasource() via a config from a parsed yaml string without substitution variables should work as expected.
|
What does this test and why?
Adding a datasource using context.add_datasource() via a config from a parsed yaml string without substitution variables should work as expected.
| def test_add_datasource_from_yaml(mock_emit, empty_data_context_stats_enabled):
"""
What does this test and why?
Adding a datasource using context.add_datasource() via a config from a parsed yaml string without substitution variables should work as expected.
"""
context: DataContext = empty_data_con... | [
"def",
"test_add_datasource_from_yaml",
"(",
"mock_emit",
",",
"empty_data_context_stats_enabled",
")",
":",
"context",
":",
"DataContext",
"=",
"empty_data_context_stats_enabled",
"assert",
"\"my_new_datasource\"",
"not",
"in",
"context",
".",
"datasources",
".",
"keys",
... | [
1990,
0
] | [
2115,
62
] | python | en | ['en', 'error', 'th'] | False |
test_add_datasource_from_yaml_sql_datasource | (
mock_emit,
sa,
test_backends,
empty_data_context_stats_enabled,
) |
What does this test and why?
Adding a datasource using context.add_datasource() via a config from a parsed yaml string without substitution variables should work as expected.
|
What does this test and why?
Adding a datasource using context.add_datasource() via a config from a parsed yaml string without substitution variables should work as expected.
| def test_add_datasource_from_yaml_sql_datasource(
mock_emit,
sa,
test_backends,
empty_data_context_stats_enabled,
):
"""
What does this test and why?
Adding a datasource using context.add_datasource() via a config from a parsed yaml string without substitution variables should work as expect... | [
"def",
"test_add_datasource_from_yaml_sql_datasource",
"(",
"mock_emit",
",",
"sa",
",",
"test_backends",
",",
"empty_data_context_stats_enabled",
",",
")",
":",
"if",
"\"postgresql\"",
"not",
"in",
"test_backends",
":",
"pytest",
".",
"skip",
"(",
"\"test_add_datasourc... | [
2121,
0
] | [
2309,
62
] | python | en | ['en', 'error', 'th'] | False |
test_add_datasource_from_yaml_sql_datasource_with_credentials | (
mock_emit, sa, test_backends, empty_data_context_stats_enabled
) |
What does this test and why?
Adding a datasource using context.add_datasource() via a config from a parsed yaml string without substitution variables.
In addition, this tests whether the same can be accomplished using credentials with a Datasource and SqlAlchemyExecutionEngine, rather than a SimpleSqlalch... |
What does this test and why?
Adding a datasource using context.add_datasource() via a config from a parsed yaml string without substitution variables.
In addition, this tests whether the same can be accomplished using credentials with a Datasource and SqlAlchemyExecutionEngine, rather than a SimpleSqlalch... | def test_add_datasource_from_yaml_sql_datasource_with_credentials(
mock_emit, sa, test_backends, empty_data_context_stats_enabled
):
"""
What does this test and why?
Adding a datasource using context.add_datasource() via a config from a parsed yaml string without substitution variables.
In addition,... | [
"def",
"test_add_datasource_from_yaml_sql_datasource_with_credentials",
"(",
"mock_emit",
",",
"sa",
",",
"test_backends",
",",
"empty_data_context_stats_enabled",
")",
":",
"if",
"\"postgresql\"",
"not",
"in",
"test_backends",
":",
"pytest",
".",
"skip",
"(",
"\"test_add... | [
2315,
0
] | [
2508,
36
] | python | en | ['en', 'error', 'th'] | False |
test_add_datasource_from_yaml_with_substitution_variables | (
mock_emit, empty_data_context_stats_enabled, monkeypatch
) |
What does this test and why?
Adding a datasource using context.add_datasource() via a config from a parsed yaml string containing substitution variables should work as expected.
|
What does this test and why?
Adding a datasource using context.add_datasource() via a config from a parsed yaml string containing substitution variables should work as expected.
| def test_add_datasource_from_yaml_with_substitution_variables(
mock_emit, empty_data_context_stats_enabled, monkeypatch
):
"""
What does this test and why?
Adding a datasource using context.add_datasource() via a config from a parsed yaml string containing substitution variables should work as expected.... | [
"def",
"test_add_datasource_from_yaml_with_substitution_variables",
"(",
"mock_emit",
",",
"empty_data_context_stats_enabled",
",",
"monkeypatch",
")",
":",
"context",
":",
"DataContext",
"=",
"empty_data_context_stats_enabled",
"assert",
"\"my_new_datasource\"",
"not",
"in",
"... | [
2514,
0
] | [
2644,
62
] | python | en | ['en', 'error', 'th'] | False |
BaseCase.open | (self, url) | Navigates the current browser window to the specified page. | Navigates the current browser window to the specified page. | def open(self, url):
""" Navigates the current browser window to the specified page. """
self.__last_page_load_url = None
if url.startswith("://"):
# Convert URLs such as "://google.com" into "https://google.com"
url = "https" + url
self.driver.get(url)
if... | [
"def",
"open",
"(",
"self",
",",
"url",
")",
":",
"self",
".",
"__last_page_load_url",
"=",
"None",
"if",
"url",
".",
"startswith",
"(",
"\"://\"",
")",
":",
"# Convert URLs such as \"://google.com\" into \"https://google.com\"",
"url",
"=",
"\"https\"",
"+",
"url... | [
91,
4
] | [
100,
42
] | python | en | ['en', 'en', 'en'] | True |
BaseCase.get | (self, url) | If url looks like a page URL, opens the URL in the web browser.
Otherwise, returns self.get_element(URL_AS_A_SELECTOR)
Examples:
self.get("https://seleniumbase.io") # Navigates to the URL
self.get("input.class") # Finds and returns the WebElement
| If url looks like a page URL, opens the URL in the web browser.
Otherwise, returns self.get_element(URL_AS_A_SELECTOR)
Examples:
self.get("https://seleniumbase.io") # Navigates to the URL
self.get("input.class") # Finds and returns the WebElement
| def get(self, url):
""" If url looks like a page URL, opens the URL in the web browser.
Otherwise, returns self.get_element(URL_AS_A_SELECTOR)
Examples:
self.get("https://seleniumbase.io") # Navigates to the URL
self.get("input.class") # Finds and return... | [
"def",
"get",
"(",
"self",
",",
"url",
")",
":",
"if",
"self",
".",
"__looks_like_a_page_url",
"(",
"url",
")",
":",
"self",
".",
"open",
"(",
"url",
")",
"else",
":",
"return",
"self",
".",
"get_element",
"(",
"url",
")"
] | [
102,
4
] | [
112,
40
] | python | en | ['en', 'en', 'en'] | True |
BaseCase.slow_click | (self, selector, by=By.CSS_SELECTOR, timeout=None) | Similar to click(), but pauses for a brief moment before clicking.
When used in combination with setting the user-agent, you can often
bypass bot-detection by tricking websites into thinking that you're
not a bot. (Useful on websites that block web automation tools.)
To ... | Similar to click(), but pauses for a brief moment before clicking.
When used in combination with setting the user-agent, you can often
bypass bot-detection by tricking websites into thinking that you're
not a bot. (Useful on websites that block web automation tools.)
To ... | def slow_click(self, selector, by=By.CSS_SELECTOR, timeout=None):
""" Similar to click(), but pauses for a brief moment before clicking.
When used in combination with setting the user-agent, you can often
bypass bot-detection by tricking websites into thinking that you're
not... | [
"def",
"slow_click",
"(",
"self",
",",
"selector",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"timeout",
"=",
"None",
")",
":",
"if",
"not",
"timeout",
":",
"timeout",
"=",
"settings",
".",
"SMALL_TIMEOUT",
"if",
"self",
".",
"timeout_multiplier",
"... | [
185,
4
] | [
201,
68
] | python | en | ['en', 'en', 'en'] | True |
BaseCase.click_chain | (self, selectors_list, by=By.CSS_SELECTOR,
timeout=None, spacing=0) | This method clicks on a list of elements in succession.
'spacing' is the amount of time to wait between clicks. (sec) | This method clicks on a list of elements in succession.
'spacing' is the amount of time to wait between clicks. (sec) | def click_chain(self, selectors_list, by=By.CSS_SELECTOR,
timeout=None, spacing=0):
""" This method clicks on a list of elements in succession.
'spacing' is the amount of time to wait between clicks. (sec) """
if not timeout:
timeout = settings.SMALL_TIMEOUT
... | [
"def",
"click_chain",
"(",
"self",
",",
"selectors_list",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"timeout",
"=",
"None",
",",
"spacing",
"=",
"0",
")",
":",
"if",
"not",
"timeout",
":",
"timeout",
"=",
"settings",
".",
"SMALL_TIMEOUT",
"if",
"... | [
236,
4
] | [
247,
35
] | python | en | ['en', 'en', 'en'] | True |
BaseCase.update_text | (self, selector, text, by=By.CSS_SELECTOR,
timeout=None, retry=False) | This method updates an element's text field with new text.
Has multiple parts:
* Waits for the element to be visible.
* Waits for the element to be interactive.
* Clears the text field.
* Types in the new text.
* Hits Enter/Submit (if the text end... | This method updates an element's text field with new text.
Has multiple parts:
* Waits for the element to be visible.
* Waits for the element to be interactive.
* Clears the text field.
* Types in the new text.
* Hits Enter/Submit (if the text end... | def update_text(self, selector, text, by=By.CSS_SELECTOR,
timeout=None, retry=False):
""" This method updates an element's text field with new text.
Has multiple parts:
* Waits for the element to be visible.
* Waits for the element to be interactive.
... | [
"def",
"update_text",
"(",
"self",
",",
"selector",
",",
"text",
",",
"by",
"=",
"By",
".",
"CSS_SELECTOR",
",",
"timeout",
"=",
"None",
",",
"retry",
"=",
"False",
")",
":",
"if",
"not",
"timeout",
":",
"timeout",
"=",
"settings",
".",
"LARGE_TIMEOUT"... | [
249,
4
] | [
328,
46
] | python | en | ['en', 'en', 'en'] | True |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.