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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
LinuxDistribution.version_parts | (self, best=False) |
Return the version of the OS distribution, as a tuple of version
numbers.
For details, see :func:`distro.version_parts`.
|
Return the version of the OS distribution, as a tuple of version
numbers. | def version_parts(self, best=False):
"""
Return the version of the OS distribution, as a tuple of version
numbers.
For details, see :func:`distro.version_parts`.
"""
version_str = self.version(best=best)
if version_str:
version_regex = re.compile(r'(\... | [
"def",
"version_parts",
"(",
"self",
",",
"best",
"=",
"False",
")",
":",
"version_str",
"=",
"self",
".",
"version",
"(",
"best",
"=",
"best",
")",
"if",
"version_str",
":",
"version_regex",
"=",
"re",
".",
"compile",
"(",
"r'(\\d+)\\.?(\\d+)?\\.?(\\d+)?'",... | [
766,
4
] | [
780,
25
] | python | en | ['en', 'error', 'th'] | False |
LinuxDistribution.major_version | (self, best=False) |
Return the major version number of the current distribution.
For details, see :func:`distro.major_version`.
|
Return the major version number of the current distribution. | def major_version(self, best=False):
"""
Return the major version number of the current distribution.
For details, see :func:`distro.major_version`.
"""
return self.version_parts(best)[0] | [
"def",
"major_version",
"(",
"self",
",",
"best",
"=",
"False",
")",
":",
"return",
"self",
".",
"version_parts",
"(",
"best",
")",
"[",
"0",
"]"
] | [
782,
4
] | [
788,
42
] | python | en | ['en', 'error', 'th'] | False |
LinuxDistribution.minor_version | (self, best=False) |
Return the minor version number of the current distribution.
For details, see :func:`distro.minor_version`.
|
Return the minor version number of the current distribution. | def minor_version(self, best=False):
"""
Return the minor version number of the current distribution.
For details, see :func:`distro.minor_version`.
"""
return self.version_parts(best)[1] | [
"def",
"minor_version",
"(",
"self",
",",
"best",
"=",
"False",
")",
":",
"return",
"self",
".",
"version_parts",
"(",
"best",
")",
"[",
"1",
"]"
] | [
790,
4
] | [
796,
42
] | python | en | ['en', 'error', 'th'] | False |
LinuxDistribution.build_number | (self, best=False) |
Return the build number of the current distribution.
For details, see :func:`distro.build_number`.
|
Return the build number of the current distribution. | def build_number(self, best=False):
"""
Return the build number of the current distribution.
For details, see :func:`distro.build_number`.
"""
return self.version_parts(best)[2] | [
"def",
"build_number",
"(",
"self",
",",
"best",
"=",
"False",
")",
":",
"return",
"self",
".",
"version_parts",
"(",
"best",
")",
"[",
"2",
"]"
] | [
798,
4
] | [
804,
42
] | python | en | ['en', 'error', 'th'] | False |
LinuxDistribution.like | (self) |
Return the IDs of distributions that are like the OS distribution.
For details, see :func:`distro.like`.
|
Return the IDs of distributions that are like the OS distribution. | def like(self):
"""
Return the IDs of distributions that are like the OS distribution.
For details, see :func:`distro.like`.
"""
return self.os_release_attr('id_like') or '' | [
"def",
"like",
"(",
"self",
")",
":",
"return",
"self",
".",
"os_release_attr",
"(",
"'id_like'",
")",
"or",
"''"
] | [
806,
4
] | [
812,
52
] | python | en | ['en', 'error', 'th'] | False |
LinuxDistribution.codename | (self) |
Return the codename of the OS distribution.
For details, see :func:`distro.codename`.
|
Return the codename of the OS distribution. | def codename(self):
"""
Return the codename of the OS distribution.
For details, see :func:`distro.codename`.
"""
try:
# Handle os_release specially since distros might purposefully set
# this to empty string to have no codename
return self._o... | [
"def",
"codename",
"(",
"self",
")",
":",
"try",
":",
"# Handle os_release specially since distros might purposefully set",
"# this to empty string to have no codename",
"return",
"self",
".",
"_os_release_info",
"[",
"'codename'",
"]",
"except",
"KeyError",
":",
"return",
... | [
814,
4
] | [
827,
21
] | python | en | ['en', 'error', 'th'] | False |
LinuxDistribution.info | (self, pretty=False, best=False) |
Return certain machine-readable information about the OS
distribution.
For details, see :func:`distro.info`.
|
Return certain machine-readable information about the OS
distribution. | def info(self, pretty=False, best=False):
"""
Return certain machine-readable information about the OS
distribution.
For details, see :func:`distro.info`.
"""
return dict(
id=self.id(),
version=self.version(pretty, best),
version_parts... | [
"def",
"info",
"(",
"self",
",",
"pretty",
"=",
"False",
",",
"best",
"=",
"False",
")",
":",
"return",
"dict",
"(",
"id",
"=",
"self",
".",
"id",
"(",
")",
",",
"version",
"=",
"self",
".",
"version",
"(",
"pretty",
",",
"best",
")",
",",
"ver... | [
829,
4
] | [
846,
9
] | python | en | ['en', 'error', 'th'] | False |
LinuxDistribution.os_release_info | (self) |
Return a dictionary containing key-value pairs for the information
items from the os-release file data source of the OS distribution.
For details, see :func:`distro.os_release_info`.
|
Return a dictionary containing key-value pairs for the information
items from the os-release file data source of the OS distribution. | def os_release_info(self):
"""
Return a dictionary containing key-value pairs for the information
items from the os-release file data source of the OS distribution.
For details, see :func:`distro.os_release_info`.
"""
return self._os_release_info | [
"def",
"os_release_info",
"(",
"self",
")",
":",
"return",
"self",
".",
"_os_release_info"
] | [
848,
4
] | [
855,
36
] | python | en | ['en', 'error', 'th'] | False |
LinuxDistribution.lsb_release_info | (self) |
Return a dictionary containing key-value pairs for the information
items from the lsb_release command data source of the OS
distribution.
For details, see :func:`distro.lsb_release_info`.
|
Return a dictionary containing key-value pairs for the information
items from the lsb_release command data source of the OS
distribution. | def lsb_release_info(self):
"""
Return a dictionary containing key-value pairs for the information
items from the lsb_release command data source of the OS
distribution.
For details, see :func:`distro.lsb_release_info`.
"""
return self._lsb_release_info | [
"def",
"lsb_release_info",
"(",
"self",
")",
":",
"return",
"self",
".",
"_lsb_release_info"
] | [
857,
4
] | [
865,
37
] | python | en | ['en', 'error', 'th'] | False |
LinuxDistribution.distro_release_info | (self) |
Return a dictionary containing key-value pairs for the information
items from the distro release file data source of the OS
distribution.
For details, see :func:`distro.distro_release_info`.
|
Return a dictionary containing key-value pairs for the information
items from the distro release file data source of the OS
distribution. | def distro_release_info(self):
"""
Return a dictionary containing key-value pairs for the information
items from the distro release file data source of the OS
distribution.
For details, see :func:`distro.distro_release_info`.
"""
return self._distro_release_info | [
"def",
"distro_release_info",
"(",
"self",
")",
":",
"return",
"self",
".",
"_distro_release_info"
] | [
867,
4
] | [
875,
40
] | python | en | ['en', 'error', 'th'] | False |
LinuxDistribution.uname_info | (self) |
Return a dictionary containing key-value pairs for the information
items from the uname command data source of the OS distribution.
For details, see :func:`distro.uname_info`.
|
Return a dictionary containing key-value pairs for the information
items from the uname command data source of the OS distribution. | def uname_info(self):
"""
Return a dictionary containing key-value pairs for the information
items from the uname command data source of the OS distribution.
For details, see :func:`distro.uname_info`.
"""
return self._uname_info | [
"def",
"uname_info",
"(",
"self",
")",
":",
"return",
"self",
".",
"_uname_info"
] | [
877,
4
] | [
884,
31
] | python | en | ['en', 'error', 'th'] | False |
LinuxDistribution.os_release_attr | (self, attribute) |
Return a single named information item from the os-release file data
source of the OS distribution.
For details, see :func:`distro.os_release_attr`.
|
Return a single named information item from the os-release file data
source of the OS distribution. | def os_release_attr(self, attribute):
"""
Return a single named information item from the os-release file data
source of the OS distribution.
For details, see :func:`distro.os_release_attr`.
"""
return self._os_release_info.get(attribute, '') | [
"def",
"os_release_attr",
"(",
"self",
",",
"attribute",
")",
":",
"return",
"self",
".",
"_os_release_info",
".",
"get",
"(",
"attribute",
",",
"''",
")"
] | [
886,
4
] | [
893,
55
] | python | en | ['en', 'error', 'th'] | False |
LinuxDistribution.lsb_release_attr | (self, attribute) |
Return a single named information item from the lsb_release command
output data source of the OS distribution.
For details, see :func:`distro.lsb_release_attr`.
|
Return a single named information item from the lsb_release command
output data source of the OS distribution. | def lsb_release_attr(self, attribute):
"""
Return a single named information item from the lsb_release command
output data source of the OS distribution.
For details, see :func:`distro.lsb_release_attr`.
"""
return self._lsb_release_info.get(attribute, '') | [
"def",
"lsb_release_attr",
"(",
"self",
",",
"attribute",
")",
":",
"return",
"self",
".",
"_lsb_release_info",
".",
"get",
"(",
"attribute",
",",
"''",
")"
] | [
895,
4
] | [
902,
56
] | python | en | ['en', 'error', 'th'] | False |
LinuxDistribution.distro_release_attr | (self, attribute) |
Return a single named information item from the distro release file
data source of the OS distribution.
For details, see :func:`distro.distro_release_attr`.
|
Return a single named information item from the distro release file
data source of the OS distribution. | def distro_release_attr(self, attribute):
"""
Return a single named information item from the distro release file
data source of the OS distribution.
For details, see :func:`distro.distro_release_attr`.
"""
return self._distro_release_info.get(attribute, '') | [
"def",
"distro_release_attr",
"(",
"self",
",",
"attribute",
")",
":",
"return",
"self",
".",
"_distro_release_info",
".",
"get",
"(",
"attribute",
",",
"''",
")"
] | [
904,
4
] | [
911,
59
] | python | en | ['en', 'error', 'th'] | False |
LinuxDistribution.uname_attr | (self, attribute) |
Return a single named information item from the uname command
output data source of the OS distribution.
For details, see :func:`distro.uname_release_attr`.
|
Return a single named information item from the uname command
output data source of the OS distribution. | def uname_attr(self, attribute):
"""
Return a single named information item from the uname command
output data source of the OS distribution.
For details, see :func:`distro.uname_release_attr`.
"""
return self._uname_info.get(attribute, '') | [
"def",
"uname_attr",
"(",
"self",
",",
"attribute",
")",
":",
"return",
"self",
".",
"_uname_info",
".",
"get",
"(",
"attribute",
",",
"''",
")"
] | [
913,
4
] | [
920,
50
] | python | en | ['en', 'error', 'th'] | False |
LinuxDistribution._os_release_info | (self) |
Get the information items from the specified os-release file.
Returns:
A dictionary containing all information items.
|
Get the information items from the specified os-release file. | def _os_release_info(self):
"""
Get the information items from the specified os-release file.
Returns:
A dictionary containing all information items.
"""
if os.path.isfile(self.os_release_file):
with open(self.os_release_file) as release_file:
... | [
"def",
"_os_release_info",
"(",
"self",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"self",
".",
"os_release_file",
")",
":",
"with",
"open",
"(",
"self",
".",
"os_release_file",
")",
"as",
"release_file",
":",
"return",
"self",
".",
"_parse_o... | [
923,
4
] | [
933,
17
] | python | en | ['en', 'error', 'th'] | False |
LinuxDistribution._parse_os_release_content | (lines) |
Parse the lines of an os-release file.
Parameters:
* lines: Iterable through the lines in the os-release file.
Each line must be a unicode string or a UTF-8 encoded byte
string.
Returns:
A dictionary containing all information items.
... |
Parse the lines of an os-release file. | def _parse_os_release_content(lines):
"""
Parse the lines of an os-release file.
Parameters:
* lines: Iterable through the lines in the os-release file.
Each line must be a unicode string or a UTF-8 encoded byte
string.
Returns:
A ... | [
"def",
"_parse_os_release_content",
"(",
"lines",
")",
":",
"props",
"=",
"{",
"}",
"lexer",
"=",
"shlex",
".",
"shlex",
"(",
"lines",
",",
"posix",
"=",
"True",
")",
"lexer",
".",
"whitespace_split",
"=",
"True",
"# The shlex module defines its `wordchars` vari... | [
936,
4
] | [
998,
20
] | python | en | ['en', 'error', 'th'] | False |
LinuxDistribution._lsb_release_info | (self) |
Get the information items from the lsb_release command output.
Returns:
A dictionary containing all information items.
|
Get the information items from the lsb_release command output. | def _lsb_release_info(self):
"""
Get the information items from the lsb_release command output.
Returns:
A dictionary containing all information items.
"""
if not self.include_lsb:
return {}
with open(os.devnull, 'w') as devnull:
try:
... | [
"def",
"_lsb_release_info",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"include_lsb",
":",
"return",
"{",
"}",
"with",
"open",
"(",
"os",
".",
"devnull",
",",
"'w'",
")",
"as",
"devnull",
":",
"try",
":",
"cmd",
"=",
"(",
"'lsb_release'",
",",
... | [
1001,
4
] | [
1017,
55
] | python | en | ['en', 'error', 'th'] | False |
LinuxDistribution._parse_lsb_release_content | (lines) |
Parse the output of the lsb_release command.
Parameters:
* lines: Iterable through the lines of the lsb_release output.
Each line must be a unicode string or a UTF-8 encoded byte
string.
Returns:
A dictionary containing all information it... |
Parse the output of the lsb_release command. | def _parse_lsb_release_content(lines):
"""
Parse the output of the lsb_release command.
Parameters:
* lines: Iterable through the lines of the lsb_release output.
Each line must be a unicode string or a UTF-8 encoded byte
string.
Returns:
... | [
"def",
"_parse_lsb_release_content",
"(",
"lines",
")",
":",
"props",
"=",
"{",
"}",
"for",
"line",
"in",
"lines",
":",
"kv",
"=",
"line",
".",
"strip",
"(",
"'\\n'",
")",
".",
"split",
"(",
"':'",
",",
"1",
")",
"if",
"len",
"(",
"kv",
")",
"!="... | [
1020,
4
] | [
1041,
20
] | python | en | ['en', 'error', 'th'] | False |
LinuxDistribution._distro_release_info | (self) |
Get the information items from the specified distro release file.
Returns:
A dictionary containing all information items.
|
Get the information items from the specified distro release file. | def _distro_release_info(self):
"""
Get the information items from the specified distro release file.
Returns:
A dictionary containing all information items.
"""
if self.distro_release_file:
# If it was specified, we use it and parse what we can, even if
... | [
"def",
"_distro_release_info",
"(",
"self",
")",
":",
"if",
"self",
".",
"distro_release_file",
":",
"# If it was specified, we use it and parse what we can, even if",
"# its file name or content does not match the expected pattern.",
"distro_info",
"=",
"self",
".",
"_parse_distro... | [
1086,
4
] | [
1151,
21
] | python | en | ['en', 'error', 'th'] | False |
LinuxDistribution._parse_distro_release_file | (self, filepath) |
Parse a distro release file.
Parameters:
* filepath: Path name of the distro release file.
Returns:
A dictionary containing all information items.
|
Parse a distro release file. | def _parse_distro_release_file(self, filepath):
"""
Parse a distro release file.
Parameters:
* filepath: Path name of the distro release file.
Returns:
A dictionary containing all information items.
"""
try:
with open(filepath) as fp:
... | [
"def",
"_parse_distro_release_file",
"(",
"self",
",",
"filepath",
")",
":",
"try",
":",
"with",
"open",
"(",
"filepath",
")",
"as",
"fp",
":",
"# Only parse the first line. For instance, on SLES there",
"# are multiple lines. We don't want them...",
"return",
"self",
"."... | [
1153,
4
] | [
1173,
21
] | python | en | ['en', 'error', 'th'] | False |
LinuxDistribution._parse_distro_release_content | (line) |
Parse a line from a distro release file.
Parameters:
* line: Line from the distro release file. Must be a unicode string
or a UTF-8 encoded byte string.
Returns:
A dictionary containing all information items.
|
Parse a line from a distro release file. | def _parse_distro_release_content(line):
"""
Parse a line from a distro release file.
Parameters:
* line: Line from the distro release file. Must be a unicode string
or a UTF-8 encoded byte string.
Returns:
A dictionary containing all information ite... | [
"def",
"_parse_distro_release_content",
"(",
"line",
")",
":",
"matches",
"=",
"_DISTRO_RELEASE_CONTENT_REVERSED_PATTERN",
".",
"match",
"(",
"line",
".",
"strip",
"(",
")",
"[",
":",
":",
"-",
"1",
"]",
")",
"distro_info",
"=",
"{",
"}",
"if",
"matches",
... | [
1176,
4
] | [
1199,
26
] | python | en | ['en', 'error', 'th'] | False |
InitPlugin.initialized | (self, context) |
Suds client initialization.
Called after wsdl the has been loaded. Provides the plugin
with the opportunity to inspect/modify the WSDL.
@param context: The init context.
@type context: L{InitContext}
|
Suds client initialization.
Called after wsdl the has been loaded. Provides the plugin
with the opportunity to inspect/modify the WSDL.
| def initialized(self, context):
"""
Suds client initialization.
Called after wsdl the has been loaded. Provides the plugin
with the opportunity to inspect/modify the WSDL.
@param context: The init context.
@type context: L{InitContext}
"""
pass | [
"def",
"initialized",
"(",
"self",
",",
"context",
")",
":",
"pass"
] | [
77,
4
] | [
85,
12
] | python | en | ['en', 'error', 'th'] | False |
DocumentPlugin.loaded | (self, context) |
Suds has loaded a WSDL/XSD document. Provides the plugin
with an opportunity to inspect/modify the unparsed document.
Called after each WSDL/XSD document is loaded.
@param context: The document context.
@type context: L{DocumentContext}
|
Suds has loaded a WSDL/XSD document. Provides the plugin
with an opportunity to inspect/modify the unparsed document.
Called after each WSDL/XSD document is loaded.
| def loaded(self, context):
"""
Suds has loaded a WSDL/XSD document. Provides the plugin
with an opportunity to inspect/modify the unparsed document.
Called after each WSDL/XSD document is loaded.
@param context: The document context.
@type context: L{DocumentContext... | [
"def",
"loaded",
"(",
"self",
",",
"context",
")",
":",
"pass"
] | [
93,
4
] | [
101,
12
] | python | en | ['en', 'error', 'th'] | False |
DocumentPlugin.parsed | (self, context) |
Suds has parsed a WSDL/XSD document. Provides the plugin
with an opportunity to inspect/modify the parsed document.
Called after each WSDL/XSD document is parsed.
@param context: The document context.
@type context: L{DocumentContext}
|
Suds has parsed a WSDL/XSD document. Provides the plugin
with an opportunity to inspect/modify the parsed document.
Called after each WSDL/XSD document is parsed.
| def parsed(self, context):
"""
Suds has parsed a WSDL/XSD document. Provides the plugin
with an opportunity to inspect/modify the parsed document.
Called after each WSDL/XSD document is parsed.
@param context: The document context.
@type context: L{DocumentContext}
... | [
"def",
"parsed",
"(",
"self",
",",
"context",
")",
":",
"pass"
] | [
103,
4
] | [
111,
12
] | python | en | ['en', 'error', 'th'] | False |
MessagePlugin.marshalled | (self, context) |
Suds will send the specified soap envelope.
Provides the plugin with the opportunity to inspect/modify
the envelope Document before it is sent.
@param context: The send context.
The I{envelope} is the envelope docuemnt.
@type context: L{MessageContext}
|
Suds will send the specified soap envelope.
Provides the plugin with the opportunity to inspect/modify
the envelope Document before it is sent.
| def marshalled(self, context):
"""
Suds will send the specified soap envelope.
Provides the plugin with the opportunity to inspect/modify
the envelope Document before it is sent.
@param context: The send context.
The I{envelope} is the envelope docuemnt.
@type... | [
"def",
"marshalled",
"(",
"self",
",",
"context",
")",
":",
"pass"
] | [
119,
4
] | [
128,
12
] | python | en | ['en', 'error', 'th'] | False |
MessagePlugin.sending | (self, context) |
Suds will send the specified soap envelope.
Provides the plugin with the opportunity to inspect/modify
the message text it is sent.
@param context: The send context.
The I{envelope} is the envelope text.
@type context: L{MessageContext}
|
Suds will send the specified soap envelope.
Provides the plugin with the opportunity to inspect/modify
the message text it is sent.
| def sending(self, context):
"""
Suds will send the specified soap envelope.
Provides the plugin with the opportunity to inspect/modify
the message text it is sent.
@param context: The send context.
The I{envelope} is the envelope text.
@type context: L{Message... | [
"def",
"sending",
"(",
"self",
",",
"context",
")",
":",
"pass"
] | [
130,
4
] | [
139,
12
] | python | en | ['en', 'error', 'th'] | False |
MessagePlugin.received | (self, context) |
Suds has received the specified reply.
Provides the plugin with the opportunity to inspect/modify
the received XML text before it is SAX parsed.
@param context: The reply context.
The I{reply} is the raw text.
@type context: L{MessageContext}
|
Suds has received the specified reply.
Provides the plugin with the opportunity to inspect/modify
the received XML text before it is SAX parsed.
| def received(self, context):
"""
Suds has received the specified reply.
Provides the plugin with the opportunity to inspect/modify
the received XML text before it is SAX parsed.
@param context: The reply context.
The I{reply} is the raw text.
@type context: L{... | [
"def",
"received",
"(",
"self",
",",
"context",
")",
":",
"pass"
] | [
141,
4
] | [
150,
12
] | python | en | ['en', 'error', 'th'] | False |
MessagePlugin.parsed | (self, context) |
Suds has sax parsed the received reply.
Provides the plugin with the opportunity to inspect/modify
the sax parsed DOM tree for the reply before it is unmarshalled.
@param context: The reply context.
The I{reply} is DOM tree.
@type context: L{MessageContext}
|
Suds has sax parsed the received reply.
Provides the plugin with the opportunity to inspect/modify
the sax parsed DOM tree for the reply before it is unmarshalled.
| def parsed(self, context):
"""
Suds has sax parsed the received reply.
Provides the plugin with the opportunity to inspect/modify
the sax parsed DOM tree for the reply before it is unmarshalled.
@param context: The reply context.
The I{reply} is DOM tree.
@typ... | [
"def",
"parsed",
"(",
"self",
",",
"context",
")",
":",
"pass"
] | [
152,
4
] | [
161,
12
] | python | en | ['en', 'error', 'th'] | False |
MessagePlugin.unmarshalled | (self, context) |
Suds has unmarshalled the received reply.
Provides the plugin with the opportunity to inspect/modify
the unmarshalled reply object before it is returned.
@param context: The reply context.
The I{reply} is unmarshalled suds object.
@type context: L{MessageContext}
... |
Suds has unmarshalled the received reply.
Provides the plugin with the opportunity to inspect/modify
the unmarshalled reply object before it is returned.
| def unmarshalled(self, context):
"""
Suds has unmarshalled the received reply.
Provides the plugin with the opportunity to inspect/modify
the unmarshalled reply object before it is returned.
@param context: The reply context.
The I{reply} is unmarshalled suds object.
... | [
"def",
"unmarshalled",
"(",
"self",
",",
"context",
")",
":",
"pass"
] | [
163,
4
] | [
172,
12
] | python | en | ['en', 'error', 'th'] | False |
PluginContainer.__init__ | (self, plugins) |
@param plugins: A list of plugin objects.
@type plugins: [L{Plugin},]
| def __init__(self, plugins):
"""
@param plugins: A list of plugin objects.
@type plugins: [L{Plugin},]
"""
self.plugins = plugins | [
"def",
"__init__",
"(",
"self",
",",
"plugins",
")",
":",
"self",
".",
"plugins",
"=",
"plugins"
] | [
190,
4
] | [
195,
30
] | python | en | ['en', 'error', 'th'] | False | |
Method.__init__ | (self, name, domain) |
@param name: The method name.
@type name: str
@param domain: A plugin domain.
@type domain: L{PluginDomain}
| def __init__(self, name, domain):
"""
@param name: The method name.
@type name: str
@param domain: A plugin domain.
@type domain: L{PluginDomain}
"""
self.name = name
self.domain = domain | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"domain",
")",
":",
"self",
".",
"name",
"=",
"name",
"self",
".",
"domain",
"=",
"domain"
] | [
236,
4
] | [
244,
28
] | python | en | ['en', 'error', 'th'] | False | |
splitUp | (pred) | Parse a single version comparison.
Return (comparison string, StrictVersion)
| Parse a single version comparison. | def splitUp(pred):
"""Parse a single version comparison.
Return (comparison string, StrictVersion)
"""
res = re_splitComparison.match(pred)
if not res:
raise ValueError("bad package restriction syntax: %r" % pred)
comp, verStr = res.groups()
return (comp, distutils.version.StrictVer... | [
"def",
"splitUp",
"(",
"pred",
")",
":",
"res",
"=",
"re_splitComparison",
".",
"match",
"(",
"pred",
")",
"if",
"not",
"res",
":",
"raise",
"ValueError",
"(",
"\"bad package restriction syntax: %r\"",
"%",
"pred",
")",
"comp",
",",
"verStr",
"=",
"res",
"... | [
16,
0
] | [
25,
58
] | python | en | ['en', 'fr', 'en'] | True |
split_provision | (value) | Return the name and optional version number of a provision.
The version number, if given, will be returned as a `StrictVersion`
instance, otherwise it will be `None`.
>>> split_provision('mypkg')
('mypkg', None)
>>> split_provision(' mypkg( 1.2 ) ')
('mypkg', StrictVersion ('1.2'))
| Return the name and optional version number of a provision. | def split_provision(value):
"""Return the name and optional version number of a provision.
The version number, if given, will be returned as a `StrictVersion`
instance, otherwise it will be `None`.
>>> split_provision('mypkg')
('mypkg', None)
>>> split_provision(' mypkg( 1.2 ) ')
('mypkg',... | [
"def",
"split_provision",
"(",
"value",
")",
":",
"global",
"_provision_rx",
"if",
"_provision_rx",
"is",
"None",
":",
"_provision_rx",
"=",
"re",
".",
"compile",
"(",
"r\"([a-zA-Z_]\\w*(?:\\.[a-zA-Z_]\\w*)*)(?:\\s*\\(\\s*([^)\\s]+)\\s*\\))?$\"",
",",
"re",
".",
"ASCII"... | [
142,
0
] | [
165,
26
] | python | en | ['en', 'en', 'en'] | True |
VersionPredicate.__init__ | (self, versionPredicateStr) | Parse a version predicate string.
| Parse a version predicate string.
| def __init__(self, versionPredicateStr):
"""Parse a version predicate string.
"""
# Fields:
# name: package name
# pred: list of (comparison string, StrictVersion)
versionPredicateStr = versionPredicateStr.strip()
if not versionPredicateStr:
r... | [
"def",
"__init__",
"(",
"self",
",",
"versionPredicateStr",
")",
":",
"# Fields:",
"# name: package name",
"# pred: list of (comparison string, StrictVersion)",
"versionPredicateStr",
"=",
"versionPredicateStr",
".",
"strip",
"(",
")",
"if",
"not",
"versionPredicateSt... | [
95,
4
] | [
120,
26
] | python | ht | ['sk', 'ht', 'it'] | False |
VersionPredicate.satisfied_by | (self, version) | True if version is compatible with all the predicates in self.
The parameter version must be acceptable to the StrictVersion
constructor. It may be either a string or StrictVersion.
| True if version is compatible with all the predicates in self.
The parameter version must be acceptable to the StrictVersion
constructor. It may be either a string or StrictVersion.
| def satisfied_by(self, version):
"""True if version is compatible with all the predicates in self.
The parameter version must be acceptable to the StrictVersion
constructor. It may be either a string or StrictVersion.
"""
for cond, ver in self.pred:
if not compmap[co... | [
"def",
"satisfied_by",
"(",
"self",
",",
"version",
")",
":",
"for",
"cond",
",",
"ver",
"in",
"self",
".",
"pred",
":",
"if",
"not",
"compmap",
"[",
"cond",
"]",
"(",
"version",
",",
"ver",
")",
":",
"return",
"False",
"return",
"True"
] | [
129,
4
] | [
137,
19
] | python | en | ['en', 'en', 'en'] | True |
my_lcs | (string, sub) |
Calculates longest common subsequence for a pair of tokenized strings
:param string : list of str : tokens from a string split using whitespace
:param sub : list of str : shorter string, also split using whitespace
:returns: length (list of int): length of the longest common subsequence between the two... |
Calculates longest common subsequence for a pair of tokenized strings
:param string : list of str : tokens from a string split using whitespace
:param sub : list of str : shorter string, also split using whitespace
:returns: length (list of int): length of the longest common subsequence between the two... | def my_lcs(string, sub):
"""
Calculates longest common subsequence for a pair of tokenized strings
:param string : list of str : tokens from a string split using whitespace
:param sub : list of str : shorter string, also split using whitespace
:returns: length (list of int): length of the longest co... | [
"def",
"my_lcs",
"(",
"string",
",",
"sub",
")",
":",
"if",
"(",
"len",
"(",
"string",
")",
"<",
"len",
"(",
"sub",
")",
")",
":",
"sub",
",",
"string",
"=",
"string",
",",
"sub",
"lengths",
"=",
"[",
"[",
"0",
"for",
"i",
"in",
"range",
"(",... | [
13,
0
] | [
34,
41
] | python | en | ['en', 'error', 'th'] | False |
Rouge.calc_score | (self, candidate, refs) |
Compute ROUGE-L score given one candidate and references for an image
:param candidate: str : candidate sentence to be evaluated
:param refs: list of str : COCO reference sentences for the particular image to be evaluated
:returns score: int (ROUGE-L score for the candidate evaluated ag... |
Compute ROUGE-L score given one candidate and references for an image
:param candidate: str : candidate sentence to be evaluated
:param refs: list of str : COCO reference sentences for the particular image to be evaluated
:returns score: int (ROUGE-L score for the candidate evaluated ag... | def calc_score(self, candidate, refs):
"""
Compute ROUGE-L score given one candidate and references for an image
:param candidate: str : candidate sentence to be evaluated
:param refs: list of str : COCO reference sentences for the particular image to be evaluated
:returns score:... | [
"def",
"calc_score",
"(",
"self",
",",
"candidate",
",",
"refs",
")",
":",
"assert",
"(",
"len",
"(",
"candidate",
")",
"==",
"1",
")",
"assert",
"(",
"len",
"(",
"refs",
")",
">",
"0",
")",
"prec",
"=",
"[",
"]",
"rec",
"=",
"[",
"]",
"# split... | [
47,
4
] | [
77,
20
] | python | en | ['en', 'error', 'th'] | False |
Rouge.compute_score | (self, gts, res) |
Computes Rouge-L score given a set of reference and candidate sentences for the dataset
Invoked by evaluate_captions.py
:param hypo_for_image: dict : candidate / test sentences with "image name" key and "tokenized sentences" as values
:param ref_for_image: dict : reference MS-COCO sente... |
Computes Rouge-L score given a set of reference and candidate sentences for the dataset
Invoked by evaluate_captions.py
:param hypo_for_image: dict : candidate / test sentences with "image name" key and "tokenized sentences" as values
:param ref_for_image: dict : reference MS-COCO sente... | def compute_score(self, gts, res):
"""
Computes Rouge-L score given a set of reference and candidate sentences for the dataset
Invoked by evaluate_captions.py
:param hypo_for_image: dict : candidate / test sentences with "image name" key and "tokenized sentences" as values
:param... | [
"def",
"compute_score",
"(",
"self",
",",
"gts",
",",
"res",
")",
":",
"assert",
"(",
"gts",
".",
"keys",
"(",
")",
"==",
"res",
".",
"keys",
"(",
")",
")",
"imgIds",
"=",
"gts",
".",
"keys",
"(",
")",
"score",
"=",
"[",
"]",
"for",
"id",
"in... | [
79,
4
] | [
104,
45
] | python | en | ['en', 'error', 'th'] | False |
parse_abc_tunebook_file | (filename) | Parse an ABC Tunebook file.
Args:
filename: File path to an ABC tunebook.
Returns:
tunes: A dictionary of reference number to NoteSequence of parsed ABC tunes.
exceptions: A list of exceptions for tunes that could not be parsed.
Raises:
DuplicateReferenceNumberError: If the same reference numbe... | Parse an ABC Tunebook file. | def parse_abc_tunebook_file(filename):
"""Parse an ABC Tunebook file.
Args:
filename: File path to an ABC tunebook.
Returns:
tunes: A dictionary of reference number to NoteSequence of parsed ABC tunes.
exceptions: A list of exceptions for tunes that could not be parsed.
Raises:
DuplicateRefer... | [
"def",
"parse_abc_tunebook_file",
"(",
"filename",
")",
":",
"# 'r' mode will decode the file as utf-8 in py3.",
"return",
"parse_abc_tunebook",
"(",
"open",
"(",
"filename",
",",
"'r'",
")",
".",
"read",
"(",
")",
")"
] | [
67,
0
] | [
82,
55
] | python | en | ['en', 'en', 'en'] | True |
parse_abc_tunebook | (tunebook) | Parse an ABC Tunebook string.
Args:
tunebook: The ABC tunebook as a string.
Returns:
tunes: A dictionary of reference number to NoteSequence of parsed ABC tunes.
exceptions: A list of exceptions for tunes that could not be parsed.
Raises:
DuplicateReferenceNumberError: If the same reference num... | Parse an ABC Tunebook string. | def parse_abc_tunebook(tunebook):
"""Parse an ABC Tunebook string.
Args:
tunebook: The ABC tunebook as a string.
Returns:
tunes: A dictionary of reference number to NoteSequence of parsed ABC tunes.
exceptions: A list of exceptions for tunes that could not be parsed.
Raises:
DuplicateReferenc... | [
"def",
"parse_abc_tunebook",
"(",
"tunebook",
")",
":",
"# Split tunebook into sections based on empty lines.",
"sections",
"=",
"[",
"]",
"current_lines",
"=",
"[",
"]",
"for",
"line",
"in",
"tunebook",
".",
"splitlines",
"(",
")",
":",
"line",
"=",
"line",
"."... | [
85,
0
] | [
138,
26
] | python | en | ['en', 'en', 'en'] | True |
ABCTune._qpm | (self) | Returns the current QPM. | Returns the current QPM. | def _qpm(self):
"""Returns the current QPM."""
if self._ns.tempos:
return self._ns.tempos[-1].qpm
else:
# No QPM has been specified, so will use the default one.
return constants.DEFAULT_QUARTERS_PER_MINUTE | [
"def",
"_qpm",
"(",
"self",
")",
":",
"if",
"self",
".",
"_ns",
".",
"tempos",
":",
"return",
"self",
".",
"_ns",
".",
"tempos",
"[",
"-",
"1",
"]",
".",
"qpm",
"else",
":",
"# No QPM has been specified, so will use the default one.",
"return",
"constants",
... | [
290,
2
] | [
296,
50
] | python | en | ['en', 'ca', 'en'] | True |
ABCTune._set_unit_note_length_from_header | (self) | Sets the current unit note length.
Should be called immediately after parsing the header.
Raises:
ABCParseError: If multiple time signatures were set in the header.
| Sets the current unit note length. | def _set_unit_note_length_from_header(self):
"""Sets the current unit note length.
Should be called immediately after parsing the header.
Raises:
ABCParseError: If multiple time signatures were set in the header.
"""
# http://abcnotation.com/wiki/abc:standard:v2.1#lunit_note_length
if s... | [
"def",
"_set_unit_note_length_from_header",
"(",
"self",
")",
":",
"# http://abcnotation.com/wiki/abc:standard:v2.1#lunit_note_length",
"if",
"self",
".",
"_current_unit_note_length",
":",
"# If it has been set explicitly, leave it as is.",
"pass",
"elif",
"not",
"self",
".",
"_n... | [
309,
2
] | [
334,
55
] | python | en | ['en', 'en', 'en'] | True |
ABCTune._add_section | (self, time) | Adds a new section to the NoteSequence.
If the most recently added section is for the same time, a new section will
not be created.
Args:
time: The time at which to create the new section.
Returns:
The id of the newly created section, or None if no new section was
created.
| Adds a new section to the NoteSequence. | def _add_section(self, time):
"""Adds a new section to the NoteSequence.
If the most recently added section is for the same time, a new section will
not be created.
Args:
time: The time at which to create the new section.
Returns:
The id of the newly created section, or None if no new... | [
"def",
"_add_section",
"(",
"self",
",",
"time",
")",
":",
"if",
"not",
"self",
".",
"_ns",
".",
"section_annotations",
"and",
"time",
">",
"0",
":",
"# We're in a piece with sections, need to add a section marker at the",
"# beginning of the piece if there isn't one there ... | [
344,
2
] | [
375,
17
] | python | en | ['en', 'en', 'en'] | True |
ABCTune._finalize | (self) | Do final cleanup. To be called at the end of the tune. | Do final cleanup. To be called at the end of the tune. | def _finalize(self):
"""Do final cleanup. To be called at the end of the tune."""
self._finalize_repeats()
self._finalize_sections() | [
"def",
"_finalize",
"(",
"self",
")",
":",
"self",
".",
"_finalize_repeats",
"(",
")",
"self",
".",
"_finalize_sections",
"(",
")"
] | [
377,
2
] | [
380,
29
] | python | en | ['en', 'en', 'en'] | True |
ABCTune._finalize_repeats | (self) | Handle any pending repeats. | Handle any pending repeats. | def _finalize_repeats(self):
"""Handle any pending repeats."""
# If we're still expecting a repeat at the end of the tune, that's an error
# in the file.
if self._current_expected_repeats:
raise RepeatParseError(
'Expected a repeat at the end of the file, but did not get one.') | [
"def",
"_finalize_repeats",
"(",
"self",
")",
":",
"# If we're still expecting a repeat at the end of the tune, that's an error",
"# in the file.",
"if",
"self",
".",
"_current_expected_repeats",
":",
"raise",
"RepeatParseError",
"(",
"'Expected a repeat at the end of the file, but d... | [
382,
2
] | [
388,
75
] | python | en | ['en', 'en', 'en'] | True |
ABCTune._finalize_sections | (self) | Handle any pending sections. | Handle any pending sections. | def _finalize_sections(self):
"""Handle any pending sections."""
# If a new section was started at the very end of the piece, delete it
# because it will contain no notes and is meaningless.
# This happens if the last line in the piece ends with a :| symbol. A new
# section is set up to handle upcom... | [
"def",
"_finalize_sections",
"(",
"self",
")",
":",
"# If a new section was started at the very end of the piece, delete it",
"# because it will contain no notes and is meaningless.",
"# This happens if the last line in the piece ends with a :| symbol. A new",
"# section is set up to handle upcomi... | [
390,
2
] | [
414,
22
] | python | en | ['en', 'en', 'en'] | True |
ABCTune._apply_broken_rhythm | (self, broken_rhythm) | Applies a broken rhythm symbol to the two most recently added notes. | Applies a broken rhythm symbol to the two most recently added notes. | def _apply_broken_rhythm(self, broken_rhythm):
"""Applies a broken rhythm symbol to the two most recently added notes."""
# http://abcnotation.com/wiki/abc:standard:v2.1#broken_rhythm
if len(self._ns.notes) < 2:
raise ABCParseError(
'Cannot apply a broken rhythm with fewer than 2 notes')
... | [
"def",
"_apply_broken_rhythm",
"(",
"self",
",",
"broken_rhythm",
")",
":",
"# http://abcnotation.com/wiki/abc:standard:v2.1#broken_rhythm",
"if",
"len",
"(",
"self",
".",
"_ns",
".",
"notes",
")",
"<",
"2",
":",
"raise",
"ABCParseError",
"(",
"'Cannot apply a broken ... | [
416,
2
] | [
441,
25
] | python | en | ['en', 'en', 'en'] | True |
ABCTune._parse_music_code | (self, line) | Parse the music code within an ABC file. | Parse the music code within an ABC file. | def _parse_music_code(self, line):
"""Parse the music code within an ABC file."""
# http://abcnotation.com/wiki/abc:standard:v2.1#the_tune_body
pos = 0
broken_rhythm = None
while pos < len(line):
match = None
for regex in [
ABCTune.NOTE_PATTERN,
ABCTune.CHORD_PATTERN... | [
"def",
"_parse_music_code",
"(",
"self",
",",
"line",
")",
":",
"# http://abcnotation.com/wiki/abc:standard:v2.1#the_tune_body",
"pos",
"=",
"0",
"broken_rhythm",
"=",
"None",
"while",
"pos",
"<",
"len",
"(",
"line",
")",
":",
"match",
"=",
"None",
"for",
"regex... | [
484,
2
] | [
713,
51
] | python | en | ['en', 'en', 'en'] | True |
ABCTune.parse_key | (key) | Parse an ABC key string. | Parse an ABC key string. | def parse_key(key):
"""Parse an ABC key string."""
# http://abcnotation.com/wiki/abc:standard:v2.1#kkey
key_match = ABCTune.KEY_PATTERN.match(key)
if not key_match:
raise ABCParseError('Could not parse key: {}'.format(key))
key_components = list(key_match.groups())
# Shorten the mode to... | [
"def",
"parse_key",
"(",
"key",
")",
":",
"# http://abcnotation.com/wiki/abc:standard:v2.1#kkey",
"key_match",
"=",
"ABCTune",
".",
"KEY_PATTERN",
".",
"match",
"(",
"key",
")",
"if",
"not",
"key_match",
":",
"raise",
"ABCParseError",
"(",
"'Could not parse key: {}'",... | [
725,
2
] | [
795,
45
] | python | en | ['en', 'ht', 'en'] | True |
ABCTune._parse_information_field | (self, field_name, field_content) | Parses information field. | Parses information field. | def _parse_information_field(self, field_name, field_content):
"""Parses information field."""
# http://abcnotation.com/wiki/abc:standard:v2.1#information_fields
if field_name == 'A':
pass
elif field_name == 'B':
pass
elif field_name == 'C':
# Composer
# http://abcnotation.co... | [
"def",
"_parse_information_field",
"(",
"self",
",",
"field_name",
",",
"field_content",
")",
":",
"# http://abcnotation.com/wiki/abc:standard:v2.1#information_fields",
"if",
"field_name",
"==",
"'A'",
":",
"pass",
"elif",
"field_name",
"==",
"'B'",
":",
"pass",
"elif",... | [
805,
2
] | [
969,
77
] | python | en | ['en', 'en', 'en'] | True |
compose_views | (thunks: List[Callable[[], HttpResponse]]) |
This takes a series of thunks and calls them in sequence, and it
smushes all the json results into a single response when
everything goes right. (This helps clients avoid extra latency
hops.) It rolls back the transaction when things go wrong in any
one of the composed methods.
TODO: Move th... |
This takes a series of thunks and calls them in sequence, and it
smushes all the json results into a single response when
everything goes right. (This helps clients avoid extra latency
hops.) It rolls back the transaction when things go wrong in any
one of the composed methods. | def compose_views(thunks: List[Callable[[], HttpResponse]]) -> HttpResponse:
"""
This takes a series of thunks and calls them in sequence, and it
smushes all the json results into a single response when
everything goes right. (This helps clients avoid extra latency
hops.) It rolls back the transac... | [
"def",
"compose_views",
"(",
"thunks",
":",
"List",
"[",
"Callable",
"[",
"[",
"]",
",",
"HttpResponse",
"]",
"]",
")",
"->",
"HttpResponse",
":",
"json_dict",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
"=",
"{",
"}",
"with",
"transaction",
".",
"atom... | [
351,
0
] | [
370,
34
] | python | en | ['en', 'error', 'th'] | False |
send_messages_for_new_subscribers | (
user_profile: UserProfile,
subscribers: Set[UserProfile],
new_subscriptions: Dict[str, List[str]],
email_to_user_profile: Dict[str, UserProfile],
created_streams: List[Stream],
announce: bool,
) |
If you are subscribing lots of new users to new streams,
this function can be pretty expensive in terms of generating
lots of queries and sending lots of messages. We isolate
the code partly to make it easier to test things like
excessive query counts by mocking this function so that it
doesn'... |
If you are subscribing lots of new users to new streams,
this function can be pretty expensive in terms of generating
lots of queries and sending lots of messages. We isolate
the code partly to make it easier to test things like
excessive query counts by mocking this function so that it
doesn'... | def send_messages_for_new_subscribers(
user_profile: UserProfile,
subscribers: Set[UserProfile],
new_subscriptions: Dict[str, List[str]],
email_to_user_profile: Dict[str, UserProfile],
created_streams: List[Stream],
announce: bool,
) -> None:
"""
If you are subscribing lots of new users ... | [
"def",
"send_messages_for_new_subscribers",
"(",
"user_profile",
":",
"UserProfile",
",",
"subscribers",
":",
"Set",
"[",
"UserProfile",
"]",
",",
"new_subscriptions",
":",
"Dict",
"[",
"str",
",",
"List",
"[",
"str",
"]",
"]",
",",
"email_to_user_profile",
":",... | [
563,
0
] | [
662,
71
] | python | en | ['en', 'error', 'th'] | False |
update_subscription_properties_backend | (
request: HttpRequest,
user_profile: UserProfile,
subscription_data: List[Dict[str, Any]] = REQ(
json_validator=check_list(
check_dict(
[
("stream_id", check_int),
("property", check_string),
("value", check_uni... |
This is the entry point to changing subscription properties. This
is a bulk endpoint: requestors always provide a subscription_data
list containing dictionaries for each stream of interest.
Requests are of the form:
[{"stream_id": "1", "property": "is_muted", "value": False},
{"stream_id": "... |
This is the entry point to changing subscription properties. This
is a bulk endpoint: requestors always provide a subscription_data
list containing dictionaries for each stream of interest. | def update_subscription_properties_backend(
request: HttpRequest,
user_profile: UserProfile,
subscription_data: List[Dict[str, Any]] = REQ(
json_validator=check_list(
check_dict(
[
("stream_id", check_int),
("property", check_string... | [
"def",
"update_subscription_properties_backend",
"(",
"request",
":",
"HttpRequest",
",",
"user_profile",
":",
"UserProfile",
",",
"subscription_data",
":",
"List",
"[",
"Dict",
"[",
"str",
",",
"Any",
"]",
"]",
"=",
"REQ",
"(",
"json_validator",
"=",
"check_lis... | [
820,
0
] | [
881,
61
] | python | en | ['en', 'error', 'th'] | False |
Core.process | (self, content) |
Process an object graph representation of the xml I{node}.
@param content: The current content being unmarshalled.
@type content: L{Content}
@return: A suds object.
@rtype: L{Object}
|
Process an object graph representation of the xml I{node}.
| def process(self, content):
"""
Process an object graph representation of the xml I{node}.
@param content: The current content being unmarshalled.
@type content: L{Content}
@return: A suds object.
@rtype: L{Object}
"""
self.reset()
return self.appe... | [
"def",
"process",
"(",
"self",
",",
"content",
")",
":",
"self",
".",
"reset",
"(",
")",
"return",
"self",
".",
"append",
"(",
"content",
")"
] | [
38,
4
] | [
47,
35
] | python | en | ['en', 'error', 'th'] | False |
Core.append | (self, content) |
Process the specified node and convert the XML document into
a I{suds} L{object}.
@param content: The current content being unmarshalled.
@type content: L{Content}
@return: A I{append-result} tuple as: (L{Object}, I{value})
@rtype: I{append-result}
@note: This is... |
Process the specified node and convert the XML document into
a I{suds} L{object}.
| def append(self, content):
"""
Process the specified node and convert the XML document into
a I{suds} L{object}.
@param content: The current content being unmarshalled.
@type content: L{Content}
@return: A I{append-result} tuple as: (L{Object}, I{value})
@rtype: I... | [
"def",
"append",
"(",
"self",
",",
"content",
")",
":",
"self",
".",
"start",
"(",
"content",
")",
"self",
".",
"append_attributes",
"(",
"content",
")",
"self",
".",
"append_children",
"(",
"content",
")",
"self",
".",
"append_text",
"(",
"content",
")"... | [
49,
4
] | [
65,
40
] | python | en | ['en', 'error', 'th'] | False |
Core.postprocess | (self, content) |
Perform final processing of the resulting data structure as follows:
- Mixed values (children and text) will have a result of the I{content.node}.
- Simi-simple values (attributes, no-children and text) will have a result of a
property object.
- Simple values (no-attr... |
Perform final processing of the resulting data structure as follows:
- Mixed values (children and text) will have a result of the I{content.node}.
- Simi-simple values (attributes, no-children and text) will have a result of a
property object.
- Simple values (no-attr... | def postprocess(self, content):
"""
Perform final processing of the resulting data structure as follows:
- Mixed values (children and text) will have a result of the I{content.node}.
- Simi-simple values (attributes, no-children and text) will have a result of a
property... | [
"def",
"postprocess",
"(",
"self",
",",
"content",
")",
":",
"node",
"=",
"content",
".",
"node",
"if",
"len",
"(",
"node",
".",
"children",
")",
"and",
"node",
".",
"hasText",
"(",
")",
":",
"return",
"node",
"attributes",
"=",
"AttrList",
"(",
"nod... | [
67,
4
] | [
102,
31
] | python | en | ['en', 'error', 'th'] | False |
Core.append_attributes | (self, content) |
Append attribute nodes into L{Content.data}.
Attributes in the I{schema} or I{xml} namespaces are skipped.
@param content: The current content being unmarshalled.
@type content: L{Content}
|
Append attribute nodes into L{Content.data}.
Attributes in the I{schema} or I{xml} namespaces are skipped.
| def append_attributes(self, content):
"""
Append attribute nodes into L{Content.data}.
Attributes in the I{schema} or I{xml} namespaces are skipped.
@param content: The current content being unmarshalled.
@type content: L{Content}
"""
attributes = AttrList(content... | [
"def",
"append_attributes",
"(",
"self",
",",
"content",
")",
":",
"attributes",
"=",
"AttrList",
"(",
"content",
".",
"node",
".",
"attributes",
")",
"for",
"attr",
"in",
"attributes",
".",
"real",
"(",
")",
":",
"name",
"=",
"attr",
".",
"name",
"val... | [
104,
4
] | [
115,
55
] | python | en | ['en', 'error', 'th'] | False |
Core.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",
")",
":",
"key",
"=",
"name",
"key",
"=",
"'_%s'",
"%",
"reserved",
".",
"get",
"(",
"key",
",",
"key",
")",
"setattr",
"(",
"content",
".",
"data",
",",
"key",
",",... | [
117,
4
] | [
129,
41
] | python | en | ['en', 'error', 'th'] | False |
Core.append_children | (self, content) |
Append child nodes into L{Content.data}
@param content: The current content being unmarshalled.
@type content: L{Content}
|
Append child nodes into L{Content.data}
| def append_children(self, content):
"""
Append child nodes into L{Content.data}
@param content: The current content being unmarshalled.
@type content: L{Content}
"""
for child in content.node:
cont = Content(child)
cval = self.append(cont)
... | [
"def",
"append_children",
"(",
"self",
",",
"content",
")",
":",
"for",
"child",
"in",
"content",
".",
"node",
":",
"cont",
"=",
"Content",
"(",
"child",
")",
"cval",
"=",
"self",
".",
"append",
"(",
"cont",
")",
"key",
"=",
"reserved",
".",
"get",
... | [
131,
4
] | [
154,
48
] | python | en | ['en', 'error', 'th'] | False |
Core.append_text | (self, content) |
Append text nodes into L{Content.data}
@param content: The current content being unmarshalled.
@type content: L{Content}
|
Append text nodes into L{Content.data}
| def append_text(self, content):
"""
Append text nodes into L{Content.data}
@param content: The current content being unmarshalled.
@type content: L{Content}
"""
if content.node.hasText():
content.text = content.node.getText() | [
"def",
"append_text",
"(",
"self",
",",
"content",
")",
":",
"if",
"content",
".",
"node",
".",
"hasText",
"(",
")",
":",
"content",
".",
"text",
"=",
"content",
".",
"node",
".",
"getText",
"(",
")"
] | [
156,
4
] | [
163,
49
] | python | en | ['en', 'error', 'th'] | False |
Core.start | (self, content) |
Processing on I{node} has started. Build and return
the proper object.
@param content: The current content being unmarshalled.
@type content: L{Content}
@return: A subclass of Object.
@rtype: L{Object}
|
Processing on I{node} has started. Build and return
the proper object.
| def start(self, content):
"""
Processing on I{node} has started. Build and return
the proper object.
@param content: The current content being unmarshalled.
@type content: L{Content}
@return: A subclass of Object.
@rtype: L{Object}
"""
content.dat... | [
"def",
"start",
"(",
"self",
",",
"content",
")",
":",
"content",
".",
"data",
"=",
"Factory",
".",
"object",
"(",
"content",
".",
"node",
".",
"name",
")"
] | [
168,
4
] | [
177,
56
] | python | en | ['en', 'error', 'th'] | False |
Core.end | (self, content) |
Processing on I{node} has ended.
@param content: The current content being unmarshalled.
@type content: L{Content}
|
Processing on I{node} has ended.
| def end(self, content):
"""
Processing on I{node} has ended.
@param content: The current content being unmarshalled.
@type content: L{Content}
"""
pass | [
"def",
"end",
"(",
"self",
",",
"content",
")",
":",
"pass"
] | [
179,
4
] | [
185,
12
] | python | en | ['en', 'error', 'th'] | False |
Core.bounded | (self, content) |
Get whether the content is bounded (not a list).
@param content: The current content being unmarshalled.
@type content: L{Content}
@return: True if bounded, else False
@rtype: boolean
|
Get whether the content is bounded (not a list).
| def bounded(self, content):
"""
Get whether the content is bounded (not a list).
@param content: The current content being unmarshalled.
@type content: L{Content}
@return: True if bounded, else False
@rtype: boolean
'"""
return ( not self.unbounded(content... | [
"def",
"bounded",
"(",
"self",
",",
"content",
")",
":",
"return",
"(",
"not",
"self",
".",
"unbounded",
"(",
"content",
")",
")"
] | [
187,
4
] | [
195,
46
] | python | en | ['en', 'error', 'th'] | False |
Core.unbounded | (self, content) |
Get whether the object is unbounded (a list).
@param content: The current content being unmarshalled.
@type content: L{Content}
@return: True if unbounded, else False
@rtype: boolean
|
Get whether the object is unbounded (a list).
| def unbounded(self, content):
"""
Get whether the object is unbounded (a list).
@param content: The current content being unmarshalled.
@type content: L{Content}
@return: True if unbounded, else False
@rtype: boolean
'"""
return False | [
"def",
"unbounded",
"(",
"self",
",",
"content",
")",
":",
"return",
"False"
] | [
197,
4
] | [
205,
20
] | python | en | ['en', 'error', 'th'] | False |
Core.nillable | (self, content) |
Get whether the object is nillable.
@param content: The current content being unmarshalled.
@type content: L{Content}
@return: True if nillable, else False
@rtype: boolean
|
Get whether the object is nillable.
| def nillable(self, content):
"""
Get whether the object is nillable.
@param content: The current content being unmarshalled.
@type content: L{Content}
@return: True if nillable, else False
@rtype: boolean
'"""
return False | [
"def",
"nillable",
"(",
"self",
",",
"content",
")",
":",
"return",
"False"
] | [
207,
4
] | [
215,
20
] | python | en | ['en', 'error', 'th'] | False |
_hash_dict | (d) | Return a stable sha224 of a dictionary. | Return a stable sha224 of a dictionary. | def _hash_dict(d):
# type: (Dict[str, str]) -> str
"""Return a stable sha224 of a dictionary."""
s = json.dumps(d, sort_keys=True, separators=(",", ":"), ensure_ascii=True)
return hashlib.sha224(s.encode("ascii")).hexdigest() | [
"def",
"_hash_dict",
"(",
"d",
")",
":",
"# type: (Dict[str, str]) -> str",
"s",
"=",
"json",
".",
"dumps",
"(",
"d",
",",
"sort_keys",
"=",
"True",
",",
"separators",
"=",
"(",
"\",\"",
",",
"\":\"",
")",
",",
"ensure_ascii",
"=",
"True",
")",
"return",... | [
28,
0
] | [
32,
56
] | python | en | ['en', 'en', 'en'] | True |
Cache._get_cache_path_parts_legacy | (self, link) | Get parts of part that must be os.path.joined with cache_dir
Legacy cache key (pip < 20) for compatibility with older caches.
| Get parts of part that must be os.path.joined with cache_dir | def _get_cache_path_parts_legacy(self, link):
# type: (Link) -> List[str]
"""Get parts of part that must be os.path.joined with cache_dir
Legacy cache key (pip < 20) for compatibility with older caches.
"""
# We want to generate an url to use as our cache key, we don't want to
... | [
"def",
"_get_cache_path_parts_legacy",
"(",
"self",
",",
"link",
")",
":",
"# type: (Link) -> List[str]",
"# We want to generate an url to use as our cache key, we don't want to",
"# just re-use the URL because it might have other items in the fragment",
"# and we don't care about those.",
"... | [
57,
4
] | [
83,
20
] | python | en | ['en', 'en', 'en'] | True |
Cache._get_cache_path_parts | (self, link) | Get parts of part that must be os.path.joined with cache_dir
| Get parts of part that must be os.path.joined with cache_dir
| def _get_cache_path_parts(self, link):
# type: (Link) -> List[str]
"""Get parts of part that must be os.path.joined with cache_dir
"""
# We want to generate an url to use as our cache key, we don't want to
# just re-use the URL because it might have other items in the fragment
... | [
"def",
"_get_cache_path_parts",
"(",
"self",
",",
"link",
")",
":",
"# type: (Link) -> List[str]",
"# We want to generate an url to use as our cache key, we don't want to",
"# just re-use the URL because it might have other items in the fragment",
"# and we don't care about those.",
"key_par... | [
85,
4
] | [
118,
20
] | python | en | ['en', 'en', 'en'] | True |
Cache.get_path_for_link | (self, link) | Return a directory to store cached items in for link.
| Return a directory to store cached items in for link.
| def get_path_for_link(self, link):
# type: (Link) -> str
"""Return a directory to store cached items in for link.
"""
raise NotImplementedError() | [
"def",
"get_path_for_link",
"(",
"self",
",",
"link",
")",
":",
"# type: (Link) -> str",
"raise",
"NotImplementedError",
"(",
")"
] | [
152,
4
] | [
156,
35
] | python | en | ['en', 'en', 'en'] | True |
Cache.get | (
self,
link, # type: Link
package_name, # type: Optional[str]
supported_tags, # type: List[Tag]
) | Returns a link to a cached item if it exists, otherwise returns the
passed link.
| Returns a link to a cached item if it exists, otherwise returns the
passed link.
| def get(
self,
link, # type: Link
package_name, # type: Optional[str]
supported_tags, # type: List[Tag]
):
# type: (...) -> Link
"""Returns a link to a cached item if it exists, otherwise returns the
passed link.
"""
raise NotImp... | [
"def",
"get",
"(",
"self",
",",
"link",
",",
"# type: Link",
"package_name",
",",
"# type: Optional[str]",
"supported_tags",
",",
"# type: List[Tag]",
")",
":",
"# type: (...) -> Link",
"raise",
"NotImplementedError",
"(",
")"
] | [
158,
4
] | [
168,
35
] | python | en | ['en', 'en', 'en'] | True |
SimpleWheelCache.get_path_for_link | (self, link) | Return a directory to store cached wheels for link
Because there are M wheels for any one sdist, we provide a directory
to cache them in, and then consult that directory when looking up
cache hits.
We only insert things into the cache if they have plausible version
numbers, so ... | Return a directory to store cached wheels for link | def get_path_for_link(self, link):
# type: (Link) -> str
"""Return a directory to store cached wheels for link
Because there are M wheels for any one sdist, we provide a directory
to cache them in, and then consult that directory when looking up
cache hits.
We only inse... | [
"def",
"get_path_for_link",
"(",
"self",
",",
"link",
")",
":",
"# type: (Link) -> str",
"parts",
"=",
"self",
".",
"_get_cache_path_parts",
"(",
"link",
")",
"assert",
"self",
".",
"cache_dir",
"# Store wheels within the root cache_dir",
"return",
"os",
".",
"path"... | [
187,
4
] | [
206,
61
] | python | en | ['en', 'en', 'en'] | True |
WheelCache.get_cache_entry | (
self,
link, # type: Link
package_name, # type: Optional[str]
supported_tags, # type: List[Tag]
) | Returns a CacheEntry with a link to a cached item if it exists or
None. The cache entry indicates if the item was found in the persistent
or ephemeral cache.
| Returns a CacheEntry with a link to a cached item if it exists or
None. The cache entry indicates if the item was found in the persistent
or ephemeral cache.
| def get_cache_entry(
self,
link, # type: Link
package_name, # type: Optional[str]
supported_tags, # type: List[Tag]
):
# type: (...) -> Optional[CacheEntry]
"""Returns a CacheEntry with a link to a cached item if it exists or
None. The cache ent... | [
"def",
"get_cache_entry",
"(",
"self",
",",
"link",
",",
"# type: Link",
"package_name",
",",
"# type: Optional[str]",
"supported_tags",
",",
"# type: List[Tag]",
")",
":",
"# type: (...) -> Optional[CacheEntry]",
"retval",
"=",
"self",
".",
"_wheel_cache",
".",
"get",
... | [
318,
4
] | [
345,
19
] | python | en | ['en', 'en', 'en'] | True |
BaseRunner._prepare_runnable_before_enqueue | (
self,
runnable: RunnableObject,
) |
Подготовка запускаемого объекта к работе.
В данной точке расширения можно пропатчить объект через публичные методы
|
Подготовка запускаемого объекта к работе. | def _prepare_runnable_before_enqueue(
self,
runnable: RunnableObject,
):
"""
Подготовка запускаемого объекта к работе.
В данной точке расширения можно пропатчить объект через публичные методы
"""
if isinstance(runnable, GlobalHelperMixin):
runnabl... | [
"def",
"_prepare_runnable_before_enqueue",
"(",
"self",
",",
"runnable",
":",
"RunnableObject",
",",
")",
":",
"if",
"isinstance",
"(",
"runnable",
",",
"GlobalHelperMixin",
")",
":",
"runnable",
".",
"set_global_helper",
"(",
"global_helper",
"=",
"self",
".",
... | [
48,
4
] | [
60,
13
] | python | en | ['en', 'error', 'th'] | False |
BaseRunner.enqueue | (
self,
runnable: RunnableObject,
*args,
**kwargs,
) |
Добавление задачи на выполнение функции в очередь
|
Добавление задачи на выполнение функции в очередь
| def enqueue(
self,
runnable: RunnableObject,
*args,
**kwargs,
):
"""
Добавление задачи на выполнение функции в очередь
"""
self._prepare_runnable_before_enqueue(
runnable=runnable,
)
self._queue.append(runnable) | [
"def",
"enqueue",
"(",
"self",
",",
"runnable",
":",
"RunnableObject",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
",",
")",
":",
"self",
".",
"_prepare_runnable_before_enqueue",
"(",
"runnable",
"=",
"runnable",
",",
")",
"self",
".",
"_queue",
".",
"app... | [
62,
4
] | [
75,
36
] | python | en | ['en', 'error', 'th'] | False |
BaseRunner.run | (self, *args, **kwargs) |
Выполнение всех задач стоящих в очереди
|
Выполнение всех задач стоящих в очереди
| def run(self, *args, **kwargs):
"""
Выполнение всех задач стоящих в очереди
"""
self.validate()
if self.result.has_not_errors:
while self._queue:
runnable: RunnableObject = (
self._queue.popleft()
)
... | [
"def",
"run",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"validate",
"(",
")",
"if",
"self",
".",
"result",
".",
"has_not_errors",
":",
"while",
"self",
".",
"_queue",
":",
"runnable",
":",
"RunnableObject",
"=",
... | [
77,
4
] | [
95,
58
] | python | en | ['en', 'error', 'th'] | False |
LazySavingRunner._do_save_objects_queue | (self) |
Запуск сохранения у выполняемых объектов
|
Запуск сохранения у выполняемых объектов
| def _do_save_objects_queue(self):
"""
Запуск сохранения у выполняемых объектов
"""
while self._queue_to_save:
runnable: LazySavingRunnableObject = self._queue_to_save.popleft()
runnable.do_save() | [
"def",
"_do_save_objects_queue",
"(",
"self",
")",
":",
"while",
"self",
".",
"_queue_to_save",
":",
"runnable",
":",
"LazySavingRunnableObject",
"=",
"self",
".",
"_queue_to_save",
".",
"popleft",
"(",
")",
"runnable",
".",
"do_save",
"(",
")"
] | [
110,
4
] | [
116,
30
] | python | en | ['en', 'error', 'th'] | False |
LazySavingRunner.run | (self, *args, **kwargs) |
Выполнение всех задач стоящих в очереди
|
Выполнение всех задач стоящих в очереди
| def run(self, *args, **kwargs):
"""
Выполнение всех задач стоящих в очереди
"""
self.validate()
if self.result.has_not_errors:
while self._queue:
runnable: RunnableObject = self._queue.popleft()
runnable.before_validate()
... | [
"def",
"run",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"validate",
"(",
")",
"if",
"self",
".",
"result",
".",
"has_not_errors",
":",
"while",
"self",
".",
"_queue",
":",
"runnable",
":",
"RunnableObject",
"=",
... | [
118,
4
] | [
137,
56
] | python | en | ['en', 'error', 'th'] | False |
LazyStrictSavingRunner._get_strict_saving_error | (self) |
Ошибка, которая должна быть возвращена при несоблюдении условий
строгого режима
|
Ошибка, которая должна быть возвращена при несоблюдении условий
строгого режима
| def _get_strict_saving_error(self) -> BaseError:
"""
Ошибка, которая должна быть возвращена при несоблюдении условий
строгого режима
"""
return BaseError() | [
"def",
"_get_strict_saving_error",
"(",
"self",
")",
"->",
"BaseError",
":",
"return",
"BaseError",
"(",
")"
] | [
152,
4
] | [
157,
26
] | python | en | ['en', 'error', 'th'] | False |
LazyStrictSavingRunner.run | (self, *args, **kwargs) |
Выполнение всех задач стоящих в очереди
|
Выполнение всех задач стоящих в очереди
| def run(self, *args, **kwargs):
"""
Выполнение всех задач стоящих в очереди
"""
self.before_validate()
self.validate()
self.after_validate()
if self.result.has_not_errors:
queue_length = len(self._queue)
while self._queue:
... | [
"def",
"run",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"before_validate",
"(",
")",
"self",
".",
"validate",
"(",
")",
"self",
".",
"after_validate",
"(",
")",
"if",
"self",
".",
"result",
".",
"has_not_errors",
... | [
159,
4
] | [
191,
43
] | python | en | ['en', 'error', 'th'] | False |
LazySavingSettableQueueRunner.set_queue | (self, queue_to_save) |
Установка очереди на сохранение
|
Установка очереди на сохранение
| def set_queue(self, queue_to_save):
"""
Установка очереди на сохранение
"""
self._queue_to_save = queue_to_save | [
"def",
"set_queue",
"(",
"self",
",",
"queue_to_save",
")",
":",
"self",
".",
"_queue_to_save",
"=",
"queue_to_save"
] | [
263,
4
] | [
267,
43
] | python | en | ['en', 'error', 'th'] | False |
LazyDelegateSavingSettableQueueRunner.do_save | (self, *args, **kwargs) |
Сохранение делегировано пусковику
|
Сохранение делегировано пусковику
| def do_save(self, *args, **kwargs):
"""
Сохранение делегировано пусковику
""" | [
"def",
"do_save",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":"
] | [
290,
4
] | [
293,
11
] | python | en | ['en', 'error', 'th'] | False |
write_emoticon_data | (
realm_id: int, custom_emoji_data: List[Dict[str, Any]], data_dir: str, output_dir: str
) |
This function does most of the work for processing emoticons, the bulk
of which is copying files. We also write a json file with metadata.
Finally, we return a list of RealmEmoji dicts to our caller.
In our data_dir we have a pretty simple setup:
The exported JSON file will have emoji rows i... |
This function does most of the work for processing emoticons, the bulk
of which is copying files. We also write a json file with metadata.
Finally, we return a list of RealmEmoji dicts to our caller. | def write_emoticon_data(
realm_id: int, custom_emoji_data: List[Dict[str, Any]], data_dir: str, output_dir: str
) -> List[ZerverFieldsT]:
"""
This function does most of the work for processing emoticons, the bulk
of which is copying files. We also write a json file with metadata.
Finally, we return... | [
"def",
"write_emoticon_data",
"(",
"realm_id",
":",
"int",
",",
"custom_emoji_data",
":",
"List",
"[",
"Dict",
"[",
"str",
",",
"Any",
"]",
"]",
",",
"data_dir",
":",
"str",
",",
"output_dir",
":",
"str",
")",
"->",
"List",
"[",
"ZerverFieldsT",
"]",
"... | [
597,
0
] | [
678,
21
] | python | en | ['en', 'error', 'th'] | False |
PyDialog.__init__ | (self, *args, **kw) | Dialog(database, name, x, y, w, h, attributes, title, first,
default, cancel, bitmap=true) | Dialog(database, name, x, y, w, h, attributes, title, first,
default, cancel, bitmap=true) | def __init__(self, *args, **kw):
"""Dialog(database, name, x, y, w, h, attributes, title, first,
default, cancel, bitmap=true)"""
Dialog.__init__(self, *args)
ruler = self.h - 36
bmwidth = 152*ruler/328
#if kw.get("bitmap", True):
# self.bitmap("Bitmap", 0, 0, ... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"Dialog",
".",
"__init__",
"(",
"self",
",",
"*",
"args",
")",
"ruler",
"=",
"self",
".",
"h",
"-",
"36",
"bmwidth",
"=",
"152",
"*",
"ruler",
"/",
"328",
"#if kw.... | [
26,
4
] | [
34,
52
] | python | en | ['en', 'en', 'pl'] | True |
PyDialog.title | (self, title) | Set the title text of the dialog at the top. | Set the title text of the dialog at the top. | def title(self, title):
"Set the title text of the dialog at the top."
# name, x, y, w, h, flags=Visible|Enabled|Transparent|NoPrefix,
# text, in VerdanaBold10
self.text("Title", 15, 10, 320, 60, 0x30003,
r"{\VerdanaBold10}%s" % title) | [
"def",
"title",
"(",
"self",
",",
"title",
")",
":",
"# name, x, y, w, h, flags=Visible|Enabled|Transparent|NoPrefix,",
"# text, in VerdanaBold10",
"self",
".",
"text",
"(",
"\"Title\"",
",",
"15",
",",
"10",
",",
"320",
",",
"60",
",",
"0x30003",
",",
"r\"{\\Verd... | [
36,
4
] | [
41,
48
] | python | en | ['en', 'en', 'en'] | True |
PyDialog.back | (self, title, next, name = "Back", active = 1) | Add a back button with a given title, the tab-next button,
its name in the Control table, possibly initially disabled.
Return the button, so that events can be associated | Add a back button with a given title, the tab-next button,
its name in the Control table, possibly initially disabled. | def back(self, title, next, name = "Back", active = 1):
"""Add a back button with a given title, the tab-next button,
its name in the Control table, possibly initially disabled.
Return the button, so that events can be associated"""
if active:
flags = 3 # Visible|Enabled
... | [
"def",
"back",
"(",
"self",
",",
"title",
",",
"next",
",",
"name",
"=",
"\"Back\"",
",",
"active",
"=",
"1",
")",
":",
"if",
"active",
":",
"flags",
"=",
"3",
"# Visible|Enabled",
"else",
":",
"flags",
"=",
"1",
"# Visible",
"return",
"self",
".",
... | [
43,
4
] | [
52,
81
] | python | en | ['en', 'en', 'en'] | True |
PyDialog.cancel | (self, title, next, name = "Cancel", active = 1) | Add a cancel button with a given title, the tab-next button,
its name in the Control table, possibly initially disabled.
Return the button, so that events can be associated | Add a cancel button with a given title, the tab-next button,
its name in the Control table, possibly initially disabled. | def cancel(self, title, next, name = "Cancel", active = 1):
"""Add a cancel button with a given title, the tab-next button,
its name in the Control table, possibly initially disabled.
Return the button, so that events can be associated"""
if active:
flags = 3 # Visible|Enabl... | [
"def",
"cancel",
"(",
"self",
",",
"title",
",",
"next",
",",
"name",
"=",
"\"Cancel\"",
",",
"active",
"=",
"1",
")",
":",
"if",
"active",
":",
"flags",
"=",
"3",
"# Visible|Enabled",
"else",
":",
"flags",
"=",
"1",
"# Visible",
"return",
"self",
".... | [
54,
4
] | [
63,
80
] | python | en | ['en', 'en', 'en'] | True |
PyDialog.next | (self, title, next, name = "Next", active = 1) | Add a Next button with a given title, the tab-next button,
its name in the Control table, possibly initially disabled.
Return the button, so that events can be associated | Add a Next button with a given title, the tab-next button,
its name in the Control table, possibly initially disabled. | def next(self, title, next, name = "Next", active = 1):
"""Add a Next button with a given title, the tab-next button,
its name in the Control table, possibly initially disabled.
Return the button, so that events can be associated"""
if active:
flags = 3 # Visible|Enabled
... | [
"def",
"next",
"(",
"self",
",",
"title",
",",
"next",
",",
"name",
"=",
"\"Next\"",
",",
"active",
"=",
"1",
")",
":",
"if",
"active",
":",
"flags",
"=",
"3",
"# Visible|Enabled",
"else",
":",
"flags",
"=",
"1",
"# Visible",
"return",
"self",
".",
... | [
65,
4
] | [
74,
80
] | python | en | ['en', 'en', 'en'] | True |
PyDialog.xbutton | (self, name, title, next, xpos) | Add a button with a given title, the tab-next button,
its name in the Control table, giving its x position; the
y-position is aligned with the other buttons.
Return the button, so that events can be associated | Add a button with a given title, the tab-next button,
its name in the Control table, giving its x position; the
y-position is aligned with the other buttons. | def xbutton(self, name, title, next, xpos):
"""Add a button with a given title, the tab-next button,
its name in the Control table, giving its x position; the
y-position is aligned with the other buttons.
Return the button, so that events can be associated"""
return self.pushbut... | [
"def",
"xbutton",
"(",
"self",
",",
"name",
",",
"title",
",",
"next",
",",
"xpos",
")",
":",
"return",
"self",
".",
"pushbutton",
"(",
"name",
",",
"int",
"(",
"self",
".",
"w",
"*",
"xpos",
"-",
"28",
")",
",",
"self",
".",
"h",
"-",
"27",
... | [
76,
4
] | [
82,
94
] | python | en | ['en', 'en', 'en'] | True |
bdist_msi.add_find_python | (self) | Adds code to the installer to compute the location of Python.
Properties PYTHON.MACHINE.X.Y and PYTHON.USER.X.Y will be set from the
registry for each version of Python.
Properties TARGETDIRX.Y will be set from PYTHON.USER.X.Y if defined,
else from PYTHON.MACHINE.X.Y.
Properti... | Adds code to the installer to compute the location of Python. | def add_find_python(self):
"""Adds code to the installer to compute the location of Python.
Properties PYTHON.MACHINE.X.Y and PYTHON.USER.X.Y will be set from the
registry for each version of Python.
Properties TARGETDIRX.Y will be set from PYTHON.USER.X.Y if defined,
else from... | [
"def",
"add_find_python",
"(",
"self",
")",
":",
"start",
"=",
"402",
"for",
"ver",
"in",
"self",
".",
"versions",
":",
"install_path",
"=",
"r\"SOFTWARE\\Python\\PythonCore\\%s\\InstallPath\"",
"%",
"ver",
"machine_reg",
"=",
"\"python.machine.\"",
"+",
"ver",
"u... | [
330,
4
] | [
382,
30
] | python | en | ['en', 'en', 'en'] | True |
create_main_parser | () | Creates and returns the main parser for pip's CLI
| Creates and returns the main parser for pip's CLI
| def create_main_parser():
# type: () -> ConfigOptionParser
"""Creates and returns the main parser for pip's CLI
"""
parser_kw = {
'usage': '\n%prog <command> [options]',
'add_help_option': False,
'formatter': UpdatingDefaultsHelpFormatter(),
'name': 'global',
'pr... | [
"def",
"create_main_parser",
"(",
")",
":",
"# type: () -> ConfigOptionParser",
"parser_kw",
"=",
"{",
"'usage'",
":",
"'\\n%prog <command> [options]'",
",",
"'add_help_option'",
":",
"False",
",",
"'formatter'",
":",
"UpdatingDefaultsHelpFormatter",
"(",
")",
",",
"'na... | [
23,
0
] | [
55,
17
] | python | en | ['en', 'en', 'en'] | True |
MessagePOSTTest.test_message_to_stream_by_name | (self) |
Sending a message to a stream to which you are subscribed is
successful.
|
Sending a message to a stream to which you are subscribed is
successful.
| def test_message_to_stream_by_name(self) -> None:
"""
Sending a message to a stream to which you are subscribed is
successful.
"""
self.login("hamlet")
result = self.client_post(
"/json/messages",
{
"type": "stream",
... | [
"def",
"test_message_to_stream_by_name",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"login",
"(",
"\"hamlet\"",
")",
"result",
"=",
"self",
".",
"client_post",
"(",
"\"/json/messages\"",
",",
"{",
"\"type\"",
":",
"\"stream\"",
",",
"\"to\"",
":",
"\"... | [
83,
4
] | [
99,
40
] | python | en | ['en', 'error', 'th'] | False |
MessagePOSTTest.test_api_message_to_stream_by_name | (self) |
Same as above, but for the API view
|
Same as above, but for the API view
| def test_api_message_to_stream_by_name(self) -> None:
"""
Same as above, but for the API view
"""
user = self.example_user("hamlet")
result = self.api_post(
user,
"/api/v1/messages",
{
"type": "stream",
"to": "Ve... | [
"def",
"test_api_message_to_stream_by_name",
"(",
"self",
")",
"->",
"None",
":",
"user",
"=",
"self",
".",
"example_user",
"(",
"\"hamlet\"",
")",
"result",
"=",
"self",
".",
"api_post",
"(",
"user",
",",
"\"/api/v1/messages\"",
",",
"{",
"\"type\"",
":",
"... | [
101,
4
] | [
117,
40
] | python | en | ['en', 'error', 'th'] | False |
MessagePOSTTest.test_message_to_stream_by_id | (self) |
Sending a message to a stream (by stream ID) to which you are
subscribed is successful.
|
Sending a message to a stream (by stream ID) to which you are
subscribed is successful.
| def test_message_to_stream_by_id(self) -> None:
"""
Sending a message to a stream (by stream ID) to which you are
subscribed is successful.
"""
self.login("hamlet")
realm = get_realm("zulip")
stream = get_stream("Verona", realm)
result = self.client_post(
... | [
"def",
"test_message_to_stream_by_id",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"login",
"(",
"\"hamlet\"",
")",
"realm",
"=",
"get_realm",
"(",
"\"zulip\"",
")",
"stream",
"=",
"get_stream",
"(",
"\"Verona\"",
",",
"realm",
")",
"result",
"=",
"s... | [
145,
4
] | [
165,
71
] | python | en | ['en', 'error', 'th'] | False |
MessagePOSTTest.test_sending_message_as_stream_post_policy_admins | (self) |
Sending messages to streams which only the admins can post to.
|
Sending messages to streams which only the admins can post to.
| def test_sending_message_as_stream_post_policy_admins(self) -> None:
"""
Sending messages to streams which only the admins can post to.
"""
admin_profile = self.example_user("iago")
self.login_user(admin_profile)
stream_name = "Verona"
stream = get_stream(stream_... | [
"def",
"test_sending_message_as_stream_post_policy_admins",
"(",
"self",
")",
"->",
"None",
":",
"admin_profile",
"=",
"self",
".",
"example_user",
"(",
"\"iago\"",
")",
"self",
".",
"login_user",
"(",
"admin_profile",
")",
"stream_name",
"=",
"\"Verona\"",
"stream"... | [
167,
4
] | [
253,
9
] | python | en | ['en', 'error', 'th'] | False |
MessagePOSTTest.test_sending_message_as_stream_post_policy_moderators | (self) |
Sending messages to streams which only the moderators can post to.
|
Sending messages to streams which only the moderators can post to.
| def test_sending_message_as_stream_post_policy_moderators(self) -> None:
"""
Sending messages to streams which only the moderators can post to.
"""
admin_profile = self.example_user("iago")
self.login_user(admin_profile)
stream_name = "Verona"
stream = get_stream... | [
"def",
"test_sending_message_as_stream_post_policy_moderators",
"(",
"self",
")",
"->",
"None",
":",
"admin_profile",
"=",
"self",
".",
"example_user",
"(",
"\"iago\"",
")",
"self",
".",
"login_user",
"(",
"admin_profile",
")",
"stream_name",
"=",
"\"Verona\"",
"str... | [
255,
4
] | [
335,
9
] | python | en | ['en', 'error', 'th'] | False |
MessagePOSTTest.test_sending_message_as_stream_post_policy_restrict_new_members | (self) |
Sending messages to streams which new members cannot post to.
|
Sending messages to streams which new members cannot post to.
| def test_sending_message_as_stream_post_policy_restrict_new_members(self) -> None:
"""
Sending messages to streams which new members cannot post to.
"""
admin_profile = self.example_user("iago")
self.login_user(admin_profile)
do_set_realm_property(admin_profile.realm, "w... | [
"def",
"test_sending_message_as_stream_post_policy_restrict_new_members",
"(",
"self",
")",
"->",
"None",
":",
"admin_profile",
"=",
"self",
".",
"example_user",
"(",
"\"iago\"",
")",
"self",
".",
"login_user",
"(",
"admin_profile",
")",
"do_set_realm_property",
"(",
... | [
337,
4
] | [
439,
9
] | python | en | ['en', 'error', 'th'] | False |
MessagePOSTTest.test_api_message_with_default_to | (self) |
Sending messages without a to field should be sent to the default
stream for the user_profile.
|
Sending messages without a to field should be sent to the default
stream for the user_profile.
| def test_api_message_with_default_to(self) -> None:
"""
Sending messages without a to field should be sent to the default
stream for the user_profile.
"""
user = self.example_user("hamlet")
user.default_sending_stream_id = get_stream("Verona", user.realm).id
user.... | [
"def",
"test_api_message_with_default_to",
"(",
"self",
")",
"->",
"None",
":",
"user",
"=",
"self",
".",
"example_user",
"(",
"\"hamlet\"",
")",
"user",
".",
"default_sending_stream_id",
"=",
"get_stream",
"(",
"\"Verona\"",
",",
"user",
".",
"realm",
")",
".... | [
441,
4
] | [
464,
68
] | python | en | ['en', 'error', 'th'] | False |
MessagePOSTTest.test_message_to_nonexistent_stream | (self) |
Sending a message to a nonexistent stream fails.
|
Sending a message to a nonexistent stream fails.
| def test_message_to_nonexistent_stream(self) -> None:
"""
Sending a message to a nonexistent stream fails.
"""
self.login("hamlet")
self.assertFalse(Stream.objects.filter(name="nonexistent_stream"))
result = self.client_post(
"/json/messages",
{
... | [
"def",
"test_message_to_nonexistent_stream",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"login",
"(",
"\"hamlet\"",
")",
"self",
".",
"assertFalse",
"(",
"Stream",
".",
"objects",
".",
"filter",
"(",
"name",
"=",
"\"nonexistent_stream\"",
")",
")",
"r... | [
466,
4
] | [
482,
84
] | python | en | ['en', 'error', 'th'] | False |
MessagePOSTTest.test_message_to_nonexistent_stream_with_bad_characters | (self) |
Nonexistent stream name with bad characters should be escaped properly.
|
Nonexistent stream name with bad characters should be escaped properly.
| def test_message_to_nonexistent_stream_with_bad_characters(self) -> None:
"""
Nonexistent stream name with bad characters should be escaped properly.
"""
self.login("hamlet")
self.assertFalse(Stream.objects.filter(name="""&<"'><non-existent>"""))
result = self.client_post... | [
"def",
"test_message_to_nonexistent_stream_with_bad_characters",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"login",
"(",
"\"hamlet\"",
")",
"self",
".",
"assertFalse",
"(",
"Stream",
".",
"objects",
".",
"filter",
"(",
"name",
"=",
"\"\"\"&<\"'><non-existe... | [
484,
4
] | [
502,
9
] | 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.