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
APPO.run
(self)
This function contains the main loop of the algorithm, as well as initialization/cleanup code. :return: ExperimentStatus (SUCCESS, FAILURE, INTERRUPTED). Useful in testing.
This function contains the main loop of the algorithm, as well as initialization/cleanup code.
def run(self): """ This function contains the main loop of the algorithm, as well as initialization/cleanup code. :return: ExperimentStatus (SUCCESS, FAILURE, INTERRUPTED). Useful in testing. """ status = ExperimentStatus.SUCCESS if os.path.isfile(done_filename(self.cf...
[ "def", "run", "(", "self", ")", ":", "status", "=", "ExperimentStatus", ".", "SUCCESS", "if", "os", ".", "path", ".", "isfile", "(", "done_filename", "(", "self", ".", "cfg", ")", ")", ":", "log", ".", "warning", "(", "'Training already finished! Remove \"...
[ 643, 4 ]
[ 728, 21 ]
python
en
['en', 'error', 'th']
False
doom_turn_and_attack_only
()
TURN_LEFT TURN_RIGHT ATTACK
TURN_LEFT TURN_RIGHT ATTACK
def doom_turn_and_attack_only(): """ TURN_LEFT TURN_RIGHT ATTACK """ space = gym.spaces.Tuple(( Discrete(3), # noop, turn left, turn right Discrete(2), # noop, attack )) return space
[ "def", "doom_turn_and_attack_only", "(", ")", ":", "space", "=", "gym", ".", "spaces", ".", "Tuple", "(", "(", "Discrete", "(", "3", ")", ",", "# noop, turn left, turn right", "Discrete", "(", "2", ")", ",", "# noop, attack", ")", ")", "return", "space" ]
[ 14, 0 ]
[ 25, 16 ]
python
en
['en', 'error', 'th']
False
doom_action_space_basic
()
TURN_LEFT TURN_RIGHT MOVE_FORWARD MOVE_BACKWARD
TURN_LEFT TURN_RIGHT MOVE_FORWARD MOVE_BACKWARD
def doom_action_space_basic(): """ TURN_LEFT TURN_RIGHT MOVE_FORWARD MOVE_BACKWARD """ space = gym.spaces.Tuple(( Discrete(3), # noop, turn left, turn right Discrete(3), # noop, forward, backward )) space.key_to_action = key_to_action_basic return space
[ "def", "doom_action_space_basic", "(", ")", ":", "space", "=", "gym", ".", "spaces", ".", "Tuple", "(", "(", "Discrete", "(", "3", ")", ",", "# noop, turn left, turn right", "Discrete", "(", "3", ")", ",", "# noop, forward, backward", ")", ")", "space", ".",...
[ 28, 0 ]
[ 41, 16 ]
python
en
['en', 'error', 'th']
False
doom_action_space_extended
()
This function assumes the following list of available buttons: TURN_LEFT TURN_RIGHT MOVE_FORWARD MOVE_BACKWARD MOVE_LEFT MOVE_RIGHT ATTACK
This function assumes the following list of available buttons: TURN_LEFT TURN_RIGHT MOVE_FORWARD MOVE_BACKWARD MOVE_LEFT MOVE_RIGHT ATTACK
def doom_action_space_extended(): """ This function assumes the following list of available buttons: TURN_LEFT TURN_RIGHT MOVE_FORWARD MOVE_BACKWARD MOVE_LEFT MOVE_RIGHT ATTACK """ space = gym.spaces.Tuple(( Discrete(3), # noop, turn left, turn right Discrete...
[ "def", "doom_action_space_extended", "(", ")", ":", "space", "=", "gym", ".", "spaces", ".", "Tuple", "(", "(", "Discrete", "(", "3", ")", ",", "# noop, turn left, turn right", "Discrete", "(", "3", ")", ",", "# noop, forward, backward", "Discrete", "(", "3", ...
[ 44, 0 ]
[ 62, 16 ]
python
en
['en', 'error', 'th']
False
doom_action_space
()
Standard action space for full-featured Doom environments (e.g. deathmatch). TODO: crouch? TODO: strafe? This should precisely correspond to the available_buttons configuration in the .cfg file. This function assumes: MOVE_FORWARD MOVE_BACKWARD MOVE_RIGHT MOVE_LEFT ...
Standard action space for full-featured Doom environments (e.g. deathmatch). TODO: crouch? TODO: strafe?
def doom_action_space(): """ Standard action space for full-featured Doom environments (e.g. deathmatch). TODO: crouch? TODO: strafe? This should precisely correspond to the available_buttons configuration in the .cfg file. This function assumes: MOVE_FORWARD MOVE_BACKWARD ...
[ "def", "doom_action_space", "(", ")", ":", "return", "gym", ".", "spaces", ".", "Tuple", "(", "(", "Discrete", "(", "3", ")", ",", "# noop, forward, backward", "Discrete", "(", "3", ")", ",", "# noop, move right, move left", "Discrete", "(", "3", ")", ",", ...
[ 65, 0 ]
[ 90, 6 ]
python
en
['en', 'error', 'th']
False
doom_action_space_full_discretized
(with_use=False)
MOVE_FORWARD MOVE_BACKWARD MOVE_RIGHT MOVE_LEFT SELECT_WEAPON1 SELECT_WEAPON2 SELECT_WEAPON3 SELECT_WEAPON4 SELECT_WEAPON5 SELECT_WEAPON6 SELECT_WEAPON7 ATTACK SPEED TURN_LEFT_RIGHT_DELTA
MOVE_FORWARD MOVE_BACKWARD MOVE_RIGHT MOVE_LEFT SELECT_WEAPON1 SELECT_WEAPON2 SELECT_WEAPON3 SELECT_WEAPON4 SELECT_WEAPON5 SELECT_WEAPON6 SELECT_WEAPON7 ATTACK SPEED TURN_LEFT_RIGHT_DELTA
def doom_action_space_full_discretized(with_use=False): """ MOVE_FORWARD MOVE_BACKWARD MOVE_RIGHT MOVE_LEFT SELECT_WEAPON1 SELECT_WEAPON2 SELECT_WEAPON3 SELECT_WEAPON4 SELECT_WEAPON5 SELECT_WEAPON6 SELECT_WEAPON7 ATTACK ...
[ "def", "doom_action_space_full_discretized", "(", "with_use", "=", "False", ")", ":", "spaces", "=", "[", "Discrete", "(", "3", ")", ",", "# noop, forward, backward", "Discrete", "(", "3", ")", ",", "# noop, move right, move left", "Discrete", "(", "8", ")", ","...
[ 145, 0 ]
[ 174, 35 ]
python
en
['en', 'error', 'th']
False
TrelloHookTests.test_ignored_card_actions
(self)
Certain card-related actions are now ignored solely based on the action type, and we don't need to do any other parsing to ignore them as invalid.
Certain card-related actions are now ignored solely based on the action type, and we don't need to do any other parsing to ignore them as invalid.
def test_ignored_card_actions(self) -> None: """ Certain card-related actions are now ignored solely based on the action type, and we don't need to do any other parsing to ignore them as invalid. """ actions = [ "copyCard", "createCheckItem", ...
[ "def", "test_ignored_card_actions", "(", "self", ")", "->", "None", ":", "actions", "=", "[", "\"copyCard\"", ",", "\"createCheckItem\"", ",", "\"updateCheckItem\"", ",", "\"updateList\"", ",", "]", "for", "action", "in", "actions", ":", "data", "=", "dict", "...
[ 127, 4 ]
[ 147, 48 ]
python
en
['en', 'error', 'th']
False
pytest_addhooks
(pluginmanager)
called at plugin registration time to allow adding new hooks via a call to ``pluginmanager.add_hookspecs(module_or_class, prefix)``. :param _pytest.config.PytestPluginManager pluginmanager: pytest plugin manager .. note:: This hook is incompatible with ``hookwrapper=True``.
called at plugin registration time to allow adding new hooks via a call to ``pluginmanager.add_hookspecs(module_or_class, prefix)``.
def pytest_addhooks(pluginmanager): """called at plugin registration time to allow adding new hooks via a call to ``pluginmanager.add_hookspecs(module_or_class, prefix)``. :param _pytest.config.PytestPluginManager pluginmanager: pytest plugin manager .. note:: This hook is incompatible with `...
[ "def", "pytest_addhooks", "(", "pluginmanager", ")", ":" ]
[ 12, 0 ]
[ 21, 7 ]
python
en
['en', 'en', 'en']
True
pytest_namespace
()
(**Deprecated**) this hook causes direct monkeypatching on pytest, its use is strongly discouraged return dict of name->object to be made globally available in the pytest namespace. This hook is called at plugin registration time. .. note:: This hook is incompatible with ``hookwrapper=Tru...
(**Deprecated**) this hook causes direct monkeypatching on pytest, its use is strongly discouraged return dict of name->object to be made globally available in the pytest namespace.
def pytest_namespace(): """ (**Deprecated**) this hook causes direct monkeypatching on pytest, its use is strongly discouraged return dict of name->object to be made globally available in the pytest namespace. This hook is called at plugin registration time. .. note:: This hook is inco...
[ "def", "pytest_namespace", "(", ")", ":" ]
[ 25, 0 ]
[ 35, 7 ]
python
en
['en', 'error', 'th']
False
pytest_plugin_registered
(plugin, manager)
a new pytest plugin got registered. :param plugin: the plugin module or instance :param _pytest.config.PytestPluginManager manager: pytest plugin manager .. note:: This hook is incompatible with ``hookwrapper=True``.
a new pytest plugin got registered.
def pytest_plugin_registered(plugin, manager): """ a new pytest plugin got registered. :param plugin: the plugin module or instance :param _pytest.config.PytestPluginManager manager: pytest plugin manager .. note:: This hook is incompatible with ``hookwrapper=True``. """
[ "def", "pytest_plugin_registered", "(", "plugin", ",", "manager", ")", ":" ]
[ 39, 0 ]
[ 47, 7 ]
python
en
['en', 'lb', 'en']
True
pytest_addoption
(parser)
register argparse-style options and ini-style config values, called once at the beginning of a test run. .. note:: This function should be implemented only in plugins or ``conftest.py`` files situated at the tests root directory due to how pytest :ref:`discovers plugins during startup ...
register argparse-style options and ini-style config values, called once at the beginning of a test run.
def pytest_addoption(parser): """register argparse-style options and ini-style config values, called once at the beginning of a test run. .. note:: This function should be implemented only in plugins or ``conftest.py`` files situated at the tests root directory due to how pytest :r...
[ "def", "pytest_addoption", "(", "parser", ")", ":" ]
[ 51, 0 ]
[ 80, 7 ]
python
en
['en', 'en', 'en']
True
pytest_configure
(config)
Allows plugins and conftest files to perform initial configuration. This hook is called for every plugin and initial conftest file after command line options have been parsed. After that, the hook is called for other conftest files as they are imported. .. note:: This hook is incompa...
Allows plugins and conftest files to perform initial configuration.
def pytest_configure(config): """ Allows plugins and conftest files to perform initial configuration. This hook is called for every plugin and initial conftest file after command line options have been parsed. After that, the hook is called for other conftest files as they are imported. ....
[ "def", "pytest_configure", "(", "config", ")", ":" ]
[ 84, 0 ]
[ 98, 7 ]
python
en
['en', 'error', 'th']
False
pytest_cmdline_parse
(pluginmanager, args)
return initialized config object, parsing the specified args. Stops at first non-None result, see :ref:`firstresult` .. note:: This hook will not be called for ``conftest.py`` files, only for setuptools plugins. :param _pytest.config.PytestPluginManager pluginmanager: pytest plugin manager :p...
return initialized config object, parsing the specified args.
def pytest_cmdline_parse(pluginmanager, args): """return initialized config object, parsing the specified args. Stops at first non-None result, see :ref:`firstresult` .. note:: This hook will not be called for ``conftest.py`` files, only for setuptools plugins. :param _pytest.config.PytestPlu...
[ "def", "pytest_cmdline_parse", "(", "pluginmanager", ",", "args", ")", ":" ]
[ 107, 0 ]
[ 117, 7 ]
python
en
['en', 'en', 'en']
True
pytest_cmdline_preparse
(config, args)
(**Deprecated**) modify command line arguments before option parsing. This hook is considered deprecated and will be removed in a future pytest version. Consider using :func:`pytest_load_initial_conftests` instead. .. note:: This hook will not be called for ``conftest.py`` files, only for setuptoo...
(**Deprecated**) modify command line arguments before option parsing.
def pytest_cmdline_preparse(config, args): """(**Deprecated**) modify command line arguments before option parsing. This hook is considered deprecated and will be removed in a future pytest version. Consider using :func:`pytest_load_initial_conftests` instead. .. note:: This hook will not be c...
[ "def", "pytest_cmdline_preparse", "(", "config", ",", "args", ")", ":" ]
[ 120, 0 ]
[ 131, 7 ]
python
en
['en', 'en', 'en']
True
pytest_cmdline_main
(config)
called for performing the main command line action. The default implementation will invoke the configure hooks and runtest_mainloop. .. note:: This hook will not be called for ``conftest.py`` files, only for setuptools plugins. Stops at first non-None result, see :ref:`firstresult` :param _p...
called for performing the main command line action. The default implementation will invoke the configure hooks and runtest_mainloop.
def pytest_cmdline_main(config): """ called for performing the main command line action. The default implementation will invoke the configure hooks and runtest_mainloop. .. note:: This hook will not be called for ``conftest.py`` files, only for setuptools plugins. Stops at first non-None resul...
[ "def", "pytest_cmdline_main", "(", "config", ")", ":" ]
[ 135, 0 ]
[ 145, 7 ]
python
en
['en', 'en', 'en']
True
pytest_load_initial_conftests
(early_config, parser, args)
implements the loading of initial conftest files ahead of command line option parsing. .. note:: This hook will not be called for ``conftest.py`` files, only for setuptools plugins. :param _pytest.config.Config early_config: pytest config object :param list[str] args: list of arguments passed...
implements the loading of initial conftest files ahead of command line option parsing.
def pytest_load_initial_conftests(early_config, parser, args): """ implements the loading of initial conftest files ahead of command line option parsing. .. note:: This hook will not be called for ``conftest.py`` files, only for setuptools plugins. :param _pytest.config.Config early_config: py...
[ "def", "pytest_load_initial_conftests", "(", "early_config", ",", "parser", ",", "args", ")", ":" ]
[ 148, 0 ]
[ 158, 7 ]
python
en
['en', 'en', 'en']
True
pytest_collection
(session)
Perform the collection protocol for the given session. Stops at first non-None result, see :ref:`firstresult`. :param _pytest.main.Session session: the pytest session object
Perform the collection protocol for the given session.
def pytest_collection(session): """Perform the collection protocol for the given session. Stops at first non-None result, see :ref:`firstresult`. :param _pytest.main.Session session: the pytest session object """
[ "def", "pytest_collection", "(", "session", ")", ":" ]
[ 166, 0 ]
[ 172, 7 ]
python
en
['en', 'en', 'en']
True
pytest_collection_modifyitems
(session, config, items)
called after collection has been performed, may filter or re-order the items in-place. :param _pytest.main.Session session: the pytest session object :param _pytest.config.Config config: pytest config object :param List[_pytest.nodes.Item] items: list of item objects
called after collection has been performed, may filter or re-order the items in-place.
def pytest_collection_modifyitems(session, config, items): """ called after collection has been performed, may filter or re-order the items in-place. :param _pytest.main.Session session: the pytest session object :param _pytest.config.Config config: pytest config object :param List[_pytest.nodes.It...
[ "def", "pytest_collection_modifyitems", "(", "session", ",", "config", ",", "items", ")", ":" ]
[ 175, 0 ]
[ 182, 7 ]
python
en
['en', 'en', 'en']
True
pytest_collection_finish
(session)
called after collection has been performed and modified. :param _pytest.main.Session session: the pytest session object
called after collection has been performed and modified.
def pytest_collection_finish(session): """ called after collection has been performed and modified. :param _pytest.main.Session session: the pytest session object """
[ "def", "pytest_collection_finish", "(", "session", ")", ":" ]
[ 185, 0 ]
[ 189, 7 ]
python
en
['en', 'en', 'en']
True
pytest_ignore_collect
(path, config)
return True to prevent considering this path for collection. This hook is consulted for all files and directories prior to calling more specific hooks. Stops at first non-None result, see :ref:`firstresult` :param str path: the path to analyze :param _pytest.config.Config config: pytest config ob...
return True to prevent considering this path for collection. This hook is consulted for all files and directories prior to calling more specific hooks.
def pytest_ignore_collect(path, config): """ return True to prevent considering this path for collection. This hook is consulted for all files and directories prior to calling more specific hooks. Stops at first non-None result, see :ref:`firstresult` :param str path: the path to analyze :para...
[ "def", "pytest_ignore_collect", "(", "path", ",", "config", ")", ":" ]
[ 193, 0 ]
[ 202, 7 ]
python
en
['en', 'en', 'en']
True
pytest_collect_directory
(path, parent)
called before traversing a directory for collection files. Stops at first non-None result, see :ref:`firstresult` :param str path: the path to analyze
called before traversing a directory for collection files.
def pytest_collect_directory(path, parent): """ called before traversing a directory for collection files. Stops at first non-None result, see :ref:`firstresult` :param str path: the path to analyze """
[ "def", "pytest_collect_directory", "(", "path", ",", "parent", ")", ":" ]
[ 206, 0 ]
[ 212, 7 ]
python
en
['en', 'en', 'en']
True
pytest_collect_file
(path, parent)
return collection Node or None for the given path. Any new node needs to have the specified ``parent`` as a parent. :param str path: the path to collect
return collection Node or None for the given path. Any new node needs to have the specified ``parent`` as a parent.
def pytest_collect_file(path, parent): """ return collection Node or None for the given path. Any new node needs to have the specified ``parent`` as a parent. :param str path: the path to collect """
[ "def", "pytest_collect_file", "(", "path", ",", "parent", ")", ":" ]
[ 215, 0 ]
[ 220, 7 ]
python
en
['en', 'en', 'en']
True
pytest_collectstart
(collector)
collector starts collecting.
collector starts collecting.
def pytest_collectstart(collector): """ collector starts collecting. """
[ "def", "pytest_collectstart", "(", "collector", ")", ":" ]
[ 225, 0 ]
[ 226, 40 ]
python
en
['en', 'en', 'en']
True
pytest_itemcollected
(item)
we just collected a test item.
we just collected a test item.
def pytest_itemcollected(item): """ we just collected a test item. """
[ "def", "pytest_itemcollected", "(", "item", ")", ":" ]
[ 229, 0 ]
[ 230, 42 ]
python
en
['en', 'en', 'en']
True
pytest_collectreport
(report)
collector finished collecting.
collector finished collecting.
def pytest_collectreport(report): """ collector finished collecting. """
[ "def", "pytest_collectreport", "(", "report", ")", ":" ]
[ 233, 0 ]
[ 234, 42 ]
python
en
['en', 'en', 'en']
True
pytest_deselected
(items)
called for test items deselected by keyword.
called for test items deselected by keyword.
def pytest_deselected(items): """ called for test items deselected by keyword. """
[ "def", "pytest_deselected", "(", "items", ")", ":" ]
[ 237, 0 ]
[ 238, 56 ]
python
en
['en', 'en', 'en']
True
pytest_make_collect_report
(collector)
perform ``collector.collect()`` and return a CollectReport. Stops at first non-None result, see :ref:`firstresult`
perform ``collector.collect()`` and return a CollectReport.
def pytest_make_collect_report(collector): """ perform ``collector.collect()`` and return a CollectReport. Stops at first non-None result, see :ref:`firstresult` """
[ "def", "pytest_make_collect_report", "(", "collector", ")", ":" ]
[ 242, 0 ]
[ 245, 62 ]
python
en
['en', 'en', 'en']
True
pytest_pycollect_makemodule
(path, parent)
return a Module collector or None for the given path. This hook will be called for each matching test module path. The pytest_collect_file hook needs to be used if you want to create test modules for files that do not match as a test module. Stops at first non-None result, see :ref:`firstresult`
return a Module collector or None for the given path. This hook will be called for each matching test module path. The pytest_collect_file hook needs to be used if you want to create test modules for files that do not match as a test module.
def pytest_pycollect_makemodule(path, parent): """ return a Module collector or None for the given path. This hook will be called for each matching test module path. The pytest_collect_file hook needs to be used if you want to create test modules for files that do not match as a test module. Stops ...
[ "def", "pytest_pycollect_makemodule", "(", "path", ",", "parent", ")", ":" ]
[ 253, 0 ]
[ 259, 62 ]
python
en
['en', 'en', 'en']
True
pytest_pycollect_makeitem
(collector, name, obj)
return custom item/collector for a python object in a module, or None. Stops at first non-None result, see :ref:`firstresult`
return custom item/collector for a python object in a module, or None.
def pytest_pycollect_makeitem(collector, name, obj): """ return custom item/collector for a python object in a module, or None. Stops at first non-None result, see :ref:`firstresult` """
[ "def", "pytest_pycollect_makeitem", "(", "collector", ",", "name", ",", "obj", ")", ":" ]
[ 263, 0 ]
[ 266, 62 ]
python
en
['en', 'en', 'en']
True
pytest_pyfunc_call
(pyfuncitem)
call underlying test function. Stops at first non-None result, see :ref:`firstresult`
call underlying test function.
def pytest_pyfunc_call(pyfuncitem): """ call underlying test function. Stops at first non-None result, see :ref:`firstresult` """
[ "def", "pytest_pyfunc_call", "(", "pyfuncitem", ")", ":" ]
[ 270, 0 ]
[ 273, 62 ]
python
en
['en', 'en', 'en']
True
pytest_generate_tests
(metafunc)
generate (multiple) parametrized calls to a test function.
generate (multiple) parametrized calls to a test function.
def pytest_generate_tests(metafunc): """ generate (multiple) parametrized calls to a test function."""
[ "def", "pytest_generate_tests", "(", "metafunc", ")", ":" ]
[ 276, 0 ]
[ 277, 69 ]
python
en
['en', 'en', 'en']
True
pytest_make_parametrize_id
(config, val, argname)
Return a user-friendly string representation of the given ``val`` that will be used by @pytest.mark.parametrize calls. Return None if the hook doesn't know about ``val``. The parameter name is available as ``argname``, if required. Stops at first non-None result, see :ref:`firstresult` :param _pytest....
Return a user-friendly string representation of the given ``val`` that will be used by @pytest.mark.parametrize calls. Return None if the hook doesn't know about ``val``. The parameter name is available as ``argname``, if required.
def pytest_make_parametrize_id(config, val, argname): """Return a user-friendly string representation of the given ``val`` that will be used by @pytest.mark.parametrize calls. Return None if the hook doesn't know about ``val``. The parameter name is available as ``argname``, if required. Stops at first...
[ "def", "pytest_make_parametrize_id", "(", "config", ",", "val", ",", "argname", ")", ":" ]
[ 281, 0 ]
[ 291, 7 ]
python
en
['en', 'en', 'en']
True
pytest_runtestloop
(session)
called for performing the main runtest loop (after collection finished). Stops at first non-None result, see :ref:`firstresult` :param _pytest.main.Session session: the pytest session object
called for performing the main runtest loop (after collection finished).
def pytest_runtestloop(session): """ called for performing the main runtest loop (after collection finished). Stops at first non-None result, see :ref:`firstresult` :param _pytest.main.Session session: the pytest session object """
[ "def", "pytest_runtestloop", "(", "session", ")", ":" ]
[ 299, 0 ]
[ 306, 7 ]
python
en
['en', 'en', 'en']
True
pytest_itemstart
(item, node)
(**Deprecated**) use pytest_runtest_logstart.
(**Deprecated**) use pytest_runtest_logstart.
def pytest_itemstart(item, node): """(**Deprecated**) use pytest_runtest_logstart. """
[ "def", "pytest_itemstart", "(", "item", ",", "node", ")", ":" ]
[ 309, 0 ]
[ 310, 56 ]
python
en
['en', 'sv', 'en']
True
pytest_runtest_protocol
(item, nextitem)
implements the runtest_setup/call/teardown protocol for the given test item, including capturing exceptions and calling reporting hooks. :arg item: test item for which the runtest protocol is performed. :arg nextitem: the scheduled-to-be-next test item (or None if this is the end m...
implements the runtest_setup/call/teardown protocol for the given test item, including capturing exceptions and calling reporting hooks.
def pytest_runtest_protocol(item, nextitem): """ implements the runtest_setup/call/teardown protocol for the given test item, including capturing exceptions and calling reporting hooks. :arg item: test item for which the runtest protocol is performed. :arg nextitem: the scheduled-to-be-next test i...
[ "def", "pytest_runtest_protocol", "(", "item", ",", "nextitem", ")", ":" ]
[ 314, 0 ]
[ 328, 62 ]
python
en
['en', 'en', 'en']
True
pytest_runtest_logstart
(nodeid, location)
signal the start of running a single test item. This hook will be called **before** :func:`pytest_runtest_setup`, :func:`pytest_runtest_call` and :func:`pytest_runtest_teardown` hooks. :param str nodeid: full id of the item :param location: a triple of ``(filename, linenum, testname)``
signal the start of running a single test item.
def pytest_runtest_logstart(nodeid, location): """ signal the start of running a single test item. This hook will be called **before** :func:`pytest_runtest_setup`, :func:`pytest_runtest_call` and :func:`pytest_runtest_teardown` hooks. :param str nodeid: full id of the item :param location: a trip...
[ "def", "pytest_runtest_logstart", "(", "nodeid", ",", "location", ")", ":" ]
[ 331, 0 ]
[ 339, 7 ]
python
en
['en', 'en', 'en']
True
pytest_runtest_logfinish
(nodeid, location)
signal the complete finish of running a single test item. This hook will be called **after** :func:`pytest_runtest_setup`, :func:`pytest_runtest_call` and :func:`pytest_runtest_teardown` hooks. :param str nodeid: full id of the item :param location: a triple of ``(filename, linenum, testname)``
signal the complete finish of running a single test item.
def pytest_runtest_logfinish(nodeid, location): """ signal the complete finish of running a single test item. This hook will be called **after** :func:`pytest_runtest_setup`, :func:`pytest_runtest_call` and :func:`pytest_runtest_teardown` hooks. :param str nodeid: full id of the item :param locati...
[ "def", "pytest_runtest_logfinish", "(", "nodeid", ",", "location", ")", ":" ]
[ 342, 0 ]
[ 350, 7 ]
python
en
['en', 'en', 'en']
True
pytest_runtest_setup
(item)
called before ``pytest_runtest_call(item)``.
called before ``pytest_runtest_call(item)``.
def pytest_runtest_setup(item): """ called before ``pytest_runtest_call(item)``. """
[ "def", "pytest_runtest_setup", "(", "item", ")", ":" ]
[ 353, 0 ]
[ 354, 56 ]
python
en
['en', 'en', 'en']
True
pytest_runtest_call
(item)
called to execute the test ``item``.
called to execute the test ``item``.
def pytest_runtest_call(item): """ called to execute the test ``item``. """
[ "def", "pytest_runtest_call", "(", "item", ")", ":" ]
[ 357, 0 ]
[ 358, 48 ]
python
en
['en', 'en', 'en']
True
pytest_runtest_teardown
(item, nextitem)
called after ``pytest_runtest_call``. :arg nextitem: the scheduled-to-be-next test item (None if no further test item is scheduled). This argument can be used to perform exact teardowns, i.e. calling just enough finalizers so that nextitem only needs to ca...
called after ``pytest_runtest_call``.
def pytest_runtest_teardown(item, nextitem): """ called after ``pytest_runtest_call``. :arg nextitem: the scheduled-to-be-next test item (None if no further test item is scheduled). This argument can be used to perform exact teardowns, i.e. calling just enough finalizers ...
[ "def", "pytest_runtest_teardown", "(", "item", ",", "nextitem", ")", ":" ]
[ 361, 0 ]
[ 368, 7 ]
python
en
['en', 'en', 'en']
True
pytest_runtest_makereport
(item, call)
return a :py:class:`_pytest.runner.TestReport` object for the given :py:class:`pytest.Item <_pytest.main.Item>` and :py:class:`_pytest.runner.CallInfo`. Stops at first non-None result, see :ref:`firstresult`
return a :py:class:`_pytest.runner.TestReport` object for the given :py:class:`pytest.Item <_pytest.main.Item>` and :py:class:`_pytest.runner.CallInfo`.
def pytest_runtest_makereport(item, call): """ return a :py:class:`_pytest.runner.TestReport` object for the given :py:class:`pytest.Item <_pytest.main.Item>` and :py:class:`_pytest.runner.CallInfo`. Stops at first non-None result, see :ref:`firstresult` """
[ "def", "pytest_runtest_makereport", "(", "item", ",", "call", ")", ":" ]
[ 372, 0 ]
[ 377, 62 ]
python
en
['en', 'lb', 'en']
True
pytest_runtest_logreport
(report)
process a test setup/call/teardown report relating to the respective phase of executing a test.
process a test setup/call/teardown report relating to the respective phase of executing a test.
def pytest_runtest_logreport(report): """ process a test setup/call/teardown report relating to the respective phase of executing a test. """
[ "def", "pytest_runtest_logreport", "(", "report", ")", ":" ]
[ 380, 0 ]
[ 382, 49 ]
python
en
['en', 'pt', 'en']
True
pytest_fixture_setup
(fixturedef, request)
performs fixture setup execution. :return: The return value of the call to the fixture function Stops at first non-None result, see :ref:`firstresult` .. note:: If the fixture function returns None, other implementations of this hook function will continue to be called, according to the ...
performs fixture setup execution.
def pytest_fixture_setup(fixturedef, request): """ performs fixture setup execution. :return: The return value of the call to the fixture function Stops at first non-None result, see :ref:`firstresult` .. note:: If the fixture function returns None, other implementations of this hook ...
[ "def", "pytest_fixture_setup", "(", "fixturedef", ",", "request", ")", ":" ]
[ 390, 0 ]
[ 401, 7 ]
python
en
['en', 'su', 'en']
True
pytest_fixture_post_finalizer
(fixturedef, request)
called after fixture teardown, but before the cache is cleared so the fixture result cache ``fixturedef.cached_result`` can still be accessed.
called after fixture teardown, but before the cache is cleared so the fixture result cache ``fixturedef.cached_result`` can still be accessed.
def pytest_fixture_post_finalizer(fixturedef, request): """ called after fixture teardown, but before the cache is cleared so the fixture result cache ``fixturedef.cached_result`` can still be accessed."""
[ "def", "pytest_fixture_post_finalizer", "(", "fixturedef", ",", "request", ")", ":" ]
[ 404, 0 ]
[ 407, 25 ]
python
en
['en', 'en', 'en']
True
pytest_sessionstart
(session)
before session.main() is called. :param _pytest.main.Session session: the pytest session object
before session.main() is called.
def pytest_sessionstart(session): """ before session.main() is called. :param _pytest.main.Session session: the pytest session object """
[ "def", "pytest_sessionstart", "(", "session", ")", ":" ]
[ 414, 0 ]
[ 418, 7 ]
python
en
['en', 'en', 'en']
True
pytest_sessionfinish
(session, exitstatus)
whole test run finishes. :param _pytest.main.Session session: the pytest session object :param int exitstatus: the status which pytest will return to the system
whole test run finishes.
def pytest_sessionfinish(session, exitstatus): """ whole test run finishes. :param _pytest.main.Session session: the pytest session object :param int exitstatus: the status which pytest will return to the system """
[ "def", "pytest_sessionfinish", "(", "session", ",", "exitstatus", ")", ":" ]
[ 421, 0 ]
[ 426, 7 ]
python
en
['en', 'en', 'en']
True
pytest_unconfigure
(config)
called before test process is exited. :param _pytest.config.Config config: pytest config object
called before test process is exited.
def pytest_unconfigure(config): """ called before test process is exited. :param _pytest.config.Config config: pytest config object """
[ "def", "pytest_unconfigure", "(", "config", ")", ":" ]
[ 429, 0 ]
[ 433, 7 ]
python
en
['en', 'en', 'en']
True
pytest_assertrepr_compare
(config, op, left, right)
return explanation for comparisons in failing assert expressions. Return None for no custom explanation, otherwise return a list of strings. The strings will be joined by newlines but any newlines *in* a string will be escaped. Note that all but the first line will be indented slightly, the intention...
return explanation for comparisons in failing assert expressions.
def pytest_assertrepr_compare(config, op, left, right): """return explanation for comparisons in failing assert expressions. Return None for no custom explanation, otherwise return a list of strings. The strings will be joined by newlines but any newlines *in* a string will be escaped. Note that all ...
[ "def", "pytest_assertrepr_compare", "(", "config", ",", "op", ",", "left", ",", "right", ")", ":" ]
[ 440, 0 ]
[ 449, 7 ]
python
en
['en', 'en', 'en']
True
pytest_report_header
(config, startdir)
return a string or list of strings to be displayed as header info for terminal reporting. :param _pytest.config.Config config: pytest config object :param startdir: py.path object with the starting dir .. note:: This function should be implemented only in plugins or ``conftest.py`` files...
return a string or list of strings to be displayed as header info for terminal reporting.
def pytest_report_header(config, startdir): """ return a string or list of strings to be displayed as header info for terminal reporting. :param _pytest.config.Config config: pytest config object :param startdir: py.path object with the starting dir .. note:: This function should be implement...
[ "def", "pytest_report_header", "(", "config", ",", "startdir", ")", ":" ]
[ 456, 0 ]
[ 467, 7 ]
python
en
['en', 'en', 'en']
True
pytest_report_collectionfinish
(config, startdir, items)
.. versionadded:: 3.2 return a string or list of strings to be displayed after collection has finished successfully. This strings will be displayed after the standard "collected X items" message. :param _pytest.config.Config config: pytest config object :param startdir: py.path object with the s...
.. versionadded:: 3.2
def pytest_report_collectionfinish(config, startdir, items): """ .. versionadded:: 3.2 return a string or list of strings to be displayed after collection has finished successfully. This strings will be displayed after the standard "collected X items" message. :param _pytest.config.Config config:...
[ "def", "pytest_report_collectionfinish", "(", "config", ",", "startdir", ",", "items", ")", ":" ]
[ 470, 0 ]
[ 481, 7 ]
python
en
['en', 'error', 'th']
False
pytest_report_teststatus
(report)
return result-category, shortletter and verbose word for reporting. Stops at first non-None result, see :ref:`firstresult`
return result-category, shortletter and verbose word for reporting.
def pytest_report_teststatus(report): """ return result-category, shortletter and verbose word for reporting. Stops at first non-None result, see :ref:`firstresult` """
[ "def", "pytest_report_teststatus", "(", "report", ")", ":" ]
[ 485, 0 ]
[ 488, 62 ]
python
en
['en', 'en', 'en']
True
pytest_terminal_summary
(terminalreporter, exitstatus)
add additional section in terminal summary reporting.
add additional section in terminal summary reporting.
def pytest_terminal_summary(terminalreporter, exitstatus): """ add additional section in terminal summary reporting. """
[ "def", "pytest_terminal_summary", "(", "terminalreporter", ",", "exitstatus", ")", ":" ]
[ 491, 0 ]
[ 492, 66 ]
python
en
['en', 'en', 'en']
True
pytest_logwarning
(message, code, nodeid, fslocation)
process a warning specified by a message, a code string, a nodeid and fslocation (both of which may be None if the warning is not tied to a particular node/location). .. note:: This hook is incompatible with ``hookwrapper=True``.
process a warning specified by a message, a code string, a nodeid and fslocation (both of which may be None if the warning is not tied to a particular node/location).
def pytest_logwarning(message, code, nodeid, fslocation): """ process a warning specified by a message, a code string, a nodeid and fslocation (both of which may be None if the warning is not tied to a particular node/location). .. note:: This hook is incompatible with ``hookwrapper=True``. ...
[ "def", "pytest_logwarning", "(", "message", ",", "code", ",", "nodeid", ",", "fslocation", ")", ":" ]
[ 496, 0 ]
[ 503, 7 ]
python
en
['en', 'en', 'en']
True
pytest_doctest_prepare_content
(content)
return processed content for a given doctest Stops at first non-None result, see :ref:`firstresult`
return processed content for a given doctest
def pytest_doctest_prepare_content(content): """ return processed content for a given doctest Stops at first non-None result, see :ref:`firstresult` """
[ "def", "pytest_doctest_prepare_content", "(", "content", ")", ":" ]
[ 511, 0 ]
[ 514, 62 ]
python
en
['en', 'en', 'en']
True
pytest_internalerror
(excrepr, excinfo)
called for internal errors.
called for internal errors.
def pytest_internalerror(excrepr, excinfo): """ called for internal errors. """
[ "def", "pytest_internalerror", "(", "excrepr", ",", "excinfo", ")", ":" ]
[ 521, 0 ]
[ 522, 39 ]
python
en
['en', 'en', 'en']
True
pytest_keyboard_interrupt
(excinfo)
called for keyboard interrupt.
called for keyboard interrupt.
def pytest_keyboard_interrupt(excinfo): """ called for keyboard interrupt. """
[ "def", "pytest_keyboard_interrupt", "(", "excinfo", ")", ":" ]
[ 525, 0 ]
[ 526, 42 ]
python
en
['en', 'en', 'en']
True
pytest_exception_interact
(node, call, report)
called when an exception was raised which can potentially be interactively handled. This hook is only called if an exception was raised that is not an internal exception like ``skip.Exception``.
called when an exception was raised which can potentially be interactively handled.
def pytest_exception_interact(node, call, report): """called when an exception was raised which can potentially be interactively handled. This hook is only called if an exception was raised that is not an internal exception like ``skip.Exception``. """
[ "def", "pytest_exception_interact", "(", "node", ",", "call", ",", "report", ")", ":" ]
[ 529, 0 ]
[ 535, 7 ]
python
en
['en', 'en', 'en']
True
pytest_enter_pdb
(config)
called upon pdb.set_trace(), can be used by plugins to take special action just before the python debugger enters in interactive mode. :param _pytest.config.Config config: pytest config object
called upon pdb.set_trace(), can be used by plugins to take special action just before the python debugger enters in interactive mode.
def pytest_enter_pdb(config): """ called upon pdb.set_trace(), can be used by plugins to take special action just before the python debugger enters in interactive mode. :param _pytest.config.Config config: pytest config object """
[ "def", "pytest_enter_pdb", "(", "config", ")", ":" ]
[ 538, 0 ]
[ 543, 7 ]
python
en
['en', 'en', 'en']
True
TestDeprecatedCall.test_deprecated_call_no_warning
(self, mode)
Ensure deprecated_call() raises the expected failure when its block/function does not raise a deprecation warning.
Ensure deprecated_call() raises the expected failure when its block/function does not raise a deprecation warning.
def test_deprecated_call_no_warning(self, mode): """Ensure deprecated_call() raises the expected failure when its block/function does not raise a deprecation warning. """ def f(): pass msg = 'Did not produce DeprecationWarning or PendingDeprecationWarning' wi...
[ "def", "test_deprecated_call_no_warning", "(", "self", ",", "mode", ")", ":", "def", "f", "(", ")", ":", "pass", "msg", "=", "'Did not produce DeprecationWarning or PendingDeprecationWarning'", "with", "pytest", ".", "raises", "(", "AssertionError", ",", "matches", ...
[ 107, 4 ]
[ 120, 23 ]
python
en
['en', 'en', 'en']
True
TestDeprecatedCall.test_deprecated_call_modes
(self, warning_type, mode, call_f_first)
Ensure deprecated_call() captures a deprecation warning as expected inside its block/function.
Ensure deprecated_call() captures a deprecation warning as expected inside its block/function.
def test_deprecated_call_modes(self, warning_type, mode, call_f_first): """Ensure deprecated_call() captures a deprecation warning as expected inside its block/function. """ def f(): warnings.warn(warning_type("hi")) return 10 # ensure deprecated_call() c...
[ "def", "test_deprecated_call_modes", "(", "self", ",", "warning_type", ",", "mode", ",", "call_f_first", ")", ":", "def", "f", "(", ")", ":", "warnings", ".", "warn", "(", "warning_type", "(", "\"hi\"", ")", ")", "return", "10", "# ensure deprecated_call() can...
[ 126, 4 ]
[ 141, 32 ]
python
en
['en', 'en', 'en']
True
TestDeprecatedCall.test_deprecated_call_exception_is_raised
(self, mode)
If the block of the code being tested by deprecated_call() raises an exception, it must raise the exception undisturbed.
If the block of the code being tested by deprecated_call() raises an exception, it must raise the exception undisturbed.
def test_deprecated_call_exception_is_raised(self, mode): """If the block of the code being tested by deprecated_call() raises an exception, it must raise the exception undisturbed. """ def f(): raise ValueError('some exception') with pytest.raises(ValueError, match=...
[ "def", "test_deprecated_call_exception_is_raised", "(", "self", ",", "mode", ")", ":", "def", "f", "(", ")", ":", "raise", "ValueError", "(", "'some exception'", ")", "with", "pytest", ".", "raises", "(", "ValueError", ",", "match", "=", "'some exception'", ")...
[ 144, 4 ]
[ 156, 23 ]
python
en
['en', 'en', 'en']
True
TestWarns.test_double_test
(self, testdir)
If a test is run again, the warning should still be raised
If a test is run again, the warning should still be raised
def test_double_test(self, testdir): """If a test is run again, the warning should still be raised""" testdir.makepyfile(''' import pytest import warnings @pytest.mark.parametrize('run', [1, 2]) def test(run): with pytest.warns(RuntimeWarn...
[ "def", "test_double_test", "(", "self", ",", "testdir", ")", ":", "testdir", ".", "makepyfile", "(", "'''\n import pytest\n import warnings\n\n @pytest.mark.parametrize('run', [1, 2])\n def test(run):\n with pytest.warns(RuntimeWarni...
[ 272, 4 ]
[ 284, 54 ]
python
en
['en', 'en', 'en']
True
replace_assignees_username_with_name
(assignees: List[Dict[str, str]])
Replace the username of each assignee with their (full) name. This is a hack-like adaptor so that when assignees are passed to `get_pull_request_event_message` we can use the assignee's name and not their username (for more consistency).
Replace the username of each assignee with their (full) name.
def replace_assignees_username_with_name(assignees: List[Dict[str, str]]) -> List[Dict[str, str]]: """Replace the username of each assignee with their (full) name. This is a hack-like adaptor so that when assignees are passed to `get_pull_request_event_message` we can use the assignee's name and not th...
[ "def", "replace_assignees_username_with_name", "(", "assignees", ":", "List", "[", "Dict", "[", "str", ",", "str", "]", "]", ")", "->", "List", "[", "Dict", "[", "str", ",", "str", "]", "]", ":", "for", "assignee", "in", "assignees", ":", "assignee", "...
[ 172, 0 ]
[ 181, 20 ]
python
en
['en', 'en', 'en']
True
direct_url_as_pep440_direct_reference
(direct_url, name)
Convert a DirectUrl to a pip requirement string.
Convert a DirectUrl to a pip requirement string.
def direct_url_as_pep440_direct_reference(direct_url, name): # type: (DirectUrl, str) -> str """Convert a DirectUrl to a pip requirement string.""" direct_url.validate() # if invalid, this is a pip bug requirement = name + " @ " fragments = [] if isinstance(direct_url.info, VcsInfo): re...
[ "def", "direct_url_as_pep440_direct_reference", "(", "direct_url", ",", "name", ")", ":", "# type: (DirectUrl, str) -> str", "direct_url", ".", "validate", "(", ")", "# if invalid, this is a pip bug", "requirement", "=", "name", "+", "\" @ \"", "fragments", "=", "[", "]...
[ 29, 0 ]
[ 54, 22 ]
python
en
['en', 'en', 'en']
True
dist_get_direct_url
(dist)
Obtain a DirectUrl from a pkg_resource.Distribution. Returns None if the distribution has no `direct_url.json` metadata, or if `direct_url.json` is invalid.
Obtain a DirectUrl from a pkg_resource.Distribution.
def dist_get_direct_url(dist): # type: (Distribution) -> Optional[DirectUrl] """Obtain a DirectUrl from a pkg_resource.Distribution. Returns None if the distribution has no `direct_url.json` metadata, or if `direct_url.json` is invalid. """ if not dist.has_metadata(DIRECT_URL_METADATA_NAME): ...
[ "def", "dist_get_direct_url", "(", "dist", ")", ":", "# type: (Distribution) -> Optional[DirectUrl]", "if", "not", "dist", ".", "has_metadata", "(", "DIRECT_URL_METADATA_NAME", ")", ":", "return", "None", "try", ":", "return", "DirectUrl", ".", "from_json", "(", "di...
[ 107, 0 ]
[ 129, 19 ]
python
en
['en', 'en', 'en']
True
api_zendesk_webhook
( request: HttpRequest, user_profile: UserProfile, ticket_title: str = REQ(), ticket_id: str = REQ(), message: str = REQ(), )
Zendesk uses triggers with message templates. This webhook uses the ticket_id and ticket_title to create a subject. And passes with zendesk user's configured message to zulip.
Zendesk uses triggers with message templates. This webhook uses the ticket_id and ticket_title to create a subject. And passes with zendesk user's configured message to zulip.
def api_zendesk_webhook( request: HttpRequest, user_profile: UserProfile, ticket_title: str = REQ(), ticket_id: str = REQ(), message: str = REQ(), ) -> HttpResponse: """ Zendesk uses triggers with message templates. This webhook uses the ticket_id and ticket_title to create a subject. An...
[ "def", "api_zendesk_webhook", "(", "request", ":", "HttpRequest", ",", "user_profile", ":", "UserProfile", ",", "ticket_title", ":", "str", "=", "REQ", "(", ")", ",", "ticket_id", ":", "str", "=", "REQ", "(", ")", ",", "message", ":", "str", "=", "REQ", ...
[ 18, 0 ]
[ 32, 25 ]
python
en
['en', 'error', 'th']
False
_get_dist
(metadata_directory)
Return a pkg_resources.Distribution for the provided metadata directory.
Return a pkg_resources.Distribution for the provided metadata directory.
def _get_dist(metadata_directory): # type: (str) -> Distribution """Return a pkg_resources.Distribution for the provided metadata directory. """ dist_dir = metadata_directory.rstrip(os.sep) # Build a PathMetadata object, from path to metadata. :wink: base_dir, dist_dir_name = os.path.split(...
[ "def", "_get_dist", "(", "metadata_directory", ")", ":", "# type: (str) -> Distribution", "dist_dir", "=", "metadata_directory", ".", "rstrip", "(", "os", ".", "sep", ")", "# Build a PathMetadata object, from path to metadata. :wink:", "base_dir", ",", "dist_dir_name", "=",...
[ 67, 0 ]
[ 91, 5 ]
python
en
['en', 'en', 'en']
True
InstallRequirement.format_debug
(self)
An un-tested helper for getting state, for debugging.
An un-tested helper for getting state, for debugging.
def format_debug(self): # type: () -> str """An un-tested helper for getting state, for debugging. """ attributes = vars(self) names = sorted(attributes) state = ( "{}={!r}".format(attr, attributes[attr]) for attr in sorted(names) ) return '<{...
[ "def", "format_debug", "(", "self", ")", ":", "# type: () -> str", "attributes", "=", "vars", "(", "self", ")", "names", "=", "sorted", "(", "attributes", ")", "state", "=", "(", "\"{}={!r}\"", ".", "format", "(", "attr", ",", "attributes", "[", "attr", ...
[ 242, 4 ]
[ 255, 9 ]
python
en
['da', 'en', 'en']
True
InstallRequirement.is_pinned
(self)
Return whether I am pinned to an exact version. For example, some-package==1.2 is pinned; some-package>1.2 is not.
Return whether I am pinned to an exact version.
def is_pinned(self): # type: () -> bool """Return whether I am pinned to an exact version. For example, some-package==1.2 is pinned; some-package>1.2 is not. """ specifiers = self.specifier return (len(specifiers) == 1 and next(iter(specifiers)).operator ...
[ "def", "is_pinned", "(", "self", ")", ":", "# type: () -> bool", "specifiers", "=", "self", ".", "specifier", "return", "(", "len", "(", "specifiers", ")", "==", "1", "and", "next", "(", "iter", "(", "specifiers", ")", ")", ".", "operator", "in", "{", ...
[ 271, 4 ]
[ 279, 65 ]
python
en
['en', 'en', 'en']
True
InstallRequirement.has_hash_options
(self)
Return whether any known-good hashes are specified as options. These activate --require-hashes mode; hashes specified as part of a URL do not.
Return whether any known-good hashes are specified as options.
def has_hash_options(self): # type: () -> bool """Return whether any known-good hashes are specified as options. These activate --require-hashes mode; hashes specified as part of a URL do not. """ return bool(self.hash_options)
[ "def", "has_hash_options", "(", "self", ")", ":", "# type: () -> bool", "return", "bool", "(", "self", ".", "hash_options", ")" ]
[ 300, 4 ]
[ 308, 38 ]
python
en
['en', 'en', 'en']
True
InstallRequirement.hashes
(self, trust_internet=True)
Return a hash-comparer that considers my option- and URL-based hashes to be known-good. Hashes in URLs--ones embedded in the requirements file, not ones downloaded from an index server--are almost peers with ones from flags. They satisfy --require-hashes (whether it was implicitly or ...
Return a hash-comparer that considers my option- and URL-based hashes to be known-good.
def hashes(self, trust_internet=True): # type: (bool) -> Hashes """Return a hash-comparer that considers my option- and URL-based hashes to be known-good. Hashes in URLs--ones embedded in the requirements file, not ones downloaded from an index server--are almost peers with ones...
[ "def", "hashes", "(", "self", ",", "trust_internet", "=", "True", ")", ":", "# type: (bool) -> Hashes", "good_hashes", "=", "self", ".", "hash_options", ".", "copy", "(", ")", "link", "=", "self", ".", "link", "if", "trust_internet", "else", "self", ".", "...
[ 310, 4 ]
[ 330, 34 ]
python
en
['en', 'en', 'en']
True
InstallRequirement.from_path
(self)
Format a nice indicator to show where this "comes from"
Format a nice indicator to show where this "comes from"
def from_path(self): # type: () -> Optional[str] """Format a nice indicator to show where this "comes from" """ if self.req is None: return None s = str(self.req) if self.comes_from: if isinstance(self.comes_from, six.string_types): ...
[ "def", "from_path", "(", "self", ")", ":", "# type: () -> Optional[str]", "if", "self", ".", "req", "is", "None", ":", "return", "None", "s", "=", "str", "(", "self", ".", "req", ")", "if", "self", ".", "comes_from", ":", "if", "isinstance", "(", "self...
[ 332, 4 ]
[ 346, 16 ]
python
en
['en', 'en', 'en']
True
InstallRequirement._set_requirement
(self)
Set requirement after generating metadata.
Set requirement after generating metadata.
def _set_requirement(self): # type: () -> None """Set requirement after generating metadata. """ assert self.req is None assert self.metadata is not None assert self.source_dir is not None # Construct a Requirement object from the generated metadata if is...
[ "def", "_set_requirement", "(", "self", ")", ":", "# type: () -> None", "assert", "self", ".", "req", "is", "None", "assert", "self", ".", "metadata", "is", "not", "None", "assert", "self", ".", "source_dir", "is", "not", "None", "# Construct a Requirement objec...
[ 386, 4 ]
[ 406, 9 ]
python
en
['da', 'en', 'en']
True
InstallRequirement.check_if_exists
(self, use_user_site)
Find an installed distribution that satisfies or conflicts with this requirement, and set self.satisfied_by or self.should_reinstall appropriately.
Find an installed distribution that satisfies or conflicts with this requirement, and set self.satisfied_by or self.should_reinstall appropriately.
def check_if_exists(self, use_user_site): # type: (bool) -> None """Find an installed distribution that satisfies or conflicts with this requirement, and set self.satisfied_by or self.should_reinstall appropriately. """ if self.req is None: return exis...
[ "def", "check_if_exists", "(", "self", ",", "use_user_site", ")", ":", "# type: (bool) -> None", "if", "self", ".", "req", "is", "None", ":", "return", "existing_dist", "=", "get_distribution", "(", "self", ".", "req", ".", "name", ")", "if", "not", "existin...
[ 424, 4 ]
[ 458, 49 ]
python
en
['en', 'en', 'en']
True
InstallRequirement.load_pyproject_toml
(self)
Load the pyproject.toml file. After calling this routine, all of the attributes related to PEP 517 processing for this requirement have been set. In particular, the use_pep517 attribute can be used to determine whether we should follow the PEP 517 or legacy (setup.py) code path. ...
Load the pyproject.toml file.
def load_pyproject_toml(self): # type: () -> None """Load the pyproject.toml file. After calling this routine, all of the attributes related to PEP 517 processing for this requirement have been set. In particular, the use_pep517 attribute can be used to determine whether we shou...
[ "def", "load_pyproject_toml", "(", "self", ")", ":", "# type: () -> None", "pyproject_toml_data", "=", "load_pyproject_toml", "(", "self", ".", "use_pep517", ",", "self", ".", "pyproject_toml_path", ",", "self", ".", "setup_py_path", ",", "str", "(", "self", ")", ...
[ 494, 4 ]
[ 520, 9 ]
python
en
['en', 'en', 'en']
True
InstallRequirement._generate_metadata
(self)
Invokes metadata generator functions, with the required arguments.
Invokes metadata generator functions, with the required arguments.
def _generate_metadata(self): # type: () -> str """Invokes metadata generator functions, with the required arguments. """ if not self.use_pep517: assert self.unpacked_source_directory return generate_metadata_legacy( build_env=self.build_env, ...
[ "def", "_generate_metadata", "(", "self", ")", ":", "# type: () -> str", "if", "not", "self", ".", "use_pep517", ":", "assert", "self", ".", "unpacked_source_directory", "return", "generate_metadata_legacy", "(", "build_env", "=", "self", ".", "build_env", ",", "s...
[ 522, 4 ]
[ 542, 9 ]
python
en
['en', 'en', 'en']
True
InstallRequirement.prepare_metadata
(self)
Ensure that project metadata is available. Under PEP 517, call the backend hook to prepare the metadata. Under legacy processing, call setup.py egg-info.
Ensure that project metadata is available.
def prepare_metadata(self): # type: () -> None """Ensure that project metadata is available. Under PEP 517, call the backend hook to prepare the metadata. Under legacy processing, call setup.py egg-info. """ assert self.source_dir with indent_log(): ...
[ "def", "prepare_metadata", "(", "self", ")", ":", "# type: () -> None", "assert", "self", ".", "source_dir", "with", "indent_log", "(", ")", ":", "self", ".", "metadata_directory", "=", "self", ".", "_generate_metadata", "(", ")", "# Act on the newly generated metad...
[ 544, 4 ]
[ 562, 44 ]
python
en
['en', 'en', 'en']
True
InstallRequirement.ensure_has_source_dir
( self, parent_dir, autodelete=False, parallel_builds=False, )
Ensure that a source_dir is set. This will create a temporary build dir if the name of the requirement isn't known yet. :param parent_dir: The ideal pip parent_dir for the source_dir. Generally src_dir for editables and build_dir for sdists. :return: self.source_dir ...
Ensure that a source_dir is set.
def ensure_has_source_dir( self, parent_dir, autodelete=False, parallel_builds=False, ): # type: (str, bool, bool) -> None """Ensure that a source_dir is set. This will create a temporary build dir if the name of the requirement isn't known yet. ...
[ "def", "ensure_has_source_dir", "(", "self", ",", "parent_dir", ",", "autodelete", "=", "False", ",", "parallel_builds", "=", "False", ",", ")", ":", "# type: (str, bool, bool) -> None", "if", "self", ".", "source_dir", "is", "None", ":", "self", ".", "source_di...
[ 595, 4 ]
[ 616, 13 ]
python
en
['en', 'fr', 'en']
True
InstallRequirement.uninstall
(self, auto_confirm=False, verbose=False)
Uninstall the distribution currently satisfying this requirement. Prompts before removing or modifying files unless ``auto_confirm`` is True. Refuses to delete or modify files outside of ``sys.prefix`` - thus uninstallation within a virtual environment can only modify ...
Uninstall the distribution currently satisfying this requirement.
def uninstall(self, auto_confirm=False, verbose=False): # type: (bool, bool) -> Optional[UninstallPathSet] """ Uninstall the distribution currently satisfying this requirement. Prompts before removing or modifying files unless ``auto_confirm`` is True. Refuses to delete...
[ "def", "uninstall", "(", "self", ",", "auto_confirm", "=", "False", ",", "verbose", "=", "False", ")", ":", "# type: (bool, bool) -> Optional[UninstallPathSet]", "assert", "self", ".", "req", "dist", "=", "get_distribution", "(", "self", ".", "req", ".", "name",...
[ 663, 4 ]
[ 686, 34 ]
python
en
['en', 'error', 'th']
False
InstallRequirement.archive
(self, build_dir)
Saves archive to provided build_dir. Used for saving downloaded VCS requirements as part of `pip download`.
Saves archive to provided build_dir.
def archive(self, build_dir): # type: (str) -> None """Saves archive to provided build_dir. Used for saving downloaded VCS requirements as part of `pip download`. """ assert self.source_dir create_archive = True archive_name = '{}-{}.zip'.format(self.name, self....
[ "def", "archive", "(", "self", ",", "build_dir", ")", ":", "# type: (str) -> None", "assert", "self", ".", "source_dir", "create_archive", "=", "True", "archive_name", "=", "'{}-{}.zip'", ".", "format", "(", "self", ".", "name", ",", "self", ".", "metadata", ...
[ 705, 4 ]
[ 764, 59 ]
python
en
['en', 'en', 'en']
True
Typed.__init__
(self, schema)
@param schema: A schema object. @type schema: L{xsd.schema.Schema}
def __init__(self, schema): """ @param schema: A schema object. @type schema: L{xsd.schema.Schema} """ self.resolver = NodeResolver(schema)
[ "def", "__init__", "(", "self", ",", "schema", ")", ":", "self", ".", "resolver", "=", "NodeResolver", "(", "schema", ")" ]
[ 46, 4 ]
[ 51, 44 ]
python
en
['en', 'error', 'th']
False
Typed.process
(self, node, type)
Process an object graph representation of the xml L{node}. @param node: An XML tree. @type node: L{sax.element.Element} @param type: The I{optional} schema type. @type type: L{xsd.sxbase.SchemaObject} @return: A suds object. @rtype: L{Object}
Process an object graph representation of the xml L{node}.
def process(self, node, type): """ Process an object graph representation of the xml L{node}. @param node: An XML tree. @type node: L{sax.element.Element} @param type: The I{optional} schema type. @type type: L{xsd.sxbase.SchemaObject} @return: A suds object. ...
[ "def", "process", "(", "self", ",", "node", ",", "type", ")", ":", "content", "=", "Content", "(", "node", ")", "content", ".", "type", "=", "type", "return", "Core", ".", "process", "(", "self", ",", "content", ")" ]
[ 53, 4 ]
[ 65, 42 ]
python
en
['en', 'error', 'th']
False
Typed.append_attribute
(self, name, value, content)
Append an attribute name/value into L{Content.data}. @param name: The attribute name @type name: basestring @param value: The attribute's value @type value: basestring @param content: The current content being unmarshalled. @type content: L{Content}
Append an attribute name/value into L{Content.data}.
def append_attribute(self, name, value, content): """ Append an attribute name/value into L{Content.data}. @param name: The attribute name @type name: basestring @param value: The attribute's value @type value: basestring @param content: The current content being ...
[ "def", "append_attribute", "(", "self", ",", "name", ",", "value", ",", "content", ")", ":", "type", "=", "self", ".", "resolver", ".", "findattr", "(", "name", ")", "if", "type", "is", "None", ":", "log", ".", "warn", "(", "'attribute (%s) type, not-fou...
[ 105, 4 ]
[ 120, 57 ]
python
en
['en', 'error', 'th']
False
Typed.append_text
(self, content)
Append text nodes into L{Content.data} Here is where the I{true} type is used to translate the value into the proper python type. @param content: The current content being unmarshalled. @type content: L{Content}
Append text nodes into L{Content.data} Here is where the I{true} type is used to translate the value into the proper python type.
def append_text(self, content): """ Append text nodes into L{Content.data} Here is where the I{true} type is used to translate the value into the proper python type. @param content: The current content being unmarshalled. @type content: L{Content} """ Core...
[ "def", "append_text", "(", "self", ",", "content", ")", ":", "Core", ".", "append_text", "(", "self", ",", "content", ")", "known", "=", "self", ".", "resolver", ".", "top", "(", ")", ".", "resolved", "content", ".", "text", "=", "self", ".", "transl...
[ 122, 4 ]
[ 132, 59 ]
python
en
['en', 'error', 'th']
False
Typed.translated
(self, value, type)
translate using the schema type
translate using the schema type
def translated(self, value, type): """ translate using the schema type """ if value is not None: resolved = type.resolve() return resolved.translate(value) else: return value
[ "def", "translated", "(", "self", ",", "value", ",", "type", ")", ":", "if", "value", "is", "not", "None", ":", "resolved", "=", "type", ".", "resolve", "(", ")", "return", "resolved", ".", "translate", "(", "value", ")", "else", ":", "return", "valu...
[ 134, 4 ]
[ 140, 24 ]
python
en
['en', 'ne', 'en']
True
TestMetafunc.test_parametrize_and_id_unicode
(self)
Allow unicode strings for "ids" parameter in Python 2 (##1905)
Allow unicode strings for "ids" parameter in Python 2 (##1905)
def test_parametrize_and_id_unicode(self): """Allow unicode strings for "ids" parameter in Python 2 (##1905)""" def func(x): pass metafunc = self.Metafunc(func) metafunc.parametrize("x", [1, 2], ids=[u'basic', u'advanced']) ids = [x.id for x in metafunc._calls] ...
[ "def", "test_parametrize_and_id_unicode", "(", "self", ")", ":", "def", "func", "(", "x", ")", ":", "pass", "metafunc", "=", "self", ".", "Metafunc", "(", "func", ")", "metafunc", ".", "parametrize", "(", "\"x\"", ",", "[", "1", ",", "2", "]", ",", "...
[ 133, 4 ]
[ 140, 45 ]
python
en
['en', 'en', 'en']
True
TestMetafunc.test_unicode_idval
(self)
This tests that Unicode strings outside the ASCII character set get escaped, using byte escapes if they're in that range or unicode escapes if they're not.
This tests that Unicode strings outside the ASCII character set get escaped, using byte escapes if they're in that range or unicode escapes if they're not.
def test_unicode_idval(self): """This tests that Unicode strings outside the ASCII character set get escaped, using byte escapes if they're in that range or unicode escapes if they're not. """ from _pytest.python import _idval values = [ ( u''...
[ "def", "test_unicode_idval", "(", "self", ")", ":", "from", "_pytest", ".", "python", "import", "_idval", "values", "=", "[", "(", "u''", ",", "''", ")", ",", "(", "u'ascii'", ",", "'ascii'", ")", ",", "(", "u'ação',", "", "'a\\\\xe7\\\\xe3o'", ")", ",...
[ 199, 4 ]
[ 230, 56 ]
python
en
['en', 'en', 'en']
True
TestMetafunc.test_bytes_idval
(self)
unittest for the expected behavior to obtain ids for parametrized bytes values: - python2: non-ascii strings are considered bytes and formatted using "binary escape", where any byte < 127 is escaped into its hex form. - python3: bytes objects are always escaped using "binary escape". ...
unittest for the expected behavior to obtain ids for parametrized bytes values: - python2: non-ascii strings are considered bytes and formatted using "binary escape", where any byte < 127 is escaped into its hex form. - python3: bytes objects are always escaped using "binary escape". ...
def test_bytes_idval(self): """unittest for the expected behavior to obtain ids for parametrized bytes values: - python2: non-ascii strings are considered bytes and formatted using "binary escape", where any byte < 127 is escaped into its hex form. - python3: bytes objects are al...
[ "def", "test_bytes_idval", "(", "self", ")", ":", "from", "_pytest", ".", "python", "import", "_idval", "values", "=", "[", "(", "b''", ",", "''", ")", ",", "(", "b'\\xc3\\xb4\\xff\\xe4'", ",", "'\\\\xc3\\\\xb4\\\\xff\\\\xe4'", ")", ",", "(", "b'ascii'", ","...
[ 232, 4 ]
[ 247, 56 ]
python
en
['en', 'en', 'en']
True
TestMetafunc.test_class_or_function_idval
(self)
unittest for the expected behavior to obtain ids for parametrized values that are classes or functions: their __name__.
unittest for the expected behavior to obtain ids for parametrized values that are classes or functions: their __name__.
def test_class_or_function_idval(self): """unittest for the expected behavior to obtain ids for parametrized values that are classes or functions: their __name__. """ from _pytest.python import _idval class TestClass(object): pass def test_function(): ...
[ "def", "test_class_or_function_idval", "(", "self", ")", ":", "from", "_pytest", ".", "python", "import", "_idval", "class", "TestClass", "(", "object", ")", ":", "pass", "def", "test_function", "(", ")", ":", "pass", "values", "=", "[", "(", "TestClass", ...
[ 249, 4 ]
[ 266, 56 ]
python
en
['en', 'en', 'en']
True
TestMetafunc.test_parametrize_ids_exception
(self, testdir)
:param testdir: the instance of Testdir class, a temporary test directory.
:param testdir: the instance of Testdir class, a temporary test directory.
def test_parametrize_ids_exception(self, testdir): """ :param testdir: the instance of Testdir class, a temporary test directory. """ testdir.makepyfile(""" import pytest def ids(arg): raise Exception("bad ids") ...
[ "def", "test_parametrize_ids_exception", "(", "self", ",", "testdir", ")", ":", "testdir", ".", "makepyfile", "(", "\"\"\"\n import pytest\n\n def ids(arg):\n raise Exception(\"bad ids\")\n\n @pytest.mark.parametrize(\"arg\", [\...
[ 395, 4 ]
[ 416, 10 ]
python
en
['en', 'error', 'th']
False
TestMetafunc.test_parametrize_indirect_list_functional
(self, testdir)
Test parametrization with 'indirect' parameter applied on particular arguments. As y is is direct, its value should be used directly rather than being passed to the fixture y. :param testdir: the instance of Testdir class, a temporary test directory.
Test parametrization with 'indirect' parameter applied on particular arguments. As y is is direct, its value should be used directly rather than being passed to the fixture y.
def test_parametrize_indirect_list_functional(self, testdir): """ Test parametrization with 'indirect' parameter applied on particular arguments. As y is is direct, its value should be used directly rather than being passed to the fixture y. :param testdir: the instance ...
[ "def", "test_parametrize_indirect_list_functional", "(", "self", ",", "testdir", ")", ":", "testdir", ".", "makepyfile", "(", "\"\"\"\n import pytest\n @pytest.fixture(scope='function')\n def x(request):\n return request.param * 3\n ...
[ 491, 4 ]
[ 518, 10 ]
python
en
['en', 'error', 'th']
False
TestMetafunc.test_parametrize_uses_no_fixture_error_indirect_false
(self, testdir)
The 'uses no fixture' error tells the user at collection time that the parametrize data they've set up doesn't correspond to the fixtures in their test function, rather than silently ignoring this and letting the test potentially pass.
The 'uses no fixture' error tells the user at collection time that the parametrize data they've set up doesn't correspond to the fixtures in their test function, rather than silently ignoring this and letting the test potentially pass.
def test_parametrize_uses_no_fixture_error_indirect_false(self, testdir): """The 'uses no fixture' error tells the user at collection time that the parametrize data they've set up doesn't correspond to the fixtures in their test function, rather than silently ignoring this and letting th...
[ "def", "test_parametrize_uses_no_fixture_error_indirect_false", "(", "self", ",", "testdir", ")", ":", "testdir", ".", "makepyfile", "(", "\"\"\"\n import pytest\n\n @pytest.mark.parametrize('x, y', [('a', 'b')], indirect=False)\n def test_simple(x):\n ...
[ 529, 4 ]
[ 545, 10 ]
python
en
['en', 'en', 'en']
True
TestMetafuncFunctional.test_fixture_parametrized_empty_ids
(self, testdir)
Fixtures parametrized with empty ids cause an internal error (#1849).
Fixtures parametrized with empty ids cause an internal error (#1849).
def test_fixture_parametrized_empty_ids(self, testdir): """Fixtures parametrized with empty ids cause an internal error (#1849).""" testdir.makepyfile(''' import pytest @pytest.fixture(scope="module", ids=[], params=[]) def temp(request): return reques...
[ "def", "test_fixture_parametrized_empty_ids", "(", "self", ",", "testdir", ")", ":", "testdir", ".", "makepyfile", "(", "'''\n import pytest\n\n @pytest.fixture(scope=\"module\", ids=[], params=[])\n def temp(request):\n return request.param\n\n...
[ 1047, 4 ]
[ 1060, 54 ]
python
en
['en', 'en', 'en']
True
TestMetafuncFunctional.test_parametrized_empty_ids
(self, testdir)
Tests parametrized with empty ids cause an internal error (#1849).
Tests parametrized with empty ids cause an internal error (#1849).
def test_parametrized_empty_ids(self, testdir): """Tests parametrized with empty ids cause an internal error (#1849).""" testdir.makepyfile(''' import pytest @pytest.mark.parametrize('temp', [], ids=list()) def test_temp(temp): pass ''') ...
[ "def", "test_parametrized_empty_ids", "(", "self", ",", "testdir", ")", ":", "testdir", ".", "makepyfile", "(", "'''\n import pytest\n\n @pytest.mark.parametrize('temp', [], ids=list())\n def test_temp(temp):\n pass\n '''", ")", "re...
[ 1062, 4 ]
[ 1072, 54 ]
python
en
['en', 'en', 'en']
True
TestMetafuncFunctional.test_parametrized_ids_invalid_type
(self, testdir)
Tests parametrized with ids as non-strings (#1857).
Tests parametrized with ids as non-strings (#1857).
def test_parametrized_ids_invalid_type(self, testdir): """Tests parametrized with ids as non-strings (#1857).""" testdir.makepyfile(''' import pytest @pytest.mark.parametrize("x, expected", [(10, 20), (40, 80)], ids=(None, 2)) def test_ids_numbers(x,expected): ...
[ "def", "test_parametrized_ids_invalid_type", "(", "self", ",", "testdir", ")", ":", "testdir", ".", "makepyfile", "(", "'''\n import pytest\n\n @pytest.mark.parametrize(\"x, expected\", [(10, 20), (40, 80)], ids=(None, 2))\n def test_ids_numbers(x,expected):\...
[ 1074, 4 ]
[ 1084, 92 ]
python
en
['en', 'en', 'en']
True
SettingHelpExtension.extendMarkdown
(self, md: Markdown)
Add SettingHelpExtension to the Markdown instance.
Add SettingHelpExtension to the Markdown instance.
def extendMarkdown(self, md: Markdown) -> None: """Add SettingHelpExtension to the Markdown instance.""" md.registerExtension(self) md.preprocessors.register(Setting(), "setting", 515)
[ "def", "extendMarkdown", "(", "self", ",", "md", ":", "Markdown", ")", "->", "None", ":", "md", ".", "registerExtension", "(", "self", ")", "md", ".", "preprocessors", ".", "register", "(", "Setting", "(", ")", ",", "\"setting\"", ",", "515", ")" ]
[ 98, 4 ]
[ 101, 60 ]
python
en
['en', 'en', 'en']
True
RawField.preprocess
(self, x)
Preprocess an example if the `preprocessing` Pipeline is provided.
Preprocess an example if the `preprocessing` Pipeline is provided.
def preprocess(self, x): """ Preprocess an example if the `preprocessing` Pipeline is provided. """ if self.preprocessing is not None: return self.preprocessing(x) else: return x
[ "def", "preprocess", "(", "self", ",", "x", ")", ":", "if", "self", ".", "preprocessing", "is", "not", "None", ":", "return", "self", ".", "preprocessing", "(", "x", ")", "else", ":", "return", "x" ]
[ 41, 4 ]
[ 46, 20 ]
python
en
['en', 'en', 'en']
True
RawField.process
(self, batch, *args, **kwargs)
Process a list of examples to create a batch. Postprocess the batch with user-provided Pipeline. Args: batch (list(object)): A list of object from a batch of examples. Returns: object: Processed object given the input and custom postprocessing Pipeline....
Process a list of examples to create a batch.
def process(self, batch, *args, **kwargs): """ Process a list of examples to create a batch. Postprocess the batch with user-provided Pipeline. Args: batch (list(object)): A list of object from a batch of examples. Returns: object: Processed object given the inp...
[ "def", "process", "(", "self", ",", "batch", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "postprocessing", "is", "not", "None", ":", "batch", "=", "self", ".", "postprocessing", "(", "batch", ")", "return", "default_collate"...
[ 48, 4 ]
[ 61, 37 ]
python
en
['en', 'en', 'en']
True
TextField.pad
(self, minibatch)
Pad a batch of examples using this field. Pads to self.fix_length if provided, otherwise pads to the length of the longest example in the batch. Prepends self.init_token and appends self.eos_token if those attributes are not None. Returns a tuple of the padded list and a list containing ...
Pad a batch of examples using this field. Pads to self.fix_length if provided, otherwise pads to the length of the longest example in the batch. Prepends self.init_token and appends self.eos_token if those attributes are not None. Returns a tuple of the padded list and a list containing ...
def pad(self, minibatch): """Pad a batch of examples using this field. Pads to self.fix_length if provided, otherwise pads to the length of the longest example in the batch. Prepends self.init_token and appends self.eos_token if those attributes are not None. Returns a tuple of the ...
[ "def", "pad", "(", "self", ",", "minibatch", ")", ":", "minibatch", "=", "list", "(", "minibatch", ")", "if", "self", ".", "fix_length", "is", "None", ":", "max_len", "=", "max", "(", "len", "(", "x", ")", "for", "x", "in", "minibatch", ")", "else"...
[ 214, 4 ]
[ 246, 21 ]
python
en
['en', 'en', 'en']
True
TextField.numericalize
(self, arr, device=None)
Turn a batch of examples that use this field into a list of Variables. If the field has include_lengths=True, a tensor of lengths will be included in the return value. Arguments: arr (List[List[str]], or tuple of (List[List[str]], List[int])): List of tokenized and pa...
Turn a batch of examples that use this field into a list of Variables. If the field has include_lengths=True, a tensor of lengths will be included in the return value. Arguments: arr (List[List[str]], or tuple of (List[List[str]], List[int])): List of tokenized and pa...
def numericalize(self, arr, device=None): """Turn a batch of examples that use this field into a list of Variables. If the field has include_lengths=True, a tensor of lengths will be included in the return value. Arguments: arr (List[List[str]], or tuple of (List[List[str]], ...
[ "def", "numericalize", "(", "self", ",", "arr", ",", "device", "=", "None", ")", ":", "if", "self", ".", "include_lengths", "and", "not", "isinstance", "(", "arr", ",", "tuple", ")", ":", "raise", "ValueError", "(", "\"Field has include_lengths set to True, bu...
[ 248, 4 ]
[ 304, 18 ]
python
en
['en', 'en', 'en']
True