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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
django-haystack/django-haystack | b6dd72e6b5c97b782f5436b7bb4e8227ba6e3b06 | haystack/query.py | python | ValuesListSearchQuerySet.post_process_results | (self, results) | return to_cache | [] | def post_process_results(self, results):
to_cache = []
if self._flat:
accum = to_cache.extend
else:
accum = to_cache.append
for result in results:
accum([getattr(result, i, None) for i in self._fields])
return to_cache | [
"def",
"post_process_results",
"(",
"self",
",",
"results",
")",
":",
"to_cache",
"=",
"[",
"]",
"if",
"self",
".",
"_flat",
":",
"accum",
"=",
"to_cache",
".",
"extend",
"else",
":",
"accum",
"=",
"to_cache",
".",
"append",
"for",
"result",
"in",
"res... | https://github.com/django-haystack/django-haystack/blob/b6dd72e6b5c97b782f5436b7bb4e8227ba6e3b06/haystack/query.py#L692-L703 | |||
radlab/sparrow | afb8efadeb88524f1394d1abe4ea66c6fd2ac744 | src/main/python/parse_per_task_logs.py | python | Request.queue_times | (self) | return queue_times | Returns a list of queue times for all complete __tasks. | Returns a list of queue times for all complete __tasks. | [
"Returns",
"a",
"list",
"of",
"queue",
"times",
"for",
"all",
"complete",
"__tasks",
"."
] | def queue_times(self):
""" Returns a list of queue times for all complete __tasks. """
queue_times = []
for task in self.__tasks.values():
if task.complete():
queue_times.append(task.queued_time())
return queue_times | [
"def",
"queue_times",
"(",
"self",
")",
":",
"queue_times",
"=",
"[",
"]",
"for",
"task",
"in",
"self",
".",
"__tasks",
".",
"values",
"(",
")",
":",
"if",
"task",
".",
"complete",
"(",
")",
":",
"queue_times",
".",
"append",
"(",
"task",
".",
"que... | https://github.com/radlab/sparrow/blob/afb8efadeb88524f1394d1abe4ea66c6fd2ac744/src/main/python/parse_per_task_logs.py#L359-L365 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/ads/binary_sensor.py | python | AdsBinarySensor.__init__ | (self, ads_hub, name, ads_var, device_class) | Initialize ADS binary sensor. | Initialize ADS binary sensor. | [
"Initialize",
"ADS",
"binary",
"sensor",
"."
] | def __init__(self, ads_hub, name, ads_var, device_class):
"""Initialize ADS binary sensor."""
super().__init__(ads_hub, name, ads_var)
self._attr_device_class = device_class or BinarySensorDeviceClass.MOVING | [
"def",
"__init__",
"(",
"self",
",",
"ads_hub",
",",
"name",
",",
"ads_var",
",",
"device_class",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"ads_hub",
",",
"name",
",",
"ads_var",
")",
"self",
".",
"_attr_device_class",
"=",
"device_class",
"or"... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/ads/binary_sensor.py#L51-L54 | ||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/modules/selinux.py | python | port_delete_policy | (name, protocol=None, port=None) | return _port_add_or_delete_policy("delete", name, None, protocol, port, None) | .. versionadded:: 2019.2.0
Deletes the SELinux policy for a given protocol and port.
Returns the result of the call to semanage.
name
The protocol and port spec. Can be formatted as ``(tcp|udp)/(port|port-range)``.
protocol
The protocol for the port, ``tcp`` or ``udp``. Required if n... | .. versionadded:: 2019.2.0 | [
"..",
"versionadded",
"::",
"2019",
".",
"2",
".",
"0"
] | def port_delete_policy(name, protocol=None, port=None):
"""
.. versionadded:: 2019.2.0
Deletes the SELinux policy for a given protocol and port.
Returns the result of the call to semanage.
name
The protocol and port spec. Can be formatted as ``(tcp|udp)/(port|port-range)``.
protocol
... | [
"def",
"port_delete_policy",
"(",
"name",
",",
"protocol",
"=",
"None",
",",
"port",
"=",
"None",
")",
":",
"return",
"_port_add_or_delete_policy",
"(",
"\"delete\"",
",",
"name",
",",
"None",
",",
"protocol",
",",
"port",
",",
"None",
")"
] | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/selinux.py#L805-L829 | |
pyscf/pyscf | 0adfb464333f5ceee07b664f291d4084801bae64 | pyscf/pbc/scf/khf.py | python | analyze | (mf, verbose=logger.DEBUG, with_meta_lowdin=WITH_META_LOWDIN,
**kwargs) | Analyze the given SCF object: print orbital energies, occupancies;
print orbital coefficients; Mulliken population analysis; Dipole moment | Analyze the given SCF object: print orbital energies, occupancies;
print orbital coefficients; Mulliken population analysis; Dipole moment | [
"Analyze",
"the",
"given",
"SCF",
"object",
":",
"print",
"orbital",
"energies",
"occupancies",
";",
"print",
"orbital",
"coefficients",
";",
"Mulliken",
"population",
"analysis",
";",
"Dipole",
"moment"
] | def analyze(mf, verbose=logger.DEBUG, with_meta_lowdin=WITH_META_LOWDIN,
**kwargs):
'''Analyze the given SCF object: print orbital energies, occupancies;
print orbital coefficients; Mulliken population analysis; Dipole moment
'''
mf.dump_scf_summary(verbose)
mo_occ = mf.mo_occ
mo_c... | [
"def",
"analyze",
"(",
"mf",
",",
"verbose",
"=",
"logger",
".",
"DEBUG",
",",
"with_meta_lowdin",
"=",
"WITH_META_LOWDIN",
",",
"*",
"*",
"kwargs",
")",
":",
"mf",
".",
"dump_scf_summary",
"(",
"verbose",
")",
"mo_occ",
"=",
"mf",
".",
"mo_occ",
"mo_coe... | https://github.com/pyscf/pyscf/blob/0adfb464333f5ceee07b664f291d4084801bae64/pyscf/pbc/scf/khf.py#L280-L294 | ||
aneisch/home-assistant-config | 86e381fde9609cb8871c439c433c12989e4e225d | custom_components/monitor_docker/switch.py | python | DockerContainerSwitch.event_callback | (self, name="", remove=False) | Callback for update of container information. | Callback for update of container information. | [
"Callback",
"for",
"update",
"of",
"container",
"information",
"."
] | def event_callback(self, name="", remove=False):
"""Callback for update of container information."""
if remove:
# If already called before, do not remove it again
if self._removed:
return
_LOGGER.info("[%s] %s: Removing switch entity", self._instance... | [
"def",
"event_callback",
"(",
"self",
",",
"name",
"=",
"\"\"",
",",
"remove",
"=",
"False",
")",
":",
"if",
"remove",
":",
"# If already called before, do not remove it again",
"if",
"self",
".",
"_removed",
":",
"return",
"_LOGGER",
".",
"info",
"(",
"\"[%s]... | https://github.com/aneisch/home-assistant-config/blob/86e381fde9609cb8871c439c433c12989e4e225d/custom_components/monitor_docker/switch.py#L197-L227 | ||
HonglinChu/SiamTrackers | 8471660b14f970578a43f077b28207d44a27e867 | SiamFCpp/SiamFCpp-video_analyst/siamfcpp/utils/visualization.py | python | VideoWriter.__init__ | (self, video_file, fps=25, scale=1.0) | :param video_file: path to write video. Perform nothing in case of None
:param fps: frame per second
:param scale: resize scale | [] | def __init__(self, video_file, fps=25, scale=1.0):
"""
:param video_file: path to write video. Perform nothing in case of None
:param fps: frame per second
:param scale: resize scale
"""
self.video_file = video_file
self.fps = fps
self.writer = None
... | [
"def",
"__init__",
"(",
"self",
",",
"video_file",
",",
"fps",
"=",
"25",
",",
"scale",
"=",
"1.0",
")",
":",
"self",
".",
"video_file",
"=",
"video_file",
"self",
".",
"fps",
"=",
"fps",
"self",
".",
"writer",
"=",
"None",
"self",
".",
"scale",
"=... | https://github.com/HonglinChu/SiamTrackers/blob/8471660b14f970578a43f077b28207d44a27e867/SiamFCpp/SiamFCpp-video_analyst/siamfcpp/utils/visualization.py#L17-L27 | |||
naftaliharris/tauthon | 5587ceec329b75f7caf6d65a036db61ac1bae214 | Lib/idlelib/CallTips.py | python | get_arg_text | (ob) | return argspec | Return a string describing the signature of a callable object, or ''.
For Python-coded functions and methods, the first line is introspected.
Delete 'self' parameter for classes (.__init__) and bound methods.
The next lines are the first lines of the doc string up to the first
empty line or _MAX_LINES.... | Return a string describing the signature of a callable object, or ''. | [
"Return",
"a",
"string",
"describing",
"the",
"signature",
"of",
"a",
"callable",
"object",
"or",
"."
] | def get_arg_text(ob):
'''Return a string describing the signature of a callable object, or ''.
For Python-coded functions and methods, the first line is introspected.
Delete 'self' parameter for classes (.__init__) and bound methods.
The next lines are the first lines of the doc string up to the first
... | [
"def",
"get_arg_text",
"(",
"ob",
")",
":",
"argspec",
"=",
"\"\"",
"try",
":",
"ob_call",
"=",
"ob",
".",
"__call__",
"except",
"BaseException",
":",
"if",
"type",
"(",
"ob",
")",
"is",
"types",
".",
"ClassType",
":",
"# old-style",
"ob_call",
"=",
"o... | https://github.com/naftaliharris/tauthon/blob/5587ceec329b75f7caf6d65a036db61ac1bae214/Lib/idlelib/CallTips.py#L139-L215 | |
hexway/apple_bleee | 1f8022959be660b561e6004b808dd93fa252bc90 | npyscreen/wgwidget.py | python | InputHandler.set_up_handlers | (self) | This function should be called somewhere during object initialisation (which all library-defined widgets do). You might like to override this in your own definition,
but in most cases the add_handers or add_complex_handlers methods are what you want. | This function should be called somewhere during object initialisation (which all library-defined widgets do). You might like to override this in your own definition,
but in most cases the add_handers or add_complex_handlers methods are what you want. | [
"This",
"function",
"should",
"be",
"called",
"somewhere",
"during",
"object",
"initialisation",
"(",
"which",
"all",
"library",
"-",
"defined",
"widgets",
"do",
")",
".",
"You",
"might",
"like",
"to",
"override",
"this",
"in",
"your",
"own",
"definition",
"... | def set_up_handlers(self):
"""This function should be called somewhere during object initialisation (which all library-defined widgets do). You might like to override this in your own definition,
but in most cases the add_handers or add_complex_handlers methods are what you want."""
#called in __init__
... | [
"def",
"set_up_handlers",
"(",
"self",
")",
":",
"#called in __init__",
"self",
".",
"handlers",
"=",
"{",
"curses",
".",
"ascii",
".",
"NL",
":",
"self",
".",
"h_exit_down",
",",
"curses",
".",
"ascii",
".",
"CR",
":",
"self",
".",
"h_exit_down",
",",
... | https://github.com/hexway/apple_bleee/blob/1f8022959be660b561e6004b808dd93fa252bc90/npyscreen/wgwidget.py#L103-L122 | ||
jython/jython3 | def4f8ec47cb7a9c799ea4c745f12badf92c5769 | lib-python/3.5.1/urllib/request.py | python | URLopener.open_http | (self, url, data=None) | return self._open_generic_http(http.client.HTTPConnection, url, data) | Use HTTP protocol. | Use HTTP protocol. | [
"Use",
"HTTP",
"protocol",
"."
] | def open_http(self, url, data=None):
"""Use HTTP protocol."""
return self._open_generic_http(http.client.HTTPConnection, url, data) | [
"def",
"open_http",
"(",
"self",
",",
"url",
",",
"data",
"=",
"None",
")",
":",
"return",
"self",
".",
"_open_generic_http",
"(",
"http",
".",
"client",
".",
"HTTPConnection",
",",
"url",
",",
"data",
")"
] | https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/lib-python/3.5.1/urllib/request.py#L1861-L1863 | |
freewym/espresso | 6671c507350295269e38add57dbe601dcb8e6ecf | fairseq/models/roberta/model.py | python | RobertaEncoder.forward | (
self,
src_tokens,
features_only=False,
return_all_hiddens=False,
masked_tokens=None,
**unused,
) | return x, extra | Args:
src_tokens (LongTensor): input tokens of shape `(batch, src_len)`
features_only (bool, optional): skip LM head and just return
features. If True, the output will be of shape
`(batch, src_len, embed_dim)`.
return_all_hiddens (bool, optional): also... | Args:
src_tokens (LongTensor): input tokens of shape `(batch, src_len)`
features_only (bool, optional): skip LM head and just return
features. If True, the output will be of shape
`(batch, src_len, embed_dim)`.
return_all_hiddens (bool, optional): also... | [
"Args",
":",
"src_tokens",
"(",
"LongTensor",
")",
":",
"input",
"tokens",
"of",
"shape",
"(",
"batch",
"src_len",
")",
"features_only",
"(",
"bool",
"optional",
")",
":",
"skip",
"LM",
"head",
"and",
"just",
"return",
"features",
".",
"If",
"True",
"the... | def forward(
self,
src_tokens,
features_only=False,
return_all_hiddens=False,
masked_tokens=None,
**unused,
):
"""
Args:
src_tokens (LongTensor): input tokens of shape `(batch, src_len)`
features_only (bool, optional): skip LM h... | [
"def",
"forward",
"(",
"self",
",",
"src_tokens",
",",
"features_only",
"=",
"False",
",",
"return_all_hiddens",
"=",
"False",
",",
"masked_tokens",
"=",
"None",
",",
"*",
"*",
"unused",
",",
")",
":",
"x",
",",
"extra",
"=",
"self",
".",
"extract_featur... | https://github.com/freewym/espresso/blob/6671c507350295269e38add57dbe601dcb8e6ecf/fairseq/models/roberta/model.py#L558-L587 | |
guildai/guildai | 1665985a3d4d788efc1a3180ca51cc417f71ca78 | guild/external/pip/_vendor/requests/models.py | python | PreparedRequest.prepare_hooks | (self, hooks) | Prepares the given hooks. | Prepares the given hooks. | [
"Prepares",
"the",
"given",
"hooks",
"."
] | def prepare_hooks(self, hooks):
"""Prepares the given hooks."""
# hooks can be passed as None to the prepare method and to this
# method. To prevent iterating over None, simply use an empty list
# if hooks is False-y
hooks = hooks or []
for event in hooks:
sel... | [
"def",
"prepare_hooks",
"(",
"self",
",",
"hooks",
")",
":",
"# hooks can be passed as None to the prepare method and to this",
"# method. To prevent iterating over None, simply use an empty list",
"# if hooks is False-y",
"hooks",
"=",
"hooks",
"or",
"[",
"]",
"for",
"event",
... | https://github.com/guildai/guildai/blob/1665985a3d4d788efc1a3180ca51cc417f71ca78/guild/external/pip/_vendor/requests/models.py#L572-L579 | ||
fluentpython/example-code-2e | 80f7f84274a47579e59c29a4657691525152c9d5 | 12-seq-hacking/vector_v2.py | python | Vector.__len__ | (self) | return len(self._components) | [] | def __len__(self):
return len(self._components) | [
"def",
"__len__",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"_components",
")"
] | https://github.com/fluentpython/example-code-2e/blob/80f7f84274a47579e59c29a4657691525152c9d5/12-seq-hacking/vector_v2.py#L149-L150 | |||
proycon/pynlpl | 7707f69a91caaa6cde037f0d0379f1d42500a68b | pynlpl/statistics.py | python | FrequencyList.__contains__ | (self, type) | return type in self._count | Checks if the specified type is in the frequency list | Checks if the specified type is in the frequency list | [
"Checks",
"if",
"the",
"specified",
"type",
"is",
"in",
"the",
"frequency",
"list"
] | def __contains__(self, type):
"""Checks if the specified type is in the frequency list"""
if self.dovalidation: type = self._validate(type)
return type in self._count | [
"def",
"__contains__",
"(",
"self",
",",
"type",
")",
":",
"if",
"self",
".",
"dovalidation",
":",
"type",
"=",
"self",
".",
"_validate",
"(",
"type",
")",
"return",
"type",
"in",
"self",
".",
"_count"
] | https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/statistics.py#L167-L170 | |
Source-Python-Dev-Team/Source.Python | d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb | addons/source-python/packages/site-packages/sqlalchemy/orm/interfaces.py | python | MapperOption.process_query_conditionally | (self, query) | same as process_query(), except that this option may not
apply to the given query.
This is typically used during a lazy load or scalar refresh
operation to propagate options stated in the original Query to the
new Query being used for the load. It occurs for those options that
... | same as process_query(), except that this option may not
apply to the given query. | [
"same",
"as",
"process_query",
"()",
"except",
"that",
"this",
"option",
"may",
"not",
"apply",
"to",
"the",
"given",
"query",
"."
] | def process_query_conditionally(self, query):
"""same as process_query(), except that this option may not
apply to the given query.
This is typically used during a lazy load or scalar refresh
operation to propagate options stated in the original Query to the
new Query being used... | [
"def",
"process_query_conditionally",
"(",
"self",
",",
"query",
")",
":",
"self",
".",
"process_query",
"(",
"query",
")"
] | https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/packages/site-packages/sqlalchemy/orm/interfaces.py#L568-L579 | ||
bytedance/byteps | d0bcf1a87ee87539ceb29bcc976d4da063ffc47b | byteps/torch/compression.py | python | Compressor.decompress | (tensor, ctx) | Decompress the tensor with the given context. | Decompress the tensor with the given context. | [
"Decompress",
"the",
"tensor",
"with",
"the",
"given",
"context",
"."
] | def decompress(tensor, ctx):
"""Decompress the tensor with the given context."""
pass | [
"def",
"decompress",
"(",
"tensor",
",",
"ctx",
")",
":",
"pass"
] | https://github.com/bytedance/byteps/blob/d0bcf1a87ee87539ceb29bcc976d4da063ffc47b/byteps/torch/compression.py#L29-L31 | ||
lovelylain/pyctp | fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d | futures/ctp/ApiStruct.py | python | ReqOpenAccount.__init__ | (self, TradeCode='', BankID='', BankBranchID='', BrokerID='', BrokerBranchID='', TradeDate='', TradeTime='', BankSerial='', TradingDay='', PlateSerial=0, LastFragment=LF_Yes, SessionID=0, CustomerName='', IdCardType=ICT_EID, IdentifiedCardNo='', Gender=GD_Unknown, CountryCode='', CustType=CUSTT_Person, Address='', ZipC... | [] | def __init__(self, TradeCode='', BankID='', BankBranchID='', BrokerID='', BrokerBranchID='', TradeDate='', TradeTime='', BankSerial='', TradingDay='', PlateSerial=0, LastFragment=LF_Yes, SessionID=0, CustomerName='', IdCardType=ICT_EID, IdentifiedCardNo='', Gender=GD_Unknown, CountryCode='', CustType=CUSTT_Person, Addr... | [
"def",
"__init__",
"(",
"self",
",",
"TradeCode",
"=",
"''",
",",
"BankID",
"=",
"''",
",",
"BankBranchID",
"=",
"''",
",",
"BrokerID",
"=",
"''",
",",
"BrokerBranchID",
"=",
"''",
",",
"TradeDate",
"=",
"''",
",",
"TradeTime",
"=",
"''",
",",
"BankS... | https://github.com/lovelylain/pyctp/blob/fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d/futures/ctp/ApiStruct.py#L4757-L4801 | ||||
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/conversations/v1/user/__init__.py | python | UserInstance.friendly_name | (self) | return self._properties['friendly_name'] | :returns: The string that you assigned to describe the resource
:rtype: unicode | :returns: The string that you assigned to describe the resource
:rtype: unicode | [
":",
"returns",
":",
"The",
"string",
"that",
"you",
"assigned",
"to",
"describe",
"the",
"resource",
":",
"rtype",
":",
"unicode"
] | def friendly_name(self):
"""
:returns: The string that you assigned to describe the resource
:rtype: unicode
"""
return self._properties['friendly_name'] | [
"def",
"friendly_name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_properties",
"[",
"'friendly_name'",
"]"
] | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/conversations/v1/user/__init__.py#L386-L391 | |
IJDykeman/wangTiles | 7c1ee2095ebdf7f72bce07d94c6484915d5cae8b | experimental_code/tiles_3d/venv_mac_py3/lib/python2.7/site-packages/pip/_internal/utils/misc.py | python | renames | (old, new) | Like os.renames(), but handles renaming across devices. | Like os.renames(), but handles renaming across devices. | [
"Like",
"os",
".",
"renames",
"()",
"but",
"handles",
"renaming",
"across",
"devices",
"."
] | def renames(old, new):
"""Like os.renames(), but handles renaming across devices."""
# Implementation borrowed from os.renames().
head, tail = os.path.split(new)
if head and tail and not os.path.exists(head):
os.makedirs(head)
shutil.move(old, new)
head, tail = os.path.split(old)
i... | [
"def",
"renames",
"(",
"old",
",",
"new",
")",
":",
"# Implementation borrowed from os.renames().",
"head",
",",
"tail",
"=",
"os",
".",
"path",
".",
"split",
"(",
"new",
")",
"if",
"head",
"and",
"tail",
"and",
"not",
"os",
".",
"path",
".",
"exists",
... | https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv_mac_py3/lib/python2.7/site-packages/pip/_internal/utils/misc.py#L269-L283 | ||
kanzure/nanoengineer | 874e4c9f8a9190f093625b267f9767e19f82e6c4 | cad/src/commands/BuildCrystal/CrystalShape.py | python | CrystalShape._updateBBox | (self, curveList) | Recompute the bounding box for the list of curves | Recompute the bounding box for the list of curves | [
"Recompute",
"the",
"bounding",
"box",
"for",
"the",
"list",
"of",
"curves"
] | def _updateBBox(self, curveList):
"""
Recompute the bounding box for the list of curves
"""
bbox = BBox()
for c in curveList[1:]:
bbox.merge(c.bbox)
curveList[0] = bbox | [
"def",
"_updateBBox",
"(",
"self",
",",
"curveList",
")",
":",
"bbox",
"=",
"BBox",
"(",
")",
"for",
"c",
"in",
"curveList",
"[",
"1",
":",
"]",
":",
"bbox",
".",
"merge",
"(",
"c",
".",
"bbox",
")",
"curveList",
"[",
"0",
"]",
"=",
"bbox"
] | https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/commands/BuildCrystal/CrystalShape.py#L213-L220 | ||
billpmurphy/hask | 4609cc8d9d975f51b6ecdbd33640cdffdc28f953 | hask/Prelude.py | python | sequence_ | (xs) | sequence_ :: Monad m => [m a] -> m None
Evaluate each action in the sequence from left to right, and ignore the
results. | sequence_ :: Monad m => [m a] -> m None | [
"sequence_",
"::",
"Monad",
"m",
"=",
">",
"[",
"m",
"a",
"]",
"-",
">",
"m",
"None"
] | def sequence_(xs):
"""
sequence_ :: Monad m => [m a] -> m None
Evaluate each action in the sequence from left to right, and ignore the
results.
"""
raise NotImplementedError() | [
"def",
"sequence_",
"(",
"xs",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/billpmurphy/hask/blob/4609cc8d9d975f51b6ecdbd33640cdffdc28f953/hask/Prelude.py#L209-L216 | ||
minio/minio-py | b3ba3bf99fe6b9ff2b28855550d6ab5345c134e3 | minio/minioadmin.py | python | MinioAdmin.kms_key_create | (self, key=None) | return self._run(
[
"kms", "key", "create", self._target, key
] + ([key] if key else []),
) | Create a new KMS master key. | Create a new KMS master key. | [
"Create",
"a",
"new",
"KMS",
"master",
"key",
"."
] | def kms_key_create(self, key=None):
"""Create a new KMS master key."""
return self._run(
[
"kms", "key", "create", self._target, key
] + ([key] if key else []),
) | [
"def",
"kms_key_create",
"(",
"self",
",",
"key",
"=",
"None",
")",
":",
"return",
"self",
".",
"_run",
"(",
"[",
"\"kms\"",
",",
"\"key\"",
",",
"\"create\"",
",",
"self",
".",
"_target",
",",
"key",
"]",
"+",
"(",
"[",
"key",
"]",
"if",
"key",
... | https://github.com/minio/minio-py/blob/b3ba3bf99fe6b9ff2b28855550d6ab5345c134e3/minio/minioadmin.py#L206-L212 | |
python-social-auth/social-core | 1ea27e8989657bb35dd37b6ee2e038e1358fbc96 | social_core/backends/douban.py | python | DoubanOAuth2.user_data | (self, access_token, *args, **kwargs) | return self.get_json(
'https://api.douban.com/v2/user/~me',
headers={'Authorization': f'Bearer {access_token}'}
) | Return user data provided | Return user data provided | [
"Return",
"user",
"data",
"provided"
] | def user_data(self, access_token, *args, **kwargs):
"""Return user data provided"""
return self.get_json(
'https://api.douban.com/v2/user/~me',
headers={'Authorization': f'Bearer {access_token}'}
) | [
"def",
"user_data",
"(",
"self",
",",
"access_token",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"get_json",
"(",
"'https://api.douban.com/v2/user/~me'",
",",
"headers",
"=",
"{",
"'Authorization'",
":",
"f'Bearer {access_token}'... | https://github.com/python-social-auth/social-core/blob/1ea27e8989657bb35dd37b6ee2e038e1358fbc96/social_core/backends/douban.py#L54-L59 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/xmlrpc/client.py | python | Marshaller.dump_int | (self, value, write) | [] | def dump_int(self, value, write):
# in case ints are > 32 bits
if value > MAXINT or value < MININT:
raise OverflowError("int exceeds XML-RPC limits")
write("<value><int>")
write(str(value))
write("</int></value>\n") | [
"def",
"dump_int",
"(",
"self",
",",
"value",
",",
"write",
")",
":",
"# in case ints are > 32 bits",
"if",
"value",
">",
"MAXINT",
"or",
"value",
"<",
"MININT",
":",
"raise",
"OverflowError",
"(",
"\"int exceeds XML-RPC limits\"",
")",
"write",
"(",
"\"<value><... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/xmlrpc/client.py#L525-L531 | ||||
theotherp/nzbhydra | 4b03d7f769384b97dfc60dade4806c0fc987514e | libs/requests/packages/urllib3/response.py | python | HTTPResponse._init_length | (self, request_method) | return length | Set initial length value for Response content if available. | Set initial length value for Response content if available. | [
"Set",
"initial",
"length",
"value",
"for",
"Response",
"content",
"if",
"available",
"."
] | def _init_length(self, request_method):
"""
Set initial length value for Response content if available.
"""
length = self.headers.get('content-length')
if length is not None and self.chunked:
# This Response will fail with an IncompleteRead if it can't be
... | [
"def",
"_init_length",
"(",
"self",
",",
"request_method",
")",
":",
"length",
"=",
"self",
".",
"headers",
".",
"get",
"(",
"'content-length'",
")",
"if",
"length",
"is",
"not",
"None",
"and",
"self",
".",
"chunked",
":",
"# This Response will fail with an In... | https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/requests/packages/urllib3/response.py#L198-L244 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_openshift/library/oc_adm_ca_server_cert.py | python | OpenShiftCLIConfig.config_options | (self) | return self._options | return config options | return config options | [
"return",
"config",
"options"
] | def config_options(self):
''' return config options '''
return self._options | [
"def",
"config_options",
"(",
"self",
")",
":",
"return",
"self",
".",
"_options"
] | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_openshift/library/oc_adm_ca_server_cert.py#L1459-L1461 | |
UniShared/videonotes | 803cdd97b90823fb17f50dd55999aa7d1fec6c3a | lib/oauth2/__init__.py | python | Request.to_postdata | (self) | return urllib.urlencode(d, True).replace('+', '%20') | Serialize as post data for a POST request. | Serialize as post data for a POST request. | [
"Serialize",
"as",
"post",
"data",
"for",
"a",
"POST",
"request",
"."
] | def to_postdata(self):
"""Serialize as post data for a POST request."""
d = {}
for k, v in self.iteritems():
d[k.encode('utf-8')] = to_utf8_optional_iterator(v)
# tell urlencode to deal with sequence values and map them correctly
# to resulting querystring. for examp... | [
"def",
"to_postdata",
"(",
"self",
")",
":",
"d",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"self",
".",
"iteritems",
"(",
")",
":",
"d",
"[",
"k",
".",
"encode",
"(",
"'utf-8'",
")",
"]",
"=",
"to_utf8_optional_iterator",
"(",
"v",
")",
"# tell... | https://github.com/UniShared/videonotes/blob/803cdd97b90823fb17f50dd55999aa7d1fec6c3a/lib/oauth2/__init__.py#L402-L411 | |
smart-mobile-software/gitstack | d9fee8f414f202143eb6e620529e8e5539a2af56 | python/Lib/site-packages/django/contrib/gis/db/models/sql/compiler.py | python | GeoSQLCompiler.get_default_columns | (self, with_aliases=False, col_aliases=None,
start_alias=None, opts=None, as_pairs=False, local_only=False) | return result, aliases | Computes the default columns for selecting every field in the base
model. Will sometimes be called to pull in related models (e.g. via
select_related), in which case "opts" and "start_alias" will be given
to provide a starting point for the traversal.
Returns a list of strings, quoted a... | Computes the default columns for selecting every field in the base
model. Will sometimes be called to pull in related models (e.g. via
select_related), in which case "opts" and "start_alias" will be given
to provide a starting point for the traversal. | [
"Computes",
"the",
"default",
"columns",
"for",
"selecting",
"every",
"field",
"in",
"the",
"base",
"model",
".",
"Will",
"sometimes",
"be",
"called",
"to",
"pull",
"in",
"related",
"models",
"(",
"e",
".",
"g",
".",
"via",
"select_related",
")",
"in",
"... | def get_default_columns(self, with_aliases=False, col_aliases=None,
start_alias=None, opts=None, as_pairs=False, local_only=False):
"""
Computes the default columns for selecting every field in the base
model. Will sometimes be called to pull in related models (e.g. via
selec... | [
"def",
"get_default_columns",
"(",
"self",
",",
"with_aliases",
"=",
"False",
",",
"col_aliases",
"=",
"None",
",",
"start_alias",
"=",
"None",
",",
"opts",
"=",
"None",
",",
"as_pairs",
"=",
"False",
",",
"local_only",
"=",
"False",
")",
":",
"result",
... | https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/site-packages/django/contrib/gis/db/models/sql/compiler.py#L96-L163 | |
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/matplotlib/transforms.py | python | CompositeGenericTransform.__init__ | (self, a, b, **kwargs) | Create a new composite transform that is the result of
applying transform *a* then transform *b*.
You will generally not call this constructor directly but use
the :func:`composite_transform_factory` function instead,
which can automatically choose the best kind of composite
tra... | Create a new composite transform that is the result of
applying transform *a* then transform *b*. | [
"Create",
"a",
"new",
"composite",
"transform",
"that",
"is",
"the",
"result",
"of",
"applying",
"transform",
"*",
"a",
"*",
"then",
"transform",
"*",
"b",
"*",
"."
] | def __init__(self, a, b, **kwargs):
"""
Create a new composite transform that is the result of
applying transform *a* then transform *b*.
You will generally not call this constructor directly but use
the :func:`composite_transform_factory` function instead,
which can aut... | [
"def",
"__init__",
"(",
"self",
",",
"a",
",",
"b",
",",
"*",
"*",
"kwargs",
")",
":",
"assert",
"a",
".",
"output_dims",
"==",
"b",
".",
"input_dims",
"self",
".",
"input_dims",
"=",
"a",
".",
"input_dims",
"self",
".",
"output_dims",
"=",
"b",
".... | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/matplotlib/transforms.py#L2135-L2152 | ||
pythonql/pythonql | 10ded9473eee8dc75630c2c67f06b6f86a0af305 | pythonql/parser/PythonQLParser.py | python | Parser.p_let_clause_entry | (self, p) | let_clause_entry : expr_list '=' test | let_clause_entry : expr_list '=' test | [
"let_clause_entry",
":",
"expr_list",
"=",
"test"
] | def p_let_clause_entry(self, p):
"""let_clause_entry : expr_list '=' test"""
p[0] = make_node('let_clause_entry', p) | [
"def",
"p_let_clause_entry",
"(",
"self",
",",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"make_node",
"(",
"'let_clause_entry'",
",",
"p",
")"
] | https://github.com/pythonql/pythonql/blob/10ded9473eee8dc75630c2c67f06b6f86a0af305/pythonql/parser/PythonQLParser.py#L714-L716 | ||
dmlc/dgl | 8d14a739bc9e446d6c92ef83eafe5782398118de | python/dgl/_deprecate/graph.py | python | DGLBaseGraph.edge_id | (self, u, v, force_multi=None, return_array=False) | Return the edge ID, or an array of edge IDs, between source node
`u` and destination node `v`.
Parameters
----------
u : int
The source node ID.
v : int
The destination node ID.
force_multi : bool
Deprecated (Will be deleted in the fut... | Return the edge ID, or an array of edge IDs, between source node
`u` and destination node `v`. | [
"Return",
"the",
"edge",
"ID",
"or",
"an",
"array",
"of",
"edge",
"IDs",
"between",
"source",
"node",
"u",
"and",
"destination",
"node",
"v",
"."
] | def edge_id(self, u, v, force_multi=None, return_array=False):
"""Return the edge ID, or an array of edge IDs, between source node
`u` and destination node `v`.
Parameters
----------
u : int
The source node ID.
v : int
The destination node ID.
... | [
"def",
"edge_id",
"(",
"self",
",",
"u",
",",
"v",
",",
"force_multi",
"=",
"None",
",",
"return_array",
"=",
"False",
")",
":",
"idx",
"=",
"self",
".",
"_graph",
".",
"edge_id",
"(",
"u",
",",
"v",
")",
"if",
"force_multi",
"is",
"not",
"None",
... | https://github.com/dmlc/dgl/blob/8d14a739bc9e446d6c92ef83eafe5782398118de/python/dgl/_deprecate/graph.py#L322-L393 | ||
bugy/script-server | 9a57ce15903c81bcb537b872f1330ee55ba31563 | tools/build.py | python | BuildInfo.get_files | (self) | return self.files | [] | def get_files(self):
return self.files | [
"def",
"get_files",
"(",
"self",
")",
":",
"return",
"self",
".",
"files"
] | https://github.com/bugy/script-server/blob/9a57ce15903c81bcb537b872f1330ee55ba31563/tools/build.py#L47-L48 | |||
MeanEYE/Sunflower | 1024bbdde3b8e202ddad3553b321a7b6230bffc9 | sunflower/plugin_base/plugin.py | python | PluginBase._drag_drop | (self, widget, drag_context, x, y, timestamp) | return True | Handle dropping data over widget | Handle dropping data over widget | [
"Handle",
"dropping",
"data",
"over",
"widget"
] | def _drag_drop(self, widget, drag_context, x, y, timestamp):
"""Handle dropping data over widget"""
return True | [
"def",
"_drag_drop",
"(",
"self",
",",
"widget",
",",
"drag_context",
",",
"x",
",",
"y",
",",
"timestamp",
")",
":",
"return",
"True"
] | https://github.com/MeanEYE/Sunflower/blob/1024bbdde3b8e202ddad3553b321a7b6230bffc9/sunflower/plugin_base/plugin.py#L161-L163 | |
smart-mobile-software/gitstack | d9fee8f414f202143eb6e620529e8e5539a2af56 | python/Lib/idlelib/configDialog.py | python | ConfigDialog.SaveNewTheme | (self,themeName,theme) | save a newly created theme.
themeName - string, the name of the new theme
theme - dictionary containing the new theme | save a newly created theme.
themeName - string, the name of the new theme
theme - dictionary containing the new theme | [
"save",
"a",
"newly",
"created",
"theme",
".",
"themeName",
"-",
"string",
"the",
"name",
"of",
"the",
"new",
"theme",
"theme",
"-",
"dictionary",
"containing",
"the",
"new",
"theme"
] | def SaveNewTheme(self,themeName,theme):
"""
save a newly created theme.
themeName - string, the name of the new theme
theme - dictionary containing the new theme
"""
if not idleConf.userCfg['highlight'].has_section(themeName):
idleConf.userCfg['highlight'].add... | [
"def",
"SaveNewTheme",
"(",
"self",
",",
"themeName",
",",
"theme",
")",
":",
"if",
"not",
"idleConf",
".",
"userCfg",
"[",
"'highlight'",
"]",
".",
"has_section",
"(",
"themeName",
")",
":",
"idleConf",
".",
"userCfg",
"[",
"'highlight'",
"]",
".",
"add... | https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/idlelib/configDialog.py#L1075-L1085 | ||
osmr/imgclsmob | f2993d3ce73a2f7ddba05da3891defb08547d504 | pytorch/pytorchcv/models/sparsenet.py | python | sparsenet201 | (**kwargs) | return get_sparsenet(num_layers=201, model_name="sparsenet201", **kwargs) | SparseNet-201 model from 'Sparsely Aggregated Convolutional Networks,' https://arxiv.org/abs/1801.05895.
Parameters:
----------
pretrained : bool, default False
Whether to load the pretrained weights for model.
root : str, default '~/.torch/models'
Location for keeping the model paramet... | SparseNet-201 model from 'Sparsely Aggregated Convolutional Networks,' https://arxiv.org/abs/1801.05895. | [
"SparseNet",
"-",
"201",
"model",
"from",
"Sparsely",
"Aggregated",
"Convolutional",
"Networks",
"https",
":",
"//",
"arxiv",
".",
"org",
"/",
"abs",
"/",
"1801",
".",
"05895",
"."
] | def sparsenet201(**kwargs):
"""
SparseNet-201 model from 'Sparsely Aggregated Convolutional Networks,' https://arxiv.org/abs/1801.05895.
Parameters:
----------
pretrained : bool, default False
Whether to load the pretrained weights for model.
root : str, default '~/.torch/models'
... | [
"def",
"sparsenet201",
"(",
"*",
"*",
"kwargs",
")",
":",
"return",
"get_sparsenet",
"(",
"num_layers",
"=",
"201",
",",
"model_name",
"=",
"\"sparsenet201\"",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/osmr/imgclsmob/blob/f2993d3ce73a2f7ddba05da3891defb08547d504/pytorch/pytorchcv/models/sparsenet.py#L309-L320 | |
openbmc/openbmc | 5f4109adae05f4d6925bfe960007d52f98c61086 | poky/bitbake/lib/toaster/orm/models.py | python | Project.get_available_recipes | (self) | return queryset | Returns QuerySet of all the recipes that are provided by layers
added to this project | Returns QuerySet of all the recipes that are provided by layers
added to this project | [
"Returns",
"QuerySet",
"of",
"all",
"the",
"recipes",
"that",
"are",
"provided",
"by",
"layers",
"added",
"to",
"this",
"project"
] | def get_available_recipes(self):
""" Returns QuerySet of all the recipes that are provided by layers
added to this project """
queryset = Recipe.objects.filter(
layer_version__in=self.get_project_layer_versions())
return queryset | [
"def",
"get_available_recipes",
"(",
"self",
")",
":",
"queryset",
"=",
"Recipe",
".",
"objects",
".",
"filter",
"(",
"layer_version__in",
"=",
"self",
".",
"get_project_layer_versions",
"(",
")",
")",
"return",
"queryset"
] | https://github.com/openbmc/openbmc/blob/5f4109adae05f4d6925bfe960007d52f98c61086/poky/bitbake/lib/toaster/orm/models.py#L347-L353 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/argparse.py | python | ArgumentParser._add_action | (self, action) | return action | [] | def _add_action(self, action):
if action.option_strings:
self._optionals._add_action(action)
else:
self._positionals._add_action(action)
return action | [
"def",
"_add_action",
"(",
"self",
",",
"action",
")",
":",
"if",
"action",
".",
"option_strings",
":",
"self",
".",
"_optionals",
".",
"_add_action",
"(",
"action",
")",
"else",
":",
"self",
".",
"_positionals",
".",
"_add_action",
"(",
"action",
")",
"... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/argparse.py#L1680-L1685 | |||
sideeffects/SideFXLabs | 956bc1eef6710882ae8d3a31b4a33dd631a56d5f | scripts/python/hou_settings.py | python | Settings._save | (self) | [] | def _save(self):
with open(self.filename, 'w') as fp:
json.dump(self._settings_dic, fp) | [
"def",
"_save",
"(",
"self",
")",
":",
"with",
"open",
"(",
"self",
".",
"filename",
",",
"'w'",
")",
"as",
"fp",
":",
"json",
".",
"dump",
"(",
"self",
".",
"_settings_dic",
",",
"fp",
")"
] | https://github.com/sideeffects/SideFXLabs/blob/956bc1eef6710882ae8d3a31b4a33dd631a56d5f/scripts/python/hou_settings.py#L57-L59 | ||||
facebookresearch/hydra | 9b2f4d54b328d1551aa70a241a1d638cbe046367 | examples/patterns/multi-select/my_app.py | python | my_app | (cfg: DictConfig) | [] | def my_app(cfg: DictConfig) -> None:
print(OmegaConf.to_yaml(cfg)) | [
"def",
"my_app",
"(",
"cfg",
":",
"DictConfig",
")",
"->",
"None",
":",
"print",
"(",
"OmegaConf",
".",
"to_yaml",
"(",
"cfg",
")",
")"
] | https://github.com/facebookresearch/hydra/blob/9b2f4d54b328d1551aa70a241a1d638cbe046367/examples/patterns/multi-select/my_app.py#L8-L9 | ||||
edisonlz/fastor | 342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3 | base/site-packages/pymongo/master_slave_connection.py | python | MasterSlaveConnection._send_message_with_response | (self, message, _connection_to_use=None,
_must_use_master=False, **kwargs) | Receive a message from Mongo.
Sends the given message and returns a (connection_id, response) pair.
:Parameters:
- `operation`: opcode of the message to send
- `data`: data to send | Receive a message from Mongo. | [
"Receive",
"a",
"message",
"from",
"Mongo",
"."
] | def _send_message_with_response(self, message, _connection_to_use=None,
_must_use_master=False, **kwargs):
"""Receive a message from Mongo.
Sends the given message and returns a (connection_id, response) pair.
:Parameters:
- `operation`: opcode of ... | [
"def",
"_send_message_with_response",
"(",
"self",
",",
"message",
",",
"_connection_to_use",
"=",
"None",
",",
"_must_use_master",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"_connection_to_use",
"is",
"not",
"None",
":",
"if",
"_connection_to_use",... | https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/pymongo/master_slave_connection.py#L169-L206 | ||
ReactionMechanismGenerator/RMG-Py | 2b7baf51febf27157def58fb3f6cee03fb6a684c | rmgpy/tools/globaluncertainty.py | python | ReactorPCEFactory.analyze_results | (self, log=True) | return mean, var, cov, main_sens, total_sens | Obtain the results: the prediction mean and variance, as well as the global sensitivity indices
Returns a tuple containing the following statistics
(mean species mole fractions, variance, covariance, main sensitivity indices, total sensitivity indices) | Obtain the results: the prediction mean and variance, as well as the global sensitivity indices
Returns a tuple containing the following statistics
(mean species mole fractions, variance, covariance, main sensitivity indices, total sensitivity indices) | [
"Obtain",
"the",
"results",
":",
"the",
"prediction",
"mean",
"and",
"variance",
"as",
"well",
"as",
"the",
"global",
"sensitivity",
"indices",
"Returns",
"a",
"tuple",
"containing",
"the",
"following",
"statistics",
"(",
"mean",
"species",
"mole",
"fractions",
... | def analyze_results(self, log=True):
"""
Obtain the results: the prediction mean and variance, as well as the global sensitivity indices
Returns a tuple containing the following statistics
(mean species mole fractions, variance, covariance, main sensitivity indices, total sensit... | [
"def",
"analyze_results",
"(",
"self",
",",
"log",
"=",
"True",
")",
":",
"# Compute the mean and variance for each of the uncertain parameters",
"mean",
"=",
"np",
".",
"array",
"(",
"self",
".",
"pce",
".",
"Mean",
"(",
")",
")",
"var",
"=",
"np",
".",
"ar... | https://github.com/ReactionMechanismGenerator/RMG-Py/blob/2b7baf51febf27157def58fb3f6cee03fb6a684c/rmgpy/tools/globaluncertainty.py#L417-L508 | |
biolab/orange2 | db40a9449cb45b507d63dcd5739b223f9cffb8e6 | Orange/evaluation/scoring.py | python | split_by_iterations | (res) | return ress | Split ExperimentResults of a multiple iteratation test into a list
of ExperimentResults, one for each iteration. | Split ExperimentResults of a multiple iteratation test into a list
of ExperimentResults, one for each iteration. | [
"Split",
"ExperimentResults",
"of",
"a",
"multiple",
"iteratation",
"test",
"into",
"a",
"list",
"of",
"ExperimentResults",
"one",
"for",
"each",
"iteration",
"."
] | def split_by_iterations(res):
"""Split ExperimentResults of a multiple iteratation test into a list
of ExperimentResults, one for each iteration.
"""
if res.number_of_iterations < 2:
return [res]
ress = [Orange.evaluation.testing.ExperimentResults(
1, res.classifier_names, r... | [
"def",
"split_by_iterations",
"(",
"res",
")",
":",
"if",
"res",
".",
"number_of_iterations",
"<",
"2",
":",
"return",
"[",
"res",
"]",
"ress",
"=",
"[",
"Orange",
".",
"evaluation",
".",
"testing",
".",
"ExperimentResults",
"(",
"1",
",",
"res",
".",
... | https://github.com/biolab/orange2/blob/db40a9449cb45b507d63dcd5739b223f9cffb8e6/Orange/evaluation/scoring.py#L84-L98 | |
JiYou/openstack | 8607dd488bde0905044b303eb6e52bdea6806923 | packages/source/nova/nova/virt/xenapi/driver.py | python | XenAPIDriver.inject_file | (self, instance, b64_path, b64_contents) | Create a file on the VM instance. The file path and contents
should be base64-encoded. | Create a file on the VM instance. The file path and contents
should be base64-encoded. | [
"Create",
"a",
"file",
"on",
"the",
"VM",
"instance",
".",
"The",
"file",
"path",
"and",
"contents",
"should",
"be",
"base64",
"-",
"encoded",
"."
] | def inject_file(self, instance, b64_path, b64_contents):
"""Create a file on the VM instance. The file path and contents
should be base64-encoded.
"""
self._vmops.inject_file(instance, b64_path, b64_contents) | [
"def",
"inject_file",
"(",
"self",
",",
"instance",
",",
"b64_path",
",",
"b64_contents",
")",
":",
"self",
".",
"_vmops",
".",
"inject_file",
"(",
"instance",
",",
"b64_path",
",",
"b64_contents",
")"
] | https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/nova/nova/virt/xenapi/driver.py#L212-L216 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_openshift/library/oc_route.py | python | OpenShiftCLI._create | (self, fname) | return self.openshift_cmd(['create', '-f', fname]) | call oc create on a filename | call oc create on a filename | [
"call",
"oc",
"create",
"on",
"a",
"filename"
] | def _create(self, fname):
'''call oc create on a filename'''
return self.openshift_cmd(['create', '-f', fname]) | [
"def",
"_create",
"(",
"self",
",",
"fname",
")",
":",
"return",
"self",
".",
"openshift_cmd",
"(",
"[",
"'create'",
",",
"'-f'",
",",
"fname",
"]",
")"
] | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_openshift/library/oc_route.py#L1003-L1005 | |
scikit-learn/scikit-learn | 1d1aadd0711b87d2a11c80aad15df6f8cf156712 | examples/svm/plot_iris_svc.py | python | plot_contours | (ax, clf, xx, yy, **params) | return out | Plot the decision boundaries for a classifier.
Parameters
----------
ax: matplotlib axes object
clf: a classifier
xx: meshgrid ndarray
yy: meshgrid ndarray
params: dictionary of params to pass to contourf, optional | Plot the decision boundaries for a classifier. | [
"Plot",
"the",
"decision",
"boundaries",
"for",
"a",
"classifier",
"."
] | def plot_contours(ax, clf, xx, yy, **params):
"""Plot the decision boundaries for a classifier.
Parameters
----------
ax: matplotlib axes object
clf: a classifier
xx: meshgrid ndarray
yy: meshgrid ndarray
params: dictionary of params to pass to contourf, optional
"""
Z = clf.pre... | [
"def",
"plot_contours",
"(",
"ax",
",",
"clf",
",",
"xx",
",",
"yy",
",",
"*",
"*",
"params",
")",
":",
"Z",
"=",
"clf",
".",
"predict",
"(",
"np",
".",
"c_",
"[",
"xx",
".",
"ravel",
"(",
")",
",",
"yy",
".",
"ravel",
"(",
")",
"]",
")",
... | https://github.com/scikit-learn/scikit-learn/blob/1d1aadd0711b87d2a11c80aad15df6f8cf156712/examples/svm/plot_iris_svc.py#L61-L75 | |
digidotcom/xbee-python | 0757f4be0017530c205175fbee8f9f61be9614d1 | digi/xbee/devices.py | python | DigiMeshNetwork.__init__ | (self, device) | Class constructor. Instantiates a new `DigiMeshNetwork`.
Args:
device (:class:`.DigiMeshDevice`): Local DigiMesh node to get the
network from.
Raises:
ValueError: If `device` is `None`. | Class constructor. Instantiates a new `DigiMeshNetwork`. | [
"Class",
"constructor",
".",
"Instantiates",
"a",
"new",
"DigiMeshNetwork",
"."
] | def __init__(self, device):
"""
Class constructor. Instantiates a new `DigiMeshNetwork`.
Args:
device (:class:`.DigiMeshDevice`): Local DigiMesh node to get the
network from.
Raises:
ValueError: If `device` is `None`.
"""
super().... | [
"def",
"__init__",
"(",
"self",
",",
"device",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"device",
")",
"self",
".",
"__saved_no",
"=",
"None",
"self",
".",
"__saved_so",
"=",
"None",
"self",
".",
"__sync_sleep_enabled",
"=",
"False",
"# Calcula... | https://github.com/digidotcom/xbee-python/blob/0757f4be0017530c205175fbee8f9f61be9614d1/digi/xbee/devices.py#L11620-L11645 | ||
JacquesLucke/animation_nodes | b1e3ace8dcb0a771fd882fc3ac4e490b009fa0d1 | animation_nodes/auto_load.py | python | iter_my_classes | (modules) | [] | def iter_my_classes(modules):
base_types = get_register_base_types()
for cls in get_classes_in_modules(modules):
if any(base in base_types for base in cls.__bases__):
if not getattr(cls, "is_registered", False):
yield cls | [
"def",
"iter_my_classes",
"(",
"modules",
")",
":",
"base_types",
"=",
"get_register_base_types",
"(",
")",
"for",
"cls",
"in",
"get_classes_in_modules",
"(",
"modules",
")",
":",
"if",
"any",
"(",
"base",
"in",
"base_types",
"for",
"base",
"in",
"cls",
".",... | https://github.com/JacquesLucke/animation_nodes/blob/b1e3ace8dcb0a771fd882fc3ac4e490b009fa0d1/animation_nodes/auto_load.py#L106-L111 | ||||
shlomif/PySolFC | 780c399e6f68a95916d84e7e88a067e8fcbec1cc | pysollib/game/__init__.py | python | Game._calcMouseBind | (self, binding_format) | return self.app.opt.calcCustomMouseButtonsBinding(binding_format) | docstring for _calcMouseBind | docstring for _calcMouseBind | [
"docstring",
"for",
"_calcMouseBind"
] | def _calcMouseBind(self, binding_format):
"""docstring for _calcMouseBind"""
return self.app.opt.calcCustomMouseButtonsBinding(binding_format) | [
"def",
"_calcMouseBind",
"(",
"self",
",",
"binding_format",
")",
":",
"return",
"self",
".",
"app",
".",
"opt",
".",
"calcCustomMouseButtonsBinding",
"(",
"binding_format",
")"
] | https://github.com/shlomif/PySolFC/blob/780c399e6f68a95916d84e7e88a067e8fcbec1cc/pysollib/game/__init__.py#L677-L679 | |
bgshih/aster | 0c74b9b9cd22a021c1d57b75a3041bcbd7ace3cc | trainer.py | python | train | (create_tensor_dict_fn_list, create_model_fn, train_config, master, task,
num_clones, worker_replicas, clone_on_cpu, ps_tasks, worker_job_name,
is_chief, train_dir) | Training function for models.
Args:
create_tensor_dict_fn: a function to create a tensor input dictionary.
create_model_fn: a function that creates a DetectionModel and generates
losses.
train_config: a train_pb2.TrainConfig protobuf.
master: BNS name of the TensorFlow master to u... | Training function for models.
Args:
create_tensor_dict_fn: a function to create a tensor input dictionary.
create_model_fn: a function that creates a DetectionModel and generates
losses.
train_config: a train_pb2.TrainConfig protobuf.
master: BNS name of the TensorFlow master to u... | [
"Training",
"function",
"for",
"models",
".",
"Args",
":",
"create_tensor_dict_fn",
":",
"a",
"function",
"to",
"create",
"a",
"tensor",
"input",
"dictionary",
".",
"create_model_fn",
":",
"a",
"function",
"that",
"creates",
"a",
"DetectionModel",
"and",
"genera... | def train(create_tensor_dict_fn_list, create_model_fn, train_config, master, task,
num_clones, worker_replicas, clone_on_cpu, ps_tasks, worker_job_name,
is_chief, train_dir):
"""Training function for models.
Args:
create_tensor_dict_fn: a function to create a tensor input dictionary.
cre... | [
"def",
"train",
"(",
"create_tensor_dict_fn_list",
",",
"create_model_fn",
",",
"train_config",
",",
"master",
",",
"task",
",",
"num_clones",
",",
"worker_replicas",
",",
"clone_on_cpu",
",",
"ps_tasks",
",",
"worker_job_name",
",",
"is_chief",
",",
"train_dir",
... | https://github.com/bgshih/aster/blob/0c74b9b9cd22a021c1d57b75a3041bcbd7ace3cc/trainer.py#L77-L269 | ||
worthwhile/django-herald | c0b0f4e894b26ec46647d1c70a6a62a89f34b06a | herald/base.py | python | NotificationBase.get_extra_data | (self) | return {} | Returns a dictionary of extra data to be stored, and used for sending.
MUST BE JSON SERIALIZABLE | Returns a dictionary of extra data to be stored, and used for sending.
MUST BE JSON SERIALIZABLE | [
"Returns",
"a",
"dictionary",
"of",
"extra",
"data",
"to",
"be",
"stored",
"and",
"used",
"for",
"sending",
".",
"MUST",
"BE",
"JSON",
"SERIALIZABLE"
] | def get_extra_data(self):
"""
Returns a dictionary of extra data to be stored, and used for sending.
MUST BE JSON SERIALIZABLE
"""
return {} | [
"def",
"get_extra_data",
"(",
"self",
")",
":",
"return",
"{",
"}"
] | https://github.com/worthwhile/django-herald/blob/c0b0f4e894b26ec46647d1c70a6a62a89f34b06a/herald/base.py#L140-L146 | |
smicallef/spiderfoot | fd4bf9394c9ab3ecc90adc3115c56349fb23165b | modules/sfp_subdomain_takeover.py | python | sfp_subdomain_takeover.watchedEvents | (self) | return ["AFFILIATE_INTERNET_NAME", "AFFILIATE_INTERNET_NAME_UNRESOLVED"] | [] | def watchedEvents(self):
return ["AFFILIATE_INTERNET_NAME", "AFFILIATE_INTERNET_NAME_UNRESOLVED"] | [
"def",
"watchedEvents",
"(",
"self",
")",
":",
"return",
"[",
"\"AFFILIATE_INTERNET_NAME\"",
",",
"\"AFFILIATE_INTERNET_NAME_UNRESOLVED\"",
"]"
] | https://github.com/smicallef/spiderfoot/blob/fd4bf9394c9ab3ecc90adc3115c56349fb23165b/modules/sfp_subdomain_takeover.py#L72-L73 | |||
missionpinball/mpf | 8e6b74cff4ba06d2fec9445742559c1068b88582 | mpf/core/ball_controller.py | python | BallController._collecting_balls_complete | (self) | event: collecting_balls_complete
desc: Posted by the ball controller when it has finished the collecting
balls process. | event: collecting_balls_complete | [
"event",
":",
"collecting_balls_complete"
] | def _collecting_balls_complete(self) -> None:
self.machine.events.remove_handler(self._collecting_balls_entered_callback)
self.machine.events.post('collecting_balls_complete')
'''event: collecting_balls_complete
desc: Posted by the ball controller when it has finished the collecting
... | [
"def",
"_collecting_balls_complete",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"machine",
".",
"events",
".",
"remove_handler",
"(",
"self",
".",
"_collecting_balls_entered_callback",
")",
"self",
".",
"machine",
".",
"events",
".",
"post",
"(",
"'coll... | https://github.com/missionpinball/mpf/blob/8e6b74cff4ba06d2fec9445742559c1068b88582/mpf/core/ball_controller.py#L354-L362 | ||
deepfakes/faceswap | 09c7d8aca3c608d1afad941ea78e9fd9b64d9219 | lib/gui/custom_widgets.py | python | ContextMenu.cm_bind | (self) | Bind the menu to the given widgets Right Click event
After associating a widget with this :class:`ContextMenu` this function should be called
to bind it to the right click button | Bind the menu to the given widgets Right Click event | [
"Bind",
"the",
"menu",
"to",
"the",
"given",
"widgets",
"Right",
"Click",
"event"
] | def cm_bind(self):
""" Bind the menu to the given widgets Right Click event
After associating a widget with this :class:`ContextMenu` this function should be called
to bind it to the right click button
"""
button = "<Button-2>" if platform.system() == "Darwin" else "<Button-3>"
... | [
"def",
"cm_bind",
"(",
"self",
")",
":",
"button",
"=",
"\"<Button-2>\"",
"if",
"platform",
".",
"system",
"(",
")",
"==",
"\"Darwin\"",
"else",
"\"<Button-3>\"",
"logger",
".",
"debug",
"(",
"\"Binding '%s' to '%s'\"",
",",
"button",
",",
"self",
".",
"_wid... | https://github.com/deepfakes/faceswap/blob/09c7d8aca3c608d1afad941ea78e9fd9b64d9219/lib/gui/custom_widgets.py#L53-L61 | ||
mgrankin/ru_transformers | e698092ed31b340dc39ecea26f1b0be87cdbd022 | sp_encoder.py | python | SPEncoder.convert_tokens_to_ids | (self, tokens) | return [self.sp.PieceToId(token) for token in tokens] | [] | def convert_tokens_to_ids(self, tokens):
return [self.sp.PieceToId(token) for token in tokens] | [
"def",
"convert_tokens_to_ids",
"(",
"self",
",",
"tokens",
")",
":",
"return",
"[",
"self",
".",
"sp",
".",
"PieceToId",
"(",
"token",
")",
"for",
"token",
"in",
"tokens",
"]"
] | https://github.com/mgrankin/ru_transformers/blob/e698092ed31b340dc39ecea26f1b0be87cdbd022/sp_encoder.py#L53-L54 | |||
mozillazg/pypy | 2ff5cd960c075c991389f842c6d59e71cf0cb7d0 | rpython/annotator/classdesc.py | python | ClassDesc.mergeattrfamilies | (self, others, attrname) | return changed | Merge the attr families of the given Descs into one. | Merge the attr families of the given Descs into one. | [
"Merge",
"the",
"attr",
"families",
"of",
"the",
"given",
"Descs",
"into",
"one",
"."
] | def mergeattrfamilies(self, others, attrname):
"""Merge the attr families of the given Descs into one."""
access_sets = self.bookkeeper.get_classpbc_attr_families(attrname)
changed, rep, attrfamily = access_sets.find(self)
for desc in others:
changed1, rep, attrfamily = acces... | [
"def",
"mergeattrfamilies",
"(",
"self",
",",
"others",
",",
"attrname",
")",
":",
"access_sets",
"=",
"self",
".",
"bookkeeper",
".",
"get_classpbc_attr_families",
"(",
"attrname",
")",
"changed",
",",
"rep",
",",
"attrfamily",
"=",
"access_sets",
".",
"find"... | https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/rpython/annotator/classdesc.py#L935-L942 | |
openstack/nova | b49b7663e1c3073917d5844b81d38db8e86d05c4 | nova/scheduler/utils.py | python | _log_compute_error | (instance_uuid, retry) | If the request contained an exception from a previous compute
build/resize operation, log it to aid debugging | If the request contained an exception from a previous compute
build/resize operation, log it to aid debugging | [
"If",
"the",
"request",
"contained",
"an",
"exception",
"from",
"a",
"previous",
"compute",
"build",
"/",
"resize",
"operation",
"log",
"it",
"to",
"aid",
"debugging"
] | def _log_compute_error(instance_uuid, retry):
"""If the request contained an exception from a previous compute
build/resize operation, log it to aid debugging
"""
exc = retry.get('exc') # string-ified exception from compute
if not exc:
return # no exception info from a previous attempt, sk... | [
"def",
"_log_compute_error",
"(",
"instance_uuid",
",",
"retry",
")",
":",
"exc",
"=",
"retry",
".",
"get",
"(",
"'exc'",
")",
"# string-ified exception from compute",
"if",
"not",
"exc",
":",
"return",
"# no exception info from a previous attempt, skip",
"hosts",
"="... | https://github.com/openstack/nova/blob/b49b7663e1c3073917d5844b81d38db8e86d05c4/nova/scheduler/utils.py#L992-L1008 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/celery/backends/redis.py | python | RedisBackend.incr | (self, key) | return self.client.incr(key) | [] | def incr(self, key):
return self.client.incr(key) | [
"def",
"incr",
"(",
"self",
",",
"key",
")",
":",
"return",
"self",
".",
"client",
".",
"incr",
"(",
"key",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/celery/backends/redis.py#L218-L219 | |||
flairNLP/flair | b774774752c8338aab3d620f7e5062f66ec7a69d | flair/datasets/entity_linking.py | python | WSD_MASC.__init__ | (
self,
base_path: Union[str, Path] = None,
in_memory: bool = True,
columns={0: "text", 3: "wn30_key"},
tag_to_bioes=None,
label_name_map: Dict[str, str] = None,
banned_sentences: List[str] = None,
sample_missing_splits: Union[bool, str] = True,
cu... | Initialize MASC (Manually Annotated Sub-Corpus) provided in UFSAC https://github.com/getalp/UFSAC
When first initializing the corpus the whole UFSAC data is downloaded. | Initialize MASC (Manually Annotated Sub-Corpus) provided in UFSAC https://github.com/getalp/UFSAC
When first initializing the corpus the whole UFSAC data is downloaded. | [
"Initialize",
"MASC",
"(",
"Manually",
"Annotated",
"Sub",
"-",
"Corpus",
")",
"provided",
"in",
"UFSAC",
"https",
":",
"//",
"github",
".",
"com",
"/",
"getalp",
"/",
"UFSAC",
"When",
"first",
"initializing",
"the",
"corpus",
"the",
"whole",
"UFSAC",
"dat... | def __init__(
self,
base_path: Union[str, Path] = None,
in_memory: bool = True,
columns={0: "text", 3: "wn30_key"},
tag_to_bioes=None,
label_name_map: Dict[str, str] = None,
banned_sentences: List[str] = None,
sample_missing_splits: Union[bool, str] = True... | [
"def",
"__init__",
"(",
"self",
",",
"base_path",
":",
"Union",
"[",
"str",
",",
"Path",
"]",
"=",
"None",
",",
"in_memory",
":",
"bool",
"=",
"True",
",",
"columns",
"=",
"{",
"0",
":",
"\"text\"",
",",
"3",
":",
"\"wn30_key\"",
"}",
",",
"tag_to_... | https://github.com/flairNLP/flair/blob/b774774752c8338aab3d620f7e5062f66ec7a69d/flair/datasets/entity_linking.py#L1617-L1693 | ||
007gzs/dingtalk-sdk | 7979da2e259fdbc571728cae2425a04dbc65850a | dingtalk/client/api/taobao.py | python | TbWuDaoKou.alibaba_price_promotion_activity_query | (
self,
page,
outer_promotion_code,
page_size,
ou_code=''
) | return self._top_request(
"alibaba.price.promotion.activity.query",
{
"page": page,
"outer_promotion_code": outer_promotion_code,
"page_size": page_size,
"ou_code": ou_code
}
) | 查询盒马帮档期活动详情
文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=36865
:param page: 页码
:param outer_promotion_code: 外部档期code
:param page_size: 页码大小
:param ou_code: TOB店仓编码 | 查询盒马帮档期活动详情
文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=36865 | [
"查询盒马帮档期活动详情",
"文档地址:https",
":",
"//",
"open",
"-",
"doc",
".",
"dingtalk",
".",
"com",
"/",
"docs",
"/",
"api",
".",
"htm?apiId",
"=",
"36865"
] | def alibaba_price_promotion_activity_query(
self,
page,
outer_promotion_code,
page_size,
ou_code=''
):
"""
查询盒马帮档期活动详情
文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=36865
:param page: 页码
:param outer_promoti... | [
"def",
"alibaba_price_promotion_activity_query",
"(",
"self",
",",
"page",
",",
"outer_promotion_code",
",",
"page_size",
",",
"ou_code",
"=",
"''",
")",
":",
"return",
"self",
".",
"_top_request",
"(",
"\"alibaba.price.promotion.activity.query\"",
",",
"{",
"\"page\"... | https://github.com/007gzs/dingtalk-sdk/blob/7979da2e259fdbc571728cae2425a04dbc65850a/dingtalk/client/api/taobao.py#L63810-L63834 | |
eoyilmaz/stalker | a35c041b79d953d00dc2a09cf8206956ca269bef | stalker/models/shot.py | python | Shot._validate_fps | (self, fps) | return float(fps) | validates the given fps_in value | validates the given fps_in value | [
"validates",
"the",
"given",
"fps_in",
"value"
] | def _validate_fps(self, fps):
"""validates the given fps_in value
"""
if fps is None:
# fps = self.project.fps
return None
if not isinstance(fps, (int, float)):
raise TypeError(
'%s.fps should be a positive float or int, not %s' % (
... | [
"def",
"_validate_fps",
"(",
"self",
",",
"fps",
")",
":",
"if",
"fps",
"is",
"None",
":",
"# fps = self.project.fps",
"return",
"None",
"if",
"not",
"isinstance",
"(",
"fps",
",",
"(",
"int",
",",
"float",
")",
")",
":",
"raise",
"TypeError",
"(",
"'%... | https://github.com/eoyilmaz/stalker/blob/a35c041b79d953d00dc2a09cf8206956ca269bef/stalker/models/shot.py#L350-L371 | |
ukdtom/ExportTools.bundle | 49aba4292a2897f640162a833c2792480aa4f0b6 | Contents/Libraries/Shared/xlsxwriter/worksheet.py | python | Worksheet.set_print_scale | (self, scale) | Set the scale factor for the printed page.
Args:
scale: Print scale. 10 <= scale <= 400.
Returns:
Nothing. | Set the scale factor for the printed page. | [
"Set",
"the",
"scale",
"factor",
"for",
"the",
"printed",
"page",
"."
] | def set_print_scale(self, scale):
"""
Set the scale factor for the printed page.
Args:
scale: Print scale. 10 <= scale <= 400.
Returns:
Nothing.
"""
# Confine the scale to Excel's range.
if scale < 10 or scale > 400:
warn("Pr... | [
"def",
"set_print_scale",
"(",
"self",
",",
"scale",
")",
":",
"# Confine the scale to Excel's range.",
"if",
"scale",
"<",
"10",
"or",
"scale",
">",
"400",
":",
"warn",
"(",
"\"Print scale '%d' outside range: 10 <= scale <= 400\"",
"%",
"scale",
")",
"return",
"# T... | https://github.com/ukdtom/ExportTools.bundle/blob/49aba4292a2897f640162a833c2792480aa4f0b6/Contents/Libraries/Shared/xlsxwriter/worksheet.py#L3481-L3501 | ||
pikpikcu/Pentest-Tools-Framework | cd6e6107764a809943dc4e073cde8149c1a2cd03 | modules/xsser/core/curlcontrol.py | python | Curl.post | (self, cgi, params) | return self.__request(cgi) | Post a url. | Post a url. | [
"Post",
"a",
"url",
"."
] | def post(self, cgi, params):
"""
Post a url.
"""
self.set_option(pycurl.POST, 1)
self.set_option(pycurl.POSTFIELDS, params)
return self.__request(cgi) | [
"def",
"post",
"(",
"self",
",",
"cgi",
",",
"params",
")",
":",
"self",
".",
"set_option",
"(",
"pycurl",
".",
"POST",
",",
"1",
")",
"self",
".",
"set_option",
"(",
"pycurl",
".",
"POSTFIELDS",
",",
"params",
")",
"return",
"self",
".",
"__request"... | https://github.com/pikpikcu/Pentest-Tools-Framework/blob/cd6e6107764a809943dc4e073cde8149c1a2cd03/modules/xsser/core/curlcontrol.py#L420-L426 | |
EnterpriseDB/barman | 487bad92edec72712531ead4746fad72bb310270 | barman/clients/cloud_backup_delete.py | python | main | (args=None) | The main script entry point
:param list[str] args: the raw arguments list. When not provided
it defaults to sys.args[1:] | The main script entry point | [
"The",
"main",
"script",
"entry",
"point"
] | def main(args=None):
"""
The main script entry point
:param list[str] args: the raw arguments list. When not provided
it defaults to sys.args[1:]
"""
config = parse_arguments(args)
configure_logging(config)
try:
cloud_interface = get_cloud_interface(config)
with cl... | [
"def",
"main",
"(",
"args",
"=",
"None",
")",
":",
"config",
"=",
"parse_arguments",
"(",
"args",
")",
"configure_logging",
"(",
"config",
")",
"try",
":",
"cloud_interface",
"=",
"get_cloud_interface",
"(",
"config",
")",
"with",
"closing",
"(",
"cloud_inte... | https://github.com/EnterpriseDB/barman/blob/487bad92edec72712531ead4746fad72bb310270/barman/clients/cloud_backup_delete.py#L196-L279 | ||
Nuitka/Nuitka | 39262276993757fa4e299f497654065600453fc9 | nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/Python.py | python | Value.write | (self, built_value) | Set the value of the node. | Set the value of the node. | [
"Set",
"the",
"value",
"of",
"the",
"node",
"."
] | def write(self, built_value):
"""Set the value of the node."""
self.built_value = built_value | [
"def",
"write",
"(",
"self",
",",
"built_value",
")",
":",
"self",
".",
"built_value",
"=",
"built_value"
] | https://github.com/Nuitka/Nuitka/blob/39262276993757fa4e299f497654065600453fc9/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/Python.py#L80-L82 | ||
pypa/pip | 7f8a6844037fb7255cfd0d34ff8e8cf44f2598d4 | src/pip/_vendor/urllib3/util/proxy.py | python | connection_requires_http_tunnel | (
proxy_url=None, proxy_config=None, destination_scheme=None
) | return True | Returns True if the connection requires an HTTP CONNECT through the proxy.
:param URL proxy_url:
URL of the proxy.
:param ProxyConfig proxy_config:
Proxy configuration from poolmanager.py
:param str destination_scheme:
The scheme of the destination. (i.e https, http, etc) | Returns True if the connection requires an HTTP CONNECT through the proxy. | [
"Returns",
"True",
"if",
"the",
"connection",
"requires",
"an",
"HTTP",
"CONNECT",
"through",
"the",
"proxy",
"."
] | def connection_requires_http_tunnel(
proxy_url=None, proxy_config=None, destination_scheme=None
):
"""
Returns True if the connection requires an HTTP CONNECT through the proxy.
:param URL proxy_url:
URL of the proxy.
:param ProxyConfig proxy_config:
Proxy configuration from poolman... | [
"def",
"connection_requires_http_tunnel",
"(",
"proxy_url",
"=",
"None",
",",
"proxy_config",
"=",
"None",
",",
"destination_scheme",
"=",
"None",
")",
":",
"# If we're not using a proxy, no way to use a tunnel.",
"if",
"proxy_url",
"is",
"None",
":",
"return",
"False",... | https://github.com/pypa/pip/blob/7f8a6844037fb7255cfd0d34ff8e8cf44f2598d4/src/pip/_vendor/urllib3/util/proxy.py#L4-L34 | |
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/email/message.py | python | Message.set_param | (self, param, value, header='Content-Type', requote=True,
charset=None, language='') | Set a parameter in the Content-Type header.
If the parameter already exists in the header, its value will be
replaced with the new value.
If header is Content-Type and has not yet been defined for this
message, it will be set to "text/plain" and the new parameter and
value will... | Set a parameter in the Content-Type header. | [
"Set",
"a",
"parameter",
"in",
"the",
"Content",
"-",
"Type",
"header",
"."
] | def set_param(self, param, value, header='Content-Type', requote=True,
charset=None, language=''):
"""Set a parameter in the Content-Type header.
If the parameter already exists in the header, its value will be
replaced with the new value.
If header is Content-Type an... | [
"def",
"set_param",
"(",
"self",
",",
"param",
",",
"value",
",",
"header",
"=",
"'Content-Type'",
",",
"requote",
"=",
"True",
",",
"charset",
"=",
"None",
",",
"language",
"=",
"''",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"tuple",
... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/email/message.py#L571-L617 | ||
mathics/Mathics | 318e06dea8f1c70758a50cb2f95c9900150e3a68 | mathics/builtin/system.py | python | Share.apply_1 | (self, symbol, evaluation) | return Integer0 | Share[symbol_Symbol] | Share[symbol_Symbol] | [
"Share",
"[",
"symbol_Symbol",
"]"
] | def apply_1(self, symbol, evaluation) -> Integer:
"""Share[symbol_Symbol]"""
# TODO: implement a routine that swap all the definitions,
# collecting repeated symbols and expressions, and then
# remplace them by references.
# Return the amount of memory recovered.
return I... | [
"def",
"apply_1",
"(",
"self",
",",
"symbol",
",",
"evaluation",
")",
"->",
"Integer",
":",
"# TODO: implement a routine that swap all the definitions,",
"# collecting repeated symbols and expressions, and then",
"# remplace them by references.",
"# Return the amount of memory recovere... | https://github.com/mathics/Mathics/blob/318e06dea8f1c70758a50cb2f95c9900150e3a68/mathics/builtin/system.py#L608-L614 | |
selfteaching/selfteaching-python-camp | 9982ee964b984595e7d664b07c389cddaf158f1e | 19100205/Ceasar1978/pip-19.0.3/src/pip/_vendor/html5lib/treebuilders/base.py | python | Node.__init__ | (self, name) | Creates a Node
:arg name: The tag name associated with the node | Creates a Node | [
"Creates",
"a",
"Node"
] | def __init__(self, name):
"""Creates a Node
:arg name: The tag name associated with the node
"""
# The tag name assocaited with the node
self.name = name
# The parent of the current node (or None for the document node)
self.parent = None
# The value of t... | [
"def",
"__init__",
"(",
"self",
",",
"name",
")",
":",
"# The tag name assocaited with the node",
"self",
".",
"name",
"=",
"name",
"# The parent of the current node (or None for the document node)",
"self",
".",
"parent",
"=",
"None",
"# The value of the current node (applie... | https://github.com/selfteaching/selfteaching-python-camp/blob/9982ee964b984595e7d664b07c389cddaf158f1e/19100205/Ceasar1978/pip-19.0.3/src/pip/_vendor/html5lib/treebuilders/base.py#L25-L43 | ||
kanzure/nanoengineer | 874e4c9f8a9190f093625b267f9767e19f82e6c4 | cad/src/graphics/drawing/GLPrimitiveBuffer.py | python | Hunk.changedRange | (self, chgLowID, chgHighID) | return | Record a range of data changes, for later flushing.
chgLowID and chgHighID are primitive IDs, possibly spanning many hunks.
The high end is the index of the one *after* the end of the range, as
usual in Python. | Record a range of data changes, for later flushing. | [
"Record",
"a",
"range",
"of",
"data",
"changes",
"for",
"later",
"flushing",
"."
] | def changedRange(self, chgLowID, chgHighID):
"""
Record a range of data changes, for later flushing.
chgLowID and chgHighID are primitive IDs, possibly spanning many hunks.
The high end is the index of the one *after* the end of the range, as
usual in Python.
"""
... | [
"def",
"changedRange",
"(",
"self",
",",
"chgLowID",
",",
"chgHighID",
")",
":",
"(",
"lowHunk",
",",
"lowIndex",
")",
"=",
"decodePrimID",
"(",
"chgLowID",
")",
"(",
"highHunk",
",",
"highIndex",
")",
"=",
"decodePrimID",
"(",
"chgHighID",
")",
"if",
"s... | https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/graphics/drawing/GLPrimitiveBuffer.py#L637-L664 | |
yxgeee/MMT | 057e1ea5d3054c9d7e5fa72c727298d8e4c5f668 | mmt/utils/data/__init__.py | python | IterLoader.__len__ | (self) | return len(self.loader) | [] | def __len__(self):
if (self.length is not None):
return self.length
return len(self.loader) | [
"def",
"__len__",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"length",
"is",
"not",
"None",
")",
":",
"return",
"self",
".",
"length",
"return",
"len",
"(",
"self",
".",
"loader",
")"
] | https://github.com/yxgeee/MMT/blob/057e1ea5d3054c9d7e5fa72c727298d8e4c5f668/mmt/utils/data/__init__.py#L12-L15 | |||
wandb/client | 3963364d8112b7dedb928fa423b6878ea1b467d9 | wandb/vendor/watchdog/observers/api.py | python | BaseObserver.schedule | (self, event_handler, path, recursive=False) | return watch | Schedules watching a path and calls appropriate methods specified
in the given event handler in response to file system events.
:param event_handler:
An event handler instance that has appropriate event handling
methods which will be called by the observer in response to
... | Schedules watching a path and calls appropriate methods specified
in the given event handler in response to file system events. | [
"Schedules",
"watching",
"a",
"path",
"and",
"calls",
"appropriate",
"methods",
"specified",
"in",
"the",
"given",
"event",
"handler",
"in",
"response",
"to",
"file",
"system",
"events",
"."
] | def schedule(self, event_handler, path, recursive=False):
"""
Schedules watching a path and calls appropriate methods specified
in the given event handler in response to file system events.
:param event_handler:
An event handler instance that has appropriate event handling
... | [
"def",
"schedule",
"(",
"self",
",",
"event_handler",
",",
"path",
",",
"recursive",
"=",
"False",
")",
":",
"with",
"self",
".",
"_lock",
":",
"watch",
"=",
"ObservedWatch",
"(",
"path",
",",
"recursive",
")",
"self",
".",
"_add_handler_for_watch",
"(",
... | https://github.com/wandb/client/blob/3963364d8112b7dedb928fa423b6878ea1b467d9/wandb/vendor/watchdog/observers/api.py#L258-L295 | |
dragonfly/dragonfly | a579b5eadf452e23b07d4caf27b402703b0012b7 | dragonfly/exd/domains.py | python | DiscreteEuclideanDomain.get_dim | (self) | return self.dim | Return the dimensions. | Return the dimensions. | [
"Return",
"the",
"dimensions",
"."
] | def get_dim(self):
""" Return the dimensions. """
return self.dim | [
"def",
"get_dim",
"(",
"self",
")",
":",
"return",
"self",
".",
"dim"
] | https://github.com/dragonfly/dragonfly/blob/a579b5eadf452e23b07d4caf27b402703b0012b7/dragonfly/exd/domains.py#L234-L236 | |
IBM/lale | b4d6829c143a4735b06083a0e6c70d2cca244162 | lale/lib/aif360/util.py | python | _SymmetricDisparateImpact.__call__ | (self, estimator, X, y) | return self.score_estimator(estimator, X, y) | [] | def __call__(self, estimator, X, y):
return self.score_estimator(estimator, X, y) | [
"def",
"__call__",
"(",
"self",
",",
"estimator",
",",
"X",
",",
"y",
")",
":",
"return",
"self",
".",
"score_estimator",
"(",
"estimator",
",",
"X",
",",
"y",
")"
] | https://github.com/IBM/lale/blob/b4d6829c143a4735b06083a0e6c70d2cca244162/lale/lib/aif360/util.py#L844-L845 | |||
awslabs/sockeye | ec2d13f7beb42d8c4f389dba0172250dc9154d5a | sockeye/utils.py | python | check_condition | (condition: bool, error_message: str) | Check the condition and if it is not met, exit with the given error message
and error_code, similar to assertions.
:param condition: Condition to check.
:param error_message: Error message to show to the user. | Check the condition and if it is not met, exit with the given error message
and error_code, similar to assertions. | [
"Check",
"the",
"condition",
"and",
"if",
"it",
"is",
"not",
"met",
"exit",
"with",
"the",
"given",
"error",
"message",
"and",
"error_code",
"similar",
"to",
"assertions",
"."
] | def check_condition(condition: bool, error_message: str):
"""
Check the condition and if it is not met, exit with the given error message
and error_code, similar to assertions.
:param condition: Condition to check.
:param error_message: Error message to show to the user.
"""
if not conditio... | [
"def",
"check_condition",
"(",
"condition",
":",
"bool",
",",
"error_message",
":",
"str",
")",
":",
"if",
"not",
"condition",
":",
"raise",
"SockeyeError",
"(",
"error_message",
")"
] | https://github.com/awslabs/sockeye/blob/ec2d13f7beb42d8c4f389dba0172250dc9154d5a/sockeye/utils.py#L144-L153 | ||
beeware/ouroboros | a29123c6fab6a807caffbb7587cf548e0c370296 | ouroboros/datetime.py | python | date.ctime | (self) | return "%s %s %2d 00:00:00 %04d" % (
_DAYNAMES[weekday],
_MONTHNAMES[self._month],
self._day, self._year) | Return ctime() style string. | Return ctime() style string. | [
"Return",
"ctime",
"()",
"style",
"string",
"."
] | def ctime(self):
"Return ctime() style string."
weekday = self.toordinal() % 7 or 7
return "%s %s %2d 00:00:00 %04d" % (
_DAYNAMES[weekday],
_MONTHNAMES[self._month],
self._day, self._year) | [
"def",
"ctime",
"(",
"self",
")",
":",
"weekday",
"=",
"self",
".",
"toordinal",
"(",
")",
"%",
"7",
"or",
"7",
"return",
"\"%s %s %2d 00:00:00 %04d\"",
"%",
"(",
"_DAYNAMES",
"[",
"weekday",
"]",
",",
"_MONTHNAMES",
"[",
"self",
".",
"_month",
"]",
",... | https://github.com/beeware/ouroboros/blob/a29123c6fab6a807caffbb7587cf548e0c370296/ouroboros/datetime.py#L733-L739 | |
makinacorpus/landez | 6e5c71ded6071158e7943df204cd7bd1ed623a30 | landez/sources.py | python | TileDownloader.tile | (self, z, x, y) | Download the specified tile from `tiles_url` | Download the specified tile from `tiles_url` | [
"Download",
"the",
"specified",
"tile",
"from",
"tiles_url"
] | def tile(self, z, x, y):
"""
Download the specified tile from `tiles_url`
"""
logger.debug(_("Download tile %s") % ((z, x, y),))
# Render each keyword in URL ({s}, {x}, {y}, {z}, {size} ... )
size = self.tilesize
s = self.tiles_subdomains[(x + y) % len(self.tiles_... | [
"def",
"tile",
"(",
"self",
",",
"z",
",",
"x",
",",
"y",
")",
":",
"logger",
".",
"debug",
"(",
"_",
"(",
"\"Download tile %s\"",
")",
"%",
"(",
"(",
"z",
",",
"x",
",",
"y",
")",
",",
")",
")",
"# Render each keyword in URL ({s}, {x}, {y}, {z}, {size... | https://github.com/makinacorpus/landez/blob/6e5c71ded6071158e7943df204cd7bd1ed623a30/landez/sources.py#L163-L192 | ||
GoogleCloudPlatform/PerfKitBenchmarker | 6e3412d7d5e414b8ca30ed5eaf970cef1d919a67 | perfkitbenchmarker/providers/azure/azure_blob_storage.py | python | AzureBlobStorageService.ListTopLevelSubfolders | (self, bucket) | return list(unique_folders) | Lists the top level folders (not files) in a bucket.
Each listed item is a full file name, eg. "supplier/supplier.csv", so just
the high level folder name is extracted, and repetitions are eliminated for
when there's multiple files in a folder.
Args:
bucket: Name of the bucket to list the top le... | Lists the top level folders (not files) in a bucket. | [
"Lists",
"the",
"top",
"level",
"folders",
"(",
"not",
"files",
")",
"in",
"a",
"bucket",
"."
] | def ListTopLevelSubfolders(self, bucket):
"""Lists the top level folders (not files) in a bucket.
Each listed item is a full file name, eg. "supplier/supplier.csv", so just
the high level folder name is extracted, and repetitions are eliminated for
when there's multiple files in a folder.
Args:
... | [
"def",
"ListTopLevelSubfolders",
"(",
"self",
",",
"bucket",
")",
":",
"unique_folders",
"=",
"set",
"(",
"[",
"obj",
".",
"split",
"(",
"'/'",
")",
"[",
"0",
"]",
".",
"strip",
"(",
")",
"for",
"obj",
"in",
"self",
".",
"List",
"(",
"bucket",
")",... | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/6e3412d7d5e414b8ca30ed5eaf970cef1d919a67/perfkitbenchmarker/providers/azure/azure_blob_storage.py#L197-L215 | |
GaoQ1/rasa_nlu_gq | aea2d037220f022b2773d0852cbcfbad582e8e25 | rasa_nlu_gao/models/bert/modeling.py | python | reshape_to_matrix | (input_tensor) | return output_tensor | Reshapes a >= rank 2 tensor to a rank 2 tensor (i.e., a matrix). | Reshapes a >= rank 2 tensor to a rank 2 tensor (i.e., a matrix). | [
"Reshapes",
"a",
">",
"=",
"rank",
"2",
"tensor",
"to",
"a",
"rank",
"2",
"tensor",
"(",
"i",
".",
"e",
".",
"a",
"matrix",
")",
"."
] | def reshape_to_matrix(input_tensor):
"""Reshapes a >= rank 2 tensor to a rank 2 tensor (i.e., a matrix)."""
ndims = input_tensor.shape.ndims
if ndims < 2:
raise ValueError("Input tensor must have at least rank 2. Shape = %s" %
(input_tensor.shape))
if ndims == 2:
... | [
"def",
"reshape_to_matrix",
"(",
"input_tensor",
")",
":",
"ndims",
"=",
"input_tensor",
".",
"shape",
".",
"ndims",
"if",
"ndims",
"<",
"2",
":",
"raise",
"ValueError",
"(",
"\"Input tensor must have at least rank 2. Shape = %s\"",
"%",
"(",
"input_tensor",
".",
... | https://github.com/GaoQ1/rasa_nlu_gq/blob/aea2d037220f022b2773d0852cbcfbad582e8e25/rasa_nlu_gao/models/bert/modeling.py#L942-L953 | |
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/pandas/core/strings.py | python | str_encode | (arr, encoding, errors="strict") | return _na_map(f, arr) | Encode character string in the Series/Index using indicated encoding.
Equivalent to :meth:`str.encode`.
Parameters
----------
encoding : str
errors : str, optional
Returns
-------
encoded : Series/Index of objects | Encode character string in the Series/Index using indicated encoding.
Equivalent to :meth:`str.encode`. | [
"Encode",
"character",
"string",
"in",
"the",
"Series",
"/",
"Index",
"using",
"indicated",
"encoding",
".",
"Equivalent",
"to",
":",
"meth",
":",
"str",
".",
"encode",
"."
] | def str_encode(arr, encoding, errors="strict"):
"""
Encode character string in the Series/Index using indicated encoding.
Equivalent to :meth:`str.encode`.
Parameters
----------
encoding : str
errors : str, optional
Returns
-------
encoded : Series/Index of objects
"""
... | [
"def",
"str_encode",
"(",
"arr",
",",
"encoding",
",",
"errors",
"=",
"\"strict\"",
")",
":",
"if",
"encoding",
"in",
"_cpython_optimized_encoders",
":",
"# CPython optimized implementation",
"f",
"=",
"lambda",
"x",
":",
"x",
".",
"encode",
"(",
"encoding",
"... | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/pandas/core/strings.py#L1713-L1733 | |
scrapinghub/frontera | 84f9e1034d2868447db88e865596c0fbb32e70f6 | frontera/core/manager.py | python | ComponentsPipelineMixin.middlewares | (self) | return self._middlewares | A list of :class:`Middleware <frontera.core.components.Middleware>` objects to be used by the frontier. \
Can be defined with :setting:`MIDDLEWARES` setting. | A list of :class:`Middleware <frontera.core.components.Middleware>` objects to be used by the frontier. \
Can be defined with :setting:`MIDDLEWARES` setting. | [
"A",
"list",
"of",
":",
"class",
":",
"Middleware",
"<frontera",
".",
"core",
".",
"components",
".",
"Middleware",
">",
"objects",
"to",
"be",
"used",
"by",
"the",
"frontier",
".",
"\\",
"Can",
"be",
"defined",
"with",
":",
"setting",
":",
"MIDDLEWARES"... | def middlewares(self):
"""
A list of :class:`Middleware <frontera.core.components.Middleware>` objects to be used by the frontier. \
Can be defined with :setting:`MIDDLEWARES` setting.
"""
return self._middlewares | [
"def",
"middlewares",
"(",
"self",
")",
":",
"return",
"self",
".",
"_middlewares"
] | https://github.com/scrapinghub/frontera/blob/84f9e1034d2868447db88e865596c0fbb32e70f6/frontera/core/manager.py#L97-L102 | |
stratosphereips/Manati | 20e55d49edf00f8503807c62397d02a0dad9ddff | manati/api_manager/core/modules_manager.py | python | ModulesManager.bulk_labeling_by_whois_relation | (username, analysis_session_id, domain,verdict) | [] | def bulk_labeling_by_whois_relation(username, analysis_session_id, domain,verdict):
queue = django_rq.get_queue('high')
queue.enqueue(__bulk_labeling_by_whois_relation_aux__,
username,
analysis_session_id,
domain,verdict) | [
"def",
"bulk_labeling_by_whois_relation",
"(",
"username",
",",
"analysis_session_id",
",",
"domain",
",",
"verdict",
")",
":",
"queue",
"=",
"django_rq",
".",
"get_queue",
"(",
"'high'",
")",
"queue",
".",
"enqueue",
"(",
"__bulk_labeling_by_whois_relation_aux__",
... | https://github.com/stratosphereips/Manati/blob/20e55d49edf00f8503807c62397d02a0dad9ddff/manati/api_manager/core/modules_manager.py#L301-L306 | ||||
GoogleCloudPlatform/PerfKitBenchmarker | 6e3412d7d5e414b8ca30ed5eaf970cef1d919a67 | perfkitbenchmarker/windows_virtual_machine.py | python | BaseWindowsMixin.WaitForBootCompletion | (self) | Waits until VM is has booted. | Waits until VM is has booted. | [
"Waits",
"until",
"VM",
"is",
"has",
"booted",
"."
] | def WaitForBootCompletion(self):
"""Waits until VM is has booted."""
to_wait_for = [self._WaitForWinRmCommand]
if FLAGS.cluster_boot_test_rdp_port_listening:
to_wait_for.append(self._WaitForRdpPort)
vm_util.RunParallelThreads([(method, [], {}) for method in to_wait_for], 2) | [
"def",
"WaitForBootCompletion",
"(",
"self",
")",
":",
"to_wait_for",
"=",
"[",
"self",
".",
"_WaitForWinRmCommand",
"]",
"if",
"FLAGS",
".",
"cluster_boot_test_rdp_port_listening",
":",
"to_wait_for",
".",
"append",
"(",
"self",
".",
"_WaitForRdpPort",
")",
"vm_u... | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/6e3412d7d5e414b8ca30ed5eaf970cef1d919a67/perfkitbenchmarker/windows_virtual_machine.py#L410-L415 | ||
WerWolv/EdiZon_CheatsConfigsAndScripts | d16d36c7509c01dca770f402babd83ff2e9ae6e7 | Scripts/lib/python3.5/email/headerregistry.py | python | HeaderRegistry.map_to_type | (self, name, cls) | Register cls as the specialized class for handling "name" headers. | Register cls as the specialized class for handling "name" headers. | [
"Register",
"cls",
"as",
"the",
"specialized",
"class",
"for",
"handling",
"name",
"headers",
"."
] | def map_to_type(self, name, cls):
"""Register cls as the specialized class for handling "name" headers.
"""
self.registry[name.lower()] = cls | [
"def",
"map_to_type",
"(",
"self",
",",
"name",
",",
"cls",
")",
":",
"self",
".",
"registry",
"[",
"name",
".",
"lower",
"(",
")",
"]",
"=",
"cls"
] | https://github.com/WerWolv/EdiZon_CheatsConfigsAndScripts/blob/d16d36c7509c01dca770f402babd83ff2e9ae6e7/Scripts/lib/python3.5/email/headerregistry.py#L566-L570 | ||
facebookresearch/ParlAI | e4d59c30eef44f1f67105961b82a83fd28d7d78b | parlai/core/teachers.py | python | ChunkTeacher._setup_data | (self, datatype) | Passthrough. | Passthrough. | [
"Passthrough",
"."
] | def _setup_data(self, datatype):
"""
Passthrough.
"""
pass | [
"def",
"_setup_data",
"(",
"self",
",",
"datatype",
")",
":",
"pass"
] | https://github.com/facebookresearch/ParlAI/blob/e4d59c30eef44f1f67105961b82a83fd28d7d78b/parlai/core/teachers.py#L2395-L2399 | ||
vtr0n/TelegramTUI | a64f910971187d0d9f4192fb2ad369599d9d87c5 | telegramtui/src/npyscreen/proto_fm_screen_area.py | python | ScreenArea._max_physical | (self) | return (mxy-1, mxx-1) | How big is the physical screen? | How big is the physical screen? | [
"How",
"big",
"is",
"the",
"physical",
"screen?"
] | def _max_physical(self):
"How big is the physical screen?"
# On OS X newwin does not correctly get the size of the screen.
# let's see how big we could be: create a temp screen
# and see the size curses makes it. No good to keep, though
try:
mxy, mxx = struct.unpack(... | [
"def",
"_max_physical",
"(",
"self",
")",
":",
"# On OS X newwin does not correctly get the size of the screen.",
"# let's see how big we could be: create a temp screen",
"# and see the size curses makes it. No good to keep, though",
"try",
":",
"mxy",
",",
"mxx",
"=",
"struct",
"."... | https://github.com/vtr0n/TelegramTUI/blob/a64f910971187d0d9f4192fb2ad369599d9d87c5/telegramtui/src/npyscreen/proto_fm_screen_area.py#L111-L124 | |
VirtueSecurity/aws-extender | d123b7e1a845847709ba3a481f11996bddc68a1c | BappModules/boto/redshift/layer1.py | python | RedshiftConnection.modify_cluster | (self, cluster_identifier, cluster_type=None,
node_type=None, number_of_nodes=None,
cluster_security_groups=None,
vpc_security_group_ids=None,
master_user_password=None,
cluster_parameter_group_name=None,
... | return self._make_request(
action='ModifyCluster',
verb='POST',
path='/', params=params) | Modifies the settings for a cluster. For example, you can add
another security or parameter group, update the preferred
maintenance window, or change the master user password.
Resetting a cluster password or modifying the security groups
associated with a cluster do not need a reboot. Ho... | Modifies the settings for a cluster. For example, you can add
another security or parameter group, update the preferred
maintenance window, or change the master user password.
Resetting a cluster password or modifying the security groups
associated with a cluster do not need a reboot. Ho... | [
"Modifies",
"the",
"settings",
"for",
"a",
"cluster",
".",
"For",
"example",
"you",
"can",
"add",
"another",
"security",
"or",
"parameter",
"group",
"update",
"the",
"preferred",
"maintenance",
"window",
"or",
"change",
"the",
"master",
"user",
"password",
"."... | def modify_cluster(self, cluster_identifier, cluster_type=None,
node_type=None, number_of_nodes=None,
cluster_security_groups=None,
vpc_security_group_ids=None,
master_user_password=None,
cluster_parameter... | [
"def",
"modify_cluster",
"(",
"self",
",",
"cluster_identifier",
",",
"cluster_type",
"=",
"None",
",",
"node_type",
"=",
"None",
",",
"number_of_nodes",
"=",
"None",
",",
"cluster_security_groups",
"=",
"None",
",",
"vpc_security_group_ids",
"=",
"None",
",",
"... | https://github.com/VirtueSecurity/aws-extender/blob/d123b7e1a845847709ba3a481f11996bddc68a1c/BappModules/boto/redshift/layer1.py#L2252-L2489 | |
yianjiajia/django_web_ansible | 1103343082a65abf9d37310f5048514d74930753 | devops/apps/ansible/elfinder/volumes/base.py | python | ElfinderVolumeDriver._mimetype | (self, path) | Attempt to read the file's mimetype. Should return ``None``
on fail.
.. warning::
**Not implemented**, each driver must provide its own
imlementation. | Attempt to read the file's mimetype. Should return ``None``
on fail.
.. warning::
**Not implemented**, each driver must provide its own
imlementation. | [
"Attempt",
"to",
"read",
"the",
"file",
"s",
"mimetype",
".",
"Should",
"return",
"None",
"on",
"fail",
".",
"..",
"warning",
"::",
"**",
"Not",
"implemented",
"**",
"each",
"driver",
"must",
"provide",
"its",
"own",
"imlementation",
"."
] | def _mimetype(self, path):
"""
Attempt to read the file's mimetype. Should return ``None``
on fail.
.. warning::
**Not implemented**, each driver must provide its own
imlementation.
"""
raise NotImplementedError | [
"def",
"_mimetype",
"(",
"self",
",",
"path",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/yianjiajia/django_web_ansible/blob/1103343082a65abf9d37310f5048514d74930753/devops/apps/ansible/elfinder/volumes/base.py#L1931-L1941 | ||
datactive/bigbang | d4fef7eb41ae04e51f4e369de5a721c66231202b | bigbang/analysis/graph.py | python | ascendancy | (am) | return A | Ulanowicz ecosystem health measures
Input is weighted adjacency matrix. | Ulanowicz ecosystem health measures
Input is weighted adjacency matrix. | [
"Ulanowicz",
"ecosystem",
"health",
"measures",
"Input",
"is",
"weighted",
"adjacency",
"matrix",
"."
] | def ascendancy(am):
"""
Ulanowicz ecosystem health measures
Input is weighted adjacency matrix.
"""
# should these be normalized?!?!
# output rates
s0 = np.tile(np.sum(am, 0).T, (am.shape[0], 1))
# input rates
s1 = np.tile(np.sum(am, 1).T, (am.shape[1], 1)).T
logs = np.nan_to_nu... | [
"def",
"ascendancy",
"(",
"am",
")",
":",
"# should these be normalized?!?!",
"# output rates",
"s0",
"=",
"np",
".",
"tile",
"(",
"np",
".",
"sum",
"(",
"am",
",",
"0",
")",
".",
"T",
",",
"(",
"am",
".",
"shape",
"[",
"0",
"]",
",",
"1",
")",
"... | https://github.com/datactive/bigbang/blob/d4fef7eb41ae04e51f4e369de5a721c66231202b/bigbang/analysis/graph.py#L113-L129 | |
DylanWusee/pointconv | f39dc3e101af2f52544181ee20c14f73279b48ae | utils/provider.py | python | random_scale_point_cloud | (batch_data, scale_low=0.8, scale_high=1.25) | return batch_data | Randomly scale the point cloud. Scale is per point cloud.
Input:
BxNx3 array, original batch of point clouds
Return:
BxNx3 array, scaled batch of point clouds | Randomly scale the point cloud. Scale is per point cloud.
Input:
BxNx3 array, original batch of point clouds
Return:
BxNx3 array, scaled batch of point clouds | [
"Randomly",
"scale",
"the",
"point",
"cloud",
".",
"Scale",
"is",
"per",
"point",
"cloud",
".",
"Input",
":",
"BxNx3",
"array",
"original",
"batch",
"of",
"point",
"clouds",
"Return",
":",
"BxNx3",
"array",
"scaled",
"batch",
"of",
"point",
"clouds"
] | def random_scale_point_cloud(batch_data, scale_low=0.8, scale_high=1.25):
""" Randomly scale the point cloud. Scale is per point cloud.
Input:
BxNx3 array, original batch of point clouds
Return:
BxNx3 array, scaled batch of point clouds
"""
B, N, C = batch_data.shape
... | [
"def",
"random_scale_point_cloud",
"(",
"batch_data",
",",
"scale_low",
"=",
"0.8",
",",
"scale_high",
"=",
"1.25",
")",
":",
"B",
",",
"N",
",",
"C",
"=",
"batch_data",
".",
"shape",
"scales",
"=",
"np",
".",
"random",
".",
"uniform",
"(",
"scale_low",
... | https://github.com/DylanWusee/pointconv/blob/f39dc3e101af2f52544181ee20c14f73279b48ae/utils/provider.py#L152-L163 | |
mailpile/Mailpile | b5e4b85fd1e584951d6d13af362ab28821466eea | mailpile/config/validators.py | python | HostNameValid | (host) | Tests whether a string is a valid host-name, return a boolean value
>>> HostNameValid("127.0.0.1")
True
>>> HostNameValid("::1")
True
>>> HostNameValid("localhost")
True
>>> HostNameValid("22.45")
False | Tests whether a string is a valid host-name, return a boolean value | [
"Tests",
"whether",
"a",
"string",
"is",
"a",
"valid",
"host",
"-",
"name",
"return",
"a",
"boolean",
"value"
] | def HostNameValid(host):
"""
Tests whether a string is a valid host-name, return a boolean value
>>> HostNameValid("127.0.0.1")
True
>>> HostNameValid("::1")
True
>>> HostNameValid("localhost")
True
>>> HostNameValid("22.45")
False
"""
valid = False
for attr in ["... | [
"def",
"HostNameValid",
"(",
"host",
")",
":",
"valid",
"=",
"False",
"for",
"attr",
"in",
"[",
"\"AF_INET\"",
",",
"\"AF_INET6\"",
"]",
":",
"try",
":",
"socket",
".",
"inet_pton",
"(",
"socket",
".",
"__getattribute__",
"(",
"attr",
")",
",",
"host",
... | https://github.com/mailpile/Mailpile/blob/b5e4b85fd1e584951d6d13af362ab28821466eea/mailpile/config/validators.py#L104-L135 | ||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/whoosh/src/whoosh/filedb/gae.py | python | DatastoreFile.read | (self, length) | return self.data.read(length) | [] | def read(self, length):
return self.data.read(length) | [
"def",
"read",
"(",
"self",
",",
"length",
")",
":",
"return",
"self",
".",
"data",
".",
"read",
"(",
"length",
")"
] | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/whoosh/src/whoosh/filedb/gae.py#L69-L70 | |||
NervanaSystems/neon | 8c3fb8a93b4a89303467b25817c60536542d08bd | neon/backends/nervanacpu.py | python | CPUTensor.raw | (self) | return self._tensor.ctypes.data | Access the raw buffer.
Returns:
pointer: A device specific pointer | Access the raw buffer. | [
"Access",
"the",
"raw",
"buffer",
"."
] | def raw(self):
"""
Access the raw buffer.
Returns:
pointer: A device specific pointer
"""
return self._tensor.ctypes.data | [
"def",
"raw",
"(",
"self",
")",
":",
"return",
"self",
".",
"_tensor",
".",
"ctypes",
".",
"data"
] | https://github.com/NervanaSystems/neon/blob/8c3fb8a93b4a89303467b25817c60536542d08bd/neon/backends/nervanacpu.py#L261-L268 | |
googlecolab/colabtools | b7b3566363e2f0bad9ad256ae317314ba5bd42f8 | google/colab/html/_background_server.py | python | _BackgroundServer.__init__ | (self, app) | Initialize (but do not start) background server.
Args:
app: server application to run. | Initialize (but do not start) background server. | [
"Initialize",
"(",
"but",
"do",
"not",
"start",
")",
"background",
"server",
"."
] | def __init__(self, app):
"""Initialize (but do not start) background server.
Args:
app: server application to run.
"""
self._app = app
# These will be initialized when starting the server.
self._port = None
self._server_thread = None
self._ioloop = None
self._server = None | [
"def",
"__init__",
"(",
"self",
",",
"app",
")",
":",
"self",
".",
"_app",
"=",
"app",
"# These will be initialized when starting the server.",
"self",
".",
"_port",
"=",
"None",
"self",
".",
"_server_thread",
"=",
"None",
"self",
".",
"_ioloop",
"=",
"None",
... | https://github.com/googlecolab/colabtools/blob/b7b3566363e2f0bad9ad256ae317314ba5bd42f8/google/colab/html/_background_server.py#L32-L44 | ||
tomplus/kubernetes_asyncio | f028cc793e3a2c519be6a52a49fb77ff0b014c9b | kubernetes_asyncio/client/models/v1_typed_local_object_reference.py | python | V1TypedLocalObjectReference.to_str | (self) | return pprint.pformat(self.to_dict()) | Returns the string representation of the model | Returns the string representation of the model | [
"Returns",
"the",
"string",
"representation",
"of",
"the",
"model"
] | def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict()) | [
"def",
"to_str",
"(",
"self",
")",
":",
"return",
"pprint",
".",
"pformat",
"(",
"self",
".",
"to_dict",
"(",
")",
")"
] | https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1_typed_local_object_reference.py#L160-L162 | |
gnuradio/pybombs | 17044241bf835b93571026b112f179f2db7448a4 | pybombs/fetchers/wget.py | python | Wget.update_src | (self, src, dest, dirname, args=None) | return self.fetch_url(src, dest, dirname, args) | For an update, we grab the archive and copy it over into the existing
directory. Luckily, that's exactly the same as fetch_url(). | For an update, we grab the archive and copy it over into the existing
directory. Luckily, that's exactly the same as fetch_url(). | [
"For",
"an",
"update",
"we",
"grab",
"the",
"archive",
"and",
"copy",
"it",
"over",
"into",
"the",
"existing",
"directory",
".",
"Luckily",
"that",
"s",
"exactly",
"the",
"same",
"as",
"fetch_url",
"()",
"."
] | def update_src(self, src, dest, dirname, args=None):
"""
For an update, we grab the archive and copy it over into the existing
directory. Luckily, that's exactly the same as fetch_url().
"""
return self.fetch_url(src, dest, dirname, args) | [
"def",
"update_src",
"(",
"self",
",",
"src",
",",
"dest",
",",
"dirname",
",",
"args",
"=",
"None",
")",
":",
"return",
"self",
".",
"fetch_url",
"(",
"src",
",",
"dest",
",",
"dirname",
",",
"args",
")"
] | https://github.com/gnuradio/pybombs/blob/17044241bf835b93571026b112f179f2db7448a4/pybombs/fetchers/wget.py#L144-L149 | |
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/volume/_colorbar.py | python | ColorBar.thickness | (self) | return self["thickness"] | Sets the thickness of the color bar This measure excludes the
size of the padding, ticks and labels.
The 'thickness' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float | Sets the thickness of the color bar This measure excludes the
size of the padding, ticks and labels.
The 'thickness' property is a number and may be specified as:
- An int or float in the interval [0, inf] | [
"Sets",
"the",
"thickness",
"of",
"the",
"color",
"bar",
"This",
"measure",
"excludes",
"the",
"size",
"of",
"the",
"padding",
"ticks",
"and",
"labels",
".",
"The",
"thickness",
"property",
"is",
"a",
"number",
"and",
"may",
"be",
"specified",
"as",
":",
... | def thickness(self):
"""
Sets the thickness of the color bar This measure excludes the
size of the padding, ticks and labels.
The 'thickness' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
i... | [
"def",
"thickness",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"thickness\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/volume/_colorbar.py#L564-L576 | |
1012598167/flask_mongodb_game | 60c7e0351586656ec38f851592886338e50b4110 | python_flask/venv/Lib/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/pkg_resources/__init__.py | python | WorkingSet.require | (self, *requirements) | return needed | Ensure that distributions matching `requirements` are activated
`requirements` must be a string or a (possibly-nested) sequence
thereof, specifying the distributions and versions required. The
return value is a sequence of the distributions that needed to be
activated to fulfill the re... | Ensure that distributions matching `requirements` are activated | [
"Ensure",
"that",
"distributions",
"matching",
"requirements",
"are",
"activated"
] | def require(self, *requirements):
"""Ensure that distributions matching `requirements` are activated
`requirements` must be a string or a (possibly-nested) sequence
thereof, specifying the distributions and versions required. The
return value is a sequence of the distributions that nee... | [
"def",
"require",
"(",
"self",
",",
"*",
"requirements",
")",
":",
"needed",
"=",
"self",
".",
"resolve",
"(",
"parse_requirements",
"(",
"requirements",
")",
")",
"for",
"dist",
"in",
"needed",
":",
"self",
".",
"add",
"(",
"dist",
")",
"return",
"nee... | https://github.com/1012598167/flask_mongodb_game/blob/60c7e0351586656ec38f851592886338e50b4110/python_flask/venv/Lib/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/pkg_resources/__init__.py#L889-L903 | |
dropbox/changes | 37e23c3141b75e4785cf398d015e3dbca41bdd56 | changes/vcs/base.py | python | Vcs._construct_subprocess | (self, *args, **kwargs) | return proc | Construct a subprocess with the correct arguments and environment | Construct a subprocess with the correct arguments and environment | [
"Construct",
"a",
"subprocess",
"with",
"the",
"correct",
"arguments",
"and",
"environment"
] | def _construct_subprocess(self, *args, **kwargs):
# type: (*Any, **Any) -> Popen
"""Construct a subprocess with the correct arguments and environment"""
env = os.environ.copy()
for key, value in self.get_default_env().iteritems():
env.setdefault(key, value)
env.setd... | [
"def",
"_construct_subprocess",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# type: (*Any, **Any) -> Popen",
"env",
"=",
"os",
".",
"environ",
".",
"copy",
"(",
")",
"for",
"key",
",",
"value",
"in",
"self",
".",
"get_default_env",
... | https://github.com/dropbox/changes/blob/37e23c3141b75e4785cf398d015e3dbca41bdd56/changes/vcs/base.py#L127-L148 | |
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/oauth2client-4.1.3/oauth2client/_helpers.py | python | scopes_to_string | (scopes) | Converts scope value to a string.
If scopes is a string then it is simply passed through. If scopes is an
iterable then a string is returned that is all the individual scopes
concatenated with spaces.
Args:
scopes: string or iterable of strings, the scopes.
Returns:
The scopes for... | Converts scope value to a string. | [
"Converts",
"scope",
"value",
"to",
"a",
"string",
"."
] | def scopes_to_string(scopes):
"""Converts scope value to a string.
If scopes is a string then it is simply passed through. If scopes is an
iterable then a string is returned that is all the individual scopes
concatenated with spaces.
Args:
scopes: string or iterable of strings, the scopes.... | [
"def",
"scopes_to_string",
"(",
"scopes",
")",
":",
"if",
"isinstance",
"(",
"scopes",
",",
"six",
".",
"string_types",
")",
":",
"return",
"scopes",
"else",
":",
"return",
"' '",
".",
"join",
"(",
"scopes",
")"
] | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/oauth2client-4.1.3/oauth2client/_helpers.py#L143-L159 | ||
stopstalk/stopstalk-deployment | 10c3ab44c4ece33ae515f6888c15033db2004bb1 | aws_lambda/spoj_aws_lambda_function/lambda_code/pkg_resources/__init__.py | python | _find_adapter | (registry, ob) | Return an adapter factory for `ob` from `registry` | Return an adapter factory for `ob` from `registry` | [
"Return",
"an",
"adapter",
"factory",
"for",
"ob",
"from",
"registry"
] | def _find_adapter(registry, ob):
"""Return an adapter factory for `ob` from `registry`"""
types = _always_object(inspect.getmro(getattr(ob, '__class__', type(ob))))
for t in types:
if t in registry:
return registry[t] | [
"def",
"_find_adapter",
"(",
"registry",
",",
"ob",
")",
":",
"types",
"=",
"_always_object",
"(",
"inspect",
".",
"getmro",
"(",
"getattr",
"(",
"ob",
",",
"'__class__'",
",",
"type",
"(",
"ob",
")",
")",
")",
")",
"for",
"t",
"in",
"types",
":",
... | https://github.com/stopstalk/stopstalk-deployment/blob/10c3ab44c4ece33ae515f6888c15033db2004bb1/aws_lambda/spoj_aws_lambda_function/lambda_code/pkg_resources/__init__.py#L3023-L3028 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.