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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
translate | (a, table, deletechars=None) |
For each element in `a`, return a copy of the string where all
characters occurring in the optional argument `deletechars` are
removed, and the remaining characters have been mapped through the
given translation table.
Calls `str.translate` element-wise.
Parameters
----------
a : arra... |
For each element in `a`, return a copy of the string where all
characters occurring in the optional argument `deletechars` are
removed, and the remaining characters have been mapped through the
given translation table. | def translate(a, table, deletechars=None):
"""
For each element in `a`, return a copy of the string where all
characters occurring in the optional argument `deletechars` are
removed, and the remaining characters have been mapped through the
given translation table.
Calls `str.translate` element... | [
"def",
"translate",
"(",
"a",
",",
"table",
",",
"deletechars",
"=",
"None",
")",
":",
"a_arr",
"=",
"numpy",
".",
"asarray",
"(",
"a",
")",
"if",
"issubclass",
"(",
"a_arr",
".",
"dtype",
".",
"type",
",",
"unicode_",
")",
":",
"return",
"_vec_strin... | [
1639,
0
] | [
1672,
80
] | python | en | ['en', 'error', 'th'] | False |
upper | (a) |
Return an array with the elements converted to uppercase.
Calls `str.upper` element-wise.
For 8-bit strings, this method is locale-dependent.
Parameters
----------
a : array_like, {str, unicode}
Input array.
Returns
-------
out : ndarray, {str, unicode}
Output ar... |
Return an array with the elements converted to uppercase. | def upper(a):
"""
Return an array with the elements converted to uppercase.
Calls `str.upper` element-wise.
For 8-bit strings, this method is locale-dependent.
Parameters
----------
a : array_like, {str, unicode}
Input array.
Returns
-------
out : ndarray, {str, unico... | [
"def",
"upper",
"(",
"a",
")",
":",
"a_arr",
"=",
"numpy",
".",
"asarray",
"(",
"a",
")",
"return",
"_vec_string",
"(",
"a_arr",
",",
"a_arr",
".",
"dtype",
",",
"'upper'",
")"
] | [
1676,
0
] | [
1707,
51
] | python | en | ['en', 'error', 'th'] | False |
zfill | (a, width) |
Return the numeric string left-filled with zeros
Calls `str.zfill` element-wise.
Parameters
----------
a : array_like, {str, unicode}
Input array.
width : int
Width of string to left-fill elements in `a`.
Returns
-------
out : ndarray, {str, unicode}
Outpu... |
Return the numeric string left-filled with zeros | def zfill(a, width):
"""
Return the numeric string left-filled with zeros
Calls `str.zfill` element-wise.
Parameters
----------
a : array_like, {str, unicode}
Input array.
width : int
Width of string to left-fill elements in `a`.
Returns
-------
out : ndarray, ... | [
"def",
"zfill",
"(",
"a",
",",
"width",
")",
":",
"a_arr",
"=",
"numpy",
".",
"asarray",
"(",
"a",
")",
"width_arr",
"=",
"numpy",
".",
"asarray",
"(",
"width",
")",
"size",
"=",
"long",
"(",
"numpy",
".",
"max",
"(",
"width_arr",
".",
"flat",
")... | [
1715,
0
] | [
1742,
63
] | python | en | ['en', 'error', 'th'] | False |
isnumeric | (a) |
For each element, return True if there are only numeric
characters in the element.
Calls `unicode.isnumeric` element-wise.
Numeric characters include digit characters, and all characters
that have the Unicode numeric value property, e.g. ``U+2155,
VULGAR FRACTION ONE FIFTH``.
Parameters
... |
For each element, return True if there are only numeric
characters in the element. | def isnumeric(a):
"""
For each element, return True if there are only numeric
characters in the element.
Calls `unicode.isnumeric` element-wise.
Numeric characters include digit characters, and all characters
that have the Unicode numeric value property, e.g. ``U+2155,
VULGAR FRACTION ONE ... | [
"def",
"isnumeric",
"(",
"a",
")",
":",
"if",
"_use_unicode",
"(",
"a",
")",
"!=",
"unicode_",
":",
"raise",
"TypeError",
"(",
"\"isnumeric is only available for Unicode strings and arrays\"",
")",
"return",
"_vec_string",
"(",
"a",
",",
"bool_",
",",
"'isnumeric'... | [
1746,
0
] | [
1774,
45
] | python | en | ['en', 'error', 'th'] | False |
isdecimal | (a) |
For each element, return True if there are only decimal
characters in the element.
Calls `unicode.isdecimal` element-wise.
Decimal characters include digit characters, and all characters
that that can be used to form decimal-radix numbers,
e.g. ``U+0660, ARABIC-INDIC DIGIT ZERO``.
Parame... |
For each element, return True if there are only decimal
characters in the element. | def isdecimal(a):
"""
For each element, return True if there are only decimal
characters in the element.
Calls `unicode.isdecimal` element-wise.
Decimal characters include digit characters, and all characters
that that can be used to form decimal-radix numbers,
e.g. ``U+0660, ARABIC-INDIC ... | [
"def",
"isdecimal",
"(",
"a",
")",
":",
"if",
"_use_unicode",
"(",
"a",
")",
"!=",
"unicode_",
":",
"raise",
"TypeError",
"(",
"\"isnumeric is only available for Unicode strings and arrays\"",
")",
"return",
"_vec_string",
"(",
"a",
",",
"bool_",
",",
"'isdecimal'... | [
1778,
0
] | [
1806,
45
] | python | en | ['en', 'error', 'th'] | False |
array | (obj, itemsize=None, copy=True, unicode=None, order=None) |
Create a `chararray`.
.. note::
This class is provided for numarray backward-compatibility.
New code (not concerned with numarray compatibility) should use
arrays of type `string_` or `unicode_` and use the free functions
in :mod:`numpy.char <numpy.core.defchararray>` for fast
... |
Create a `chararray`. | def array(obj, itemsize=None, copy=True, unicode=None, order=None):
"""
Create a `chararray`.
.. note::
This class is provided for numarray backward-compatibility.
New code (not concerned with numarray compatibility) should use
arrays of type `string_` or `unicode_` and use the free fu... | [
"def",
"array",
"(",
"obj",
",",
"itemsize",
"=",
"None",
",",
"copy",
"=",
"True",
",",
"unicode",
"=",
"None",
",",
"order",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"(",
"_bytes",
",",
"_unicode",
")",
")",
":",
"if",
"unico... | [
2617,
0
] | [
2766,
30
] | python | en | ['en', 'error', 'th'] | False |
asarray | (obj, itemsize=None, unicode=None, order=None) |
Convert the input to a `chararray`, copying the data only if
necessary.
Versus a regular NumPy array of type `str` or `unicode`, this
class adds the following functionality:
1) values automatically have whitespace removed from the end
when indexed
2) comparison operators automat... |
Convert the input to a `chararray`, copying the data only if
necessary. | def asarray(obj, itemsize=None, unicode=None, order=None):
"""
Convert the input to a `chararray`, copying the data only if
necessary.
Versus a regular NumPy array of type `str` or `unicode`, this
class adds the following functionality:
1) values automatically have whitespace removed from th... | [
"def",
"asarray",
"(",
"obj",
",",
"itemsize",
"=",
"None",
",",
"unicode",
"=",
"None",
",",
"order",
"=",
"None",
")",
":",
"return",
"array",
"(",
"obj",
",",
"itemsize",
",",
"copy",
"=",
"False",
",",
"unicode",
"=",
"unicode",
",",
"order",
"... | [
2769,
0
] | [
2818,
46
] | python | en | ['en', 'error', 'th'] | False |
check_keys_equal | (result_keys, target_keys) | Check if all elements in target_keys is in result_keys. | Check if all elements in target_keys is in result_keys. | def check_keys_equal(result_keys, target_keys):
"""Check if all elements in target_keys is in result_keys."""
return set(target_keys) == set(result_keys) | [
"def",
"check_keys_equal",
"(",
"result_keys",
",",
"target_keys",
")",
":",
"return",
"set",
"(",
"target_keys",
")",
"==",
"set",
"(",
"result_keys",
")"
] | [
6,
0
] | [
8,
47
] | python | en | ['en', 'en', 'en'] | True |
check_keys_contain | (result_keys, target_keys) | Check if elements in target_keys is in result_keys. | Check if elements in target_keys is in result_keys. | def check_keys_contain(result_keys, target_keys):
"""Check if elements in target_keys is in result_keys."""
return set(target_keys).issubset(set(result_keys)) | [
"def",
"check_keys_contain",
"(",
"result_keys",
",",
"target_keys",
")",
":",
"return",
"set",
"(",
"target_keys",
")",
".",
"issubset",
"(",
"set",
"(",
"result_keys",
")",
")"
] | [
11,
0
] | [
13,
54
] | python | en | ['en', 'en', 'en'] | True |
score | (source_data: list, weights: list, *args) | Analyse and score a dataset using a range based percentual proximity
algorithm and calculate the linear maximum likelihood estimation.
Args:
source_data (list): Data set to process.
weights (list): Weights corresponding to each column from the data set.
0 if lower values have higher ... | Analyse and score a dataset using a range based percentual proximity
algorithm and calculate the linear maximum likelihood estimation.
Args:
source_data (list): Data set to process.
weights (list): Weights corresponding to each column from the data set.
0 if lower values have higher ... | def score(source_data: list, weights: list, *args) -> list:
"""Analyse and score a dataset using a range based percentual proximity
algorithm and calculate the linear maximum likelihood estimation.
Args:
source_data (list): Data set to process.
weights (list): Weights corresponding to each c... | [
"def",
"score",
"(",
"source_data",
":",
"list",
",",
"weights",
":",
"list",
",",
"*",
"args",
")",
"->",
"list",
":",
"# getting data",
"data_lists",
"=",
"[",
"]",
"for",
"item",
"in",
"source_data",
":",
"for",
"i",
",",
"val",
"in",
"enumerate",
... | [
29,
0
] | [
102,
22
] | python | en | ['en', 'ny', 'en'] | True |
score_columns | (source_data: list, columns: list, weights: list) | Analyse data file using a range based percentual proximity
algorithm and calculate the linear maximum likelihood estimation.
Args:
source_data (list): Data set to process.
columns (list): Indexes of the source_data columns to be scored.
weights (list): Weights corresponding to each colum... | Analyse data file using a range based percentual proximity
algorithm and calculate the linear maximum likelihood estimation.
Args:
source_data (list): Data set to process.
columns (list): Indexes of the source_data columns to be scored.
weights (list): Weights corresponding to each colum... | def score_columns(source_data: list, columns: list, weights: list) -> list:
"""Analyse data file using a range based percentual proximity
algorithm and calculate the linear maximum likelihood estimation.
Args:
source_data (list): Data set to process.
columns (list): Indexes of the source_dat... | [
"def",
"score_columns",
"(",
"source_data",
":",
"list",
",",
"columns",
":",
"list",
",",
"weights",
":",
"list",
")",
"->",
"list",
":",
"temp_data",
"=",
"[",
"]",
"for",
"item",
"in",
"source_data",
":",
"temp_data",
".",
"append",
"(",
"[",
"item"... | [
105,
0
] | [
130,
22
] | python | en | ['en', 'ny', 'en'] | True |
Callback.on_before_accelerator_backend_setup | (self, trainer, pl_module: LightningModule) | Called before accelerator is being setup | Called before accelerator is being setup | def on_before_accelerator_backend_setup(self, trainer, pl_module: LightningModule) -> None:
"""Called before accelerator is being setup"""
pass | [
"def",
"on_before_accelerator_backend_setup",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
")",
"->",
"None",
":",
"pass"
] | [
31,
4
] | [
33,
12
] | python | en | ['en', 'en', 'en'] | True |
Callback.setup | (self, trainer, pl_module: LightningModule, stage: str) | Called when fit or test begins | Called when fit or test begins | def setup(self, trainer, pl_module: LightningModule, stage: str) -> None:
"""Called when fit or test begins"""
pass | [
"def",
"setup",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
",",
"stage",
":",
"str",
")",
"->",
"None",
":",
"pass"
] | [
35,
4
] | [
37,
12
] | python | en | ['en', 'en', 'en'] | True |
Callback.teardown | (self, trainer, pl_module: LightningModule, stage: str) | Called when fit or test ends | Called when fit or test ends | def teardown(self, trainer, pl_module: LightningModule, stage: str) -> None:
"""Called when fit or test ends"""
pass | [
"def",
"teardown",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
",",
"stage",
":",
"str",
")",
"->",
"None",
":",
"pass"
] | [
39,
4
] | [
41,
12
] | python | en | ['en', 'en', 'en'] | True |
Callback.on_init_start | (self, trainer) | Called when the trainer initialization begins, model has not yet been set. | Called when the trainer initialization begins, model has not yet been set. | def on_init_start(self, trainer) -> None:
"""Called when the trainer initialization begins, model has not yet been set."""
pass | [
"def",
"on_init_start",
"(",
"self",
",",
"trainer",
")",
"->",
"None",
":",
"pass"
] | [
43,
4
] | [
45,
12
] | python | en | ['en', 'en', 'en'] | True |
Callback.on_init_end | (self, trainer) | Called when the trainer initialization ends, model has not yet been set. | Called when the trainer initialization ends, model has not yet been set. | def on_init_end(self, trainer) -> None:
"""Called when the trainer initialization ends, model has not yet been set."""
pass | [
"def",
"on_init_end",
"(",
"self",
",",
"trainer",
")",
"->",
"None",
":",
"pass"
] | [
47,
4
] | [
49,
12
] | python | en | ['en', 'en', 'en'] | True |
Callback.on_fit_start | (self, trainer, pl_module: LightningModule) | Called when fit begins | Called when fit begins | def on_fit_start(self, trainer, pl_module: LightningModule) -> None:
"""Called when fit begins"""
pass | [
"def",
"on_fit_start",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
")",
"->",
"None",
":",
"pass"
] | [
51,
4
] | [
53,
12
] | python | en | ['en', 'en', 'en'] | True |
Callback.on_fit_end | (self, trainer, pl_module: LightningModule) | Called when fit ends | Called when fit ends | def on_fit_end(self, trainer, pl_module: LightningModule) -> None:
"""Called when fit ends"""
pass | [
"def",
"on_fit_end",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
")",
"->",
"None",
":",
"pass"
] | [
55,
4
] | [
57,
12
] | python | en | ['en', 'en', 'en'] | True |
Callback.on_sanity_check_start | (self, trainer, pl_module: LightningModule) | Called when the validation sanity check starts. | Called when the validation sanity check starts. | def on_sanity_check_start(self, trainer, pl_module: LightningModule) -> None:
"""Called when the validation sanity check starts."""
pass | [
"def",
"on_sanity_check_start",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
")",
"->",
"None",
":",
"pass"
] | [
59,
4
] | [
61,
12
] | python | en | ['en', 'en', 'en'] | True |
Callback.on_sanity_check_end | (self, trainer, pl_module: LightningModule) | Called when the validation sanity check ends. | Called when the validation sanity check ends. | def on_sanity_check_end(self, trainer, pl_module: LightningModule) -> None:
"""Called when the validation sanity check ends."""
pass | [
"def",
"on_sanity_check_end",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
")",
"->",
"None",
":",
"pass"
] | [
63,
4
] | [
65,
12
] | python | en | ['en', 'en', 'en'] | True |
Callback.on_train_batch_start | (
self, trainer, pl_module: LightningModule, batch: Any, batch_idx: int, dataloader_idx: int
) | Called when the train batch begins. | Called when the train batch begins. | def on_train_batch_start(
self, trainer, pl_module: LightningModule, batch: Any, batch_idx: int, dataloader_idx: int
) -> None:
"""Called when the train batch begins."""
pass | [
"def",
"on_train_batch_start",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
",",
"batch",
":",
"Any",
",",
"batch_idx",
":",
"int",
",",
"dataloader_idx",
":",
"int",
")",
"->",
"None",
":",
"pass"
] | [
67,
4
] | [
71,
12
] | python | en | ['en', 'en', 'en'] | True |
Callback.on_train_batch_end | (
self, trainer, pl_module: LightningModule, outputs: Any, batch: Any, batch_idx: int, dataloader_idx: int
) | Called when the train batch ends. | Called when the train batch ends. | def on_train_batch_end(
self, trainer, pl_module: LightningModule, outputs: Any, batch: Any, batch_idx: int, dataloader_idx: int
) -> None:
"""Called when the train batch ends."""
pass | [
"def",
"on_train_batch_end",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
",",
"outputs",
":",
"Any",
",",
"batch",
":",
"Any",
",",
"batch_idx",
":",
"int",
",",
"dataloader_idx",
":",
"int",
")",
"->",
"None",
":",
"pass"
] | [
73,
4
] | [
77,
12
] | python | en | ['en', 'en', 'en'] | True |
Callback.on_train_epoch_start | (self, trainer, pl_module: LightningModule) | Called when the train epoch begins. | Called when the train epoch begins. | def on_train_epoch_start(self, trainer, pl_module: LightningModule) -> None:
"""Called when the train epoch begins."""
pass | [
"def",
"on_train_epoch_start",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
")",
"->",
"None",
":",
"pass"
] | [
79,
4
] | [
81,
12
] | python | en | ['en', 'de', 'en'] | True |
Callback.on_train_epoch_end | (self, trainer, pl_module: LightningModule, outputs: Any) | Called when the train epoch ends. | Called when the train epoch ends. | def on_train_epoch_end(self, trainer, pl_module: LightningModule, outputs: Any) -> None:
"""Called when the train epoch ends."""
pass | [
"def",
"on_train_epoch_end",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
",",
"outputs",
":",
"Any",
")",
"->",
"None",
":",
"pass"
] | [
83,
4
] | [
85,
12
] | python | en | ['en', 'en', 'en'] | True |
Callback.on_validation_epoch_start | (self, trainer, pl_module: LightningModule) | Called when the val epoch begins. | Called when the val epoch begins. | def on_validation_epoch_start(self, trainer, pl_module: LightningModule) -> None:
"""Called when the val epoch begins."""
pass | [
"def",
"on_validation_epoch_start",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
")",
"->",
"None",
":",
"pass"
] | [
87,
4
] | [
89,
12
] | python | en | ['en', 'en', 'en'] | True |
Callback.on_validation_epoch_end | (self, trainer, pl_module: LightningModule) | Called when the val epoch ends. | Called when the val epoch ends. | def on_validation_epoch_end(self, trainer, pl_module: LightningModule) -> None:
"""Called when the val epoch ends."""
pass | [
"def",
"on_validation_epoch_end",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
")",
"->",
"None",
":",
"pass"
] | [
91,
4
] | [
93,
12
] | python | en | ['en', 'en', 'en'] | True |
Callback.on_test_epoch_start | (self, trainer, pl_module: LightningModule) | Called when the test epoch begins. | Called when the test epoch begins. | def on_test_epoch_start(self, trainer, pl_module: LightningModule) -> None:
"""Called when the test epoch begins."""
pass | [
"def",
"on_test_epoch_start",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
")",
"->",
"None",
":",
"pass"
] | [
95,
4
] | [
97,
12
] | python | en | ['en', 'de', 'en'] | True |
Callback.on_test_epoch_end | (self, trainer, pl_module: LightningModule) | Called when the test epoch ends. | Called when the test epoch ends. | def on_test_epoch_end(self, trainer, pl_module: LightningModule) -> None:
"""Called when the test epoch ends."""
pass | [
"def",
"on_test_epoch_end",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
")",
"->",
"None",
":",
"pass"
] | [
99,
4
] | [
101,
12
] | python | en | ['en', 'en', 'en'] | True |
Callback.on_epoch_start | (self, trainer, pl_module: LightningModule) | Called when the epoch begins. | Called when the epoch begins. | def on_epoch_start(self, trainer, pl_module: LightningModule) -> None:
"""Called when the epoch begins."""
pass | [
"def",
"on_epoch_start",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
")",
"->",
"None",
":",
"pass"
] | [
103,
4
] | [
105,
12
] | python | en | ['en', 'de', 'en'] | True |
Callback.on_epoch_end | (self, trainer, pl_module: LightningModule) | Called when the epoch ends. | Called when the epoch ends. | def on_epoch_end(self, trainer, pl_module: LightningModule) -> None:
"""Called when the epoch ends."""
pass | [
"def",
"on_epoch_end",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
")",
"->",
"None",
":",
"pass"
] | [
107,
4
] | [
109,
12
] | python | en | ['en', 'en', 'en'] | True |
Callback.on_batch_start | (self, trainer, pl_module: LightningModule) | Called when the training batch begins. | Called when the training batch begins. | def on_batch_start(self, trainer, pl_module: LightningModule) -> None:
"""Called when the training batch begins."""
pass | [
"def",
"on_batch_start",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
")",
"->",
"None",
":",
"pass"
] | [
111,
4
] | [
113,
12
] | python | en | ['en', 'en', 'en'] | True |
Callback.on_validation_batch_start | (
self, trainer, pl_module: LightningModule, batch: Any, batch_idx: int, dataloader_idx: int
) | Called when the validation batch begins. | Called when the validation batch begins. | def on_validation_batch_start(
self, trainer, pl_module: LightningModule, batch: Any, batch_idx: int, dataloader_idx: int
) -> None:
"""Called when the validation batch begins."""
pass | [
"def",
"on_validation_batch_start",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
",",
"batch",
":",
"Any",
",",
"batch_idx",
":",
"int",
",",
"dataloader_idx",
":",
"int",
")",
"->",
"None",
":",
"pass"
] | [
115,
4
] | [
119,
12
] | python | en | ['en', 'en', 'en'] | True |
Callback.on_validation_batch_end | (
self, trainer, pl_module: LightningModule, outputs: Any, batch: Any, batch_idx: int, dataloader_idx: int
) | Called when the validation batch ends. | Called when the validation batch ends. | def on_validation_batch_end(
self, trainer, pl_module: LightningModule, outputs: Any, batch: Any, batch_idx: int, dataloader_idx: int
) -> None:
"""Called when the validation batch ends."""
pass | [
"def",
"on_validation_batch_end",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
",",
"outputs",
":",
"Any",
",",
"batch",
":",
"Any",
",",
"batch_idx",
":",
"int",
",",
"dataloader_idx",
":",
"int",
")",
"->",
"None",
":",
"pass"
] | [
121,
4
] | [
125,
12
] | python | en | ['en', 'en', 'en'] | True |
Callback.on_test_batch_start | (
self, trainer, pl_module: LightningModule, batch: Any, batch_idx: int, dataloader_idx: int
) | Called when the test batch begins. | Called when the test batch begins. | def on_test_batch_start(
self, trainer, pl_module: LightningModule, batch: Any, batch_idx: int, dataloader_idx: int
) -> None:
"""Called when the test batch begins."""
pass | [
"def",
"on_test_batch_start",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
",",
"batch",
":",
"Any",
",",
"batch_idx",
":",
"int",
",",
"dataloader_idx",
":",
"int",
")",
"->",
"None",
":",
"pass"
] | [
127,
4
] | [
131,
12
] | python | en | ['en', 'en', 'en'] | True |
Callback.on_test_batch_end | (
self, trainer, pl_module: LightningModule, outputs: Any, batch: Any, batch_idx: int, dataloader_idx: int
) | Called when the test batch ends. | Called when the test batch ends. | def on_test_batch_end(
self, trainer, pl_module: LightningModule, outputs: Any, batch: Any, batch_idx: int, dataloader_idx: int
) -> None:
"""Called when the test batch ends."""
pass | [
"def",
"on_test_batch_end",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
",",
"outputs",
":",
"Any",
",",
"batch",
":",
"Any",
",",
"batch_idx",
":",
"int",
",",
"dataloader_idx",
":",
"int",
")",
"->",
"None",
":",
"pass"
] | [
133,
4
] | [
137,
12
] | python | en | ['en', 'en', 'en'] | True |
Callback.on_batch_end | (self, trainer, pl_module: LightningModule) | Called when the training batch ends. | Called when the training batch ends. | def on_batch_end(self, trainer, pl_module: LightningModule) -> None:
"""Called when the training batch ends."""
pass | [
"def",
"on_batch_end",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
")",
"->",
"None",
":",
"pass"
] | [
139,
4
] | [
141,
12
] | python | en | ['en', 'en', 'en'] | True |
Callback.on_train_start | (self, trainer, pl_module: LightningModule) | Called when the train begins. | Called when the train begins. | def on_train_start(self, trainer, pl_module: LightningModule) -> None:
"""Called when the train begins."""
pass | [
"def",
"on_train_start",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
")",
"->",
"None",
":",
"pass"
] | [
143,
4
] | [
145,
12
] | python | en | ['en', 'en', 'en'] | True |
Callback.on_train_end | (self, trainer, pl_module: LightningModule) | Called when the train ends. | Called when the train ends. | def on_train_end(self, trainer, pl_module: LightningModule) -> None:
"""Called when the train ends."""
pass | [
"def",
"on_train_end",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
")",
"->",
"None",
":",
"pass"
] | [
147,
4
] | [
149,
12
] | python | en | ['en', 'en', 'en'] | True |
Callback.on_pretrain_routine_start | (self, trainer, pl_module: LightningModule) | Called when the pretrain routine begins. | Called when the pretrain routine begins. | def on_pretrain_routine_start(self, trainer, pl_module: LightningModule) -> None:
"""Called when the pretrain routine begins."""
pass | [
"def",
"on_pretrain_routine_start",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
")",
"->",
"None",
":",
"pass"
] | [
151,
4
] | [
153,
12
] | python | en | ['en', 'de', 'en'] | True |
Callback.on_pretrain_routine_end | (self, trainer, pl_module: LightningModule) | Called when the pretrain routine ends. | Called when the pretrain routine ends. | def on_pretrain_routine_end(self, trainer, pl_module: LightningModule) -> None:
"""Called when the pretrain routine ends."""
pass | [
"def",
"on_pretrain_routine_end",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
")",
"->",
"None",
":",
"pass"
] | [
155,
4
] | [
157,
12
] | python | en | ['en', 'en', 'en'] | True |
Callback.on_validation_start | (self, trainer, pl_module: LightningModule) | Called when the validation loop begins. | Called when the validation loop begins. | def on_validation_start(self, trainer, pl_module: LightningModule) -> None:
"""Called when the validation loop begins."""
pass | [
"def",
"on_validation_start",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
")",
"->",
"None",
":",
"pass"
] | [
159,
4
] | [
161,
12
] | python | en | ['en', 'af', 'en'] | True |
Callback.on_validation_end | (self, trainer, pl_module: LightningModule) | Called when the validation loop ends. | Called when the validation loop ends. | def on_validation_end(self, trainer, pl_module: LightningModule) -> None:
"""Called when the validation loop ends."""
pass | [
"def",
"on_validation_end",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
")",
"->",
"None",
":",
"pass"
] | [
163,
4
] | [
165,
12
] | python | en | ['en', 'en', 'en'] | True |
Callback.on_test_start | (self, trainer, pl_module: LightningModule) | Called when the test begins. | Called when the test begins. | def on_test_start(self, trainer, pl_module: LightningModule) -> None:
"""Called when the test begins."""
pass | [
"def",
"on_test_start",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
")",
"->",
"None",
":",
"pass"
] | [
167,
4
] | [
169,
12
] | python | en | ['en', 'en', 'en'] | True |
Callback.on_test_end | (self, trainer, pl_module: LightningModule) | Called when the test ends. | Called when the test ends. | def on_test_end(self, trainer, pl_module: LightningModule) -> None:
"""Called when the test ends."""
pass | [
"def",
"on_test_end",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
")",
"->",
"None",
":",
"pass"
] | [
171,
4
] | [
173,
12
] | python | en | ['en', 'en', 'en'] | True |
Callback.on_keyboard_interrupt | (self, trainer, pl_module: LightningModule) | Called when the training is interrupted by ``KeyboardInterrupt``. | Called when the training is interrupted by ``KeyboardInterrupt``. | def on_keyboard_interrupt(self, trainer, pl_module: LightningModule) -> None:
"""Called when the training is interrupted by ``KeyboardInterrupt``."""
pass | [
"def",
"on_keyboard_interrupt",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
")",
"->",
"None",
":",
"pass"
] | [
175,
4
] | [
177,
12
] | python | en | ['en', 'en', 'en'] | True |
Callback.on_save_checkpoint | (self, trainer, pl_module: LightningModule) | Called when saving a model checkpoint, use to persist state. | Called when saving a model checkpoint, use to persist state. | def on_save_checkpoint(self, trainer, pl_module: LightningModule) -> None:
"""Called when saving a model checkpoint, use to persist state."""
pass | [
"def",
"on_save_checkpoint",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
")",
"->",
"None",
":",
"pass"
] | [
179,
4
] | [
181,
12
] | python | en | ['en', 'en', 'en'] | True |
Callback.on_load_checkpoint | (self, checkpointed_state) | Called when loading a model checkpoint, use to reload state. | Called when loading a model checkpoint, use to reload state. | def on_load_checkpoint(self, checkpointed_state) -> None:
"""Called when loading a model checkpoint, use to reload state."""
pass | [
"def",
"on_load_checkpoint",
"(",
"self",
",",
"checkpointed_state",
")",
"->",
"None",
":",
"pass"
] | [
183,
4
] | [
185,
12
] | python | en | ['en', 'en', 'en'] | True |
Callback.on_after_backward | (self, trainer, pl_module: LightningModule) | Called after ``loss.backward()`` and before optimizers do anything. | Called after ``loss.backward()`` and before optimizers do anything. | def on_after_backward(self, trainer, pl_module: LightningModule) -> None:
"""Called after ``loss.backward()`` and before optimizers do anything."""
pass | [
"def",
"on_after_backward",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
")",
"->",
"None",
":",
"pass"
] | [
187,
4
] | [
189,
12
] | python | en | ['en', 'en', 'en'] | True |
Callback.on_before_zero_grad | (self, trainer, pl_module: LightningModule, optimizer) | Called after ``optimizer.step()`` and before ``optimizer.zero_grad()``. | Called after ``optimizer.step()`` and before ``optimizer.zero_grad()``. | def on_before_zero_grad(self, trainer, pl_module: LightningModule, optimizer) -> None:
"""Called after ``optimizer.step()`` and before ``optimizer.zero_grad()``."""
pass | [
"def",
"on_before_zero_grad",
"(",
"self",
",",
"trainer",
",",
"pl_module",
":",
"LightningModule",
",",
"optimizer",
")",
"->",
"None",
":",
"pass"
] | [
191,
4
] | [
193,
12
] | python | en | ['en', 'en', 'en'] | True |
HardwareDataReady._create_i2c_driver | (data_ready_pin: int = None) |
Creates a driver that communicates by I2C and uses a hardware
interrupt to tell when there is new data available.
:param data_ready_pin: the GPIO pin connected to the INT1 pin on the LSM9DS1
:return: a driver
|
Creates a driver that communicates by I2C and uses a hardware
interrupt to tell when there is new data available.
:param data_ready_pin: the GPIO pin connected to the INT1 pin on the LSM9DS1
:return: a driver
| def _create_i2c_driver(data_ready_pin: int = None) -> Driver:
"""
Creates a driver that communicates by I2C and uses a hardware
interrupt to tell when there is new data available.
:param data_ready_pin: the GPIO pin connected to the INT1 pin on the LSM9DS1
:return: a driver
... | [
"def",
"_create_i2c_driver",
"(",
"data_ready_pin",
":",
"int",
"=",
"None",
")",
"->",
"Driver",
":",
"return",
"Driver",
"(",
"I2CTransport",
"(",
"1",
",",
"I2CTransport",
".",
"I2C_AG_ADDRESS",
",",
"data_ready_pin",
")",
",",
"I2CTransport",
"(",
"1",
"... | [
17,
4
] | [
26,
58
] | python | en | ['en', 'ja', 'th'] | False |
HardwareDataReady._create_spi_driver | (data_ready_pin: int = None) |
Creates a driver that communicates by SPI and uses a hardware
interrupt to tell when there is new data available.
:param data_ready_pin: the GPIO pin connected to the INT1 pin on the LSM9DS1
:return: a driver
|
Creates a driver that communicates by SPI and uses a hardware
interrupt to tell when there is new data available.
:param data_ready_pin: the GPIO pin connected to the INT1 pin on the LSM9DS1
:return: a driver
| def _create_spi_driver(data_ready_pin: int = None) -> Driver:
"""
Creates a driver that communicates by SPI and uses a hardware
interrupt to tell when there is new data available.
:param data_ready_pin: the GPIO pin connected to the INT1 pin on the LSM9DS1
:return: a driver
... | [
"def",
"_create_spi_driver",
"(",
"data_ready_pin",
":",
"int",
"=",
"None",
")",
"->",
"Driver",
":",
"return",
"Driver",
"(",
"SPITransport",
"(",
"0",
",",
"False",
",",
"data_ready_pin",
")",
",",
"SPITransport",
"(",
"1",
",",
"True",
")",
")"
] | [
29,
4
] | [
38,
34
] | python | en | ['en', 'ja', 'th'] | False |
seed_everything | (seed: Optional[int] = None) |
Function that sets seed for pseudo-random number generators in:
pytorch, numpy, python.random
In addition, sets the env variable `PL_GLOBAL_SEED` which will be passed to
spawned subprocesses (e.g. ddp_spawn backend).
Args:
seed: the integer value seed for global random state in Lightning.
... |
Function that sets seed for pseudo-random number generators in:
pytorch, numpy, python.random
In addition, sets the env variable `PL_GLOBAL_SEED` which will be passed to
spawned subprocesses (e.g. ddp_spawn backend). | def seed_everything(seed: Optional[int] = None) -> int:
"""
Function that sets seed for pseudo-random number generators in:
pytorch, numpy, python.random
In addition, sets the env variable `PL_GLOBAL_SEED` which will be passed to
spawned subprocesses (e.g. ddp_spawn backend).
Args:
seed... | [
"def",
"seed_everything",
"(",
"seed",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
")",
"->",
"int",
":",
"max_seed_value",
"=",
"np",
".",
"iinfo",
"(",
"np",
".",
"uint32",
")",
".",
"max",
"min_seed_value",
"=",
"np",
".",
"iinfo",
"(",
"np",
... | [
26,
0
] | [
59,
15
] | python | en | ['en', 'error', 'th'] | False |
ReadBuffer.create_buffer | (self, buffer_name) | Creates a software buffer that it will push the received data to
| Creates a software buffer that it will push the received data to
| def create_buffer(self, buffer_name):
"""Creates a software buffer that it will push the received data to
"""
self._buffers[buffer_name] = collections.deque(
maxlen=self._buffer_length) | [
"def",
"create_buffer",
"(",
"self",
",",
"buffer_name",
")",
":",
"self",
".",
"_buffers",
"[",
"buffer_name",
"]",
"=",
"collections",
".",
"deque",
"(",
"maxlen",
"=",
"self",
".",
"_buffer_length",
")"
] | [
97,
4
] | [
101,
39
] | python | en | ['en', 'en', 'en'] | True |
ReadBuffer.create_printf_buffer | (self, buffer_name) | Creates a software buffer that it will push M0N0 printf to only
| Creates a software buffer that it will push M0N0 printf to only
| def create_printf_buffer(self, buffer_name):
""" Creates a software buffer that it will push M0N0 printf to only
"""
self._printf_buffers[buffer_name] = collections.deque(
maxlen=self._buffer_length) | [
"def",
"create_printf_buffer",
"(",
"self",
",",
"buffer_name",
")",
":",
"self",
".",
"_printf_buffers",
"[",
"buffer_name",
"]",
"=",
"collections",
".",
"deque",
"(",
"maxlen",
"=",
"self",
".",
"_buffer_length",
")"
] | [
103,
4
] | [
107,
39
] | python | en | ['en', 'en', 'en'] | True |
ReadBuffer.read_buffer | (self, buffer_name, num_chars=1) | Destructively reads (pops) from buffer.
| Destructively reads (pops) from buffer.
| def read_buffer(self, buffer_name, num_chars=1):
""" Destructively reads (pops) from buffer.
"""
if num_chars > len(self._buffers[buffer_name]):
num_chars = len(self._buffers[buffer_name])
return ''.join([self._buffers[buffer_name].popleft()
for x in range(0,... | [
"def",
"read_buffer",
"(",
"self",
",",
"buffer_name",
",",
"num_chars",
"=",
"1",
")",
":",
"if",
"num_chars",
">",
"len",
"(",
"self",
".",
"_buffers",
"[",
"buffer_name",
"]",
")",
":",
"num_chars",
"=",
"len",
"(",
"self",
".",
"_buffers",
"[",
"... | [
109,
4
] | [
115,
46
] | python | en | ['en', 'en', 'en'] | True |
ReadBuffer.read_printf_buffer | (self, buffer_name, num_chars=1) | Destructively reads (pops) from printf buffer.
| Destructively reads (pops) from printf buffer.
| def read_printf_buffer(self, buffer_name, num_chars=1):
""" Destructively reads (pops) from printf buffer.
"""
if num_chars > len(self._printf_buffers[buffer_name]):
num_chars = len(self._printf_buffers[buffer_name])
return ''.join([self._printf_buffers[buffer_name].popleft()... | [
"def",
"read_printf_buffer",
"(",
"self",
",",
"buffer_name",
",",
"num_chars",
"=",
"1",
")",
":",
"if",
"num_chars",
">",
"len",
"(",
"self",
".",
"_printf_buffers",
"[",
"buffer_name",
"]",
")",
":",
"num_chars",
"=",
"len",
"(",
"self",
".",
"_printf... | [
117,
4
] | [
123,
46
] | python | en | ['en', 'cs', 'en'] | True |
ReadBuffer.flush_buffer | (self, buffer_name) | Clears the buffer
| Clears the buffer
| def flush_buffer(self, buffer_name):
""" Clears the buffer
"""
self._buffers[buffer_name].clear() | [
"def",
"flush_buffer",
"(",
"self",
",",
"buffer_name",
")",
":",
"self",
".",
"_buffers",
"[",
"buffer_name",
"]",
".",
"clear",
"(",
")"
] | [
125,
4
] | [
128,
42
] | python | en | ['en', 'en', 'en'] | True |
ReadBuffer.flush_printf_buffer | (self, buffer_name) | Clears the printf buffer
| Clears the printf buffer
| def flush_printf_buffer(self, buffer_name):
""" Clears the printf buffer
"""
self._printf_buffers[buffer_name].clear() | [
"def",
"flush_printf_buffer",
"(",
"self",
",",
"buffer_name",
")",
":",
"self",
".",
"_printf_buffers",
"[",
"buffer_name",
"]",
".",
"clear",
"(",
")"
] | [
130,
4
] | [
133,
49
] | python | en | ['en', 'tg', 'en'] | True |
ReadBuffer.read_only_buffer | (self, buffer_name) | Non-destrive read of entire buffer
| Non-destrive read of entire buffer
| def read_only_buffer(self, buffer_name):
""" Non-destrive read of entire buffer
"""
return ''.join(list(self._buffers[buffer_name])) | [
"def",
"read_only_buffer",
"(",
"self",
",",
"buffer_name",
")",
":",
"return",
"''",
".",
"join",
"(",
"list",
"(",
"self",
".",
"_buffers",
"[",
"buffer_name",
"]",
")",
")"
] | [
135,
4
] | [
138,
56
] | python | en | ['en', 'it', 'en'] | True |
ReadBuffer.read_only_printf_buffer | (self, buffer_name) | Non-destrive read of entire printf buffer
| Non-destrive read of entire printf buffer
| def read_only_printf_buffer(self, buffer_name):
""" Non-destrive read of entire printf buffer
"""
return ''.join(list(self._printf_buffers[buffer_name])) | [
"def",
"read_only_printf_buffer",
"(",
"self",
",",
"buffer_name",
")",
":",
"return",
"''",
".",
"join",
"(",
"list",
"(",
"self",
".",
"_printf_buffers",
"[",
"buffer_name",
"]",
")",
")"
] | [
140,
4
] | [
143,
63
] | python | en | ['en', 'it', 'en'] | True |
ReadBuffer.read_all_buffer | (self, buffer_name) | Destructive read of entire buffer
| Destructive read of entire buffer
| def read_all_buffer(self, buffer_name):
"""Destructive read of entire buffer
"""
# reads until empty
result = ''.join(list(self._buffers[buffer_name]))
self._buffers[buffer_name].clear()
return result | [
"def",
"read_all_buffer",
"(",
"self",
",",
"buffer_name",
")",
":",
"# reads until empty",
"result",
"=",
"''",
".",
"join",
"(",
"list",
"(",
"self",
".",
"_buffers",
"[",
"buffer_name",
"]",
")",
")",
"self",
".",
"_buffers",
"[",
"buffer_name",
"]",
... | [
145,
4
] | [
151,
21
] | python | en | ['en', 'lb', 'en'] | True |
ReadBuffer.read_all_printf_buffer | (self, buffer_name) | Destructive read of entire printf buffer
| Destructive read of entire printf buffer
| def read_all_printf_buffer(self, buffer_name):
""" Destructive read of entire printf buffer
"""
# reads until empty
result = ''.join(list(self._printf_buffers[buffer_name]))
self._printf_buffers[buffer_name].clear()
return result | [
"def",
"read_all_printf_buffer",
"(",
"self",
",",
"buffer_name",
")",
":",
"# reads until empty",
"result",
"=",
"''",
".",
"join",
"(",
"list",
"(",
"self",
".",
"_printf_buffers",
"[",
"buffer_name",
"]",
")",
")",
"self",
".",
"_printf_buffers",
"[",
"bu... | [
153,
4
] | [
159,
21
] | python | en | ['en', 'lb', 'en'] | True |
ReadBuffer.in_waiting | (self, buffer_name) | Gets the number of characters unread from buffer
| Gets the number of characters unread from buffer
| def in_waiting(self, buffer_name):
"""Gets the number of characters unread from buffer
"""
return len(self._buffers[buffer_name]) | [
"def",
"in_waiting",
"(",
"self",
",",
"buffer_name",
")",
":",
"return",
"len",
"(",
"self",
".",
"_buffers",
"[",
"buffer_name",
"]",
")"
] | [
161,
4
] | [
164,
46
] | python | en | ['en', 'en', 'en'] | True |
ReadBuffer.in_printf_waiting | (self, buffer_name) | Gets the number of characters unread from printf buffer
| Gets the number of characters unread from printf buffer
| def in_printf_waiting(self, buffer_name):
"""Gets the number of characters unread from printf buffer
"""
return len(self._printf_buffers[buffer_name]) | [
"def",
"in_printf_waiting",
"(",
"self",
",",
"buffer_name",
")",
":",
"return",
"len",
"(",
"self",
".",
"_printf_buffers",
"[",
"buffer_name",
"]",
")"
] | [
166,
4
] | [
169,
53
] | python | en | ['en', 'en', 'en'] | True |
ReadBuffer._periodic_sample | (self) | Samples the input read buffer periodically
| Samples the input read buffer periodically
| def _periodic_sample(self):
"""Samples the input read buffer periodically
"""
count = 0
carryover_printf = "" # for storing printf spanning across samples
while self._stop == False:
count += 1
data = ''
if self._ser_port.isOpen() == False:
... | [
"def",
"_periodic_sample",
"(",
"self",
")",
":",
"count",
"=",
"0",
"carryover_printf",
"=",
"\"\"",
"# for storing printf spanning across samples",
"while",
"self",
".",
"_stop",
"==",
"False",
":",
"count",
"+=",
"1",
"data",
"=",
"''",
"if",
"self",
".",
... | [
171,
4
] | [
246,
58
] | python | en | ['en', 'en', 'en'] | True |
TestHistogramOptimBinNums.test_simple | (self) |
Straightforward testing with a mixture of linspace data (for
consistency). All test values have been precomputed and the values
shouldn't change
|
Straightforward testing with a mixture of linspace data (for
consistency). All test values have been precomputed and the values
shouldn't change
| def test_simple(self):
"""
Straightforward testing with a mixture of linspace data (for
consistency). All test values have been precomputed and the values
shouldn't change
"""
# Some basic sanity checking, with some fixed data.
# Checking for the correct number of... | [
"def",
"test_simple",
"(",
"self",
")",
":",
"# Some basic sanity checking, with some fixed data.",
"# Checking for the correct number of bins",
"basic_test",
"=",
"{",
"50",
":",
"{",
"'fd'",
":",
"4",
",",
"'scott'",
":",
"4",
",",
"'rice'",
":",
"8",
",",
"'stu... | [
441,
4
] | [
465,
79
] | python | en | ['en', 'error', 'th'] | False |
TestHistogramOptimBinNums.test_small | (self) |
Smaller datasets have the potential to cause issues with the data
adaptive methods, especially the FD method. All bin numbers have been
precalculated.
|
Smaller datasets have the potential to cause issues with the data
adaptive methods, especially the FD method. All bin numbers have been
precalculated.
| def test_small(self):
"""
Smaller datasets have the potential to cause issues with the data
adaptive methods, especially the FD method. All bin numbers have been
precalculated.
"""
small_dat = {1: {'fd': 1, 'scott': 1, 'rice': 1, 'sturges': 1,
'do... | [
"def",
"test_small",
"(",
"self",
")",
":",
"small_dat",
"=",
"{",
"1",
":",
"{",
"'fd'",
":",
"1",
",",
"'scott'",
":",
"1",
",",
"'rice'",
":",
"1",
",",
"'sturges'",
":",
"1",
",",
"'doane'",
":",
"1",
",",
"'sqrt'",
":",
"1",
",",
"'stone'"... | [
467,
4
] | [
485,
79
] | python | en | ['en', 'error', 'th'] | False |
TestHistogramOptimBinNums.test_incorrect_methods | (self) |
Check a Value Error is thrown when an unknown string is passed in
|
Check a Value Error is thrown when an unknown string is passed in
| def test_incorrect_methods(self):
"""
Check a Value Error is thrown when an unknown string is passed in
"""
check_list = ['mad', 'freeman', 'histograms', 'IQR']
for estimator in check_list:
assert_raises(ValueError, histogram, [1, 2, 3], estimator) | [
"def",
"test_incorrect_methods",
"(",
"self",
")",
":",
"check_list",
"=",
"[",
"'mad'",
",",
"'freeman'",
",",
"'histograms'",
",",
"'IQR'",
"]",
"for",
"estimator",
"in",
"check_list",
":",
"assert_raises",
"(",
"ValueError",
",",
"histogram",
",",
"[",
"1... | [
487,
4
] | [
493,
70
] | python | en | ['en', 'error', 'th'] | False |
TestHistogramOptimBinNums.test_novariance | (self) |
Check that methods handle no variance in data
Primarily for Scott and FD as the SD and IQR are both 0 in this case
|
Check that methods handle no variance in data
Primarily for Scott and FD as the SD and IQR are both 0 in this case
| def test_novariance(self):
"""
Check that methods handle no variance in data
Primarily for Scott and FD as the SD and IQR are both 0 in this case
"""
novar_dataset = np.ones(100)
novar_resultdict = {'fd': 1, 'scott': 1, 'rice': 1, 'sturges': 1,
... | [
"def",
"test_novariance",
"(",
"self",
")",
":",
"novar_dataset",
"=",
"np",
".",
"ones",
"(",
"100",
")",
"novar_resultdict",
"=",
"{",
"'fd'",
":",
"1",
",",
"'scott'",
":",
"1",
",",
"'rice'",
":",
"1",
",",
"'sturges'",
":",
"1",
",",
"'doane'",
... | [
495,
4
] | [
507,
62
] | python | en | ['en', 'error', 'th'] | False |
TestHistogramOptimBinNums.test_limited_variance | (self) |
Check when IQR is 0, but variance exists, we return the sturges value
and not the fd value.
|
Check when IQR is 0, but variance exists, we return the sturges value
and not the fd value.
| def test_limited_variance(self):
"""
Check when IQR is 0, but variance exists, we return the sturges value
and not the fd value.
"""
lim_var_data = np.ones(1000)
lim_var_data[:3] = 0
lim_var_data[-4:] = 100
edges_auto = histogram_bin_edges(lim_var_data, '... | [
"def",
"test_limited_variance",
"(",
"self",
")",
":",
"lim_var_data",
"=",
"np",
".",
"ones",
"(",
"1000",
")",
"lim_var_data",
"[",
":",
"3",
"]",
"=",
"0",
"lim_var_data",
"[",
"-",
"4",
":",
"]",
"=",
"100",
"edges_auto",
"=",
"histogram_bin_edges",
... | [
509,
4
] | [
525,
60
] | python | en | ['en', 'error', 'th'] | False |
TestHistogramOptimBinNums.test_outlier | (self) |
Check the FD, Scott and Doane with outliers.
The FD estimates a smaller binwidth since it's less affected by
outliers. Since the range is so (artificially) large, this means more
bins, most of which will be empty, but the data of interest usually is
unaffected. The Scott estima... |
Check the FD, Scott and Doane with outliers. | def test_outlier(self):
"""
Check the FD, Scott and Doane with outliers.
The FD estimates a smaller binwidth since it's less affected by
outliers. Since the range is so (artificially) large, this means more
bins, most of which will be empty, but the data of interest usually is
... | [
"def",
"test_outlier",
"(",
"self",
")",
":",
"xcenter",
"=",
"np",
".",
"linspace",
"(",
"-",
"10",
",",
"10",
",",
"50",
")",
"outlier_dataset",
"=",
"np",
".",
"hstack",
"(",
"(",
"np",
".",
"linspace",
"(",
"-",
"110",
",",
"-",
"100",
",",
... | [
527,
4
] | [
545,
41
] | python | en | ['en', 'error', 'th'] | False |
TestHistogramOptimBinNums.test_scott_vs_stone | (self) | Verify that Scott's rule and Stone's rule converges for normally distributed data | Verify that Scott's rule and Stone's rule converges for normally distributed data | def test_scott_vs_stone(self):
"""Verify that Scott's rule and Stone's rule converges for normally distributed data"""
def nbins_ratio(seed, size):
rng = np.random.RandomState(seed)
x = rng.normal(loc=0, scale=2, size=size)
a, b = len(np.histogram(x, 'stone')[0]), le... | [
"def",
"test_scott_vs_stone",
"(",
"self",
")",
":",
"def",
"nbins_ratio",
"(",
"seed",
",",
"size",
")",
":",
"rng",
"=",
"np",
".",
"random",
".",
"RandomState",
"(",
"seed",
")",
"x",
"=",
"rng",
".",
"normal",
"(",
"loc",
"=",
"0",
",",
"scale"... | [
547,
4
] | [
561,
69
] | python | en | ['en', 'en', 'en'] | True |
TestHistogramOptimBinNums.test_simple_range | (self) |
Straightforward testing with a mixture of linspace data (for
consistency). Adding in a 3rd mixture that will then be
completely ignored. All test values have been precomputed and
the shouldn't change.
|
Straightforward testing with a mixture of linspace data (for
consistency). Adding in a 3rd mixture that will then be
completely ignored. All test values have been precomputed and
the shouldn't change.
| def test_simple_range(self):
"""
Straightforward testing with a mixture of linspace data (for
consistency). Adding in a 3rd mixture that will then be
completely ignored. All test values have been precomputed and
the shouldn't change.
"""
# some basic sanity checki... | [
"def",
"test_simple_range",
"(",
"self",
")",
":",
"# some basic sanity checking, with some fixed data.",
"# Checking for the correct number of bins",
"basic_test",
"=",
"{",
"50",
":",
"{",
"'fd'",
":",
"8",
",",
"'scott'",
":",
"8",
",",
"'rice'",
":",
"15",
",",
... | [
563,
4
] | [
592,
58
] | python | en | ['en', 'error', 'th'] | False |
TestHistogramOptimBinNums.test_simple_weighted | (self) |
Check that weighted data raises a TypeError
|
Check that weighted data raises a TypeError
| def test_simple_weighted(self):
"""
Check that weighted data raises a TypeError
"""
estimator_list = ['fd', 'scott', 'rice', 'sturges', 'auto']
for estimator in estimator_list:
assert_raises(TypeError, histogram, [1, 2, 3],
estimator, weights... | [
"def",
"test_simple_weighted",
"(",
"self",
")",
":",
"estimator_list",
"=",
"[",
"'fd'",
",",
"'scott'",
",",
"'rice'",
",",
"'sturges'",
",",
"'auto'",
"]",
"for",
"estimator",
"in",
"estimator_list",
":",
"assert_raises",
"(",
"TypeError",
",",
"histogram",... | [
604,
4
] | [
611,
55
] | python | en | ['en', 'error', 'th'] | False |
TestHistogramdd.test_equal_edges | (self) | Test that adjacent entries in an edge array can be equal | Test that adjacent entries in an edge array can be equal | def test_equal_edges(self):
""" Test that adjacent entries in an edge array can be equal """
x = np.array([0, 1, 2])
y = np.array([0, 1, 2])
x_edges = np.array([0, 2, 2])
y_edges = 1
hist, edges = histogramdd((x, y), bins=(x_edges, y_edges))
hist_expected = np.ar... | [
"def",
"test_equal_edges",
"(",
"self",
")",
":",
"x",
"=",
"np",
".",
"array",
"(",
"[",
"0",
",",
"1",
",",
"2",
"]",
")",
"y",
"=",
"np",
".",
"array",
"(",
"[",
"0",
",",
"1",
",",
"2",
"]",
")",
"x_edges",
"=",
"np",
".",
"array",
"(... | [
751,
4
] | [
763,
41
] | python | en | ['en', 'en', 'en'] | True |
TestHistogramdd.test_edge_dtype | (self) | Test that if an edge array is input, its type is preserved | Test that if an edge array is input, its type is preserved | def test_edge_dtype(self):
""" Test that if an edge array is input, its type is preserved """
x = np.array([0, 10, 20])
y = x / 10
x_edges = np.array([0, 5, 15, 20])
y_edges = x_edges / 10
hist, edges = histogramdd((x, y), bins=(x_edges, y_edges))
assert_equal(ed... | [
"def",
"test_edge_dtype",
"(",
"self",
")",
":",
"x",
"=",
"np",
".",
"array",
"(",
"[",
"0",
",",
"10",
",",
"20",
"]",
")",
"y",
"=",
"x",
"/",
"10",
"x_edges",
"=",
"np",
".",
"array",
"(",
"[",
"0",
",",
"5",
",",
"15",
",",
"20",
"]"... | [
765,
4
] | [
774,
51
] | python | en | ['en', 'en', 'en'] | True |
test_bottom_up_simple_head | () | test bottom up simple head. | test bottom up simple head. | def test_bottom_up_simple_head():
"""test bottom up simple head."""
with pytest.raises(TypeError):
# extra
_ = BottomUpSimpleHead(
in_channels=512, num_joints=17, with_ae_loss=[True], extra=[])
# test final_conv_kernel
with pytest.raises(AssertionError):
_ = BottomUp... | [
"def",
"test_bottom_up_simple_head",
"(",
")",
":",
"with",
"pytest",
".",
"raises",
"(",
"TypeError",
")",
":",
"# extra",
"_",
"=",
"BottomUpSimpleHead",
"(",
"in_channels",
"=",
"512",
",",
"num_joints",
"=",
"17",
",",
"with_ae_loss",
"=",
"[",
"True",
... | [
7,
0
] | [
98,
54
] | python | en | ['en', 'et', 'en'] | True |
test_bottom_up_higherresolution_head | () | test bottom up higherresolution head. | test bottom up higherresolution head. | def test_bottom_up_higherresolution_head():
"""test bottom up higherresolution head."""
# test final_conv_kernel
with pytest.raises(AssertionError):
_ = BottomUpHigherResolutionHead(
in_channels=512,
num_joints=17,
with_ae_loss=[True, False],
extra={'... | [
"def",
"test_bottom_up_higherresolution_head",
"(",
")",
":",
"# test final_conv_kernel",
"with",
"pytest",
".",
"raises",
"(",
"AssertionError",
")",
":",
"_",
"=",
"BottomUpHigherResolutionHead",
"(",
"in_channels",
"=",
"512",
",",
"num_joints",
"=",
"17",
",",
... | [
101,
0
] | [
232,
54
] | python | de | ['nl', 'de', 'en'] | False |
_demo_inputs | (input_shape=(1, 3, 64, 64)) | Create a superset of inputs needed to run backbone.
Args:
input_shape (tuple): input batch dimensions.
Default: (1, 3, 64, 64).
Returns:
Random input tensor with the size of input_shape.
| Create a superset of inputs needed to run backbone. | def _demo_inputs(input_shape=(1, 3, 64, 64)):
"""Create a superset of inputs needed to run backbone.
Args:
input_shape (tuple): input batch dimensions.
Default: (1, 3, 64, 64).
Returns:
Random input tensor with the size of input_shape.
"""
inps = np.random.random(input_s... | [
"def",
"_demo_inputs",
"(",
"input_shape",
"=",
"(",
"1",
",",
"3",
",",
"64",
",",
"64",
")",
")",
":",
"inps",
"=",
"np",
".",
"random",
".",
"random",
"(",
"input_shape",
")",
"inps",
"=",
"torch",
".",
"FloatTensor",
"(",
"inps",
")",
"return",... | [
235,
0
] | [
246,
15
] | python | en | ['en', 'en', 'en'] | True |
Mounter.__init__ | (self, g, v, r, n, ns="default",
log_level=logging.INFO) | children event handlers | children event handlers | def __init__(self, g, v, r, n, ns="default",
log_level=logging.INFO):
""" children event handlers """
def on_child_create(body, *args, **kwargs):
_, _ = args, kwargs
_g, _v, _r = util.gvr_from_body(body)
_sync_from_parent(_g, _v, _r,
... | [
"def",
"__init__",
"(",
"self",
",",
"g",
",",
"v",
",",
"r",
",",
"n",
",",
"ns",
"=",
"\"default\"",
",",
"log_level",
"=",
"logging",
".",
"INFO",
")",
":",
"def",
"on_child_create",
"(",
"body",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",... | [
77,
4
] | [
428,
41
] | python | en | ['eu', 'nl', 'en'] | False |
test_file_logger_automatic_versioning | (tmpdir) | Verify that automatic versioning works | Verify that automatic versioning works | def test_file_logger_automatic_versioning(tmpdir):
"""Verify that automatic versioning works"""
root_dir = tmpdir.mkdir("exp")
root_dir.mkdir("version_0")
root_dir.mkdir("version_1")
logger = CSVLogger(save_dir=tmpdir, name="exp")
assert logger.version == 2 | [
"def",
"test_file_logger_automatic_versioning",
"(",
"tmpdir",
")",
":",
"root_dir",
"=",
"tmpdir",
".",
"mkdir",
"(",
"\"exp\"",
")",
"root_dir",
".",
"mkdir",
"(",
"\"version_0\"",
")",
"root_dir",
".",
"mkdir",
"(",
"\"version_1\"",
")",
"logger",
"=",
"CSV... | [
24,
0
] | [
33,
30
] | python | en | ['en', 'en', 'en'] | True |
test_file_logger_manual_versioning | (tmpdir) | Verify that manual versioning works | Verify that manual versioning works | def test_file_logger_manual_versioning(tmpdir):
"""Verify that manual versioning works"""
root_dir = tmpdir.mkdir("exp")
root_dir.mkdir("version_0")
root_dir.mkdir("version_1")
root_dir.mkdir("version_2")
logger = CSVLogger(save_dir=tmpdir, name="exp", version=1)
assert logger.version == ... | [
"def",
"test_file_logger_manual_versioning",
"(",
"tmpdir",
")",
":",
"root_dir",
"=",
"tmpdir",
".",
"mkdir",
"(",
"\"exp\"",
")",
"root_dir",
".",
"mkdir",
"(",
"\"version_0\"",
")",
"root_dir",
".",
"mkdir",
"(",
"\"version_1\"",
")",
"root_dir",
".",
"mkdi... | [
36,
0
] | [
46,
30
] | python | en | ['en', 'en', 'en'] | True |
test_file_logger_named_version | (tmpdir) | Verify that manual versioning works for string versions, e.g. '2020-02-05-162402' | Verify that manual versioning works for string versions, e.g. '2020-02-05-162402' | def test_file_logger_named_version(tmpdir):
"""Verify that manual versioning works for string versions, e.g. '2020-02-05-162402' """
exp_name = "exp"
tmpdir.mkdir(exp_name)
expected_version = "2020-02-05-162402"
logger = CSVLogger(save_dir=tmpdir, name=exp_name, version=expected_version)
logge... | [
"def",
"test_file_logger_named_version",
"(",
"tmpdir",
")",
":",
"exp_name",
"=",
"\"exp\"",
"tmpdir",
".",
"mkdir",
"(",
"exp_name",
")",
"expected_version",
"=",
"\"2020-02-05-162402\"",
"logger",
"=",
"CSVLogger",
"(",
"save_dir",
"=",
"tmpdir",
",",
"name",
... | [
49,
0
] | [
61,
59
] | python | en | ['en', 'en', 'en'] | True |
test_file_logger_no_name | (tmpdir, name) | Verify that None or empty name works | Verify that None or empty name works | def test_file_logger_no_name(tmpdir, name):
"""Verify that None or empty name works"""
logger = CSVLogger(save_dir=tmpdir, name=name)
logger.save()
assert logger.root_dir == tmpdir
assert os.listdir(tmpdir / 'version_0') | [
"def",
"test_file_logger_no_name",
"(",
"tmpdir",
",",
"name",
")",
":",
"logger",
"=",
"CSVLogger",
"(",
"save_dir",
"=",
"tmpdir",
",",
"name",
"=",
"name",
")",
"logger",
".",
"save",
"(",
")",
"assert",
"logger",
".",
"root_dir",
"==",
"tmpdir",
"ass... | [
65,
0
] | [
70,
43
] | python | en | ['en', 'en', 'en'] | True |
str_to_bool_or_str | (val: str) | Possibly convert a string representation of truth to bool.
Returns the input otherwise.
Based on the python implementation distutils.utils.strtobool
True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values
are 'n', 'no', 'f', 'false', 'off', and '0'.
| Possibly convert a string representation of truth to bool.
Returns the input otherwise.
Based on the python implementation distutils.utils.strtobool | def str_to_bool_or_str(val: str) -> Union[str, bool]:
"""Possibly convert a string representation of truth to bool.
Returns the input otherwise.
Based on the python implementation distutils.utils.strtobool
True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values
are 'n', 'no', 'f', 'fal... | [
"def",
"str_to_bool_or_str",
"(",
"val",
":",
"str",
")",
"->",
"Union",
"[",
"str",
",",
"bool",
"]",
":",
"lower",
"=",
"val",
".",
"lower",
"(",
")",
"if",
"lower",
"in",
"(",
"'y'",
",",
"'yes'",
",",
"'t'",
",",
"'true'",
",",
"'on'",
",",
... | [
22,
0
] | [
36,
18
] | python | en | ['en', 'en', 'en'] | True |
str_to_bool | (val: str) | Convert a string representation of truth to bool.
True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values
are 'n', 'no', 'f', 'false', 'off', and '0'. Raises ValueError if
'val' is anything else.
>>> str_to_bool('YES')
True
>>> str_to_bool('FALSE')
False
| Convert a string representation of truth to bool. | def str_to_bool(val: str) -> bool:
"""Convert a string representation of truth to bool.
True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values
are 'n', 'no', 'f', 'false', 'off', and '0'. Raises ValueError if
'val' is anything else.
>>> str_to_bool('YES')
True
>>> str_to_boo... | [
"def",
"str_to_bool",
"(",
"val",
":",
"str",
")",
"->",
"bool",
":",
"val",
"=",
"str_to_bool_or_str",
"(",
"val",
")",
"if",
"isinstance",
"(",
"val",
",",
"bool",
")",
":",
"return",
"val",
"raise",
"ValueError",
"(",
"f'invalid truth value {val}'",
")"... | [
39,
0
] | [
54,
50
] | python | en | ['en', 'en', 'en'] | True |
is_picklable | (obj: object) | Tests if an object can be pickled | Tests if an object can be pickled | def is_picklable(obj: object) -> bool:
"""Tests if an object can be pickled"""
try:
pickle.dumps(obj)
return True
except (pickle.PicklingError, AttributeError):
return False | [
"def",
"is_picklable",
"(",
"obj",
":",
"object",
")",
"->",
"bool",
":",
"try",
":",
"pickle",
".",
"dumps",
"(",
"obj",
")",
"return",
"True",
"except",
"(",
"pickle",
".",
"PicklingError",
",",
"AttributeError",
")",
":",
"return",
"False"
] | [
57,
0
] | [
64,
20
] | python | en | ['en', 'en', 'en'] | True |
clean_namespace | (hparams) | Removes all unpicklable entries from hparams | Removes all unpicklable entries from hparams | def clean_namespace(hparams):
"""Removes all unpicklable entries from hparams"""
hparams_dict = hparams
if isinstance(hparams, Namespace):
hparams_dict = hparams.__dict__
del_attrs = [k for k, v in hparams_dict.items() if not is_picklable(v)]
for k in del_attrs:
rank_zero_warn(f"a... | [
"def",
"clean_namespace",
"(",
"hparams",
")",
":",
"hparams_dict",
"=",
"hparams",
"if",
"isinstance",
"(",
"hparams",
",",
"Namespace",
")",
":",
"hparams_dict",
"=",
"hparams",
".",
"__dict__",
"del_attrs",
"=",
"[",
"k",
"for",
"k",
",",
"v",
"in",
"... | [
67,
0
] | [
78,
27
] | python | en | ['en', 'en', 'en'] | True |
parse_class_init_keys | (cls) | Parse key words for standard self, *args and **kwargs
>>> class Model():
... def __init__(self, hparams, *my_args, anykw=42, **my_kwargs):
... pass
>>> parse_class_init_keys(Model)
('self', 'my_args', 'my_kwargs')
| Parse key words for standard self, *args and **kwargs | def parse_class_init_keys(cls) -> Tuple[str, str, str]:
"""Parse key words for standard self, *args and **kwargs
>>> class Model():
... def __init__(self, hparams, *my_args, anykw=42, **my_kwargs):
... pass
>>> parse_class_init_keys(Model)
('self', 'my_args', 'my_kwargs')
"""
... | [
"def",
"parse_class_init_keys",
"(",
"cls",
")",
"->",
"Tuple",
"[",
"str",
",",
"str",
",",
"str",
"]",
":",
"init_parameters",
"=",
"inspect",
".",
"signature",
"(",
"cls",
".",
"__init__",
")",
".",
"parameters",
"# docs claims the params are always ordered",... | [
81,
0
] | [
105,
35
] | python | en | ['en', 'en', 'en'] | True |
collect_init_args | (frame, path_args: list, inside: bool = False) |
Recursively collects the arguments passed to the child constructors in the inheritance tree.
Args:
frame: the current stack frame
path_args: a list of dictionaries containing the constructor args in all parent classes
inside: track if we are inside inheritance path, avoid terminating t... |
Recursively collects the arguments passed to the child constructors in the inheritance tree. | def collect_init_args(frame, path_args: list, inside: bool = False) -> list:
"""
Recursively collects the arguments passed to the child constructors in the inheritance tree.
Args:
frame: the current stack frame
path_args: a list of dictionaries containing the constructor args in all parent ... | [
"def",
"collect_init_args",
"(",
"frame",
",",
"path_args",
":",
"list",
",",
"inside",
":",
"bool",
"=",
"False",
")",
"->",
"list",
":",
"_",
",",
"_",
",",
"_",
",",
"local_vars",
"=",
"inspect",
".",
"getargvalues",
"(",
"frame",
")",
"if",
"'__c... | [
124,
0
] | [
147,
24
] | python | en | ['en', 'error', 'th'] | False |
_lightning_get_all_attr_holders | (model, attribute) |
Special attribute finding for Lightning. Gets all of the objects or dicts that holds attribute.
Checks for attribute in model namespace, the old hparams namespace/dict, and the datamodule.
|
Special attribute finding for Lightning. Gets all of the objects or dicts that holds attribute.
Checks for attribute in model namespace, the old hparams namespace/dict, and the datamodule.
| def _lightning_get_all_attr_holders(model, attribute):
"""
Special attribute finding for Lightning. Gets all of the objects or dicts that holds attribute.
Checks for attribute in model namespace, the old hparams namespace/dict, and the datamodule.
"""
trainer = getattr(model, 'trainer', None)
h... | [
"def",
"_lightning_get_all_attr_holders",
"(",
"model",
",",
"attribute",
")",
":",
"trainer",
"=",
"getattr",
"(",
"model",
",",
"'trainer'",
",",
"None",
")",
"holders",
"=",
"[",
"]",
"# Check if attribute in model",
"if",
"hasattr",
"(",
"model",
",",
"att... | [
198,
0
] | [
220,
18
] | python | en | ['en', 'error', 'th'] | False |
_lightning_get_first_attr_holder | (model, attribute) |
Special attribute finding for Lightning. Gets the object or dict that holds attribute, or None.
Checks for attribute in model namespace, the old hparams namespace/dict, and the datamodule,
returns the last one that has it.
|
Special attribute finding for Lightning. Gets the object or dict that holds attribute, or None.
Checks for attribute in model namespace, the old hparams namespace/dict, and the datamodule,
returns the last one that has it.
| def _lightning_get_first_attr_holder(model, attribute):
"""
Special attribute finding for Lightning. Gets the object or dict that holds attribute, or None.
Checks for attribute in model namespace, the old hparams namespace/dict, and the datamodule,
returns the last one that has it.
"""
holders ... | [
"def",
"_lightning_get_first_attr_holder",
"(",
"model",
",",
"attribute",
")",
":",
"holders",
"=",
"_lightning_get_all_attr_holders",
"(",
"model",
",",
"attribute",
")",
"if",
"len",
"(",
"holders",
")",
"==",
"0",
":",
"return",
"None",
"# using the last holde... | [
223,
0
] | [
233,
22
] | python | en | ['en', 'error', 'th'] | False |
lightning_hasattr | (model, attribute) |
Special hasattr for Lightning. Checks for attribute in model namespace,
the old hparams namespace/dict, and the datamodule.
|
Special hasattr for Lightning. Checks for attribute in model namespace,
the old hparams namespace/dict, and the datamodule.
| def lightning_hasattr(model, attribute):
"""
Special hasattr for Lightning. Checks for attribute in model namespace,
the old hparams namespace/dict, and the datamodule.
"""
return _lightning_get_first_attr_holder(model, attribute) is not None | [
"def",
"lightning_hasattr",
"(",
"model",
",",
"attribute",
")",
":",
"return",
"_lightning_get_first_attr_holder",
"(",
"model",
",",
"attribute",
")",
"is",
"not",
"None"
] | [
236,
0
] | [
241,
73
] | python | en | ['en', 'error', 'th'] | False |
lightning_getattr | (model, attribute) |
Special getattr for Lightning. Checks for attribute in model namespace,
the old hparams namespace/dict, and the datamodule.
Raises:
AttributeError:
If ``model`` doesn't have ``attribute`` in any of
model namespace, the hparams namespace/dict, and the datamodule.
|
Special getattr for Lightning. Checks for attribute in model namespace,
the old hparams namespace/dict, and the datamodule. | def lightning_getattr(model, attribute):
"""
Special getattr for Lightning. Checks for attribute in model namespace,
the old hparams namespace/dict, and the datamodule.
Raises:
AttributeError:
If ``model`` doesn't have ``attribute`` in any of
model namespace, the hparams... | [
"def",
"lightning_getattr",
"(",
"model",
",",
"attribute",
")",
":",
"holder",
"=",
"_lightning_get_first_attr_holder",
"(",
"model",
",",
"attribute",
")",
"if",
"holder",
"is",
"None",
":",
"raise",
"AttributeError",
"(",
"f'{attribute} is neither stored in the mod... | [
244,
0
] | [
263,
37
] | python | en | ['en', 'error', 'th'] | False |
lightning_setattr | (model, attribute, value) |
Special setattr for Lightning. Checks for attribute in model namespace
and the old hparams namespace/dict.
Will also set the attribute on datamodule, if it exists.
Raises:
AttributeError:
If ``model`` doesn't have ``attribute`` in any of
model namespace, the hparams nam... |
Special setattr for Lightning. Checks for attribute in model namespace
and the old hparams namespace/dict.
Will also set the attribute on datamodule, if it exists. | def lightning_setattr(model, attribute, value):
"""
Special setattr for Lightning. Checks for attribute in model namespace
and the old hparams namespace/dict.
Will also set the attribute on datamodule, if it exists.
Raises:
AttributeError:
If ``model`` doesn't have ``attribute``... | [
"def",
"lightning_setattr",
"(",
"model",
",",
"attribute",
",",
"value",
")",
":",
"holders",
"=",
"_lightning_get_all_attr_holders",
"(",
"model",
",",
"attribute",
")",
"if",
"len",
"(",
"holders",
")",
"==",
"0",
":",
"raise",
"AttributeError",
"(",
"f'{... | [
266,
0
] | [
288,
45
] | python | en | ['en', 'error', 'th'] | False |
ValidationEpochEndVariations.validation_epoch_end | (self, outputs) |
Called at the end of validation to aggregate outputs
Args:
outputs: list of individual outputs of each validation step
|
Called at the end of validation to aggregate outputs | def validation_epoch_end(self, outputs):
"""
Called at the end of validation to aggregate outputs
Args:
outputs: list of individual outputs of each validation step
"""
# if returned a scalar from validation_step, outputs is a list of tensor scalars
# we retu... | [
"def",
"validation_epoch_end",
"(",
"self",
",",
"outputs",
")",
":",
"# if returned a scalar from validation_step, outputs is a list of tensor scalars",
"# we return just the average in this case (if we want)",
"def",
"_mean",
"(",
"res",
",",
"key",
")",
":",
"# recursive mean ... | [
23,
4
] | [
47,
22
] | python | en | ['en', 'error', 'th'] | False |
ValidationEpochEndVariations.validation_epoch_end__multiple_dataloaders | (self, outputs) |
Called at the end of validation to aggregate outputs
Args:
outputs: list of individual outputs of each validation step
|
Called at the end of validation to aggregate outputs | def validation_epoch_end__multiple_dataloaders(self, outputs):
"""
Called at the end of validation to aggregate outputs
Args:
outputs: list of individual outputs of each validation step
"""
# if returned a scalar from validation_step, outputs is a list of tensor sca... | [
"def",
"validation_epoch_end__multiple_dataloaders",
"(",
"self",
",",
"outputs",
")",
":",
"# if returned a scalar from validation_step, outputs is a list of tensor scalars",
"# we return just the average in this case (if we want)",
"def",
"_mean",
"(",
"res",
",",
"key",
")",
":"... | [
49,
4
] | [
77,
22
] | python | en | ['en', 'error', 'th'] | False |
Background.getBackgroundID | (self) |
Retorna os id's das imagens de background
|
Retorna os id's das imagens de background
| def getBackgroundID(self):
"""
Retorna os id's das imagens de background
"""
return [self.__background_default, *self.__background] | [
"def",
"getBackgroundID",
"(",
"self",
")",
":",
"return",
"[",
"self",
".",
"__background_default",
",",
"*",
"self",
".",
"__background",
"]"
] | [
42,
4
] | [
46,
62
] | python | en | ['en', 'error', 'th'] | False |
Background.getPhotoImage | (image=None, image_path=None, width=None, height=None, closeAfter=False) |
Retorna um objeto da classe PIL.ImageTk.PhotoImage de uma imagem e as imagens criadas de PIL.Image
(photoImage, new, original)
@param image: Instância de PIL.Image.open
@param image_path: Diretório da imagem
@param width: Largura da imagem
@param height: Altura da imag... |
Retorna um objeto da classe PIL.ImageTk.PhotoImage de uma imagem e as imagens criadas de PIL.Image
(photoImage, new, original) | def getPhotoImage(image=None, image_path=None, width=None, height=None, closeAfter=False):
"""
Retorna um objeto da classe PIL.ImageTk.PhotoImage de uma imagem e as imagens criadas de PIL.Image
(photoImage, new, original)
@param image: Instância de PIL.Image.open
@param image_p... | [
"def",
"getPhotoImage",
"(",
"image",
"=",
"None",
",",
"image_path",
"=",
"None",
",",
"width",
"=",
"None",
",",
"height",
"=",
"None",
",",
"closeAfter",
"=",
"False",
")",
":",
"if",
"not",
"image",
":",
"if",
"not",
"image_path",
":",
"return",
... | [
49,
4
] | [
88,
42
] | python | en | ['en', 'error', 'th'] | False |
Background.reset | (self) |
Método para resetar o background, apagando todos os itens que não sejam o plano de fundo
|
Método para resetar o background, apagando todos os itens que não sejam o plano de fundo
| def reset(self):
"""
Método para resetar o background, apagando todos os itens que não sejam o plano de fundo
"""
# Deleta todos os itens do canvas
self.delete("all")
# Para a animação passando False para o atributo "stop"
self.__stop = False
# Limpa a ... | [
"def",
"reset",
"(",
"self",
")",
":",
"# Deleta todos os itens do canvas",
"self",
".",
"delete",
"(",
"\"all\"",
")",
"# Para a animação passando False para o atributo \"stop\"",
"self",
".",
"__stop",
"=",
"False",
"# Limpa a lista de imagens usadas na animação",
"self",
... | [
90,
4
] | [
110,
109
] | python | en | ['en', 'error', 'th'] | False |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.