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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
inspurer/WorkAttendanceSystem | 1221e2d67bdf5bb15fe99517cc3ded58ccb066df | V2.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/_vendor/cachecontrol/controller.py | python | parse_uri | (uri) | return (groups[1], groups[3], groups[4], groups[6], groups[8]) | Parses a URI using the regex given in Appendix B of RFC 3986.
(scheme, authority, path, query, fragment) = parse_uri(uri) | Parses a URI using the regex given in Appendix B of RFC 3986. | [
"Parses",
"a",
"URI",
"using",
"the",
"regex",
"given",
"in",
"Appendix",
"B",
"of",
"RFC",
"3986",
"."
] | def parse_uri(uri):
"""Parses a URI using the regex given in Appendix B of RFC 3986.
(scheme, authority, path, query, fragment) = parse_uri(uri)
"""
groups = URI.match(uri).groups()
return (groups[1], groups[3], groups[4], groups[6], groups[8]) | [
"def",
"parse_uri",
"(",
"uri",
")",
":",
"groups",
"=",
"URI",
".",
"match",
"(",
"uri",
")",
".",
"groups",
"(",
")",
"return",
"(",
"groups",
"[",
"1",
"]",
",",
"groups",
"[",
"3",
"]",
",",
"groups",
"[",
"4",
"]",
",",
"groups",
"[",
"6... | https://github.com/inspurer/WorkAttendanceSystem/blob/1221e2d67bdf5bb15fe99517cc3ded58ccb066df/V2.0/venv/Lib/site-packages/pip-9.0.1-py3.5.egg/pip/_vendor/cachecontrol/controller.py#L21-L27 | |
naftaliharris/tauthon | 5587ceec329b75f7caf6d65a036db61ac1bae214 | Lib/lib-tk/Tkinter.py | python | Misc.after_idle | (self, func, *args) | return self.after('idle', func, *args) | Call FUNC once if the Tcl main loop has no event to
process.
Return an identifier to cancel the scheduling with
after_cancel. | Call FUNC once if the Tcl main loop has no event to
process. | [
"Call",
"FUNC",
"once",
"if",
"the",
"Tcl",
"main",
"loop",
"has",
"no",
"event",
"to",
"process",
"."
] | def after_idle(self, func, *args):
"""Call FUNC once if the Tcl main loop has no event to
process.
Return an identifier to cancel the scheduling with
after_cancel."""
return self.after('idle', func, *args) | [
"def",
"after_idle",
"(",
"self",
",",
"func",
",",
"*",
"args",
")",
":",
"return",
"self",
".",
"after",
"(",
"'idle'",
",",
"func",
",",
"*",
"args",
")"
] | https://github.com/naftaliharris/tauthon/blob/5587ceec329b75f7caf6d65a036db61ac1bae214/Lib/lib-tk/Tkinter.py#L605-L611 | |
sethmlarson/virtualbox-python | 984a6e2cb0e8996f4df40f4444c1528849f1c70d | virtualbox/library.py | python | IUSBDeviceFilters.device_filters | (self) | return [IUSBDeviceFilter(a) for a in ret] | Get IUSBDeviceFilter value for 'deviceFilters'
List of USB device filters associated with the machine.
If the machine is currently running, these filters are activated
every time a new (supported) USB device is attached to the host
computer that was not ignored by global filters
... | Get IUSBDeviceFilter value for 'deviceFilters'
List of USB device filters associated with the machine. | [
"Get",
"IUSBDeviceFilter",
"value",
"for",
"deviceFilters",
"List",
"of",
"USB",
"device",
"filters",
"associated",
"with",
"the",
"machine",
"."
] | def device_filters(self):
"""Get IUSBDeviceFilter value for 'deviceFilters'
List of USB device filters associated with the machine.
If the machine is currently running, these filters are activated
every time a new (supported) USB device is attached to the host
computer that was ... | [
"def",
"device_filters",
"(",
"self",
")",
":",
"ret",
"=",
"self",
".",
"_get_attr",
"(",
"\"deviceFilters\"",
")",
"return",
"[",
"IUSBDeviceFilter",
"(",
"a",
")",
"for",
"a",
"in",
"ret",
"]"
] | https://github.com/sethmlarson/virtualbox-python/blob/984a6e2cb0e8996f4df40f4444c1528849f1c70d/virtualbox/library.py#L30644-L30668 | |
googlearchive/pywebsocket | c459a5f9a04714e596726e876fcb46951c61a5f7 | mod_pywebsocket/handshake/hybi00.py | python | Handshaker.__init__ | (self, request, dispatcher) | Construct an instance.
Args:
request: mod_python request.
dispatcher: Dispatcher (dispatch.Dispatcher).
Handshaker will add attributes such as ws_resource in performing
handshake. | Construct an instance. | [
"Construct",
"an",
"instance",
"."
] | def __init__(self, request, dispatcher):
"""Construct an instance.
Args:
request: mod_python request.
dispatcher: Dispatcher (dispatch.Dispatcher).
Handshaker will add attributes such as ws_resource in performing
handshake.
"""
self._logger = ut... | [
"def",
"__init__",
"(",
"self",
",",
"request",
",",
"dispatcher",
")",
":",
"self",
".",
"_logger",
"=",
"util",
".",
"get_class_logger",
"(",
"self",
")",
"self",
".",
"_request",
"=",
"request",
"self",
".",
"_dispatcher",
"=",
"dispatcher"
] | https://github.com/googlearchive/pywebsocket/blob/c459a5f9a04714e596726e876fcb46951c61a5f7/mod_pywebsocket/handshake/hybi00.py#L123-L137 | ||
ClusterLabs/pcs | 1f225199e02c8d20456bb386f4c913c3ff21ac78 | pcs/cluster.py | python | wait_for_local_node_started | (stop_at, interval) | Commandline options: no options | Commandline options: no options | [
"Commandline",
"options",
":",
"no",
"options"
] | def wait_for_local_node_started(stop_at, interval):
"""
Commandline options: no options
"""
try:
while True:
time.sleep(interval)
node_status = lib_pacemaker.get_local_node_status(
utils.cmd_runner()
)
if is_node_fully_started(node_... | [
"def",
"wait_for_local_node_started",
"(",
"stop_at",
",",
"interval",
")",
":",
"try",
":",
"while",
"True",
":",
"time",
".",
"sleep",
"(",
"interval",
")",
"node_status",
"=",
"lib_pacemaker",
".",
"get_local_node_status",
"(",
"utils",
".",
"cmd_runner",
"... | https://github.com/ClusterLabs/pcs/blob/1f225199e02c8d20456bb386f4c913c3ff21ac78/pcs/cluster.py#L337-L363 | ||
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/voice/v1/archived_call.py | python | ArchivedCallInstance.__init__ | (self, version, payload, date=None, sid=None) | Initialize the ArchivedCallInstance
:returns: twilio.rest.voice.v1.archived_call.ArchivedCallInstance
:rtype: twilio.rest.voice.v1.archived_call.ArchivedCallInstance | Initialize the ArchivedCallInstance | [
"Initialize",
"the",
"ArchivedCallInstance"
] | def __init__(self, version, payload, date=None, sid=None):
"""
Initialize the ArchivedCallInstance
:returns: twilio.rest.voice.v1.archived_call.ArchivedCallInstance
:rtype: twilio.rest.voice.v1.archived_call.ArchivedCallInstance
"""
super(ArchivedCallInstance, self).__in... | [
"def",
"__init__",
"(",
"self",
",",
"version",
",",
"payload",
",",
"date",
"=",
"None",
",",
"sid",
"=",
"None",
")",
":",
"super",
"(",
"ArchivedCallInstance",
",",
"self",
")",
".",
"__init__",
"(",
"version",
")",
"# Marshaled Properties",
"self",
"... | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/voice/v1/archived_call.py#L153-L171 | ||
los-cocos/cocos | 3b47281f95d6ee52bb2a357a767f213e670bd601 | samples/handling_events.py | python | MouseDisplay.on_mouse_motion | (self, x, y, dx, dy) | Called when the mouse moves over the app window with no button pressed
(x, y) are the physical coordinates of the mouse
(dx, dy) is the distance vector covered by the mouse pointer since the
last call. | Called when the mouse moves over the app window with no button pressed
(x, y) are the physical coordinates of the mouse
(dx, dy) is the distance vector covered by the mouse pointer since the
last call. | [
"Called",
"when",
"the",
"mouse",
"moves",
"over",
"the",
"app",
"window",
"with",
"no",
"button",
"pressed",
"(",
"x",
"y",
")",
"are",
"the",
"physical",
"coordinates",
"of",
"the",
"mouse",
"(",
"dx",
"dy",
")",
"is",
"the",
"distance",
"vector",
"c... | def on_mouse_motion(self, x, y, dx, dy):
"""Called when the mouse moves over the app window with no button pressed
(x, y) are the physical coordinates of the mouse
(dx, dy) is the distance vector covered by the mouse pointer since the
last call.
"""
self.update... | [
"def",
"on_mouse_motion",
"(",
"self",
",",
"x",
",",
"y",
",",
"dx",
",",
"dy",
")",
":",
"self",
".",
"update_text",
"(",
"x",
",",
"y",
")"
] | https://github.com/los-cocos/cocos/blob/3b47281f95d6ee52bb2a357a767f213e670bd601/samples/handling_events.py#L91-L98 | ||
openseg-group/openseg.pytorch | 2cdb3de5dcbc96f531b68e5bf1233c860f247b3e | lib/utils/helpers/image_helper.py | python | ImageHelper.imfrombytes | (content, flag='color') | return img | Read an image from bytes.
Args:
content (bytes): Image bytes got from files or other streams.
flag (str): Same as :func:`imread`.
Returns:
ndarray: Loaded image array. | Read an image from bytes. | [
"Read",
"an",
"image",
"from",
"bytes",
"."
] | def imfrombytes(content, flag='color'):
"""Read an image from bytes.
Args:
content (bytes): Image bytes got from files or other streams.
flag (str): Same as :func:`imread`.
Returns:
ndarray: Loaded image array.
"""
imread_flags = {
... | [
"def",
"imfrombytes",
"(",
"content",
",",
"flag",
"=",
"'color'",
")",
":",
"imread_flags",
"=",
"{",
"'color'",
":",
"cv2",
".",
"IMREAD_COLOR",
",",
"'grayscale'",
":",
"cv2",
".",
"IMREAD_GRAYSCALE",
",",
"'unchanged'",
":",
"cv2",
".",
"IMREAD_UNCHANGED... | https://github.com/openseg-group/openseg.pytorch/blob/2cdb3de5dcbc96f531b68e5bf1233c860f247b3e/lib/utils/helpers/image_helper.py#L281-L299 | |
ctxis/canape | 5f0e03424577296bcc60c2008a60a98ec5307e4b | CANAPE.Scripting/Lib/mailbox.py | python | MHMessage.set_sequences | (self, sequences) | Set the list of sequences that include the message. | Set the list of sequences that include the message. | [
"Set",
"the",
"list",
"of",
"sequences",
"that",
"include",
"the",
"message",
"."
] | def set_sequences(self, sequences):
"""Set the list of sequences that include the message."""
self._sequences = list(sequences) | [
"def",
"set_sequences",
"(",
"self",
",",
"sequences",
")",
":",
"self",
".",
"_sequences",
"=",
"list",
"(",
"sequences",
")"
] | https://github.com/ctxis/canape/blob/5f0e03424577296bcc60c2008a60a98ec5307e4b/CANAPE.Scripting/Lib/mailbox.py#L1655-L1657 | ||
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib/imaplib.py | python | IMAP4.xatom | (self, name, *args) | return self._simple_command(name, *args) | Allow simple extension commands
notified by server in CAPABILITY response.
Assumes command is legal in current state.
(typ, [data]) = <instance>.xatom(name, arg, ...)
Returns response appropriate to extension command `name'. | Allow simple extension commands
notified by server in CAPABILITY response. | [
"Allow",
"simple",
"extension",
"commands",
"notified",
"by",
"server",
"in",
"CAPABILITY",
"response",
"."
] | def xatom(self, name, *args):
"""Allow simple extension commands
notified by server in CAPABILITY response.
Assumes command is legal in current state.
(typ, [data]) = <instance>.xatom(name, arg, ...)
Returns response appropriate to extension command `name'.
"""... | [
"def",
"xatom",
"(",
"self",
",",
"name",
",",
"*",
"args",
")",
":",
"name",
"=",
"name",
".",
"upper",
"(",
")",
"#if not name in self.capabilities: # Let the server decide!",
"# raise self.error('unknown extension command: %s' % name)",
"if",
"not",
"name",
"... | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/imaplib.py#L777-L792 | |
Azure/azure-devops-cli-extension | 11334cd55806bef0b99c3bee5a438eed71e44037 | azure-devops/azext_devops/devops_sdk/v6_0/git/git_client_base.py | python | GitClientBase.delete_pull_request_labels | (self, repository_id, pull_request_id, label_id_or_name, project=None, project_id=None) | DeletePullRequestLabels.
[Preview API] Removes a label from the set of those assigned to the pull request.
:param str repository_id: The repository ID of the pull request’s target branch.
:param int pull_request_id: ID of the pull request.
:param str label_id_or_name: The name or ID of t... | DeletePullRequestLabels.
[Preview API] Removes a label from the set of those assigned to the pull request.
:param str repository_id: The repository ID of the pull request’s target branch.
:param int pull_request_id: ID of the pull request.
:param str label_id_or_name: The name or ID of t... | [
"DeletePullRequestLabels",
".",
"[",
"Preview",
"API",
"]",
"Removes",
"a",
"label",
"from",
"the",
"set",
"of",
"those",
"assigned",
"to",
"the",
"pull",
"request",
".",
":",
"param",
"str",
"repository_id",
":",
"The",
"repository",
"ID",
"of",
"the",
"p... | def delete_pull_request_labels(self, repository_id, pull_request_id, label_id_or_name, project=None, project_id=None):
"""DeletePullRequestLabels.
[Preview API] Removes a label from the set of those assigned to the pull request.
:param str repository_id: The repository ID of the pull request’s t... | [
"def",
"delete_pull_request_labels",
"(",
"self",
",",
"repository_id",
",",
"pull_request_id",
",",
"label_id_or_name",
",",
"project",
"=",
"None",
",",
"project_id",
"=",
"None",
")",
":",
"route_values",
"=",
"{",
"}",
"if",
"project",
"is",
"not",
"None",... | https://github.com/Azure/azure-devops-cli-extension/blob/11334cd55806bef0b99c3bee5a438eed71e44037/azure-devops/azext_devops/devops_sdk/v6_0/git/git_client_base.py#L1714-L1739 | ||
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/_osx_support.py | python | customize_compiler | (_config_vars) | return _config_vars | Customize compiler path and configuration variables.
This customization is performed when the first
extension module build is requested
in distutils.sysconfig.customize_compiler). | Customize compiler path and configuration variables. | [
"Customize",
"compiler",
"path",
"and",
"configuration",
"variables",
"."
] | def customize_compiler(_config_vars):
"""Customize compiler path and configuration variables.
This customization is performed when the first
extension module build is requested
in distutils.sysconfig.customize_compiler).
"""
# Find a compiler to use for extension module builds
_find_approp... | [
"def",
"customize_compiler",
"(",
"_config_vars",
")",
":",
"# Find a compiler to use for extension module builds",
"_find_appropriate_compiler",
"(",
"_config_vars",
")",
"# Remove ppc arch flags if not supported here",
"_remove_unsupported_archs",
"(",
"_config_vars",
")",
"# Allow... | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/_osx_support.py#L409-L426 | |
odoo/odoo-extra | 6076bb3f7eef957269147ff952fccc991cde187d | base_report_designer/plugin/openerp_report_designer/bin/script/lib/gui.py | python | DBModalDialog.enableCheckBoxTriState | ( self, cCtrlName, bTriStateEnable ) | Enable or disable the tri state mode of the control. | Enable or disable the tri state mode of the control. | [
"Enable",
"or",
"disable",
"the",
"tri",
"state",
"mode",
"of",
"the",
"control",
"."
] | def enableCheckBoxTriState( self, cCtrlName, bTriStateEnable ):
"""Enable or disable the tri state mode of the control."""
oControl = self.getControl( cCtrlName )
oControl.enableTriState( bTriStateEnable ) | [
"def",
"enableCheckBoxTriState",
"(",
"self",
",",
"cCtrlName",
",",
"bTriStateEnable",
")",
":",
"oControl",
"=",
"self",
".",
"getControl",
"(",
"cCtrlName",
")",
"oControl",
".",
"enableTriState",
"(",
"bTriStateEnable",
")"
] | https://github.com/odoo/odoo-extra/blob/6076bb3f7eef957269147ff952fccc991cde187d/base_report_designer/plugin/openerp_report_designer/bin/script/lib/gui.py#L412-L415 | ||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_vendored_deps/library/oc_volume.py | python | DeploymentConfig.get_env_vars | (self) | return self.get(DeploymentConfig.env_path) or [] | return a environment variables | return a environment variables | [
"return",
"a",
"environment",
"variables"
] | def get_env_vars(self):
'''return a environment variables '''
return self.get(DeploymentConfig.env_path) or [] | [
"def",
"get_env_vars",
"(",
"self",
")",
":",
"return",
"self",
".",
"get",
"(",
"DeploymentConfig",
".",
"env_path",
")",
"or",
"[",
"]"
] | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.10.0-0.29.0/roles/lib_vendored_deps/library/oc_volume.py#L1626-L1628 | |
nanoporetech/medaka | 2b83074fe3b6a6ec971614bfc6804f543fe1e5f0 | medaka/datastore.py | python | DataStore.__init__ | (self, filename, mode='r') | Initialize a datastore.
:param filename: file to open.
:param mode: file opening mode ('r', 'w', 'a'). | Initialize a datastore. | [
"Initialize",
"a",
"datastore",
"."
] | def __init__(self, filename, mode='r'):
"""Initialize a datastore.
:param filename: file to open.
:param mode: file opening mode ('r', 'w', 'a').
"""
self.filename = filename
self.mode = mode
self.logger = medaka.common.get_named_logger('DataStre')
self... | [
"def",
"__init__",
"(",
"self",
",",
"filename",
",",
"mode",
"=",
"'r'",
")",
":",
"self",
".",
"filename",
"=",
"filename",
"self",
".",
"mode",
"=",
"mode",
"self",
".",
"logger",
"=",
"medaka",
".",
"common",
".",
"get_named_logger",
"(",
"'DataStr... | https://github.com/nanoporetech/medaka/blob/2b83074fe3b6a6ec971614bfc6804f543fe1e5f0/medaka/datastore.py#L193-L208 | ||
pypa/pipenv | b21baade71a86ab3ee1429f71fbc14d4f95fb75d | pipenv/patched/notpip/_internal/index/sources.py | python | _FlatDirectorySource.link | (self) | return None | [] | def link(self) -> Optional[Link]:
return None | [
"def",
"link",
"(",
"self",
")",
"->",
"Optional",
"[",
"Link",
"]",
":",
"return",
"None"
] | https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/patched/notpip/_internal/index/sources.py#L57-L58 | |||
Trilarion/opensourcegames | 6cde84b7a1fc893338174a66c142ff423f87e9ea | code/utils/osg_parse.py | python | ListingTransformer.quoted_value | (self, x) | return str(x[0])[1:-1].strip() | :param x:
:return: | [] | def quoted_value(self, x):
"""
:param x:
:return:
"""
return str(x[0])[1:-1].strip() | [
"def",
"quoted_value",
"(",
"self",
",",
"x",
")",
":",
"return",
"str",
"(",
"x",
"[",
"0",
"]",
")",
"[",
"1",
":",
"-",
"1",
"]",
".",
"strip",
"(",
")"
] | https://github.com/Trilarion/opensourcegames/blob/6cde84b7a1fc893338174a66c142ff423f87e9ea/code/utils/osg_parse.py#L24-L30 | ||
mbusb/multibootusb | fa89b28f27891a9ce8d6e2a5737baa2e6ee83dfd | scripts/gen.py | python | read_input_yes | () | List option and read user input
:return: True if user selected yes or else false | List option and read user input
:return: True if user selected yes or else false | [
"List",
"option",
"and",
"read",
"user",
"input",
":",
"return",
":",
"True",
"if",
"user",
"selected",
"yes",
"or",
"else",
"false"
] | def read_input_yes():
"""
List option and read user input
:return: True if user selected yes or else false
"""
yes_list = ['Y', 'y', 'Yes', 'yes', 'YES']
no_list = ['N', 'n', 'No', 'no', 'NO']
response = input("Please enter the option listed above : ")
if response in yes_list:
re... | [
"def",
"read_input_yes",
"(",
")",
":",
"yes_list",
"=",
"[",
"'Y'",
",",
"'y'",
",",
"'Yes'",
",",
"'yes'",
",",
"'YES'",
"]",
"no_list",
"=",
"[",
"'N'",
",",
"'n'",
",",
"'No'",
",",
"'no'",
",",
"'NO'",
"]",
"response",
"=",
"input",
"(",
"\"... | https://github.com/mbusb/multibootusb/blob/fa89b28f27891a9ce8d6e2a5737baa2e6ee83dfd/scripts/gen.py#L188-L199 | ||
gramps-project/gramps | 04d4651a43eb210192f40a9f8c2bad8ee8fa3753 | gramps/gui/editors/objectentries.py | python | NoteEntry.get_from_handle | (self, handle) | return self.db.get_note_from_handle(handle) | return the object given the hande | return the object given the hande | [
"return",
"the",
"object",
"given",
"the",
"hande"
] | def get_from_handle(self, handle):
""" return the object given the hande
"""
return self.db.get_note_from_handle(handle) | [
"def",
"get_from_handle",
"(",
"self",
",",
"handle",
")",
":",
"return",
"self",
".",
"db",
".",
"get_note_from_handle",
"(",
"handle",
")"
] | https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/gui/editors/objectentries.py#L460-L463 | |
JulianEberius/SublimePythonIDE | d70e40abc0c9f347af3204c7b910e0d6bfd6e459 | server/lib/python_all/jedi/evaluate/representation.py | python | Instance._get_func_self_name | (self, func) | Returns the name of the first param in a class method (which is
normally self. | Returns the name of the first param in a class method (which is
normally self. | [
"Returns",
"the",
"name",
"of",
"the",
"first",
"param",
"in",
"a",
"class",
"method",
"(",
"which",
"is",
"normally",
"self",
"."
] | def _get_func_self_name(self, func):
"""
Returns the name of the first param in a class method (which is
normally self.
"""
try:
return str(func.params[0].name)
except IndexError:
return None | [
"def",
"_get_func_self_name",
"(",
"self",
",",
"func",
")",
":",
"try",
":",
"return",
"str",
"(",
"func",
".",
"params",
"[",
"0",
"]",
".",
"name",
")",
"except",
"IndexError",
":",
"return",
"None"
] | https://github.com/JulianEberius/SublimePythonIDE/blob/d70e40abc0c9f347af3204c7b910e0d6bfd6e459/server/lib/python_all/jedi/evaluate/representation.py#L124-L132 | ||
awslabs/aws-ec2rescue-linux | 8ecf40e7ea0d2563dac057235803fca2221029d2 | lib/requests/cookies.py | python | RequestsCookieJar.itervalues | (self) | Dict-like itervalues() that returns an iterator of values of cookies
from the jar.
.. seealso:: iterkeys() and iteritems(). | Dict-like itervalues() that returns an iterator of values of cookies
from the jar. | [
"Dict",
"-",
"like",
"itervalues",
"()",
"that",
"returns",
"an",
"iterator",
"of",
"values",
"of",
"cookies",
"from",
"the",
"jar",
"."
] | def itervalues(self):
"""Dict-like itervalues() that returns an iterator of values of cookies
from the jar.
.. seealso:: iterkeys() and iteritems().
"""
for cookie in iter(self):
yield cookie.value | [
"def",
"itervalues",
"(",
"self",
")",
":",
"for",
"cookie",
"in",
"iter",
"(",
"self",
")",
":",
"yield",
"cookie",
".",
"value"
] | https://github.com/awslabs/aws-ec2rescue-linux/blob/8ecf40e7ea0d2563dac057235803fca2221029d2/lib/requests/cookies.py#L236-L243 | ||
baidu/Dialogue | 2415430e1f3997806d059455a6e5b16a2d565d06 | DAM/utils/layers.py | python | RNN_last_state | (x, lengths, hidden_size) | return outputs, last_states | encode x with a gru cell and return the last state.
Args:
x: a tensor with shape [batch, time, dimension]
length: a tensor with shape [batch]
Return:
a tensor with shape [batch, hidden_size]
Raises: | encode x with a gru cell and return the last state.
Args:
x: a tensor with shape [batch, time, dimension]
length: a tensor with shape [batch] | [
"encode",
"x",
"with",
"a",
"gru",
"cell",
"and",
"return",
"the",
"last",
"state",
".",
"Args",
":",
"x",
":",
"a",
"tensor",
"with",
"shape",
"[",
"batch",
"time",
"dimension",
"]",
"length",
":",
"a",
"tensor",
"with",
"shape",
"[",
"batch",
"]"
] | def RNN_last_state(x, lengths, hidden_size):
'''encode x with a gru cell and return the last state.
Args:
x: a tensor with shape [batch, time, dimension]
length: a tensor with shape [batch]
Return:
a tensor with shape [batch, hidden_size]
Raises:
'''
cell = tf.nn.r... | [
"def",
"RNN_last_state",
"(",
"x",
",",
"lengths",
",",
"hidden_size",
")",
":",
"cell",
"=",
"tf",
".",
"nn",
".",
"rnn_cell",
".",
"GRUCell",
"(",
"hidden_size",
")",
"outputs",
",",
"last_states",
"=",
"tf",
".",
"nn",
".",
"dynamic_rnn",
"(",
"cell... | https://github.com/baidu/Dialogue/blob/2415430e1f3997806d059455a6e5b16a2d565d06/DAM/utils/layers.py#L480-L494 | |
JiYou/openstack | 8607dd488bde0905044b303eb6e52bdea6806923 | chap19/monitor/monitor/build/lib.linux-x86_64-2.7/monitor/api/contrib/quotas.py | python | QuotaSetsController._format_quota_set | (self, project_id, quota_set) | return dict(quota_set=result) | Convert the quota object to a result dict | Convert the quota object to a result dict | [
"Convert",
"the",
"quota",
"object",
"to",
"a",
"result",
"dict"
] | def _format_quota_set(self, project_id, quota_set):
"""Convert the quota object to a result dict"""
result = dict(id=str(project_id))
for resource in QUOTAS.resources:
result[resource] = quota_set[resource]
return dict(quota_set=result) | [
"def",
"_format_quota_set",
"(",
"self",
",",
"project_id",
",",
"quota_set",
")",
":",
"result",
"=",
"dict",
"(",
"id",
"=",
"str",
"(",
"project_id",
")",
")",
"for",
"resource",
"in",
"QUOTAS",
".",
"resources",
":",
"result",
"[",
"resource",
"]",
... | https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/chap19/monitor/monitor/build/lib.linux-x86_64-2.7/monitor/api/contrib/quotas.py#L50-L58 | |
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/pty.py | python | master_open | () | return _open_terminal() | master_open() -> (master_fd, slave_name)
Open a pty master and return the fd, and the filename of the slave end.
Deprecated, use openpty() instead. | master_open() -> (master_fd, slave_name)
Open a pty master and return the fd, and the filename of the slave end.
Deprecated, use openpty() instead. | [
"master_open",
"()",
"-",
">",
"(",
"master_fd",
"slave_name",
")",
"Open",
"a",
"pty",
"master",
"and",
"return",
"the",
"fd",
"and",
"the",
"filename",
"of",
"the",
"slave",
"end",
".",
"Deprecated",
"use",
"openpty",
"()",
"instead",
"."
] | def master_open():
"""master_open() -> (master_fd, slave_name)
Open a pty master and return the fd, and the filename of the slave end.
Deprecated, use openpty() instead."""
try:
master_fd, slave_fd = os.openpty()
except (AttributeError, OSError):
pass
else:
slave_name = ... | [
"def",
"master_open",
"(",
")",
":",
"try",
":",
"master_fd",
",",
"slave_fd",
"=",
"os",
".",
"openpty",
"(",
")",
"except",
"(",
"AttributeError",
",",
"OSError",
")",
":",
"pass",
"else",
":",
"slave_name",
"=",
"os",
".",
"ttyname",
"(",
"slave_fd"... | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/pty.py#L34-L48 | |
HymanLiuTS/flaskTs | 286648286976e85d9b9a5873632331efcafe0b21 | flasky/lib/python2.7/site-packages/flask/wrappers.py | python | Request.module | (self) | The name of the current module if the request was dispatched
to an actual module. This is deprecated functionality, use blueprints
instead. | The name of the current module if the request was dispatched
to an actual module. This is deprecated functionality, use blueprints
instead. | [
"The",
"name",
"of",
"the",
"current",
"module",
"if",
"the",
"request",
"was",
"dispatched",
"to",
"an",
"actual",
"module",
".",
"This",
"is",
"deprecated",
"functionality",
"use",
"blueprints",
"instead",
"."
] | def module(self):
"""The name of the current module if the request was dispatched
to an actual module. This is deprecated functionality, use blueprints
instead.
"""
from warnings import warn
warn(DeprecationWarning('modules were deprecated in favor of '
... | [
"def",
"module",
"(",
"self",
")",
":",
"from",
"warnings",
"import",
"warn",
"warn",
"(",
"DeprecationWarning",
"(",
"'modules were deprecated in favor of '",
"'blueprints. Use request.blueprint '",
"'instead.'",
")",
",",
"stacklevel",
"=",
"2",
")",
"if",
"self",
... | https://github.com/HymanLiuTS/flaskTs/blob/286648286976e85d9b9a5873632331efcafe0b21/flasky/lib/python2.7/site-packages/flask/wrappers.py#L80-L90 | ||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | bin/x86/Debug/scripting_engine/Lib/ftplib.py | python | FTP.retrlines | (self, cmd, callback = None) | return self.voidresp() | Retrieve data in line mode. A new port is created for you.
Args:
cmd: A RETR, LIST, NLST, or MLSD command.
callback: An optional single parameter callable that is called
for each line with the trailing CRLF stripped.
[default: print_line()]
... | Retrieve data in line mode. A new port is created for you. | [
"Retrieve",
"data",
"in",
"line",
"mode",
".",
"A",
"new",
"port",
"is",
"created",
"for",
"you",
"."
] | def retrlines(self, cmd, callback = None):
"""Retrieve data in line mode. A new port is created for you.
Args:
cmd: A RETR, LIST, NLST, or MLSD command.
callback: An optional single parameter callable that is called
for each line with the trailing CRLF stripped.... | [
"def",
"retrlines",
"(",
"self",
",",
"cmd",
",",
"callback",
"=",
"None",
")",
":",
"if",
"callback",
"is",
"None",
":",
"callback",
"=",
"print_line",
"resp",
"=",
"self",
".",
"sendcmd",
"(",
"'TYPE A'",
")",
"conn",
"=",
"self",
".",
"transfercmd",... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/bin/x86/Debug/scripting_engine/Lib/ftplib.py#L408-L436 | |
fortharris/Pcode | 147962d160a834c219e12cb456abc130826468e4 | Xtra/autopep8.py | python | match_file | (filename, exclude) | return True | Return True if file is okay for modifying/recursing. | Return True if file is okay for modifying/recursing. | [
"Return",
"True",
"if",
"file",
"is",
"okay",
"for",
"modifying",
"/",
"recursing",
"."
] | def match_file(filename, exclude):
"""Return True if file is okay for modifying/recursing."""
base_name = os.path.basename(filename)
if base_name.startswith('.'):
return False
for pattern in exclude:
if fnmatch.fnmatch(base_name, pattern):
return False
if fnmatch.fn... | [
"def",
"match_file",
"(",
"filename",
",",
"exclude",
")",
":",
"base_name",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"filename",
")",
"if",
"base_name",
".",
"startswith",
"(",
"'.'",
")",
":",
"return",
"False",
"for",
"pattern",
"in",
"exclude",
... | https://github.com/fortharris/Pcode/blob/147962d160a834c219e12cb456abc130826468e4/Xtra/autopep8.py#L3480-L3496 | |
pfnet/pytorch-pfn-extras | b7ced31c1e78a0527c36d745ca091ec270da49e3 | pytorch_pfn_extras/utils/comparer.py | python | _ComparableHandler.train_validation_end | (self, trainer, evaluator) | [] | def train_validation_end(self, trainer, evaluator):
self._handler.train_validation_end(trainer, evaluator) | [
"def",
"train_validation_end",
"(",
"self",
",",
"trainer",
",",
"evaluator",
")",
":",
"self",
".",
"_handler",
".",
"train_validation_end",
"(",
"trainer",
",",
"evaluator",
")"
] | https://github.com/pfnet/pytorch-pfn-extras/blob/b7ced31c1e78a0527c36d745ca091ec270da49e3/pytorch_pfn_extras/utils/comparer.py#L57-L58 | ||||
Source-Python-Dev-Team/Source.Python | d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb | addons/source-python/packages/site-packages/sqlalchemy/orm/unitofwork.py | python | UOWTransaction.get_attribute_history | (self, state, key,
passive=attributes.PASSIVE_NO_INITIALIZE) | return state_history | facade to attributes.get_state_history(), including
caching of results. | facade to attributes.get_state_history(), including
caching of results. | [
"facade",
"to",
"attributes",
".",
"get_state_history",
"()",
"including",
"caching",
"of",
"results",
"."
] | def get_attribute_history(self, state, key,
passive=attributes.PASSIVE_NO_INITIALIZE):
"""facade to attributes.get_state_history(), including
caching of results."""
hashkey = ("history", state, key)
# cache the objects, not the states; the strong reference... | [
"def",
"get_attribute_history",
"(",
"self",
",",
"state",
",",
"key",
",",
"passive",
"=",
"attributes",
".",
"PASSIVE_NO_INITIALIZE",
")",
":",
"hashkey",
"=",
"(",
"\"history\"",
",",
"state",
",",
"key",
")",
"# cache the objects, not the states; the strong refe... | https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/packages/site-packages/sqlalchemy/orm/unitofwork.py#L178-L218 | |
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/encodings/iso8859_16.py | python | Codec.decode | (self,input,errors='strict') | return codecs.charmap_decode(input,errors,decoding_table) | [] | def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table) | [
"def",
"decode",
"(",
"self",
",",
"input",
",",
"errors",
"=",
"'strict'",
")",
":",
"return",
"codecs",
".",
"charmap_decode",
"(",
"input",
",",
"errors",
",",
"decoding_table",
")"
] | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/encodings/iso8859_16.py#L14-L15 | |||
MDAnalysis/mdanalysis | 3488df3cdb0c29ed41c4fb94efe334b541e31b21 | package/MDAnalysis/lib/util.py | python | convert_aa_code | (x) | Converts between 3-letter and 1-letter amino acid codes.
Parameters
----------
x : str
1-letter or 3-letter amino acid code
Returns
-------
str
3-letter or 1-letter amino acid code
Raises
------
ValueError
No conversion can be made; the amino acid code is n... | Converts between 3-letter and 1-letter amino acid codes. | [
"Converts",
"between",
"3",
"-",
"letter",
"and",
"1",
"-",
"letter",
"amino",
"acid",
"codes",
"."
] | def convert_aa_code(x):
"""Converts between 3-letter and 1-letter amino acid codes.
Parameters
----------
x : str
1-letter or 3-letter amino acid code
Returns
-------
str
3-letter or 1-letter amino acid code
Raises
------
ValueError
No conversion can be... | [
"def",
"convert_aa_code",
"(",
"x",
")",
":",
"if",
"len",
"(",
"x",
")",
"==",
"1",
":",
"d",
"=",
"amino_acid_codes",
"else",
":",
"d",
"=",
"inverse_aa_codes",
"try",
":",
"return",
"d",
"[",
"x",
".",
"upper",
"(",
")",
"]",
"except",
"KeyError... | https://github.com/MDAnalysis/mdanalysis/blob/3488df3cdb0c29ed41c4fb94efe334b541e31b21/package/MDAnalysis/lib/util.py#L1406-L1438 | ||
NTMC-Community/MatchZoo | 8a487ee5a574356fc91e4f48e219253dc11bcff2 | matchzoo/engine/param_table.py | python | ParamTable.to_frame | (self) | return df | Convert the parameter table into a pandas data frame.
:return: A `pandas.DataFrame`.
Example:
>>> import matchzoo as mz
>>> table = mz.ParamTable()
>>> table.add(mz.Param(name='x', value=10, desc='my x'))
>>> table.add(mz.Param(name='y', value=20, desc='... | Convert the parameter table into a pandas data frame. | [
"Convert",
"the",
"parameter",
"table",
"into",
"a",
"pandas",
"data",
"frame",
"."
] | def to_frame(self) -> pd.DataFrame:
"""
Convert the parameter table into a pandas data frame.
:return: A `pandas.DataFrame`.
Example:
>>> import matchzoo as mz
>>> table = mz.ParamTable()
>>> table.add(mz.Param(name='x', value=10, desc='my x'))
... | [
"def",
"to_frame",
"(",
"self",
")",
"->",
"pd",
".",
"DataFrame",
":",
"df",
"=",
"pd",
".",
"DataFrame",
"(",
"data",
"=",
"{",
"'Name'",
":",
"[",
"p",
".",
"name",
"for",
"p",
"in",
"self",
"]",
",",
"'Description'",
":",
"[",
"p",
".",
"de... | https://github.com/NTMC-Community/MatchZoo/blob/8a487ee5a574356fc91e4f48e219253dc11bcff2/matchzoo/engine/param_table.py#L71-L94 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/plat-atheos/TYPES.py | python | __P | (args) | return args | [] | def __P(args): return args | [
"def",
"__P",
"(",
"args",
")",
":",
"return",
"args"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/plat-atheos/TYPES.py#L49-L49 | |||
seppius-xbmc-repo/ru | d0879d56ec8243b2c7af44fda5cf3d1ff77fd2e2 | script.module.html5lib/lib/html5lib/tokenizer.py | python | HTMLTokenizer.scriptDataEscapedEndTagOpenState | (self) | return True | [] | def scriptDataEscapedEndTagOpenState(self):
data = self.stream.char()
if data in asciiLetters:
self.temporaryBuffer = data
self.state = self.scriptDataEscapedEndTagNameState
else:
self.tokenQueue.append({"type": tokenTypes["Characters"], "data": "</"})
... | [
"def",
"scriptDataEscapedEndTagOpenState",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"stream",
".",
"char",
"(",
")",
"if",
"data",
"in",
"asciiLetters",
":",
"self",
".",
"temporaryBuffer",
"=",
"data",
"self",
".",
"state",
"=",
"self",
".",
"sc... | https://github.com/seppius-xbmc-repo/ru/blob/d0879d56ec8243b2c7af44fda5cf3d1ff77fd2e2/script.module.html5lib/lib/html5lib/tokenizer.py#L701-L710 | |||
thingsboard/thingsboard-gateway | 1d1b1fc2450852dbd56ff137c6bfd49143dc758d | thingsboard_gateway/gateway/grpc_service/tb_grpc_manager.py | python | TBGRPCServerManager.__increase_incoming_statistic | (self, session_id) | [] | def __increase_incoming_statistic(self, session_id):
if session_id in self.sessions:
self.sessions[session_id]['statistics']["MessagesReceived"] += 1 | [
"def",
"__increase_incoming_statistic",
"(",
"self",
",",
"session_id",
")",
":",
"if",
"session_id",
"in",
"self",
".",
"sessions",
":",
"self",
".",
"sessions",
"[",
"session_id",
"]",
"[",
"'statistics'",
"]",
"[",
"\"MessagesReceived\"",
"]",
"+=",
"1"
] | https://github.com/thingsboard/thingsboard-gateway/blob/1d1b1fc2450852dbd56ff137c6bfd49143dc758d/thingsboard_gateway/gateway/grpc_service/tb_grpc_manager.py#L190-L192 | ||||
huggingface/transformers | 623b4f7c63f60cce917677ee704d6c93ee960b4b | examples/research_projects/bert-loses-patience/run_glue_with_pabee.py | python | evaluate | (args, model, tokenizer, prefix="", patience=0) | return results | [] | def evaluate(args, model, tokenizer, prefix="", patience=0):
if args.model_type == "albert":
model.albert.set_regression_threshold(args.regression_threshold)
model.albert.set_patience(patience)
model.albert.reset_stats()
elif args.model_type == "bert":
model.bert.set_regression_... | [
"def",
"evaluate",
"(",
"args",
",",
"model",
",",
"tokenizer",
",",
"prefix",
"=",
"\"\"",
",",
"patience",
"=",
"0",
")",
":",
"if",
"args",
".",
"model_type",
"==",
"\"albert\"",
":",
"model",
".",
"albert",
".",
"set_regression_threshold",
"(",
"args... | https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/examples/research_projects/bert-loses-patience/run_glue_with_pabee.py#L265-L353 | |||
CedricGuillemet/Imogen | ee417b42747ed5b46cb11b02ef0c3630000085b3 | bin/Lib/lib2to3/pytree.py | python | NegatedPattern.__init__ | (self, content=None) | Initializer.
The argument is either a pattern or None. If it is None, this
only matches an empty sequence (effectively '$' in regex
lingo). If it is not None, this matches whenever the argument
pattern doesn't have any matches. | Initializer. | [
"Initializer",
"."
] | def __init__(self, content=None):
"""
Initializer.
The argument is either a pattern or None. If it is None, this
only matches an empty sequence (effectively '$' in regex
lingo). If it is not None, this matches whenever the argument
pattern doesn't have any matches.
... | [
"def",
"__init__",
"(",
"self",
",",
"content",
"=",
"None",
")",
":",
"if",
"content",
"is",
"not",
"None",
":",
"assert",
"isinstance",
"(",
"content",
",",
"BasePattern",
")",
",",
"repr",
"(",
"content",
")",
"self",
".",
"content",
"=",
"content"
... | https://github.com/CedricGuillemet/Imogen/blob/ee417b42747ed5b46cb11b02ef0c3630000085b3/bin/Lib/lib2to3/pytree.py#L795-L806 | ||
keiffster/program-y | 8c99b56f8c32f01a7b9887b5daae9465619d0385 | src/programy/storage/stores/sql/dao/link.py | python | Link.__repr__ | (self) | return "<Linked(id='%s', primary_user='%s', provided_key='%s', generated_key='%s', " \
"expired='%s', expires='%s', retry_count='%d')>" % \
(DAOUtils.valid_id(self.id), self.primary_user, self.provided_key, self.generated_key, self.expired,
self.expires, self.retry_count) | [] | def __repr__(self):
return "<Linked(id='%s', primary_user='%s', provided_key='%s', generated_key='%s', " \
"expired='%s', expires='%s', retry_count='%d')>" % \
(DAOUtils.valid_id(self.id), self.primary_user, self.provided_key, self.generated_key, self.expired,
self.... | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"\"<Linked(id='%s', primary_user='%s', provided_key='%s', generated_key='%s', \"",
"\"expired='%s', expires='%s', retry_count='%d')>\"",
"%",
"(",
"DAOUtils",
".",
"valid_id",
"(",
"self",
".",
"id",
")",
",",
"self",
".",... | https://github.com/keiffster/program-y/blob/8c99b56f8c32f01a7b9887b5daae9465619d0385/src/programy/storage/stores/sql/dao/link.py#L37-L41 | |||
IJDykeman/wangTiles | 7c1ee2095ebdf7f72bce07d94c6484915d5cae8b | experimental_code/venv/lib/python2.7/site-packages/setuptools/archive_util.py | python | unpack_directory | (filename, extract_dir, progress_filter=default_filter) | Unpack" a directory, using the same interface as for archives
Raises ``UnrecognizedFormat`` if `filename` is not a directory | Unpack" a directory, using the same interface as for archives | [
"Unpack",
"a",
"directory",
"using",
"the",
"same",
"interface",
"as",
"for",
"archives"
] | def unpack_directory(filename, extract_dir, progress_filter=default_filter):
""""Unpack" a directory, using the same interface as for archives
Raises ``UnrecognizedFormat`` if `filename` is not a directory
"""
if not os.path.isdir(filename):
raise UnrecognizedFormat("%s is not a directory" % fi... | [
"def",
"unpack_directory",
"(",
"filename",
",",
"extract_dir",
",",
"progress_filter",
"=",
"default_filter",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"filename",
")",
":",
"raise",
"UnrecognizedFormat",
"(",
"\"%s is not a directory\"",
"%"... | https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/venv/lib/python2.7/site-packages/setuptools/archive_util.py#L61-L85 | ||
sergiocorreia/panflute | b9546cf7b88fdc9f00117fca395c4d3590f45769 | panflute/elements.py | python | Doc.__init__ | (self, *args, metadata={}, format='html', api_version=(1, 22)) | [] | def __init__(self, *args, metadata={}, format='html', api_version=(1, 22)):
self._set_content(args, Block)
self.metadata = metadata
self.format = format # Output format
try:
self.api_version = tuple(check_type(v, int) for v in api_version)
except TypeError:
... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"metadata",
"=",
"{",
"}",
",",
"format",
"=",
"'html'",
",",
"api_version",
"=",
"(",
"1",
",",
"22",
")",
")",
":",
"self",
".",
"_set_content",
"(",
"args",
",",
"Block",
")",
"self",
".",... | https://github.com/sergiocorreia/panflute/blob/b9546cf7b88fdc9f00117fca395c4d3590f45769/panflute/elements.py#L56-L69 | ||||
ipython/ipython | c0abea7a6dfe52c1f74c9d0387d4accadba7cc14 | IPython/core/display.py | python | Javascript.__init__ | (self, data=None, url=None, filename=None, lib=None, css=None) | Create a Javascript display object given raw data.
When this object is returned by an expression or passed to the
display function, it will result in the data being displayed
in the frontend. If the data is a URL, the data will first be
downloaded and then displayed.
In the Not... | Create a Javascript display object given raw data. | [
"Create",
"a",
"Javascript",
"display",
"object",
"given",
"raw",
"data",
"."
] | def __init__(self, data=None, url=None, filename=None, lib=None, css=None):
"""Create a Javascript display object given raw data.
When this object is returned by an expression or passed to the
display function, it will result in the data being displayed
in the frontend. If the data is a... | [
"def",
"__init__",
"(",
"self",
",",
"data",
"=",
"None",
",",
"url",
"=",
"None",
",",
"filename",
"=",
"None",
",",
"lib",
"=",
"None",
",",
"css",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"lib",
",",
"str",
")",
":",
"lib",
"=",
"[",
... | https://github.com/ipython/ipython/blob/c0abea7a6dfe52c1f74c9d0387d4accadba7cc14/IPython/core/display.py#L701-L745 | ||
mne-tools/mne-python | f90b303ce66a8415e64edd4605b09ac0179c1ebf | mne/channels/channels.py | python | SetChannelsMixin.anonymize | (self, daysback=None, keep_his=False, verbose=None) | return self | Anonymize measurement information in place.
Parameters
----------
%(anonymize_info_parameters)s
%(verbose)s
Returns
-------
inst : instance of Raw | Epochs | Evoked
The modified instance.
Notes
-----
%(anonymize_info_notes)s
... | Anonymize measurement information in place. | [
"Anonymize",
"measurement",
"information",
"in",
"place",
"."
] | def anonymize(self, daysback=None, keep_his=False, verbose=None):
"""Anonymize measurement information in place.
Parameters
----------
%(anonymize_info_parameters)s
%(verbose)s
Returns
-------
inst : instance of Raw | Epochs | Evoked
The modi... | [
"def",
"anonymize",
"(",
"self",
",",
"daysback",
"=",
"None",
",",
"keep_his",
"=",
"False",
",",
"verbose",
"=",
"None",
")",
":",
"anonymize_info",
"(",
"self",
".",
"info",
",",
"daysback",
"=",
"daysback",
",",
"keep_his",
"=",
"keep_his",
",",
"v... | https://github.com/mne-tools/mne-python/blob/f90b303ce66a8415e64edd4605b09ac0179c1ebf/mne/channels/channels.py#L604-L626 | |
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/nntplib.py | python | NNTP.descriptions | (self, group_pattern) | return self._getdescriptions(group_pattern, True) | Get descriptions for a range of groups. | Get descriptions for a range of groups. | [
"Get",
"descriptions",
"for",
"a",
"range",
"of",
"groups",
"."
] | def descriptions(self, group_pattern):
"""Get descriptions for a range of groups."""
return self._getdescriptions(group_pattern, True) | [
"def",
"descriptions",
"(",
"self",
",",
"group_pattern",
")",
":",
"return",
"self",
".",
"_getdescriptions",
"(",
"group_pattern",
",",
"True",
")"
] | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/nntplib.py#L676-L678 | |
TensorSpeech/TensorflowTTS | 34358d82a4c91fd70344872f8ea8a405ea84aedb | tensorflow_tts/models/melgan.py | python | TFMelGANGenerator.call | (self, mels, **kwargs) | return self.inference(mels) | Calculate forward propagation.
Args:
c (Tensor): Input tensor (B, T, channels)
Returns:
Tensor: Output tensor (B, T ** prod(upsample_scales), out_channels) | Calculate forward propagation.
Args:
c (Tensor): Input tensor (B, T, channels)
Returns:
Tensor: Output tensor (B, T ** prod(upsample_scales), out_channels) | [
"Calculate",
"forward",
"propagation",
".",
"Args",
":",
"c",
"(",
"Tensor",
")",
":",
"Input",
"tensor",
"(",
"B",
"T",
"channels",
")",
"Returns",
":",
"Tensor",
":",
"Output",
"tensor",
"(",
"B",
"T",
"**",
"prod",
"(",
"upsample_scales",
")",
"out_... | def call(self, mels, **kwargs):
"""Calculate forward propagation.
Args:
c (Tensor): Input tensor (B, T, channels)
Returns:
Tensor: Output tensor (B, T ** prod(upsample_scales), out_channels)
"""
return self.inference(mels) | [
"def",
"call",
"(",
"self",
",",
"mels",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"inference",
"(",
"mels",
")"
] | https://github.com/TensorSpeech/TensorflowTTS/blob/34358d82a4c91fd70344872f8ea8a405ea84aedb/tensorflow_tts/models/melgan.py#L278-L285 | |
ufora/ufora | 04db96ab049b8499d6d6526445f4f9857f1b6c7e | ufora/distributed/Service.py | python | Service.start | (self) | all services are started by calling start which is assumed to never return | all services are started by calling start which is assumed to never return | [
"all",
"services",
"are",
"started",
"by",
"calling",
"start",
"which",
"is",
"assumed",
"to",
"never",
"return"
] | def start(self):
'''all services are started by calling start which is assumed to never return'''
print "THIS IS HAPPENING"
raise AttributeError() | [
"def",
"start",
"(",
"self",
")",
":",
"print",
"\"THIS IS HAPPENING\"",
"raise",
"AttributeError",
"(",
")"
] | https://github.com/ufora/ufora/blob/04db96ab049b8499d6d6526445f4f9857f1b6c7e/ufora/distributed/Service.py#L16-L19 | ||
dropbox/dropbox-sdk-python | 015437429be224732990041164a21a0501235db1 | dropbox/team_log.py | python | EventTypeArg.is_note_acl_link | (self) | return self._tag == 'note_acl_link' | Check if the union tag is ``note_acl_link``.
:rtype: bool | Check if the union tag is ``note_acl_link``. | [
"Check",
"if",
"the",
"union",
"tag",
"is",
"note_acl_link",
"."
] | def is_note_acl_link(self):
"""
Check if the union tag is ``note_acl_link``.
:rtype: bool
"""
return self._tag == 'note_acl_link' | [
"def",
"is_note_acl_link",
"(",
"self",
")",
":",
"return",
"self",
".",
"_tag",
"==",
"'note_acl_link'"
] | https://github.com/dropbox/dropbox-sdk-python/blob/015437429be224732990041164a21a0501235db1/dropbox/team_log.py#L41847-L41853 | |
zzzeek/sqlalchemy | fc5c54fcd4d868c2a4c7ac19668d72f506fe821e | lib/sqlalchemy/engine/base.py | python | Engine.transaction | (self, callable_, *args, **kwargs) | r"""Execute the given function within a transaction boundary.
The function is passed a :class:`_engine.Connection` newly procured
from :meth:`_engine.Engine.connect` as the first argument,
followed by the given \*args and \**kwargs.
e.g.::
def do_something(conn, x, y):
... | r"""Execute the given function within a transaction boundary. | [
"r",
"Execute",
"the",
"given",
"function",
"within",
"a",
"transaction",
"boundary",
"."
] | def transaction(self, callable_, *args, **kwargs):
r"""Execute the given function within a transaction boundary.
The function is passed a :class:`_engine.Connection` newly procured
from :meth:`_engine.Engine.connect` as the first argument,
followed by the given \*args and \**kwargs.
... | [
"def",
"transaction",
"(",
"self",
",",
"callable_",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"\"_sa_skip_warning\"",
"]",
"=",
"True",
"with",
"self",
".",
"connect",
"(",
")",
"as",
"conn",
":",
"return",
"conn",
".",
"tr... | https://github.com/zzzeek/sqlalchemy/blob/fc5c54fcd4d868c2a4c7ac19668d72f506fe821e/lib/sqlalchemy/engine/base.py#L3009-L3050 | ||
cloudera/impyla | 0c736af4cad2bade9b8e313badc08ec50e81c948 | impala/_thrift_gen/hive_metastore/ttypes.py | python | ColumnStatisticsData.__eq__ | (self, other) | return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ | [] | def __eq__(self, other):
return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"return",
"isinstance",
"(",
"other",
",",
"self",
".",
"__class__",
")",
"and",
"self",
".",
"__dict__",
"==",
"other",
".",
"__dict__"
] | https://github.com/cloudera/impyla/blob/0c736af4cad2bade9b8e313badc08ec50e81c948/impala/_thrift_gen/hive_metastore/ttypes.py#L4660-L4661 | |||
playframework/play1 | 0ecac3bc2421ae2dbec27a368bf671eda1c9cba5 | python/Lib/codecs.py | python | getreader | (encoding) | return lookup(encoding).streamreader | Lookup up the codec for the given encoding and return
its StreamReader class or factory function.
Raises a LookupError in case the encoding cannot be found. | Lookup up the codec for the given encoding and return
its StreamReader class or factory function. | [
"Lookup",
"up",
"the",
"codec",
"for",
"the",
"given",
"encoding",
"and",
"return",
"its",
"StreamReader",
"class",
"or",
"factory",
"function",
"."
] | def getreader(encoding):
""" Lookup up the codec for the given encoding and return
its StreamReader class or factory function.
Raises a LookupError in case the encoding cannot be found.
"""
return lookup(encoding).streamreader | [
"def",
"getreader",
"(",
"encoding",
")",
":",
"return",
"lookup",
"(",
"encoding",
")",
".",
"streamreader"
] | https://github.com/playframework/play1/blob/0ecac3bc2421ae2dbec27a368bf671eda1c9cba5/python/Lib/codecs.py#L991-L999 | |
Yuliang-Liu/Box_Discretization_Network | 5b3a30c97429ef8e5c5e1c4e2476c7d9abdc03e6 | maskrcnn_benchmark/layers/deform_conv_v2.py | python | DCN.forward | (self, input) | return dcn_v2_conv(input, offset, mask,
self.weight, self.bias,
self.stride,
self.padding,
self.dilation,
self.deformable_groups) | [] | def forward(self, input):
out = self.conv_offset_mask(input)
o1, o2, mask = torch.chunk(out, 3, dim=1)
offset = torch.cat((o1, o2), dim=1)
mask = torch.sigmoid(mask)
return dcn_v2_conv(input, offset, mask,
self.weight, self.bias,
... | [
"def",
"forward",
"(",
"self",
",",
"input",
")",
":",
"out",
"=",
"self",
".",
"conv_offset_mask",
"(",
"input",
")",
"o1",
",",
"o2",
",",
"mask",
"=",
"torch",
".",
"chunk",
"(",
"out",
",",
"3",
",",
"dim",
"=",
"1",
")",
"offset",
"=",
"to... | https://github.com/Yuliang-Liu/Box_Discretization_Network/blob/5b3a30c97429ef8e5c5e1c4e2476c7d9abdc03e6/maskrcnn_benchmark/layers/deform_conv_v2.py#L121-L131 | |||
tomplus/kubernetes_asyncio | f028cc793e3a2c519be6a52a49fb77ff0b014c9b | kubernetes_asyncio/client/models/v1_api_service_status.py | python | V1APIServiceStatus.to_dict | (self) | return result | Returns the model properties as a dict | Returns the model properties as a dict | [
"Returns",
"the",
"model",
"properties",
"as",
"a",
"dict"
] | def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if has... | [
"def",
"to_dict",
"(",
"self",
")",
":",
"result",
"=",
"{",
"}",
"for",
"attr",
",",
"_",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"openapi_types",
")",
":",
"value",
"=",
"getattr",
"(",
"self",
",",
"attr",
")",
"if",
"isinstance",
"(",
... | https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1_api_service_status.py#L78-L100 | |
replit-archive/empythoned | 977ec10ced29a3541a4973dc2b59910805695752 | cpython/Tools/msi/msi.py | python | PyDialog.xbutton | (self, name, title, next, xpos) | return self.pushbutton(name, int(self.w*xpos - 28), self.h-27, 56, 17, 3, title, next) | Add a button with a given title, the tab-next button,
its name in the Control table, giving its x position; the
y-position is aligned with the other buttons.
Return the button, so that events can be associated | Add a button with a given title, the tab-next button,
its name in the Control table, giving its x position; the
y-position is aligned with the other buttons. | [
"Add",
"a",
"button",
"with",
"a",
"given",
"title",
"the",
"tab",
"-",
"next",
"button",
"its",
"name",
"in",
"the",
"Control",
"table",
"giving",
"its",
"x",
"position",
";",
"the",
"y",
"-",
"position",
"is",
"aligned",
"with",
"the",
"other",
"butt... | def xbutton(self, name, title, next, xpos):
"""Add a button with a given title, the tab-next button,
its name in the Control table, giving its x position; the
y-position is aligned with the other buttons.
Return the button, so that events can be associated"""
return self.pushbut... | [
"def",
"xbutton",
"(",
"self",
",",
"name",
",",
"title",
",",
"next",
",",
"xpos",
")",
":",
"return",
"self",
".",
"pushbutton",
"(",
"name",
",",
"int",
"(",
"self",
".",
"w",
"*",
"xpos",
"-",
"28",
")",
",",
"self",
".",
"h",
"-",
"27",
... | https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/cpython/Tools/msi/msi.py#L340-L346 | |
blindfuzzy/LHF | 51568ee159d0f5b46944a29c1e6786f9fffe1fb3 | Modules/IPy.py | python | IPint.broadcast | (self) | return self.int() + self.len() - 1 | Return the broadcast (last) address of a network as an (long) integer.
The same as IP[-1]. | Return the broadcast (last) address of a network as an (long) integer. | [
"Return",
"the",
"broadcast",
"(",
"last",
")",
"address",
"of",
"a",
"network",
"as",
"an",
"(",
"long",
")",
"integer",
"."
] | def broadcast(self):
"""
Return the broadcast (last) address of a network as an (long) integer.
The same as IP[-1]."""
return self.int() + self.len() - 1 | [
"def",
"broadcast",
"(",
"self",
")",
":",
"return",
"self",
".",
"int",
"(",
")",
"+",
"self",
".",
"len",
"(",
")",
"-",
"1"
] | https://github.com/blindfuzzy/LHF/blob/51568ee159d0f5b46944a29c1e6786f9fffe1fb3/Modules/IPy.py#L298-L303 | |
graphql-python/graphql-core | 9ea9c3705d6826322027d9bb539d37c5b25f7af9 | src/graphql/language/parser.py | python | Parser.parse_schema_extension | (self) | return SchemaExtensionNode(
directives=directives, operation_types=operation_types, loc=self.loc(start)
) | SchemaExtension | SchemaExtension | [
"SchemaExtension"
] | def parse_schema_extension(self) -> SchemaExtensionNode:
"""SchemaExtension"""
start = self._lexer.token
self.expect_keyword("extend")
self.expect_keyword("schema")
directives = self.parse_const_directives()
operation_types = self.optional_many(
TokenKind.BRAC... | [
"def",
"parse_schema_extension",
"(",
"self",
")",
"->",
"SchemaExtensionNode",
":",
"start",
"=",
"self",
".",
"_lexer",
".",
"token",
"self",
".",
"expect_keyword",
"(",
"\"extend\"",
")",
"self",
".",
"expect_keyword",
"(",
"\"schema\"",
")",
"directives",
... | https://github.com/graphql-python/graphql-core/blob/9ea9c3705d6826322027d9bb539d37c5b25f7af9/src/graphql/language/parser.py#L858-L871 | |
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/pricing/v1/phone_number/country.py | python | CountryInstance.__repr__ | (self) | return '<Twilio.Pricing.V1.CountryInstance {}>'.format(context) | Provide a friendly representation
:returns: Machine friendly representation
:rtype: str | Provide a friendly representation | [
"Provide",
"a",
"friendly",
"representation"
] | def __repr__(self):
"""
Provide a friendly representation
:returns: Machine friendly representation
:rtype: str
"""
context = ' '.join('{}={}'.format(k, v) for k, v in self._solution.items())
return '<Twilio.Pricing.V1.CountryInstance {}>'.format(context) | [
"def",
"__repr__",
"(",
"self",
")",
":",
"context",
"=",
"' '",
".",
"join",
"(",
"'{}={}'",
".",
"format",
"(",
"k",
",",
"v",
")",
"for",
"k",
",",
"v",
"in",
"self",
".",
"_solution",
".",
"items",
"(",
")",
")",
"return",
"'<Twilio.Pricing.V1.... | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/pricing/v1/phone_number/country.py#L306-L314 | |
ucaiado/rl_trading | f4168c69f44fe5a11a06461387d4591426a43735 | market_sim/_agents/agent_frwk.py | python | BasicAgent._select_spread | (self, t_state, s_code=None) | return None, self.f_spread | Select the spread to use in a new order. Return the code criterium
to select the spread and a list of the bid and ask spread
:param t_state: tuple. The inputs to be considered by the agent | Select the spread to use in a new order. Return the code criterium
to select the spread and a list of the bid and ask spread | [
"Select",
"the",
"spread",
"to",
"use",
"in",
"a",
"new",
"order",
".",
"Return",
"the",
"code",
"criterium",
"to",
"select",
"the",
"spread",
"and",
"a",
"list",
"of",
"the",
"bid",
"and",
"ask",
"spread"
] | def _select_spread(self, t_state, s_code=None):
'''
Select the spread to use in a new order. Return the code criterium
to select the spread and a list of the bid and ask spread
:param t_state: tuple. The inputs to be considered by the agent
'''
return None, self.f_spread | [
"def",
"_select_spread",
"(",
"self",
",",
"t_state",
",",
"s_code",
"=",
"None",
")",
":",
"return",
"None",
",",
"self",
".",
"f_spread"
] | https://github.com/ucaiado/rl_trading/blob/f4168c69f44fe5a11a06461387d4591426a43735/market_sim/_agents/agent_frwk.py#L717-L724 | |
ianmiell/shutit | ef724e1ed4dcc544e594200e0b6cdfa53d04a95f | shutit_class.py | python | ShutIt.stop_all | (self, run_order=-1) | Runs stop method on all modules less than the passed-in run_order.
Used when target is exporting itself mid-build, so we clean up state
before committing run files etc. | Runs stop method on all modules less than the passed-in run_order.
Used when target is exporting itself mid-build, so we clean up state
before committing run files etc. | [
"Runs",
"stop",
"method",
"on",
"all",
"modules",
"less",
"than",
"the",
"passed",
"-",
"in",
"run_order",
".",
"Used",
"when",
"target",
"is",
"exporting",
"itself",
"mid",
"-",
"build",
"so",
"we",
"clean",
"up",
"state",
"before",
"committing",
"run",
... | def stop_all(self, run_order=-1):
"""Runs stop method on all modules less than the passed-in run_order.
Used when target is exporting itself mid-build, so we clean up state
before committing run files etc.
"""
shutit_global.shutit_global_object.yield_to_draw()
# sort them so they're stopped in reverse order... | [
"def",
"stop_all",
"(",
"self",
",",
"run_order",
"=",
"-",
"1",
")",
":",
"shutit_global",
".",
"shutit_global_object",
".",
"yield_to_draw",
"(",
")",
"# sort them so they're stopped in reverse order",
"for",
"module_id",
"in",
"self",
".",
"module_ids",
"(",
"r... | https://github.com/ianmiell/shutit/blob/ef724e1ed4dcc544e594200e0b6cdfa53d04a95f/shutit_class.py#L4628-L4640 | ||
ericfourrier/scrape-linkedin | e18d7d93abb78a65683b7fdf6d94eed0a2785ef8 | pylinkedin/scraper.py | python | LinkedinItem.recommendations | (self) | return self.get_clean_xpath('//div[@id = "recommendations"]//ul/li/div[@class = "description"]/text()') | Return a list of description of the recommendations | Return a list of description of the recommendations | [
"Return",
"a",
"list",
"of",
"description",
"of",
"the",
"recommendations"
] | def recommendations(self):
""" Return a list of description of the recommendations """
return self.get_clean_xpath('//div[@id = "recommendations"]//ul/li/div[@class = "description"]/text()') | [
"def",
"recommendations",
"(",
"self",
")",
":",
"return",
"self",
".",
"get_clean_xpath",
"(",
"'//div[@id = \"recommendations\"]//ul/li/div[@class = \"description\"]/text()'",
")"
] | https://github.com/ericfourrier/scrape-linkedin/blob/e18d7d93abb78a65683b7fdf6d94eed0a2785ef8/pylinkedin/scraper.py#L318-L320 | |
kuri65536/python-for-android | 26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891 | python-modules/twisted/twisted/mail/imap4.py | python | IMAP4Server.__cbManualSearch | (self, result, tag, mbox, query, uid,
searchResults=None) | Apply the search filter to a set of messages. Send the response to the
client.
@type result: C{list} of C{tuple} of (C{int}, provider of
L{imap4.IMessage})
@param result: A list two tuples of messages with their sequence ids,
sorted by the ids in descending order.
... | Apply the search filter to a set of messages. Send the response to the
client. | [
"Apply",
"the",
"search",
"filter",
"to",
"a",
"set",
"of",
"messages",
".",
"Send",
"the",
"response",
"to",
"the",
"client",
"."
] | def __cbManualSearch(self, result, tag, mbox, query, uid,
searchResults=None):
"""
Apply the search filter to a set of messages. Send the response to the
client.
@type result: C{list} of C{tuple} of (C{int}, provider of
L{imap4.IMessage})
@pa... | [
"def",
"__cbManualSearch",
"(",
"self",
",",
"result",
",",
"tag",
",",
"mbox",
",",
"query",
",",
"uid",
",",
"searchResults",
"=",
"None",
")",
":",
"if",
"searchResults",
"is",
"None",
":",
"searchResults",
"=",
"[",
"]",
"i",
"=",
"0",
"# result is... | https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-modules/twisted/twisted/mail/imap4.py#L1438-L1491 | ||
godotengine/godot-blender-exporter | b8b883df64f601acc4c40110e99631422a4978ff | io_scene_godot/converters/animation/serializer.py | python | Track.to_string | (self) | return self.convert_to_keys_object().to_string() | Serialize a track object | Serialize a track object | [
"Serialize",
"a",
"track",
"object"
] | def to_string(self):
"""Serialize a track object"""
return self.convert_to_keys_object().to_string() | [
"def",
"to_string",
"(",
"self",
")",
":",
"return",
"self",
".",
"convert_to_keys_object",
"(",
")",
".",
"to_string",
"(",
")"
] | https://github.com/godotengine/godot-blender-exporter/blob/b8b883df64f601acc4c40110e99631422a4978ff/io_scene_godot/converters/animation/serializer.py#L170-L172 | |
naver/sqlova | fc68af6008fd2fd5839210e4b06a352007f609b6 | sqlova/utils/utils_wikisql.py | python | load_w2i_wemb | (path_wikisql, bert=False) | return w2i, wemb | Load pre-made subset of TAPI. | Load pre-made subset of TAPI. | [
"Load",
"pre",
"-",
"made",
"subset",
"of",
"TAPI",
"."
] | def load_w2i_wemb(path_wikisql, bert=False):
""" Load pre-made subset of TAPI.
"""
if bert:
with open(os.path.join(path_wikisql, 'w2i_bert.json'), 'r') as f_w2i:
w2i = json.load(f_w2i)
wemb = load(os.path.join(path_wikisql, 'wemb_bert.npy'), )
else:
with open(os.path.... | [
"def",
"load_w2i_wemb",
"(",
"path_wikisql",
",",
"bert",
"=",
"False",
")",
":",
"if",
"bert",
":",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"path_wikisql",
",",
"'w2i_bert.json'",
")",
",",
"'r'",
")",
"as",
"f_w2i",
":",
"w2i",
"=... | https://github.com/naver/sqlova/blob/fc68af6008fd2fd5839210e4b06a352007f609b6/sqlova/utils/utils_wikisql.py#L78-L90 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/cover/__init__.py | python | is_closed | (hass, entity_id) | return hass.states.is_state(entity_id, STATE_CLOSED) | Return if the cover is closed based on the statemachine. | Return if the cover is closed based on the statemachine. | [
"Return",
"if",
"the",
"cover",
"is",
"closed",
"based",
"on",
"the",
"statemachine",
"."
] | def is_closed(hass, entity_id):
"""Return if the cover is closed based on the statemachine."""
return hass.states.is_state(entity_id, STATE_CLOSED) | [
"def",
"is_closed",
"(",
"hass",
",",
"entity_id",
")",
":",
"return",
"hass",
".",
"states",
".",
"is_state",
"(",
"entity_id",
",",
"STATE_CLOSED",
")"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/cover/__init__.py#L98-L100 | |
tobegit3hub/deep_image_model | 8a53edecd9e00678b278bb10f6fb4bdb1e4ee25e | java_predict_client/src/main/proto/tensorflow/models/embedding/word2vec.py | python | Word2Vec.build_graph | (self) | Build the graph for the full model. | Build the graph for the full model. | [
"Build",
"the",
"graph",
"for",
"the",
"full",
"model",
"."
] | def build_graph(self):
"""Build the graph for the full model."""
opts = self._options
# The training data. A text file.
(words, counts, words_per_epoch, self._epoch, self._words, examples,
labels) = word2vec.skipgram(filename=opts.train_data,
batch_size=opts.batch_s... | [
"def",
"build_graph",
"(",
"self",
")",
":",
"opts",
"=",
"self",
".",
"_options",
"# The training data. A text file.",
"(",
"words",
",",
"counts",
",",
"words_per_epoch",
",",
"self",
".",
"_epoch",
",",
"self",
".",
"_words",
",",
"examples",
",",
"labels... | https://github.com/tobegit3hub/deep_image_model/blob/8a53edecd9e00678b278bb10f6fb4bdb1e4ee25e/java_predict_client/src/main/proto/tensorflow/models/embedding/word2vec.py#L343-L373 | ||
gramps-project/gramps | 04d4651a43eb210192f40a9f8c2bad8ee8fa3753 | gramps/gen/db/generic.py | python | DbGeneric._iter_objects | (self, class_) | Iterate over items in a class. | Iterate over items in a class. | [
"Iterate",
"over",
"items",
"in",
"a",
"class",
"."
] | def _iter_objects(self, class_):
"""
Iterate over items in a class.
"""
cursor = self._get_table_func(class_.__name__, "cursor_func")
for data in cursor():
yield class_.create(data[1]) | [
"def",
"_iter_objects",
"(",
"self",
",",
"class_",
")",
":",
"cursor",
"=",
"self",
".",
"_get_table_func",
"(",
"class_",
".",
"__name__",
",",
"\"cursor_func\"",
")",
"for",
"data",
"in",
"cursor",
"(",
")",
":",
"yield",
"class_",
".",
"create",
"(",... | https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/gen/db/generic.py#L1536-L1542 | ||
OfflineIMAP/offlineimap | e70d3992a0e9bb0fcdf3c94e1edf25a4124dfcd2 | offlineimap/repository/LocalStatus.py | python | LocalStatusRepository.forgetfolders | (self) | Forgets the cached list of folders, if any. Useful to run
after a sync run. | Forgets the cached list of folders, if any. Useful to run
after a sync run. | [
"Forgets",
"the",
"cached",
"list",
"of",
"folders",
"if",
"any",
".",
"Useful",
"to",
"run",
"after",
"a",
"sync",
"run",
"."
] | def forgetfolders(self):
"""Forgets the cached list of folders, if any. Useful to run
after a sync run."""
self._folders = {} | [
"def",
"forgetfolders",
"(",
"self",
")",
":",
"self",
".",
"_folders",
"=",
"{",
"}"
] | https://github.com/OfflineIMAP/offlineimap/blob/e70d3992a0e9bb0fcdf3c94e1edf25a4124dfcd2/offlineimap/repository/LocalStatus.py#L135-L139 | ||
makerbot/ReplicatorG | d6f2b07785a5a5f1e172fb87cb4303b17c575d5d | skein_engines/skeinforge-50/fabmetheus_utilities/archive.py | python | getFilesWithFileTypesWithoutWords | (fileTypes, words = [], fileInDirectory='') | return filesWithFileTypes | Get files which have a given file type, but with do not contain a word in a list. | Get files which have a given file type, but with do not contain a word in a list. | [
"Get",
"files",
"which",
"have",
"a",
"given",
"file",
"type",
"but",
"with",
"do",
"not",
"contain",
"a",
"word",
"in",
"a",
"list",
"."
] | def getFilesWithFileTypesWithoutWords(fileTypes, words = [], fileInDirectory=''):
'Get files which have a given file type, but with do not contain a word in a list.'
filesWithFileTypes = []
for filePath in getFilePaths(fileInDirectory):
for fileType in fileTypes:
if isFileWithFileTypeWithoutWords(fileType, file... | [
"def",
"getFilesWithFileTypesWithoutWords",
"(",
"fileTypes",
",",
"words",
"=",
"[",
"]",
",",
"fileInDirectory",
"=",
"''",
")",
":",
"filesWithFileTypes",
"=",
"[",
"]",
"for",
"filePath",
"in",
"getFilePaths",
"(",
"fileInDirectory",
")",
":",
"for",
"file... | https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-50/fabmetheus_utilities/archive.py#L128-L136 | |
caiiiac/Machine-Learning-with-Python | 1a26c4467da41ca4ebc3d5bd789ea942ef79422f | MachineLearning/venv/lib/python3.5/site-packages/pandas/core/indexes/base.py | python | Index._format_attrs | (self) | return attrs | Return a list of tuples of the (attr,formatted_value) | Return a list of tuples of the (attr,formatted_value) | [
"Return",
"a",
"list",
"of",
"tuples",
"of",
"the",
"(",
"attr",
"formatted_value",
")"
] | def _format_attrs(self):
"""
Return a list of tuples of the (attr,formatted_value)
"""
attrs = []
attrs.append(('dtype', "'%s'" % self.dtype))
if self.name is not None:
attrs.append(('name', default_pprint(self.name)))
max_seq_items = get_option('displ... | [
"def",
"_format_attrs",
"(",
"self",
")",
":",
"attrs",
"=",
"[",
"]",
"attrs",
".",
"append",
"(",
"(",
"'dtype'",
",",
"\"'%s'\"",
"%",
"self",
".",
"dtype",
")",
")",
"if",
"self",
".",
"name",
"is",
"not",
"None",
":",
"attrs",
".",
"append",
... | https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/pandas/core/indexes/base.py#L945-L956 | |
idanr1986/cuckoo-droid | 1350274639473d3d2b0ac740cae133ca53ab7444 | analyzer/android_on_linux/lib/api/androguard/analysis.py | python | TaintedPackages.get_packages_by_bb | (self, bb) | return l | :rtype: return a list of packaged used in a basic block | :rtype: return a list of packaged used in a basic block | [
":",
"rtype",
":",
"return",
"a",
"list",
"of",
"packaged",
"used",
"in",
"a",
"basic",
"block"
] | def get_packages_by_bb(self, bb):
"""
:rtype: return a list of packaged used in a basic block
"""
l = []
for i in self.__packages :
paths = self.__packages[i].gets()
for j in paths :
for k in paths[j] :
if k.get_bb()... | [
"def",
"get_packages_by_bb",
"(",
"self",
",",
"bb",
")",
":",
"l",
"=",
"[",
"]",
"for",
"i",
"in",
"self",
".",
"__packages",
":",
"paths",
"=",
"self",
".",
"__packages",
"[",
"i",
"]",
".",
"gets",
"(",
")",
"for",
"j",
"in",
"paths",
":",
... | https://github.com/idanr1986/cuckoo-droid/blob/1350274639473d3d2b0ac740cae133ca53ab7444/analyzer/android_on_linux/lib/api/androguard/analysis.py#L1728-L1740 | |
pbiernat/ripr | 223954f4b2e1283239c80df9ea434050da710de7 | analysis_engine.py | python | aengine.find_section | (self, addr) | Function should find what segment/section $addr is in and return a tuple
(StartAddress, Endaddress, Segment Name)
Error: Return -1 | Function should find what segment/section $addr is in and return a tuple
(StartAddress, Endaddress, Segment Name)
Error: Return -1 | [
"Function",
"should",
"find",
"what",
"segment",
"/",
"section",
"$addr",
"is",
"in",
"and",
"return",
"a",
"tuple",
"(",
"StartAddress",
"Endaddress",
"Segment",
"Name",
")",
"Error",
":",
"Return",
"-",
"1"
] | def find_section(self, addr):
'''
Function should find what segment/section $addr is in and return a tuple
(StartAddress, Endaddress, Segment Name)
Error: Return -1
'''
pass | [
"def",
"find_section",
"(",
"self",
",",
"addr",
")",
":",
"pass"
] | https://github.com/pbiernat/ripr/blob/223954f4b2e1283239c80df9ea434050da710de7/analysis_engine.py#L42-L48 | ||
ewels/MultiQC | 9b953261d3d684c24eef1827a5ce6718c847a5af | multiqc/modules/prokka/prokka.py | python | MultiqcModule.prokka_barplot | (self) | return bargraph.plot(self.prokka, keys, plot_config) | Make a basic plot of the annotation stats | Make a basic plot of the annotation stats | [
"Make",
"a",
"basic",
"plot",
"of",
"the",
"annotation",
"stats"
] | def prokka_barplot(self):
"""Make a basic plot of the annotation stats"""
# Specify the order of the different categories
keys = OrderedDict()
keys["CDS"] = {"name": "CDS"}
keys["rRNA"] = {"name": "rRNA"}
keys["tRNA"] = {"name": "tRNA"}
keys["tmRNA"] = {"name": "... | [
"def",
"prokka_barplot",
"(",
"self",
")",
":",
"# Specify the order of the different categories",
"keys",
"=",
"OrderedDict",
"(",
")",
"keys",
"[",
"\"CDS\"",
"]",
"=",
"{",
"\"name\"",
":",
"\"CDS\"",
"}",
"keys",
"[",
"\"rRNA\"",
"]",
"=",
"{",
"\"name\"",... | https://github.com/ewels/MultiQC/blob/9b953261d3d684c24eef1827a5ce6718c847a5af/multiqc/modules/prokka/prokka.py#L204-L224 | |
fake-name/ReadableWebProxy | ed5c7abe38706acc2684a1e6cd80242a03c5f010 | WebMirror/management/rss_parser_funcs/feed_parse_extractNovelcvCom.py | python | extractNovelcvCom | (item) | return False | Parser for 'novelcv.com' | Parser for 'novelcv.com' | [
"Parser",
"for",
"novelcv",
".",
"com"
] | def extractNovelcvCom(item):
'''
Parser for 'novelcv.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
# Seems dead now
return None
tagmap = [
# ('Isekai Tensei - Kimi to no Saikai made Nagai koto Na... | [
"def",
"extractNovelcvCom",
"(",
"item",
")",
":",
"vol",
",",
"chp",
",",
"frag",
",",
"postfix",
"=",
"extractVolChapterFragmentPostfix",
"(",
"item",
"[",
"'title'",
"]",
")",
"if",
"not",
"(",
"chp",
"or",
"vol",
")",
"or",
"\"preview\"",
"in",
"item... | https://github.com/fake-name/ReadableWebProxy/blob/ed5c7abe38706acc2684a1e6cd80242a03c5f010/WebMirror/management/rss_parser_funcs/feed_parse_extractNovelcvCom.py#L1-L43 | |
vladimarius/imapy | 651a57ea50e76b8f91ad9150184c3f9b7072ad60 | imapy/query_builder.py | python | Q.subject | (self, what) | return self | Messages that contain the specified string in the envelope
structure's SUBJECT field. | Messages that contain the specified string in the envelope
structure's SUBJECT field. | [
"Messages",
"that",
"contain",
"the",
"specified",
"string",
"in",
"the",
"envelope",
"structure",
"s",
"SUBJECT",
"field",
"."
] | def subject(self, what):
"""Messages that contain the specified string in the envelope
structure's SUBJECT field."""
self.queries += ['SUBJECT', what]
return self | [
"def",
"subject",
"(",
"self",
",",
"what",
")",
":",
"self",
".",
"queries",
"+=",
"[",
"'SUBJECT'",
",",
"what",
"]",
"return",
"self"
] | https://github.com/vladimarius/imapy/blob/651a57ea50e76b8f91ad9150184c3f9b7072ad60/imapy/query_builder.py#L300-L304 | |
securityclippy/elasticintel | aa08d3e9f5ab1c000128e95161139ce97ff0e334 | ingest_feed_lambda/requests/adapters.py | python | HTTPAdapter.send | (self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None) | return self.build_response(request, resp) | Sends PreparedRequest object. Returns Response object.
:param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
:param stream: (optional) Whether to stream the request content.
:param timeout: (optional) How long to wait for the server to send
data before giving up... | Sends PreparedRequest object. Returns Response object. | [
"Sends",
"PreparedRequest",
"object",
".",
"Returns",
"Response",
"object",
"."
] | def send(self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None):
"""Sends PreparedRequest object. Returns Response object.
:param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
:param stream: (optional) Whether to stream the request content.
... | [
"def",
"send",
"(",
"self",
",",
"request",
",",
"stream",
"=",
"False",
",",
"timeout",
"=",
"None",
",",
"verify",
"=",
"True",
",",
"cert",
"=",
"None",
",",
"proxies",
"=",
"None",
")",
":",
"conn",
"=",
"self",
".",
"get_connection",
"(",
"req... | https://github.com/securityclippy/elasticintel/blob/aa08d3e9f5ab1c000128e95161139ce97ff0e334/ingest_feed_lambda/requests/adapters.py#L329-L453 | |
KalleHallden/AutoTimer | 2d954216700c4930baa154e28dbddc34609af7ce | env/lib/python2.7/site-packages/pkg_resources/_vendor/pyparsing.py | python | StringStart.__init__ | ( self ) | [] | def __init__( self ):
super(StringStart,self).__init__()
self.errmsg = "Expected start of text" | [
"def",
"__init__",
"(",
"self",
")",
":",
"super",
"(",
"StringStart",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"errmsg",
"=",
"\"Expected start of text\""
] | https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/pkg_resources/_vendor/pyparsing.py#L3184-L3186 | ||||
Tencent/bk-bcs-saas | 2b437bf2f5fd5ce2078f7787c3a12df609f7679d | bcs-app/backend/helm/app/models.py | python | App.destroy_app_task | (self, username, access_token) | destroy app in cluster, then remove record from db | destroy app in cluster, then remove record from db | [
"destroy",
"app",
"in",
"cluster",
"then",
"remove",
"record",
"from",
"db"
] | def destroy_app_task(self, username, access_token):
"""destroy app in cluster, then remove record from db"""
# operation record
log_client = self.record_destroy(username=username, access_token=access_token)
try:
app_deployer = AppDeployer(app=self, access_token=access_token)... | [
"def",
"destroy_app_task",
"(",
"self",
",",
"username",
",",
"access_token",
")",
":",
"# operation record",
"log_client",
"=",
"self",
".",
"record_destroy",
"(",
"username",
"=",
"username",
",",
"access_token",
"=",
"access_token",
")",
"try",
":",
"app_depl... | https://github.com/Tencent/bk-bcs-saas/blob/2b437bf2f5fd5ce2078f7787c3a12df609f7679d/bcs-app/backend/helm/app/models.py#L588-L611 | ||
ilektrojohn/creepy | 9f60449897e12a7a6f8fb53e602ffc57f2a74f1e | creepy/CreepyMain.py | python | MainWindow.updateCurrentLocationDetails | (self, index) | Called when the user clicks on a location from the location list. It updates the information
displayed on the Current Target Details Window | Called when the user clicks on a location from the location list. It updates the information
displayed on the Current Target Details Window | [
"Called",
"when",
"the",
"user",
"clicks",
"on",
"a",
"location",
"from",
"the",
"location",
"list",
".",
"It",
"updates",
"the",
"information",
"displayed",
"on",
"the",
"Current",
"Target",
"Details",
"Window"
] | def updateCurrentLocationDetails(self, index):
'''
Called when the user clicks on a location from the location list. It updates the information
displayed on the Current Target Details Window
'''
location = self.locationsTableModel.locations[index.row()]
self.ui.currentTa... | [
"def",
"updateCurrentLocationDetails",
"(",
"self",
",",
"index",
")",
":",
"location",
"=",
"self",
".",
"locationsTableModel",
".",
"locations",
"[",
"index",
".",
"row",
"(",
")",
"]",
"self",
".",
"ui",
".",
"currentTargetDetailsLocationValue",
".",
"setTe... | https://github.com/ilektrojohn/creepy/blob/9f60449897e12a7a6f8fb53e602ffc57f2a74f1e/creepy/CreepyMain.py#L443-L452 | ||
frescobaldi/frescobaldi | 301cc977fc4ba7caa3df9e4bf905212ad5d06912 | frescobaldi_app/preferences/shortcuts.py | python | Shortcuts.items | (self) | Yield all the items in the actions tree. | Yield all the items in the actions tree. | [
"Yield",
"all",
"the",
"items",
"in",
"the",
"actions",
"tree",
"."
] | def items(self):
"""Yield all the items in the actions tree."""
def children(item):
for i in range(item.childCount()):
c = item.child(i)
if c.childCount():
for c1 in children(c):
yield c1
else:
... | [
"def",
"items",
"(",
"self",
")",
":",
"def",
"children",
"(",
"item",
")",
":",
"for",
"i",
"in",
"range",
"(",
"item",
".",
"childCount",
"(",
")",
")",
":",
"c",
"=",
"item",
".",
"child",
"(",
"i",
")",
"if",
"c",
".",
"childCount",
"(",
... | https://github.com/frescobaldi/frescobaldi/blob/301cc977fc4ba7caa3df9e4bf905212ad5d06912/frescobaldi_app/preferences/shortcuts.py#L153-L164 | ||
kanzure/nanoengineer | 874e4c9f8a9190f093625b267f9767e19f82e6c4 | cad/src/commands/PlaneProperties/PlanePropertyManager.py | python | PlanePropertyManager.update_props_if_needed_before_closing | (self) | This updates some cosmetic properties of the Plane (e.g. fill color,
border color, etc.) before closing the Property Manager. | This updates some cosmetic properties of the Plane (e.g. fill color,
border color, etc.) before closing the Property Manager. | [
"This",
"updates",
"some",
"cosmetic",
"properties",
"of",
"the",
"Plane",
"(",
"e",
".",
"g",
".",
"fill",
"color",
"border",
"color",
"etc",
".",
")",
"before",
"closing",
"the",
"Property",
"Manager",
"."
] | def update_props_if_needed_before_closing(self):
"""
This updates some cosmetic properties of the Plane (e.g. fill color,
border color, etc.) before closing the Property Manager.
"""
# Example: The Plane Property Manager is open and the user is
# 'previewing' the plane. ... | [
"def",
"update_props_if_needed_before_closing",
"(",
"self",
")",
":",
"# Example: The Plane Property Manager is open and the user is",
"# 'previewing' the plane. Now the user clicks on \"Build > Atoms\"",
"# to invoke the next command (without clicking \"Done\").",
"# This calls openPropertyManag... | https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/commands/PlaneProperties/PlanePropertyManager.py#L1035-L1061 | ||
pysmt/pysmt | ade4dc2a825727615033a96d31c71e9f53ce4764 | pysmt/fnode.py | python | FNode.Equals | (self, right) | return self._apply_infix(right, _mgr().Equals) | [] | def Equals(self, right):
return self._apply_infix(right, _mgr().Equals) | [
"def",
"Equals",
"(",
"self",
",",
"right",
")",
":",
"return",
"self",
".",
"_apply_infix",
"(",
"right",
",",
"_mgr",
"(",
")",
".",
"Equals",
")"
] | https://github.com/pysmt/pysmt/blob/ade4dc2a825727615033a96d31c71e9f53ce4764/pysmt/fnode.py#L733-L734 | |||
IronLanguages/ironpython2 | 51fdedeeda15727717fb8268a805f71b06c0b9f1 | Src/StdLib/Lib/warnings.py | python | warn | (message, category=None, stacklevel=1) | Issue a warning, or maybe ignore it or raise an exception. | Issue a warning, or maybe ignore it or raise an exception. | [
"Issue",
"a",
"warning",
"or",
"maybe",
"ignore",
"it",
"or",
"raise",
"an",
"exception",
"."
] | def warn(message, category=None, stacklevel=1):
"""Issue a warning, or maybe ignore it or raise an exception."""
# Check if message is already a Warning object
if isinstance(message, Warning):
category = message.__class__
# Check category argument
if category is None:
category = User... | [
"def",
"warn",
"(",
"message",
",",
"category",
"=",
"None",
",",
"stacklevel",
"=",
"1",
")",
":",
"# Check if message is already a Warning object",
"if",
"isinstance",
"(",
"message",
",",
"Warning",
")",
":",
"category",
"=",
"message",
".",
"__class__",
"#... | https://github.com/IronLanguages/ironpython2/blob/51fdedeeda15727717fb8268a805f71b06c0b9f1/Src/StdLib/Lib/warnings.py#L197-L235 | ||
annoviko/pyclustering | bf4f51a472622292627ec8c294eb205585e50f52 | pyclustering/container/cftree.py | python | cftree.__init__ | (self, branch_factor, max_entries, threshold, type_measurement = measurement_type.CENTROID_EUCLIDEAN_DISTANCE) | !
@brief Create CF-tree.
@param[in] branch_factor (uint): Maximum number of children for non-leaf nodes.
@param[in] max_entries (uint): Maximum number of entries for leaf nodes.
@param[in] threshold (double): Maximum diameter of feature clustering for each leaf node.
@pa... | ! | [
"!"
] | def __init__(self, branch_factor, max_entries, threshold, type_measurement = measurement_type.CENTROID_EUCLIDEAN_DISTANCE):
"""!
@brief Create CF-tree.
@param[in] branch_factor (uint): Maximum number of children for non-leaf nodes.
@param[in] max_entries (uint): Maximum number o... | [
"def",
"__init__",
"(",
"self",
",",
"branch_factor",
",",
"max_entries",
",",
"threshold",
",",
"type_measurement",
"=",
"measurement_type",
".",
"CENTROID_EUCLIDEAN_DISTANCE",
")",
":",
"self",
".",
"__root",
"=",
"None",
"self",
".",
"__branch_factor",
"=",
"... | https://github.com/annoviko/pyclustering/blob/bf4f51a472622292627ec8c294eb205585e50f52/pyclustering/container/cftree.py#L773-L800 | ||
fortharris/Pcode | 147962d160a834c219e12cb456abc130826468e4 | Extensions/MiniMap.py | python | MiniMap.mousePressEvent | (self, event) | [] | def mousePressEvent(self, event):
super(MiniMap, self).mousePressEvent(event)
line, index = self.getCursorPosition()
self.editor.showLine(line) | [
"def",
"mousePressEvent",
"(",
"self",
",",
"event",
")",
":",
"super",
"(",
"MiniMap",
",",
"self",
")",
".",
"mousePressEvent",
"(",
"event",
")",
"line",
",",
"index",
"=",
"self",
".",
"getCursorPosition",
"(",
")",
"self",
".",
"editor",
".",
"sho... | https://github.com/fortharris/Pcode/blob/147962d160a834c219e12cb456abc130826468e4/Extensions/MiniMap.py#L92-L95 | ||||
keras-team/keras-preprocessing | 6701f27afa62712b34a17d4b0ff879156b0c7937 | keras_preprocessing/image/affine_transformations.py | python | random_brightness | (x, brightness_range, scale=True) | return apply_brightness_shift(x, u, scale) | Performs a random brightness shift.
# Arguments
x: Input tensor. Must be 3D.
brightness_range: Tuple of floats; brightness range.
scale: Whether to rescale the image such that minimum and maximum values
are 0 and 255 respectively.
Default: True.
# Returns
... | Performs a random brightness shift. | [
"Performs",
"a",
"random",
"brightness",
"shift",
"."
] | def random_brightness(x, brightness_range, scale=True):
"""Performs a random brightness shift.
# Arguments
x: Input tensor. Must be 3D.
brightness_range: Tuple of floats; brightness range.
scale: Whether to rescale the image such that minimum and maximum values
are 0 and 255... | [
"def",
"random_brightness",
"(",
"x",
",",
"brightness_range",
",",
"scale",
"=",
"True",
")",
":",
"if",
"len",
"(",
"brightness_range",
")",
"!=",
"2",
":",
"raise",
"ValueError",
"(",
"'`brightness_range should be tuple or list of two floats. '",
"'Received: %s'",
... | https://github.com/keras-team/keras-preprocessing/blob/6701f27afa62712b34a17d4b0ff879156b0c7937/keras_preprocessing/image/affine_transformations.py#L245-L267 | |
google/transitfeed | d727e97cb66ac2ca2d699a382ea1d449ee26c2a1 | transitfeed/serviceperiod.py | python | ServicePeriod.GetCalendarFieldValuesTuple | (self) | Return the tuple of calendar.txt values or None if this ServicePeriod
should not be in calendar.txt . | Return the tuple of calendar.txt values or None if this ServicePeriod
should not be in calendar.txt . | [
"Return",
"the",
"tuple",
"of",
"calendar",
".",
"txt",
"values",
"or",
"None",
"if",
"this",
"ServicePeriod",
"should",
"not",
"be",
"in",
"calendar",
".",
"txt",
"."
] | def GetCalendarFieldValuesTuple(self):
"""Return the tuple of calendar.txt values or None if this ServicePeriod
should not be in calendar.txt ."""
if self.start_date and self.end_date:
return [getattr(self, fn) for fn in self._FIELD_NAMES] | [
"def",
"GetCalendarFieldValuesTuple",
"(",
"self",
")",
":",
"if",
"self",
".",
"start_date",
"and",
"self",
".",
"end_date",
":",
"return",
"[",
"getattr",
"(",
"self",
",",
"fn",
")",
"for",
"fn",
"in",
"self",
".",
"_FIELD_NAMES",
"]"
] | https://github.com/google/transitfeed/blob/d727e97cb66ac2ca2d699a382ea1d449ee26c2a1/transitfeed/serviceperiod.py#L106-L110 | ||
Allen7D/mini-shop-server | 5f3ddd5a4e5e99a1e005f11abc620cefff2493fc | app/api/v1/product.py | python | update_product | (id) | return Success(error_code=1) | 更新商品 | 更新商品 | [
"更新商品"
] | def update_product(id):
'''更新商品'''
return Success(error_code=1) | [
"def",
"update_product",
"(",
"id",
")",
":",
"return",
"Success",
"(",
"error_code",
"=",
"1",
")"
] | https://github.com/Allen7D/mini-shop-server/blob/5f3ddd5a4e5e99a1e005f11abc620cefff2493fc/app/api/v1/product.py#L72-L74 | |
iamteem/redisco | a7ba19ff3c38061d6d8bc0c10fa754baadcfeb91 | redisco/containers.py | python | TypedList.__setitem__ | (self, index, value) | [] | def __setitem__(self, index, value):
self.list[index] = self.typecast_stor(value) | [
"def",
"__setitem__",
"(",
"self",
",",
"index",
",",
"value",
")",
":",
"self",
".",
"list",
"[",
"index",
"]",
"=",
"self",
".",
"typecast_stor",
"(",
"value",
")"
] | https://github.com/iamteem/redisco/blob/a7ba19ff3c38061d6d8bc0c10fa754baadcfeb91/redisco/containers.py#L381-L382 | ||||
timonwong/OmniMarkupPreviewer | 21921ac7a99d2b5924a2219b33679a5b53621392 | OmniMarkupLib/libs/bottle.py | python | BaseRequest.__setitem__ | (self, key, value) | Change an environ value and clear all caches that depend on it. | Change an environ value and clear all caches that depend on it. | [
"Change",
"an",
"environ",
"value",
"and",
"clear",
"all",
"caches",
"that",
"depend",
"on",
"it",
"."
] | def __setitem__(self, key, value):
""" Change an environ value and clear all caches that depend on it. """
if self.environ.get('bottle.request.readonly'):
raise KeyError('The environ dictionary is read-only.')
self.environ[key] = value
todelete = ()
if key == 'wsgi... | [
"def",
"__setitem__",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"if",
"self",
".",
"environ",
".",
"get",
"(",
"'bottle.request.readonly'",
")",
":",
"raise",
"KeyError",
"(",
"'The environ dictionary is read-only.'",
")",
"self",
".",
"environ",
"[",
... | https://github.com/timonwong/OmniMarkupPreviewer/blob/21921ac7a99d2b5924a2219b33679a5b53621392/OmniMarkupLib/libs/bottle.py#L1209-L1226 | ||
Unidata/siphon | d8ede355114801bf7a05db20dfe49ab132723f86 | src/siphon/metadata.py | python | TDSCatalogMetadata.__init__ | (self, element, metadata_in=None) | Initialize a :class:`TDSCatalogMetadata` object.
Parameters
----------
element : :class:`~xml.etree.ElementTree.Element`
An :class:`~xml.etree.ElementTree.Element` representing a metadata node
metadata_in : dict[str, object], optional
Parent metadata to inherit, ... | Initialize a :class:`TDSCatalogMetadata` object. | [
"Initialize",
"a",
":",
"class",
":",
"TDSCatalogMetadata",
"object",
"."
] | def __init__(self, element, metadata_in=None):
"""Initialize a :class:`TDSCatalogMetadata` object.
Parameters
----------
element : :class:`~xml.etree.ElementTree.Element`
An :class:`~xml.etree.ElementTree.Element` representing a metadata node
metadata_in : dict[str, ... | [
"def",
"__init__",
"(",
"self",
",",
"element",
",",
"metadata_in",
"=",
"None",
")",
":",
"self",
".",
"_ct",
"=",
"_ComplexTypes",
"(",
")",
"self",
".",
"_st",
"=",
"_SimpleTypes",
"(",
")",
"self",
".",
"_sts",
"=",
"_SimpleTypes",
".",
"__dict__",... | https://github.com/Unidata/siphon/blob/d8ede355114801bf7a05db20dfe49ab132723f86/src/siphon/metadata.py#L452-L490 | ||
stb-tester/stb-tester | 5b652bd5018360f2352f9bedc5f80ff92e66b2d1 | _stbt/types.py | python | Region.contains | (self, other) | :returns: True if ``other`` (a `Region` or `Position`) is entirely
contained within self. | :returns: True if ``other`` (a `Region` or `Position`) is entirely
contained within self. | [
":",
"returns",
":",
"True",
"if",
"other",
"(",
"a",
"Region",
"or",
"Position",
")",
"is",
"entirely",
"contained",
"within",
"self",
"."
] | def contains(self, other):
"""
:returns: True if ``other`` (a `Region` or `Position`) is entirely
contained within self.
"""
if other is None:
return False
elif all(hasattr(other, a) for a in ("x", "y", "right", "bottom")):
# a Region
... | [
"def",
"contains",
"(",
"self",
",",
"other",
")",
":",
"if",
"other",
"is",
"None",
":",
"return",
"False",
"elif",
"all",
"(",
"hasattr",
"(",
"other",
",",
"a",
")",
"for",
"a",
"in",
"(",
"\"x\"",
",",
"\"y\"",
",",
"\"right\"",
",",
"\"bottom\... | https://github.com/stb-tester/stb-tester/blob/5b652bd5018360f2352f9bedc5f80ff92e66b2d1/_stbt/types.py#L271-L287 | ||
HonglinChu/SiamTrackers | 8471660b14f970578a43f077b28207d44a27e867 | TrTr/TrTr-pysot/trtr/models/backbone/resnet_atrous.py | python | resnet18 | (**kwargs) | return model | Constructs a ResNet-18 model. | Constructs a ResNet-18 model. | [
"Constructs",
"a",
"ResNet",
"-",
"18",
"model",
"."
] | def resnet18(**kwargs):
"""Constructs a ResNet-18 model.
"""
model = ResNet(BasicBlock, [2, 2, 2, 2], **kwargs)
return model | [
"def",
"resnet18",
"(",
"*",
"*",
"kwargs",
")",
":",
"model",
"=",
"ResNet",
"(",
"BasicBlock",
",",
"[",
"2",
",",
"2",
",",
"2",
",",
"2",
"]",
",",
"*",
"*",
"kwargs",
")",
"return",
"model"
] | https://github.com/HonglinChu/SiamTrackers/blob/8471660b14f970578a43f077b28207d44a27e867/TrTr/TrTr-pysot/trtr/models/backbone/resnet_atrous.py#L203-L208 | |
bjmayor/hacker | e3ce2ad74839c2733b27dac6c0f495e0743e1866 | venv/lib/python3.5/site-packages/pkg_resources/_vendor/pyparsing.py | python | ParserElement.transformString | ( self, instring ) | Extension to C{L{scanString}}, to modify matching text with modified tokens that may
be returned from a parse action. To use C{transformString}, define a grammar and
attach a parse action to it that modifies the returned token list.
Invoking C{transformString()} on a target string will then sca... | Extension to C{L{scanString}}, to modify matching text with modified tokens that may
be returned from a parse action. To use C{transformString}, define a grammar and
attach a parse action to it that modifies the returned token list.
Invoking C{transformString()} on a target string will then sca... | [
"Extension",
"to",
"C",
"{",
"L",
"{",
"scanString",
"}}",
"to",
"modify",
"matching",
"text",
"with",
"modified",
"tokens",
"that",
"may",
"be",
"returned",
"from",
"a",
"parse",
"action",
".",
"To",
"use",
"C",
"{",
"transformString",
"}",
"define",
"a... | def transformString( self, instring ):
"""
Extension to C{L{scanString}}, to modify matching text with modified tokens that may
be returned from a parse action. To use C{transformString}, define a grammar and
attach a parse action to it that modifies the returned token list.
Inv... | [
"def",
"transformString",
"(",
"self",
",",
"instring",
")",
":",
"out",
"=",
"[",
"]",
"lastE",
"=",
"0",
"# force preservation of <TAB>s, to minimize unwanted transformation of string, and to",
"# keep string locs straight between transformString and scanString",
"self",
".",
... | https://github.com/bjmayor/hacker/blob/e3ce2ad74839c2733b27dac6c0f495e0743e1866/venv/lib/python3.5/site-packages/pkg_resources/_vendor/pyparsing.py#L1692-L1733 | ||
JiYou/openstack | 8607dd488bde0905044b303eb6e52bdea6806923 | packages/source/quantum/quantum/plugins/nec/ofc_driver_base.py | python | OFCDriverBase.create_tenant | (self, description, tenant_id=None) | Create a new tenant at OpenFlow Controller.
:param description: A description of this tenant.
:param tenant_id: A hint of OFC tenant ID.
A driver could use this id as a OFC id or ignore it.
:returns: ID of the tenant created at OpenFlow Controller.
:raises: qua... | Create a new tenant at OpenFlow Controller. | [
"Create",
"a",
"new",
"tenant",
"at",
"OpenFlow",
"Controller",
"."
] | def create_tenant(self, description, tenant_id=None):
"""Create a new tenant at OpenFlow Controller.
:param description: A description of this tenant.
:param tenant_id: A hint of OFC tenant ID.
A driver could use this id as a OFC id or ignore it.
:returns: ID o... | [
"def",
"create_tenant",
"(",
"self",
",",
"description",
",",
"tenant_id",
"=",
"None",
")",
":",
"pass"
] | https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/quantum/quantum/plugins/nec/ofc_driver_base.py#L32-L41 | ||
jliljebl/flowblade | 995313a509b80e99eb1ad550d945bdda5995093b | flowblade-trunk/Flowblade/propertyeditorbuilder.py | python | _get_fade_length_editor | (editable_property) | return FadeLengthEditor(editable_property) | [] | def _get_fade_length_editor(editable_property):
return FadeLengthEditor(editable_property) | [
"def",
"_get_fade_length_editor",
"(",
"editable_property",
")",
":",
"return",
"FadeLengthEditor",
"(",
"editable_property",
")"
] | https://github.com/jliljebl/flowblade/blob/995313a509b80e99eb1ad550d945bdda5995093b/flowblade-trunk/Flowblade/propertyeditorbuilder.py#L733-L734 | |||
wxWidgets/Phoenix | b2199e299a6ca6d866aa6f3d0888499136ead9d6 | wx/lib/agw/aui/framemanager.py | python | GetToolBarDockOffsets | (docks) | return top_left, bottom_right | Returns the toolbar dock offsets (top-left and bottom-right).
:param `docks`: a list of :class:`AuiDockInfo` to analyze. | Returns the toolbar dock offsets (top-left and bottom-right). | [
"Returns",
"the",
"toolbar",
"dock",
"offsets",
"(",
"top",
"-",
"left",
"and",
"bottom",
"-",
"right",
")",
"."
] | def GetToolBarDockOffsets(docks):
"""
Returns the toolbar dock offsets (top-left and bottom-right).
:param `docks`: a list of :class:`AuiDockInfo` to analyze.
"""
top_left = wx.Size(0, 0)
bottom_right = wx.Size(0, 0)
for dock in docks:
if dock.toolbar:
dock_direction =... | [
"def",
"GetToolBarDockOffsets",
"(",
"docks",
")",
":",
"top_left",
"=",
"wx",
".",
"Size",
"(",
"0",
",",
"0",
")",
"bottom_right",
"=",
"wx",
".",
"Size",
"(",
"0",
",",
"0",
")",
"for",
"dock",
"in",
"docks",
":",
"if",
"dock",
".",
"toolbar",
... | https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/aui/framemanager.py#L3541-L3568 | |
pypa/pipenv | b21baade71a86ab3ee1429f71fbc14d4f95fb75d | pipenv/vendor/plette/lockfiles.py | python | Lockfile.develop | (self, value) | [] | def develop(self, value):
self["develop"] = value | [
"def",
"develop",
"(",
"self",
",",
"value",
")",
":",
"self",
"[",
"\"develop\"",
"]",
"=",
"value"
] | https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/vendor/plette/lockfiles.py#L170-L171 | ||||
NVlabs/neuralrgbd | c8071a0bcbd4c4e7ef95c44e7de9c51353ab9764 | code/mdataloader/kitti.py | python | _read_split_file | ( filepath) | return trajs | Read data split txt file provided by KITTI dataset authors | Read data split txt file provided by KITTI dataset authors | [
"Read",
"data",
"split",
"txt",
"file",
"provided",
"by",
"KITTI",
"dataset",
"authors"
] | def _read_split_file( filepath):
'''
Read data split txt file provided by KITTI dataset authors
'''
with open(filepath) as f:
trajs = f.readlines()
trajs = [ x.strip() for x in trajs ]
return trajs | [
"def",
"_read_split_file",
"(",
"filepath",
")",
":",
"with",
"open",
"(",
"filepath",
")",
"as",
"f",
":",
"trajs",
"=",
"f",
".",
"readlines",
"(",
")",
"trajs",
"=",
"[",
"x",
".",
"strip",
"(",
")",
"for",
"x",
"in",
"trajs",
"]",
"return",
"... | https://github.com/NVlabs/neuralrgbd/blob/c8071a0bcbd4c4e7ef95c44e7de9c51353ab9764/code/mdataloader/kitti.py#L59-L67 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | ansible/roles/lib_openshift_3.2/library/oc_process.py | python | Utils.cleanup | (files) | Clean up on exit | Clean up on exit | [
"Clean",
"up",
"on",
"exit"
] | def cleanup(files):
'''Clean up on exit '''
for sfile in files:
if os.path.exists(sfile):
if os.path.isdir(sfile):
shutil.rmtree(sfile)
elif os.path.isfile(sfile):
os.remove(sfile) | [
"def",
"cleanup",
"(",
"files",
")",
":",
"for",
"sfile",
"in",
"files",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"sfile",
")",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"sfile",
")",
":",
"shutil",
".",
"rmtree",
"(",
"sfile",
... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_openshift_3.2/library/oc_process.py#L311-L318 | ||
Esri/ArcREST | ab240fde2b0200f61d4a5f6df033516e53f2f416 | src/arcrest/ags/layer.py | python | FeatureLayer_Depricated.updateFeature | (self,
features,
gdbVersion=None,
rollbackOnFailure=True) | return res | updates an existing feature in a feature service layer
Input:
feature - feature object(s) to get updated. A single feature
or a list of feature objects can be passed
Output:
dictionary of result messages | updates an existing feature in a feature service layer
Input:
feature - feature object(s) to get updated. A single feature
or a list of feature objects can be passed
Output:
dictionary of result messages | [
"updates",
"an",
"existing",
"feature",
"in",
"a",
"feature",
"service",
"layer",
"Input",
":",
"feature",
"-",
"feature",
"object",
"(",
"s",
")",
"to",
"get",
"updated",
".",
"A",
"single",
"feature",
"or",
"a",
"list",
"of",
"feature",
"objects",
"can... | def updateFeature(self,
features,
gdbVersion=None,
rollbackOnFailure=True):
"""
updates an existing feature in a feature service layer
Input:
feature - feature object(s) to get updated. A single feature
... | [
"def",
"updateFeature",
"(",
"self",
",",
"features",
",",
"gdbVersion",
"=",
"None",
",",
"rollbackOnFailure",
"=",
"True",
")",
":",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
",",
"\"rollbackOnFailure\"",
":",
"rollbackOnFailure",
"}",
"if",
"gdbVersion"... | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/ags/layer.py#L787-L823 | |
gcollazo/BrowserRefresh-Sublime | daee0eda6480c07f8636ed24e5c555d24e088886 | win/pywinauto/controls/common_controls.py | python | ListViewWrapper.Columns | (self) | return cols | Get the information on the columns of the ListView | Get the information on the columns of the ListView | [
"Get",
"the",
"information",
"on",
"the",
"columns",
"of",
"the",
"ListView"
] | def Columns(self):
"Get the information on the columns of the ListView"
cols = []
for i in range(0, self.ColumnCount()):
cols.append(self.GetColumn(i))
return cols | [
"def",
"Columns",
"(",
"self",
")",
":",
"cols",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"self",
".",
"ColumnCount",
"(",
")",
")",
":",
"cols",
".",
"append",
"(",
"self",
".",
"GetColumn",
"(",
"i",
")",
")",
"return",
"cols"... | https://github.com/gcollazo/BrowserRefresh-Sublime/blob/daee0eda6480c07f8636ed24e5c555d24e088886/win/pywinauto/controls/common_controls.py#L281-L288 | |
inkandswitch/livebook | 93c8d467734787366ad084fc3566bf5cbe249c51 | public/pypyjs/modules/numpy/distutils/misc_util.py | python | Configuration.append_to | (self, extlib) | Append libraries, include_dirs to extension or library item. | Append libraries, include_dirs to extension or library item. | [
"Append",
"libraries",
"include_dirs",
"to",
"extension",
"or",
"library",
"item",
"."
] | def append_to(self, extlib):
"""Append libraries, include_dirs to extension or library item.
"""
if is_sequence(extlib):
lib_name, build_info = extlib
dict_append(build_info,
libraries=self.libraries,
include_dirs=self.inclu... | [
"def",
"append_to",
"(",
"self",
",",
"extlib",
")",
":",
"if",
"is_sequence",
"(",
"extlib",
")",
":",
"lib_name",
",",
"build_info",
"=",
"extlib",
"dict_append",
"(",
"build_info",
",",
"libraries",
"=",
"self",
".",
"libraries",
",",
"include_dirs",
"=... | https://github.com/inkandswitch/livebook/blob/93c8d467734787366ad084fc3566bf5cbe249c51/public/pypyjs/modules/numpy/distutils/misc_util.py#L1899-L1911 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.