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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Samsung/cotopaxi | d19178b1235017257fec20d0a41edc918de55574 | cotopaxi/dtls_utils.py | python | scrap_dtls_response | (resp_packet) | return parsed_response | Parse response packet and scraps DTLS response from stdout. | Parse response packet and scraps DTLS response from stdout. | [
"Parse",
"response",
"packet",
"and",
"scraps",
"DTLS",
"response",
"from",
"stdout",
"."
] | def scrap_dtls_response(resp_packet):
"""Parse response packet and scraps DTLS response from stdout."""
save_stdout, sys.stdout = sys.stdout, StringIO()
resp_packet.show()
parsed_response = sys.stdout.getvalue()
sys.stdout = save_stdout
parsed_response = (
"len(parsed_response): {}\n".fo... | [
"def",
"scrap_dtls_response",
"(",
"resp_packet",
")",
":",
"save_stdout",
",",
"sys",
".",
"stdout",
"=",
"sys",
".",
"stdout",
",",
"StringIO",
"(",
")",
"resp_packet",
".",
"show",
"(",
")",
"parsed_response",
"=",
"sys",
".",
"stdout",
".",
"getvalue",... | https://github.com/Samsung/cotopaxi/blob/d19178b1235017257fec20d0a41edc918de55574/cotopaxi/dtls_utils.py#L155-L164 | |
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-linux/x64/PIL/ImageFilter.py | python | Color3DLUT.__repr__ | (self) | return "<{}>".format(" ".join(r)) | [] | def __repr__(self):
r = [
"{} from {}".format(self.__class__.__name__, self.table.__class__.__name__),
"size={:d}x{:d}x{:d}".format(*self.size),
"channels={:d}".format(self.channels),
]
if self.mode:
r.append("target_mode={}".format(self.mode))
... | [
"def",
"__repr__",
"(",
"self",
")",
":",
"r",
"=",
"[",
"\"{} from {}\"",
".",
"format",
"(",
"self",
".",
"__class__",
".",
"__name__",
",",
"self",
".",
"table",
".",
"__class__",
".",
"__name__",
")",
",",
"\"size={:d}x{:d}x{:d}\"",
".",
"format",
"(... | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-linux/x64/PIL/ImageFilter.py#L514-L522 | |||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/distutils/command/build_ext.py | python | build_ext.build_extension | (self, ext) | [] | def build_extension(self, ext):
sources = ext.sources
if sources is None or type(sources) not in (ListType, TupleType):
raise DistutilsSetupError, \
("in 'ext_modules' option (extension '%s'), " +
"'sources' must be present and must be " +
... | [
"def",
"build_extension",
"(",
"self",
",",
"ext",
")",
":",
"sources",
"=",
"ext",
".",
"sources",
"if",
"sources",
"is",
"None",
"or",
"type",
"(",
"sources",
")",
"not",
"in",
"(",
"ListType",
",",
"TupleType",
")",
":",
"raise",
"DistutilsSetupError"... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/distutils/command/build_ext.py#L448-L528 | ||||
dhtech/swboot | b741e8f90f3941a7619e12addf337bed1d299204 | http/server.py | python | BaseHTTPRequestHandler.send_header | (self, keyword, value) | Send a MIME header to the headers buffer. | Send a MIME header to the headers buffer. | [
"Send",
"a",
"MIME",
"header",
"to",
"the",
"headers",
"buffer",
"."
] | def send_header(self, keyword, value):
"""Send a MIME header to the headers buffer."""
if self.request_version != 'HTTP/0.9':
if not hasattr(self, '_headers_buffer'):
self._headers_buffer = []
self._headers_buffer.append(
("%s: %s\r\n" % (keyword, ... | [
"def",
"send_header",
"(",
"self",
",",
"keyword",
",",
"value",
")",
":",
"if",
"self",
".",
"request_version",
"!=",
"'HTTP/0.9'",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_headers_buffer'",
")",
":",
"self",
".",
"_headers_buffer",
"=",
"[",
"... | https://github.com/dhtech/swboot/blob/b741e8f90f3941a7619e12addf337bed1d299204/http/server.py#L510-L522 | ||
jython/jython3 | def4f8ec47cb7a9c799ea4c745f12badf92c5769 | Lib/socketserver.py | python | BaseServer.serve_forever | (self, poll_interval=0.5) | Handle one request at a time until shutdown.
Polls for shutdown every poll_interval seconds. Ignores
self.timeout. If you need to do periodic tasks, do them in
another thread. | Handle one request at a time until shutdown. | [
"Handle",
"one",
"request",
"at",
"a",
"time",
"until",
"shutdown",
"."
] | def serve_forever(self, poll_interval=0.5):
"""Handle one request at a time until shutdown.
Polls for shutdown every poll_interval seconds. Ignores
self.timeout. If you need to do periodic tasks, do them in
another thread.
"""
self.__is_shut_down.clear()
try:
... | [
"def",
"serve_forever",
"(",
"self",
",",
"poll_interval",
"=",
"0.5",
")",
":",
"self",
".",
"__is_shut_down",
".",
"clear",
"(",
")",
"try",
":",
"while",
"not",
"self",
".",
"__shutdown_request",
":",
"# XXX: Consider using another file descriptor or",
"# conne... | https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/Lib/socketserver.py#L221-L241 | ||
FrancoisSchnell/GPicSync | 07d7c4b7da44e4e6665abb94bbb9ef6da0e779d1 | src/geoexif.py | python | GeoExif.readLatLong | (self) | return latlong | read latitude AND longitude at the same time | read latitude AND longitude at the same time | [
"read",
"latitude",
"AND",
"longitude",
"at",
"the",
"same",
"time"
] | def readLatLong(self):
"""read latitude AND longitude at the same time"""
result=os.popen('%s -n -GPSLatitude -GPSLatitudeRef \
-GPSLongitude -GPSLongitudeRef "%s" ' \
% (self.exifcmd, self.picPath)).read().split("\n")
print (result)
if len(result)>=4:
resu... | [
"def",
"readLatLong",
"(",
"self",
")",
":",
"result",
"=",
"os",
".",
"popen",
"(",
"'%s -n -GPSLatitude -GPSLatitudeRef \\\n -GPSLongitude -GPSLongitudeRef \"%s\" '",
"%",
"(",
"self",
".",
"exifcmd",
",",
"self",
".",
"picPath",
")",
")",
".",
"read",
... | https://github.com/FrancoisSchnell/GPicSync/blob/07d7c4b7da44e4e6665abb94bbb9ef6da0e779d1/src/geoexif.py#L102-L127 | |
google/tangent | 6533e83af09de7345d1b438512679992f080dcc9 | tangent/reverse_ad.py | python | ReverseAD.visit_With | (self, node) | Deal with the special with insert_grad_of(x) statement. | Deal with the special with insert_grad_of(x) statement. | [
"Deal",
"with",
"the",
"special",
"with",
"insert_grad_of",
"(",
"x",
")",
"statement",
"."
] | def visit_With(self, node):
"""Deal with the special with insert_grad_of(x) statement."""
if ast_.is_insert_grad_of_statement(node):
primal = []
adjoint = node.body
if isinstance(adjoint[0], gast.With):
_, adjoint = self.visit(adjoint[0])
node.body[0] = comments.add_comment(node.... | [
"def",
"visit_With",
"(",
"self",
",",
"node",
")",
":",
"if",
"ast_",
".",
"is_insert_grad_of_statement",
"(",
"node",
")",
":",
"primal",
"=",
"[",
"]",
"adjoint",
"=",
"node",
".",
"body",
"if",
"isinstance",
"(",
"adjoint",
"[",
"0",
"]",
",",
"g... | https://github.com/google/tangent/blob/6533e83af09de7345d1b438512679992f080dcc9/tangent/reverse_ad.py#L376-L395 | ||
jython/frozen-mirror | b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99 | lib-python/2.7/pydoc.py | python | classname | (object, modname) | return name | Get a class name and qualify it with a module name if necessary. | Get a class name and qualify it with a module name if necessary. | [
"Get",
"a",
"class",
"name",
"and",
"qualify",
"it",
"with",
"a",
"module",
"name",
"if",
"necessary",
"."
] | def classname(object, modname):
"""Get a class name and qualify it with a module name if necessary."""
name = object.__name__
if object.__module__ != modname:
name = object.__module__ + '.' + name
return name | [
"def",
"classname",
"(",
"object",
",",
"modname",
")",
":",
"name",
"=",
"object",
".",
"__name__",
"if",
"object",
".",
"__module__",
"!=",
"modname",
":",
"name",
"=",
"object",
".",
"__module__",
"+",
"'.'",
"+",
"name",
"return",
"name"
] | https://github.com/jython/frozen-mirror/blob/b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99/lib-python/2.7/pydoc.py#L95-L100 | |
aws/serverless-application-model | ab6943a340a3f489af62b8c70c1366242b2887fe | samtranslator/model/preferences/deployment_preference_collection.py | python | DeploymentPreferenceCollection.add | (self, logical_id, deployment_preference_dict) | Add this deployment preference to the collection
:raise ValueError if an existing logical id already exists in the _resource_preferences
:param logical_id: logical id of the resource where this deployment preference applies
:param deployment_preference_dict: the input SAM template deployment pr... | Add this deployment preference to the collection | [
"Add",
"this",
"deployment",
"preference",
"to",
"the",
"collection"
] | def add(self, logical_id, deployment_preference_dict):
"""
Add this deployment preference to the collection
:raise ValueError if an existing logical id already exists in the _resource_preferences
:param logical_id: logical id of the resource where this deployment preference applies
... | [
"def",
"add",
"(",
"self",
",",
"logical_id",
",",
"deployment_preference_dict",
")",
":",
"if",
"logical_id",
"in",
"self",
".",
"_resource_preferences",
":",
"raise",
"ValueError",
"(",
"\"logical_id {logical_id} previously added to this deployment_preference_collection\"",... | https://github.com/aws/serverless-application-model/blob/ab6943a340a3f489af62b8c70c1366242b2887fe/samtranslator/model/preferences/deployment_preference_collection.py#L51-L66 | ||
deepgully/me | f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0 | libs/alembic/config.py | python | Config.get_template_directory | (self) | return os.path.join(package_dir, 'templates') | Return the directory where Alembic setup templates are found.
This method is used by the alembic ``init`` and ``list_templates``
commands. | Return the directory where Alembic setup templates are found. | [
"Return",
"the",
"directory",
"where",
"Alembic",
"setup",
"templates",
"are",
"found",
"."
] | def get_template_directory(self):
"""Return the directory where Alembic setup templates are found.
This method is used by the alembic ``init`` and ``list_templates``
commands.
"""
return os.path.join(package_dir, 'templates') | [
"def",
"get_template_directory",
"(",
"self",
")",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"package_dir",
",",
"'templates'",
")"
] | https://github.com/deepgully/me/blob/f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0/libs/alembic/config.py#L100-L107 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_openshift/library/oc_image.py | python | OCImage.get | (self) | return results | return a image by name | return a image by name | [
"return",
"a",
"image",
"by",
"name"
] | def get(self):
'''return a image by name '''
results = self._get('imagestream', self.image_name)
results['exists'] = False
if results['returncode'] == 0 and results['results'][0]:
results['exists'] = True
if results['returncode'] != 0 and '"{}" not found'.format(self... | [
"def",
"get",
"(",
"self",
")",
":",
"results",
"=",
"self",
".",
"_get",
"(",
"'imagestream'",
",",
"self",
".",
"image_name",
")",
"results",
"[",
"'exists'",
"]",
"=",
"False",
"if",
"results",
"[",
"'returncode'",
"]",
"==",
"0",
"and",
"results",
... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_openshift/library/oc_image.py#L1486-L1496 | |
threat9/routersploit | 3fd394637f5566c4cf6369eecae08c4d27f93cda | routersploit/core/exploit/utils.py | python | iter_modules | (modules_directory: str = MODULES_DIR) | Iterates over valid modules
:param str modules_directory: path to modules directory
:return list: list of found modules | Iterates over valid modules | [
"Iterates",
"over",
"valid",
"modules"
] | def iter_modules(modules_directory: str = MODULES_DIR) -> list:
""" Iterates over valid modules
:param str modules_directory: path to modules directory
:return list: list of found modules
"""
modules = index_modules(modules_directory)
modules = map(lambda x: "".join(["routersploit.modules.", x... | [
"def",
"iter_modules",
"(",
"modules_directory",
":",
"str",
"=",
"MODULES_DIR",
")",
"->",
"list",
":",
"modules",
"=",
"index_modules",
"(",
"modules_directory",
")",
"modules",
"=",
"map",
"(",
"lambda",
"x",
":",
"\"\"",
".",
"join",
"(",
"[",
"\"route... | https://github.com/threat9/routersploit/blob/3fd394637f5566c4cf6369eecae08c4d27f93cda/routersploit/core/exploit/utils.py#L128-L138 | ||
open-io/oio-sds | 16041950b6056a55d5ce7ca77795defe6dfa6c61 | oio/xcute/server.py | python | XcuteServer._get_job_id | (self, req) | return job_id | Fetch job ID from request query string. | Fetch job ID from request query string. | [
"Fetch",
"job",
"ID",
"from",
"request",
"query",
"string",
"."
] | def _get_job_id(self, req):
"""Fetch job ID from request query string."""
job_id = req.args.get('id')
if not job_id:
raise HTTPBadRequest('Missing job ID')
return job_id | [
"def",
"_get_job_id",
"(",
"self",
",",
"req",
")",
":",
"job_id",
"=",
"req",
".",
"args",
".",
"get",
"(",
"'id'",
")",
"if",
"not",
"job_id",
":",
"raise",
"HTTPBadRequest",
"(",
"'Missing job ID'",
")",
"return",
"job_id"
] | https://github.com/open-io/oio-sds/blob/16041950b6056a55d5ce7ca77795defe6dfa6c61/oio/xcute/server.py#L123-L128 | |
Chaosthebot/Chaos | 0cfbb85ab52654967909aef54eff3a0e62b641bd | twitter_api/__init__.py | python | API_TWITTER.GetApi | (self) | return self.__api | [] | def GetApi(self):
return self.__api | [
"def",
"GetApi",
"(",
"self",
")",
":",
"return",
"self",
".",
"__api"
] | https://github.com/Chaosthebot/Chaos/blob/0cfbb85ab52654967909aef54eff3a0e62b641bd/twitter_api/__init__.py#L16-L17 | |||
pyRiemann/pyRiemann | 30c2cd7204d19f1a60d3b7945dfd8ee3c46a8df8 | pyriemann/utils/ajd.py | python | uwedge | (X, init=None, eps=1e-7, n_iter_max=100) | return W_est, D | Approximate joint diagonalization algorithm UWEDGE.
Uniformly Weighted Exhaustive Diagonalization using Gauss iteration
(U-WEDGE). Implementation of the AJD algorithm by Tichavsky and
Yeredor [1]_ [2]_. This is a translation from the matlab code provided
by the authors.
Parameters
----------
... | Approximate joint diagonalization algorithm UWEDGE. | [
"Approximate",
"joint",
"diagonalization",
"algorithm",
"UWEDGE",
"."
] | def uwedge(X, init=None, eps=1e-7, n_iter_max=100):
"""Approximate joint diagonalization algorithm UWEDGE.
Uniformly Weighted Exhaustive Diagonalization using Gauss iteration
(U-WEDGE). Implementation of the AJD algorithm by Tichavsky and
Yeredor [1]_ [2]_. This is a translation from the matlab code pr... | [
"def",
"uwedge",
"(",
"X",
",",
"init",
"=",
"None",
",",
"eps",
"=",
"1e-7",
",",
"n_iter_max",
"=",
"100",
")",
":",
"L",
",",
"d",
",",
"_",
"=",
"X",
".",
"shape",
"# reshape input matrix",
"M",
"=",
"np",
".",
"concatenate",
"(",
"X",
",",
... | https://github.com/pyRiemann/pyRiemann/blob/30c2cd7204d19f1a60d3b7945dfd8ee3c46a8df8/pyriemann/utils/ajd.py#L204-L303 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/xml/sax/xmlreader.py | python | AttributesImpl.getType | (self, name) | return "CDATA" | [] | def getType(self, name):
return "CDATA" | [
"def",
"getType",
"(",
"self",
",",
"name",
")",
":",
"return",
"\"CDATA\""
] | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/xml/sax/xmlreader.py#L287-L288 | |||
OpenEndedGroup/Field | 4f7c8edfb01bb0ccc927b78d3c500f018a4ae37c | Contents/lib/python/logging/__init__.py | python | info | (msg, *args, **kwargs) | Log a message with severity 'INFO' on the root logger. | Log a message with severity 'INFO' on the root logger. | [
"Log",
"a",
"message",
"with",
"severity",
"INFO",
"on",
"the",
"root",
"logger",
"."
] | def info(msg, *args, **kwargs):
"""
Log a message with severity 'INFO' on the root logger.
"""
if len(root.handlers) == 0:
basicConfig()
apply(root.info, (msg,)+args, kwargs) | [
"def",
"info",
"(",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"len",
"(",
"root",
".",
"handlers",
")",
"==",
"0",
":",
"basicConfig",
"(",
")",
"apply",
"(",
"root",
".",
"info",
",",
"(",
"msg",
",",
")",
"+",
"args"... | https://github.com/OpenEndedGroup/Field/blob/4f7c8edfb01bb0ccc927b78d3c500f018a4ae37c/Contents/lib/python/logging/__init__.py#L1313-L1319 | ||
landlab/landlab | a5dd80b8ebfd03d1ba87ef6c4368c409485f222c | landlab/grid/voronoi.py | python | simple_poly_area | (x, y) | return 0.5 * abs(sum(x[:-1] * y[1:] - x[1:] * y[:-1]) + x[-1] * y[0] - x[0] * y[-1]) | Calculates and returns the area of a 2-D simple polygon.
Input vertices must be in sequence (clockwise or counterclockwise). *x*
and *y* are arrays that give the x- and y-axis coordinates of the
polygon's vertices.
Parameters
----------
x : ndarray
x-coordinates of of polygon vertices.... | Calculates and returns the area of a 2-D simple polygon. | [
"Calculates",
"and",
"returns",
"the",
"area",
"of",
"a",
"2",
"-",
"D",
"simple",
"polygon",
"."
] | def simple_poly_area(x, y):
"""Calculates and returns the area of a 2-D simple polygon.
Input vertices must be in sequence (clockwise or counterclockwise). *x*
and *y* are arrays that give the x- and y-axis coordinates of the
polygon's vertices.
Parameters
----------
x : ndarray
x-... | [
"def",
"simple_poly_area",
"(",
"x",
",",
"y",
")",
":",
"# For short arrays (less than about 100 elements) it seems that the",
"# Python sum is faster than the numpy sum. Likewise for the Python",
"# built-in abs.",
"return",
"0.5",
"*",
"abs",
"(",
"sum",
"(",
"x",
"[",
":"... | https://github.com/landlab/landlab/blob/a5dd80b8ebfd03d1ba87ef6c4368c409485f222c/landlab/grid/voronoi.py#L15-L57 | |
lovelylain/pyctp | fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d | option/ctp/ApiStruct.py | python | OptionInstrMarginAdjust.__init__ | (self, InstrumentID='', InvestorRange=IR_All, BrokerID='', InvestorID='', SShortMarginRatioByMoney=0.0, SShortMarginRatioByVolume=0.0, HShortMarginRatioByMoney=0.0, HShortMarginRatioByVolume=0.0, AShortMarginRatioByMoney=0.0, AShortMarginRatioByVolume=0.0, IsRelative=0, ExchangeID='') | [] | def __init__(self, InstrumentID='', InvestorRange=IR_All, BrokerID='', InvestorID='', SShortMarginRatioByMoney=0.0, SShortMarginRatioByVolume=0.0, HShortMarginRatioByMoney=0.0, HShortMarginRatioByVolume=0.0, AShortMarginRatioByMoney=0.0, AShortMarginRatioByVolume=0.0, IsRelative=0, ExchangeID=''):
self.Instrume... | [
"def",
"__init__",
"(",
"self",
",",
"InstrumentID",
"=",
"''",
",",
"InvestorRange",
"=",
"IR_All",
",",
"BrokerID",
"=",
"''",
",",
"InvestorID",
"=",
"''",
",",
"SShortMarginRatioByMoney",
"=",
"0.0",
",",
"SShortMarginRatioByVolume",
"=",
"0.0",
",",
"HS... | https://github.com/lovelylain/pyctp/blob/fd304de4b50c4ddc31a4190b1caaeb5dec66bc5d/option/ctp/ApiStruct.py#L3299-L3311 | ||||
collinsctk/PyQYT | 7af3673955f94ff1b2df2f94220cd2dab2e252af | ExtentionPackages/scapy/layers/l2.py | python | arpcachepoison | (target, victim, interval=60) | Poison target's cache with (your MAC,victim's IP) couple
arpcachepoison(target, victim, [interval=60]) -> None | Poison target's cache with (your MAC,victim's IP) couple
arpcachepoison(target, victim, [interval=60]) -> None | [
"Poison",
"target",
"s",
"cache",
"with",
"(",
"your",
"MAC",
"victim",
"s",
"IP",
")",
"couple",
"arpcachepoison",
"(",
"target",
"victim",
"[",
"interval",
"=",
"60",
"]",
")",
"-",
">",
"None"
] | def arpcachepoison(target, victim, interval=60):
"""Poison target's cache with (your MAC,victim's IP) couple
arpcachepoison(target, victim, [interval=60]) -> None
"""
tmac = getmacbyip(target)
p = Ether(dst=tmac)/ARP(op="who-has", psrc=victim, pdst=target)
try:
while 1:
sendp(p, ifac... | [
"def",
"arpcachepoison",
"(",
"target",
",",
"victim",
",",
"interval",
"=",
"60",
")",
":",
"tmac",
"=",
"getmacbyip",
"(",
"target",
")",
"p",
"=",
"Ether",
"(",
"dst",
"=",
"tmac",
")",
"/",
"ARP",
"(",
"op",
"=",
"\"who-has\"",
",",
"psrc",
"="... | https://github.com/collinsctk/PyQYT/blob/7af3673955f94ff1b2df2f94220cd2dab2e252af/ExtentionPackages/scapy/layers/l2.py#L438-L451 | ||
jh0ker/mau_mau_bot | 4021c1483e8bf0bc3f8c08fac6200345a15e6631 | utils.py | python | error | (bot, update, error) | Simple error handler | Simple error handler | [
"Simple",
"error",
"handler"
] | def error(bot, update, error):
"""Simple error handler"""
logger.exception(error) | [
"def",
"error",
"(",
"bot",
",",
"update",
",",
"error",
")",
":",
"logger",
".",
"exception",
"(",
"error",
")"
] | https://github.com/jh0ker/mau_mau_bot/blob/4021c1483e8bf0bc3f8c08fac6200345a15e6631/utils.py#L80-L82 | ||
wistbean/learn_python3_spider | 73c873f4845f4385f097e5057407d03dd37a117b | stackoverflow/venv/lib/python3.6/site-packages/twisted/mail/relay.py | python | ESMTPRelayer.__init__ | (self, messagePaths, *args, **kw) | @type messagePaths: L{list} of L{bytes}
@param messagePaths: The base filename for each message to be relayed.
@type args: 3-L{tuple} of (0) L{bytes}, (1) L{None} or
L{ClientContextFactory
<twisted.internet.ssl.ClientContextFactory>},
(2) L{bytes} or 4-L{tuple} of (0... | @type messagePaths: L{list} of L{bytes}
@param messagePaths: The base filename for each message to be relayed. | [
"@type",
"messagePaths",
":",
"L",
"{",
"list",
"}",
"of",
"L",
"{",
"bytes",
"}",
"@param",
"messagePaths",
":",
"The",
"base",
"filename",
"for",
"each",
"message",
"to",
"be",
"relayed",
"."
] | def __init__(self, messagePaths, *args, **kw):
"""
@type messagePaths: L{list} of L{bytes}
@param messagePaths: The base filename for each message to be relayed.
@type args: 3-L{tuple} of (0) L{bytes}, (1) L{None} or
L{ClientContextFactory
<twisted.internet.ssl.C... | [
"def",
"__init__",
"(",
"self",
",",
"messagePaths",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"smtp",
".",
"ESMTPClient",
".",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
"self",
".",
"loadMessages",
"(",
"messagePa... | https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/twisted/mail/relay.py#L162-L180 | ||
kamalkraj/ALBERT-TF2.0 | 8d0cc211361e81a648bf846d8ec84225273db0e4 | tokenization.py | python | _is_whitespace | (char) | return False | Checks whether `chars` is a whitespace character. | Checks whether `chars` is a whitespace character. | [
"Checks",
"whether",
"chars",
"is",
"a",
"whitespace",
"character",
"."
] | def _is_whitespace(char):
"""Checks whether `chars` is a whitespace character."""
# \t, \n, and \r are technically control characters but we treat them
# as whitespace since they are generally considered as such.
if char == " " or char == "\t" or char == "\n" or char == "\r":
return True
cat = unicodedata... | [
"def",
"_is_whitespace",
"(",
"char",
")",
":",
"# \\t, \\n, and \\r are technically control characters but we treat them",
"# as whitespace since they are generally considered as such.",
"if",
"char",
"==",
"\" \"",
"or",
"char",
"==",
"\"\\t\"",
"or",
"char",
"==",
"\"\\n\"",... | https://github.com/kamalkraj/ALBERT-TF2.0/blob/8d0cc211361e81a648bf846d8ec84225273db0e4/tokenization.py#L462-L471 | |
Tencent/GAutomator | 0ac9f849d1ca2c59760a91c5c94d3db375a380cd | GAutomatorIos/build/lib/ga2/engine/unityEngine.py | python | UnityEngine.get_element_text | (self, element) | return ret | 获取GameObject文字信息
NGUI控件则获取UILable、UIInput、GUIText组件上的文字信息
UGUI控件则获取Text、GUIText组件上的问题信息
:param element: 查找到的GameObject
:Usage:
>>>element=engine.find_element('/Canvas/Panel/Button')
>>>text=engine.get_element_text(element)
:return:文字内容
:ra... | 获取GameObject文字信息
NGUI控件则获取UILable、UIInput、GUIText组件上的文字信息
UGUI控件则获取Text、GUIText组件上的问题信息
:param element: 查找到的GameObject | [
"获取GameObject文字信息",
"NGUI控件则获取UILable、UIInput、GUIText组件上的文字信息",
"UGUI控件则获取Text、GUIText组件上的问题信息",
":",
"param",
"element",
":",
"查找到的GameObject"
] | def get_element_text(self, element):
"""
获取GameObject文字信息
NGUI控件则获取UILable、UIInput、GUIText组件上的文字信息
UGUI控件则获取Text、GUIText组件上的问题信息
:param element: 查找到的GameObject
:Usage:
>>>element=engine.find_element('/Canvas/Panel/Button')
>>>text=engi... | [
"def",
"get_element_text",
"(",
"self",
",",
"element",
")",
":",
"if",
"element",
"is",
"None",
":",
"raise",
"WeTestInvaildArg",
"(",
"\"Invalid Instance\"",
")",
"ret",
"=",
"self",
".",
"socket",
".",
"send_command",
"(",
"Commands",
".",
"GET_ELEMENT_TEXT... | https://github.com/Tencent/GAutomator/blob/0ac9f849d1ca2c59760a91c5c94d3db375a380cd/GAutomatorIos/build/lib/ga2/engine/unityEngine.py#L126-L142 | |
pypa/pip | 7f8a6844037fb7255cfd0d34ff8e8cf44f2598d4 | src/pip/_vendor/rich/markup.py | python | escape | (
markup: str, _escape: _EscapeSubMethod = re.compile(r"(\\*)(\[[a-z#\/].*?\])").sub
) | return markup | Escapes text so that it won't be interpreted as markup.
Args:
markup (str): Content to be inserted in to markup.
Returns:
str: Markup with square brackets escaped. | Escapes text so that it won't be interpreted as markup. | [
"Escapes",
"text",
"so",
"that",
"it",
"won",
"t",
"be",
"interpreted",
"as",
"markup",
"."
] | def escape(
markup: str, _escape: _EscapeSubMethod = re.compile(r"(\\*)(\[[a-z#\/].*?\])").sub
) -> str:
"""Escapes text so that it won't be interpreted as markup.
Args:
markup (str): Content to be inserted in to markup.
Returns:
str: Markup with square brackets escaped.
"""
d... | [
"def",
"escape",
"(",
"markup",
":",
"str",
",",
"_escape",
":",
"_EscapeSubMethod",
"=",
"re",
".",
"compile",
"(",
"r\"(\\\\*)(\\[[a-z#\\/].*?\\])\"",
")",
".",
"sub",
")",
"->",
"str",
":",
"def",
"escape_backslashes",
"(",
"match",
":",
"Match",
"[",
"... | https://github.com/pypa/pip/blob/7f8a6844037fb7255cfd0d34ff8e8cf44f2598d4/src/pip/_vendor/rich/markup.py#L49-L67 | |
inducer/pycuda | 9f3b898ec0846e2a4dff5077d4403ea03b1fccf9 | pycuda/driver.py | python | Out.post_call | (self, stream) | [] | def post_call(self, stream):
if stream is not None:
memcpy_dtoh(self.array, self.get_device_alloc())
else:
memcpy_dtoh(self.array, self.get_device_alloc()) | [
"def",
"post_call",
"(",
"self",
",",
"stream",
")",
":",
"if",
"stream",
"is",
"not",
"None",
":",
"memcpy_dtoh",
"(",
"self",
".",
"array",
",",
"self",
".",
"get_device_alloc",
"(",
")",
")",
"else",
":",
"memcpy_dtoh",
"(",
"self",
".",
"array",
... | https://github.com/inducer/pycuda/blob/9f3b898ec0846e2a4dff5077d4403ea03b1fccf9/pycuda/driver.py#L151-L155 | ||||
DetectionTeamUCAS/RetinaNet_Tensorflow_Rotation | ee5e8b6a1ac9fa51dfa5b9a5c40a663927b2ac53 | data/io/read_tfrecord.py | python | read_and_prepocess_single_img | (filename_queue, shortside_len, is_training) | return img_name, img, gtboxes_and_label, num_objects | [] | def read_and_prepocess_single_img(filename_queue, shortside_len, is_training):
img_name, img, gtboxes_and_label, num_objects = read_single_example_and_decode(filename_queue)
img = tf.cast(img, tf.float32)
if is_training:
img, gtboxes_and_label = image_preprocess.short_side_resize(img_tensor=img, ... | [
"def",
"read_and_prepocess_single_img",
"(",
"filename_queue",
",",
"shortside_len",
",",
"is_training",
")",
":",
"img_name",
",",
"img",
",",
"gtboxes_and_label",
",",
"num_objects",
"=",
"read_single_example_and_decode",
"(",
"filename_queue",
")",
"img",
"=",
"tf"... | https://github.com/DetectionTeamUCAS/RetinaNet_Tensorflow_Rotation/blob/ee5e8b6a1ac9fa51dfa5b9a5c40a663927b2ac53/data/io/read_tfrecord.py#L46-L67 | |||
pjkundert/cpppo | 4c217b6c06b88bede3888cc5ea2731f271a95086 | server/network.py | python | bench | ( server_func, client_func, client_count,
server_kwds=None, client_kwds=None, client_max=10, server_join_timeout=1.0 ) | Bench-test the server_func (with optional keyword args from server_kwds) as a process; will fail
if one already bound to port. Creates a thread pool (default 10) of client_func. Each client
is supplied a unique number argument, and the supplied client_kwds as keywords, and should
return 0 on success, !0 o... | Bench-test the server_func (with optional keyword args from server_kwds) as a process; will fail
if one already bound to port. Creates a thread pool (default 10) of client_func. Each client
is supplied a unique number argument, and the supplied client_kwds as keywords, and should
return 0 on success, !0 o... | [
"Bench",
"-",
"test",
"the",
"server_func",
"(",
"with",
"optional",
"keyword",
"args",
"from",
"server_kwds",
")",
"as",
"a",
"process",
";",
"will",
"fail",
"if",
"one",
"already",
"bound",
"to",
"port",
".",
"Creates",
"a",
"thread",
"pool",
"(",
"def... | def bench( server_func, client_func, client_count,
server_kwds=None, client_kwds=None, client_max=10, server_join_timeout=1.0 ):
"""Bench-test the server_func (with optional keyword args from server_kwds) as a process; will fail
if one already bound to port. Creates a thread pool (default 10) of cli... | [
"def",
"bench",
"(",
"server_func",
",",
"client_func",
",",
"client_count",
",",
"server_kwds",
"=",
"None",
",",
"client_kwds",
"=",
"None",
",",
"client_max",
"=",
"10",
",",
"server_join_timeout",
"=",
"1.0",
")",
":",
"# Either multiprocessing.Process or thre... | https://github.com/pjkundert/cpppo/blob/4c217b6c06b88bede3888cc5ea2731f271a95086/server/network.py#L429-L497 | ||
deepmind/dm_control | 806a10e896e7c887635328bfa8352604ad0fedae | dm_control/locomotion/props/target_sphere.py | python | TargetSphere.geom | (self) | return self._geom | [] | def geom(self):
return self._geom | [
"def",
"geom",
"(",
"self",
")",
":",
"return",
"self",
".",
"_geom"
] | https://github.com/deepmind/dm_control/blob/806a10e896e7c887635328bfa8352604ad0fedae/dm_control/locomotion/props/target_sphere.py#L68-L69 | |||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_utils/src/class/yedit.py | python | Yedit.append | (self, path, value) | return (True, self.yaml_dict) | append value to a list | append value to a list | [
"append",
"value",
"to",
"a",
"list"
] | def append(self, path, value):
'''append value to a list'''
try:
entry = Yedit.get_entry(self.yaml_dict, path, self.separator)
except KeyError:
entry = None
if entry is None:
self.put(path, [])
entry = Yedit.get_entry(self.yaml_dict, path,... | [
"def",
"append",
"(",
"self",
",",
"path",
",",
"value",
")",
":",
"try",
":",
"entry",
"=",
"Yedit",
".",
"get_entry",
"(",
"self",
".",
"yaml_dict",
",",
"path",
",",
"self",
".",
"separator",
")",
"except",
"KeyError",
":",
"entry",
"=",
"None",
... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_utils/src/class/yedit.py#L392-L409 | |
arizvisa/ida-minsc | 8627a60f047b5e55d3efeecde332039cd1a16eea | base/structure.py | python | member_t.__unicode__ | (self) | return u"<member '{:s}' index={:d} offset={:-#x} size={:+#x}{:s}>{:s}".format(utils.string.escape(name, '\''), self.index, self.offset, self.size, " typeinfo='{:s}'".format(typeinfo) if len("{:s}".format(typeinfo)) else '', " // {!s}".format(utils.string.repr(tag) if '\n' in comment else utils.string.to(comment)) if co... | Render the current member in a readable format. | Render the current member in a readable format. | [
"Render",
"the",
"current",
"member",
"in",
"a",
"readable",
"format",
"."
] | def __unicode__(self):
'''Render the current member in a readable format.'''
id, name, typ, comment, tag, typeinfo = self.id, self.fullname, self.type, self.comment or '', self.tag(), "{!s}".format(self.typeinfo.dstr()).replace(' *', '*')
return u"<member '{:s}' index={:d} offset={:-#x} size={:+... | [
"def",
"__unicode__",
"(",
"self",
")",
":",
"id",
",",
"name",
",",
"typ",
",",
"comment",
",",
"tag",
",",
"typeinfo",
"=",
"self",
".",
"id",
",",
"self",
".",
"fullname",
",",
"self",
".",
"type",
",",
"self",
".",
"comment",
"or",
"''",
",",... | https://github.com/arizvisa/ida-minsc/blob/8627a60f047b5e55d3efeecde332039cd1a16eea/base/structure.py#L2267-L2270 | |
mittagessen/kraken | 9882ba0743797a2d5b0a7b562fcc7235e87323da | kraken/lib/codec.py | python | PytorchCodec.merge | (self, codec: 'PytorchCodec') | return PytorchCodec(c2l_cand, self.strict), set(rm_labels) | Transforms this codec (c1) into another (c2) reusing as many labels as
possible.
The resulting codec is able to encode the same code point sequences
while not necessarily having the same labels for them as c2.
Retains matching character -> label mappings from both codecs, removes
... | Transforms this codec (c1) into another (c2) reusing as many labels as
possible. | [
"Transforms",
"this",
"codec",
"(",
"c1",
")",
"into",
"another",
"(",
"c2",
")",
"reusing",
"as",
"many",
"labels",
"as",
"possible",
"."
] | def merge(self, codec: 'PytorchCodec') -> Tuple['PytorchCodec', Set]:
"""
Transforms this codec (c1) into another (c2) reusing as many labels as
possible.
The resulting codec is able to encode the same code point sequences
while not necessarily having the same labels for them as... | [
"def",
"merge",
"(",
"self",
",",
"codec",
":",
"'PytorchCodec'",
")",
"->",
"Tuple",
"[",
"'PytorchCodec'",
",",
"Set",
"]",
":",
"# find character sequences not encodable (exact match) by new codec.",
"# get labels for these sequences as deletion candidates",
"rm_candidates",... | https://github.com/mittagessen/kraken/blob/9882ba0743797a2d5b0a7b562fcc7235e87323da/kraken/lib/codec.py#L173-L216 | |
google/grr | 8ad8a4d2c5a93c92729206b7771af19d92d4f915 | grr/core/grr_response_core/lib/rdfvalues/structs.py | python | ProtoType.__init__ | (self,
field_number=None,
required=False,
labels=None,
set_default_on_access=None,
**kwargs) | [] | def __init__(self,
field_number=None,
required=False,
labels=None,
set_default_on_access=None,
**kwargs):
super().__init__(**kwargs)
# TODO: Without this type hint, pytype thinks that field_number
# is always None.
self.field_num... | [
"def",
"__init__",
"(",
"self",
",",
"field_number",
"=",
"None",
",",
"required",
"=",
"False",
",",
"labels",
"=",
"None",
",",
"set_default_on_access",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"*",
"... | https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/core/grr_response_core/lib/rdfvalues/structs.py#L187-L205 | ||||
P1sec/pycrate | d12bbccf1df8c9c7891a26967a9d2635610ec5b8 | pycrate_core/elt.py | python | Sequence.clear | (self) | Clear the content of self
Args:
None
Returns:
None | Clear the content of self
Args:
None
Returns:
None | [
"Clear",
"the",
"content",
"of",
"self",
"Args",
":",
"None",
"Returns",
":",
"None"
] | def clear(self):
"""Clear the content of self
Args:
None
Returns:
None
"""
if python_version < 3:
del self._content[:]
else:
self._content.clear() | [
"def",
"clear",
"(",
"self",
")",
":",
"if",
"python_version",
"<",
"3",
":",
"del",
"self",
".",
"_content",
"[",
":",
"]",
"else",
":",
"self",
".",
"_content",
".",
"clear",
"(",
")"
] | https://github.com/P1sec/pycrate/blob/d12bbccf1df8c9c7891a26967a9d2635610ec5b8/pycrate_core/elt.py#L3961-L3973 | ||
git-cola/git-cola | b48b8028e0c3baf47faf7b074b9773737358163d | cola/widgets/branch.py | python | TreeEntry.__init__ | (self, basename, refname, children) | [] | def __init__(self, basename, refname, children):
self.basename = basename
self.refname = refname
self.children = children | [
"def",
"__init__",
"(",
"self",
",",
"basename",
",",
"refname",
",",
"children",
")",
":",
"self",
".",
"basename",
"=",
"basename",
"self",
".",
"refname",
"=",
"refname",
"self",
".",
"children",
"=",
"children"
] | https://github.com/git-cola/git-cola/blob/b48b8028e0c3baf47faf7b074b9773737358163d/cola/widgets/branch.py#L504-L507 | ||||
JetBrains/python-skeletons | 95ad24b666e475998e5d1cc02ed53a2188036167 | __builtin__.py | python | locals | () | return {} | Update and return a dictionary containing the current scope's local
variables.
:rtype: dict[string, unknown] | Update and return a dictionary containing the current scope's local
variables. | [
"Update",
"and",
"return",
"a",
"dictionary",
"containing",
"the",
"current",
"scope",
"s",
"local",
"variables",
"."
] | def locals():
"""Update and return a dictionary containing the current scope's local
variables.
:rtype: dict[string, unknown]
"""
return {} | [
"def",
"locals",
"(",
")",
":",
"return",
"{",
"}"
] | https://github.com/JetBrains/python-skeletons/blob/95ad24b666e475998e5d1cc02ed53a2188036167/__builtin__.py#L192-L198 | |
lensacom/sparkit-learn | 0498502107c1f7dcf33cda0cdb6f5ba4b42524b7 | splearn/feature_selection/variance_threshold.py | python | SparkVarianceThreshold.transform | (self, Z) | return Z.transform(mapper, column='X') | Reduce X to the selected features.
Parameters
----------
X : array of shape [n_samples, n_features]
The input samples.
Returns
-------
X_r : array of shape [n_samples, n_selected_features]
The input samples with only the selected features. | Reduce X to the selected features. | [
"Reduce",
"X",
"to",
"the",
"selected",
"features",
"."
] | def transform(self, Z):
"""Reduce X to the selected features.
Parameters
----------
X : array of shape [n_samples, n_features]
The input samples.
Returns
-------
X_r : array of shape [n_samples, n_selected_features]
The input samples with... | [
"def",
"transform",
"(",
"self",
",",
"Z",
")",
":",
"X",
"=",
"Z",
"[",
":",
",",
"'X'",
"]",
"if",
"isinstance",
"(",
"Z",
",",
"DictRDD",
")",
"else",
"Z",
"check_rdd",
"(",
"X",
",",
"(",
"np",
".",
"ndarray",
",",
"sp",
".",
"spmatrix",
... | https://github.com/lensacom/sparkit-learn/blob/0498502107c1f7dcf33cda0cdb6f5ba4b42524b7/splearn/feature_selection/variance_threshold.py#L95-L113 | |
TensorLab/tensorfx | 98a91b1d9e657f9444b6140712a5dedcdd906acf | src/data/_ds_csv.py | python | CsvDataSource.path | (self) | return self._path | Retrives the path represented by the DataSource. | Retrives the path represented by the DataSource. | [
"Retrives",
"the",
"path",
"represented",
"by",
"the",
"DataSource",
"."
] | def path(self):
"""Retrives the path represented by the DataSource.
"""
return self._path | [
"def",
"path",
"(",
"self",
")",
":",
"return",
"self",
".",
"_path"
] | https://github.com/TensorLab/tensorfx/blob/98a91b1d9e657f9444b6140712a5dedcdd906acf/src/data/_ds_csv.py#L75-L78 | |
kornia/kornia | b12d6611b1c41d47b2c93675f0ea344b5314a688 | kornia/metrics/mean_iou.py | python | mean_iou_bbox | (boxes_1: torch.Tensor, boxes_2: torch.Tensor) | return intersection / union | Compute the IoU of the cartisian product of two sets of boxes.
Each box in each set shall be (x1, y1, x2, y2).
Args:
boxes_1: a tensor of bounding boxes in :math:`(B1, 4)`.
boxes_2: a tensor of bounding boxes in :math:`(B2, 4)`.
Returns:
a tensor in dimensions :math:`(B1, B2)`, re... | Compute the IoU of the cartisian product of two sets of boxes. | [
"Compute",
"the",
"IoU",
"of",
"the",
"cartisian",
"product",
"of",
"two",
"sets",
"of",
"boxes",
"."
] | def mean_iou_bbox(boxes_1: torch.Tensor, boxes_2: torch.Tensor) -> torch.Tensor:
"""Compute the IoU of the cartisian product of two sets of boxes.
Each box in each set shall be (x1, y1, x2, y2).
Args:
boxes_1: a tensor of bounding boxes in :math:`(B1, 4)`.
boxes_2: a tensor of bounding box... | [
"def",
"mean_iou_bbox",
"(",
"boxes_1",
":",
"torch",
".",
"Tensor",
",",
"boxes_2",
":",
"torch",
".",
"Tensor",
")",
"->",
"torch",
".",
"Tensor",
":",
"# TODO: support more box types. e.g. xywh,",
"if",
"not",
"(",
"(",
"(",
"boxes_1",
"[",
":",
",",
"2... | https://github.com/kornia/kornia/blob/b12d6611b1c41d47b2c93675f0ea344b5314a688/kornia/metrics/mean_iou.py#L63-L102 | |
google/clusterfuzz | f358af24f414daa17a3649b143e71ea71871ef59 | src/clusterfuzz/_internal/bot/tasks/regression_task.py | python | _testcase_reproduces_in_revision | (testcase,
testcase_file_path,
job_type,
revision,
should_log=True,
min_revision=None,
max_revisio... | return result.is_crash() | Test to see if a test case reproduces in the specified revision. | Test to see if a test case reproduces in the specified revision. | [
"Test",
"to",
"see",
"if",
"a",
"test",
"case",
"reproduces",
"in",
"the",
"specified",
"revision",
"."
] | def _testcase_reproduces_in_revision(testcase,
testcase_file_path,
job_type,
revision,
should_log=True,
min_revision=None,
... | [
"def",
"_testcase_reproduces_in_revision",
"(",
"testcase",
",",
"testcase_file_path",
",",
"job_type",
",",
"revision",
",",
"should_log",
"=",
"True",
",",
"min_revision",
"=",
"None",
",",
"max_revision",
"=",
"None",
")",
":",
"if",
"should_log",
":",
"log_m... | https://github.com/google/clusterfuzz/blob/f358af24f414daa17a3649b143e71ea71871ef59/src/clusterfuzz/_internal/bot/tasks/regression_task.py#L86-L117 | |
foolwood/deepmask-pytorch | 97b02aa29ce39b9e43144c89937dbead2a99adcc | tools/train.py | python | BinaryMeter.reset | (self) | [] | def reset(self):
self.acc = 0
self.n = 0 | [
"def",
"reset",
"(",
"self",
")",
":",
"self",
".",
"acc",
"=",
"0",
"self",
".",
"n",
"=",
"0"
] | https://github.com/foolwood/deepmask-pytorch/blob/97b02aa29ce39b9e43144c89937dbead2a99adcc/tools/train.py#L103-L105 | ||||
IronLanguages/ironpython3 | 7a7bb2a872eeab0d1009fc8a6e24dca43f65b693 | Src/StdLib/Lib/inspect.py | python | stack | (context=1) | return getouterframes(sys._getframe(1), context) | Return a list of records for the stack above the caller's frame. | Return a list of records for the stack above the caller's frame. | [
"Return",
"a",
"list",
"of",
"records",
"for",
"the",
"stack",
"above",
"the",
"caller",
"s",
"frame",
"."
] | def stack(context=1):
"""Return a list of records for the stack above the caller's frame."""
return getouterframes(sys._getframe(1), context) | [
"def",
"stack",
"(",
"context",
"=",
"1",
")",
":",
"return",
"getouterframes",
"(",
"sys",
".",
"_getframe",
"(",
"1",
")",
",",
"context",
")"
] | https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/inspect.py#L1346-L1348 | |
google-research/albert | 932b41f0319fbef7efd069d5ff545e3358574e19 | modeling.py | python | einsum_via_matmul | (input_tensor, w, num_inner_dims) | return ret | Implements einsum via matmul and reshape ops.
Args:
input_tensor: float Tensor of shape [<batch_dims>, <inner_dims>].
w: float Tensor of shape [<inner_dims>, <outer_dims>].
num_inner_dims: int. number of dimensions to use for inner products.
Returns:
float Tensor of shape [<batch_dims>, <outer_dim... | Implements einsum via matmul and reshape ops. | [
"Implements",
"einsum",
"via",
"matmul",
"and",
"reshape",
"ops",
"."
] | def einsum_via_matmul(input_tensor, w, num_inner_dims):
"""Implements einsum via matmul and reshape ops.
Args:
input_tensor: float Tensor of shape [<batch_dims>, <inner_dims>].
w: float Tensor of shape [<inner_dims>, <outer_dims>].
num_inner_dims: int. number of dimensions to use for inner products.
... | [
"def",
"einsum_via_matmul",
"(",
"input_tensor",
",",
"w",
",",
"num_inner_dims",
")",
":",
"input_shape",
"=",
"get_shape_list",
"(",
"input_tensor",
")",
"w_shape",
"=",
"get_shape_list",
"(",
"w",
")",
"batch_dims",
"=",
"input_shape",
"[",
":",
"-",
"num_i... | https://github.com/google-research/albert/blob/932b41f0319fbef7efd069d5ff545e3358574e19/modeling.py#L632-L657 | |
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/venv/lib/python3.7/site-packages/pip/_vendor/distlib/locators.py | python | DependencyFinder.__init__ | (self, locator=None) | Initialise an instance, using the specified locator
to locate distributions. | Initialise an instance, using the specified locator
to locate distributions. | [
"Initialise",
"an",
"instance",
"using",
"the",
"specified",
"locator",
"to",
"locate",
"distributions",
"."
] | def __init__(self, locator=None):
"""
Initialise an instance, using the specified locator
to locate distributions.
"""
self.locator = locator or default_locator
self.scheme = get_scheme(self.locator.scheme) | [
"def",
"__init__",
"(",
"self",
",",
"locator",
"=",
"None",
")",
":",
"self",
".",
"locator",
"=",
"locator",
"or",
"default_locator",
"self",
".",
"scheme",
"=",
"get_scheme",
"(",
"self",
".",
"locator",
".",
"scheme",
")"
] | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/venv/lib/python3.7/site-packages/pip/_vendor/distlib/locators.py#L1066-L1072 | ||
triaquae/triaquae | bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9 | TriAquae/models/Ubuntu_12/pyasn1/type/univ.py | python | SequenceAndSetBase.setDefaultComponents | (self) | [] | def setDefaultComponents(self):
if self._componentTypeLen == self._componentValuesSet:
return
idx = self._componentTypeLen
while idx:
idx = idx - 1
if self._componentType[idx].isDefaulted:
if self.getComponentByPosition(idx) is None:
... | [
"def",
"setDefaultComponents",
"(",
"self",
")",
":",
"if",
"self",
".",
"_componentTypeLen",
"==",
"self",
".",
"_componentValuesSet",
":",
"return",
"idx",
"=",
"self",
".",
"_componentTypeLen",
"while",
"idx",
":",
"idx",
"=",
"idx",
"-",
"1",
"if",
"se... | https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/Ubuntu_12/pyasn1/type/univ.py#L806-L819 | ||||
IBM/lale | b4d6829c143a4735b06083a0e6c70d2cca244162 | lale/type_checking.py | python | _validate_subschema | (
sub: JSON_TYPE, sup: JSON_TYPE, sub_name="sub", sup_name="super"
) | [] | def _validate_subschema(
sub: JSON_TYPE, sup: JSON_TYPE, sub_name="sub", sup_name="super"
):
if not is_subschema(sub, sup):
raise SubschemaError(sub, sup, sub_name, sup_name) | [
"def",
"_validate_subschema",
"(",
"sub",
":",
"JSON_TYPE",
",",
"sup",
":",
"JSON_TYPE",
",",
"sub_name",
"=",
"\"sub\"",
",",
"sup_name",
"=",
"\"super\"",
")",
":",
"if",
"not",
"is_subschema",
"(",
"sub",
",",
"sup",
")",
":",
"raise",
"SubschemaError"... | https://github.com/IBM/lale/blob/b4d6829c143a4735b06083a0e6c70d2cca244162/lale/type_checking.py#L250-L254 | ||||
gitpython-developers/GitPython | fac603789d66c0fd7c26e75debb41b06136c5026 | git/index/base.py | python | IndexFile._delete_entries_cache | (self) | Safely clear the entries cache so it can be recreated | Safely clear the entries cache so it can be recreated | [
"Safely",
"clear",
"the",
"entries",
"cache",
"so",
"it",
"can",
"be",
"recreated"
] | def _delete_entries_cache(self) -> None:
"""Safely clear the entries cache so it can be recreated"""
try:
del(self.entries)
except AttributeError:
# fails in python 2.6.5 with this exception
pass | [
"def",
"_delete_entries_cache",
"(",
"self",
")",
"->",
"None",
":",
"try",
":",
"del",
"(",
"self",
".",
"entries",
")",
"except",
"AttributeError",
":",
"# fails in python 2.6.5 with this exception",
"pass"
] | https://github.com/gitpython-developers/GitPython/blob/fac603789d66c0fd7c26e75debb41b06136c5026/git/index/base.py#L158-L164 | ||
mesalock-linux/mesapy | ed546d59a21b36feb93e2309d5c6b75aa0ad95c9 | lib-python/2.7/lib2to3/pgen2/grammar.py | python | Grammar.report | (self) | Dump the grammar tables to standard output, for debugging. | Dump the grammar tables to standard output, for debugging. | [
"Dump",
"the",
"grammar",
"tables",
"to",
"standard",
"output",
"for",
"debugging",
"."
] | def report(self):
"""Dump the grammar tables to standard output, for debugging."""
from pprint import pprint
print "s2n"
pprint(self.symbol2number)
print "n2s"
pprint(self.number2symbol)
print "states"
pprint(self.states)
print "dfas"
pprin... | [
"def",
"report",
"(",
"self",
")",
":",
"from",
"pprint",
"import",
"pprint",
"print",
"\"s2n\"",
"pprint",
"(",
"self",
".",
"symbol2number",
")",
"print",
"\"n2s\"",
"pprint",
"(",
"self",
".",
"number2symbol",
")",
"print",
"\"states\"",
"pprint",
"(",
... | https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/lib-python/2.7/lib2to3/pgen2/grammar.py#L125-L138 | ||
SciTools/iris | a12d0b15bab3377b23a148e891270b13a0419c38 | lib/iris/_merge.py | python | _is_dependent | (dependent, independent, positions, function_mapping=None) | return valid | Determine whether there exists a one-to-one functional relationship
between the independent candidate dimension/s and the dependent
candidate dimension.
Args:
* dependent:
A candidate dimension that requires to be functionally
dependent on all the independent candidate dimensions.
... | Determine whether there exists a one-to-one functional relationship
between the independent candidate dimension/s and the dependent
candidate dimension. | [
"Determine",
"whether",
"there",
"exists",
"a",
"one",
"-",
"to",
"-",
"one",
"functional",
"relationship",
"between",
"the",
"independent",
"candidate",
"dimension",
"/",
"s",
"and",
"the",
"dependent",
"candidate",
"dimension",
"."
] | def _is_dependent(dependent, independent, positions, function_mapping=None):
"""
Determine whether there exists a one-to-one functional relationship
between the independent candidate dimension/s and the dependent
candidate dimension.
Args:
* dependent:
A candidate dimension that requir... | [
"def",
"_is_dependent",
"(",
"dependent",
",",
"independent",
",",
"positions",
",",
"function_mapping",
"=",
"None",
")",
":",
"valid",
"=",
"True",
"relation",
"=",
"{",
"}",
"if",
"isinstance",
"(",
"function_mapping",
",",
"dict",
")",
":",
"relation",
... | https://github.com/SciTools/iris/blob/a12d0b15bab3377b23a148e891270b13a0419c38/lib/iris/_merge.py#L783-L830 | |
fortharris/Pcode | 147962d160a834c219e12cb456abc130826468e4 | pyflakes/checker.py | python | Checker.deferAssignment | (self, callable) | Schedule an assignment handler to be called just after deferred
function handlers. | Schedule an assignment handler to be called just after deferred
function handlers. | [
"Schedule",
"an",
"assignment",
"handler",
"to",
"be",
"called",
"just",
"after",
"deferred",
"function",
"handlers",
"."
] | def deferAssignment(self, callable):
"""
Schedule an assignment handler to be called just after deferred
function handlers.
"""
self._deferredAssignments.append((callable, self.scopeStack[:], self.offset)) | [
"def",
"deferAssignment",
"(",
"self",
",",
"callable",
")",
":",
"self",
".",
"_deferredAssignments",
".",
"append",
"(",
"(",
"callable",
",",
"self",
".",
"scopeStack",
"[",
":",
"]",
",",
"self",
".",
"offset",
")",
")"
] | https://github.com/fortharris/Pcode/blob/147962d160a834c219e12cb456abc130826468e4/pyflakes/checker.py#L318-L323 | ||
chromium/web-page-replay | 472351e1122bb1beb936952c7e75ae58bf8a69f1 | platformsettings.py | python | _BasePlatformSettings.timer | (self) | return time.time() | Return the current time in seconds as a floating point number. | Return the current time in seconds as a floating point number. | [
"Return",
"the",
"current",
"time",
"in",
"seconds",
"as",
"a",
"floating",
"point",
"number",
"."
] | def timer(self):
"""Return the current time in seconds as a floating point number."""
return time.time() | [
"def",
"timer",
"(",
"self",
")",
":",
"return",
"time",
".",
"time",
"(",
")"
] | https://github.com/chromium/web-page-replay/blob/472351e1122bb1beb936952c7e75ae58bf8a69f1/platformsettings.py#L169-L171 | |
leo-editor/leo-editor | 383d6776d135ef17d73d935a2f0ecb3ac0e99494 | leo/commands/editCommands.py | python | EditCommandsClass.whatLine | (self, event) | Print the line number of the line containing the cursor. | Print the line number of the line containing the cursor. | [
"Print",
"the",
"line",
"number",
"of",
"the",
"line",
"containing",
"the",
"cursor",
"."
] | def whatLine(self, event):
"""Print the line number of the line containing the cursor."""
k = self.c.k
w = self.editWidget(event)
if w:
s = w.getAllText()
i = w.getInsertPoint()
row, col = g.convertPythonIndexToRowCol(s, i)
k.keyboardQuit()... | [
"def",
"whatLine",
"(",
"self",
",",
"event",
")",
":",
"k",
"=",
"self",
".",
"c",
".",
"k",
"w",
"=",
"self",
".",
"editWidget",
"(",
"event",
")",
"if",
"w",
":",
"s",
"=",
"w",
".",
"getAllText",
"(",
")",
"i",
"=",
"w",
".",
"getInsertPo... | https://github.com/leo-editor/leo-editor/blob/383d6776d135ef17d73d935a2f0ecb3ac0e99494/leo/commands/editCommands.py#L1290-L1299 | ||
qhduan/just_another_seq2seq | ac9be1b1599c05e0802824afa8a351dcb9ba936e | rnn_crf.py | python | RNNCRF.build_single_cell | (self, n_hidden, use_residual) | return cell | 构建一个单独的rnn cell
Args:
n_hidden: 隐藏层神经元数量
use_residual: 是否使用residual wrapper | 构建一个单独的rnn cell
Args:
n_hidden: 隐藏层神经元数量
use_residual: 是否使用residual wrapper | [
"构建一个单独的rnn",
"cell",
"Args",
":",
"n_hidden",
":",
"隐藏层神经元数量",
"use_residual",
":",
"是否使用residual",
"wrapper"
] | def build_single_cell(self, n_hidden, use_residual):
"""构建一个单独的rnn cell
Args:
n_hidden: 隐藏层神经元数量
use_residual: 是否使用residual wrapper
"""
cell_type = LSTMCell
if self.cell_type.lower() == 'gru':
cell_type = GRUCell
cell = cell_type(n_hidd... | [
"def",
"build_single_cell",
"(",
"self",
",",
"n_hidden",
",",
"use_residual",
")",
":",
"cell_type",
"=",
"LSTMCell",
"if",
"self",
".",
"cell_type",
".",
"lower",
"(",
")",
"==",
"'gru'",
":",
"cell_type",
"=",
"GRUCell",
"cell",
"=",
"cell_type",
"(",
... | https://github.com/qhduan/just_another_seq2seq/blob/ac9be1b1599c05e0802824afa8a351dcb9ba936e/rnn_crf.py#L247-L268 | |
dropbox/dropbox-sdk-python | 015437429be224732990041164a21a0501235db1 | dropbox/sharing.py | python | SetAccessInheritanceError.get_access_error | (self) | return self._value | Unable to access shared folder.
Only call this if :meth:`is_access_error` is true.
:rtype: SharedFolderAccessError | Unable to access shared folder. | [
"Unable",
"to",
"access",
"shared",
"folder",
"."
] | def get_access_error(self):
"""
Unable to access shared folder.
Only call this if :meth:`is_access_error` is true.
:rtype: SharedFolderAccessError
"""
if not self.is_access_error():
raise AttributeError("tag 'access_error' not set")
return self._valu... | [
"def",
"get_access_error",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_access_error",
"(",
")",
":",
"raise",
"AttributeError",
"(",
"\"tag 'access_error' not set\"",
")",
"return",
"self",
".",
"_value"
] | https://github.com/dropbox/dropbox-sdk-python/blob/015437429be224732990041164a21a0501235db1/dropbox/sharing.py#L7835-L7845 | |
phantomcyber/playbooks | 9e850ecc44cb98c5dde53784744213a1ed5799bd | ssh_endpoint_investigate.py | python | on_start | (container) | return | [] | def on_start(container):
phantom.debug('on_start() called')
# call 'get_jira_key' block
get_jira_key(container=container)
return | [
"def",
"on_start",
"(",
"container",
")",
":",
"phantom",
".",
"debug",
"(",
"'on_start() called'",
")",
"# call 'get_jira_key' block",
"get_jira_key",
"(",
"container",
"=",
"container",
")",
"return"
] | https://github.com/phantomcyber/playbooks/blob/9e850ecc44cb98c5dde53784744213a1ed5799bd/ssh_endpoint_investigate.py#L8-L14 | |||
open-telemetry/opentelemetry-python | f5d872050204685b5ef831d02ec593956820ebe6 | exporter/opentelemetry-exporter-jaeger-thrift/src/opentelemetry/exporter/jaeger/thrift/gen/agent/Agent.py | python | Client.emitZipkinBatch | (self, spans) | Parameters:
- spans | Parameters:
- spans | [
"Parameters",
":",
"-",
"spans"
] | def emitZipkinBatch(self, spans):
"""
Parameters:
- spans
"""
self.send_emitZipkinBatch(spans) | [
"def",
"emitZipkinBatch",
"(",
"self",
",",
"spans",
")",
":",
"self",
".",
"send_emitZipkinBatch",
"(",
"spans",
")"
] | https://github.com/open-telemetry/opentelemetry-python/blob/f5d872050204685b5ef831d02ec593956820ebe6/exporter/opentelemetry-exporter-jaeger-thrift/src/opentelemetry/exporter/jaeger/thrift/gen/agent/Agent.py#L41-L46 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/flaskbb/utils/search.py | python | ForumWhoosheer.delete_forum | (cls, writer, forum) | [] | def delete_forum(cls, writer, forum):
writer.delete_by_term('forum_id', forum.id) | [
"def",
"delete_forum",
"(",
"cls",
",",
"writer",
",",
"forum",
")",
":",
"writer",
".",
"delete_by_term",
"(",
"'forum_id'",
",",
"forum",
".",
"id",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/flaskbb/utils/search.py#L116-L117 | ||||
joaoventura/pylibui | 2e74db787bfea533f3ae465670963daedcaec344 | pylibui/libui/box.py | python | uiNewVerticalBox | () | return clibui.uiNewVerticalBox() | Returns a vertical box.
:return: uiBox | Returns a vertical box. | [
"Returns",
"a",
"vertical",
"box",
"."
] | def uiNewVerticalBox():
"""
Returns a vertical box.
:return: uiBox
"""
# Set return type
clibui.uiNewVerticalBox.restype = ctypes.POINTER(uiBox)
return clibui.uiNewVerticalBox() | [
"def",
"uiNewVerticalBox",
"(",
")",
":",
"# Set return type",
"clibui",
".",
"uiNewVerticalBox",
".",
"restype",
"=",
"ctypes",
".",
"POINTER",
"(",
"uiBox",
")",
"return",
"clibui",
".",
"uiNewVerticalBox",
"(",
")"
] | https://github.com/joaoventura/pylibui/blob/2e74db787bfea533f3ae465670963daedcaec344/pylibui/libui/box.py#L94-L104 | |
bravoserver/bravo | 7be5d792871a8447499911fa1502c6a7c1437dc3 | bravo/beta/factory.py | python | BravoFactory.teardown_protocol | (self, protocol) | Do internal bookkeeping on behalf of a protocol which has been
disconnected.
Did you know that "bookkeeping" is one of the few words in English
which has three pairs of double letters in a row? | Do internal bookkeeping on behalf of a protocol which has been
disconnected. | [
"Do",
"internal",
"bookkeeping",
"on",
"behalf",
"of",
"a",
"protocol",
"which",
"has",
"been",
"disconnected",
"."
] | def teardown_protocol(self, protocol):
"""
Do internal bookkeeping on behalf of a protocol which has been
disconnected.
Did you know that "bookkeeping" is one of the few words in English
which has three pairs of double letters in a row?
"""
username = protocol.u... | [
"def",
"teardown_protocol",
"(",
"self",
",",
"protocol",
")",
":",
"username",
"=",
"protocol",
".",
"username",
"host",
"=",
"protocol",
".",
"host",
"if",
"username",
"in",
"self",
".",
"protocols",
":",
"del",
"self",
".",
"protocols",
"[",
"username",... | https://github.com/bravoserver/bravo/blob/7be5d792871a8447499911fa1502c6a7c1437dc3/bravo/beta/factory.py#L191-L206 | ||
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | runtime/python/lib/python2.7/rfc822.py | python | parsedate_tz | (data) | return (yy, mm, dd, thh, tmm, tss, 0, 1, 0, tzoffset) | Convert a date string to a time tuple.
Accounts for military timezones. | Convert a date string to a time tuple. | [
"Convert",
"a",
"date",
"string",
"to",
"a",
"time",
"tuple",
"."
] | def parsedate_tz(data):
"""Convert a date string to a time tuple.
Accounts for military timezones.
"""
if not data:
return None
data = data.split()
if data[0][-1] in (',', '.') or data[0].lower() in _daynames:
# There's a dayname here. Skip it
del data[0]
else:
... | [
"def",
"parsedate_tz",
"(",
"data",
")",
":",
"if",
"not",
"data",
":",
"return",
"None",
"data",
"=",
"data",
".",
"split",
"(",
")",
"if",
"data",
"[",
"0",
"]",
"[",
"-",
"1",
"]",
"in",
"(",
"','",
",",
"'.'",
")",
"or",
"data",
"[",
"0",... | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/rfc822.py#L850-L932 | |
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/mailbox.py | python | _PartialFile.__init__ | (self, f, start=None, stop=None) | Initialize a _PartialFile. | Initialize a _PartialFile. | [
"Initialize",
"a",
"_PartialFile",
"."
] | def __init__(self, f, start=None, stop=None):
"""Initialize a _PartialFile."""
_ProxyFile.__init__(self, f, start)
self._start = start
self._stop = stop | [
"def",
"__init__",
"(",
"self",
",",
"f",
",",
"start",
"=",
"None",
",",
"stop",
"=",
"None",
")",
":",
"_ProxyFile",
".",
"__init__",
"(",
"self",
",",
"f",
",",
"start",
")",
"self",
".",
"_start",
"=",
"start",
"self",
".",
"_stop",
"=",
"sto... | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/mailbox.py#L2022-L2026 | ||
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | runtime/python/lib/python2.7/site-packages/PIL/ImageOps.py | python | fit | (image, size, method=Image.NEAREST, bleed=0.0, centering=(0.5, 0.5)) | return out.resize(size, method) | This method returns a sized and cropped version of the image,
cropped to the aspect ratio and size that you request. | This method returns a sized and cropped version of the image,
cropped to the aspect ratio and size that you request. | [
"This",
"method",
"returns",
"a",
"sized",
"and",
"cropped",
"version",
"of",
"the",
"image",
"cropped",
"to",
"the",
"aspect",
"ratio",
"and",
"size",
"that",
"you",
"request",
"."
] | def fit(image, size, method=Image.NEAREST, bleed=0.0, centering=(0.5, 0.5)):
"""
This method returns a sized and cropped version of the image,
cropped to the aspect ratio and size that you request.
"""
# by Kevin Cazabon, Feb 17/2000
# kevin@cazabon.com
# http://www.cazabon.com
# ensur... | [
"def",
"fit",
"(",
"image",
",",
"size",
",",
"method",
"=",
"Image",
".",
"NEAREST",
",",
"bleed",
"=",
"0.0",
",",
"centering",
"=",
"(",
"0.5",
",",
"0.5",
")",
")",
":",
"# by Kevin Cazabon, Feb 17/2000",
"# kevin@cazabon.com",
"# http://www.cazabon.com",
... | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/site-packages/PIL/ImageOps.py#L266-L333 | |
theotherp/nzbhydra | 4b03d7f769384b97dfc60dade4806c0fc987514e | libs/werkzeug/debug/tbtools.py | python | Traceback.paste | (self) | return {
'url': resp['html_url'],
'id': resp['id']
} | Create a paste and return the paste id. | Create a paste and return the paste id. | [
"Create",
"a",
"paste",
"and",
"return",
"the",
"paste",
"id",
"."
] | def paste(self):
"""Create a paste and return the paste id."""
data = json.dumps({
'description': 'Werkzeug Internal Server Error',
'public': False,
'files': {
'traceback.txt': {
'content': self.plaintext
}
... | [
"def",
"paste",
"(",
"self",
")",
":",
"data",
"=",
"json",
".",
"dumps",
"(",
"{",
"'description'",
":",
"'Werkzeug Internal Server Error'",
",",
"'public'",
":",
"False",
",",
"'files'",
":",
"{",
"'traceback.txt'",
":",
"{",
"'content'",
":",
"self",
".... | https://github.com/theotherp/nzbhydra/blob/4b03d7f769384b97dfc60dade4806c0fc987514e/libs/werkzeug/debug/tbtools.py#L276-L297 | |
OctoPrint/OctoPrint | 4b12b0e6f06c3abfb31b1840a0605e2de8e911d2 | src/octoprint/vendor/zeroconf.py | python | DNSIncoming.read_utf | (self, offset, length) | return text_type(self.data[offset : offset + length], "utf-8", "replace") | Reads a UTF-8 string of a given length from the packet | Reads a UTF-8 string of a given length from the packet | [
"Reads",
"a",
"UTF",
"-",
"8",
"string",
"of",
"a",
"given",
"length",
"from",
"the",
"packet"
] | def read_utf(self, offset, length):
"""Reads a UTF-8 string of a given length from the packet"""
return text_type(self.data[offset : offset + length], "utf-8", "replace") | [
"def",
"read_utf",
"(",
"self",
",",
"offset",
",",
"length",
")",
":",
"return",
"text_type",
"(",
"self",
".",
"data",
"[",
"offset",
":",
"offset",
"+",
"length",
"]",
",",
"\"utf-8\"",
",",
"\"replace\"",
")"
] | https://github.com/OctoPrint/OctoPrint/blob/4b12b0e6f06c3abfb31b1840a0605e2de8e911d2/src/octoprint/vendor/zeroconf.py#L765-L767 | |
microsoft/azure-devops-python-api | 451cade4c475482792cbe9e522c1fee32393139e | azure-devops/azure/devops/v5_1/gallery/gallery_client.py | python | GalleryClient.get_certificate | (self, publisher_name, extension_name, version=None, **kwargs) | return self._client.stream_download(response, callback=callback) | GetCertificate.
[Preview API]
:param str publisher_name:
:param str extension_name:
:param str version:
:rtype: object | GetCertificate.
[Preview API]
:param str publisher_name:
:param str extension_name:
:param str version:
:rtype: object | [
"GetCertificate",
".",
"[",
"Preview",
"API",
"]",
":",
"param",
"str",
"publisher_name",
":",
":",
"param",
"str",
"extension_name",
":",
":",
"param",
"str",
"version",
":",
":",
"rtype",
":",
"object"
] | def get_certificate(self, publisher_name, extension_name, version=None, **kwargs):
"""GetCertificate.
[Preview API]
:param str publisher_name:
:param str extension_name:
:param str version:
:rtype: object
"""
route_values = {}
if publisher_name is ... | [
"def",
"get_certificate",
"(",
"self",
",",
"publisher_name",
",",
"extension_name",
",",
"version",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"route_values",
"=",
"{",
"}",
"if",
"publisher_name",
"is",
"not",
"None",
":",
"route_values",
"[",
"'pub... | https://github.com/microsoft/azure-devops-python-api/blob/451cade4c475482792cbe9e522c1fee32393139e/azure-devops/azure/devops/v5_1/gallery/gallery_client.py#L397-L421 | |
ilastik/ilastik | 6acd2c554bc517e9c8ddad3623a7aaa2e6970c28 | lazyflow/stype.py | python | SlotType.isConfigured | (self) | return False | Slot types must implement this method.
it should analyse the .meta property of the slot
and return wether the neccessary meta information
is available. | Slot types must implement this method. | [
"Slot",
"types",
"must",
"implement",
"this",
"method",
"."
] | def isConfigured(self):
"""
Slot types must implement this method.
it should analyse the .meta property of the slot
and return wether the neccessary meta information
is available.
"""
return False | [
"def",
"isConfigured",
"(",
"self",
")",
":",
"return",
"False"
] | https://github.com/ilastik/ilastik/blob/6acd2c554bc517e9c8ddad3623a7aaa2e6970c28/lazyflow/stype.py#L73-L81 | |
jason9693/MusicTransformer-tensorflow2.0 | f7c06c0cb2e9cdddcbf6db779cb39cd650282778 | custom/callback.py | python | MTFitCallback.__init__ | (self, save_path) | [] | def __init__(self, save_path):
super(MTFitCallback, self).__init__()
self.save_path = save_path | [
"def",
"__init__",
"(",
"self",
",",
"save_path",
")",
":",
"super",
"(",
"MTFitCallback",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"save_path",
"=",
"save_path"
] | https://github.com/jason9693/MusicTransformer-tensorflow2.0/blob/f7c06c0cb2e9cdddcbf6db779cb39cd650282778/custom/callback.py#L10-L12 | ||||
jupyter/qtconsole | 631ab02bc59b89747adcab3d11aed4a9788d3027 | qtconsole/comms.py | python | CommManager.unregister_target | (self, target_name, f) | return self.targets.pop(target_name) | Unregister a callable registered with register_target | Unregister a callable registered with register_target | [
"Unregister",
"a",
"callable",
"registered",
"with",
"register_target"
] | def unregister_target(self, target_name, f):
"""Unregister a callable registered with register_target"""
return self.targets.pop(target_name) | [
"def",
"unregister_target",
"(",
"self",
",",
"target_name",
",",
"f",
")",
":",
"return",
"self",
".",
"targets",
".",
"pop",
"(",
"target_name",
")"
] | https://github.com/jupyter/qtconsole/blob/631ab02bc59b89747adcab3d11aed4a9788d3027/qtconsole/comms.py#L83-L85 | |
home-assistant/supervisor | 69c2517d5211b483fdfe968b0a2b36b672ee7ab2 | supervisor/api/ingress.py | python | _response_header | (response: aiohttp.ClientResponse) | return headers | Create response header. | Create response header. | [
"Create",
"response",
"header",
"."
] | def _response_header(response: aiohttp.ClientResponse) -> dict[str, str]:
"""Create response header."""
headers = {}
for name, value in response.headers.items():
if name in (
hdrs.TRANSFER_ENCODING,
hdrs.CONTENT_LENGTH,
hdrs.CONTENT_TYPE,
hdrs.CONTENT... | [
"def",
"_response_header",
"(",
"response",
":",
"aiohttp",
".",
"ClientResponse",
")",
"->",
"dict",
"[",
"str",
",",
"str",
"]",
":",
"headers",
"=",
"{",
"}",
"for",
"name",
",",
"value",
"in",
"response",
".",
"headers",
".",
"items",
"(",
")",
"... | https://github.com/home-assistant/supervisor/blob/69c2517d5211b483fdfe968b0a2b36b672ee7ab2/supervisor/api/ingress.py#L251-L265 | |
spulec/moto | a688c0032596a7dfef122b69a08f2bec3be2e481 | moto/core/models.py | python | patch_client | (client) | Explicitly patch a boto3-client | Explicitly patch a boto3-client | [
"Explicitly",
"patch",
"a",
"boto3",
"-",
"client"
] | def patch_client(client):
"""
Explicitly patch a boto3-client
"""
"""
Adding the botocore_stubber to the BUILTIN_HANDLERS, as above, will mock everything as long as the import ordering is correct
- user: start mock_service decorator
- system: imports core.model
- system: adds the st... | [
"def",
"patch_client",
"(",
"client",
")",
":",
"\"\"\"\n Adding the botocore_stubber to the BUILTIN_HANDLERS, as above, will mock everything as long as the import ordering is correct\n - user: start mock_service decorator\n - system: imports core.model\n - system: adds the stubber to t... | https://github.com/spulec/moto/blob/a688c0032596a7dfef122b69a08f2bec3be2e481/moto/core/models.py#L417-L436 | ||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/lighthouse/v20200324/models.py | python | ResetInstanceRequest.__init__ | (self) | r"""
:param InstanceId: 实例 ID。可通过[DescribeInstances](https://cloud.tencent.com/document/api/1207/47573)接口返回值中的InstanceId获取。
:type InstanceId: str
:param BlueprintId: 镜像 ID。可通过[DescribeBlueprints](https://cloud.tencent.com/document/product/1207/47689)接口返回值中的BlueprintId获取。
:type BlueprintI... | r"""
:param InstanceId: 实例 ID。可通过[DescribeInstances](https://cloud.tencent.com/document/api/1207/47573)接口返回值中的InstanceId获取。
:type InstanceId: str
:param BlueprintId: 镜像 ID。可通过[DescribeBlueprints](https://cloud.tencent.com/document/product/1207/47689)接口返回值中的BlueprintId获取。
:type BlueprintI... | [
"r",
":",
"param",
"InstanceId",
":",
"实例",
"ID。可通过",
"[",
"DescribeInstances",
"]",
"(",
"https",
":",
"//",
"cloud",
".",
"tencent",
".",
"com",
"/",
"document",
"/",
"api",
"/",
"1207",
"/",
"47573",
")",
"接口返回值中的InstanceId获取。",
":",
"type",
"Instance... | def __init__(self):
r"""
:param InstanceId: 实例 ID。可通过[DescribeInstances](https://cloud.tencent.com/document/api/1207/47573)接口返回值中的InstanceId获取。
:type InstanceId: str
:param BlueprintId: 镜像 ID。可通过[DescribeBlueprints](https://cloud.tencent.com/document/product/1207/47689)接口返回值中的BlueprintId... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"InstanceId",
"=",
"None",
"self",
".",
"BlueprintId",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/lighthouse/v20200324/models.py#L4715-L4723 | ||
rlworkgroup/garage | b4abe07f0fa9bac2cb70e4a3e315c2e7e5b08507 | src/garage/examples/tf/te_ppo_point.py | python | circle | (r, n) | Generate n points on a circle of radius r.
Args:
r (float): Radius of the circle.
n (int): Number of points to generate.
Yields:
tuple(float, float): Coordinate of a point. | Generate n points on a circle of radius r. | [
"Generate",
"n",
"points",
"on",
"a",
"circle",
"of",
"radius",
"r",
"."
] | def circle(r, n):
"""Generate n points on a circle of radius r.
Args:
r (float): Radius of the circle.
n (int): Number of points to generate.
Yields:
tuple(float, float): Coordinate of a point.
"""
for t in np.arange(0, 2 * np.pi, 2 * np.pi / n):
yield r * np.sin(t... | [
"def",
"circle",
"(",
"r",
",",
"n",
")",
":",
"for",
"t",
"in",
"np",
".",
"arange",
"(",
"0",
",",
"2",
"*",
"np",
".",
"pi",
",",
"2",
"*",
"np",
".",
"pi",
"/",
"n",
")",
":",
"yield",
"r",
"*",
"np",
".",
"sin",
"(",
"t",
")",
",... | https://github.com/rlworkgroup/garage/blob/b4abe07f0fa9bac2cb70e4a3e315c2e7e5b08507/src/garage/examples/tf/te_ppo_point.py#L21-L33 | ||
ales-tsurko/cells | 4cf7e395cd433762bea70cdc863a346f3a6fe1d0 | packaging/macos/python/lib/python3.7/nntplib.py | python | _NNTPBase.group | (self, name) | return resp, int(count), int(first), int(last), name | Process a GROUP command. Argument:
- group: the group name
Returns:
- resp: server response if successful
- count: number of articles
- first: first article number
- last: last article number
- name: the group name | Process a GROUP command. Argument:
- group: the group name
Returns:
- resp: server response if successful
- count: number of articles
- first: first article number
- last: last article number
- name: the group name | [
"Process",
"a",
"GROUP",
"command",
".",
"Argument",
":",
"-",
"group",
":",
"the",
"group",
"name",
"Returns",
":",
"-",
"resp",
":",
"server",
"response",
"if",
"successful",
"-",
"count",
":",
"number",
"of",
"articles",
"-",
"first",
":",
"first",
... | def group(self, name):
"""Process a GROUP command. Argument:
- group: the group name
Returns:
- resp: server response if successful
- count: number of articles
- first: first article number
- last: last article number
- name: the group name
"""
... | [
"def",
"group",
"(",
"self",
",",
"name",
")",
":",
"resp",
"=",
"self",
".",
"_shortcmd",
"(",
"'GROUP '",
"+",
"name",
")",
"if",
"not",
"resp",
".",
"startswith",
"(",
"'211'",
")",
":",
"raise",
"NNTPReplyError",
"(",
"resp",
")",
"words",
"=",
... | https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/nntplib.py#L651-L675 | |
sfepy/sfepy | 02ec7bb2ab39ee1dfe1eb4cd509f0ffb7dcc8b25 | sfepy/discrete/fem/fields_base.py | python | VolumeField.average_qp_to_vertices | (self, data_qp, integral) | return data_vertex | Average data given in quadrature points in region elements into
region vertices.
.. math::
u_n = \sum_e (u_{e,avg} * volume_e) / \sum_e volume_e
= \sum_e \int_{volume_e} u / \sum volume_e | Average data given in quadrature points in region elements into
region vertices. | [
"Average",
"data",
"given",
"in",
"quadrature",
"points",
"in",
"region",
"elements",
"into",
"region",
"vertices",
"."
] | def average_qp_to_vertices(self, data_qp, integral):
"""
Average data given in quadrature points in region elements into
region vertices.
.. math::
u_n = \sum_e (u_{e,avg} * volume_e) / \sum_e volume_e
= \sum_e \int_{volume_e} u / \sum volume_e
"""
... | [
"def",
"average_qp_to_vertices",
"(",
"self",
",",
"data_qp",
",",
"integral",
")",
":",
"region",
"=",
"self",
".",
"region",
"n_cells",
"=",
"region",
".",
"get_n_cells",
"(",
")",
"if",
"n_cells",
"!=",
"data_qp",
".",
"shape",
"[",
"0",
"]",
":",
"... | https://github.com/sfepy/sfepy/blob/02ec7bb2ab39ee1dfe1eb4cd509f0ffb7dcc8b25/sfepy/discrete/fem/fields_base.py#L1279-L1321 | |
angr/angr | 4b04d56ace135018083d36d9083805be8146688b | angr/angrdb/serializers/comments.py | python | CommentsSerializer.load | (session, db_kb, kb) | return comments | :param session:
:param DbKnowledgeBase db_kb:
:param KnowledgeBase kb:
:return: | [] | def load(session, db_kb, kb): # pylint:disable=unused-argument
"""
:param session:
:param DbKnowledgeBase db_kb:
:param KnowledgeBase kb:
:return:
"""
db_comments = db_kb.comments
comments = Comments(kb)
for db_comment in db_comments:
... | [
"def",
"load",
"(",
"session",
",",
"db_kb",
",",
"kb",
")",
":",
"# pylint:disable=unused-argument",
"db_comments",
"=",
"db_kb",
".",
"comments",
"comments",
"=",
"Comments",
"(",
"kb",
")",
"for",
"db_comment",
"in",
"db_comments",
":",
"comments",
"[",
"... | https://github.com/angr/angr/blob/4b04d56ace135018083d36d9083805be8146688b/angr/angrdb/serializers/comments.py#L41-L56 | ||
openstack/cinder | 23494a6d6c51451688191e1847a458f1d3cdcaa5 | cinder/volume/drivers/dell_emc/sc/storagecenter_api.py | python | SCApi.get_volume | (self, provider_id) | return result | Returns the scvolume associated with provider_id.
:param provider_id: This is the instanceId
:return: Dell SCVolume object. | Returns the scvolume associated with provider_id. | [
"Returns",
"the",
"scvolume",
"associated",
"with",
"provider_id",
"."
] | def get_volume(self, provider_id):
"""Returns the scvolume associated with provider_id.
:param provider_id: This is the instanceId
:return: Dell SCVolume object.
"""
result = None
if provider_id:
r = self.client.get('StorageCenter/ScVolume/%s' % provider_id)
... | [
"def",
"get_volume",
"(",
"self",
",",
"provider_id",
")",
":",
"result",
"=",
"None",
"if",
"provider_id",
":",
"r",
"=",
"self",
".",
"client",
".",
"get",
"(",
"'StorageCenter/ScVolume/%s'",
"%",
"provider_id",
")",
"if",
"self",
".",
"_check_result",
"... | https://github.com/openstack/cinder/blob/23494a6d6c51451688191e1847a458f1d3cdcaa5/cinder/volume/drivers/dell_emc/sc/storagecenter_api.py#L1319-L1330 | |
databricks/databricks-cli | 6c429d4f581fc99f54cbf9239879434310037cc7 | databricks_cli/configure/provider.py | python | set_config_provider | (provider) | Sets a DatabricksConfigProvider that will be used for all future calls to get_config(),
used by the Databricks CLI code to discover the user's credentials. | Sets a DatabricksConfigProvider that will be used for all future calls to get_config(),
used by the Databricks CLI code to discover the user's credentials. | [
"Sets",
"a",
"DatabricksConfigProvider",
"that",
"will",
"be",
"used",
"for",
"all",
"future",
"calls",
"to",
"get_config",
"()",
"used",
"by",
"the",
"Databricks",
"CLI",
"code",
"to",
"discover",
"the",
"user",
"s",
"credentials",
"."
] | def set_config_provider(provider):
"""
Sets a DatabricksConfigProvider that will be used for all future calls to get_config(),
used by the Databricks CLI code to discover the user's credentials.
"""
global _config_provider
if provider and not isinstance(provider, DatabricksConfigProvider):
... | [
"def",
"set_config_provider",
"(",
"provider",
")",
":",
"global",
"_config_provider",
"if",
"provider",
"and",
"not",
"isinstance",
"(",
"provider",
",",
"DatabricksConfigProvider",
")",
":",
"raise",
"Exception",
"(",
"'Must be instance of DatabricksConfigProvider: %s'"... | https://github.com/databricks/databricks-cli/blob/6c429d4f581fc99f54cbf9239879434310037cc7/databricks_cli/configure/provider.py#L154-L162 | ||
getsentry/sentry | 83b1f25aac3e08075e0e2495bc29efaf35aca18a | src/sentry/plugins/base/v2.py | python | IPlugin2.get_conf_title | (self) | return self.conf_title or self.get_title() | Returns a string representing the title to be shown on the configuration page. | Returns a string representing the title to be shown on the configuration page. | [
"Returns",
"a",
"string",
"representing",
"the",
"title",
"to",
"be",
"shown",
"on",
"the",
"configuration",
"page",
"."
] | def get_conf_title(self):
"""
Returns a string representing the title to be shown on the configuration page.
"""
return self.conf_title or self.get_title() | [
"def",
"get_conf_title",
"(",
"self",
")",
":",
"return",
"self",
".",
"conf_title",
"or",
"self",
".",
"get_title",
"(",
")"
] | https://github.com/getsentry/sentry/blob/83b1f25aac3e08075e0e2495bc29efaf35aca18a/src/sentry/plugins/base/v2.py#L209-L213 | |
Azure/azure-devops-cli-extension | 11334cd55806bef0b99c3bee5a438eed71e44037 | azure-devops/azext_devops/devops_sdk/v5_0/work/work_client.py | python | WorkClient.get_backlog | (self, team_context, id) | return self._deserialize('BacklogLevelConfiguration', response) | GetBacklog.
[Preview API] Get a backlog level
:param :class:`<TeamContext> <azure.devops.v5_0.work.models.TeamContext>` team_context: The team context for the operation
:param str id: The id of the backlog level
:rtype: :class:`<BacklogLevelConfiguration> <azure.devops.v5_0.work.models.B... | GetBacklog.
[Preview API] Get a backlog level
:param :class:`<TeamContext> <azure.devops.v5_0.work.models.TeamContext>` team_context: The team context for the operation
:param str id: The id of the backlog level
:rtype: :class:`<BacklogLevelConfiguration> <azure.devops.v5_0.work.models.B... | [
"GetBacklog",
".",
"[",
"Preview",
"API",
"]",
"Get",
"a",
"backlog",
"level",
":",
"param",
":",
"class",
":",
"<TeamContext",
">",
"<azure",
".",
"devops",
".",
"v5_0",
".",
"work",
".",
"models",
".",
"TeamContext",
">",
"team_context",
":",
"The",
... | def get_backlog(self, team_context, id):
"""GetBacklog.
[Preview API] Get a backlog level
:param :class:`<TeamContext> <azure.devops.v5_0.work.models.TeamContext>` team_context: The team context for the operation
:param str id: The id of the backlog level
:rtype: :class:`<Backlog... | [
"def",
"get_backlog",
"(",
"self",
",",
"team_context",
",",
"id",
")",
":",
"project",
"=",
"None",
"team",
"=",
"None",
"if",
"team_context",
"is",
"not",
"None",
":",
"if",
"team_context",
".",
"project_id",
":",
"project",
"=",
"team_context",
".",
"... | https://github.com/Azure/azure-devops-cli-extension/blob/11334cd55806bef0b99c3bee5a438eed71e44037/azure-devops/azext_devops/devops_sdk/v5_0/work/work_client.py#L89-L119 | |
wxWidgets/Phoenix | b2199e299a6ca6d866aa6f3d0888499136ead9d6 | wx/lib/agw/buttonpanel.py | python | ButtonInfo.GetStatus | (self) | return self._status | Returns the :class:`ButtonInfo` status.
:return: A string containing the :class:`ButtonInfo` status (one of "Pressed", "Hover", "Normal",
"Toggled", "Disabled"). | Returns the :class:`ButtonInfo` status. | [
"Returns",
"the",
":",
"class",
":",
"ButtonInfo",
"status",
"."
] | def GetStatus(self):
"""
Returns the :class:`ButtonInfo` status.
:return: A string containing the :class:`ButtonInfo` status (one of "Pressed", "Hover", "Normal",
"Toggled", "Disabled").
"""
return self._status | [
"def",
"GetStatus",
"(",
"self",
")",
":",
"return",
"self",
".",
"_status"
] | https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/buttonpanel.py#L1533-L1541 | |
Tencent/bk-bcs-saas | 2b437bf2f5fd5ce2078f7787c3a12df609f7679d | bcs-app/backend/resources/namespace/client.py | python | Namespace.get_or_create_cc_namespace | (self, name: str, username: str) | return self._create_namespace(username, name) | 尝试在 PaaSCC 中查询指定命名空间,若不存在则创建
:param name: 命名空间名称
:param username: 操作者
:return: Namespace 信息 | 尝试在 PaaSCC 中查询指定命名空间,若不存在则创建 | [
"尝试在",
"PaaSCC",
"中查询指定命名空间,若不存在则创建"
] | def get_or_create_cc_namespace(self, name: str, username: str) -> Dict:
"""
尝试在 PaaSCC 中查询指定命名空间,若不存在则创建
:param name: 命名空间名称
:param username: 操作者
:return: Namespace 信息
"""
# 假定cc中有,集群中也存在
cc_namespaces = get_namespaces_by_cluster_id(
self.ctx_... | [
"def",
"get_or_create_cc_namespace",
"(",
"self",
",",
"name",
":",
"str",
",",
"username",
":",
"str",
")",
"->",
"Dict",
":",
"# 假定cc中有,集群中也存在",
"cc_namespaces",
"=",
"get_namespaces_by_cluster_id",
"(",
"self",
".",
"ctx_cluster",
".",
"context",
".",
"auth",... | https://github.com/Tencent/bk-bcs-saas/blob/2b437bf2f5fd5ce2078f7787c3a12df609f7679d/bcs-app/backend/resources/namespace/client.py#L27-L43 | |
pyansys/pymapdl | c07291fc062b359abf0e92b95a92d753a95ef3d7 | ansys/mapdl/core/inline_functions/selection_queries.py | python | _NextSelectedEntityQueries.arnext | (self, a: int) | return self._run_query(f"ARNEXT({a})", integer=True) | Returns next selected area with a number greater than `a`.
Returns the next highest area number after the supplied
area number `a`, from the current selection.
If no 'next selected' area exists (or if the supplied
area number does not exist in the selection) `0` is
returned.
... | Returns next selected area with a number greater than `a`. | [
"Returns",
"next",
"selected",
"area",
"with",
"a",
"number",
"greater",
"than",
"a",
"."
] | def arnext(self, a: int) -> int:
"""Returns next selected area with a number greater than `a`.
Returns the next highest area number after the supplied
area number `a`, from the current selection.
If no 'next selected' area exists (or if the supplied
area number does not exist i... | [
"def",
"arnext",
"(",
"self",
",",
"a",
":",
"int",
")",
"->",
"int",
":",
"return",
"self",
".",
"_run_query",
"(",
"f\"ARNEXT({a})\"",
",",
"integer",
"=",
"True",
")"
] | https://github.com/pyansys/pymapdl/blob/c07291fc062b359abf0e92b95a92d753a95ef3d7/ansys/mapdl/core/inline_functions/selection_queries.py#L459-L496 | |
brython-dev/brython | 9cba5fb7f43a9b52fff13e89b403e02a1dfaa5f3 | www/src/Lib/stat.py | python | S_ISBLK | (mode) | return S_IFMT(mode) == S_IFBLK | Return True if mode is from a block special device file. | Return True if mode is from a block special device file. | [
"Return",
"True",
"if",
"mode",
"is",
"from",
"a",
"block",
"special",
"device",
"file",
"."
] | def S_ISBLK(mode):
"""Return True if mode is from a block special device file."""
return S_IFMT(mode) == S_IFBLK | [
"def",
"S_ISBLK",
"(",
"mode",
")",
":",
"return",
"S_IFMT",
"(",
"mode",
")",
"==",
"S_IFBLK"
] | https://github.com/brython-dev/brython/blob/9cba5fb7f43a9b52fff13e89b403e02a1dfaa5f3/www/src/Lib/stat.py#L58-L60 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy-bench.py | python | test_basic | () | [] | def test_basic():
assert list(unify(a, x, {})) == [{x: a}]
assert list(unify(a, x, {x: 10})) == []
assert list(unify(1, x, {})) == [{x: 1}]
assert list(unify(a, a, {})) == [{}]
assert list(unify((w, x), (y, z), {})) == [{w: y, x: z}]
assert list(unify(x, (a, b), {})) == [{x: (a, b)}]
assert... | [
"def",
"test_basic",
"(",
")",
":",
"assert",
"list",
"(",
"unify",
"(",
"a",
",",
"x",
",",
"{",
"}",
")",
")",
"==",
"[",
"{",
"x",
":",
"a",
"}",
"]",
"assert",
"list",
"(",
"unify",
"(",
"a",
",",
"x",
",",
"{",
"x",
":",
"10",
"}",
... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy-bench.py#L26-L36 | ||||
darrellsilver/norc | 7736899cbe27c8db6dcbf1e04d7fd4eb4a8f8a9d | core/models/schedules.py | python | CronSchedule.pretty_name | (self) | return self.encoding | Returns the pretty (predefined) name for this schedule. | Returns the pretty (predefined) name for this schedule. | [
"Returns",
"the",
"pretty",
"(",
"predefined",
")",
"name",
"for",
"this",
"schedule",
"."
] | def pretty_name(self):
"""Returns the pretty (predefined) name for this schedule."""
searchs = {
r'o\*d\*w\*h\*m(\d+),(\d+)s\d+': 'HALFHOURLY',
r'o\*d\*w\*h\*m\d+s\d+': 'HOURLY',
r'o\*d\*w\*h\d+m\d+s\d+': 'DAILY',
r'o\*d\*w\d+h\d+m\d+s\d+': 'WEEKLY',
... | [
"def",
"pretty_name",
"(",
"self",
")",
":",
"searchs",
"=",
"{",
"r'o\\*d\\*w\\*h\\*m(\\d+),(\\d+)s\\d+'",
":",
"'HALFHOURLY'",
",",
"r'o\\*d\\*w\\*h\\*m\\d+s\\d+'",
":",
"'HOURLY'",
",",
"r'o\\*d\\*w\\*h\\d+m\\d+s\\d+'",
":",
"'DAILY'",
",",
"r'o\\*d\\*w\\d+h\\d+m\\d+s\\d... | https://github.com/darrellsilver/norc/blob/7736899cbe27c8db6dcbf1e04d7fd4eb4a8f8a9d/core/models/schedules.py#L356-L374 | |
retentioneering/retentioneering-tools | 71aa4c5c8297e61773d1ba576b3cd7cef5cecdb3 | retentioneering/core/core_functions/_legacy_functions.py | python | core_event_distribution | (self, core_events, index_col=None, event_col=None,
thresh=None, plotting=True, use_greater=True, **kwargs) | return self._obj[self._obj[self._index_col()].isin(f)].reset_index(drop=True) | [] | def core_event_distribution(self, core_events, index_col=None, event_col=None,
thresh=None, plotting=True, use_greater=True, **kwargs):
self._init_cols(locals())
if type(core_events) == str:
core_events = [core_events]
self._obj['is_core_event'] = self._obj[self._event_co... | [
"def",
"core_event_distribution",
"(",
"self",
",",
"core_events",
",",
"index_col",
"=",
"None",
",",
"event_col",
"=",
"None",
",",
"thresh",
"=",
"None",
",",
"plotting",
"=",
"True",
",",
"use_greater",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",... | https://github.com/retentioneering/retentioneering-tools/blob/71aa4c5c8297e61773d1ba576b3cd7cef5cecdb3/retentioneering/core/core_functions/_legacy_functions.py#L589-L602 | |||
cobbler/cobbler | eed8cdca3e970c8aa1d199e80b8c8f19b3f940cc | cobbler/utils.py | python | get_mtab | (mtab="/etc/mtab", vfstype: bool = False) | return mtab_map | Get the list of mtab entries. If a custom mtab should be read then the location can be overridden via a parameter.
:param mtab: The location of the mtab. Argument can be omitted if the mtab is at its default location.
:param vfstype: If this is True, then all filesystems which are nfs are returned. Otherwise t... | Get the list of mtab entries. If a custom mtab should be read then the location can be overridden via a parameter. | [
"Get",
"the",
"list",
"of",
"mtab",
"entries",
".",
"If",
"a",
"custom",
"mtab",
"should",
"be",
"read",
"then",
"the",
"location",
"can",
"be",
"overridden",
"via",
"a",
"parameter",
"."
] | def get_mtab(mtab="/etc/mtab", vfstype: bool = False) -> list:
"""
Get the list of mtab entries. If a custom mtab should be read then the location can be overridden via a parameter.
:param mtab: The location of the mtab. Argument can be omitted if the mtab is at its default location.
:param vfstype: If... | [
"def",
"get_mtab",
"(",
"mtab",
"=",
"\"/etc/mtab\"",
",",
"vfstype",
":",
"bool",
"=",
"False",
")",
"->",
"list",
":",
"global",
"mtab_mtime",
",",
"mtab_map",
"mtab_stat",
"=",
"os",
".",
"stat",
"(",
"mtab",
")",
"if",
"mtab_stat",
".",
"st_mtime",
... | https://github.com/cobbler/cobbler/blob/eed8cdca3e970c8aa1d199e80b8c8f19b3f940cc/cobbler/utils.py#L1459-L1484 | |
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/cwp/v20180228/models.py | python | DescribeAssetWebFrameListResponse.__init__ | (self) | r"""
:param Total: 记录总数
:type Total: int
:param WebFrames: 列表
注意:此字段可能返回 null,表示取不到有效值。
:type WebFrames: list of AssetWebFrameBaseInfo
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str | r"""
:param Total: 记录总数
:type Total: int
:param WebFrames: 列表
注意:此字段可能返回 null,表示取不到有效值。
:type WebFrames: list of AssetWebFrameBaseInfo
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str | [
"r",
":",
"param",
"Total",
":",
"记录总数",
":",
"type",
"Total",
":",
"int",
":",
"param",
"WebFrames",
":",
"列表",
"注意:此字段可能返回",
"null,表示取不到有效值。",
":",
"type",
"WebFrames",
":",
"list",
"of",
"AssetWebFrameBaseInfo",
":",
"param",
"RequestId",
":",
"唯一请求",
"... | def __init__(self):
r"""
:param Total: 记录总数
:type Total: int
:param WebFrames: 列表
注意:此字段可能返回 null,表示取不到有效值。
:type WebFrames: list of AssetWebFrameBaseInfo
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.To... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"Total",
"=",
"None",
"self",
".",
"WebFrames",
"=",
"None",
"self",
".",
"RequestId",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/cwp/v20180228/models.py#L6611-L6623 | ||
williamSYSU/TextGAN-PyTorch | 891635af6845edfee382de147faa4fc00c7e90eb | metrics/nll.py | python | NLL.reset | (self, model=None, data_loader=None, label_i=None, leak_dis=None) | [] | def reset(self, model=None, data_loader=None, label_i=None, leak_dis=None):
self.model = model
self.data_loader = data_loader
self.label_i = label_i
self.leak_dis = leak_dis | [
"def",
"reset",
"(",
"self",
",",
"model",
"=",
"None",
",",
"data_loader",
"=",
"None",
",",
"label_i",
"=",
"None",
",",
"leak_dis",
"=",
"None",
")",
":",
"self",
".",
"model",
"=",
"model",
"self",
".",
"data_loader",
"=",
"data_loader",
"self",
... | https://github.com/williamSYSU/TextGAN-PyTorch/blob/891635af6845edfee382de147faa4fc00c7e90eb/metrics/nll.py#L43-L47 | ||||
yorikvanhavre/BIM_Workbench | 1114096d1f6abe15ce93c6ca8fed568f52765753 | archobjects/wall.py | python | Wall.onChanged | (self, obj, prop) | This method is activated when a property changes. | This method is activated when a property changes. | [
"This",
"method",
"is",
"activated",
"when",
"a",
"property",
"changes",
"."
] | def onChanged(self, obj, prop):
"""This method is activated when a property changes.
"""
super(Wall, self).onChanged(obj, prop)
if prop == "Material" and hasattr(obj, "Material"):
if obj.Material and utils.get_type(obj.Material) == 'MultiMaterial':
obj.Width ... | [
"def",
"onChanged",
"(",
"self",
",",
"obj",
",",
"prop",
")",
":",
"super",
"(",
"Wall",
",",
"self",
")",
".",
"onChanged",
"(",
"obj",
",",
"prop",
")",
"if",
"prop",
"==",
"\"Material\"",
"and",
"hasattr",
"(",
"obj",
",",
"\"Material\"",
")",
... | https://github.com/yorikvanhavre/BIM_Workbench/blob/1114096d1f6abe15ce93c6ca8fed568f52765753/archobjects/wall.py#L225-L280 | ||
we1h0/SecurityManageFramwork | e706461bdf5e2bc78e9fc59c66904b95e81e331e | RBAC/templatetags/custom_tag.py | python | get_structure_data | (request) | return menu_data | 处理菜单结构 | 处理菜单结构 | [
"处理菜单结构"
] | def get_structure_data(request):
"""处理菜单结构"""
menu = request.session[settings.SESSION_MENU_KEY]
all_menu = menu[settings.ALL_MENU_KEY]
permission_url = menu[settings.PERMISSION_MENU_KEY]
all_menu_dict = {}
for item in all_menu:
item['children'] = []
all_menu_dict[item['id']]... | [
"def",
"get_structure_data",
"(",
"request",
")",
":",
"menu",
"=",
"request",
".",
"session",
"[",
"settings",
".",
"SESSION_MENU_KEY",
"]",
"all_menu",
"=",
"menu",
"[",
"settings",
".",
"ALL_MENU_KEY",
"]",
"permission_url",
"=",
"menu",
"[",
"settings",
... | https://github.com/we1h0/SecurityManageFramwork/blob/e706461bdf5e2bc78e9fc59c66904b95e81e331e/RBAC/templatetags/custom_tag.py#L16-L49 | |
kkroening/ffmpeg-python | f3079726fae7b7b71e4175f79c5eeaddc1d205fb | ffmpeg/nodes.py | python | OutputStream.__init__ | (self, upstream_node, upstream_label, upstream_selector=None) | [] | def __init__(self, upstream_node, upstream_label, upstream_selector=None):
super(OutputStream, self).__init__(
upstream_node,
upstream_label,
{OutputNode, GlobalNode, MergeOutputsNode},
upstream_selector=upstream_selector,
) | [
"def",
"__init__",
"(",
"self",
",",
"upstream_node",
",",
"upstream_label",
",",
"upstream_selector",
"=",
"None",
")",
":",
"super",
"(",
"OutputStream",
",",
"self",
")",
".",
"__init__",
"(",
"upstream_node",
",",
"upstream_label",
",",
"{",
"OutputNode",
... | https://github.com/kkroening/ffmpeg-python/blob/f3079726fae7b7b71e4175f79c5eeaddc1d205fb/ffmpeg/nodes.py#L323-L329 | ||||
MVIG-SJTU/AlphaPose | bcfbc997526bcac464d116356ac2efea9483ff68 | alphapose/utils/bbox.py | python | bbox_xywh_to_xyxy | (xywh) | Convert bounding boxes from format (x, y, w, h) to (xmin, ymin, xmax, ymax)
Parameters
----------
xywh : list, tuple or numpy.ndarray
The bbox in format (x, y, w, h).
If numpy.ndarray is provided, we expect multiple bounding boxes with
shape `(N, 4)`.
Returns
-------
tu... | Convert bounding boxes from format (x, y, w, h) to (xmin, ymin, xmax, ymax) | [
"Convert",
"bounding",
"boxes",
"from",
"format",
"(",
"x",
"y",
"w",
"h",
")",
"to",
"(",
"xmin",
"ymin",
"xmax",
"ymax",
")"
] | def bbox_xywh_to_xyxy(xywh):
"""Convert bounding boxes from format (x, y, w, h) to (xmin, ymin, xmax, ymax)
Parameters
----------
xywh : list, tuple or numpy.ndarray
The bbox in format (x, y, w, h).
If numpy.ndarray is provided, we expect multiple bounding boxes with
shape `(N, ... | [
"def",
"bbox_xywh_to_xyxy",
"(",
"xywh",
")",
":",
"if",
"isinstance",
"(",
"xywh",
",",
"(",
"tuple",
",",
"list",
")",
")",
":",
"if",
"not",
"len",
"(",
"xywh",
")",
"==",
"4",
":",
"raise",
"IndexError",
"(",
"\"Bounding boxes must have 4 elements, giv... | https://github.com/MVIG-SJTU/AlphaPose/blob/bcfbc997526bcac464d116356ac2efea9483ff68/alphapose/utils/bbox.py#L40-L71 | ||
bendmorris/static-python | 2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473 | Lib/uu.py | python | test | () | uuencode/uudecode main program | uuencode/uudecode main program | [
"uuencode",
"/",
"uudecode",
"main",
"program"
] | def test():
"""uuencode/uudecode main program"""
import optparse
parser = optparse.OptionParser(usage='usage: %prog [-d] [-t] [input [output]]')
parser.add_option('-d', '--decode', dest='decode', help='Decode (instead of encode)?', default=False, action='store_true')
parser.add_option('-t', '--text... | [
"def",
"test",
"(",
")",
":",
"import",
"optparse",
"parser",
"=",
"optparse",
".",
"OptionParser",
"(",
"usage",
"=",
"'usage: %prog [-d] [-t] [input [output]]'",
")",
"parser",
".",
"add_option",
"(",
"'-d'",
",",
"'--decode'",
",",
"dest",
"=",
"'decode'",
... | https://github.com/bendmorris/static-python/blob/2e0f8c4d7ed5b359dc7d8a75b6fb37e6b6c5c473/Lib/uu.py#L160-L196 | ||
gramps-project/gramps | 04d4651a43eb210192f40a9f8c2bad8ee8fa3753 | gramps/cli/clidbman.py | python | CLIDbManager.break_lock | (self, dbpath) | Breaks the lock on a database | Breaks the lock on a database | [
"Breaks",
"the",
"lock",
"on",
"a",
"database"
] | def break_lock(self, dbpath):
"""
Breaks the lock on a database
"""
if os.path.exists(os.path.join(dbpath, "lock")):
os.unlink(os.path.join(dbpath, "lock")) | [
"def",
"break_lock",
"(",
"self",
",",
"dbpath",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"os",
".",
"path",
".",
"join",
"(",
"dbpath",
",",
"\"lock\"",
")",
")",
":",
"os",
".",
"unlink",
"(",
"os",
".",
"path",
".",
"join",
"("... | https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/cli/clidbman.py#L454-L459 | ||
pyside/pyside2-setup | d526f801ced4687d5413907a93dedcd782ef72fa | tools/qtpy2cpp_lib/formatter.py | python | format_literal | (node) | return '' | Returns the value of number/string literals | Returns the value of number/string literals | [
"Returns",
"the",
"value",
"of",
"number",
"/",
"string",
"literals"
] | def format_literal(node):
"""Returns the value of number/string literals"""
if isinstance(node, ast.Num):
return str(node.n)
if isinstance(node, ast.Str):
# Fixme: escaping
return f'"{node.s}"'
return '' | [
"def",
"format_literal",
"(",
"node",
")",
":",
"if",
"isinstance",
"(",
"node",
",",
"ast",
".",
"Num",
")",
":",
"return",
"str",
"(",
"node",
".",
"n",
")",
"if",
"isinstance",
"(",
"node",
",",
"ast",
".",
"Str",
")",
":",
"# Fixme: escaping",
... | https://github.com/pyside/pyside2-setup/blob/d526f801ced4687d5413907a93dedcd782ef72fa/tools/qtpy2cpp_lib/formatter.py#L111-L118 | |
redis/redis-py | 0affa0ed3f3cbcb6dec29b34a580f769f69ae9f7 | redis/commands/sentinel.py | python | SentinelCommands.sentinel_remove | (self, name) | return self.execute_command("SENTINEL REMOVE", name) | Remove a master from Sentinel's monitoring | Remove a master from Sentinel's monitoring | [
"Remove",
"a",
"master",
"from",
"Sentinel",
"s",
"monitoring"
] | def sentinel_remove(self, name):
"Remove a master from Sentinel's monitoring"
return self.execute_command("SENTINEL REMOVE", name) | [
"def",
"sentinel_remove",
"(",
"self",
",",
"name",
")",
":",
"return",
"self",
".",
"execute_command",
"(",
"\"SENTINEL REMOVE\"",
",",
"name",
")"
] | https://github.com/redis/redis-py/blob/0affa0ed3f3cbcb6dec29b34a580f769f69ae9f7/redis/commands/sentinel.py#L30-L32 | |
noxrepo/pox | 5f82461e01f8822bd7336603b361bff4ffbd2380 | pox/openflow/spanning_tree.py | python | _calc_spanning_tree | () | return tree | Calculates the actual spanning tree
Returns it as dictionary where the keys are DPID1, and the
values are tuples of (DPID2, port-num), where port-num
is the port on DPID1 connecting to DPID2. | Calculates the actual spanning tree | [
"Calculates",
"the",
"actual",
"spanning",
"tree"
] | def _calc_spanning_tree ():
"""
Calculates the actual spanning tree
Returns it as dictionary where the keys are DPID1, and the
values are tuples of (DPID2, port-num), where port-num
is the port on DPID1 connecting to DPID2.
"""
def flip (link):
return Discovery.Link(link[2],link[3], link[0],link[1])
... | [
"def",
"_calc_spanning_tree",
"(",
")",
":",
"def",
"flip",
"(",
"link",
")",
":",
"return",
"Discovery",
".",
"Link",
"(",
"link",
"[",
"2",
"]",
",",
"link",
"[",
"3",
"]",
",",
"link",
"[",
"0",
"]",
",",
"link",
"[",
"1",
"]",
")",
"adj",
... | https://github.com/noxrepo/pox/blob/5f82461e01f8822bd7336603b361bff4ffbd2380/pox/openflow/spanning_tree.py#L47-L117 | |
uqfoundation/multiprocess | 028cc73f02655e6451d92e5147d19d8c10aebe50 | py3.8/multiprocess/connection.py | python | Listener.close | (self) | Close the bound socket or named pipe of `self`. | Close the bound socket or named pipe of `self`. | [
"Close",
"the",
"bound",
"socket",
"or",
"named",
"pipe",
"of",
"self",
"."
] | def close(self):
'''
Close the bound socket or named pipe of `self`.
'''
listener = self._listener
if listener is not None:
self._listener = None
listener.close() | [
"def",
"close",
"(",
"self",
")",
":",
"listener",
"=",
"self",
".",
"_listener",
"if",
"listener",
"is",
"not",
"None",
":",
"self",
".",
"_listener",
"=",
"None",
"listener",
".",
"close",
"(",
")"
] | https://github.com/uqfoundation/multiprocess/blob/028cc73f02655e6451d92e5147d19d8c10aebe50/py3.8/multiprocess/connection.py#L472-L479 | ||
demisto/content | 5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07 | Packs/GSuiteAdmin/Integrations/GSuiteAdmin/GSuiteAdmin.py | python | user_alias_add_command | (client, args: Dict[str, Any]) | return CommandResults(
outputs_prefix=OUTPUT_PREFIX['ADD_ALIAS'],
outputs_key_field=['id', 'alias'],
outputs=outputs,
readable_output=readable_output,
raw_response=response
) | Adds an alias.
:param client: client object which is used to get response from api
:param args: command arguments.
:return: CommandResults object with context and human-readable. | Adds an alias. | [
"Adds",
"an",
"alias",
"."
] | def user_alias_add_command(client, args: Dict[str, Any]) -> CommandResults:
"""
Adds an alias.
:param client: client object which is used to get response from api
:param args: command arguments.
:return: CommandResults object with context and human-readable.
"""
user_key = args.get('user_k... | [
"def",
"user_alias_add_command",
"(",
"client",
",",
"args",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"CommandResults",
":",
"user_key",
"=",
"args",
".",
"get",
"(",
"'user_key'",
",",
"''",
")",
"user_key",
"=",
"urllib",
".",
"parse",
".... | https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/GSuiteAdmin/Integrations/GSuiteAdmin/GSuiteAdmin.py#L633-L663 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.