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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
webcompat/webcompat.com | c3504dffec29b14eaa62ef01aa1ba78f9c2b12ef | webcompat/templates/__init__.py | python | get_description | (body_html) | Get the description of the body by parsing its content.
In cases where this fails (in case someone doesn't use the form, and
files and issue directly on GitHub and edits the template), return
something sensible. | Get the description of the body by parsing its content. | [
"Get",
"the",
"description",
"of",
"the",
"body",
"by",
"parsing",
"its",
"content",
"."
] | def get_description(body_html):
"""Get the description of the body by parsing its content.
In cases where this fails (in case someone doesn't use the form, and
files and issue directly on GitHub and edits the template), return
something sensible.
"""
stripped_body = Markup.striptags(body_html)
... | [
"def",
"get_description",
"(",
"body_html",
")",
":",
"stripped_body",
"=",
"Markup",
".",
"striptags",
"(",
"body_html",
")",
"description",
"=",
"re",
".",
"search",
"(",
"r'Description: (.+?) Steps'",
",",
"stripped_body",
")",
"if",
"description",
":",
"retu... | https://github.com/webcompat/webcompat.com/blob/c3504dffec29b14eaa62ef01aa1ba78f9c2b12ef/webcompat/templates/__init__.py#L103-L115 | ||
cloudlinux/kuberdock-platform | 8b3923c19755f3868e4142b62578d9b9857d2704 | node_storage_manage/storage.py | python | init_kd_zpool | (devices) | Creates and mounts Kuberdock zpool. | Creates and mounts Kuberdock zpool. | [
"Creates",
"and",
"mounts",
"Kuberdock",
"zpool",
"."
] | def init_kd_zpool(devices):
"""Creates and mounts Kuberdock zpool."""
err_code, output = get_subprocess_result(
['zpool', 'create', '-f', KD_ZPOOL_NAME] + devices
)
raise_cmd_error(err_code, output)
err_code, output = get_subprocess_result(
['zfs', 'set', 'mountpoint={}'.format(LOCAL... | [
"def",
"init_kd_zpool",
"(",
"devices",
")",
":",
"err_code",
",",
"output",
"=",
"get_subprocess_result",
"(",
"[",
"'zpool'",
",",
"'create'",
",",
"'-f'",
",",
"KD_ZPOOL_NAME",
"]",
"+",
"devices",
")",
"raise_cmd_error",
"(",
"err_code",
",",
"output",
"... | https://github.com/cloudlinux/kuberdock-platform/blob/8b3923c19755f3868e4142b62578d9b9857d2704/node_storage_manage/storage.py#L62-L83 | ||
owtf/owtf | 22d6d35fb2a232fcc56bf5ed504ec52fd65f15b6 | owtf/managers/target.py | python | get_all_targets | (session, key) | return results | Get all targets by key
:param key: Target key
:type key: `str`
:return:
:rtype: | Get all targets by key | [
"Get",
"all",
"targets",
"by",
"key"
] | def get_all_targets(session, key):
"""Get all targets by key
:param key: Target key
:type key: `str`
:return:
:rtype:
"""
results = session.query(getattr(Target, key.lower())).all()
results = [result[0] for result in results]
return results | [
"def",
"get_all_targets",
"(",
"session",
",",
"key",
")",
":",
"results",
"=",
"session",
".",
"query",
"(",
"getattr",
"(",
"Target",
",",
"key",
".",
"lower",
"(",
")",
")",
")",
".",
"all",
"(",
")",
"results",
"=",
"[",
"result",
"[",
"0",
"... | https://github.com/owtf/owtf/blob/22d6d35fb2a232fcc56bf5ed504ec52fd65f15b6/owtf/managers/target.py#L525-L535 | |
LumaPictures/pymel | fa88a3f4fa18e09bb8aa9bdf4dab53d984bada72 | pymel/core/windows.py | python | lsUI | (**kwargs) | return [uitypes.PyUI(x) for x in _lsUI(**kwargs)] | Modified:
- long defaults to True
- if no type is passed, defaults to all known types | Modified:
- long defaults to True
- if no type is passed, defaults to all known types | [
"Modified",
":",
"-",
"long",
"defaults",
"to",
"True",
"-",
"if",
"no",
"type",
"is",
"passed",
"defaults",
"to",
"all",
"known",
"types"
] | def lsUI(**kwargs):
"""
Modified:
- long defaults to True
- if no type is passed, defaults to all known types
"""
from . import uitypes
return [uitypes.PyUI(x) for x in _lsUI(**kwargs)] | [
"def",
"lsUI",
"(",
"*",
"*",
"kwargs",
")",
":",
"from",
".",
"import",
"uitypes",
"return",
"[",
"uitypes",
".",
"PyUI",
"(",
"x",
")",
"for",
"x",
"in",
"_lsUI",
"(",
"*",
"*",
"kwargs",
")",
"]"
] | https://github.com/LumaPictures/pymel/blob/fa88a3f4fa18e09bb8aa9bdf4dab53d984bada72/pymel/core/windows.py#L94-L101 | |
mitre/multiscanner | 86e0145ba3c4a34611f257dc78cd2482ed6358db | multiscanner/common/stix2_generator/__init__.py | python | extract_http_requests_cuckoo | (signature, custom_labels=None) | return indicators | Process Cuckoo http signatures obtained from analysis.
Args:
signature: A dict from the "signatures" list from the "Cuckoo Sandbox"
portion of the report.
custom_labels: A list of labels to attach into generated Indicators.
Returns:
list: Containing ``stix2.Indicator`` with... | Process Cuckoo http signatures obtained from analysis. | [
"Process",
"Cuckoo",
"http",
"signatures",
"obtained",
"from",
"analysis",
"."
] | def extract_http_requests_cuckoo(signature, custom_labels=None):
'''
Process Cuckoo http signatures obtained from analysis.
Args:
signature: A dict from the "signatures" list from the "Cuckoo Sandbox"
portion of the report.
custom_labels: A list of labels to attach into generate... | [
"def",
"extract_http_requests_cuckoo",
"(",
"signature",
",",
"custom_labels",
"=",
"None",
")",
":",
"indicators",
"=",
"[",
"]",
"labels",
"=",
"[",
"'url-watchlist'",
"]",
"if",
"custom_labels",
":",
"labels",
".",
"extend",
"(",
"custom_labels",
")",
"for"... | https://github.com/mitre/multiscanner/blob/86e0145ba3c4a34611f257dc78cd2482ed6358db/multiscanner/common/stix2_generator/__init__.py#L174-L210 | |
xjsender/haoide | 717dd706db1169bfc41e818ac6fc6cd9a0aef12d | requests/packages/urllib3/connectionpool.py | python | HTTPConnectionPool.is_same_host | (self, url) | return (scheme, host, port) == (self.scheme, self.host, self.port) | Check if the given ``url`` is a member of the same host as this
connection pool. | Check if the given ``url`` is a member of the same host as this
connection pool. | [
"Check",
"if",
"the",
"given",
"url",
"is",
"a",
"member",
"of",
"the",
"same",
"host",
"as",
"this",
"connection",
"pool",
"."
] | def is_same_host(self, url):
"""
Check if the given ``url`` is a member of the same host as this
connection pool.
"""
if url.startswith('/'):
return True
# TODO: Add optional support for socket.gethostbyname checking.
scheme, host, port = get_host(url... | [
"def",
"is_same_host",
"(",
"self",
",",
"url",
")",
":",
"if",
"url",
".",
"startswith",
"(",
"'/'",
")",
":",
"return",
"True",
"# TODO: Add optional support for socket.gethostbyname checking.",
"scheme",
",",
"host",
",",
"port",
"=",
"get_host",
"(",
"url",
... | https://github.com/xjsender/haoide/blob/717dd706db1169bfc41e818ac6fc6cd9a0aef12d/requests/packages/urllib3/connectionpool.py#L417-L434 | |
chribsen/simple-machine-learning-examples | dc94e52a4cebdc8bb959ff88b81ff8cfeca25022 | venv/lib/python2.7/site-packages/scipy/odr/odrpack.py | python | Data.set_meta | (self, **kwds) | Update the metadata dictionary with the keywords and data provided
by keywords.
Examples
--------
::
data.set_meta(lab="Ph 7; Lab 26", title="Ag110 + Ag108 Decay") | Update the metadata dictionary with the keywords and data provided
by keywords. | [
"Update",
"the",
"metadata",
"dictionary",
"with",
"the",
"keywords",
"and",
"data",
"provided",
"by",
"keywords",
"."
] | def set_meta(self, **kwds):
""" Update the metadata dictionary with the keywords and data provided
by keywords.
Examples
--------
::
data.set_meta(lab="Ph 7; Lab 26", title="Ag110 + Ag108 Decay")
"""
self.meta.update(kwds) | [
"def",
"set_meta",
"(",
"self",
",",
"*",
"*",
"kwds",
")",
":",
"self",
".",
"meta",
".",
"update",
"(",
"kwds",
")"
] | https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/scipy/odr/odrpack.py#L274-L285 | ||
sahana/eden | 1696fa50e90ce967df69f66b571af45356cc18da | modules/templates/IFRC/parser.py | python | S3Parser._parse_value | (text, fieldname) | return result | Parse a value from a piece of text | Parse a value from a piece of text | [
"Parse",
"a",
"value",
"from",
"a",
"piece",
"of",
"text"
] | def _parse_value(text, fieldname):
"""
Parse a value from a piece of text
"""
parts = text.split(":%s:" % fieldname, 1)
parts = parts[1].split(":", 1)
result = parts[0]
return result | [
"def",
"_parse_value",
"(",
"text",
",",
"fieldname",
")",
":",
"parts",
"=",
"text",
".",
"split",
"(",
"\":%s:\"",
"%",
"fieldname",
",",
"1",
")",
"parts",
"=",
"parts",
"[",
"1",
"]",
".",
"split",
"(",
"\":\"",
",",
"1",
")",
"result",
"=",
... | https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/templates/IFRC/parser.py#L49-L57 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/xiaomi_tv/media_player.py | python | XiaomiTV.volume_up | (self) | Increase volume by one. | Increase volume by one. | [
"Increase",
"volume",
"by",
"one",
"."
] | def volume_up(self):
"""Increase volume by one."""
self._tv.volume_up() | [
"def",
"volume_up",
"(",
"self",
")",
":",
"self",
".",
"_tv",
".",
"volume_up",
"(",
")"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/xiaomi_tv/media_player.py#L112-L114 | ||
feincms/feincms | be35576fa86083a969ae56aaf848173d1a5a3c5d | feincms/module/page/modeladmins.py | python | PageAdmin.is_visible_admin | (self, page) | return tree_editor.ajax_editable_boolean_cell(page, "active") | Instead of just showing an on/off boolean, also indicate whether this
page is not visible because of publishing dates or inherited status. | Instead of just showing an on/off boolean, also indicate whether this
page is not visible because of publishing dates or inherited status. | [
"Instead",
"of",
"just",
"showing",
"an",
"on",
"/",
"off",
"boolean",
"also",
"indicate",
"whether",
"this",
"page",
"is",
"not",
"visible",
"because",
"of",
"publishing",
"dates",
"or",
"inherited",
"status",
"."
] | def is_visible_admin(self, page):
"""
Instead of just showing an on/off boolean, also indicate whether this
page is not visible because of publishing dates or inherited status.
"""
if page.parent_id and page.parent_id not in _local.visible_pages:
# parent page's invis... | [
"def",
"is_visible_admin",
"(",
"self",
",",
"page",
")",
":",
"if",
"page",
".",
"parent_id",
"and",
"page",
".",
"parent_id",
"not",
"in",
"_local",
".",
"visible_pages",
":",
"# parent page's invisibility is inherited",
"if",
"page",
".",
"id",
"in",
"_loca... | https://github.com/feincms/feincms/blob/be35576fa86083a969ae56aaf848173d1a5a3c5d/feincms/module/page/modeladmins.py#L215-L235 | |
F8LEFT/DecLLVM | d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c | python/idaapi.py | python | ctree_anchor_t.is_citem_anchor | (self, *args) | return _idaapi.ctree_anchor_t_is_citem_anchor(self, *args) | is_citem_anchor(self) -> bool | is_citem_anchor(self) -> bool | [
"is_citem_anchor",
"(",
"self",
")",
"-",
">",
"bool"
] | def is_citem_anchor(self, *args):
"""
is_citem_anchor(self) -> bool
"""
return _idaapi.ctree_anchor_t_is_citem_anchor(self, *args) | [
"def",
"is_citem_anchor",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_idaapi",
".",
"ctree_anchor_t_is_citem_anchor",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/F8LEFT/DecLLVM/blob/d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c/python/idaapi.py#L38820-L38824 | |
openstack/glance | 502fa0ffc8970c087c5924742231812c0da6a114 | glance/api/v2/cached_images.py | python | CacheController.queue_image | (self, req, image_id) | PUT /queued_images/<IMAGE_ID>
Queues an image for caching. We do not check to see if
the image is in the registry here. That is done by the
prefetcher... | PUT /queued_images/<IMAGE_ID> | [
"PUT",
"/",
"queued_images",
"/",
"<IMAGE_ID",
">"
] | def queue_image(self, req, image_id):
"""
PUT /queued_images/<IMAGE_ID>
Queues an image for caching. We do not check to see if
the image is in the registry here. That is done by the
prefetcher...
"""
self._enforce(req)
self.cache.queue_image(image_id) | [
"def",
"queue_image",
"(",
"self",
",",
"req",
",",
"image_id",
")",
":",
"self",
".",
"_enforce",
"(",
"req",
")",
"self",
".",
"cache",
".",
"queue_image",
"(",
"image_id",
")"
] | https://github.com/openstack/glance/blob/502fa0ffc8970c087c5924742231812c0da6a114/glance/api/v2/cached_images.py#L88-L97 | ||
bnpy/bnpy | d5b311e8f58ccd98477f4a0c8a4d4982e3fca424 | bnpy/obsmodel/MultObsModel.py | python | MultObsModel.calcLogSoftEvMatrix_FromPost | (self, Data, **kwargs) | Calculate expected log soft ev matrix under Post.
Returns
------
L : 2D array, size N x K | Calculate expected log soft ev matrix under Post. | [
"Calculate",
"expected",
"log",
"soft",
"ev",
"matrix",
"under",
"Post",
"."
] | def calcLogSoftEvMatrix_FromPost(self, Data, **kwargs):
''' Calculate expected log soft ev matrix under Post.
Returns
------
L : 2D array, size N x K
'''
ElogphiT = self.GetCached('E_logphiT', 'all') # V x K
doSparse1 = 'activeonlyLP' in kwargs and kwargs['activ... | [
"def",
"calcLogSoftEvMatrix_FromPost",
"(",
"self",
",",
"Data",
",",
"*",
"*",
"kwargs",
")",
":",
"ElogphiT",
"=",
"self",
".",
"GetCached",
"(",
"'E_logphiT'",
",",
"'all'",
")",
"# V x K",
"doSparse1",
"=",
"'activeonlyLP'",
"in",
"kwargs",
"and",
"kwarg... | https://github.com/bnpy/bnpy/blob/d5b311e8f58ccd98477f4a0c8a4d4982e3fca424/bnpy/obsmodel/MultObsModel.py#L348-L366 | ||
SavinaRoja/PyUserInput | 8a93a4e32430fd9da68590897e06e0be9a2ad26e | pykeyboard/windows.py | python | PyKeyboardEvent.toggle_shift_state | (self) | Does toggling for the shift state. | Does toggling for the shift state. | [
"Does",
"toggling",
"for",
"the",
"shift",
"state",
"."
] | def toggle_shift_state(self): # This will be removed later
'''Does toggling for the shift state.'''
states = [1, 0]
self.shift_state = states[self.shift_state] | [
"def",
"toggle_shift_state",
"(",
"self",
")",
":",
"# This will be removed later",
"states",
"=",
"[",
"1",
",",
"0",
"]",
"self",
".",
"shift_state",
"=",
"states",
"[",
"self",
".",
"shift_state",
"]"
] | https://github.com/SavinaRoja/PyUserInput/blob/8a93a4e32430fd9da68590897e06e0be9a2ad26e/pykeyboard/windows.py#L307-L310 | ||
1040003585/WebScrapingWithPython | a770fa5b03894076c8c9539b1ffff34424ffc016 | portia_examle/lib/python2.7/site-packages/pip/utils/packaging.py | python | check_requires_python | (requires_python) | return python_version in requires_python_specifier | Check if the python version in use match the `requires_python` specifier.
Returns `True` if the version of python in use matches the requirement.
Returns `False` if the version of python in use does not matches the
requirement.
Raises an InvalidSpecifier if `requires_python` have an invalid format. | Check if the python version in use match the `requires_python` specifier. | [
"Check",
"if",
"the",
"python",
"version",
"in",
"use",
"match",
"the",
"requires_python",
"specifier",
"."
] | def check_requires_python(requires_python):
"""
Check if the python version in use match the `requires_python` specifier.
Returns `True` if the version of python in use matches the requirement.
Returns `False` if the version of python in use does not matches the
requirement.
Raises an InvalidS... | [
"def",
"check_requires_python",
"(",
"requires_python",
")",
":",
"if",
"requires_python",
"is",
"None",
":",
"# The package provides no information",
"return",
"True",
"requires_python_specifier",
"=",
"specifiers",
".",
"SpecifierSet",
"(",
"requires_python",
")",
"# We... | https://github.com/1040003585/WebScrapingWithPython/blob/a770fa5b03894076c8c9539b1ffff34424ffc016/portia_examle/lib/python2.7/site-packages/pip/utils/packaging.py#L17-L34 | |
p2pool/p2pool | 53c438bbada06b9d4a9a465bc13f7694a7a322b7 | nattraverso/portmapper.py | python | get_port_mapper | (proto="TCP") | return nattraverso.pynupnp.get_port_mapper() | Returns a L{NATMapper} instance, suited to map a port for
the given protocol. Defaults to TCP.
For the moment, only upnp mapper is available. It accepts both UDP and TCP.
@param proto: The protocol: 'TCP' or 'UDP'
@type proto: string
@return: A deferred called with a L{NATMapper} instance
... | Returns a L{NATMapper} instance, suited to map a port for
the given protocol. Defaults to TCP.
For the moment, only upnp mapper is available. It accepts both UDP and TCP. | [
"Returns",
"a",
"L",
"{",
"NATMapper",
"}",
"instance",
"suited",
"to",
"map",
"a",
"port",
"for",
"the",
"given",
"protocol",
".",
"Defaults",
"to",
"TCP",
".",
"For",
"the",
"moment",
"only",
"upnp",
"mapper",
"is",
"available",
".",
"It",
"accepts",
... | def get_port_mapper(proto="TCP"):
"""
Returns a L{NATMapper} instance, suited to map a port for
the given protocol. Defaults to TCP.
For the moment, only upnp mapper is available. It accepts both UDP and TCP.
@param proto: The protocol: 'TCP' or 'UDP'
@type proto: string
@return: A... | [
"def",
"get_port_mapper",
"(",
"proto",
"=",
"\"TCP\"",
")",
":",
"import",
"nattraverso",
".",
"pynupnp",
"return",
"nattraverso",
".",
"pynupnp",
".",
"get_port_mapper",
"(",
")"
] | https://github.com/p2pool/p2pool/blob/53c438bbada06b9d4a9a465bc13f7694a7a322b7/nattraverso/portmapper.py#L18-L31 | |
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/gdata/src/gdata/youtube/client.py | python | YouTubeClient.delete_track | (self, video_id, track, client_id, developer_key,
auth_token=None, **kwargs) | return self.request(http_request=http_request, **kwargs) | Deletes a track. | Deletes a track. | [
"Deletes",
"a",
"track",
"."
] | def delete_track(self, video_id, track, client_id, developer_key,
auth_token=None, **kwargs):
"""Deletes a track."""
if isinstance(track, gdata.youtube.data.TrackEntry):
track_id_text_node = track.get_id().split(':')
track_id = track_id_text_node[3]
else:
track_id = trac... | [
"def",
"delete_track",
"(",
"self",
",",
"video_id",
",",
"track",
",",
"client_id",
",",
"developer_key",
",",
"auth_token",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"track",
",",
"gdata",
".",
"youtube",
".",
"data",
"... | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/gdata/src/gdata/youtube/client.py#L222-L240 | |
F8LEFT/DecLLVM | d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c | python/idaapi.py | python | get_demangled_name | (*args) | return _idaapi.get_demangled_name(*args) | get_demangled_name(frm, ea, inhibitor, demform, strict) -> char * | get_demangled_name(frm, ea, inhibitor, demform, strict) -> char * | [
"get_demangled_name",
"(",
"frm",
"ea",
"inhibitor",
"demform",
"strict",
")",
"-",
">",
"char",
"*"
] | def get_demangled_name(*args):
"""
get_demangled_name(frm, ea, inhibitor, demform, strict) -> char *
"""
return _idaapi.get_demangled_name(*args) | [
"def",
"get_demangled_name",
"(",
"*",
"args",
")",
":",
"return",
"_idaapi",
".",
"get_demangled_name",
"(",
"*",
"args",
")"
] | https://github.com/F8LEFT/DecLLVM/blob/d38e45e3d0dd35634adae1d0cf7f96f3bd96e74c/python/idaapi.py#L47293-L47297 | |
FabriceSalvaire/CodeReview | c48433467ac2a9a14b9c9026734f8c494af4aa95 | CodeReview/GUI/DiffViewer/DiffWidget.py | python | DiffViewerCursor.end | (self) | Insert a block and set the y positions. | Insert a block and set the y positions. | [
"Insert",
"a",
"block",
"and",
"set",
"the",
"y",
"positions",
"."
] | def end(self):
"""Insert a block and set the y positions."""
self._cursor.insertBlock()
self._text_blocks[-1].y_bottom = self.y()
for text_block0, text_block1 in pairwise(self._text_blocks):
text_block0.y_bottom = text_block1.y_top | [
"def",
"end",
"(",
"self",
")",
":",
"self",
".",
"_cursor",
".",
"insertBlock",
"(",
")",
"self",
".",
"_text_blocks",
"[",
"-",
"1",
"]",
".",
"y_bottom",
"=",
"self",
".",
"y",
"(",
")",
"for",
"text_block0",
",",
"text_block1",
"in",
"pairwise",
... | https://github.com/FabriceSalvaire/CodeReview/blob/c48433467ac2a9a14b9c9026734f8c494af4aa95/CodeReview/GUI/DiffViewer/DiffWidget.py#L133-L140 | ||
canonical/cloud-init | dc1aabfca851e520693c05322f724bd102c76364 | cloudinit/analyze/__main__.py | python | configure_io | (args) | return (infh, outfh) | Common parsing and setup of input/output files | Common parsing and setup of input/output files | [
"Common",
"parsing",
"and",
"setup",
"of",
"input",
"/",
"output",
"files"
] | def configure_io(args):
"""Common parsing and setup of input/output files"""
if args.infile == "-":
infh = sys.stdin
else:
try:
infh = open(args.infile, "r")
except OSError:
sys.stderr.write("Cannot open file %s\n" % args.infile)
sys.exit(1)
i... | [
"def",
"configure_io",
"(",
"args",
")",
":",
"if",
"args",
".",
"infile",
"==",
"\"-\"",
":",
"infh",
"=",
"sys",
".",
"stdin",
"else",
":",
"try",
":",
"infh",
"=",
"open",
"(",
"args",
".",
"infile",
",",
"\"r\"",
")",
"except",
"OSError",
":",
... | https://github.com/canonical/cloud-init/blob/dc1aabfca851e520693c05322f724bd102c76364/cloudinit/analyze/__main__.py#L273-L293 | |
robotlearn/pyrobolearn | 9cd7c060723fda7d2779fa255ac998c2c82b8436 | pyrobolearn/parameters/updater.py | python | ParameterUpdater.compute | (self, current=None, target=None) | return self.target | Update the target parameter(s) based on the current parameter(s).
Args:
current (int, float, torch.tensor, np.array, torch.nn.Module, None): current parameter(s). If None, it
will be set to the current parameter(s) given at the initialization.
target (int, float, torch.t... | Update the target parameter(s) based on the current parameter(s). | [
"Update",
"the",
"target",
"parameter",
"(",
"s",
")",
"based",
"on",
"the",
"current",
"parameter",
"(",
"s",
")",
"."
] | def compute(self, current=None, target=None):
"""
Update the target parameter(s) based on the current parameter(s).
Args:
current (int, float, torch.tensor, np.array, torch.nn.Module, None): current parameter(s). If None, it
will be set to the current parameter(s) gi... | [
"def",
"compute",
"(",
"self",
",",
"current",
"=",
"None",
",",
"target",
"=",
"None",
")",
":",
"# if time to update the parameters",
"if",
"(",
"self",
".",
"counter",
"%",
"self",
".",
"sleep_count",
")",
"==",
"0",
":",
"# if the current parameters is Non... | https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/parameters/updater.py#L60-L98 | |
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/modules/cron.py | python | _check_instance_uid_match | (user) | return os.geteuid() == __salt__["file.user_to_uid"](user) | Returns true if running instance's UID matches the specified user UID | Returns true if running instance's UID matches the specified user UID | [
"Returns",
"true",
"if",
"running",
"instance",
"s",
"UID",
"matches",
"the",
"specified",
"user",
"UID"
] | def _check_instance_uid_match(user):
"""
Returns true if running instance's UID matches the specified user UID
"""
return os.geteuid() == __salt__["file.user_to_uid"](user) | [
"def",
"_check_instance_uid_match",
"(",
"user",
")",
":",
"return",
"os",
".",
"geteuid",
"(",
")",
"==",
"__salt__",
"[",
"\"file.user_to_uid\"",
"]",
"(",
"user",
")"
] | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/cron.py#L179-L183 | |
graphcore/examples | 46d2b7687b829778369fc6328170a7b14761e5c6 | applications/popart/deep_voice/text_utils.py | python | text_to_sequence | (text, replace_prob=0.5) | return sequence | Converts a string of text to a sequence of IDs corresponding to the symbols in the text | Converts a string of text to a sequence of IDs corresponding to the symbols in the text | [
"Converts",
"a",
"string",
"of",
"text",
"to",
"a",
"sequence",
"of",
"IDs",
"corresponding",
"to",
"the",
"symbols",
"in",
"the",
"text"
] | def text_to_sequence(text, replace_prob=0.5):
""" Converts a string of text to a sequence of IDs corresponding to the symbols in the text """
text = text.upper()
if replace_prob > 0.0:
text = replace_with_pronunciation(text, replace_prob)
sequence = []
while len(text):
match_resul... | [
"def",
"text_to_sequence",
"(",
"text",
",",
"replace_prob",
"=",
"0.5",
")",
":",
"text",
"=",
"text",
".",
"upper",
"(",
")",
"if",
"replace_prob",
">",
"0.0",
":",
"text",
"=",
"replace_with_pronunciation",
"(",
"text",
",",
"replace_prob",
")",
"sequen... | https://github.com/graphcore/examples/blob/46d2b7687b829778369fc6328170a7b14761e5c6/applications/popart/deep_voice/text_utils.py#L51-L73 | |
GNS3/gns3-gui | da8adbaa18ab60e053af2a619efd468f4c8950f3 | gns3/ports/port.py | python | Port.setLabel | (self, label) | Sets a port label.
:param label: NoteItem instance. | Sets a port label. | [
"Sets",
"a",
"port",
"label",
"."
] | def setLabel(self, label):
"""
Sets a port label.
:param label: NoteItem instance.
"""
self._port_label = label
if self._link and self._port_label:
self._link.addPortLabel(self, self._port_label) | [
"def",
"setLabel",
"(",
"self",
",",
"label",
")",
":",
"self",
".",
"_port_label",
"=",
"label",
"if",
"self",
".",
"_link",
"and",
"self",
".",
"_port_label",
":",
"self",
".",
"_link",
".",
"addPortLabel",
"(",
"self",
",",
"self",
".",
"_port_label... | https://github.com/GNS3/gns3-gui/blob/da8adbaa18ab60e053af2a619efd468f4c8950f3/gns3/ports/port.py#L334-L342 | ||
pyvista/pyvista | 012dbb95a9aae406c3cd4cd94fc8c477f871e426 | pyvista/themes.py | python | DefaultTheme.colorbar_vertical | (self) | return self._colorbar_vertical | Return or set the default parameters of a vertical colorbar.
Examples
--------
Set the default colorbar width to 0.45.
>>> import pyvista
>>> pyvista.global_theme.colorbar_vertical.width = 0.45 # doctest:+SKIP
Set the default colorbar height to 0.8.
>>> impor... | Return or set the default parameters of a vertical colorbar. | [
"Return",
"or",
"set",
"the",
"default",
"parameters",
"of",
"a",
"vertical",
"colorbar",
"."
] | def colorbar_vertical(self) -> _ColorbarConfig:
"""Return or set the default parameters of a vertical colorbar.
Examples
--------
Set the default colorbar width to 0.45.
>>> import pyvista
>>> pyvista.global_theme.colorbar_vertical.width = 0.45 # doctest:+SKIP
... | [
"def",
"colorbar_vertical",
"(",
"self",
")",
"->",
"_ColorbarConfig",
":",
"return",
"self",
".",
"_colorbar_vertical"
] | https://github.com/pyvista/pyvista/blob/012dbb95a9aae406c3cd4cd94fc8c477f871e426/pyvista/themes.py#L1706-L1722 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Mac/Modules/evt/evtscan.py | python | MyScanner.makerepairinstructions | (self) | return [
([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
[("InBuffer", "*", "*")]),
([("void", "*", "OutMode"), ("long", "*", "InMode"),
("long", "*", "OutMode")],
[("VarVarOutBuffer", "*", "InOutMode... | [] | def makerepairinstructions(self):
return [
([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
[("InBuffer", "*", "*")]),
([("void", "*", "OutMode"), ("long", "*", "InMode"),
("long", "*", "OutMode")],
... | [
"def",
"makerepairinstructions",
"(",
"self",
")",
":",
"return",
"[",
"(",
"[",
"(",
"\"void_ptr\"",
",",
"\"*\"",
",",
"\"InMode\"",
")",
",",
"(",
"\"long\"",
",",
"\"*\"",
",",
"\"InMode\"",
")",
"]",
",",
"[",
"(",
"\"InBuffer\"",
",",
"\"*\"",
",... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Mac/Modules/evt/evtscan.py#L58-L77 | |||
skylander86/lambda-text-extractor | 6da52d077a2fc571e38bfe29c33ae68f6443cd5a | lib-linux_x64/requests/utils.py | python | prepend_scheme_if_needed | (url, new_scheme) | return urlunparse((scheme, netloc, path, params, query, fragment)) | Given a URL that may or may not have a scheme, prepend the given scheme.
Does not replace a present scheme with the one provided as an argument.
:rtype: str | Given a URL that may or may not have a scheme, prepend the given scheme.
Does not replace a present scheme with the one provided as an argument. | [
"Given",
"a",
"URL",
"that",
"may",
"or",
"may",
"not",
"have",
"a",
"scheme",
"prepend",
"the",
"given",
"scheme",
".",
"Does",
"not",
"replace",
"a",
"present",
"scheme",
"with",
"the",
"one",
"provided",
"as",
"an",
"argument",
"."
] | def prepend_scheme_if_needed(url, new_scheme):
"""Given a URL that may or may not have a scheme, prepend the given scheme.
Does not replace a present scheme with the one provided as an argument.
:rtype: str
"""
scheme, netloc, path, params, query, fragment = urlparse(url, new_scheme)
# urlpars... | [
"def",
"prepend_scheme_if_needed",
"(",
"url",
",",
"new_scheme",
")",
":",
"scheme",
",",
"netloc",
",",
"path",
",",
"params",
",",
"query",
",",
"fragment",
"=",
"urlparse",
"(",
"url",
",",
"new_scheme",
")",
"# urlparse is a finicky beast, and sometimes decid... | https://github.com/skylander86/lambda-text-extractor/blob/6da52d077a2fc571e38bfe29c33ae68f6443cd5a/lib-linux_x64/requests/utils.py#L816-L830 | |
blue-oil/blueoil | 0c9160b524b17482d59ae48a0c11384f1d26dccc | blueoil/cmd/init.py | python | prompt | (question) | return answers['value'] | Execute prompt answer
Args:
question (list): list of inquirer question
Returns: string of answer | Execute prompt answer | [
"Execute",
"prompt",
"answer"
] | def prompt(question):
"""Execute prompt answer
Args:
question (list): list of inquirer question
Returns: string of answer
"""
answers = inquirer.prompt(question)
return answers['value'] | [
"def",
"prompt",
"(",
"question",
")",
":",
"answers",
"=",
"inquirer",
".",
"prompt",
"(",
"question",
")",
"return",
"answers",
"[",
"'value'",
"]"
] | https://github.com/blue-oil/blueoil/blob/0c9160b524b17482d59ae48a0c11384f1d26dccc/blueoil/cmd/init.py#L171-L181 | |
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | frontend/id_kind_def.py | python | IdSpec.LexerPairs | (self, kind) | return result | [] | def LexerPairs(self, kind):
# type: (Kind_t) -> List[Tuple[bool, str, Id_t]]
result = []
for is_regex, pat, id_ in self.lexer_pairs[kind]:
result.append((is_regex, pat, id_))
return result | [
"def",
"LexerPairs",
"(",
"self",
",",
"kind",
")",
":",
"# type: (Kind_t) -> List[Tuple[bool, str, Id_t]]",
"result",
"=",
"[",
"]",
"for",
"is_regex",
",",
"pat",
",",
"id_",
"in",
"self",
".",
"lexer_pairs",
"[",
"kind",
"]",
":",
"result",
".",
"append",... | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/frontend/id_kind_def.py#L44-L49 | |||
maximecb/gym-minigrid | 6116191b15aec9e09e4b48edd16f144e31b412fa | gym_minigrid/minigrid.py | python | MiniGridEnv.render | (self, mode='human', close=False, highlight=True, tile_size=TILE_PIXELS) | return img | Render the whole-grid human view | Render the whole-grid human view | [
"Render",
"the",
"whole",
"-",
"grid",
"human",
"view"
] | def render(self, mode='human', close=False, highlight=True, tile_size=TILE_PIXELS):
"""
Render the whole-grid human view
"""
if close:
if self.window:
self.window.close()
return
if mode == 'human' and not self.window:
import g... | [
"def",
"render",
"(",
"self",
",",
"mode",
"=",
"'human'",
",",
"close",
"=",
"False",
",",
"highlight",
"=",
"True",
",",
"tile_size",
"=",
"TILE_PIXELS",
")",
":",
"if",
"close",
":",
"if",
"self",
".",
"window",
":",
"self",
".",
"window",
".",
... | https://github.com/maximecb/gym-minigrid/blob/6116191b15aec9e09e4b48edd16f144e31b412fa/gym_minigrid/minigrid.py#L1238-L1295 | |
kyuupichan/electrumx | ab9024f74a034e634a518cfbcdb1fcd911e62f00 | electrumx/server/db.py | python | DB.assert_flushed | (self, flush_data) | Asserts state is fully flushed. | Asserts state is fully flushed. | [
"Asserts",
"state",
"is",
"fully",
"flushed",
"."
] | def assert_flushed(self, flush_data):
'''Asserts state is fully flushed.'''
assert flush_data.state.tx_count == self.fs_tx_count == self.state.tx_count
assert flush_data.state.height == self.fs_height == self.state.height
assert flush_data.state.tip == self.state.tip
assert not f... | [
"def",
"assert_flushed",
"(",
"self",
",",
"flush_data",
")",
":",
"assert",
"flush_data",
".",
"state",
".",
"tx_count",
"==",
"self",
".",
"fs_tx_count",
"==",
"self",
".",
"state",
".",
"tx_count",
"assert",
"flush_data",
".",
"state",
".",
"height",
"=... | https://github.com/kyuupichan/electrumx/blob/ab9024f74a034e634a518cfbcdb1fcd911e62f00/electrumx/server/db.py#L180-L190 | ||
peterbuga/HASS-sonoff-ewelink | ab8fef3426d0f4821def48f25205e32fe23cc59a | sonoff/__init__.py | python | SonoffDevice.get_device | (self) | return None | [] | def get_device(self):
for device in self._hass.data[DOMAIN].get_devices():
if 'deviceid' in device and device['deviceid'] == self._deviceid:
return device
return None | [
"def",
"get_device",
"(",
"self",
")",
":",
"for",
"device",
"in",
"self",
".",
"_hass",
".",
"data",
"[",
"DOMAIN",
"]",
".",
"get_devices",
"(",
")",
":",
"if",
"'deviceid'",
"in",
"device",
"and",
"device",
"[",
"'deviceid'",
"]",
"==",
"self",
".... | https://github.com/peterbuga/HASS-sonoff-ewelink/blob/ab8fef3426d0f4821def48f25205e32fe23cc59a/sonoff/__init__.py#L644-L649 | |||
bigmlcom/python | 35f69d2f3121f1b3dde43495cf145d4992796ad5 | bigml/multimodel.py | python | MultiModel._generate_votes | (self, input_data, missing_strategy=LAST_PREDICTION,
unused_fields=None) | return votes | Generates a MultiVote object that contains the predictions
made by each of the models. Please note that this function
calls a _predict method which assumes input data has been
properly checked against the model fields. Only casting
to the correct type will be applied. | Generates a MultiVote object that contains the predictions
made by each of the models. Please note that this function
calls a _predict method which assumes input data has been
properly checked against the model fields. Only casting
to the correct type will be applied. | [
"Generates",
"a",
"MultiVote",
"object",
"that",
"contains",
"the",
"predictions",
"made",
"by",
"each",
"of",
"the",
"models",
".",
"Please",
"note",
"that",
"this",
"function",
"calls",
"a",
"_predict",
"method",
"which",
"assumes",
"input",
"data",
"has",
... | def _generate_votes(self, input_data, missing_strategy=LAST_PREDICTION,
unused_fields=None):
""" Generates a MultiVote object that contains the predictions
made by each of the models. Please note that this function
calls a _predict method which assumes input data ... | [
"def",
"_generate_votes",
"(",
"self",
",",
"input_data",
",",
"missing_strategy",
"=",
"LAST_PREDICTION",
",",
"unused_fields",
"=",
"None",
")",
":",
"votes",
"=",
"MultiVote",
"(",
"[",
"]",
")",
"for",
"order",
"in",
"range",
"(",
"0",
",",
"len",
"(... | https://github.com/bigmlcom/python/blob/35f69d2f3121f1b3dde43495cf145d4992796ad5/bigml/multimodel.py#L188-L213 | |
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/tke/v20180525/models.py | python | PrometheusNotification.__init__ | (self) | r"""
:param Enabled: 是否启用
:type Enabled: bool
:param RepeatInterval: 收敛时间
:type RepeatInterval: str
:param TimeRangeStart: 生效起始时间
:type TimeRangeStart: str
:param TimeRangeEnd: 生效结束时间
:type TimeRangeEnd: str
:param NotifyWay: 告警通知方式。目前有SMS、EMAIL、CA... | r"""
:param Enabled: 是否启用
:type Enabled: bool
:param RepeatInterval: 收敛时间
:type RepeatInterval: str
:param TimeRangeStart: 生效起始时间
:type TimeRangeStart: str
:param TimeRangeEnd: 生效结束时间
:type TimeRangeEnd: str
:param NotifyWay: 告警通知方式。目前有SMS、EMAIL、CA... | [
"r",
":",
"param",
"Enabled",
":",
"是否启用",
":",
"type",
"Enabled",
":",
"bool",
":",
"param",
"RepeatInterval",
":",
"收敛时间",
":",
"type",
"RepeatInterval",
":",
"str",
":",
"param",
"TimeRangeStart",
":",
"生效起始时间",
":",
"type",
"TimeRangeStart",
":",
"str"... | def __init__(self):
r"""
:param Enabled: 是否启用
:type Enabled: bool
:param RepeatInterval: 收敛时间
:type RepeatInterval: str
:param TimeRangeStart: 生效起始时间
:type TimeRangeStart: str
:param TimeRangeEnd: 生效结束时间
:type TimeRangeEnd: str
:param Notif... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"Enabled",
"=",
"None",
"self",
".",
"RepeatInterval",
"=",
"None",
"self",
".",
"TimeRangeStart",
"=",
"None",
"self",
".",
"TimeRangeEnd",
"=",
"None",
"self",
".",
"NotifyWay",
"=",
"None",
"self"... | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/tke/v20180525/models.py#L8707-L8765 | ||
openbmc/openbmc | 5f4109adae05f4d6925bfe960007d52f98c61086 | poky/meta/lib/oe/license.py | python | list_licenses | (licensestr) | return visitor.licenses | Simply get a list of all licenses mentioned in a license string.
Binary operators are not applied or taken into account in any way | Simply get a list of all licenses mentioned in a license string.
Binary operators are not applied or taken into account in any way | [
"Simply",
"get",
"a",
"list",
"of",
"all",
"licenses",
"mentioned",
"in",
"a",
"license",
"string",
".",
"Binary",
"operators",
"are",
"not",
"applied",
"or",
"taken",
"into",
"account",
"in",
"any",
"way"
] | def list_licenses(licensestr):
"""Simply get a list of all licenses mentioned in a license string.
Binary operators are not applied or taken into account in any way"""
visitor = ListVisitor()
try:
visitor.visit_string(licensestr)
except SyntaxError as exc:
raise LicenseSyntaxError... | [
"def",
"list_licenses",
"(",
"licensestr",
")",
":",
"visitor",
"=",
"ListVisitor",
"(",
")",
"try",
":",
"visitor",
".",
"visit_string",
"(",
"licensestr",
")",
"except",
"SyntaxError",
"as",
"exc",
":",
"raise",
"LicenseSyntaxError",
"(",
"licensestr",
",",
... | https://github.com/openbmc/openbmc/blob/5f4109adae05f4d6925bfe960007d52f98c61086/poky/meta/lib/oe/license.py#L230-L238 | |
edfungus/Crouton | ada98b3930192938a48909072b45cb84b945f875 | clients/python_clients/cf_demo_client/cf_env/lib/python2.7/site-packages/setuptools/archive_util.py | python | default_filter | (src,dst) | return dst | The default progress/filter callback; returns True for all files | The default progress/filter callback; returns True for all files | [
"The",
"default",
"progress",
"/",
"filter",
"callback",
";",
"returns",
"True",
"for",
"all",
"files"
] | def default_filter(src,dst):
"""The default progress/filter callback; returns True for all files"""
return dst | [
"def",
"default_filter",
"(",
"src",
",",
"dst",
")",
":",
"return",
"dst"
] | https://github.com/edfungus/Crouton/blob/ada98b3930192938a48909072b45cb84b945f875/clients/python_clients/cf_demo_client/cf_env/lib/python2.7/site-packages/setuptools/archive_util.py#L21-L23 | |
RhinoSecurityLabs/Cloud-Security-Research | b7d14b7eb51b7dea6ea6a8978682bd9671e0e183 | AWS/s3_bucket_bruteforcer/buckethead.py | python | check_region_choice | (regions) | Check that the region passed to the script is valid. If all,
return all regions.
Args:
regions (str): Comma separated string of regions.
Returns:
list: List of AWS regions. | Check that the region passed to the script is valid. If all,
return all regions. | [
"Check",
"that",
"the",
"region",
"passed",
"to",
"the",
"script",
"is",
"valid",
".",
"If",
"all",
"return",
"all",
"regions",
"."
] | def check_region_choice(regions):
"""
Check that the region passed to the script is valid. If all,
return all regions.
Args:
regions (str): Comma separated string of regions.
Returns:
list: List of AWS regions.
"""
regions = [x.strip() for x in regions.split(",")]
if "a... | [
"def",
"check_region_choice",
"(",
"regions",
")",
":",
"regions",
"=",
"[",
"x",
".",
"strip",
"(",
")",
"for",
"x",
"in",
"regions",
".",
"split",
"(",
"\",\"",
")",
"]",
"if",
"\"all\"",
"in",
"regions",
":",
"return",
"S3_REGIONS",
"elif",
"not",
... | https://github.com/RhinoSecurityLabs/Cloud-Security-Research/blob/b7d14b7eb51b7dea6ea6a8978682bd9671e0e183/AWS/s3_bucket_bruteforcer/buckethead.py#L34-L55 | ||
UniversalDependencies/tools | 74faa47086440d03e06aa26bc7a8247878737c18 | compat/argparse.py | python | FileType.__call__ | (self, string) | [] | def __call__(self, string):
# the special argument "-" means sys.std{in,out}
if string == '-':
if 'r' in self._mode:
return _sys.stdin
elif 'w' in self._mode:
return _sys.stdout
else:
msg = _('argument "-" with mode %r' ... | [
"def",
"__call__",
"(",
"self",
",",
"string",
")",
":",
"# the special argument \"-\" means sys.std{in,out}",
"if",
"string",
"==",
"'-'",
":",
"if",
"'r'",
"in",
"self",
".",
"_mode",
":",
"return",
"_sys",
".",
"stdin",
"elif",
"'w'",
"in",
"self",
".",
... | https://github.com/UniversalDependencies/tools/blob/74faa47086440d03e06aa26bc7a8247878737c18/compat/argparse.py#L1138-L1153 | ||||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | ansible/roles/lib_oa_openshift/library/oc_adm_ca_server_cert.py | python | OpenShiftCLI._evacuate | (self, node=None, selector=None, pod_selector=None, dry_run=False, grace_period=None, force=False) | return self.openshift_cmd(cmd, oadm=True, output=True, output_type='raw') | perform oadm manage-node evacuate | perform oadm manage-node evacuate | [
"perform",
"oadm",
"manage",
"-",
"node",
"evacuate"
] | def _evacuate(self, node=None, selector=None, pod_selector=None, dry_run=False, grace_period=None, force=False):
''' perform oadm manage-node evacuate '''
cmd = ['manage-node']
if node:
cmd.extend(node)
else:
cmd.append('--selector={}'.format(selector))
i... | [
"def",
"_evacuate",
"(",
"self",
",",
"node",
"=",
"None",
",",
"selector",
"=",
"None",
",",
"pod_selector",
"=",
"None",
",",
"dry_run",
"=",
"False",
",",
"grace_period",
"=",
"None",
",",
"force",
"=",
"False",
")",
":",
"cmd",
"=",
"[",
"'manage... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_oa_openshift/library/oc_adm_ca_server_cert.py#L1081-L1103 | |
NVIDIA/DeepLearningExamples | 589604d49e016cd9ef4525f7abcc9c7b826cfc5e | PyTorch/LanguageModeling/BART/utils/optimization.py | python | get_linear_schedule_with_warmup | (optimizer, num_warmup_steps, num_training_steps, last_epoch=-1) | return LambdaLR(optimizer, lr_lambda, last_epoch) | Create a schedule with a learning rate that decreases linearly from the initial lr set in the optimizer to 0,
after a warmup period during which it increases linearly from 0 to the initial lr set in the optimizer.
Args:
optimizer (:class:`~torch.optim.Optimizer`):
The optimizer for which to... | Create a schedule with a learning rate that decreases linearly from the initial lr set in the optimizer to 0,
after a warmup period during which it increases linearly from 0 to the initial lr set in the optimizer. | [
"Create",
"a",
"schedule",
"with",
"a",
"learning",
"rate",
"that",
"decreases",
"linearly",
"from",
"the",
"initial",
"lr",
"set",
"in",
"the",
"optimizer",
"to",
"0",
"after",
"a",
"warmup",
"period",
"during",
"which",
"it",
"increases",
"linearly",
"from... | def get_linear_schedule_with_warmup(optimizer, num_warmup_steps, num_training_steps, last_epoch=-1):
"""
Create a schedule with a learning rate that decreases linearly from the initial lr set in the optimizer to 0,
after a warmup period during which it increases linearly from 0 to the initial lr set in the ... | [
"def",
"get_linear_schedule_with_warmup",
"(",
"optimizer",
",",
"num_warmup_steps",
",",
"num_training_steps",
",",
"last_epoch",
"=",
"-",
"1",
")",
":",
"def",
"lr_lambda",
"(",
"current_step",
":",
"int",
")",
":",
"if",
"current_step",
"<",
"num_warmup_steps"... | https://github.com/NVIDIA/DeepLearningExamples/blob/589604d49e016cd9ef4525f7abcc9c7b826cfc5e/PyTorch/LanguageModeling/BART/utils/optimization.py#L71-L97 | |
Source-Python-Dev-Team/Source.Python | d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb | addons/source-python/Python3/platform.py | python | platform | (aliased=0, terse=0) | return platform | Returns a single string identifying the underlying platform
with as much useful information as possible (but no more :).
The output is intended to be human readable rather than
machine parseable. It may look different on different
platforms and this is intended.
If "aliased" is... | Returns a single string identifying the underlying platform
with as much useful information as possible (but no more :). | [
"Returns",
"a",
"single",
"string",
"identifying",
"the",
"underlying",
"platform",
"with",
"as",
"much",
"useful",
"information",
"as",
"possible",
"(",
"but",
"no",
"more",
":",
")",
"."
] | def platform(aliased=0, terse=0):
""" Returns a single string identifying the underlying platform
with as much useful information as possible (but no more :).
The output is intended to be human readable rather than
machine parseable. It may look different on different
platforms and... | [
"def",
"platform",
"(",
"aliased",
"=",
"0",
",",
"terse",
"=",
"0",
")",
":",
"result",
"=",
"_platform_cache",
".",
"get",
"(",
"(",
"aliased",
",",
"terse",
")",
",",
"None",
")",
"if",
"result",
"is",
"not",
"None",
":",
"return",
"result",
"# ... | https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/Python3/platform.py#L1304-L1391 | |
donnemartin/data-science-ipython-notebooks | 5b3c00d462c6e9200315afe46d0093948621eb95 | deep-learning/keras-tutorial/deep_learning_models/imagenet_utils.py | python | preprocess_input | (x, dim_ordering='default') | return x | [] | def preprocess_input(x, dim_ordering='default'):
if dim_ordering == 'default':
dim_ordering = K.image_dim_ordering()
assert dim_ordering in {'tf', 'th'}
if dim_ordering == 'th':
x[:, 0, :, :] -= 103.939
x[:, 1, :, :] -= 116.779
x[:, 2, :, :] -= 123.68
# 'RGB'->'BGR'
... | [
"def",
"preprocess_input",
"(",
"x",
",",
"dim_ordering",
"=",
"'default'",
")",
":",
"if",
"dim_ordering",
"==",
"'default'",
":",
"dim_ordering",
"=",
"K",
".",
"image_dim_ordering",
"(",
")",
"assert",
"dim_ordering",
"in",
"{",
"'tf'",
",",
"'th'",
"}",
... | https://github.com/donnemartin/data-science-ipython-notebooks/blob/5b3c00d462c6e9200315afe46d0093948621eb95/deep-learning/keras-tutorial/deep_learning_models/imagenet_utils.py#L11-L28 | |||
mchristopher/PokemonGo-DesktopMap | ec37575f2776ee7d64456e2a1f6b6b78830b4fe0 | app/pywin/Lib/logging/__init__.py | python | Logger._log | (self, level, msg, args, exc_info=None, extra=None) | Low-level logging routine which creates a LogRecord and then calls
all the handlers of this logger to handle the record. | Low-level logging routine which creates a LogRecord and then calls
all the handlers of this logger to handle the record. | [
"Low",
"-",
"level",
"logging",
"routine",
"which",
"creates",
"a",
"LogRecord",
"and",
"then",
"calls",
"all",
"the",
"handlers",
"of",
"this",
"logger",
"to",
"handle",
"the",
"record",
"."
] | def _log(self, level, msg, args, exc_info=None, extra=None):
"""
Low-level logging routine which creates a LogRecord and then calls
all the handlers of this logger to handle the record.
"""
if _srcfile:
#IronPython doesn't track Python frames, so findCaller raises an
... | [
"def",
"_log",
"(",
"self",
",",
"level",
",",
"msg",
",",
"args",
",",
"exc_info",
"=",
"None",
",",
"extra",
"=",
"None",
")",
":",
"if",
"_srcfile",
":",
"#IronPython doesn't track Python frames, so findCaller raises an",
"#exception on some versions of IronPython.... | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/ec37575f2776ee7d64456e2a1f6b6b78830b4fe0/app/pywin/Lib/logging/__init__.py#L1267-L1286 | ||
merenlab/anvio | 9b792e2cedc49ecb7c0bed768261595a0d87c012 | anvio/sequence.py | python | Kmerizer.get_prefix_kmer_dict | (self, kmer_size, include_full_length=True) | return kmer_dict | Get k-mers of a given size from the beginning of input sequences.
Parameters
==========
kmer_size : int
Length of the k-mers to be extracted
include_full_length : bool, True
Whether to include or ignore full-length input sequences among the hashed k-mers
... | Get k-mers of a given size from the beginning of input sequences. | [
"Get",
"k",
"-",
"mers",
"of",
"a",
"given",
"size",
"from",
"the",
"beginning",
"of",
"input",
"sequences",
"."
] | def get_prefix_kmer_dict(self, kmer_size, include_full_length=True):
"""Get k-mers of a given size from the beginning of input sequences.
Parameters
==========
kmer_size : int
Length of the k-mers to be extracted
include_full_length : bool, True
Whether ... | [
"def",
"get_prefix_kmer_dict",
"(",
"self",
",",
"kmer_size",
",",
"include_full_length",
"=",
"True",
")",
":",
"kmer_dict",
"=",
"{",
"}",
"for",
"name",
",",
"seq",
"in",
"zip",
"(",
"self",
".",
"names",
",",
"self",
".",
"seqs",
")",
":",
"if",
... | https://github.com/merenlab/anvio/blob/9b792e2cedc49ecb7c0bed768261595a0d87c012/anvio/sequence.py#L248-L285 | |
espnet/espnet | ea411f3f627b8f101c211e107d0ff7053344ac80 | egs/vcc20/vc1_task2/local/clean_text_finnish.py | python | g2p | (text) | return " ".join(tokens) | Convert grapheme to phoneme. | Convert grapheme to phoneme. | [
"Convert",
"grapheme",
"to",
"phoneme",
"."
] | def g2p(text):
"""Convert grapheme to phoneme."""
tokens = filter(lambda s: s != " ", f_g2p(text))
return " ".join(tokens) | [
"def",
"g2p",
"(",
"text",
")",
":",
"tokens",
"=",
"filter",
"(",
"lambda",
"s",
":",
"s",
"!=",
"\" \"",
",",
"f_g2p",
"(",
"text",
")",
")",
"return",
"\" \"",
".",
"join",
"(",
"tokens",
")"
] | https://github.com/espnet/espnet/blob/ea411f3f627b8f101c211e107d0ff7053344ac80/egs/vcc20/vc1_task2/local/clean_text_finnish.py#L44-L47 | |
wxWidgets/Phoenix | b2199e299a6ca6d866aa6f3d0888499136ead9d6 | wx/lib/agw/scrolledthumbnail.py | python | ScrolledThumbnail.GetThumbBorder | (self) | return self._tBorder | Returns the thumbnail border. | Returns the thumbnail border. | [
"Returns",
"the",
"thumbnail",
"border",
"."
] | def GetThumbBorder(self):
""" Returns the thumbnail border. """
return self._tBorder | [
"def",
"GetThumbBorder",
"(",
"self",
")",
":",
"return",
"self",
".",
"_tBorder"
] | https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/scrolledthumbnail.py#L1044-L1047 | |
euske/pdfminer | 423f851fc20ebd701bc4c8b5b7ba0e7904e18e3b | pdfminer/pdfdocument.py | python | PDFDocument.find_xref | (self, parser) | return int(prev) | Internal function used to locate the first XRef. | Internal function used to locate the first XRef. | [
"Internal",
"function",
"used",
"to",
"locate",
"the",
"first",
"XRef",
"."
] | def find_xref(self, parser):
"""Internal function used to locate the first XRef."""
# search the last xref table by scanning the file backwards.
prev = None
for line in parser.revreadlines():
line = line.strip()
if self.debug:
logging.debug('find_x... | [
"def",
"find_xref",
"(",
"self",
",",
"parser",
")",
":",
"# search the last xref table by scanning the file backwards.",
"prev",
"=",
"None",
"for",
"line",
"in",
"parser",
".",
"revreadlines",
"(",
")",
":",
"line",
"=",
"line",
".",
"strip",
"(",
")",
"if",... | https://github.com/euske/pdfminer/blob/423f851fc20ebd701bc4c8b5b7ba0e7904e18e3b/pdfminer/pdfdocument.py#L755-L771 | |
Chaffelson/nipyapi | d3b186fd701ce308c2812746d98af9120955e810 | nipyapi/nifi/models/process_group_status_snapshot_dto.py | python | ProcessGroupStatusSnapshotDTO.bytes_in | (self) | return self._bytes_in | Gets the bytes_in of this ProcessGroupStatusSnapshotDTO.
The number of bytes that have come into this ProcessGroup in the last 5 minutes
:return: The bytes_in of this ProcessGroupStatusSnapshotDTO.
:rtype: int | Gets the bytes_in of this ProcessGroupStatusSnapshotDTO.
The number of bytes that have come into this ProcessGroup in the last 5 minutes | [
"Gets",
"the",
"bytes_in",
"of",
"this",
"ProcessGroupStatusSnapshotDTO",
".",
"The",
"number",
"of",
"bytes",
"that",
"have",
"come",
"into",
"this",
"ProcessGroup",
"in",
"the",
"last",
"5",
"minutes"
] | def bytes_in(self):
"""
Gets the bytes_in of this ProcessGroupStatusSnapshotDTO.
The number of bytes that have come into this ProcessGroup in the last 5 minutes
:return: The bytes_in of this ProcessGroupStatusSnapshotDTO.
:rtype: int
"""
return self._bytes_in | [
"def",
"bytes_in",
"(",
"self",
")",
":",
"return",
"self",
".",
"_bytes_in"
] | https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/process_group_status_snapshot_dto.py#L458-L466 | |
grantjenks/free-python-games | 3f27c6555e2c72a9b1c668c4dd8506d7b8378d09 | freegames/pong.py | python | rectangle | (x, y, width, height) | Draw rectangle at (x, y) with given width and height. | Draw rectangle at (x, y) with given width and height. | [
"Draw",
"rectangle",
"at",
"(",
"x",
"y",
")",
"with",
"given",
"width",
"and",
"height",
"."
] | def rectangle(x, y, width, height):
"""Draw rectangle at (x, y) with given width and height."""
up()
goto(x, y)
down()
begin_fill()
for count in range(2):
forward(width)
left(90)
forward(height)
left(90)
end_fill() | [
"def",
"rectangle",
"(",
"x",
",",
"y",
",",
"width",
",",
"height",
")",
":",
"up",
"(",
")",
"goto",
"(",
"x",
",",
"y",
")",
"down",
"(",
")",
"begin_fill",
"(",
")",
"for",
"count",
"in",
"range",
"(",
"2",
")",
":",
"forward",
"(",
"widt... | https://github.com/grantjenks/free-python-games/blob/3f27c6555e2c72a9b1c668c4dd8506d7b8378d09/freegames/pong.py#L35-L46 | ||
mlcommons/training | 4a4d5a0b7efe99c680306b1940749211d4238a84 | reinforcement/tensorflow/minigo/oneoffs/oneoff_utils.py | python | find_and_filter_sgf_files | (base_dir, min_year=None, komi=None) | return filtered_sgf_files | Finds all sgf files in base_dir with year >= min_year and komi | Finds all sgf files in base_dir with year >= min_year and komi | [
"Finds",
"all",
"sgf",
"files",
"in",
"base_dir",
"with",
"year",
">",
"=",
"min_year",
"and",
"komi"
] | def find_and_filter_sgf_files(base_dir, min_year=None, komi=None):
"""Finds all sgf files in base_dir with year >= min_year and komi"""
sgf_files = []
for dirpath, dirnames, filenames in os.walk(base_dir):
for filename in filenames:
if filename.endswith('.sgf'):
path = os... | [
"def",
"find_and_filter_sgf_files",
"(",
"base_dir",
",",
"min_year",
"=",
"None",
",",
"komi",
"=",
"None",
")",
":",
"sgf_files",
"=",
"[",
"]",
"for",
"dirpath",
",",
"dirnames",
",",
"filenames",
"in",
"os",
".",
"walk",
"(",
"base_dir",
")",
":",
... | https://github.com/mlcommons/training/blob/4a4d5a0b7efe99c680306b1940749211d4238a84/reinforcement/tensorflow/minigo/oneoffs/oneoff_utils.py#L77-L95 | |
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/apps/callcenter/indicator_sets.py | python | CallCenterIndicators.date_ranges | (self) | return {
WEEK0: (weekago, self.reference_date),
WEEK1: (weekago2, weekago),
MONTH0: (daysago30, self.reference_date),
MONTH1: (daysago60, daysago30),
} | [] | def date_ranges(self):
weekago = self.reference_date - timedelta(days=7)
weekago2 = self.reference_date - timedelta(days=14)
daysago30 = self.reference_date - timedelta(days=30)
daysago60 = self.reference_date - timedelta(days=60)
return {
WEEK0: (weekago, self.refere... | [
"def",
"date_ranges",
"(",
"self",
")",
":",
"weekago",
"=",
"self",
".",
"reference_date",
"-",
"timedelta",
"(",
"days",
"=",
"7",
")",
"weekago2",
"=",
"self",
".",
"reference_date",
"-",
"timedelta",
"(",
"days",
"=",
"14",
")",
"daysago30",
"=",
"... | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/callcenter/indicator_sets.py#L110-L120 | |||
Komodo/KomodoEdit | 61edab75dce2bdb03943b387b0608ea36f548e8e | src/udl/luddite.py | python | Shell.do_just_compile | (self, subcmd, opts, udl_path) | return commands.compile(
udl_path, output_dir=opts.output_dir,
include_path=opts.include_dirs, log=log) | ${cmd_name}: compile a .udl file into a .lexres file
${cmd_usage}
${cmd_option_list}
Note: This is a replacement for the deprecated `luddite compile'. In
a subsequent release this will get the name `luddite compile'. | ${cmd_name}: compile a .udl file into a .lexres file
${cmd_usage}
${cmd_option_list}
Note: This is a replacement for the deprecated `luddite compile'. In
a subsequent release this will get the name `luddite compile'. | [
"$",
"{",
"cmd_name",
"}",
":",
"compile",
"a",
".",
"udl",
"file",
"into",
"a",
".",
"lexres",
"file",
"$",
"{",
"cmd_usage",
"}",
"$",
"{",
"cmd_option_list",
"}",
"Note",
":",
"This",
"is",
"a",
"replacement",
"for",
"the",
"deprecated",
"luddite",
... | def do_just_compile(self, subcmd, opts, udl_path):
"""${cmd_name}: compile a .udl file into a .lexres file
${cmd_usage}
${cmd_option_list}
Note: This is a replacement for the deprecated `luddite compile'. In
a subsequent release this will get the name `luddite compile'.
... | [
"def",
"do_just_compile",
"(",
"self",
",",
"subcmd",
",",
"opts",
",",
"udl_path",
")",
":",
"return",
"commands",
".",
"compile",
"(",
"udl_path",
",",
"output_dir",
"=",
"opts",
".",
"output_dir",
",",
"include_path",
"=",
"opts",
".",
"include_dirs",
"... | https://github.com/Komodo/KomodoEdit/blob/61edab75dce2bdb03943b387b0608ea36f548e8e/src/udl/luddite.py#L140-L150 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/ipysheet/easy.py | python | current | () | return _last_sheet | Returns the current `Sheet` instance | Returns the current `Sheet` instance | [
"Returns",
"the",
"current",
"Sheet",
"instance"
] | def current():
"""Returns the current `Sheet` instance"""
return _last_sheet | [
"def",
"current",
"(",
")",
":",
"return",
"_last_sheet"
] | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/ipysheet/easy.py#L65-L67 | |
OpenMined/PySyft | f181ca02d307d57bfff9477610358df1a12e3ac9 | packages/syft/src/syft/core/tensor/smpc/mpc_tensor.py | python | MPCTensor.sanity_checks | (mpc_tensor: MPCTensor, other: Any) | return mpc_tensor, other | Performs sanity checks to share data to whole superset of parites involved.
Args:
mpc_tensor(MPCTensor): input MPCTensor to perform sanity check on.
other (Any): input operand.
Returns:
Tuple[MPCTensor,Any]: Rehared Tensor values. | Performs sanity checks to share data to whole superset of parites involved.
Args:
mpc_tensor(MPCTensor): input MPCTensor to perform sanity check on.
other (Any): input operand.
Returns:
Tuple[MPCTensor,Any]: Rehared Tensor values. | [
"Performs",
"sanity",
"checks",
"to",
"share",
"data",
"to",
"whole",
"superset",
"of",
"parites",
"involved",
".",
"Args",
":",
"mpc_tensor",
"(",
"MPCTensor",
")",
":",
"input",
"MPCTensor",
"to",
"perform",
"sanity",
"check",
"on",
".",
"other",
"(",
"A... | def sanity_checks(mpc_tensor: MPCTensor, other: Any) -> Tuple[MPCTensor, Any]:
"""Performs sanity checks to share data to whole superset of parites involved.
Args:
mpc_tensor(MPCTensor): input MPCTensor to perform sanity check on.
other (Any): input operand.
Returns:
... | [
"def",
"sanity_checks",
"(",
"mpc_tensor",
":",
"MPCTensor",
",",
"other",
":",
"Any",
")",
"->",
"Tuple",
"[",
"MPCTensor",
",",
"Any",
"]",
":",
"if",
"utils",
".",
"ispointer",
"(",
"other",
")",
":",
"parties",
"=",
"mpc_tensor",
".",
"parties",
"c... | https://github.com/OpenMined/PySyft/blob/f181ca02d307d57bfff9477610358df1a12e3ac9/packages/syft/src/syft/core/tensor/smpc/mpc_tensor.py#L544-L582 | |
kedro-org/kedro | e78990c6b606a27830f0d502afa0f639c0830950 | kedro/framework/hooks/specs.py | python | DatasetSpecs.after_dataset_loaded | (self, dataset_name: str, data: Any) | Hook to be invoked after a dataset is loaded from the catalog.
Args:
dataset_name: name of the dataset that was loaded from the catalog.
data: the actual data that was loaded from the catalog. | Hook to be invoked after a dataset is loaded from the catalog. | [
"Hook",
"to",
"be",
"invoked",
"after",
"a",
"dataset",
"is",
"loaded",
"from",
"the",
"catalog",
"."
] | def after_dataset_loaded(self, dataset_name: str, data: Any) -> None:
"""Hook to be invoked after a dataset is loaded from the catalog.
Args:
dataset_name: name of the dataset that was loaded from the catalog.
data: the actual data that was loaded from the catalog.
"""
... | [
"def",
"after_dataset_loaded",
"(",
"self",
",",
"dataset_name",
":",
"str",
",",
"data",
":",
"Any",
")",
"->",
"None",
":",
"pass"
] | https://github.com/kedro-org/kedro/blob/e78990c6b606a27830f0d502afa0f639c0830950/kedro/framework/hooks/specs.py#L257-L265 | ||
enthought/traits | d22ce1f096e2a6f87c78d7f1bb5bf0abab1a18ff | traits/trait_types.py | python | List.create_editor | (self) | return list_editor(self, self) | Returns the default UI editor for the trait. | Returns the default UI editor for the trait. | [
"Returns",
"the",
"default",
"UI",
"editor",
"for",
"the",
"trait",
"."
] | def create_editor(self):
""" Returns the default UI editor for the trait.
"""
return list_editor(self, self) | [
"def",
"create_editor",
"(",
"self",
")",
":",
"return",
"list_editor",
"(",
"self",
",",
"self",
")"
] | https://github.com/enthought/traits/blob/d22ce1f096e2a6f87c78d7f1bb5bf0abab1a18ff/traits/trait_types.py#L2684-L2687 | |
pyrocko/pyrocko | b6baefb7540fb7fce6ed9b856ec0c413961a4320 | src/dataset/gshhg.py | python | Polygon.__init__ | (self, gshhg_file, offset, *attr) | Initialise a GSHHG polygon
:param gshhg_file: GSHHG binary file
:type gshhg_file: str
:param offset: This polygon's offset in binary file
:type offset: int
:param attr: Polygon attributes
``(pid, npoints, _flag, west, east, south, north,
area, area_ful... | Initialise a GSHHG polygon | [
"Initialise",
"a",
"GSHHG",
"polygon"
] | def __init__(self, gshhg_file, offset, *attr):
'''
Initialise a GSHHG polygon
:param gshhg_file: GSHHG binary file
:type gshhg_file: str
:param offset: This polygon's offset in binary file
:type offset: int
:param attr: Polygon attributes
``(pid, npo... | [
"def",
"__init__",
"(",
"self",
",",
"gshhg_file",
",",
"offset",
",",
"*",
"attr",
")",
":",
"(",
"self",
".",
"pid",
",",
"self",
".",
"npoints",
",",
"self",
".",
"_flag",
",",
"self",
".",
"west",
",",
"self",
".",
"east",
",",
"self",
".",
... | https://github.com/pyrocko/pyrocko/blob/b6baefb7540fb7fce6ed9b856ec0c413961a4320/src/dataset/gshhg.py#L202-L245 | ||
TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials | 5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e | tensorflow_dl_models/research/inception/inception/data/build_image_data.py | python | _is_png | (filename) | return filename.endswith('.png') | Determine if a file contains a PNG format image.
Args:
filename: string, path of the image file.
Returns:
boolean indicating if the image is a PNG. | Determine if a file contains a PNG format image. | [
"Determine",
"if",
"a",
"file",
"contains",
"a",
"PNG",
"format",
"image",
"."
] | def _is_png(filename):
"""Determine if a file contains a PNG format image.
Args:
filename: string, path of the image file.
Returns:
boolean indicating if the image is a PNG.
"""
return filename.endswith('.png') | [
"def",
"_is_png",
"(",
"filename",
")",
":",
"return",
"filename",
".",
"endswith",
"(",
"'.png'",
")"
] | https://github.com/TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials/blob/5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e/tensorflow_dl_models/research/inception/inception/data/build_image_data.py#L177-L186 | |
tern-tools/tern | 723f43dcaae2f2f0a08a63e5e8de3938031a386e | tern/formats/html/generator.py | python | HTML.generate_layer | (self, layer) | return report | Given a layer object, create a html report for the layer | Given a layer object, create a html report for the layer | [
"Given",
"a",
"layer",
"object",
"create",
"a",
"html",
"report",
"for",
"the",
"layer"
] | def generate_layer(self, layer):
"""Given a layer object, create a html report for the layer"""
logger.debug("Creating HTML report...")
report = ""
report = report + '\n' + head_layer % (css, get_tool_version())
report = report + '\n' + report_dict_to_html(layer.to_dict())
... | [
"def",
"generate_layer",
"(",
"self",
",",
"layer",
")",
":",
"logger",
".",
"debug",
"(",
"\"Creating HTML report...\"",
")",
"report",
"=",
"\"\"",
"report",
"=",
"report",
"+",
"'\\n'",
"+",
"head_layer",
"%",
"(",
"css",
",",
"get_tool_version",
"(",
"... | https://github.com/tern-tools/tern/blob/723f43dcaae2f2f0a08a63e5e8de3938031a386e/tern/formats/html/generator.py#L331-L339 | |
JimmXinu/FanFicFare | bc149a2deb2636320fe50a3e374af6eef8f61889 | included_dependencies/html2text/__init__.py | python | HTML2Text.replaceEntities | (self, s) | [] | def replaceEntities(self, s):
s = s.group(1)
if s[0] == "#":
return self.charref(s[1:])
else:
return self.entityref(s) | [
"def",
"replaceEntities",
"(",
"self",
",",
"s",
")",
":",
"s",
"=",
"s",
".",
"group",
"(",
"1",
")",
"if",
"s",
"[",
"0",
"]",
"==",
"\"#\"",
":",
"return",
"self",
".",
"charref",
"(",
"s",
"[",
"1",
":",
"]",
")",
"else",
":",
"return",
... | https://github.com/JimmXinu/FanFicFare/blob/bc149a2deb2636320fe50a3e374af6eef8f61889/included_dependencies/html2text/__init__.py#L861-L866 | ||||
bikalims/bika.lims | 35e4bbdb5a3912cae0b5eb13e51097c8b0486349 | bika/lims/exportimport/instruments/resultsimport.py | python | AnalysisResultsImporter.getOverride | (self) | return self._override | If the importer must override previously entered results.
[False, False]: The results will not be overriden
[True, False]: The results will be overriden only if there's no
result entered yet,
[True, True]: The results will be always overriden, also if the
... | If the importer must override previously entered results.
[False, False]: The results will not be overriden
[True, False]: The results will be overriden only if there's no
result entered yet,
[True, True]: The results will be always overriden, also if the
... | [
"If",
"the",
"importer",
"must",
"override",
"previously",
"entered",
"results",
".",
"[",
"False",
"False",
"]",
":",
"The",
"results",
"will",
"not",
"be",
"overriden",
"[",
"True",
"False",
"]",
":",
"The",
"results",
"will",
"be",
"overriden",
"only",
... | def getOverride(self):
""" If the importer must override previously entered results.
[False, False]: The results will not be overriden
[True, False]: The results will be overriden only if there's no
result entered yet,
[True, True]: The results will... | [
"def",
"getOverride",
"(",
"self",
")",
":",
"return",
"self",
".",
"_override"
] | https://github.com/bikalims/bika.lims/blob/35e4bbdb5a3912cae0b5eb13e51097c8b0486349/bika/lims/exportimport/instruments/resultsimport.py#L302-L310 | |
cuthbertLab/music21 | bd30d4663e52955ed922c10fdf541419d8c67671 | music21/corpus/corpora.py | python | LocalCorpus.cacheFilePath | (self) | return filePath | Get the path to the file path that stores the .json file.
returns a pathlib.Path | Get the path to the file path that stores the .json file. | [
"Get",
"the",
"path",
"to",
"the",
"file",
"path",
"that",
"stores",
"the",
".",
"json",
"file",
"."
] | def cacheFilePath(self):
'''
Get the path to the file path that stores the .json file.
returns a pathlib.Path
'''
localCorpusSettings = self._getSettings()
if localCorpusSettings is not None and localCorpusSettings.cacheFilePath is not None:
return localCorpu... | [
"def",
"cacheFilePath",
"(",
"self",
")",
":",
"localCorpusSettings",
"=",
"self",
".",
"_getSettings",
"(",
")",
"if",
"localCorpusSettings",
"is",
"not",
"None",
"and",
"localCorpusSettings",
".",
"cacheFilePath",
"is",
"not",
"None",
":",
"return",
"localCorp... | https://github.com/cuthbertLab/music21/blob/bd30d4663e52955ed922c10fdf541419d8c67671/music21/corpus/corpora.py#L726-L742 | |
saghul/evergreen | 22f22f45892f397c23c3e09e6ea1ad4c00b3add8 | evergreen/tasks.py | python | Task.kill | (self, typ=TaskExit, value=None, tb=None) | Terminates the current task by raising an exception into it.
Whatever that task might be doing; be it waiting for I/O or another
primitive, it sees an exception as soon as it yields control.
By default, this exception is TaskExit, but a specific exception
may be specified. | Terminates the current task by raising an exception into it.
Whatever that task might be doing; be it waiting for I/O or another
primitive, it sees an exception as soon as it yields control. | [
"Terminates",
"the",
"current",
"task",
"by",
"raising",
"an",
"exception",
"into",
"it",
".",
"Whatever",
"that",
"task",
"might",
"be",
"doing",
";",
"be",
"it",
"waiting",
"for",
"I",
"/",
"O",
"or",
"another",
"primitive",
"it",
"sees",
"an",
"except... | def kill(self, typ=TaskExit, value=None, tb=None):
"""Terminates the current task by raising an exception into it.
Whatever that task might be doing; be it waiting for I/O or another
primitive, it sees an exception as soon as it yields control.
By default, this exception is TaskExit, bu... | [
"def",
"kill",
"(",
"self",
",",
"typ",
"=",
"TaskExit",
",",
"value",
"=",
"None",
",",
"tb",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"is_alive",
"(",
")",
":",
"return",
"if",
"not",
"value",
":",
"value",
"=",
"typ",
"(",
")",
"if",... | https://github.com/saghul/evergreen/blob/22f22f45892f397c23c3e09e6ea1ad4c00b3add8/evergreen/tasks.py#L96-L114 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_vendored_deps/library/oc_pvc.py | python | PersistentVolumeClaim.access_modes | (self) | return self._access_modes | access_modes property | access_modes property | [
"access_modes",
"property"
] | def access_modes(self):
''' access_modes property '''
if self._access_modes is None:
self._access_modes = self.get_access_modes()
if not isinstance(self._access_modes, list):
self._access_modes = list(self._access_modes)
return self._access_modes | [
"def",
"access_modes",
"(",
"self",
")",
":",
"if",
"self",
".",
"_access_modes",
"is",
"None",
":",
"self",
".",
"_access_modes",
"=",
"self",
".",
"get_access_modes",
"(",
")",
"if",
"not",
"isinstance",
"(",
"self",
".",
"_access_modes",
",",
"list",
... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_vendored_deps/library/oc_pvc.py#L1594-L1601 | |
chapmanb/bcbb | dbfb52711f0bfcc1d26c5a5b53c9ff4f50dc0027 | biosql_ontologies/sparta.py | python | Thing.__delattr__ | (self, attr) | attr - either:
a) str starting with _ (normal attribute deletion)
b) str that is a URI
c) str in the form prefix_localname | attr - either:
a) str starting with _ (normal attribute deletion)
b) str that is a URI
c) str in the form prefix_localname | [
"attr",
"-",
"either",
":",
"a",
")",
"str",
"starting",
"with",
"_",
"(",
"normal",
"attribute",
"deletion",
")",
"b",
")",
"str",
"that",
"is",
"a",
"URI",
"c",
")",
"str",
"in",
"the",
"form",
"prefix_localname"
] | def __delattr__(self, attr):
"""
attr - either:
a) str starting with _ (normal attribute deletion)
b) str that is a URI
c) str in the form prefix_localname
"""
if attr[0] == '_':
del self.__dict__[attr]
else:
if... | [
"def",
"__delattr__",
"(",
"self",
",",
"attr",
")",
":",
"if",
"attr",
"[",
"0",
"]",
"==",
"'_'",
":",
"del",
"self",
".",
"__dict__",
"[",
"attr",
"]",
"else",
":",
"if",
"\":\"",
"in",
"attr",
":",
"self",
".",
"_store",
".",
"remove",
"(",
... | https://github.com/chapmanb/bcbb/blob/dbfb52711f0bfcc1d26c5a5b53c9ff4f50dc0027/biosql_ontologies/sparta.py#L208-L224 | ||
django-import-export/django-import-export | 0d4340f02582e86d4515159becb045cad1d53ee0 | import_export/resources.py | python | Resource.before_import_row | (self, row, row_number=None, **kwargs) | Override to add additional logic. Does nothing by default. | Override to add additional logic. Does nothing by default. | [
"Override",
"to",
"add",
"additional",
"logic",
".",
"Does",
"nothing",
"by",
"default",
"."
] | def before_import_row(self, row, row_number=None, **kwargs):
"""
Override to add additional logic. Does nothing by default.
"""
pass | [
"def",
"before_import_row",
"(",
"self",
",",
"row",
",",
"row_number",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"pass"
] | https://github.com/django-import-export/django-import-export/blob/0d4340f02582e86d4515159becb045cad1d53ee0/import_export/resources.py#L629-L633 | ||
HymanLiuTS/flaskTs | 286648286976e85d9b9a5873632331efcafe0b21 | flasky/lib/python2.7/site-packages/sqlalchemy/sql/elements.py | python | Null._instance | (cls) | return Null() | Return a constant :class:`.Null` construct. | Return a constant :class:`.Null` construct. | [
"Return",
"a",
"constant",
":",
"class",
":",
".",
"Null",
"construct",
"."
] | def _instance(cls):
"""Return a constant :class:`.Null` construct."""
return Null() | [
"def",
"_instance",
"(",
"cls",
")",
":",
"return",
"Null",
"(",
")"
] | https://github.com/HymanLiuTS/flaskTs/blob/286648286976e85d9b9a5873632331efcafe0b21/flasky/lib/python2.7/site-packages/sqlalchemy/sql/elements.py#L1633-L1636 | |
python/cpython | e13cdca0f5224ec4e23bdd04bb3120506964bc8b | Lib/ssl.py | python | get_server_certificate | (addr, ssl_version=PROTOCOL_TLS_CLIENT,
ca_certs=None, timeout=_GLOBAL_DEFAULT_TIMEOUT) | return DER_cert_to_PEM_cert(dercert) | Retrieve the certificate from the server at the specified address,
and return it as a PEM-encoded string.
If 'ca_certs' is specified, validate the server cert against it.
If 'ssl_version' is specified, use it in the connection attempt.
If 'timeout' is specified, use it in the connection attempt. | Retrieve the certificate from the server at the specified address,
and return it as a PEM-encoded string.
If 'ca_certs' is specified, validate the server cert against it.
If 'ssl_version' is specified, use it in the connection attempt.
If 'timeout' is specified, use it in the connection attempt. | [
"Retrieve",
"the",
"certificate",
"from",
"the",
"server",
"at",
"the",
"specified",
"address",
"and",
"return",
"it",
"as",
"a",
"PEM",
"-",
"encoded",
"string",
".",
"If",
"ca_certs",
"is",
"specified",
"validate",
"the",
"server",
"cert",
"against",
"it",... | def get_server_certificate(addr, ssl_version=PROTOCOL_TLS_CLIENT,
ca_certs=None, timeout=_GLOBAL_DEFAULT_TIMEOUT):
"""Retrieve the certificate from the server at the specified address,
and return it as a PEM-encoded string.
If 'ca_certs' is specified, validate the server cert agai... | [
"def",
"get_server_certificate",
"(",
"addr",
",",
"ssl_version",
"=",
"PROTOCOL_TLS_CLIENT",
",",
"ca_certs",
"=",
"None",
",",
"timeout",
"=",
"_GLOBAL_DEFAULT_TIMEOUT",
")",
":",
"host",
",",
"port",
"=",
"addr",
"if",
"ca_certs",
"is",
"not",
"None",
":",
... | https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/ssl.py#L1510-L1530 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/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
bmwidth = 152*ruler/328
#if kw.get("bitmap", True):
# self.bitmap("Bitmap", 0, 0, ... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"Dialog",
".",
"__init__",
"(",
"self",
",",
"*",
"args",
")",
"ruler",
"=",
"self",
".",
"h",
"-",
"36",
"bmwidth",
"=",
"152",
"*",
"ruler",
"/",
"328",
"#if kw.... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/distutils/command/bdist_msi.py#L25-L33 | ||
tanghaibao/jcvi | 5e720870c0928996f8b77a38208106ff0447ccb6 | jcvi/assembly/hic.py | python | prepare_synteny | (tourfile, lastfile, odir, p, opts) | return anchorsfile, qbedfile, contig_to_beds | Prepare synteny plots for movie(). | Prepare synteny plots for movie(). | [
"Prepare",
"synteny",
"plots",
"for",
"movie",
"()",
"."
] | def prepare_synteny(tourfile, lastfile, odir, p, opts):
"""
Prepare synteny plots for movie().
"""
qbedfile, sbedfile = get_bed_filenames(lastfile, p, opts)
qbedfile = op.abspath(qbedfile)
sbedfile = op.abspath(sbedfile)
qbed = Bed(qbedfile, sorted=False)
contig_to_beds = dict(qbed.sub_... | [
"def",
"prepare_synteny",
"(",
"tourfile",
",",
"lastfile",
",",
"odir",
",",
"p",
",",
"opts",
")",
":",
"qbedfile",
",",
"sbedfile",
"=",
"get_bed_filenames",
"(",
"lastfile",
",",
"p",
",",
"opts",
")",
"qbedfile",
"=",
"op",
".",
"abspath",
"(",
"q... | https://github.com/tanghaibao/jcvi/blob/5e720870c0928996f8b77a38208106ff0447ccb6/jcvi/assembly/hic.py#L1322-L1351 | |
fooying/3102 | 0faee38c30b2e24154f41e68457cfd8f7a61c040 | thirdparty/dns/zone.py | python | Zone.to_text | (self, sorted=True, relativize=True, nl=None) | return return_value | Return a zone's text as though it were written to a file.
@param sorted: if True, the file will be written with the
names sorted in DNSSEC order from least to greatest. Otherwise
the names will be written in whatever order they happen to have
in the zone's dictionary.
@param re... | Return a zone's text as though it were written to a file. | [
"Return",
"a",
"zone",
"s",
"text",
"as",
"though",
"it",
"were",
"written",
"to",
"a",
"file",
"."
] | def to_text(self, sorted=True, relativize=True, nl=None):
"""Return a zone's text as though it were written to a file.
@param sorted: if True, the file will be written with the
names sorted in DNSSEC order from least to greatest. Otherwise
the names will be written in whatever order th... | [
"def",
"to_text",
"(",
"self",
",",
"sorted",
"=",
"True",
",",
"relativize",
"=",
"True",
",",
"nl",
"=",
"None",
")",
":",
"temp_buffer",
"=",
"StringIO",
"(",
")",
"self",
".",
"to_file",
"(",
"temp_buffer",
",",
"sorted",
",",
"relativize",
",",
... | https://github.com/fooying/3102/blob/0faee38c30b2e24154f41e68457cfd8f7a61c040/thirdparty/dns/zone.py#L513-L532 | |
cronyo/cronyo | cd5abab0871b68bf31b18aac934303928130a441 | cronyo/vendor/yaml/constructor.py | python | FullConstructor.construct_python_str | (self, node) | return self.construct_scalar(node) | [] | def construct_python_str(self, node):
return self.construct_scalar(node) | [
"def",
"construct_python_str",
"(",
"self",
",",
"node",
")",
":",
"return",
"self",
".",
"construct_scalar",
"(",
"node",
")"
] | https://github.com/cronyo/cronyo/blob/cd5abab0871b68bf31b18aac934303928130a441/cronyo/vendor/yaml/constructor.py#L475-L476 | |||
salabim/salabim | e0de846b042daf2dc71aaf43d8adc6486b57f376 | salabim_exp.py | python | test31 | () | [] | def test31():
class X(sim.Component):
def process(self):
yield self.hold(1)
s1.set()
yield self.hold(2)
s1.reset()
yield self.hold(2)
y.print_info()
s1.trigger()
class Y(sim.Component):
def process(self):
... | [
"def",
"test31",
"(",
")",
":",
"class",
"X",
"(",
"sim",
".",
"Component",
")",
":",
"def",
"process",
"(",
"self",
")",
":",
"yield",
"self",
".",
"hold",
"(",
"1",
")",
"s1",
".",
"set",
"(",
")",
"yield",
"self",
".",
"hold",
"(",
"2",
")... | https://github.com/salabim/salabim/blob/e0de846b042daf2dc71aaf43d8adc6486b57f376/salabim_exp.py#L3254-L3289 | ||||
fluentpython/example-code-2e | 80f7f84274a47579e59c29a4657691525152c9d5 | 24-class-metaprog/bulkfood/model_v7.py | python | EntityMeta.__init__ | (cls, name, bases, attr_dict) | [] | def __init__(cls, name, bases, attr_dict):
super().__init__(name, bases, attr_dict) # <1>
for key, attr in attr_dict.items(): # <2>
if isinstance(attr, Validated):
type_name = type(attr).__name__
attr.storage_name = '_{}#{}'.format(type_name, key) | [
"def",
"__init__",
"(",
"cls",
",",
"name",
",",
"bases",
",",
"attr_dict",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"name",
",",
"bases",
",",
"attr_dict",
")",
"# <1>",
"for",
"key",
",",
"attr",
"in",
"attr_dict",
".",
"items",
"(",
")... | https://github.com/fluentpython/example-code-2e/blob/80f7f84274a47579e59c29a4657691525152c9d5/24-class-metaprog/bulkfood/model_v7.py#L57-L62 | ||||
trevp/tlslite | cd82fadb6bb958522b7457c5ed95890283437a4f | tlslite/tlsrecordlayer.py | python | TLSRecordLayer.send | (self, s) | return len(s) | Send data to the TLS connection (socket emulation).
@raise socket.error: If a socket error occurs. | Send data to the TLS connection (socket emulation). | [
"Send",
"data",
"to",
"the",
"TLS",
"connection",
"(",
"socket",
"emulation",
")",
"."
] | def send(self, s):
"""Send data to the TLS connection (socket emulation).
@raise socket.error: If a socket error occurs.
"""
self.write(s)
return len(s) | [
"def",
"send",
"(",
"self",
",",
"s",
")",
":",
"self",
".",
"write",
"(",
"s",
")",
"return",
"len",
"(",
"s",
")"
] | https://github.com/trevp/tlslite/blob/cd82fadb6bb958522b7457c5ed95890283437a4f/tlslite/tlsrecordlayer.py#L420-L426 | |
perone/Pyevolve | 589b6a9b92ed1fd9ef00987bf4bfe807c4a7b7e0 | pyevolve/Statistics.py | python | Statistics.asTuple | (self) | return tuple(self.internalDict.values()) | Returns the stats as a python tuple | Returns the stats as a python tuple | [
"Returns",
"the",
"stats",
"as",
"a",
"python",
"tuple"
] | def asTuple(self):
""" Returns the stats as a python tuple """
return tuple(self.internalDict.values()) | [
"def",
"asTuple",
"(",
"self",
")",
":",
"return",
"tuple",
"(",
"self",
".",
"internalDict",
".",
"values",
"(",
")",
")"
] | https://github.com/perone/Pyevolve/blob/589b6a9b92ed1fd9ef00987bf4bfe807c4a7b7e0/pyevolve/Statistics.py#L80-L82 | |
loli/medpy | 39131b94f0ab5328ab14a874229320efc2f74d98 | medpy/graphcut/graph.py | python | Graph.get_nodes | (self) | return list(range(1, self.__nodes + 1)) | r"""
Get the nodes.
Returns
-------
nodes : list
All nodes as an ordered list. | r"""
Get the nodes.
Returns
-------
nodes : list
All nodes as an ordered list. | [
"r",
"Get",
"the",
"nodes",
".",
"Returns",
"-------",
"nodes",
":",
"list",
"All",
"nodes",
"as",
"an",
"ordered",
"list",
"."
] | def get_nodes(self):
r"""
Get the nodes.
Returns
-------
nodes : list
All nodes as an ordered list.
"""
return list(range(1, self.__nodes + 1)) | [
"def",
"get_nodes",
"(",
"self",
")",
":",
"return",
"list",
"(",
"range",
"(",
"1",
",",
"self",
".",
"__nodes",
"+",
"1",
")",
")"
] | https://github.com/loli/medpy/blob/39131b94f0ab5328ab14a874229320efc2f74d98/medpy/graphcut/graph.py#L156-L165 | |
guildai/guildai | 1665985a3d4d788efc1a3180ca51cc417f71ca78 | guild/external/pip/_vendor/urllib3/packages/six.py | python | _SixMetaPathImporter.get_code | (self, fullname) | return None | Return None
Required, if is_package is implemented | Return None | [
"Return",
"None"
] | def get_code(self, fullname):
"""Return None
Required, if is_package is implemented"""
self.__get_module(fullname) # eventually raises ImportError
return None | [
"def",
"get_code",
"(",
"self",
",",
"fullname",
")",
":",
"self",
".",
"__get_module",
"(",
"fullname",
")",
"# eventually raises ImportError",
"return",
"None"
] | https://github.com/guildai/guildai/blob/1665985a3d4d788efc1a3180ca51cc417f71ca78/guild/external/pip/_vendor/urllib3/packages/six.py#L218-L223 | |
avrae/avrae | 6ebe46a1ec3d4dfaa2f9b18fac948325f39f87de | cogs5e/models/initiative/combatant.py | python | Combatant.on_remove | (self) | Called when the combatant is removed from combat, either through !i remove or the combat ending. | Called when the combatant is removed from combat, either through !i remove or the combat ending. | [
"Called",
"when",
"the",
"combatant",
"is",
"removed",
"from",
"combat",
"either",
"through",
"!i",
"remove",
"or",
"the",
"combat",
"ending",
"."
] | def on_remove(self):
"""
Called when the combatant is removed from combat, either through !i remove or the combat ending.
"""
pass | [
"def",
"on_remove",
"(",
"self",
")",
":",
"pass"
] | https://github.com/avrae/avrae/blob/6ebe46a1ec3d4dfaa2f9b18fac948325f39f87de/cogs5e/models/initiative/combatant.py#L376-L380 | ||
MrH0wl/Cloudmare | 65e5bc9888f9d362ab2abfb103ea6c1e869d67aa | thirdparty/requests/models.py | python | Response.is_permanent_redirect | (self) | return ('location' in self.headers and self.status_code in (codes.moved_permanently, codes.permanent_redirect)) | True if this Response one of the permanent versions of redirect. | True if this Response one of the permanent versions of redirect. | [
"True",
"if",
"this",
"Response",
"one",
"of",
"the",
"permanent",
"versions",
"of",
"redirect",
"."
] | def is_permanent_redirect(self):
"""True if this Response one of the permanent versions of redirect."""
return ('location' in self.headers and self.status_code in (codes.moved_permanently, codes.permanent_redirect)) | [
"def",
"is_permanent_redirect",
"(",
"self",
")",
":",
"return",
"(",
"'location'",
"in",
"self",
".",
"headers",
"and",
"self",
".",
"status_code",
"in",
"(",
"codes",
".",
"moved_permanently",
",",
"codes",
".",
"permanent_redirect",
")",
")"
] | https://github.com/MrH0wl/Cloudmare/blob/65e5bc9888f9d362ab2abfb103ea6c1e869d67aa/thirdparty/requests/models.py#L716-L718 | |
blackye/webdirdig | 11eb3df84d228127dde1dd4afcb922f5075903a2 | thirdparty_libs/requests/cookies.py | python | MockRequest.origin_req_host | (self) | return self.get_origin_req_host() | [] | def origin_req_host(self):
return self.get_origin_req_host() | [
"def",
"origin_req_host",
"(",
"self",
")",
":",
"return",
"self",
".",
"get_origin_req_host",
"(",
")"
] | https://github.com/blackye/webdirdig/blob/11eb3df84d228127dde1dd4afcb922f5075903a2/thirdparty_libs/requests/cookies.py#L74-L75 | |||
hydroshare/hydroshare | 7ba563b55412f283047fb3ef6da367d41dec58c6 | hs_tracking/management/commands/stats.py | python | Command.monthly_orgs_counts | (self, start_date, end_date) | [] | def monthly_orgs_counts(self, start_date, end_date):
profiles = UserProfile.objects.filter(user__date_joined__lte=end_date)
org_count = profiles.values('organization').distinct().count()
self.print_var("monthly_orgs_counts", org_count, (start_date, end_date)) | [
"def",
"monthly_orgs_counts",
"(",
"self",
",",
"start_date",
",",
"end_date",
")",
":",
"profiles",
"=",
"UserProfile",
".",
"objects",
".",
"filter",
"(",
"user__date_joined__lte",
"=",
"end_date",
")",
"org_count",
"=",
"profiles",
".",
"values",
"(",
"'org... | https://github.com/hydroshare/hydroshare/blob/7ba563b55412f283047fb3ef6da367d41dec58c6/hs_tracking/management/commands/stats.py#L98-L101 | ||||
PaddlePaddle/PaddleX | 2bab73f81ab54e328204e7871e6ae4a82e719f5d | paddlex/ppcls/arch/backbone/legendary_models/hrnet.py | python | HighResolutionModule.__init__ | (self, num_filters, has_se=False) | [] | def __init__(self, num_filters, has_se=False):
super().__init__()
self.basic_block_list = nn.LayerList()
for i in range(len(num_filters)):
self.basic_block_list.append(
nn.Sequential(*[
BasicBlock(
num_channels=num_filters... | [
"def",
"__init__",
"(",
"self",
",",
"num_filters",
",",
"has_se",
"=",
"False",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
")",
"self",
".",
"basic_block_list",
"=",
"nn",
".",
"LayerList",
"(",
")",
"for",
"i",
"in",
"range",
"(",
"len",
... | https://github.com/PaddlePaddle/PaddleX/blob/2bab73f81ab54e328204e7871e6ae4a82e719f5d/paddlex/ppcls/arch/backbone/legendary_models/hrnet.py#L240-L255 | ||||
pybuilder/pybuilder | 12ea2f54e04f97daada375dc3309a3f525f1b5e1 | src/main/python/pybuilder/_vendor/pkg_resources/_vendor/pyparsing.py | python | ParserElement.runTests | (self, tests, parseAll=True, comment='#', fullDump=True, printResults=True, failureTests=False) | return success, allResults | Execute the parse expression on a series of test strings, showing each
test, the parsed results or where the parse failed. Quick and easy way to
run a parse expression against a list of sample strings.
Parameters:
- tests - a list of separate test strings, or a multiline str... | Execute the parse expression on a series of test strings, showing each
test, the parsed results or where the parse failed. Quick and easy way to
run a parse expression against a list of sample strings.
Parameters:
- tests - a list of separate test strings, or a multiline str... | [
"Execute",
"the",
"parse",
"expression",
"on",
"a",
"series",
"of",
"test",
"strings",
"showing",
"each",
"test",
"the",
"parsed",
"results",
"or",
"where",
"the",
"parse",
"failed",
".",
"Quick",
"and",
"easy",
"way",
"to",
"run",
"a",
"parse",
"expressio... | def runTests(self, tests, parseAll=True, comment='#', fullDump=True, printResults=True, failureTests=False):
"""
Execute the parse expression on a series of test strings, showing each
test, the parsed results or where the parse failed. Quick and easy way to
run a parse expression against... | [
"def",
"runTests",
"(",
"self",
",",
"tests",
",",
"parseAll",
"=",
"True",
",",
"comment",
"=",
"'#'",
",",
"fullDump",
"=",
"True",
",",
"printResults",
"=",
"True",
",",
"failureTests",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"tests",
",",
... | https://github.com/pybuilder/pybuilder/blob/12ea2f54e04f97daada375dc3309a3f525f1b5e1/src/main/python/pybuilder/_vendor/pkg_resources/_vendor/pyparsing.py#L2232-L2361 | |
CGATOxford/cgat | 326aad4694bdfae8ddc194171bb5d73911243947 | CGAT/TreeTools.py | python | TreeDFS | (tree, node_id,
pre_function=Nop,
descend_condition=Nop,
post_function=Nop) | BFS tree tree traversal starting at node_id.
Apply functions pre_function at first and
post_function at last visit of a node. | BFS tree tree traversal starting at node_id. | [
"BFS",
"tree",
"tree",
"traversal",
"starting",
"at",
"node_id",
"."
] | def TreeDFS(tree, node_id,
pre_function=Nop,
descend_condition=Nop,
post_function=Nop):
"""BFS tree tree traversal starting at node_id.
Apply functions pre_function at first and
post_function at last visit of a node.
"""
pre_function(node_id)
for n in tree.no... | [
"def",
"TreeDFS",
"(",
"tree",
",",
"node_id",
",",
"pre_function",
"=",
"Nop",
",",
"descend_condition",
"=",
"Nop",
",",
"post_function",
"=",
"Nop",
")",
":",
"pre_function",
"(",
"node_id",
")",
"for",
"n",
"in",
"tree",
".",
"node",
"(",
"node_id",
... | https://github.com/CGATOxford/cgat/blob/326aad4694bdfae8ddc194171bb5d73911243947/CGAT/TreeTools.py#L525-L538 | ||
tomplus/kubernetes_asyncio | f028cc793e3a2c519be6a52a49fb77ff0b014c9b | kubernetes_asyncio/client/models/v1beta1_certificate_signing_request.py | python | V1beta1CertificateSigningRequest.__ne__ | (self, other) | return self.to_dict() != other.to_dict() | Returns true if both objects are not equal | Returns true if both objects are not equal | [
"Returns",
"true",
"if",
"both",
"objects",
"are",
"not",
"equal"
] | def __ne__(self, other):
"""Returns true if both objects are not equal"""
if not isinstance(other, V1beta1CertificateSigningRequest):
return True
return self.to_dict() != other.to_dict() | [
"def",
"__ne__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"V1beta1CertificateSigningRequest",
")",
":",
"return",
"True",
"return",
"self",
".",
"to_dict",
"(",
")",
"!=",
"other",
".",
"to_dict",
"(",
")"
] | https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1beta1_certificate_signing_request.py#L223-L228 | |
phantomcyber/playbooks | 9e850ecc44cb98c5dde53784744213a1ed5799bd | excessive_account_lockouts_enrichment_and_response.py | python | query_endpoint_rights | (action=None, success=None, container=None, results=None, handle=None, filtered_artifacts=None, filtered_results=None, custom_function=None, **kwargs) | return | [] | def query_endpoint_rights(action=None, success=None, container=None, results=None, handle=None, filtered_artifacts=None, filtered_results=None, custom_function=None, **kwargs):
phantom.debug('query_endpoint_rights() called')
# collect data for 'query_endpoint_rights' call
formatted_data_1 = phantom.get_for... | [
"def",
"query_endpoint_rights",
"(",
"action",
"=",
"None",
",",
"success",
"=",
"None",
",",
"container",
"=",
"None",
",",
"results",
"=",
"None",
",",
"handle",
"=",
"None",
",",
"filtered_artifacts",
"=",
"None",
",",
"filtered_results",
"=",
"None",
"... | https://github.com/phantomcyber/playbooks/blob/9e850ecc44cb98c5dde53784744213a1ed5799bd/excessive_account_lockouts_enrichment_and_response.py#L304-L322 | |||
menpo/menpofit | 5f2f45bab26df206d43292fd32d19cd8f62f0443 | menpofit/math/regression.py | python | OptimalLinearRegression.predict | (self, x) | return np.dot(x, self.R) | r"""
Makes a prediction using the trained regression model.
Parameters
----------
x : ``(n_features,)`` `ndarray`
The input feature vector.
Returns
-------
prediction : ``(n_dims,)`` `ndarray`
The prediction vector. | r"""
Makes a prediction using the trained regression model. | [
"r",
"Makes",
"a",
"prediction",
"using",
"the",
"trained",
"regression",
"model",
"."
] | def predict(self, x):
r"""
Makes a prediction using the trained regression model.
Parameters
----------
x : ``(n_features,)`` `ndarray`
The input feature vector.
Returns
-------
prediction : ``(n_dims,)`` `ndarray`
The prediction ... | [
"def",
"predict",
"(",
"self",
",",
"x",
")",
":",
"if",
"self",
".",
"bias",
":",
"if",
"len",
"(",
"x",
".",
"shape",
")",
"==",
"1",
":",
"x",
"=",
"np",
".",
"hstack",
"(",
"(",
"x",
",",
"np",
".",
"ones",
"(",
"1",
")",
")",
")",
... | https://github.com/menpo/menpofit/blob/5f2f45bab26df206d43292fd32d19cd8f62f0443/menpofit/math/regression.py#L348-L367 | |
robotlearn/pyrobolearn | 9cd7c060723fda7d2779fa255ac998c2c82b8436 | pyrobolearn/tools/bridges/mouse_keyboard/bridge_mousekeyboard_wheeled.py | python | BridgeMouseKeyboardWheeledRobot.simulator | (self) | return self._robot.simulator | Return the simulator instance. | Return the simulator instance. | [
"Return",
"the",
"simulator",
"instance",
"."
] | def simulator(self):
"""Return the simulator instance."""
return self._robot.simulator | [
"def",
"simulator",
"(",
"self",
")",
":",
"return",
"self",
".",
"_robot",
".",
"simulator"
] | https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/tools/bridges/mouse_keyboard/bridge_mousekeyboard_wheeled.py#L113-L115 | |
bendmorris/static-python | 2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473 | Lib/tkinter/__init__.py | python | Misc.winfo_reqwidth | (self) | return getint(
self.tk.call('winfo', 'reqwidth', self._w)) | Return requested width of this widget. | Return requested width of this widget. | [
"Return",
"requested",
"width",
"of",
"this",
"widget",
"."
] | def winfo_reqwidth(self):
"""Return requested width of this widget."""
return getint(
self.tk.call('winfo', 'reqwidth', self._w)) | [
"def",
"winfo_reqwidth",
"(",
"self",
")",
":",
"return",
"getint",
"(",
"self",
".",
"tk",
".",
"call",
"(",
"'winfo'",
",",
"'reqwidth'",
",",
"self",
".",
"_w",
")",
")"
] | https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Lib/tkinter/__init__.py#L832-L835 | |
a312863063/seeprettyface-generator-yellow | c75b95b56c40036d00b35f3e140cc4a45598e077 | dnnlib/tflib/optimizer.py | python | Optimizer.apply_updates | (self) | Construct training op to update the registered variables based on their gradients. | Construct training op to update the registered variables based on their gradients. | [
"Construct",
"training",
"op",
"to",
"update",
"the",
"registered",
"variables",
"based",
"on",
"their",
"gradients",
"."
] | def apply_updates(self) -> tf.Operation:
"""Construct training op to update the registered variables based on their gradients."""
tfutil.assert_tf_initialized()
assert not self._updates_applied
self._updates_applied = True
devices = list(self._dev_grads.keys())
total_grad... | [
"def",
"apply_updates",
"(",
"self",
")",
"->",
"tf",
".",
"Operation",
":",
"tfutil",
".",
"assert_tf_initialized",
"(",
")",
"assert",
"not",
"self",
".",
"_updates_applied",
"self",
".",
"_updates_applied",
"=",
"True",
"devices",
"=",
"list",
"(",
"self"... | https://github.com/a312863063/seeprettyface-generator-yellow/blob/c75b95b56c40036d00b35f3e140cc4a45598e077/dnnlib/tflib/optimizer.py#L102-L180 | ||
007gzs/dingtalk-sdk | 7979da2e259fdbc571728cae2425a04dbc65850a | dingtalk/client/api/taobao.py | python | TbALiJianKangZhuiSuMa.alibaba_alihealth_drug_code_common_list_codeinfo | (
self,
ref_ent_id,
search_source,
code_list,
auth_ref_ent_id,
cert_isv_no='',
invocation='',
terminal_type='',
terminal_name='',
bureau_name='',
error_message=''
) | return self._top_request(
"alibaba.alihealth.drug.code.common.list.codeinfo",
{
"ref_ent_id": ref_ent_id,
"search_source": search_source,
"code_list": code_list,
"auth_ref_ent_id": auth_ref_ent_id,
"cert_isv_no": cer... | 通用查询码接口
文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=41299
:param ref_ent_id: 企业refEntId
:param search_source: 标示医院业务
:param code_list: 追溯码
:param auth_ref_ent_id: 验证权限企业id
:param cert_isv_no: 证件编号
:param invocation: 调用方式:formal-正式、test-测试
:param... | 通用查询码接口
文档地址:https://open-doc.dingtalk.com/docs/api.htm?apiId=41299 | [
"通用查询码接口",
"文档地址:https",
":",
"//",
"open",
"-",
"doc",
".",
"dingtalk",
".",
"com",
"/",
"docs",
"/",
"api",
".",
"htm?apiId",
"=",
"41299"
] | def alibaba_alihealth_drug_code_common_list_codeinfo(
self,
ref_ent_id,
search_source,
code_list,
auth_ref_ent_id,
cert_isv_no='',
invocation='',
terminal_type='',
terminal_name='',
bureau_name='',
... | [
"def",
"alibaba_alihealth_drug_code_common_list_codeinfo",
"(",
"self",
",",
"ref_ent_id",
",",
"search_source",
",",
"code_list",
",",
"auth_ref_ent_id",
",",
"cert_isv_no",
"=",
"''",
",",
"invocation",
"=",
"''",
",",
"terminal_type",
"=",
"''",
",",
"terminal_na... | https://github.com/007gzs/dingtalk-sdk/blob/7979da2e259fdbc571728cae2425a04dbc65850a/dingtalk/client/api/taobao.py#L89954-L89996 | |
linuxmint/mintupdate | 476059f9f977cd1d0d7a451c64931a7a9ffd4bbf | usr/lib/linuxmint/mintUpdate/mintUpdate.py | python | MintUpdate.close_preferences | (self, widget, window) | [] | def close_preferences(self, widget, window):
self.window.set_sensitive(True)
self.preferences_window_showing = False
window.destroy()
self.refresh() | [
"def",
"close_preferences",
"(",
"self",
",",
"widget",
",",
"window",
")",
":",
"self",
".",
"window",
".",
"set_sensitive",
"(",
"True",
")",
"self",
".",
"preferences_window_showing",
"=",
"False",
"window",
".",
"destroy",
"(",
")",
"self",
".",
"refre... | https://github.com/linuxmint/mintupdate/blob/476059f9f977cd1d0d7a451c64931a7a9ffd4bbf/usr/lib/linuxmint/mintUpdate/mintUpdate.py#L2466-L2470 | ||||
cea-hpc/clustershell | c421133ed4baa69e35ff76c476d4097201485344 | lib/ClusterShell/RangeSet.py | python | RangeSetND.intersection_update | (self, other) | ``s.intersection_update(t)`` returns nodeset s keeping only
elements also found in t. | ``s.intersection_update(t)`` returns nodeset s keeping only
elements also found in t. | [
"s",
".",
"intersection_update",
"(",
"t",
")",
"returns",
"nodeset",
"s",
"keeping",
"only",
"elements",
"also",
"found",
"in",
"t",
"."
] | def intersection_update(self, other):
"""
``s.intersection_update(t)`` returns nodeset s keeping only
elements also found in t.
"""
if other is self:
return
tmp_rnd = RangeSetND()
empty_rset = RangeSet()
for rgvec in self._veclist:
... | [
"def",
"intersection_update",
"(",
"self",
",",
"other",
")",
":",
"if",
"other",
"is",
"self",
":",
"return",
"tmp_rnd",
"=",
"RangeSetND",
"(",
")",
"empty_rset",
"=",
"RangeSet",
"(",
")",
"for",
"rgvec",
"in",
"self",
".",
"_veclist",
":",
"for",
"... | https://github.com/cea-hpc/clustershell/blob/c421133ed4baa69e35ff76c476d4097201485344/lib/ClusterShell/RangeSet.py#L1358-L1377 | ||
robotlearn/pyrobolearn | 9cd7c060723fda7d2779fa255ac998c2c82b8436 | pyrobolearn/simulators/mujoco.py | python | Mujoco.get_joint_names | (self, body_id, joint_ids) | return names | Return the name of the given joint(s).
Args:
body_id (int): unique body id.
joint_ids (int, list[int]): a joint id, or list of joint ids.
Returns:
if 1 joint:
str: name of the joint
if multiple joints:
str[N]: name of each... | Return the name of the given joint(s). | [
"Return",
"the",
"name",
"of",
"the",
"given",
"joint",
"(",
"s",
")",
"."
] | def get_joint_names(self, body_id, joint_ids):
"""
Return the name of the given joint(s).
Args:
body_id (int): unique body id.
joint_ids (int, list[int]): a joint id, or list of joint ids.
Returns:
if 1 joint:
str: name of the joint
... | [
"def",
"get_joint_names",
"(",
"self",
",",
"body_id",
",",
"joint_ids",
")",
":",
"body",
"=",
"self",
".",
"_bodies",
"[",
"body_id",
"]",
"one_joint",
"=",
"isinstance",
"(",
"joint_ids",
",",
"int",
")",
"if",
"one_joint",
":",
"joint_ids",
"=",
"[",... | https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/simulators/mujoco.py#L2604-L2630 | |
nicola-decao/s-vae-pytorch | 671c46c0772a2c92a602252311864c48c816bc44 | examples/mnist.py | python | ModelVAE.__init__ | (self, h_dim, z_dim, activation=F.relu, distribution='normal') | ModelVAE initializer
:param h_dim: dimension of the hidden layers
:param z_dim: dimension of the latent representation
:param activation: callable activation function
:param distribution: string either `normal` or `vmf`, indicates which distribution to use | ModelVAE initializer
:param h_dim: dimension of the hidden layers
:param z_dim: dimension of the latent representation
:param activation: callable activation function
:param distribution: string either `normal` or `vmf`, indicates which distribution to use | [
"ModelVAE",
"initializer",
":",
"param",
"h_dim",
":",
"dimension",
"of",
"the",
"hidden",
"layers",
":",
"param",
"z_dim",
":",
"dimension",
"of",
"the",
"latent",
"representation",
":",
"param",
"activation",
":",
"callable",
"activation",
"function",
":",
"... | def __init__(self, h_dim, z_dim, activation=F.relu, distribution='normal'):
"""
ModelVAE initializer
:param h_dim: dimension of the hidden layers
:param z_dim: dimension of the latent representation
:param activation: callable activation function
:param distribution: stri... | [
"def",
"__init__",
"(",
"self",
",",
"h_dim",
",",
"z_dim",
",",
"activation",
"=",
"F",
".",
"relu",
",",
"distribution",
"=",
"'normal'",
")",
":",
"super",
"(",
"ModelVAE",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"z_dim",
",",
... | https://github.com/nicola-decao/s-vae-pytorch/blob/671c46c0772a2c92a602252311864c48c816bc44/examples/mnist.py#L23-L53 | ||
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/scatter3d/_marker.py | python | Marker.sizemin | (self) | return self["sizemin"] | Has an effect only if `marker.size` is set to a numerical
array. Sets the minimum size (in px) of the rendered marker
points.
The 'sizemin' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float | Has an effect only if `marker.size` is set to a numerical
array. Sets the minimum size (in px) of the rendered marker
points.
The 'sizemin' property is a number and may be specified as:
- An int or float in the interval [0, inf] | [
"Has",
"an",
"effect",
"only",
"if",
"marker",
".",
"size",
"is",
"set",
"to",
"a",
"numerical",
"array",
".",
"Sets",
"the",
"minimum",
"size",
"(",
"in",
"px",
")",
"of",
"the",
"rendered",
"marker",
"points",
".",
"The",
"sizemin",
"property",
"is",... | def sizemin(self):
"""
Has an effect only if `marker.size` is set to a numerical
array. Sets the minimum size (in px) of the rendered marker
points.
The 'sizemin' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Retu... | [
"def",
"sizemin",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"sizemin\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/scatter3d/_marker.py#L784-L797 | |
basho/riak-python-client | 91de13a16607cdf553d1a194e762734e3bec4231 | riak/content.py | python | RiakContent.add_link | (self, obj, tag=None) | return self._robject | add_link(obj, tag=None)
Add a link to a RiakObject.
:param obj: Either a RiakObject or 3 item link tuple consisting
of (bucket, key, tag).
:type obj: mixed
:param tag: Optional link tag. Defaults to bucket name. It is ignored
if ``obj`` is a 3 item link tuple.
... | add_link(obj, tag=None) | [
"add_link",
"(",
"obj",
"tag",
"=",
"None",
")"
] | def add_link(self, obj, tag=None):
"""
add_link(obj, tag=None)
Add a link to a RiakObject.
:param obj: Either a RiakObject or 3 item link tuple consisting
of (bucket, key, tag).
:type obj: mixed
:param tag: Optional link tag. Defaults to bucket name. It is i... | [
"def",
"add_link",
"(",
"self",
",",
"obj",
",",
"tag",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"tuple",
")",
":",
"newlink",
"=",
"obj",
"else",
":",
"newlink",
"=",
"(",
"obj",
".",
"bucket",
".",
"name",
",",
"obj",
".",
... | https://github.com/basho/riak-python-client/blob/91de13a16607cdf553d1a194e762734e3bec4231/riak/content.py#L166-L186 | |
yukitsuji/3D_CNN_tensorflow | 5104ecf3f75a4e51a2170b72244e3f2a8993ce25 | input_velodyne.py | python | filter_camera_angle | (places) | return places[bool_in] | Filter camera angles for KiTTI Datasets | Filter camera angles for KiTTI Datasets | [
"Filter",
"camera",
"angles",
"for",
"KiTTI",
"Datasets"
] | def filter_camera_angle(places):
"""Filter camera angles for KiTTI Datasets"""
bool_in = np.logical_and((places[:, 1] < places[:, 0] - 0.27), (-places[:, 1] < places[:, 0] - 0.27))
# bool_in = np.logical_and((places[:, 1] < places[:, 0]), (-places[:, 1] < places[:, 0]))
return places[bool_in] | [
"def",
"filter_camera_angle",
"(",
"places",
")",
":",
"bool_in",
"=",
"np",
".",
"logical_and",
"(",
"(",
"places",
"[",
":",
",",
"1",
"]",
"<",
"places",
"[",
":",
",",
"0",
"]",
"-",
"0.27",
")",
",",
"(",
"-",
"places",
"[",
":",
",",
"1",... | https://github.com/yukitsuji/3D_CNN_tensorflow/blob/5104ecf3f75a4e51a2170b72244e3f2a8993ce25/input_velodyne.py#L97-L101 | |
hyperledger/fabric-sdk-py | 8ee33a8981887e37950dc0f36a7ec63b3a5ba5c3 | hfc/fabric/channel/channel.py | python | Channel._build_channel_header | (type, tx_id, channel_id,
timestamp, epoch=0, extension=None) | return channel_header | Build channel.
:param extension: extension (Default value = None)
:param timestamp: timestamp
:param channel_id: channel id
:param tx_id: transaction id
:param type: type
:param epoch: epoch
:return: common_proto.Header instance (Default value = 0) | Build channel. | [
"Build",
"channel",
"."
] | def _build_channel_header(type, tx_id, channel_id,
timestamp, epoch=0, extension=None):
"""Build channel.
:param extension: extension (Default value = None)
:param timestamp: timestamp
:param channel_id: channel id
:param tx_id: transaction id
... | [
"def",
"_build_channel_header",
"(",
"type",
",",
"tx_id",
",",
"channel_id",
",",
"timestamp",
",",
"epoch",
"=",
"0",
",",
"extension",
"=",
"None",
")",
":",
"channel_header",
"=",
"common_pb2",
".",
"ChannelHeader",
"(",
")",
"channel_header",
".",
"type... | https://github.com/hyperledger/fabric-sdk-py/blob/8ee33a8981887e37950dc0f36a7ec63b3a5ba5c3/hfc/fabric/channel/channel.py#L245-L267 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.