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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
oracle/oci-python-sdk | 3c1604e4e212008fb6718e2f68cdb5ef71fd5793 | src/oci/core/compute_client.py | python | ComputeClient.list_app_catalog_listing_resource_versions | (self, listing_id, **kwargs) | Gets all resource versions for a particular listing.
:param str listing_id: (required)
The OCID of the listing.
:param int limit: (optional)
For list pagination. The maximum number of results per page, or items to return in a paginated
\"List\" call. For important ... | Gets all resource versions for a particular listing. | [
"Gets",
"all",
"resource",
"versions",
"for",
"a",
"particular",
"listing",
"."
] | def list_app_catalog_listing_resource_versions(self, listing_id, **kwargs):
"""
Gets all resource versions for a particular listing.
:param str listing_id: (required)
The OCID of the listing.
:param int limit: (optional)
For list pagination. The maximum number ... | [
"def",
"list_app_catalog_listing_resource_versions",
"(",
"self",
",",
"listing_id",
",",
"*",
"*",
"kwargs",
")",
":",
"resource_path",
"=",
"\"/appCatalogListings/{listingId}/resourceVersions\"",
"method",
"=",
"\"GET\"",
"# Don't accept unknown kwargs",
"expected_kwargs",
... | https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/core/compute_client.py#L4243-L4355 | ||
jessemelpolio/Faster_RCNN_for_DOTA | 499b32c3893ccd8850e0aca07e5afb952d08943e | faster_rcnn/core/module.py | python | Module.install_monitor | (self, mon) | Install monitor on all executors | Install monitor on all executors | [
"Install",
"monitor",
"on",
"all",
"executors"
] | def install_monitor(self, mon):
""" Install monitor on all executors """
assert self.binded
self._exec_group.install_monitor(mon) | [
"def",
"install_monitor",
"(",
"self",
",",
"mon",
")",
":",
"assert",
"self",
".",
"binded",
"self",
".",
"_exec_group",
".",
"install_monitor",
"(",
"mon",
")"
] | https://github.com/jessemelpolio/Faster_RCNN_for_DOTA/blob/499b32c3893ccd8850e0aca07e5afb952d08943e/faster_rcnn/core/module.py#L706-L709 | ||
nsacyber/WALKOFF | 52d3311abe99d64cd2a902eb998c5e398efe0e07 | api_gateway/serverdb/resource_fa.py | python | Resource.as_json | (self, with_roles=False) | return out | Returns the dictionary representation of the Resource object.
Args:
with_roles (bool, optional): Boolean to determine whether or not to include Role objects associated with the
Resource in the JSON representation. Defaults to False. | Returns the dictionary representation of the Resource object. | [
"Returns",
"the",
"dictionary",
"representation",
"of",
"the",
"Resource",
"object",
"."
] | def as_json(self, with_roles=False):
"""Returns the dictionary representation of the Resource object.
Args:
with_roles (bool, optional): Boolean to determine whether or not to include Role objects associated with the
Resource in the JSON representation. Defaults to False.
... | [
"def",
"as_json",
"(",
"self",
",",
"with_roles",
"=",
"False",
")",
":",
"out",
"=",
"{",
"'id'",
":",
"self",
".",
"id",
",",
"'name'",
":",
"self",
".",
"name",
",",
"'operations'",
":",
"[",
"(",
"operation",
".",
"operation_id",
",",
"operation"... | https://github.com/nsacyber/WALKOFF/blob/52d3311abe99d64cd2a902eb998c5e398efe0e07/api_gateway/serverdb/resource_fa.py#L39-L51 | |
OpenMDAO/OpenMDAO1 | 791a6fbbb7d266f3dcbc1f7bde3ae03a70dc1317 | openmdao/core/driver.py | python | Driver.outputs_of_interest | (self) | return self._of_interest(list(chain(self._objs, self._cons))) | Returns
-------
list of tuples of str
The list of constraints and objectives, organized into tuples
according to previously defined VOI groups. | Returns
-------
list of tuples of str
The list of constraints and objectives, organized into tuples
according to previously defined VOI groups. | [
"Returns",
"-------",
"list",
"of",
"tuples",
"of",
"str",
"The",
"list",
"of",
"constraints",
"and",
"objectives",
"organized",
"into",
"tuples",
"according",
"to",
"previously",
"defined",
"VOI",
"groups",
"."
] | def outputs_of_interest(self):
"""
Returns
-------
list of tuples of str
The list of constraints and objectives, organized into tuples
according to previously defined VOI groups.
"""
return self._of_interest(list(chain(self._objs, self._cons))) | [
"def",
"outputs_of_interest",
"(",
"self",
")",
":",
"return",
"self",
".",
"_of_interest",
"(",
"list",
"(",
"chain",
"(",
"self",
".",
"_objs",
",",
"self",
".",
"_cons",
")",
")",
")"
] | https://github.com/OpenMDAO/OpenMDAO1/blob/791a6fbbb7d266f3dcbc1f7bde3ae03a70dc1317/openmdao/core/driver.py#L234-L242 | |
web2py/web2py-book | 9bb9fd0f8ed7f5ba82ba8c1a5d3485540b0b855a | modules/w2p_book_cidr.py | python | CIDRConv.bin2ip | (b) | return ip[:-1] | convert a binary string into an IP address | convert a binary string into an IP address | [
"convert",
"a",
"binary",
"string",
"into",
"an",
"IP",
"address"
] | def bin2ip(b):
"""
convert a binary string into an IP address
"""
ip = ""
for i in range(0,len(b),8):
ip += str(int(b[i:i+8],2))+"."
return ip[:-1] | [
"def",
"bin2ip",
"(",
"b",
")",
":",
"ip",
"=",
"\"\"",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"b",
")",
",",
"8",
")",
":",
"ip",
"+=",
"str",
"(",
"int",
"(",
"b",
"[",
"i",
":",
"i",
"+",
"8",
"]",
",",
"2",
")",
")"... | https://github.com/web2py/web2py-book/blob/9bb9fd0f8ed7f5ba82ba8c1a5d3485540b0b855a/modules/w2p_book_cidr.py#L47-L54 | |
mila-iqia/myia | 56774a39579b4ec4123f44843ad4ca688acc859b | myia/public_api.py | python | conv2d | (input, weight, bias=None, stride=1, padding=0, dilation=1, groups=1) | return ret | r"""Applies a Conv2d. | r"""Applies a Conv2d. | [
"r",
"Applies",
"a",
"Conv2d",
"."
] | def conv2d(input, weight, bias=None, stride=1, padding=0, dilation=1, groups=1):
r"""Applies a Conv2d."""
# noqa: D202
"""
# This is for later versions of pytorch that support other paddings?
if padding_mode != 'zeros':
raise Exception("'zeros' is the only padding_mode that is currently
... | [
"def",
"conv2d",
"(",
"input",
",",
"weight",
",",
"bias",
"=",
"None",
",",
"stride",
"=",
"1",
",",
"padding",
"=",
"0",
",",
"dilation",
"=",
"1",
",",
"groups",
"=",
"1",
")",
":",
"# noqa: D202",
"\"\"\"\n # This is for later versions of pytorch that... | https://github.com/mila-iqia/myia/blob/56774a39579b4ec4123f44843ad4ca688acc859b/myia/public_api.py#L299-L316 | |
JacquesLucke/animation_nodes | b1e3ace8dcb0a771fd882fc3ac4e490b009fa0d1 | animation_nodes/base_types/update_file.py | python | setLinks | (linksByTree) | [] | def setLinks(linksByTree):
for tree, links in linksByTree.items():
for fromNode, fromIdentifier, toNode, toIdentifier in links:
fromSocket = getSocketByIdentifier(fromNode.outputs, fromIdentifier)
toSocket = getSocketByIdentifier(toNode.inputs, toIdentifier)
if fromSocket... | [
"def",
"setLinks",
"(",
"linksByTree",
")",
":",
"for",
"tree",
",",
"links",
"in",
"linksByTree",
".",
"items",
"(",
")",
":",
"for",
"fromNode",
",",
"fromIdentifier",
",",
"toNode",
",",
"toIdentifier",
"in",
"links",
":",
"fromSocket",
"=",
"getSocketB... | https://github.com/JacquesLucke/animation_nodes/blob/b1e3ace8dcb0a771fd882fc3ac4e490b009fa0d1/animation_nodes/base_types/update_file.py#L104-L115 | ||||
reviewboard/reviewboard | 7395902e4c181bcd1d633f61105012ffb1d18e1b | reviewboard/reviews/ui/base.py | python | FileAttachmentReviewUI.get_best_handler | (cls, mimetype) | return best_score, best_fit | Return the Review UI and score that that best fit the mimetype.
Args:
mimetype (tuple):
A parsed mimetype to find the best review UI for. This is a
3-tuple of the type, subtype, and parameters as returned by
:py:func:`mimeparse.parse_mime_type`.
... | Return the Review UI and score that that best fit the mimetype. | [
"Return",
"the",
"Review",
"UI",
"and",
"score",
"that",
"that",
"best",
"fit",
"the",
"mimetype",
"."
] | def get_best_handler(cls, mimetype):
"""Return the Review UI and score that that best fit the mimetype.
Args:
mimetype (tuple):
A parsed mimetype to find the best review UI for. This is a
3-tuple of the type, subtype, and parameters as returned by
... | [
"def",
"get_best_handler",
"(",
"cls",
",",
"mimetype",
")",
":",
"best_score",
"=",
"0",
"best_fit",
"=",
"None",
"for",
"review_ui",
"in",
"_file_attachment_review_uis",
":",
"for",
"mt",
"in",
"review_ui",
".",
"supported_mimetypes",
":",
"try",
":",
"score... | https://github.com/reviewboard/reviewboard/blob/7395902e4c181bcd1d633f61105012ffb1d18e1b/reviewboard/reviews/ui/base.py#L796-L825 | |
koalalorenzo/python-digitalocean | ebea58fddf2ceea35c027bfa66f2fa9f5debfd64 | digitalocean/Tag.py | python | Tag.load | (self) | return self | Fetch data about tag | Fetch data about tag | [
"Fetch",
"data",
"about",
"tag"
] | def load(self):
"""
Fetch data about tag
"""
tags = self.get_data("tags/%s" % self.name)
tag = tags['tag']
for attr in tag.keys():
setattr(self, attr, tag[attr])
return self | [
"def",
"load",
"(",
"self",
")",
":",
"tags",
"=",
"self",
".",
"get_data",
"(",
"\"tags/%s\"",
"%",
"self",
".",
"name",
")",
"tag",
"=",
"tags",
"[",
"'tag'",
"]",
"for",
"attr",
"in",
"tag",
".",
"keys",
"(",
")",
":",
"setattr",
"(",
"self",
... | https://github.com/koalalorenzo/python-digitalocean/blob/ebea58fddf2ceea35c027bfa66f2fa9f5debfd64/digitalocean/Tag.py#L19-L29 | |
fabioz/PyDev.Debugger | 0f8c02a010fe5690405da1dd30ed72326191ce63 | _pydev_bundle/pydev_log.py | python | _pydevd_log | (level, msg, *args) | Levels are:
0 most serious warnings/errors (always printed)
1 warnings/significant events
2 informational trace
3 verbose mode | Levels are: | [
"Levels",
"are",
":"
] | def _pydevd_log(level, msg, *args):
'''
Levels are:
0 most serious warnings/errors (always printed)
1 warnings/significant events
2 informational trace
3 verbose mode
'''
if level <= DebugInfoHolder.DEBUG_TRACE_LEVEL:
# yes, we can have errors printing if the console of the prog... | [
"def",
"_pydevd_log",
"(",
"level",
",",
"msg",
",",
"*",
"args",
")",
":",
"if",
"level",
"<=",
"DebugInfoHolder",
".",
"DEBUG_TRACE_LEVEL",
":",
"# yes, we can have errors printing if the console of the program has been finished (and we're still trying to print something)",
"... | https://github.com/fabioz/PyDev.Debugger/blob/0f8c02a010fe5690405da1dd30ed72326191ce63/_pydev_bundle/pydev_log.py#L97-L144 | ||
tensorflow/tensor2tensor | 2a33b152d7835af66a6d20afe7961751047e28dd | tensor2tensor/data_generators/text_problems.py | python | Text2ClassProblem.num_classes | (self) | The number of classes. | The number of classes. | [
"The",
"number",
"of",
"classes",
"."
] | def num_classes(self):
"""The number of classes."""
raise NotImplementedError() | [
"def",
"num_classes",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/tensorflow/tensor2tensor/blob/2a33b152d7835af66a6d20afe7961751047e28dd/tensor2tensor/data_generators/text_problems.py#L528-L530 | ||
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/util/couch.py | python | categorize_bulk_save_errors | (error) | return result_map | [] | def categorize_bulk_save_errors(error):
result_map = defaultdict(list)
for result in error.results:
error = result.get('error', None)
result_map[error].append(result)
return result_map | [
"def",
"categorize_bulk_save_errors",
"(",
"error",
")",
":",
"result_map",
"=",
"defaultdict",
"(",
"list",
")",
"for",
"result",
"in",
"error",
".",
"results",
":",
"error",
"=",
"result",
".",
"get",
"(",
"'error'",
",",
"None",
")",
"result_map",
"[",
... | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/util/couch.py#L118-L124 | |||
sopel-irc/sopel | 787baa6e39f9dad57d94600c92e10761c41b21ef | sopel/modules/reddit.py | python | redditor_command | (bot, trigger) | return redditor_info(bot, trigger, match, commanded=True) | [] | def redditor_command(bot, trigger):
# require input
if not trigger.group(2):
bot.reply('You must provide a Redditor name.')
return
# Redditor names do not contain spaces
match = trigger.group(3)
return redditor_info(bot, trigger, match, commanded=True) | [
"def",
"redditor_command",
"(",
"bot",
",",
"trigger",
")",
":",
"# require input",
"if",
"not",
"trigger",
".",
"group",
"(",
"2",
")",
":",
"bot",
".",
"reply",
"(",
"'You must provide a Redditor name.'",
")",
"return",
"# Redditor names do not contain spaces",
... | https://github.com/sopel-irc/sopel/blob/787baa6e39f9dad57d94600c92e10761c41b21ef/sopel/modules/reddit.py#L480-L488 | |||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-0.96/django/core/handlers/modpython.py | python | ModPythonRequest._load_post_and_files | (self) | Populates self._post and self._files | Populates self._post and self._files | [
"Populates",
"self",
".",
"_post",
"and",
"self",
".",
"_files"
] | def _load_post_and_files(self):
"Populates self._post and self._files"
if self._req.headers_in.has_key('content-type') and self._req.headers_in['content-type'].startswith('multipart'):
self._post, self._files = http.parse_file_upload(self._req.headers_in, self.raw_post_data)
else:
... | [
"def",
"_load_post_and_files",
"(",
"self",
")",
":",
"if",
"self",
".",
"_req",
".",
"headers_in",
".",
"has_key",
"(",
"'content-type'",
")",
"and",
"self",
".",
"_req",
".",
"headers_in",
"[",
"'content-type'",
"]",
".",
"startswith",
"(",
"'multipart'",
... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-0.96/django/core/handlers/modpython.py#L47-L52 | ||
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v7/services/services/feed_item_service/client.py | python | FeedItemServiceClient.common_location_path | (project: str, location: str,) | return "projects/{project}/locations/{location}".format(
project=project, location=location,
) | Return a fully-qualified location string. | Return a fully-qualified location string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"location",
"string",
"."
] | def common_location_path(project: str, location: str,) -> str:
"""Return a fully-qualified location string."""
return "projects/{project}/locations/{location}".format(
project=project, location=location,
) | [
"def",
"common_location_path",
"(",
"project",
":",
"str",
",",
"location",
":",
"str",
",",
")",
"->",
"str",
":",
"return",
"\"projects/{project}/locations/{location}\"",
".",
"format",
"(",
"project",
"=",
"project",
",",
"location",
"=",
"location",
",",
"... | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v7/services/services/feed_item_service/client.py#L239-L243 | |
scipy/scipy | e0a749f01e79046642ccfdc419edbf9e7ca141ad | scipy/sparse/_bsr.py | python | bsr_matrix.matmat | (self, other) | return self * other | Multiply this sparse matrix by other matrix. | Multiply this sparse matrix by other matrix. | [
"Multiply",
"this",
"sparse",
"matrix",
"by",
"other",
"matrix",
"."
] | def matmat(self, other):
"""Multiply this sparse matrix by other matrix."""
return self * other | [
"def",
"matmat",
"(",
"self",
",",
"other",
")",
":",
"return",
"self",
"*",
"other"
] | https://github.com/scipy/scipy/blob/e0a749f01e79046642ccfdc419edbf9e7ca141ad/scipy/sparse/_bsr.py#L346-L348 | |
open-mmlab/OpenPCDet | 0f4d3f1f5c1fbe551c35917220e75eb90e28035f | pcdet/models/backbones_3d/spconv_unet.py | python | UNetV2.forward | (self, batch_dict) | return batch_dict | Args:
batch_dict:
batch_size: int
vfe_features: (num_voxels, C)
voxel_coords: (num_voxels, 4), [batch_idx, z_idx, y_idx, x_idx]
Returns:
batch_dict:
encoded_spconv_tensor: sparse tensor
point_features: (N, C) | Args:
batch_dict:
batch_size: int
vfe_features: (num_voxels, C)
voxel_coords: (num_voxels, 4), [batch_idx, z_idx, y_idx, x_idx]
Returns:
batch_dict:
encoded_spconv_tensor: sparse tensor
point_features: (N, C) | [
"Args",
":",
"batch_dict",
":",
"batch_size",
":",
"int",
"vfe_features",
":",
"(",
"num_voxels",
"C",
")",
"voxel_coords",
":",
"(",
"num_voxels",
"4",
")",
"[",
"batch_idx",
"z_idx",
"y_idx",
"x_idx",
"]",
"Returns",
":",
"batch_dict",
":",
"encoded_spconv... | def forward(self, batch_dict):
"""
Args:
batch_dict:
batch_size: int
vfe_features: (num_voxels, C)
voxel_coords: (num_voxels, 4), [batch_idx, z_idx, y_idx, x_idx]
Returns:
batch_dict:
encoded_spconv_tensor: s... | [
"def",
"forward",
"(",
"self",
",",
"batch_dict",
")",
":",
"voxel_features",
",",
"voxel_coords",
"=",
"batch_dict",
"[",
"'voxel_features'",
"]",
",",
"batch_dict",
"[",
"'voxel_coords'",
"]",
"batch_size",
"=",
"batch_dict",
"[",
"'batch_size'",
"]",
"input_s... | https://github.com/open-mmlab/OpenPCDet/blob/0f4d3f1f5c1fbe551c35917220e75eb90e28035f/pcdet/models/backbones_3d/spconv_unet.py#L162-L212 | |
pymedusa/Medusa | 1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38 | ext/tornado/web.py | python | Application.listen | (self, port: int, address: str = "", **kwargs: Any) | return server | Starts an HTTP server for this application on the given port.
This is a convenience alias for creating an `.HTTPServer`
object and calling its listen method. Keyword arguments not
supported by `HTTPServer.listen <.TCPServer.listen>` are passed to the
`.HTTPServer` constructor. For adv... | Starts an HTTP server for this application on the given port. | [
"Starts",
"an",
"HTTP",
"server",
"for",
"this",
"application",
"on",
"the",
"given",
"port",
"."
] | def listen(self, port: int, address: str = "", **kwargs: Any) -> HTTPServer:
"""Starts an HTTP server for this application on the given port.
This is a convenience alias for creating an `.HTTPServer`
object and calling its listen method. Keyword arguments not
supported by `HTTPServer.l... | [
"def",
"listen",
"(",
"self",
",",
"port",
":",
"int",
",",
"address",
":",
"str",
"=",
"\"\"",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"HTTPServer",
":",
"server",
"=",
"HTTPServer",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
"server",
"... | https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/tornado/web.py#L2089-L2110 | |
canonical/cloud-init | dc1aabfca851e520693c05322f724bd102c76364 | cloudinit/sources/DataSourceVMware.py | python | is_valid_ip_addr | (val) | return True | Returns false if the address is loopback, link local or unspecified;
otherwise true is returned. | Returns false if the address is loopback, link local or unspecified;
otherwise true is returned. | [
"Returns",
"false",
"if",
"the",
"address",
"is",
"loopback",
"link",
"local",
"or",
"unspecified",
";",
"otherwise",
"true",
"is",
"returned",
"."
] | def is_valid_ip_addr(val):
"""
Returns false if the address is loopback, link local or unspecified;
otherwise true is returned.
"""
# TODO(extend cloudinit.net.is_ip_addr exclude link_local/loopback etc)
# TODO(migrate to use cloudinit.net.is_ip_addr)#
addr = None
try:
addr = ip... | [
"def",
"is_valid_ip_addr",
"(",
"val",
")",
":",
"# TODO(extend cloudinit.net.is_ip_addr exclude link_local/loopback etc)",
"# TODO(migrate to use cloudinit.net.is_ip_addr)#",
"addr",
"=",
"None",
"try",
":",
"addr",
"=",
"ipaddress",
".",
"ip_address",
"(",
"val",
")",
"ex... | https://github.com/canonical/cloud-init/blob/dc1aabfca851e520693c05322f724bd102c76364/cloudinit/sources/DataSourceVMware.py#L684-L702 | |
oracle/oci-python-sdk | 3c1604e4e212008fb6718e2f68cdb5ef71fd5793 | src/oci/_vendor/urllib3/response.py | python | HTTPResponse.data | (self) | [] | def data(self):
# For backwards-compat with earlier urllib3 0.4 and earlier.
if self._body:
return self._body
if self._fp:
return self.read(cache_content=True) | [
"def",
"data",
"(",
"self",
")",
":",
"# For backwards-compat with earlier urllib3 0.4 and earlier.",
"if",
"self",
".",
"_body",
":",
"return",
"self",
".",
"_body",
"if",
"self",
".",
"_fp",
":",
"return",
"self",
".",
"read",
"(",
"cache_content",
"=",
"Tru... | https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/_vendor/urllib3/response.py#L299-L305 | ||||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/cms/v20190321/models.py | python | TextSample.__init__ | (self) | r"""
:param Code: 处理错误码
:type Code: int
:param Content: 关键词
:type Content: str
:param CreatedAt: 创建时间戳
:type CreatedAt: int
:param EvilType: 恶意类型
100:正常
20001:政治
20002:色情
20006:涉毒违法
20007:谩骂
20105:广告引流
24001:暴恐
:type EvilType: int
:param Id: 唯一标... | r"""
:param Code: 处理错误码
:type Code: int
:param Content: 关键词
:type Content: str
:param CreatedAt: 创建时间戳
:type CreatedAt: int
:param EvilType: 恶意类型
100:正常
20001:政治
20002:色情
20006:涉毒违法
20007:谩骂
20105:广告引流
24001:暴恐
:type EvilType: int
:param Id: 唯一标... | [
"r",
":",
"param",
"Code",
":",
"处理错误码",
":",
"type",
"Code",
":",
"int",
":",
"param",
"Content",
":",
"关键词",
":",
"type",
"Content",
":",
"str",
":",
"param",
"CreatedAt",
":",
"创建时间戳",
":",
"type",
"CreatedAt",
":",
"int",
":",
"param",
"EvilType"... | def __init__(self):
r"""
:param Code: 处理错误码
:type Code: int
:param Content: 关键词
:type Content: str
:param CreatedAt: 创建时间戳
:type CreatedAt: int
:param EvilType: 恶意类型
100:正常
20001:政治
20002:色情
20006:涉毒违法
20007:谩骂
20105:广告引流
24001:暴恐
:type EvilType... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"Code",
"=",
"None",
"self",
".",
"Content",
"=",
"None",
"self",
".",
"CreatedAt",
"=",
"None",
"self",
".",
"EvilType",
"=",
"None",
"self",
".",
"Id",
"=",
"None",
"self",
".",
"Label",
"=",... | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/cms/v20190321/models.py#L1928-L1962 | ||
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/CPython/27/Lib/lib-tk/turtle.py | python | TurtleScreen.reset | (self) | Reset all Turtles on the Screen to their initial state.
No argument.
Example (for a TurtleScreen instance named screen):
>>> screen.reset() | Reset all Turtles on the Screen to their initial state. | [
"Reset",
"all",
"Turtles",
"on",
"the",
"Screen",
"to",
"their",
"initial",
"state",
"."
] | def reset(self):
"""Reset all Turtles on the Screen to their initial state.
No argument.
Example (for a TurtleScreen instance named screen):
>>> screen.reset()
"""
for turtle in self._turtles:
turtle._setmode(self._mode)
turtle.reset() | [
"def",
"reset",
"(",
"self",
")",
":",
"for",
"turtle",
"in",
"self",
".",
"_turtles",
":",
"turtle",
".",
"_setmode",
"(",
"self",
".",
"_mode",
")",
"turtle",
".",
"reset",
"(",
")"
] | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/CPython/27/Lib/lib-tk/turtle.py#L1148-L1158 | ||
locationtech-labs/geopyspark | 97bcb17a56ed4b4059e2f0dbab97706562cac692 | geopyspark/geotrellis/neighborhood.py | python | Nesw.__repr__ | (self) | return "Nesw(extent={})".format(self.param_1) | [] | def __repr__(self):
return "Nesw(extent={})".format(self.param_1) | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"\"Nesw(extent={})\"",
".",
"format",
"(",
"self",
".",
"param_1",
")"
] | https://github.com/locationtech-labs/geopyspark/blob/97bcb17a56ed4b4059e2f0dbab97706562cac692/geopyspark/geotrellis/neighborhood.py#L122-L123 | |||
poppy-project/pypot | c5d384fe23eef9f6ec98467f6f76626cdf20afb9 | pypot/dynamixel/protocol/v2.py | python | DxlInstructionPacket.checksum | (self) | return crc16(self._buff(), 5 + self.length) | [] | def checksum(self):
return crc16(self._buff(), 5 + self.length) | [
"def",
"checksum",
"(",
"self",
")",
":",
"return",
"crc16",
"(",
"self",
".",
"_buff",
"(",
")",
",",
"5",
"+",
"self",
".",
"length",
")"
] | https://github.com/poppy-project/pypot/blob/c5d384fe23eef9f6ec98467f6f76626cdf20afb9/pypot/dynamixel/protocol/v2.py#L75-L76 | |||
XanaduAI/strawberryfields | 298601e409528f22c6717c2d816ab68ae8bda1fa | strawberryfields/ops.py | python | GKP.__str__ | (self) | return self.__class__.__name__ + "(" + ", ".join(temp) + ")" | String representation for the GKP operation using Blackbird syntax.
Assumes that the arguments to GKP can be lists with non-symbolic
entries, strings or scalars.
Returns:
str: string representation | String representation for the GKP operation using Blackbird syntax. | [
"String",
"representation",
"for",
"the",
"GKP",
"operation",
"using",
"Blackbird",
"syntax",
"."
] | def __str__(self):
"""String representation for the GKP operation using Blackbird syntax.
Assumes that the arguments to GKP can be lists with non-symbolic
entries, strings or scalars.
Returns:
str: string representation
"""
# defaults to the class name
... | [
"def",
"__str__",
"(",
"self",
")",
":",
"# defaults to the class name",
"if",
"not",
"self",
".",
"p",
":",
"return",
"self",
".",
"__class__",
".",
"__name__",
"# class name and parameter values",
"temp",
"=",
"[",
"]",
"for",
"i",
"in",
"self",
".",
"p",
... | https://github.com/XanaduAI/strawberryfields/blob/298601e409528f22c6717c2d816ab68ae8bda1fa/strawberryfields/ops.py#L964-L987 | |
enthought/mayavi | 2103a273568b8f0bd62328801aafbd6252543ae8 | mayavi/tools/data_wizards/data_source_factory.py | python | DataSourceFactory._add_vector_data | (self) | Adds the vector data to the vtk source. | Adds the vector data to the vtk source. | [
"Adds",
"the",
"vector",
"data",
"to",
"the",
"vtk",
"source",
"."
] | def _add_vector_data(self):
""" Adds the vector data to the vtk source.
"""
if self.has_vector_data:
vectors = c_[self.vector_u.ravel(),
self.vector_v.ravel(),
self.vector_w.ravel(),
]
self._vtk_sou... | [
"def",
"_add_vector_data",
"(",
"self",
")",
":",
"if",
"self",
".",
"has_vector_data",
":",
"vectors",
"=",
"c_",
"[",
"self",
".",
"vector_u",
".",
"ravel",
"(",
")",
",",
"self",
".",
"vector_v",
".",
"ravel",
"(",
")",
",",
"self",
".",
"vector_w... | https://github.com/enthought/mayavi/blob/2103a273568b8f0bd62328801aafbd6252543ae8/mayavi/tools/data_wizards/data_source_factory.py#L75-L83 | ||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/google/appengine/ext/gql/__init__.py | python | Execute | (query_string, *args, **keyword_args) | return proto_query.Bind(args, keyword_args).Run() | Execute command to parse and run the query.
Calls the query parser code to build a proto-query which is an
unbound query. The proto-query is then bound into a real query and
executed.
Args:
query_string: properly formatted GQL query string.
args: rest of the positional arguments used to bind numeric r... | Execute command to parse and run the query. | [
"Execute",
"command",
"to",
"parse",
"and",
"run",
"the",
"query",
"."
] | def Execute(query_string, *args, **keyword_args):
"""Execute command to parse and run the query.
Calls the query parser code to build a proto-query which is an
unbound query. The proto-query is then bound into a real query and
executed.
Args:
query_string: properly formatted GQL query string.
args: ... | [
"def",
"Execute",
"(",
"query_string",
",",
"*",
"args",
",",
"*",
"*",
"keyword_args",
")",
":",
"app",
"=",
"keyword_args",
".",
"pop",
"(",
"'_app'",
",",
"None",
")",
"proto_query",
"=",
"GQL",
"(",
"query_string",
",",
"_app",
"=",
"app",
")",
"... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/google/appengine/ext/gql/__init__.py#L63-L85 | |
LuxCoreRender/BlendLuxCore | bf31ca58501d54c02acd97001b6db7de81da7cbf | operators/general.py | python | LUXCORE_OT_open_website_popup.draw | (self, context) | [] | def draw(self, context):
layout = self.layout
if self.message:
layout.label(text=self.message) | [
"def",
"draw",
"(",
"self",
",",
"context",
")",
":",
"layout",
"=",
"self",
".",
"layout",
"if",
"self",
".",
"message",
":",
"layout",
".",
"label",
"(",
"text",
"=",
"self",
".",
"message",
")"
] | https://github.com/LuxCoreRender/BlendLuxCore/blob/bf31ca58501d54c02acd97001b6db7de81da7cbf/operators/general.py#L229-L232 | ||||
inventree/InvenTree | 4a5e4a88ac3e91d64a21e8cab3708ecbc6e2bd8b | InvenTree/barcodes/plugins/inventree_barcode.py | python | InvenTreeBarcodePlugin.getStockItem | (self) | return None | [] | def getStockItem(self):
for k in self.data.keys():
if k.lower() == 'stockitem':
data = self.data[k]
pk = None
# Initially try casting to an integer
try:
pk = int(data)
except (TypeError, ValueErro... | [
"def",
"getStockItem",
"(",
"self",
")",
":",
"for",
"k",
"in",
"self",
".",
"data",
".",
"keys",
"(",
")",
":",
"if",
"k",
".",
"lower",
"(",
")",
"==",
"'stockitem'",
":",
"data",
"=",
"self",
".",
"data",
"[",
"k",
"]",
"pk",
"=",
"None",
... | https://github.com/inventree/InvenTree/blob/4a5e4a88ac3e91d64a21e8cab3708ecbc6e2bd8b/InvenTree/barcodes/plugins/inventree_barcode.py#L61-L88 | |||
frobelbest/BANet | 4015642c9dfe8287c5f146d7a90df594625f2560 | legacy/deeptam/python/deeptam_tracker/evaluation/rgbd_benchmark/evaluate_ate.py | python | align | (model,data) | return rot,trans,trans_error | Align two trajectories using the method of Horn (closed-form).
Input:
model -- first trajectory (3xn)
data -- second trajectory (3xn)
Output:
rot -- rotation matrix (3x3)
trans -- translation vector (3x1)
trans_error -- translational error per point (1xn) | Align two trajectories using the method of Horn (closed-form).
Input:
model -- first trajectory (3xn)
data -- second trajectory (3xn)
Output:
rot -- rotation matrix (3x3)
trans -- translation vector (3x1)
trans_error -- translational error per point (1xn) | [
"Align",
"two",
"trajectories",
"using",
"the",
"method",
"of",
"Horn",
"(",
"closed",
"-",
"form",
")",
".",
"Input",
":",
"model",
"--",
"first",
"trajectory",
"(",
"3xn",
")",
"data",
"--",
"second",
"trajectory",
"(",
"3xn",
")",
"Output",
":",
"ro... | def align(model,data):
"""Align two trajectories using the method of Horn (closed-form).
Input:
model -- first trajectory (3xn)
data -- second trajectory (3xn)
Output:
rot -- rotation matrix (3x3)
trans -- translation vector (3x1)
trans_error -- translational error per point (1... | [
"def",
"align",
"(",
"model",
",",
"data",
")",
":",
"numpy",
".",
"set_printoptions",
"(",
"precision",
"=",
"3",
",",
"suppress",
"=",
"True",
")",
"model_zerocentered",
"=",
"model",
"-",
"model",
".",
"mean",
"(",
"1",
")",
"data_zerocentered",
"=",
... | https://github.com/frobelbest/BANet/blob/4015642c9dfe8287c5f146d7a90df594625f2560/legacy/deeptam/python/deeptam_tracker/evaluation/rgbd_benchmark/evaluate_ate.py#L50-L82 | |
DeepLabCut/DeepLabCut | 1dd14c54729ae0d8e66ca495aa5baeb83502e1c7 | deeplabcut/pose_estimation_tensorflow/predict_videos.py | python | convert_detections2tracklets | (
config,
videos,
videotype="avi",
shuffle=1,
trainingsetindex=0,
overwrite=False,
destfolder=None,
ignore_bodyparts=None,
inferencecfg=None,
modelprefix="",
greedy=False,
calibrate=False,
window_size=0,
identity_only=False,
track_method="",
) | This should be called at the end of deeplabcut.analyze_videos for multianimal projects!
Parameters
----------
config : string
Full path of the config.yaml file as a string.
videos : list
A list of strings containing the full paths to videos for analysis or a path to the directory, wher... | This should be called at the end of deeplabcut.analyze_videos for multianimal projects! | [
"This",
"should",
"be",
"called",
"at",
"the",
"end",
"of",
"deeplabcut",
".",
"analyze_videos",
"for",
"multianimal",
"projects!"
] | def convert_detections2tracklets(
config,
videos,
videotype="avi",
shuffle=1,
trainingsetindex=0,
overwrite=False,
destfolder=None,
ignore_bodyparts=None,
inferencecfg=None,
modelprefix="",
greedy=False,
calibrate=False,
window_size=0,
identity_only=False,
tra... | [
"def",
"convert_detections2tracklets",
"(",
"config",
",",
"videos",
",",
"videotype",
"=",
"\"avi\"",
",",
"shuffle",
"=",
"1",
",",
"trainingsetindex",
"=",
"0",
",",
"overwrite",
"=",
"False",
",",
"destfolder",
"=",
"None",
",",
"ignore_bodyparts",
"=",
... | https://github.com/DeepLabCut/DeepLabCut/blob/1dd14c54729ae0d8e66ca495aa5baeb83502e1c7/deeplabcut/pose_estimation_tensorflow/predict_videos.py#L1271-L1607 | ||
danielgtaylor/arista | edcf2565eea92014b55c1084acd12a832aab1ca2 | arista/presets.py | python | extract | (stream) | return [x[:-5] for x in tar.getnames() if x.endswith(".json")] | Extract a preset file into the user's local presets directory.
@type stream: a file-like object
@param stream: The opened bzip2-compressed tar file of the preset
@rtype: list
@return: The installed device preset shortnames ["name1", "name2", ...] | Extract a preset file into the user's local presets directory. | [
"Extract",
"a",
"preset",
"file",
"into",
"the",
"user",
"s",
"local",
"presets",
"directory",
"."
] | def extract(stream):
"""
Extract a preset file into the user's local presets directory.
@type stream: a file-like object
@param stream: The opened bzip2-compressed tar file of the preset
@rtype: list
@return: The installed device preset shortnames ["name1", "name2", ... | [
"def",
"extract",
"(",
"stream",
")",
":",
"local_path",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"os",
".",
"path",
".",
"join",
"(",
"\"~\"",
",",
"\".arista\"",
",",
"\"presets\"",
")",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
... | https://github.com/danielgtaylor/arista/blob/edcf2565eea92014b55c1084acd12a832aab1ca2/arista/presets.py#L565-L585 | |
utkusen/leviathan | a1a1d8ce19ea178ab68e550bfb45797f11163cf8 | lib/utils.py | python | query_constructor | (country, protocol, service) | return {
'censys': 'location.country_code: ' + country + ' and protocols: ' + port,
}.get(service, "country:" + country + " port:" + port) | [] | def query_constructor(country, protocol, service):
port = get_protocol_by_service(protocol, service)
return {
'censys': 'location.country_code: ' + country + ' and protocols: ' + port,
}.get(service, "country:" + country + " port:" + port) | [
"def",
"query_constructor",
"(",
"country",
",",
"protocol",
",",
"service",
")",
":",
"port",
"=",
"get_protocol_by_service",
"(",
"protocol",
",",
"service",
")",
"return",
"{",
"'censys'",
":",
"'location.country_code: '",
"+",
"country",
"+",
"' and protocols:... | https://github.com/utkusen/leviathan/blob/a1a1d8ce19ea178ab68e550bfb45797f11163cf8/lib/utils.py#L118-L122 | |||
mozman/ezdxf | 59d0fc2ea63f5cf82293428f5931da7e9f9718e9 | src/ezdxf/addons/acadctb.py | python | NamedPlotStyles.get_lineweight | (self, name: str) | Returns the assigned lineweight for :class:`PlotStyle` `name` in
millimeter. | Returns the assigned lineweight for :class:`PlotStyle` `name` in
millimeter. | [
"Returns",
"the",
"assigned",
"lineweight",
"for",
":",
"class",
":",
"PlotStyle",
"name",
"in",
"millimeter",
"."
] | def get_lineweight(self, name: str):
"""Returns the assigned lineweight for :class:`PlotStyle` `name` in
millimeter.
"""
style = self[name]
lineweight = style.get_lineweight()
if lineweight == 0.0:
return None
else:
return lineweight | [
"def",
"get_lineweight",
"(",
"self",
",",
"name",
":",
"str",
")",
":",
"style",
"=",
"self",
"[",
"name",
"]",
"lineweight",
"=",
"style",
".",
"get_lineweight",
"(",
")",
"if",
"lineweight",
"==",
"0.0",
":",
"return",
"None",
"else",
":",
"return",... | https://github.com/mozman/ezdxf/blob/59d0fc2ea63f5cf82293428f5931da7e9f9718e9/src/ezdxf/addons/acadctb.py#L572-L581 | ||
zbyte64/django-hyperadmin | 9ac2ae284b76efb3c50a1c2899f383a27154cb54 | hyperadmin/indexes.py | python | Index.get_links | (self, **kwargs) | return links | [] | def get_links(self, **kwargs):
links = self.get_filter_links(**kwargs)
#active_section = self.get_active_section()
#if active_section:
# links += active_section.get_pagination_links()
return links | [
"def",
"get_links",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"links",
"=",
"self",
".",
"get_filter_links",
"(",
"*",
"*",
"kwargs",
")",
"#active_section = self.get_active_section()",
"#if active_section:",
"# links += active_section.get_pagination_links()",
... | https://github.com/zbyte64/django-hyperadmin/blob/9ac2ae284b76efb3c50a1c2899f383a27154cb54/hyperadmin/indexes.py#L104-L109 | |||
caiiiac/Machine-Learning-with-Python | 1a26c4467da41ca4ebc3d5bd789ea942ef79422f | MachineLearning/venv/lib/python3.5/site-packages/pandas/core/internals.py | python | DatetimeTZBlock.to_object_block | (self, mgr) | return self.make_block(values, klass=ObjectBlock, **kwargs) | return myself as an object block
Since we keep the DTI as a 1-d object, this is different
depends on BlockManager's ndim | return myself as an object block | [
"return",
"myself",
"as",
"an",
"object",
"block"
] | def to_object_block(self, mgr):
"""
return myself as an object block
Since we keep the DTI as a 1-d object, this is different
depends on BlockManager's ndim
"""
values = self.get_values(dtype=object)
kwargs = {}
if mgr.ndim > 1:
values = _bloc... | [
"def",
"to_object_block",
"(",
"self",
",",
"mgr",
")",
":",
"values",
"=",
"self",
".",
"get_values",
"(",
"dtype",
"=",
"object",
")",
"kwargs",
"=",
"{",
"}",
"if",
"mgr",
".",
"ndim",
">",
"1",
":",
"values",
"=",
"_block_shape",
"(",
"values",
... | https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/pandas/core/internals.py#L2403-L2416 | |
JetBrains/python-skeletons | 95ad24b666e475998e5d1cc02ed53a2188036167 | __builtin__.py | python | int.__rrshift__ | (self, y) | return 0 | y shifted right by n bits.
:type y: numbers.Integral
:rtype: int | y shifted right by n bits. | [
"y",
"shifted",
"right",
"by",
"n",
"bits",
"."
] | def __rrshift__(self, y):
"""y shifted right by n bits.
:type y: numbers.Integral
:rtype: int
"""
return 0 | [
"def",
"__rrshift__",
"(",
"self",
",",
"y",
")",
":",
"return",
"0"
] | https://github.com/JetBrains/python-skeletons/blob/95ad24b666e475998e5d1cc02ed53a2188036167/__builtin__.py#L639-L645 | |
cloudant/bigcouch | 8e9c1ec0ed1676ff152f10658f5c83a1a91fa8fe | couchjs/scons/scons-local-2.0.1/SCons/Node/FS.py | python | Dir._create | (self) | Create this directory, silently and without worrying about
whether the builder is the default or not. | Create this directory, silently and without worrying about
whether the builder is the default or not. | [
"Create",
"this",
"directory",
"silently",
"and",
"without",
"worrying",
"about",
"whether",
"the",
"builder",
"is",
"the",
"default",
"or",
"not",
"."
] | def _create(self):
"""Create this directory, silently and without worrying about
whether the builder is the default or not."""
listDirs = []
parent = self
while parent:
if parent.exists():
break
listDirs.append(parent)
p = paren... | [
"def",
"_create",
"(",
"self",
")",
":",
"listDirs",
"=",
"[",
"]",
"parent",
"=",
"self",
"while",
"parent",
":",
"if",
"parent",
".",
"exists",
"(",
")",
":",
"break",
"listDirs",
".",
"append",
"(",
"parent",
")",
"p",
"=",
"parent",
".",
"up",
... | https://github.com/cloudant/bigcouch/blob/8e9c1ec0ed1676ff152f10658f5c83a1a91fa8fe/couchjs/scons/scons-local-2.0.1/SCons/Node/FS.py#L1576-L1606 | ||
yt-project/yt | dc7b24f9b266703db4c843e329c6c8644d47b824 | yt/utilities/sdf.py | python | SDFIndex.get_padded_bbox_data | (self, level, cell_iarr, pad, fields) | return data | Return list of data chunks for a cell on the given level
plus a padding around the cell, for a list of fields.
Returns
-------
data: list
A list of dictionaries of data.
Examples
--------
>>> chunks = midx.get_padded_bbox_data(
... ... | Return list of data chunks for a cell on the given level
plus a padding around the cell, for a list of fields. | [
"Return",
"list",
"of",
"data",
"chunks",
"for",
"a",
"cell",
"on",
"the",
"given",
"level",
"plus",
"a",
"padding",
"around",
"the",
"cell",
"for",
"a",
"list",
"of",
"fields",
"."
] | def get_padded_bbox_data(self, level, cell_iarr, pad, fields):
"""
Return list of data chunks for a cell on the given level
plus a padding around the cell, for a list of fields.
Returns
-------
data: list
A list of dictionaries of data.
Examp... | [
"def",
"get_padded_bbox_data",
"(",
"self",
",",
"level",
",",
"cell_iarr",
",",
"pad",
",",
"fields",
")",
":",
"_ensure_xyz_fields",
"(",
"fields",
")",
"data",
"=",
"[",
"]",
"for",
"dd",
"in",
"self",
".",
"iter_padded_bbox_data",
"(",
"level",
",",
... | https://github.com/yt-project/yt/blob/dc7b24f9b266703db4c843e329c6c8644d47b824/yt/utilities/sdf.py#L1371-L1393 | |
khanhnamle1994/natural-language-processing | 01d450d5ac002b0156ef4cf93a07cb508c1bcdc5 | assignment1/.env/lib/python2.7/site-packages/numpy/matlib.py | python | eye | (n,M=None, k=0, dtype=float) | return asmatrix(np.eye(n, M, k, dtype)) | Return a matrix with ones on the diagonal and zeros elsewhere.
Parameters
----------
n : int
Number of rows in the output.
M : int, optional
Number of columns in the output, defaults to `n`.
k : int, optional
Index of the diagonal: 0 refers to the main diagonal,
a po... | Return a matrix with ones on the diagonal and zeros elsewhere. | [
"Return",
"a",
"matrix",
"with",
"ones",
"on",
"the",
"diagonal",
"and",
"zeros",
"elsewhere",
"."
] | def eye(n,M=None, k=0, dtype=float):
"""
Return a matrix with ones on the diagonal and zeros elsewhere.
Parameters
----------
n : int
Number of rows in the output.
M : int, optional
Number of columns in the output, defaults to `n`.
k : int, optional
Index of the diag... | [
"def",
"eye",
"(",
"n",
",",
"M",
"=",
"None",
",",
"k",
"=",
"0",
",",
"dtype",
"=",
"float",
")",
":",
"return",
"asmatrix",
"(",
"np",
".",
"eye",
"(",
"n",
",",
"M",
",",
"k",
",",
"dtype",
")",
")"
] | https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/numpy/matlib.py#L176-L213 | |
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/surface/contours/_x.py | python | X.size | (self) | return self["size"] | Sets the step between each contour level. Must be positive.
The 'size' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float | Sets the step between each contour level. Must be positive.
The 'size' property is a number and may be specified as:
- An int or float in the interval [0, inf] | [
"Sets",
"the",
"step",
"between",
"each",
"contour",
"level",
".",
"Must",
"be",
"positive",
".",
"The",
"size",
"property",
"is",
"a",
"number",
"and",
"may",
"be",
"specified",
"as",
":",
"-",
"An",
"int",
"or",
"float",
"in",
"the",
"interval",
"[",... | def size(self):
"""
Sets the step between each contour level. Must be positive.
The 'size' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
"""
return self["size"] | [
"def",
"size",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"size\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/surface/contours/_x.py#L271-L282 | |
aneisch/home-assistant-config | 86e381fde9609cb8871c439c433c12989e4e225d | custom_components/hacs/validate/manager.py | python | ValidationManager.async_run_repository_checks | (self, repository: HacsRepository) | Run all validators for a repository. | Run all validators for a repository. | [
"Run",
"all",
"validators",
"for",
"a",
"repository",
"."
] | async def async_run_repository_checks(self, repository: HacsRepository) -> None:
"""Run all validators for a repository."""
if not self.hacs.system.running:
return
await self.async_load(repository)
await asyncio.gather(
*[
validator.execute_valid... | [
"async",
"def",
"async_run_repository_checks",
"(",
"self",
",",
"repository",
":",
"HacsRepository",
")",
"->",
"None",
":",
"if",
"not",
"self",
".",
"hacs",
".",
"system",
".",
"running",
":",
"return",
"await",
"self",
".",
"async_load",
"(",
"repository... | https://github.com/aneisch/home-assistant-config/blob/86e381fde9609cb8871c439c433c12989e4e225d/custom_components/hacs/validate/manager.py#L51-L77 | ||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/gse/v20191112/models.py | python | UpdateGameServerSessionQueueResponse.__init__ | (self) | r"""
:param GameServerSessionQueue: 部署服务组对象
:type GameServerSessionQueue: :class:`tencentcloud.gse.v20191112.models.GameServerSessionQueue`
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str | r"""
:param GameServerSessionQueue: 部署服务组对象
:type GameServerSessionQueue: :class:`tencentcloud.gse.v20191112.models.GameServerSessionQueue`
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str | [
"r",
":",
"param",
"GameServerSessionQueue",
":",
"部署服务组对象",
":",
"type",
"GameServerSessionQueue",
":",
":",
"class",
":",
"tencentcloud",
".",
"gse",
".",
"v20191112",
".",
"models",
".",
"GameServerSessionQueue",
":",
"param",
"RequestId",
":",
"唯一请求",
"ID,每次... | def __init__(self):
r"""
:param GameServerSessionQueue: 部署服务组对象
:type GameServerSessionQueue: :class:`tencentcloud.gse.v20191112.models.GameServerSessionQueue`
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.GameServerSes... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"GameServerSessionQueue",
"=",
"None",
"self",
".",
"RequestId",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/gse/v20191112/models.py#L6804-L6812 | ||
boto/boto | b2a6f08122b2f1b89888d2848e730893595cd001 | boto/iam/connection.py | python | IAMConnection.create_login_profile | (self, user_name, password) | return self.get_response('CreateLoginProfile', params) | Creates a login profile for the specified user, give the user the
ability to access AWS services and the AWS Management Console.
:type user_name: string
:param user_name: The name of the user
:type password: string
:param password: The new password for the user | Creates a login profile for the specified user, give the user the
ability to access AWS services and the AWS Management Console. | [
"Creates",
"a",
"login",
"profile",
"for",
"the",
"specified",
"user",
"give",
"the",
"user",
"the",
"ability",
"to",
"access",
"AWS",
"services",
"and",
"the",
"AWS",
"Management",
"Console",
"."
] | def create_login_profile(self, user_name, password):
"""
Creates a login profile for the specified user, give the user the
ability to access AWS services and the AWS Management Console.
:type user_name: string
:param user_name: The name of the user
:type password: strin... | [
"def",
"create_login_profile",
"(",
"self",
",",
"user_name",
",",
"password",
")",
":",
"params",
"=",
"{",
"'UserName'",
":",
"user_name",
",",
"'Password'",
":",
"password",
"}",
"return",
"self",
".",
"get_response",
"(",
"'CreateLoginProfile'",
",",
"para... | https://github.com/boto/boto/blob/b2a6f08122b2f1b89888d2848e730893595cd001/boto/iam/connection.py#L940-L954 | |
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-windows/x86/ldap3/utils/ciDict.py | python | CaseInsensitiveDict.__repr__ | (self) | return repr(self._store) | [] | def __repr__(self):
return repr(self._store) | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"repr",
"(",
"self",
".",
"_store",
")"
] | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-windows/x86/ldap3/utils/ciDict.py#L76-L77 | |||
Azure/azure-devops-cli-extension | 11334cd55806bef0b99c3bee5a438eed71e44037 | azure-devops/azext_devops/devops_sdk/v5_0/tfvc/tfvc_client.py | python | TfvcClient.get_items_batch | (self, item_request_data, project=None) | return self._deserialize('[[TfvcItem]]', self._unwrap_collection(response)) | GetItemsBatch.
Post for retrieving a set of items given a list of paths or a long path. Allows for specifying the recursionLevel and version descriptors for each path.
:param :class:`<TfvcItemRequestData> <azure.devops.v5_0.tfvc.models.TfvcItemRequestData>` item_request_data:
:param str project:... | GetItemsBatch.
Post for retrieving a set of items given a list of paths or a long path. Allows for specifying the recursionLevel and version descriptors for each path.
:param :class:`<TfvcItemRequestData> <azure.devops.v5_0.tfvc.models.TfvcItemRequestData>` item_request_data:
:param str project:... | [
"GetItemsBatch",
".",
"Post",
"for",
"retrieving",
"a",
"set",
"of",
"items",
"given",
"a",
"list",
"of",
"paths",
"or",
"a",
"long",
"path",
".",
"Allows",
"for",
"specifying",
"the",
"recursionLevel",
"and",
"version",
"descriptors",
"for",
"each",
"path",... | def get_items_batch(self, item_request_data, project=None):
"""GetItemsBatch.
Post for retrieving a set of items given a list of paths or a long path. Allows for specifying the recursionLevel and version descriptors for each path.
:param :class:`<TfvcItemRequestData> <azure.devops.v5_0.tfvc.mode... | [
"def",
"get_items_batch",
"(",
"self",
",",
"item_request_data",
",",
"project",
"=",
"None",
")",
":",
"route_values",
"=",
"{",
"}",
"if",
"project",
"is",
"not",
"None",
":",
"route_values",
"[",
"'project'",
"]",
"=",
"self",
".",
"_serialize",
".",
... | https://github.com/Azure/azure-devops-cli-extension/blob/11334cd55806bef0b99c3bee5a438eed71e44037/azure-devops/azext_devops/devops_sdk/v5_0/tfvc/tfvc_client.py#L291-L307 | |
wrye-bash/wrye-bash | d495c47cfdb44475befa523438a40c4419cb386f | Mopy/bash/basher/saves_links.py | python | Saves_ProfilesData.remove | (self,profile) | return True | Removes load list. | Removes load list. | [
"Removes",
"load",
"list",
"."
] | def remove(self,profile):
"""Removes load list."""
profileSaves = _win_join(profile)
#--Can't remove active or Default directory.
if bosh.saveInfos.localSave == profileSaves:
balt.showError(self.parent,_(u'Active profile cannot be removed.'))
return False
... | [
"def",
"remove",
"(",
"self",
",",
"profile",
")",
":",
"profileSaves",
"=",
"_win_join",
"(",
"profile",
")",
"#--Can't remove active or Default directory.",
"if",
"bosh",
".",
"saveInfos",
".",
"localSave",
"==",
"profileSaves",
":",
"balt",
".",
"showError",
... | https://github.com/wrye-bash/wrye-bash/blob/d495c47cfdb44475befa523438a40c4419cb386f/Mopy/bash/basher/saves_links.py#L137-L158 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_openshift/library/oc_adm_policy_group.py | python | Yedit._write | (filename, contents) | Actually write the file contents to disk. This helps with mocking. | Actually write the file contents to disk. This helps with mocking. | [
"Actually",
"write",
"the",
"file",
"contents",
"to",
"disk",
".",
"This",
"helps",
"with",
"mocking",
"."
] | def _write(filename, contents):
''' Actually write the file contents to disk. This helps with mocking. '''
tmp_filename = filename + '.yedit'
with open(tmp_filename, 'w') as yfd:
fcntl.flock(yfd, fcntl.LOCK_EX | fcntl.LOCK_NB)
yfd.write(contents)
fcntl.flock... | [
"def",
"_write",
"(",
"filename",
",",
"contents",
")",
":",
"tmp_filename",
"=",
"filename",
"+",
"'.yedit'",
"with",
"open",
"(",
"tmp_filename",
",",
"'w'",
")",
"as",
"yfd",
":",
"fcntl",
".",
"flock",
"(",
"yfd",
",",
"fcntl",
".",
"LOCK_EX",
"|",... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_openshift/library/oc_adm_policy_group.py#L341-L351 | ||
graalvm/mx | 29c0debab406352df3af246be2f8973be5db69ae | mx_benchmark.py | python | StdOutBenchmarkSuite.repairDatapointsAndFail | (self, benchmarks, bmSuiteArgs, partialResults, message) | [] | def repairDatapointsAndFail(self, benchmarks, bmSuiteArgs, partialResults, message):
self.repairDatapoints(benchmarks, bmSuiteArgs, partialResults)
for result in partialResults:
result["error"] = message
raise BenchmarkFailureError(message, partialResults) | [
"def",
"repairDatapointsAndFail",
"(",
"self",
",",
"benchmarks",
",",
"bmSuiteArgs",
",",
"partialResults",
",",
"message",
")",
":",
"self",
".",
"repairDatapoints",
"(",
"benchmarks",
",",
"bmSuiteArgs",
",",
"partialResults",
")",
"for",
"result",
"in",
"par... | https://github.com/graalvm/mx/blob/29c0debab406352df3af246be2f8973be5db69ae/mx_benchmark.py#L1042-L1046 | ||||
gustavz/realtime_object_detection | 3aab434b20e510d3953b4265dd73a1c7c315067d | rod/model.py | python | Model.start | (self) | starts fps and visualizer class | starts fps and visualizer class | [
"starts",
"fps",
"and",
"visualizer",
"class"
] | def start(self):
"""
starts fps and visualizer class
"""
self.fps.start()
self._visualizer = Visualizer(self.config).start() | [
"def",
"start",
"(",
"self",
")",
":",
"self",
".",
"fps",
".",
"start",
"(",
")",
"self",
".",
"_visualizer",
"=",
"Visualizer",
"(",
"self",
".",
"config",
")",
".",
"start",
"(",
")"
] | https://github.com/gustavz/realtime_object_detection/blob/3aab434b20e510d3953b4265dd73a1c7c315067d/rod/model.py#L242-L247 | ||
cocoakekeyu/autoproxy | c7298b1d46129e7bbb58d5a701be4e01025dde4f | autoproxy.py | python | ProxyFetch.fetch_proxy_from_ip3336 | (self) | return proxyes | [] | def fetch_proxy_from_ip3336(self):
proxyes = {}
url = 'http://www.ip3366.net/free/?stype=1&page='
try:
for i in range(1, 6):
soup = self.get_soup(url + str(i))
trs = soup.find("div", attrs={"id": "list"}).table.find_all("tr")
for i, tr ... | [
"def",
"fetch_proxy_from_ip3336",
"(",
"self",
")",
":",
"proxyes",
"=",
"{",
"}",
"url",
"=",
"'http://www.ip3366.net/free/?stype=1&page='",
"try",
":",
"for",
"i",
"in",
"range",
"(",
"1",
",",
"6",
")",
":",
"soup",
"=",
"self",
".",
"get_soup",
"(",
... | https://github.com/cocoakekeyu/autoproxy/blob/c7298b1d46129e7bbb58d5a701be4e01025dde4f/autoproxy.py#L290-L308 | |||
pyscf/pyscf | 0adfb464333f5ceee07b664f291d4084801bae64 | pyscf/solvent/__init__.py | python | ddPCM | (method_or_mol, solvent_obj=None, dm=None) | Initialize ddPCM model.
Examples:
>>> mf = ddPCM(scf.RHF(mol))
>>> mf.kernel()
>>> sol = ddPCM(mol)
>>> mc = ddPCM(CASCI(mf, 6, 6), sol)
>>> mc.kernel() | Initialize ddPCM model. | [
"Initialize",
"ddPCM",
"model",
"."
] | def ddPCM(method_or_mol, solvent_obj=None, dm=None):
'''Initialize ddPCM model.
Examples:
>>> mf = ddPCM(scf.RHF(mol))
>>> mf.kernel()
>>> sol = ddPCM(mol)
>>> mc = ddPCM(CASCI(mf, 6, 6), sol)
>>> mc.kernel()
'''
from pyscf import gto
from pyscf import scf, mcscf
from pyscf... | [
"def",
"ddPCM",
"(",
"method_or_mol",
",",
"solvent_obj",
"=",
"None",
",",
"dm",
"=",
"None",
")",
":",
"from",
"pyscf",
"import",
"gto",
"from",
"pyscf",
"import",
"scf",
",",
"mcscf",
"from",
"pyscf",
"import",
"tdscf",
"from",
"pyscf",
".",
"solvent"... | https://github.com/pyscf/pyscf/blob/0adfb464333f5ceee07b664f291d4084801bae64/pyscf/solvent/__init__.py#L47-L75 | ||
chadmv/cmt | 1b1a9a4fb154d1d10e73373cf899e4d83c95a6a1 | scripts/pyparsing/core.py | python | ParserElement.scanString | (self, instring, maxMatches=_MAX_INT, overlap=False) | Scan the input string for expression matches. Each match will return the
matching tokens, start location, and end location. May be called with optional
``maxMatches`` argument, to clip scanning after 'n' matches are found. If
``overlap`` is specified, then overlapping matches will be reported... | Scan the input string for expression matches. Each match will return the
matching tokens, start location, and end location. May be called with optional
``maxMatches`` argument, to clip scanning after 'n' matches are found. If
``overlap`` is specified, then overlapping matches will be reported... | [
"Scan",
"the",
"input",
"string",
"for",
"expression",
"matches",
".",
"Each",
"match",
"will",
"return",
"the",
"matching",
"tokens",
"start",
"location",
"and",
"end",
"location",
".",
"May",
"be",
"called",
"with",
"optional",
"maxMatches",
"argument",
"to"... | def scanString(self, instring, maxMatches=_MAX_INT, overlap=False):
"""
Scan the input string for expression matches. Each match will return the
matching tokens, start location, and end location. May be called with optional
``maxMatches`` argument, to clip scanning after 'n' matches ar... | [
"def",
"scanString",
"(",
"self",
",",
"instring",
",",
"maxMatches",
"=",
"_MAX_INT",
",",
"overlap",
"=",
"False",
")",
":",
"if",
"not",
"self",
".",
"streamlined",
":",
"self",
".",
"streamline",
"(",
")",
"for",
"e",
"in",
"self",
".",
"ignoreExpr... | https://github.com/chadmv/cmt/blob/1b1a9a4fb154d1d10e73373cf899e4d83c95a6a1/scripts/pyparsing/core.py#L831-L901 | ||
python-cmd2/cmd2 | c1f6114d52161a3b8a32d3cee1c495d79052e1fb | cmd2/history.py | python | History._zero_based_index | (self, onebased: Union[int, str]) | return result | Convert a one-based index to a zero-based index. | Convert a one-based index to a zero-based index. | [
"Convert",
"a",
"one",
"-",
"based",
"index",
"to",
"a",
"zero",
"-",
"based",
"index",
"."
] | def _zero_based_index(self, onebased: Union[int, str]) -> int:
"""Convert a one-based index to a zero-based index."""
result = int(onebased)
if result > 0:
result -= 1
return result | [
"def",
"_zero_based_index",
"(",
"self",
",",
"onebased",
":",
"Union",
"[",
"int",
",",
"str",
"]",
")",
"->",
"int",
":",
"result",
"=",
"int",
"(",
"onebased",
")",
"if",
"result",
">",
"0",
":",
"result",
"-=",
"1",
"return",
"result"
] | https://github.com/python-cmd2/cmd2/blob/c1f6114d52161a3b8a32d3cee1c495d79052e1fb/cmd2/history.py#L148-L153 | |
owid/covid-19-data | 936aeae6cfbdc0163939ed7bd8ecdbb2582c0a92 | scripts/scripts/old/ecdc.py | python | export | (filename) | return standard_export(
load_standardized(filename),
OUTPUT_PATH,
DATASET_NAME
) | [] | def export(filename):
# locations.csv
# load merged so that we exclude any past country names that exist in
# ecdc_country_standardized but not in the current dataset
df_loc = _load_merged(filename)[['countriesAndTerritories', 'location']] \
.drop_duplicates()
df_loc = df_loc.merge(
... | [
"def",
"export",
"(",
"filename",
")",
":",
"# locations.csv",
"# load merged so that we exclude any past country names that exist in",
"# ecdc_country_standardized but not in the current dataset",
"df_loc",
"=",
"_load_merged",
"(",
"filename",
")",
"[",
"[",
"'countriesAndTerrito... | https://github.com/owid/covid-19-data/blob/936aeae6cfbdc0163939ed7bd8ecdbb2582c0a92/scripts/scripts/old/ecdc.py#L246-L266 | |||
kvesteri/validators | 29df0817d840263c371c32bd704706c6a8a36a85 | validators/ip_address.py | python | ipv6 | (value) | return False | Return whether or not given value is a valid IP version 6 address
(including IPv4-mapped IPv6 addresses).
This validator is based on `WTForms IPAddress validator`_.
.. _WTForms IPAddress validator:
https://github.com/wtforms/wtforms/blob/master/wtforms/validators.py
Examples::
>>> ipv... | Return whether or not given value is a valid IP version 6 address
(including IPv4-mapped IPv6 addresses). | [
"Return",
"whether",
"or",
"not",
"given",
"value",
"is",
"a",
"valid",
"IP",
"version",
"6",
"address",
"(",
"including",
"IPv4",
"-",
"mapped",
"IPv6",
"addresses",
")",
"."
] | def ipv6(value):
"""
Return whether or not given value is a valid IP version 6 address
(including IPv4-mapped IPv6 addresses).
This validator is based on `WTForms IPAddress validator`_.
.. _WTForms IPAddress validator:
https://github.com/wtforms/wtforms/blob/master/wtforms/validators.py
... | [
"def",
"ipv6",
"(",
"value",
")",
":",
"ipv6_groups",
"=",
"value",
".",
"split",
"(",
"':'",
")",
"if",
"len",
"(",
"ipv6_groups",
")",
"==",
"1",
":",
"return",
"False",
"ipv4_groups",
"=",
"ipv6_groups",
"[",
"-",
"1",
"]",
".",
"split",
"(",
"'... | https://github.com/kvesteri/validators/blob/29df0817d840263c371c32bd704706c6a8a36a85/validators/ip_address.py#L58-L119 | |
grnet/synnefo | d06ec8c7871092131cdaabf6b03ed0b504c93e43 | snf-common/synnefo/util/urltools.py | python | _clean_netloc | (netloc) | Remove trailing '.' and ':' and tolower | Remove trailing '.' and ':' and tolower | [
"Remove",
"trailing",
".",
"and",
":",
"and",
"tolower"
] | def _clean_netloc(netloc):
"""Remove trailing '.' and ':' and tolower
"""
try:
netloc.encode('ascii')
except:
return netloc.rstrip('.:').decode('utf-8').lower().encode('utf-8')
else:
return netloc.rstrip('.:').lower() | [
"def",
"_clean_netloc",
"(",
"netloc",
")",
":",
"try",
":",
"netloc",
".",
"encode",
"(",
"'ascii'",
")",
"except",
":",
"return",
"netloc",
".",
"rstrip",
"(",
"'.:'",
")",
".",
"decode",
"(",
"'utf-8'",
")",
".",
"lower",
"(",
")",
".",
"encode",
... | https://github.com/grnet/synnefo/blob/d06ec8c7871092131cdaabf6b03ed0b504c93e43/snf-common/synnefo/util/urltools.py#L315-L323 | ||
xavier150/Blender-For-UnrealEngine-Addons | c0294688fe65d0e8130bc4db7afd1edf5d7ba2f4 | blender-for-unrealengine/languages/__init__.py | python | Translate_Tooltips | (phrase: str) | Translate the give phrase into Blender’s current language. | Translate the give phrase into Blender’s current language. | [
"Translate",
"the",
"give",
"phrase",
"into",
"Blender’s",
"current",
"language",
"."
] | def Translate_Tooltips(phrase: str):
"""
Translate the give phrase into Blender’s current language.
"""
CheckCurrentLanguage()
if phrase in tooltips_dictionary:
return tooltips_dictionary[phrase]
else:
print("Error, in languages text ID not found: " + phrase)
return phra... | [
"def",
"Translate_Tooltips",
"(",
"phrase",
":",
"str",
")",
":",
"CheckCurrentLanguage",
"(",
")",
"if",
"phrase",
"in",
"tooltips_dictionary",
":",
"return",
"tooltips_dictionary",
"[",
"phrase",
"]",
"else",
":",
"print",
"(",
"\"Error, in languages text ID not f... | https://github.com/xavier150/Blender-For-UnrealEngine-Addons/blob/c0294688fe65d0e8130bc4db7afd1edf5d7ba2f4/blender-for-unrealengine/languages/__init__.py#L59-L69 | ||
lpty/nlp_base | e82f5a317a335b382e106307c9f047850c6da6f4 | sentiment/src/api.py | python | test_model | () | 模型测试 | 模型测试 | [
"模型测试"
] | def test_model():
"""
模型测试
"""
config = get_config()
test_file_path = config.get('test', 'test_seg_corpus_path')
model = get_model()
result = model.test(test_file_path)
print('precision:', result.precision)
print('recall:', result.recall)
print('examples:', result.nexamples) | [
"def",
"test_model",
"(",
")",
":",
"config",
"=",
"get_config",
"(",
")",
"test_file_path",
"=",
"config",
".",
"get",
"(",
"'test'",
",",
"'test_seg_corpus_path'",
")",
"model",
"=",
"get_model",
"(",
")",
"result",
"=",
"model",
".",
"test",
"(",
"tes... | https://github.com/lpty/nlp_base/blob/e82f5a317a335b382e106307c9f047850c6da6f4/sentiment/src/api.py#L34-L44 | ||
quantumlib/OpenFermion | 6187085f2a7707012b68370b625acaeed547e62b | src/openfermion/chem/molecular_data.py | python | MolecularData.fci_one_rdm | (self, value) | [] | def fci_one_rdm(self, value):
self._fci_one_rdm = value | [
"def",
"fci_one_rdm",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"_fci_one_rdm",
"=",
"value"
] | https://github.com/quantumlib/OpenFermion/blob/6187085f2a7707012b68370b625acaeed547e62b/src/openfermion/chem/molecular_data.py#L528-L529 | ||||
clovaai/assembled-cnn | 9cdc29761d828ecd3708ea13e5acc44c696ec30f | preprocessing/autoaugment.py | python | color | (image, factor) | return blend(degenerate, image, factor) | Equivalent of PIL Color. | Equivalent of PIL Color. | [
"Equivalent",
"of",
"PIL",
"Color",
"."
] | def color(image, factor):
"""Equivalent of PIL Color."""
degenerate = tf.image.grayscale_to_rgb(tf.image.rgb_to_grayscale(image))
return blend(degenerate, image, factor) | [
"def",
"color",
"(",
"image",
",",
"factor",
")",
":",
"degenerate",
"=",
"tf",
".",
"image",
".",
"grayscale_to_rgb",
"(",
"tf",
".",
"image",
".",
"rgb_to_grayscale",
"(",
"image",
")",
")",
"return",
"blend",
"(",
"degenerate",
",",
"image",
",",
"f... | https://github.com/clovaai/assembled-cnn/blob/9cdc29761d828ecd3708ea13e5acc44c696ec30f/preprocessing/autoaugment.py#L427-L430 | |
BigBrotherBot/big-brother-bot | 848823c71413c86e7f1ff9584f43e08d40a7f2c0 | b3/__init__.py | python | getB3versionString | () | return sversion | Return the B3 version as a string. | Return the B3 version as a string. | [
"Return",
"the",
"B3",
"version",
"as",
"a",
"string",
"."
] | def getB3versionString():
"""
Return the B3 version as a string.
"""
sversion = re.sub(r'\^[0-9a-z]', '', version)
if main_is_frozen():
vinfo = getB3versionInfo()
sversion = '%s [%s%s]' % (sversion, vinfo[1], vinfo[2])
return sversion | [
"def",
"getB3versionString",
"(",
")",
":",
"sversion",
"=",
"re",
".",
"sub",
"(",
"r'\\^[0-9a-z]'",
",",
"''",
",",
"version",
")",
"if",
"main_is_frozen",
"(",
")",
":",
"vinfo",
"=",
"getB3versionInfo",
"(",
")",
"sversion",
"=",
"'%s [%s%s]'",
"%",
... | https://github.com/BigBrotherBot/big-brother-bot/blob/848823c71413c86e7f1ff9584f43e08d40a7f2c0/b3/__init__.py#L189-L197 | |
mikedh/trimesh | 6b1e05616b44e6dd708d9bc748b211656ebb27ec | trimesh/path/entities.py | python | BSpline.discrete | (self, vertices, count=None, scale=1.0) | return self._orient(discrete) | Discretize the B-Spline curve.
Parameters
-------------
vertices : (n, 2) or (n, 3) float
Points in space
scale : float
Scale of overall drawings (for precision)
count : int
Number of segments to return
Returns
-------------
... | Discretize the B-Spline curve. | [
"Discretize",
"the",
"B",
"-",
"Spline",
"curve",
"."
] | def discrete(self, vertices, count=None, scale=1.0):
"""
Discretize the B-Spline curve.
Parameters
-------------
vertices : (n, 2) or (n, 3) float
Points in space
scale : float
Scale of overall drawings (for precision)
count : int
Nu... | [
"def",
"discrete",
"(",
"self",
",",
"vertices",
",",
"count",
"=",
"None",
",",
"scale",
"=",
"1.0",
")",
":",
"discrete",
"=",
"discretize_bspline",
"(",
"control",
"=",
"vertices",
"[",
"self",
".",
"points",
"]",
",",
"knots",
"=",
"self",
".",
"... | https://github.com/mikedh/trimesh/blob/6b1e05616b44e6dd708d9bc748b211656ebb27ec/trimesh/path/entities.py#L779-L802 | |
dask/dask | c2b962fec1ba45440fe928869dc64cfe9cc36506 | dask/core.py | python | find_all_possible_keys | (tasks) | return ret | Returns all possible keys in `tasks` including hashable literals.
The definition of a key in a Dask graph is any hashable object
that is not a task. This function returns all such objects in
`tasks` even if the object is in fact a literal. | Returns all possible keys in `tasks` including hashable literals. | [
"Returns",
"all",
"possible",
"keys",
"in",
"tasks",
"including",
"hashable",
"literals",
"."
] | def find_all_possible_keys(tasks) -> set:
"""Returns all possible keys in `tasks` including hashable literals.
The definition of a key in a Dask graph is any hashable object
that is not a task. This function returns all such objects in
`tasks` even if the object is in fact a literal.
"""
ret =... | [
"def",
"find_all_possible_keys",
"(",
"tasks",
")",
"->",
"set",
":",
"ret",
"=",
"set",
"(",
")",
"while",
"tasks",
":",
"work",
"=",
"[",
"]",
"for",
"w",
"in",
"tasks",
":",
"typ",
"=",
"type",
"(",
"w",
")",
"if",
"typ",
"is",
"tuple",
"and",... | https://github.com/dask/dask/blob/c2b962fec1ba45440fe928869dc64cfe9cc36506/dask/core.py#L192-L217 | |
madduck/reclass | 9c3478498a5dfa3d1e5cf7aa3b602ca3b53ee15b | reclass/errors.py | python | IncompleteInterpolationError.__init__ | (self, string, end_sentinel) | [] | def __init__(self, string, end_sentinel):
super(IncompleteInterpolationError, self).__init__(msg=None)
self._ref = string.join(PARAMETER_INTERPOLATION_SENTINELS)
self._end_sentinel = end_sentinel | [
"def",
"__init__",
"(",
"self",
",",
"string",
",",
"end_sentinel",
")",
":",
"super",
"(",
"IncompleteInterpolationError",
",",
"self",
")",
".",
"__init__",
"(",
"msg",
"=",
"None",
")",
"self",
".",
"_ref",
"=",
"string",
".",
"join",
"(",
"PARAMETER_... | https://github.com/madduck/reclass/blob/9c3478498a5dfa3d1e5cf7aa3b602ca3b53ee15b/reclass/errors.py#L149-L152 | ||||
pyscaffold/pyscaffold | ee61243caf6bbaa0a88e0af11fe50ed0d6d34ae4 | src/pyscaffold/extensions/interactive.py | python | get_config | (kind: str) | return reduce(_merge_config, list_all_extensions(), initial_value) | Get configurations that will be used for generating examples
(from both :obj:`CONFIG` and the ``interactive`` attribute of each extension).
The ``kind`` argument can assume the same values as the :obj:`CONFIG` keys.
This function is cached to improve performance. Call ``get_config.__wrapped__`` to
byp... | Get configurations that will be used for generating examples
(from both :obj:`CONFIG` and the ``interactive`` attribute of each extension). | [
"Get",
"configurations",
"that",
"will",
"be",
"used",
"for",
"generating",
"examples",
"(",
"from",
"both",
":",
"obj",
":",
"CONFIG",
"and",
"the",
"interactive",
"attribute",
"of",
"each",
"extension",
")",
"."
] | def get_config(kind: str) -> Set[str]:
"""Get configurations that will be used for generating examples
(from both :obj:`CONFIG` and the ``interactive`` attribute of each extension).
The ``kind`` argument can assume the same values as the :obj:`CONFIG` keys.
This function is cached to improve performan... | [
"def",
"get_config",
"(",
"kind",
":",
"str",
")",
"->",
"Set",
"[",
"str",
"]",
":",
"# TODO: when `python_requires >= 3.8` use Literal[\"ignore\", \"comment\"] instead of",
"# str for type annotation of kind",
"configurable",
"=",
"CONFIG",
".",
"keys",
"(",
")",
... | https://github.com/pyscaffold/pyscaffold/blob/ee61243caf6bbaa0a88e0af11fe50ed0d6d34ae4/src/pyscaffold/extensions/interactive.py#L66-L88 | |
microsoft/azure-devops-python-api | 451cade4c475482792cbe9e522c1fee32393139e | azure-devops/azure/devops/v5_1/task_agent/task_agent_client.py | python | TaskAgentClient.delete_deployment_target | (self, project, deployment_group_id, target_id) | DeleteDeploymentTarget.
[Preview API] Delete a deployment target in a deployment group. This deletes the agent from associated deployment pool too.
:param str project: Project ID or project name
:param int deployment_group_id: ID of the deployment group in which deployment target is deleted.
... | DeleteDeploymentTarget.
[Preview API] Delete a deployment target in a deployment group. This deletes the agent from associated deployment pool too.
:param str project: Project ID or project name
:param int deployment_group_id: ID of the deployment group in which deployment target is deleted.
... | [
"DeleteDeploymentTarget",
".",
"[",
"Preview",
"API",
"]",
"Delete",
"a",
"deployment",
"target",
"in",
"a",
"deployment",
"group",
".",
"This",
"deletes",
"the",
"agent",
"from",
"associated",
"deployment",
"pool",
"too",
".",
":",
"param",
"str",
"project",
... | def delete_deployment_target(self, project, deployment_group_id, target_id):
"""DeleteDeploymentTarget.
[Preview API] Delete a deployment target in a deployment group. This deletes the agent from associated deployment pool too.
:param str project: Project ID or project name
:param int de... | [
"def",
"delete_deployment_target",
"(",
"self",
",",
"project",
",",
"deployment_group_id",
",",
"target_id",
")",
":",
"route_values",
"=",
"{",
"}",
"if",
"project",
"is",
"not",
"None",
":",
"route_values",
"[",
"'project'",
"]",
"=",
"self",
".",
"_seria... | https://github.com/microsoft/azure-devops-python-api/blob/451cade4c475482792cbe9e522c1fee32393139e/azure-devops/azure/devops/v5_1/task_agent/task_agent_client.py#L629-L646 | ||
pypa/pipenv | b21baade71a86ab3ee1429f71fbc14d4f95fb75d | pipenv/vendor/requests/_internal_utils.py | python | to_native_string | (string, encoding='ascii') | return out | Given a string object, regardless of type, returns a representation of
that string in the native string type, encoding and decoding where
necessary. This assumes ASCII unless told otherwise. | Given a string object, regardless of type, returns a representation of
that string in the native string type, encoding and decoding where
necessary. This assumes ASCII unless told otherwise. | [
"Given",
"a",
"string",
"object",
"regardless",
"of",
"type",
"returns",
"a",
"representation",
"of",
"that",
"string",
"in",
"the",
"native",
"string",
"type",
"encoding",
"and",
"decoding",
"where",
"necessary",
".",
"This",
"assumes",
"ASCII",
"unless",
"to... | def to_native_string(string, encoding='ascii'):
"""Given a string object, regardless of type, returns a representation of
that string in the native string type, encoding and decoding where
necessary. This assumes ASCII unless told otherwise.
"""
if isinstance(string, builtin_str):
out = stri... | [
"def",
"to_native_string",
"(",
"string",
",",
"encoding",
"=",
"'ascii'",
")",
":",
"if",
"isinstance",
"(",
"string",
",",
"builtin_str",
")",
":",
"out",
"=",
"string",
"else",
":",
"if",
"is_py2",
":",
"out",
"=",
"string",
".",
"encode",
"(",
"enc... | https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/vendor/requests/_internal_utils.py#L14-L27 | |
leancloud/satori | 701caccbd4fe45765001ca60435c0cb499477c03 | satori-rules/plugin/libs/urllib3/connectionpool.py | python | _normalize_host | (host, scheme) | return host | Normalize hosts for comparisons and use with sockets. | Normalize hosts for comparisons and use with sockets. | [
"Normalize",
"hosts",
"for",
"comparisons",
"and",
"use",
"with",
"sockets",
"."
] | def _normalize_host(host, scheme):
"""
Normalize hosts for comparisons and use with sockets.
"""
# httplib doesn't like it when we include brackets in IPv6 addresses
# Specifically, if we include brackets but also pass the port then
# httplib crazily doubles up the square brackets on the Host h... | [
"def",
"_normalize_host",
"(",
"host",
",",
"scheme",
")",
":",
"# httplib doesn't like it when we include brackets in IPv6 addresses",
"# Specifically, if we include brackets but also pass the port then",
"# httplib crazily doubles up the square brackets on the Host header.",
"# Instead, we n... | https://github.com/leancloud/satori/blob/701caccbd4fe45765001ca60435c0cb499477c03/satori-rules/plugin/libs/urllib3/connectionpool.py#L882-L897 | |
pyansys/pymapdl | c07291fc062b359abf0e92b95a92d753a95ef3d7 | ansys/mapdl/core/_commands/preproc/materials.py | python | Materials.mpchg | (self, mat="", elem="", **kwargs) | return self.run(command, **kwargs) | APDL Command: MPCHG
Changes the material number attribute of an element.
Parameters
----------
mat
Assign this material number to the element. Material numbers are
defined with the material property commands [MP].
elem
Element for material ... | APDL Command: MPCHG | [
"APDL",
"Command",
":",
"MPCHG"
] | def mpchg(self, mat="", elem="", **kwargs):
"""APDL Command: MPCHG
Changes the material number attribute of an element.
Parameters
----------
mat
Assign this material number to the element. Material numbers are
defined with the material property command... | [
"def",
"mpchg",
"(",
"self",
",",
"mat",
"=",
"\"\"",
",",
"elem",
"=",
"\"\"",
",",
"*",
"*",
"kwargs",
")",
":",
"command",
"=",
"\"MPCHG,%s,%s\"",
"%",
"(",
"str",
"(",
"mat",
")",
",",
"str",
"(",
"elem",
")",
")",
"return",
"self",
".",
"r... | https://github.com/pyansys/pymapdl/blob/c07291fc062b359abf0e92b95a92d753a95ef3d7/ansys/mapdl/core/_commands/preproc/materials.py#L243-L270 | |
dropbox/dropbox-sdk-python | 015437429be224732990041164a21a0501235db1 | dropbox/team_log.py | python | EventType.shared_link_change_visibility | (cls, val) | return cls('shared_link_change_visibility', val) | Create an instance of this class set to the
``shared_link_change_visibility`` tag with value ``val``.
:param SharedLinkChangeVisibilityType val:
:rtype: EventType | Create an instance of this class set to the
``shared_link_change_visibility`` tag with value ``val``. | [
"Create",
"an",
"instance",
"of",
"this",
"class",
"set",
"to",
"the",
"shared_link_change_visibility",
"tag",
"with",
"value",
"val",
"."
] | def shared_link_change_visibility(cls, val):
"""
Create an instance of this class set to the
``shared_link_change_visibility`` tag with value ``val``.
:param SharedLinkChangeVisibilityType val:
:rtype: EventType
"""
return cls('shared_link_change_visibility', val... | [
"def",
"shared_link_change_visibility",
"(",
"cls",
",",
"val",
")",
":",
"return",
"cls",
"(",
"'shared_link_change_visibility'",
",",
"val",
")"
] | https://github.com/dropbox/dropbox-sdk-python/blob/015437429be224732990041164a21a0501235db1/dropbox/team_log.py#L26331-L26339 | |
numba/numba | bf480b9e0da858a65508c2b17759a72ee6a44c51 | numba/parfors/parfor.py | python | unwrap_parfor_blocks | (parfor, blocks=None) | return | unwrap parfor blocks after analysis/optimization.
Allows changes to the parfor loop. | unwrap parfor blocks after analysis/optimization.
Allows changes to the parfor loop. | [
"unwrap",
"parfor",
"blocks",
"after",
"analysis",
"/",
"optimization",
".",
"Allows",
"changes",
"to",
"the",
"parfor",
"loop",
"."
] | def unwrap_parfor_blocks(parfor, blocks=None):
"""
unwrap parfor blocks after analysis/optimization.
Allows changes to the parfor loop.
"""
if blocks is not None:
# make sure init block isn't removed
init_block_label = min(blocks.keys())
# update loop body blocks
bloc... | [
"def",
"unwrap_parfor_blocks",
"(",
"parfor",
",",
"blocks",
"=",
"None",
")",
":",
"if",
"blocks",
"is",
"not",
"None",
":",
"# make sure init block isn't removed",
"init_block_label",
"=",
"min",
"(",
"blocks",
".",
"keys",
"(",
")",
")",
"# update loop body b... | https://github.com/numba/numba/blob/bf480b9e0da858a65508c2b17759a72ee6a44c51/numba/parfors/parfor.py#L4358-L4383 | |
NVIDIA/DeepLearningExamples | 589604d49e016cd9ef4525f7abcc9c7b826cfc5e | TensorFlow/LanguageModeling/BERT/utils/create_glue_data.py | python | MrpcProcessor.get_train_examples | (self, data_dir) | return self._create_examples(
self._read_tsv(os.path.join(data_dir, "train.tsv")), "train") | See base class. | See base class. | [
"See",
"base",
"class",
"."
] | def get_train_examples(self, data_dir):
"""See base class."""
return self._create_examples(
self._read_tsv(os.path.join(data_dir, "train.tsv")), "train") | [
"def",
"get_train_examples",
"(",
"self",
",",
"data_dir",
")",
":",
"return",
"self",
".",
"_create_examples",
"(",
"self",
".",
"_read_tsv",
"(",
"os",
".",
"path",
".",
"join",
"(",
"data_dir",
",",
"\"train.tsv\"",
")",
")",
",",
"\"train\"",
")"
] | https://github.com/NVIDIA/DeepLearningExamples/blob/589604d49e016cd9ef4525f7abcc9c7b826cfc5e/TensorFlow/LanguageModeling/BERT/utils/create_glue_data.py#L238-L241 | |
s-leger/archipack | 5a6243bf1edf08a6b429661ce291dacb551e5f8a | pygeos/planargraph.py | python | PlanarGraph.getNodes | (self, nodes) | * Returns the Nodes in this PlanarGraph.
*
* @param nodes : the nodes are push_back'ed here | * Returns the Nodes in this PlanarGraph.
*
* | [
"*",
"Returns",
"the",
"Nodes",
"in",
"this",
"PlanarGraph",
".",
"*",
"*"
] | def getNodes(self, nodes):
"""
* Returns the Nodes in this PlanarGraph.
*
* @param nodes : the nodes are push_back'ed here
"""
self._nodeMap.getNodes(nodes) | [
"def",
"getNodes",
"(",
"self",
",",
"nodes",
")",
":",
"self",
".",
"_nodeMap",
".",
"getNodes",
"(",
"nodes",
")"
] | https://github.com/s-leger/archipack/blob/5a6243bf1edf08a6b429661ce291dacb551e5f8a/pygeos/planargraph.py#L179-L185 | ||
mesalock-linux/mesapy | ed546d59a21b36feb93e2309d5c6b75aa0ad95c9 | lib-python/2.7/lib2to3/fixer_util.py | python | does_tree_import | (package, name, node) | return bool(binding) | Returns true if name is imported from package at the
top level of the tree which node belongs to.
To cover the case of an import like 'import foo', use
None for the package and 'foo' for the name. | Returns true if name is imported from package at the
top level of the tree which node belongs to.
To cover the case of an import like 'import foo', use
None for the package and 'foo' for the name. | [
"Returns",
"true",
"if",
"name",
"is",
"imported",
"from",
"package",
"at",
"the",
"top",
"level",
"of",
"the",
"tree",
"which",
"node",
"belongs",
"to",
".",
"To",
"cover",
"the",
"case",
"of",
"an",
"import",
"like",
"import",
"foo",
"use",
"None",
"... | def does_tree_import(package, name, node):
""" Returns true if name is imported from package at the
top level of the tree which node belongs to.
To cover the case of an import like 'import foo', use
None for the package and 'foo' for the name. """
binding = find_binding(name, find_root(n... | [
"def",
"does_tree_import",
"(",
"package",
",",
"name",
",",
"node",
")",
":",
"binding",
"=",
"find_binding",
"(",
"name",
",",
"find_root",
"(",
"node",
")",
",",
"package",
")",
"return",
"bool",
"(",
"binding",
")"
] | https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/lib-python/2.7/lib2to3/fixer_util.py#L282-L288 | |
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/ipaddress.py | python | _IPAddressBase._ip_int_from_prefix | (cls, prefixlen) | return cls._ALL_ONES ^ (cls._ALL_ONES >> prefixlen) | Turn the prefix length into a bitwise netmask
Args:
prefixlen: An integer, the prefix length.
Returns:
An integer. | Turn the prefix length into a bitwise netmask | [
"Turn",
"the",
"prefix",
"length",
"into",
"a",
"bitwise",
"netmask"
] | def _ip_int_from_prefix(cls, prefixlen):
"""Turn the prefix length into a bitwise netmask
Args:
prefixlen: An integer, the prefix length.
Returns:
An integer.
"""
return cls._ALL_ONES ^ (cls._ALL_ONES >> prefixlen) | [
"def",
"_ip_int_from_prefix",
"(",
"cls",
",",
"prefixlen",
")",
":",
"return",
"cls",
".",
"_ALL_ONES",
"^",
"(",
"cls",
".",
"_ALL_ONES",
">>",
"prefixlen",
")"
] | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/ipaddress.py#L556-L566 | |
JaniceWuo/MovieRecommend | 4c86db64ca45598917d304f535413df3bc9fea65 | movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/index.py | python | Link.__hash__ | (self) | return hash(self.url) | [] | def __hash__(self):
return hash(self.url) | [
"def",
"__hash__",
"(",
"self",
")",
":",
"return",
"hash",
"(",
"self",
".",
"url",
")"
] | https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/index.py#L947-L948 | |||
thearn/Python-Arduino-Command-API | 610171b3ae153542aca42d354fbb26c32027f38f | Arduino/arduino.py | python | EEPROM.read | (self, adrress) | Reads a byte from the EEPROM.
:address: the location to write to, starting from 0 (int) | Reads a byte from the EEPROM.
:address: the location to write to, starting from 0 (int) | [
"Reads",
"a",
"byte",
"from",
"the",
"EEPROM",
".",
":",
"address",
":",
"the",
"location",
"to",
"write",
"to",
"starting",
"from",
"0",
"(",
"int",
")"
] | def read(self, adrress):
""" Reads a byte from the EEPROM.
:address: the location to write to, starting from 0 (int)
"""
cmd_str = build_cmd_str("eer", (adrress,))
try:
self.sr.write(cmd_str)
self.sr.flush()
response = self... | [
"def",
"read",
"(",
"self",
",",
"adrress",
")",
":",
"cmd_str",
"=",
"build_cmd_str",
"(",
"\"eer\"",
",",
"(",
"adrress",
",",
")",
")",
"try",
":",
"self",
".",
"sr",
".",
"write",
"(",
"cmd_str",
")",
"self",
".",
"sr",
".",
"flush",
"(",
")"... | https://github.com/thearn/Python-Arduino-Command-API/blob/610171b3ae153542aca42d354fbb26c32027f38f/Arduino/arduino.py#L603-L616 | ||
stanford-futuredata/noscope | 6c6aa72e09280530dfdcf87871c1ac43df3b6cc3 | example/noscope_optimizer.py | python | runtime_estimator | (params, TARGET_CNN_FALSE_NEGATIVE_RATE) | return params | [] | def runtime_estimator(params, TARGET_CNN_FALSE_NEGATIVE_RATE):
# cost of various components of pipeline
COST_CONST = 1
COST_DIFF = 10
COST_CNN = 400
COST_YOLO = 60000
runtime_cost = 0
runtime_cost += COST_CONST * params['num_windows']
runtime_cost += COST_DIFF * params['num_diff_evals'... | [
"def",
"runtime_estimator",
"(",
"params",
",",
"TARGET_CNN_FALSE_NEGATIVE_RATE",
")",
":",
"# cost of various components of pipeline",
"COST_CONST",
"=",
"1",
"COST_DIFF",
"=",
"10",
"COST_CNN",
"=",
"400",
"COST_YOLO",
"=",
"60000",
"runtime_cost",
"=",
"0",
"runtim... | https://github.com/stanford-futuredata/noscope/blob/6c6aa72e09280530dfdcf87871c1ac43df3b6cc3/example/noscope_optimizer.py#L103-L126 | |||
pwnieexpress/pwn_plug_sources | 1a23324f5dc2c3de20f9c810269b6a29b2758cad | src/set/src/core/scapy.py | python | IntEnumField.__init__ | (self, name, default, enum) | [] | def __init__(self, name, default, enum):
EnumField.__init__(self, name, default, enum, "I") | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"default",
",",
"enum",
")",
":",
"EnumField",
".",
"__init__",
"(",
"self",
",",
"name",
",",
"default",
",",
"enum",
",",
"\"I\"",
")"
] | https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/set/src/core/scapy.py#L4321-L4322 | ||||
anyant/rssant | effeb5b01fd6ae8e53516ad919a8275ef47ccbcc | rssant_feedlib/importer.py | python | _normalize_url | (url) | return str(yarl.URL(url).with_fragment(None)) | >>> _normalize_url('https://blog.guyskk.com/blog/1#title')
'https://blog.guyskk.com/blog/1'
>>> _normalize_url('HTTPS://t.cn/123ABC?q=1')
'https://t.cn/123ABC?q=1' | >>> _normalize_url('https://blog.guyskk.com/blog/1#title')
'https://blog.guyskk.com/blog/1'
>>> _normalize_url('HTTPS://t.cn/123ABC?q=1')
'https://t.cn/123ABC?q=1' | [
">>>",
"_normalize_url",
"(",
"https",
":",
"//",
"blog",
".",
"guyskk",
".",
"com",
"/",
"blog",
"/",
"1#title",
")",
"https",
":",
"//",
"blog",
".",
"guyskk",
".",
"com",
"/",
"blog",
"/",
"1",
">>>",
"_normalize_url",
"(",
"HTTPS",
":",
"//",
"... | def _normalize_url(url):
"""
>>> _normalize_url('https://blog.guyskk.com/blog/1#title')
'https://blog.guyskk.com/blog/1'
>>> _normalize_url('HTTPS://t.cn/123ABC?q=1')
'https://t.cn/123ABC?q=1'
"""
return str(yarl.URL(url).with_fragment(None)) | [
"def",
"_normalize_url",
"(",
"url",
")",
":",
"return",
"str",
"(",
"yarl",
".",
"URL",
"(",
"url",
")",
".",
"with_fragment",
"(",
"None",
")",
")"
] | https://github.com/anyant/rssant/blob/effeb5b01fd6ae8e53516ad919a8275ef47ccbcc/rssant_feedlib/importer.py#L153-L160 | |
punchagan/cinspect | 23834b9d02511a88cba8ca0aa1397eef927822c3 | cinspect/vendor/clang/cindex.py | python | Index.create | (excludeDecls=False) | return Index(conf.lib.clang_createIndex(excludeDecls, 0)) | Create a new Index.
Parameters:
excludeDecls -- Exclude local declarations from translation units. | Create a new Index.
Parameters:
excludeDecls -- Exclude local declarations from translation units. | [
"Create",
"a",
"new",
"Index",
".",
"Parameters",
":",
"excludeDecls",
"--",
"Exclude",
"local",
"declarations",
"from",
"translation",
"units",
"."
] | def create(excludeDecls=False):
"""
Create a new Index.
Parameters:
excludeDecls -- Exclude local declarations from translation units.
"""
return Index(conf.lib.clang_createIndex(excludeDecls, 0)) | [
"def",
"create",
"(",
"excludeDecls",
"=",
"False",
")",
":",
"return",
"Index",
"(",
"conf",
".",
"lib",
".",
"clang_createIndex",
"(",
"excludeDecls",
",",
"0",
")",
")"
] | https://github.com/punchagan/cinspect/blob/23834b9d02511a88cba8ca0aa1397eef927822c3/cinspect/vendor/clang/cindex.py#L2113-L2119 | |
duerrp/pyexperiment | c426565d870d944bd5b9712629d8f1ba2527c67f | pyexperiment/utils/persistent_memoize.py | python | PersistentCache.__getitem__ | (self, key) | return state[self.key][key] | Get cache entry | Get cache entry | [
"Get",
"cache",
"entry"
] | def __getitem__(self, key):
"""Get cache entry
"""
return state[self.key][key] | [
"def",
"__getitem__",
"(",
"self",
",",
"key",
")",
":",
"return",
"state",
"[",
"self",
".",
"key",
"]",
"[",
"key",
"]"
] | https://github.com/duerrp/pyexperiment/blob/c426565d870d944bd5b9712629d8f1ba2527c67f/pyexperiment/utils/persistent_memoize.py#L33-L36 | |
django/django | 0a17666045de6739ae1c2ac695041823d5f827f7 | django/utils/module_loading.py | python | module_dir | (module) | Find the name of the directory that contains a module, if possible.
Raise ValueError otherwise, e.g. for namespace packages that are split
over several directories. | Find the name of the directory that contains a module, if possible. | [
"Find",
"the",
"name",
"of",
"the",
"directory",
"that",
"contains",
"a",
"module",
"if",
"possible",
"."
] | def module_dir(module):
"""
Find the name of the directory that contains a module, if possible.
Raise ValueError otherwise, e.g. for namespace packages that are split
over several directories.
"""
# Convert to list because __path__ may not support indexing.
paths = list(getattr(module, '__p... | [
"def",
"module_dir",
"(",
"module",
")",
":",
"# Convert to list because __path__ may not support indexing.",
"paths",
"=",
"list",
"(",
"getattr",
"(",
"module",
",",
"'__path__'",
",",
"[",
"]",
")",
")",
"if",
"len",
"(",
"paths",
")",
"==",
"1",
":",
"re... | https://github.com/django/django/blob/0a17666045de6739ae1c2ac695041823d5f827f7/django/utils/module_loading.py#L91-L106 | ||
chainer/chainerrl | 7eed375614b46a986f0adfedcc8c61b5063e1d3e | chainerrl/functions/mellowmax.py | python | maximum_entropy_mellowmax | (values, omega=1., beta_min=-10, beta_max=10) | return F.softmax(xp.expand_dims(xp.asarray(batch_beta), 1) * values) | Maximum entropy mellowmax policy function.
This function provides a categorical distribution whose expectation matches
the one of mellowmax function while maximizing its entropy.
See: http://arxiv.org/abs/1612.05628
Args:
values (Variable or ndarray):
Input values. Mellowmax is ta... | Maximum entropy mellowmax policy function. | [
"Maximum",
"entropy",
"mellowmax",
"policy",
"function",
"."
] | def maximum_entropy_mellowmax(values, omega=1., beta_min=-10, beta_max=10):
"""Maximum entropy mellowmax policy function.
This function provides a categorical distribution whose expectation matches
the one of mellowmax function while maximizing its entropy.
See: http://arxiv.org/abs/1612.05628
Ar... | [
"def",
"maximum_entropy_mellowmax",
"(",
"values",
",",
"omega",
"=",
"1.",
",",
"beta_min",
"=",
"-",
"10",
",",
"beta_max",
"=",
"10",
")",
":",
"xp",
"=",
"chainer",
".",
"cuda",
".",
"get_array_module",
"(",
"values",
")",
"mm",
"=",
"mellowmax",
"... | https://github.com/chainer/chainerrl/blob/7eed375614b46a986f0adfedcc8c61b5063e1d3e/chainerrl/functions/mellowmax.py#L29-L72 | |
incuna/django-wkhtmltopdf | 5ef1775098ff753fa84a1417f6de327d8ae01353 | wkhtmltopdf/views.py | python | PDFTemplateResponse.rendered_content | (self) | return render_pdf_from_template(
self.resolve_template(self.template_name),
self.resolve_template(self.header_template),
self.resolve_template(self.footer_template),
context=self.resolve_context(self.context_data),
request=self._request,
cmd_option... | Returns the freshly rendered content for the template and context
described by the PDFResponse.
This *does not* set the final content of the response. To set the
response content, you must either call render(), or set the
content explicitly using the value of this property. | Returns the freshly rendered content for the template and context
described by the PDFResponse. | [
"Returns",
"the",
"freshly",
"rendered",
"content",
"for",
"the",
"template",
"and",
"context",
"described",
"by",
"the",
"PDFResponse",
"."
] | def rendered_content(self):
"""Returns the freshly rendered content for the template and context
described by the PDFResponse.
This *does not* set the final content of the response. To set the
response content, you must either call render(), or set the
content explicitly using t... | [
"def",
"rendered_content",
"(",
"self",
")",
":",
"cmd_options",
"=",
"self",
".",
"cmd_options",
".",
"copy",
"(",
")",
"return",
"render_pdf_from_template",
"(",
"self",
".",
"resolve_template",
"(",
"self",
".",
"template_name",
")",
",",
"self",
".",
"re... | https://github.com/incuna/django-wkhtmltopdf/blob/5ef1775098ff753fa84a1417f6de327d8ae01353/wkhtmltopdf/views.py#L64-L82 | |
google/coursebuilder-core | 08f809db3226d9269e30d5edd0edd33bd22041f4 | coursebuilder/common/safe_dom.py | python | Element.sanitized | (self) | return buff | Santize the element and its descendants. | Santize the element and its descendants. | [
"Santize",
"the",
"element",
"and",
"its",
"descendants",
"."
] | def sanitized(self):
"""Santize the element and its descendants."""
assert Element._ALLOWED_NAME_PATTERN.match(self._tag_name), (
'tag name %s is not allowed' % self._tag_name)
buff = '<' + self._tag_name
for attr_name, value in sorted(self._attr.items()):
if attr... | [
"def",
"sanitized",
"(",
"self",
")",
":",
"assert",
"Element",
".",
"_ALLOWED_NAME_PATTERN",
".",
"match",
"(",
"self",
".",
"_tag_name",
")",
",",
"(",
"'tag name %s is not allowed'",
"%",
"self",
".",
"_tag_name",
")",
"buff",
"=",
"'<'",
"+",
"self",
"... | https://github.com/google/coursebuilder-core/blob/08f809db3226d9269e30d5edd0edd33bd22041f4/coursebuilder/common/safe_dom.py#L218-L243 | |
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/trunking/v1/trunk/phone_number.py | python | PhoneNumberContext.fetch | (self) | return PhoneNumberInstance(
self._version,
payload,
trunk_sid=self._solution['trunk_sid'],
sid=self._solution['sid'],
) | Fetch the PhoneNumberInstance
:returns: The fetched PhoneNumberInstance
:rtype: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberInstance | Fetch the PhoneNumberInstance | [
"Fetch",
"the",
"PhoneNumberInstance"
] | def fetch(self):
"""
Fetch the PhoneNumberInstance
:returns: The fetched PhoneNumberInstance
:rtype: twilio.rest.trunking.v1.trunk.phone_number.PhoneNumberInstance
"""
payload = self._version.fetch(method='GET', uri=self._uri, )
return PhoneNumberInstance(
... | [
"def",
"fetch",
"(",
"self",
")",
":",
"payload",
"=",
"self",
".",
"_version",
".",
"fetch",
"(",
"method",
"=",
"'GET'",
",",
"uri",
"=",
"self",
".",
"_uri",
",",
")",
"return",
"PhoneNumberInstance",
"(",
"self",
".",
"_version",
",",
"payload",
... | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/trunking/v1/trunk/phone_number.py#L217-L231 | |
phonopy/phonopy | 816586d0ba8177482ecf40e52f20cbdee2260d51 | phonopy/cui/phonopy_script.py | python | print_settings | (
settings, phonon, is_primitive_axes_auto, unitcell_filename, load_phonopy_yaml
) | Show setting info. | Show setting info. | [
"Show",
"setting",
"info",
"."
] | def print_settings(
settings, phonon, is_primitive_axes_auto, unitcell_filename, load_phonopy_yaml
):
"""Show setting info."""
primitive_matrix = phonon.primitive_matrix
supercell_matrix = phonon.supercell_matrix
interface_mode = phonon.calculator
run_mode = settings.run_mode
if interface_mo... | [
"def",
"print_settings",
"(",
"settings",
",",
"phonon",
",",
"is_primitive_axes_auto",
",",
"unitcell_filename",
",",
"load_phonopy_yaml",
")",
":",
"primitive_matrix",
"=",
"phonon",
".",
"primitive_matrix",
"supercell_matrix",
"=",
"phonon",
".",
"supercell_matrix",
... | https://github.com/phonopy/phonopy/blob/816586d0ba8177482ecf40e52f20cbdee2260d51/phonopy/cui/phonopy_script.py#L260-L396 | ||
mandiant/ioc_writer | 712247f3a10bdc2584fa18ac909fc763f71df21a | ioc_writer/ioc_api.py | python | IOC.open_ioc | (fn) | return root, metadata_node, top_level_indicator, parameters_node | Opens an IOC file, or XML string. Returns the root element, top level
indicator element, and parameters element. If the IOC or string fails
to parse, an IOCParseError is raised.
This is a helper function used by __init__.
:param fn: This is a path to a file to open, or a string conta... | Opens an IOC file, or XML string. Returns the root element, top level
indicator element, and parameters element. If the IOC or string fails
to parse, an IOCParseError is raised. | [
"Opens",
"an",
"IOC",
"file",
"or",
"XML",
"string",
".",
"Returns",
"the",
"root",
"element",
"top",
"level",
"indicator",
"element",
"and",
"parameters",
"element",
".",
"If",
"the",
"IOC",
"or",
"string",
"fails",
"to",
"parse",
"an",
"IOCParseError",
"... | def open_ioc(fn):
"""
Opens an IOC file, or XML string. Returns the root element, top level
indicator element, and parameters element. If the IOC or string fails
to parse, an IOCParseError is raised.
This is a helper function used by __init__.
:param fn: This is a pat... | [
"def",
"open_ioc",
"(",
"fn",
")",
":",
"parsed_xml",
"=",
"xmlutils",
".",
"read_xml_no_ns",
"(",
"fn",
")",
"if",
"not",
"parsed_xml",
":",
"raise",
"IOCParseError",
"(",
"'Error occured parsing XML'",
")",
"root",
"=",
"parsed_xml",
".",
"getroot",
"(",
"... | https://github.com/mandiant/ioc_writer/blob/712247f3a10bdc2584fa18ac909fc763f71df21a/ioc_writer/ioc_api.py#L108-L135 | |
qibinlou/SinaWeibo-Emotion-Classification | f336fc104abd68b0ec4180fe2ed80fafe49cb790 | nltk/inference/api.py | python | ProverCommand.prove | (self, verbose=False) | Perform the actual proof. | Perform the actual proof. | [
"Perform",
"the",
"actual",
"proof",
"."
] | def prove(self, verbose=False):
"""
Perform the actual proof.
"""
raise NotImplementedError() | [
"def",
"prove",
"(",
"self",
",",
"verbose",
"=",
"False",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/qibinlou/SinaWeibo-Emotion-Classification/blob/f336fc104abd68b0ec4180fe2ed80fafe49cb790/nltk/inference/api.py#L121-L125 | ||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | bin/x86/Debug/scripting_engine/Lib/mailbox.py | python | MH.lock | (self) | Lock the mailbox. | Lock the mailbox. | [
"Lock",
"the",
"mailbox",
"."
] | def lock(self):
"""Lock the mailbox."""
if not self._locked:
self._file = open(os.path.join(self._path, '.mh_sequences'), 'rb+')
_lock_file(self._file)
self._locked = True | [
"def",
"lock",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_locked",
":",
"self",
".",
"_file",
"=",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"_path",
",",
"'.mh_sequences'",
")",
",",
"'rb+'",
")",
"_lock_file",
"(",
... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/bin/x86/Debug/scripting_engine/Lib/mailbox.py#L1018-L1023 | ||
007gzs/dingtalk-sdk | 7979da2e259fdbc571728cae2425a04dbc65850a | dingtalk/client/api/taobao.py | python | TbDMP.taobao_dmp_crowd_name_get | (
self,
crowd_name=''
) | return self._top_request(
"taobao.dmp.crowd.name.get",
{
"crowd_name": crowd_name
},
result_processor=lambda x: x["crowd"]
) | 根据人群名称获取人群
!!!该接口已在官方文档下线,请谨慎使用!!!
文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=24183
:param crowd_name: 人群名称 | 根据人群名称获取人群
!!!该接口已在官方文档下线,请谨慎使用!!! | [
"根据人群名称获取人群",
"!!!该接口已在官方文档下线,请谨慎使用!!!"
] | def taobao_dmp_crowd_name_get(
self,
crowd_name=''
):
"""
根据人群名称获取人群
!!!该接口已在官方文档下线,请谨慎使用!!!
文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=24183
:param crowd_name: 人群名称
"""
return self._top_request(
"taobao.dmp.cro... | [
"def",
"taobao_dmp_crowd_name_get",
"(",
"self",
",",
"crowd_name",
"=",
"''",
")",
":",
"return",
"self",
".",
"_top_request",
"(",
"\"taobao.dmp.crowd.name.get\"",
",",
"{",
"\"crowd_name\"",
":",
"crowd_name",
"}",
",",
"result_processor",
"=",
"lambda",
"x",
... | https://github.com/007gzs/dingtalk-sdk/blob/7979da2e259fdbc571728cae2425a04dbc65850a/dingtalk/client/api/taobao.py#L45136-L45154 | |
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/tkinter/tix.py | python | HList.delete_all | (self) | [] | def delete_all(self):
self.tk.call(self._w, 'delete', 'all') | [
"def",
"delete_all",
"(",
"self",
")",
":",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"'delete'",
",",
"'all'",
")"
] | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/tkinter/tix.py#L888-L889 | ||||
MalloyDelacroix/DownloaderForReddit | e2547a6d1f119b31642445e64cb21f4568ce4012 | DownloaderForReddit/core/reddit_object_creator.py | python | RedditObjectCreator.create_subreddit | (self, sub_name, list_defaults) | See create_user above. | See create_user above. | [
"See",
"create_user",
"above",
"."
] | def create_subreddit(self, sub_name, list_defaults):
"""See create_user above."""
with self.db.get_scoped_session() as session:
subreddit = session.query(Subreddit).filter(func.lower(Subreddit.name) == sub_name.lower()).first()
if subreddit is None:
validation_set... | [
"def",
"create_subreddit",
"(",
"self",
",",
"sub_name",
",",
"list_defaults",
")",
":",
"with",
"self",
".",
"db",
".",
"get_scoped_session",
"(",
")",
"as",
"session",
":",
"subreddit",
"=",
"session",
".",
"query",
"(",
"Subreddit",
")",
".",
"filter",
... | https://github.com/MalloyDelacroix/DownloaderForReddit/blob/e2547a6d1f119b31642445e64cb21f4568ce4012/DownloaderForReddit/core/reddit_object_creator.py#L60-L75 | ||
cogeotiff/rio-tiler | d045ac953238a4246de3cab0361cd1755dab0e90 | rio_tiler/utils.py | python | linear_rescale | (
image: numpy.ndarray,
in_range: IntervalTuple,
out_range: IntervalTuple = (0, 255),
) | return image * (omax - omin) + omin | Apply linear rescaling to a numpy array.
Args:
image (numpy.ndarray): array to rescale.
in_range (tuple): array min/max value to rescale from.
out_range (tuple, optional): output min/max bounds to rescale to. Defaults to `(0, 255)`.
Returns:
numpy.ndarray: linear rescaled array... | Apply linear rescaling to a numpy array. | [
"Apply",
"linear",
"rescaling",
"to",
"a",
"numpy",
"array",
"."
] | def linear_rescale(
image: numpy.ndarray,
in_range: IntervalTuple,
out_range: IntervalTuple = (0, 255),
) -> numpy.ndarray:
"""Apply linear rescaling to a numpy array.
Args:
image (numpy.ndarray): array to rescale.
in_range (tuple): array min/max value to rescale from.
out_r... | [
"def",
"linear_rescale",
"(",
"image",
":",
"numpy",
".",
"ndarray",
",",
"in_range",
":",
"IntervalTuple",
",",
"out_range",
":",
"IntervalTuple",
"=",
"(",
"0",
",",
"255",
")",
",",
")",
"->",
"numpy",
".",
"ndarray",
":",
"imin",
",",
"imax",
"=",
... | https://github.com/cogeotiff/rio-tiler/blob/d045ac953238a4246de3cab0361cd1755dab0e90/rio_tiler/utils.py#L341-L361 | |
TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials | 5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e | tensorflow_dl_models/research/lm_1b/data_utils.py | python | get_batch | (generator, batch_size, num_steps, max_word_length, pad=False) | Read batches of input. | Read batches of input. | [
"Read",
"batches",
"of",
"input",
"."
] | def get_batch(generator, batch_size, num_steps, max_word_length, pad=False):
"""Read batches of input."""
cur_stream = [None] * batch_size
inputs = np.zeros([batch_size, num_steps], np.int32)
char_inputs = np.zeros([batch_size, num_steps, max_word_length], np.int32)
global_word_ids = np.zeros([batch_size, nu... | [
"def",
"get_batch",
"(",
"generator",
",",
"batch_size",
",",
"num_steps",
",",
"max_word_length",
",",
"pad",
"=",
"False",
")",
":",
"cur_stream",
"=",
"[",
"None",
"]",
"*",
"batch_size",
"inputs",
"=",
"np",
".",
"zeros",
"(",
"[",
"batch_size",
",",... | https://github.com/TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials/blob/5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e/tensorflow_dl_models/research/lm_1b/data_utils.py#L164-L214 | ||
neozhaoliang/pywonderland | 4fc110ba2e7db7db0a0d89369f02c479282239db | src/gifmaze/gifmaze/gifmaze.py | python | GIFSurface._gif_header | (self) | return screen + self.palette + loop | Get the `logical screen descriptor`, `global color table` and `loop
control block`. | Get the `logical screen descriptor`, `global color table` and `loop
control block`. | [
"Get",
"the",
"logical",
"screen",
"descriptor",
"global",
"color",
"table",
"and",
"loop",
"control",
"block",
"."
] | def _gif_header(self):
"""
Get the `logical screen descriptor`, `global color table` and `loop
control block`.
"""
if self.palette is None:
raise ValueError("Missing global color table.")
color_depth = (len(self.palette) // 3).bit_length() - 1
screen ... | [
"def",
"_gif_header",
"(",
"self",
")",
":",
"if",
"self",
".",
"palette",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Missing global color table.\"",
")",
"color_depth",
"=",
"(",
"len",
"(",
"self",
".",
"palette",
")",
"//",
"3",
")",
".",
"bit_... | https://github.com/neozhaoliang/pywonderland/blob/4fc110ba2e7db7db0a0d89369f02c479282239db/src/gifmaze/gifmaze/gifmaze.py#L250-L261 | |
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/trusthub/v1/end_user.py | python | EndUserInstance.__repr__ | (self) | return '<Twilio.Trusthub.V1.EndUserInstance {}>'.format(context) | Provide a friendly representation
:returns: Machine friendly representation
:rtype: str | Provide a friendly representation | [
"Provide",
"a",
"friendly",
"representation"
] | def __repr__(self):
"""
Provide a friendly representation
:returns: Machine friendly representation
:rtype: str
"""
context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items())
return '<Twilio.Trusthub.V1.EndUserInstance {}>'.format(context) | [
"def",
"__repr__",
"(",
"self",
")",
":",
"context",
"=",
"' '",
".",
"join",
"(",
"'{}={}'",
".",
"format",
"(",
"k",
",",
"v",
")",
"for",
"k",
",",
"v",
"in",
"self",
".",
"_solution",
".",
"items",
"(",
")",
")",
"return",
"'<Twilio.Trusthub.V1... | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/trusthub/v1/end_user.py#L402-L410 | |
intel/virtual-storage-manager | 00706ab9701acbd0d5e04b19cc80c6b66a2973b8 | source/python-vsmclient/vsmclient/utils.py | python | arg | (*args, **kwargs) | return _decorator | Decorator for CLI args. | Decorator for CLI args. | [
"Decorator",
"for",
"CLI",
"args",
"."
] | def arg(*args, **kwargs):
"""Decorator for CLI args."""
def _decorator(func):
add_arg(func, *args, **kwargs)
return func
return _decorator | [
"def",
"arg",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"_decorator",
"(",
"func",
")",
":",
"add_arg",
"(",
"func",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"func",
"return",
"_decorator"
] | https://github.com/intel/virtual-storage-manager/blob/00706ab9701acbd0d5e04b19cc80c6b66a2973b8/source/python-vsmclient/vsmclient/utils.py#L28-L33 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.