nwo stringlengths 5 106 | sha stringlengths 40 40 | path stringlengths 4 174 | language stringclasses 1
value | identifier stringlengths 1 140 | parameters stringlengths 0 87.7k | argument_list stringclasses 1
value | return_statement stringlengths 0 426k | docstring stringlengths 0 64.3k | docstring_summary stringlengths 0 26.3k | docstring_tokens list | function stringlengths 18 4.83M | function_tokens list | url stringlengths 83 304 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
slgobinath/SafeEyes | 7ef644e6a2ef8541d929d5355a38185ccd138cbd | safeeyes/safeeyes.py | python | SafeEyes.start_break | (self, break_obj) | Pass the break information to break screen. | Pass the break information to break screen. | [
"Pass",
"the",
"break",
"information",
"to",
"break",
"screen",
"."
] | def start_break(self, break_obj):
"""
Pass the break information to break screen.
"""
# Get the HTML widgets content from plugins
widget = self.plugins_manager.get_break_screen_widgets(break_obj)
actions = self.plugins_manager.get_break_screen_tray_actions(break_obj)
... | [
"def",
"start_break",
"(",
"self",
",",
"break_obj",
")",
":",
"# Get the HTML widgets content from plugins",
"widget",
"=",
"self",
".",
"plugins_manager",
".",
"get_break_screen_widgets",
"(",
"break_obj",
")",
"actions",
"=",
"self",
".",
"plugins_manager",
".",
... | https://github.com/slgobinath/SafeEyes/blob/7ef644e6a2ef8541d929d5355a38185ccd138cbd/safeeyes/safeeyes.py#L262-L269 | ||
mgear-dev/mgear | 06ddc26c5adb5eab07ca470c7fafa77404c8a1de | scripts/mgear/maya/shifter/component/guide.py | python | ComponentGuide.addDispCurve | (self, name, centers=[], degree=1) | return icon.connection_display_curve(self.getName(name),
centers,
degree) | Add a display curve object to the guide.
Display curve object is a simple curve to show the connection between
different guide element..
Args:
name (str): Local name of the element.
centers (list of dagNode): List of object to define the curve.
degree (int)... | Add a display curve object to the guide. | [
"Add",
"a",
"display",
"curve",
"object",
"to",
"the",
"guide",
"."
] | def addDispCurve(self, name, centers=[], degree=1):
"""Add a display curve object to the guide.
Display curve object is a simple curve to show the connection between
different guide element..
Args:
name (str): Local name of the element.
centers (list of dagNode)... | [
"def",
"addDispCurve",
"(",
"self",
",",
"name",
",",
"centers",
"=",
"[",
"]",
",",
"degree",
"=",
"1",
")",
":",
"return",
"icon",
".",
"connection_display_curve",
"(",
"self",
".",
"getName",
"(",
"name",
")",
",",
"centers",
",",
"degree",
")"
] | https://github.com/mgear-dev/mgear/blob/06ddc26c5adb5eab07ca470c7fafa77404c8a1de/scripts/mgear/maya/shifter/component/guide.py#L591-L608 | |
isocpp/CppCoreGuidelines | 171fda35972cb0678c26274547be3d5dfaf73156 | scripts/python/cpplint.py | python | FlagCxx14Features | (filename, clean_lines, linenum, error) | Flag those C++14 features that we restrict.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found. | Flag those C++14 features that we restrict. | [
"Flag",
"those",
"C",
"++",
"14",
"features",
"that",
"we",
"restrict",
"."
] | def FlagCxx14Features(filename, clean_lines, linenum, error):
"""Flag those C++14 features that we restrict.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors... | [
"def",
"FlagCxx14Features",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"include",
"=",
"Match",
"(",
"r'\\s*#\\s*include\\s+[<\"]([^<\"]+)[\">]'",
",",
"line",
")",... | https://github.com/isocpp/CppCoreGuidelines/blob/171fda35972cb0678c26274547be3d5dfaf73156/scripts/python/cpplint.py#L6036-L6052 | ||
facebookresearch/detectron2 | cb92ae1763cd7d3777c243f07749574cdaec6cb8 | detectron2/modeling/roi_heads/keypoint_head.py | python | BaseKeypointRCNNHead.layers | (self, x) | Neural network layers that makes predictions from regional input features. | Neural network layers that makes predictions from regional input features. | [
"Neural",
"network",
"layers",
"that",
"makes",
"predictions",
"from",
"regional",
"input",
"features",
"."
] | def layers(self, x):
"""
Neural network layers that makes predictions from regional input features.
"""
raise NotImplementedError | [
"def",
"layers",
"(",
"self",
",",
"x",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/facebookresearch/detectron2/blob/cb92ae1763cd7d3777c243f07749574cdaec6cb8/detectron2/modeling/roi_heads/keypoint_head.py#L207-L211 | ||
exaile/exaile | a7b58996c5c15b3aa7b9975ac13ee8f784ef4689 | xlgui/main.py | python | MainWindow._update_track_information | (self) | Sets track information | Sets track information | [
"Sets",
"track",
"information"
] | def _update_track_information(self):
"""
Sets track information
"""
track = player.PLAYER.current
if not track:
return
self.window.set_title(self.title_formatter.format(track)) | [
"def",
"_update_track_information",
"(",
"self",
")",
":",
"track",
"=",
"player",
".",
"PLAYER",
".",
"current",
"if",
"not",
"track",
":",
"return",
"self",
".",
"window",
".",
"set_title",
"(",
"self",
".",
"title_formatter",
".",
"format",
"(",
"track"... | https://github.com/exaile/exaile/blob/a7b58996c5c15b3aa7b9975ac13ee8f784ef4689/xlgui/main.py#L1020-L1029 | ||
roglew/guppy-proxy | 01df16be71dd9f23d7de415a315821659c29bc63 | guppyproxy/proxy.py | python | ProxyConnection.generate_pem_certificates | (self) | return ret | [] | def generate_pem_certificates(self):
cmd = {
"Command": "GenPEMCerts",
}
result = self.reqrsp_cmd(cmd)
ret = GenPemCertsResult(result["KeyPEMData"], result["CertificatePEMData"])
return ret | [
"def",
"generate_pem_certificates",
"(",
"self",
")",
":",
"cmd",
"=",
"{",
"\"Command\"",
":",
"\"GenPEMCerts\"",
",",
"}",
"result",
"=",
"self",
".",
"reqrsp_cmd",
"(",
"cmd",
")",
"ret",
"=",
"GenPemCertsResult",
"(",
"result",
"[",
"\"KeyPEMData\"",
"]"... | https://github.com/roglew/guppy-proxy/blob/01df16be71dd9f23d7de415a315821659c29bc63/guppyproxy/proxy.py#L960-L966 | |||
pymedusa/Medusa | 1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38 | ext/boto/route53/record.py | python | ResourceRecordSets.__iter__ | (self) | Override the next function to support paging | Override the next function to support paging | [
"Override",
"the",
"next",
"function",
"to",
"support",
"paging"
] | def __iter__(self):
"""Override the next function to support paging"""
results = super(ResourceRecordSets, self).__iter__()
truncated = self.is_truncated
while results:
for obj in results:
yield obj
if self.is_truncated:
self.is_tru... | [
"def",
"__iter__",
"(",
"self",
")",
":",
"results",
"=",
"super",
"(",
"ResourceRecordSets",
",",
"self",
")",
".",
"__iter__",
"(",
")",
"truncated",
"=",
"self",
".",
"is_truncated",
"while",
"results",
":",
"for",
"obj",
"in",
"results",
":",
"yield"... | https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/boto/route53/record.py#L182-L196 | ||
nipy/mindboggle | bc10812979d42e94b8a01ad8f98b4ceae33169e5 | mindboggle/guts/utilities.py | python | list_strings | (string1='', string2='', string3='', string4='') | return string_list | Put strings in a list.
Parameters
----------
string1 : string
string2 : string
string3 : string
string4 : string
Returns
-------
string_list : list of strings
Examples
--------
>>> from mindboggle.guts.utilities import list_strings
>>> string1 = 'a b c'
>>> str... | Put strings in a list. | [
"Put",
"strings",
"in",
"a",
"list",
"."
] | def list_strings(string1='', string2='', string3='', string4=''):
"""
Put strings in a list.
Parameters
----------
string1 : string
string2 : string
string3 : string
string4 : string
Returns
-------
string_list : list of strings
Examples
--------
>>> from mindb... | [
"def",
"list_strings",
"(",
"string1",
"=",
"''",
",",
"string2",
"=",
"''",
",",
"string3",
"=",
"''",
",",
"string4",
"=",
"''",
")",
":",
"string_list",
"=",
"[",
"]",
"if",
"string1",
"and",
"isinstance",
"(",
"string1",
",",
"str",
")",
":",
"... | https://github.com/nipy/mindboggle/blob/bc10812979d42e94b8a01ad8f98b4ceae33169e5/mindboggle/guts/utilities.py#L75-L113 | |
openedx/edx-platform | 68dd185a0ab45862a2a61e0f803d7e03d2be71b5 | lms/djangoapps/discussion/apps.py | python | DiscussionConfig.ready | (self) | Connect handlers to send notifications about discussions. | Connect handlers to send notifications about discussions. | [
"Connect",
"handlers",
"to",
"send",
"notifications",
"about",
"discussions",
"."
] | def ready(self):
"""
Connect handlers to send notifications about discussions.
"""
from .signals import handlers | [
"def",
"ready",
"(",
"self",
")",
":",
"from",
".",
"signals",
"import",
"handlers"
] | https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/lms/djangoapps/discussion/apps.py#L39-L43 | ||
aws-samples/aws-kube-codesuite | ab4e5ce45416b83bffb947ab8d234df5437f4fca | src/networkx/generators/small.py | python | tutte_graph | (create_using=None) | return G | Return the Tutte graph. | Return the Tutte graph. | [
"Return",
"the",
"Tutte",
"graph",
"."
] | def tutte_graph(create_using=None):
"""Return the Tutte graph."""
description = [
"adjacencylist",
"Tutte's Graph",
46,
[[2, 3, 4], [5, 27], [11, 12], [19, 20], [6, 34],
[7, 30], [8, 28], [9, 15], [10, 39], [11, 38],
[40], [13, 40], [14, 36], [15, 16], [35],
... | [
"def",
"tutte_graph",
"(",
"create_using",
"=",
"None",
")",
":",
"description",
"=",
"[",
"\"adjacencylist\"",
",",
"\"Tutte's Graph\"",
",",
"46",
",",
"[",
"[",
"2",
",",
"3",
",",
"4",
"]",
",",
"[",
"5",
",",
"27",
"]",
",",
"[",
"11",
",",
... | https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/networkx/generators/small.py#L433-L450 | |
landlab/landlab | a5dd80b8ebfd03d1ba87ef6c4368c409485f222c | landlab/ca/boundaries/hex_lattice_tectonicizer.py | python | LatticeNormalFault._setup_links_to_update_after_offset | (self, in_footwall) | Create and store array with IDs of links for which to update
transitions after fault offset.
These are: all active boundary links with at least one node in the
footwall, plus the lowest non-boundary links, including the
next-to-lowest vertical links and those angling that are below them... | Create and store array with IDs of links for which to update
transitions after fault offset. | [
"Create",
"and",
"store",
"array",
"with",
"IDs",
"of",
"links",
"for",
"which",
"to",
"update",
"transitions",
"after",
"fault",
"offset",
"."
] | def _setup_links_to_update_after_offset(self, in_footwall):
"""Create and store array with IDs of links for which to update
transitions after fault offset.
These are: all active boundary links with at least one node in the
footwall, plus the lowest non-boundary links, including the
... | [
"def",
"_setup_links_to_update_after_offset",
"(",
"self",
",",
"in_footwall",
")",
":",
"g",
"=",
"self",
".",
"grid",
"lower_active",
"=",
"logical_and",
"(",
"arange",
"(",
"g",
".",
"number_of_links",
")",
"<",
"self",
".",
"first_link_shifted_to",
",",
"g... | https://github.com/landlab/landlab/blob/a5dd80b8ebfd03d1ba87ef6c4368c409485f222c/landlab/ca/boundaries/hex_lattice_tectonicizer.py#L512-L556 | ||
psychopy/psychopy | 01b674094f38d0e0bd51c45a6f66f671d7041696 | psychopy/sound/audioclip.py | python | AudioClip.convertToWAV | (self) | return np.asarray(
self._samples * ((1 << 15) - 1), dtype=np.int16).tobytes() | Get a copy of stored audio samples in WAV PCM format.
Returns
-------
ndarray
Array with the same shapes as `.samples` but in 16-bit WAV PCM
format. | Get a copy of stored audio samples in WAV PCM format. | [
"Get",
"a",
"copy",
"of",
"stored",
"audio",
"samples",
"in",
"WAV",
"PCM",
"format",
"."
] | def convertToWAV(self):
"""Get a copy of stored audio samples in WAV PCM format.
Returns
-------
ndarray
Array with the same shapes as `.samples` but in 16-bit WAV PCM
format.
"""
return np.asarray(
self._samples * ((1 << 15) - 1), dt... | [
"def",
"convertToWAV",
"(",
"self",
")",
":",
"return",
"np",
".",
"asarray",
"(",
"self",
".",
"_samples",
"*",
"(",
"(",
"1",
"<<",
"15",
")",
"-",
"1",
")",
",",
"dtype",
"=",
"np",
".",
"int16",
")",
".",
"tobytes",
"(",
")"
] | https://github.com/psychopy/psychopy/blob/01b674094f38d0e0bd51c45a6f66f671d7041696/psychopy/sound/audioclip.py#L645-L656 | |
rougier/freetype-py | 7cf83720274806aad190e1ea04a5f2c36bcc2501 | freetype/__init__.py | python | Face.select_charmap | ( self, encoding ) | Select a given charmap by its encoding tag (as listed in 'freetype.h').
**Note**:
This function returns an error if no charmap in the face corresponds to
the encoding queried here.
Because many fonts contain more than a single cmap for Unicode
encoding, this function h... | Select a given charmap by its encoding tag (as listed in 'freetype.h'). | [
"Select",
"a",
"given",
"charmap",
"by",
"its",
"encoding",
"tag",
"(",
"as",
"listed",
"in",
"freetype",
".",
"h",
")",
"."
] | def select_charmap( self, encoding ):
'''
Select a given charmap by its encoding tag (as listed in 'freetype.h').
**Note**:
This function returns an error if no charmap in the face corresponds to
the encoding queried here.
Because many fonts contain more than a s... | [
"def",
"select_charmap",
"(",
"self",
",",
"encoding",
")",
":",
"error",
"=",
"FT_Select_Charmap",
"(",
"self",
".",
"_FT_Face",
",",
"encoding",
")",
"if",
"error",
":",
"raise",
"FT_Exception",
"(",
"error",
")"
] | https://github.com/rougier/freetype-py/blob/7cf83720274806aad190e1ea04a5f2c36bcc2501/freetype/__init__.py#L1312-L1327 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/openshift_logging/library/openshift_logging_facts.py | python | OpenshiftLoggingFacts.facts_for_configmaps | (self, namespace) | Gathers facts for configmaps in logging namespace | Gathers facts for configmaps in logging namespace | [
"Gathers",
"facts",
"for",
"configmaps",
"in",
"logging",
"namespace"
] | def facts_for_configmaps(self, namespace):
''' Gathers facts for configmaps in logging namespace '''
self.default_keys_for("configmaps")
a_list = self.oc_command("get", "configmaps", namespace=namespace)
if len(a_list["items"]) == 0:
return
for item in a_list["items"]... | [
"def",
"facts_for_configmaps",
"(",
"self",
",",
"namespace",
")",
":",
"self",
".",
"default_keys_for",
"(",
"\"configmaps\"",
")",
"a_list",
"=",
"self",
".",
"oc_command",
"(",
"\"get\"",
",",
"\"configmaps\"",
",",
"namespace",
"=",
"namespace",
")",
"if",... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/openshift_logging/library/openshift_logging_facts.py#L218-L231 | ||
wbond/packagecontrol.io | 9f5eb7e3392e6bc2ad979ad32d3dd27ef9c00b20 | app/lib/package_control/deps/asn1crypto/x509.py | python | Certificate.ocsp_no_check_value | (self) | return self._ocsp_no_check_value | This extension is used on certificates of OCSP responders, indicating
that revocation information for the certificate should never need to
be verified, thus preventing possible loops in path validation.
:return:
None or a Null object (if present) | This extension is used on certificates of OCSP responders, indicating
that revocation information for the certificate should never need to
be verified, thus preventing possible loops in path validation. | [
"This",
"extension",
"is",
"used",
"on",
"certificates",
"of",
"OCSP",
"responders",
"indicating",
"that",
"revocation",
"information",
"for",
"the",
"certificate",
"should",
"never",
"need",
"to",
"be",
"verified",
"thus",
"preventing",
"possible",
"loops",
"in",... | def ocsp_no_check_value(self):
"""
This extension is used on certificates of OCSP responders, indicating
that revocation information for the certificate should never need to
be verified, thus preventing possible loops in path validation.
:return:
None or a Null objec... | [
"def",
"ocsp_no_check_value",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_processed_extensions",
":",
"self",
".",
"_set_extensions",
"(",
")",
"return",
"self",
".",
"_ocsp_no_check_value"
] | https://github.com/wbond/packagecontrol.io/blob/9f5eb7e3392e6bc2ad979ad32d3dd27ef9c00b20/app/lib/package_control/deps/asn1crypto/x509.py#L2484-L2496 | |
OmniSharp/omnisharp-sublime | 19baf3c4d350193af0f8da1ae5a8df0fa6cded61 | lib/urllib3/util/timeout.py | python | Timeout.start_connect | (self) | return self._start_connect | Start the timeout clock, used during a connect() attempt
:raises urllib3.exceptions.TimeoutStateError: if you attempt
to start a timer that has been started already. | Start the timeout clock, used during a connect() attempt | [
"Start",
"the",
"timeout",
"clock",
"used",
"during",
"a",
"connect",
"()",
"attempt"
] | def start_connect(self):
""" Start the timeout clock, used during a connect() attempt
:raises urllib3.exceptions.TimeoutStateError: if you attempt
to start a timer that has been started already.
"""
if self._start_connect is not None:
raise TimeoutStateError("Tim... | [
"def",
"start_connect",
"(",
"self",
")",
":",
"if",
"self",
".",
"_start_connect",
"is",
"not",
"None",
":",
"raise",
"TimeoutStateError",
"(",
"\"Timeout timer has already been started.\"",
")",
"self",
".",
"_start_connect",
"=",
"current_time",
"(",
")",
"retu... | https://github.com/OmniSharp/omnisharp-sublime/blob/19baf3c4d350193af0f8da1ae5a8df0fa6cded61/lib/urllib3/util/timeout.py#L169-L178 | |
mdiazcl/fuzzbunch-debian | 2b76c2249ade83a389ae3badb12a1bd09901fd2c | windows/fuzzbunch/plugin.py | python | Plugin.isHiddenParameter | (self, name) | return False | Given a parameter name, is that parameter hidden? | Given a parameter name, is that parameter hidden? | [
"Given",
"a",
"parameter",
"name",
"is",
"that",
"parameter",
"hidden?"
] | def isHiddenParameter(self, name):
"""Given a parameter name, is that parameter hidden?"""
param = self.getParameter(name)
if self.isParameter(name):
return param.isHidden()
return False | [
"def",
"isHiddenParameter",
"(",
"self",
",",
"name",
")",
":",
"param",
"=",
"self",
".",
"getParameter",
"(",
"name",
")",
"if",
"self",
".",
"isParameter",
"(",
"name",
")",
":",
"return",
"param",
".",
"isHidden",
"(",
")",
"return",
"False"
] | https://github.com/mdiazcl/fuzzbunch-debian/blob/2b76c2249ade83a389ae3badb12a1bd09901fd2c/windows/fuzzbunch/plugin.py#L189-L194 | |
Drakkar-Software/OctoBot | c80ed2270e5d085994213955c0f56b9e3b70b476 | octobot/logger.py | python | init_octobot_chan_logger | (bot_id: str) | [] | async def init_octobot_chan_logger(bot_id: str):
await channel_instances.get_chan_at_id(constants.OCTOBOT_CHANNEL, bot_id).new_consumer(
octobot_channel_callback,
priority_level=LOGGER_PRIORITY_LEVEL,
bot_id=bot_id,
subject=[enums.OctoBotChannelSubjects.NOTIFICATION.value, enums.Octo... | [
"async",
"def",
"init_octobot_chan_logger",
"(",
"bot_id",
":",
"str",
")",
":",
"await",
"channel_instances",
".",
"get_chan_at_id",
"(",
"constants",
".",
"OCTOBOT_CHANNEL",
",",
"bot_id",
")",
".",
"new_consumer",
"(",
"octobot_channel_callback",
",",
"priority_l... | https://github.com/Drakkar-Software/OctoBot/blob/c80ed2270e5d085994213955c0f56b9e3b70b476/octobot/logger.py#L170-L176 | ||||
ethereum/trinity | 6383280c5044feb06695ac2f7bc1100b7bcf4fe0 | trinity/config.py | python | TrinityConfig.__init__ | (self,
network_id: int,
app_identifier: str = "",
genesis_config: Dict[str, Any] = None,
max_peers: int = 25,
trinity_root_dir: Path = None,
trinity_tmp_root_dir: bool = False,
data_dir: Path = None,
... | [] | def __init__(self,
network_id: int,
app_identifier: str = "",
genesis_config: Dict[str, Any] = None,
max_peers: int = 25,
trinity_root_dir: Path = None,
trinity_tmp_root_dir: bool = False,
data_dir: Pa... | [
"def",
"__init__",
"(",
"self",
",",
"network_id",
":",
"int",
",",
"app_identifier",
":",
"str",
"=",
"\"\"",
",",
"genesis_config",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
"=",
"None",
",",
"max_peers",
":",
"int",
"=",
"25",
",",
"trinity_root_dir... | https://github.com/ethereum/trinity/blob/6383280c5044feb06695ac2f7bc1100b7bcf4fe0/trinity/config.py#L278-L336 | ||||
PrefectHQ/prefect | 67bdc94e2211726d99561f6f52614bec8970e981 | src/prefect/_version.py | python | render | (pieces, style) | return {
"version": rendered,
"full-revisionid": pieces["long"],
"dirty": pieces["dirty"],
"error": None,
"date": pieces.get("date"),
} | Render the given version pieces into the requested style. | Render the given version pieces into the requested style. | [
"Render",
"the",
"given",
"version",
"pieces",
"into",
"the",
"requested",
"style",
"."
] | def render(pieces, style):
"""Render the given version pieces into the requested style."""
if pieces["error"]:
return {
"version": "unknown",
"full-revisionid": pieces.get("long"),
"dirty": None,
"error": pieces["error"],
"date": None,
... | [
"def",
"render",
"(",
"pieces",
",",
"style",
")",
":",
"if",
"pieces",
"[",
"\"error\"",
"]",
":",
"return",
"{",
"\"version\"",
":",
"\"unknown\"",
",",
"\"full-revisionid\"",
":",
"pieces",
".",
"get",
"(",
"\"long\"",
")",
",",
"\"dirty\"",
":",
"Non... | https://github.com/PrefectHQ/prefect/blob/67bdc94e2211726d99561f6f52614bec8970e981/src/prefect/_version.py#L469-L504 | |
zzzeek/sqlalchemy | fc5c54fcd4d868c2a4c7ac19668d72f506fe821e | lib/sqlalchemy/ext/asyncio/result.py | python | AsyncMappingResult.one | (self) | return await greenlet_spawn(self._only_one_row, True, True, False) | Return exactly one object or raise an exception.
Equivalent to :meth:`_asyncio.AsyncResult.one` except that
mapping values, rather than :class:`_result.Row` objects,
are returned. | Return exactly one object or raise an exception. | [
"Return",
"exactly",
"one",
"object",
"or",
"raise",
"an",
"exception",
"."
] | async def one(self):
"""Return exactly one object or raise an exception.
Equivalent to :meth:`_asyncio.AsyncResult.one` except that
mapping values, rather than :class:`_result.Row` objects,
are returned.
"""
return await greenlet_spawn(self._only_one_row, True, True, Fa... | [
"async",
"def",
"one",
"(",
"self",
")",
":",
"return",
"await",
"greenlet_spawn",
"(",
"self",
".",
"_only_one_row",
",",
"True",
",",
"True",
",",
"False",
")"
] | https://github.com/zzzeek/sqlalchemy/blob/fc5c54fcd4d868c2a4c7ac19668d72f506fe821e/lib/sqlalchemy/ext/asyncio/result.py#L640-L648 | |
EtienneCmb/visbrain | b599038e095919dc193b12d5e502d127de7d03c9 | visbrain/objects/source_obj.py | python | SourceObj.symbol | (self, value) | Set symbol value. | Set symbol value. | [
"Set",
"symbol",
"value",
"."
] | def symbol(self, value):
"""Set symbol value."""
assert isinstance(value, str)
self._sources.symbol = value
self._sources.update() | [
"def",
"symbol",
"(",
"self",
",",
"value",
")",
":",
"assert",
"isinstance",
"(",
"value",
",",
"str",
")",
"self",
".",
"_sources",
".",
"symbol",
"=",
"value",
"self",
".",
"_sources",
".",
"update",
"(",
")"
] | https://github.com/EtienneCmb/visbrain/blob/b599038e095919dc193b12d5e502d127de7d03c9/visbrain/objects/source_obj.py#L652-L656 | ||
richshaw2015/oh-my-rss | 68b9284e0acaf44ea389d675b71949177f9f3256 | web/utils.py | python | set_active_rss | (feeds) | 访问过的源,设置一个标识,3天缓存
:param feeds:
:return: | 访问过的源,设置一个标识,3天缓存
:param feeds:
:return: | [
"访问过的源,设置一个标识,3天缓存",
":",
"param",
"feeds",
":",
":",
"return",
":"
] | def set_active_rss(feeds):
"""
访问过的源,设置一个标识,3天缓存
:param feeds:
:return:
"""
with R.pipeline(transaction=False) as p:
for feed in feeds:
p.set(settings.REDIS_ACTIVE_RSS_KEY % feed, 1, 3*24*3600)
p.execute() | [
"def",
"set_active_rss",
"(",
"feeds",
")",
":",
"with",
"R",
".",
"pipeline",
"(",
"transaction",
"=",
"False",
")",
"as",
"p",
":",
"for",
"feed",
"in",
"feeds",
":",
"p",
".",
"set",
"(",
"settings",
".",
"REDIS_ACTIVE_RSS_KEY",
"%",
"feed",
",",
... | https://github.com/richshaw2015/oh-my-rss/blob/68b9284e0acaf44ea389d675b71949177f9f3256/web/utils.py#L124-L133 | ||
bleachbit/bleachbit | 88fc4452936d02b56a76f07ce2142306bb47262b | bleachbit/GUI.py | python | Bleachbit.cb_shred_clipboard | (self, action, param) | Callback for menu option: shred paths from clipboard | Callback for menu option: shred paths from clipboard | [
"Callback",
"for",
"menu",
"option",
":",
"shred",
"paths",
"from",
"clipboard"
] | def cb_shred_clipboard(self, action, param):
"""Callback for menu option: shred paths from clipboard"""
clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
clipboard.request_targets(self.cb_clipboard_uri_received) | [
"def",
"cb_shred_clipboard",
"(",
"self",
",",
"action",
",",
"param",
")",
":",
"clipboard",
"=",
"Gtk",
".",
"Clipboard",
".",
"get",
"(",
"Gdk",
".",
"SELECTION_CLIPBOARD",
")",
"clipboard",
".",
"request_targets",
"(",
"self",
".",
"cb_clipboard_uri_receiv... | https://github.com/bleachbit/bleachbit/blob/88fc4452936d02b56a76f07ce2142306bb47262b/bleachbit/GUI.py#L225-L228 | ||
pyg-team/pytorch_geometric | b920e9a3a64e22c8356be55301c88444ff051cae | torch_geometric/nn/dense/dense_sage_conv.py | python | DenseSAGEConv.reset_parameters | (self) | [] | def reset_parameters(self):
self.lin_rel.reset_parameters()
self.lin_root.reset_parameters() | [
"def",
"reset_parameters",
"(",
"self",
")",
":",
"self",
".",
"lin_rel",
".",
"reset_parameters",
"(",
")",
"self",
".",
"lin_root",
".",
"reset_parameters",
"(",
")"
] | https://github.com/pyg-team/pytorch_geometric/blob/b920e9a3a64e22c8356be55301c88444ff051cae/torch_geometric/nn/dense/dense_sage_conv.py#L29-L31 | ||||
tensorflow/graphics | 86997957324bfbdd85848daae989b4c02588faa0 | tensorflow_graphics/projects/local_implicit_grid/core/model_g2v.py | python | ResBlock3D.__init__ | (self, neck_channels, out_channels) | Initialization.
Args:
neck_channels: int, number of channels in bottleneck layer.
out_channels: int, number of output channels. | Initialization. | [
"Initialization",
"."
] | def __init__(self, neck_channels, out_channels):
"""Initialization.
Args:
neck_channels: int, number of channels in bottleneck layer.
out_channels: int, number of output channels.
"""
super(ResBlock3D, self).__init__()
self.neck_channels = neck_channels
self.out_channels = out_chann... | [
"def",
"__init__",
"(",
"self",
",",
"neck_channels",
",",
"out_channels",
")",
":",
"super",
"(",
"ResBlock3D",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"neck_channels",
"=",
"neck_channels",
"self",
".",
"out_channels",
"=",
"out_channels"... | https://github.com/tensorflow/graphics/blob/86997957324bfbdd85848daae989b4c02588faa0/tensorflow_graphics/projects/local_implicit_grid/core/model_g2v.py#L32-L50 | ||
apache/incubator-spot | 2d60a2adae7608b43e90ce1b9ec0adf24f6cc8eb | spot-ingest/pipelines/proxy/bluecoat.py | python | spot_decoder | (s) | return s | Dummy decoder function.
:param s: input to decode
:returns: s | Dummy decoder function. | [
"Dummy",
"decoder",
"function",
"."
] | def spot_decoder(s):
"""
Dummy decoder function.
:param s: input to decode
:returns: s
"""
if s is None:
return None
return s | [
"def",
"spot_decoder",
"(",
"s",
")",
":",
"if",
"s",
"is",
"None",
":",
"return",
"None",
"return",
"s"
] | https://github.com/apache/incubator-spot/blob/2d60a2adae7608b43e90ce1b9ec0adf24f6cc8eb/spot-ingest/pipelines/proxy/bluecoat.py#L94-L103 | |
CedricGuillemet/Imogen | ee417b42747ed5b46cb11b02ef0c3630000085b3 | bin/Lib/logging/config.py | python | stopListening | () | Stop the listening server which was created with a call to listen(). | Stop the listening server which was created with a call to listen(). | [
"Stop",
"the",
"listening",
"server",
"which",
"was",
"created",
"with",
"a",
"call",
"to",
"listen",
"()",
"."
] | def stopListening():
"""
Stop the listening server which was created with a call to listen().
"""
global _listener
logging._acquireLock()
try:
if _listener:
_listener.abort = 1
_listener = None
finally:
logging._releaseLock() | [
"def",
"stopListening",
"(",
")",
":",
"global",
"_listener",
"logging",
".",
"_acquireLock",
"(",
")",
"try",
":",
"if",
"_listener",
":",
"_listener",
".",
"abort",
"=",
"1",
"_listener",
"=",
"None",
"finally",
":",
"logging",
".",
"_releaseLock",
"(",
... | https://github.com/CedricGuillemet/Imogen/blob/ee417b42747ed5b46cb11b02ef0c3630000085b3/bin/Lib/logging/config.py#L924-L935 | ||
stratosphereips/StratosphereLinuxIPS | 985ac0f141dd71fe9c6faa8307bcf95a3754951d | modules/virustotal/virustotal.py | python | Module.set_url_data_in_URLInfo | (self,url,cached_data) | Function to set VirusTotal data of the URL in the URLInfo. | Function to set VirusTotal data of the URL in the URLInfo. | [
"Function",
"to",
"set",
"VirusTotal",
"data",
"of",
"the",
"URL",
"in",
"the",
"URLInfo",
"."
] | def set_url_data_in_URLInfo(self,url,cached_data):
"""
Function to set VirusTotal data of the URL in the URLInfo.
"""
score = self.get_url_vt_data(url)
# Score of this url didn't change
vtdata = {"URL" : score,
"timestamp": time.time()}
data = {"... | [
"def",
"set_url_data_in_URLInfo",
"(",
"self",
",",
"url",
",",
"cached_data",
")",
":",
"score",
"=",
"self",
".",
"get_url_vt_data",
"(",
"url",
")",
"# Score of this url didn't change",
"vtdata",
"=",
"{",
"\"URL\"",
":",
"score",
",",
"\"timestamp\"",
":",
... | https://github.com/stratosphereips/StratosphereLinuxIPS/blob/985ac0f141dd71fe9c6faa8307bcf95a3754951d/modules/virustotal/virustotal.py#L159-L168 | ||
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/typing.py | python | Generic.__init_subclass__ | (cls, *args, **kwargs) | [] | def __init_subclass__(cls, *args, **kwargs):
super().__init_subclass__(*args, **kwargs)
tvars = []
if '__orig_bases__' in cls.__dict__:
error = Generic in cls.__orig_bases__
else:
error = Generic in cls.__bases__ and cls.__name__ != 'Protocol'
if error:
... | [
"def",
"__init_subclass__",
"(",
"cls",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
")",
".",
"__init_subclass__",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"tvars",
"=",
"[",
"]",
"if",
"'__orig_bases__'",
"in",
"cls",
... | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/typing.py#L900-L933 | ||||
osmr/imgclsmob | f2993d3ce73a2f7ddba05da3891defb08547d504 | tensorflow_/tensorflowcv/models/seresnet.py | python | get_seresnet | (blocks,
bottleneck=None,
conv1_stride=True,
model_name=None,
pretrained=False,
root=os.path.join("~", ".tensorflow", "models"),
**kwargs) | return net | Create SE-ResNet model with specific parameters.
Parameters:
----------
blocks : int
Number of blocks.
bottleneck : bool, default None
Whether to use a bottleneck or simple block in units.
conv1_stride : bool, default True
Whether to use stride in the first or the second con... | Create SE-ResNet model with specific parameters. | [
"Create",
"SE",
"-",
"ResNet",
"model",
"with",
"specific",
"parameters",
"."
] | def get_seresnet(blocks,
bottleneck=None,
conv1_stride=True,
model_name=None,
pretrained=False,
root=os.path.join("~", ".tensorflow", "models"),
**kwargs):
"""
Create SE-ResNet model with specific parameters.
... | [
"def",
"get_seresnet",
"(",
"blocks",
",",
"bottleneck",
"=",
"None",
",",
"conv1_stride",
"=",
"True",
",",
"model_name",
"=",
"None",
",",
"pretrained",
"=",
"False",
",",
"root",
"=",
"os",
".",
"path",
".",
"join",
"(",
"\"~\"",
",",
"\".tensorflow\"... | https://github.com/osmr/imgclsmob/blob/f2993d3ce73a2f7ddba05da3891defb08547d504/tensorflow_/tensorflowcv/models/seresnet.py#L202-L298 | |
PowerScript/KatanaFramework | 0f6ad90a88de865d58ec26941cb4460501e75496 | lib/setuptools/setuptools/command/easy_install.py | python | CommandSpec.from_string | (cls, string) | return cls(items) | Construct a command spec from a simple string representing a command
line parseable by shlex.split. | Construct a command spec from a simple string representing a command
line parseable by shlex.split. | [
"Construct",
"a",
"command",
"spec",
"from",
"a",
"simple",
"string",
"representing",
"a",
"command",
"line",
"parseable",
"by",
"shlex",
".",
"split",
"."
] | def from_string(cls, string):
"""
Construct a command spec from a simple string representing a command
line parseable by shlex.split.
"""
items = shlex.split(string, **cls.split_args)
return cls(items) | [
"def",
"from_string",
"(",
"cls",
",",
"string",
")",
":",
"items",
"=",
"shlex",
".",
"split",
"(",
"string",
",",
"*",
"*",
"cls",
".",
"split_args",
")",
"return",
"cls",
"(",
"items",
")"
] | https://github.com/PowerScript/KatanaFramework/blob/0f6ad90a88de865d58ec26941cb4460501e75496/lib/setuptools/setuptools/command/easy_install.py#L1955-L1961 | |
JohnHammond/katana | 4f58537428dc6776b0dcb8a852f7ccdde87dbebe | katana/units/raw/strings.py | python | Unit.evaluate | (self, case: Any) | Evaluate the target. Run ``strings`` on the target and
recurse on any newfound information.
:param case: A case returned by ``enumerate``. For this unit,\
the ``enumerate`` function is not used.
:return: None. This function should not return any data. | Evaluate the target. Run ``strings`` on the target and
recurse on any newfound information. | [
"Evaluate",
"the",
"target",
".",
"Run",
"strings",
"on",
"the",
"target",
"and",
"recurse",
"on",
"any",
"newfound",
"information",
"."
] | def evaluate(self, case: Any):
"""
Evaluate the target. Run ``strings`` on the target and
recurse on any newfound information.
:param case: A case returned by ``enumerate``. For this unit,\
the ``enumerate`` function is not used.
:return: None. This function should not ... | [
"def",
"evaluate",
"(",
"self",
",",
"case",
":",
"Any",
")",
":",
"# Run the process.",
"command",
"=",
"[",
"\"strings\"",
",",
"self",
".",
"target",
".",
"path",
",",
"\"-n\"",
",",
"self",
".",
"get",
"(",
"\"length\"",
",",
"\"10\"",
")",
"]",
... | https://github.com/JohnHammond/katana/blob/4f58537428dc6776b0dcb8a852f7ccdde87dbebe/katana/units/raw/strings.py#L48-L71 | ||
XX-net/XX-Net | a9898cfcf0084195fb7e69b6bc834e59aecdf14f | python3.8.2/Lib/statistics.py | python | NormalDist.__rsub__ | (x1, x2) | return -(x1 - x2) | Subtract a NormalDist from a constant or another NormalDist. | Subtract a NormalDist from a constant or another NormalDist. | [
"Subtract",
"a",
"NormalDist",
"from",
"a",
"constant",
"or",
"another",
"NormalDist",
"."
] | def __rsub__(x1, x2):
"Subtract a NormalDist from a constant or another NormalDist."
return -(x1 - x2) | [
"def",
"__rsub__",
"(",
"x1",
",",
"x2",
")",
":",
"return",
"-",
"(",
"x1",
"-",
"x2",
")"
] | https://github.com/XX-net/XX-Net/blob/a9898cfcf0084195fb7e69b6bc834e59aecdf14f/python3.8.2/Lib/statistics.py#L1085-L1087 | |
iclavera/learning_to_adapt | bd7d99ba402521c96631e7d09714128f549db0f1 | learning_to_adapt/mujoco_py/mjtypes.py | python | MjVisualWrapper.headlight | (self) | return self._wrapped.contents.headlight | [] | def headlight(self):
return self._wrapped.contents.headlight | [
"def",
"headlight",
"(",
"self",
")",
":",
"return",
"self",
".",
"_wrapped",
".",
"contents",
".",
"headlight"
] | https://github.com/iclavera/learning_to_adapt/blob/bd7d99ba402521c96631e7d09714128f549db0f1/learning_to_adapt/mujoco_py/mjtypes.py#L2070-L2071 | |||
brendano/tweetmotif | 1b0b1e3a941745cd5a26eba01f554688b7c4b27e | everything_else/djfrontend/django-1.0.2/contrib/gis/geos/libgeos.py | python | get_pointer_arr | (n) | return GeomArr() | Gets a ctypes pointer array (of length `n`) for GEOSGeom_t opaque pointer. | Gets a ctypes pointer array (of length `n`) for GEOSGeom_t opaque pointer. | [
"Gets",
"a",
"ctypes",
"pointer",
"array",
"(",
"of",
"length",
"n",
")",
"for",
"GEOSGeom_t",
"opaque",
"pointer",
"."
] | def get_pointer_arr(n):
"Gets a ctypes pointer array (of length `n`) for GEOSGeom_t opaque pointer."
GeomArr = GEOM_PTR * n
return GeomArr() | [
"def",
"get_pointer_arr",
"(",
"n",
")",
":",
"GeomArr",
"=",
"GEOM_PTR",
"*",
"n",
"return",
"GeomArr",
"(",
")"
] | https://github.com/brendano/tweetmotif/blob/1b0b1e3a941745cd5a26eba01f554688b7c4b27e/everything_else/djfrontend/django-1.0.2/contrib/gis/geos/libgeos.py#L99-L102 | |
Robot-Will/Stino | a94831cd1bf40a59587a7b6cc2e9b5c4306b1bf2 | libs/serial/urlhandler/protocol_socket.py | python | Serial.close | (self) | Close port | Close port | [
"Close",
"port"
] | def close(self):
"""Close port"""
if self.is_open:
if self._socket:
try:
self._socket.shutdown(socket.SHUT_RDWR)
self._socket.close()
except:
# ignore errors.
pass
... | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_open",
":",
"if",
"self",
".",
"_socket",
":",
"try",
":",
"self",
".",
"_socket",
".",
"shutdown",
"(",
"socket",
".",
"SHUT_RDWR",
")",
"self",
".",
"_socket",
".",
"close",
"(",
")",
... | https://github.com/Robot-Will/Stino/blob/a94831cd1bf40a59587a7b6cc2e9b5c4306b1bf2/libs/serial/urlhandler/protocol_socket.py#L86-L99 | ||
enthought/traitsui | b7c38c7a47bf6ae7971f9ddab70c8a358647dd25 | traitsui/wx/range_editor.py | python | LargeRangeSliderEditor.update_range_ui | (self) | Updates the slider range controls. | Updates the slider range controls. | [
"Updates",
"the",
"slider",
"range",
"controls",
"."
] | def update_range_ui(self):
"""Updates the slider range controls."""
low, high = self.cur_low, self.cur_high
value = self.value
self._set_format()
self.control.label_lo.SetLabel(self._format % low)
self.control.label_hi.SetLabel(self._format % high)
if high > low:
... | [
"def",
"update_range_ui",
"(",
"self",
")",
":",
"low",
",",
"high",
"=",
"self",
".",
"cur_low",
",",
"self",
".",
"cur_high",
"value",
"=",
"self",
".",
"value",
"self",
".",
"_set_format",
"(",
")",
"self",
".",
"control",
".",
"label_lo",
".",
"S... | https://github.com/enthought/traitsui/blob/b7c38c7a47bf6ae7971f9ddab70c8a358647dd25/traitsui/wx/range_editor.py#L572-L597 | ||
LMFDB/lmfdb | 6cf48a4c18a96e6298da6ae43f587f96845bcb43 | lmfdb/verify/char_dir_orbits.py | python | char_dir_orbits.check_char_dir_values_agg | (self) | return self.check_crosstable_count('char_dir_values', 'char_degree', 'orbit_label') | The number of entries in char_dir_values matching a given orbit_label should be char_degree | The number of entries in char_dir_values matching a given orbit_label should be char_degree | [
"The",
"number",
"of",
"entries",
"in",
"char_dir_values",
"matching",
"a",
"given",
"orbit_label",
"should",
"be",
"char_degree"
] | def check_char_dir_values_agg(self):
"""
The number of entries in char_dir_values matching a given orbit_label should be char_degree
"""
# TIME about 750s
return self.check_crosstable_count('char_dir_values', 'char_degree', 'orbit_label') | [
"def",
"check_char_dir_values_agg",
"(",
"self",
")",
":",
"# TIME about 750s",
"return",
"self",
".",
"check_crosstable_count",
"(",
"'char_dir_values'",
",",
"'char_degree'",
",",
"'orbit_label'",
")"
] | https://github.com/LMFDB/lmfdb/blob/6cf48a4c18a96e6298da6ae43f587f96845bcb43/lmfdb/verify/char_dir_orbits.py#L63-L68 | |
CastagnaIT/plugin.video.netflix | 5cf5fa436eb9956576c0f62aa31a4c7d6c5b8a4a | resources/lib/navigation/actions.py | python | AddonActionExecutor.change_watched_status | (self, videoid) | Change the watched status of a video, only when sync of watched status with NF is enabled | Change the watched status of a video, only when sync of watched status with NF is enabled | [
"Change",
"the",
"watched",
"status",
"of",
"a",
"video",
"only",
"when",
"sync",
"of",
"watched",
"status",
"with",
"NF",
"is",
"enabled"
] | def change_watched_status(self, videoid):
"""Change the watched status of a video, only when sync of watched status with NF is enabled"""
change_watched_status_locally(videoid) | [
"def",
"change_watched_status",
"(",
"self",
",",
"videoid",
")",
":",
"change_watched_status_locally",
"(",
"videoid",
")"
] | https://github.com/CastagnaIT/plugin.video.netflix/blob/5cf5fa436eb9956576c0f62aa31a4c7d6c5b8a4a/resources/lib/navigation/actions.py#L180-L182 | ||
Trusted-AI/adversarial-robustness-toolbox | 9fabffdbb92947efa1ecc5d825d634d30dfbaf29 | art/estimators/mxnet.py | python | MXEstimator.__init__ | (self, **kwargs) | Estimator class for MXNet Gluon models. | Estimator class for MXNet Gluon models. | [
"Estimator",
"class",
"for",
"MXNet",
"Gluon",
"models",
"."
] | def __init__(self, **kwargs) -> None:
"""
Estimator class for MXNet Gluon models.
"""
super().__init__(**kwargs) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"*",
"*",
"kwargs",
")"
] | https://github.com/Trusted-AI/adversarial-robustness-toolbox/blob/9fabffdbb92947efa1ecc5d825d634d30dfbaf29/art/estimators/mxnet.py#L43-L47 | ||
Komodo/KomodoEdit | 61edab75dce2bdb03943b387b0608ea36f548e8e | src/codeintel/play/core.py | python | Window.PopupMenuXY | (*args, **kwargs) | return _core.Window_PopupMenuXY(*args, **kwargs) | PopupMenuXY(Menu menu, int x, int y) -> bool
Pops up the given menu at the specified coordinates, relative to this
window, and returns control when the user has dismissed the menu. If a
menu item is selected, the corresponding menu event is generated and
will be processed as usual. | PopupMenuXY(Menu menu, int x, int y) -> bool | [
"PopupMenuXY",
"(",
"Menu",
"menu",
"int",
"x",
"int",
"y",
")",
"-",
">",
"bool"
] | def PopupMenuXY(*args, **kwargs):
"""
PopupMenuXY(Menu menu, int x, int y) -> bool
Pops up the given menu at the specified coordinates, relative to this
window, and returns control when the user has dismissed the menu. If a
menu item is selected, the corresponding menu event is ... | [
"def",
"PopupMenuXY",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core",
".",
"Window_PopupMenuXY",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/Komodo/KomodoEdit/blob/61edab75dce2bdb03943b387b0608ea36f548e8e/src/codeintel/play/core.py#L6718-L6727 | |
FederatedAI/FATE | 32540492623568ecd1afcb367360133616e02fa3 | python/federatedml/feature/binning/bin_result.py | python | MultiClassBinResult.generated_pb_list | (self, split_points=None) | return res | [] | def generated_pb_list(self, split_points=None):
res = []
for br in self.bin_results:
res.append(br.generated_pb(split_points))
return res | [
"def",
"generated_pb_list",
"(",
"self",
",",
"split_points",
"=",
"None",
")",
":",
"res",
"=",
"[",
"]",
"for",
"br",
"in",
"self",
".",
"bin_results",
":",
"res",
".",
"append",
"(",
"br",
".",
"generated_pb",
"(",
"split_points",
")",
")",
"return"... | https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/federatedml/feature/binning/bin_result.py#L263-L267 | |||
lutris/lutris | 66675a4d5537f6b2a2ba2b6df0b3cdf8924c823a | lutris/util/graphics/displayconfig.py | python | MutterDisplayManager.get_current_resolution | (self) | return str(current_mode.width), str(current_mode.height) | Return the current resolution for the primary display | Return the current resolution for the primary display | [
"Return",
"the",
"current",
"resolution",
"for",
"the",
"primary",
"display"
] | def get_current_resolution(self):
"""Return the current resolution for the primary display"""
logger.debug("Retrieving current resolution")
current_mode = self.display_config.current_state.get_current_mode()
if not current_mode:
logger.error("Could not retrieve the current di... | [
"def",
"get_current_resolution",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"Retrieving current resolution\"",
")",
"current_mode",
"=",
"self",
".",
"display_config",
".",
"current_state",
".",
"get_current_mode",
"(",
")",
"if",
"not",
"current_mode",
... | https://github.com/lutris/lutris/blob/66675a4d5537f6b2a2ba2b6df0b3cdf8924c823a/lutris/util/graphics/displayconfig.py#L622-L629 | |
airnotifier/airnotifier | 27207bc9e8ee8f3ac9db428a456020d9e55eabda | pushservices/wns.py | python | WNSClient.request_token | (self) | return accesstoken | [] | def request_token(self):
payload = {
"grant_type": "client_credentials",
"client_id": self.clientid,
"client_secret": self.clientsecret,
"scope": "notify.windows.com",
}
response = requests.post(WNSACCESSTOKEN_URL, data=payload)
responsedat... | [
"def",
"request_token",
"(",
"self",
")",
":",
"payload",
"=",
"{",
"\"grant_type\"",
":",
"\"client_credentials\"",
",",
"\"client_id\"",
":",
"self",
".",
"clientid",
",",
"\"client_secret\"",
":",
"self",
".",
"clientsecret",
",",
"\"scope\"",
":",
"\"notify.... | https://github.com/airnotifier/airnotifier/blob/27207bc9e8ee8f3ac9db428a456020d9e55eabda/pushservices/wns.py#L100-L115 | |||
ninthDevilHAUNSTER/ArknightsAutoHelper | a27a930502d6e432368d9f62595a1d69a992f4e6 | vendor/penguin_client/penguin_client/models/stage.py | python | Stage.is_gacha | (self, is_gacha) | Sets the is_gacha of this Stage.
:param is_gacha: The is_gacha of this Stage. # noqa: E501
:type: bool | Sets the is_gacha of this Stage. | [
"Sets",
"the",
"is_gacha",
"of",
"this",
"Stage",
"."
] | def is_gacha(self, is_gacha):
"""Sets the is_gacha of this Stage.
:param is_gacha: The is_gacha of this Stage. # noqa: E501
:type: bool
"""
self._is_gacha = is_gacha | [
"def",
"is_gacha",
"(",
"self",
",",
"is_gacha",
")",
":",
"self",
".",
"_is_gacha",
"=",
"is_gacha"
] | https://github.com/ninthDevilHAUNSTER/ArknightsAutoHelper/blob/a27a930502d6e432368d9f62595a1d69a992f4e6/vendor/penguin_client/penguin_client/models/stage.py#L216-L224 | ||
secdev/scapy | 65089071da1acf54622df0b4fa7fc7673d47d3cd | scapy/layers/inet.py | python | fragment | (pkt, fragsize=1480) | return lst | Fragment a big IP datagram | Fragment a big IP datagram | [
"Fragment",
"a",
"big",
"IP",
"datagram"
] | def fragment(pkt, fragsize=1480):
"""Fragment a big IP datagram"""
lastfragsz = fragsize
fragsize -= fragsize % 8
lst = []
for p in pkt:
s = raw(p[IP].payload)
nb = (len(s) - lastfragsz + fragsize - 1) // fragsize + 1
for i in range(nb):
q = p.copy()
d... | [
"def",
"fragment",
"(",
"pkt",
",",
"fragsize",
"=",
"1480",
")",
":",
"lastfragsz",
"=",
"fragsize",
"fragsize",
"-=",
"fragsize",
"%",
"8",
"lst",
"=",
"[",
"]",
"for",
"p",
"in",
"pkt",
":",
"s",
"=",
"raw",
"(",
"p",
"[",
"IP",
"]",
".",
"p... | https://github.com/secdev/scapy/blob/65089071da1acf54622df0b4fa7fc7673d47d3cd/scapy/layers/inet.py#L1060-L1083 | |
czq142857/BSP-NET-original | f69862990b1e9d95718053fc229d3b35aebfb511 | modelSVR.py | python | BSP_SVR.__init__ | (self, sess, phase, sample_vox_size, is_training = False, prev_ef_dim=32, ef_dim=64, c_dim=256, p_dim=4096, dataset_name='default', checkpoint_dir=None, sample_dir=None, data_dir='./data') | Args:
too lazy to explain | Args:
too lazy to explain | [
"Args",
":",
"too",
"lazy",
"to",
"explain"
] | def __init__(self, sess, phase, sample_vox_size, is_training = False, prev_ef_dim=32, ef_dim=64, c_dim=256, p_dim=4096, dataset_name='default', checkpoint_dir=None, sample_dir=None, data_dir='./data'):
"""
Args:
too lazy to explain
"""
self.sess = sess
#progressive training
#1-- (16, 16*16*16)
#2-- (3... | [
"def",
"__init__",
"(",
"self",
",",
"sess",
",",
"phase",
",",
"sample_vox_size",
",",
"is_training",
"=",
"False",
",",
"prev_ef_dim",
"=",
"32",
",",
"ef_dim",
"=",
"64",
",",
"c_dim",
"=",
"256",
",",
"p_dim",
"=",
"4096",
",",
"dataset_name",
"=",... | https://github.com/czq142857/BSP-NET-original/blob/f69862990b1e9d95718053fc229d3b35aebfb511/modelSVR.py#L16-L106 | ||
1040003585/WebScrapingWithPython | a770fa5b03894076c8c9539b1ffff34424ffc016 | portia_examle/lib/python2.7/site-packages/wheel/bdist_wheel.py | python | bdist_wheel.wheel_dist_name | (self) | return '-'.join((safer_name(self.distribution.get_name()),
safer_version(self.distribution.get_version()))) | Return distribution full name with - replaced with _ | Return distribution full name with - replaced with _ | [
"Return",
"distribution",
"full",
"name",
"with",
"-",
"replaced",
"with",
"_"
] | def wheel_dist_name(self):
"""Return distribution full name with - replaced with _"""
return '-'.join((safer_name(self.distribution.get_name()),
safer_version(self.distribution.get_version()))) | [
"def",
"wheel_dist_name",
"(",
"self",
")",
":",
"return",
"'-'",
".",
"join",
"(",
"(",
"safer_name",
"(",
"self",
".",
"distribution",
".",
"get_name",
"(",
")",
")",
",",
"safer_version",
"(",
"self",
".",
"distribution",
".",
"get_version",
"(",
")",... | https://github.com/1040003585/WebScrapingWithPython/blob/a770fa5b03894076c8c9539b1ffff34424ffc016/portia_examle/lib/python2.7/site-packages/wheel/bdist_wheel.py#L128-L131 | |
learningequality/kolibri | d056dbc477aaf651ab843caa141a6a1e0a491046 | kolibri/core/auth/management/commands/bulkimportusers.py | python | Validator.validate | (self, data) | Validate `data` and return an iterator over errors found. | Validate `data` and return an iterator over errors found. | [
"Validate",
"data",
"and",
"return",
"an",
"iterator",
"over",
"errors",
"found",
"."
] | def validate(self, data):
"""
Validate `data` and return an iterator over errors found.
"""
for index, row in enumerate(data):
error_flag = False
username = self.get_username(row)
if not username:
error = {
"row": in... | [
"def",
"validate",
"(",
"self",
",",
"data",
")",
":",
"for",
"index",
",",
"row",
"in",
"enumerate",
"(",
"data",
")",
":",
"error_flag",
"=",
"False",
"username",
"=",
"self",
".",
"get_username",
"(",
"row",
")",
"if",
"not",
"username",
":",
"err... | https://github.com/learningequality/kolibri/blob/d056dbc477aaf651ab843caa141a6a1e0a491046/kolibri/core/auth/management/commands/bulkimportusers.py#L306-L351 | ||
google/grr | 8ad8a4d2c5a93c92729206b7771af19d92d4f915 | grr/server/grr_response_server/databases/db.py | python | Database.CountHuntResults | (self, hunt_id, with_tag=None, with_type=None) | Counts hunt results of a given hunt using given query options.
If both with_tag and with_type arguments are provided, they will be applied
using AND boolean operator.
Args:
hunt_id: The id of the hunt to count results for.
with_tag: (Optional) When specified, should be a string. Only results
... | Counts hunt results of a given hunt using given query options. | [
"Counts",
"hunt",
"results",
"of",
"a",
"given",
"hunt",
"using",
"given",
"query",
"options",
"."
] | def CountHuntResults(self, hunt_id, with_tag=None, with_type=None):
"""Counts hunt results of a given hunt using given query options.
If both with_tag and with_type arguments are provided, they will be applied
using AND boolean operator.
Args:
hunt_id: The id of the hunt to count results for.
... | [
"def",
"CountHuntResults",
"(",
"self",
",",
"hunt_id",
",",
"with_tag",
"=",
"None",
",",
"with_type",
"=",
"None",
")",
":"
] | https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/server/grr_response_server/databases/db.py#L2693-L2708 | ||
zorkian/nagios-api | 15706da83aa78ef0a196ecaad1738e9a011141e0 | nagios/core.py | python | Nagios.__init__ | (self, statusfile=None) | Create a new Nagios state store. One argument, statusfile, is used to
indicate where the status file is. This object is intended to be read-only
once it has been created. | Create a new Nagios state store. One argument, statusfile, is used to
indicate where the status file is. This object is intended to be read-only
once it has been created. | [
"Create",
"a",
"new",
"Nagios",
"state",
"store",
".",
"One",
"argument",
"statusfile",
"is",
"used",
"to",
"indicate",
"where",
"the",
"status",
"file",
"is",
".",
"This",
"object",
"is",
"intended",
"to",
"be",
"read",
"-",
"only",
"once",
"it",
"has",... | def __init__(self, statusfile=None):
'''Create a new Nagios state store. One argument, statusfile, is used to
indicate where the status file is. This object is intended to be read-only
once it has been created.
'''
self.info = Info({})
self.program = Program({})
... | [
"def",
"__init__",
"(",
"self",
",",
"statusfile",
"=",
"None",
")",
":",
"self",
".",
"info",
"=",
"Info",
"(",
"{",
"}",
")",
"self",
".",
"program",
"=",
"Program",
"(",
"{",
"}",
")",
"self",
".",
"hosts",
"=",
"{",
"}",
"self",
".",
"servi... | https://github.com/zorkian/nagios-api/blob/15706da83aa78ef0a196ecaad1738e9a011141e0/nagios/core.py#L11-L24 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/whoosh/filedb/gae.py | python | DatastoreStorage.total_size | (self) | return sum(self.file_length(f) for f in self.list()) | [] | def total_size(self):
return sum(self.file_length(f) for f in self.list()) | [
"def",
"total_size",
"(",
"self",
")",
":",
"return",
"sum",
"(",
"self",
".",
"file_length",
"(",
"f",
")",
"for",
"f",
"in",
"self",
".",
"list",
"(",
")",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/whoosh/filedb/gae.py#L127-L128 | |||
AndrewAnnex/SpiceyPy | 9f8b626338f119bacd39ef2ba94a6f71bd6341c0 | src/spiceypy/spiceypy.py | python | irfnum | (name: str) | return index.value | Return the index of one of the standard inertial reference
frames supported by :func:`irfrot`
https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/FORTRAN/spicelib/irfnum.html
:param name: Name of standard inertial reference frame.
:return: is the index of the frame. | Return the index of one of the standard inertial reference
frames supported by :func:`irfrot` | [
"Return",
"the",
"index",
"of",
"one",
"of",
"the",
"standard",
"inertial",
"reference",
"frames",
"supported",
"by",
":",
"func",
":",
"irfrot"
] | def irfnum(name: str) -> int:
"""
Return the index of one of the standard inertial reference
frames supported by :func:`irfrot`
https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/FORTRAN/spicelib/irfnum.html
:param name: Name of standard inertial reference frame.
:return: is the index of the fram... | [
"def",
"irfnum",
"(",
"name",
":",
"str",
")",
"->",
"int",
":",
"index",
"=",
"ctypes",
".",
"c_int",
"(",
")",
"name_len",
"=",
"ctypes",
".",
"c_int",
"(",
"len",
"(",
"name",
")",
")",
"name",
"=",
"stypes",
".",
"string_to_char_p",
"(",
"name"... | https://github.com/AndrewAnnex/SpiceyPy/blob/9f8b626338f119bacd39ef2ba94a6f71bd6341c0/src/spiceypy/spiceypy.py#L7548-L7562 | |
caiiiac/Machine-Learning-with-Python | 1a26c4467da41ca4ebc3d5bd789ea942ef79422f | MachineLearning/venv/lib/python3.5/site-packages/pandas/io/pytables.py | python | AppendableMultiSeriesTable.write | (self, obj, **kwargs) | return super(AppendableMultiSeriesTable, self).write(obj=obj, **kwargs) | we are going to write this as a frame table | we are going to write this as a frame table | [
"we",
"are",
"going",
"to",
"write",
"this",
"as",
"a",
"frame",
"table"
] | def write(self, obj, **kwargs):
""" we are going to write this as a frame table """
name = obj.name or 'values'
obj, self.levels = self.validate_multiindex(obj)
cols = list(self.levels)
cols.append(name)
obj.columns = cols
return super(AppendableMultiSeriesTable, ... | [
"def",
"write",
"(",
"self",
",",
"obj",
",",
"*",
"*",
"kwargs",
")",
":",
"name",
"=",
"obj",
".",
"name",
"or",
"'values'",
"obj",
",",
"self",
".",
"levels",
"=",
"self",
".",
"validate_multiindex",
"(",
"obj",
")",
"cols",
"=",
"list",
"(",
... | https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/pandas/io/pytables.py#L4198-L4205 | |
nosmokingbandit/Watcher3 | 0217e75158b563bdefc8e01c3be7620008cf3977 | lib/requests/packages/urllib3/connectionpool.py | python | HTTPConnectionPool._get_timeout | (self, timeout) | Helper that always returns a :class:`urllib3.util.Timeout` | Helper that always returns a :class:`urllib3.util.Timeout` | [
"Helper",
"that",
"always",
"returns",
"a",
":",
"class",
":",
"urllib3",
".",
"util",
".",
"Timeout"
] | def _get_timeout(self, timeout):
""" Helper that always returns a :class:`urllib3.util.Timeout` """
if timeout is _Default:
return self.timeout.clone()
if isinstance(timeout, Timeout):
return timeout.clone()
else:
# User passed us an int/float. This i... | [
"def",
"_get_timeout",
"(",
"self",
",",
"timeout",
")",
":",
"if",
"timeout",
"is",
"_Default",
":",
"return",
"self",
".",
"timeout",
".",
"clone",
"(",
")",
"if",
"isinstance",
"(",
"timeout",
",",
"Timeout",
")",
":",
"return",
"timeout",
".",
"clo... | https://github.com/nosmokingbandit/Watcher3/blob/0217e75158b563bdefc8e01c3be7620008cf3977/lib/requests/packages/urllib3/connectionpool.py#L292-L302 | ||
InvestmentSystems/static-frame | 0b19d6969bf6c17fb0599871aca79eb3b52cf2ed | static_frame/core/type_blocks.py | python | TypeBlocks.fillfalsy_backward | (self,
limit: int = 0,
*,
axis: int = 0) | Return a new ``TypeBlocks`` after feeding backward the last non-falsy observation across contiguous missing values. Backward, axis 0 fills columns, going from bottom to top. Backward axis 1 fills rows, going from right to left. | Return a new ``TypeBlocks`` after feeding backward the last non-falsy observation across contiguous missing values. Backward, axis 0 fills columns, going from bottom to top. Backward axis 1 fills rows, going from right to left. | [
"Return",
"a",
"new",
"TypeBlocks",
"after",
"feeding",
"backward",
"the",
"last",
"non",
"-",
"falsy",
"observation",
"across",
"contiguous",
"missing",
"values",
".",
"Backward",
"axis",
"0",
"fills",
"columns",
"going",
"from",
"bottom",
"to",
"top",
".",
... | def fillfalsy_backward(self,
limit: int = 0,
*,
axis: int = 0) -> 'TypeBlocks':
'''Return a new ``TypeBlocks`` after feeding backward the last non-falsy observation across contiguous missing values. Backward, axis 0 fills columns, going from bottom to top. Backward axis 1 fil... | [
"def",
"fillfalsy_backward",
"(",
"self",
",",
"limit",
":",
"int",
"=",
"0",
",",
"*",
",",
"axis",
":",
"int",
"=",
"0",
")",
"->",
"'TypeBlocks'",
":",
"if",
"axis",
"==",
"0",
":",
"return",
"self",
".",
"from_blocks",
"(",
"self",
".",
"_fill_... | https://github.com/InvestmentSystems/static-frame/blob/0b19d6969bf6c17fb0599871aca79eb3b52cf2ed/static_frame/core/type_blocks.py#L3383-L3405 | ||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/Lib/email/utils.py | python | formatdate | (timeval=None, localtime=False, usegmt=False) | return '%s, %02d %s %04d %02d:%02d:%02d %s' % (
['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'][now[6]],
now[2],
['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][now[1] - 1],
now[0], now[3], now[4], now[5],
zone) | Returns a date string as specified by RFC 2822, e.g.:
Fri, 09 Nov 2001 01:08:47 -0000
Optional timeval if given is a floating point time value as accepted by
gmtime() and localtime(), otherwise the current time is used.
Optional localtime is a flag that when True, interprets timeval, and
returns ... | Returns a date string as specified by RFC 2822, e.g.: | [
"Returns",
"a",
"date",
"string",
"as",
"specified",
"by",
"RFC",
"2822",
"e",
".",
"g",
".",
":"
] | def formatdate(timeval=None, localtime=False, usegmt=False):
"""Returns a date string as specified by RFC 2822, e.g.:
Fri, 09 Nov 2001 01:08:47 -0000
Optional timeval if given is a floating point time value as accepted by
gmtime() and localtime(), otherwise the current time is used.
Optional loca... | [
"def",
"formatdate",
"(",
"timeval",
"=",
"None",
",",
"localtime",
"=",
"False",
",",
"usegmt",
"=",
"False",
")",
":",
"# Note: we cannot use strftime() because that honors the locale and RFC",
"# 2822 requires that day and month names be the English abbreviations.",
"if",
"t... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/Lib/email/utils.py#L124-L173 | |
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/mako/util.py | python | LRUCache.__getitem__ | (self, key) | return item.value | [] | def __getitem__(self, key):
item = dict.__getitem__(self, key)
item.timestamp = timeit.default_timer()
return item.value | [
"def",
"__getitem__",
"(",
"self",
",",
"key",
")",
":",
"item",
"=",
"dict",
".",
"__getitem__",
"(",
"self",
",",
"key",
")",
"item",
".",
"timestamp",
"=",
"timeit",
".",
"default_timer",
"(",
")",
"return",
"item",
".",
"value"
] | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/mako/util.py#L195-L198 | |||
google/grr | 8ad8a4d2c5a93c92729206b7771af19d92d4f915 | grr/client/grr_response_client/comms.py | python | SizeLimitedQueue.Size | (self) | return self._total_size | [] | def Size(self):
return self._total_size | [
"def",
"Size",
"(",
"self",
")",
":",
"return",
"self",
".",
"_total_size"
] | https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/client/grr_response_client/comms.py#L911-L912 | |||
chubin/cheat.sh | 46d1a5f73c6b88da15d809154245dbf234e9479e | lib/search.py | python | _parse_options | (options) | return search_options | Parse search options string into optiond_dict | Parse search options string into optiond_dict | [
"Parse",
"search",
"options",
"string",
"into",
"optiond_dict"
] | def _parse_options(options):
"""Parse search options string into optiond_dict
"""
if options is None:
return {}
search_options = {
'insensitive': 'i' in options,
'word_boundaries': 'b' in options,
'recursive': 'r' in options,
}
return search_options | [
"def",
"_parse_options",
"(",
"options",
")",
":",
"if",
"options",
"is",
"None",
":",
"return",
"{",
"}",
"search_options",
"=",
"{",
"'insensitive'",
":",
"'i'",
"in",
"options",
",",
"'word_boundaries'",
":",
"'b'",
"in",
"options",
",",
"'recursive'",
... | https://github.com/chubin/cheat.sh/blob/46d1a5f73c6b88da15d809154245dbf234e9479e/lib/search.py#L35-L47 | |
asyncio-docs/asyncio-doc | 8ac6b818fd060163b265da42842a6fd1c5d34181 | examples/simple_server.py | python | MyRequestHandler.do_GET | (self) | Respond after seconds given in path. | Respond after seconds given in path. | [
"Respond",
"after",
"seconds",
"given",
"in",
"path",
"."
] | def do_GET(self): # pylint: disable=invalid-name
"""Respond after seconds given in path.
"""
try:
seconds = float(self.path[1:])
except ValueError:
seconds = 0.0
if seconds < 0:
seconds = 0.0
text = "Waited for {:4.2f} seconds.\nThat's... | [
"def",
"do_GET",
"(",
"self",
")",
":",
"# pylint: disable=invalid-name",
"try",
":",
"seconds",
"=",
"float",
"(",
"self",
".",
"path",
"[",
"1",
":",
"]",
")",
"except",
"ValueError",
":",
"seconds",
"=",
"0.0",
"if",
"seconds",
"<",
"0",
":",
"secon... | https://github.com/asyncio-docs/asyncio-doc/blob/8ac6b818fd060163b265da42842a6fd1c5d34181/examples/simple_server.py#L24-L40 | ||
miketeo/pysmb | fc3faca073385b8abc4a503bb4439f849840f94c | python3/smb/base.py | python | SharedFile.isDirectory | (self) | return bool(self.file_attributes & ATTR_DIRECTORY) | A convenience property to return True if this file resource is a directory on the remote server | A convenience property to return True if this file resource is a directory on the remote server | [
"A",
"convenience",
"property",
"to",
"return",
"True",
"if",
"this",
"file",
"resource",
"is",
"a",
"directory",
"on",
"the",
"remote",
"server"
] | def isDirectory(self):
"""A convenience property to return True if this file resource is a directory on the remote server"""
return bool(self.file_attributes & ATTR_DIRECTORY) | [
"def",
"isDirectory",
"(",
"self",
")",
":",
"return",
"bool",
"(",
"self",
".",
"file_attributes",
"&",
"ATTR_DIRECTORY",
")"
] | https://github.com/miketeo/pysmb/blob/fc3faca073385b8abc4a503bb4439f849840f94c/python3/smb/base.py#L3010-L3012 | |
pydicom/pydicom | 935de3b4ac94a5f520f3c91b42220ff0f13bce54 | pydicom/benchmarks/bench_handler_numpy.py | python | TimeGetPixelData.time_32bit_3sample_1frame | (self) | Time retrieval of 32-bit, 3 sample/pixel, 1 frame. | Time retrieval of 32-bit, 3 sample/pixel, 1 frame. | [
"Time",
"retrieval",
"of",
"32",
"-",
"bit",
"3",
"sample",
"/",
"pixel",
"1",
"frame",
"."
] | def time_32bit_3sample_1frame(self):
"""Time retrieval of 32-bit, 3 sample/pixel, 1 frame."""
for ii in range(self.no_runs):
get_pixeldata(self.ds_32_3_1) | [
"def",
"time_32bit_3sample_1frame",
"(",
"self",
")",
":",
"for",
"ii",
"in",
"range",
"(",
"self",
".",
"no_runs",
")",
":",
"get_pixeldata",
"(",
"self",
".",
"ds_32_3_1",
")"
] | https://github.com/pydicom/pydicom/blob/935de3b4ac94a5f520f3c91b42220ff0f13bce54/pydicom/benchmarks/bench_handler_numpy.py#L203-L206 | ||
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/twisted/twisted/trial/reporter.py | python | TestResult.startTest | (self, test) | This must be called before the given test is commenced.
@type test: L{pyunit.TestCase} | This must be called before the given test is commenced. | [
"This",
"must",
"be",
"called",
"before",
"the",
"given",
"test",
"is",
"commenced",
"."
] | def startTest(self, test):
"""
This must be called before the given test is commenced.
@type test: L{pyunit.TestCase}
"""
super(TestResult, self).startTest(test)
self._testStarted = self._getTime() | [
"def",
"startTest",
"(",
"self",
",",
"test",
")",
":",
"super",
"(",
"TestResult",
",",
"self",
")",
".",
"startTest",
"(",
"test",
")",
"self",
".",
"_testStarted",
"=",
"self",
".",
"_getTime",
"(",
")"
] | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/twisted/twisted/trial/reporter.py#L88-L95 | ||
zopefoundation/Zope | ea04dd670d1a48d4d5c879d3db38fc2e9b4330bb | src/OFS/interfaces.py | python | IManageable.tabs_path_default | (REQUEST) | [] | def tabs_path_default(REQUEST):
"""
""" | [
"def",
"tabs_path_default",
"(",
"REQUEST",
")",
":"
] | https://github.com/zopefoundation/Zope/blob/ea04dd670d1a48d4d5c879d3db38fc2e9b4330bb/src/OFS/interfaces.py#L293-L295 | ||||
djblets/djblets | 0496e1ec49e43d43d776768c9fc5b6f8af56ec2c | djblets/datagrid/grids.py | python | DataGrid.precompute_objects | (self, render_context=None) | Pre-compute all objects used to render the datagrid.
This builds the queryset and stores the list of objects for use in
rendering the datagrid. It takes into consideration sorting,
the current page, and augmented queries from columns.
Args:
render_context (Context):
... | Pre-compute all objects used to render the datagrid. | [
"Pre",
"-",
"compute",
"all",
"objects",
"used",
"to",
"render",
"the",
"datagrid",
"."
] | def precompute_objects(self, render_context=None):
"""Pre-compute all objects used to render the datagrid.
This builds the queryset and stores the list of objects for use in
rendering the datagrid. It takes into consideration sorting,
the current page, and augmented queries from columns... | [
"def",
"precompute_objects",
"(",
"self",
",",
"render_context",
"=",
"None",
")",
":",
"query",
"=",
"self",
".",
"queryset",
"use_select_related",
"=",
"False",
"# Generate the actual list of fields we'll be sorting by",
"sort_list",
"=",
"[",
"]",
"for",
"sort_item... | https://github.com/djblets/djblets/blob/0496e1ec49e43d43d776768c9fc5b6f8af56ec2c/djblets/datagrid/grids.py#L1215-L1371 | ||
isce-framework/isce2 | 0e5114a8bede3caf1d533d98e44dfe4b983e3f48 | components/isceobj/TopsProc/runPrepESD.py | python | multilook | (intname, alks=5, rlks=15) | return outFile | Take looks. | Take looks. | [
"Take",
"looks",
"."
] | def multilook(intname, alks=5, rlks=15):
'''
Take looks.
'''
from mroipac.looks.Looks import Looks
inimg = isceobj.createImage()
inimg.load(intname + '.xml')
spl = os.path.splitext(intname)
ext = '.{0}alks_{1}rlks'.format(alks, rlks)
outFile = spl[0] + ext + spl[1]
lkObj = L... | [
"def",
"multilook",
"(",
"intname",
",",
"alks",
"=",
"5",
",",
"rlks",
"=",
"15",
")",
":",
"from",
"mroipac",
".",
"looks",
".",
"Looks",
"import",
"Looks",
"inimg",
"=",
"isceobj",
".",
"createImage",
"(",
")",
"inimg",
".",
"load",
"(",
"intname"... | https://github.com/isce-framework/isce2/blob/0e5114a8bede3caf1d533d98e44dfe4b983e3f48/components/isceobj/TopsProc/runPrepESD.py#L16-L39 | |
kuri65536/python-for-android | 26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891 | python-modules/twisted/twisted/words/protocols/msn.py | python | SwitchboardClient.sendTypingNotification | (self) | used to send a typing notification. Upon receiving this
message the official client will display a 'user is typing'
message to all other users in the chat session for 10 seconds.
The official client sends one of these every 5 seconds (I think)
as long as you continue to type. | used to send a typing notification. Upon receiving this
message the official client will display a 'user is typing'
message to all other users in the chat session for 10 seconds.
The official client sends one of these every 5 seconds (I think)
as long as you continue to type. | [
"used",
"to",
"send",
"a",
"typing",
"notification",
".",
"Upon",
"receiving",
"this",
"message",
"the",
"official",
"client",
"will",
"display",
"a",
"user",
"is",
"typing",
"message",
"to",
"all",
"other",
"users",
"in",
"the",
"chat",
"session",
"for",
... | def sendTypingNotification(self):
"""
used to send a typing notification. Upon receiving this
message the official client will display a 'user is typing'
message to all other users in the chat session for 10 seconds.
The official client sends one of these every 5 seconds (I think... | [
"def",
"sendTypingNotification",
"(",
"self",
")",
":",
"m",
"=",
"MSNMessage",
"(",
")",
"m",
".",
"ack",
"=",
"m",
".",
"MESSAGE_ACK_NONE",
"m",
".",
"setHeader",
"(",
"'Content-Type'",
",",
"'text/x-msmsgscontrol'",
")",
"m",
".",
"setHeader",
"(",
"'Ty... | https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-modules/twisted/twisted/words/protocols/msn.py#L1977-L1990 | ||
sensepost/objection | 658675f0e7716bd0899c9f6e9c45d25f38a699d8 | objection/commands/plugin_manager.py | python | load_plugin | (args: list = None) | Loads an objection plugin.
:param args:
:return: | Loads an objection plugin. | [
"Loads",
"an",
"objection",
"plugin",
"."
] | def load_plugin(args: list = None) -> None:
"""
Loads an objection plugin.
:param args:
:return:
"""
if len(args) <= 0:
click.secho('Usage: plugin load <plugin path> (<plugin namespace>)', bold=True)
return
path = os.path.abspath(args[0])
if os.path.isdir(p... | [
"def",
"load_plugin",
"(",
"args",
":",
"list",
"=",
"None",
")",
"->",
"None",
":",
"if",
"len",
"(",
"args",
")",
"<=",
"0",
":",
"click",
".",
"secho",
"(",
"'Usage: plugin load <plugin path> (<plugin namespace>)'",
",",
"bold",
"=",
"True",
")",
"retur... | https://github.com/sensepost/objection/blob/658675f0e7716bd0899c9f6e9c45d25f38a699d8/objection/commands/plugin_manager.py#L11-L59 | ||
enkore/i3pystatus | 34af13547dfb8407d9cf47473b8068e681dcc55f | i3pystatus/timer.py | python | Timer.start | (self, seconds=300) | Starts timer.
If timer is already running it will increase remaining time instead.
:param int seconds: Initial time. | Starts timer.
If timer is already running it will increase remaining time instead. | [
"Starts",
"timer",
".",
"If",
"timer",
"is",
"already",
"running",
"it",
"will",
"increase",
"remaining",
"time",
"instead",
"."
] | def start(self, seconds=300):
"""
Starts timer.
If timer is already running it will increase remaining time instead.
:param int seconds: Initial time.
"""
if self.state is TimerState.stopped:
self.compare = time.time() + abs(seconds)
self.state = ... | [
"def",
"start",
"(",
"self",
",",
"seconds",
"=",
"300",
")",
":",
"if",
"self",
".",
"state",
"is",
"TimerState",
".",
"stopped",
":",
"self",
".",
"compare",
"=",
"time",
".",
"time",
"(",
")",
"+",
"abs",
"(",
"seconds",
")",
"self",
".",
"sta... | https://github.com/enkore/i3pystatus/blob/34af13547dfb8407d9cf47473b8068e681dcc55f/i3pystatus/timer.py#L147-L158 | ||
biopython/biopython | 2dd97e71762af7b046d7f7f8a4f1e38db6b06c86 | Bio/UniGene/__init__.py | python | STSLine.__init__ | (self, text=None) | Initialize the class. | Initialize the class. | [
"Initialize",
"the",
"class",
"."
] | def __init__(self, text=None):
"""Initialize the class."""
self.acc = ""
self.unists = ""
if text is not None:
self.text = text
self._init_from_text(text) | [
"def",
"__init__",
"(",
"self",
",",
"text",
"=",
"None",
")",
":",
"self",
".",
"acc",
"=",
"\"\"",
"self",
".",
"unists",
"=",
"\"\"",
"if",
"text",
"is",
"not",
"None",
":",
"self",
".",
"text",
"=",
"text",
"self",
".",
"_init_from_text",
"(",
... | https://github.com/biopython/biopython/blob/2dd97e71762af7b046d7f7f8a4f1e38db6b06c86/Bio/UniGene/__init__.py#L184-L190 | ||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/cme/v20191029/models.py | python | DescribeClassRequest.__init__ | (self) | r"""
:param Platform: 平台名称,指定访问的平台。
:type Platform: str
:param Owner: 归属者。
:type Owner: :class:`tencentcloud.cme.v20191029.models.Entity`
:param Operator: 操作者。填写用户的 Id,用于标识调用者及校验操作权限。
:type Operator: str | r"""
:param Platform: 平台名称,指定访问的平台。
:type Platform: str
:param Owner: 归属者。
:type Owner: :class:`tencentcloud.cme.v20191029.models.Entity`
:param Operator: 操作者。填写用户的 Id,用于标识调用者及校验操作权限。
:type Operator: str | [
"r",
":",
"param",
"Platform",
":",
"平台名称,指定访问的平台。",
":",
"type",
"Platform",
":",
"str",
":",
"param",
"Owner",
":",
"归属者。",
":",
"type",
"Owner",
":",
":",
"class",
":",
"tencentcloud",
".",
"cme",
".",
"v20191029",
".",
"models",
".",
"Entity",
":",... | def __init__(self):
r"""
:param Platform: 平台名称,指定访问的平台。
:type Platform: str
:param Owner: 归属者。
:type Owner: :class:`tencentcloud.cme.v20191029.models.Entity`
:param Operator: 操作者。填写用户的 Id,用于标识调用者及校验操作权限。
:type Operator: str
"""
self.Platform = None... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"Platform",
"=",
"None",
"self",
".",
"Owner",
"=",
"None",
"self",
".",
"Operator",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/cme/v20191029/models.py#L1350-L1361 | ||
titusjan/argos | 5a9c31a8a9a2ca825bbf821aa1e685740e3682d7 | argos/inspector/pgplugins/pgctis.py | python | PgColorMapCtiEditor.getData | (self) | return self.selectionWidget.getCurrentColorMap() | Gets data from the editor widget. | Gets data from the editor widget. | [
"Gets",
"data",
"from",
"the",
"editor",
"widget",
"."
] | def getData(self):
""" Gets data from the editor widget.
"""
return self.selectionWidget.getCurrentColorMap() | [
"def",
"getData",
"(",
"self",
")",
":",
"return",
"self",
".",
"selectionWidget",
".",
"getCurrentColorMap",
"(",
")"
] | https://github.com/titusjan/argos/blob/5a9c31a8a9a2ca825bbf821aa1e685740e3682d7/argos/inspector/pgplugins/pgctis.py#L1053-L1056 | |
huggingface/transformers | 623b4f7c63f60cce917677ee704d6c93ee960b4b | src/transformers/models/electra/modeling_flax_electra.py | python | FlaxElectraTiedDense.setup | (self) | [] | def setup(self):
self.bias = self.param("bias", self.bias_init, (self.embedding_size,)) | [
"def",
"setup",
"(",
"self",
")",
":",
"self",
".",
"bias",
"=",
"self",
".",
"param",
"(",
"\"bias\"",
",",
"self",
".",
"bias_init",
",",
"(",
"self",
".",
"embedding_size",
",",
")",
")"
] | https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/models/electra/modeling_flax_electra.py#L678-L679 | ||||
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/densitymapbox/_colorbar.py | python | ColorBar.ticks | (self) | return self["ticks"] | Determines whether ticks are drawn or not. If "", this axis'
ticks are not drawn. If "outside" ("inside"), this axis' are
drawn outside (inside) the axis lines.
The 'ticks' property is an enumeration that may be specified as:
- One of the following enumeration values:
... | Determines whether ticks are drawn or not. If "", this axis'
ticks are not drawn. If "outside" ("inside"), this axis' are
drawn outside (inside) the axis lines.
The 'ticks' property is an enumeration that may be specified as:
- One of the following enumeration values:
... | [
"Determines",
"whether",
"ticks",
"are",
"drawn",
"or",
"not",
".",
"If",
"this",
"axis",
"ticks",
"are",
"not",
"drawn",
".",
"If",
"outside",
"(",
"inside",
")",
"this",
"axis",
"are",
"drawn",
"outside",
"(",
"inside",
")",
"the",
"axis",
"lines",
"... | def ticks(self):
"""
Determines whether ticks are drawn or not. If "", this axis'
ticks are not drawn. If "outside" ("inside"), this axis' are
drawn outside (inside) the axis lines.
The 'ticks' property is an enumeration that may be specified as:
- One of the follo... | [
"def",
"ticks",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"ticks\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/densitymapbox/_colorbar.py#L996-L1010 | |
seemoo-lab/internalblue | ba6ba0b99f835964395d6dd1b1eb7dd850398fd6 | internalblue/fw/fw.py | python | Firmware._module_to_firmware_definition | (self, fw: ModuleType) | Wrap existing usages where the module was used and extract the new FirmwareDefinition class
:param fw:
:return: | Wrap existing usages where the module was used and extract the new FirmwareDefinition class | [
"Wrap",
"existing",
"usages",
"where",
"the",
"module",
"was",
"used",
"and",
"extract",
"the",
"new",
"FirmwareDefinition",
"class"
] | def _module_to_firmware_definition(self, fw: ModuleType) -> FirmwareDefinition:
"""
Wrap existing usages where the module was used and extract the new FirmwareDefinition class
:param fw:
:return:
"""
_types = {
name: cls
for name, cls in fw.__dict... | [
"def",
"_module_to_firmware_definition",
"(",
"self",
",",
"fw",
":",
"ModuleType",
")",
"->",
"FirmwareDefinition",
":",
"_types",
"=",
"{",
"name",
":",
"cls",
"for",
"name",
",",
"cls",
"in",
"fw",
".",
"__dict__",
".",
"items",
"(",
")",
"if",
"isins... | https://github.com/seemoo-lab/internalblue/blob/ba6ba0b99f835964395d6dd1b1eb7dd850398fd6/internalblue/fw/fw.py#L152-L168 | ||
NVlabs/STEP | 59da38af240869fa6f1bc565803cff34aafdaa99 | external/ActivityNet/Evaluation/ava/np_box_list.py | python | BoxList.get_field | (self, field) | return self.data[field] | Accesses data associated with the specified field in the box collection.
Args:
field: a string parameter used to speficy a related field to be accessed.
Returns:
a numpy 1-d array representing data of an associated field
Raises:
ValueError: if invalid field | Accesses data associated with the specified field in the box collection. | [
"Accesses",
"data",
"associated",
"with",
"the",
"specified",
"field",
"in",
"the",
"box",
"collection",
"."
] | def get_field(self, field):
"""Accesses data associated with the specified field in the box collection.
Args:
field: a string parameter used to speficy a related field to be accessed.
Returns:
a numpy 1-d array representing data of an associated field
Raises:
ValueError: if invalid ... | [
"def",
"get_field",
"(",
"self",
",",
"field",
")",
":",
"if",
"not",
"self",
".",
"has_field",
"(",
"field",
")",
":",
"raise",
"ValueError",
"(",
"'field {} does not exist'",
".",
"format",
"(",
"field",
")",
")",
"return",
"self",
".",
"data",
"[",
... | https://github.com/NVlabs/STEP/blob/59da38af240869fa6f1bc565803cff34aafdaa99/external/ActivityNet/Evaluation/ava/np_box_list.py#L90-L104 | |
ring04h/wyportmap | c4201e2313504e780a7f25238eba2a2d3223e739 | sqlalchemy/sql/operators.py | python | ColumnOperators.concat | (self, other) | return self.operate(concat_op, other) | Implement the 'concat' operator.
In a column context, produces the clause ``a || b``,
or uses the ``concat()`` operator on MySQL. | Implement the 'concat' operator. | [
"Implement",
"the",
"concat",
"operator",
"."
] | def concat(self, other):
"""Implement the 'concat' operator.
In a column context, produces the clause ``a || b``,
or uses the ``concat()`` operator on MySQL.
"""
return self.operate(concat_op, other) | [
"def",
"concat",
"(",
"self",
",",
"other",
")",
":",
"return",
"self",
".",
"operate",
"(",
"concat_op",
",",
"other",
")"
] | https://github.com/ring04h/wyportmap/blob/c4201e2313504e780a7f25238eba2a2d3223e739/sqlalchemy/sql/operators.py#L360-L367 | |
fossasia/pslab-python | bb53a334b729d0956ed9f4ce6899903f3e4868ef | pslab/external/display.py | python | SSD1306.draw_horizontal_line | (self, x0, y0, length, color, update: bool = True) | Draw a horizontal line. | Draw a horizontal line. | [
"Draw",
"a",
"horizontal",
"line",
"."
] | def draw_horizontal_line(self, x0, y0, length, color, update: bool = True):
"""Draw a horizontal line."""
self.draw_line(x0, y0, x0 + length - 1, y0, color, update) | [
"def",
"draw_horizontal_line",
"(",
"self",
",",
"x0",
",",
"y0",
",",
"length",
",",
"color",
",",
"update",
":",
"bool",
"=",
"True",
")",
":",
"self",
".",
"draw_line",
"(",
"x0",
",",
"y0",
",",
"x0",
"+",
"length",
"-",
"1",
",",
"y0",
",",
... | https://github.com/fossasia/pslab-python/blob/bb53a334b729d0956ed9f4ce6899903f3e4868ef/pslab/external/display.py#L294-L296 | ||
Shizmob/pydle | 9798eb3db6665622fdd1391cdb563ebdb3014c6c | pydle/__init__.py | python | featurize | (*features) | return type(name, tuple(sorted_features), {}) | Put features into proper MRO order. | Put features into proper MRO order. | [
"Put",
"features",
"into",
"proper",
"MRO",
"order",
"."
] | def featurize(*features):
""" Put features into proper MRO order. """
from functools import cmp_to_key
def compare_subclass(left, right):
if issubclass(left, right):
return -1
elif issubclass(right, left):
return 1
return 0
sorted_features = sorted(featu... | [
"def",
"featurize",
"(",
"*",
"features",
")",
":",
"from",
"functools",
"import",
"cmp_to_key",
"def",
"compare_subclass",
"(",
"left",
",",
"right",
")",
":",
"if",
"issubclass",
"(",
"left",
",",
"right",
")",
":",
"return",
"-",
"1",
"elif",
"issubcl... | https://github.com/Shizmob/pydle/blob/9798eb3db6665622fdd1391cdb563ebdb3014c6c/pydle/__init__.py#L16-L30 | |
NeuromorphicProcessorProject/snn_toolbox | a85ada7b5d060500703285ef8a68f06ea1ffda65 | snntoolbox/simulation/utils.py | python | AbstractSNN.add_layer | (self, layer) | Do anything that concerns adding any layer independently of its
type.
Parameters
----------
layer: keras.layers.Layer | keras.layers.Conv
Layer | Do anything that concerns adding any layer independently of its
type. | [
"Do",
"anything",
"that",
"concerns",
"adding",
"any",
"layer",
"independently",
"of",
"its",
"type",
"."
] | def add_layer(self, layer):
"""Do anything that concerns adding any layer independently of its
type.
Parameters
----------
layer: keras.layers.Layer | keras.layers.Conv
Layer
"""
pass | [
"def",
"add_layer",
"(",
"self",
",",
"layer",
")",
":",
"pass"
] | https://github.com/NeuromorphicProcessorProject/snn_toolbox/blob/a85ada7b5d060500703285ef8a68f06ea1ffda65/snntoolbox/simulation/utils.py#L212-L223 | ||
taomujian/linbing | fe772a58f41e3b046b51a866bdb7e4655abaf51a | python/app/thirdparty/oneforall/modules/check/sitemap.py | python | Sitemap.check | (self) | 正则匹配域名的sitemap文件中的子域 | 正则匹配域名的sitemap文件中的子域 | [
"正则匹配域名的sitemap文件中的子域"
] | def check(self):
"""
正则匹配域名的sitemap文件中的子域
"""
filenames = {'sitemap.xml', 'sitemap.txt', 'sitemap.html', 'sitemapindex.xml'}
self.to_check(filenames) | [
"def",
"check",
"(",
"self",
")",
":",
"filenames",
"=",
"{",
"'sitemap.xml'",
",",
"'sitemap.txt'",
",",
"'sitemap.html'",
",",
"'sitemapindex.xml'",
"}",
"self",
".",
"to_check",
"(",
"filenames",
")"
] | https://github.com/taomujian/linbing/blob/fe772a58f41e3b046b51a866bdb7e4655abaf51a/python/app/thirdparty/oneforall/modules/check/sitemap.py#L14-L19 | ||
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/conversations/v1/service/conversation/webhook.py | python | WebhookInstance._proxy | (self) | return self._context | Generate an instance context for the instance, the context is capable of
performing various actions. All instance actions are proxied to the context
:returns: WebhookContext for this WebhookInstance
:rtype: twilio.rest.conversations.v1.service.conversation.webhook.WebhookContext | Generate an instance context for the instance, the context is capable of
performing various actions. All instance actions are proxied to the context | [
"Generate",
"an",
"instance",
"context",
"for",
"the",
"instance",
"the",
"context",
"is",
"capable",
"of",
"performing",
"various",
"actions",
".",
"All",
"instance",
"actions",
"are",
"proxied",
"to",
"the",
"context"
] | def _proxy(self):
"""
Generate an instance context for the instance, the context is capable of
performing various actions. All instance actions are proxied to the context
:returns: WebhookContext for this WebhookInstance
:rtype: twilio.rest.conversations.v1.service.conversation... | [
"def",
"_proxy",
"(",
"self",
")",
":",
"if",
"self",
".",
"_context",
"is",
"None",
":",
"self",
".",
"_context",
"=",
"WebhookContext",
"(",
"self",
".",
"_version",
",",
"chat_service_sid",
"=",
"self",
".",
"_solution",
"[",
"'chat_service_sid'",
"]",
... | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/conversations/v1/service/conversation/webhook.py#L379-L394 | |
steeve/xbmctorrent | e6bcb1037668959e1e3cb5ba8cf3e379c6638da9 | resources/site-packages/concurrent/futures/process.py | python | _python_exit | () | [] | def _python_exit():
global _shutdown
_shutdown = True
items = list(_threads_queues.items())
for t, q in items:
q.put(None)
for t, q in items:
t.join() | [
"def",
"_python_exit",
"(",
")",
":",
"global",
"_shutdown",
"_shutdown",
"=",
"True",
"items",
"=",
"list",
"(",
"_threads_queues",
".",
"items",
"(",
")",
")",
"for",
"t",
",",
"q",
"in",
"items",
":",
"q",
".",
"put",
"(",
"None",
")",
"for",
"t... | https://github.com/steeve/xbmctorrent/blob/e6bcb1037668959e1e3cb5ba8cf3e379c6638da9/resources/site-packages/concurrent/futures/process.py#L79-L86 | ||||
mesalock-linux/mesapy | ed546d59a21b36feb93e2309d5c6b75aa0ad95c9 | pypy/module/_cffi_backend/ffi_obj.py | python | W_FFIObject.descr_addressof | (self, w_arg, args_w) | return W_CData(space, cdata, w_ctypeptr) | \
Limited equivalent to the '&' operator in C:
1. ffi.addressof(<cdata 'struct-or-union'>) returns a cdata that is a
pointer to this struct or union.
2. ffi.addressof(<cdata>, field-or-index...) returns the address of a
field or array item inside the given structure or array, recursively
in case of nested structures ... | \
Limited equivalent to the '&' operator in C: | [
"\\",
"Limited",
"equivalent",
"to",
"the",
"&",
"operator",
"in",
"C",
":"
] | def descr_addressof(self, w_arg, args_w):
"""\
Limited equivalent to the '&' operator in C:
1. ffi.addressof(<cdata 'struct-or-union'>) returns a cdata that is a
pointer to this struct or union.
2. ffi.addressof(<cdata>, field-or-index...) returns the address of a
field or array item inside the given structur... | [
"def",
"descr_addressof",
"(",
"self",
",",
"w_arg",
",",
"args_w",
")",
":",
"#",
"from",
"pypy",
".",
"module",
".",
"_cffi_backend",
".",
"lib_obj",
"import",
"W_LibObject",
"space",
"=",
"self",
".",
"space",
"if",
"isinstance",
"(",
"w_arg",
",",
"W... | https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/pypy/module/_cffi_backend/ffi_obj.py#L211-L255 | |
WikidPad/WikidPad | 558109638807bc76b4672922686e416ab2d5f79c | WikidPad/lib/pwiki/WindowLayout.py | python | StorablePerspective.getStoredPerspective | (self) | Returns a unistring describing the contents of the window for
later recreation or None if this window can't be stored.
If a window doesn't need to store additional perspective data,
return empty unistring | Returns a unistring describing the contents of the window for
later recreation or None if this window can't be stored.
If a window doesn't need to store additional perspective data,
return empty unistring | [
"Returns",
"a",
"unistring",
"describing",
"the",
"contents",
"of",
"the",
"window",
"for",
"later",
"recreation",
"or",
"None",
"if",
"this",
"window",
"can",
"t",
"be",
"stored",
".",
"If",
"a",
"window",
"doesn",
"t",
"need",
"to",
"store",
"additional"... | def getStoredPerspective(self):
"""
Returns a unistring describing the contents of the window for
later recreation or None if this window can't be stored.
If a window doesn't need to store additional perspective data,
return empty unistring
"""
raise NotImplemente... | [
"def",
"getStoredPerspective",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/WikidPad/WikidPad/blob/558109638807bc76b4672922686e416ab2d5f79c/WikidPad/lib/pwiki/WindowLayout.py#L984-L991 | ||
mitshell/libmich | fe63c12d1d9466f2c39824625e63ac05b712a3a6 | libmich/asn1/parsers.py | python | parse_set | (Obj, text='') | return text | parses any set assigned to an ASN.1 type or class
set a dict {'root': list of values, 'ext': list of values or None} in Obj['val'],
each list containing ASN.1 values corresponding to the Obj type
returns the rest of the text | parses any set assigned to an ASN.1 type or class
set a dict {'root': list of values, 'ext': list of values or None} in Obj['val'],
each list containing ASN.1 values corresponding to the Obj type
returns the rest of the text | [
"parses",
"any",
"set",
"assigned",
"to",
"an",
"ASN",
".",
"1",
"type",
"or",
"class",
"set",
"a",
"dict",
"{",
"root",
":",
"list",
"of",
"values",
"ext",
":",
"list",
"of",
"values",
"or",
"None",
"}",
"in",
"Obj",
"[",
"val",
"]",
"each",
"li... | def parse_set(Obj, text=''):
'''
parses any set assigned to an ASN.1 type or class
set a dict {'root': list of values, 'ext': list of values or None} in Obj['val'],
each list containing ASN.1 values corresponding to the Obj type
returns the rest of the text
'''
text, text_set =... | [
"def",
"parse_set",
"(",
"Obj",
",",
"text",
"=",
"''",
")",
":",
"text",
",",
"text_set",
"=",
"extract_curlybrack",
"(",
"text",
")",
"if",
"text_set",
"is",
"None",
":",
"raise",
"(",
"ASN1_PROC_TEXT",
"(",
"'%s: invalid set: %s'",
"%",
"(",
"Obj",
".... | https://github.com/mitshell/libmich/blob/fe63c12d1d9466f2c39824625e63ac05b712a3a6/libmich/asn1/parsers.py#L1444-L1493 | |
Jenyay/outwiker | 50530cf7b3f71480bb075b2829bc0669773b835b | plugins/datagraph/datagraph/libs/dateutil/tz/tz.py | python | tzutc.is_ambiguous | (self, dt) | return False | Whether or not the "wall time" of a given datetime is ambiguous in this
zone.
:param dt:
A :py:class:`datetime.datetime`, naive or time zone aware.
:return:
Returns ``True`` if ambiguous, ``False`` otherwise.
.. versionadded:: 2.6.0 | Whether or not the "wall time" of a given datetime is ambiguous in this
zone. | [
"Whether",
"or",
"not",
"the",
"wall",
"time",
"of",
"a",
"given",
"datetime",
"is",
"ambiguous",
"in",
"this",
"zone",
"."
] | def is_ambiguous(self, dt):
"""
Whether or not the "wall time" of a given datetime is ambiguous in this
zone.
:param dt:
A :py:class:`datetime.datetime`, naive or time zone aware.
:return:
Returns ``True`` if ambiguous, ``False`` otherwise.
.. ... | [
"def",
"is_ambiguous",
"(",
"self",
",",
"dt",
")",
":",
"return",
"False"
] | https://github.com/Jenyay/outwiker/blob/50530cf7b3f71480bb075b2829bc0669773b835b/plugins/datagraph/datagraph/libs/dateutil/tz/tz.py#L46-L60 | |
datalad/datalad | d8c8383d878a207bb586415314219a60c345f732 | datalad/support/parallel.py | python | ProducerConsumer._producer_iter | (self) | return self.producer() if inspect.isgeneratorfunction(self.producer) else self.producer | A little helper to also support generator functions | A little helper to also support generator functions | [
"A",
"little",
"helper",
"to",
"also",
"support",
"generator",
"functions"
] | def _producer_iter(self):
"""A little helper to also support generator functions"""
return self.producer() if inspect.isgeneratorfunction(self.producer) else self.producer | [
"def",
"_producer_iter",
"(",
"self",
")",
":",
"return",
"self",
".",
"producer",
"(",
")",
"if",
"inspect",
".",
"isgeneratorfunction",
"(",
"self",
".",
"producer",
")",
"else",
"self",
".",
"producer"
] | https://github.com/datalad/datalad/blob/d8c8383d878a207bb586415314219a60c345f732/datalad/support/parallel.py#L309-L311 | |
WerWolv/EdiZon_CheatsConfigsAndScripts | d16d36c7509c01dca770f402babd83ff2e9ae6e7 | Scripts/lib/python3.5/poplib.py | python | POP3.user | (self, user) | return self._shortcmd('USER %s' % user) | Send user name, return response
(should indicate password required). | Send user name, return response | [
"Send",
"user",
"name",
"return",
"response"
] | def user(self, user):
"""Send user name, return response
(should indicate password required).
"""
return self._shortcmd('USER %s' % user) | [
"def",
"user",
"(",
"self",
",",
"user",
")",
":",
"return",
"self",
".",
"_shortcmd",
"(",
"'USER %s'",
"%",
"user",
")"
] | https://github.com/WerWolv/EdiZon_CheatsConfigsAndScripts/blob/d16d36c7509c01dca770f402babd83ff2e9ae6e7/Scripts/lib/python3.5/poplib.py#L198-L203 | |
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/cloudinary/api.py | python | resources_by_asset_ids | (asset_ids, **options) | return call_api("get", uri, params, **options) | Retrieves the resources (assets) indicated in the asset IDs.
This method does not return deleted assets even if they have been backed up.
See: `Get resources by context API reference
<https://cloudinary.com/documentation/admin_api#get_resources>`_
:param asset_ids: The requested asset IDs.
:type... | Retrieves the resources (assets) indicated in the asset IDs.
This method does not return deleted assets even if they have been backed up. | [
"Retrieves",
"the",
"resources",
"(",
"assets",
")",
"indicated",
"in",
"the",
"asset",
"IDs",
".",
"This",
"method",
"does",
"not",
"return",
"deleted",
"assets",
"even",
"if",
"they",
"have",
"been",
"backed",
"up",
"."
] | def resources_by_asset_ids(asset_ids, **options):
"""Retrieves the resources (assets) indicated in the asset IDs.
This method does not return deleted assets even if they have been backed up.
See: `Get resources by context API reference
<https://cloudinary.com/documentation/admin_api#get_resources>`_
... | [
"def",
"resources_by_asset_ids",
"(",
"asset_ids",
",",
"*",
"*",
"options",
")",
":",
"uri",
"=",
"[",
"\"resources\"",
",",
"'by_asset_ids'",
"]",
"params",
"=",
"dict",
"(",
"only",
"(",
"options",
",",
"\"tags\"",
",",
"\"moderations\"",
",",
"\"context\... | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/cloudinary/api.py#L96-L112 | |
ynhacler/RedKindle | 7c970920dc840f869e38cbda480d630cc2e7b200 | rq2/compat/dictconfig.py | python | DictConfigurator.add_handlers | (self, logger, handlers) | Add handlers to a logger from a list of names. | Add handlers to a logger from a list of names. | [
"Add",
"handlers",
"to",
"a",
"logger",
"from",
"a",
"list",
"of",
"names",
"."
] | def add_handlers(self, logger, handlers):
"""Add handlers to a logger from a list of names."""
for h in handlers:
try:
logger.addHandler(self.config['handlers'][h])
except Exception as e:
raise ValueError('Unable to add handler %r: %s' % (h, e)) | [
"def",
"add_handlers",
"(",
"self",
",",
"logger",
",",
"handlers",
")",
":",
"for",
"h",
"in",
"handlers",
":",
"try",
":",
"logger",
".",
"addHandler",
"(",
"self",
".",
"config",
"[",
"'handlers'",
"]",
"[",
"h",
"]",
")",
"except",
"Exception",
"... | https://github.com/ynhacler/RedKindle/blob/7c970920dc840f869e38cbda480d630cc2e7b200/rq2/compat/dictconfig.py#L510-L516 | ||
OCA/l10n-spain | 99050907670a70307fcd8cdfb6f3400d9e120df4 | l10n_es_ticketbai_api/models/ticketbai_invoice_customer.py | python | TicketBaiInvoiceCustomer._check_zip | (self) | [] | def _check_zip(self):
for record in self:
if record.zip and 20 < len(record.zip):
raise exceptions.ValidationError(
_(
"TicketBAI Invoice %s:\n"
"Customer %s ZIP Code %s longer than expected. "
... | [
"def",
"_check_zip",
"(",
"self",
")",
":",
"for",
"record",
"in",
"self",
":",
"if",
"record",
".",
"zip",
"and",
"20",
"<",
"len",
"(",
"record",
".",
"zip",
")",
":",
"raise",
"exceptions",
".",
"ValidationError",
"(",
"_",
"(",
"\"TicketBAI Invoice... | https://github.com/OCA/l10n-spain/blob/99050907670a70307fcd8cdfb6f3400d9e120df4/l10n_es_ticketbai_api/models/ticketbai_invoice_customer.py#L144-L154 | ||||
glue-viz/glue | 840b4c1364b0fa63bf67c914540c93dd71df41e1 | glue/core/hub.py | python | Hub.subscribe | (self, subscriber, message_class,
handler=None,
filter=lambda x: True) | Subscribe an object to a type of message class.
:param subscriber: The subscribing object
:type subscriber: :class:`~glue.core.hub.HubListener`
:param message_class: A :class:`~glue.core.message.Message` class
to subscribe to
:param handler:
An... | Subscribe an object to a type of message class. | [
"Subscribe",
"an",
"object",
"to",
"a",
"type",
"of",
"message",
"class",
"."
] | def subscribe(self, subscriber, message_class,
handler=None,
filter=lambda x: True):
"""Subscribe an object to a type of message class.
:param subscriber: The subscribing object
:type subscriber: :class:`~glue.core.hub.HubListener`
:param message_cla... | [
"def",
"subscribe",
"(",
"self",
",",
"subscriber",
",",
"message_class",
",",
"handler",
"=",
"None",
",",
"filter",
"=",
"lambda",
"x",
":",
"True",
")",
":",
"if",
"not",
"isinstance",
"(",
"subscriber",
",",
"HubListener",
")",
":",
"raise",
"Invalid... | https://github.com/glue-viz/glue/blob/840b4c1364b0fa63bf67c914540c93dd71df41e1/glue/core/hub.py#L69-L116 | ||
IJDykeman/wangTiles | 7c1ee2095ebdf7f72bce07d94c6484915d5cae8b | experimental_code/tiles_3d/venv/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py | python | _Stream.seek | (self, pos=0) | return self.pos | Set the stream's file pointer to pos. Negative seeking
is forbidden. | Set the stream's file pointer to pos. Negative seeking
is forbidden. | [
"Set",
"the",
"stream",
"s",
"file",
"pointer",
"to",
"pos",
".",
"Negative",
"seeking",
"is",
"forbidden",
"."
] | def seek(self, pos=0):
"""Set the stream's file pointer to pos. Negative seeking
is forbidden.
"""
if pos - self.pos >= 0:
blocks, remainder = divmod(pos - self.pos, self.bufsize)
for i in range(blocks):
self.read(self.bufsize)
self.... | [
"def",
"seek",
"(",
"self",
",",
"pos",
"=",
"0",
")",
":",
"if",
"pos",
"-",
"self",
".",
"pos",
">=",
"0",
":",
"blocks",
",",
"remainder",
"=",
"divmod",
"(",
"pos",
"-",
"self",
".",
"pos",
",",
"self",
".",
"bufsize",
")",
"for",
"i",
"i... | https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py#L552-L563 | |
wistbean/learn_python3_spider | 73c873f4845f4385f097e5057407d03dd37a117b | stackoverflow/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/html5lib/serializer.py | python | HTMLSerializer.render | (self, treewalker, encoding=None) | Serializes the stream from the treewalker into a string
:arg treewalker: the treewalker to serialize
:arg encoding: the string encoding to use
:returns: the serialized tree
Example:
>>> from html5lib import parse, getTreeWalker
>>> from html5lib.serializer import HTM... | Serializes the stream from the treewalker into a string | [
"Serializes",
"the",
"stream",
"from",
"the",
"treewalker",
"into",
"a",
"string"
] | def render(self, treewalker, encoding=None):
"""Serializes the stream from the treewalker into a string
:arg treewalker: the treewalker to serialize
:arg encoding: the string encoding to use
:returns: the serialized tree
Example:
>>> from html5lib import parse, getTr... | [
"def",
"render",
"(",
"self",
",",
"treewalker",
",",
"encoding",
"=",
"None",
")",
":",
"if",
"encoding",
":",
"return",
"b\"\"",
".",
"join",
"(",
"list",
"(",
"self",
".",
"serialize",
"(",
"treewalker",
",",
"encoding",
")",
")",
")",
"else",
":"... | https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/html5lib/serializer.py#L375-L398 | ||
googlefonts/nototools | 903a218f62256a286cde48c76b3051703f8a1de5 | nototools/generate_samples.py | python | _canonicalize_escapes | (definition_lines) | return out_lines | Replace each escape of a reserved character with a unicode escape. | Replace each escape of a reserved character with a unicode escape. | [
"Replace",
"each",
"escape",
"of",
"a",
"reserved",
"character",
"with",
"a",
"unicode",
"escape",
"."
] | def _canonicalize_escapes(definition_lines):
"""Replace each escape of a reserved character with a unicode escape."""
out_lines = []
for line in definition_lines:
if "\\" in line:
for old, new in _ESCAPES:
line = line.replace(old, new)
out_lines.append(line)
r... | [
"def",
"_canonicalize_escapes",
"(",
"definition_lines",
")",
":",
"out_lines",
"=",
"[",
"]",
"for",
"line",
"in",
"definition_lines",
":",
"if",
"\"\\\\\"",
"in",
"line",
":",
"for",
"old",
",",
"new",
"in",
"_ESCAPES",
":",
"line",
"=",
"line",
".",
"... | https://github.com/googlefonts/nototools/blob/903a218f62256a286cde48c76b3051703f8a1de5/nototools/generate_samples.py#L260-L268 | |
keiffster/program-y | 8c99b56f8c32f01a7b9887b5daae9465619d0385 | src/programy/storage/stores/sql/dao/node.py | python | PatternNode.__repr__ | (self) | return "<Pattern Node(id='%s', name='%s', node_class='%s')>" % (
DAOUtils.valid_id(self.id), self.name, self.node_class) | [] | def __repr__(self):
return "<Pattern Node(id='%s', name='%s', node_class='%s')>" % (
DAOUtils.valid_id(self.id), self.name, self.node_class) | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"\"<Pattern Node(id='%s', name='%s', node_class='%s')>\"",
"%",
"(",
"DAOUtils",
".",
"valid_id",
"(",
"self",
".",
"id",
")",
",",
"self",
".",
"name",
",",
"self",
".",
"node_class",
")"
] | https://github.com/keiffster/program-y/blob/8c99b56f8c32f01a7b9887b5daae9465619d0385/src/programy/storage/stores/sql/dao/node.py#L33-L35 | |||
bamtercelboo/cnn-lstm-bilstm-deepcnn-clstm-in-pytorch | 71b8c3f21b6dbc39562a3f8f221e90a1c7d9592f | main.py | python | start_train | (model, train_iter, dev_iter, test_iter) | :function:start train
:param model:
:param train_iter:
:param dev_iter:
:param test_iter:
:return: | :function:start train
:param model:
:param train_iter:
:param dev_iter:
:param test_iter:
:return: | [
":",
"function:start",
"train",
":",
"param",
"model",
":",
":",
"param",
"train_iter",
":",
":",
"param",
"dev_iter",
":",
":",
"param",
"test_iter",
":",
":",
"return",
":"
] | def start_train(model, train_iter, dev_iter, test_iter):
"""
:function:start train
:param model:
:param train_iter:
:param dev_iter:
:param test_iter:
:return:
"""
if config.predict is not None:
label = train_ALL_CNN.predict(config.predict, model, config.text_field, config.la... | [
"def",
"start_train",
"(",
"model",
",",
"train_iter",
",",
"dev_iter",
",",
"test_iter",
")",
":",
"if",
"config",
".",
"predict",
"is",
"not",
"None",
":",
"label",
"=",
"train_ALL_CNN",
".",
"predict",
"(",
"config",
".",
"predict",
",",
"model",
",",... | https://github.com/bamtercelboo/cnn-lstm-bilstm-deepcnn-clstm-in-pytorch/blob/71b8c3f21b6dbc39562a3f8f221e90a1c7d9592f/main.py#L328-L415 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.