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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Pagure/pagure | 512f23f5cd1f965276969747792edeb1215cba68 | pagure/lib/git.py | python | rebase_pull_request | (session, request, username) | return "Pull-request rebased" | Rebase the specified pull-request.
Args:
session (sqlalchemy): the session to connect to the database with
request (pagure.lib.model.PullRequest): the database object
corresponding to the pull-request to rebase
username (string): the name of the user asking for the pull-request
... | Rebase the specified pull-request. | [
"Rebase",
"the",
"specified",
"pull",
"-",
"request",
"."
] | def rebase_pull_request(session, request, username):
"""Rebase the specified pull-request.
Args:
session (sqlalchemy): the session to connect to the database with
request (pagure.lib.model.PullRequest): the database object
corresponding to the pull-request to rebase
username... | [
"def",
"rebase_pull_request",
"(",
"session",
",",
"request",
",",
"username",
")",
":",
"_log",
".",
"info",
"(",
"\"%s asked to rebase the pull-request: %s\"",
",",
"username",
",",
"request",
")",
"user",
"=",
"pagure",
".",
"lib",
".",
"query",
".",
"get_u... | https://github.com/Pagure/pagure/blob/512f23f5cd1f965276969747792edeb1215cba68/pagure/lib/git.py#L1950-L2086 | |
JacquesLucke/animation_nodes | b1e3ace8dcb0a771fd882fc3ac4e490b009fa0d1 | animation_nodes/nodes/action/action_viewer.py | python | FrameRangeRectangle.__init__ | (self, x1, y1, x2, y2, startFrame, endFrame) | [] | def __init__(self, x1, y1, x2, y2, startFrame, endFrame):
assert startFrame <= endFrame
super().__init__(x1, y1, x2, y2)
self.startFrame = startFrame
self.endFrame = endFrame | [
"def",
"__init__",
"(",
"self",
",",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
",",
"startFrame",
",",
"endFrame",
")",
":",
"assert",
"startFrame",
"<=",
"endFrame",
"super",
"(",
")",
".",
"__init__",
"(",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
")... | https://github.com/JacquesLucke/animation_nodes/blob/b1e3ace8dcb0a771fd882fc3ac4e490b009fa0d1/animation_nodes/nodes/action/action_viewer.py#L50-L54 | ||||
KhronosGroup/NNEF-Tools | c913758ca687dab8cb7b49e8f1556819a2d0ca25 | nnef_tools/io/tf/lite/flatbuffers/ExpOptions.py | python | ExpOptions.GetRootAsExpOptions | (cls, buf, offset) | return x | [] | def GetRootAsExpOptions(cls, buf, offset):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = ExpOptions()
x.Init(buf, n + offset)
return x | [
"def",
"GetRootAsExpOptions",
"(",
"cls",
",",
"buf",
",",
"offset",
")",
":",
"n",
"=",
"flatbuffers",
".",
"encode",
".",
"Get",
"(",
"flatbuffers",
".",
"packer",
".",
"uoffset",
",",
"buf",
",",
"offset",
")",
"x",
"=",
"ExpOptions",
"(",
")",
"x... | https://github.com/KhronosGroup/NNEF-Tools/blob/c913758ca687dab8cb7b49e8f1556819a2d0ca25/nnef_tools/io/tf/lite/flatbuffers/ExpOptions.py#L13-L17 | |||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/live/v20180801/live_client.py | python | LiveClient.DescribeLiveSnapshotTemplate | (self, request) | 获取单个截图模板。
:param request: Request instance for DescribeLiveSnapshotTemplate.
:type request: :class:`tencentcloud.live.v20180801.models.DescribeLiveSnapshotTemplateRequest`
:rtype: :class:`tencentcloud.live.v20180801.models.DescribeLiveSnapshotTemplateResponse` | 获取单个截图模板。 | [
"获取单个截图模板。"
] | def DescribeLiveSnapshotTemplate(self, request):
"""获取单个截图模板。
:param request: Request instance for DescribeLiveSnapshotTemplate.
:type request: :class:`tencentcloud.live.v20180801.models.DescribeLiveSnapshotTemplateRequest`
:rtype: :class:`tencentcloud.live.v20180801.models.DescribeLive... | [
"def",
"DescribeLiveSnapshotTemplate",
"(",
"self",
",",
"request",
")",
":",
"try",
":",
"params",
"=",
"request",
".",
"_serialize",
"(",
")",
"body",
"=",
"self",
".",
"call",
"(",
"\"DescribeLiveSnapshotTemplate\"",
",",
"params",
")",
"response",
"=",
"... | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/live/v20180801/live_client.py#L1882-L1907 | ||
pandas-dev/pandas | 5ba7d714014ae8feaccc0dd4a98890828cf2832d | pandas/io/parsers/readers.py | python | validate_integer | (name, val, min_val=0) | return val | Checks whether the 'name' parameter for parsing is either
an integer OR float that can SAFELY be cast to an integer
without losing accuracy. Raises a ValueError if that is
not the case.
Parameters
----------
name : str
Parameter name (used for error reporting)
val : int or float
... | Checks whether the 'name' parameter for parsing is either
an integer OR float that can SAFELY be cast to an integer
without losing accuracy. Raises a ValueError if that is
not the case. | [
"Checks",
"whether",
"the",
"name",
"parameter",
"for",
"parsing",
"is",
"either",
"an",
"integer",
"OR",
"float",
"that",
"can",
"SAFELY",
"be",
"cast",
"to",
"an",
"integer",
"without",
"losing",
"accuracy",
".",
"Raises",
"a",
"ValueError",
"if",
"that",
... | def validate_integer(name, val, min_val=0):
"""
Checks whether the 'name' parameter for parsing is either
an integer OR float that can SAFELY be cast to an integer
without losing accuracy. Raises a ValueError if that is
not the case.
Parameters
----------
name : str
Parameter na... | [
"def",
"validate_integer",
"(",
"name",
",",
"val",
",",
"min_val",
"=",
"0",
")",
":",
"msg",
"=",
"f\"'{name:s}' must be an integer >={min_val:d}\"",
"if",
"val",
"is",
"not",
"None",
":",
"if",
"is_float",
"(",
"val",
")",
":",
"if",
"int",
"(",
"val",
... | https://github.com/pandas-dev/pandas/blob/5ba7d714014ae8feaccc0dd4a98890828cf2832d/pandas/io/parsers/readers.py#L480-L506 | |
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/boto-2.46.1/boto/mws/connection.py | python | MWSConnection.list_orders | (self, request, response, **kw) | return self._post_request(request, kw, response) | Returns a list of orders created or updated during a time
frame that you specify. | Returns a list of orders created or updated during a time
frame that you specify. | [
"Returns",
"a",
"list",
"of",
"orders",
"created",
"or",
"updated",
"during",
"a",
"time",
"frame",
"that",
"you",
"specify",
"."
] | def list_orders(self, request, response, **kw):
"""Returns a list of orders created or updated during a time
frame that you specify.
"""
toggle = set(('FulfillmentChannel.Channel.1',
'OrderStatus.Status.1', 'PaymentMethod.1',
'LastUpdatedAft... | [
"def",
"list_orders",
"(",
"self",
",",
"request",
",",
"response",
",",
"*",
"*",
"kw",
")",
":",
"toggle",
"=",
"set",
"(",
"(",
"'FulfillmentChannel.Channel.1'",
",",
"'OrderStatus.Status.1'",
",",
"'PaymentMethod.1'",
",",
"'LastUpdatedAfter'",
",",
"'LastUp... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/boto-2.46.1/boto/mws/connection.py#L717-L732 | |
google/timesketch | 1ce6b60e125d104e6644947c6f1dbe1b82ac76b6 | api_client/python/timesketch_api_client/graph.py | python | Graph.layout | (self) | return self._layout | Property that returns back the layout of the graph. | Property that returns back the layout of the graph. | [
"Property",
"that",
"returns",
"back",
"the",
"layout",
"of",
"the",
"graph",
"."
] | def layout(self):
"""Property that returns back the layout of the graph."""
if self._layout:
return self._layout
layout = self._GRAPH_LAYOUTS.get('spring')
self._layout = layout(self.graph)
return self._layout | [
"def",
"layout",
"(",
"self",
")",
":",
"if",
"self",
".",
"_layout",
":",
"return",
"self",
".",
"_layout",
"layout",
"=",
"self",
".",
"_GRAPH_LAYOUTS",
".",
"get",
"(",
"'spring'",
")",
"self",
".",
"_layout",
"=",
"layout",
"(",
"self",
".",
"gra... | https://github.com/google/timesketch/blob/1ce6b60e125d104e6644947c6f1dbe1b82ac76b6/api_client/python/timesketch_api_client/graph.py#L338-L345 | |
jdf/processing.py | 76e48ac855fd34169a7576a5cbc396bda698e781 | mode/formatter/autopep8.py | python | ReformattedLines._add_item | (self, item, indent_amt) | Add an item to the line.
Reflow the line to get the best formatting after the item is
inserted. The bracket depth indicates if the item is being
inserted inside of a container or not. | Add an item to the line. | [
"Add",
"an",
"item",
"to",
"the",
"line",
"."
] | def _add_item(self, item, indent_amt):
"""Add an item to the line.
Reflow the line to get the best formatting after the item is
inserted. The bracket depth indicates if the item is being
inserted inside of a container or not.
"""
if self._prev_item and self._prev_item.i... | [
"def",
"_add_item",
"(",
"self",
",",
"item",
",",
"indent_amt",
")",
":",
"if",
"self",
".",
"_prev_item",
"and",
"self",
".",
"_prev_item",
".",
"is_string",
"and",
"item",
".",
"is_string",
":",
"# Place consecutive string literals on separate lines.",
"self",
... | https://github.com/jdf/processing.py/blob/76e48ac855fd34169a7576a5cbc396bda698e781/mode/formatter/autopep8.py#L1556-L1595 | ||
Epistimio/orion | 732e739d99561020dbe620760acf062ade746006 | src/orion/core/worker/transformer.py | python | Compose.target_type | (self) | return type_after if type_after else type_before | Infer type of the tranformation target. | Infer type of the tranformation target. | [
"Infer",
"type",
"of",
"the",
"tranformation",
"target",
"."
] | def target_type(self):
"""Infer type of the tranformation target."""
type_before = self.composition.target_type
type_after = self.apply.target_type
return type_after if type_after else type_before | [
"def",
"target_type",
"(",
"self",
")",
":",
"type_before",
"=",
"self",
".",
"composition",
".",
"target_type",
"type_after",
"=",
"self",
".",
"apply",
".",
"target_type",
"return",
"type_after",
"if",
"type_after",
"else",
"type_before"
] | https://github.com/Epistimio/orion/blob/732e739d99561020dbe620760acf062ade746006/src/orion/core/worker/transformer.py#L316-L320 | |
WerWolv/EdiZon_CheatsConfigsAndScripts | d16d36c7509c01dca770f402babd83ff2e9ae6e7 | Scripts/lib/python3.5/asyncio/base_events.py | python | BaseEventLoop._process_events | (self, event_list) | Process selector events. | Process selector events. | [
"Process",
"selector",
"events",
"."
] | def _process_events(self, event_list):
"""Process selector events."""
raise NotImplementedError | [
"def",
"_process_events",
"(",
"self",
",",
"event_list",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/WerWolv/EdiZon_CheatsConfigsAndScripts/blob/d16d36c7509c01dca770f402babd83ff2e9ae6e7/Scripts/lib/python3.5/asyncio/base_events.py#L351-L353 | ||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.4/django/template/defaultfilters.py | python | date | (value, arg=None) | Formats a date according to the given format. | Formats a date according to the given format. | [
"Formats",
"a",
"date",
"according",
"to",
"the",
"given",
"format",
"."
] | def date(value, arg=None):
"""Formats a date according to the given format."""
if not value:
return u''
if arg is None:
arg = settings.DATE_FORMAT
try:
return formats.date_format(value, arg)
except AttributeError:
try:
return format(value, arg)
exc... | [
"def",
"date",
"(",
"value",
",",
"arg",
"=",
"None",
")",
":",
"if",
"not",
"value",
":",
"return",
"u''",
"if",
"arg",
"is",
"None",
":",
"arg",
"=",
"settings",
".",
"DATE_FORMAT",
"try",
":",
"return",
"formats",
".",
"date_format",
"(",
"value",... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.4/django/template/defaultfilters.py#L708-L720 | ||
spack/spack | 675210bd8bd1c5d32ad1cc83d898fb43b569ed74 | lib/spack/external/jinja2/nodes.py | python | Node.iter_child_nodes | (self, exclude=None, only=None) | Iterates over all direct child nodes of the node. This iterates
over all fields and yields the values of they are nodes. If the value
of a field is a list all the nodes in that list are returned. | Iterates over all direct child nodes of the node. This iterates
over all fields and yields the values of they are nodes. If the value
of a field is a list all the nodes in that list are returned. | [
"Iterates",
"over",
"all",
"direct",
"child",
"nodes",
"of",
"the",
"node",
".",
"This",
"iterates",
"over",
"all",
"fields",
"and",
"yields",
"the",
"values",
"of",
"they",
"are",
"nodes",
".",
"If",
"the",
"value",
"of",
"a",
"field",
"is",
"a",
"lis... | def iter_child_nodes(self, exclude=None, only=None):
"""Iterates over all direct child nodes of the node. This iterates
over all fields and yields the values of they are nodes. If the value
of a field is a list all the nodes in that list are returned.
"""
for _, item in self.it... | [
"def",
"iter_child_nodes",
"(",
"self",
",",
"exclude",
"=",
"None",
",",
"only",
"=",
"None",
")",
":",
"for",
"_",
",",
"item",
"in",
"self",
".",
"iter_fields",
"(",
"exclude",
",",
"only",
")",
":",
"if",
"isinstance",
"(",
"item",
",",
"list",
... | https://github.com/spack/spack/blob/675210bd8bd1c5d32ad1cc83d898fb43b569ed74/lib/spack/external/jinja2/nodes.py#L155-L166 | ||
cea-hpc/clustershell | c421133ed4baa69e35ff76c476d4097201485344 | lib/ClusterShell/NodeSet.py | python | NodeSetBase.__iter__ | (self) | Iterator on single nodes as string. | Iterator on single nodes as string. | [
"Iterator",
"on",
"single",
"nodes",
"as",
"string",
"."
] | def __iter__(self):
"""Iterator on single nodes as string."""
# Does not call self._iterbase() + str() for better performance.
for pat, ivec, pads, _ in self._iter():
if ivec is not None:
# For performance reasons, add a special case for 1D RangeSet
if... | [
"def",
"__iter__",
"(",
"self",
")",
":",
"# Does not call self._iterbase() + str() for better performance.",
"for",
"pat",
",",
"ivec",
",",
"pads",
",",
"_",
"in",
"self",
".",
"_iter",
"(",
")",
":",
"if",
"ivec",
"is",
"not",
"None",
":",
"# For performanc... | https://github.com/cea-hpc/clustershell/blob/c421133ed4baa69e35ff76c476d4097201485344/lib/ClusterShell/NodeSet.py#L195-L207 | ||
dropbox/dropbox-sdk-python | 015437429be224732990041164a21a0501235db1 | dropbox/team_log.py | python | EventDetails.is_paper_doc_delete_comment_details | (self) | return self._tag == 'paper_doc_delete_comment_details' | Check if the union tag is ``paper_doc_delete_comment_details``.
:rtype: bool | Check if the union tag is ``paper_doc_delete_comment_details``. | [
"Check",
"if",
"the",
"union",
"tag",
"is",
"paper_doc_delete_comment_details",
"."
] | def is_paper_doc_delete_comment_details(self):
"""
Check if the union tag is ``paper_doc_delete_comment_details``.
:rtype: bool
"""
return self._tag == 'paper_doc_delete_comment_details' | [
"def",
"is_paper_doc_delete_comment_details",
"(",
"self",
")",
":",
"return",
"self",
".",
"_tag",
"==",
"'paper_doc_delete_comment_details'"
] | https://github.com/dropbox/dropbox-sdk-python/blob/015437429be224732990041164a21a0501235db1/dropbox/team_log.py#L14799-L14805 | |
micahflee/torbrowser-launcher | 4b9d49c18315476b1a95878c2d84e8e8299db6c9 | torbrowser_launcher/settings.py | python | Settings.install | (self) | [] | def install(self):
self.save()
subprocess.Popen([self.common.paths["tbl_bin"]])
self.close() | [
"def",
"install",
"(",
"self",
")",
":",
"self",
".",
"save",
"(",
")",
"subprocess",
".",
"Popen",
"(",
"[",
"self",
".",
"common",
".",
"paths",
"[",
"\"tbl_bin\"",
"]",
"]",
")",
"self",
".",
"close",
"(",
")"
] | https://github.com/micahflee/torbrowser-launcher/blob/4b9d49c18315476b1a95878c2d84e8e8299db6c9/torbrowser_launcher/settings.py#L169-L172 | ||||
albertz/music-player | d23586f5bf657cbaea8147223be7814d117ae73d | src/modules/songdb.py | python | DB._removeOldDb | (self) | [] | def _removeOldDb(self):
# Maybe we really should do some backuping...?
self.disconnectAll()
import shutil, os
shutil.rmtree(self.path, ignore_errors=True)
try: os.remove(self.path)
except OSError: pass | [
"def",
"_removeOldDb",
"(",
"self",
")",
":",
"# Maybe we really should do some backuping...?",
"self",
".",
"disconnectAll",
"(",
")",
"import",
"shutil",
",",
"os",
"shutil",
".",
"rmtree",
"(",
"self",
".",
"path",
",",
"ignore_errors",
"=",
"True",
")",
"t... | https://github.com/albertz/music-player/blob/d23586f5bf657cbaea8147223be7814d117ae73d/src/modules/songdb.py#L312-L318 | ||||
bikalims/bika.lims | 35e4bbdb5a3912cae0b5eb13e51097c8b0486349 | bika/lims/jsonapi/request.py | python | get_json | () | return data or dict() | get the request json payload | get the request json payload | [
"get",
"the",
"request",
"json",
"payload"
] | def get_json():
""" get the request json payload
"""
data = get_request_data().pop()
return data or dict() | [
"def",
"get_json",
"(",
")",
":",
"data",
"=",
"get_request_data",
"(",
")",
".",
"pop",
"(",
")",
"return",
"data",
"or",
"dict",
"(",
")"
] | https://github.com/bikalims/bika.lims/blob/35e4bbdb5a3912cae0b5eb13e51097c8b0486349/bika/lims/jsonapi/request.py#L206-L210 | |
JiYou/openstack | 8607dd488bde0905044b303eb6e52bdea6806923 | packages/source/cinder/cinder/volume/drivers/netapp/iscsi.py | python | NetAppISCSIDriver._check_flags | (self) | Ensure that the flags we care about are set. | Ensure that the flags we care about are set. | [
"Ensure",
"that",
"the",
"flags",
"we",
"care",
"about",
"are",
"set",
"."
] | def _check_flags(self):
"""Ensure that the flags we care about are set."""
required_flags = ['netapp_wsdl_url', 'netapp_login', 'netapp_password',
'netapp_server_hostname', 'netapp_server_port']
for flag in required_flags:
if not getattr(self.configuration, ... | [
"def",
"_check_flags",
"(",
"self",
")",
":",
"required_flags",
"=",
"[",
"'netapp_wsdl_url'",
",",
"'netapp_login'",
",",
"'netapp_password'",
",",
"'netapp_server_hostname'",
",",
"'netapp_server_port'",
"]",
"for",
"flag",
"in",
"required_flags",
":",
"if",
"not"... | https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/cinder/cinder/volume/drivers/netapp/iscsi.py#L163-L176 | ||
Arelle/Arelle | 20f3d8a8afd41668e1520799acd333349ce0ba17 | arelle/TkTableWrapper.py | python | Table.clear_all | (self, first=None, last=None) | Perform all of the above clear functions on the specified area. | Perform all of the above clear functions on the specified area. | [
"Perform",
"all",
"of",
"the",
"above",
"clear",
"functions",
"on",
"the",
"specified",
"area",
"."
] | def clear_all(self, first=None, last=None):
"""Perform all of the above clear functions on the specified area."""
self.clear('all', first, last) | [
"def",
"clear_all",
"(",
"self",
",",
"first",
"=",
"None",
",",
"last",
"=",
"None",
")",
":",
"self",
".",
"clear",
"(",
"'all'",
",",
"first",
",",
"last",
")"
] | https://github.com/Arelle/Arelle/blob/20f3d8a8afd41668e1520799acd333349ce0ba17/arelle/TkTableWrapper.py#L212-L214 | ||
trailofbits/protofuzz | acc6ab67b4af5d569f250b4f13f5e67d04b78ba3 | protofuzz/gen.py | python | Permuter.make_dependent | (self, source, target, action) | Create a dependency between path 'source' and path 'target' via the callable 'action'.
>>> permuter._generators
[IterValueGenerator(one), IterValueGenerator(two)]
>>> permuter.make_dependent('one', 'two', lambda x: x + 1)
Going forward, 'two' will only contain values that are (one+1). | Create a dependency between path 'source' and path 'target' via the callable 'action'. | [
"Create",
"a",
"dependency",
"between",
"path",
"source",
"and",
"path",
"target",
"via",
"the",
"callable",
"action",
"."
] | def make_dependent(self, source, target, action):
"""Create a dependency between path 'source' and path 'target' via the callable 'action'.
>>> permuter._generators
[IterValueGenerator(one), IterValueGenerator(two)]
>>> permuter.make_dependent('one', 'two', lambda x: x + 1)
Goi... | [
"def",
"make_dependent",
"(",
"self",
",",
"source",
",",
"target",
",",
"action",
")",
":",
"if",
"not",
"self",
".",
"_generators",
":",
"return",
"src_permuter",
",",
"src",
"=",
"self",
".",
"_resolve_child",
"(",
"source",
")",
"dest",
"=",
"self",
... | https://github.com/trailofbits/protofuzz/blob/acc6ab67b4af5d569f250b4f13f5e67d04b78ba3/protofuzz/gen.py#L126-L147 | ||
spesmilo/electrum | bdbd59300fbd35b01605e66145458e5f396108e8 | electrum/channel_db.py | python | NodeInfo.parse_addresses_field | (addresses_field) | return addresses | [] | def parse_addresses_field(addresses_field):
buf = addresses_field
def read(n):
nonlocal buf
data, buf = buf[0:n], buf[n:]
return data
addresses = []
while buf:
atype = ord(read(1))
if atype == 0:
pass
... | [
"def",
"parse_addresses_field",
"(",
"addresses_field",
")",
":",
"buf",
"=",
"addresses_field",
"def",
"read",
"(",
"n",
")",
":",
"nonlocal",
"buf",
"data",
",",
"buf",
"=",
"buf",
"[",
"0",
":",
"n",
"]",
",",
"buf",
"[",
"n",
":",
"]",
"return",
... | https://github.com/spesmilo/electrum/blob/bdbd59300fbd35b01605e66145458e5f396108e8/electrum/channel_db.py#L188-L225 | |||
pymedusa/Medusa | 1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38 | medusa/tv/episode.py | python | Episode.full_path | (self) | Return episode full path.
:return:
:rtype: str | Return episode full path. | [
"Return",
"episode",
"full",
"path",
"."
] | def full_path(self):
"""Return episode full path.
:return:
:rtype: str
"""
if self.location is None or self.location == '':
return None
else:
return os.path.join(self.series.location, self.location) | [
"def",
"full_path",
"(",
"self",
")",
":",
"if",
"self",
".",
"location",
"is",
"None",
"or",
"self",
".",
"location",
"==",
"''",
":",
"return",
"None",
"else",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"series",
".",
"locat... | https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/medusa/tv/episode.py#L1407-L1416 | ||
shiyanhui/FileHeader | f347cc134021fb0b710694b71c57742476f5fd2b | jinja2/filters.py | python | environmentfilter | (f) | return f | Decorator for marking evironment dependent filters. The current
:class:`Environment` is passed to the filter as first argument. | Decorator for marking evironment dependent filters. The current
:class:`Environment` is passed to the filter as first argument. | [
"Decorator",
"for",
"marking",
"evironment",
"dependent",
"filters",
".",
"The",
"current",
":",
"class",
":",
"Environment",
"is",
"passed",
"to",
"the",
"filter",
"as",
"first",
"argument",
"."
] | def environmentfilter(f):
"""Decorator for marking evironment dependent filters. The current
:class:`Environment` is passed to the filter as first argument.
"""
f.environmentfilter = True
return f | [
"def",
"environmentfilter",
"(",
"f",
")",
":",
"f",
".",
"environmentfilter",
"=",
"True",
"return",
"f"
] | https://github.com/shiyanhui/FileHeader/blob/f347cc134021fb0b710694b71c57742476f5fd2b/jinja2/filters.py#L46-L51 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/django/contrib/admin/helpers.py | python | InlineAdminForm.fk_field | (self) | [] | def fk_field(self):
fk = getattr(self.formset, "fk", None)
if fk:
return AdminField(self.form, fk.name, False)
else:
return "" | [
"def",
"fk_field",
"(",
"self",
")",
":",
"fk",
"=",
"getattr",
"(",
"self",
".",
"formset",
",",
"\"fk\"",
",",
"None",
")",
"if",
"fk",
":",
"return",
"AdminField",
"(",
"self",
".",
"form",
",",
"fk",
".",
"name",
",",
"False",
")",
"else",
":... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/django/contrib/admin/helpers.py#L348-L353 | ||||
mchristopher/PokemonGo-DesktopMap | ec37575f2776ee7d64456e2a1f6b6b78830b4fe0 | app/pywin/Lib/telnetlib.py | python | Telnet.set_debuglevel | (self, debuglevel) | Set the debug level.
The higher it is, the more debug output you get (on sys.stdout). | Set the debug level. | [
"Set",
"the",
"debug",
"level",
"."
] | def set_debuglevel(self, debuglevel):
"""Set the debug level.
The higher it is, the more debug output you get (on sys.stdout).
"""
self.debuglevel = debuglevel | [
"def",
"set_debuglevel",
"(",
"self",
",",
"debuglevel",
")",
":",
"self",
".",
"debuglevel",
"=",
"debuglevel"
] | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/ec37575f2776ee7d64456e2a1f6b6b78830b4fe0/app/pywin/Lib/telnetlib.py#L247-L253 | ||
cortex-lab/phy | 9a330b9437a3d0b40a37a201d147224e6e7fb462 | phy/gui/widgets.py | python | Table.get_previous_id | (self, callback=None) | Get the previous non-skipped row id. | Get the previous non-skipped row id. | [
"Get",
"the",
"previous",
"non",
"-",
"skipped",
"row",
"id",
"."
] | def get_previous_id(self, callback=None):
"""Get the previous non-skipped row id."""
self.eval_js('table.getSiblingId(undefined, "previous");', callback=callback) | [
"def",
"get_previous_id",
"(",
"self",
",",
"callback",
"=",
"None",
")",
":",
"self",
".",
"eval_js",
"(",
"'table.getSiblingId(undefined, \"previous\");'",
",",
"callback",
"=",
"callback",
")"
] | https://github.com/cortex-lab/phy/blob/9a330b9437a3d0b40a37a201d147224e6e7fb462/phy/gui/widgets.py#L470-L472 | ||
HariSekhon/Nagios-Plugins | a436fc63e10ab8a64d623df109777dea2eda5758 | older/check_sftp.py | python | which | (executable) | return None | takes an executable name as the only arg and tests if it is in the path.
Returns the full path of the executable if it exists in path, or None if it
does not | takes an executable name as the only arg and tests if it is in the path.
Returns the full path of the executable if it exists in path, or None if it
does not | [
"takes",
"an",
"executable",
"name",
"as",
"the",
"only",
"arg",
"and",
"tests",
"if",
"it",
"is",
"in",
"the",
"path",
".",
"Returns",
"the",
"full",
"path",
"of",
"the",
"executable",
"if",
"it",
"exists",
"in",
"path",
"or",
"None",
"if",
"it",
"d... | def which(executable):
"""takes an executable name as the only arg and tests if it is in the path.
Returns the full path of the executable if it exists in path, or None if it
does not"""
for basepath in os.environ['PATH'].split(os.pathsep):
path = os.path.join(basepath, executable)
if o... | [
"def",
"which",
"(",
"executable",
")",
":",
"for",
"basepath",
"in",
"os",
".",
"environ",
"[",
"'PATH'",
"]",
".",
"split",
"(",
"os",
".",
"pathsep",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"basepath",
",",
"executable",
")",... | https://github.com/HariSekhon/Nagios-Plugins/blob/a436fc63e10ab8a64d623df109777dea2eda5758/older/check_sftp.py#L49-L58 | |
cclib/cclib | 81cd4a81cc4a3bbed7016b3e417ca9bff8ad3a92 | cclib/parser/turbomoleparser.py | python | Turbomole.parse_dscf_orbitals | (self, inputfile, line) | return orbitals, line | Extract orbital occupation and energies from a dscf logfile.
Returns
-------
tuple
a two membered tuple where the first element is a list of dictionaries of the the orbitals parsed, while the second is the line on which parsing should continue. | Extract orbital occupation and energies from a dscf logfile.
Returns
-------
tuple
a two membered tuple where the first element is a list of dictionaries of the the orbitals parsed, while the second is the line on which parsing should continue. | [
"Extract",
"orbital",
"occupation",
"and",
"energies",
"from",
"a",
"dscf",
"logfile",
".",
"Returns",
"-------",
"tuple",
"a",
"two",
"membered",
"tuple",
"where",
"the",
"first",
"element",
"is",
"a",
"list",
"of",
"dictionaries",
"of",
"the",
"the",
"orbi... | def parse_dscf_orbitals(self, inputfile, line):
"""
Extract orbital occupation and energies from a dscf logfile.
Returns
-------
tuple
a two membered tuple where the first element is a list of dictionaries of the the orbitals parsed, while the second is the l... | [
"def",
"parse_dscf_orbitals",
"(",
"self",
",",
"inputfile",
",",
"line",
")",
":",
"## Orbital occupation info from dscf.",
"# orbitals $scfmo will be written to file mos",
"# ",
"# irrep 1a 2a 3a 4a 5a ",
"# eigenvalues H ... | https://github.com/cclib/cclib/blob/81cd4a81cc4a3bbed7016b3e417ca9bff8ad3a92/cclib/parser/turbomoleparser.py#L1152-L1244 | |
viblo/pymunk | 77647ca037d5ceabd728f20f37d2da8a3bfb73a0 | pymunk/bb.py | python | BB.contains | (self, other: "BB") | return bool(lib.cpBBContainsBB(self, other)) | Returns true if bb completley contains the other bb | Returns true if bb completley contains the other bb | [
"Returns",
"true",
"if",
"bb",
"completley",
"contains",
"the",
"other",
"bb"
] | def contains(self, other: "BB") -> bool:
"""Returns true if bb completley contains the other bb"""
return bool(lib.cpBBContainsBB(self, other)) | [
"def",
"contains",
"(",
"self",
",",
"other",
":",
"\"BB\"",
")",
"->",
"bool",
":",
"return",
"bool",
"(",
"lib",
".",
"cpBBContainsBB",
"(",
"self",
",",
"other",
")",
")"
] | https://github.com/viblo/pymunk/blob/77647ca037d5ceabd728f20f37d2da8a3bfb73a0/pymunk/bb.py#L53-L55 | |
prkumar/uplink | 3472806f68a60a93f7cb555d36365551a5411cc5 | uplink/helpers.py | python | RequestBuilder.add_transaction_hook | (self, hook) | [] | def add_transaction_hook(self, hook):
self._transaction_hooks.append(hook) | [
"def",
"add_transaction_hook",
"(",
"self",
",",
"hook",
")",
":",
"self",
".",
"_transaction_hooks",
".",
"append",
"(",
"hook",
")"
] | https://github.com/prkumar/uplink/blob/3472806f68a60a93f7cb555d36365551a5411cc5/uplink/helpers.py#L114-L115 | ||||
inguma/bokken | 6109dd0025093a11631cb88cf48cb5c5ed5e617d | lib/web/net.py | python | htmlunquote | (text) | return text | r"""
Decodes `text` that's HTML quoted.
>>> htmlunquote(u'<'&">')
u'<\'&">' | r"""
Decodes `text` that's HTML quoted. | [
"r",
"Decodes",
"text",
"that",
"s",
"HTML",
"quoted",
"."
] | def htmlunquote(text):
r"""
Decodes `text` that's HTML quoted.
>>> htmlunquote(u'<'&">')
u'<\'&">'
"""
text = text.replace(u""", u'"')
text = text.replace(u"'", u"'")
text = text.replace(u">", u">")
text = text.replace(u"<", u"<")
text =... | [
"def",
"htmlunquote",
"(",
"text",
")",
":",
"text",
"=",
"text",
".",
"replace",
"(",
"u\""\"",
",",
"u'\"'",
")",
"text",
"=",
"text",
".",
"replace",
"(",
"u\"'\"",
",",
"u\"'\"",
")",
"text",
"=",
"text",
".",
"replace",
"(",
"u\">\"",
... | https://github.com/inguma/bokken/blob/6109dd0025093a11631cb88cf48cb5c5ed5e617d/lib/web/net.py#L156-L168 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/integrals/transforms.py | python | _hankel_transform | (f, r, k, nu, name, simplify=True) | return _simplify(F, simplify), cond | Compute a general Hankel transform
.. math:: F_\nu(k) = \int_{0}^\infty f(r) J_\nu(k r) r \mathrm{d} r. | Compute a general Hankel transform | [
"Compute",
"a",
"general",
"Hankel",
"transform"
] | def _hankel_transform(f, r, k, nu, name, simplify=True):
"""
Compute a general Hankel transform
.. math:: F_\nu(k) = \int_{0}^\infty f(r) J_\nu(k r) r \mathrm{d} r.
"""
from sympy import besselj, oo
F = integrate(f*besselj(nu, k*r)*r, (r, 0, oo))
if not F.has(Integral):
return _sim... | [
"def",
"_hankel_transform",
"(",
"f",
",",
"r",
",",
"k",
",",
"nu",
",",
"name",
",",
"simplify",
"=",
"True",
")",
":",
"from",
"sympy",
"import",
"besselj",
",",
"oo",
"F",
"=",
"integrate",
"(",
"f",
"*",
"besselj",
"(",
"nu",
",",
"k",
"*",
... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/integrals/transforms.py#L1667-L1686 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_vendored_deps/library/oc_adm_registry.py | python | OpenShiftCLI._run | (self, cmds, input_data) | return proc.returncode, stdout.decode('utf-8'), stderr.decode('utf-8') | Actually executes the command. This makes mocking easier. | Actually executes the command. This makes mocking easier. | [
"Actually",
"executes",
"the",
"command",
".",
"This",
"makes",
"mocking",
"easier",
"."
] | def _run(self, cmds, input_data):
''' Actually executes the command. This makes mocking easier. '''
curr_env = os.environ.copy()
curr_env.update({'KUBECONFIG': self.kubeconfig})
proc = subprocess.Popen(cmds,
stdin=subprocess.PIPE,
... | [
"def",
"_run",
"(",
"self",
",",
"cmds",
",",
"input_data",
")",
":",
"curr_env",
"=",
"os",
".",
"environ",
".",
"copy",
"(",
")",
"curr_env",
".",
"update",
"(",
"{",
"'KUBECONFIG'",
":",
"self",
".",
"kubeconfig",
"}",
")",
"proc",
"=",
"subproces... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_vendored_deps/library/oc_adm_registry.py#L1214-L1226 | |
zhaoweicai/Detectron-Cascade-RCNN | 5a297fcc16eab6c26b7b1a9fe2767c626730f03b | detectron/utils/segms.py | python | rle_mask_voting | (
top_masks, all_masks, all_dets, iou_thresh, binarize_thresh, method='AVG'
) | return top_segms_out | Returns new masks (in correspondence with `top_masks`) by combining
multiple overlapping masks coming from the pool of `all_masks`. Two methods
for combining masks are supported: 'AVG' uses a weighted average of
overlapping mask pixels; 'UNION' takes the union of all mask pixels. | Returns new masks (in correspondence with `top_masks`) by combining
multiple overlapping masks coming from the pool of `all_masks`. Two methods
for combining masks are supported: 'AVG' uses a weighted average of
overlapping mask pixels; 'UNION' takes the union of all mask pixels. | [
"Returns",
"new",
"masks",
"(",
"in",
"correspondence",
"with",
"top_masks",
")",
"by",
"combining",
"multiple",
"overlapping",
"masks",
"coming",
"from",
"the",
"pool",
"of",
"all_masks",
".",
"Two",
"methods",
"for",
"combining",
"masks",
"are",
"supported",
... | def rle_mask_voting(
top_masks, all_masks, all_dets, iou_thresh, binarize_thresh, method='AVG'
):
"""Returns new masks (in correspondence with `top_masks`) by combining
multiple overlapping masks coming from the pool of `all_masks`. Two methods
for combining masks are supported: 'AVG' uses a weighted av... | [
"def",
"rle_mask_voting",
"(",
"top_masks",
",",
"all_masks",
",",
"all_dets",
",",
"iou_thresh",
",",
"binarize_thresh",
",",
"method",
"=",
"'AVG'",
")",
":",
"if",
"len",
"(",
"top_masks",
")",
"==",
"0",
":",
"return",
"all_not_crowd",
"=",
"[",
"False... | https://github.com/zhaoweicai/Detectron-Cascade-RCNN/blob/5a297fcc16eab6c26b7b1a9fe2767c626730f03b/detectron/utils/segms.py#L145-L206 | |
Qiskit/qiskit-terra | b66030e3b9192efdd3eb95cf25c6545fe0a13da4 | qiskit/qasm/node/reset.py | python | Reset.qasm | (self) | return "reset " + self.children[0].qasm() + ";" | Return the corresponding OPENQASM string. | Return the corresponding OPENQASM string. | [
"Return",
"the",
"corresponding",
"OPENQASM",
"string",
"."
] | def qasm(self):
"""Return the corresponding OPENQASM string."""
return "reset " + self.children[0].qasm() + ";" | [
"def",
"qasm",
"(",
"self",
")",
":",
"return",
"\"reset \"",
"+",
"self",
".",
"children",
"[",
"0",
"]",
".",
"qasm",
"(",
")",
"+",
"\";\""
] | https://github.com/Qiskit/qiskit-terra/blob/b66030e3b9192efdd3eb95cf25c6545fe0a13da4/qiskit/qasm/node/reset.py#L27-L29 | |
Bartzi/stn-ocr | 7fd90d845197367eb4e850edcbf95bb815116c99 | mxnet/utils/create_gif.py | python | intToBin | (i) | return chr(i1) + chr(i2) | Integer to two bytes | Integer to two bytes | [
"Integer",
"to",
"two",
"bytes"
] | def intToBin(i):
""" Integer to two bytes """
# devide in two parts (bytes)
i1 = i % 256
i2 = int(i/256)
# make string (little endian)
return chr(i1) + chr(i2) | [
"def",
"intToBin",
"(",
"i",
")",
":",
"# devide in two parts (bytes)",
"i1",
"=",
"i",
"%",
"256",
"i2",
"=",
"int",
"(",
"i",
"/",
"256",
")",
"# make string (little endian)",
"return",
"chr",
"(",
"i1",
")",
"+",
"chr",
"(",
"i2",
")"
] | https://github.com/Bartzi/stn-ocr/blob/7fd90d845197367eb4e850edcbf95bb815116c99/mxnet/utils/create_gif.py#L15-L21 | |
aws-samples/aws-kube-codesuite | ab4e5ce45416b83bffb947ab8d234df5437f4fca | src/networkx/classes/graph.py | python | Graph.clear | (self) | Remove all nodes and edges from the graph.
This also removes the name, and all graph, node, and edge attributes.
Examples
--------
>>> G = nx.path_graph(4) # or DiGraph, MultiGraph, MultiDiGraph, etc
>>> G.clear()
>>> list(G.nodes)
[]
>>> list(G.edges)
... | Remove all nodes and edges from the graph. | [
"Remove",
"all",
"nodes",
"and",
"edges",
"from",
"the",
"graph",
"."
] | def clear(self):
"""Remove all nodes and edges from the graph.
This also removes the name, and all graph, node, and edge attributes.
Examples
--------
>>> G = nx.path_graph(4) # or DiGraph, MultiGraph, MultiDiGraph, etc
>>> G.clear()
>>> list(G.nodes)
[... | [
"def",
"clear",
"(",
"self",
")",
":",
"self",
".",
"name",
"=",
"''",
"self",
".",
"_adj",
".",
"clear",
"(",
")",
"self",
".",
"_node",
".",
"clear",
"(",
")",
"self",
".",
"graph",
".",
"clear",
"(",
")"
] | https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/networkx/classes/graph.py#L1295-L1313 | ||
tomplus/kubernetes_asyncio | f028cc793e3a2c519be6a52a49fb77ff0b014c9b | kubernetes_asyncio/client/models/v1beta1_json_schema_props.py | python | V1beta1JSONSchemaProps.multiple_of | (self, multiple_of) | Sets the multiple_of of this V1beta1JSONSchemaProps.
:param multiple_of: The multiple_of of this V1beta1JSONSchemaProps. # noqa: E501
:type: float | Sets the multiple_of of this V1beta1JSONSchemaProps. | [
"Sets",
"the",
"multiple_of",
"of",
"this",
"V1beta1JSONSchemaProps",
"."
] | def multiple_of(self, multiple_of):
"""Sets the multiple_of of this V1beta1JSONSchemaProps.
:param multiple_of: The multiple_of of this V1beta1JSONSchemaProps. # noqa: E501
:type: float
"""
self._multiple_of = multiple_of | [
"def",
"multiple_of",
"(",
"self",
",",
"multiple_of",
")",
":",
"self",
".",
"_multiple_of",
"=",
"multiple_of"
] | https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1beta1_json_schema_props.py#L834-L842 | ||
gramps-project/gramps | 04d4651a43eb210192f40a9f8c2bad8ee8fa3753 | gramps/gui/widgets/styledtexteditor.py | python | StyledTextEditor.__init__ | (self) | Setup initial instance variable values. | Setup initial instance variable values. | [
"Setup",
"initial",
"instance",
"variable",
"values",
"."
] | def __init__(self):
"""Setup initial instance variable values."""
self.textbuffer = UndoableStyledBuffer()
self.undo_disabled = self.textbuffer.undo_disabled # see bug 7097
self.textbuffer.connect('style-changed', self._on_buffer_style_changed)
self.textbuffer.connect('changed', ... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"textbuffer",
"=",
"UndoableStyledBuffer",
"(",
")",
"self",
".",
"undo_disabled",
"=",
"self",
".",
"textbuffer",
".",
"undo_disabled",
"# see bug 7097",
"self",
".",
"textbuffer",
".",
"connect",
"(",
... | https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/gui/widgets/styledtexteditor.py#L286-L312 | ||
PySimpleGUI/PySimpleGUI | 6c0d1fb54f493d45e90180b322fbbe70f7a5af3c | PySimpleGUIWeb/PySimpleGUIWeb.py | python | Window.SetAlpha | (self, alpha) | Change the window's transparency
:param alpha: From 0 to 1 with 0 being completely transparent
:return: | Change the window's transparency
:param alpha: From 0 to 1 with 0 being completely transparent
:return: | [
"Change",
"the",
"window",
"s",
"transparency",
":",
"param",
"alpha",
":",
"From",
"0",
"to",
"1",
"with",
"0",
"being",
"completely",
"transparent",
":",
"return",
":"
] | def SetAlpha(self, alpha):
'''
Change the window's transparency
:param alpha: From 0 to 1 with 0 being completely transparent
:return:
'''
self._AlphaChannel = alpha * 255
if self._AlphaChannel is not None:
self.MasterFrame.SetTransparent(self._AlphaCh... | [
"def",
"SetAlpha",
"(",
"self",
",",
"alpha",
")",
":",
"self",
".",
"_AlphaChannel",
"=",
"alpha",
"*",
"255",
"if",
"self",
".",
"_AlphaChannel",
"is",
"not",
"None",
":",
"self",
".",
"MasterFrame",
".",
"SetTransparent",
"(",
"self",
".",
"_AlphaChan... | https://github.com/PySimpleGUI/PySimpleGUI/blob/6c0d1fb54f493d45e90180b322fbbe70f7a5af3c/PySimpleGUIWeb/PySimpleGUIWeb.py#L3205-L3213 | ||
glitchdotcom/WebPutty | 4f5da5eb2b4668cbf3c15cf002feacd1d95d2ef7 | libs/babel/support.py | python | Translations.load | (cls, dirname=None, locales=None, domain=DEFAULT_DOMAIN) | return cls(fileobj=open(filename, 'rb'), domain=domain) | Load translations from the given directory.
:param dirname: the directory containing the ``MO`` files
:param locales: the list of locales in order of preference (items in
this list can be either `Locale` objects or locale
strings)
:param domain: t... | Load translations from the given directory. | [
"Load",
"translations",
"from",
"the",
"given",
"directory",
"."
] | def load(cls, dirname=None, locales=None, domain=DEFAULT_DOMAIN):
"""Load translations from the given directory.
:param dirname: the directory containing the ``MO`` files
:param locales: the list of locales in order of preference (items in
this list can be either `Locale... | [
"def",
"load",
"(",
"cls",
",",
"dirname",
"=",
"None",
",",
"locales",
"=",
"None",
",",
"domain",
"=",
"DEFAULT_DOMAIN",
")",
":",
"if",
"locales",
"is",
"not",
"None",
":",
"if",
"not",
"isinstance",
"(",
"locales",
",",
"(",
"list",
",",
"tuple",... | https://github.com/glitchdotcom/WebPutty/blob/4f5da5eb2b4668cbf3c15cf002feacd1d95d2ef7/libs/babel/support.py#L283-L304 | |
openlabs/magento | 903c02db6ea2404d1e2013a7f0951a621c80fd80 | magento/catalog.py | python | Product.create | (self, product_type, attribute_set_id, sku, data) | return int(self.call(
'catalog_product.create',
[product_type, attribute_set_id, sku, data]
)
) | Create Product and return ID
:param product_type: String type of product
:param attribute_set_id: ID of attribute set
:param sku: SKU of the product
:param data: Dictionary of data
:return: INT id of product created | Create Product and return ID | [
"Create",
"Product",
"and",
"return",
"ID"
] | def create(self, product_type, attribute_set_id, sku, data):
"""
Create Product and return ID
:param product_type: String type of product
:param attribute_set_id: ID of attribute set
:param sku: SKU of the product
:param data: Dictionary of data
:return: INT id o... | [
"def",
"create",
"(",
"self",
",",
"product_type",
",",
"attribute_set_id",
",",
"sku",
",",
"data",
")",
":",
"return",
"int",
"(",
"self",
".",
"call",
"(",
"'catalog_product.create'",
",",
"[",
"product_type",
",",
"attribute_set_id",
",",
"sku",
",",
"... | https://github.com/openlabs/magento/blob/903c02db6ea2404d1e2013a7f0951a621c80fd80/magento/catalog.py#L268-L282 | |
realpython/book2-exercises | cde325eac8e6d8cff2316601c2e5b36bb46af7d0 | web2py-rest/gluon/compileapp.py | python | test | () | return | Example::
>>> import traceback, types
>>> environment={'x':1}
>>> open('a.py', 'w').write('print 1/x')
>>> save_pyc('a.py')
>>> os.unlink('a.py')
>>> if type(read_pyc('a.pyc'))==types.CodeType: print 'code'
code
>>> exec read_pyc('a.pyc') in environment
... | Example:: | [
"Example",
"::"
] | def test():
"""
Example::
>>> import traceback, types
>>> environment={'x':1}
>>> open('a.py', 'w').write('print 1/x')
>>> save_pyc('a.py')
>>> os.unlink('a.py')
>>> if type(read_pyc('a.pyc'))==types.CodeType: print 'code'
code
>>> exec read_pyc('... | [
"def",
"test",
"(",
")",
":",
"return"
] | https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/web2py-rest/gluon/compileapp.py#L743-L758 | |
uccser/cs-unplugged | f83593f872792e71a9fab3f2d77a0f489205926b | csunplugged/resources/utils/get_options_html.py | python | get_options_html | (options, local_options, request_parameters=None) | return html_string | Return HTML string of form elements for given options.
Args:
options (list): List of ResourceParameters options.
local_options (list): List of ResourceParameters local options.
request_parameters (QueryDict): Request QueryDict for resource form.
Returns:
HTML string | Return HTML string of form elements for given options. | [
"Return",
"HTML",
"string",
"of",
"form",
"elements",
"for",
"given",
"options",
"."
] | def get_options_html(options, local_options, request_parameters=None):
"""Return HTML string of form elements for given options.
Args:
options (list): List of ResourceParameters options.
local_options (list): List of ResourceParameters local options.
request_parameters (QueryDict): Requ... | [
"def",
"get_options_html",
"(",
"options",
",",
"local_options",
",",
"request_parameters",
"=",
"None",
")",
":",
"html_elements",
"=",
"[",
"]",
"for",
"parameter",
"in",
"options",
".",
"values",
"(",
")",
":",
"html_elements",
".",
"append",
"(",
"parame... | https://github.com/uccser/cs-unplugged/blob/f83593f872792e71a9fab3f2d77a0f489205926b/csunplugged/resources/utils/get_options_html.py#L7-L32 | |
CedricGuillemet/Imogen | ee417b42747ed5b46cb11b02ef0c3630000085b3 | bin/Lib/locale.py | python | _print_locale | () | Test function. | Test function. | [
"Test",
"function",
"."
] | def _print_locale():
""" Test function.
"""
categories = {}
def _init_categories(categories=categories):
for k,v in globals().items():
if k[:3] == 'LC_':
categories[k] = v
_init_categories()
del categories['LC_ALL']
print('Locale defaults as determined b... | [
"def",
"_print_locale",
"(",
")",
":",
"categories",
"=",
"{",
"}",
"def",
"_init_categories",
"(",
"categories",
"=",
"categories",
")",
":",
"for",
"k",
",",
"v",
"in",
"globals",
"(",
")",
".",
"items",
"(",
")",
":",
"if",
"k",
"[",
":",
"3",
... | https://github.com/CedricGuillemet/Imogen/blob/ee417b42747ed5b46cb11b02ef0c3630000085b3/bin/Lib/locale.py#L1677-L1731 | ||
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/webob/webob/byterange.py | python | Range.parse | (cls, header) | return cls(start, end) | Parse the header; may return None if header is invalid | Parse the header; may return None if header is invalid | [
"Parse",
"the",
"header",
";",
"may",
"return",
"None",
"if",
"header",
"is",
"invalid"
] | def parse(cls, header):
"""
Parse the header; may return None if header is invalid
"""
m = _rx_range.match(header or '')
if not m:
return None
start, end = m.groups()
if not start:
return cls(-int(end), None)
start = int(start)
... | [
"def",
"parse",
"(",
"cls",
",",
"header",
")",
":",
"m",
"=",
"_rx_range",
".",
"match",
"(",
"header",
"or",
"''",
")",
"if",
"not",
"m",
":",
"return",
"None",
"start",
",",
"end",
"=",
"m",
".",
"groups",
"(",
")",
"if",
"not",
"start",
":"... | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/webob/webob/byterange.py#L70-L86 | |
ChunyuanLI/Optimus | f63f4a7ca10aea022978500a37d72dd53a37a576 | code/examples/big_ae/run_data_filtering.py | python | train | (args, train_dataloader, model_vae, encoder_tokenizer, decoder_tokenizer, table_name) | return num_collected, num_dropped | Train the model | Train the model | [
"Train",
"the",
"model"
] | def train(args, train_dataloader, model_vae, encoder_tokenizer, decoder_tokenizer, table_name):
""" Train the model """
if args.local_rank in [-1, 0]:
tb_writer = SummaryWriter()
args.train_batch_size = args.per_gpu_train_batch_size * max(1, args.n_gpu)
# train_sampler = RandomSampler(train_dat... | [
"def",
"train",
"(",
"args",
",",
"train_dataloader",
",",
"model_vae",
",",
"encoder_tokenizer",
",",
"decoder_tokenizer",
",",
"table_name",
")",
":",
"if",
"args",
".",
"local_rank",
"in",
"[",
"-",
"1",
",",
"0",
"]",
":",
"tb_writer",
"=",
"SummaryWri... | https://github.com/ChunyuanLI/Optimus/blob/f63f4a7ca10aea022978500a37d72dd53a37a576/code/examples/big_ae/run_data_filtering.py#L120-L269 | |
1012598167/flask_mongodb_game | 60c7e0351586656ec38f851592886338e50b4110 | python_flask/venv/Lib/site-packages/pymongo/aggregation.py | python | _AggregationCommand._cursor_collection | (self, cursor_doc) | The Collection used for the aggregate command cursor. | The Collection used for the aggregate command cursor. | [
"The",
"Collection",
"used",
"for",
"the",
"aggregate",
"command",
"cursor",
"."
] | def _cursor_collection(self, cursor_doc):
"""The Collection used for the aggregate command cursor."""
raise NotImplementedError | [
"def",
"_cursor_collection",
"(",
"self",
",",
"cursor_doc",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/1012598167/flask_mongodb_game/blob/60c7e0351586656ec38f851592886338e50b4110/python_flask/venv/Lib/site-packages/pymongo/aggregation.py#L82-L84 | ||
FederatedAI/FATE | 32540492623568ecd1afcb367360133616e02fa3 | python/fate_arch/abc/_computing.py | python | CTableABC.save | (self, address: AddressABC, partitions: int, schema: dict, **kwargs) | save table
Parameters
----------
address: AddressABC
address to save table to
partitions: int
number of partitions to save as
schema: dict
table schema | save table | [
"save",
"table"
] | def save(self, address: AddressABC, partitions: int, schema: dict, **kwargs):
"""
save table
Parameters
----------
address: AddressABC
address to save table to
partitions: int
number of partitions to save as
schema: dict
table sch... | [
"def",
"save",
"(",
"self",
",",
"address",
":",
"AddressABC",
",",
"partitions",
":",
"int",
",",
"schema",
":",
"dict",
",",
"*",
"*",
"kwargs",
")",
":",
"..."
] | https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/fate_arch/abc/_computing.py#L65-L78 | ||
Project-MONAI/MONAI | 83f8b06372a3803ebe9281300cb794a1f3395018 | monai/transforms/spatial/array.py | python | RandGridDistortion.__init__ | (
self,
num_cells: Union[Tuple[int], int] = 5,
prob: float = 0.1,
distort_limit: Union[Tuple[float, float], float] = (-0.03, 0.03),
mode: Union[GridSampleMode, str] = GridSampleMode.BILINEAR,
padding_mode: Union[GridSamplePadMode, str] = GridSamplePadMode.BORDER,
... | Random grid distortion transform. Refer to:
https://github.com/albumentations-team/albumentations/blob/master/albumentations/augmentations/transforms.py
Args:
num_cells: number of grid cells on each dimension.
prob: probability of returning a randomized grid distortion transform... | Random grid distortion transform. Refer to:
https://github.com/albumentations-team/albumentations/blob/master/albumentations/augmentations/transforms.py | [
"Random",
"grid",
"distortion",
"transform",
".",
"Refer",
"to",
":",
"https",
":",
"//",
"github",
".",
"com",
"/",
"albumentations",
"-",
"team",
"/",
"albumentations",
"/",
"blob",
"/",
"master",
"/",
"albumentations",
"/",
"augmentations",
"/",
"transfor... | def __init__(
self,
num_cells: Union[Tuple[int], int] = 5,
prob: float = 0.1,
distort_limit: Union[Tuple[float, float], float] = (-0.03, 0.03),
mode: Union[GridSampleMode, str] = GridSampleMode.BILINEAR,
padding_mode: Union[GridSamplePadMode, str] = GridSamplePadMode.BORD... | [
"def",
"__init__",
"(",
"self",
",",
"num_cells",
":",
"Union",
"[",
"Tuple",
"[",
"int",
"]",
",",
"int",
"]",
"=",
"5",
",",
"prob",
":",
"float",
"=",
"0.1",
",",
"distort_limit",
":",
"Union",
"[",
"Tuple",
"[",
"float",
",",
"float",
"]",
",... | https://github.com/Project-MONAI/MONAI/blob/83f8b06372a3803ebe9281300cb794a1f3395018/monai/transforms/spatial/array.py#L2116-L2153 | ||
microsoft/azure-devops-python-api | 451cade4c475482792cbe9e522c1fee32393139e | azure-devops/azure/devops/v6_0/git/git_client_base.py | python | GitClientBase.get_pull_request_reviewer | (self, repository_id, pull_request_id, reviewer_id, project=None) | return self._deserialize('IdentityRefWithVote', response) | GetPullRequestReviewer.
[Preview API] Retrieve information about a particular reviewer on a pull request
:param str repository_id: The repository ID of the pull request's target branch.
:param int pull_request_id: ID of the pull request.
:param str reviewer_id: ID of the reviewer.
... | GetPullRequestReviewer.
[Preview API] Retrieve information about a particular reviewer on a pull request
:param str repository_id: The repository ID of the pull request's target branch.
:param int pull_request_id: ID of the pull request.
:param str reviewer_id: ID of the reviewer.
... | [
"GetPullRequestReviewer",
".",
"[",
"Preview",
"API",
"]",
"Retrieve",
"information",
"about",
"a",
"particular",
"reviewer",
"on",
"a",
"pull",
"request",
":",
"param",
"str",
"repository_id",
":",
"The",
"repository",
"ID",
"of",
"the",
"pull",
"request",
"s... | def get_pull_request_reviewer(self, repository_id, pull_request_id, reviewer_id, project=None):
"""GetPullRequestReviewer.
[Preview API] Retrieve information about a particular reviewer on a pull request
:param str repository_id: The repository ID of the pull request's target branch.
:pa... | [
"def",
"get_pull_request_reviewer",
"(",
"self",
",",
"repository_id",
",",
"pull_request_id",
",",
"reviewer_id",
",",
"project",
"=",
"None",
")",
":",
"route_values",
"=",
"{",
"}",
"if",
"project",
"is",
"not",
"None",
":",
"route_values",
"[",
"'project'"... | https://github.com/microsoft/azure-devops-python-api/blob/451cade4c475482792cbe9e522c1fee32393139e/azure-devops/azure/devops/v6_0/git/git_client_base.py#L1960-L1982 | |
chen3feng/blade-build | 360b4c9ddb9087fb811af3aef2830301cf48805e | src/blade/target.py | python | Target._target_dir | (self) | return self.target_dir | Return the full path of target dir. | Return the full path of target dir. | [
"Return",
"the",
"full",
"path",
"of",
"target",
"dir",
"."
] | def _target_dir(self):
"""Return the full path of target dir."""
return self.target_dir | [
"def",
"_target_dir",
"(",
"self",
")",
":",
"return",
"self",
".",
"target_dir"
] | https://github.com/chen3feng/blade-build/blob/360b4c9ddb9087fb811af3aef2830301cf48805e/src/blade/target.py#L586-L588 | |
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/scatterpolar/selected/_marker.py | python | Marker.color | (self) | return self["color"] | Sets the marker color of selected points.
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
... | Sets the marker color of selected points.
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
... | [
"Sets",
"the",
"marker",
"color",
"of",
"selected",
"points",
".",
"The",
"color",
"property",
"is",
"a",
"color",
"and",
"may",
"be",
"specified",
"as",
":",
"-",
"A",
"hex",
"string",
"(",
"e",
".",
"g",
".",
"#ff0000",
")",
"-",
"An",
"rgb",
"/"... | def color(self):
"""
Sets the marker color of selected points.
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/h... | [
"def",
"color",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"color\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/scatterpolar/selected/_marker.py#L16-L66 | |
golismero/golismero | 7d605b937e241f51c1ca4f47b20f755eeefb9d76 | thirdparty_libs/nltk/inference/mace.py | python | test_transform_output | (argument_pair) | Transform the model into various Mace4 ``interpformat`` formats. | Transform the model into various Mace4 ``interpformat`` formats. | [
"Transform",
"the",
"model",
"into",
"various",
"Mace4",
"interpformat",
"formats",
"."
] | def test_transform_output(argument_pair):
"""
Transform the model into various Mace4 ``interpformat`` formats.
"""
lp = LogicParser()
g = lp.parse(argument_pair[0])
alist = [lp.parse(a) for a in argument_pair[1]]
m = MaceCommand(g, assumptions=alist)
m.build_model()
for a in alist:
... | [
"def",
"test_transform_output",
"(",
"argument_pair",
")",
":",
"lp",
"=",
"LogicParser",
"(",
")",
"g",
"=",
"lp",
".",
"parse",
"(",
"argument_pair",
"[",
"0",
"]",
")",
"alist",
"=",
"[",
"lp",
".",
"parse",
"(",
"a",
")",
"for",
"a",
"in",
"arg... | https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/thirdparty_libs/nltk/inference/mace.py#L282-L298 | ||
scottslowe/learning-tools | 5a2abe30e269055d89f6ff4210f0f9f52d632680 | traefik/tf-ans-swarm/ec2.py | python | Ec2Inventory.get_elasticache_replication_groups_by_region | (self, region) | Makes an AWS API call to the list of ElastiCache replication groups
in a particular region. | Makes an AWS API call to the list of ElastiCache replication groups
in a particular region. | [
"Makes",
"an",
"AWS",
"API",
"call",
"to",
"the",
"list",
"of",
"ElastiCache",
"replication",
"groups",
"in",
"a",
"particular",
"region",
"."
] | def get_elasticache_replication_groups_by_region(self, region):
''' Makes an AWS API call to the list of ElastiCache replication groups
in a particular region.'''
# ElastiCache boto module doesn't provide a get_all_intances method,
# that's why we need to call describe directly (it woul... | [
"def",
"get_elasticache_replication_groups_by_region",
"(",
"self",
",",
"region",
")",
":",
"# ElastiCache boto module doesn't provide a get_all_intances method,",
"# that's why we need to call describe directly (it would be called by",
"# the shorthand method anyway...)",
"try",
":",
"co... | https://github.com/scottslowe/learning-tools/blob/5a2abe30e269055d89f6ff4210f0f9f52d632680/traefik/tf-ans-swarm/ec2.py#L741-L773 | ||
golismero/golismero | 7d605b937e241f51c1ca4f47b20f755eeefb9d76 | tools/sqlmap/thirdparty/xdot/xdot.py | python | Pen.copy | (self) | return pen | Create a copy of this pen. | Create a copy of this pen. | [
"Create",
"a",
"copy",
"of",
"this",
"pen",
"."
] | def copy(self):
"""Create a copy of this pen."""
pen = Pen()
pen.__dict__ = self.__dict__.copy()
return pen | [
"def",
"copy",
"(",
"self",
")",
":",
"pen",
"=",
"Pen",
"(",
")",
"pen",
".",
"__dict__",
"=",
"self",
".",
"__dict__",
".",
"copy",
"(",
")",
"return",
"pen"
] | https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/tools/sqlmap/thirdparty/xdot/xdot.py#L62-L66 | |
nltk/nltk | 3f74ac55681667d7ef78b664557487145f51eb02 | nltk/translate/stack_decoder.py | python | StackDecoder.__init__ | (self, phrase_table, language_model) | :param phrase_table: Table of translations for source language
phrases and the log probabilities for those translations.
:type phrase_table: PhraseTable
:param language_model: Target language model. Must define a
``probability_change`` method that calculates the change in
... | :param phrase_table: Table of translations for source language
phrases and the log probabilities for those translations.
:type phrase_table: PhraseTable | [
":",
"param",
"phrase_table",
":",
"Table",
"of",
"translations",
"for",
"source",
"language",
"phrases",
"and",
"the",
"log",
"probabilities",
"for",
"those",
"translations",
".",
":",
"type",
"phrase_table",
":",
"PhraseTable"
] | def __init__(self, phrase_table, language_model):
"""
:param phrase_table: Table of translations for source language
phrases and the log probabilities for those translations.
:type phrase_table: PhraseTable
:param language_model: Target language model. Must define a
... | [
"def",
"__init__",
"(",
"self",
",",
"phrase_table",
",",
"language_model",
")",
":",
"self",
".",
"phrase_table",
"=",
"phrase_table",
"self",
".",
"language_model",
"=",
"language_model",
"self",
".",
"word_penalty",
"=",
"0.0",
"\"\"\"\n float: Influences ... | https://github.com/nltk/nltk/blob/3f74ac55681667d7ef78b664557487145f51eb02/nltk/translate/stack_decoder.py#L79-L119 | ||
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/asyncio/streams.py | python | StreamReader.readline | (self) | return line | Read chunk of data from the stream until newline (b'\n') is found.
On success, return chunk that ends with newline. If only partial
line can be read due to EOF, return incomplete line without
terminating newline. When EOF was reached while no bytes read, empty
bytes object is returned.
... | Read chunk of data from the stream until newline (b'\n') is found. | [
"Read",
"chunk",
"of",
"data",
"from",
"the",
"stream",
"until",
"newline",
"(",
"b",
"\\",
"n",
")",
"is",
"found",
"."
] | async def readline(self):
"""Read chunk of data from the stream until newline (b'\n') is found.
On success, return chunk that ends with newline. If only partial
line can be read due to EOF, return incomplete line without
terminating newline. When EOF was reached while no bytes read, emp... | [
"async",
"def",
"readline",
"(",
"self",
")",
":",
"sep",
"=",
"b'\\n'",
"seplen",
"=",
"len",
"(",
"sep",
")",
"try",
":",
"line",
"=",
"await",
"self",
".",
"readuntil",
"(",
"sep",
")",
"except",
"exceptions",
".",
"IncompleteReadError",
"as",
"e",
... | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/asyncio/streams.py#L521-L550 | |
LiDan456/MAD-GANs | 3139a73a4112d3f3f18182c9a6cdc2c671e7cfe8 | plotting.py | python | visualise_latent | (Z, identifier) | return True | visualise a SINGLE point in the latent space | visualise a SINGLE point in the latent space | [
"visualise",
"a",
"SINGLE",
"point",
"in",
"the",
"latent",
"space"
] | def visualise_latent(Z, identifier):
"""
visualise a SINGLE point in the latent space
"""
seq_length = Z.shape[0]
latent_dim = Z.shape[1]
if latent_dim > 2:
print('WARNING: Only visualising first two dimensions of latent space.')
h = np.random.random()
colours = np.array([hsv_to... | [
"def",
"visualise_latent",
"(",
"Z",
",",
"identifier",
")",
":",
"seq_length",
"=",
"Z",
".",
"shape",
"[",
"0",
"]",
"latent_dim",
"=",
"Z",
".",
"shape",
"[",
"1",
"]",
"if",
"latent_dim",
">",
"2",
":",
"print",
"(",
"'WARNING: Only visualising first... | https://github.com/LiDan456/MAD-GANs/blob/3139a73a4112d3f3f18182c9a6cdc2c671e7cfe8/plotting.py#L436-L452 | |
inspurer/WorkAttendanceSystem | 1221e2d67bdf5bb15fe99517cc3ded58ccb066df | V1.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/_vendor/distlib/_backport/shutil.py | python | copy | (src, dst) | Copy data and mode bits ("cp src dst").
The destination may be a directory. | Copy data and mode bits ("cp src dst"). | [
"Copy",
"data",
"and",
"mode",
"bits",
"(",
"cp",
"src",
"dst",
")",
"."
] | def copy(src, dst):
"""Copy data and mode bits ("cp src dst").
The destination may be a directory.
"""
if os.path.isdir(dst):
dst = os.path.join(dst, os.path.basename(src))
copyfile(src, dst)
copymode(src, dst) | [
"def",
"copy",
"(",
"src",
",",
"dst",
")",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"dst",
")",
":",
"dst",
"=",
"os",
".",
"path",
".",
"join",
"(",
"dst",
",",
"os",
".",
"path",
".",
"basename",
"(",
"src",
")",
")",
"copyfile",
... | https://github.com/inspurer/WorkAttendanceSystem/blob/1221e2d67bdf5bb15fe99517cc3ded58ccb066df/V1.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/_vendor/distlib/_backport/shutil.py#L130-L139 | ||
GeneralMills/pytrends | bac0caea18817630e98b503a38e9b445e7b5add1 | pytrends/dailydata.py | python | convert_dates_to_timeframe | (start: date, stop: date) | return f"{start.strftime('%Y-%m-%d')} {stop.strftime('%Y-%m-%d')}" | Given two dates, returns a stringified version of the interval between
the two dates which is used to retrieve data for a specific time frame
from Google Trends. | Given two dates, returns a stringified version of the interval between
the two dates which is used to retrieve data for a specific time frame
from Google Trends. | [
"Given",
"two",
"dates",
"returns",
"a",
"stringified",
"version",
"of",
"the",
"interval",
"between",
"the",
"two",
"dates",
"which",
"is",
"used",
"to",
"retrieve",
"data",
"for",
"a",
"specific",
"time",
"frame",
"from",
"Google",
"Trends",
"."
] | def convert_dates_to_timeframe(start: date, stop: date) -> str:
"""Given two dates, returns a stringified version of the interval between
the two dates which is used to retrieve data for a specific time frame
from Google Trends.
"""
return f"{start.strftime('%Y-%m-%d')} {stop.strftime('%Y-%m-%d')}" | [
"def",
"convert_dates_to_timeframe",
"(",
"start",
":",
"date",
",",
"stop",
":",
"date",
")",
"->",
"str",
":",
"return",
"f\"{start.strftime('%Y-%m-%d')} {stop.strftime('%Y-%m-%d')}\""
] | https://github.com/GeneralMills/pytrends/blob/bac0caea18817630e98b503a38e9b445e7b5add1/pytrends/dailydata.py#L21-L26 | |
thunlp/OpenNRE | dbc58f5da049cc97e6e9a9a750839d595ea38471 | opennre/encoder/pcnn_encoder.py | python | PCNNEncoder.forward | (self, token, pos1, pos2, mask) | return x | Args:
token: (B, L), index of tokens
pos1: (B, L), relative position to head entity
pos2: (B, L), relative position to tail entity
Return:
(B, EMBED), representations for sentences | Args:
token: (B, L), index of tokens
pos1: (B, L), relative position to head entity
pos2: (B, L), relative position to tail entity
Return:
(B, EMBED), representations for sentences | [
"Args",
":",
"token",
":",
"(",
"B",
"L",
")",
"index",
"of",
"tokens",
"pos1",
":",
"(",
"B",
"L",
")",
"relative",
"position",
"to",
"head",
"entity",
"pos2",
":",
"(",
"B",
"L",
")",
"relative",
"position",
"to",
"tail",
"entity",
"Return",
":",... | def forward(self, token, pos1, pos2, mask):
"""
Args:
token: (B, L), index of tokens
pos1: (B, L), relative position to head entity
pos2: (B, L), relative position to tail entity
Return:
(B, EMBED), representations for sentences
"""
... | [
"def",
"forward",
"(",
"self",
",",
"token",
",",
"pos1",
",",
"pos2",
",",
"mask",
")",
":",
"# Check size of tensors",
"if",
"len",
"(",
"token",
".",
"size",
"(",
")",
")",
"!=",
"2",
"or",
"token",
".",
"size",
"(",
")",
"!=",
"pos1",
".",
"s... | https://github.com/thunlp/OpenNRE/blob/dbc58f5da049cc97e6e9a9a750839d595ea38471/opennre/encoder/pcnn_encoder.py#L54-L80 | |
zlai0/MAST | a57b043ca597b9b7ef6842b1fa965c9f1ee71526 | models/submodule.py | python | conv3x3 | (in_planes, out_planes, stride=1, groups=1, dilation=1) | return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=dilation, groups=groups, bias=False, dilation=dilation) | 3x3 convolution with padding | 3x3 convolution with padding | [
"3x3",
"convolution",
"with",
"padding"
] | def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1):
"""3x3 convolution with padding"""
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=dilation, groups=groups, bias=False, dilation=dilation) | [
"def",
"conv3x3",
"(",
"in_planes",
",",
"out_planes",
",",
"stride",
"=",
"1",
",",
"groups",
"=",
"1",
",",
"dilation",
"=",
"1",
")",
":",
"return",
"nn",
".",
"Conv2d",
"(",
"in_planes",
",",
"out_planes",
",",
"kernel_size",
"=",
"3",
",",
"stri... | https://github.com/zlai0/MAST/blob/a57b043ca597b9b7ef6842b1fa965c9f1ee71526/models/submodule.py#L353-L356 | |
OpenEndedGroup/Field | 4f7c8edfb01bb0ccc927b78d3c500f018a4ae37c | Contents/lib/python/javapath.py | python | isdir | (path) | return File(sys.getPath(path)).isDirectory() | Test whether a path is a directory | Test whether a path is a directory | [
"Test",
"whether",
"a",
"path",
"is",
"a",
"directory"
] | def isdir(path):
"""Test whether a path is a directory"""
path = _tostr(path, "isdir")
return File(sys.getPath(path)).isDirectory() | [
"def",
"isdir",
"(",
"path",
")",
":",
"path",
"=",
"_tostr",
"(",
"path",
",",
"\"isdir\"",
")",
"return",
"File",
"(",
"sys",
".",
"getPath",
"(",
"path",
")",
")",
".",
"isDirectory",
"(",
")"
] | https://github.com/OpenEndedGroup/Field/blob/4f7c8edfb01bb0ccc927b78d3c500f018a4ae37c/Contents/lib/python/javapath.py#L115-L118 | |
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/cherrypy/cherrypy/wsgiserver/wsgiserver3.py | python | HTTPRequest.send_headers | (self) | Assert, process, and send the HTTP response message-headers.
You must set self.status, and self.outheaders before calling this. | Assert, process, and send the HTTP response message-headers.
You must set self.status, and self.outheaders before calling this. | [
"Assert",
"process",
"and",
"send",
"the",
"HTTP",
"response",
"message",
"-",
"headers",
".",
"You",
"must",
"set",
"self",
".",
"status",
"and",
"self",
".",
"outheaders",
"before",
"calling",
"this",
"."
] | def send_headers(self):
"""Assert, process, and send the HTTP response message-headers.
You must set self.status, and self.outheaders before calling this.
"""
hkeys = [key.lower() for key, value in self.outheaders]
status = int(self.status[:3])
if status... | [
"def",
"send_headers",
"(",
"self",
")",
":",
"hkeys",
"=",
"[",
"key",
".",
"lower",
"(",
")",
"for",
"key",
",",
"value",
"in",
"self",
".",
"outheaders",
"]",
"status",
"=",
"int",
"(",
"self",
".",
"status",
"[",
":",
"3",
"]",
")",
"if",
"... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/cherrypy/cherrypy/wsgiserver/wsgiserver3.py#L882-L948 | ||
nortikin/sverchok | 7b460f01317c15f2681bfa3e337c5e7346f3711b | core/sockets.py | python | SvSocketCommon.hide_safe | (self) | return self.hide | It will hide even linked sockets | It will hide even linked sockets | [
"It",
"will",
"hide",
"even",
"linked",
"sockets"
] | def hide_safe(self):
"""It will hide even linked sockets"""
return self.hide | [
"def",
"hide_safe",
"(",
"self",
")",
":",
"return",
"self",
".",
"hide"
] | https://github.com/nortikin/sverchok/blob/7b460f01317c15f2681bfa3e337c5e7346f3711b/core/sockets.py#L372-L374 | |
ShivamSarodia/ShivyC | e7d72eff237e1ef49ec70333497348baf86be425 | shivyc/il_gen.py | python | SymbolTable.add_typedef | (self, identifier, ctype) | Add a type definition to the symbol table. | Add a type definition to the symbol table. | [
"Add",
"a",
"type",
"definition",
"to",
"the",
"symbol",
"table",
"."
] | def add_typedef(self, identifier, ctype):
"""Add a type definition to the symbol table."""
name = identifier.content
if name in self.tables[-1].vars:
old_ctype = self.tables[-1].vars[name]
if isinstance(old_ctype, ILValue):
err = f"'{name}' redeclared as ... | [
"def",
"add_typedef",
"(",
"self",
",",
"identifier",
",",
"ctype",
")",
":",
"name",
"=",
"identifier",
".",
"content",
"if",
"name",
"in",
"self",
".",
"tables",
"[",
"-",
"1",
"]",
".",
"vars",
":",
"old_ctype",
"=",
"self",
".",
"tables",
"[",
... | https://github.com/ShivamSarodia/ShivyC/blob/e7d72eff237e1ef49ec70333497348baf86be425/shivyc/il_gen.py#L316-L331 | ||
ladybug-tools/butterfly | c8fc0bbe317bb41bfe5f28305782a82347b8c776 | butterfly/solution.py | python | SolutionParameter.isSolutionParameter | (self) | return True | Return True. | Return True. | [
"Return",
"True",
"."
] | def isSolutionParameter(self):
"""Return True."""
return True | [
"def",
"isSolutionParameter",
"(",
"self",
")",
":",
"return",
"True"
] | https://github.com/ladybug-tools/butterfly/blob/c8fc0bbe317bb41bfe5f28305782a82347b8c776/butterfly/solution.py#L397-L399 | |
GNS3/gns3-gui | da8adbaa18ab60e053af2a619efd468f4c8950f3 | gns3/main_window.py | python | MainWindow.openProjectActionSlot | (self) | Slot called to open a project. | Slot called to open a project. | [
"Slot",
"called",
"to",
"open",
"a",
"project",
"."
] | def openProjectActionSlot(self):
"""
Slot called to open a project.
"""
if Controller.instance().isRemote():
# If the server is remote we use the new project windows with the project library
self._newProjectActionSlot()
else:
directory = self.... | [
"def",
"openProjectActionSlot",
"(",
"self",
")",
":",
"if",
"Controller",
".",
"instance",
"(",
")",
".",
"isRemote",
"(",
")",
":",
"# If the server is remote we use the new project windows with the project library",
"self",
".",
"_newProjectActionSlot",
"(",
")",
"el... | https://github.com/GNS3/gns3-gui/blob/da8adbaa18ab60e053af2a619efd468f4c8950f3/gns3/main_window.py#L419-L436 | ||
MegEngine/Models | 4c55d28bad03652a4e352bf5e736a75df041d84a | official/nlp/bert/model.py | python | transpose | (inp, a, b) | return inp.transpose(cur_shape) | [] | def transpose(inp, a, b):
cur_shape = list(range(0, inp.ndim))
cur_shape[a], cur_shape[b] = cur_shape[b], cur_shape[a]
return inp.transpose(cur_shape) | [
"def",
"transpose",
"(",
"inp",
",",
"a",
",",
"b",
")",
":",
"cur_shape",
"=",
"list",
"(",
"range",
"(",
"0",
",",
"inp",
".",
"ndim",
")",
")",
"cur_shape",
"[",
"a",
"]",
",",
"cur_shape",
"[",
"b",
"]",
"=",
"cur_shape",
"[",
"b",
"]",
"... | https://github.com/MegEngine/Models/blob/4c55d28bad03652a4e352bf5e736a75df041d84a/official/nlp/bert/model.py#L37-L40 | |||
visionml/pytracking | 3e6a8980db7a2275252abcc398ed0c2494f0ceab | ltr/models/loss/kl_regression.py | python | KLRegressionGrid.forward | (self, scores, gt_density, grid_dim=-1, grid_scale=1.0) | return L.mean() | Args:
scores: predicted score values
gt_density: probability density of the ground truth distribution
grid_dim: dimension(s) of the grid
grid_scale: area of one grid cell | Args:
scores: predicted score values
gt_density: probability density of the ground truth distribution
grid_dim: dimension(s) of the grid
grid_scale: area of one grid cell | [
"Args",
":",
"scores",
":",
"predicted",
"score",
"values",
"gt_density",
":",
"probability",
"density",
"of",
"the",
"ground",
"truth",
"distribution",
"grid_dim",
":",
"dimension",
"(",
"s",
")",
"of",
"the",
"grid",
"grid_scale",
":",
"area",
"of",
"one",... | def forward(self, scores, gt_density, grid_dim=-1, grid_scale=1.0):
"""Args:
scores: predicted score values
gt_density: probability density of the ground truth distribution
grid_dim: dimension(s) of the grid
grid_scale: area of one grid cell"""
score_corr... | [
"def",
"forward",
"(",
"self",
",",
"scores",
",",
"gt_density",
",",
"grid_dim",
"=",
"-",
"1",
",",
"grid_scale",
"=",
"1.0",
")",
":",
"score_corr",
"=",
"grid_scale",
"*",
"torch",
".",
"sum",
"(",
"scores",
"*",
"gt_density",
",",
"dim",
"=",
"g... | https://github.com/visionml/pytracking/blob/3e6a8980db7a2275252abcc398ed0c2494f0ceab/ltr/models/loss/kl_regression.py#L59-L70 | |
dagwieers/mrepo | a55cbc737d8bade92070d38e4dbb9a24be4b477f | rhn/transports.py | python | BaseOutput.__init__ | (self, transfer=0, encoding=0, connection=None, method="POST") | [] | def __init__(self, transfer=0, encoding=0, connection=None, method="POST"):
# Assumes connection is an instance of HTTPConnection
if connection:
if not isinstance(connection, connections.HTTPConnection):
raise Exception("Expected an HTTPConnection type object")
self.... | [
"def",
"__init__",
"(",
"self",
",",
"transfer",
"=",
"0",
",",
"encoding",
"=",
"0",
",",
"connection",
"=",
"None",
",",
"method",
"=",
"\"POST\"",
")",
":",
"# Assumes connection is an instance of HTTPConnection",
"if",
"connection",
":",
"if",
"not",
"isin... | https://github.com/dagwieers/mrepo/blob/a55cbc737d8bade92070d38e4dbb9a24be4b477f/rhn/transports.py#L589-L617 | ||||
tosher/Mediawiker | 81bf97cace59bedcb1668e7830b85c36e014428e | lib/Crypto.lin.x64/Crypto/Hash/SHA3_384.py | python | SHA3_384_Hash.hexdigest | (self) | return "".join(["%02x" % bord(x) for x in self.digest()]) | Return the **printable** digest of the message that has been hashed so far.
:return: The hash digest, computed over the data processed so far.
Hexadecimal encoded.
:rtype: string | Return the **printable** digest of the message that has been hashed so far. | [
"Return",
"the",
"**",
"printable",
"**",
"digest",
"of",
"the",
"message",
"that",
"has",
"been",
"hashed",
"so",
"far",
"."
] | def hexdigest(self):
"""Return the **printable** digest of the message that has been hashed so far.
:return: The hash digest, computed over the data processed so far.
Hexadecimal encoded.
:rtype: string
"""
return "".join(["%02x" % bord(x) for x in self.digest(... | [
"def",
"hexdigest",
"(",
"self",
")",
":",
"return",
"\"\"",
".",
"join",
"(",
"[",
"\"%02x\"",
"%",
"bord",
"(",
"x",
")",
"for",
"x",
"in",
"self",
".",
"digest",
"(",
")",
"]",
")"
] | https://github.com/tosher/Mediawiker/blob/81bf97cace59bedcb1668e7830b85c36e014428e/lib/Crypto.lin.x64/Crypto/Hash/SHA3_384.py#L104-L112 | |
apache/libcloud | 90971e17bfd7b6bb97b2489986472c531cc8e140 | libcloud/loadbalancer/drivers/nttcis.py | python | NttCisLBDriver.list_protocols | (self) | return ["http", "https", "tcp", "udp", "ftp", "smtp"] | Return a list of supported protocols.
Since all protocols are support by NTTC-CIS, this is a list
of common protocols.
:rtype: ``list`` of ``str`` | Return a list of supported protocols. | [
"Return",
"a",
"list",
"of",
"supported",
"protocols",
"."
] | def list_protocols(self):
"""
Return a list of supported protocols.
Since all protocols are support by NTTC-CIS, this is a list
of common protocols.
:rtype: ``list`` of ``str``
"""
return ["http", "https", "tcp", "udp", "ftp", "smtp"] | [
"def",
"list_protocols",
"(",
"self",
")",
":",
"return",
"[",
"\"http\"",
",",
"\"https\"",
",",
"\"tcp\"",
",",
"\"udp\"",
",",
"\"ftp\"",
",",
"\"smtp\"",
"]"
] | https://github.com/apache/libcloud/blob/90971e17bfd7b6bb97b2489986472c531cc8e140/libcloud/loadbalancer/drivers/nttcis.py#L286-L295 | |
rootpy/rootpy | 3926935e1f2100d8ba68070c2ab44055d4800f73 | rootpy/stats/histfactory/utils.py | python | split_norm_shape | (histosys, nominal_hist) | return norm, shape | Split a HistoSys into normalization (OverallSys) and shape (HistoSys)
components.
It is recommended to use OverallSys as much as possible, which tries to
enforce continuity up to the second derivative during
interpolation/extrapolation. So, if there is indeed a shape variation, then
factorize it in... | Split a HistoSys into normalization (OverallSys) and shape (HistoSys)
components. | [
"Split",
"a",
"HistoSys",
"into",
"normalization",
"(",
"OverallSys",
")",
"and",
"shape",
"(",
"HistoSys",
")",
"components",
"."
] | def split_norm_shape(histosys, nominal_hist):
"""
Split a HistoSys into normalization (OverallSys) and shape (HistoSys)
components.
It is recommended to use OverallSys as much as possible, which tries to
enforce continuity up to the second derivative during
interpolation/extrapolation. So, if t... | [
"def",
"split_norm_shape",
"(",
"histosys",
",",
"nominal_hist",
")",
":",
"up",
"=",
"histosys",
".",
"GetHistoHigh",
"(",
")",
"dn",
"=",
"histosys",
".",
"GetHistoLow",
"(",
")",
"up",
"=",
"up",
".",
"Clone",
"(",
"name",
"=",
"up",
".",
"name",
... | https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/stats/histfactory/utils.py#L357-L382 | |
nipy/nipy | d16d268938dcd5c15748ca051532c21f57cf8a22 | nipy/core/reference/coordinate_map.py | python | AffineTransform.renamed_range | (self, newnames, name='') | return renamed_range(self, newnames) | New AffineTransform with renamed function_domain
Parameters
----------
newnames : dict
A dictionary whose keys are integers or are in
mapping.function_range.coord_names and whose values are the
new names.
Returns
-------
newmapping : Aff... | New AffineTransform with renamed function_domain | [
"New",
"AffineTransform",
"with",
"renamed",
"function_domain"
] | def renamed_range(self, newnames, name=''):
""" New AffineTransform with renamed function_domain
Parameters
----------
newnames : dict
A dictionary whose keys are integers or are in
mapping.function_range.coord_names and whose values are the
new names.
... | [
"def",
"renamed_range",
"(",
"self",
",",
"newnames",
",",
"name",
"=",
"''",
")",
":",
"return",
"renamed_range",
"(",
"self",
",",
"newnames",
")"
] | https://github.com/nipy/nipy/blob/d16d268938dcd5c15748ca051532c21f57cf8a22/nipy/core/reference/coordinate_map.py#L897-L928 | |
IdentityPython/pysaml2 | 6badb32d212257bd83ffcc816f9b625f68281b47 | src/saml2/xmldsig/__init__.py | python | key_value_from_string | (xml_string) | return saml2.create_class_from_xml_string(KeyValue, xml_string) | [] | def key_value_from_string(xml_string):
return saml2.create_class_from_xml_string(KeyValue, xml_string) | [
"def",
"key_value_from_string",
"(",
"xml_string",
")",
":",
"return",
"saml2",
".",
"create_class_from_xml_string",
"(",
"KeyValue",
",",
"xml_string",
")"
] | https://github.com/IdentityPython/pysaml2/blob/6badb32d212257bd83ffcc816f9b625f68281b47/src/saml2/xmldsig/__init__.py#L1270-L1271 | |||
sydney0zq/PTSNet | 1a9be3eb12216be354a77294cde75f330d278796 | coupled_otn_opn/tracking/maskrcnn/lib/model/utils/net_utils.py | python | _crop_pool_layer | (bottom, rois, max_pool=True) | return crops, grid | [ x2-x1 x1 + x2 - W + 1 ]
[ ----- 0 --------------- ]
[ W - 1 W - 1 ]
[ ]
[ y2-y1 y1 + y2 - H + 1 ]
[ 0 ----- --------------- ]
[ H - 1 H - 1 ] | [ x2-x1 x1 + x2 - W + 1 ]
[ ----- 0 --------------- ]
[ W - 1 W - 1 ]
[ ]
[ y2-y1 y1 + y2 - H + 1 ]
[ 0 ----- --------------- ]
[ H - 1 H - 1 ] | [
"[",
"x2",
"-",
"x1",
"x1",
"+",
"x2",
"-",
"W",
"+",
"1",
"]",
"[",
"-----",
"0",
"---------------",
"]",
"[",
"W",
"-",
"1",
"W",
"-",
"1",
"]",
"[",
"]",
"[",
"y2",
"-",
"y1",
"y1",
"+",
"y2",
"-",
"H",
"+",
"1",
"]",
"[",
"0",
"--... | def _crop_pool_layer(bottom, rois, max_pool=True):
# code modified from
# https://github.com/ruotianluo/pytorch-faster-rcnn
# implement it using stn
# box to affine
# input (x1,y1,x2,y2)
"""
[ x2-x1 x1 + x2 - W + 1 ]
[ ----- 0 --------------- ]
[ W - 1 ... | [
"def",
"_crop_pool_layer",
"(",
"bottom",
",",
"rois",
",",
"max_pool",
"=",
"True",
")",
":",
"# code modified from ",
"# https://github.com/ruotianluo/pytorch-faster-rcnn",
"# implement it using stn",
"# box to affine",
"# input (x1,y1,x2,y2)",
"rois",
"=",
"rois",
".",
"... | https://github.com/sydney0zq/PTSNet/blob/1a9be3eb12216be354a77294cde75f330d278796/coupled_otn_opn/tracking/maskrcnn/lib/model/utils/net_utils.py#L38-L90 | |
art-programmer/PlaneNet | ccc4423d278388d01cb3300be992b951b90acc7a | code/html.py | python | TestCase.test_iadd_tag | (self) | test iadd'ing a tag | test iadd'ing a tag | [
"test",
"iadd",
"ing",
"a",
"tag"
] | def test_iadd_tag(self):
"test iadd'ing a tag"
h = XML('xml')
h += XML('some-tag', 'spam', newlines=False)
h += XML('text', 'spam', newlines=False)
self.assertEquals(str(h),
'<xml>\n<some-tag>spam</some-tag>\n<text>spam</text>\n</xml>') | [
"def",
"test_iadd_tag",
"(",
"self",
")",
":",
"h",
"=",
"XML",
"(",
"'xml'",
")",
"h",
"+=",
"XML",
"(",
"'some-tag'",
",",
"'spam'",
",",
"newlines",
"=",
"False",
")",
"h",
"+=",
"XML",
"(",
"'text'",
",",
"'spam'",
",",
"newlines",
"=",
"False"... | https://github.com/art-programmer/PlaneNet/blob/ccc4423d278388d01cb3300be992b951b90acc7a/code/html.py#L435-L441 | ||
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/cheroot/makefile.py | python | BufferedWriter.write | (self, b) | Write bytes to buffer. | Write bytes to buffer. | [
"Write",
"bytes",
"to",
"buffer",
"."
] | def write(self, b):
"""Write bytes to buffer."""
self._checkClosed()
if isinstance(b, str):
raise TypeError("can't write str to binary stream")
with self._write_lock:
self._write_buf.extend(b)
self._flush_unlocked()
return len(b) | [
"def",
"write",
"(",
"self",
",",
"b",
")",
":",
"self",
".",
"_checkClosed",
"(",
")",
"if",
"isinstance",
"(",
"b",
",",
"str",
")",
":",
"raise",
"TypeError",
"(",
"\"can't write str to binary stream\"",
")",
"with",
"self",
".",
"_write_lock",
":",
"... | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/cheroot/makefile.py#L28-L37 | ||
iclavera/learning_to_adapt | bd7d99ba402521c96631e7d09714128f549db0f1 | learning_to_adapt/envs/mujoco_env.py | python | MujocoEnv.start_viewer | (self) | [] | def start_viewer(self):
viewer = self.get_viewer()
if not viewer.running:
viewer.start() | [
"def",
"start_viewer",
"(",
"self",
")",
":",
"viewer",
"=",
"self",
".",
"get_viewer",
"(",
")",
"if",
"not",
"viewer",
".",
"running",
":",
"viewer",
".",
"start",
"(",
")"
] | https://github.com/iclavera/learning_to_adapt/blob/bd7d99ba402521c96631e7d09714128f549db0f1/learning_to_adapt/envs/mujoco_env.py#L193-L196 | ||||
aio-libs/aioredis-py | 56d6b325ee246a3eb0fc8bb6803247c86bb2f494 | aioredis/client.py | python | PubSub.execute_command | (self, *args: EncodableT) | Execute a publish/subscribe command | Execute a publish/subscribe command | [
"Execute",
"a",
"publish",
"/",
"subscribe",
"command"
] | async def execute_command(self, *args: EncodableT):
"""Execute a publish/subscribe command"""
# NOTE: don't parse the response in this function -- it could pull a
# legitimate message off the stack if the connection is already
# subscribed to one or more channels
if self.connec... | [
"async",
"def",
"execute_command",
"(",
"self",
",",
"*",
"args",
":",
"EncodableT",
")",
":",
"# NOTE: don't parse the response in this function -- it could pull a",
"# legitimate message off the stack if the connection is already",
"# subscribed to one or more channels",
"if",
"sel... | https://github.com/aio-libs/aioredis-py/blob/56d6b325ee246a3eb0fc8bb6803247c86bb2f494/aioredis/client.py#L4007-L4023 | ||
facebookresearch/ParlAI | e4d59c30eef44f1f67105961b82a83fd28d7d78b | parlai/tasks/multiwoz_v22/agents.py | python | MultiwozV22Parser._get_find_api_response | (self, intent, raw_slots, sys_dialog_act) | return results | Get an API response out of the lookup databases. | Get an API response out of the lookup databases. | [
"Get",
"an",
"API",
"response",
"out",
"of",
"the",
"lookup",
"databases",
"."
] | def _get_find_api_response(self, intent, raw_slots, sys_dialog_act):
"""
Get an API response out of the lookup databases.
"""
domain = ""
for cand in DOMAINS:
if cand in intent:
domain = cand
if domain == "taxi": # handle separately cause funk... | [
"def",
"_get_find_api_response",
"(",
"self",
",",
"intent",
",",
"raw_slots",
",",
"sys_dialog_act",
")",
":",
"domain",
"=",
"\"\"",
"for",
"cand",
"in",
"DOMAINS",
":",
"if",
"cand",
"in",
"intent",
":",
"domain",
"=",
"cand",
"if",
"domain",
"==",
"\... | https://github.com/facebookresearch/ParlAI/blob/e4d59c30eef44f1f67105961b82a83fd28d7d78b/parlai/tasks/multiwoz_v22/agents.py#L159-L216 | |
geometalab/Vector-Tiles-Reader-QGIS-Plugin | a31ae86959c8f3b7d6f332f84191cd7ca4683e1d | ext-libs/shapely/geometry/polygon.py | python | geos_polygon_from_py | (shell, holes=None) | [] | def geos_polygon_from_py(shell, holes=None):
if shell is None:
return None
if isinstance(shell, Polygon):
return geos_geom_from_py(shell)
if shell is not None:
ret = geos_linearring_from_py(shell)
if ret is None:
return None
geos_shell, ndim = ret
... | [
"def",
"geos_polygon_from_py",
"(",
"shell",
",",
"holes",
"=",
"None",
")",
":",
"if",
"shell",
"is",
"None",
":",
"return",
"None",
"if",
"isinstance",
"(",
"shell",
",",
"Polygon",
")",
":",
"return",
"geos_geom_from_py",
"(",
"shell",
")",
"if",
"she... | https://github.com/geometalab/Vector-Tiles-Reader-QGIS-Plugin/blob/a31ae86959c8f3b7d6f332f84191cd7ca4683e1d/ext-libs/shapely/geometry/polygon.py#L485-L525 | ||||
caiiiac/Machine-Learning-with-Python | 1a26c4467da41ca4ebc3d5bd789ea942ef79422f | MachineLearning/venv/lib/python3.5/site-packages/scipy/io/matlab/miobase.py | python | MatFileReader.__init__ | (self, mat_stream,
byte_order=None,
mat_dtype=False,
squeeze_me=False,
chars_as_strings=True,
matlab_compatible=False,
struct_as_record=True,
verify_compressed_data_integrity=True
) | Initializer for mat file reader
mat_stream : file-like
object with file API, open for reading
%(load_args)s | Initializer for mat file reader | [
"Initializer",
"for",
"mat",
"file",
"reader"
] | def __init__(self, mat_stream,
byte_order=None,
mat_dtype=False,
squeeze_me=False,
chars_as_strings=True,
matlab_compatible=False,
struct_as_record=True,
verify_compressed_data_integrity=True
... | [
"def",
"__init__",
"(",
"self",
",",
"mat_stream",
",",
"byte_order",
"=",
"None",
",",
"mat_dtype",
"=",
"False",
",",
"squeeze_me",
"=",
"False",
",",
"chars_as_strings",
"=",
"True",
",",
"matlab_compatible",
"=",
"False",
",",
"struct_as_record",
"=",
"T... | https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/scipy/io/matlab/miobase.py#L346-L377 | ||
google/clusterfuzz | f358af24f414daa17a3649b143e71ea71871ef59 | src/clusterfuzz/_internal/bot/tokenizer/antlr_tokenizer.py | python | AntlrTokenizer.fill | (self, stream) | return i | Helper function. antlr4.CommonTokenStream.fill should work, but
it does not fetch all of the tokens. This is a replacement that works. | Helper function. antlr4.CommonTokenStream.fill should work, but
it does not fetch all of the tokens. This is a replacement that works. | [
"Helper",
"function",
".",
"antlr4",
".",
"CommonTokenStream",
".",
"fill",
"should",
"work",
"but",
"it",
"does",
"not",
"fetch",
"all",
"of",
"the",
"tokens",
".",
"This",
"is",
"a",
"replacement",
"that",
"works",
"."
] | def fill(self, stream):
"""Helper function. antlr4.CommonTokenStream.fill should work, but
it does not fetch all of the tokens. This is a replacement that works."""
i = 0
while stream.fetch(1):
i += 1
return i | [
"def",
"fill",
"(",
"self",
",",
"stream",
")",
":",
"i",
"=",
"0",
"while",
"stream",
".",
"fetch",
"(",
"1",
")",
":",
"i",
"+=",
"1",
"return",
"i"
] | https://github.com/google/clusterfuzz/blob/f358af24f414daa17a3649b143e71ea71871ef59/src/clusterfuzz/_internal/bot/tokenizer/antlr_tokenizer.py#L30-L36 | |
SpockBotMC/SpockBot | f89911551f18357720034fbaa52837a0d09f66ea | spockbot/mcp/mcpacket.py | python | Packet.new_ident | (self, ident) | [] | def new_ident(self, ident):
self.__init__(ident, self.data) | [
"def",
"new_ident",
"(",
"self",
",",
"ident",
")",
":",
"self",
".",
"__init__",
"(",
"ident",
",",
"self",
".",
"data",
")"
] | https://github.com/SpockBotMC/SpockBot/blob/f89911551f18357720034fbaa52837a0d09f66ea/spockbot/mcp/mcpacket.py#L45-L46 | ||||
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-linux/x64/tornado/template.py | python | _IncludeBlock.find_named_blocks | (
self, loader: Optional[BaseLoader], named_blocks: Dict[str, _NamedBlock]
) | [] | def find_named_blocks(
self, loader: Optional[BaseLoader], named_blocks: Dict[str, _NamedBlock]
) -> None:
assert loader is not None
included = loader.load(self.name, self.template_name)
included.file.find_named_blocks(loader, named_blocks) | [
"def",
"find_named_blocks",
"(",
"self",
",",
"loader",
":",
"Optional",
"[",
"BaseLoader",
"]",
",",
"named_blocks",
":",
"Dict",
"[",
"str",
",",
"_NamedBlock",
"]",
")",
"->",
"None",
":",
"assert",
"loader",
"is",
"not",
"None",
"included",
"=",
"loa... | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-linux/x64/tornado/template.py#L580-L585 | ||||
Jenyay/outwiker | 50530cf7b3f71480bb075b2829bc0669773b835b | src/outwiker/core/spellchecker/spelldict.py | python | create_new_dic_file | (dic_file: str) | Create .dic file if it is not exists | Create .dic file if it is not exists | [
"Create",
".",
"dic",
"file",
"if",
"it",
"is",
"not",
"exists"
] | def create_new_dic_file(dic_file: str):
'''
Create .dic file if it is not exists
'''
if not os.path.exists(dic_file):
logger.debug('Create .dic file: {}'.format(dic_file))
with open(dic_file, 'w', encoding='utf8') as fp:
fp.write('1\ntest') | [
"def",
"create_new_dic_file",
"(",
"dic_file",
":",
"str",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"dic_file",
")",
":",
"logger",
".",
"debug",
"(",
"'Create .dic file: {}'",
".",
"format",
"(",
"dic_file",
")",
")",
"with",
"open"... | https://github.com/Jenyay/outwiker/blob/50530cf7b3f71480bb075b2829bc0669773b835b/src/outwiker/core/spellchecker/spelldict.py#L40-L47 | ||
pytorch/fairseq | 1575f30dd0a9f7b3c499db0b4767aa4e9f79056c | fairseq/search.py | python | Sampling._sample_topp | (self, lprobs) | return trimed_probs, truncated_indices | Sample among the smallest set of elements whose cumulative probability mass exceeds p.
See `"The Curious Case of Neural Text Degeneration"
(Holtzman et al., 2019) <https://arxiv.org/abs/1904.09751>`_.
Args:
lprobs: (bsz x input_beam_size x vocab_size)
the model's lo... | Sample among the smallest set of elements whose cumulative probability mass exceeds p. | [
"Sample",
"among",
"the",
"smallest",
"set",
"of",
"elements",
"whose",
"cumulative",
"probability",
"mass",
"exceeds",
"p",
"."
] | def _sample_topp(self, lprobs):
"""Sample among the smallest set of elements whose cumulative probability mass exceeds p.
See `"The Curious Case of Neural Text Degeneration"
(Holtzman et al., 2019) <https://arxiv.org/abs/1904.09751>`_.
Args:
lprobs: (bsz x input_beam_size x... | [
"def",
"_sample_topp",
"(",
"self",
",",
"lprobs",
")",
":",
"probs",
"=",
"lprobs",
".",
"exp_",
"(",
")",
"# sort the last dimension (vocab dimension) in descending order",
"sorted_probs",
",",
"sorted_indices",
"=",
"probs",
".",
"sort",
"(",
"descending",
"=",
... | https://github.com/pytorch/fairseq/blob/1575f30dd0a9f7b3c499db0b4767aa4e9f79056c/fairseq/search.py#L630-L673 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/combinat/dyck_word.py | python | replace_symbols | (x) | r"""
A map sending ``open_symbol`` to ``'('`` and ``close_symbol`` to ``')'``,
and raising an error on any input other than ``open_symbol`` and
``close_symbol``. The values of the constants ``open_symbol``
and ``close_symbol`` are subject to change.
This is the inverse map of :func:`replace_parens`... | r"""
A map sending ``open_symbol`` to ``'('`` and ``close_symbol`` to ``')'``,
and raising an error on any input other than ``open_symbol`` and
``close_symbol``. The values of the constants ``open_symbol``
and ``close_symbol`` are subject to change. | [
"r",
"A",
"map",
"sending",
"open_symbol",
"to",
"(",
"and",
"close_symbol",
"to",
")",
"and",
"raising",
"an",
"error",
"on",
"any",
"input",
"other",
"than",
"open_symbol",
"and",
"close_symbol",
".",
"The",
"values",
"of",
"the",
"constants",
"open_symbol... | def replace_symbols(x):
r"""
A map sending ``open_symbol`` to ``'('`` and ``close_symbol`` to ``')'``,
and raising an error on any input other than ``open_symbol`` and
``close_symbol``. The values of the constants ``open_symbol``
and ``close_symbol`` are subject to change.
This is the inverse m... | [
"def",
"replace_symbols",
"(",
"x",
")",
":",
"if",
"x",
"==",
"open_symbol",
":",
"return",
"'('",
"if",
"x",
"==",
"close_symbol",
":",
"return",
"')'",
"raise",
"ValueError"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/dyck_word.py#L150-L190 | ||
pypa/setuptools | 9f37366aab9cd8f6baa23e6a77cfdb8daf97757e | pkg_resources/__init__.py | python | NullProvider._get | (self, path) | [] | def _get(self, path):
if hasattr(self.loader, 'get_data'):
return self.loader.get_data(path)
raise NotImplementedError(
"Can't perform this operation for loaders without 'get_data()'"
) | [
"def",
"_get",
"(",
"self",
",",
"path",
")",
":",
"if",
"hasattr",
"(",
"self",
".",
"loader",
",",
"'get_data'",
")",
":",
"return",
"self",
".",
"loader",
".",
"get_data",
"(",
"path",
")",
"raise",
"NotImplementedError",
"(",
"\"Can't perform this oper... | https://github.com/pypa/setuptools/blob/9f37366aab9cd8f6baa23e6a77cfdb8daf97757e/pkg_resources/__init__.py#L1558-L1563 | ||||
pyamg/pyamg | e3fb6feaad2358e681f2f4affae3205bfe9a2350 | pyamg/aggregation/rootnode.py | python | rootnode_solver | (A, B=None, BH=None,
symmetry='hermitian', strength='symmetric',
aggregate='standard', smooth='energy',
presmoother=('block_gauss_seidel',
{'sweep': 'symmetric'}),
postsmoother=('block_gauss_seidel',
... | return ml | Create a multilevel solver using root-node based Smoothed Aggregation (SA).
See the notes below, for the major differences with the classical-style
smoothed aggregation solver in aggregation.smoothed_aggregation_solver.
Parameters
----------
A : csr_matrix, bsr_matrix
Sparse NxN matrix in ... | Create a multilevel solver using root-node based Smoothed Aggregation (SA). | [
"Create",
"a",
"multilevel",
"solver",
"using",
"root",
"-",
"node",
"based",
"Smoothed",
"Aggregation",
"(",
"SA",
")",
"."
] | def rootnode_solver(A, B=None, BH=None,
symmetry='hermitian', strength='symmetric',
aggregate='standard', smooth='energy',
presmoother=('block_gauss_seidel',
{'sweep': 'symmetric'}),
postsmoother=('block_gau... | [
"def",
"rootnode_solver",
"(",
"A",
",",
"B",
"=",
"None",
",",
"BH",
"=",
"None",
",",
"symmetry",
"=",
"'hermitian'",
",",
"strength",
"=",
"'symmetric'",
",",
"aggregate",
"=",
"'standard'",
",",
"smooth",
"=",
"'energy'",
",",
"presmoother",
"=",
"("... | https://github.com/pyamg/pyamg/blob/e3fb6feaad2358e681f2f4affae3205bfe9a2350/pyamg/aggregation/rootnode.py#L26-L306 | |
schutzwerk/CANalyzat0r | 6bc251e69f73d9f8554bcc6134354e18ab8ca426 | src/Database.py | python | Database.checkDB | (self) | Checks if all the table count of the SQLite database matches the needed table count.
If the check does pass the user will be notified to create a project if no project is exisiting yet.
If the check does not pass the user will be prompted for an action:
- Truncate the database and create an empt... | Checks if all the table count of the SQLite database matches the needed table count.
If the check does pass the user will be notified to create a project if no project is exisiting yet.
If the check does not pass the user will be prompted for an action:
- Truncate the database and create an empt... | [
"Checks",
"if",
"all",
"the",
"table",
"count",
"of",
"the",
"SQLite",
"database",
"matches",
"the",
"needed",
"table",
"count",
".",
"If",
"the",
"check",
"does",
"pass",
"the",
"user",
"will",
"be",
"notified",
"to",
"create",
"a",
"project",
"if",
"no... | def checkDB(self):
"""
Checks if all the table count of the SQLite database matches the needed table count.
If the check does pass the user will be notified to create a project if no project is exisiting yet.
If the check does not pass the user will be prompted for an action:
- T... | [
"def",
"checkDB",
"(",
"self",
")",
":",
"cursor",
"=",
"self",
".",
"connection",
".",
"cursor",
"(",
")",
"cursor",
".",
"execute",
"(",
"DatabaseStatements",
".",
"checkTablesPresentStatement",
")",
"data",
"=",
"cursor",
".",
"fetchall",
"(",
")",
"# A... | https://github.com/schutzwerk/CANalyzat0r/blob/6bc251e69f73d9f8554bcc6134354e18ab8ca426/src/Database.py#L369-L421 | ||
kcunning/Katie-s-Rougish-PyGame | 1b299ebc27e5f68a25b2e0462845f0b4423ebbbe | roguey/classes/gamescreen.py | python | GameScreen.draw_background | (self) | Draws my glorious background. | Draws my glorious background. | [
"Draws",
"my",
"glorious",
"background",
"."
] | def draw_background(self):
''' Draws my glorious background.
'''
self.screen.blit(self.bg, (0,0)) | [
"def",
"draw_background",
"(",
"self",
")",
":",
"self",
".",
"screen",
".",
"blit",
"(",
"self",
".",
"bg",
",",
"(",
"0",
",",
"0",
")",
")"
] | https://github.com/kcunning/Katie-s-Rougish-PyGame/blob/1b299ebc27e5f68a25b2e0462845f0b4423ebbbe/roguey/classes/gamescreen.py#L151-L154 | ||
captainhammy/Houdini-Toolbox | a4e61c3c0296b3a3a153a8dd42297c316be1b0f3 | houdini/pyfilter/ht-pyfilter.py | python | filterQuit | () | Perform actions just before Mantra quits. | Perform actions just before Mantra quits. | [
"Perform",
"actions",
"just",
"before",
"Mantra",
"quits",
"."
] | def filterQuit():
"""Perform actions just before Mantra quits."""
_logger.debug("filterQuit")
_PYFILTER_MANAGER.run_operations_for_stage("filter_quit") | [
"def",
"filterQuit",
"(",
")",
":",
"_logger",
".",
"debug",
"(",
"\"filterQuit\"",
")",
"_PYFILTER_MANAGER",
".",
"run_operations_for_stage",
"(",
"\"filter_quit\"",
")"
] | https://github.com/captainhammy/Houdini-Toolbox/blob/a4e61c3c0296b3a3a153a8dd42297c316be1b0f3/houdini/pyfilter/ht-pyfilter.py#L180-L184 | ||
Scifabric/pybossa | fd87953c067a94ae211cd8771d4eead130ef3c64 | pybossa/view/account.py | python | delete | (name) | Delete user account. | Delete user account. | [
"Delete",
"user",
"account",
"."
] | def delete(name):
"""
Delete user account.
"""
user = user_repo.get_by_name(name)
if not user:
return abort(404)
if current_user.name != name:
return abort(403)
super_queue.enqueue(delete_account, user.id)
if (request.headers.get('Content-Type') == 'application/json' or... | [
"def",
"delete",
"(",
"name",
")",
":",
"user",
"=",
"user_repo",
".",
"get_by_name",
"(",
"name",
")",
"if",
"not",
"user",
":",
"return",
"abort",
"(",
"404",
")",
"if",
"current_user",
".",
"name",
"!=",
"name",
":",
"return",
"abort",
"(",
"403",... | https://github.com/Scifabric/pybossa/blob/fd87953c067a94ae211cd8771d4eead130ef3c64/pybossa/view/account.py#L872-L890 | ||
saturday06/VRM_Addon_for_Blender | 0fc59703bb203dca760501221d34ecc4a566e64f | io_scene_vrm/editor/mesh_from_bone_envelopes.py | python | ICYP_OT_make_mesh_from_bone_envelopes.poll | (cls, _context: bpy.types.Context) | return True | [] | def poll(cls, _context: bpy.types.Context) -> bool:
return True | [
"def",
"poll",
"(",
"cls",
",",
"_context",
":",
"bpy",
".",
"types",
".",
"Context",
")",
"->",
"bool",
":",
"return",
"True"
] | https://github.com/saturday06/VRM_Addon_for_Blender/blob/0fc59703bb203dca760501221d34ecc4a566e64f/io_scene_vrm/editor/mesh_from_bone_envelopes.py#L17-L18 | |||
angr/angr | 4b04d56ace135018083d36d9083805be8146688b | angr/engines/vex/claripy/ccall.py | python | x86g_calculate_daa_das_aaa_aas | (state, flags_and_AX, opcode) | return result | [] | def x86g_calculate_daa_das_aaa_aas(state, flags_and_AX, opcode):
assert len(flags_and_AX) == 32
assert opcode.op == 'BVV'
opcode = opcode.args[0]
r_O = flags_and_AX[data['X86']['CondBitOffsets']['G_CC_SHIFT_O'] + 16].zero_extend(31)
r_S = flags_and_AX[data['X86']['CondBitOffsets']['G_CC_SHIFT_S']... | [
"def",
"x86g_calculate_daa_das_aaa_aas",
"(",
"state",
",",
"flags_and_AX",
",",
"opcode",
")",
":",
"assert",
"len",
"(",
"flags_and_AX",
")",
"==",
"32",
"assert",
"opcode",
".",
"op",
"==",
"'BVV'",
"opcode",
"=",
"opcode",
".",
"args",
"[",
"0",
"]",
... | https://github.com/angr/angr/blob/4b04d56ace135018083d36d9083805be8146688b/angr/engines/vex/claripy/ccall.py#L1109-L1190 | |||
zhaoolee/StarsAndClown | b2d4039cad2f9232b691e5976f787b49a0a2c113 | node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py | python | _EscapeEnvironmentVariableExpansion | (s) | return s | Escapes % characters.
Escapes any % characters so that Windows-style environment variable
expansions will leave them alone.
See http://connect.microsoft.com/VisualStudio/feedback/details/106127/cl-d-name-text-containing-percentage-characters-doesnt-compile
to understand why we have to do this.
Args:
s... | Escapes % characters. | [
"Escapes",
"%",
"characters",
"."
] | def _EscapeEnvironmentVariableExpansion(s):
"""Escapes % characters.
Escapes any % characters so that Windows-style environment variable
expansions will leave them alone.
See http://connect.microsoft.com/VisualStudio/feedback/details/106127/cl-d-name-text-containing-percentage-characters-doesnt-compile
to un... | [
"def",
"_EscapeEnvironmentVariableExpansion",
"(",
"s",
")",
":",
"s",
"=",
"s",
".",
"replace",
"(",
"'%'",
",",
"'%%'",
")",
"return",
"s"
] | https://github.com/zhaoolee/StarsAndClown/blob/b2d4039cad2f9232b691e5976f787b49a0a2c113/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py#L664-L679 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.