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
test__logger_connector__epoch_result_store__train
(tmpdir, monkeypatch)
Tests that LoggerConnector will properly capture logged information and reduce them
Tests that LoggerConnector will properly capture logged information and reduce them
def test__logger_connector__epoch_result_store__train(tmpdir, monkeypatch): """ Tests that LoggerConnector will properly capture logged information and reduce them """ monkeypatch.setenv("PL_DEV_DEBUG", "1") class TestModel(BoringModel): train_losses = [] @decorator_with_argum...
[ "def", "test__logger_connector__epoch_result_store__train", "(", "tmpdir", ",", "monkeypatch", ")", ":", "monkeypatch", ".", "setenv", "(", "\"PL_DEV_DEBUG\"", ",", "\"1\"", ")", "class", "TestModel", "(", "BoringModel", ")", ":", "train_losses", "=", "[", "]", "@...
[ 54, 0 ]
[ 109, 32 ]
python
en
['en', 'error', 'th']
False
test__logger_connector__epoch_result_store__train__ttbt
(tmpdir)
Tests that LoggerConnector will properly capture logged information with ttbt and reduce them
Tests that LoggerConnector will properly capture logged information with ttbt and reduce them
def test__logger_connector__epoch_result_store__train__ttbt(tmpdir): """ Tests that LoggerConnector will properly capture logged information with ttbt and reduce them """ truncated_bptt_steps = 2 sequence_size = 30 batch_size = 30 x_seq = torch.rand(batch_size, sequence_size, 1) y_s...
[ "def", "test__logger_connector__epoch_result_store__train__ttbt", "(", "tmpdir", ")", ":", "truncated_bptt_steps", "=", "2", "sequence_size", "=", "30", "batch_size", "=", "30", "x_seq", "=", "torch", ".", "rand", "(", "batch_size", ",", "sequence_size", ",", "1", ...
[ 112, 0 ]
[ 204, 69 ]
python
en
['en', 'error', 'th']
False
test__logger_connector__epoch_result_store__test_multi_dataloaders
(tmpdir, monkeypatch, num_dataloaders)
Tests that LoggerConnector will properly capture logged information in multi dataloaders scenario
Tests that LoggerConnector will properly capture logged information in multi dataloaders scenario
def test__logger_connector__epoch_result_store__test_multi_dataloaders(tmpdir, monkeypatch, num_dataloaders): """ Tests that LoggerConnector will properly capture logged information in multi dataloaders scenario """ monkeypatch.setenv("PL_DEV_DEBUG", "1") class TestModel(BoringModel): test_...
[ "def", "test__logger_connector__epoch_result_store__test_multi_dataloaders", "(", "tmpdir", ",", "monkeypatch", ",", "num_dataloaders", ")", ":", "monkeypatch", ".", "setenv", "(", "\"PL_DEV_DEBUG\"", ",", "\"1\"", ")", "class", "TestModel", "(", "BoringModel", ")", ":"...
[ 208, 0 ]
[ 265, 58 ]
python
en
['en', 'error', 'th']
False
test_logging_to_progress_bar_with_reserved_key
(tmpdir)
Test that logging a metric with a reserved name to the progress bar raises a warning.
Test that logging a metric with a reserved name to the progress bar raises a warning.
def test_logging_to_progress_bar_with_reserved_key(tmpdir): """ Test that logging a metric with a reserved name to the progress bar raises a warning. """ class TestModel(BoringModel): def training_step(self, *args, **kwargs): output = super().training_step(*args, **kwargs) self...
[ "def", "test_logging_to_progress_bar_with_reserved_key", "(", "tmpdir", ")", ":", "class", "TestModel", "(", "BoringModel", ")", ":", "def", "training_step", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "output", "=", "super", "(", ")", ...
[ 455, 0 ]
[ 471, 26 ]
python
en
['en', 'en', 'en']
True
CometLogger.experiment
(self)
r""" Actual Comet object. To use Comet features in your :class:`~pytorch_lightning.core.lightning.LightningModule` do the following. Example:: self.logger.experiment.some_comet_function()
r""" Actual Comet object. To use Comet features in your :class:`~pytorch_lightning.core.lightning.LightningModule` do the following.
def experiment(self): r""" Actual Comet object. To use Comet features in your :class:`~pytorch_lightning.core.lightning.LightningModule` do the following. Example:: self.logger.experiment.some_comet_function() """ if self._experiment is not None: ...
[ "def", "experiment", "(", "self", ")", ":", "if", "self", ".", "_experiment", "is", "not", "None", ":", "return", "self", ".", "_experiment", "if", "self", ".", "_future_experiment_key", "is", "not", "None", ":", "os", ".", "environ", "[", "\"COMET_EXPERIM...
[ 180, 4 ]
[ 226, 31 ]
python
cy
['en', 'cy', 'hi']
False
CometLogger.finalize
(self, status: str)
r""" When calling ``self.experiment.end()``, that experiment won't log any more data to Comet. That's why, if you need to log any more data, you need to create an ExistingCometExperiment. For example, to log data when testing your model after training, because when training is finalized ...
r""" When calling ``self.experiment.end()``, that experiment won't log any more data to Comet. That's why, if you need to log any more data, you need to create an ExistingCometExperiment. For example, to log data when testing your model after training, because when training is finalized ...
def finalize(self, status: str) -> None: r""" When calling ``self.experiment.end()``, that experiment won't log any more data to Comet. That's why, if you need to log any more data, you need to create an ExistingCometExperiment. For example, to log data when testing your model after trai...
[ "def", "finalize", "(", "self", ",", "status", ":", "str", ")", "->", "None", ":", "self", ".", "experiment", ".", "end", "(", ")", "self", ".", "reset_experiment", "(", ")" ]
[ 251, 4 ]
[ 262, 31 ]
python
cy
['en', 'cy', 'hi']
False
rename_for_jekyll
(nb_path: Path, warnings: Set[Tuple[str, str]]=None)
Return a Path's filename string appended with its modified time in YYYY-MM-DD format.
Return a Path's filename string appended with its modified time in YYYY-MM-DD format.
def rename_for_jekyll(nb_path: Path, warnings: Set[Tuple[str, str]]=None) -> str: """ Return a Path's filename string appended with its modified time in YYYY-MM-DD format. """ assert nb_path.exists(), f'{nb_path} could not be found.' # Checks if filename is compliant with Jekyll blog posts if _...
[ "def", "rename_for_jekyll", "(", "nb_path", ":", "Path", ",", "warnings", ":", "Set", "[", "Tuple", "[", "str", ",", "str", "]", "]", "=", "None", ")", "->", "str", ":", "assert", "nb_path", ".", "exists", "(", ")", ",", "f'{nb_path} could not be found.'...
[ 10, 0 ]
[ 28, 19 ]
python
en
['en', 'error', 'th']
False
TestSetOps.test_in1d_invert
(self)
Test in1d's invert parameter
Test in1d's invert parameter
def test_in1d_invert(self): "Test in1d's invert parameter" # We use two different sizes for the b array here to test the # two different paths in in1d(). for mult in (1, 10): a = np.array([5, 4, 5, 3, 4, 4, 3, 4, 3, 5, 2, 1, 5, 5]) b = [2, 3, 4] * mult ...
[ "def", "test_in1d_invert", "(", "self", ")", ":", "# We use two different sizes for the b array here to test the", "# two different paths in in1d().", "for", "mult", "in", "(", "1", ",", "10", ")", ":", "a", "=", "np", ".", "array", "(", "[", "5", ",", "4", ",",...
[ 300, 4 ]
[ 307, 78 ]
python
en
['en', 'lb', 'en']
True
create_button
(p1)
for creating a new database
for creating a new database
def create_button(p1): """ for creating a new database """ global cursor sql_command = """ CREATE TABLE notes ( id INTEGER PRIMARY KEY, title TEXT, note TEXT);""" try: cursor.execute(sql_command) w.errorOutput.configure(text="") except: w.erro...
[ "def", "create_button", "(", "p1", ")", ":", "global", "cursor", "sql_command", "=", "\"\"\"\n CREATE TABLE notes ( \n id INTEGER PRIMARY KEY, \n title TEXT, \n note TEXT);\"\"\"", "try", ":", "cursor", ".", "execute", "(", "sql_command", ")", "w", ".", "errorOu...
[ 52, 0 ]
[ 68, 67 ]
python
en
['en', 'error', 'th']
False
clear_button
(p1)
This function is for the clear button. This will clear the notice-input field
This function is for the clear button. This will clear the notice-input field
def clear_button(p1): """ This function is for the clear button. This will clear the notice-input field """ w.inputNotice.delete(1.0, END)
[ "def", "clear_button", "(", "p1", ")", ":", "w", ".", "inputNotice", ".", "delete", "(", "1.0", ",", "END", ")" ]
[ 99, 0 ]
[ 104, 34 ]
python
en
['en', 'error', 'th']
False
exit_button
(p1)
function for the exit button. this will exit the application.
function for the exit button. this will exit the application.
def exit_button(p1): """ function for the exit button. this will exit the application. """ sys.exit(0)
[ "def", "exit_button", "(", "p1", ")", ":", "sys", ".", "exit", "(", "0", ")" ]
[ 107, 0 ]
[ 112, 15 ]
python
en
['en', 'error', 'th']
False
NativeMixedPrecisionPlugin.backward
( self, model: LightningModule, closure_loss: torch.Tensor, optimizer: Optimizer, opt_idx: int, should_accumulate: bool, *args, **kwargs, )
performs the actual backpropagation Args: model: the model to be optimized closure_loss: the loss value obtained from the closure optimizer: the optimizer to perform the step lateron opt_idx: the optimizer's index should_accumulate: whether to accumul...
performs the actual backpropagation
def backward( self, model: LightningModule, closure_loss: torch.Tensor, optimizer: Optimizer, opt_idx: int, should_accumulate: bool, *args, **kwargs, ) -> torch.Tensor: """performs the actual backpropagation Args: model: th...
[ "def", "backward", "(", "self", ",", "model", ":", "LightningModule", ",", "closure_loss", ":", "torch", ".", "Tensor", ",", "optimizer", ":", "Optimizer", ",", "opt_idx", ":", "int", ",", "should_accumulate", ":", "bool", ",", "*", "args", ",", "*", "*"...
[ 36, 4 ]
[ 64, 27 ]
python
en
['en', 'en', 'en']
True
NativeMixedPrecisionPlugin.pre_optimizer_step
( self, pl_module: LightningModule, optimizer: Optimizer, optimizer_idx: int, lambda_closure: Callable, **kwargs )
always called before the optimizer step. Checks that the optimizer is not LBFGS, as this one is not supported by native amp
always called before the optimizer step. Checks that the optimizer is not LBFGS, as this one is not supported by native amp
def pre_optimizer_step( self, pl_module: LightningModule, optimizer: Optimizer, optimizer_idx: int, lambda_closure: Callable, **kwargs ) -> bool: """always called before the optimizer step. Checks that the optimizer is not LBFGS, as this one is not supported by native amp """ ...
[ "def", "pre_optimizer_step", "(", "self", ",", "pl_module", ":", "LightningModule", ",", "optimizer", ":", "Optimizer", ",", "optimizer_idx", ":", "int", ",", "lambda_closure", ":", "Callable", ",", "*", "*", "kwargs", ")", "->", "bool", ":", "if", "isinstan...
[ 66, 4 ]
[ 83, 20 ]
python
en
['en', 'en', 'en']
True
NativeMixedPrecisionPlugin.post_optimizer_step
(self, optimizer: Optimizer, optimizer_idx: int)
Updates the GradScaler
Updates the GradScaler
def post_optimizer_step(self, optimizer: Optimizer, optimizer_idx: int) -> None: """Updates the GradScaler""" self.scaler.step(optimizer) self.scaler.update()
[ "def", "post_optimizer_step", "(", "self", ",", "optimizer", ":", "Optimizer", ",", "optimizer_idx", ":", "int", ")", "->", "None", ":", "self", ".", "scaler", ".", "step", "(", "optimizer", ")", "self", ".", "scaler", ".", "update", "(", ")" ]
[ 85, 4 ]
[ 88, 28 ]
python
en
['en', 'nl', 'en']
True
NativeMixedPrecisionPlugin.train_step_context
(self)
Enable autocast context
Enable autocast context
def train_step_context(self) -> Generator[autocast, None, None]: """Enable autocast context""" with torch.cuda.amp.autocast(): yield
[ "def", "train_step_context", "(", "self", ")", "->", "Generator", "[", "autocast", ",", "None", ",", "None", "]", ":", "with", "torch", ".", "cuda", ".", "amp", ".", "autocast", "(", ")", ":", "yield" ]
[ 91, 4 ]
[ 94, 17 ]
python
de
['de', 'fr', 'en']
False
do_search
()
Extract the posted data; perform the search; return results.
Extract the posted data; perform the search; return results.
def do_search() -> 'html': """Extract the posted data; perform the search; return results.""" @copy_current_request_context def log_request(req: 'flask_request', res: str) -> None: """Log details of the web request and the results.""" # raise Exception("Something awful just happened.") ...
[ "def", "do_search", "(", ")", "->", "'html'", ":", "@", "copy_current_request_context", "def", "log_request", "(", "req", ":", "'flask_request'", ",", "res", ":", "str", ")", "->", "None", ":", "\"\"\"Log details of the web request and the results.\"\"\"", "# raise Ex...
[ 30, 0 ]
[ 65, 48 ]
python
en
['en', 'en', 'en']
True
entry_page
()
Display this webapp's HTML form.
Display this webapp's HTML form.
def entry_page() -> 'html': """Display this webapp's HTML form.""" return render_template('entry.html', the_title='Welcome to search4letters on the web!')
[ "def", "entry_page", "(", ")", "->", "'html'", ":", "return", "render_template", "(", "'entry.html'", ",", "the_title", "=", "'Welcome to search4letters on the web!'", ")" ]
[ 70, 0 ]
[ 73, 77 ]
python
en
['en', 'en', 'en']
True
view_the_log
()
Display the contents of the log file as a HTML table.
Display the contents of the log file as a HTML table.
def view_the_log() -> 'html': """Display the contents of the log file as a HTML table.""" try: with UseDatabase(app.config['dbconfig']) as cursor: _SQL = """select phrase, letters, ip, browser_string, results from log""" cursor.execute(_SQL) conten...
[ "def", "view_the_log", "(", ")", "->", "'html'", ":", "try", ":", "with", "UseDatabase", "(", "app", ".", "config", "[", "'dbconfig'", "]", ")", "as", "cursor", ":", "_SQL", "=", "\"\"\"select phrase, letters, ip, browser_string, results\n from log\...
[ 78, 0 ]
[ 100, 18 ]
python
en
['en', 'en', 'en']
True
loadFile
(fileName)
loadFile: This function loads the file and reads its lines.
loadFile: This function loads the file and reads its lines.
def loadFile(fileName): """ loadFile: This function loads the file and reads its lines. """ global lines fo = open(fileName) for line in fo: lines.append(line) fo.close()
[ "def", "loadFile", "(", "fileName", ")", ":", "global", "lines", "fo", "=", "open", "(", "fileName", ")", "for", "line", "in", "fo", ":", "lines", ".", "append", "(", "line", ")", "fo", ".", "close", "(", ")" ]
[ 49, 0 ]
[ 57, 14 ]
python
en
['en', 'error', 'th']
False
scanner
(string)
scanner: This function builds the tokens by the content of the file. The tokens will be saved in list 'tokens'
scanner: This function builds the tokens by the content of the file. The tokens will be saved in list 'tokens'
def scanner(string): """ scanner: This function builds the tokens by the content of the file. The tokens will be saved in list 'tokens' """ global tokens token = "" state = 0 # init state for ch in string: if state == 0: if ch == 'm': # catch mov-command ...
[ "def", "scanner", "(", "string", ")", ":", "global", "tokens", "token", "=", "\"\"", "state", "=", "0", "# init state", "for", "ch", "in", "string", ":", "if", "state", "==", "0", ":", "if", "ch", "==", "'m'", ":", "# catch mov-command", "state", "=", ...
[ 60, 0 ]
[ 916, 37 ]
python
en
['en', 'error', 'th']
False
scan
()
scan: applys function scanner() to each line of the source code.
scan: applys function scanner() to each line of the source code.
def scan(): """ scan: applys function scanner() to each line of the source code. """ global lines assert len(lines) > 0, "no lines" for line in lines: try: scanner(line) except InvalidSyntax: print("line=", line)
[ "def", "scan", "(", ")", ":", "global", "lines", "assert", "len", "(", "lines", ")", ">", "0", ",", "\"no lines\"", "for", "line", "in", "lines", ":", "try", ":", "scanner", "(", "line", ")", "except", "InvalidSyntax", ":", "print", "(", "\"line=\"", ...
[ 919, 0 ]
[ 929, 32 ]
python
en
['en', 'error', 'th']
False
parser
()
parser: parses the tokens of the list 'tokens'
parser: parses the tokens of the list 'tokens'
def parser(): """ parser: parses the tokens of the list 'tokens' """ global tokens global eax, ebx, ecx, edx assert len(tokens) > 0, "no tokens" pointer = 0 # pointer for tokens token = Token("", "") tmpToken = Token("", "") while pointer < len(tokens): token = ...
[ "def", "parser", "(", ")", ":", "global", "tokens", "global", "eax", ",", "ebx", ",", "ecx", ",", "edx", "assert", "len", "(", "tokens", ")", ">", "0", ",", "\"no tokens\"", "pointer", "=", "0", "# pointer for tokens", "token", "=", "Token", "(", "\"\"...
[ 932, 0 ]
[ 1609, 20 ]
python
en
['en', 'error', 'th']
False
registerLabels
()
This function search for labels / subprogram-labels and registers this in the 'jumps' list.
This function search for labels / subprogram-labels and registers this in the 'jumps' list.
def registerLabels(): """ This function search for labels / subprogram-labels and registers this in the 'jumps' list. """ for i in range(len(tokens)): if (tokens[i].t == "label"): jumps[tokens[i].token] = i elif tokens[i].t == "subprogram": jumps[tokens[i].tok...
[ "def", "registerLabels", "(", ")", ":", "for", "i", "in", "range", "(", "len", "(", "tokens", ")", ")", ":", "if", "(", "tokens", "[", "i", "]", ".", "t", "==", "\"label\"", ")", ":", "jumps", "[", "tokens", "[", "i", "]", ".", "token", "]", ...
[ 1612, 0 ]
[ 1620, 38 ]
python
en
['en', 'error', 'th']
False
resetInterpreter
()
resets the interpreter mind.
resets the interpreter mind.
def resetInterpreter(): """ resets the interpreter mind. """ global eax, ebx, ecx, edx, zeroFlag, stack global variables, jumps, lines, tokens, returnStack eax = 0 ebx = 0 ecx = 0 edx = 0 zeroFlag = False stack = [] jumps = {} variables = {} lines = [] tok...
[ "def", "resetInterpreter", "(", ")", ":", "global", "eax", ",", "ebx", ",", "ecx", ",", "edx", ",", "zeroFlag", ",", "stack", "global", "variables", ",", "jumps", ",", "lines", ",", "tokens", ",", "returnStack", "eax", "=", "0", "ebx", "=", "0", "ecx...
[ 1623, 0 ]
[ 1639, 20 ]
python
en
['en', 'error', 'th']
False
main
()
reads textfiles from the command-line and interprets them.
reads textfiles from the command-line and interprets them.
def main(): """ reads textfiles from the command-line and interprets them. """ # [1:] because the first argument is the program itself. for arg in sys.argv[1:]: resetInterpreter() # resets interpreter mind try: loadFile(arg) scan() regist...
[ "def", "main", "(", ")", ":", "# [1:] because the first argument is the program itself.", "for", "arg", "in", "sys", ".", "argv", "[", "1", ":", "]", ":", "resetInterpreter", "(", ")", "# resets interpreter mind", "try", ":", "loadFile", "(", "arg", ")", "scan",...
[ 1649, 0 ]
[ 1668, 54 ]
python
en
['en', 'error', 'th']
False
_can_target
(cmd, arch)
Return true if the architecture supports the -arch flag
Return true if the architecture supports the -arch flag
def _can_target(cmd, arch): """Return true if the architecture supports the -arch flag""" newcmd = cmd[:] fid, filename = tempfile.mkstemp(suffix=".f") os.close(fid) try: d = os.path.dirname(filename) output = os.path.splitext(filename)[0] + ".o" try: newcmd.exten...
[ "def", "_can_target", "(", "cmd", ",", "arch", ")", ":", "newcmd", "=", "cmd", "[", ":", "]", "fid", ",", "filename", "=", "tempfile", ".", "mkstemp", "(", "suffix", "=", "\".f\"", ")", "os", ".", "close", "(", "fid", ")", "try", ":", "d", "=", ...
[ 533, 0 ]
[ 551, 16 ]
python
en
['en', 'en', 'en']
True
GnuFCompiler.gnu_version_match
(self, version_string)
Handle the different versions of GNU fortran compilers
Handle the different versions of GNU fortran compilers
def gnu_version_match(self, version_string): """Handle the different versions of GNU fortran compilers""" # Strip warning(s) that may be emitted by gfortran while version_string.startswith('gfortran: warning'): version_string = version_string[version_string.find('\n') + 1:] ...
[ "def", "gnu_version_match", "(", "self", ",", "version_string", ")", ":", "# Strip warning(s) that may be emitted by gfortran", "while", "version_string", ".", "startswith", "(", "'gfortran: warning'", ")", ":", "version_string", "=", "version_string", "[", "version_string"...
[ 40, 4 ]
[ 82, 46 ]
python
en
['en', 'en', 'en']
True
GnuFCompiler._c_arch_flags
(self)
Return detected arch flags from CFLAGS
Return detected arch flags from CFLAGS
def _c_arch_flags(self): """ Return detected arch flags from CFLAGS """ from distutils import sysconfig try: cflags = sysconfig.get_config_vars()['CFLAGS'] except KeyError: return [] arch_re = re.compile(r"-arch\s+(\w+)") arch_flags = [] fo...
[ "def", "_c_arch_flags", "(", "self", ")", ":", "from", "distutils", "import", "sysconfig", "try", ":", "cflags", "=", "sysconfig", ".", "get_config_vars", "(", ")", "[", "'CFLAGS'", "]", "except", "KeyError", ":", "return", "[", "]", "arch_re", "=", "re", ...
[ 250, 4 ]
[ 261, 25 ]
python
en
['en', 'en', 'en']
True
Gnu95FCompiler._universal_flags
(self, cmd)
Return a list of -arch flags for every supported architecture.
Return a list of -arch flags for every supported architecture.
def _universal_flags(self, cmd): """Return a list of -arch flags for every supported architecture.""" if not sys.platform == 'darwin': return [] arch_flags = [] # get arches the C compiler gets. c_archs = self._c_arch_flags() if "i386" in c_archs: ...
[ "def", "_universal_flags", "(", "self", ",", "cmd", ")", ":", "if", "not", "sys", ".", "platform", "==", "'darwin'", ":", "return", "[", "]", "arch_flags", "=", "[", "]", "# get arches the C compiler gets.", "c_archs", "=", "self", ".", "_c_arch_flags", "(",...
[ 328, 4 ]
[ 342, 25 ]
python
en
['en', 'en', 'en']
True
Gnu95FCompiler._link_wrapper_lib
(self, objects, output_dir, extra_dll_dir, chained_dlls, is_archive)
Create a wrapper shared library for the given objects Return an MSVC-compatible lib
Create a wrapper shared library for the given objects
def _link_wrapper_lib(self, objects, output_dir, extra_dll_dir, chained_dlls, is_archive): """Create a wrapper shared library for the given objects Return an MSVC-compatible lib """ c_compiler = self.c_compiler if c_compiler.compiler_type != "msvc": ...
[ "def", "_link_wrapper_lib", "(", "self", ",", "objects", ",", "output_dir", ",", "extra_dll_dir", ",", "chained_dlls", ",", "is_archive", ")", ":", "c_compiler", "=", "self", ".", "c_compiler", "if", "c_compiler", ".", "compiler_type", "!=", "\"msvc\"", ":", "...
[ 421, 4 ]
[ 481, 33 ]
python
en
['en', 'en', 'en']
True
Gnu95FCompiler.wrap_unlinkable_objects
(self, objects, output_dir, extra_dll_dir)
Convert a set of object files that are not compatible with the default linker, to a file that is compatible.
Convert a set of object files that are not compatible with the default linker, to a file that is compatible.
def wrap_unlinkable_objects(self, objects, output_dir, extra_dll_dir): """ Convert a set of object files that are not compatible with the default linker, to a file that is compatible. """ if self.c_compiler.compiler_type == "msvc": # Compile a DLL and return the lib f...
[ "def", "wrap_unlinkable_objects", "(", "self", ",", "objects", ",", "output_dir", ",", "extra_dll_dir", ")", ":", "if", "self", ".", "c_compiler", ".", "compiler_type", "==", "\"msvc\"", ":", "# Compile a DLL and return the lib for the DLL as", "# the object. Also keep tr...
[ 487, 4 ]
[ 530, 54 ]
python
en
['en', 'error', 'th']
False
old_func4
(self, x)
Summary. Further info.
Summary.
def old_func4(self, x): """Summary. Further info. """ return x
[ "def", "old_func4", "(", "self", ",", "x", ")", ":", "return", "x" ]
[ 41, 0 ]
[ 46, 12 ]
python
en
['en', 'ky', 'en']
False
old_func5
(self, x)
Summary. Bizarre indentation.
Summary.
def old_func5(self, x): """Summary. Bizarre indentation. """ return x
[ "def", "old_func5", "(", "self", ",", "x", ")", ":", "return", "x" ]
[ 50, 0 ]
[ 55, 12 ]
python
en
['en', 'ky', 'en']
False
old_func6
(self, x)
Also in PEP-257.
Also in PEP-257.
def old_func6(self, x): """ Also in PEP-257. """ return x
[ "def", "old_func6", "(", "self", ",", "x", ")", ":", "return", "x" ]
[ 59, 0 ]
[ 63, 12 ]
python
en
['en', 'error', 'th']
False
_deprecate_out_named_y
(f)
Allow the out argument to be passed as the name `y` (deprecated) In future, this decorator should be removed.
Allow the out argument to be passed as the name `y` (deprecated)
def _deprecate_out_named_y(f): """ Allow the out argument to be passed as the name `y` (deprecated) In future, this decorator should be removed. """ @functools.wraps(f) def func(x, out=None, **kwargs): if 'y' in kwargs: if 'out' in kwargs: raise TypeError( ...
[ "def", "_deprecate_out_named_y", "(", "f", ")", ":", "@", "functools", ".", "wraps", "(", "f", ")", "def", "func", "(", "x", ",", "out", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "'y'", "in", "kwargs", ":", "if", "'out'", "in", "kwarg...
[ 17, 0 ]
[ 39, 15 ]
python
en
['en', 'error', 'th']
False
_fix_out_named_y
(f)
Allow the out argument to be passed as the name `y` (deprecated) This decorator should only be used if _deprecate_out_named_y is used on a corresponding dispatcher function.
Allow the out argument to be passed as the name `y` (deprecated)
def _fix_out_named_y(f): """ Allow the out argument to be passed as the name `y` (deprecated) This decorator should only be used if _deprecate_out_named_y is used on a corresponding dispatcher function. """ @functools.wraps(f) def func(x, out=None, **kwargs): if 'y' in kwargs: ...
[ "def", "_fix_out_named_y", "(", "f", ")", ":", "@", "functools", ".", "wraps", "(", "f", ")", "def", "func", "(", "x", ",", "out", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "'y'", "in", "kwargs", ":", "# we already did error checking in _de...
[ 42, 0 ]
[ 56, 15 ]
python
en
['en', 'error', 'th']
False
_fix_and_maybe_deprecate_out_named_y
(f)
Use the appropriate decorator, depending upon if dispatching is being used.
Use the appropriate decorator, depending upon if dispatching is being used.
def _fix_and_maybe_deprecate_out_named_y(f): """ Use the appropriate decorator, depending upon if dispatching is being used. """ if ARRAY_FUNCTION_ENABLED: return _fix_out_named_y(f) else: return _deprecate_out_named_y(f)
[ "def", "_fix_and_maybe_deprecate_out_named_y", "(", "f", ")", ":", "if", "ARRAY_FUNCTION_ENABLED", ":", "return", "_fix_out_named_y", "(", "f", ")", "else", ":", "return", "_deprecate_out_named_y", "(", "f", ")" ]
[ 59, 0 ]
[ 66, 40 ]
python
en
['en', 'error', 'th']
False
fix
(x, out=None)
Round to nearest integer towards zero. Round an array of floats element-wise to nearest integer towards zero. The rounded values are returned as floats. Parameters ---------- x : array_like An array of floats to be rounded y : ndarray, optional Output array Returns ...
Round to nearest integer towards zero.
def fix(x, out=None): """ Round to nearest integer towards zero. Round an array of floats element-wise to nearest integer towards zero. The rounded values are returned as floats. Parameters ---------- x : array_like An array of floats to be rounded y : ndarray, optional ...
[ "def", "fix", "(", "x", ",", "out", "=", "None", ")", ":", "# promote back to an array if flattened", "res", "=", "nx", ".", "asanyarray", "(", "nx", ".", "ceil", "(", "x", ",", "out", "=", "out", ")", ")", "res", "=", "nx", ".", "floor", "(", "x",...
[ 76, 0 ]
[ 118, 14 ]
python
en
['en', 'error', 'th']
False
isposinf
(x, out=None)
Test element-wise for positive infinity, return result as bool array. Parameters ---------- x : array_like The input array. y : array_like, optional A boolean array with the same shape as `x` to store the result. Returns ------- out : ndarray A boolean array wi...
Test element-wise for positive infinity, return result as bool array.
def isposinf(x, out=None): """ Test element-wise for positive infinity, return result as bool array. Parameters ---------- x : array_like The input array. y : array_like, optional A boolean array with the same shape as `x` to store the result. Returns ------- out : ...
[ "def", "isposinf", "(", "x", ",", "out", "=", "None", ")", ":", "is_inf", "=", "nx", ".", "isinf", "(", "x", ")", "try", ":", "signbit", "=", "~", "nx", ".", "signbit", "(", "x", ")", "except", "TypeError", ":", "raise", "TypeError", "(", "'This ...
[ 123, 0 ]
[ 187, 51 ]
python
en
['en', 'error', 'th']
False
isneginf
(x, out=None)
Test element-wise for negative infinity, return result as bool array. Parameters ---------- x : array_like The input array. out : array_like, optional A boolean array with the same shape and type as `x` to store the result. Returns ------- out : ndarray ...
Test element-wise for negative infinity, return result as bool array.
def isneginf(x, out=None): """ Test element-wise for negative infinity, return result as bool array. Parameters ---------- x : array_like The input array. out : array_like, optional A boolean array with the same shape and type as `x` to store the result. Returns ...
[ "def", "isneginf", "(", "x", ",", "out", "=", "None", ")", ":", "is_inf", "=", "nx", ".", "isinf", "(", "x", ")", "try", ":", "signbit", "=", "nx", ".", "signbit", "(", "x", ")", "except", "TypeError", ":", "raise", "TypeError", "(", "'This operati...
[ 192, 0 ]
[ 257, 51 ]
python
en
['en', 'error', 'th']
False
Result.get_batch_log_metrics
(self, include_forked_originals=True, add_dataloader_idx=False)
Gets the metrics to log at the end of the batch step
Gets the metrics to log at the end of the batch step
def get_batch_log_metrics(self, include_forked_originals=True, add_dataloader_idx=False) -> dict: """ Gets the metrics to log at the end of the batch step """ result = {} meta = self['meta'] for k, options in meta.items(): if k == '_internal': ...
[ "def", "get_batch_log_metrics", "(", "self", ",", "include_forked_originals", "=", "True", ",", "add_dataloader_idx", "=", "False", ")", "->", "dict", ":", "result", "=", "{", "}", "meta", "=", "self", "[", "'meta'", "]", "for", "k", ",", "options", "in", ...
[ 284, 4 ]
[ 307, 21 ]
python
en
['en', 'error', 'th']
False
Result.get_epoch_log_metrics
(self, add_dataloader_idx=False)
Gets the metrics to log at the end of epoch
Gets the metrics to log at the end of epoch
def get_epoch_log_metrics(self, add_dataloader_idx=False) -> dict: """ Gets the metrics to log at the end of epoch """ result = {} meta = self['meta'] for k, options in meta.items(): if k == '_internal': continue if options['forked...
[ "def", "get_epoch_log_metrics", "(", "self", ",", "add_dataloader_idx", "=", "False", ")", "->", "dict", ":", "result", "=", "{", "}", "meta", "=", "self", "[", "'meta'", "]", "for", "k", ",", "options", "in", "meta", ".", "items", "(", ")", ":", "if...
[ 309, 4 ]
[ 338, 21 ]
python
en
['en', 'error', 'th']
False
Result.get_epoch_pbar_metrics
(self, add_dataloader_idx=False)
Gets the metrics to log at the end of epoch
Gets the metrics to log at the end of epoch
def get_epoch_pbar_metrics(self, add_dataloader_idx=False): """ Gets the metrics to log at the end of epoch """ result = {} meta = self['meta'] for k, options in meta.items(): if k == '_internal': continue if options['forked']: ...
[ "def", "get_epoch_pbar_metrics", "(", "self", ",", "add_dataloader_idx", "=", "False", ")", ":", "result", "=", "{", "}", "meta", "=", "self", "[", "'meta'", "]", "for", "k", ",", "options", "in", "meta", ".", "items", "(", ")", ":", "if", "k", "==",...
[ 340, 4 ]
[ 370, 21 ]
python
en
['en', 'error', 'th']
False
Result.get_forked_metrics
(self, add_dataloader_idx=False)
Gets the metrics to log at the end of epoch
Gets the metrics to log at the end of epoch
def get_forked_metrics(self, add_dataloader_idx=False): """ Gets the metrics to log at the end of epoch """ result = {} meta = self['meta'] for k, options in meta.items(): if k == '_internal': continue dl_key = self._add_dataloade...
[ "def", "get_forked_metrics", "(", "self", ",", "add_dataloader_idx", "=", "False", ")", ":", "result", "=", "{", "}", "meta", "=", "self", "[", "'meta'", "]", "for", "k", ",", "options", "in", "meta", ".", "items", "(", ")", ":", "if", "k", "==", "...
[ 372, 4 ]
[ 392, 21 ]
python
en
['en', 'error', 'th']
False
Result.get_batch_pbar_metrics
(self, include_forked_originals=True, add_dataloader_idx=False)
Gets the metrics to log at the end of the batch step
Gets the metrics to log at the end of the batch step
def get_batch_pbar_metrics(self, include_forked_originals=True, add_dataloader_idx=False): """ Gets the metrics to log at the end of the batch step """ result = {} meta = self['meta'] for k, options in meta.items(): if k == '_internal': contin...
[ "def", "get_batch_pbar_metrics", "(", "self", ",", "include_forked_originals", "=", "True", ",", "add_dataloader_idx", "=", "False", ")", ":", "result", "=", "{", "}", "meta", "=", "self", "[", "'meta'", "]", "for", "k", ",", "options", "in", "meta", ".", ...
[ 394, 4 ]
[ 416, 21 ]
python
en
['en', 'error', 'th']
False
Result.to
(self, *args, **kwargs)
Move all self attributes to the given device.
Move all self attributes to the given device.
def to(self, *args, **kwargs): """Move all self attributes to the given device.""" for k, v in self.items(): if isinstance(v, torch.Tensor): self.__setitem__(k, v.to(*args, **kwargs))
[ "def", "to", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "for", "k", ",", "v", "in", "self", ".", "items", "(", ")", ":", "if", "isinstance", "(", "v", ",", "torch", ".", "Tensor", ")", ":", "self", ".", "__setitem__", "...
[ 423, 4 ]
[ 427, 58 ]
python
en
['en', 'en', 'en']
True
Result.cpu
(self)
Move all self attributes to CPU.
Move all self attributes to CPU.
def cpu(self): """Move all self attributes to CPU.""" self.to(torch.device("cpu"))
[ "def", "cpu", "(", "self", ")", ":", "self", ".", "to", "(", "torch", ".", "device", "(", "\"cpu\"", ")", ")" ]
[ 429, 4 ]
[ 431, 36 ]
python
en
['en', 'en', 'en']
True
Result.unpack_batch_size
(sample)
Recursively unpack sample to find a torch.Tensor. returns len(tensor) when found, or 1 when it hits an empty or non iterable.
Recursively unpack sample to find a torch.Tensor. returns len(tensor) when found, or 1 when it hits an empty or non iterable.
def unpack_batch_size(sample): """ Recursively unpack sample to find a torch.Tensor. returns len(tensor) when found, or 1 when it hits an empty or non iterable. """ if isinstance(sample, torch.Tensor): size = sample.size(0) elif isinstance(sample, str): ...
[ "def", "unpack_batch_size", "(", "sample", ")", ":", "if", "isinstance", "(", "sample", ",", "torch", ".", "Tensor", ")", ":", "size", "=", "sample", ".", "size", "(", "0", ")", "elif", "isinstance", "(", "sample", ",", "str", ")", ":", "return", "le...
[ 456, 4 ]
[ 473, 19 ]
python
en
['en', 'error', 'th']
False
Result.rename_keys
(self, map_dict: dict)
Maps key values to the target values. Useful when renaming variables in mass. Args: map_dict:
Maps key values to the target values. Useful when renaming variables in mass.
def rename_keys(self, map_dict: dict): """ Maps key values to the target values. Useful when renaming variables in mass. Args: map_dict: """ meta = self.meta for source, dest in map_dict.items(): # map the main keys self[dest] = self[s...
[ "def", "rename_keys", "(", "self", ",", "map_dict", ":", "dict", ")", ":", "meta", "=", "self", ".", "meta", "for", "source", ",", "dest", "in", "map_dict", ".", "items", "(", ")", ":", "# map the main keys", "self", "[", "dest", "]", "=", "self", "[...
[ 616, 4 ]
[ 631, 28 ]
python
en
['en', 'error', 'th']
False
JiraRestClient.get_boards
(self, start_at=0, max_results=100, board_type=None, name=None, project_key_or_id=None)
Returns all boards. This only includes boards that the user has permission to view. :param start_at: The starting index of the returned boards. Base index: 0. :param max_results: The maximum number of boards to return per page. Default: 100. :param board_type: Filters results to boards ...
Returns all boards. This only includes boards that the user has permission to view. :param start_at: The starting index of the returned boards. Base index: 0. :param max_results: The maximum number of boards to return per page. Default: 100. :param board_type: Filters results to boards ...
def get_boards(self, start_at=0, max_results=100, board_type=None, name=None, project_key_or_id=None): """ Returns all boards. This only includes boards that the user has permission to view. :param start_at: The starting index of the returned boards. Base index: 0. :param max_results: Th...
[ "def", "get_boards", "(", "self", ",", "start_at", "=", "0", ",", "max_results", "=", "100", ",", "board_type", "=", "None", ",", "name", "=", "None", ",", "project_key_or_id", "=", "None", ")", ":", "loop_count", "=", "max_results", "//", "BATCH_SIZE_BOAR...
[ 10, 4 ]
[ 45, 26 ]
python
en
['en', 'error', 'th']
False
JiraRestClient.get_users
(self, username='.', start_at=0, max_results=1000, include_active=True, include_inactive=False)
Returns a list of users that match the search string. This resource cannot be accessed anonymously. :param username: A query string used to search username, name or e-mail address. "." - search for all users. :param start_at: the index of the first user to return (0-based). :param max_r...
Returns a list of users that match the search string. This resource cannot be accessed anonymously. :param username: A query string used to search username, name or e-mail address. "." - search for all users. :param start_at: the index of the first user to return (0-based). :param max_r...
def get_users(self, username='.', start_at=0, max_results=1000, include_active=True, include_inactive=False): """ Returns a list of users that match the search string. This resource cannot be accessed anonymously. :param username: A query string used to search username, name or e-mail address. "...
[ "def", "get_users", "(", "self", ",", "username", "=", "'.'", ",", "start_at", "=", "0", ",", "max_results", "=", "1000", ",", "include_active", "=", "True", ",", "include_inactive", "=", "False", ")", ":", "loop_count", "=", "max_results", "//", "BATCH_SI...
[ 47, 4 ]
[ 77, 25 ]
python
en
['en', 'error', 'th']
False
JiraRestClient.issues_search
(self, jql='order by key', start_at=0, max_results=1000, fields=None)
Searches for issues using JQL. :param jql: a JQL query string :param start_at: the index of the first issue to return (0-based) :param max_results: the maximum number of issues to return (defaults to 50). :param fields: the list of fields to return for each issue. By default, al...
Searches for issues using JQL. :param jql: a JQL query string :param start_at: the index of the first issue to return (0-based) :param max_results: the maximum number of issues to return (defaults to 50). :param fields: the list of fields to return for each issue. By default, al...
def issues_search(self, jql='order by key', start_at=0, max_results=1000, fields=None): """ Searches for issues using JQL. :param jql: a JQL query string :param start_at: the index of the first issue to return (0-based) :param max_results: the maximum number of issues to return (...
[ "def", "issues_search", "(", "self", ",", "jql", "=", "'order by key'", ",", "start_at", "=", "0", ",", "max_results", "=", "1000", ",", "fields", "=", "None", ")", ":", "loop_count", "=", "max_results", "//", "BATCH_SIZE_ISSUES", "+", "1", "issues", "=", ...
[ 79, 4 ]
[ 117, 21 ]
python
en
['en', 'error', 'th']
False
JiraRestClient.issues_search_parallel
(self, jql='order by key', max_results=1000, fields=None)
Parallel version
Parallel version
def issues_search_parallel(self, jql='order by key', max_results=1000, fields=None): """ Parallel version """ from multiprocessing import cpu_count from multiprocessing.pool import ThreadPool api_url = f'{self.host}/rest/api/2/search' if max_results % BATCH_SIZE...
[ "def", "issues_search_parallel", "(", "self", ",", "jql", "=", "'order by key'", ",", "max_results", "=", "1000", ",", "fields", "=", "None", ")", ":", "from", "multiprocessing", "import", "cpu_count", "from", "multiprocessing", ".", "pool", "import", "ThreadPoo...
[ 119, 4 ]
[ 155, 21 ]
python
en
['en', 'error', 'th']
False
JiraRestClient.create_user
(self, display_name=None, email=None, name='', password='', application_keys=None)
Creates a user. This resource is retained for legacy compatibility. As soon as a more suitable alternative is available this resource will be deprecated. :param name: The username for the user. This property is deprecated because of privacy changes. :param password: A password for the u...
Creates a user. This resource is retained for legacy compatibility. As soon as a more suitable alternative is available this resource will be deprecated. :param name: The username for the user. This property is deprecated because of privacy changes. :param password: A password for the u...
def create_user(self, display_name=None, email=None, name='', password='', application_keys=None): """ Creates a user. This resource is retained for legacy compatibility. As soon as a more suitable alternative is available this resource will be deprecated. :param name: The username for t...
[ "def", "create_user", "(", "self", ",", "display_name", "=", "None", ",", "email", "=", "None", ",", "name", "=", "''", ",", "password", "=", "''", ",", "application_keys", "=", "None", ")", ":", "api_url", "=", "self", ".", "_host", "+", "\"/rest/api/...
[ 163, 4 ]
[ 187, 30 ]
python
en
['en', 'error', 'th']
False
JiraRestClient.get_all_projects
(self)
:return: Returns the projects list of all project types - all categories
:return: Returns the projects list of all project types - all categories
def get_all_projects(self): """ :return: Returns the projects list of all project types - all categories """ api_url = f'{self.host}/rest/api/2/project' response = self.get(api_url, 'Could not get the list of projects') return response.json()
[ "def", "get_all_projects", "(", "self", ")", ":", "api_url", "=", "f'{self.host}/rest/api/2/project'", "response", "=", "self", ".", "get", "(", "api_url", ",", "'Could not get the list of projects'", ")", "return", "response", ".", "json", "(", ")" ]
[ 189, 4 ]
[ 196, 30 ]
python
en
['en', 'error', 'th']
False
SuperTensorTestCase.testNorm
(self)
Test norm function
Test norm function
def testNorm(self): "Test norm function" print(self.typeStr, "... ", file=sys.stderr) norm = SuperTensor.__dict__[self.typeStr + "Norm"] supertensor = np.arange(2*2*2*2, dtype=self.typeCode).reshape((2, 2, 2, 2)) #Note: cludge to get an answer of the same type as supertensor. ...
[ "def", "testNorm", "(", "self", ")", ":", "print", "(", "self", ".", "typeStr", ",", "\"... \"", ",", "file", "=", "sys", ".", "stderr", ")", "norm", "=", "SuperTensor", ".", "__dict__", "[", "self", ".", "typeStr", "+", "\"Norm\"", "]", "supertensor",...
[ 28, 4 ]
[ 36, 60 ]
python
en
['en', 'en', 'en']
True
SuperTensorTestCase.testNormBadList
(self)
Test norm function with bad list
Test norm function with bad list
def testNormBadList(self): "Test norm function with bad list" print(self.typeStr, "... ", file=sys.stderr) norm = SuperTensor.__dict__[self.typeStr + "Norm"] supertensor = [[[[0, "one"], [2, 3]], [[3, "two"], [1, 0]]], [[[0, "one"], [2, 3]], [[3, "two"], [1, 0]]]] self.assertRais...
[ "def", "testNormBadList", "(", "self", ")", ":", "print", "(", "self", ".", "typeStr", ",", "\"... \"", ",", "file", "=", "sys", ".", "stderr", ")", "norm", "=", "SuperTensor", ".", "__dict__", "[", "self", ".", "typeStr", "+", "\"Norm\"", "]", "supert...
[ 39, 4 ]
[ 44, 58 ]
python
en
['en', 'en', 'en']
True
SuperTensorTestCase.testNormWrongDim
(self)
Test norm function with wrong dimensions
Test norm function with wrong dimensions
def testNormWrongDim(self): "Test norm function with wrong dimensions" print(self.typeStr, "... ", file=sys.stderr) norm = SuperTensor.__dict__[self.typeStr + "Norm"] supertensor = np.arange(2*2*2, dtype=self.typeCode).reshape((2, 2, 2)) self.assertRaises(TypeError, norm, superte...
[ "def", "testNormWrongDim", "(", "self", ")", ":", "print", "(", "self", ".", "typeStr", ",", "\"... \"", ",", "file", "=", "sys", ".", "stderr", ")", "norm", "=", "SuperTensor", ".", "__dict__", "[", "self", ".", "typeStr", "+", "\"Norm\"", "]", "super...
[ 47, 4 ]
[ 52, 55 ]
python
en
['en', 'en', 'en']
True
SuperTensorTestCase.testNormWrongSize
(self)
Test norm function with wrong size
Test norm function with wrong size
def testNormWrongSize(self): "Test norm function with wrong size" print(self.typeStr, "... ", file=sys.stderr) norm = SuperTensor.__dict__[self.typeStr + "Norm"] supertensor = np.arange(3*2*2, dtype=self.typeCode).reshape((3, 2, 2)) self.assertRaises(TypeError, norm, supertensor)
[ "def", "testNormWrongSize", "(", "self", ")", ":", "print", "(", "self", ".", "typeStr", ",", "\"... \"", ",", "file", "=", "sys", ".", "stderr", ")", "norm", "=", "SuperTensor", ".", "__dict__", "[", "self", ".", "typeStr", "+", "\"Norm\"", "]", "supe...
[ 55, 4 ]
[ 60, 55 ]
python
en
['en', 'en', 'en']
True
SuperTensorTestCase.testNormNonContainer
(self)
Test norm function with non-container
Test norm function with non-container
def testNormNonContainer(self): "Test norm function with non-container" print(self.typeStr, "... ", file=sys.stderr) norm = SuperTensor.__dict__[self.typeStr + "Norm"] self.assertRaises(TypeError, norm, None)
[ "def", "testNormNonContainer", "(", "self", ")", ":", "print", "(", "self", ".", "typeStr", ",", "\"... \"", ",", "file", "=", "sys", ".", "stderr", ")", "norm", "=", "SuperTensor", ".", "__dict__", "[", "self", ".", "typeStr", "+", "\"Norm\"", "]", "s...
[ 63, 4 ]
[ 67, 48 ]
python
en
['en', 'en', 'en']
True
SuperTensorTestCase.testMax
(self)
Test max function
Test max function
def testMax(self): "Test max function" print(self.typeStr, "... ", file=sys.stderr) max = SuperTensor.__dict__[self.typeStr + "Max"] supertensor = [[[[1, 2], [3, 4]], [[5, 6], [7, 8]]], [[[1, 2], [3, 4]], [[5, 6], [7, 8]]]] self.assertEqual(max(supertensor), 8)
[ "def", "testMax", "(", "self", ")", ":", "print", "(", "self", ".", "typeStr", ",", "\"... \"", ",", "file", "=", "sys", ".", "stderr", ")", "max", "=", "SuperTensor", ".", "__dict__", "[", "self", ".", "typeStr", "+", "\"Max\"", "]", "supertensor", ...
[ 70, 4 ]
[ 75, 45 ]
python
en
['en', 'en', 'en']
True
SuperTensorTestCase.testMaxBadList
(self)
Test max function with bad list
Test max function with bad list
def testMaxBadList(self): "Test max function with bad list" print(self.typeStr, "... ", file=sys.stderr) max = SuperTensor.__dict__[self.typeStr + "Max"] supertensor = [[[[1, "two"], [3, 4]], [[5, "six"], [7, 8]]], [[[1, "two"], [3, 4]], [[5, "six"], [7, 8]]]] self.assertRaises(B...
[ "def", "testMaxBadList", "(", "self", ")", ":", "print", "(", "self", ".", "typeStr", ",", "\"... \"", ",", "file", "=", "sys", ".", "stderr", ")", "max", "=", "SuperTensor", ".", "__dict__", "[", "self", ".", "typeStr", "+", "\"Max\"", "]", "supertens...
[ 78, 4 ]
[ 83, 57 ]
python
en
['en', 'en', 'en']
True
SuperTensorTestCase.testMaxNonContainer
(self)
Test max function with non-container
Test max function with non-container
def testMaxNonContainer(self): "Test max function with non-container" print(self.typeStr, "... ", file=sys.stderr) max = SuperTensor.__dict__[self.typeStr + "Max"] self.assertRaises(TypeError, max, None)
[ "def", "testMaxNonContainer", "(", "self", ")", ":", "print", "(", "self", ".", "typeStr", ",", "\"... \"", ",", "file", "=", "sys", ".", "stderr", ")", "max", "=", "SuperTensor", ".", "__dict__", "[", "self", ".", "typeStr", "+", "\"Max\"", "]", "self...
[ 86, 4 ]
[ 90, 47 ]
python
en
['en', 'en', 'en']
True
SuperTensorTestCase.testMaxWrongDim
(self)
Test max function with wrong dimensions
Test max function with wrong dimensions
def testMaxWrongDim(self): "Test max function with wrong dimensions" print(self.typeStr, "... ", file=sys.stderr) max = SuperTensor.__dict__[self.typeStr + "Max"] self.assertRaises(TypeError, max, [0, -1, 2, -3])
[ "def", "testMaxWrongDim", "(", "self", ")", ":", "print", "(", "self", ".", "typeStr", ",", "\"... \"", ",", "file", "=", "sys", ".", "stderr", ")", "max", "=", "SuperTensor", ".", "__dict__", "[", "self", ".", "typeStr", "+", "\"Max\"", "]", "self", ...
[ 93, 4 ]
[ 97, 57 ]
python
en
['en', 'en', 'en']
True
SuperTensorTestCase.testMin
(self)
Test min function
Test min function
def testMin(self): "Test min function" print(self.typeStr, "... ", file=sys.stderr) min = SuperTensor.__dict__[self.typeStr + "Min"] supertensor = [[[[9, 8], [7, 6]], [[5, 4], [3, 2]]], [[[9, 8], [7, 6]], [[5, 4], [3, 2]]]] self.assertEqual(min(supertensor), 2)
[ "def", "testMin", "(", "self", ")", ":", "print", "(", "self", ".", "typeStr", ",", "\"... \"", ",", "file", "=", "sys", ".", "stderr", ")", "min", "=", "SuperTensor", ".", "__dict__", "[", "self", ".", "typeStr", "+", "\"Min\"", "]", "supertensor", ...
[ 100, 4 ]
[ 105, 45 ]
python
en
['de', 'en', 'en']
True
SuperTensorTestCase.testMinBadList
(self)
Test min function with bad list
Test min function with bad list
def testMinBadList(self): "Test min function with bad list" print(self.typeStr, "... ", file=sys.stderr) min = SuperTensor.__dict__[self.typeStr + "Min"] supertensor = [[[["nine", 8], [7, 6]], [["five", 4], [3, 2]]], [[["nine", 8], [7, 6]], [["five", 4], [3, 2]]]] self.assertRais...
[ "def", "testMinBadList", "(", "self", ")", ":", "print", "(", "self", ".", "typeStr", ",", "\"... \"", ",", "file", "=", "sys", ".", "stderr", ")", "min", "=", "SuperTensor", ".", "__dict__", "[", "self", ".", "typeStr", "+", "\"Min\"", "]", "supertens...
[ 108, 4 ]
[ 113, 57 ]
python
en
['en', 'en', 'en']
True
SuperTensorTestCase.testMinNonContainer
(self)
Test min function with non-container
Test min function with non-container
def testMinNonContainer(self): "Test min function with non-container" print(self.typeStr, "... ", file=sys.stderr) min = SuperTensor.__dict__[self.typeStr + "Min"] self.assertRaises(TypeError, min, True)
[ "def", "testMinNonContainer", "(", "self", ")", ":", "print", "(", "self", ".", "typeStr", ",", "\"... \"", ",", "file", "=", "sys", ".", "stderr", ")", "min", "=", "SuperTensor", ".", "__dict__", "[", "self", ".", "typeStr", "+", "\"Min\"", "]", "self...
[ 116, 4 ]
[ 120, 47 ]
python
en
['en', 'en', 'en']
True
SuperTensorTestCase.testMinWrongDim
(self)
Test min function with wrong dimensions
Test min function with wrong dimensions
def testMinWrongDim(self): "Test min function with wrong dimensions" print(self.typeStr, "... ", file=sys.stderr) min = SuperTensor.__dict__[self.typeStr + "Min"] self.assertRaises(TypeError, min, [[1, 3], [5, 7]])
[ "def", "testMinWrongDim", "(", "self", ")", ":", "print", "(", "self", ".", "typeStr", ",", "\"... \"", ",", "file", "=", "sys", ".", "stderr", ")", "min", "=", "SuperTensor", ".", "__dict__", "[", "self", ".", "typeStr", "+", "\"Min\"", "]", "self", ...
[ 123, 4 ]
[ 127, 59 ]
python
en
['en', 'en', 'en']
True
SuperTensorTestCase.testScale
(self)
Test scale function
Test scale function
def testScale(self): "Test scale function" print(self.typeStr, "... ", file=sys.stderr) scale = SuperTensor.__dict__[self.typeStr + "Scale"] supertensor = np.arange(3*3*3*3, dtype=self.typeCode).reshape((3, 3, 3, 3)) answer = supertensor.copy()*4 scale(supertensor, 4) ...
[ "def", "testScale", "(", "self", ")", ":", "print", "(", "self", ".", "typeStr", ",", "\"... \"", ",", "file", "=", "sys", ".", "stderr", ")", "scale", "=", "SuperTensor", ".", "__dict__", "[", "self", ".", "typeStr", "+", "\"Scale\"", "]", "supertenso...
[ 130, 4 ]
[ 137, 61 ]
python
en
['it', 'en', 'en']
True
SuperTensorTestCase.testScaleWrongType
(self)
Test scale function with wrong type
Test scale function with wrong type
def testScaleWrongType(self): "Test scale function with wrong type" print(self.typeStr, "... ", file=sys.stderr) scale = SuperTensor.__dict__[self.typeStr + "Scale"] supertensor = np.array([[[1, 0, 1], [0, 1, 0], [1, 0, 1]], [[0, 1, 0], [1, 0, 1], [0, 1, 0]], ...
[ "def", "testScaleWrongType", "(", "self", ")", ":", "print", "(", "self", ".", "typeStr", ",", "\"... \"", ",", "file", "=", "sys", ".", "stderr", ")", "scale", "=", "SuperTensor", ".", "__dict__", "[", "self", ".", "typeStr", "+", "\"Scale\"", "]", "s...
[ 140, 4 ]
[ 147, 56 ]
python
en
['en', 'en', 'en']
True
SuperTensorTestCase.testScaleWrongDim
(self)
Test scale function with wrong dimensions
Test scale function with wrong dimensions
def testScaleWrongDim(self): "Test scale function with wrong dimensions" print(self.typeStr, "... ", file=sys.stderr) scale = SuperTensor.__dict__[self.typeStr + "Scale"] supertensor = np.array([[1, 0, 1], [0, 1, 0], [1, 0, 1], [0, 1, 0], [1, 0, 1], [0, 1, 0]], ...
[ "def", "testScaleWrongDim", "(", "self", ")", ":", "print", "(", "self", ".", "typeStr", ",", "\"... \"", ",", "file", "=", "sys", ".", "stderr", ")", "scale", "=", "SuperTensor", ".", "__dict__", "[", "self", ".", "typeStr", "+", "\"Scale\"", "]", "su...
[ 150, 4 ]
[ 156, 56 ]
python
en
['en', 'en', 'en']
True
SuperTensorTestCase.testScaleWrongSize
(self)
Test scale function with wrong size
Test scale function with wrong size
def testScaleWrongSize(self): "Test scale function with wrong size" print(self.typeStr, "... ", file=sys.stderr) scale = SuperTensor.__dict__[self.typeStr + "Scale"] supertensor = np.array([[[1, 0], [0, 1], [1, 0]], [[0, 1], [1, 0], [0, 1]], ...
[ "def", "testScaleWrongSize", "(", "self", ")", ":", "print", "(", "self", ".", "typeStr", ",", "\"... \"", ",", "file", "=", "sys", ".", "stderr", ")", "scale", "=", "SuperTensor", ".", "__dict__", "[", "self", ".", "typeStr", "+", "\"Scale\"", "]", "s...
[ 159, 4 ]
[ 166, 56 ]
python
en
['en', 'en', 'en']
True
SuperTensorTestCase.testScaleNonArray
(self)
Test scale function with non-array
Test scale function with non-array
def testScaleNonArray(self): "Test scale function with non-array" print(self.typeStr, "... ", file=sys.stderr) scale = SuperTensor.__dict__[self.typeStr + "Scale"] self.assertRaises(TypeError, scale, True)
[ "def", "testScaleNonArray", "(", "self", ")", ":", "print", "(", "self", ".", "typeStr", ",", "\"... \"", ",", "file", "=", "sys", ".", "stderr", ")", "scale", "=", "SuperTensor", ".", "__dict__", "[", "self", ".", "typeStr", "+", "\"Scale\"", "]", "se...
[ 169, 4 ]
[ 173, 49 ]
python
en
['en', 'en', 'en']
True
SuperTensorTestCase.testFloor
(self)
Test floor function
Test floor function
def testFloor(self): "Test floor function" print(self.typeStr, "... ", file=sys.stderr) supertensor = np.arange(2*2*2*2, dtype=self.typeCode).reshape((2, 2, 2, 2)) answer = supertensor.copy() answer[answer < 4] = 4 floor = SuperTensor.__dict__[self.typeStr + "Floor"] ...
[ "def", "testFloor", "(", "self", ")", ":", "print", "(", "self", ".", "typeStr", ",", "\"... \"", ",", "file", "=", "sys", ".", "stderr", ")", "supertensor", "=", "np", ".", "arange", "(", "2", "*", "2", "*", "2", "*", "2", ",", "dtype", "=", "...
[ 176, 4 ]
[ 185, 58 ]
python
nl
['nl', 'nl', 'en']
True
SuperTensorTestCase.testFloorWrongType
(self)
Test floor function with wrong type
Test floor function with wrong type
def testFloorWrongType(self): "Test floor function with wrong type" print(self.typeStr, "... ", file=sys.stderr) floor = SuperTensor.__dict__[self.typeStr + "Floor"] supertensor = np.ones(2*2*2*2, dtype='c').reshape((2, 2, 2, 2)) self.assertRaises(TypeError, floor, supertensor)
[ "def", "testFloorWrongType", "(", "self", ")", ":", "print", "(", "self", ".", "typeStr", ",", "\"... \"", ",", "file", "=", "sys", ".", "stderr", ")", "floor", "=", "SuperTensor", ".", "__dict__", "[", "self", ".", "typeStr", "+", "\"Floor\"", "]", "s...
[ 188, 4 ]
[ 193, 56 ]
python
en
['en', 'en', 'en']
True
SuperTensorTestCase.testFloorWrongDim
(self)
Test floor function with wrong type
Test floor function with wrong type
def testFloorWrongDim(self): "Test floor function with wrong type" print(self.typeStr, "... ", file=sys.stderr) floor = SuperTensor.__dict__[self.typeStr + "Floor"] supertensor = np.arange(2*2*2, dtype=self.typeCode).reshape((2, 2, 2)) self.assertRaises(TypeError, floor, superten...
[ "def", "testFloorWrongDim", "(", "self", ")", ":", "print", "(", "self", ".", "typeStr", ",", "\"... \"", ",", "file", "=", "sys", ".", "stderr", ")", "floor", "=", "SuperTensor", ".", "__dict__", "[", "self", ".", "typeStr", "+", "\"Floor\"", "]", "su...
[ 196, 4 ]
[ 201, 56 ]
python
en
['en', 'en', 'en']
True
SuperTensorTestCase.testFloorNonArray
(self)
Test floor function with non-array
Test floor function with non-array
def testFloorNonArray(self): "Test floor function with non-array" print(self.typeStr, "... ", file=sys.stderr) floor = SuperTensor.__dict__[self.typeStr + "Floor"] self.assertRaises(TypeError, floor, object)
[ "def", "testFloorNonArray", "(", "self", ")", ":", "print", "(", "self", ".", "typeStr", ",", "\"... \"", ",", "file", "=", "sys", ".", "stderr", ")", "floor", "=", "SuperTensor", ".", "__dict__", "[", "self", ".", "typeStr", "+", "\"Floor\"", "]", "se...
[ 204, 4 ]
[ 208, 51 ]
python
en
['en', 'en', 'en']
True
SuperTensorTestCase.testCeil
(self)
Test ceil function
Test ceil function
def testCeil(self): "Test ceil function" print(self.typeStr, "... ", file=sys.stderr) supertensor = np.arange(2*2*2*2, dtype=self.typeCode).reshape((2, 2, 2, 2)) answer = supertensor.copy() answer[answer > 5] = 5 ceil = SuperTensor.__dict__[self.typeStr + "Ceil"] ...
[ "def", "testCeil", "(", "self", ")", ":", "print", "(", "self", ".", "typeStr", ",", "\"... \"", ",", "file", "=", "sys", ".", "stderr", ")", "supertensor", "=", "np", ".", "arange", "(", "2", "*", "2", "*", "2", "*", "2", ",", "dtype", "=", "s...
[ 211, 4 ]
[ 219, 58 ]
python
en
['nb', 'fr', 'en']
False
SuperTensorTestCase.testCeilWrongType
(self)
Test ceil function with wrong type
Test ceil function with wrong type
def testCeilWrongType(self): "Test ceil function with wrong type" print(self.typeStr, "... ", file=sys.stderr) ceil = SuperTensor.__dict__[self.typeStr + "Ceil"] supertensor = np.ones(2*2*2*2, 'c').reshape((2, 2, 2, 2)) self.assertRaises(TypeError, ceil, supertensor)
[ "def", "testCeilWrongType", "(", "self", ")", ":", "print", "(", "self", ".", "typeStr", ",", "\"... \"", ",", "file", "=", "sys", ".", "stderr", ")", "ceil", "=", "SuperTensor", ".", "__dict__", "[", "self", ".", "typeStr", "+", "\"Ceil\"", "]", "supe...
[ 222, 4 ]
[ 227, 55 ]
python
en
['en', 'en', 'en']
True
SuperTensorTestCase.testCeilWrongDim
(self)
Test ceil function with wrong dimensions
Test ceil function with wrong dimensions
def testCeilWrongDim(self): "Test ceil function with wrong dimensions" print(self.typeStr, "... ", file=sys.stderr) ceil = SuperTensor.__dict__[self.typeStr + "Ceil"] supertensor = np.arange(2*2*2, dtype=self.typeCode).reshape((2, 2, 2)) self.assertRaises(TypeError, ceil, superte...
[ "def", "testCeilWrongDim", "(", "self", ")", ":", "print", "(", "self", ".", "typeStr", ",", "\"... \"", ",", "file", "=", "sys", ".", "stderr", ")", "ceil", "=", "SuperTensor", ".", "__dict__", "[", "self", ".", "typeStr", "+", "\"Ceil\"", "]", "super...
[ 230, 4 ]
[ 235, 55 ]
python
en
['en', 'en', 'en']
True
SuperTensorTestCase.testCeilNonArray
(self)
Test ceil function with non-array
Test ceil function with non-array
def testCeilNonArray(self): "Test ceil function with non-array" print(self.typeStr, "... ", file=sys.stderr) ceil = SuperTensor.__dict__[self.typeStr + "Ceil"] supertensor = np.arange(2*2*2*2, dtype=self.typeCode).reshape((2, 2, 2, 2)).tolist() self.assertRaises(TypeError, ceil, ...
[ "def", "testCeilNonArray", "(", "self", ")", ":", "print", "(", "self", ".", "typeStr", ",", "\"... \"", ",", "file", "=", "sys", ".", "stderr", ")", "ceil", "=", "SuperTensor", ".", "__dict__", "[", "self", ".", "typeStr", "+", "\"Ceil\"", "]", "super...
[ 238, 4 ]
[ 243, 55 ]
python
en
['en', 'en', 'en']
True
SuperTensorTestCase.testLUSplit
(self)
Test luSplit function
Test luSplit function
def testLUSplit(self): "Test luSplit function" print(self.typeStr, "... ", file=sys.stderr) luSplit = SuperTensor.__dict__[self.typeStr + "LUSplit"] supertensor = np.ones(2*2*2*2, dtype=self.typeCode).reshape((2, 2, 2, 2)) answer_upper = [[[[0, 0], [0, 1]], [[0, 1], [1, 1]]], [[[...
[ "def", "testLUSplit", "(", "self", ")", ":", "print", "(", "self", ".", "typeStr", ",", "\"... \"", ",", "file", "=", "sys", ".", "stderr", ")", "luSplit", "=", "SuperTensor", ".", "__dict__", "[", "self", ".", "typeStr", "+", "\"LUSplit\"", "]", "supe...
[ 246, 4 ]
[ 255, 61 ]
python
en
['en', 'no', 'en']
True
Ball.draw
(self)
draws the ball onto screen.
draws the ball onto screen.
def draw(self): """ draws the ball onto screen. """ pygame.draw.circle(screen, (255, 0, 0), (self._xLoc, self._yLoc), self._radius)
[ "def", "draw", "(", "self", ")", ":", "pygame", ".", "draw", ".", "circle", "(", "screen", ",", "(", "255", ",", "0", ",", "0", ")", ",", "(", "self", ".", "_xLoc", ",", "self", ".", "_yLoc", ")", ",", "self", ".", "_radius", ")" ]
[ 57, 4 ]
[ 61, 87 ]
python
en
['en', 'error', 'th']
False
Ball.update
(self, paddle, brickwall)
moves the ball at the screen. contains some collision detection.
moves the ball at the screen. contains some collision detection.
def update(self, paddle, brickwall): """ moves the ball at the screen. contains some collision detection. """ self._xLoc += self.__xVel self._yLoc += self.__yVel # left screen wall bounce if self._xLoc <= self._radius: self.__xVel *= -1...
[ "def", "update", "(", "self", ",", "paddle", ",", "brickwall", ")", ":", "self", ".", "_xLoc", "+=", "self", ".", "__xVel", "self", ".", "_yLoc", "+=", "self", ".", "__yVel", "# left screen wall bounce", "if", "self", ".", "_xLoc", "<=", "self", ".", "...
[ 63, 4 ]
[ 99, 20 ]
python
en
['en', 'error', 'th']
False
Paddle.draw
(self)
draws the paddle onto screen.
draws the paddle onto screen.
def draw(self): """ draws the paddle onto screen. """ pygame.draw.rect(screen, (0, 0, 0), (self._xLoc, self._yLoc, self._width, self._height), 0)
[ "def", "draw", "(", "self", ")", ":", "pygame", ".", "draw", ".", "rect", "(", "screen", ",", "(", "0", ",", "0", ",", "0", ")", ",", "(", "self", ".", "_xLoc", ",", "self", ".", "_yLoc", ",", "self", ".", "_width", ",", "self", ".", "_height...
[ 118, 4 ]
[ 122, 99 ]
python
en
['en', 'error', 'th']
False
Paddle.update
(self)
moves the paddle at the screen via mouse
moves the paddle at the screen via mouse
def update(self): """ moves the paddle at the screen via mouse """ x, y = pygame.mouse.get_pos() if x >= 0 and x <= (self.__W - self._width): self._xLoc = x
[ "def", "update", "(", "self", ")", ":", "x", ",", "y", "=", "pygame", ".", "mouse", ".", "get_pos", "(", ")", "if", "x", ">=", "0", "and", "x", "<=", "(", "self", ".", "__W", "-", "self", ".", "_width", ")", ":", "self", ".", "_xLoc", "=", ...
[ 124, 4 ]
[ 130, 26 ]
python
en
['en', 'error', 'th']
False
Brick.draw
(self)
draws the brick onto screen. color: rgb(56, 177, 237)
draws the brick onto screen. color: rgb(56, 177, 237)
def draw(self): """ draws the brick onto screen. color: rgb(56, 177, 237) """ pygame.draw.rect(screen, (56, 177, 237), (self._xLoc, self._yLoc, self._width, self._height), 0)
[ "def", "draw", "(", "self", ")", ":", "pygame", ".", "draw", ".", "rect", "(", "screen", ",", "(", "56", ",", "177", ",", "237", ")", ",", "(", "self", ".", "_xLoc", ",", "self", ".", "_yLoc", ",", "self", ".", "_width", ",", "self", ".", "_h...
[ 151, 4 ]
[ 156, 104 ]
python
en
['en', 'error', 'th']
False
Brick.add
(self, group)
adds this brick to a given group.
adds this brick to a given group.
def add(self, group): """ adds this brick to a given group. """ group.add(self) self.__isInGroup = True
[ "def", "add", "(", "self", ",", "group", ")", ":", "group", ".", "add", "(", "self", ")", "self", ".", "__isInGroup", "=", "True" ]
[ 158, 4 ]
[ 163, 31 ]
python
en
['en', 'error', 'th']
False
Brick.remove
(self, group)
removes this brick from the given group.
removes this brick from the given group.
def remove(self, group): """ removes this brick from the given group. """ group.remove(self) self.__isInGroup = False
[ "def", "remove", "(", "self", ",", "group", ")", ":", "group", ".", "remove", "(", "self", ")", "self", ".", "__isInGroup", "=", "False" ]
[ 165, 4 ]
[ 170, 32 ]
python
en
['en', 'error', 'th']
False
Brick.alive
(self)
returns true when this brick belongs to the brick wall. otherwise false
returns true when this brick belongs to the brick wall. otherwise false
def alive(self): """ returns true when this brick belongs to the brick wall. otherwise false """ return self.__isInGroup
[ "def", "alive", "(", "self", ")", ":", "return", "self", ".", "__isInGroup" ]
[ 172, 4 ]
[ 177, 31 ]
python
en
['en', 'error', 'th']
False
Brick.collide
(self, ball)
collision detection between ball and this brick
collision detection between ball and this brick
def collide(self, ball): """ collision detection between ball and this brick """ brickX = self._xLoc brickY = self._yLoc brickW = self._width brickH = self._height ballX = ball._xLoc ballY = ball._yLoc ballXVel = ball.getXVel() ...
[ "def", "collide", "(", "self", ",", "ball", ")", ":", "brickX", "=", "self", ".", "_xLoc", "brickY", "=", "self", ".", "_yLoc", "brickW", "=", "self", ".", "_width", "brickH", "=", "self", ".", "_height", "ballX", "=", "ball", ".", "_xLoc", "ballY", ...
[ 179, 4 ]
[ 197, 24 ]
python
en
['en', 'error', 'th']
False
BrickWall.add
(self, brick)
adds a brick to this BrickWall (group)
adds a brick to this BrickWall (group)
def add(self, brick): """ adds a brick to this BrickWall (group) """ self._bricks.append(brick)
[ "def", "add", "(", "self", ",", "brick", ")", ":", "self", ".", "_bricks", ".", "append", "(", "brick", ")" ]
[ 224, 4 ]
[ 228, 34 ]
python
en
['en', 'error', 'th']
False
BrickWall.remove
(self, brick)
removes a brick from this BrickWall (group)
removes a brick from this BrickWall (group)
def remove(self, brick): """ removes a brick from this BrickWall (group) """ self._bricks.remove(brick)
[ "def", "remove", "(", "self", ",", "brick", ")", ":", "self", ".", "_bricks", ".", "remove", "(", "brick", ")" ]
[ 230, 4 ]
[ 234, 34 ]
python
en
['en', 'error', 'th']
False
BrickWall.draw
(self)
draws all bricks onto screen.
draws all bricks onto screen.
def draw(self): """ draws all bricks onto screen. """ for brick in self._bricks: if brick != None: brick.draw()
[ "def", "draw", "(", "self", ")", ":", "for", "brick", "in", "self", ".", "_bricks", ":", "if", "brick", "!=", "None", ":", "brick", ".", "draw", "(", ")" ]
[ 236, 4 ]
[ 242, 28 ]
python
en
['en', 'error', 'th']
False
BrickWall.update
(self, ball)
checks collision between ball and bricks.
checks collision between ball and bricks.
def update(self, ball): """ checks collision between ball and bricks. """ for i in range(len(self._bricks)): if ((self._bricks[i] != None) and self._bricks[i].collide(ball)): self._bricks[i] = None # removes the None-elements from the brick list. ...
[ "def", "update", "(", "self", ",", "ball", ")", ":", "for", "i", "in", "range", "(", "len", "(", "self", ".", "_bricks", ")", ")", ":", "if", "(", "(", "self", ".", "_bricks", "[", "i", "]", "!=", "None", ")", "and", "self", ".", "_bricks", "...
[ 244, 4 ]
[ 255, 42 ]
python
en
['en', 'error', 'th']
False
BrickWall.hasWin
(self)
Has player win the game?
Has player win the game?
def hasWin(self): """ Has player win the game? """ return len(self._bricks) == 0
[ "def", "hasWin", "(", "self", ")", ":", "return", "len", "(", "self", ".", "_bricks", ")", "==", "0" ]
[ 257, 4 ]
[ 261, 37 ]
python
en
['en', 'error', 'th']
False
BrickWall.collide
(self, ball)
check collisions between the ball and any of the bricks.
check collisions between the ball and any of the bricks.
def collide(self, ball): """ check collisions between the ball and any of the bricks. """ for brick in self._bricks: if brick.collide(ball): return True return False
[ "def", "collide", "(", "self", ",", "ball", ")", ":", "for", "brick", "in", "self", ".", "_bricks", ":", "if", "brick", ".", "collide", "(", "ball", ")", ":", "return", "True", "return", "False" ]
[ 263, 4 ]
[ 271, 20 ]
python
en
['en', 'error', 'th']
False
test_alexnet_backbone
()
Test alexnet backbone.
Test alexnet backbone.
def test_alexnet_backbone(): """Test alexnet backbone.""" model = AlexNet(-1) model.train() imgs = torch.randn(1, 3, 256, 192) feat = model(imgs) assert feat.shape == (1, 256, 7, 5) model = AlexNet(1) model.train() imgs = torch.randn(1, 3, 224, 224) feat = model(imgs) asse...
[ "def", "test_alexnet_backbone", "(", ")", ":", "model", "=", "AlexNet", "(", "-", "1", ")", "model", ".", "train", "(", ")", "imgs", "=", "torch", ".", "randn", "(", "1", ",", "3", ",", "256", ",", "192", ")", "feat", "=", "model", "(", "imgs", ...
[ 5, 0 ]
[ 19, 31 ]
python
en
['en', 'cy', 'en']
True
polyline
(off, scl)
Returns an array representing a linear polynomial. Parameters ---------- off, scl : scalars The "y-intercept" and "slope" of the line, respectively. Returns ------- y : ndarray This module's representation of the linear polynomial ``off + scl*x``. See Also ...
Returns an array representing a linear polynomial.
def polyline(off, scl): """ Returns an array representing a linear polynomial. Parameters ---------- off, scl : scalars The "y-intercept" and "slope" of the line, respectively. Returns ------- y : ndarray This module's representation of the linear polynomial ``off + ...
[ "def", "polyline", "(", "off", ",", "scl", ")", ":", "if", "scl", "!=", "0", ":", "return", "np", ".", "array", "(", "[", "off", ",", "scl", "]", ")", "else", ":", "return", "np", ".", "array", "(", "[", "off", "]", ")" ]
[ 98, 0 ]
[ 129, 30 ]
python
en
['en', 'error', 'th']
False
polyfromroots
(roots)
Generate a monic polynomial with given roots. Return the coefficients of the polynomial .. math:: p(x) = (x - r_0) * (x - r_1) * ... * (x - r_n), where the `r_n` are the roots specified in `roots`. If a zero has multiplicity n, then it must appear in `roots` n times. For instance, if 2 is a...
Generate a monic polynomial with given roots.
def polyfromroots(roots): """ Generate a monic polynomial with given roots. Return the coefficients of the polynomial .. math:: p(x) = (x - r_0) * (x - r_1) * ... * (x - r_n), where the `r_n` are the roots specified in `roots`. If a zero has multiplicity n, then it must appear in `roots` n t...
[ "def", "polyfromroots", "(", "roots", ")", ":", "return", "pu", ".", "_fromroots", "(", "polyline", ",", "polymul", ",", "roots", ")" ]
[ 132, 0 ]
[ 190, 50 ]
python
en
['en', 'error', 'th']
False