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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
linxid/Machine_Learning_Study_Path | 558e82d13237114bbb8152483977806fc0c222af | Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/response.py | python | HTTPResponse.tell | (self) | return self._fp_bytes_read | Obtain the number of bytes pulled over the wire so far. May differ from
the amount of content returned by :meth:``HTTPResponse.read`` if bytes
are encoded on the wire (e.g, compressed). | Obtain the number of bytes pulled over the wire so far. May differ from
the amount of content returned by :meth:``HTTPResponse.read`` if bytes
are encoded on the wire (e.g, compressed). | [
"Obtain",
"the",
"number",
"of",
"bytes",
"pulled",
"over",
"the",
"wire",
"so",
"far",
".",
"May",
"differ",
"from",
"the",
"amount",
"of",
"content",
"returned",
"by",
":",
"meth",
":",
"HTTPResponse",
".",
"read",
"if",
"bytes",
"are",
"encoded",
"on"... | def tell(self):
"""
Obtain the number of bytes pulled over the wire so far. May differ from
the amount of content returned by :meth:``HTTPResponse.read`` if bytes
are encoded on the wire (e.g, compressed).
"""
return self._fp_bytes_read | [
"def",
"tell",
"(",
"self",
")",
":",
"return",
"self",
".",
"_fp_bytes_read"
] | https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/response.py#L172-L178 | |
EtienneCmb/visbrain | b599038e095919dc193b12d5e502d127de7d03c9 | visbrain/gui/brain/interface/ui_elements/ui_connectivity.py | python | UiConnectivity._fcn_connect_lw | (self) | Update line width. | Update line width. | [
"Update",
"line",
"width",
"."
] | def _fcn_connect_lw(self):
"""Update line width."""
self._get_select_object().line_width = self._c_line_width.value() | [
"def",
"_fcn_connect_lw",
"(",
"self",
")",
":",
"self",
".",
"_get_select_object",
"(",
")",
".",
"line_width",
"=",
"self",
".",
"_c_line_width",
".",
"value",
"(",
")"
] | https://github.com/EtienneCmb/visbrain/blob/b599038e095919dc193b12d5e502d127de7d03c9/visbrain/gui/brain/interface/ui_elements/ui_connectivity.py#L85-L87 | ||
ArduPilot/ardupilot_wiki | 0a4c3988fa77bd9774fb7e0309f072660e259414 | build_parameters.py | python | generate_rst_files | (commits_to_checkout_and_parse) | return 0 | For each git hash it generates its Parameters file. | For each git hash it generates its Parameters file. | [
"For",
"each",
"git",
"hash",
"it",
"generates",
"its",
"Parameters",
"file",
"."
] | def generate_rst_files(commits_to_checkout_and_parse):
"""
For each git hash it generates its Parameters file.
"""
def replace_anchors(source_file, dest_file, version_tag):
"""
For each parameter file generate by param_parse.py, it inserts a version tag in anchors to do not make co... | [
"def",
"generate_rst_files",
"(",
"commits_to_checkout_and_parse",
")",
":",
"def",
"replace_anchors",
"(",
"source_file",
",",
"dest_file",
",",
"version_tag",
")",
":",
"\"\"\"\n For each parameter file generate by param_parse.py, it inserts a version tag in anchors to do no... | https://github.com/ArduPilot/ardupilot_wiki/blob/0a4c3988fa77bd9774fb7e0309f072660e259414/build_parameters.py#L310-L411 | |
out0fmemory/GoAgent-Always-Available | c4254984fea633ce3d1893fe5901debd9f22c2a9 | server/lib/google/appengine/_internal/antlr3/tree.py | python | TreeAdaptor.setType | (self, t, type) | Node constructors can set the type of a node | Node constructors can set the type of a node | [
"Node",
"constructors",
"can",
"set",
"the",
"type",
"of",
"a",
"node"
] | def setType(self, t, type):
"""Node constructors can set the type of a node"""
raise NotImplementedError | [
"def",
"setType",
"(",
"self",
",",
"t",
",",
"type",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/out0fmemory/GoAgent-Always-Available/blob/c4254984fea633ce3d1893fe5901debd9f22c2a9/server/lib/google/appengine/_internal/antlr3/tree.py#L435-L438 | ||
pymedusa/Medusa | 1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38 | medusa/clients/torrent/deluged.py | python | DelugeDAPI.remove_ratio_reached | (self) | Remove all Medusa torrents that ratio was reached.
It loops in all hashes returned from client and check if it is in the snatch history
if its then it checks if we already processed media from the torrent (episode status `Downloaded`)
If is a RARed torrent then we don't have a media file so we ... | Remove all Medusa torrents that ratio was reached. | [
"Remove",
"all",
"Medusa",
"torrents",
"that",
"ratio",
"was",
"reached",
"."
] | def remove_ratio_reached(self):
"""Remove all Medusa torrents that ratio was reached.
It loops in all hashes returned from client and check if it is in the snatch history
if its then it checks if we already processed media from the torrent (episode status `Downloaded`)
If is a RARed tor... | [
"def",
"remove_ratio_reached",
"(",
"self",
")",
":",
"log",
".",
"info",
"(",
"'Checking DelugeD torrent status.'",
")",
"if",
"not",
"self",
".",
"connect",
"(",
")",
":",
"log",
".",
"warning",
"(",
"'Error while fetching torrents status'",
")",
"return",
"to... | https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/medusa/clients/torrent/deluged.py#L166-L183 | ||
huhamhire/huhamhire-hosts | 33b9c49e7a4045b00e0c0df06f25e9ce8a037761 | tui/curses_ui.py | python | CursesUI.show_funclist | (self, pos, item_sup, item_inf) | Draw `function selection list` frame with a index number of the item
selected and the range of items to be displayed.
:param pos: Index of selected item in `function selection list`.
:type pos: int or None
:param item_sup: Upper bound of item index from `function selection
l... | Draw `function selection list` frame with a index number of the item
selected and the range of items to be displayed. | [
"Draw",
"function",
"selection",
"list",
"frame",
"with",
"a",
"index",
"number",
"of",
"the",
"item",
"selected",
"and",
"the",
"range",
"of",
"items",
"to",
"be",
"displayed",
"."
] | def show_funclist(self, pos, item_sup, item_inf):
"""
Draw `function selection list` frame with a index number of the item
selected and the range of items to be displayed.
:param pos: Index of selected item in `function selection list`.
:type pos: int or None
:param item... | [
"def",
"show_funclist",
"(",
"self",
",",
"pos",
",",
"item_sup",
",",
"item_inf",
")",
":",
"# Set UI variable",
"screen",
"=",
"self",
".",
"_stdscr",
".",
"subwin",
"(",
"18",
",",
"26",
",",
"2",
",",
"26",
")",
"screen",
".",
"bkgd",
"(",
"' '",... | https://github.com/huhamhire/huhamhire-hosts/blob/33b9c49e7a4045b00e0c0df06f25e9ce8a037761/tui/curses_ui.py#L265-L324 | ||
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/apps/reports/views.py | python | ScheduledReportsView.can_edit_report | (self, report_instance) | return current_user.user_id == owner.user_id or current_user.is_domain_admin(owner_domain) | [] | def can_edit_report(self, report_instance):
owner = report_instance.owner
owner_domain = report_instance.domain
current_user = self.request.couch_user
return current_user.user_id == owner.user_id or current_user.is_domain_admin(owner_domain) | [
"def",
"can_edit_report",
"(",
"self",
",",
"report_instance",
")",
":",
"owner",
"=",
"report_instance",
".",
"owner",
"owner_domain",
"=",
"report_instance",
".",
"domain",
"current_user",
"=",
"self",
".",
"request",
".",
"couch_user",
"return",
"current_user",... | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/reports/views.py#L615-L619 | |||
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v7/services/services/campaign_service/client.py | python | CampaignServiceClient.campaign_label_path | (
customer_id: str, campaign_id: str, label_id: str,
) | return "customers/{customer_id}/campaignLabels/{campaign_id}~{label_id}".format(
customer_id=customer_id, campaign_id=campaign_id, label_id=label_id,
) | Return a fully-qualified campaign_label string. | Return a fully-qualified campaign_label string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"campaign_label",
"string",
"."
] | def campaign_label_path(
customer_id: str, campaign_id: str, label_id: str,
) -> str:
"""Return a fully-qualified campaign_label string."""
return "customers/{customer_id}/campaignLabels/{campaign_id}~{label_id}".format(
customer_id=customer_id, campaign_id=campaign_id, label_id=... | [
"def",
"campaign_label_path",
"(",
"customer_id",
":",
"str",
",",
"campaign_id",
":",
"str",
",",
"label_id",
":",
"str",
",",
")",
"->",
"str",
":",
"return",
"\"customers/{customer_id}/campaignLabels/{campaign_id}~{label_id}\"",
".",
"format",
"(",
"customer_id",
... | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v7/services/services/campaign_service/client.py#L210-L216 | |
andresriancho/w3af | cd22e5252243a87aaa6d0ddea47cf58dacfe00a9 | w3af/plugins/attack/db/sqlmap/lib/takeover/registry.py | python | Registry.addRegKey | (self, regKey, regValue, regType, regData) | [] | def addRegKey(self, regKey, regValue, regType, regData):
self._operation = REGISTRY_OPERATION.ADD
Registry._initVars(self, regKey, regValue, regType, regData)
self._createRemoteBatchFile()
debugMsg = "adding registry key value '%s' " % self._regValue
debugMsg += "to registry ke... | [
"def",
"addRegKey",
"(",
"self",
",",
"regKey",
",",
"regValue",
",",
"regType",
",",
"regData",
")",
":",
"self",
".",
"_operation",
"=",
"REGISTRY_OPERATION",
".",
"ADD",
"Registry",
".",
"_initVars",
"(",
"self",
",",
"regKey",
",",
"regValue",
",",
"... | https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/plugins/attack/db/sqlmap/lib/takeover/registry.py#L93-L104 | ||||
cloudlinux/kuberdock-platform | 8b3923c19755f3868e4142b62578d9b9857d2704 | kubedock/kapi/pod.py | python | _del_docker_prefix | (value) | return value.split('docker://')[-1] | Removes 'docker://' from container or image id returned from kubernetes
API. | Removes 'docker://' from container or image id returned from kubernetes
API. | [
"Removes",
"docker",
":",
"//",
"from",
"container",
"or",
"image",
"id",
"returned",
"from",
"kubernetes",
"API",
"."
] | def _del_docker_prefix(value):
"""Removes 'docker://' from container or image id returned from kubernetes
API.
"""
if not value:
return value
return value.split('docker://')[-1] | [
"def",
"_del_docker_prefix",
"(",
"value",
")",
":",
"if",
"not",
"value",
":",
"return",
"value",
"return",
"value",
".",
"split",
"(",
"'docker://'",
")",
"[",
"-",
"1",
"]"
] | https://github.com/cloudlinux/kuberdock-platform/blob/8b3923c19755f3868e4142b62578d9b9857d2704/kubedock/kapi/pod.py#L587-L594 | |
peering-manager/peering-manager | 62c870fb9caa6dfc056feb77c595d45bc3c4988a | peering/models/models.py | python | InternetExchange.merged_import_policies | (self, reverse=False) | return list(reversed(policies)) if reverse else policies | [] | def merged_import_policies(self, reverse=False):
# Get own policies
policies = [p for p in self.import_policies()]
return list(reversed(policies)) if reverse else policies | [
"def",
"merged_import_policies",
"(",
"self",
",",
"reverse",
"=",
"False",
")",
":",
"# Get own policies",
"policies",
"=",
"[",
"p",
"for",
"p",
"in",
"self",
".",
"import_policies",
"(",
")",
"]",
"return",
"list",
"(",
"reversed",
"(",
"policies",
")",... | https://github.com/peering-manager/peering-manager/blob/62c870fb9caa6dfc056feb77c595d45bc3c4988a/peering/models/models.py#L621-L625 | |||
conansherry/detectron2 | 72c935d9aad8935406b1038af408aa06077d950a | detectron2/utils/colormap.py | python | random_color | (rgb=False, maximum=255) | return ret | Args:
rgb (bool): whether to return RGB colors or BGR colors.
maximum (int): either 255 or 1
Returns:
ndarray: a vector of 3 numbers | Args:
rgb (bool): whether to return RGB colors or BGR colors.
maximum (int): either 255 or 1 | [
"Args",
":",
"rgb",
"(",
"bool",
")",
":",
"whether",
"to",
"return",
"RGB",
"colors",
"or",
"BGR",
"colors",
".",
"maximum",
"(",
"int",
")",
":",
"either",
"255",
"or",
"1"
] | def random_color(rgb=False, maximum=255):
"""
Args:
rgb (bool): whether to return RGB colors or BGR colors.
maximum (int): either 255 or 1
Returns:
ndarray: a vector of 3 numbers
"""
idx = np.random.randint(0, len(_COLORS))
ret = _COLORS[idx] * maximum
if not rgb:
... | [
"def",
"random_color",
"(",
"rgb",
"=",
"False",
",",
"maximum",
"=",
"255",
")",
":",
"idx",
"=",
"np",
".",
"random",
".",
"randint",
"(",
"0",
",",
"len",
"(",
"_COLORS",
")",
")",
"ret",
"=",
"_COLORS",
"[",
"idx",
"]",
"*",
"maximum",
"if",
... | https://github.com/conansherry/detectron2/blob/72c935d9aad8935406b1038af408aa06077d950a/detectron2/utils/colormap.py#L111-L124 | |
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/matplotlib/transforms.py | python | BboxBase.corners | (self) | return np.array([[l, b], [l, t], [r, b], [r, t]]) | Return an array of points which are the four corners of this
rectangle. For example, if this :class:`Bbox` is defined by
the points (*a*, *b*) and (*c*, *d*), :meth:`corners` returns
(*a*, *b*), (*a*, *d*), (*c*, *b*) and (*c*, *d*). | Return an array of points which are the four corners of this
rectangle. For example, if this :class:`Bbox` is defined by
the points (*a*, *b*) and (*c*, *d*), :meth:`corners` returns
(*a*, *b*), (*a*, *d*), (*c*, *b*) and (*c*, *d*). | [
"Return",
"an",
"array",
"of",
"points",
"which",
"are",
"the",
"four",
"corners",
"of",
"this",
"rectangle",
".",
"For",
"example",
"if",
"this",
":",
"class",
":",
"Bbox",
"is",
"defined",
"by",
"the",
"points",
"(",
"*",
"a",
"*",
"*",
"b",
"*",
... | def corners(self):
"""
Return an array of points which are the four corners of this
rectangle. For example, if this :class:`Bbox` is defined by
the points (*a*, *b*) and (*c*, *d*), :meth:`corners` returns
(*a*, *b*), (*a*, *d*), (*c*, *b*) and (*c*, *d*).
"""
l,... | [
"def",
"corners",
"(",
"self",
")",
":",
"l",
",",
"b",
",",
"r",
",",
"t",
"=",
"self",
".",
"get_points",
"(",
")",
".",
"flatten",
"(",
")",
"return",
"np",
".",
"array",
"(",
"[",
"[",
"l",
",",
"b",
"]",
",",
"[",
"l",
",",
"t",
"]",... | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/matplotlib/transforms.py#L688-L696 | |
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/CPython/27/Lib/lib-tk/Tkinter.py | python | Misc.winfo_id | (self) | return self.tk.getint(
self.tk.call('winfo', 'id', self._w)) | Return identifier ID for this widget. | Return identifier ID for this widget. | [
"Return",
"identifier",
"ID",
"for",
"this",
"widget",
"."
] | def winfo_id(self):
"""Return identifier ID for this widget."""
return self.tk.getint(
self.tk.call('winfo', 'id', self._w)) | [
"def",
"winfo_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"tk",
".",
"getint",
"(",
"self",
".",
"tk",
".",
"call",
"(",
"'winfo'",
",",
"'id'",
",",
"self",
".",
"_w",
")",
")"
] | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/CPython/27/Lib/lib-tk/Tkinter.py#L732-L735 | |
datastore/datastore | 7ccf0cd4748001d3dbf5e6dda369b0f63e0269d3 | datastore/filesystem/__init__.py | python | ensure_directory_exists | (directory) | Ensures `directory` exists. May make `directory` and intermediate dirs.
Raises RuntimeError if `directory` is a file. | Ensures `directory` exists. May make `directory` and intermediate dirs.
Raises RuntimeError if `directory` is a file. | [
"Ensures",
"directory",
"exists",
".",
"May",
"make",
"directory",
"and",
"intermediate",
"dirs",
".",
"Raises",
"RuntimeError",
"if",
"directory",
"is",
"a",
"file",
"."
] | def ensure_directory_exists(directory):
'''Ensures `directory` exists. May make `directory` and intermediate dirs.
Raises RuntimeError if `directory` is a file.
'''
if not os.path.exists(directory):
os.makedirs(directory)
elif os.path.isfile(directory):
raise RuntimeError('Path %s is a file, not a dir... | [
"def",
"ensure_directory_exists",
"(",
"directory",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"directory",
")",
":",
"os",
".",
"makedirs",
"(",
"directory",
")",
"elif",
"os",
".",
"path",
".",
"isfile",
"(",
"directory",
")",
":",... | https://github.com/datastore/datastore/blob/7ccf0cd4748001d3dbf5e6dda369b0f63e0269d3/datastore/filesystem/__init__.py#L16-L23 | ||
clalancette/oz | 1ab43e88033efa774815c6ebb59ae2841f2980e9 | oz/Debian.py | python | DebianGuest._initrd_inject_preseed | (self, fetchurl, force_download) | Internal method to download and inject a preseed file into an initrd. | Internal method to download and inject a preseed file into an initrd. | [
"Internal",
"method",
"to",
"download",
"and",
"inject",
"a",
"preseed",
"file",
"into",
"an",
"initrd",
"."
] | def _initrd_inject_preseed(self, fetchurl, force_download):
"""
Internal method to download and inject a preseed file into an initrd.
"""
# we first see if we can use direct kernel booting, as that is
# faster than downloading the ISO
kernel = None
initrd = None
... | [
"def",
"_initrd_inject_preseed",
"(",
"self",
",",
"fetchurl",
",",
"force_download",
")",
":",
"# we first see if we can use direct kernel booting, as that is",
"# faster than downloading the ISO",
"kernel",
"=",
"None",
"initrd",
"=",
"None",
"try",
":",
"(",
"kernel",
... | https://github.com/clalancette/oz/blob/1ab43e88033efa774815c6ebb59ae2841f2980e9/oz/Debian.py#L569-L628 | ||
TesterlifeRaymond/doraemon | d5cb6e34bd5f2aa97273ce0c0c9303e32beaa333 | venv/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/packages/ordered_dict.py | python | OrderedDict.__setitem__ | (self, key, value, dict_setitem=dict.__setitem__) | od.__setitem__(i, y) <==> od[i]=y | od.__setitem__(i, y) <==> od[i]=y | [
"od",
".",
"__setitem__",
"(",
"i",
"y",
")",
"<",
"==",
">",
"od",
"[",
"i",
"]",
"=",
"y"
] | def __setitem__(self, key, value, dict_setitem=dict.__setitem__):
'od.__setitem__(i, y) <==> od[i]=y'
# Setting a new item creates a new link which goes at the end of the linked
# list, and the inherited dictionary is updated with the new key/value pair.
if key not in self:
r... | [
"def",
"__setitem__",
"(",
"self",
",",
"key",
",",
"value",
",",
"dict_setitem",
"=",
"dict",
".",
"__setitem__",
")",
":",
"# Setting a new item creates a new link which goes at the end of the linked",
"# list, and the inherited dictionary is updated with the new key/value pair."... | https://github.com/TesterlifeRaymond/doraemon/blob/d5cb6e34bd5f2aa97273ce0c0c9303e32beaa333/venv/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/packages/ordered_dict.py#L44-L52 | ||
lbryio/lbry-sdk | f78e3825ca0f130834d3876a824f9d380501ced8 | lbry/crypto/hash.py | python | hex_str_to_hash | (x) | return reversed(unhexlify(x)) | Convert a displayed hex string to a binary hash. | Convert a displayed hex string to a binary hash. | [
"Convert",
"a",
"displayed",
"hex",
"string",
"to",
"a",
"binary",
"hash",
"."
] | def hex_str_to_hash(x):
""" Convert a displayed hex string to a binary hash. """
return reversed(unhexlify(x)) | [
"def",
"hex_str_to_hash",
"(",
"x",
")",
":",
"return",
"reversed",
"(",
"unhexlify",
"(",
"x",
")",
")"
] | https://github.com/lbryio/lbry-sdk/blob/f78e3825ca0f130834d3876a824f9d380501ced8/lbry/crypto/hash.py#L45-L47 | |
dropbox/dropbox-sdk-python | 015437429be224732990041164a21a0501235db1 | dropbox/team_log.py | python | EventType.group_add_external_id | (cls, val) | return cls('group_add_external_id', val) | Create an instance of this class set to the ``group_add_external_id``
tag with value ``val``.
:param GroupAddExternalIdType val:
:rtype: EventType | Create an instance of this class set to the ``group_add_external_id``
tag with value ``val``. | [
"Create",
"an",
"instance",
"of",
"this",
"class",
"set",
"to",
"the",
"group_add_external_id",
"tag",
"with",
"value",
"val",
"."
] | def group_add_external_id(cls, val):
"""
Create an instance of this class set to the ``group_add_external_id``
tag with value ``val``.
:param GroupAddExternalIdType val:
:rtype: EventType
"""
return cls('group_add_external_id', val) | [
"def",
"group_add_external_id",
"(",
"cls",
",",
"val",
")",
":",
"return",
"cls",
"(",
"'group_add_external_id'",
",",
"val",
")"
] | https://github.com/dropbox/dropbox-sdk-python/blob/015437429be224732990041164a21a0501235db1/dropbox/team_log.py#L24305-L24313 | |
Robert-JunWang/PeleeNet | 05e928adb7387d54b48373583ee4430a28966599 | peleenet.py | python | BasicConv2d.forward | (self, x) | [] | def forward(self, x):
x = self.conv(x)
x = self.norm(x)
if self.activation:
return F.relu(x, inplace=True)
else:
return x | [
"def",
"forward",
"(",
"self",
",",
"x",
")",
":",
"x",
"=",
"self",
".",
"conv",
"(",
"x",
")",
"x",
"=",
"self",
".",
"norm",
"(",
"x",
")",
"if",
"self",
".",
"activation",
":",
"return",
"F",
".",
"relu",
"(",
"x",
",",
"inplace",
"=",
... | https://github.com/Robert-JunWang/PeleeNet/blob/05e928adb7387d54b48373583ee4430a28966599/peleenet.py#L82-L88 | ||||
JiYou/openstack | 8607dd488bde0905044b303eb6e52bdea6806923 | packages/source/swift/swift/common/middleware/formpost.py | python | _iter_requests | (wsgi_input, boundary) | Given a multi-part mime encoded input file object and boundary,
yield file-like objects for each part.
:param wsgi_input: The file-like object to read from.
:param boundary: The mime boundary to separate new file-like
objects on.
:returns: A generator of file-like objects for each ... | Given a multi-part mime encoded input file object and boundary,
yield file-like objects for each part. | [
"Given",
"a",
"multi",
"-",
"part",
"mime",
"encoded",
"input",
"file",
"object",
"and",
"boundary",
"yield",
"file",
"-",
"like",
"objects",
"for",
"each",
"part",
"."
] | def _iter_requests(wsgi_input, boundary):
"""
Given a multi-part mime encoded input file object and boundary,
yield file-like objects for each part.
:param wsgi_input: The file-like object to read from.
:param boundary: The mime boundary to separate new file-like
objects on.
... | [
"def",
"_iter_requests",
"(",
"wsgi_input",
",",
"boundary",
")",
":",
"boundary",
"=",
"'--'",
"+",
"boundary",
"if",
"wsgi_input",
".",
"readline",
"(",
")",
".",
"strip",
"(",
")",
"!=",
"boundary",
":",
"raise",
"FormInvalid",
"(",
"'invalid starting bou... | https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/swift/swift/common/middleware/formpost.py#L228-L248 | ||
yzcjtr/GeoNet | 5b176025bc63563ef53297aa3d20cc6e575fb833 | kitti_eval/flow_tool/flowlib.py | python | read_image | (filename) | return im | Read normal image of any format
:param filename: name of the image file
:return: image data in matrix uint8 type | Read normal image of any format
:param filename: name of the image file
:return: image data in matrix uint8 type | [
"Read",
"normal",
"image",
"of",
"any",
"format",
":",
"param",
"filename",
":",
"name",
"of",
"the",
"image",
"file",
":",
"return",
":",
"image",
"data",
"in",
"matrix",
"uint8",
"type"
] | def read_image(filename):
"""
Read normal image of any format
:param filename: name of the image file
:return: image data in matrix uint8 type
"""
img = Image.open(filename)
im = np.array(img)
return im | [
"def",
"read_image",
"(",
"filename",
")",
":",
"img",
"=",
"Image",
".",
"open",
"(",
"filename",
")",
"im",
"=",
"np",
".",
"array",
"(",
"img",
")",
"return",
"im"
] | https://github.com/yzcjtr/GeoNet/blob/5b176025bc63563ef53297aa3d20cc6e575fb833/kitti_eval/flow_tool/flowlib.py#L432-L440 | |
globocom/m3u8 | cf7ae5fda4681efcea796cd7c51c02f152c36009 | m3u8/parser.py | python | _cueout_elemental | (line, state, prevline) | [] | def _cueout_elemental(line, state, prevline):
param, value = line.split(':', 1)
res = re.match('.*EXT-OATCLS-SCTE35:(.*)$', prevline)
if res:
return (res.group(1), value)
else:
return None | [
"def",
"_cueout_elemental",
"(",
"line",
",",
"state",
",",
"prevline",
")",
":",
"param",
",",
"value",
"=",
"line",
".",
"split",
"(",
"':'",
",",
"1",
")",
"res",
"=",
"re",
".",
"match",
"(",
"'.*EXT-OATCLS-SCTE35:(.*)$'",
",",
"prevline",
")",
"if... | https://github.com/globocom/m3u8/blob/cf7ae5fda4681efcea796cd7c51c02f152c36009/m3u8/parser.py#L376-L382 | ||||
hypothesis/h | 25ef1b8d94889df86ace5a084f1aa0effd9f4e25 | h/cli/commands/user.py | python | add | (ctx, username, email, password, authority) | Create a new user. | Create a new user. | [
"Create",
"a",
"new",
"user",
"."
] | def add(ctx, username, email, password, authority):
"""Create a new user."""
request = ctx.obj["bootstrap"]()
signup_service = request.find_service(name="user_signup")
signup_kwargs = {
"username": username,
"email": email,
"password": password,
"require_activation": Fa... | [
"def",
"add",
"(",
"ctx",
",",
"username",
",",
"email",
",",
"password",
",",
"authority",
")",
":",
"request",
"=",
"ctx",
".",
"obj",
"[",
"\"bootstrap\"",
"]",
"(",
")",
"signup_service",
"=",
"request",
".",
"find_service",
"(",
"name",
"=",
"\"us... | https://github.com/hypothesis/h/blob/25ef1b8d94889df86ace5a084f1aa0effd9f4e25/h/cli/commands/user.py#L19-L45 | ||
tahoe-lafs/tahoe-lafs | 766a53b5208c03c45ca0a98e97eee76870276aa1 | src/allmydata/interfaces.py | python | ICheckResults.get_encoding_expected | () | Return 'N', the number of total shares generated. | Return 'N', the number of total shares generated. | [
"Return",
"N",
"the",
"number",
"of",
"total",
"shares",
"generated",
"."
] | def get_encoding_expected():
"""Return 'N', the number of total shares generated.""" | [
"def",
"get_encoding_expected",
"(",
")",
":"
] | https://github.com/tahoe-lafs/tahoe-lafs/blob/766a53b5208c03c45ca0a98e97eee76870276aa1/src/allmydata/interfaces.py#L2314-L2315 | ||
misterch0c/shadowbroker | e3a069bea47a2c1009697941ac214adc6f90aa8d | windows/Resources/Python/Core/Lib/distutils/command/bdist_msi.py | python | PyDialog.__init__ | (self, *args, **kw) | Dialog(database, name, x, y, w, h, attributes, title, first,
default, cancel, bitmap=true) | Dialog(database, name, x, y, w, h, attributes, title, first,
default, cancel, bitmap=true) | [
"Dialog",
"(",
"database",
"name",
"x",
"y",
"w",
"h",
"attributes",
"title",
"first",
"default",
"cancel",
"bitmap",
"=",
"true",
")"
] | def __init__(self, *args, **kw):
"""Dialog(database, name, x, y, w, h, attributes, title, first,
default, cancel, bitmap=true)"""
Dialog.__init__(self, *args)
ruler = self.h - 36
self.line('BottomLine', 0, ruler, self.w, 0) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"Dialog",
".",
"__init__",
"(",
"self",
",",
"*",
"args",
")",
"ruler",
"=",
"self",
".",
"h",
"-",
"36",
"self",
".",
"line",
"(",
"'BottomLine'",
",",
"0",
",",
... | https://github.com/misterch0c/shadowbroker/blob/e3a069bea47a2c1009697941ac214adc6f90aa8d/windows/Resources/Python/Core/Lib/distutils/command/bdist_msi.py#L27-L32 | ||
mit-ll/LL-Fuzzer | 7c532a55cfd7dba9445afa39bd25574a320e1a69 | nfc/dep.py | python | DEP.general_bytes | (self) | return self._gb | The general bytes received with the ATR exchange | The general bytes received with the ATR exchange | [
"The",
"general",
"bytes",
"received",
"with",
"the",
"ATR",
"exchange"
] | def general_bytes(self):
"""The general bytes received with the ATR exchange"""
return self._gb | [
"def",
"general_bytes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_gb"
] | https://github.com/mit-ll/LL-Fuzzer/blob/7c532a55cfd7dba9445afa39bd25574a320e1a69/nfc/dep.py#L35-L37 | |
jina-ai/jina | c77a492fcd5adba0fc3de5347bea83dd4e7d8087 | jina/optimizers/discovery.py | python | _write_optimization_parameter | (
executor_configurations, target_file, overwrite_parameter_file
) | [] | def _write_optimization_parameter(
executor_configurations, target_file, overwrite_parameter_file
):
output = [
parameter for config in executor_configurations.values() for parameter in config
]
if os.path.exists(target_file) and not overwrite_parameter_file:
logger.warning(
... | [
"def",
"_write_optimization_parameter",
"(",
"executor_configurations",
",",
"target_file",
",",
"overwrite_parameter_file",
")",
":",
"output",
"=",
"[",
"parameter",
"for",
"config",
"in",
"executor_configurations",
".",
"values",
"(",
")",
"for",
"parameter",
"in",... | https://github.com/jina-ai/jina/blob/c77a492fcd5adba0fc3de5347bea83dd4e7d8087/jina/optimizers/discovery.py#L81-L94 | ||||
abulka/pynsource | 886bf4ea05bede67fe7846185fbe78704c2a0e8a | Research/python advanced/multicast_csharp_style2 - threaded.py | python | multicast.__bool__ | (self) | return operator.truth(reduce(lambda a, b: a and b, list(self.values()), 1)) | A multicast is logically true if all delegate attributes are logically true | A multicast is logically true if all delegate attributes are logically true | [
"A",
"multicast",
"is",
"logically",
"true",
"if",
"all",
"delegate",
"attributes",
"are",
"logically",
"true"
] | def __bool__(self):
"A multicast is logically true if all delegate attributes are logically true"
return operator.truth(reduce(lambda a, b: a and b, list(self.values()), 1)) | [
"def",
"__bool__",
"(",
"self",
")",
":",
"return",
"operator",
".",
"truth",
"(",
"reduce",
"(",
"lambda",
"a",
",",
"b",
":",
"a",
"and",
"b",
",",
"list",
"(",
"self",
".",
"values",
"(",
")",
")",
",",
"1",
")",
")"
] | https://github.com/abulka/pynsource/blob/886bf4ea05bede67fe7846185fbe78704c2a0e8a/Research/python advanced/multicast_csharp_style2 - threaded.py#L61-L64 | |
huggingface/transformers | 623b4f7c63f60cce917677ee704d6c93ee960b4b | templates/adding_a_new_model/cookiecutter-template-{{cookiecutter.modelname}}/tokenization_{{cookiecutter.lowercase_modelname}}.py | python | __init__ | (
self,
vocab_file,
merges_file,
unk_token="<|endoftext|>",
bos_token="<|endoftext|>",
eos_token="<|endoftext|>",
add_prefix_space=False,
trim_offsets=True,
**kwargs
) | [] | def __init__(
self,
vocab_file,
merges_file,
unk_token="<|endoftext|>",
bos_token="<|endoftext|>",
eos_token="<|endoftext|>",
add_prefix_space=False,
trim_offsets=True,
**kwargs
):
super().__init__(
... | [
"def",
"__init__",
"(",
"self",
",",
"vocab_file",
",",
"merges_file",
",",
"unk_token",
"=",
"\"<|endoftext|>\"",
",",
"bos_token",
"=",
"\"<|endoftext|>\"",
",",
"eos_token",
"=",
"\"<|endoftext|>\"",
",",
"add_prefix_space",
"=",
"False",
",",
"trim_offsets",
"... | https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/templates/adding_a_new_model/cookiecutter-template-{{cookiecutter.modelname}}/tokenization_{{cookiecutter.lowercase_modelname}}.py#L279-L302 | ||||
commaai/laika | dc38f251dbc7ebb535a3c220de8424634d297248 | laika/downloader.py | python | retryable | (f) | return wrapped | Decorator to allow us to pass multiple URLs from which to download.
Automatically retry the request with the next URL on failure | Decorator to allow us to pass multiple URLs from which to download.
Automatically retry the request with the next URL on failure | [
"Decorator",
"to",
"allow",
"us",
"to",
"pass",
"multiple",
"URLs",
"from",
"which",
"to",
"download",
".",
"Automatically",
"retry",
"the",
"request",
"with",
"the",
"next",
"URL",
"on",
"failure"
] | def retryable(f):
"""
Decorator to allow us to pass multiple URLs from which to download.
Automatically retry the request with the next URL on failure
"""
def wrapped(url_bases, *args, **kwargs):
if isinstance(url_bases, str):
# only one url passed, don't do the retry thing
return f(url_bases,... | [
"def",
"retryable",
"(",
"f",
")",
":",
"def",
"wrapped",
"(",
"url_bases",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"url_bases",
",",
"str",
")",
":",
"# only one url passed, don't do the retry thing",
"return",
"f",
"... | https://github.com/commaai/laika/blob/dc38f251dbc7ebb535a3c220de8424634d297248/laika/downloader.py#L22-L40 | |
stepjam/PyRep | d778d5d4ffa3be366d4e699f6e2941553fd47ecc | pyrep/robots/robot_component.py | python | RobotComponent.get_joint_count | (self) | return self._num_joints | Gets the number of joints in this component.
:return: The number of joints. | Gets the number of joints in this component. | [
"Gets",
"the",
"number",
"of",
"joints",
"in",
"this",
"component",
"."
] | def get_joint_count(self) -> int:
"""Gets the number of joints in this component.
:return: The number of joints.
"""
return self._num_joints | [
"def",
"get_joint_count",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"_num_joints"
] | https://github.com/stepjam/PyRep/blob/d778d5d4ffa3be366d4e699f6e2941553fd47ecc/pyrep/robots/robot_component.py#L55-L60 | |
pylast/pylast | a204055798e05364965e321e8d8755c1e223a464 | src/pylast/__init__.py | python | _Opus.get_userplaycount | (self) | return _number(_extract(doc, "userplaycount")) | Returns the number of plays by a given username | Returns the number of plays by a given username | [
"Returns",
"the",
"number",
"of",
"plays",
"by",
"a",
"given",
"username"
] | def get_userplaycount(self):
"""Returns the number of plays by a given username"""
if not self.username:
return
params = self._get_params()
params["username"] = self.username
doc = self._request(self.ws_prefix + ".getInfo", True, params)
return _number(_ext... | [
"def",
"get_userplaycount",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"username",
":",
"return",
"params",
"=",
"self",
".",
"_get_params",
"(",
")",
"params",
"[",
"\"username\"",
"]",
"=",
"self",
".",
"username",
"doc",
"=",
"self",
".",
"_re... | https://github.com/pylast/pylast/blob/a204055798e05364965e321e8d8755c1e223a464/src/pylast/__init__.py#L1602-L1612 | |
standardebooks/tools | f57af3c5938a9aeed9e97e82b2c130424f6033e5 | se/images.py | python | _apply_css | (elem: etree.Element, css_text: str) | return result_css | [] | def _apply_css(elem: etree.Element, css_text: str) -> dict:
chunks = [[y.strip() for y in x.split("\n") if y.strip() != ""] for x in css_text.replace("\r", "").split("}")]
result_css = {}
def apply_css(kvs):
for pair in kvs:
k, css = [selector.strip() for selector in pair.split(":")]
result_css[k] = css.rep... | [
"def",
"_apply_css",
"(",
"elem",
":",
"etree",
".",
"Element",
",",
"css_text",
":",
"str",
")",
"->",
"dict",
":",
"chunks",
"=",
"[",
"[",
"y",
".",
"strip",
"(",
")",
"for",
"y",
"in",
"x",
".",
"split",
"(",
"\"\\n\"",
")",
"if",
"y",
".",... | https://github.com/standardebooks/tools/blob/f57af3c5938a9aeed9e97e82b2c130424f6033e5/se/images.py#L334-L356 | |||
Cadene/tensorflow-model-zoo.torch | 990b10ffc22d4c8eacb2a502f20415b4f70c74c2 | models/research/real_nvp/real_nvp_multiscale_dataset.py | python | masked_conv_coupling | (input_, mask_in, dim, name,
use_batch_norm=True, train=True, weight_norm=True,
reverse=False, residual_blocks=5,
bottleneck=False, use_aff=True,
use_width=1., use_height=1.,
mask_channel=0., ski... | Coupling with masked convolution. | Coupling with masked convolution. | [
"Coupling",
"with",
"masked",
"convolution",
"."
] | def masked_conv_coupling(input_, mask_in, dim, name,
use_batch_norm=True, train=True, weight_norm=True,
reverse=False, residual_blocks=5,
bottleneck=False, use_aff=True,
use_width=1., use_height=1.,
... | [
"def",
"masked_conv_coupling",
"(",
"input_",
",",
"mask_in",
",",
"dim",
",",
"name",
",",
"use_batch_norm",
"=",
"True",
",",
"train",
"=",
"True",
",",
"weight_norm",
"=",
"True",
",",
"reverse",
"=",
"False",
",",
"residual_blocks",
"=",
"5",
",",
"b... | https://github.com/Cadene/tensorflow-model-zoo.torch/blob/990b10ffc22d4c8eacb2a502f20415b4f70c74c2/models/research/real_nvp/real_nvp_multiscale_dataset.py#L455-L475 | ||
Azure/blobxfer | c6c6c143e8ee413d09a1110abafdb92e9e8afc39 | blobxfer/util.py | python | new_md5_hasher | () | return hashlib.md5() | Create a new MD5 hasher
:rtype: md5.MD5
:return: new MD5 hasher | Create a new MD5 hasher
:rtype: md5.MD5
:return: new MD5 hasher | [
"Create",
"a",
"new",
"MD5",
"hasher",
":",
"rtype",
":",
"md5",
".",
"MD5",
":",
"return",
":",
"new",
"MD5",
"hasher"
] | def new_md5_hasher():
# type: (None) -> md5.MD5
"""Create a new MD5 hasher
:rtype: md5.MD5
:return: new MD5 hasher
"""
return hashlib.md5() | [
"def",
"new_md5_hasher",
"(",
")",
":",
"# type: (None) -> md5.MD5",
"return",
"hashlib",
".",
"md5",
"(",
")"
] | https://github.com/Azure/blobxfer/blob/c6c6c143e8ee413d09a1110abafdb92e9e8afc39/blobxfer/util.py#L224-L230 | |
nengo/nengo | f5a88ba6b42b39a722299db6e889a5d034fcfeda | nengo/utils/filter_design.py | python | cont2discrete | (sys, dt, method="zoh", alpha=None) | return ad, bd, cd, dd, dt | Transform a continuous to a discrete state-space system.
Parameters
----------
sys : a tuple describing the system.
The following gives the number of elements in the tuple and
the interpretation:
* 2: (num, den)
* 3: (zeros, poles, gain)
* 4: (A, B, C, D)
... | Transform a continuous to a discrete state-space system. | [
"Transform",
"a",
"continuous",
"to",
"a",
"discrete",
"state",
"-",
"space",
"system",
"."
] | def cont2discrete(sys, dt, method="zoh", alpha=None): # noqa: C901
"""
Transform a continuous to a discrete state-space system.
Parameters
----------
sys : a tuple describing the system.
The following gives the number of elements in the tuple and
the interpretation:
* 2... | [
"def",
"cont2discrete",
"(",
"sys",
",",
"dt",
",",
"method",
"=",
"\"zoh\"",
",",
"alpha",
"=",
"None",
")",
":",
"# noqa: C901",
"if",
"len",
"(",
"sys",
")",
"==",
"2",
":",
"sysd",
"=",
"cont2discrete",
"(",
"tf2ss",
"(",
"sys",
"[",
"0",
"]",
... | https://github.com/nengo/nengo/blob/f5a88ba6b42b39a722299db6e889a5d034fcfeda/nengo/utils/filter_design.py#L399-L529 | |
PyMVPA/PyMVPA | 76c476b3de8264b0bb849bf226da5674d659564e | mvpa2/clfs/lars.py | python | LARS.get_sensitivity_analyzer | (self, **kwargs) | return LARSWeights(self, **kwargs) | Returns a sensitivity analyzer for LARS. | Returns a sensitivity analyzer for LARS. | [
"Returns",
"a",
"sensitivity",
"analyzer",
"for",
"LARS",
"."
] | def get_sensitivity_analyzer(self, **kwargs):
"""Returns a sensitivity analyzer for LARS."""
return LARSWeights(self, **kwargs) | [
"def",
"get_sensitivity_analyzer",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"LARSWeights",
"(",
"self",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/PyMVPA/PyMVPA/blob/76c476b3de8264b0bb849bf226da5674d659564e/mvpa2/clfs/lars.py#L247-L249 | |
gnemoug/distribute_crawler | fb74ad853126b3a6358f987d763d492d8f3eec12 | woaidu_crawler/woaidu_crawler/scrapy_redis/queue.py | python | SpiderQueue.push | (self, request) | Push a request | Push a request | [
"Push",
"a",
"request"
] | def push(self, request):
"""Push a request"""
self.server.lpush(self.key, self._encode_request(request)) | [
"def",
"push",
"(",
"self",
",",
"request",
")",
":",
"self",
".",
"server",
".",
"lpush",
"(",
"self",
".",
"key",
",",
"self",
".",
"_encode_request",
"(",
"request",
")",
")"
] | https://github.com/gnemoug/distribute_crawler/blob/fb74ad853126b3a6358f987d763d492d8f3eec12/woaidu_crawler/woaidu_crawler/scrapy_redis/queue.py#L59-L61 | ||
pm4py/pm4py-core | 7807b09a088b02199cd0149d724d0e28793971bf | pm4py/algo/filtering/log/cases/case_filter.py | python | filter_on_case_size | (log: EventLog, min_case_size: int = 2, max_case_size=None) | return filtered_log | Get only traces in the log with a given size
Parameters
-----------
log
Log
min_case_size
Minimum desidered size of traces
max_case_size
Maximum desidered size of traces
Returns
-----------
filtered_log
Filtered log | Get only traces in the log with a given size | [
"Get",
"only",
"traces",
"in",
"the",
"log",
"with",
"a",
"given",
"size"
] | def filter_on_case_size(log: EventLog, min_case_size: int = 2, max_case_size=None) -> EventLog:
"""
Get only traces in the log with a given size
Parameters
-----------
log
Log
min_case_size
Minimum desidered size of traces
max_case_size
Maximum desidered size of trac... | [
"def",
"filter_on_case_size",
"(",
"log",
":",
"EventLog",
",",
"min_case_size",
":",
"int",
"=",
"2",
",",
"max_case_size",
"=",
"None",
")",
"->",
"EventLog",
":",
"if",
"max_case_size",
"is",
"not",
"None",
":",
"filtered_log",
"=",
"EventLog",
"(",
"["... | https://github.com/pm4py/pm4py-core/blob/7807b09a088b02199cd0149d724d0e28793971bf/pm4py/algo/filtering/log/cases/case_filter.py#L78-L100 | |
learningequality/ka-lite | 571918ea668013dcf022286ea85eff1c5333fb8b | kalite/packages/bundled/django/core/cache/backends/base.py | python | BaseCache.make_key | (self, key, version=None) | return new_key | Constructs the key used by all other methods. By default it
uses the key_func to generate a key (which, by default,
prepends the `key_prefix' and 'version'). An different key
function can be provided at the time of cache construction;
alternatively, you can subclass the cache backend to ... | Constructs the key used by all other methods. By default it
uses the key_func to generate a key (which, by default,
prepends the `key_prefix' and 'version'). An different key
function can be provided at the time of cache construction;
alternatively, you can subclass the cache backend to ... | [
"Constructs",
"the",
"key",
"used",
"by",
"all",
"other",
"methods",
".",
"By",
"default",
"it",
"uses",
"the",
"key_func",
"to",
"generate",
"a",
"key",
"(",
"which",
"by",
"default",
"prepends",
"the",
"key_prefix",
"and",
"version",
")",
".",
"An",
"d... | def make_key(self, key, version=None):
"""Constructs the key used by all other methods. By default it
uses the key_func to generate a key (which, by default,
prepends the `key_prefix' and 'version'). An different key
function can be provided at the time of cache construction;
alt... | [
"def",
"make_key",
"(",
"self",
",",
"key",
",",
"version",
"=",
"None",
")",
":",
"if",
"version",
"is",
"None",
":",
"version",
"=",
"self",
".",
"version",
"new_key",
"=",
"self",
".",
"key_func",
"(",
"key",
",",
"self",
".",
"key_prefix",
",",
... | https://github.com/learningequality/ka-lite/blob/571918ea668013dcf022286ea85eff1c5333fb8b/kalite/packages/bundled/django/core/cache/backends/base.py#L70-L82 | |
Yonsm/.homeassistant | 4d9a0070d0fcd8a5ded46e7884da9a4494bbbf26 | custom_components/xiaomi_miio_fan/fan.py | python | XiaomiFanLeshow.async_oscillate | (self, oscillating: bool) | Set oscillation. | Set oscillation. | [
"Set",
"oscillation",
"."
] | async def async_oscillate(self, oscillating: bool) -> None:
"""Set oscillation."""
if oscillating:
await self._try_command(
"Setting oscillate on of the miio device failed.",
self._device.set_oscillate,
True,
)
else:
... | [
"async",
"def",
"async_oscillate",
"(",
"self",
",",
"oscillating",
":",
"bool",
")",
"->",
"None",
":",
"if",
"oscillating",
":",
"await",
"self",
".",
"_try_command",
"(",
"\"Setting oscillate on of the miio device failed.\"",
",",
"self",
".",
"_device",
".",
... | https://github.com/Yonsm/.homeassistant/blob/4d9a0070d0fcd8a5ded46e7884da9a4494bbbf26/custom_components/xiaomi_miio_fan/fan.py#L1062-L1075 | ||
openmc-dev/openmc | 0cf7d9283786677e324bfbdd0984a54d1c86dacc | openmc/deplete/nuclide.py | python | FissionYield.__iadd__ | (self, other) | return self | Increment value from other fission yield | Increment value from other fission yield | [
"Increment",
"value",
"from",
"other",
"fission",
"yield"
] | def __iadd__(self, other):
"""Increment value from other fission yield"""
if not isinstance(other, FissionYield):
return NotImplemented
self.yields += other.yields
return self | [
"def",
"__iadd__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"FissionYield",
")",
":",
"return",
"NotImplemented",
"self",
".",
"yields",
"+=",
"other",
".",
"yields",
"return",
"self"
] | https://github.com/openmc-dev/openmc/blob/0cf7d9283786677e324bfbdd0984a54d1c86dacc/openmc/deplete/nuclide.py#L648-L653 | |
sammchardy/python-binance | 217f1e2205877f80dbaba6ee92354ce4aca74232 | binance/client.py | python | Client.futures_place_batch_order | (self, **params) | return self._request_futures_api('post', 'batchOrders', True, data=params) | Send in new orders.
https://binance-docs.github.io/apidocs/futures/en/#place-multiple-orders-trade
To avoid modifying the existing signature generation and parameter order logic,
the url encoding is done on the special query param, batchOrders, in the early stage. | Send in new orders. | [
"Send",
"in",
"new",
"orders",
"."
] | def futures_place_batch_order(self, **params):
"""Send in new orders.
https://binance-docs.github.io/apidocs/futures/en/#place-multiple-orders-trade
To avoid modifying the existing signature generation and parameter order logic,
the url encoding is done on the special query param, batc... | [
"def",
"futures_place_batch_order",
"(",
"self",
",",
"*",
"*",
"params",
")",
":",
"query_string",
"=",
"urlencode",
"(",
"params",
")",
"query_string",
"=",
"query_string",
".",
"replace",
"(",
"'%27'",
",",
"'%22'",
")",
"params",
"[",
"'batchOrders'",
"]... | https://github.com/sammchardy/python-binance/blob/217f1e2205877f80dbaba6ee92354ce4aca74232/binance/client.py#L5856-L5868 | |
calebstewart/pwncat | d67865bdaac60dd0761d0698062e7b443a62c6db | pwncat/channel/ssh.py | python | Ssh.recv | (self, count: Optional[int] = None) | return data | Receive data from the remote shell
If your channel class does not implement ``peak``, a default
implementation is provided. In this case, you can use the
``_pop_peek`` to get available peek buffer data prior to
reading data like a normal ``recv``.
:param count: maximum number o... | Receive data from the remote shell | [
"Receive",
"data",
"from",
"the",
"remote",
"shell"
] | def recv(self, count: Optional[int] = None) -> bytes:
"""Receive data from the remote shell
If your channel class does not implement ``peak``, a default
implementation is provided. In this case, you can use the
``_pop_peek`` to get available peek buffer data prior to
reading dat... | [
"def",
"recv",
"(",
"self",
",",
"count",
":",
"Optional",
"[",
"int",
"]",
"=",
"None",
")",
"->",
"bytes",
":",
"if",
"self",
".",
"peek_buffer",
":",
"data",
"=",
"self",
".",
"peek_buffer",
"[",
":",
"count",
"]",
"self",
".",
"peek_buffer",
"=... | https://github.com/calebstewart/pwncat/blob/d67865bdaac60dd0761d0698062e7b443a62c6db/pwncat/channel/ssh.py#L91-L121 | |
dickreuter/Poker | b7642f0277e267e1a44eab957c4c7d1d8f50f4ee | poker/decisionmaker/genetic_algorithm.py | python | GeneticAlgorithm.assess_bet | (self, p, L, decision, stage, coeff1, change) | [] | def assess_bet(self, p, L, decision, stage, coeff1, change):
A = L.d['Bet', stage, 'Won'] > (L.d['Bet', stage, 'Lost']) * coeff1 # Bet won bigger Bet lost
B = L.d['Check', stage, 'Won'] > L.d['Check', stage, 'Lost'] # check won bigger check lost
C = L.d['Bet', stage, 'Won'] < (L.d['Bet', stage... | [
"def",
"assess_bet",
"(",
"self",
",",
"p",
",",
"L",
",",
"decision",
",",
"stage",
",",
"coeff1",
",",
"change",
")",
":",
"A",
"=",
"L",
".",
"d",
"[",
"'Bet'",
",",
"stage",
",",
"'Won'",
"]",
">",
"(",
"L",
".",
"d",
"[",
"'Bet'",
",",
... | https://github.com/dickreuter/Poker/blob/b7642f0277e267e1a44eab957c4c7d1d8f50f4ee/poker/decisionmaker/genetic_algorithm.py#L60-L80 | ||||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/combinat/k_tableau.py | python | WeakTableau_factorized_permutation.straighten_input | (t, k) | return w_tuple | r"""
Straightens input.
INPUT:
- ``t`` -- a list of reduced words or a list of elements in the Weyl group of type
`A_k^{(1)}`
- ``k`` -- a positive integer
EXAMPLES::
sage: from sage.combinat.k_tableau import WeakTableau_factorized_permutation
... | r"""
Straightens input. | [
"r",
"Straightens",
"input",
"."
] | def straighten_input(t, k):
r"""
Straightens input.
INPUT:
- ``t`` -- a list of reduced words or a list of elements in the Weyl group of type
`A_k^{(1)}`
- ``k`` -- a positive integer
EXAMPLES::
sage: from sage.combinat.k_tableau import WeakTable... | [
"def",
"straighten_input",
"(",
"t",
",",
"k",
")",
":",
"W",
"=",
"WeylGroup",
"(",
"[",
"'A'",
",",
"k",
",",
"1",
"]",
",",
"prefix",
"=",
"'s'",
")",
"if",
"len",
"(",
"t",
")",
">",
"0",
":",
"if",
"isinstance",
"(",
"t",
"[",
"0",
"]"... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/k_tableau.py#L1793-L1827 | |
hellohaptik/chatbot_ner | 742104790170ae5b73c583c94db6786549337dc4 | ner_v2/detectors/temporal/date/en/date_detection.py | python | DateDetector._day_in_next_week | (self, date_list=None, original_list=None) | return date_list, original_list | Detects "next <day of the week>" and its variants and returns the date on that day in the next week.
Week starts with Sunday and ends with Saturday
Matches "next" or "nxt" followed by day of the week - Sunday/Monday/Tuesday/Wednesday/Thursday/Friday/Saturday
or their abbreviations. NOTE: Day of... | Detects "next <day of the week>" and its variants and returns the date on that day in the next week.
Week starts with Sunday and ends with Saturday | [
"Detects",
"next",
"<day",
"of",
"the",
"week",
">",
"and",
"its",
"variants",
"and",
"returns",
"the",
"date",
"on",
"that",
"day",
"in",
"the",
"next",
"week",
".",
"Week",
"starts",
"with",
"Sunday",
"and",
"ends",
"with",
"Saturday"
] | def _day_in_next_week(self, date_list=None, original_list=None):
"""
Detects "next <day of the week>" and its variants and returns the date on that day in the next week.
Week starts with Sunday and ends with Saturday
Matches "next" or "nxt" followed by day of the week - Sunday/Monday/Tu... | [
"def",
"_day_in_next_week",
"(",
"self",
",",
"date_list",
"=",
"None",
",",
"original_list",
"=",
"None",
")",
":",
"if",
"original_list",
"is",
"None",
":",
"original_list",
"=",
"[",
"]",
"if",
"date_list",
"is",
"None",
":",
"date_list",
"=",
"[",
"]... | https://github.com/hellohaptik/chatbot_ner/blob/742104790170ae5b73c583c94db6786549337dc4/ner_v2/detectors/temporal/date/en/date_detection.py#L1082-L1131 | |
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/eiam/v20210420/models.py | python | AuthorizationInfoSearchCriteria.__init__ | (self) | r"""
:param Keyword: 名称匹配搜索,当查询类型为用户时,匹配范围包括:用户名称、应用名称;当查询类型为用户组时,匹配范围包括:用户组名称、应用名称;当查询类型为组织机构时,匹配范围包括:组织机构名称、应用名称。
:type Keyword: str | r"""
:param Keyword: 名称匹配搜索,当查询类型为用户时,匹配范围包括:用户名称、应用名称;当查询类型为用户组时,匹配范围包括:用户组名称、应用名称;当查询类型为组织机构时,匹配范围包括:组织机构名称、应用名称。
:type Keyword: str | [
"r",
":",
"param",
"Keyword",
":",
"名称匹配搜索,当查询类型为用户时,匹配范围包括:用户名称、应用名称;当查询类型为用户组时,匹配范围包括:用户组名称、应用名称;当查询类型为组织机构时,匹配范围包括:组织机构名称、应用名称。",
":",
"type",
"Keyword",
":",
"str"
] | def __init__(self):
r"""
:param Keyword: 名称匹配搜索,当查询类型为用户时,匹配范围包括:用户名称、应用名称;当查询类型为用户组时,匹配范围包括:用户组名称、应用名称;当查询类型为组织机构时,匹配范围包括:组织机构名称、应用名称。
:type Keyword: str
"""
self.Keyword = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"Keyword",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/eiam/v20210420/models.py#L432-L437 | ||
cgre-aachen/gempy | 6ad16c46fc6616c9f452fba85d31ce32decd8b10 | gempy/core/theano_modules/theano_graph.py | python | TheanoGraph.__init__ | (self, output='geology', optimizer='fast_compile', verbose=[0], dtype='float32',
is_fault=None, is_lith=None) | In the init we need to create all the symbolic parameters that are used in the process. Most of the variables
are shared parameters initialized with random values. At this stage we only care about the type and shape of the
parameters. After we have the graph built we can update the value of these shared... | In the init we need to create all the symbolic parameters that are used in the process. Most of the variables
are shared parameters initialized with random values. At this stage we only care about the type and shape of the
parameters. After we have the graph built we can update the value of these shared... | [
"In",
"the",
"init",
"we",
"need",
"to",
"create",
"all",
"the",
"symbolic",
"parameters",
"that",
"are",
"used",
"in",
"the",
"process",
".",
"Most",
"of",
"the",
"variables",
"are",
"shared",
"parameters",
"initialized",
"with",
"random",
"values",
".",
... | def __init__(self, output='geology', optimizer='fast_compile', verbose=[0], dtype='float32',
is_fault=None, is_lith=None):
"""
In the init we need to create all the symbolic parameters that are used in the process. Most of the variables
are shared parameters initialized with ran... | [
"def",
"__init__",
"(",
"self",
",",
"output",
"=",
"'geology'",
",",
"optimizer",
"=",
"'fast_compile'",
",",
"verbose",
"=",
"[",
"0",
"]",
",",
"dtype",
"=",
"'float32'",
",",
"is_fault",
"=",
"None",
",",
"is_lith",
"=",
"None",
")",
":",
"# Pass t... | https://github.com/cgre-aachen/gempy/blob/6ad16c46fc6616c9f452fba85d31ce32decd8b10/gempy/core/theano_modules/theano_graph.py#L53-L221 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/sqlalchemy/dialects/oracle/base.py | python | OracleCompiler.__init__ | (self, *args, **kwargs) | [] | def __init__(self, *args, **kwargs):
self.__wheres = {}
self._quoted_bind_names = {}
super(OracleCompiler, self).__init__(*args, **kwargs) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"__wheres",
"=",
"{",
"}",
"self",
".",
"_quoted_bind_names",
"=",
"{",
"}",
"super",
"(",
"OracleCompiler",
",",
"self",
")",
".",
"__init__",
"(",
"... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/sqlalchemy/dialects/oracle/base.py#L671-L674 | ||||
shiweibsw/Translation-Tools | 2fbbf902364e557fa7017f9a74a8797b7440c077 | venv/Lib/site-packages/xlwt/Workbook.py | python | Workbook.add_sheet | (self, sheetname, cell_overwrite_ok=False) | return self.__worksheets[-1] | This method is used to create Worksheets in a Workbook.
:param sheetname:
The name to use for this sheet, as it will appear in the
tabs at the bottom of the Excel application.
:param cell_overwrite_ok:
If ``True``, cells in the added worksheet will not raise an
... | This method is used to create Worksheets in a Workbook. | [
"This",
"method",
"is",
"used",
"to",
"create",
"Worksheets",
"in",
"a",
"Workbook",
"."
] | def add_sheet(self, sheetname, cell_overwrite_ok=False):
"""
This method is used to create Worksheets in a Workbook.
:param sheetname:
The name to use for this sheet, as it will appear in the
tabs at the bottom of the Excel application.
:param cell_overwrite_ok:
... | [
"def",
"add_sheet",
"(",
"self",
",",
"sheetname",
",",
"cell_overwrite_ok",
"=",
"False",
")",
":",
"from",
".",
"import",
"Utils",
"from",
".",
"Worksheet",
"import",
"Worksheet",
"if",
"not",
"isinstance",
"(",
"sheetname",
",",
"unicode_type",
")",
":",
... | https://github.com/shiweibsw/Translation-Tools/blob/2fbbf902364e557fa7017f9a74a8797b7440c077/venv/Lib/site-packages/xlwt/Workbook.py#L344-L374 | |
triaquae/triaquae | bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9 | TriAquae/models/django/contrib/admin/sites.py | python | AdminSite.__init__ | (self, name='admin', app_name='admin') | [] | def __init__(self, name='admin', app_name='admin'):
self._registry = {} # model_class class -> admin_class instance
self.name = name
self.app_name = app_name
self._actions = {'delete_selected': actions.delete_selected}
self._global_actions = self._actions.copy() | [
"def",
"__init__",
"(",
"self",
",",
"name",
"=",
"'admin'",
",",
"app_name",
"=",
"'admin'",
")",
":",
"self",
".",
"_registry",
"=",
"{",
"}",
"# model_class class -> admin_class instance",
"self",
".",
"name",
"=",
"name",
"self",
".",
"app_name",
"=",
... | https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/django/contrib/admin/sites.py#L45-L50 | ||||
p2pool/p2pool | 53c438bbada06b9d4a9a465bc13f7694a7a322b7 | wstools/XMLSchema.py | python | DOMAdapter.loadFromURL | (self, url) | [] | def loadFromURL(self, url):
self.__node = DOM.loadFromURL(url)
if hasattr(self.__node, 'documentElement'):
self.__node = self.__node.documentElement | [
"def",
"loadFromURL",
"(",
"self",
",",
"url",
")",
":",
"self",
".",
"__node",
"=",
"DOM",
".",
"loadFromURL",
"(",
"url",
")",
"if",
"hasattr",
"(",
"self",
".",
"__node",
",",
"'documentElement'",
")",
":",
"self",
".",
"__node",
"=",
"self",
".",... | https://github.com/p2pool/p2pool/blob/53c438bbada06b9d4a9a465bc13f7694a7a322b7/wstools/XMLSchema.py#L296-L299 | ||||
AstroPrint/AstroBox | e7e3b8a7d33ea85fcb6b2696869c0d719ceb8b75 | src/astroprint/camera/v4l2/gstreamer/pipeline.py | python | AstroPrintPipeline.stopProcess | (self) | [] | def stopProcess(self):
if self._process:
if self._listening:
self._sendReqToProcess({'action': 'shutdown'})
self._process.join(2.0) #Give it two seconds to exit and kill otherwise
if self._process: # It's possible that while waiting for the join this has been closed by another process ( Issue https://g... | [
"def",
"stopProcess",
"(",
"self",
")",
":",
"if",
"self",
".",
"_process",
":",
"if",
"self",
".",
"_listening",
":",
"self",
".",
"_sendReqToProcess",
"(",
"{",
"'action'",
":",
"'shutdown'",
"}",
")",
"self",
".",
"_process",
".",
"join",
"(",
"2.0"... | https://github.com/AstroPrint/AstroBox/blob/e7e3b8a7d33ea85fcb6b2696869c0d719ceb8b75/src/astroprint/camera/v4l2/gstreamer/pipeline.py#L98-L114 | ||||
nucleic/enaml | 65c2a2a2d765e88f2e1103046680571894bb41ed | enaml/core/import_hooks.py | python | EnamlImporter.get_code | (self) | return self.compile_code() | Loads and returns the code object for the Enaml module and
the full path to the module for use as the __file__ attribute
of the module.
Returns
-------
result : (code, path)
The Python code object for the .enaml module, and the full
path to the module as ... | Loads and returns the code object for the Enaml module and
the full path to the module for use as the __file__ attribute
of the module. | [
"Loads",
"and",
"returns",
"the",
"code",
"object",
"for",
"the",
"Enaml",
"module",
"and",
"the",
"full",
"path",
"to",
"the",
"module",
"for",
"use",
"as",
"the",
"__file__",
"attribute",
"of",
"the",
"module",
"."
] | def get_code(self):
""" Loads and returns the code object for the Enaml module and
the full path to the module for use as the __file__ attribute
of the module.
Returns
-------
result : (code, path)
The Python code object for the .enaml module, and the full
... | [
"def",
"get_code",
"(",
"self",
")",
":",
"# If the .enaml file does not exist, just use the .enamlc file.",
"# We can presume that the latter exists because it was already",
"# checked by the loader. Should the situation ever arise that",
"# it was deleted between then and now, an IOError is more... | https://github.com/nucleic/enaml/blob/65c2a2a2d765e88f2e1103046680571894bb41ed/enaml/core/import_hooks.py#L370-L401 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/polys/densearith.py | python | dmp_mul | (f, g, u, K) | return dmp_strip(h, u) | Multiply dense polynomials in ``K[X]``.
Examples
========
>>> from sympy.polys import ring, ZZ
>>> R, x,y = ring("x,y", ZZ)
>>> R.dmp_mul(x*y + 1, x)
x**2*y + x | Multiply dense polynomials in ``K[X]``. | [
"Multiply",
"dense",
"polynomials",
"in",
"K",
"[",
"X",
"]",
"."
] | def dmp_mul(f, g, u, K):
"""
Multiply dense polynomials in ``K[X]``.
Examples
========
>>> from sympy.polys import ring, ZZ
>>> R, x,y = ring("x,y", ZZ)
>>> R.dmp_mul(x*y + 1, x)
x**2*y + x
"""
if not u:
return dup_mul(f, g, K)
if f == g:
return dmp_sqr(f... | [
"def",
"dmp_mul",
"(",
"f",
",",
"g",
",",
"u",
",",
"K",
")",
":",
"if",
"not",
"u",
":",
"return",
"dup_mul",
"(",
"f",
",",
"g",
",",
"K",
")",
"if",
"f",
"==",
"g",
":",
"return",
"dmp_sqr",
"(",
"f",
",",
"u",
",",
"K",
")",
"df",
... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/polys/densearith.py#L796-L836 | |
Dvlv/Tkinter-By-Example | 30721f15f7bea41489a7c46819beb5282781e563 | Code/Chapter4-2.py | python | Game.set_game_screens | (self, game_screens) | [] | def set_game_screens(self, game_screens):
self.game_screens = game_screens | [
"def",
"set_game_screens",
"(",
"self",
",",
"game_screens",
")",
":",
"self",
".",
"game_screens",
"=",
"game_screens"
] | https://github.com/Dvlv/Tkinter-By-Example/blob/30721f15f7bea41489a7c46819beb5282781e563/Code/Chapter4-2.py#L140-L141 | ||||
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-darwin/x64/psutil/_pssunos.py | python | Process.__init__ | (self, pid) | [] | def __init__(self, pid):
self.pid = pid
self._name = None
self._ppid = None
self._procfs_path = get_procfs_path() | [
"def",
"__init__",
"(",
"self",
",",
"pid",
")",
":",
"self",
".",
"pid",
"=",
"pid",
"self",
".",
"_name",
"=",
"None",
"self",
".",
"_ppid",
"=",
"None",
"self",
".",
"_procfs_path",
"=",
"get_procfs_path",
"(",
")"
] | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-darwin/x64/psutil/_pssunos.py#L369-L373 | ||||
google/language-resources | a90601024f07ab7e96c911243324e0adeb16da96 | mul_034/script_util.py | python | ScriptSymbols | (script, include_script_code=False) | return | Yields short symbol names for all characters in the given script. | Yields short symbol names for all characters in the given script. | [
"Yields",
"short",
"symbol",
"names",
"for",
"all",
"characters",
"in",
"the",
"given",
"script",
"."
] | def ScriptSymbols(script, include_script_code=False):
"""Yields short symbol names for all characters in the given script."""
script_chars = icu.UnicodeSet(r'[\p{%s}\u200C\u200D]' % script.getName())
script_name = script.getName().replace('_', ' ')
utf8.stderr.write('Found %d characters specific to %s (%s)\n' %... | [
"def",
"ScriptSymbols",
"(",
"script",
",",
"include_script_code",
"=",
"False",
")",
":",
"script_chars",
"=",
"icu",
".",
"UnicodeSet",
"(",
"r'[\\p{%s}\\u200C\\u200D]'",
"%",
"script",
".",
"getName",
"(",
")",
")",
"script_name",
"=",
"script",
".",
"getNa... | https://github.com/google/language-resources/blob/a90601024f07ab7e96c911243324e0adeb16da96/mul_034/script_util.py#L278-L309 | |
sigmavirus24/github3.py | f642a27833d6bef93daf5bb27b35e5ddbcfbb773 | src/github3/orgs.py | python | _Organization.teams | (self, number=-1, etag=None) | return self._iter(int(number), url, ShortTeam, etag=etag) | Iterate over teams that are part of this organization.
:param int number:
(optional), number of teams to return. Default: -1 returns all
available teams.
:param str etag:
(optional), ETag from a previous request to the same endpoint
:returns:
gene... | Iterate over teams that are part of this organization. | [
"Iterate",
"over",
"teams",
"that",
"are",
"part",
"of",
"this",
"organization",
"."
] | def teams(self, number=-1, etag=None):
"""Iterate over teams that are part of this organization.
:param int number:
(optional), number of teams to return. Default: -1 returns all
available teams.
:param str etag:
(optional), ETag from a previous request to th... | [
"def",
"teams",
"(",
"self",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"\"teams\"",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_iter",
"(",
"int",
"(... | https://github.com/sigmavirus24/github3.py/blob/f642a27833d6bef93daf5bb27b35e5ddbcfbb773/src/github3/orgs.py#L1093-L1107 | |
nilearn/nilearn | 9edba4471747efacf21260bf470a346307f52706 | nilearn/interfaces/fmriprep/load_confounds_utils.py | python | _confounds_to_df | (image_file, flag_acompcor, flag_full_aroma) | return confounds_raw, confounds_json | Load raw confounds and associated metadata. | Load raw confounds and associated metadata. | [
"Load",
"raw",
"confounds",
"and",
"associated",
"metadata",
"."
] | def _confounds_to_df(image_file, flag_acompcor, flag_full_aroma):
"""Load raw confounds and associated metadata."""
_check_images(image_file, flag_full_aroma)
confounds_raw_path = _get_file_name(image_file)
confounds_json = _get_json(confounds_raw_path, flag_acompcor)
confounds_raw = _get_file_raw(c... | [
"def",
"_confounds_to_df",
"(",
"image_file",
",",
"flag_acompcor",
",",
"flag_full_aroma",
")",
":",
"_check_images",
"(",
"image_file",
",",
"flag_full_aroma",
")",
"confounds_raw_path",
"=",
"_get_file_name",
"(",
"image_file",
")",
"confounds_json",
"=",
"_get_jso... | https://github.com/nilearn/nilearn/blob/9edba4471747efacf21260bf470a346307f52706/nilearn/interfaces/fmriprep/load_confounds_utils.py#L200-L206 | |
SethMMorton/natsort | 9616d2909899e1a47735c6fcdb6fa84d08c03206 | natsort/utils.py | python | NumericalRegularExpressions._construct_regex | (cls, fmt: str) | return re.compile(fmt.format(**vars(cls)), flags=re.U) | Given a format string, construct the regex with class attributes. | Given a format string, construct the regex with class attributes. | [
"Given",
"a",
"format",
"string",
"construct",
"the",
"regex",
"with",
"class",
"attributes",
"."
] | def _construct_regex(cls, fmt: str) -> Pattern[str]:
"""Given a format string, construct the regex with class attributes."""
return re.compile(fmt.format(**vars(cls)), flags=re.U) | [
"def",
"_construct_regex",
"(",
"cls",
",",
"fmt",
":",
"str",
")",
"->",
"Pattern",
"[",
"str",
"]",
":",
"return",
"re",
".",
"compile",
"(",
"fmt",
".",
"format",
"(",
"*",
"*",
"vars",
"(",
"cls",
")",
")",
",",
"flags",
"=",
"re",
".",
"U"... | https://github.com/SethMMorton/natsort/blob/9616d2909899e1a47735c6fcdb6fa84d08c03206/natsort/utils.py#L148-L150 | |
couchbase/couchbase-python-client | 58ccfd42af320bde6b733acf094fd5a4cf34e0ad | couchbase/exceptions.py | python | CouchbaseException._can_derive | (cls, rc) | return issubclass(cls.rc_to_exctype(rc), cls) | Determines if the given error code is logically derived from this class
:param int rc: the error code to check
:return: a boolean indicating if the code is derived from this exception | Determines if the given error code is logically derived from this class
:param int rc: the error code to check
:return: a boolean indicating if the code is derived from this exception | [
"Determines",
"if",
"the",
"given",
"error",
"code",
"is",
"logically",
"derived",
"from",
"this",
"class",
":",
"param",
"int",
"rc",
":",
"the",
"error",
"code",
"to",
"check",
":",
"return",
":",
"a",
"boolean",
"indicating",
"if",
"the",
"code",
"is"... | def _can_derive(cls, rc):
"""
Determines if the given error code is logically derived from this class
:param int rc: the error code to check
:return: a boolean indicating if the code is derived from this exception
"""
return issubclass(cls.rc_to_exctype(rc), cls) | [
"def",
"_can_derive",
"(",
"cls",
",",
"rc",
")",
":",
"return",
"issubclass",
"(",
"cls",
".",
"rc_to_exctype",
"(",
"rc",
")",
",",
"cls",
")"
] | https://github.com/couchbase/couchbase-python-client/blob/58ccfd42af320bde6b733acf094fd5a4cf34e0ad/couchbase/exceptions.py#L120-L126 | |
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/Django-1.11.29/django/contrib/admin/templatetags/admin_list.py | python | _coerce_field_name | (field_name, field_index) | return field_name | Coerce a field_name (which may be a callable) to a string. | Coerce a field_name (which may be a callable) to a string. | [
"Coerce",
"a",
"field_name",
"(",
"which",
"may",
"be",
"a",
"callable",
")",
"to",
"a",
"string",
"."
] | def _coerce_field_name(field_name, field_index):
"""
Coerce a field_name (which may be a callable) to a string.
"""
if callable(field_name):
if field_name.__name__ == '<lambda>':
return 'lambda' + str(field_index)
else:
return field_name.__name__
return field_... | [
"def",
"_coerce_field_name",
"(",
"field_name",
",",
"field_index",
")",
":",
"if",
"callable",
"(",
"field_name",
")",
":",
"if",
"field_name",
".",
"__name__",
"==",
"'<lambda>'",
":",
"return",
"'lambda'",
"+",
"str",
"(",
"field_index",
")",
"else",
":",... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/Django-1.11.29/django/contrib/admin/templatetags/admin_list.py#L188-L197 | |
CLUEbenchmark/CLUEPretrainedModels | b384fd41665a8261f9c689c940cf750b3bc21fce | baselines/models/roberta/run_classifier.py | python | file_based_convert_examples_to_features | (
examples, label_list, max_seq_length, tokenizer, output_file) | Convert a set of `InputExample`s to a TFRecord file. | Convert a set of `InputExample`s to a TFRecord file. | [
"Convert",
"a",
"set",
"of",
"InputExample",
"s",
"to",
"a",
"TFRecord",
"file",
"."
] | def file_based_convert_examples_to_features(
examples, label_list, max_seq_length, tokenizer, output_file):
"""Convert a set of `InputExample`s to a TFRecord file."""
writer = tf.python_io.TFRecordWriter(output_file)
for (ex_index, example) in enumerate(examples):
if ex_index % 10000 == 0:
tf.... | [
"def",
"file_based_convert_examples_to_features",
"(",
"examples",
",",
"label_list",
",",
"max_seq_length",
",",
"tokenizer",
",",
"output_file",
")",
":",
"writer",
"=",
"tf",
".",
"python_io",
".",
"TFRecordWriter",
"(",
"output_file",
")",
"for",
"(",
"ex_inde... | https://github.com/CLUEbenchmark/CLUEPretrainedModels/blob/b384fd41665a8261f9c689c940cf750b3bc21fce/baselines/models/roberta/run_classifier.py#L411-L438 | ||
oracle/oci-python-sdk | 3c1604e4e212008fb6718e2f68cdb5ef71fd5793 | examples/network_security_groups_example.py | python | update_nsgs_in_vnic | (virtual_network_client, nsg_id, nsg_id_2, vnic_id) | return add_nsg_to_vnic_response | [] | def update_nsgs_in_vnic(virtual_network_client, nsg_id, nsg_id_2, vnic_id):
add_nsg_to_vnic_response = virtual_network_client.update_vnic(
vnic_id,
oci.core.models.UpdateVnicDetails(
nsg_ids=[nsg_id, nsg_id_2]
)
).data
return add_nsg_to_vnic_response | [
"def",
"update_nsgs_in_vnic",
"(",
"virtual_network_client",
",",
"nsg_id",
",",
"nsg_id_2",
",",
"vnic_id",
")",
":",
"add_nsg_to_vnic_response",
"=",
"virtual_network_client",
".",
"update_vnic",
"(",
"vnic_id",
",",
"oci",
".",
"core",
".",
"models",
".",
"Upda... | https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/examples/network_security_groups_example.py#L140-L147 | |||
seppius-xbmc-repo/ru | d0879d56ec8243b2c7af44fda5cf3d1ff77fd2e2 | script.module.html5lib/lib/html5lib/treebuilders/etree_lxml.py | python | TreeBuilder.getDocument | (self) | [] | def getDocument(self):
if fullTree:
return self.document._elementTree
else:
return self.document._elementTree.getroot() | [
"def",
"getDocument",
"(",
"self",
")",
":",
"if",
"fullTree",
":",
"return",
"self",
".",
"document",
".",
"_elementTree",
"else",
":",
"return",
"self",
".",
"document",
".",
"_elementTree",
".",
"getroot",
"(",
")"
] | https://github.com/seppius-xbmc-repo/ru/blob/d0879d56ec8243b2c7af44fda5cf3d1ff77fd2e2/script.module.html5lib/lib/html5lib/treebuilders/etree_lxml.py#L273-L277 | ||||
pydicom/pynetdicom | f57d8214c82b63c8e76638af43ce331f584a80fa | pynetdicom/ae.py | python | ApplicationEntity.remove_supported_context | (
self,
abstract_syntax: Union[str, UID],
transfer_syntax: TSyntaxType = None,
) | Remove a supported presentation context.
Depending on the supplied parameters one of the following will occur:
* `abstract_syntax` alone - the entire supported context will be
removed.
* `abstract_syntax` and `transfer_syntax` - If the supplied
`transfer_syntax` list conta... | Remove a supported presentation context. | [
"Remove",
"a",
"supported",
"presentation",
"context",
"."
] | def remove_supported_context(
self,
abstract_syntax: Union[str, UID],
transfer_syntax: TSyntaxType = None,
) -> None:
"""Remove a supported presentation context.
Depending on the supplied parameters one of the following will occur:
* `abstract_syntax` alone - the en... | [
"def",
"remove_supported_context",
"(",
"self",
",",
"abstract_syntax",
":",
"Union",
"[",
"str",
",",
"UID",
"]",
",",
"transfer_syntax",
":",
"TSyntaxType",
"=",
"None",
",",
")",
"->",
"None",
":",
"abstract_syntax",
"=",
"UID",
"(",
"abstract_syntax",
")... | https://github.com/pydicom/pynetdicom/blob/f57d8214c82b63c8e76638af43ce331f584a80fa/pynetdicom/ae.py#L1042-L1164 | ||
GoSecure/pyrdp | abd8b8762b6d7fd0e49d4a927b529f892b412743 | pyrdp/player/RenderingEventHandler.py | python | RenderingEventHandler.__init__ | (self, imageHandler: ImageHandler) | [] | def __init__(self, imageHandler: ImageHandler):
BaseEventHandler.__init__(self)
self._fastPath = FastPathOutputParser()
self._bitmap = BitmapParser()
self.gdi: GdiQtFrontend = None
self._orders: OrdersParser = None
self.log = logging.getLogger(__name__)
self.image... | [
"def",
"__init__",
"(",
"self",
",",
"imageHandler",
":",
"ImageHandler",
")",
":",
"BaseEventHandler",
".",
"__init__",
"(",
"self",
")",
"self",
".",
"_fastPath",
"=",
"FastPathOutputParser",
"(",
")",
"self",
".",
"_bitmap",
"=",
"BitmapParser",
"(",
")",... | https://github.com/GoSecure/pyrdp/blob/abd8b8762b6d7fd0e49d4a927b529f892b412743/pyrdp/player/RenderingEventHandler.py#L21-L28 | ||||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppDB/appscale/datastore/fdb/indexes.py | python | PropertyIterator._populated | (self, prop_index, type_name) | Checks if at least one entity exists for a given type name. | Checks if at least one entity exists for a given type name. | [
"Checks",
"if",
"at",
"least",
"one",
"entity",
"exists",
"for",
"a",
"given",
"type",
"name",
"."
] | def _populated(self, prop_index, type_name):
""" Checks if at least one entity exists for a given type name. """
index_slice = prop_index.type_range(type_name)
# This query is reversed to increase the likelihood of getting a relevant
# (not marked for GC) entry.
iterator = IndexIterator(self._tr, se... | [
"def",
"_populated",
"(",
"self",
",",
"prop_index",
",",
"type_name",
")",
":",
"index_slice",
"=",
"prop_index",
".",
"type_range",
"(",
"type_name",
")",
"# This query is reversed to increase the likelihood of getting a relevant",
"# (not marked for GC) entry.",
"iterator"... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppDB/appscale/datastore/fdb/indexes.py#L341-L355 | ||
jhorey/ferry | bbaa047df08386e17130a939e20fde5e840d1ffa | ferry/http/httpapi.py | python | query_storage | () | return status.json() | Fetch the current information for a particular filesystem. | Fetch the current information for a particular filesystem. | [
"Fetch",
"the",
"current",
"information",
"for",
"a",
"particular",
"filesystem",
"."
] | def query_storage():
"""
Fetch the current information for a particular filesystem.
"""
status = AllocationResponse()
status.uuid = request.args['uuid']
status.status = status.NOT_EXISTS
# Get the time the storage cluster was created,
# along with basic usage information.
info = ... | [
"def",
"query_storage",
"(",
")",
":",
"status",
"=",
"AllocationResponse",
"(",
")",
"status",
".",
"uuid",
"=",
"request",
".",
"args",
"[",
"'uuid'",
"]",
"status",
".",
"status",
"=",
"status",
".",
"NOT_EXISTS",
"# Get the time the storage cluster was creat... | https://github.com/jhorey/ferry/blob/bbaa047df08386e17130a939e20fde5e840d1ffa/ferry/http/httpapi.py#L605-L620 | |
osmr/imgclsmob | f2993d3ce73a2f7ddba05da3891defb08547d504 | pytorch/pytorchcv/models/regnet.py | python | regnetx160 | (**kwargs) | return get_regnet(channels_init=216, channels_slope=55.59, channels_mult=2.1, depth=22, groups=128,
model_name="regnetx160", **kwargs) | RegNetX-16GF model from 'Designing Network Design Spaces,' https://arxiv.org/abs/2003.13678.
Parameters:
----------
pretrained : bool, default False
Whether to load the pretrained weights for model.
root : str, default '~/.torch/models'
Location for keeping the model parameters. | RegNetX-16GF model from 'Designing Network Design Spaces,' https://arxiv.org/abs/2003.13678. | [
"RegNetX",
"-",
"16GF",
"model",
"from",
"Designing",
"Network",
"Design",
"Spaces",
"https",
":",
"//",
"arxiv",
".",
"org",
"/",
"abs",
"/",
"2003",
".",
"13678",
"."
] | def regnetx160(**kwargs):
"""
RegNetX-16GF model from 'Designing Network Design Spaces,' https://arxiv.org/abs/2003.13678.
Parameters:
----------
pretrained : bool, default False
Whether to load the pretrained weights for model.
root : str, default '~/.torch/models'
Location for... | [
"def",
"regnetx160",
"(",
"*",
"*",
"kwargs",
")",
":",
"return",
"get_regnet",
"(",
"channels_init",
"=",
"216",
",",
"channels_slope",
"=",
"55.59",
",",
"channels_mult",
"=",
"2.1",
",",
"depth",
"=",
"22",
",",
"groups",
"=",
"128",
",",
"model_name"... | https://github.com/osmr/imgclsmob/blob/f2993d3ce73a2f7ddba05da3891defb08547d504/pytorch/pytorchcv/models/regnet.py#L424-L436 | |
zulip/python-zulip-api | 70b86614bd15347e28ec2cab4c87c01122faae16 | zulip_bots/zulip_bots/bots/link_shortener/link_shortener.py | python | LinkShortenerHandler.shorten_link | (self, long_url: str) | return shorten_url | Shortens a link using goo.gl Link Shortener and returns it, or
returns an empty string if something goes wrong.
Parameters:
long_url (str): The original URL to shorten. | Shortens a link using goo.gl Link Shortener and returns it, or
returns an empty string if something goes wrong. | [
"Shortens",
"a",
"link",
"using",
"goo",
".",
"gl",
"Link",
"Shortener",
"and",
"returns",
"it",
"or",
"returns",
"an",
"empty",
"string",
"if",
"something",
"goes",
"wrong",
"."
] | def shorten_link(self, long_url: str) -> str:
"""Shortens a link using goo.gl Link Shortener and returns it, or
returns an empty string if something goes wrong.
Parameters:
long_url (str): The original URL to shorten.
"""
response_json = self.call_link_shorten_servi... | [
"def",
"shorten_link",
"(",
"self",
",",
"long_url",
":",
"str",
")",
"->",
"str",
":",
"response_json",
"=",
"self",
".",
"call_link_shorten_service",
"(",
"long_url",
")",
"if",
"response_json",
"[",
"\"status_code\"",
"]",
"==",
"200",
"and",
"self",
".",... | https://github.com/zulip/python-zulip-api/blob/70b86614bd15347e28ec2cab4c87c01122faae16/zulip_bots/zulip_bots/bots/link_shortener/link_shortener.py#L79-L92 | |
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/com.oracle.graal.python.cext/setup.py | python | LZMADepedency.install | (self, build_dir=None) | return self.build() | [] | def install(self, build_dir=None):
lib_path = os.path.join(self.lib_install_dir, "lib%s.%s" % (self.lib_name, lib_ext))
if os.path.exists(lib_path):
# library has been built earlier, so just return the install directory.
return self.lib_install_dir
return self.build() | [
"def",
"install",
"(",
"self",
",",
"build_dir",
"=",
"None",
")",
":",
"lib_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"lib_install_dir",
",",
"\"lib%s.%s\"",
"%",
"(",
"self",
".",
"lib_name",
",",
"lib_ext",
")",
")",
"if",
"os"... | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/com.oracle.graal.python.cext/setup.py#L326-L332 | |||
catalyst-team/catalyst | 678dc06eda1848242df010b7f34adb572def2598 | catalyst/contrib/data/reader_nifti.py | python | NiftiReader.__init__ | (
self, input_key: str, output_key: Optional[str] = None, rootpath: Optional[str] = None
) | Args:
input_key (str): key to use from annotation dict
output_key (str): key to use to store the result
rootpath (str): path to images dataset root directory
(so your can use relative paths in annotations) | Args:
input_key (str): key to use from annotation dict
output_key (str): key to use to store the result
rootpath (str): path to images dataset root directory
(so your can use relative paths in annotations) | [
"Args",
":",
"input_key",
"(",
"str",
")",
":",
"key",
"to",
"use",
"from",
"annotation",
"dict",
"output_key",
"(",
"str",
")",
":",
"key",
"to",
"use",
"to",
"store",
"the",
"result",
"rootpath",
"(",
"str",
")",
":",
"path",
"to",
"images",
"datas... | def __init__(
self, input_key: str, output_key: Optional[str] = None, rootpath: Optional[str] = None
):
"""
Args:
input_key (str): key to use from annotation dict
output_key (str): key to use to store the result
rootpath (str): path to images dataset root ... | [
"def",
"__init__",
"(",
"self",
",",
"input_key",
":",
"str",
",",
"output_key",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"rootpath",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"inpu... | https://github.com/catalyst-team/catalyst/blob/678dc06eda1848242df010b7f34adb572def2598/catalyst/contrib/data/reader_nifti.py#L17-L28 | ||
sybrenstuvel/flickrapi | 4de81d85dcdd73e4e1d19b112a0ff93feb0d10f7 | flickrapi/core.py | python | FlickrAPI._flickr_call | (self, timeout=None, **kwargs) | return reply | Performs a Flickr API call with the given arguments. The method name
itself should be passed as the 'method' parameter.
Returns the unparsed data from Flickr::
data = self._flickr_call(method='flickr.photos.getInfo',
photo_id='123', format='rest') | Performs a Flickr API call with the given arguments. The method name
itself should be passed as the 'method' parameter. | [
"Performs",
"a",
"Flickr",
"API",
"call",
"with",
"the",
"given",
"arguments",
".",
"The",
"method",
"name",
"itself",
"should",
"be",
"passed",
"as",
"the",
"method",
"parameter",
"."
] | def _flickr_call(self, timeout=None, **kwargs):
"""Performs a Flickr API call with the given arguments. The method name
itself should be passed as the 'method' parameter.
Returns the unparsed data from Flickr::
data = self._flickr_call(method='flickr.photos.getInfo',
... | [
"def",
"_flickr_call",
"(",
"self",
",",
"timeout",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"LOG",
".",
"debug",
"(",
"\"Calling %s\"",
"%",
"kwargs",
")",
"# Return value from cache if available",
"if",
"self",
".",
"cache",
"and",
"self",
".",
"c... | https://github.com/sybrenstuvel/flickrapi/blob/4de81d85dcdd73e4e1d19b112a0ff93feb0d10f7/flickrapi/core.py#L371-L393 | |
trigger/trigger | c089f761a150f537f7e3201422a3964ec52ff245 | trigger/acl/support.py | python | Term.output_ios | (self, prefix=None, acl_name=None) | return comments + self._ioslike(prefix) | Output term to IOS traditional format.
:param prefix: Prefix to use, default: 'access-list'
:param acl_name: Name of access-list to display | Output term to IOS traditional format. | [
"Output",
"term",
"to",
"IOS",
"traditional",
"format",
"."
] | def output_ios(self, prefix=None, acl_name=None):
"""
Output term to IOS traditional format.
:param prefix: Prefix to use, default: 'access-list'
:param acl_name: Name of access-list to display
"""
comments = [c.output_ios() for c in self.comments]
# If prefix is... | [
"def",
"output_ios",
"(",
"self",
",",
"prefix",
"=",
"None",
",",
"acl_name",
"=",
"None",
")",
":",
"comments",
"=",
"[",
"c",
".",
"output_ios",
"(",
")",
"for",
"c",
"in",
"self",
".",
"comments",
"]",
"# If prefix isn't set, but name is, force the templ... | https://github.com/trigger/trigger/blob/c089f761a150f537f7e3201422a3964ec52ff245/trigger/acl/support.py#L898-L923 | |
pypr/pysph | 9cb9a859934939307c65a25cbf73e4ecc83fea4a | pysph/sph/swe/basic.py | python | artificial_visc | (alpha=1.0, rij2=1.0, hi=1.0, hj=1.0, rhoi=1.0, rhoj=1.0,
csi=1.0, csj=1.0, muij=1.0) | return pi_visc | r"""**Artificial viscosity based stabilization term (Monaghan)**
Activated when :math:`\textbf{v}_{ij}.\textbf{x}_{ij} < 0`
Given by
.. math::
\Pi_{ij} = \dfrac{-a\bar c_{ij}\mu_{ij}+b\bar c_{ij}\mu_{ij}^2}{\rho_{ij}}
References
----------
.. [Monaghan2005] J. Monaghan, "Smoothed partic... | r"""**Artificial viscosity based stabilization term (Monaghan)** | [
"r",
"**",
"Artificial",
"viscosity",
"based",
"stabilization",
"term",
"(",
"Monaghan",
")",
"**"
] | def artificial_visc(alpha=1.0, rij2=1.0, hi=1.0, hj=1.0, rhoi=1.0, rhoj=1.0,
csi=1.0, csj=1.0, muij=1.0):
r"""**Artificial viscosity based stabilization term (Monaghan)**
Activated when :math:`\textbf{v}_{ij}.\textbf{x}_{ij} < 0`
Given by
.. math::
\Pi_{ij} = \dfrac{-a\bar c... | [
"def",
"artificial_visc",
"(",
"alpha",
"=",
"1.0",
",",
"rij2",
"=",
"1.0",
",",
"hi",
"=",
"1.0",
",",
"hj",
"=",
"1.0",
",",
"rhoi",
"=",
"1.0",
",",
"rhoj",
"=",
"1.0",
",",
"csi",
"=",
"1.0",
",",
"csj",
"=",
"1.0",
",",
"muij",
"=",
"1.... | https://github.com/pypr/pysph/blob/9cb9a859934939307c65a25cbf73e4ecc83fea4a/pysph/sph/swe/basic.py#L998-L1019 | |
mit-han-lab/once-for-all | 4f6fce3652ee4553ea811d38f32f90ac8b1bc378 | ofa/imagenet_classification/networks/proxyless_nets.py | python | proxyless_base | (net_config=None, n_classes=None, bn_param=None, dropout_rate=None,
local_path='~/.torch/proxylessnas/') | return net | [] | def proxyless_base(net_config=None, n_classes=None, bn_param=None, dropout_rate=None,
local_path='~/.torch/proxylessnas/'):
assert net_config is not None, 'Please input a network config'
if 'http' in net_config:
net_config_path = download_url(net_config, local_path)
else:
net_config_path = net... | [
"def",
"proxyless_base",
"(",
"net_config",
"=",
"None",
",",
"n_classes",
"=",
"None",
",",
"bn_param",
"=",
"None",
",",
"dropout_rate",
"=",
"None",
",",
"local_path",
"=",
"'~/.torch/proxylessnas/'",
")",
":",
"assert",
"net_config",
"is",
"not",
"None",
... | https://github.com/mit-han-lab/once-for-all/blob/4f6fce3652ee4553ea811d38f32f90ac8b1bc378/ofa/imagenet_classification/networks/proxyless_nets.py#L14-L32 | |||
1120362990/vulnerability-list | 59a1b3f8f9c32ec2620b2953ab561b44a8e8dd95 | tomcat/CVE_2020_1938.py | python | AjpForwardRequest.__init__ | (self, data_direction=None) | [] | def __init__(self, data_direction=None):
self.prefix_code = 0x02
self.method = None
self.protocol = None
self.req_uri = None
self.remote_addr = None
self.remote_host = None
self.server_name = None
self.server_port = None
self.is_ssl = None
... | [
"def",
"__init__",
"(",
"self",
",",
"data_direction",
"=",
"None",
")",
":",
"self",
".",
"prefix_code",
"=",
"0x02",
"self",
".",
"method",
"=",
"None",
"self",
".",
"protocol",
"=",
"None",
"self",
".",
"req_uri",
"=",
"None",
"self",
".",
"remote_a... | https://github.com/1120362990/vulnerability-list/blob/59a1b3f8f9c32ec2620b2953ab561b44a8e8dd95/tomcat/CVE_2020_1938.py#L104-L117 | ||||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.5/django/forms/fields.py | python | Field.clean | (self, value) | return value | Validates the given value and returns its "cleaned" value as an
appropriate Python object.
Raises ValidationError for any errors. | Validates the given value and returns its "cleaned" value as an
appropriate Python object. | [
"Validates",
"the",
"given",
"value",
"and",
"returns",
"its",
"cleaned",
"value",
"as",
"an",
"appropriate",
"Python",
"object",
"."
] | def clean(self, value):
"""
Validates the given value and returns its "cleaned" value as an
appropriate Python object.
Raises ValidationError for any errors.
"""
value = self.to_python(value)
self.validate(value)
self.run_validators(value)
return ... | [
"def",
"clean",
"(",
"self",
",",
"value",
")",
":",
"value",
"=",
"self",
".",
"to_python",
"(",
"value",
")",
"self",
".",
"validate",
"(",
"value",
")",
"self",
".",
"run_validators",
"(",
"value",
")",
"return",
"value"
] | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.5/django/forms/fields.py#L147-L157 | |
awslabs/aws-ec2rescue-linux | 8ecf40e7ea0d2563dac057235803fca2221029d2 | lib/requests/cookies.py | python | RequestsCookieJar.__getstate__ | (self) | return state | Unlike a normal CookieJar, this class is pickleable. | Unlike a normal CookieJar, this class is pickleable. | [
"Unlike",
"a",
"normal",
"CookieJar",
"this",
"class",
"is",
"pickleable",
"."
] | def __getstate__(self):
"""Unlike a normal CookieJar, this class is pickleable."""
state = self.__dict__.copy()
# remove the unpickleable RLock object
state.pop('_cookies_lock')
return state | [
"def",
"__getstate__",
"(",
"self",
")",
":",
"state",
"=",
"self",
".",
"__dict__",
".",
"copy",
"(",
")",
"# remove the unpickleable RLock object",
"state",
".",
"pop",
"(",
"'_cookies_lock'",
")",
"return",
"state"
] | https://github.com/awslabs/aws-ec2rescue-linux/blob/8ecf40e7ea0d2563dac057235803fca2221029d2/lib/requests/cookies.py#L400-L405 | |
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | examples/remarketing/set_up_remarketing.py | python | _target_ads_in_ad_group_to_user_list | (
client, customer_id, ad_group_id, user_list_resource_name
) | return resource_name | Creates an ad group criterion that targets a user list with an ad group.
Args:
client: an initialized GoogleAdsClient instance.
customer_id: a str client customer ID used to create an ad group
criterion.
ad_group_id: a str ID for an ad group used to create an ad group
... | Creates an ad group criterion that targets a user list with an ad group. | [
"Creates",
"an",
"ad",
"group",
"criterion",
"that",
"targets",
"a",
"user",
"list",
"with",
"an",
"ad",
"group",
"."
] | def _target_ads_in_ad_group_to_user_list(
client, customer_id, ad_group_id, user_list_resource_name
):
"""Creates an ad group criterion that targets a user list with an ad group.
Args:
client: an initialized GoogleAdsClient instance.
customer_id: a str client customer ID used to create an a... | [
"def",
"_target_ads_in_ad_group_to_user_list",
"(",
"client",
",",
"customer_id",
",",
"ad_group_id",
",",
"user_list_resource_name",
")",
":",
"ad_group_criterion_operation",
"=",
"client",
".",
"get_type",
"(",
"\"AdGroupCriterionOperation\"",
")",
"# Creates the ad group c... | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/examples/remarketing/set_up_remarketing.py#L129-L164 | |
pySTEPS/pysteps | bd9478538249e1d64036a721ceb934085d6e1da9 | pysteps/tracking/tdating.py | python | dating | (
input_video,
timelist,
mintrack=3,
cell_list=None,
label_list=None,
start=0,
minref=35,
maxref=48,
mindiff=6,
minsize=50,
minmax=41,
mindis=10,
dyn_thresh=False,
) | return track_list, cell_list, label_list | This function performs the thunderstorm detection and tracking DATing.
It requires a 3-D input array that contains the temporal succession of the 2-D data
array of each timestep. On each timestep the detection is performed, the identified
objects are advected with a flow prediction and the advected objects ... | This function performs the thunderstorm detection and tracking DATing.
It requires a 3-D input array that contains the temporal succession of the 2-D data
array of each timestep. On each timestep the detection is performed, the identified
objects are advected with a flow prediction and the advected objects ... | [
"This",
"function",
"performs",
"the",
"thunderstorm",
"detection",
"and",
"tracking",
"DATing",
".",
"It",
"requires",
"a",
"3",
"-",
"D",
"input",
"array",
"that",
"contains",
"the",
"temporal",
"succession",
"of",
"the",
"2",
"-",
"D",
"data",
"array",
... | def dating(
input_video,
timelist,
mintrack=3,
cell_list=None,
label_list=None,
start=0,
minref=35,
maxref=48,
mindiff=6,
minsize=50,
minmax=41,
mindis=10,
dyn_thresh=False,
):
"""
This function performs the thunderstorm detection and tracking DATing.
It r... | [
"def",
"dating",
"(",
"input_video",
",",
"timelist",
",",
"mintrack",
"=",
"3",
",",
"cell_list",
"=",
"None",
",",
"label_list",
"=",
"None",
",",
"start",
"=",
"0",
",",
"minref",
"=",
"35",
",",
"maxref",
"=",
"48",
",",
"mindiff",
"=",
"6",
",... | https://github.com/pySTEPS/pysteps/blob/bd9478538249e1d64036a721ceb934085d6e1da9/pysteps/tracking/tdating.py#L50-L185 | |
PySimpleGUI/PySimpleGUI | 6c0d1fb54f493d45e90180b322fbbe70f7a5af3c | ProgrammingClassExamples/MacOS versions/6f PSG (data from text file).py | python | qsort_holder | (names) | [] | def qsort_holder(names):
l = names[:]
quick_sort(l, 0, len(l) - 1)
display_list(l) | [
"def",
"qsort_holder",
"(",
"names",
")",
":",
"l",
"=",
"names",
"[",
":",
"]",
"quick_sort",
"(",
"l",
",",
"0",
",",
"len",
"(",
"l",
")",
"-",
"1",
")",
"display_list",
"(",
"l",
")"
] | https://github.com/PySimpleGUI/PySimpleGUI/blob/6c0d1fb54f493d45e90180b322fbbe70f7a5af3c/ProgrammingClassExamples/MacOS versions/6f PSG (data from text file).py#L65-L68 | ||||
ilastik/ilastik | 6acd2c554bc517e9c8ddad3623a7aaa2e6970c28 | ilastik/applets/tracking/base/trackingBaseDataExportGui.py | python | TrackingBaseDataExportGui._getAvailablePlugins | (self) | Checks whether any plugins are found and whether we use the hytra backend.
Returns the list of available plugins | Checks whether any plugins are found and whether we use the hytra backend.
Returns the list of available plugins | [
"Checks",
"whether",
"any",
"plugins",
"are",
"found",
"and",
"whether",
"we",
"use",
"the",
"hytra",
"backend",
".",
"Returns",
"the",
"list",
"of",
"available",
"plugins"
] | def _getAvailablePlugins(self):
"""
Checks whether any plugins are found and whether we use the hytra backend.
Returns the list of available plugins
"""
try:
import hytra
# export plugins only available with hytra backend
exportPlugins = plugi... | [
"def",
"_getAvailablePlugins",
"(",
"self",
")",
":",
"try",
":",
"import",
"hytra",
"# export plugins only available with hytra backend",
"exportPlugins",
"=",
"pluginManager",
".",
"getPluginsOfCategory",
"(",
"\"TrackingExportFormats\"",
")",
"availableExportPlugins",
"=",... | https://github.com/ilastik/ilastik/blob/6acd2c554bc517e9c8ddad3623a7aaa2e6970c28/ilastik/applets/tracking/base/trackingBaseDataExportGui.py#L93-L107 | ||
facebookresearch/detectron2 | cb92ae1763cd7d3777c243f07749574cdaec6cb8 | detectron2/modeling/anchor_generator.py | python | _broadcast_params | (params, num_features, name) | return params | If one size (or aspect ratio) is specified and there are multiple feature
maps, we "broadcast" anchors of that single size (or aspect ratio)
over all feature maps.
If params is list[float], or list[list[float]] with len(params) == 1, repeat
it num_features time.
Returns:
list[list[float]]:... | If one size (or aspect ratio) is specified and there are multiple feature
maps, we "broadcast" anchors of that single size (or aspect ratio)
over all feature maps. | [
"If",
"one",
"size",
"(",
"or",
"aspect",
"ratio",
")",
"is",
"specified",
"and",
"there",
"are",
"multiple",
"feature",
"maps",
"we",
"broadcast",
"anchors",
"of",
"that",
"single",
"size",
"(",
"or",
"aspect",
"ratio",
")",
"over",
"all",
"feature",
"m... | def _broadcast_params(params, num_features, name):
"""
If one size (or aspect ratio) is specified and there are multiple feature
maps, we "broadcast" anchors of that single size (or aspect ratio)
over all feature maps.
If params is list[float], or list[list[float]] with len(params) == 1, repeat
... | [
"def",
"_broadcast_params",
"(",
"params",
",",
"num_features",
",",
"name",
")",
":",
"assert",
"isinstance",
"(",
"params",
",",
"collections",
".",
"abc",
".",
"Sequence",
")",
",",
"f\"{name} in anchor generator has to be a list! Got {params}.\"",
"assert",
"len",... | https://github.com/facebookresearch/detectron2/blob/cb92ae1763cd7d3777c243f07749574cdaec6cb8/detectron2/modeling/anchor_generator.py#L54-L78 | |
theotherp/nzbhydra | 4b03d7f769384b97dfc60dade4806c0fc987514e | libs/codecs.py | python | EncodedFile | (file, data_encoding, file_encoding=None, errors='strict') | return sr | Return a wrapped version of file which provides transparent
encoding translation.
Strings written to the wrapped file are interpreted according
to the given data_encoding and then written to the original
file as string using file_encoding. The intermediate encoding
will usually ... | Return a wrapped version of file which provides transparent
encoding translation. | [
"Return",
"a",
"wrapped",
"version",
"of",
"file",
"which",
"provides",
"transparent",
"encoding",
"translation",
"."
] | def EncodedFile(file, data_encoding, file_encoding=None, errors='strict'):
""" Return a wrapped version of file which provides transparent
encoding translation.
Strings written to the wrapped file are interpreted according
to the given data_encoding and then written to the original
... | [
"def",
"EncodedFile",
"(",
"file",
",",
"data_encoding",
",",
"file_encoding",
"=",
"None",
",",
"errors",
"=",
"'strict'",
")",
":",
"if",
"file_encoding",
"is",
"None",
":",
"file_encoding",
"=",
"data_encoding",
"data_info",
"=",
"lookup",
"(",
"data_encodi... | https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/codecs.py#L893-L927 | |
frappe/frappe | b64cab6867dfd860f10ccaf41a4ec04bc890b583 | frappe/commands/utils.py | python | run_ui_tests | (context, app, headless=False, parallel=True, with_coverage=False, ci_build_id=None) | Run UI tests | Run UI tests | [
"Run",
"UI",
"tests"
] | def run_ui_tests(context, app, headless=False, parallel=True, with_coverage=False, ci_build_id=None):
"Run UI tests"
site = get_site(context)
app_base_path = os.path.abspath(os.path.join(frappe.get_app_path(app), '..'))
site_url = frappe.utils.get_site_url(site)
admin_password = frappe.get_conf(site).admin_passwor... | [
"def",
"run_ui_tests",
"(",
"context",
",",
"app",
",",
"headless",
"=",
"False",
",",
"parallel",
"=",
"True",
",",
"with_coverage",
"=",
"False",
",",
"ci_build_id",
"=",
"None",
")",
":",
"site",
"=",
"get_site",
"(",
"context",
")",
"app_base_path",
... | https://github.com/frappe/frappe/blob/b64cab6867dfd860f10ccaf41a4ec04bc890b583/frappe/commands/utils.py#L693-L736 | ||
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/venv/lib/python3.7/site-packages/pip/_vendor/distlib/manifest.py | python | Manifest.findall | (self) | Find all files under the base and set ``allfiles`` to the absolute
pathnames of files found. | Find all files under the base and set ``allfiles`` to the absolute
pathnames of files found. | [
"Find",
"all",
"files",
"under",
"the",
"base",
"and",
"set",
"allfiles",
"to",
"the",
"absolute",
"pathnames",
"of",
"files",
"found",
"."
] | def findall(self):
"""Find all files under the base and set ``allfiles`` to the absolute
pathnames of files found.
"""
from stat import S_ISREG, S_ISDIR, S_ISLNK
self.allfiles = allfiles = []
root = self.base
stack = [root]
pop = stack.pop
push = ... | [
"def",
"findall",
"(",
"self",
")",
":",
"from",
"stat",
"import",
"S_ISREG",
",",
"S_ISDIR",
",",
"S_ISLNK",
"self",
".",
"allfiles",
"=",
"allfiles",
"=",
"[",
"]",
"root",
"=",
"self",
".",
"base",
"stack",
"=",
"[",
"root",
"]",
"pop",
"=",
"st... | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/venv/lib/python3.7/site-packages/pip/_vendor/distlib/manifest.py#L57-L82 | ||
HKUST-KnowComp/ASER | 3290e7cad0ec271c3720f4d578cae2c8d17915a4 | aser/extract/relation_extractor.py | python | BaseRelationExtractor.extract_from_parsed_result | (
self, parsed_result, para_eventualities, output_format="Relation", in_order=True, **kw
) | Extract relations from the parsed result
:param parsed_result: the parsed result returned by corenlp
:type parsed_result: List[Dict[str, object]]
:param para_eventualities: eventualities in the paragraph
:type para_eventualities: List[aser.eventuality.Eventuality]
:param output_... | Extract relations from the parsed result | [
"Extract",
"relations",
"from",
"the",
"parsed",
"result"
] | def extract_from_parsed_result(
self, parsed_result, para_eventualities, output_format="Relation", in_order=True, **kw
):
""" Extract relations from the parsed result
:param parsed_result: the parsed result returned by corenlp
:type parsed_result: List[Dict[str, object]]
:pa... | [
"def",
"extract_from_parsed_result",
"(",
"self",
",",
"parsed_result",
",",
"para_eventualities",
",",
"output_format",
"=",
"\"Relation\"",
",",
"in_order",
"=",
"True",
",",
"*",
"*",
"kw",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/HKUST-KnowComp/ASER/blob/3290e7cad0ec271c3720f4d578cae2c8d17915a4/aser/extract/relation_extractor.py#L23-L146 | ||
H4ckForJob/dirmap | d2000165efe01988fe55280175b0f87930f65d33 | lib/controller/bruter.py | python | saveResults | (domain,msg) | @description: 结果保存,以"域名.txt"命名,url去重复
@param {domain:域名,msg:保存的信息}
@return: null | [] | def saveResults(domain,msg):
'''
@description: 结果保存,以"域名.txt"命名,url去重复
@param {domain:域名,msg:保存的信息}
@return: null
'''
filename = domain +'.txt'
conf.output_path = os.path.join(paths.OUTPUT_PATH, filename)
#判断文件是否存在,若不存在则创建该文件
if not os.path.exists(conf.output_path):
with open... | [
"def",
"saveResults",
"(",
"domain",
",",
"msg",
")",
":",
"filename",
"=",
"domain",
"+",
"'.txt'",
"conf",
".",
"output_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"paths",
".",
"OUTPUT_PATH",
",",
"filename",
")",
"#判断文件是否存在,若不存在则创建该文件",
"if",
"n... | https://github.com/H4ckForJob/dirmap/blob/d2000165efe01988fe55280175b0f87930f65d33/lib/controller/bruter.py#L58-L75 | |||
styxit/HTPC-Manager | 490697460b4fa1797106aece27d873bc256b2ff1 | libs/requests/models.py | python | Response.__bool__ | (self) | return self.ok | Returns true if :attr:`status_code` is 'OK'. | Returns true if :attr:`status_code` is 'OK'. | [
"Returns",
"true",
"if",
":",
"attr",
":",
"status_code",
"is",
"OK",
"."
] | def __bool__(self):
"""Returns true if :attr:`status_code` is 'OK'."""
return self.ok | [
"def",
"__bool__",
"(",
"self",
")",
":",
"return",
"self",
".",
"ok"
] | https://github.com/styxit/HTPC-Manager/blob/490697460b4fa1797106aece27d873bc256b2ff1/libs/requests/models.py#L502-L504 | |
WattTime/pyiso | 4e7bbc672da5a3d9750e70130ae06ae3c4a2d652 | pyiso/bpa.py | python | BPAClient.fetch_historical | (self) | return df | Get BPA generation or load data from the far past | Get BPA generation or load data from the far past | [
"Get",
"BPA",
"generation",
"or",
"load",
"data",
"from",
"the",
"far",
"past"
] | def fetch_historical(self):
"""Get BPA generation or load data from the far past"""
# set up requests
request_urls = []
this_year = self.options['start_at'].year
while this_year <= self.options['start_at'].year:
if this_year >= 2011:
request_urls.appen... | [
"def",
"fetch_historical",
"(",
"self",
")",
":",
"# set up requests",
"request_urls",
"=",
"[",
"]",
"this_year",
"=",
"self",
".",
"options",
"[",
"'start_at'",
"]",
".",
"year",
"while",
"this_year",
"<=",
"self",
".",
"options",
"[",
"'start_at'",
"]",
... | https://github.com/WattTime/pyiso/blob/4e7bbc672da5a3d9750e70130ae06ae3c4a2d652/pyiso/bpa.py#L23-L58 | |
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/mechanize/mechanize/_beautifulsoup.py | python | Tag.fetch | (self, name=None, attrs={}, recursive=True, text=None,
limit=None) | return self._fetch(name, attrs, text, limit, generator) | Extracts a list of Tag objects that match the given
criteria. You can specify the name of the Tag and any
attributes you want the Tag to have.
The value of a key-value pair in the 'attrs' map can be a
string, a list of strings, a regular expression object, or a
callable that ta... | Extracts a list of Tag objects that match the given
criteria. You can specify the name of the Tag and any
attributes you want the Tag to have. | [
"Extracts",
"a",
"list",
"of",
"Tag",
"objects",
"that",
"match",
"the",
"given",
"criteria",
".",
"You",
"can",
"specify",
"the",
"name",
"of",
"the",
"Tag",
"and",
"any",
"attributes",
"you",
"want",
"the",
"Tag",
"to",
"have",
"."
] | def fetch(self, name=None, attrs={}, recursive=True, text=None,
limit=None):
"""Extracts a list of Tag objects that match the given
criteria. You can specify the name of the Tag and any
attributes you want the Tag to have.
The value of a key-value pair in the 'attrs' map ... | [
"def",
"fetch",
"(",
"self",
",",
"name",
"=",
"None",
",",
"attrs",
"=",
"{",
"}",
",",
"recursive",
"=",
"True",
",",
"text",
"=",
"None",
",",
"limit",
"=",
"None",
")",
":",
"generator",
"=",
"self",
".",
"recursiveChildGenerator",
"if",
"not",
... | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/mechanize/mechanize/_beautifulsoup.py#L475-L489 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/django/contrib/gis/geoip2/base.py | python | GeoIP2.__del__ | (self) | [] | def __del__(self):
# Cleanup any GeoIP file handles lying around.
if self._reader:
self._reader.close() | [
"def",
"__del__",
"(",
"self",
")",
":",
"# Cleanup any GeoIP file handles lying around.",
"if",
"self",
".",
"_reader",
":",
"self",
".",
"_reader",
".",
"close",
"(",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/django/contrib/gis/geoip2/base.py#L131-L134 | ||||
getlogbook/logbook | 3e0badb395ed8d0038d02996d38aa0505441327e | logbook/_fallback.py | python | ContextStackManager.iter_context_objects | (self) | return iter(objects) | Returns an iterator over all objects for the combined
application and context cache. | Returns an iterator over all objects for the combined
application and context cache. | [
"Returns",
"an",
"iterator",
"over",
"all",
"objects",
"for",
"the",
"combined",
"application",
"and",
"context",
"cache",
"."
] | def iter_context_objects(self):
"""Returns an iterator over all objects for the combined
application and context cache.
"""
use_gevent = is_gevent_enabled()
use_context = is_context_enabled()
if use_gevent:
tid = greenlet_get_ident()
elif use_context:... | [
"def",
"iter_context_objects",
"(",
"self",
")",
":",
"use_gevent",
"=",
"is_gevent_enabled",
"(",
")",
"use_context",
"=",
"is_context_enabled",
"(",
")",
"if",
"use_gevent",
":",
"tid",
"=",
"greenlet_get_ident",
"(",
")",
"elif",
"use_context",
":",
"tid",
... | https://github.com/getlogbook/logbook/blob/3e0badb395ed8d0038d02996d38aa0505441327e/logbook/_fallback.py#L149-L179 | |
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/site-packages/Cython-0.23.4-py3.3-win-amd64.egg/Cython/Compiler/Parsing.py | python | looking_at_call | (s) | return result | See if we're looking at a.b.c( | See if we're looking at a.b.c( | [
"See",
"if",
"we",
"re",
"looking",
"at",
"a",
".",
"b",
".",
"c",
"("
] | def looking_at_call(s):
"See if we're looking at a.b.c("
# Don't mess up the original position, so save and restore it.
# Unfortunately there's no good way to handle this, as a subsequent call
# to next() will not advance the position until it reads a new token.
position = s.start_line, s.start_col
... | [
"def",
"looking_at_call",
"(",
"s",
")",
":",
"# Don't mess up the original position, so save and restore it.",
"# Unfortunately there's no good way to handle this, as a subsequent call",
"# to next() will not advance the position until it reads a new token.",
"position",
"=",
"s",
".",
"s... | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/Cython-0.23.4-py3.3-win-amd64.egg/Cython/Compiler/Parsing.py#L2425-L2434 | |
priestc/moneywagon | 5ea771fb3be4ef726ff7c24581fe7d34f095fab7 | moneywagon/tx.py | python | Transaction.add_output | (self, address, value, unit='satoshi') | Add an output (a person who will receive funds via this tx).
If no unit is specified, satoshi is implied. | Add an output (a person who will receive funds via this tx).
If no unit is specified, satoshi is implied. | [
"Add",
"an",
"output",
"(",
"a",
"person",
"who",
"will",
"receive",
"funds",
"via",
"this",
"tx",
")",
".",
"If",
"no",
"unit",
"is",
"specified",
"satoshi",
"is",
"implied",
"."
] | def add_output(self, address, value, unit='satoshi'):
"""
Add an output (a person who will receive funds via this tx).
If no unit is specified, satoshi is implied.
"""
value_satoshi = self.from_unit_to_satoshi(value, unit)
if self.verbose:
print("Adding outpu... | [
"def",
"add_output",
"(",
"self",
",",
"address",
",",
"value",
",",
"unit",
"=",
"'satoshi'",
")",
":",
"value_satoshi",
"=",
"self",
".",
"from_unit_to_satoshi",
"(",
"value",
",",
"unit",
")",
"if",
"self",
".",
"verbose",
":",
"print",
"(",
"\"Adding... | https://github.com/priestc/moneywagon/blob/5ea771fb3be4ef726ff7c24581fe7d34f095fab7/moneywagon/tx.py#L145-L160 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.