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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
S3Url.suffix | (self) |
Attempts to get a file suffix from the S3 key.
If can't find one returns `None`.
|
Attempts to get a file suffix from the S3 key.
If can't find one returns `None`.
| def suffix(self) -> Optional[str]:
"""
Attempts to get a file suffix from the S3 key.
If can't find one returns `None`.
"""
splits = self._parsed.path.rsplit(".", 1)
_suffix = splits[-1]
if len(_suffix) > 0 and len(splits) > 1:
return str(_suffix)
... | [
"def",
"suffix",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"splits",
"=",
"self",
".",
"_parsed",
".",
"path",
".",
"rsplit",
"(",
"\".\"",
",",
"1",
")",
"_suffix",
"=",
"splits",
"[",
"-",
"1",
"]",
"if",
"len",
"(",
"_suffix",
... | [
446,
4
] | [
455,
19
] | python | en | ['en', 'error', 'th'] | False |
move_on_at | (deadline) | Use as a context manager to create a cancel scope with the given
absolute deadline.
Args:
deadline (float): The deadline.
| Use as a context manager to create a cancel scope with the given
absolute deadline. | def move_on_at(deadline):
"""Use as a context manager to create a cancel scope with the given
absolute deadline.
Args:
deadline (float): The deadline.
"""
return trio.CancelScope(deadline=deadline) | [
"def",
"move_on_at",
"(",
"deadline",
")",
":",
"return",
"trio",
".",
"CancelScope",
"(",
"deadline",
"=",
"deadline",
")"
] | [
5,
0
] | [
13,
46
] | python | en | ['en', 'en', 'en'] | True |
move_on_after | (seconds) | Use as a context manager to create a cancel scope whose deadline is
set to now + *seconds*.
Args:
seconds (float): The timeout.
Raises:
ValueError: if timeout is less than zero.
| Use as a context manager to create a cancel scope whose deadline is
set to now + *seconds*. | def move_on_after(seconds):
"""Use as a context manager to create a cancel scope whose deadline is
set to now + *seconds*.
Args:
seconds (float): The timeout.
Raises:
ValueError: if timeout is less than zero.
"""
if seconds < 0:
raise ValueError("timeout must be non-negat... | [
"def",
"move_on_after",
"(",
"seconds",
")",
":",
"if",
"seconds",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"\"timeout must be non-negative\"",
")",
"return",
"move_on_at",
"(",
"trio",
".",
"current_time",
"(",
")",
"+",
"seconds",
")"
] | [
16,
0
] | [
30,
52
] | python | en | ['en', 'en', 'en'] | True |
sleep_forever | () | Pause execution of the current task forever (or until cancelled).
Equivalent to calling ``await sleep(math.inf)``.
| Pause execution of the current task forever (or until cancelled). | async def sleep_forever():
"""Pause execution of the current task forever (or until cancelled).
Equivalent to calling ``await sleep(math.inf)``.
"""
await trio.lowlevel.wait_task_rescheduled(lambda _: trio.lowlevel.Abort.SUCCEEDED) | [
"async",
"def",
"sleep_forever",
"(",
")",
":",
"await",
"trio",
".",
"lowlevel",
".",
"wait_task_rescheduled",
"(",
"lambda",
"_",
":",
"trio",
".",
"lowlevel",
".",
"Abort",
".",
"SUCCEEDED",
")"
] | [
33,
0
] | [
39,
86
] | python | en | ['en', 'en', 'en'] | True |
sleep_until | (deadline) | Pause execution of the current task until the given time.
The difference between :func:`sleep` and :func:`sleep_until` is that the
former takes a relative time and the latter takes an absolute time.
Args:
deadline (float): The time at which we should wake up again. May be in
the past, ... | Pause execution of the current task until the given time. | async def sleep_until(deadline):
"""Pause execution of the current task until the given time.
The difference between :func:`sleep` and :func:`sleep_until` is that the
former takes a relative time and the latter takes an absolute time.
Args:
deadline (float): The time at which we should wake up... | [
"async",
"def",
"sleep_until",
"(",
"deadline",
")",
":",
"with",
"move_on_at",
"(",
"deadline",
")",
":",
"await",
"sleep_forever",
"(",
")"
] | [
42,
0
] | [
55,
29
] | python | en | ['en', 'en', 'en'] | True |
sleep | (seconds) | Pause execution of the current task for the given number of seconds.
Args:
seconds (float): The number of seconds to sleep. May be zero to
insert a checkpoint without actually blocking.
Raises:
ValueError: if *seconds* is negative.
| Pause execution of the current task for the given number of seconds. | async def sleep(seconds):
"""Pause execution of the current task for the given number of seconds.
Args:
seconds (float): The number of seconds to sleep. May be zero to
insert a checkpoint without actually blocking.
Raises:
ValueError: if *seconds* is negative.
"""
if s... | [
"async",
"def",
"sleep",
"(",
"seconds",
")",
":",
"if",
"seconds",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"\"duration must be non-negative\"",
")",
"if",
"seconds",
"==",
"0",
":",
"await",
"trio",
".",
"lowlevel",
".",
"checkpoint",
"(",
")",
"else",... | [
58,
0
] | [
74,
56
] | python | en | ['en', 'en', 'en'] | True |
fail_at | (deadline) | Creates a cancel scope with the given deadline, and raises an error if it
is actually cancelled.
This function and :func:`move_on_at` are similar in that both create a
cancel scope with a given absolute deadline, and if the deadline expires
then both will cause :exc:`Cancelled` to be raised within the ... | Creates a cancel scope with the given deadline, and raises an error if it
is actually cancelled. | def fail_at(deadline):
"""Creates a cancel scope with the given deadline, and raises an error if it
is actually cancelled.
This function and :func:`move_on_at` are similar in that both create a
cancel scope with a given absolute deadline, and if the deadline expires
then both will cause :exc:`Cance... | [
"def",
"fail_at",
"(",
"deadline",
")",
":",
"with",
"move_on_at",
"(",
"deadline",
")",
"as",
"scope",
":",
"yield",
"scope",
"if",
"scope",
".",
"cancelled_caught",
":",
"raise",
"TooSlowError"
] | [
85,
0
] | [
106,
26
] | python | en | ['en', 'en', 'en'] | True |
fail_after | (seconds) | Creates a cancel scope with the given timeout, and raises an error if
it is actually cancelled.
This function and :func:`move_on_after` are similar in that both create a
cancel scope with a given timeout, and if the timeout expires then both
will cause :exc:`Cancelled` to be raised within the scope. Th... | Creates a cancel scope with the given timeout, and raises an error if
it is actually cancelled. | def fail_after(seconds):
"""Creates a cancel scope with the given timeout, and raises an error if
it is actually cancelled.
This function and :func:`move_on_after` are similar in that both create a
cancel scope with a given timeout, and if the timeout expires then both
will cause :exc:`Cancelled` t... | [
"def",
"fail_after",
"(",
"seconds",
")",
":",
"if",
"seconds",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"\"timeout must be non-negative\"",
")",
"return",
"fail_at",
"(",
"trio",
".",
"current_time",
"(",
")",
"+",
"seconds",
")"
] | [
109,
0
] | [
128,
49
] | python | en | ['en', 'en', 'en'] | True |
scanner_t.xml_generator_from_xml_file | (self) |
Configuration object containing information about the xml generator
read from the xml file.
Returns:
utils.xml_generators: configuration object
|
Configuration object containing information about the xml generator
read from the xml file. | def xml_generator_from_xml_file(self):
"""
Configuration object containing information about the xml generator
read from the xml file.
Returns:
utils.xml_generators: configuration object
"""
return self.__xml_generator_from_xml_file | [
"def",
"xml_generator_from_xml_file",
"(",
"self",
")",
":",
"return",
"self",
".",
"__xml_generator_from_xml_file"
] | [
169,
4
] | [
177,
49
] | python | en | ['en', 'error', 'th'] | False |
scanner_t.__read_location_bootstrap | (self, inst, decl, attrs, _) | This function monkey patches the __read_location function to either
__read_location_gccxml or __read_location_castxml depending on the
xml generator in use
| This function monkey patches the __read_location function to either
__read_location_gccxml or __read_location_castxml depending on the
xml generator in use
| def __read_location_bootstrap(self, inst, decl, attrs, _):
""" This function monkey patches the __read_location function to either
__read_location_gccxml or __read_location_castxml depending on the
xml generator in use
"""
if self.__xml_generator_from_xml_file.is_castxml:
... | [
"def",
"__read_location_bootstrap",
"(",
"self",
",",
"inst",
",",
"decl",
",",
"attrs",
",",
"_",
")",
":",
"if",
"self",
".",
"__xml_generator_from_xml_file",
".",
"is_castxml",
":",
"# These fields are generated by clang, and have no location.",
"# Just set an empty lo... | [
279,
4
] | [
304,
75
] | python | en | ['en', 'en', 'en'] | True |
scanner_t.__read_byte_size | (decl, attrs) | Using duck typing to set the size instead of in constructor | Using duck typing to set the size instead of in constructor | def __read_byte_size(decl, attrs):
"""Using duck typing to set the size instead of in constructor"""
size = attrs.get(XML_AN_SIZE, 0)
# Make sure the size is in bytes instead of bits
decl.byte_size = int(size) / 8 | [
"def",
"__read_byte_size",
"(",
"decl",
",",
"attrs",
")",
":",
"size",
"=",
"attrs",
".",
"get",
"(",
"XML_AN_SIZE",
",",
"0",
")",
"# Make sure the size is in bytes instead of bits",
"decl",
".",
"byte_size",
"=",
"int",
"(",
"size",
")",
"/",
"8"
] | [
369,
4
] | [
373,
38
] | python | en | ['en', 'en', 'en'] | True |
scanner_t.__read_byte_offset | (decl, attrs) | Using duck typing to set the offset instead of in constructor | Using duck typing to set the offset instead of in constructor | def __read_byte_offset(decl, attrs):
"""Using duck typing to set the offset instead of in constructor"""
offset = attrs.get(XML_AN_OFFSET, 0)
# Make sure the size is in bytes instead of bits
decl.byte_offset = int(offset) / 8 | [
"def",
"__read_byte_offset",
"(",
"decl",
",",
"attrs",
")",
":",
"offset",
"=",
"attrs",
".",
"get",
"(",
"XML_AN_OFFSET",
",",
"0",
")",
"# Make sure the size is in bytes instead of bits",
"decl",
".",
"byte_offset",
"=",
"int",
"(",
"offset",
")",
"/",
"8"
... | [
376,
4
] | [
380,
42
] | python | en | ['en', 'en', 'en'] | True |
scanner_t.__read_byte_align | (decl, attrs) | Using duck typing to set the alignment | Using duck typing to set the alignment | def __read_byte_align(decl, attrs):
"""Using duck typing to set the alignment"""
align = attrs.get(XML_AN_ALIGN, 0)
# Make sure the size is in bytes instead of bits
decl.byte_align = int(align) / 8 | [
"def",
"__read_byte_align",
"(",
"decl",
",",
"attrs",
")",
":",
"align",
"=",
"attrs",
".",
"get",
"(",
"XML_AN_ALIGN",
",",
"0",
")",
"# Make sure the size is in bytes instead of bits",
"decl",
".",
"byte_align",
"=",
"int",
"(",
"align",
")",
"/",
"8"
] | [
383,
4
] | [
387,
40
] | python | en | ['en', 'en', 'en'] | True |
ColumnMean._pandas | (cls, column, **kwargs) | Pandas Mean Implementation | Pandas Mean Implementation | def _pandas(cls, column, **kwargs):
"""Pandas Mean Implementation"""
return column.mean() | [
"def",
"_pandas",
"(",
"cls",
",",
"column",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"column",
".",
"mean",
"(",
")"
] | [
21,
4
] | [
23,
28
] | python | en | ['pt', 'fr', 'en'] | False |
ColumnMean._sqlalchemy | (cls, column, **kwargs) | SqlAlchemy Mean Implementation | SqlAlchemy Mean Implementation | def _sqlalchemy(cls, column, **kwargs):
"""SqlAlchemy Mean Implementation"""
# column * 1.0 needed for correct calculation of avg in MSSQL
return sa.func.avg(column * 1.0) | [
"def",
"_sqlalchemy",
"(",
"cls",
",",
"column",
",",
"*",
"*",
"kwargs",
")",
":",
"# column * 1.0 needed for correct calculation of avg in MSSQL",
"return",
"sa",
".",
"func",
".",
"avg",
"(",
"column",
"*",
"1.0",
")"
] | [
26,
4
] | [
29,
40
] | python | en | ['en', 'en', 'en'] | True |
ColumnMean._spark | (cls, column, _table, _column_name, **kwargs) | Spark Mean Implementation | Spark Mean Implementation | def _spark(cls, column, _table, _column_name, **kwargs):
"""Spark Mean Implementation"""
types = dict(_table.dtypes)
if types[_column_name] not in ("int", "float", "double", "bigint"):
raise TypeError("Expected numeric column type for function mean()")
return F.mean(column) | [
"def",
"_spark",
"(",
"cls",
",",
"column",
",",
"_table",
",",
"_column_name",
",",
"*",
"*",
"kwargs",
")",
":",
"types",
"=",
"dict",
"(",
"_table",
".",
"dtypes",
")",
"if",
"types",
"[",
"_column_name",
"]",
"not",
"in",
"(",
"\"int\"",
",",
"... | [
32,
4
] | [
37,
29
] | python | en | ['en', 'da', 'en'] | True |
open_tcp_stream | (
host, port, *, happy_eyeballs_delay=DEFAULT_DELAY, local_address=None
) | Connect to the given host and port over TCP.
If the given ``host`` has multiple IP addresses associated with it, then
we have a problem: which one do we use?
One approach would be to attempt to connect to the first one, and then if
that fails, attempt to connect to the second one ... until we've tried... | Connect to the given host and port over TCP. | async def open_tcp_stream(
host, port, *, happy_eyeballs_delay=DEFAULT_DELAY, local_address=None
):
"""Connect to the given host and port over TCP.
If the given ``host`` has multiple IP addresses associated with it, then
we have a problem: which one do we use?
One approach would be to attempt to c... | [
"async",
"def",
"open_tcp_stream",
"(",
"host",
",",
"port",
",",
"*",
",",
"happy_eyeballs_delay",
"=",
"DEFAULT_DELAY",
",",
"local_address",
"=",
"None",
")",
":",
"# To keep our public API surface smaller, rule out some cases that",
"# getaddrinfo will accept in some circ... | [
166,
0
] | [
370,
25
] | python | en | ['en', 'en', 'en'] | True |
Validator._repr_args | (self) | A string representation of the args passed to this validator. Used by
`__repr__`.
| A string representation of the args passed to this validator. Used by
`__repr__`.
| def _repr_args(self) -> str:
"""A string representation of the args passed to this validator. Used by
`__repr__`.
"""
return "" | [
"def",
"_repr_args",
"(",
"self",
")",
"->",
"str",
":",
"return",
"\"\""
] | [
29,
4
] | [
33,
17
] | python | en | ['en', 'en', 'en'] | True |
OneOf.options | (
self,
valuegetter: typing.Union[str, typing.Callable[[typing.Any], typing.Any]] = str,
) | Return a generator over the (value, label) pairs, where value
is a string associated with each choice. This convenience method
is useful to populate, for instance, a form select field.
:param valuegetter: Can be a callable or a string. In the former case, it must
be a one-argument c... | Return a generator over the (value, label) pairs, where value
is a string associated with each choice. This convenience method
is useful to populate, for instance, a form select field. | def options(
self,
valuegetter: typing.Union[str, typing.Callable[[typing.Any], typing.Any]] = str,
) -> typing.Iterable[typing.Tuple[typing.Any, str]]:
"""Return a generator over the (value, label) pairs, where value
is a string associated with each choice. This convenience method
... | [
"def",
"options",
"(",
"self",
",",
"valuegetter",
":",
"typing",
".",
"Union",
"[",
"str",
",",
"typing",
".",
"Callable",
"[",
"[",
"typing",
".",
"Any",
"]",
",",
"typing",
".",
"Any",
"]",
"]",
"=",
"str",
",",
")",
"->",
"typing",
".",
"Iter... | [
504,
4
] | [
521,
72
] | python | en | ['en', 'en', 'en'] | True |
suite | () | Expectation Suite operations | Expectation Suite operations | def suite():
"""Expectation Suite operations"""
pass | [
"def",
"suite",
"(",
")",
":",
"pass"
] | [
32,
0
] | [
34,
8
] | python | en | ['ca', 'en', 'en'] | True |
suite_edit | (suite, datasource, directory, jupyter, batch_kwargs) |
Generate a Jupyter notebook for editing an existing Expectation Suite.
The SUITE argument is required. This is the name you gave to the suite
when you created it.
A batch of data is required to edit the suite, which is used as a sample.
The edit command will help you specify a batch interactivel... |
Generate a Jupyter notebook for editing an existing Expectation Suite. | def suite_edit(suite, datasource, directory, jupyter, batch_kwargs):
"""
Generate a Jupyter notebook for editing an existing Expectation Suite.
The SUITE argument is required. This is the name you gave to the suite
when you created it.
A batch of data is required to edit the suite, which is used a... | [
"def",
"suite_edit",
"(",
"suite",
",",
"datasource",
",",
"directory",
",",
"jupyter",
",",
"batch_kwargs",
")",
":",
"_suite_edit",
"(",
"suite",
",",
"datasource",
",",
"directory",
",",
"jupyter",
",",
"batch_kwargs",
",",
"usage_event",
"=",
"\"cli.suite.... | [
64,
0
] | [
85,
5
] | python | en | ['en', 'error', 'th'] | False |
suite_demo | (suite, directory, view) |
Create a new demo Expectation Suite.
Great Expectations will choose a couple of columns and generate expectations
about them to demonstrate some examples of assertions you can make about
your data.
|
Create a new demo Expectation Suite. | def suite_demo(suite, directory, view):
"""
Create a new demo Expectation Suite.
Great Expectations will choose a couple of columns and generate expectations
about them to demonstrate some examples of assertions you can make about
your data.
"""
_suite_new(
suite=suite,
dire... | [
"def",
"suite_demo",
"(",
"suite",
",",
"directory",
",",
"view",
")",
":",
"_suite_new",
"(",
"suite",
"=",
"suite",
",",
"directory",
"=",
"directory",
",",
"empty",
"=",
"False",
",",
"jupyter",
"=",
"False",
",",
"view",
"=",
"view",
",",
"batch_kw... | [
235,
0
] | [
251,
5
] | python | en | ['en', 'error', 'th'] | False |
suite_new | (suite, directory, jupyter, batch_kwargs) |
Create a new empty Expectation Suite.
Edit in jupyter notebooks, or skip with the --no-jupyter flag
|
Create a new empty Expectation Suite. | def suite_new(suite, directory, jupyter, batch_kwargs):
"""
Create a new empty Expectation Suite.
Edit in jupyter notebooks, or skip with the --no-jupyter flag
"""
_suite_new(
suite=suite,
directory=directory,
empty=True,
jupyter=jupyter,
view=False,
... | [
"def",
"suite_new",
"(",
"suite",
",",
"directory",
",",
"jupyter",
",",
"batch_kwargs",
")",
":",
"_suite_new",
"(",
"suite",
"=",
"suite",
",",
"directory",
"=",
"directory",
",",
"empty",
"=",
"True",
",",
"jupyter",
"=",
"jupyter",
",",
"view",
"=",
... | [
273,
0
] | [
287,
5
] | python | en | ['en', 'error', 'th'] | False |
suite_delete | (suite, directory) |
Delete an expectation suite from the expectation store.
|
Delete an expectation suite from the expectation store.
| def suite_delete(suite, directory):
"""
Delete an expectation suite from the expectation store.
"""
usage_event = "cli.suite.delete"
context = toolkit.load_data_context_with_error_handling(directory)
suite_names = context.list_expectation_suite_names()
if not suite_names:
toolkit.exi... | [
"def",
"suite_delete",
"(",
"suite",
",",
"directory",
")",
":",
"usage_event",
"=",
"\"cli.suite.delete\"",
"context",
"=",
"toolkit",
".",
"load_data_context_with_error_handling",
"(",
"directory",
")",
"suite_names",
"=",
"context",
".",
"list_expectation_suite_names... | [
373,
0
] | [
394,
85
] | python | en | ['en', 'error', 'th'] | False |
suite_scaffold | (suite, directory, jupyter) | Scaffold a new Expectation Suite. | Scaffold a new Expectation Suite. | def suite_scaffold(suite, directory, jupyter):
"""Scaffold a new Expectation Suite."""
_suite_scaffold(suite, directory, jupyter) | [
"def",
"suite_scaffold",
"(",
"suite",
",",
"directory",
",",
"jupyter",
")",
":",
"_suite_scaffold",
"(",
"suite",
",",
"directory",
",",
"jupyter",
")"
] | [
412,
0
] | [
414,
46
] | python | en | ['en', 'en', 'en'] | True |
suite_list | (directory) | Lists available Expectation Suites. | Lists available Expectation Suites. | def suite_list(directory):
"""Lists available Expectation Suites."""
context = toolkit.load_data_context_with_error_handling(directory)
try:
suite_names = [
" - <cyan>{}</cyan>".format(suite_name)
for suite_name in context.list_expectation_suite_names()
]
if ... | [
"def",
"suite_list",
"(",
"directory",
")",
":",
"context",
"=",
"toolkit",
".",
"load_data_context_with_error_handling",
"(",
"directory",
")",
"try",
":",
"suite_names",
"=",
"[",
"\" - <cyan>{}</cyan>\"",
".",
"format",
"(",
"suite_name",
")",
"for",
"suite_nam... | [
464,
0
] | [
492,
15
] | python | en | ['en', 'en', 'en'] | True |
make_pipe | () | Makes a new pair of pipes. | Makes a new pair of pipes. | async def make_pipe() -> "Tuple[FdStream, FdStream]":
"""Makes a new pair of pipes."""
(r, w) = os.pipe()
return FdStream(w), FdStream(r) | [
"async",
"def",
"make_pipe",
"(",
")",
"->",
"\"Tuple[FdStream, FdStream]\"",
":",
"(",
"r",
",",
"w",
")",
"=",
"os",
".",
"pipe",
"(",
")",
"return",
"FdStream",
"(",
"w",
")",
",",
"FdStream",
"(",
"r",
")"
] | [
22,
0
] | [
25,
35
] | python | en | ['en', 'en', 'en'] | True |
QueryBatchKwargsGenerator._build_batch_kwargs | (self, batch_parameters) | Build batch kwargs from a partition id. | Build batch kwargs from a partition id. | def _build_batch_kwargs(self, batch_parameters):
"""Build batch kwargs from a partition id."""
data_asset_name = batch_parameters.pop("data_asset_name")
raw_query = self._get_raw_query(data_asset_name=data_asset_name)
partition_id = batch_parameters.pop("partition_id", None)
batc... | [
"def",
"_build_batch_kwargs",
"(",
"self",
",",
"batch_parameters",
")",
":",
"data_asset_name",
"=",
"batch_parameters",
".",
"pop",
"(",
"\"data_asset_name\"",
")",
"raw_query",
"=",
"self",
".",
"_get_raw_query",
"(",
"data_asset_name",
"=",
"data_asset_name",
")... | [
161,
4
] | [
174,
65
] | python | en | ['en', 'en', 'sw'] | True |
usage_statistics_enabled_method | (
func=None, event_name=None, args_payload_fn=None, result_payload_fn=None
) |
A decorator for usage statistics which defaults to the less detailed payload schema.
|
A decorator for usage statistics which defaults to the less detailed payload schema.
| def usage_statistics_enabled_method(
func=None, event_name=None, args_payload_fn=None, result_payload_fn=None
):
"""
A decorator for usage statistics which defaults to the less detailed payload schema.
"""
if callable(func):
if event_name is None:
event_name = func.__name__
... | [
"def",
"usage_statistics_enabled_method",
"(",
"func",
"=",
"None",
",",
"event_name",
"=",
"None",
",",
"args_payload_fn",
"=",
"None",
",",
"result_payload_fn",
"=",
"None",
")",
":",
"if",
"callable",
"(",
"func",
")",
":",
"if",
"event_name",
"is",
"None... | [
238,
0
] | [
290,
54
] | python | en | ['en', 'error', 'th'] | False |
send_usage_message | (
data_context,
event: str,
event_payload: Optional[dict] = None,
success: Optional[bool] = None,
) | send a usage statistics message. | send a usage statistics message. | def send_usage_message(
data_context,
event: str,
event_payload: Optional[dict] = None,
success: Optional[bool] = None,
):
"""send a usage statistics message."""
try:
handler: UsageStatisticsHandler = getattr(
data_context, "_usage_statistics_handler", None
)
... | [
"def",
"send_usage_message",
"(",
"data_context",
",",
"event",
":",
"str",
",",
"event_payload",
":",
"Optional",
"[",
"dict",
"]",
"=",
"None",
",",
"success",
":",
"Optional",
"[",
"bool",
"]",
"=",
"None",
",",
")",
":",
"try",
":",
"handler",
":",... | [
405,
0
] | [
424,
12
] | python | en | ['en', 'lv', 'en'] | True |
UsageStatisticsHandler.send_usage_message | (self, event, event_payload=None, success=None) | send a usage statistics message. | send a usage statistics message. | def send_usage_message(self, event, event_payload=None, success=None):
"""send a usage statistics message."""
try:
message = {
"event": event,
"event_payload": event_payload or {},
"success": success,
}
self.emit(messag... | [
"def",
"send_usage_message",
"(",
"self",
",",
"event",
",",
"event_payload",
"=",
"None",
",",
"success",
"=",
"None",
")",
":",
"try",
":",
"message",
"=",
"{",
"\"event\"",
":",
"event",
",",
"\"event_payload\"",
":",
"event_payload",
"or",
"{",
"}",
... | [
118,
4
] | [
129,
16
] | python | en | ['en', 'lv', 'en'] | True |
UsageStatisticsHandler.build_init_payload | (self) | Adds information that may be available only after full data context construction, but is useful to
calculate only one time (for example, anonymization). | Adds information that may be available only after full data context construction, but is useful to
calculate only one time (for example, anonymization). | def build_init_payload(self):
"""Adds information that may be available only after full data context construction, but is useful to
calculate only one time (for example, anonymization)."""
expectation_suites = [
self._data_context.get_expectation_suite(expectation_suite_name)
... | [
"def",
"build_init_payload",
"(",
"self",
")",
":",
"expectation_suites",
"=",
"[",
"self",
".",
"_data_context",
".",
"get_expectation_suite",
"(",
"expectation_suite_name",
")",
"for",
"expectation_suite_name",
"in",
"self",
".",
"_data_context",
".",
"list_expectat... | [
131,
4
] | [
171,
9
] | python | en | ['en', 'en', 'en'] | True |
UsageStatisticsHandler.emit | (self, message) |
Emit a message.
|
Emit a message.
| def emit(self, message):
"""
Emit a message.
"""
try:
if message["event"] == "data_context.__init__":
message["event_payload"] = self.build_init_payload()
message = self.build_envelope(message)
if not self.validate_message(
... | [
"def",
"emit",
"(",
"self",
",",
"message",
")",
":",
"try",
":",
"if",
"message",
"[",
"\"event\"",
"]",
"==",
"\"data_context.__init__\"",
":",
"message",
"[",
"\"event_payload\"",
"]",
"=",
"self",
".",
"build_init_payload",
"(",
")",
"message",
"=",
"s... | [
194,
4
] | [
210,
27
] | python | en | ['en', 'error', 'th'] | False |
_invert_regex_to_data_reference_template | (
regex_pattern: str,
group_names: List[str],
) | Create a string template based on a regex and corresponding list of group names.
For example:
filepath_template = _invert_regex_to_data_reference_template(
regex_pattern=r"^(.+)_(\d+)_(\d+)\.csv$",
group_names=["name", "timestamp", "price"],
)
filepath_template
... | Create a string template based on a regex and corresponding list of group names. | def _invert_regex_to_data_reference_template(
regex_pattern: str,
group_names: List[str],
) -> str:
"""Create a string template based on a regex and corresponding list of group names.
For example:
filepath_template = _invert_regex_to_data_reference_template(
regex_pattern=r"^(.+)_(... | [
"def",
"_invert_regex_to_data_reference_template",
"(",
"regex_pattern",
":",
"str",
",",
"group_names",
":",
"List",
"[",
"str",
"]",
",",
")",
"->",
"str",
":",
"data_reference_template",
":",
"str",
"=",
"\"\"",
"group_name_index",
":",
"int",
"=",
"0",
"nu... | [
194,
0
] | [
262,
34
] | python | en | ['en', 'en', 'en'] | True |
get_filesystem_one_level_directory_glob_path_list | (
base_directory_path: str, glob_directive: str
) |
List file names, relative to base_directory_path one level deep, with expansion specified by glob_directive.
:param base_directory_path -- base directory path, relative to which file paths will be collected
:param glob_directive -- glob expansion directive
:returns -- list of relative file paths
|
List file names, relative to base_directory_path one level deep, with expansion specified by glob_directive.
:param base_directory_path -- base directory path, relative to which file paths will be collected
:param glob_directive -- glob expansion directive
:returns -- list of relative file paths
| def get_filesystem_one_level_directory_glob_path_list(
base_directory_path: str, glob_directive: str
) -> List[str]:
"""
List file names, relative to base_directory_path one level deep, with expansion specified by glob_directive.
:param base_directory_path -- base directory path, relative to which file ... | [
"def",
"get_filesystem_one_level_directory_glob_path_list",
"(",
"base_directory_path",
":",
"str",
",",
"glob_directive",
":",
"str",
")",
"->",
"List",
"[",
"str",
"]",
":",
"globbed_paths",
"=",
"Path",
"(",
"base_directory_path",
")",
".",
"glob",
"(",
"glob_d... | [
275,
0
] | [
289,
20
] | python | en | ['en', 'error', 'th'] | False |
list_s3_keys | (
s3, query_options: dict, iterator_dict: dict, recursive: bool = False
) |
For InferredAssetS3DataConnector, we take bucket and prefix and search for files using RegEx at and below the level
specified by that bucket and prefix. However, for ConfiguredAssetS3DataConnector, we take bucket and prefix and
search for files using RegEx only at the level specified by that bucket and pr... |
For InferredAssetS3DataConnector, we take bucket and prefix and search for files using RegEx at and below the level
specified by that bucket and prefix. However, for ConfiguredAssetS3DataConnector, we take bucket and prefix and
search for files using RegEx only at the level specified by that bucket and pr... | def list_s3_keys(
s3, query_options: dict, iterator_dict: dict, recursive: bool = False
) -> str:
"""
For InferredAssetS3DataConnector, we take bucket and prefix and search for files using RegEx at and below the level
specified by that bucket and prefix. However, for ConfiguredAssetS3DataConnector, we ... | [
"def",
"list_s3_keys",
"(",
"s3",
",",
"query_options",
":",
"dict",
",",
"iterator_dict",
":",
"dict",
",",
"recursive",
":",
"bool",
"=",
"False",
")",
"->",
"str",
":",
"if",
"iterator_dict",
"is",
"None",
":",
"iterator_dict",
"=",
"{",
"}",
"if",
... | [
292,
0
] | [
350,
47
] | python | en | ['en', 'error', 'th'] | False |
_build_sorter_from_config | (sorter_config: Dict[str, Any]) | Build a Sorter using the provided configuration and return the newly-built Sorter. | Build a Sorter using the provided configuration and return the newly-built Sorter. | def _build_sorter_from_config(sorter_config: Dict[str, Any]) -> Sorter:
"""Build a Sorter using the provided configuration and return the newly-built Sorter."""
runtime_environment: dict = {"name": sorter_config["name"]}
sorter: Sorter = instantiate_class_from_config(
config=sorter_config,
r... | [
"def",
"_build_sorter_from_config",
"(",
"sorter_config",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"Sorter",
":",
"runtime_environment",
":",
"dict",
"=",
"{",
"\"name\"",
":",
"sorter_config",
"[",
"\"name\"",
"]",
"}",
"sorter",
":",
"Sorter",
... | [
372,
0
] | [
382,
17
] | python | en | ['en', 'en', 'en'] | True |
assert_checkpoints | () | Use as a context manager to check that the code inside the ``with``
block either exits with an exception or executes at least one
:ref:`checkpoint <checkpoints>`.
Raises:
AssertionError: if no checkpoint was executed.
Example:
Check that :func:`trio.sleep` is a checkpoint, even if it doesn... | Use as a context manager to check that the code inside the ``with``
block either exits with an exception or executes at least one
:ref:`checkpoint <checkpoints>`. | def assert_checkpoints():
"""Use as a context manager to check that the code inside the ``with``
block either exits with an exception or executes at least one
:ref:`checkpoint <checkpoints>`.
Raises:
AssertionError: if no checkpoint was executed.
Example:
Check that :func:`trio.sleep` ... | [
"def",
"assert_checkpoints",
"(",
")",
":",
"__tracebackhide__",
"=",
"True",
"return",
"_assert_yields_or_not",
"(",
"True",
")"
] | [
24,
0
] | [
41,
38
] | python | en | ['en', 'en', 'en'] | True |
assert_no_checkpoints | () | Use as a context manager to check that the code inside the ``with``
block does not execute any :ref:`checkpoints <checkpoints>`.
Raises:
AssertionError: if a checkpoint was executed.
Example:
Synchronous code never contains any checkpoints, but we can double-check
that::
send_c... | Use as a context manager to check that the code inside the ``with``
block does not execute any :ref:`checkpoints <checkpoints>`. | def assert_no_checkpoints():
"""Use as a context manager to check that the code inside the ``with``
block does not execute any :ref:`checkpoints <checkpoints>`.
Raises:
AssertionError: if a checkpoint was executed.
Example:
Synchronous code never contains any checkpoints, but we can double... | [
"def",
"assert_no_checkpoints",
"(",
")",
":",
"__tracebackhide__",
"=",
"True",
"return",
"_assert_yields_or_not",
"(",
"False",
")"
] | [
44,
0
] | [
61,
39
] | python | en | ['en', 'en', 'en'] | True |
progress | (*futures) | Track progress of dask computation in a remote cluster.
LogProgressBar is defined inside here to avoid having to import
its dependencies if not used.
| Track progress of dask computation in a remote cluster.
LogProgressBar is defined inside here to avoid having to import
its dependencies if not used.
| def progress(*futures):
"""Track progress of dask computation in a remote cluster.
LogProgressBar is defined inside here to avoid having to import
its dependencies if not used.
"""
# Import distributed only when used
from distributed.client import futures_of # pylint: disable=C0415
from dis... | [
"def",
"progress",
"(",
"*",
"futures",
")",
":",
"# Import distributed only when used",
"from",
"distributed",
".",
"client",
"import",
"futures_of",
"# pylint: disable=C0415",
"from",
"distributed",
".",
"diagnostics",
".",
"progressbar",
"import",
"TextProgressBar",
... | [
20,
0
] | [
62,
27
] | python | en | ['en', 'en', 'en'] | True |
get_dataset | (
dataset_type,
data,
schemas=None,
profiler=ColumnsExistProfiler,
caching=True,
table_name=None,
sqlite_db_path=None,
) | Utility to create datasets for json-formatted tests. | Utility to create datasets for json-formatted tests. | def get_dataset(
dataset_type,
data,
schemas=None,
profiler=ColumnsExistProfiler,
caching=True,
table_name=None,
sqlite_db_path=None,
):
"""Utility to create datasets for json-formatted tests."""
df = pd.DataFrame(data)
if dataset_type == "PandasDataset":
if schemas and "... | [
"def",
"get_dataset",
"(",
"dataset_type",
",",
"data",
",",
"schemas",
"=",
"None",
",",
"profiler",
"=",
"ColumnsExistProfiler",
",",
"caching",
"=",
"True",
",",
"table_name",
"=",
"None",
",",
"sqlite_db_path",
"=",
"None",
",",
")",
":",
"df",
"=",
... | [
242,
0
] | [
643,
69
] | python | en | ['en', 'en', 'en'] | True |
get_test_validator_with_data | (
execution_engine,
data,
schemas=None,
profiler=ColumnsExistProfiler,
caching=True,
table_name=None,
sqlite_db_path=None,
) | Utility to create datasets for json-formatted tests. | Utility to create datasets for json-formatted tests. | def get_test_validator_with_data(
execution_engine,
data,
schemas=None,
profiler=ColumnsExistProfiler,
caching=True,
table_name=None,
sqlite_db_path=None,
):
"""Utility to create datasets for json-formatted tests."""
df = pd.DataFrame(data)
if execution_engine == "pandas":
... | [
"def",
"get_test_validator_with_data",
"(",
"execution_engine",
",",
"data",
",",
"schemas",
"=",
"None",
",",
"profiler",
"=",
"ColumnsExistProfiler",
",",
"caching",
"=",
"True",
",",
"table_name",
"=",
"None",
",",
"sqlite_db_path",
"=",
"None",
",",
")",
"... | [
646,
0
] | [
816,
73
] | python | en | ['en', 'en', 'en'] | True |
generate_expectation_tests | (
expectation_type, examples_config, expectation_execution_engines_dict=None
) |
:param expectation_type: snake_case name of the expectation type
:param examples_config: a dictionary that defines the data and test cases for the expectation
:param expectation_execution_engines_dict: (optional) a dictionary that shows which backends/execution engines the
expectation is imple... | def generate_expectation_tests(
expectation_type, examples_config, expectation_execution_engines_dict=None
):
"""
:param expectation_type: snake_case name of the expectation type
:param examples_config: a dictionary that defines the data and test cases for the expectation
:param expectation_executi... | [
"def",
"generate_expectation_tests",
"(",
"expectation_type",
",",
"examples_config",
",",
"expectation_execution_engines_dict",
"=",
"None",
")",
":",
"parametrized_tests",
"=",
"[",
"]",
"# use the expectation_execution_engines_dict (if provided) to request only the appropriate bac... | [
1458,
0
] | [
1739,
29
] | python | en | ['en', 'error', 'th'] | False | |
evaluate_json_test | (data_asset, expectation_type, test) |
This method will evaluate the result of a test build using the Great Expectations json test format.
NOTE: Tests can be suppressed for certain data types if the test contains the Key 'suppress_test_for' with a list
of DataAsset types to suppress, such as ['SQLAlchemy', 'Pandas'].
:param data_asset... |
This method will evaluate the result of a test build using the Great Expectations json test format. | def evaluate_json_test(data_asset, expectation_type, test):
"""
This method will evaluate the result of a test build using the Great Expectations json test format.
NOTE: Tests can be suppressed for certain data types if the test contains the Key 'suppress_test_for' with a list
of DataAsset types to... | [
"def",
"evaluate_json_test",
"(",
"data_asset",
",",
"expectation_type",
",",
"test",
")",
":",
"data_asset",
".",
"set_default_expectation_argument",
"(",
"\"result_format\"",
",",
"\"COMPLETE\"",
")",
"data_asset",
".",
"set_default_expectation_argument",
"(",
"\"includ... | [
1742,
0
] | [
1790,
75
] | python | en | ['en', 'error', 'th'] | False |
evaluate_json_test_cfe | (validator, expectation_type, test) |
This method will evaluate the result of a test build using the Great Expectations json test format.
NOTE: Tests can be suppressed for certain data types if the test contains the Key 'suppress_test_for' with a list
of DataAsset types to suppress, such as ['SQLAlchemy', 'Pandas'].
:param data_asset... |
This method will evaluate the result of a test build using the Great Expectations json test format. | def evaluate_json_test_cfe(validator, expectation_type, test):
"""
This method will evaluate the result of a test build using the Great Expectations json test format.
NOTE: Tests can be suppressed for certain data types if the test contains the Key 'suppress_test_for' with a list
of DataAsset types... | [
"def",
"evaluate_json_test_cfe",
"(",
"validator",
",",
"expectation_type",
",",
"test",
")",
":",
"expectation_suite",
"=",
"ExpectationSuite",
"(",
"\"json_test_suite\"",
")",
"# noinspection PyProtectedMember",
"validator",
".",
"_initialize_expectations",
"(",
"expectat... | [
1793,
0
] | [
1850,
5
] | python | en | ['en', 'error', 'th'] | False |
is_call_invocation | (declaration_string) |
Returns True if `declaration_string` is a function invocation.
:param declaration_string: string that should be checked for pattern.
:type declaration_string: str
:rtype: bool
|
Returns True if `declaration_string` is a function invocation. | def is_call_invocation(declaration_string):
"""
Returns True if `declaration_string` is a function invocation.
:param declaration_string: string that should be checked for pattern.
:type declaration_string: str
:rtype: bool
"""
return __THE_PARSER.has_pattern(declaration_string) | [
"def",
"is_call_invocation",
"(",
"declaration_string",
")",
":",
"return",
"__THE_PARSER",
".",
"has_pattern",
"(",
"declaration_string",
")"
] | [
26,
0
] | [
36,
55
] | python | en | ['en', 'error', 'th'] | False |
name | (declaration_string) |
Returns the name of a function.
:type declaration_string: str
:rtype: str
|
Returns the name of a function. | def name(declaration_string):
"""
Returns the name of a function.
:type declaration_string: str
:rtype: str
"""
return __THE_PARSER.name(declaration_string) | [
"def",
"name",
"(",
"declaration_string",
")",
":",
"return",
"__THE_PARSER",
".",
"name",
"(",
"declaration_string",
")"
] | [
39,
0
] | [
47,
48
] | python | en | ['en', 'error', 'th'] | False |
args | (declaration_string) |
Returns list of function arguments
:type declaration_string: str
:rtype: [str]
|
Returns list of function arguments | def args(declaration_string):
"""
Returns list of function arguments
:type declaration_string: str
:rtype: [str]
"""
return __THE_PARSER.args(declaration_string) | [
"def",
"args",
"(",
"declaration_string",
")",
":",
"return",
"__THE_PARSER",
".",
"args",
"(",
"declaration_string",
")"
] | [
50,
0
] | [
58,
48
] | python | en | ['en', 'error', 'th'] | False |
find_args | (text, start=None) |
Finds arguments within function invocation.
:type text: str
:rtype: [ arguments ] or :data:NOT_FOUND if arguments could not be found.
|
Finds arguments within function invocation. | def find_args(text, start=None):
"""
Finds arguments within function invocation.
:type text: str
:rtype: [ arguments ] or :data:NOT_FOUND if arguments could not be found.
"""
return __THE_PARSER.find_args(text, start) | [
"def",
"find_args",
"(",
"text",
",",
"start",
"=",
"None",
")",
":",
"return",
"__THE_PARSER",
".",
"find_args",
"(",
"text",
",",
"start",
")"
] | [
64,
0
] | [
72,
46
] | python | en | ['en', 'error', 'th'] | False |
split | (declaration_string) |
Returns (name, [arguments] )
|
Returns (name, [arguments] ) | def split(declaration_string):
"""
Returns (name, [arguments] )
"""
return __THE_PARSER.split(declaration_string) | [
"def",
"split",
"(",
"declaration_string",
")",
":",
"return",
"__THE_PARSER",
".",
"split",
"(",
"declaration_string",
")"
] | [
75,
0
] | [
80,
49
] | python | en | ['en', 'error', 'th'] | False |
split_recursive | (declaration_string) |
Returns [(name, [arguments])].
|
Returns [(name, [arguments])]. | def split_recursive(declaration_string):
"""
Returns [(name, [arguments])].
"""
return __THE_PARSER.split_recursive(declaration_string) | [
"def",
"split_recursive",
"(",
"declaration_string",
")",
":",
"return",
"__THE_PARSER",
".",
"split_recursive",
"(",
"declaration_string",
")"
] | [
83,
0
] | [
88,
59
] | python | en | ['en', 'error', 'th'] | False |
join | (name_, args_, arg_separator=None) |
Returns name( argument_1, argument_2, ..., argument_n ).
|
Returns name( argument_1, argument_2, ..., argument_n ). | def join(name_, args_, arg_separator=None):
"""
Returns name( argument_1, argument_2, ..., argument_n ).
"""
return __THE_PARSER.join(name_, args_, arg_separator) | [
"def",
"join",
"(",
"name_",
",",
"args_",
",",
"arg_separator",
"=",
"None",
")",
":",
"return",
"__THE_PARSER",
".",
"join",
"(",
"name_",
",",
"args_",
",",
"arg_separator",
")"
] | [
91,
0
] | [
96,
57
] | python | en | ['en', 'error', 'th'] | False |
MakeGuid | (name, seed='msvs_new') | Returns a GUID for the specified target name.
Args:
name: Target name.
seed: Seed for MD5 hash.
Returns:
A GUID-line string calculated from the name and seed.
This generates something which looks like a GUID, but depends only on the
name and seed. This means the same name/seed will always generat... | Returns a GUID for the specified target name. | def MakeGuid(name, seed='msvs_new'):
"""Returns a GUID for the specified target name.
Args:
name: Target name.
seed: Seed for MD5 hash.
Returns:
A GUID-line string calculated from the name and seed.
This generates something which looks like a GUID, but depends only on the
name and seed. This me... | [
"def",
"MakeGuid",
"(",
"name",
",",
"seed",
"=",
"'msvs_new'",
")",
":",
"# Calculate a MD5 signature for the seed and name.",
"d",
"=",
"_new_md5",
"(",
"str",
"(",
"seed",
")",
"+",
"str",
"(",
"name",
")",
")",
".",
"hexdigest",
"(",
")",
".",
"upper",... | [
36,
0
] | [
56,
13
] | python | en | ['en', 'en', 'en'] | True |
MSVSFolder.__init__ | (self, path, name = None, entries = None,
guid = None, items = None) | Initializes the folder.
Args:
path: Full path to the folder.
name: Name of the folder.
entries: List of folder entries to nest inside this folder. May contain
Folder or Project objects. May be None, if the folder is empty.
guid: GUID to use for folder, if not None.
items: ... | Initializes the folder. | def __init__(self, path, name = None, entries = None,
guid = None, items = None):
"""Initializes the folder.
Args:
path: Full path to the folder.
name: Name of the folder.
entries: List of folder entries to nest inside this folder. May contain
Folder or Project objec... | [
"def",
"__init__",
"(",
"self",
",",
"path",
",",
"name",
"=",
"None",
",",
"entries",
"=",
"None",
",",
"guid",
"=",
"None",
",",
"items",
"=",
"None",
")",
":",
"if",
"name",
":",
"self",
".",
"name",
"=",
"name",
"else",
":",
"# Use last layer."... | [
70,
2
] | [
96,
53
] | python | en | ['en', 'zu', 'en'] | True |
MSVSProject.__init__ | (self, path, name = None, dependencies = None, guid = None,
spec = None, build_file = None, config_platform_overrides = None,
fixpath_prefix = None) | Initializes the project.
Args:
path: Absolute path to the project file.
name: Name of project. If None, the name will be the same as the base
name of the project file.
dependencies: List of other Project objects this project is dependent
upon, if not None.
guid: GUID to... | Initializes the project. | def __init__(self, path, name = None, dependencies = None, guid = None,
spec = None, build_file = None, config_platform_overrides = None,
fixpath_prefix = None):
"""Initializes the project.
Args:
path: Absolute path to the project file.
name: Name of project. If None,... | [
"def",
"__init__",
"(",
"self",
",",
"path",
",",
"name",
"=",
"None",
",",
"dependencies",
"=",
"None",
",",
"guid",
"=",
"None",
",",
"spec",
"=",
"None",
",",
"build_file",
"=",
"None",
",",
"config_platform_overrides",
"=",
"None",
",",
"fixpath_pref... | [
111,
2
] | [
146,
31
] | python | en | ['en', 'en', 'en'] | True |
MSVSSolution.__init__ | (self, path, version, entries=None, variants=None,
websiteProperties=True) | Initializes the solution.
Args:
path: Path to solution file.
version: Format version to emit.
entries: List of entries in solution. May contain Folder or Project
objects. May be None, if the folder is empty.
variants: List of build variant strings. If none, a default list will
... | Initializes the solution. | def __init__(self, path, version, entries=None, variants=None,
websiteProperties=True):
"""Initializes the solution.
Args:
path: Path to solution file.
version: Format version to emit.
entries: List of entries in solution. May contain Folder or Project
objects. May ... | [
"def",
"__init__",
"(",
"self",
",",
"path",
",",
"version",
",",
"entries",
"=",
"None",
",",
"variants",
"=",
"None",
",",
"websiteProperties",
"=",
"True",
")",
":",
"self",
".",
"path",
"=",
"path",
"self",
".",
"websiteProperties",
"=",
"websiteProp... | [
177,
2
] | [
212,
16
] | python | en | ['en', 'en', 'en'] | True |
MSVSSolution.Write | (self, writer=gyp.common.WriteOnDiff) | Writes the solution file to disk.
Raises:
IndexError: An entry appears multiple times.
| Writes the solution file to disk. | def Write(self, writer=gyp.common.WriteOnDiff):
"""Writes the solution file to disk.
Raises:
IndexError: An entry appears multiple times.
"""
# Walk the entry tree and collect all the folders and projects.
all_entries = set()
entries_to_check = self.entries[:]
while entries_to_check:
... | [
"def",
"Write",
"(",
"self",
",",
"writer",
"=",
"gyp",
".",
"common",
".",
"WriteOnDiff",
")",
":",
"# Walk the entry tree and collect all the folders and projects.",
"all_entries",
"=",
"set",
"(",
")",
"entries_to_check",
"=",
"self",
".",
"entries",
"[",
":",
... | [
215,
2
] | [
339,
13
] | python | en | ['en', 'en', 'en'] | True |
metric_value | (
engine: Type[ExecutionEngine],
metric_fn_type: Union[str, MetricFunctionTypes] = MetricFunctionTypes.VALUE,
**kwargs
) | The metric decorator annotates a method | The metric decorator annotates a method | def metric_value(
engine: Type[ExecutionEngine],
metric_fn_type: Union[str, MetricFunctionTypes] = MetricFunctionTypes.VALUE,
**kwargs
):
"""The metric decorator annotates a method"""
def wrapper(metric_fn: Callable):
@wraps(metric_fn)
def inner_func(*args, **kwargs):
re... | [
"def",
"metric_value",
"(",
"engine",
":",
"Type",
"[",
"ExecutionEngine",
"]",
",",
"metric_fn_type",
":",
"Union",
"[",
"str",
",",
"MetricFunctionTypes",
"]",
"=",
"MetricFunctionTypes",
".",
"VALUE",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"wrapper",
... | [
25,
0
] | [
42,
18
] | python | en | ['en', 'en', 'en'] | True |
metric_partial | (
engine: Type[ExecutionEngine],
partial_fn_type: Union[str, MetricPartialFunctionTypes],
domain_type: Union[str, MetricDomainTypes],
**kwargs
) | The metric decorator annotates a method | The metric decorator annotates a method | def metric_partial(
engine: Type[ExecutionEngine],
partial_fn_type: Union[str, MetricPartialFunctionTypes],
domain_type: Union[str, MetricDomainTypes],
**kwargs
):
"""The metric decorator annotates a method"""
def wrapper(metric_fn: Callable):
@wraps(metric_fn)
def inner_func(*a... | [
"def",
"metric_partial",
"(",
"engine",
":",
"Type",
"[",
"ExecutionEngine",
"]",
",",
"partial_fn_type",
":",
"Union",
"[",
"str",
",",
"MetricPartialFunctionTypes",
"]",
",",
"domain_type",
":",
"Union",
"[",
"str",
",",
"MetricDomainTypes",
"]",
",",
"*",
... | [
45,
0
] | [
66,
18
] | python | en | ['en', 'en', 'en'] | True |
MetricProvider.get_evaluation_dependencies | (
cls,
metric: MetricConfiguration,
configuration: Optional[ExpectationConfiguration] = None,
execution_engine: Optional[ExecutionEngine] = None,
runtime_configuration: Optional[dict] = None,
) | This should return a dictionary:
{
"dependency_name": MetricConfiguration,
...
}
| This should return a dictionary: | def get_evaluation_dependencies(
cls,
metric: MetricConfiguration,
configuration: Optional[ExpectationConfiguration] = None,
execution_engine: Optional[ExecutionEngine] = None,
runtime_configuration: Optional[dict] = None,
):
"""This should return a dictionary:
... | [
"def",
"get_evaluation_dependencies",
"(",
"cls",
",",
"metric",
":",
"MetricConfiguration",
",",
"configuration",
":",
"Optional",
"[",
"ExpectationConfiguration",
"]",
"=",
"None",
",",
"execution_engine",
":",
"Optional",
"[",
"ExecutionEngine",
"]",
"=",
"None",... | [
180,
4
] | [
202,
9
] | python | en | ['en', 'en', 'en'] | True |
test_requirements_files | () | requirements.txt should be a subset of requirements-dev.txt | requirements.txt should be a subset of requirements-dev.txt | def test_requirements_files():
"""requirements.txt should be a subset of requirements-dev.txt"""
with open(file_relative_path(__file__, "../requirements.txt")) as req:
requirements = {
f'{line.name}{"".join(line.specs[0])}' for line in rp.parse(req)
}
with open(file_relative_pa... | [
"def",
"test_requirements_files",
"(",
")",
":",
"with",
"open",
"(",
"file_relative_path",
"(",
"__file__",
",",
"\"../requirements.txt\"",
")",
")",
"as",
"req",
":",
"requirements",
"=",
"{",
"f'{line.name}{\"\".join(line.specs[0])}'",
"for",
"line",
"in",
"rp",
... | [
5,
0
] | [
47,
42
] | python | en | ['en', 'en', 'en'] | True |
Sourceify | (path) | Convert a path to its source directory form. The Android backend does not
support options.generator_output, so this function is a noop. | Convert a path to its source directory form. The Android backend does not
support options.generator_output, so this function is a noop. | def Sourceify(path):
"""Convert a path to its source directory form. The Android backend does not
support options.generator_output, so this function is a noop."""
return path | [
"def",
"Sourceify",
"(",
"path",
")",
":",
"return",
"path"
] | [
82,
0
] | [
85,
13
] | python | en | ['en', 'en', 'en'] | True |
AndroidMkWriter.Write | (self, qualified_target, relative_target, base_path, output_filename,
spec, configs, part_of_all, write_alias_target, sdk_version) | The main entry point: writes a .mk file for a single target.
Arguments:
qualified_target: target we're generating
relative_target: qualified target name relative to the root
base_path: path relative to source root we're building in, used to resolve
target-relative paths
out... | The main entry point: writes a .mk file for a single target. | def Write(self, qualified_target, relative_target, base_path, output_filename,
spec, configs, part_of_all, write_alias_target, sdk_version):
"""The main entry point: writes a .mk file for a single target.
Arguments:
qualified_target: target we're generating
relative_target: qualified ta... | [
"def",
"Write",
"(",
"self",
",",
"qualified_target",
",",
"relative_target",
",",
"base_path",
",",
"output_filename",
",",
"spec",
",",
"configs",
",",
"part_of_all",
",",
"write_alias_target",
",",
"sdk_version",
")",
":",
"gyp",
".",
"common",
".",
"Ensure... | [
109,
2
] | [
228,
30
] | python | en | ['en', 'en', 'en'] | True |
AndroidMkWriter.WriteActions | (self, actions, extra_sources, extra_outputs) | Write Makefile code for any 'actions' from the gyp input.
extra_sources: a list that will be filled in with newly generated source
files, if any
extra_outputs: a list that will be filled in with any outputs of these
actions (used to make other pieces dependent on these
... | Write Makefile code for any 'actions' from the gyp input. | def WriteActions(self, actions, extra_sources, extra_outputs):
"""Write Makefile code for any 'actions' from the gyp input.
extra_sources: a list that will be filled in with newly generated source
files, if any
extra_outputs: a list that will be filled in with any outputs of these
... | [
"def",
"WriteActions",
"(",
"self",
",",
"actions",
",",
"extra_sources",
",",
"extra_outputs",
")",
":",
"for",
"action",
"in",
"actions",
":",
"name",
"=",
"make",
".",
"StringToMakefileVariable",
"(",
"'%s_%s'",
"%",
"(",
"self",
".",
"relative_target",
"... | [
231,
2
] | [
322,
18
] | python | en | ['en', 'en', 'en'] | True |
AndroidMkWriter.WriteRules | (self, rules, extra_sources, extra_outputs) | Write Makefile code for any 'rules' from the gyp input.
extra_sources: a list that will be filled in with newly generated source
files, if any
extra_outputs: a list that will be filled in with any outputs of these
rules (used to make other pieces dependent on these rules)
... | Write Makefile code for any 'rules' from the gyp input. | def WriteRules(self, rules, extra_sources, extra_outputs):
"""Write Makefile code for any 'rules' from the gyp input.
extra_sources: a list that will be filled in with newly generated source
files, if any
extra_outputs: a list that will be filled in with any outputs of these
... | [
"def",
"WriteRules",
"(",
"self",
",",
"rules",
",",
"extra_sources",
",",
"extra_outputs",
")",
":",
"if",
"len",
"(",
"rules",
")",
"==",
"0",
":",
"return",
"for",
"rule",
"in",
"rules",
":",
"if",
"len",
"(",
"rule",
".",
"get",
"(",
"'rule_sourc... | [
325,
2
] | [
410,
18
] | python | en | ['en', 'en', 'en'] | True |
AndroidMkWriter.WriteCopies | (self, copies, extra_outputs) | Write Makefile code for any 'copies' from the gyp input.
extra_outputs: a list that will be filled in with any outputs of this action
(used to make other pieces dependent on this action)
| Write Makefile code for any 'copies' from the gyp input. | def WriteCopies(self, copies, extra_outputs):
"""Write Makefile code for any 'copies' from the gyp input.
extra_outputs: a list that will be filled in with any outputs of this action
(used to make other pieces dependent on this action)
"""
self.WriteLn('### Generated for copy rule.')... | [
"def",
"WriteCopies",
"(",
"self",
",",
"copies",
",",
"extra_outputs",
")",
":",
"self",
".",
"WriteLn",
"(",
"'### Generated for copy rule.'",
")",
"variable",
"=",
"make",
".",
"StringToMakefileVariable",
"(",
"self",
".",
"relative_target",
"+",
"'_copies'",
... | [
413,
2
] | [
450,
18
] | python | en | ['en', 'en', 'en'] | True |
AndroidMkWriter.WriteSourceFlags | (self, spec, configs) | Write out the flags and include paths used to compile source files for
the current target.
Args:
spec, configs: input from gyp.
| Write out the flags and include paths used to compile source files for
the current target. | def WriteSourceFlags(self, spec, configs):
"""Write out the flags and include paths used to compile source files for
the current target.
Args:
spec, configs: input from gyp.
"""
for configname, config in sorted(configs.iteritems()):
extracted_includes = []
self.WriteLn('\n# Flags... | [
"def",
"WriteSourceFlags",
"(",
"self",
",",
"spec",
",",
"configs",
")",
":",
"for",
"configname",
",",
"config",
"in",
"sorted",
"(",
"configs",
".",
"iteritems",
"(",
")",
")",
":",
"extracted_includes",
"=",
"[",
"]",
"self",
".",
"WriteLn",
"(",
"... | [
453,
2
] | [
495,
52
] | python | en | ['en', 'en', 'en'] | True |
AndroidMkWriter.WriteSources | (self, spec, configs, extra_sources) | Write Makefile code for any 'sources' from the gyp input.
These are source files necessary to build the current target.
We need to handle shared_intermediate directory source files as
a special case by copying them to the intermediate directory and
treating them as a genereated sources. Otherwise the An... | Write Makefile code for any 'sources' from the gyp input.
These are source files necessary to build the current target.
We need to handle shared_intermediate directory source files as
a special case by copying them to the intermediate directory and
treating them as a genereated sources. Otherwise the An... | def WriteSources(self, spec, configs, extra_sources):
"""Write Makefile code for any 'sources' from the gyp input.
These are source files necessary to build the current target.
We need to handle shared_intermediate directory source files as
a special case by copying them to the intermediate directory an... | [
"def",
"WriteSources",
"(",
"self",
",",
"spec",
",",
"configs",
",",
"extra_sources",
")",
":",
"sources",
"=",
"filter",
"(",
"make",
".",
"Compilable",
",",
"spec",
".",
"get",
"(",
"'sources'",
",",
"[",
"]",
")",
")",
"generated_not_sources",
"=",
... | [
498,
2
] | [
581,
40
] | python | en | ['en', 'en', 'en'] | True |
AndroidMkWriter.ComputeAndroidModule | (self, spec) | Return the Android module name used for a gyp spec.
We use the complete qualified target name to avoid collisions between
duplicate targets in different directories. We also add a suffix to
distinguish gyp-generated module names.
| Return the Android module name used for a gyp spec. | def ComputeAndroidModule(self, spec):
"""Return the Android module name used for a gyp spec.
We use the complete qualified target name to avoid collisions between
duplicate targets in different directories. We also add a suffix to
distinguish gyp-generated module names.
"""
if int(spec.get('an... | [
"def",
"ComputeAndroidModule",
"(",
"self",
",",
"spec",
")",
":",
"if",
"int",
"(",
"spec",
".",
"get",
"(",
"'android_unmangled_name'",
",",
"0",
")",
")",
":",
"assert",
"self",
".",
"type",
"!=",
"'shared_library'",
"or",
"self",
".",
"target",
".",
... | [
584,
2
] | [
613,
44
] | python | en | ['en', 'en', 'en'] | True |
AndroidMkWriter.ComputeOutputParts | (self, spec) | Return the 'output basename' of a gyp spec, split into filename + ext.
Android libraries must be named the same thing as their module name,
otherwise the linker can't find them, so product_name and so on must be
ignored if we are building a library, and the "lib" prepending is
not done for Android.
... | Return the 'output basename' of a gyp spec, split into filename + ext. | def ComputeOutputParts(self, spec):
"""Return the 'output basename' of a gyp spec, split into filename + ext.
Android libraries must be named the same thing as their module name,
otherwise the linker can't find them, so product_name and so on must be
ignored if we are building a library, and the "lib" ... | [
"def",
"ComputeOutputParts",
"(",
"self",
",",
"spec",
")",
":",
"assert",
"self",
".",
"type",
"!=",
"'loadable_module'",
"# TODO: not supported?",
"target",
"=",
"spec",
"[",
"'target_name'",
"]",
"target_prefix",
"=",
"''",
"target_ext",
"=",
"''",
"if",
"s... | [
616,
2
] | [
649,
36
] | python | en | ['en', 'en', 'en'] | True |
AndroidMkWriter.ComputeOutputBasename | (self, spec) | Return the 'output basename' of a gyp spec.
E.g., the loadable module 'foobar' in directory 'baz' will produce
'libfoobar.so'
| Return the 'output basename' of a gyp spec. | def ComputeOutputBasename(self, spec):
"""Return the 'output basename' of a gyp spec.
E.g., the loadable module 'foobar' in directory 'baz' will produce
'libfoobar.so'
"""
return ''.join(self.ComputeOutputParts(spec)) | [
"def",
"ComputeOutputBasename",
"(",
"self",
",",
"spec",
")",
":",
"return",
"''",
".",
"join",
"(",
"self",
".",
"ComputeOutputParts",
"(",
"spec",
")",
")"
] | [
652,
2
] | [
658,
49
] | python | en | ['en', 'haw', 'en'] | True |
AndroidMkWriter.ComputeOutput | (self, spec) | Return the 'output' (full output path) of a gyp spec.
E.g., the loadable module 'foobar' in directory 'baz' will produce
'$(obj)/baz/libfoobar.so'
| Return the 'output' (full output path) of a gyp spec. | def ComputeOutput(self, spec):
"""Return the 'output' (full output path) of a gyp spec.
E.g., the loadable module 'foobar' in directory 'baz' will produce
'$(obj)/baz/libfoobar.so'
"""
if self.type == 'executable':
# We install host executables into shared_intermediate_dir so they can be
... | [
"def",
"ComputeOutput",
"(",
"self",
",",
"spec",
")",
":",
"if",
"self",
".",
"type",
"==",
"'executable'",
":",
"# We install host executables into shared_intermediate_dir so they can be",
"# run by gyp rules that refer to PRODUCT_DIR.",
"path",
"=",
"'$(gyp_shared_intermedia... | [
661,
2
] | [
687,
63
] | python | en | ['en', 'en', 'en'] | True |
AndroidMkWriter.NormalizeIncludePaths | (self, include_paths) | Normalize include_paths.
Convert absolute paths to relative to the Android top directory.
Args:
include_paths: A list of unprocessed include paths.
Returns:
A list of normalized include paths.
| Normalize include_paths.
Convert absolute paths to relative to the Android top directory. | def NormalizeIncludePaths(self, include_paths):
""" Normalize include_paths.
Convert absolute paths to relative to the Android top directory.
Args:
include_paths: A list of unprocessed include paths.
Returns:
A list of normalized include paths.
"""
normalized = []
for path in in... | [
"def",
"NormalizeIncludePaths",
"(",
"self",
",",
"include_paths",
")",
":",
"normalized",
"=",
"[",
"]",
"for",
"path",
"in",
"include_paths",
":",
"if",
"path",
"[",
"0",
"]",
"==",
"'/'",
":",
"path",
"=",
"gyp",
".",
"common",
".",
"RelativePath",
... | [
689,
2
] | [
703,
21
] | python | en | ['en', 'en', 'en'] | False |
AndroidMkWriter.ExtractIncludesFromCFlags | (self, cflags) | Extract includes "-I..." out from cflags
Args:
cflags: A list of compiler flags, which may be mixed with "-I.."
Returns:
A tuple of lists: (clean_clfags, include_paths). "-I.." is trimmed.
| Extract includes "-I..." out from cflags | def ExtractIncludesFromCFlags(self, cflags):
"""Extract includes "-I..." out from cflags
Args:
cflags: A list of compiler flags, which may be mixed with "-I.."
Returns:
A tuple of lists: (clean_clfags, include_paths). "-I.." is trimmed.
"""
clean_cflags = []
include_paths = []
f... | [
"def",
"ExtractIncludesFromCFlags",
"(",
"self",
",",
"cflags",
")",
":",
"clean_cflags",
"=",
"[",
"]",
"include_paths",
"=",
"[",
"]",
"for",
"flag",
"in",
"cflags",
":",
"if",
"flag",
".",
"startswith",
"(",
"'-I'",
")",
":",
"include_paths",
".",
"ap... | [
705,
2
] | [
721,
40
] | python | en | ['en', 'en', 'en'] | True |
AndroidMkWriter.FilterLibraries | (self, libraries) | Filter the 'libraries' key to separate things that shouldn't be ldflags.
Library entries that look like filenames should be converted to android
module names instead of being passed to the linker as flags.
Args:
libraries: the value of spec.get('libraries')
Returns:
A tuple (static_lib_mod... | Filter the 'libraries' key to separate things that shouldn't be ldflags. | def FilterLibraries(self, libraries):
"""Filter the 'libraries' key to separate things that shouldn't be ldflags.
Library entries that look like filenames should be converted to android
module names instead of being passed to the linker as flags.
Args:
libraries: the value of spec.get('libraries... | [
"def",
"FilterLibraries",
"(",
"self",
",",
"libraries",
")",
":",
"static_lib_modules",
"=",
"[",
"]",
"dynamic_lib_modules",
"=",
"[",
"]",
"ldflags",
"=",
"[",
"]",
"for",
"libs",
"in",
"libraries",
":",
"# Libs can have multiple words.",
"for",
"lib",
"in"... | [
723,
2
] | [
755,
61
] | python | en | ['en', 'en', 'en'] | True |
AndroidMkWriter.ComputeDeps | (self, spec) | Compute the dependencies of a gyp spec.
Returns a tuple (deps, link_deps), where each is a list of
filenames that will need to be put in front of make for either
building (deps) or linking (link_deps).
| Compute the dependencies of a gyp spec. | def ComputeDeps(self, spec):
"""Compute the dependencies of a gyp spec.
Returns a tuple (deps, link_deps), where each is a list of
filenames that will need to be put in front of make for either
building (deps) or linking (link_deps).
"""
deps = []
link_deps = []
if 'dependencies' in spe... | [
"def",
"ComputeDeps",
"(",
"self",
",",
"spec",
")",
":",
"deps",
"=",
"[",
"]",
"link_deps",
"=",
"[",
"]",
"if",
"'dependencies'",
"in",
"spec",
":",
"deps",
".",
"extend",
"(",
"[",
"target_outputs",
"[",
"dep",
"]",
"for",
"dep",
"in",
"spec",
... | [
758,
2
] | [
774,
68
] | python | en | ['en', 'en', 'en'] | True |
AndroidMkWriter.WriteTargetFlags | (self, spec, configs, link_deps) | Write Makefile code to specify the link flags and library dependencies.
spec, configs: input from gyp.
link_deps: link dependency list; see ComputeDeps()
| Write Makefile code to specify the link flags and library dependencies. | def WriteTargetFlags(self, spec, configs, link_deps):
"""Write Makefile code to specify the link flags and library dependencies.
spec, configs: input from gyp.
link_deps: link dependency list; see ComputeDeps()
"""
# Libraries (i.e. -lfoo)
# These must be included even for static libraries as s... | [
"def",
"WriteTargetFlags",
"(",
"self",
",",
"spec",
",",
"configs",
",",
"link_deps",
")",
":",
"# Libraries (i.e. -lfoo)",
"# These must be included even for static libraries as some of them provide",
"# implicit include paths through the build system.",
"libraries",
"=",
"gyp",
... | [
777,
2
] | [
818,
46
] | python | en | ['en', 'en', 'en'] | True |
AndroidMkWriter.WriteTarget | (self, spec, configs, deps, link_deps, part_of_all,
write_alias_target) | Write Makefile code to produce the final target of the gyp spec.
spec, configs: input from gyp.
deps, link_deps: dependency lists; see ComputeDeps()
part_of_all: flag indicating this target is part of 'all'
write_alias_target: flag indicating whether to create short aliases for this
... | Write Makefile code to produce the final target of the gyp spec. | def WriteTarget(self, spec, configs, deps, link_deps, part_of_all,
write_alias_target):
"""Write Makefile code to produce the final target of the gyp spec.
spec, configs: input from gyp.
deps, link_deps: dependency lists; see ComputeDeps()
part_of_all: flag indicating this target is p... | [
"def",
"WriteTarget",
"(",
"self",
",",
"spec",
",",
"configs",
",",
"deps",
",",
"link_deps",
",",
"part_of_all",
",",
"write_alias_target",
")",
":",
"self",
".",
"WriteLn",
"(",
"'### Rules for final target.'",
")",
"if",
"self",
".",
"type",
"!=",
"'none... | [
821,
2
] | [
897,
50
] | python | en | ['en', 'en', 'en'] | True |
AndroidMkWriter.WriteList | (self, value_list, variable=None, prefix='',
quoter=make.QuoteIfNecessary, local_pathify=False) | Write a variable definition that is a list of values.
E.g. WriteList(['a','b'], 'foo', prefix='blah') writes out
foo = blaha blahb
but in a pretty-printed style.
| Write a variable definition that is a list of values. | def WriteList(self, value_list, variable=None, prefix='',
quoter=make.QuoteIfNecessary, local_pathify=False):
"""Write a variable definition that is a list of values.
E.g. WriteList(['a','b'], 'foo', prefix='blah') writes out
foo = blaha blahb
but in a pretty-printed style.
"""... | [
"def",
"WriteList",
"(",
"self",
",",
"value_list",
",",
"variable",
"=",
"None",
",",
"prefix",
"=",
"''",
",",
"quoter",
"=",
"make",
".",
"QuoteIfNecessary",
",",
"local_pathify",
"=",
"False",
")",
":",
"values",
"=",
"''",
"if",
"value_list",
":",
... | [
900,
2
] | [
914,
53
] | python | en | ['en', 'en', 'en'] | True |
AndroidMkWriter.LocalPathify | (self, path) | Convert a subdirectory-relative path into a normalized path which starts
with the make variable $(LOCAL_PATH) (i.e. the top of the project tree).
Absolute paths, or paths that contain variables, are just normalized. | Convert a subdirectory-relative path into a normalized path which starts
with the make variable $(LOCAL_PATH) (i.e. the top of the project tree).
Absolute paths, or paths that contain variables, are just normalized. | def LocalPathify(self, path):
"""Convert a subdirectory-relative path into a normalized path which starts
with the make variable $(LOCAL_PATH) (i.e. the top of the project tree).
Absolute paths, or paths that contain variables, are just normalized."""
if '$(' in path or os.path.isabs(path):
# path... | [
"def",
"LocalPathify",
"(",
"self",
",",
"path",
")",
":",
"if",
"'$('",
"in",
"path",
"or",
"os",
".",
"path",
".",
"isabs",
"(",
"path",
")",
":",
"# path is not a file in the project tree in this case, but calling",
"# normpath is still important for trimming trailin... | [
921,
2
] | [
937,
21
] | python | en | ['en', 'en', 'en'] | True |
ExpectColumnValuesToBeNormallyDistributed.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",
... | [
233,
4
] | [
245,
85
] | python | en | ['en', 'error', 'th'] | False |
patch_unittest_diff | (test_filter=None) |
Patches "assertEquals" to throw DiffError.
@:param test_filter callback to check each test. If not None it should return True to test or EqualsAssertionError will be skipped
|
Patches "assertEquals" to throw DiffError. | def patch_unittest_diff(test_filter=None):
"""
Patches "assertEquals" to throw DiffError.
@:param test_filter callback to check each test. If not None it should return True to test or EqualsAssertionError will be skipped
"""
if sys.version_info < (2, 7):
return
old = unittest.TestCase.a... | [
"def",
"patch_unittest_diff",
"(",
"test_filter",
"=",
"None",
")",
":",
"if",
"sys",
".",
"version_info",
"<",
"(",
"2",
",",
"7",
")",
":",
"return",
"old",
"=",
"unittest",
".",
"TestCase",
".",
"assertEqual",
"def",
"_patched_equals",
"(",
"self",
",... | [
19,
0
] | [
41,
51
] | python | en | ['en', 'error', 'th'] | False |
Field.get_value | (self, obj, attr, accessor=None, default=missing_) | Return the value for a given key from an object.
:param object obj: The object to get the value from.
:param str attr: The attribute/key in `obj` to get the value from.
:param callable accessor: A callable used to retrieve the value of `attr` from
the object `obj`. Defaults to `mars... | Return the value for a given key from an object. | def get_value(self, obj, attr, accessor=None, default=missing_):
"""Return the value for a given key from an object.
:param object obj: The object to get the value from.
:param str attr: The attribute/key in `obj` to get the value from.
:param callable accessor: A callable used to retri... | [
"def",
"get_value",
"(",
"self",
",",
"obj",
",",
"attr",
",",
"accessor",
"=",
"None",
",",
"default",
"=",
"missing_",
")",
":",
"# NOTE: Use getattr instead of direct attribute access here so that",
"# subclasses aren't required to define `attribute` member",
"attribute",
... | [
206,
4
] | [
219,
53
] | python | en | ['en', 'en', 'en'] | True |
Field._validate | (self, value) | Perform validation on ``value``. Raise a :exc:`ValidationError` if validation
does not succeed.
| Perform validation on ``value``. Raise a :exc:`ValidationError` if validation
does not succeed.
| def _validate(self, value):
"""Perform validation on ``value``. Raise a :exc:`ValidationError` if validation
does not succeed.
"""
errors = []
kwargs = {}
for validator in self.validators:
try:
r = validator(value)
if not isinst... | [
"def",
"_validate",
"(",
"self",
",",
"value",
")",
":",
"errors",
"=",
"[",
"]",
"kwargs",
"=",
"{",
"}",
"for",
"validator",
"in",
"self",
".",
"validators",
":",
"try",
":",
"r",
"=",
"validator",
"(",
"value",
")",
"if",
"not",
"isinstance",
"(... | [
221,
4
] | [
239,
51
] | python | en | ['en', 'ky', 'en'] | True |
Field.make_error | (self, key: str, **kwargs) | Helper method to make a `ValidationError` with an error message
from ``self.error_messages``.
| Helper method to make a `ValidationError` with an error message
from ``self.error_messages``.
| def make_error(self, key: str, **kwargs) -> ValidationError:
"""Helper method to make a `ValidationError` with an error message
from ``self.error_messages``.
"""
try:
msg = self.error_messages[key]
except KeyError as error:
class_name = self.__class__.__na... | [
"def",
"make_error",
"(",
"self",
",",
"key",
":",
"str",
",",
"*",
"*",
"kwargs",
")",
"->",
"ValidationError",
":",
"try",
":",
"msg",
"=",
"self",
".",
"error_messages",
"[",
"key",
"]",
"except",
"KeyError",
"as",
"error",
":",
"class_name",
"=",
... | [
241,
4
] | [
256,
35
] | python | en | ['en', 'de', 'en'] | True |
Field.fail | (self, key: str, **kwargs) | Helper method that raises a `ValidationError` with an error message
from ``self.error_messages``.
.. deprecated:: 3.0.0
Use `make_error <marshmallow.fields.Field.make_error>` instead.
| Helper method that raises a `ValidationError` with an error message
from ``self.error_messages``. | def fail(self, key: str, **kwargs):
"""Helper method that raises a `ValidationError` with an error message
from ``self.error_messages``.
.. deprecated:: 3.0.0
Use `make_error <marshmallow.fields.Field.make_error>` instead.
"""
warnings.warn(
'`Field.fail`... | [
"def",
"fail",
"(",
"self",
",",
"key",
":",
"str",
",",
"*",
"*",
"kwargs",
")",
":",
"warnings",
".",
"warn",
"(",
"'`Field.fail` is deprecated. Use `raise self.make_error(\"{}\", ...)` instead.'",
".",
"format",
"(",
"key",
")",
",",
"RemovedInMarshmallow4Warning... | [
258,
4
] | [
271,
48
] | python | en | ['en', 'de', 'en'] | True |
Field._validate_missing | (self, value) | Validate missing values. Raise a :exc:`ValidationError` if
`value` should be considered missing.
| Validate missing values. Raise a :exc:`ValidationError` if
`value` should be considered missing.
| def _validate_missing(self, value):
"""Validate missing values. Raise a :exc:`ValidationError` if
`value` should be considered missing.
"""
if value is missing_:
if hasattr(self, "required") and self.required:
raise self.make_error("required")
if value... | [
"def",
"_validate_missing",
"(",
"self",
",",
"value",
")",
":",
"if",
"value",
"is",
"missing_",
":",
"if",
"hasattr",
"(",
"self",
",",
"\"required\"",
")",
"and",
"self",
".",
"required",
":",
"raise",
"self",
".",
"make_error",
"(",
"\"required\"",
"... | [
273,
4
] | [
282,
45
] | python | en | ['en', 'et', 'en'] | True |
Field.serialize | (
self,
attr: str,
obj: typing.Any,
accessor: typing.Callable[[typing.Any, str, typing.Any], typing.Any] = None,
**kwargs
) | Pulls the value for the given key from the object, applies the
field's formatting and returns the result.
:param attr: The attribute/key to get from the object.
:param obj: The object to access the attribute/key from.
:param accessor: Function used to access values from ``obj``.
... | Pulls the value for the given key from the object, applies the
field's formatting and returns the result. | def serialize(
self,
attr: str,
obj: typing.Any,
accessor: typing.Callable[[typing.Any, str, typing.Any], typing.Any] = None,
**kwargs
):
"""Pulls the value for the given key from the object, applies the
field's formatting and returns the result.
:par... | [
"def",
"serialize",
"(",
"self",
",",
"attr",
":",
"str",
",",
"obj",
":",
"typing",
".",
"Any",
",",
"accessor",
":",
"typing",
".",
"Callable",
"[",
"[",
"typing",
".",
"Any",
",",
"str",
",",
"typing",
".",
"Any",
"]",
",",
"typing",
".",
"Any... | [
284,
4
] | [
308,
58
] | python | en | ['en', 'en', 'en'] | True |
Field.deserialize | (
self,
value: typing.Any,
attr: str = None,
data: typing.Mapping[str, typing.Any] = None,
**kwargs
) | Deserialize ``value``.
:param value: The value to deserialize.
:param attr: The attribute/key in `data` to deserialize.
:param data: The raw input data passed to `Schema.load`.
:param kwargs: Field-specific keyword arguments.
:raise ValidationError: If an invalid value is passed... | Deserialize ``value``. | def deserialize(
self,
value: typing.Any,
attr: str = None,
data: typing.Mapping[str, typing.Any] = None,
**kwargs
):
"""Deserialize ``value``.
:param value: The value to deserialize.
:param attr: The attribute/key in `data` to deserialize.
:p... | [
"def",
"deserialize",
"(",
"self",
",",
"value",
":",
"typing",
".",
"Any",
",",
"attr",
":",
"str",
"=",
"None",
",",
"data",
":",
"typing",
".",
"Mapping",
"[",
"str",
",",
"typing",
".",
"Any",
"]",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
... | [
310,
4
] | [
336,
21
] | python | da | ['en', 'da', 'it'] | False |
Field._bind_to_schema | (self, field_name, schema) | Update field with values from its parent schema. Called by
:meth:`Schema._bind_field <marshmallow.Schema._bind_field>`.
:param str field_name: Field name set in schema.
:param Schema schema: Parent schema.
| Update field with values from its parent schema. Called by
:meth:`Schema._bind_field <marshmallow.Schema._bind_field>`. | def _bind_to_schema(self, field_name, schema):
"""Update field with values from its parent schema. Called by
:meth:`Schema._bind_field <marshmallow.Schema._bind_field>`.
:param str field_name: Field name set in schema.
:param Schema schema: Parent schema.
"""
self.parent... | [
"def",
"_bind_to_schema",
"(",
"self",
",",
"field_name",
",",
"schema",
")",
":",
"self",
".",
"parent",
"=",
"self",
".",
"parent",
"or",
"schema",
"self",
".",
"name",
"=",
"self",
".",
"name",
"or",
"field_name"
] | [
340,
4
] | [
348,
43
] | python | en | ['en', 'en', 'en'] | True |
Field._serialize | (self, value: typing.Any, attr: str, obj: typing.Any, **kwargs) | Serializes ``value`` to a basic Python datatype. Noop by default.
Concrete :class:`Field` classes should implement this method.
Example: ::
class TitleCase(Field):
def _serialize(self, value, attr, obj, **kwargs):
if not value:
re... | Serializes ``value`` to a basic Python datatype. Noop by default.
Concrete :class:`Field` classes should implement this method. | def _serialize(self, value: typing.Any, attr: str, obj: typing.Any, **kwargs):
"""Serializes ``value`` to a basic Python datatype. Noop by default.
Concrete :class:`Field` classes should implement this method.
Example: ::
class TitleCase(Field):
def _serialize(self,... | [
"def",
"_serialize",
"(",
"self",
",",
"value",
":",
"typing",
".",
"Any",
",",
"attr",
":",
"str",
",",
"obj",
":",
"typing",
".",
"Any",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"value"
] | [
350,
4
] | [
368,
20
] | python | en | ['en', 'en', 'en'] | True |
Field._deserialize | (
self,
value: typing.Any,
attr: typing.Optional[str],
data: typing.Optional[typing.Mapping[str, typing.Any]],
**kwargs
) | Deserialize value. Concrete :class:`Field` classes should implement this method.
:param value: The value to be deserialized.
:param attr: The attribute/key in `data` to be deserialized.
:param data: The raw input data passed to the `Schema.load`.
:param kwargs: Field-specific keyword ar... | Deserialize value. Concrete :class:`Field` classes should implement this method. | def _deserialize(
self,
value: typing.Any,
attr: typing.Optional[str],
data: typing.Optional[typing.Mapping[str, typing.Any]],
**kwargs
):
"""Deserialize value. Concrete :class:`Field` classes should implement this method.
:param value: The value to be deseri... | [
"def",
"_deserialize",
"(",
"self",
",",
"value",
":",
"typing",
".",
"Any",
",",
"attr",
":",
"typing",
".",
"Optional",
"[",
"str",
"]",
",",
"data",
":",
"typing",
".",
"Optional",
"[",
"typing",
".",
"Mapping",
"[",
"str",
",",
"typing",
".",
"... | [
370,
4
] | [
392,
20
] | python | en | ['en', 'fr', 'en'] | True |
Field.context | (self) | The context dictionary for the parent :class:`Schema`. | The context dictionary for the parent :class:`Schema`. | def context(self):
"""The context dictionary for the parent :class:`Schema`."""
return self.parent.context | [
"def",
"context",
"(",
"self",
")",
":",
"return",
"self",
".",
"parent",
".",
"context"
] | [
397,
4
] | [
399,
34
] | python | en | ['en', 'en', 'en'] | True |
Field.root | (self) | Reference to the `Schema` that this field belongs to even if it is buried in a
container field (e.g. `List`).
Return `None` for unbound fields.
| Reference to the `Schema` that this field belongs to even if it is buried in a
container field (e.g. `List`).
Return `None` for unbound fields.
| def root(self):
"""Reference to the `Schema` that this field belongs to even if it is buried in a
container field (e.g. `List`).
Return `None` for unbound fields.
"""
ret = self
while hasattr(ret, "parent"):
ret = ret.parent
return ret if isinstance(re... | [
"def",
"root",
"(",
"self",
")",
":",
"ret",
"=",
"self",
"while",
"hasattr",
"(",
"ret",
",",
"\"parent\"",
")",
":",
"ret",
"=",
"ret",
".",
"parent",
"return",
"ret",
"if",
"isinstance",
"(",
"ret",
",",
"SchemaABC",
")",
"else",
"None"
] | [
402,
4
] | [
410,
58
] | python | en | ['en', 'en', 'en'] | True |
Nested.schema | (self) | The nested Schema object.
.. versionchanged:: 1.0.0
Renamed from `serializer` to `schema`.
| The nested Schema object. | def schema(self):
"""The nested Schema object.
.. versionchanged:: 1.0.0
Renamed from `serializer` to `schema`.
"""
if not self._schema:
# Inherit context from parent.
context = getattr(self.parent, "context", {})
if callable(self.nested) ... | [
"def",
"schema",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_schema",
":",
"# Inherit context from parent.",
"context",
"=",
"getattr",
"(",
"self",
".",
"parent",
",",
"\"context\"",
",",
"{",
"}",
")",
"if",
"callable",
"(",
"self",
".",
"nested... | [
497,
4
] | [
546,
27
] | python | en | ['en', 'en', 'en'] | True |
Nested._deserialize | (self, value, attr, data, partial=None, **kwargs) | Same as :meth:`Field._deserialize` with additional ``partial`` argument.
:param bool|tuple partial: For nested schemas, the ``partial``
parameter passed to `Schema.load`.
.. versionchanged:: 3.0.0
Add ``partial`` parameter.
| Same as :meth:`Field._deserialize` with additional ``partial`` argument. | def _deserialize(self, value, attr, data, partial=None, **kwargs):
"""Same as :meth:`Field._deserialize` with additional ``partial`` argument.
:param bool|tuple partial: For nested schemas, the ``partial``
parameter passed to `Schema.load`.
.. versionchanged:: 3.0.0
Add... | [
"def",
"_deserialize",
"(",
"self",
",",
"value",
",",
"attr",
",",
"data",
",",
"partial",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_test_collection",
"(",
"value",
")",
"return",
"self",
".",
"_load",
"(",
"value",
",",
"data",... | [
579,
4
] | [
589,
55
] | python | en | ['en', 'en', 'en'] | True |
UUID._validated | (self, value) | Format the value or raise a :exc:`ValidationError` if an error occurs. | Format the value or raise a :exc:`ValidationError` if an error occurs. | def _validated(self, value) -> typing.Optional[uuid.UUID]:
"""Format the value or raise a :exc:`ValidationError` if an error occurs."""
if value is None:
return None
if isinstance(value, uuid.UUID):
return value
try:
if isinstance(value, bytes) and len... | [
"def",
"_validated",
"(",
"self",
",",
"value",
")",
"->",
"typing",
".",
"Optional",
"[",
"uuid",
".",
"UUID",
"]",
":",
"if",
"value",
"is",
"None",
":",
"return",
"None",
"if",
"isinstance",
"(",
"value",
",",
"uuid",
".",
"UUID",
")",
":",
"ret... | [
832,
4
] | [
844,
60
] | python | en | ['en', 'en', 'en'] | True |
Number._format_num | (self, value) | Return the number value for value, given this field's `num_type`. | Return the number value for value, given this field's `num_type`. | def _format_num(self, value) -> typing.Any:
"""Return the number value for value, given this field's `num_type`."""
return self.num_type(value) | [
"def",
"_format_num",
"(",
"self",
",",
"value",
")",
"->",
"typing",
".",
"Any",
":",
"return",
"self",
".",
"num_type",
"(",
"value",
")"
] | [
869,
4
] | [
871,
35
] | python | en | ['en', 'en', 'en'] | True |
Number._validated | (self, value) | Format the value or raise a :exc:`ValidationError` if an error occurs. | Format the value or raise a :exc:`ValidationError` if an error occurs. | def _validated(self, value) -> typing.Optional[_T]:
"""Format the value or raise a :exc:`ValidationError` if an error occurs."""
if value is None:
return None
# (value is True or value is False) is ~5x faster than isinstance(value, bool)
if value is True or value is False:
... | [
"def",
"_validated",
"(",
"self",
",",
"value",
")",
"->",
"typing",
".",
"Optional",
"[",
"_T",
"]",
":",
"if",
"value",
"is",
"None",
":",
"return",
"None",
"# (value is True or value is False) is ~5x faster than isinstance(value, bool)",
"if",
"value",
"is",
"T... | [
873,
4
] | [
885,
70
] | python | en | ['en', 'en', 'en'] | True |
Number._serialize | (
self, value, attr, obj, **kwargs
) | Return a string if `self.as_string=True`, otherwise return this field's `num_type`. | Return a string if `self.as_string=True`, otherwise return this field's `num_type`. | def _serialize(
self, value, attr, obj, **kwargs
) -> typing.Optional[typing.Union[str, _T]]:
"""Return a string if `self.as_string=True`, otherwise return this field's `num_type`."""
if value is None:
return None
ret = self._format_num(value) # type: _T
return s... | [
"def",
"_serialize",
"(",
"self",
",",
"value",
",",
"attr",
",",
"obj",
",",
"*",
"*",
"kwargs",
")",
"->",
"typing",
".",
"Optional",
"[",
"typing",
".",
"Union",
"[",
"str",
",",
"_T",
"]",
"]",
":",
"if",
"value",
"is",
"None",
":",
"return",... | [
890,
4
] | [
897,
62
] | 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.