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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
pytest_addoption | (parser) | Add options to control log capturing. | Add options to control log capturing. | def pytest_addoption(parser):
"""Add options to control log capturing."""
group = parser.getgroup('logging')
def add_option_ini(option, dest, default=None, type=None, **kwargs):
parser.addini(dest, default=default, type=type,
help='default value for ' + option)
group.a... | [
"def",
"pytest_addoption",
"(",
"parser",
")",
":",
"group",
"=",
"parser",
".",
"getgroup",
"(",
"'logging'",
")",
"def",
"add_option_ini",
"(",
"option",
",",
"dest",
",",
"default",
"=",
"None",
",",
"type",
"=",
"None",
",",
"*",
"*",
"kwargs",
")"... | [
78,
0
] | [
134,
62
] | python | en | ['en', 'en', 'en'] | True |
catching_logs | (handler, formatter=None, level=None) | Context manager that prepares the whole logging machinery properly. | Context manager that prepares the whole logging machinery properly. | def catching_logs(handler, formatter=None, level=None):
"""Context manager that prepares the whole logging machinery properly."""
root_logger = logging.getLogger()
if formatter is not None:
handler.setFormatter(formatter)
if level is not None:
handler.setLevel(level)
# Adding the s... | [
"def",
"catching_logs",
"(",
"handler",
",",
"formatter",
"=",
"None",
",",
"level",
"=",
"None",
")",
":",
"root_logger",
"=",
"logging",
".",
"getLogger",
"(",
")",
"if",
"formatter",
"is",
"not",
"None",
":",
"handler",
".",
"setFormatter",
"(",
"form... | [
138,
0
] | [
162,
46
] | python | en | ['en', 'en', 'en'] | True |
caplog | (request) | Access and control log capturing.
Captured logs are available through the following methods::
* caplog.text() -> string containing formatted log output
* caplog.records() -> list of logging.LogRecord instances
* caplog.record_tuples() -> list of (logger_name, level, message) tuples
... | Access and control log capturing. | def caplog(request):
"""Access and control log capturing.
Captured logs are available through the following methods::
* caplog.text() -> string containing formatted log output
* caplog.records() -> list of logging.LogRecord instances
* caplog.record_tuples() -> list of (logger_name,... | [
"def",
"caplog",
"(",
"request",
")",
":",
"result",
"=",
"LogCaptureFixture",
"(",
"request",
".",
"node",
")",
"yield",
"result",
"result",
".",
"_finalize",
"(",
")"
] | [
286,
0
] | [
299,
22
] | python | en | ['en', 'en', 'en'] | True |
get_actual_log_level | (config, *setting_names) | Return the actual logging level. | Return the actual logging level. | def get_actual_log_level(config, *setting_names):
"""Return the actual logging level."""
for setting_name in setting_names:
log_level = config.getoption(setting_name)
if log_level is None:
log_level = config.getini(setting_name)
if log_level:
break
else:
... | [
"def",
"get_actual_log_level",
"(",
"config",
",",
"*",
"setting_names",
")",
":",
"for",
"setting_name",
"in",
"setting_names",
":",
"log_level",
"=",
"config",
".",
"getoption",
"(",
"setting_name",
")",
"if",
"log_level",
"is",
"None",
":",
"log_level",
"="... | [
302,
0
] | [
325,
30
] | python | en | ['en', 'la', 'en'] | True |
LogCaptureHandler.__init__ | (self) | Creates a new log handler. | Creates a new log handler. | def __init__(self):
"""Creates a new log handler."""
logging.StreamHandler.__init__(self, py.io.TextIO())
self.records = [] | [
"def",
"__init__",
"(",
"self",
")",
":",
"logging",
".",
"StreamHandler",
".",
"__init__",
"(",
"self",
",",
"py",
".",
"io",
".",
"TextIO",
"(",
")",
")",
"self",
".",
"records",
"=",
"[",
"]"
] | [
168,
4
] | [
171,
25
] | python | en | ['en', 'be', 'en'] | True |
LogCaptureHandler.emit | (self, record) | Keep the log records in a list in addition to the log text. | Keep the log records in a list in addition to the log text. | def emit(self, record):
"""Keep the log records in a list in addition to the log text."""
self.records.append(record)
logging.StreamHandler.emit(self, record) | [
"def",
"emit",
"(",
"self",
",",
"record",
")",
":",
"self",
".",
"records",
".",
"append",
"(",
"record",
")",
"logging",
".",
"StreamHandler",
".",
"emit",
"(",
"self",
",",
"record",
")"
] | [
173,
4
] | [
176,
48
] | python | en | ['en', 'en', 'en'] | True |
LogCaptureFixture.__init__ | (self, item) | Creates a new funcarg. | Creates a new funcarg. | def __init__(self, item):
"""Creates a new funcarg."""
self._item = item
self._initial_log_levels = {} | [
"def",
"__init__",
"(",
"self",
",",
"item",
")",
":",
"self",
".",
"_item",
"=",
"item",
"self",
".",
"_initial_log_levels",
"=",
"{",
"}"
] | [
186,
4
] | [
189,
37
] | python | en | ['en', 'ga', 'en'] | True |
LogCaptureFixture._finalize | (self) | Finalizes the fixture.
This restores the log levels changed by :meth:`set_level`.
| Finalizes the fixture. | def _finalize(self):
"""Finalizes the fixture.
This restores the log levels changed by :meth:`set_level`.
"""
# restore log levels
for logger_name, level in self._initial_log_levels.items():
logger = logging.getLogger(logger_name)
logger.setLevel(level) | [
"def",
"_finalize",
"(",
"self",
")",
":",
"# restore log levels",
"for",
"logger_name",
",",
"level",
"in",
"self",
".",
"_initial_log_levels",
".",
"items",
"(",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"logger_name",
")",
"logger",
".",
... | [
191,
4
] | [
199,
34
] | python | en | ['en', 'en', 'en'] | True |
LogCaptureFixture.handler | (self) |
:rtype: LogCaptureHandler
|
:rtype: LogCaptureHandler
| def handler(self):
"""
:rtype: LogCaptureHandler
"""
return self._item.catch_log_handler | [
"def",
"handler",
"(",
"self",
")",
":",
"return",
"self",
".",
"_item",
".",
"catch_log_handler"
] | [
202,
4
] | [
206,
43
] | python | en | ['en', 'error', 'th'] | False |
LogCaptureFixture.get_records | (self, when) |
Get the logging records for one of the possible test phases.
:param str when:
Which test phase to obtain the records from. Valid values are: "setup", "call" and "teardown".
:rtype: List[logging.LogRecord]
:return: the list of captured records at the given stage
..... |
Get the logging records for one of the possible test phases. | def get_records(self, when):
"""
Get the logging records for one of the possible test phases.
:param str when:
Which test phase to obtain the records from. Valid values are: "setup", "call" and "teardown".
:rtype: List[logging.LogRecord]
:return: the list of capture... | [
"def",
"get_records",
"(",
"self",
",",
"when",
")",
":",
"handler",
"=",
"self",
".",
"_item",
".",
"catch_log_handlers",
".",
"get",
"(",
"when",
")",
"if",
"handler",
":",
"return",
"handler",
".",
"records",
"else",
":",
"return",
"[",
"]"
] | [
208,
4
] | [
224,
21
] | python | en | ['en', 'error', 'th'] | False |
LogCaptureFixture.text | (self) | Returns the log text. | Returns the log text. | def text(self):
"""Returns the log text."""
return self.handler.stream.getvalue() | [
"def",
"text",
"(",
"self",
")",
":",
"return",
"self",
".",
"handler",
".",
"stream",
".",
"getvalue",
"(",
")"
] | [
227,
4
] | [
229,
45
] | python | en | ['en', 'en', 'en'] | True |
LogCaptureFixture.records | (self) | Returns the list of log records. | Returns the list of log records. | def records(self):
"""Returns the list of log records."""
return self.handler.records | [
"def",
"records",
"(",
"self",
")",
":",
"return",
"self",
".",
"handler",
".",
"records"
] | [
232,
4
] | [
234,
35
] | python | en | ['en', 'en', 'en'] | True |
LogCaptureFixture.record_tuples | (self) | Returns a list of a striped down version of log records intended
for use in assertion comparison.
The format of the tuple is:
(logger_name, log_level, message)
| Returns a list of a striped down version of log records intended
for use in assertion comparison. | def record_tuples(self):
"""Returns a list of a striped down version of log records intended
for use in assertion comparison.
The format of the tuple is:
(logger_name, log_level, message)
"""
return [(r.name, r.levelno, r.getMessage()) for r in self.records] | [
"def",
"record_tuples",
"(",
"self",
")",
":",
"return",
"[",
"(",
"r",
".",
"name",
",",
"r",
".",
"levelno",
",",
"r",
".",
"getMessage",
"(",
")",
")",
"for",
"r",
"in",
"self",
".",
"records",
"]"
] | [
237,
4
] | [
245,
74
] | python | en | ['en', 'en', 'en'] | True |
LogCaptureFixture.clear | (self) | Reset the list of log records and the captured log text. | Reset the list of log records and the captured log text. | def clear(self):
"""Reset the list of log records and the captured log text."""
self.handler.reset() | [
"def",
"clear",
"(",
"self",
")",
":",
"self",
".",
"handler",
".",
"reset",
"(",
")"
] | [
247,
4
] | [
249,
28
] | python | en | ['en', 'en', 'en'] | True |
LogCaptureFixture.set_level | (self, level, logger=None) | Sets the level for capturing of logs. The level will be restored to its previous value at the end of
the test.
:param int level: the logger to level.
:param str logger: the logger to update the level. If not given, the root logger level is updated.
.. versionchanged:: 3.4
T... | Sets the level for capturing of logs. The level will be restored to its previous value at the end of
the test. | def set_level(self, level, logger=None):
"""Sets the level for capturing of logs. The level will be restored to its previous value at the end of
the test.
:param int level: the logger to level.
:param str logger: the logger to update the level. If not given, the root logger level is upd... | [
"def",
"set_level",
"(",
"self",
",",
"level",
",",
"logger",
"=",
"None",
")",
":",
"logger_name",
"=",
"logger",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"logger_name",
")",
"# save the original log-level to restore it during teardown",
"self",
".",
"_in... | [
251,
4
] | [
266,
30
] | python | en | ['en', 'en', 'en'] | True |
LogCaptureFixture.at_level | (self, level, logger=None) | Context manager that sets the level for capturing of logs. After the end of the 'with' statement the
level is restored to its original value.
:param int level: the logger to level.
:param str logger: the logger to update the level. If not given, the root logger level is updated.
| Context manager that sets the level for capturing of logs. After the end of the 'with' statement the
level is restored to its original value. | def at_level(self, level, logger=None):
"""Context manager that sets the level for capturing of logs. After the end of the 'with' statement the
level is restored to its original value.
:param int level: the logger to level.
:param str logger: the logger to update the level. If not given... | [
"def",
"at_level",
"(",
"self",
",",
"level",
",",
"logger",
"=",
"None",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"logger",
")",
"orig_level",
"=",
"logger",
".",
"level",
"logger",
".",
"setLevel",
"(",
"level",
")",
"try",
":",
"... | [
269,
4
] | [
282,
39
] | python | en | ['en', 'en', 'en'] | True |
LoggingPlugin.__init__ | (self, config) | Creates a new plugin to capture log messages.
The formatter can be safely shared across all handlers so
create a single one for the entire test session here.
| Creates a new plugin to capture log messages. | def __init__(self, config):
"""Creates a new plugin to capture log messages.
The formatter can be safely shared across all handlers so
create a single one for the entire test session here.
"""
self._config = config
# enable verbose output automatically if live logging i... | [
"def",
"__init__",
"(",
"self",
",",
"config",
")",
":",
"self",
".",
"_config",
"=",
"config",
"# enable verbose output automatically if live logging is enabled",
"if",
"self",
".",
"_config",
".",
"getini",
"(",
"'log_cli'",
")",
"and",
"not",
"config",
".",
"... | [
341,
4
] | [
374,
35
] | python | en | ['en', 'en', 'en'] | True |
LoggingPlugin._runtest_for | (self, item, when) | Implements the internals of pytest_runtest_xxx() hook. | Implements the internals of pytest_runtest_xxx() hook. | def _runtest_for(self, item, when):
"""Implements the internals of pytest_runtest_xxx() hook."""
with catching_logs(LogCaptureHandler(),
formatter=self.formatter, level=self.log_level) as log_handler:
if self.log_cli_handler:
self.log_cli_handler.se... | [
"def",
"_runtest_for",
"(",
"self",
",",
"item",
",",
"when",
")",
":",
"with",
"catching_logs",
"(",
"LogCaptureHandler",
"(",
")",
",",
"formatter",
"=",
"self",
".",
"formatter",
",",
"level",
"=",
"self",
".",
"log_level",
")",
"as",
"log_handler",
"... | [
377,
4
] | [
397,
57
] | python | en | ['en', 'hu', 'en'] | True |
LoggingPlugin.pytest_runtestloop | (self, session) | Runs all collected test items. | Runs all collected test items. | def pytest_runtestloop(self, session):
"""Runs all collected test items."""
self._setup_cli_logging()
with self.live_logs_context:
if self.log_file_handler is not None:
with closing(self.log_file_handler):
with catching_logs(self.log_file_handler,
... | [
"def",
"pytest_runtestloop",
"(",
"self",
",",
"session",
")",
":",
"self",
".",
"_setup_cli_logging",
"(",
")",
"with",
"self",
".",
"live_logs_context",
":",
"if",
"self",
".",
"log_file_handler",
"is",
"not",
"None",
":",
"with",
"closing",
"(",
"self",
... | [
419,
4
] | [
429,
21
] | python | en | ['en', 'en', 'en'] | True |
LoggingPlugin._setup_cli_logging | (self) | Sets up the handler and logger for the Live Logs feature, if enabled.
This must be done right before starting the loop so we can access the terminal reporter plugin.
| Sets up the handler and logger for the Live Logs feature, if enabled. | def _setup_cli_logging(self):
"""Sets up the handler and logger for the Live Logs feature, if enabled.
This must be done right before starting the loop so we can access the terminal reporter plugin.
"""
terminal_reporter = self._config.pluginmanager.get_plugin('terminalreporter')
... | [
"def",
"_setup_cli_logging",
"(",
"self",
")",
":",
"terminal_reporter",
"=",
"self",
".",
"_config",
".",
"pluginmanager",
".",
"get_plugin",
"(",
"'terminalreporter'",
")",
"if",
"self",
".",
"_config",
".",
"getini",
"(",
"'log_cli'",
")",
"and",
"terminal_... | [
431,
4
] | [
451,
61
] | python | en | ['en', 'en', 'en'] | True |
_LiveLoggingStreamHandler.__init__ | (self, terminal_reporter, capture_manager) |
:param _pytest.terminal.TerminalReporter terminal_reporter:
:param _pytest.capture.CaptureManager capture_manager:
|
:param _pytest.terminal.TerminalReporter terminal_reporter:
:param _pytest.capture.CaptureManager capture_manager:
| def __init__(self, terminal_reporter, capture_manager):
"""
:param _pytest.terminal.TerminalReporter terminal_reporter:
:param _pytest.capture.CaptureManager capture_manager:
"""
logging.StreamHandler.__init__(self, stream=terminal_reporter)
self.capture_manager = capture... | [
"def",
"__init__",
"(",
"self",
",",
"terminal_reporter",
",",
"capture_manager",
")",
":",
"logging",
".",
"StreamHandler",
".",
"__init__",
"(",
"self",
",",
"stream",
"=",
"terminal_reporter",
")",
"self",
".",
"capture_manager",
"=",
"capture_manager",
"self... | [
463,
4
] | [
471,
27
] | python | en | ['en', 'error', 'th'] | False |
_LiveLoggingStreamHandler.reset | (self) | Reset the handler; should be called before the start of each test | Reset the handler; should be called before the start of each test | def reset(self):
"""Reset the handler; should be called before the start of each test"""
self._first_record_emitted = False | [
"def",
"reset",
"(",
"self",
")",
":",
"self",
".",
"_first_record_emitted",
"=",
"False"
] | [
473,
4
] | [
475,
42
] | python | en | ['en', 'en', 'en'] | True |
_LiveLoggingStreamHandler.set_when | (self, when) | Prepares for the given test phase (setup/call/teardown) | Prepares for the given test phase (setup/call/teardown) | def set_when(self, when):
"""Prepares for the given test phase (setup/call/teardown)"""
self._when = when
self._section_name_shown = False | [
"def",
"set_when",
"(",
"self",
",",
"when",
")",
":",
"self",
".",
"_when",
"=",
"when",
"self",
".",
"_section_name_shown",
"=",
"False"
] | [
477,
4
] | [
480,
40
] | python | en | ['en', 'en', 'en'] | True |
_find_all_simple | (path) |
Find all files under 'path'
|
Find all files under 'path'
| def _find_all_simple(path):
"""
Find all files under 'path'
"""
results = (
os.path.join(base, file)
for base, dirs, files in os.walk(path, followlinks=True)
for file in files
)
return filter(os.path.isfile, results) | [
"def",
"_find_all_simple",
"(",
"path",
")",
":",
"results",
"=",
"(",
"os",
".",
"path",
".",
"join",
"(",
"base",
",",
"file",
")",
"for",
"base",
",",
"dirs",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"path",
",",
"followlinks",
"=",
"True",
... | [
245,
0
] | [
254,
42
] | python | en | ['en', 'error', 'th'] | False |
findall | (dir=os.curdir) |
Find all files under 'dir' and return the list of full filenames.
Unless dir is '.', return full filenames with dir prepended.
|
Find all files under 'dir' and return the list of full filenames.
Unless dir is '.', return full filenames with dir prepended.
| def findall(dir=os.curdir):
"""
Find all files under 'dir' and return the list of full filenames.
Unless dir is '.', return full filenames with dir prepended.
"""
files = _find_all_simple(dir)
if dir == os.curdir:
make_rel = functools.partial(os.path.relpath, start=dir)
files = m... | [
"def",
"findall",
"(",
"dir",
"=",
"os",
".",
"curdir",
")",
":",
"files",
"=",
"_find_all_simple",
"(",
"dir",
")",
"if",
"dir",
"==",
"os",
".",
"curdir",
":",
"make_rel",
"=",
"functools",
".",
"partial",
"(",
"os",
".",
"path",
".",
"relpath",
... | [
257,
0
] | [
266,
22
] | python | en | ['en', 'error', 'th'] | False |
glob_to_re | (pattern) | Translate a shell-like glob pattern to a regular expression; return
a string containing the regex. Differs from 'fnmatch.translate()' in
that '*' does not match "special characters" (which are
platform-specific).
| Translate a shell-like glob pattern to a regular expression; return
a string containing the regex. Differs from 'fnmatch.translate()' in
that '*' does not match "special characters" (which are
platform-specific).
| def glob_to_re(pattern):
"""Translate a shell-like glob pattern to a regular expression; return
a string containing the regex. Differs from 'fnmatch.translate()' in
that '*' does not match "special characters" (which are
platform-specific).
"""
pattern_re = fnmatch.translate(pattern)
# '?'... | [
"def",
"glob_to_re",
"(",
"pattern",
")",
":",
"pattern_re",
"=",
"fnmatch",
".",
"translate",
"(",
"pattern",
")",
"# '?' and '*' in the glob pattern become '.' and '.*' in the RE, which",
"# IMHO is wrong -- '?' and '*' aren't supposed to match slash in Unix,",
"# and by extension ... | [
269,
0
] | [
289,
21
] | python | en | ['en', 'haw', 'en'] | True |
translate_pattern | (pattern, anchor=1, prefix=None, is_regex=0) | Translate a shell-like wildcard pattern to a compiled regular
expression. Return the compiled regex. If 'is_regex' true,
then 'pattern' is directly compiled to a regex (if it's a string)
or just returned as-is (assumes it's a regex object).
| Translate a shell-like wildcard pattern to a compiled regular
expression. Return the compiled regex. If 'is_regex' true,
then 'pattern' is directly compiled to a regex (if it's a string)
or just returned as-is (assumes it's a regex object).
| def translate_pattern(pattern, anchor=1, prefix=None, is_regex=0):
"""Translate a shell-like wildcard pattern to a compiled regular
expression. Return the compiled regex. If 'is_regex' true,
then 'pattern' is directly compiled to a regex (if it's a string)
or just returned as-is (assumes it's a regex ... | [
"def",
"translate_pattern",
"(",
"pattern",
",",
"anchor",
"=",
"1",
",",
"prefix",
"=",
"None",
",",
"is_regex",
"=",
"0",
")",
":",
"if",
"is_regex",
":",
"if",
"isinstance",
"(",
"pattern",
",",
"str",
")",
":",
"return",
"re",
".",
"compile",
"("... | [
292,
0
] | [
326,
33
] | python | en | ['en', 'en', 'en'] | True |
FileList.debug_print | (self, msg) | Print 'msg' to stdout if the global DEBUG (taken from the
DISTUTILS_DEBUG environment variable) flag is true.
| Print 'msg' to stdout if the global DEBUG (taken from the
DISTUTILS_DEBUG environment variable) flag is true.
| def debug_print(self, msg):
"""Print 'msg' to stdout if the global DEBUG (taken from the
DISTUTILS_DEBUG environment variable) flag is true.
"""
from distutils.debug import DEBUG
if DEBUG:
print(msg) | [
"def",
"debug_print",
"(",
"self",
",",
"msg",
")",
":",
"from",
"distutils",
".",
"debug",
"import",
"DEBUG",
"if",
"DEBUG",
":",
"print",
"(",
"msg",
")"
] | [
40,
4
] | [
46,
22
] | python | en | ['en', 'en', 'en'] | True |
FileList.include_pattern | (self, pattern, anchor=1, prefix=None, is_regex=0) | Select strings (presumably filenames) from 'self.files' that
match 'pattern', a Unix-style wildcard (glob) pattern. Patterns
are not quite the same as implemented by the 'fnmatch' module: '*'
and '?' match non-special characters, where "special" is platform-
dependent: slash on Unix; c... | Select strings (presumably filenames) from 'self.files' that
match 'pattern', a Unix-style wildcard (glob) pattern. Patterns
are not quite the same as implemented by the 'fnmatch' module: '*'
and '?' match non-special characters, where "special" is platform-
dependent: slash on Unix; c... | def include_pattern(self, pattern, anchor=1, prefix=None, is_regex=0):
"""Select strings (presumably filenames) from 'self.files' that
match 'pattern', a Unix-style wildcard (glob) pattern. Patterns
are not quite the same as implemented by the 'fnmatch' module: '*'
and '?' match non-sp... | [
"def",
"include_pattern",
"(",
"self",
",",
"pattern",
",",
"anchor",
"=",
"1",
",",
"prefix",
"=",
"None",
",",
"is_regex",
"=",
"0",
")",
":",
"# XXX docstring lying about what the special chars are?",
"files_found",
"=",
"False",
"pattern_re",
"=",
"translate_p... | [
179,
4
] | [
219,
26
] | python | en | ['en', 'en', 'en'] | True |
FileList.exclude_pattern | (self, pattern,
anchor=1, prefix=None, is_regex=0) | Remove strings (presumably filenames) from 'files' that match
'pattern'. Other parameters are the same as for
'include_pattern()', above.
The list 'self.files' is modified in place.
Return True if files are found, False otherwise.
| Remove strings (presumably filenames) from 'files' that match
'pattern'. Other parameters are the same as for
'include_pattern()', above.
The list 'self.files' is modified in place.
Return True if files are found, False otherwise.
| def exclude_pattern (self, pattern,
anchor=1, prefix=None, is_regex=0):
"""Remove strings (presumably filenames) from 'files' that match
'pattern'. Other parameters are the same as for
'include_pattern()', above.
The list 'self.files' is modified in place.
... | [
"def",
"exclude_pattern",
"(",
"self",
",",
"pattern",
",",
"anchor",
"=",
"1",
",",
"prefix",
"=",
"None",
",",
"is_regex",
"=",
"0",
")",
":",
"files_found",
"=",
"False",
"pattern_re",
"=",
"translate_pattern",
"(",
"pattern",
",",
"anchor",
",",
"pre... | [
222,
4
] | [
239,
26
] | python | en | ['en', 'en', 'en'] | True |
translate_pattern | (glob) |
Translate a file path glob like '*.txt' in to a regular expression.
This differs from fnmatch.translate which allows wildcards to match
directory separators. It also knows about '**/' which matches any number of
directories.
|
Translate a file path glob like '*.txt' in to a regular expression.
This differs from fnmatch.translate which allows wildcards to match
directory separators. It also knows about '**/' which matches any number of
directories.
| def translate_pattern(glob):
"""
Translate a file path glob like '*.txt' in to a regular expression.
This differs from fnmatch.translate which allows wildcards to match
directory separators. It also knows about '**/' which matches any number of
directories.
"""
pat = ''
# This will spli... | [
"def",
"translate_pattern",
"(",
"glob",
")",
":",
"pat",
"=",
"''",
"# This will split on '/' within [character classes]. This is deliberate.",
"chunks",
"=",
"glob",
".",
"split",
"(",
"os",
".",
"path",
".",
"sep",
")",
"sep",
"=",
"re",
".",
"escape",
"(",
... | [
33,
0
] | [
113,
58
] | python | en | ['en', 'error', 'th'] | False |
write_file | (filename, contents) | Create a file with the specified name and write 'contents' (a
sequence of strings without line terminators) to it.
| Create a file with the specified name and write 'contents' (a
sequence of strings without line terminators) to it.
| def write_file(filename, contents):
"""Create a file with the specified name and write 'contents' (a
sequence of strings without line terminators) to it.
"""
contents = "\n".join(contents)
# assuming the contents has been vetted for utf-8 encoding
contents = contents.encode("utf-8")
with o... | [
"def",
"write_file",
"(",
"filename",
",",
"contents",
")",
":",
"contents",
"=",
"\"\\n\"",
".",
"join",
"(",
"contents",
")",
"# assuming the contents has been vetted for utf-8 encoding",
"contents",
"=",
"contents",
".",
"encode",
"(",
"\"utf-8\"",
")",
"with",
... | [
594,
0
] | [
604,
25
] | python | en | ['en', 'en', 'en'] | True |
get_pkg_info_revision | () |
Get a -r### off of PKG-INFO Version in case this is an sdist of
a subversion revision.
|
Get a -r### off of PKG-INFO Version in case this is an sdist of
a subversion revision.
| def get_pkg_info_revision():
"""
Get a -r### off of PKG-INFO Version in case this is an sdist of
a subversion revision.
"""
warnings.warn(
"get_pkg_info_revision is deprecated.", EggInfoDeprecationWarning)
if os.path.exists('PKG-INFO'):
with io.open('PKG-INFO') as f:
... | [
"def",
"get_pkg_info_revision",
"(",
")",
":",
"warnings",
".",
"warn",
"(",
"\"get_pkg_info_revision is deprecated.\"",
",",
"EggInfoDeprecationWarning",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"'PKG-INFO'",
")",
":",
"with",
"io",
".",
"open",
"(",
... | [
699,
0
] | [
712,
12
] | python | en | ['en', 'error', 'th'] | False |
egg_info.save_version_info | (self, filename) |
Materialize the value of date into the
build tag. Install build keys in a deterministic order
to avoid arbitrary reordering on subsequent builds.
|
Materialize the value of date into the
build tag. Install build keys in a deterministic order
to avoid arbitrary reordering on subsequent builds.
| def save_version_info(self, filename):
"""
Materialize the value of date into the
build tag. Install build keys in a deterministic order
to avoid arbitrary reordering on subsequent builds.
"""
egg_info = collections.OrderedDict()
# follow the order these keys woul... | [
"def",
"save_version_info",
"(",
"self",
",",
"filename",
")",
":",
"egg_info",
"=",
"collections",
".",
"OrderedDict",
"(",
")",
"# follow the order these keys would have been added",
"# when PYTHONHASHSEED=0",
"egg_info",
"[",
"'tag_build'",
"]",
"=",
"self",
".",
"... | [
177,
4
] | [
188,
54
] | python | en | ['en', 'error', 'th'] | False |
egg_info.write_or_delete_file | (self, what, filename, data, force=False) | Write `data` to `filename` or delete if empty
If `data` is non-empty, this routine is the same as ``write_file()``.
If `data` is empty but not ``None``, this is the same as calling
``delete_file(filename)`. If `data` is ``None``, then this is a no-op
unless `filename` exists, in which ... | Write `data` to `filename` or delete if empty | def write_or_delete_file(self, what, filename, data, force=False):
"""Write `data` to `filename` or delete if empty
If `data` is non-empty, this routine is the same as ``write_file()``.
If `data` is empty but not ``None``, this is the same as calling
``delete_file(filename)`. If `data`... | [
"def",
"write_or_delete_file",
"(",
"self",
",",
"what",
",",
"filename",
",",
"data",
",",
"force",
"=",
"False",
")",
":",
"if",
"data",
":",
"self",
".",
"write_file",
"(",
"what",
",",
"filename",
",",
"data",
")",
"elif",
"os",
".",
"path",
".",... | [
239,
4
] | [
257,
42
] | python | en | ['en', 'el-Latn', 'en'] | True |
egg_info.write_file | (self, what, filename, data) | Write `data` to `filename` (if not a dry run) after announcing it
`what` is used in a log message to identify what is being written
to the file.
| Write `data` to `filename` (if not a dry run) after announcing it | def write_file(self, what, filename, data):
"""Write `data` to `filename` (if not a dry run) after announcing it
`what` is used in a log message to identify what is being written
to the file.
"""
log.info("writing %s to %s", what, filename)
data = data.encode("utf-8")
... | [
"def",
"write_file",
"(",
"self",
",",
"what",
",",
"filename",
",",
"data",
")",
":",
"log",
".",
"info",
"(",
"\"writing %s to %s\"",
",",
"what",
",",
"filename",
")",
"data",
"=",
"data",
".",
"encode",
"(",
"\"utf-8\"",
")",
"if",
"not",
"self",
... | [
259,
4
] | [
270,
21
] | python | en | ['en', 'en', 'en'] | True |
egg_info.delete_file | (self, filename) | Delete `filename` (if not a dry run) after announcing it | Delete `filename` (if not a dry run) after announcing it | def delete_file(self, filename):
"""Delete `filename` (if not a dry run) after announcing it"""
log.info("deleting %s", filename)
if not self.dry_run:
os.unlink(filename) | [
"def",
"delete_file",
"(",
"self",
",",
"filename",
")",
":",
"log",
".",
"info",
"(",
"\"deleting %s\"",
",",
"filename",
")",
"if",
"not",
"self",
".",
"dry_run",
":",
"os",
".",
"unlink",
"(",
"filename",
")"
] | [
272,
4
] | [
276,
31
] | python | en | ['en', 'en', 'en'] | True |
egg_info.find_sources | (self) | Generate SOURCES.txt manifest file | Generate SOURCES.txt manifest file | def find_sources(self):
"""Generate SOURCES.txt manifest file"""
manifest_filename = os.path.join(self.egg_info, "SOURCES.txt")
mm = manifest_maker(self.distribution)
mm.manifest = manifest_filename
mm.run()
self.filelist = mm.filelist | [
"def",
"find_sources",
"(",
"self",
")",
":",
"manifest_filename",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"egg_info",
",",
"\"SOURCES.txt\"",
")",
"mm",
"=",
"manifest_maker",
"(",
"self",
".",
"distribution",
")",
"mm",
".",
"manifest",
... | [
294,
4
] | [
300,
35
] | python | en | ['en', 'en', 'it'] | True |
FileList._remove_files | (self, predicate) |
Remove all files from the file list that match the predicate.
Return True if any matching files were removed
|
Remove all files from the file list that match the predicate.
Return True if any matching files were removed
| def _remove_files(self, predicate):
"""
Remove all files from the file list that match the predicate.
Return True if any matching files were removed
"""
found = False
for i in range(len(self.files) - 1, -1, -1):
if predicate(self.files[i]):
sel... | [
"def",
"_remove_files",
"(",
"self",
",",
"predicate",
")",
":",
"found",
"=",
"False",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"files",
")",
"-",
"1",
",",
"-",
"1",
",",
"-",
"1",
")",
":",
"if",
"predicate",
"(",
"self",
"."... | [
394,
4
] | [
405,
20
] | python | en | ['en', 'error', 'th'] | False |
FileList.include | (self, pattern) | Include files that match 'pattern'. | Include files that match 'pattern'. | def include(self, pattern):
"""Include files that match 'pattern'."""
found = [f for f in glob(pattern) if not os.path.isdir(f)]
self.extend(found)
return bool(found) | [
"def",
"include",
"(",
"self",
",",
"pattern",
")",
":",
"found",
"=",
"[",
"f",
"for",
"f",
"in",
"glob",
"(",
"pattern",
")",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"f",
")",
"]",
"self",
".",
"extend",
"(",
"found",
")",
"return"... | [
407,
4
] | [
411,
26
] | python | en | ['en', 'en', 'en'] | True |
FileList.exclude | (self, pattern) | Exclude files that match 'pattern'. | Exclude files that match 'pattern'. | def exclude(self, pattern):
"""Exclude files that match 'pattern'."""
match = translate_pattern(pattern)
return self._remove_files(match.match) | [
"def",
"exclude",
"(",
"self",
",",
"pattern",
")",
":",
"match",
"=",
"translate_pattern",
"(",
"pattern",
")",
"return",
"self",
".",
"_remove_files",
"(",
"match",
".",
"match",
")"
] | [
413,
4
] | [
416,
46
] | python | en | ['en', 'en', 'en'] | True |
FileList.recursive_include | (self, dir, pattern) |
Include all files anywhere in 'dir/' that match the pattern.
|
Include all files anywhere in 'dir/' that match the pattern.
| def recursive_include(self, dir, pattern):
"""
Include all files anywhere in 'dir/' that match the pattern.
"""
full_pattern = os.path.join(dir, '**', pattern)
found = [f for f in glob(full_pattern, recursive=True)
if not os.path.isdir(f)]
self.extend(fou... | [
"def",
"recursive_include",
"(",
"self",
",",
"dir",
",",
"pattern",
")",
":",
"full_pattern",
"=",
"os",
".",
"path",
".",
"join",
"(",
"dir",
",",
"'**'",
",",
"pattern",
")",
"found",
"=",
"[",
"f",
"for",
"f",
"in",
"glob",
"(",
"full_pattern",
... | [
418,
4
] | [
426,
26
] | python | en | ['en', 'error', 'th'] | False |
FileList.recursive_exclude | (self, dir, pattern) |
Exclude any file anywhere in 'dir/' that match the pattern.
|
Exclude any file anywhere in 'dir/' that match the pattern.
| def recursive_exclude(self, dir, pattern):
"""
Exclude any file anywhere in 'dir/' that match the pattern.
"""
match = translate_pattern(os.path.join(dir, '**', pattern))
return self._remove_files(match.match) | [
"def",
"recursive_exclude",
"(",
"self",
",",
"dir",
",",
"pattern",
")",
":",
"match",
"=",
"translate_pattern",
"(",
"os",
".",
"path",
".",
"join",
"(",
"dir",
",",
"'**'",
",",
"pattern",
")",
")",
"return",
"self",
".",
"_remove_files",
"(",
"matc... | [
428,
4
] | [
433,
46
] | python | en | ['en', 'error', 'th'] | False |
FileList.graft | (self, dir) | Include all files from 'dir/'. | Include all files from 'dir/'. | def graft(self, dir):
"""Include all files from 'dir/'."""
found = [
item
for match_dir in glob(dir)
for item in distutils.filelist.findall(match_dir)
]
self.extend(found)
return bool(found) | [
"def",
"graft",
"(",
"self",
",",
"dir",
")",
":",
"found",
"=",
"[",
"item",
"for",
"match_dir",
"in",
"glob",
"(",
"dir",
")",
"for",
"item",
"in",
"distutils",
".",
"filelist",
".",
"findall",
"(",
"match_dir",
")",
"]",
"self",
".",
"extend",
"... | [
435,
4
] | [
443,
26
] | python | en | ['en', 'en', 'en'] | True |
FileList.prune | (self, dir) | Filter out files from 'dir/'. | Filter out files from 'dir/'. | def prune(self, dir):
"""Filter out files from 'dir/'."""
match = translate_pattern(os.path.join(dir, '**'))
return self._remove_files(match.match) | [
"def",
"prune",
"(",
"self",
",",
"dir",
")",
":",
"match",
"=",
"translate_pattern",
"(",
"os",
".",
"path",
".",
"join",
"(",
"dir",
",",
"'**'",
")",
")",
"return",
"self",
".",
"_remove_files",
"(",
"match",
".",
"match",
")"
] | [
445,
4
] | [
448,
46
] | python | en | ['en', 'en', 'en'] | True |
FileList.global_include | (self, pattern) |
Include all files anywhere in the current directory that match the
pattern. This is very inefficient on large file trees.
|
Include all files anywhere in the current directory that match the
pattern. This is very inefficient on large file trees.
| def global_include(self, pattern):
"""
Include all files anywhere in the current directory that match the
pattern. This is very inefficient on large file trees.
"""
if self.allfiles is None:
self.findall()
match = translate_pattern(os.path.join('**', pattern))... | [
"def",
"global_include",
"(",
"self",
",",
"pattern",
")",
":",
"if",
"self",
".",
"allfiles",
"is",
"None",
":",
"self",
".",
"findall",
"(",
")",
"match",
"=",
"translate_pattern",
"(",
"os",
".",
"path",
".",
"join",
"(",
"'**'",
",",
"pattern",
"... | [
450,
4
] | [
460,
26
] | python | en | ['en', 'error', 'th'] | False |
FileList.global_exclude | (self, pattern) |
Exclude all files anywhere that match the pattern.
|
Exclude all files anywhere that match the pattern.
| def global_exclude(self, pattern):
"""
Exclude all files anywhere that match the pattern.
"""
match = translate_pattern(os.path.join('**', pattern))
return self._remove_files(match.match) | [
"def",
"global_exclude",
"(",
"self",
",",
"pattern",
")",
":",
"match",
"=",
"translate_pattern",
"(",
"os",
".",
"path",
".",
"join",
"(",
"'**'",
",",
"pattern",
")",
")",
"return",
"self",
".",
"_remove_files",
"(",
"match",
".",
"match",
")"
] | [
462,
4
] | [
467,
46
] | python | en | ['en', 'error', 'th'] | False |
FileList._repair | (self) |
Replace self.files with only safe paths
Because some owners of FileList manipulate the underlying
``files`` attribute directly, this method must be called to
repair those paths.
|
Replace self.files with only safe paths | def _repair(self):
"""
Replace self.files with only safe paths
Because some owners of FileList manipulate the underlying
``files`` attribute directly, this method must be called to
repair those paths.
"""
self.files = list(filter(self._safe_path, self.files)) | [
"def",
"_repair",
"(",
"self",
")",
":",
"self",
".",
"files",
"=",
"list",
"(",
"filter",
"(",
"self",
".",
"_safe_path",
",",
"self",
".",
"files",
")",
")"
] | [
480,
4
] | [
488,
62
] | python | en | ['en', 'error', 'th'] | False |
manifest_maker.write_manifest | (self) |
Write the file list in 'self.filelist' to the manifest file
named by 'self.manifest'.
|
Write the file list in 'self.filelist' to the manifest file
named by 'self.manifest'.
| def write_manifest(self):
"""
Write the file list in 'self.filelist' to the manifest file
named by 'self.manifest'.
"""
self.filelist._repair()
# Now _repairs should encodability, but not unicode
files = [self._manifest_normalize(f) for f in self.filelist.files]
... | [
"def",
"write_manifest",
"(",
"self",
")",
":",
"self",
".",
"filelist",
".",
"_repair",
"(",
")",
"# Now _repairs should encodability, but not unicode",
"files",
"=",
"[",
"self",
".",
"_manifest_normalize",
"(",
"f",
")",
"for",
"f",
"in",
"self",
".",
"file... | [
542,
4
] | [
552,
61
] | python | en | ['en', 'error', 'th'] | False |
manifest_maker._should_suppress_warning | (msg) |
suppress missing-file warnings from sdist
|
suppress missing-file warnings from sdist
| def _should_suppress_warning(msg):
"""
suppress missing-file warnings from sdist
"""
return re.match(r"standard file .*not found", msg) | [
"def",
"_should_suppress_warning",
"(",
"msg",
")",
":",
"return",
"re",
".",
"match",
"(",
"r\"standard file .*not found\"",
",",
"msg",
")"
] | [
559,
4
] | [
563,
58
] | python | en | ['en', 'error', 'th'] | False |
Row.load_cells | (self, datum=None) | Load the row's data and initialize all the cells in the row.
It also set the appropriate row properties which require
the row's data to be determined.
The row's data is provided either at initialization or as an
argument to this function.
This function is called automatically ... | Load the row's data and initialize all the cells in the row. | def load_cells(self, datum=None):
"""Load the row's data and initialize all the cells in the row.
It also set the appropriate row properties which require
the row's data to be determined.
The row's data is provided either at initialization or as an
argument to this function.
... | [
"def",
"load_cells",
"(",
"self",
",",
"datum",
"=",
"None",
")",
":",
"# Compile all the cells on instantiation.",
"table",
"=",
"self",
".",
"table",
"if",
"datum",
":",
"self",
".",
"datum",
"=",
"datum",
"else",
":",
"datum",
"=",
"self",
".",
"datum",... | [
611,
4
] | [
661,
69
] | python | en | ['en', 'en', 'en'] | True |
Row.get_cells | (self) | Returns the bound cells for this row in order. | Returns the bound cells for this row in order. | def get_cells(self):
"""Returns the bound cells for this row in order."""
return list(self.cells.values()) | [
"def",
"get_cells",
"(",
"self",
")",
":",
"return",
"list",
"(",
"self",
".",
"cells",
".",
"values",
"(",
")",
")"
] | [
689,
4
] | [
691,
40
] | python | en | ['en', 'en', 'en'] | True |
Row.can_be_selected | (self, datum) | Determines whether the row can be selected.
By default if multiselect enabled return True.
You can remove the checkbox after an ajax update here if required.
| Determines whether the row can be selected. | def can_be_selected(self, datum):
"""Determines whether the row can be selected.
By default if multiselect enabled return True.
You can remove the checkbox after an ajax update here if required.
"""
return True | [
"def",
"can_be_selected",
"(",
"self",
",",
"datum",
")",
":",
"return",
"True"
] | [
710,
4
] | [
716,
19
] | python | en | ['en', 'en', 'en'] | True |
Row.get_data | (self, request, obj_id) | Fetches the updated data for the row based on the given object ID.
Must be implemented by a subclass to allow AJAX updating.
| Fetches the updated data for the row based on the given object ID. | def get_data(self, request, obj_id):
"""Fetches the updated data for the row based on the given object ID.
Must be implemented by a subclass to allow AJAX updating.
"""
return {} | [
"def",
"get_data",
"(",
"self",
",",
"request",
",",
"obj_id",
")",
":",
"return",
"{",
"}"
] | [
718,
4
] | [
723,
17
] | python | en | ['en', 'en', 'en'] | True |
Cell.get_data | (self, datum, column, row) | Fetches the data to be displayed in this cell. | Fetches the data to be displayed in this cell. | def get_data(self, datum, column, row):
"""Fetches the data to be displayed in this cell."""
table = row.table
if column.auto == "multi_select":
data = ""
if row.can_be_selected(datum):
widget = ThemableCheckboxInput(check_test=lambda value: False)
... | [
"def",
"get_data",
"(",
"self",
",",
"datum",
",",
"column",
",",
"row",
")",
":",
"table",
"=",
"row",
".",
"table",
"if",
"column",
".",
"auto",
"==",
"\"multi_select\"",
":",
"data",
"=",
"\"\"",
"if",
"row",
".",
"can_be_selected",
"(",
"datum",
... | [
759,
4
] | [
805,
19
] | python | en | ['en', 'en', 'en'] | True |
Cell.value | (self) | Returns a formatted version of the data for final output.
This takes into consideration the
:attr:`~horizon.tables.Column.link`` and
:attr:`~horizon.tables.Column.empty_value`
attributes.
| Returns a formatted version of the data for final output. | def value(self):
"""Returns a formatted version of the data for final output.
This takes into consideration the
:attr:`~horizon.tables.Column.link`` and
:attr:`~horizon.tables.Column.empty_value`
attributes.
"""
try:
data = self.column.get_data(self.d... | [
"def",
"value",
"(",
"self",
")",
":",
"try",
":",
"data",
"=",
"self",
".",
"column",
".",
"get_data",
"(",
"self",
".",
"datum",
")",
"if",
"data",
"is",
"None",
":",
"if",
"callable",
"(",
"self",
".",
"column",
".",
"empty_value",
")",
":",
"... | [
818,
4
] | [
847,
19
] | python | en | ['en', 'en', 'en'] | True |
Cell.status | (self) | Gets the status for the column based on the cell's data. | Gets the status for the column based on the cell's data. | def status(self):
"""Gets the status for the column based on the cell's data."""
# Deal with status column mechanics based in this cell's data
if hasattr(self, '_status'):
# pylint: disable=access-member-before-definition
return self._status
if self.column.status... | [
"def",
"status",
"(",
"self",
")",
":",
"# Deal with status column mechanics based in this cell's data",
"if",
"hasattr",
"(",
"self",
",",
"'_status'",
")",
":",
"# pylint: disable=access-member-before-definition",
"return",
"self",
".",
"_status",
"if",
"self",
".",
"... | [
859,
4
] | [
876,
27
] | python | en | ['en', 'en', 'en'] | True |
Cell.get_status_class | (self, status) | Returns a css class name determined by the status value. | Returns a css class name determined by the status value. | def get_status_class(self, status):
"""Returns a css class name determined by the status value."""
if status is True:
return "status_up"
elif status is False:
return "status_down"
else:
return "warning" | [
"def",
"get_status_class",
"(",
"self",
",",
"status",
")",
":",
"if",
"status",
"is",
"True",
":",
"return",
"\"status_up\"",
"elif",
"status",
"is",
"False",
":",
"return",
"\"status_down\"",
"else",
":",
"return",
"\"warning\""
] | [
878,
4
] | [
885,
28
] | python | en | ['en', 'en', 'en'] | True |
Cell.get_default_classes | (self) | Returns a flattened string of the cell's CSS classes. | Returns a flattened string of the cell's CSS classes. | def get_default_classes(self):
"""Returns a flattened string of the cell's CSS classes."""
if not self.url:
self.column.classes = [cls for cls in self.column.classes
if cls != "anchor"]
column_class_string = self.column.get_final_attrs().get('class'... | [
"def",
"get_default_classes",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"url",
":",
"self",
".",
"column",
".",
"classes",
"=",
"[",
"cls",
"for",
"cls",
"in",
"self",
".",
"column",
".",
"classes",
"if",
"cls",
"!=",
"\"anchor\"",
"]",
"colum... | [
887,
4
] | [
900,
28
] | python | en | ['en', 'en', 'en'] | True |
Cell.update_allowed | (self) | Determines whether update of given cell is allowed.
Calls allowed action of defined UpdateAction of the Column.
| Determines whether update of given cell is allowed. | def update_allowed(self):
"""Determines whether update of given cell is allowed.
Calls allowed action of defined UpdateAction of the Column.
"""
return self.update_action.allowed(self.column.table.request,
self.datum,
... | [
"def",
"update_allowed",
"(",
"self",
")",
":",
"return",
"self",
".",
"update_action",
".",
"allowed",
"(",
"self",
".",
"column",
".",
"table",
".",
"request",
",",
"self",
".",
"datum",
",",
"self",
")"
] | [
915,
4
] | [
922,
47
] | python | en | ['en', 'en', 'en'] | True |
_check_dist_requires_python | (
dist, # type: pkg_resources.Distribution
version_info, # type: Tuple[int, int, int]
ignore_requires_python=False, # type: bool
) |
Check whether the given Python version is compatible with a distribution's
"Requires-Python" value.
:param version_info: A 3-tuple of ints representing the Python
major-minor-micro version to check.
:param ignore_requires_python: Whether to ignore the "Requires-Python"
value if the giv... |
Check whether the given Python version is compatible with a distribution's
"Requires-Python" value. | def _check_dist_requires_python(
dist, # type: pkg_resources.Distribution
version_info, # type: Tuple[int, int, int]
ignore_requires_python=False, # type: bool
):
# type: (...) -> None
"""
Check whether the given Python version is compatible with a distribution's
"Requires-Python" value.
... | [
"def",
"_check_dist_requires_python",
"(",
"dist",
",",
"# type: pkg_resources.Distribution",
"version_info",
",",
"# type: Tuple[int, int, int]",
"ignore_requires_python",
"=",
"False",
",",
"# type: bool",
")",
":",
"# type: (...) -> None",
"requires_python",
"=",
"get_requir... | [
59,
0
] | [
104,
10
] | python | en | ['en', 'error', 'th'] | False |
Resolver.resolve | (self, root_reqs, check_supported_wheels) | Resolve what operations need to be done
As a side-effect of this method, the packages (and their dependencies)
are downloaded, unpacked and prepared for installation. This
preparation is done by ``pip.operations.prepare``.
Once PyPI has static dependency metadata available, it would be... | Resolve what operations need to be done | def resolve(self, root_reqs, check_supported_wheels):
# type: (List[InstallRequirement], bool) -> RequirementSet
"""Resolve what operations need to be done
As a side-effect of this method, the packages (and their dependencies)
are downloaded, unpacked and prepared for installation. This... | [
"def",
"resolve",
"(",
"self",
",",
"root_reqs",
",",
"check_supported_wheels",
")",
":",
"# type: (List[InstallRequirement], bool) -> RequirementSet",
"requirement_set",
"=",
"RequirementSet",
"(",
"check_supported_wheels",
"=",
"check_supported_wheels",
")",
"for",
"req",
... | [
154,
4
] | [
190,
30
] | python | en | ['en', 'en', 'en'] | True |
Resolver._set_req_to_reinstall | (self, req) |
Set a requirement to be installed.
|
Set a requirement to be installed.
| def _set_req_to_reinstall(self, req):
# type: (InstallRequirement) -> None
"""
Set a requirement to be installed.
"""
# Don't uninstall the conflict if doing a user install and the
# conflict is not a user install.
if not self.use_user_site or dist_in_usersite(req... | [
"def",
"_set_req_to_reinstall",
"(",
"self",
",",
"req",
")",
":",
"# type: (InstallRequirement) -> None",
"# Don't uninstall the conflict if doing a user install and the",
"# conflict is not a user install.",
"if",
"not",
"self",
".",
"use_user_site",
"or",
"dist_in_usersite",
"... | [
202,
4
] | [
211,
31
] | python | en | ['en', 'error', 'th'] | False |
Resolver._check_skip_installed | (self, req_to_install) | Check if req_to_install should be skipped.
This will check if the req is installed, and whether we should upgrade
or reinstall it, taking into account all the relevant user options.
After calling this req_to_install will only have satisfied_by set to
None if the req_to_install is to be... | Check if req_to_install should be skipped. | def _check_skip_installed(self, req_to_install):
# type: (InstallRequirement) -> Optional[str]
"""Check if req_to_install should be skipped.
This will check if the req is installed, and whether we should upgrade
or reinstall it, taking into account all the relevant user options.
... | [
"def",
"_check_skip_installed",
"(",
"self",
",",
"req_to_install",
")",
":",
"# type: (InstallRequirement) -> Optional[str]",
"if",
"self",
".",
"ignore_installed",
":",
"return",
"None",
"req_to_install",
".",
"check_if_exists",
"(",
"self",
".",
"use_user_site",
")",... | [
213,
4
] | [
264,
19
] | python | en | ['en', 'en', 'en'] | True |
Resolver._populate_link | (self, req) | Ensure that if a link can be found for this, that it is found.
Note that req.link may still be None - if the requirement is already
installed and not needed to be upgraded based on the return value of
_is_upgrade_allowed().
If preparer.require_hashes is True, don't use the wheel cache,... | Ensure that if a link can be found for this, that it is found. | def _populate_link(self, req):
# type: (InstallRequirement) -> None
"""Ensure that if a link can be found for this, that it is found.
Note that req.link may still be None - if the requirement is already
installed and not needed to be upgraded based on the return value of
_is_upg... | [
"def",
"_populate_link",
"(",
"self",
",",
"req",
")",
":",
"# type: (InstallRequirement) -> None",
"if",
"req",
".",
"link",
"is",
"None",
":",
"req",
".",
"link",
"=",
"self",
".",
"_find_requirement_link",
"(",
"req",
")",
"if",
"self",
".",
"wheel_cache"... | [
289,
4
] | [
317,
39
] | python | en | ['en', 'en', 'en'] | True |
Resolver._get_abstract_dist_for | (self, req) | Takes a InstallRequirement and returns a single AbstractDist \
representing a prepared variant of the same.
| Takes a InstallRequirement and returns a single AbstractDist \
representing a prepared variant of the same.
| def _get_abstract_dist_for(self, req):
# type: (InstallRequirement) -> AbstractDistribution
"""Takes a InstallRequirement and returns a single AbstractDist \
representing a prepared variant of the same.
"""
if req.editable:
return self.preparer.prepare_editable_requir... | [
"def",
"_get_abstract_dist_for",
"(",
"self",
",",
"req",
")",
":",
"# type: (InstallRequirement) -> AbstractDistribution",
"if",
"req",
".",
"editable",
":",
"return",
"self",
".",
"preparer",
".",
"prepare_editable_requirement",
"(",
"req",
")",
"# satisfied_by is onl... | [
319,
4
] | [
367,
28
] | python | en | ['en', 'en', 'en'] | True |
Resolver._resolve_one | (
self,
requirement_set, # type: RequirementSet
req_to_install, # type: InstallRequirement
) | Prepare a single requirements file.
:return: A list of additional InstallRequirements to also install.
| Prepare a single requirements file. | def _resolve_one(
self,
requirement_set, # type: RequirementSet
req_to_install, # type: InstallRequirement
):
# type: (...) -> List[InstallRequirement]
"""Prepare a single requirements file.
:return: A list of additional InstallRequirements to also install.
... | [
"def",
"_resolve_one",
"(",
"self",
",",
"requirement_set",
",",
"# type: RequirementSet",
"req_to_install",
",",
"# type: InstallRequirement",
")",
":",
"# type: (...) -> List[InstallRequirement]",
"# Tell user what we are doing for this requirement:",
"# obtain (editable), skipping, ... | [
369,
4
] | [
456,
24
] | python | en | ['en', 'it', 'en'] | True |
Resolver.get_installation_order | (self, req_set) | Create the installation order.
The installation order is topological - requirements are installed
before the requiring thing. We break cycles at an arbitrary point,
and make no other guarantees.
| Create the installation order. | def get_installation_order(self, req_set):
# type: (RequirementSet) -> List[InstallRequirement]
"""Create the installation order.
The installation order is topological - requirements are installed
before the requiring thing. We break cycles at an arbitrary point,
and make no oth... | [
"def",
"get_installation_order",
"(",
"self",
",",
"req_set",
")",
":",
"# type: (RequirementSet) -> List[InstallRequirement]",
"# The current implementation, which we may change at any point",
"# installs the user specified things in the order given, except when",
"# dependencies must come ea... | [
458,
4
] | [
484,
20
] | python | en | ['en', 'en', 'en'] | True |
generate_key | (key_length=64) | Secret key generator.
The quality of randomness depends on operating system support,
see http://docs.python.org/library/random.html#random.SystemRandom.
| Secret key generator. | def generate_key(key_length=64):
"""Secret key generator.
The quality of randomness depends on operating system support,
see http://docs.python.org/library/random.html#random.SystemRandom.
"""
if hasattr(random, 'SystemRandom'):
logging.info('Generating a secure random key using SystemRando... | [
"def",
"generate_key",
"(",
"key_length",
"=",
"64",
")",
":",
"if",
"hasattr",
"(",
"random",
",",
"'SystemRandom'",
")",
":",
"logging",
".",
"info",
"(",
"'Generating a secure random key using SystemRandom.'",
")",
"choice",
"=",
"random",
".",
"SystemRandom",
... | [
27,
0
] | [
42,
38
] | python | da | ['da', 'fy', 'en'] | False |
generate_or_read_from_file | (key_file='.secret_key', key_length=64) | Multiprocess-safe secret key file generator.
Useful to replace the default (and thus unsafe) SECRET_KEY in settings.py
upon first start. Save to use, i.e. when multiple Python interpreters
serve the dashboard Django application (e.g. in a mod_wsgi + daemonized
environment). Also checks if file permiss... | Multiprocess-safe secret key file generator. | def generate_or_read_from_file(key_file='.secret_key', key_length=64):
"""Multiprocess-safe secret key file generator.
Useful to replace the default (and thus unsafe) SECRET_KEY in settings.py
upon first start. Save to use, i.e. when multiple Python interpreters
serve the dashboard Django application (... | [
"def",
"generate_or_read_from_file",
"(",
"key_file",
"=",
"'.secret_key'",
",",
"key_length",
"=",
"64",
")",
":",
"abspath",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"key_file",
")",
"# check, if key_file already exists",
"# if yes, then just read and return key",... | [
55,
0
] | [
83,
18
] | python | en | ['en', 'da', 'en'] | True |
run_without_errors | (func) |
Декоратор методов функции запускаемых только в случае отсутствия зарегистрированных ошибок в процессе работы
|
Декоратор методов функции запускаемых только в случае отсутствия зарегистрированных ошибок в процессе работы
| def run_without_errors(func):
"""
Декоратор методов функции запускаемых только в случае отсутствия зарегистрированных ошибок в процессе работы
"""
@wraps(func)
def wrapper(self, *args, **kwargs):
if self.result.has_not_errors:
return func(self, *args, **kwargs)
return wrapp... | [
"def",
"run_without_errors",
"(",
"func",
")",
":",
"@",
"wraps",
"(",
"func",
")",
"def",
"wrapper",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"result",
".",
"has_not_errors",
":",
"return",
"func",
"(",
... | [
5,
0
] | [
15,
18
] | python | en | ['en', 'error', 'th'] | False |
Manifest.__init__ | (self, base=None) |
Initialise an instance.
:param base: The base directory to explore under.
|
Initialise an instance. | def __init__(self, base=None):
"""
Initialise an instance.
:param base: The base directory to explore under.
"""
self.base = os.path.abspath(os.path.normpath(base or os.getcwd()))
self.prefix = self.base + os.sep
self.allfiles = None
self.files = set() | [
"def",
"__init__",
"(",
"self",
",",
"base",
"=",
"None",
")",
":",
"self",
".",
"base",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"normpath",
"(",
"base",
"or",
"os",
".",
"getcwd",
"(",
")",
")",
")",
"self",
".",
... | [
41,
4
] | [
50,
26
] | python | en | ['en', 'error', 'th'] | False |
Manifest.findall | (self) | Find all files under the base and set ``allfiles`` to the absolute
pathnames of files found.
| Find all files under the base and set ``allfiles`` to the absolute
pathnames of files found.
| def findall(self):
"""Find all files under the base and set ``allfiles`` to the absolute
pathnames of files found.
"""
from stat import S_ISREG, S_ISDIR, S_ISLNK
self.allfiles = allfiles = []
root = self.base
stack = [root]
pop = stack.pop
push = ... | [
"def",
"findall",
"(",
"self",
")",
":",
"from",
"stat",
"import",
"S_ISREG",
",",
"S_ISDIR",
",",
"S_ISLNK",
"self",
".",
"allfiles",
"=",
"allfiles",
"=",
"[",
"]",
"root",
"=",
"self",
".",
"base",
"stack",
"=",
"[",
"root",
"]",
"pop",
"=",
"st... | [
56,
4
] | [
81,
34
] | python | en | ['en', 'en', 'en'] | True |
Manifest.add | (self, item) |
Add a file to the manifest.
:param item: The pathname to add. This can be relative to the base.
|
Add a file to the manifest. | def add(self, item):
"""
Add a file to the manifest.
:param item: The pathname to add. This can be relative to the base.
"""
if not item.startswith(self.prefix):
item = os.path.join(self.base, item)
self.files.add(os.path.normpath(item)) | [
"def",
"add",
"(",
"self",
",",
"item",
")",
":",
"if",
"not",
"item",
".",
"startswith",
"(",
"self",
".",
"prefix",
")",
":",
"item",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"base",
",",
"item",
")",
"self",
".",
"files",
".",
... | [
83,
4
] | [
91,
46
] | python | en | ['en', 'error', 'th'] | False |
Manifest.add_many | (self, items) |
Add a list of files to the manifest.
:param items: The pathnames to add. These can be relative to the base.
|
Add a list of files to the manifest. | def add_many(self, items):
"""
Add a list of files to the manifest.
:param items: The pathnames to add. These can be relative to the base.
"""
for item in items:
self.add(item) | [
"def",
"add_many",
"(",
"self",
",",
"items",
")",
":",
"for",
"item",
"in",
"items",
":",
"self",
".",
"add",
"(",
"item",
")"
] | [
93,
4
] | [
100,
26
] | python | en | ['en', 'error', 'th'] | False |
Manifest.sorted | (self, wantdirs=False) |
Return sorted files in directory order
|
Return sorted files in directory order
| def sorted(self, wantdirs=False):
"""
Return sorted files in directory order
"""
def add_dir(dirs, d):
dirs.add(d)
logger.debug('add_dir added %s', d)
if d != self.base:
parent, _ = os.path.split(d)
assert parent not in... | [
"def",
"sorted",
"(",
"self",
",",
"wantdirs",
"=",
"False",
")",
":",
"def",
"add_dir",
"(",
"dirs",
",",
"d",
")",
":",
"dirs",
".",
"add",
"(",
"d",
")",
"logger",
".",
"debug",
"(",
"'add_dir added %s'",
",",
"d",
")",
"if",
"d",
"!=",
"self"... | [
102,
4
] | [
122,
63
] | python | en | ['en', 'error', 'th'] | False |
Manifest.clear | (self) | Clear all collected files. | Clear all collected files. | def clear(self):
"""Clear all collected files."""
self.files = set()
self.allfiles = [] | [
"def",
"clear",
"(",
"self",
")",
":",
"self",
".",
"files",
"=",
"set",
"(",
")",
"self",
".",
"allfiles",
"=",
"[",
"]"
] | [
124,
4
] | [
127,
26
] | python | en | ['en', 'en', 'en'] | True |
Manifest.process_directive | (self, directive) |
Process a directive which either adds some files from ``allfiles`` to
``files``, or removes some files from ``files``.
:param directive: The directive to process. This should be in a format
compatible with distutils ``MANIFEST.in`` files:
http://docs.... |
Process a directive which either adds some files from ``allfiles`` to
``files``, or removes some files from ``files``. | def process_directive(self, directive):
"""
Process a directive which either adds some files from ``allfiles`` to
``files``, or removes some files from ``files``.
:param directive: The directive to process. This should be in a format
compatible with distutils ``MANI... | [
"def",
"process_directive",
"(",
"self",
",",
"directive",
")",
":",
"# Parse the line: split it up, make sure the right number of words",
"# is there, and return the relevant words. 'action' is always",
"# defined: it's the first word of the line. Which of the other",
"# three are defined d... | [
129,
4
] | [
202,
45
] | python | en | ['en', 'error', 'th'] | False |
Manifest._parse_directive | (self, directive) |
Validate a directive.
:param directive: The directive to validate.
:return: A tuple of action, patterns, thedir, dir_patterns
|
Validate a directive.
:param directive: The directive to validate.
:return: A tuple of action, patterns, thedir, dir_patterns
| def _parse_directive(self, directive):
"""
Validate a directive.
:param directive: The directive to validate.
:return: A tuple of action, patterns, thedir, dir_patterns
"""
words = directive.split()
if len(words) == 1 and words[0] not in ('include', 'exclude',
... | [
"def",
"_parse_directive",
"(",
"self",
",",
"directive",
")",
":",
"words",
"=",
"directive",
".",
"split",
"(",
")",
"if",
"len",
"(",
"words",
")",
"==",
"1",
"and",
"words",
"[",
"0",
"]",
"not",
"in",
"(",
"'include'",
",",
"'exclude'",
",",
"... | [
208,
4
] | [
253,
52
] | python | en | ['en', 'error', 'th'] | False |
Manifest._include_pattern | (self, pattern, anchor=True, prefix=None,
is_regex=False) | Select strings (presumably filenames) from 'self.files' that
match 'pattern', a Unix-style wildcard (glob) pattern.
Patterns are not quite the same as implemented by the 'fnmatch'
module: '*' and '?' match non-special characters, where "special"
is platform-dependent: slash on Unix; co... | Select strings (presumably filenames) from 'self.files' that
match 'pattern', a Unix-style wildcard (glob) pattern. | def _include_pattern(self, pattern, anchor=True, prefix=None,
is_regex=False):
"""Select strings (presumably filenames) from 'self.files' that
match 'pattern', a Unix-style wildcard (glob) pattern.
Patterns are not quite the same as implemented by the 'fnmatch'
... | [
"def",
"_include_pattern",
"(",
"self",
",",
"pattern",
",",
"anchor",
"=",
"True",
",",
"prefix",
"=",
"None",
",",
"is_regex",
"=",
"False",
")",
":",
"# XXX docstring lying about what the special chars are?",
"found",
"=",
"False",
"pattern_re",
"=",
"self",
... | [
255,
4
] | [
294,
20
] | python | en | ['en', 'en', 'en'] | True |
Manifest._exclude_pattern | (self, pattern, anchor=True, prefix=None,
is_regex=False) | Remove strings (presumably filenames) from 'files' that match
'pattern'.
Other parameters are the same as for 'include_pattern()', above.
The list 'self.files' is modified in place. Return True if files are
found.
This API is public to allow e.g. exclusion of SCM subdirs, e.g. ... | Remove strings (presumably filenames) from 'files' that match
'pattern'. | def _exclude_pattern(self, pattern, anchor=True, prefix=None,
is_regex=False):
"""Remove strings (presumably filenames) from 'files' that match
'pattern'.
Other parameters are the same as for 'include_pattern()', above.
The list 'self.files' is modified in place... | [
"def",
"_exclude_pattern",
"(",
"self",
",",
"pattern",
",",
"anchor",
"=",
"True",
",",
"prefix",
"=",
"None",
",",
"is_regex",
"=",
"False",
")",
":",
"found",
"=",
"False",
"pattern_re",
"=",
"self",
".",
"_translate_pattern",
"(",
"pattern",
",",
"an... | [
296,
4
] | [
314,
20
] | python | en | ['en', 'en', 'en'] | True |
Manifest._translate_pattern | (self, pattern, anchor=True, prefix=None,
is_regex=False) | Translate a shell-like wildcard pattern to a compiled regular
expression.
Return the compiled regex. If 'is_regex' true,
then 'pattern' is directly compiled to a regex (if it's a string)
or just returned as-is (assumes it's a regex object).
| Translate a shell-like wildcard pattern to a compiled regular
expression. | def _translate_pattern(self, pattern, anchor=True, prefix=None,
is_regex=False):
"""Translate a shell-like wildcard pattern to a compiled regular
expression.
Return the compiled regex. If 'is_regex' true,
then 'pattern' is directly compiled to a regex (if it'... | [
"def",
"_translate_pattern",
"(",
"self",
",",
"pattern",
",",
"anchor",
"=",
"True",
",",
"prefix",
"=",
"None",
",",
"is_regex",
"=",
"False",
")",
":",
"if",
"is_regex",
":",
"if",
"isinstance",
"(",
"pattern",
",",
"str",
")",
":",
"return",
"re",
... | [
316,
4
] | [
369,
37
] | python | en | ['en', 'en', 'en'] | True |
Manifest._glob_to_re | (self, pattern) | Translate a shell-like glob pattern to a regular expression.
Return a string containing the regex. Differs from
'fnmatch.translate()' in that '*' does not match "special characters"
(which are platform-specific).
| Translate a shell-like glob pattern to a regular expression. | def _glob_to_re(self, pattern):
"""Translate a shell-like glob pattern to a regular expression.
Return a string containing the regex. Differs from
'fnmatch.translate()' in that '*' does not match "special characters"
(which are platform-specific).
"""
pattern_re = fnmat... | [
"def",
"_glob_to_re",
"(",
"self",
",",
"pattern",
")",
":",
"pattern_re",
"=",
"fnmatch",
".",
"translate",
"(",
"pattern",
")",
"# '?' and '*' in the glob pattern become '.' and '.*' in the RE, which",
"# IMHO is wrong -- '?' and '*' aren't supposed to match slash in Unix,",
"#... | [
371,
4
] | [
392,
25
] | python | en | ['en', 'ny', 'en'] | True |
note_interval_tree_to_sequence_proto | (note_interval_tree, sample_rate) | Convert MusicNet note interval tree to a NoteSequence proto.
Args:
note_interval_tree: An intervaltree.IntervalTree containing note intervals
and data as found in the MusicNet archive. The interval begin and end
values are audio sample numbers.
sample_rate: The sample rate for which the note ... | Convert MusicNet note interval tree to a NoteSequence proto. | def note_interval_tree_to_sequence_proto(note_interval_tree, sample_rate):
"""Convert MusicNet note interval tree to a NoteSequence proto.
Args:
note_interval_tree: An intervaltree.IntervalTree containing note intervals
and data as found in the MusicNet archive. The interval begin and end
value... | [
"def",
"note_interval_tree_to_sequence_proto",
"(",
"note_interval_tree",
",",
"sample_rate",
")",
":",
"sequence",
"=",
"music_pb2",
".",
"NoteSequence",
"(",
")",
"# Sort note intervals by onset time.",
"note_intervals",
"=",
"sorted",
"(",
"note_interval_tree",
",",
"k... | [
26,
0
] | [
67,
17
] | python | en | ['en', 'en', 'en'] | True |
musicnet_iterator | (musicnet_file) | An iterator over the MusicNet archive that yields audio and NoteSequences.
The MusicNet archive (in .npz format) can be downloaded from:
https://homes.cs.washington.edu/~thickstn/media/musicnet.npz
Args:
musicnet_file: The path to the MusicNet NumPy archive (.npz) containing
audio and transcriptions... | An iterator over the MusicNet archive that yields audio and NoteSequences. | def musicnet_iterator(musicnet_file):
"""An iterator over the MusicNet archive that yields audio and NoteSequences.
The MusicNet archive (in .npz format) can be downloaded from:
https://homes.cs.washington.edu/~thickstn/media/musicnet.npz
Args:
musicnet_file: The path to the MusicNet NumPy archive (.npz) ... | [
"def",
"musicnet_iterator",
"(",
"musicnet_file",
")",
":",
"with",
"open",
"(",
"musicnet_file",
",",
"'rb'",
")",
"as",
"f",
":",
"# Unfortunately the gfile seek function breaks the reading of NumPy",
"# archives, so we read the archive first then load as BytesIO.",
"musicnet_b... | [
70,
0
] | [
109,
25
] | python | en | ['en', 'en', 'en'] | True |
Document.document | (self, wrapper) |
Get the document root. For I{document/literal}, this is the
name of the wrapper element qualifed by the schema tns.
@param wrapper: The method name.
@type wrapper: L{xsd.sxbase.SchemaObject}
@return: A root element.
@rtype: L{Element}
|
Get the document root. For I{document/literal}, this is the
name of the wrapper element qualifed by the schema tns.
| def document(self, wrapper):
"""
Get the document root. For I{document/literal}, this is the
name of the wrapper element qualifed by the schema tns.
@param wrapper: The method name.
@type wrapper: L{xsd.sxbase.SchemaObject}
@return: A root element.
@rtype: L{Elem... | [
"def",
"document",
"(",
"self",
",",
"wrapper",
")",
":",
"tag",
"=",
"wrapper",
"[",
"1",
"]",
".",
"name",
"ns",
"=",
"wrapper",
"[",
"1",
"]",
".",
"namespace",
"(",
"'ns0'",
")",
"d",
"=",
"Element",
"(",
"tag",
",",
"ns",
"=",
"ns",
")",
... | [
78,
4
] | [
90,
16
] | python | en | ['en', 'error', 'th'] | False |
Document.bychoice | (self, ancestry) |
The ancestry contains a <choice/>
@param ancestry: A list of ancestors.
@type ancestry: list
@return: True if contains <choice/>
@rtype: boolean
|
The ancestry contains a <choice/>
| def bychoice(self, ancestry):
"""
The ancestry contains a <choice/>
@param ancestry: A list of ancestors.
@type ancestry: list
@return: True if contains <choice/>
@rtype: boolean
"""
for x in ancestry:
if x.choice():
return True... | [
"def",
"bychoice",
"(",
"self",
",",
"ancestry",
")",
":",
"for",
"x",
"in",
"ancestry",
":",
"if",
"x",
".",
"choice",
"(",
")",
":",
"return",
"True",
"return",
"False"
] | [
148,
4
] | [
159,
20
] | python | en | ['en', 'error', 'th'] | False |
check_other_queues | (queue_counts_dict: Dict[str, int]) | Do a simple queue size check for queues whose workers don't publish stats files. | Do a simple queue size check for queues whose workers don't publish stats files. | def check_other_queues(queue_counts_dict: Dict[str, int]) -> List[Dict[str, Any]]:
"""Do a simple queue size check for queues whose workers don't publish stats files."""
results = []
for queue, count in queue_counts_dict.items():
if queue in normal_queues:
continue
if count > C... | [
"def",
"check_other_queues",
"(",
"queue_counts_dict",
":",
"Dict",
"[",
"str",
",",
"int",
"]",
")",
"->",
"List",
"[",
"Dict",
"[",
"str",
",",
"Any",
"]",
"]",
":",
"results",
"=",
"[",
"]",
"for",
"queue",
",",
"count",
"in",
"queue_counts_dict",
... | [
111,
0
] | [
126,
18
] | python | en | ['en', 'en', 'en'] | True |
AnalyticsTestCase.assertTableState | (
self, table: Type[BaseCount], arg_keys: List[str], arg_values: List[List[object]]
) | Assert that the state of a *Count table is what it should be.
Example usage:
self.assertTableState(RealmCount, ['property', 'subgroup', 'realm'],
[['p1', 4], ['p2', 10, self.alt_realm]])
table -- A *Count table.
arg_keys -- List of columns of <tabl... | Assert that the state of a *Count table is what it should be. | def assertTableState(
self, table: Type[BaseCount], arg_keys: List[str], arg_values: List[List[object]]
) -> None:
"""Assert that the state of a *Count table is what it should be.
Example usage:
self.assertTableState(RealmCount, ['property', 'subgroup', 'realm'],
... | [
"def",
"assertTableState",
"(",
"self",
",",
"table",
":",
"Type",
"[",
"BaseCount",
"]",
",",
"arg_keys",
":",
"List",
"[",
"str",
"]",
",",
"arg_values",
":",
"List",
"[",
"List",
"[",
"object",
"]",
"]",
")",
"->",
"None",
":",
"defaults",
"=",
... | [
177,
4
] | [
222,
64
] | python | en | ['en', 'en', 'en'] | True |
SchemaCollection.__init__ | (self, wsdl) |
@param wsdl: A wsdl object.
@type wsdl: L{suds.wsdl.Definitions}
| def __init__(self, wsdl):
"""
@param wsdl: A wsdl object.
@type wsdl: L{suds.wsdl.Definitions}
"""
self.wsdl = wsdl
self.children = []
self.namespaces = {} | [
"def",
"__init__",
"(",
"self",
",",
"wsdl",
")",
":",
"self",
".",
"wsdl",
"=",
"wsdl",
"self",
".",
"children",
"=",
"[",
"]",
"self",
".",
"namespaces",
"=",
"{",
"}"
] | [
52,
4
] | [
59,
28
] | python | en | ['en', 'error', 'th'] | False | |
SchemaCollection.add | (self, schema) |
Add a schema node to the collection. Schema(s) within the same target
namespace are consolidated.
@param schema: A schema object.
@type schema: (L{Schema})
|
Add a schema node to the collection. Schema(s) within the same target
namespace are consolidated.
| def add(self, schema):
"""
Add a schema node to the collection. Schema(s) within the same target
namespace are consolidated.
@param schema: A schema object.
@type schema: (L{Schema})
"""
key = schema.tns[1]
existing = self.namespaces.get(key)
if e... | [
"def",
"add",
"(",
"self",
",",
"schema",
")",
":",
"key",
"=",
"schema",
".",
"tns",
"[",
"1",
"]",
"existing",
"=",
"self",
".",
"namespaces",
".",
"get",
"(",
"key",
")",
"if",
"existing",
"is",
"None",
":",
"self",
".",
"children",
".",
"appe... | [
61,
4
] | [
75,
67
] | python | en | ['en', 'error', 'th'] | False |
SchemaCollection.load | (self, options) |
Load the schema objects for the root nodes.
- de-references schemas
- merge schemas
@param options: An options dictionary.
@type options: L{options.Options}
@return: The merged schema.
@rtype: L{Schema}
|
Load the schema objects for the root nodes.
- de-references schemas
- merge schemas
| def load(self, options):
"""
Load the schema objects for the root nodes.
- de-references schemas
- merge schemas
@param options: An options dictionary.
@type options: L{options.Options}
@return: The merged schema.
@rtype: L{Schema}
"""
... | [
"def",
"load",
"(",
"self",
",",
"options",
")",
":",
"if",
"options",
".",
"autoblend",
":",
"self",
".",
"autoblend",
"(",
")",
"for",
"child",
"in",
"self",
".",
"children",
":",
"child",
".",
"build",
"(",
")",
"for",
"child",
"in",
"self",
"."... | [
77,
4
] | [
98,
21
] | python | en | ['en', 'error', 'th'] | False |
SchemaCollection.autoblend | (self) |
Ensure that all schemas within the collection
import each other which has a blending effect.
@return: self
@rtype: L{SchemaCollection}
|
Ensure that all schemas within the collection
import each other which has a blending effect.
| def autoblend(self):
"""
Ensure that all schemas within the collection
import each other which has a blending effect.
@return: self
@rtype: L{SchemaCollection}
"""
namespaces = self.namespaces.keys()
for s in self.children:
for ns in namespaces... | [
"def",
"autoblend",
"(",
"self",
")",
":",
"namespaces",
"=",
"self",
".",
"namespaces",
".",
"keys",
"(",
")",
"for",
"s",
"in",
"self",
".",
"children",
":",
"for",
"ns",
"in",
"namespaces",
":",
"tns",
"=",
"s",
".",
"root",
".",
"get",
"(",
"... | [
100,
4
] | [
119,
19
] | python | en | ['en', 'error', 'th'] | False |
SchemaCollection.locate | (self, ns) |
Find a schema by namespace. Only the URI portion of
the namespace is compared to each schema's I{targetNamespace}
@param ns: A namespace.
@type ns: (prefix,URI)
@return: The schema matching the namesapce, else None.
@rtype: L{Schema}
|
Find a schema by namespace. Only the URI portion of
the namespace is compared to each schema's I{targetNamespace}
| def locate(self, ns):
"""
Find a schema by namespace. Only the URI portion of
the namespace is compared to each schema's I{targetNamespace}
@param ns: A namespace.
@type ns: (prefix,URI)
@return: The schema matching the namesapce, else None.
@rtype: L{Schema}
... | [
"def",
"locate",
"(",
"self",
",",
"ns",
")",
":",
"return",
"self",
".",
"namespaces",
".",
"get",
"(",
"ns",
"[",
"1",
"]",
")"
] | [
121,
4
] | [
130,
41
] | python | en | ['en', 'error', 'th'] | False |
SchemaCollection.merge | (self) |
Merge the contained schemas into one.
@return: The merged schema.
@rtype: L{Schema}
|
Merge the contained schemas into one.
| def merge(self):
"""
Merge the contained schemas into one.
@return: The merged schema.
@rtype: L{Schema}
"""
if len(self):
schema = self.children[0]
for s in self.children[1:]:
schema.merge(s)
return schema
else:... | [
"def",
"merge",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
")",
":",
"schema",
"=",
"self",
".",
"children",
"[",
"0",
"]",
"for",
"s",
"in",
"self",
".",
"children",
"[",
"1",
":",
"]",
":",
"schema",
".",
"merge",
"(",
"s",
")",
"retu... | [
132,
4
] | [
144,
23
] | python | en | ['en', 'error', 'th'] | False |
Schema.__init__ | (self, root, baseurl, options, container=None) |
@param root: The xml root.
@type root: L{sax.element.Element}
@param baseurl: The base url used for importing.
@type baseurl: basestring
@param options: An options dictionary.
@type options: L{options.Options}
@param container: An optional container.
@typ... | def __init__(self, root, baseurl, options, container=None):
"""
@param root: The xml root.
@type root: L{sax.element.Element}
@param baseurl: The base url used for importing.
@type baseurl: basestring
@param options: An options dictionary.
@type options: L{options... | [
"def",
"__init__",
"(",
"self",
",",
"root",
",",
"baseurl",
",",
"options",
",",
"container",
"=",
"None",
")",
":",
"self",
".",
"root",
"=",
"root",
"self",
".",
"id",
"=",
"objid",
"(",
"self",
")",
"self",
".",
"tns",
"=",
"self",
".",
"mktn... | [
192,
4
] | [
228,
48
] | python | en | ['en', 'error', 'th'] | False | |
Schema.mktns | (self) |
Make the schema's target namespace.
@return: The namespace representation of the schema's
targetNamespace value.
@rtype: (prefix, uri)
|
Make the schema's target namespace.
| def mktns(self):
"""
Make the schema's target namespace.
@return: The namespace representation of the schema's
targetNamespace value.
@rtype: (prefix, uri)
"""
tns = [None, self.root.get('targetNamespace')]
if tns[1] is not None:
tns[0] = s... | [
"def",
"mktns",
"(",
"self",
")",
":",
"tns",
"=",
"[",
"None",
",",
"self",
".",
"root",
".",
"get",
"(",
"'targetNamespace'",
")",
"]",
"if",
"tns",
"[",
"1",
"]",
"is",
"not",
"None",
":",
"tns",
"[",
"0",
"]",
"=",
"self",
".",
"root",
".... | [
230,
4
] | [
240,
25
] | python | en | ['en', 'error', 'th'] | False |
Schema.build | (self) |
Build the schema (object graph) using the root node
using the factory.
- Build the graph.
- Collate the children.
|
Build the schema (object graph) using the root node
using the factory.
- Build the graph.
- Collate the children.
| def build(self):
"""
Build the schema (object graph) using the root node
using the factory.
- Build the graph.
- Collate the children.
"""
self.children = BasicFactory.build(self.root, self)
collated = BasicFactory.collate(self.children)
se... | [
"def",
"build",
"(",
"self",
")",
":",
"self",
".",
"children",
"=",
"BasicFactory",
".",
"build",
"(",
"self",
".",
"root",
",",
"self",
")",
"collated",
"=",
"BasicFactory",
".",
"collate",
"(",
"self",
".",
"children",
")",
"self",
".",
"children",
... | [
242,
4
] | [
257,
32
] | python | en | ['en', 'error', 'th'] | False |
Schema.merge | (self, schema) |
Merge the contents from the schema. Only objects not already contained
in this schema's collections are merged. This is to provide for bidirectional
import which produce cyclic includes.
@returns: self
@rtype: L{Schema}
|
Merge the contents from the schema. Only objects not already contained
in this schema's collections are merged. This is to provide for bidirectional
import which produce cyclic includes.
| def merge(self, schema):
"""
Merge the contents from the schema. Only objects not already contained
in this schema's collections are merged. This is to provide for bidirectional
import which produce cyclic includes.
@returns: self
@rtype: L{Schema}
"""
... | [
"def",
"merge",
"(",
"self",
",",
"schema",
")",
":",
"for",
"item",
"in",
"schema",
".",
"attributes",
".",
"items",
"(",
")",
":",
"if",
"item",
"[",
"0",
"]",
"in",
"self",
".",
"attributes",
":",
"continue",
"self",
".",
"all",
".",
"append",
... | [
259,
4
] | [
293,
19
] | python | en | ['en', 'error', 'th'] | False |
Schema.open_imports | (self, options) |
Instruct all contained L{sxbasic.Import} children to import
the schema's which they reference. The contents of the
imported schema are I{merged} in.
@param options: An options dictionary.
@type options: L{options.Options}
|
Instruct all contained L{sxbasic.Import} children to import
the schema's which they reference. The contents of the
imported schema are I{merged} in.
| def open_imports(self, options):
"""
Instruct all contained L{sxbasic.Import} children to import
the schema's which they reference. The contents of the
imported schema are I{merged} in.
@param options: An options dictionary.
@type options: L{options.Options}
"""
... | [
"def",
"open_imports",
"(",
"self",
",",
"options",
")",
":",
"for",
"imp",
"in",
"self",
".",
"imports",
":",
"imported",
"=",
"imp",
".",
"open",
"(",
"options",
")",
"if",
"imported",
"is",
"None",
":",
"continue",
"imported",
".",
"open_imports",
"... | [
295,
4
] | [
309,
32
] | python | en | ['en', 'error', 'th'] | False |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.