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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Calysto/metakernel | 9815c0e8b3f9c427105b5d094e9041a303302469 | metakernel/_metakernel.py | python | MetaKernel.register_magics | (self, magic_klass) | Register magics for a given magic_klass. | Register magics for a given magic_klass. | [
"Register",
"magics",
"for",
"a",
"given",
"magic_klass",
"."
] | def register_magics(self, magic_klass):
"""Register magics for a given magic_klass."""
magic = magic_klass(self)
line_magics = magic.get_magics('line')
cell_magics = magic.get_magics('cell')
for name in line_magics:
self.line_magics[name] = magic
for name in c... | [
"def",
"register_magics",
"(",
"self",
",",
"magic_klass",
")",
":",
"magic",
"=",
"magic_klass",
"(",
"self",
")",
"line_magics",
"=",
"magic",
".",
"get_magics",
"(",
"'line'",
")",
"cell_magics",
"=",
"magic",
".",
"get_magics",
"(",
"'cell'",
")",
"for... | https://github.com/Calysto/metakernel/blob/9815c0e8b3f9c427105b5d094e9041a303302469/metakernel/_metakernel.py#L770-L778 | ||
deepmind/dm_control | 806a10e896e7c887635328bfa8352604ad0fedae | dm_control/locomotion/walkers/cmu_humanoid.py | python | _CMUHumanoidBase.mjcf_model | (self) | return self._mjcf_root | [] | def mjcf_model(self):
return self._mjcf_root | [
"def",
"mjcf_model",
"(",
"self",
")",
":",
"return",
"self",
".",
"_mjcf_root"
] | https://github.com/deepmind/dm_control/blob/806a10e896e7c887635328bfa8352604ad0fedae/dm_control/locomotion/walkers/cmu_humanoid.py#L281-L282 | |||
bungnoid/glTools | 8ff0899de43784a18bd4543285655e68e28fb5e5 | utils/boundingBox.py | python | getBoundingBoxScale | (geometry,worldSpace=True) | return scale | Return bounding box scale for the specified geometry.
@param geometry: Geometry to return bounding box for
@type geometry: str
@param worldSpace: Calculate bounding box in world or local space
@type worldSpace: bool | Return bounding box scale for the specified geometry. | [
"Return",
"bounding",
"box",
"scale",
"for",
"the",
"specified",
"geometry",
"."
] | def getBoundingBoxScale(geometry,worldSpace=True):
'''
Return bounding box scale for the specified geometry.
@param geometry: Geometry to return bounding box for
@type geometry: str
@param worldSpace: Calculate bounding box in world or local space
@type worldSpace: bool
'''
# Get Bounding Box Min/Max
minPt = g... | [
"def",
"getBoundingBoxScale",
"(",
"geometry",
",",
"worldSpace",
"=",
"True",
")",
":",
"# Get Bounding Box Min/Max",
"minPt",
"=",
"getBoundingBoxMin",
"(",
"geometry",
",",
"worldSpace",
"=",
"worldSpace",
")",
"maxPt",
"=",
"getBoundingBoxMax",
"(",
"geometry",
... | https://github.com/bungnoid/glTools/blob/8ff0899de43784a18bd4543285655e68e28fb5e5/utils/boundingBox.py#L120-L136 | |
pbiernat/ripr | 223954f4b2e1283239c80df9ea434050da710de7 | analysis_engine.py | python | aengine.get_nop_opcode | (self) | Function should return a string corresponding to a NOP on the specified
architecture. | Function should return a string corresponding to a NOP on the specified
architecture. | [
"Function",
"should",
"return",
"a",
"string",
"corresponding",
"to",
"a",
"NOP",
"on",
"the",
"specified",
"architecture",
"."
] | def get_nop_opcode(self):
'''
Function should return a string corresponding to a NOP on the specified
architecture.
'''
pass | [
"def",
"get_nop_opcode",
"(",
"self",
")",
":",
"pass"
] | https://github.com/pbiernat/ripr/blob/223954f4b2e1283239c80df9ea434050da710de7/analysis_engine.py#L78-L83 | ||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/Lib/decimal.py | python | Decimal._round_half_even | (self, prec) | Round 5 to even, rest to nearest. | Round 5 to even, rest to nearest. | [
"Round",
"5",
"to",
"even",
"rest",
"to",
"nearest",
"."
] | def _round_half_even(self, prec):
"""Round 5 to even, rest to nearest."""
if _exact_half(self._int, prec) and \
(prec == 0 or self._int[prec-1] in '02468'):
return -1
else:
return self._round_half_up(prec) | [
"def",
"_round_half_even",
"(",
"self",
",",
"prec",
")",
":",
"if",
"_exact_half",
"(",
"self",
".",
"_int",
",",
"prec",
")",
"and",
"(",
"prec",
"==",
"0",
"or",
"self",
".",
"_int",
"[",
"prec",
"-",
"1",
"]",
"in",
"'02468'",
")",
":",
"retu... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/Lib/decimal.py#L1769-L1775 | ||
keikoproj/minion-manager | c4e89a5c4614f86f0e58acb919bb99cd9122c897 | cloud_provider/aws/aws_minion_manager.py | python | AWSMinionManager.schedule_instance_termination | (self, asg_meta) | return | Checks whether any of the instances in the asg need to be terminated. | Checks whether any of the instances in the asg need to be terminated. | [
"Checks",
"whether",
"any",
"of",
"the",
"instances",
"in",
"the",
"asg",
"need",
"to",
"be",
"terminated",
"."
] | def schedule_instance_termination(self, asg_meta):
"""
Checks whether any of the instances in the asg need to be terminated.
"""
instances = asg_meta.get_instances()
if len(instances) == 0:
return
# Check if ASG set not to terminate instance
i... | [
"def",
"schedule_instance_termination",
"(",
"self",
",",
"asg_meta",
")",
":",
"instances",
"=",
"asg_meta",
".",
"get_instances",
"(",
")",
"if",
"len",
"(",
"instances",
")",
"==",
"0",
":",
"return",
"# Check if ASG set not to terminate instance",
"if",
"asg_m... | https://github.com/keikoproj/minion-manager/blob/c4e89a5c4614f86f0e58acb919bb99cd9122c897/cloud_provider/aws/aws_minion_manager.py#L558-L632 | |
hak5/nano-tetra-modules | aa43cb5e2338b8dbd12a75314104a34ba608263b | PortalAuth/includes/scripts/libs/logging/handlers.py | python | DatagramHandler.send | (self, s) | Send a pickled string to a socket.
This function no longer allows for partial sends which can happen
when the network is busy - UDP does not guarantee delivery and
can deliver packets out of sequence. | Send a pickled string to a socket. | [
"Send",
"a",
"pickled",
"string",
"to",
"a",
"socket",
"."
] | def send(self, s):
"""
Send a pickled string to a socket.
This function no longer allows for partial sends which can happen
when the network is busy - UDP does not guarantee delivery and
can deliver packets out of sequence.
"""
if self.sock is None:
s... | [
"def",
"send",
"(",
"self",
",",
"s",
")",
":",
"if",
"self",
".",
"sock",
"is",
"None",
":",
"self",
".",
"createSocket",
"(",
")",
"self",
".",
"sock",
".",
"sendto",
"(",
"s",
",",
"(",
"self",
".",
"host",
",",
"self",
".",
"port",
")",
"... | https://github.com/hak5/nano-tetra-modules/blob/aa43cb5e2338b8dbd12a75314104a34ba608263b/PortalAuth/includes/scripts/libs/logging/handlers.py#L459-L469 | ||
bububa/MongoHub | 7f761c424741d88bb234426b74b4092c40fb4987 | Resources/pymongo/database.py | python | Database.authenticate | (self, name, password) | Authenticate to use this database.
Once authenticated, the user has full read and write access to this
database. Raises TypeError if either name or password is not an
instance of (str, unicode). Authentication lasts for the life of the
database connection, or until `Database.logout` is ... | Authenticate to use this database. | [
"Authenticate",
"to",
"use",
"this",
"database",
"."
] | def authenticate(self, name, password):
"""Authenticate to use this database.
Once authenticated, the user has full read and write access to this
database. Raises TypeError if either name or password is not an
instance of (str, unicode). Authentication lasts for the life of the
... | [
"def",
"authenticate",
"(",
"self",
",",
"name",
",",
"password",
")",
":",
"if",
"not",
"isinstance",
"(",
"name",
",",
"types",
".",
"StringTypes",
")",
":",
"raise",
"TypeError",
"(",
"\"name must be an instance of (str, unicode)\"",
")",
"if",
"not",
"isin... | https://github.com/bububa/MongoHub/blob/7f761c424741d88bb234426b74b4092c40fb4987/Resources/pymongo/database.py#L336-L370 | ||
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit - MAC OSX/tools/inject/thirdparty/chardet/eucjpprober.py | python | EUCJPProber.get_confidence | (self) | return max(contxtCf, distribCf) | [] | def get_confidence(self):
contxtCf = self._mContextAnalyzer.get_confidence()
distribCf = self._mDistributionAnalyzer.get_confidence()
return max(contxtCf, distribCf) | [
"def",
"get_confidence",
"(",
"self",
")",
":",
"contxtCf",
"=",
"self",
".",
"_mContextAnalyzer",
".",
"get_confidence",
"(",
")",
"distribCf",
"=",
"self",
".",
"_mDistributionAnalyzer",
".",
"get_confidence",
"(",
")",
"return",
"max",
"(",
"contxtCf",
",",... | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/tools/inject/thirdparty/chardet/eucjpprober.py#L87-L90 | |||
TalwalkarLab/leaf | 09ec454a5675e32e1f0546b456b77857fdece018 | models/utils/language_utils.py | python | _one_hot | (index, size) | return vec | returns one-hot vector with given size and value 1 at given index | returns one-hot vector with given size and value 1 at given index | [
"returns",
"one",
"-",
"hot",
"vector",
"with",
"given",
"size",
"and",
"value",
"1",
"at",
"given",
"index"
] | def _one_hot(index, size):
'''returns one-hot vector with given size and value 1 at given index
'''
vec = [0 for _ in range(size)]
vec[int(index)] = 1
return vec | [
"def",
"_one_hot",
"(",
"index",
",",
"size",
")",
":",
"vec",
"=",
"[",
"0",
"for",
"_",
"in",
"range",
"(",
"size",
")",
"]",
"vec",
"[",
"int",
"(",
"index",
")",
"]",
"=",
"1",
"return",
"vec"
] | https://github.com/TalwalkarLab/leaf/blob/09ec454a5675e32e1f0546b456b77857fdece018/models/utils/language_utils.py#L15-L20 | |
tensorflow/tensor2tensor | 2a33b152d7835af66a6d20afe7961751047e28dd | tensor2tensor/layers/common_layers.py | python | split_to_discretized_mix_logistic_params | (inputs) | return logits, locs, log_scales, coeffs | Splits input tensor into parameters of discretized mixture logistic.
Args:
inputs: A [batch, height, width, num_mixtures*10] tensor of floats
comprising one unconstrained mixture probability, three means
(one per channel), three standard deviations (one per channel),
and three coefficients whic... | Splits input tensor into parameters of discretized mixture logistic. | [
"Splits",
"input",
"tensor",
"into",
"parameters",
"of",
"discretized",
"mixture",
"logistic",
"."
] | def split_to_discretized_mix_logistic_params(inputs):
"""Splits input tensor into parameters of discretized mixture logistic.
Args:
inputs: A [batch, height, width, num_mixtures*10] tensor of floats
comprising one unconstrained mixture probability, three means
(one per channel), three standard devi... | [
"def",
"split_to_discretized_mix_logistic_params",
"(",
"inputs",
")",
":",
"batch",
",",
"height",
",",
"width",
",",
"output_dim",
"=",
"shape_list",
"(",
"inputs",
")",
"# pylint: disable=unbalanced-tuple-unpacking",
"num_mixtures",
"=",
"output_dim",
"//",
"10",
"... | https://github.com/tensorflow/tensor2tensor/blob/2a33b152d7835af66a6d20afe7961751047e28dd/tensor2tensor/layers/common_layers.py#L1907-L1937 | |
pytroll/satpy | 09e51f932048f98cce7919a4ff8bd2ec01e1ae98 | satpy/readers/viirs_sdr.py | python | VIIRSSDRFileHandler.end_time | (self) | return self._parse_datetime(self[date_var_path], self[time_var_path]) | Get end time. | Get end time. | [
"Get",
"end",
"time",
"."
] | def end_time(self):
"""Get end time."""
dataset_group = DATASET_KEYS[self.datasets[0]]
default_end_date = 'Data_Products/{dataset_group}/{dataset_group}_Aggr/attr/AggregateEndingDate'
default_end_time = 'Data_Products/{dataset_group}/{dataset_group}_Aggr/attr/AggregateEndingTime'
... | [
"def",
"end_time",
"(",
"self",
")",
":",
"dataset_group",
"=",
"DATASET_KEYS",
"[",
"self",
".",
"datasets",
"[",
"0",
"]",
"]",
"default_end_date",
"=",
"'Data_Products/{dataset_group}/{dataset_group}_Aggr/attr/AggregateEndingDate'",
"default_end_time",
"=",
"'Data_Prod... | https://github.com/pytroll/satpy/blob/09e51f932048f98cce7919a4ff8bd2ec01e1ae98/satpy/readers/viirs_sdr.py#L169-L176 | |
pyglet/pyglet | 2833c1df902ca81aeeffa786c12e7e87d402434b | pyglet/com.py | python | _make_callback_func | (interface, name, method_func) | return _found_impl(interface, name, method_func) | Create a callback function for ctypes if possible. | Create a callback function for ctypes if possible. | [
"Create",
"a",
"callback",
"function",
"for",
"ctypes",
"if",
"possible",
"."
] | def _make_callback_func(interface, name, method_func):
"""Create a callback function for ctypes if possible."""
if method_func is None:
return _missing_impl(interface, name)
return _found_impl(interface, name, method_func) | [
"def",
"_make_callback_func",
"(",
"interface",
",",
"name",
",",
"method_func",
")",
":",
"if",
"method_func",
"is",
"None",
":",
"return",
"_missing_impl",
"(",
"interface",
",",
"name",
")",
"return",
"_found_impl",
"(",
"interface",
",",
"name",
",",
"me... | https://github.com/pyglet/pyglet/blob/2833c1df902ca81aeeffa786c12e7e87d402434b/pyglet/com.py#L290-L295 | |
sfu-db/dataprep | 6dfb9c659e8bf73f07978ae195d0372495c6f118 | dataprep/clean/clean_mx_rfc.py | python | _format | (val: Any, output_format: str = "standard", errors: str = "coarse") | return result | Reformat a number string with proper separators and whitespace.
Parameters
----------
val
The value of number string.
output_format
If output_format = 'compact', return string without any separators or whitespace.
If output_format = 'standard', return string with proper... | Reformat a number string with proper separators and whitespace. | [
"Reformat",
"a",
"number",
"string",
"with",
"proper",
"separators",
"and",
"whitespace",
"."
] | def _format(val: Any, output_format: str = "standard", errors: str = "coarse") -> Any:
"""
Reformat a number string with proper separators and whitespace.
Parameters
----------
val
The value of number string.
output_format
If output_format = 'compact', return string withou... | [
"def",
"_format",
"(",
"val",
":",
"Any",
",",
"output_format",
":",
"str",
"=",
"\"standard\"",
",",
"errors",
":",
"str",
"=",
"\"coarse\"",
")",
"->",
"Any",
":",
"val",
"=",
"str",
"(",
"val",
")",
"result",
":",
"Any",
"=",
"[",
"]",
"if",
"... | https://github.com/sfu-db/dataprep/blob/6dfb9c659e8bf73f07978ae195d0372495c6f118/dataprep/clean/clean_mx_rfc.py#L132-L161 | |
HymanLiuTS/flaskTs | 286648286976e85d9b9a5873632331efcafe0b21 | flasky/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py | python | HTTPConnectionPool.is_same_host | (self, url) | return (scheme, host, port) == (self.scheme, self.host, self.port) | Check if the given ``url`` is a member of the same host as this
connection pool. | Check if the given ``url`` is a member of the same host as this
connection pool. | [
"Check",
"if",
"the",
"given",
"url",
"is",
"a",
"member",
"of",
"the",
"same",
"host",
"as",
"this",
"connection",
"pool",
"."
] | def is_same_host(self, url):
"""
Check if the given ``url`` is a member of the same host as this
connection pool.
"""
if url.startswith('/'):
return True
# TODO: Add optional support for socket.gethostbyname checking.
scheme, host, port = get_host(url... | [
"def",
"is_same_host",
"(",
"self",
",",
"url",
")",
":",
"if",
"url",
".",
"startswith",
"(",
"'/'",
")",
":",
"return",
"True",
"# TODO: Add optional support for socket.gethostbyname checking.",
"scheme",
",",
"host",
",",
"port",
"=",
"get_host",
"(",
"url",
... | https://github.com/HymanLiuTS/flaskTs/blob/286648286976e85d9b9a5873632331efcafe0b21/flasky/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py#L430-L447 | |
makerbot/ReplicatorG | d6f2b07785a5a5f1e172fb87cb4303b17c575d5d | skein_engines/skeinforge-50/skeinforge_application/skeinforge_plugins/craft_plugins/jitter.py | python | JitterSkein.__init__ | (self) | Initialize. | Initialize. | [
"Initialize",
"."
] | def __init__(self):
'Initialize.'
self.distanceFeedRate = gcodec.DistanceFeedRate()
self.feedRateMinute = None
self.isLoopPerimeter = False
self.layerCount = settings.LayerCount()
self.layerGolden = 0.0
self.lineIndex = 0
self.lines = None
self.loopPath = None
self.oldLocation = None
self.operatin... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"distanceFeedRate",
"=",
"gcodec",
".",
"DistanceFeedRate",
"(",
")",
"self",
".",
"feedRateMinute",
"=",
"None",
"self",
".",
"isLoopPerimeter",
"=",
"False",
"self",
".",
"layerCount",
"=",
"settings",... | https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-50/skeinforge_application/skeinforge_plugins/craft_plugins/jitter.py#L132-L144 | ||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/plot/plot3d/shapes2.py | python | polygon3d | (points, **options) | return IndexFaceSet([range(len(points))], points, **options) | Draw a polygon in 3d.
INPUT:
- ``points`` -- the vertices of the polygon
Type ``polygon3d.options`` for a dictionary of the default
options for polygons. You can change this to change
the defaults for all future polygons. Use ``polygon3d.reset()``
to reset to the default options.
EXAMP... | Draw a polygon in 3d. | [
"Draw",
"a",
"polygon",
"in",
"3d",
"."
] | def polygon3d(points, **options):
"""
Draw a polygon in 3d.
INPUT:
- ``points`` -- the vertices of the polygon
Type ``polygon3d.options`` for a dictionary of the default
options for polygons. You can change this to change
the defaults for all future polygons. Use ``polygon3d.reset()``
... | [
"def",
"polygon3d",
"(",
"points",
",",
"*",
"*",
"options",
")",
":",
"from",
"sage",
".",
"plot",
".",
"plot3d",
".",
"index_face_set",
"import",
"IndexFaceSet",
"return",
"IndexFaceSet",
"(",
"[",
"range",
"(",
"len",
"(",
"points",
")",
")",
"]",
"... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/plot/plot3d/shapes2.py#L268-L305 | |
iagcl/watchmen | d329b357e6fde3ad91e972988b160a33c12afc2a | elasticsearch/roll_indexes/packages/urllib3/contrib/_securetransport/low_level.py | python | _is_identity | (item) | return CoreFoundation.CFGetTypeID(item) == expected | Returns True if a given CFTypeRef is an identity. | Returns True if a given CFTypeRef is an identity. | [
"Returns",
"True",
"if",
"a",
"given",
"CFTypeRef",
"is",
"an",
"identity",
"."
] | def _is_identity(item):
"""
Returns True if a given CFTypeRef is an identity.
"""
expected = Security.SecIdentityGetTypeID()
return CoreFoundation.CFGetTypeID(item) == expected | [
"def",
"_is_identity",
"(",
"item",
")",
":",
"expected",
"=",
"Security",
".",
"SecIdentityGetTypeID",
"(",
")",
"return",
"CoreFoundation",
".",
"CFGetTypeID",
"(",
"item",
")",
"==",
"expected"
] | https://github.com/iagcl/watchmen/blob/d329b357e6fde3ad91e972988b160a33c12afc2a/elasticsearch/roll_indexes/packages/urllib3/contrib/_securetransport/low_level.py#L160-L165 | |
olist/correios | 5494d7457665fa9a8dffbffa976cdbd2885c54e4 | correios/models/user.py | python | Contract.end_date | (self, date) | [] | def end_date(self, date):
self._end_date = to_datetime(date) | [
"def",
"end_date",
"(",
"self",
",",
"date",
")",
":",
"self",
".",
"_end_date",
"=",
"to_datetime",
"(",
"date",
")"
] | https://github.com/olist/correios/blob/5494d7457665fa9a8dffbffa976cdbd2885c54e4/correios/models/user.py#L324-L325 | ||||
reviewboard/reviewboard | 7395902e4c181bcd1d633f61105012ffb1d18e1b | reviewboard/webapi/auth_backends.py | python | OAuth2TokenAuthBackend.verify_request | (self, request, token, user) | return (application.enabled and
application.local_site == request.local_site and
(not application.local_site or
application.local_site.is_accessible_by(user))) | Ensure the given authentication request is valid.
This method ensures the following:
* The Application being used for authentication is enabled.
* The Local Site the Application is associated with matches the Local
Site of the current HTTP request.
* If the Application is ass... | Ensure the given authentication request is valid. | [
"Ensure",
"the",
"given",
"authentication",
"request",
"is",
"valid",
"."
] | def verify_request(self, request, token, user):
"""Ensure the given authentication request is valid.
This method ensures the following:
* The Application being used for authentication is enabled.
* The Local Site the Application is associated with matches the Local
Site of th... | [
"def",
"verify_request",
"(",
"self",
",",
"request",
",",
"token",
",",
"user",
")",
":",
"application",
"=",
"token",
".",
"application",
"return",
"(",
"application",
".",
"enabled",
"and",
"application",
".",
"local_site",
"==",
"request",
".",
"local_si... | https://github.com/reviewboard/reviewboard/blob/7395902e4c181bcd1d633f61105012ffb1d18e1b/reviewboard/webapi/auth_backends.py#L34-L63 | |
returntocorp/bento | 05b365da71b65170d41fe92a702480ab76c1d17c | bento/cli.py | python | _get_version | () | return __version__ | Get the current r2c-cli version based on __init__ | Get the current r2c-cli version based on __init__ | [
"Get",
"the",
"current",
"r2c",
"-",
"cli",
"version",
"based",
"on",
"__init__"
] | def _get_version() -> str:
"""Get the current r2c-cli version based on __init__"""
from bento import __version__
return __version__ | [
"def",
"_get_version",
"(",
")",
"->",
"str",
":",
"from",
"bento",
"import",
"__version__",
"return",
"__version__"
] | https://github.com/returntocorp/bento/blob/05b365da71b65170d41fe92a702480ab76c1d17c/bento/cli.py#L126-L130 | |
tribe29/checkmk | 6260f2512e159e311f426e16b84b19d0b8e9ad0c | cmk/gui/utils/flashed_messages.py | python | get_flashed_messages | () | return [HTML(s) for s in _request_ctx_stack.top.flashes] | Return the messages flashed from the previous request to this one
Move the flashes from the session object to the current request once and
cache them for the current request. | Return the messages flashed from the previous request to this one | [
"Return",
"the",
"messages",
"flashed",
"from",
"the",
"previous",
"request",
"to",
"this",
"one"
] | def get_flashed_messages() -> List[HTML]:
"""Return the messages flashed from the previous request to this one
Move the flashes from the session object to the current request once and
cache them for the current request.
"""
flashes = _request_ctx_stack.top.flashes
if flashes is None:
if... | [
"def",
"get_flashed_messages",
"(",
")",
"->",
"List",
"[",
"HTML",
"]",
":",
"flashes",
"=",
"_request_ctx_stack",
".",
"top",
".",
"flashes",
"if",
"flashes",
"is",
"None",
":",
"if",
"not",
"hasattr",
"(",
"session",
",",
"\"session_info\"",
")",
"or",
... | https://github.com/tribe29/checkmk/blob/6260f2512e159e311f426e16b84b19d0b8e9ad0c/cmk/gui/utils/flashed_messages.py#L32-L46 | |
jython/jython3 | def4f8ec47cb7a9c799ea4c745f12badf92c5769 | lib-python/3.5.1/idlelib/CallTips.py | python | CallTips.try_open_calltip_event | (self, event) | Happens when it would be nice to open a CallTip, but not really
necessary, for example after an opening bracket, so function calls
won't be made. | Happens when it would be nice to open a CallTip, but not really
necessary, for example after an opening bracket, so function calls
won't be made. | [
"Happens",
"when",
"it",
"would",
"be",
"nice",
"to",
"open",
"a",
"CallTip",
"but",
"not",
"really",
"necessary",
"for",
"example",
"after",
"an",
"opening",
"bracket",
"so",
"function",
"calls",
"won",
"t",
"be",
"made",
"."
] | def try_open_calltip_event(self, event):
"""Happens when it would be nice to open a CallTip, but not really
necessary, for example after an opening bracket, so function calls
won't be made.
"""
self.open_calltip(False) | [
"def",
"try_open_calltip_event",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"open_calltip",
"(",
"False",
")"
] | https://github.com/jython/jython3/blob/def4f8ec47cb7a9c799ea4c745f12badf92c5769/lib-python/3.5.1/idlelib/CallTips.py#L51-L56 | ||
pymedusa/Medusa | 1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38 | ext/boto/cloudsearch/layer1.py | python | Layer1.describe_default_search_field | (self, domain_name) | return self.get_response(doc_path, 'DescribeDefaultSearchField',
params, verb='POST') | Describes options defining the default search field used by
indexing for the search domain.
:type domain_name: string
:param domain_name: A string that represents the name of a
domain. Domain names must be unique across the domains
owned by an account within an AWS regio... | Describes options defining the default search field used by
indexing for the search domain. | [
"Describes",
"options",
"defining",
"the",
"default",
"search",
"field",
"used",
"by",
"indexing",
"for",
"the",
"search",
"domain",
"."
] | def describe_default_search_field(self, domain_name):
"""
Describes options defining the default search field used by
indexing for the search domain.
:type domain_name: string
:param domain_name: A string that represents the name of a
domain. Domain names must be uni... | [
"def",
"describe_default_search_field",
"(",
"self",
",",
"domain_name",
")",
":",
"doc_path",
"=",
"(",
"'describe_default_search_field_response'",
",",
"'describe_default_search_field_result'",
",",
"'default_search_field'",
")",
"params",
"=",
"{",
"'DomainName'",
":",
... | https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/boto/cloudsearch/layer1.py#L375-L396 | |
pyqt/examples | 843bb982917cecb2350b5f6d7f42c9b7fb142ec1 | src/pyqt-official/itemviews/puzzle/puzzle.py | python | PuzzleWidget.__init__ | (self, parent=None) | [] | def __init__(self, parent=None):
super(PuzzleWidget, self).__init__(parent)
self.piecePixmaps = []
self.pieceRects = []
self.pieceLocations = []
self.highlightedRect = QRect()
self.inPlace = 0
self.setAcceptDrops(True)
self.setMinimumSize(400, 400)
... | [
"def",
"__init__",
"(",
"self",
",",
"parent",
"=",
"None",
")",
":",
"super",
"(",
"PuzzleWidget",
",",
"self",
")",
".",
"__init__",
"(",
"parent",
")",
"self",
".",
"piecePixmaps",
"=",
"[",
"]",
"self",
".",
"pieceRects",
"=",
"[",
"]",
"self",
... | https://github.com/pyqt/examples/blob/843bb982917cecb2350b5f6d7f42c9b7fb142ec1/src/pyqt-official/itemviews/puzzle/puzzle.py#L61-L72 | ||||
ShivamSarodia/ShivyC | e7d72eff237e1ef49ec70333497348baf86be425 | shivyc/spots.py | python | Spot.__hash__ | (self) | return hash((self.__class__.__name__, self.detail)) | Hash based on type and detail. | Hash based on type and detail. | [
"Hash",
"based",
"on",
"type",
"and",
"detail",
"."
] | def __hash__(self):
"""Hash based on type and detail."""
return hash((self.__class__.__name__, self.detail)) | [
"def",
"__hash__",
"(",
"self",
")",
":",
"return",
"hash",
"(",
"(",
"self",
".",
"__class__",
".",
"__name__",
",",
"self",
".",
"detail",
")",
")"
] | https://github.com/ShivamSarodia/ShivyC/blob/e7d72eff237e1ef49ec70333497348baf86be425/shivyc/spots.py#L70-L72 | |
Staffjoy/suite | 14ed49b21cf8296d2e0696a7f50f91f8e4b65072 | app/apiv2/organizations/locations/roles/users/timeoffrequests/timeoffrequest.py | python | TimeOffRequestApi.delete | (self, org_id, location_id, role_id, user_id,
time_off_request_id) | return {}, 204 | deletes a time_off_request record | deletes a time_off_request record | [
"deletes",
"a",
"time_off_request",
"record"
] | def delete(self, org_id, location_id, role_id, user_id,
time_off_request_id):
"""
deletes a time_off_request record
"""
time_off_request = TimeOffRequest.query.get_or_404(time_off_request_id)
admin_permissions = g.current_user.is_sudo(
) or g.current_user... | [
"def",
"delete",
"(",
"self",
",",
"org_id",
",",
"location_id",
",",
"role_id",
",",
"user_id",
",",
"time_off_request_id",
")",
":",
"time_off_request",
"=",
"TimeOffRequest",
".",
"query",
".",
"get_or_404",
"(",
"time_off_request_id",
")",
"admin_permissions",... | https://github.com/Staffjoy/suite/blob/14ed49b21cf8296d2e0696a7f50f91f8e4b65072/app/apiv2/organizations/locations/roles/users/timeoffrequests/timeoffrequest.py#L192-L217 | |
makerbot/ReplicatorG | d6f2b07785a5a5f1e172fb87cb4303b17c575d5d | skein_engines/skeinforge-47/skeinforge_application/skeinforge_plugins/craft_plugins/fill.py | python | RotatedLayer.__repr__ | (self) | return '%s, %s, %s' % ( self.z, self.rotation, self.nestedRings ) | Get the string representation of this RotatedLayer. | Get the string representation of this RotatedLayer. | [
"Get",
"the",
"string",
"representation",
"of",
"this",
"RotatedLayer",
"."
] | def __repr__(self):
'Get the string representation of this RotatedLayer.'
return '%s, %s, %s' % ( self.z, self.rotation, self.nestedRings ) | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"'%s, %s, %s'",
"%",
"(",
"self",
".",
"z",
",",
"self",
".",
"rotation",
",",
"self",
".",
"nestedRings",
")"
] | https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-47/skeinforge_application/skeinforge_plugins/craft_plugins/fill.py#L1337-L1339 | |
Sense-X/TSD | fb1fdd7f14f3c136f4b849914977fae1d8d49398 | mmdet/datasets/utils/np_box_mask_list_ops.py | python | ioa | (box_mask_list1, box_mask_list2) | return np_mask_ops.ioa(box_mask_list1.get_masks(), box_mask_list2.get_masks()) | Computes pairwise intersection-over-area between box and mask collections.
Intersection-over-area (ioa) between two masks mask1 and mask2 is defined as
their intersection area over mask2's area. Note that ioa is not symmetric,
that is, IOA(mask1, mask2) != IOA(mask2, mask1).
Args:
box_mask_list1: np_box_m... | Computes pairwise intersection-over-area between box and mask collections. | [
"Computes",
"pairwise",
"intersection",
"-",
"over",
"-",
"area",
"between",
"box",
"and",
"mask",
"collections",
"."
] | def ioa(box_mask_list1, box_mask_list2):
"""Computes pairwise intersection-over-area between box and mask collections.
Intersection-over-area (ioa) between two masks mask1 and mask2 is defined as
their intersection area over mask2's area. Note that ioa is not symmetric,
that is, IOA(mask1, mask2) != IOA(mask... | [
"def",
"ioa",
"(",
"box_mask_list1",
",",
"box_mask_list2",
")",
":",
"return",
"np_mask_ops",
".",
"ioa",
"(",
"box_mask_list1",
".",
"get_masks",
"(",
")",
",",
"box_mask_list2",
".",
"get_masks",
"(",
")",
")"
] | https://github.com/Sense-X/TSD/blob/fb1fdd7f14f3c136f4b849914977fae1d8d49398/mmdet/datasets/utils/np_box_mask_list_ops.py#L90-L104 | |
microsoft/nni | 31f11f51249660930824e888af0d4e022823285c | nni/algorithms/hpo/ppo_tuner/distri.py | python | CategoricalPd.neglogp | (self, x) | return tf.nn.softmax_cross_entropy_with_logits_v2(
logits=self.logits,
labels=x) | return tf.nn.sparse_softmax_cross_entropy_with_logits(logits=self.logits, labels=x)
Note: we can't use sparse_softmax_cross_entropy_with_logits because
the implementation does not allow second-order derivatives... | return tf.nn.sparse_softmax_cross_entropy_with_logits(logits=self.logits, labels=x)
Note: we can't use sparse_softmax_cross_entropy_with_logits because
the implementation does not allow second-order derivatives... | [
"return",
"tf",
".",
"nn",
".",
"sparse_softmax_cross_entropy_with_logits",
"(",
"logits",
"=",
"self",
".",
"logits",
"labels",
"=",
"x",
")",
"Note",
":",
"we",
"can",
"t",
"use",
"sparse_softmax_cross_entropy_with_logits",
"because",
"the",
"implementation",
"d... | def neglogp(self, x):
"""
return tf.nn.sparse_softmax_cross_entropy_with_logits(logits=self.logits, labels=x)
Note: we can't use sparse_softmax_cross_entropy_with_logits because
the implementation does not allow second-order derivatives...
"""
if x.dtype in {tf.uint... | [
"def",
"neglogp",
"(",
"self",
",",
"x",
")",
":",
"if",
"x",
".",
"dtype",
"in",
"{",
"tf",
".",
"uint8",
",",
"tf",
".",
"int32",
",",
"tf",
".",
"int64",
"}",
":",
"# one-hot encoding",
"x_shape_list",
"=",
"x",
".",
"shape",
".",
"as_list",
"... | https://github.com/microsoft/nni/blob/31f11f51249660930824e888af0d4e022823285c/nni/algorithms/hpo/ppo_tuner/distri.py#L81-L102 | |
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/motech/repeaters/models.py | python | FormRepeater.allowed_to_forward | (self, payload) | return (
payload.xmlns != DEVICE_LOG_XMLNS and
(not self.white_listed_form_xmlns or payload.xmlns in self.white_listed_form_xmlns
and payload.user_id not in self.user_blocklist)
) | [] | def allowed_to_forward(self, payload):
return (
payload.xmlns != DEVICE_LOG_XMLNS and
(not self.white_listed_form_xmlns or payload.xmlns in self.white_listed_form_xmlns
and payload.user_id not in self.user_blocklist)
) | [
"def",
"allowed_to_forward",
"(",
"self",
",",
"payload",
")",
":",
"return",
"(",
"payload",
".",
"xmlns",
"!=",
"DEVICE_LOG_XMLNS",
"and",
"(",
"not",
"self",
".",
"white_listed_form_xmlns",
"or",
"payload",
".",
"xmlns",
"in",
"self",
".",
"white_listed_for... | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/motech/repeaters/models.py#L607-L612 | |||
fake-name/ReadableWebProxy | ed5c7abe38706acc2684a1e6cd80242a03c5f010 | amqpstorm/message.py | python | Message.method | (self) | return self._try_decode_utf8_content(self._method, 'method') | Return the Message Method.
If auto_decode is enabled, the any strings will automatically be
decoded using decode('utf-8') if possible.
:rtype: dict | Return the Message Method. | [
"Return",
"the",
"Message",
"Method",
"."
] | def method(self):
"""Return the Message Method.
If auto_decode is enabled, the any strings will automatically be
decoded using decode('utf-8') if possible.
:rtype: dict
"""
return self._try_decode_utf8_content(self._method, 'method') | [
"def",
"method",
"(",
"self",
")",
":",
"return",
"self",
".",
"_try_decode_utf8_content",
"(",
"self",
".",
"_method",
",",
"'method'",
")"
] | https://github.com/fake-name/ReadableWebProxy/blob/ed5c7abe38706acc2684a1e6cd80242a03c5f010/amqpstorm/message.py#L78-L86 | |
tabacha/ProSafeLinux | a744882dd57e468fe70c4eeb5f91877105d9b069 | psl_class.py | python | ProSafeLinux.get_query_cmds | (self) | return rtn | return all commands which can be used in a query | return all commands which can be used in a query | [
"return",
"all",
"commands",
"which",
"can",
"be",
"used",
"in",
"a",
"query"
] | def get_query_cmds(self):
"return all commands which can be used in a query"
rtn = []
for cmd in list(self.cmd_by_name.values()):
if cmd.is_queryable():
rtn.append(cmd)
return rtn | [
"def",
"get_query_cmds",
"(",
"self",
")",
":",
"rtn",
"=",
"[",
"]",
"for",
"cmd",
"in",
"list",
"(",
"self",
".",
"cmd_by_name",
".",
"values",
"(",
")",
")",
":",
"if",
"cmd",
".",
"is_queryable",
"(",
")",
":",
"rtn",
".",
"append",
"(",
"cmd... | https://github.com/tabacha/ProSafeLinux/blob/a744882dd57e468fe70c4eeb5f91877105d9b069/psl_class.py#L160-L166 | |
ivelum/djangoql | 0788a1d4f496b19267facbad006ee63cb78c2de3 | djangoql/lexer.py | python | DjangoQLLexer.t_INT_VALUE | (self, t) | return t | [] | def t_INT_VALUE(self, t):
return t | [
"def",
"t_INT_VALUE",
"(",
"self",
",",
"t",
")",
":",
"return",
"t"
] | https://github.com/ivelum/djangoql/blob/0788a1d4f496b19267facbad006ee63cb78c2de3/djangoql/lexer.py#L121-L122 | |||
fredrik-johansson/mpmath | c11db84b3237bd8fc6721f5a0c5d7c0c98a24dc1 | mpmath/ctx_mp.py | python | MPContext.nint_distance | (ctx, x) | return n, max(re_dist, im_dist) | r"""
Return `(n,d)` where `n` is the nearest integer to `x` and `d` is
an estimate of `\log_2(|x-n|)`. If `d < 0`, `-d` gives the precision
(measured in bits) lost to cancellation when computing `x-n`.
>>> from mpmath import *
>>> n, d = nint_distance(5)
>>> ... | r"""
Return `(n,d)` where `n` is the nearest integer to `x` and `d` is
an estimate of `\log_2(|x-n|)`. If `d < 0`, `-d` gives the precision
(measured in bits) lost to cancellation when computing `x-n`. | [
"r",
"Return",
"(",
"n",
"d",
")",
"where",
"n",
"is",
"the",
"nearest",
"integer",
"to",
"x",
"and",
"d",
"is",
"an",
"estimate",
"of",
"\\",
"log_2",
"(",
"|x",
"-",
"n|",
")",
".",
"If",
"d",
"<",
"0",
"-",
"d",
"gives",
"the",
"precision",
... | def nint_distance(ctx, x):
r"""
Return `(n,d)` where `n` is the nearest integer to `x` and `d` is
an estimate of `\log_2(|x-n|)`. If `d < 0`, `-d` gives the precision
(measured in bits) lost to cancellation when computing `x-n`.
>>> from mpmath import *
>>> n, d ... | [
"def",
"nint_distance",
"(",
"ctx",
",",
"x",
")",
":",
"typx",
"=",
"type",
"(",
"x",
")",
"if",
"typx",
"in",
"int_types",
":",
"return",
"int",
"(",
"x",
")",
",",
"ctx",
".",
"ninf",
"elif",
"typx",
"is",
"rational",
".",
"mpq",
":",
"p",
"... | https://github.com/fredrik-johansson/mpmath/blob/c11db84b3237bd8fc6721f5a0c5d7c0c98a24dc1/mpmath/ctx_mp.py#L1113-L1209 | |
pyglet/pyglet | 2833c1df902ca81aeeffa786c12e7e87d402434b | pyglet/media/devices/win32.py | python | Win32AudioDeviceManager.get_devices | (self, flow=eRender, state=DEVICE_STATE_ACTIVE) | return devices | Get's all of the specified devices (by default, all output and active). | Get's all of the specified devices (by default, all output and active). | [
"Get",
"s",
"all",
"of",
"the",
"specified",
"devices",
"(",
"by",
"default",
"all",
"output",
"and",
"active",
")",
"."
] | def get_devices(self, flow=eRender, state=DEVICE_STATE_ACTIVE):
"""Get's all of the specified devices (by default, all output and active)."""
collection = IMMDeviceCollection()
self._device_enum.EnumAudioEndpoints(flow, state, byref(collection))
count = UINT()
collection.GetCoun... | [
"def",
"get_devices",
"(",
"self",
",",
"flow",
"=",
"eRender",
",",
"state",
"=",
"DEVICE_STATE_ACTIVE",
")",
":",
"collection",
"=",
"IMMDeviceCollection",
"(",
")",
"self",
".",
"_device_enum",
".",
"EnumAudioEndpoints",
"(",
"flow",
",",
"state",
",",
"b... | https://github.com/pyglet/pyglet/blob/2833c1df902ca81aeeffa786c12e7e87d402434b/pyglet/media/devices/win32.py#L273-L293 | |
bsmali4/xssfork | 515b45dfb0edb9263da544ad91fc1cb5f410bfd1 | thirdparty/bottle/bottle.py | python | MultiDict.getall | (self, key) | return self.dict.get(key) or [] | Return a (possibly empty) list of values for a key. | Return a (possibly empty) list of values for a key. | [
"Return",
"a",
"(",
"possibly",
"empty",
")",
"list",
"of",
"values",
"for",
"a",
"key",
"."
] | def getall(self, key):
""" Return a (possibly empty) list of values for a key. """
return self.dict.get(key) or [] | [
"def",
"getall",
"(",
"self",
",",
"key",
")",
":",
"return",
"self",
".",
"dict",
".",
"get",
"(",
"key",
")",
"or",
"[",
"]"
] | https://github.com/bsmali4/xssfork/blob/515b45dfb0edb9263da544ad91fc1cb5f410bfd1/thirdparty/bottle/bottle.py#L2057-L2059 | |
zeromq/pyzmq | 29aded1bf017385866dcbf7b92a954f272360060 | zmq/decorators.py | python | context | (*args, **kwargs) | return _ContextDecorator()(*args, **kwargs) | Decorator for adding a Context to a function.
Usage::
@context()
def foo(ctx):
...
.. versionadded:: 15.3
:param str name: the keyword argument passed to decorated function | Decorator for adding a Context to a function. | [
"Decorator",
"for",
"adding",
"a",
"Context",
"to",
"a",
"function",
"."
] | def context(*args, **kwargs):
"""Decorator for adding a Context to a function.
Usage::
@context()
def foo(ctx):
...
.. versionadded:: 15.3
:param str name: the keyword argument passed to decorated function
"""
return _ContextDecorator()(*args, **kwargs) | [
"def",
"context",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_ContextDecorator",
"(",
")",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/zeromq/pyzmq/blob/29aded1bf017385866dcbf7b92a954f272360060/zmq/decorators.py#L157-L170 | |
qiaoguan/Person-reid-GAN-pytorch | 18a0d63c598a3a2e8e01e2910a87b5553eb21ccb | DCGAN-tensorflow/download.py | python | download_file_from_google_drive | (id, destination) | [] | def download_file_from_google_drive(id, destination):
URL = "https://docs.google.com/uc?export=download"
session = requests.Session()
response = session.get(URL, params={ 'id': id }, stream=True)
token = get_confirm_token(response)
if token:
params = { 'id' : id, 'confirm' : token }
response = sessi... | [
"def",
"download_file_from_google_drive",
"(",
"id",
",",
"destination",
")",
":",
"URL",
"=",
"\"https://docs.google.com/uc?export=download\"",
"session",
"=",
"requests",
".",
"Session",
"(",
")",
"response",
"=",
"session",
".",
"get",
"(",
"URL",
",",
"params"... | https://github.com/qiaoguan/Person-reid-GAN-pytorch/blob/18a0d63c598a3a2e8e01e2910a87b5553eb21ccb/DCGAN-tensorflow/download.py#L54-L65 | ||||
chrysn/aiocoap | 1f03d4ceb969b2b443c288c312d44c3b7c3e2031 | aiocoap/resourcedirectory/client/register.py | python | Registerer._obtain_link_data | (self) | Store a message describing the data to be POSTed to the
registration interface.
This needs to be in :class:`Message` format, but doesn't need to have
any particular code set yet (that gets set later anyway), so in effect,
the response message from the con can be returned as is. | Store a message describing the data to be POSTed to the
registration interface. | [
"Store",
"a",
"message",
"describing",
"the",
"data",
"to",
"be",
"POSTed",
"to",
"the",
"registration",
"interface",
"."
] | async def _obtain_link_data(self):
"""Store a message describing the data to be POSTed to the
registration interface.
This needs to be in :class:`Message` format, but doesn't need to have
any particular code set yet (that gets set later anyway), so in effect,
the response messag... | [
"async",
"def",
"_obtain_link_data",
"(",
"self",
")",
":",
"if",
"self",
".",
"_link_source",
"is",
"None",
":",
"self",
".",
"_link_data",
"=",
"Message",
"(",
"content_format",
"=",
"40",
",",
"payload",
"=",
"str",
"(",
"self",
".",
"_context",
".",
... | https://github.com/chrysn/aiocoap/blob/1f03d4ceb969b2b443c288c312d44c3b7c3e2031/aiocoap/resourcedirectory/client/register.py#L155-L173 | ||
lad1337/XDM | 0c1b7009fe00f06f102a6f67c793478f515e7efe | site-packages/pylint/checkers/base.py | python | DocStringChecker._check_docstring | (self, node_type, node) | check the node has a non empty docstring | check the node has a non empty docstring | [
"check",
"the",
"node",
"has",
"a",
"non",
"empty",
"docstring"
] | def _check_docstring(self, node_type, node):
"""check the node has a non empty docstring"""
docstring = node.doc
if docstring is None:
self.stats['undocumented_'+node_type] += 1
self.add_message('C0111', node=node)
elif not docstring.strip():
self.stat... | [
"def",
"_check_docstring",
"(",
"self",
",",
"node_type",
",",
"node",
")",
":",
"docstring",
"=",
"node",
".",
"doc",
"if",
"docstring",
"is",
"None",
":",
"self",
".",
"stats",
"[",
"'undocumented_'",
"+",
"node_type",
"]",
"+=",
"1",
"self",
".",
"a... | https://github.com/lad1337/XDM/blob/0c1b7009fe00f06f102a6f67c793478f515e7efe/site-packages/pylint/checkers/base.py#L833-L841 | ||
rembo10/headphones | b3199605be1ebc83a7a8feab6b1e99b64014187c | headphones/notifiers.py | python | TELEGRAM.notify | (self, message, status, rgid=None, image=None) | return sent_successfuly | [] | def notify(self, message, status, rgid=None, image=None):
if not headphones.CONFIG.TELEGRAM_ENABLED:
return
import requests
TELEGRAM_API = "https://api.telegram.org/bot%s/%s"
# Get configuration data
token = headphones.CONFIG.TELEGRAM_TOKEN
userid = headpho... | [
"def",
"notify",
"(",
"self",
",",
"message",
",",
"status",
",",
"rgid",
"=",
"None",
",",
"image",
"=",
"None",
")",
":",
"if",
"not",
"headphones",
".",
"CONFIG",
".",
"TELEGRAM_ENABLED",
":",
"return",
"import",
"requests",
"TELEGRAM_API",
"=",
"\"ht... | https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/headphones/notifiers.py#L1020-L1064 | |||
iancmcc/ouimeaux | bc3c299dd275a420cba150e51b2566b150b9dc24 | ouimeaux/pysignals/dispatcher.py | python | Signal.__init__ | (self, providing_args=None, use_caching=False) | Create a new signal.
providing_args
A list of the arguments this signal can pass along in a send() call. | Create a new signal. | [
"Create",
"a",
"new",
"signal",
"."
] | def __init__(self, providing_args=None, use_caching=False):
"""
Create a new signal.
providing_args
A list of the arguments this signal can pass along in a send() call.
"""
self.receivers = []
if providing_args is None:
providing_args = []
... | [
"def",
"__init__",
"(",
"self",
",",
"providing_args",
"=",
"None",
",",
"use_caching",
"=",
"False",
")",
":",
"self",
".",
"receivers",
"=",
"[",
"]",
"if",
"providing_args",
"is",
"None",
":",
"providing_args",
"=",
"[",
"]",
"self",
".",
"providing_a... | https://github.com/iancmcc/ouimeaux/blob/bc3c299dd275a420cba150e51b2566b150b9dc24/ouimeaux/pysignals/dispatcher.py#L45-L64 | ||
holoviz/panel | 5e25cb09447d8edf0b316f130ee1318a2aeb880f | doc/generate_modules.py | python | create_module_file | (package, module, opts) | Build the text of the file and write the file. | Build the text of the file and write the file. | [
"Build",
"the",
"text",
"of",
"the",
"file",
"and",
"write",
"the",
"file",
"."
] | def create_module_file(package, module, opts):
"""Build the text of the file and write the file."""
text = format_heading(1, '%s Module' % module)
text += format_inheritance_diagram(package, module)
text += format_heading(2, ':mod:`%s` Module' % module)
text += format_directive(module, package)
... | [
"def",
"create_module_file",
"(",
"package",
",",
"module",
",",
"opts",
")",
":",
"text",
"=",
"format_heading",
"(",
"1",
",",
"'%s Module'",
"%",
"module",
")",
"text",
"+=",
"format_inheritance_diagram",
"(",
"package",
",",
"module",
")",
"text",
"+=",
... | https://github.com/holoviz/panel/blob/5e25cb09447d8edf0b316f130ee1318a2aeb880f/doc/generate_modules.py#L87-L94 | ||
pyg-team/pytorch_geometric | b920e9a3a64e22c8356be55301c88444ff051cae | torch_geometric/datasets/elliptic.py | python | EllipticBitcoinDataset.num_classes | (self) | return 2 | [] | def num_classes(self) -> int:
return 2 | [
"def",
"num_classes",
"(",
"self",
")",
"->",
"int",
":",
"return",
"2"
] | https://github.com/pyg-team/pytorch_geometric/blob/b920e9a3a64e22c8356be55301c88444ff051cae/torch_geometric/datasets/elliptic.py#L114-L115 | |||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/vod/v20180717/models.py | python | SplitMediaTaskSegmentInfo.__init__ | (self) | r"""
:param Input: 视频拆条任务输入信息。
:type Input: :class:`tencentcloud.vod.v20180717.models.SplitMediaTaskInput`
:param Output: 视频拆条任务输出信息。
注意:此字段可能返回 null,表示取不到有效值。
:type Output: :class:`tencentcloud.vod.v20180717.models.TaskOutputMediaInfo`
:param ProcedureTaskId: 若发起视频拆条任务时指定了视频处理流程... | r"""
:param Input: 视频拆条任务输入信息。
:type Input: :class:`tencentcloud.vod.v20180717.models.SplitMediaTaskInput`
:param Output: 视频拆条任务输出信息。
注意:此字段可能返回 null,表示取不到有效值。
:type Output: :class:`tencentcloud.vod.v20180717.models.TaskOutputMediaInfo`
:param ProcedureTaskId: 若发起视频拆条任务时指定了视频处理流程... | [
"r",
":",
"param",
"Input",
":",
"视频拆条任务输入信息。",
":",
"type",
"Input",
":",
":",
"class",
":",
"tencentcloud",
".",
"vod",
".",
"v20180717",
".",
"models",
".",
"SplitMediaTaskInput",
":",
"param",
"Output",
":",
"视频拆条任务输出信息。",
"注意:此字段可能返回",
"null,表示取不到有效值。",
... | def __init__(self):
r"""
:param Input: 视频拆条任务输入信息。
:type Input: :class:`tencentcloud.vod.v20180717.models.SplitMediaTaskInput`
:param Output: 视频拆条任务输出信息。
注意:此字段可能返回 null,表示取不到有效值。
:type Output: :class:`tencentcloud.vod.v20180717.models.TaskOutputMediaInfo`
:param Procedur... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"Input",
"=",
"None",
"self",
".",
"Output",
"=",
"None",
"self",
".",
"ProcedureTaskId",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/vod/v20180717/models.py#L20151-L20163 | ||
PrefectHQ/prefect | 67bdc94e2211726d99561f6f52614bec8970e981 | src/prefect/engine/state.py | python | State.is_meta_state | (self) | return isinstance(self, _MetaState) | Checks if the state is a meta state that wraps another state
Returns:
- bool: `True` if the state is a meta state, `False` otherwise | Checks if the state is a meta state that wraps another state | [
"Checks",
"if",
"the",
"state",
"is",
"a",
"meta",
"state",
"that",
"wraps",
"another",
"state"
] | def is_meta_state(self) -> bool:
"""
Checks if the state is a meta state that wraps another state
Returns:
- bool: `True` if the state is a meta state, `False` otherwise
"""
return isinstance(self, _MetaState) | [
"def",
"is_meta_state",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"isinstance",
"(",
"self",
",",
"_MetaState",
")"
] | https://github.com/PrefectHQ/prefect/blob/67bdc94e2211726d99561f6f52614bec8970e981/src/prefect/engine/state.py#L371-L378 | |
Qirky/FoxDot | 76318f9630bede48ff3994146ed644affa27bfa4 | FoxDot/lib/OSC.py | python | OSCBundle.copy | (self) | return copy | Returns a deep copy of this OSCBundle | Returns a deep copy of this OSCBundle | [
"Returns",
"a",
"deep",
"copy",
"of",
"this",
"OSCBundle"
] | def copy(self):
"""Returns a deep copy of this OSCBundle
"""
copy = super(OSCBundle, self).copy()
copy.timetag = self.timetag
return copy | [
"def",
"copy",
"(",
"self",
")",
":",
"copy",
"=",
"super",
"(",
"OSCBundle",
",",
"self",
")",
".",
"copy",
"(",
")",
"copy",
".",
"timetag",
"=",
"self",
".",
"timetag",
"return",
"copy"
] | https://github.com/Qirky/FoxDot/blob/76318f9630bede48ff3994146ed644affa27bfa4/FoxDot/lib/OSC.py#L692-L697 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/manifolds/differentiable/manifold_homset.py | python | IntegratedGeodesicSet._element_constructor_ | (self, metric, curve_parameter,
initial_tangent_vector, chart=None, name=None,
latex_name=None, verbose=False, across_charts=False) | return self.element_class(self, metric, curve_parameter,
initial_tangent_vector, chart=chart, name=name,
latex_name=latex_name, verbose=verbose, across_charts=across_charts) | r"""
Construct an element of ``self``, i.e. an integrated geodesic
`I \to M`, where `I` is a real interval and
`M` some differentiable manifold.
OUTPUT:
- :class:`~sage.manifolds.differentiable.integrated_curve.IntegratedGeodesic`
EXAMPLES::
sage: from sag... | r"""
Construct an element of ``self``, i.e. an integrated geodesic
`I \to M`, where `I` is a real interval and
`M` some differentiable manifold. | [
"r",
"Construct",
"an",
"element",
"of",
"self",
"i",
".",
"e",
".",
"an",
"integrated",
"geodesic",
"I",
"\\",
"to",
"M",
"where",
"I",
"is",
"a",
"real",
"interval",
"and",
"M",
"some",
"differentiable",
"manifold",
"."
] | def _element_constructor_(self, metric, curve_parameter,
initial_tangent_vector, chart=None, name=None,
latex_name=None, verbose=False, across_charts=False):
r"""
Construct an element of ``self``, i.e. an integrated geodesic
`I \to M`, where `I` is a real ... | [
"def",
"_element_constructor_",
"(",
"self",
",",
"metric",
",",
"curve_parameter",
",",
"initial_tangent_vector",
",",
"chart",
"=",
"None",
",",
"name",
"=",
"None",
",",
"latex_name",
"=",
"None",
",",
"verbose",
"=",
"False",
",",
"across_charts",
"=",
"... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/manifolds/differentiable/manifold_homset.py#L1679-L1713 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_openshift/library/oc_label.py | python | OpenShiftCLI.openshift_cmd | (self, cmd, oadm=False, output=False, output_type='json', input_data=None) | return rval | Base command for oc | Base command for oc | [
"Base",
"command",
"for",
"oc"
] | def openshift_cmd(self, cmd, oadm=False, output=False, output_type='json', input_data=None):
'''Base command for oc '''
cmds = [self.oc_binary]
if oadm:
cmds.append('adm')
cmds.extend(cmd)
if self.all_namespaces:
cmds.extend(['--all-namespaces'])
... | [
"def",
"openshift_cmd",
"(",
"self",
",",
"cmd",
",",
"oadm",
"=",
"False",
",",
"output",
"=",
"False",
",",
"output_type",
"=",
"'json'",
",",
"input_data",
"=",
"None",
")",
":",
"cmds",
"=",
"[",
"self",
".",
"oc_binary",
"]",
"if",
"oadm",
":",
... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.14-1/roles/lib_openshift/library/oc_label.py#L1129-L1173 | |
Chaffelson/nipyapi | d3b186fd701ce308c2812746d98af9120955e810 | nipyapi/nifi/apis/remote_process_groups_api.py | python | RemoteProcessGroupsApi.remove_remote_process_group_with_http_info | (self, id, **kwargs) | return self.api_client.call_api('/remote-process-groups/{id}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
... | Deletes a remote process group
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
... | Deletes a remote process group | [
"Deletes",
"a",
"remote",
"process",
"group"
] | def remove_remote_process_group_with_http_info(self, id, **kwargs):
"""
Deletes a remote process group
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
... | [
"def",
"remove_remote_process_group_with_http_info",
"(",
"self",
",",
"id",
",",
"*",
"*",
"kwargs",
")",
":",
"all_params",
"=",
"[",
"'id'",
",",
"'version'",
",",
"'client_id'",
",",
"'disconnected_node_acknowledged'",
"]",
"all_params",
".",
"append",
"(",
... | https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/apis/remote_process_groups_api.py#L284-L371 | |
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/_figurewidget.py | python | FigureWidget.select_ternaries | (self, selector=None, row=None, col=None) | return self._select_layout_subplots_by_prefix("ternary", selector, row, col) | Select ternary subplot objects from a particular subplot cell
and/or ternary subplot objects that satisfy custom selection
criteria.
Parameters
----------
selector: dict, function, or None (default None)
Dict to use as selection criteria.
ternary objects ... | Select ternary subplot objects from a particular subplot cell
and/or ternary subplot objects that satisfy custom selection
criteria. | [
"Select",
"ternary",
"subplot",
"objects",
"from",
"a",
"particular",
"subplot",
"cell",
"and",
"/",
"or",
"ternary",
"subplot",
"objects",
"that",
"satisfy",
"custom",
"selection",
"criteria",
"."
] | def select_ternaries(self, selector=None, row=None, col=None):
"""
Select ternary subplot objects from a particular subplot cell
and/or ternary subplot objects that satisfy custom selection
criteria.
Parameters
----------
selector: dict, function, or None (defaul... | [
"def",
"select_ternaries",
"(",
"self",
",",
"selector",
"=",
"None",
",",
"row",
"=",
"None",
",",
"col",
"=",
"None",
")",
":",
"return",
"self",
".",
"_select_layout_subplots_by_prefix",
"(",
"\"ternary\"",
",",
"selector",
",",
"row",
",",
"col",
")"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/_figurewidget.py#L20603-L20633 | |
0xdea/tactical-exploitation | 231146ac5b4caa44ed73fade0ec29767d28b20b5 | seitan.py | python | domain | (args) | Search services related to a domain or host name | Search services related to a domain or host name | [
"Search",
"services",
"related",
"to",
"a",
"domain",
"or",
"host",
"name"
] | def domain(args):
"""
Search services related to a domain or host name
"""
api = init(SHODAN_API_KEY)
targets = get_targets(args)
limit = args.l
ssl = args.ssl
# scan the target domains
for dom in targets:
# ssl cert based search
if ssl:
search_str = "s... | [
"def",
"domain",
"(",
"args",
")",
":",
"api",
"=",
"init",
"(",
"SHODAN_API_KEY",
")",
"targets",
"=",
"get_targets",
"(",
"args",
")",
"limit",
"=",
"args",
".",
"l",
"ssl",
"=",
"args",
".",
"ssl",
"# scan the target domains",
"for",
"dom",
"in",
"t... | https://github.com/0xdea/tactical-exploitation/blob/231146ac5b4caa44ed73fade0ec29767d28b20b5/seitan.py#L214-L255 | ||
Clarifai/clarifai-python | 7cd160e56799b5a4b04616a1a75961b974d2e6dc | clarifai/rest/client.py | python | Workflows.get_by_page | (self, page=1, per_page=20) | return results | get paginated workflows from the application
When the number of workflows get high, you may want to get
the paginated results from all the models
Args:
page: page number
per_page: number of models returned in one page
Returns:
a list of Workflow objects
Examples:
... | get paginated workflows from the application | [
"get",
"paginated",
"workflows",
"from",
"the",
"application"
] | def get_by_page(self, page=1, per_page=20):
# type: (bool, int, int) -> typing.List[Workflow]
""" get paginated workflows from the application
When the number of workflows get high, you may want to get
the paginated results from all the models
Args:
page: page number
per_page: ... | [
"def",
"get_by_page",
"(",
"self",
",",
"page",
"=",
"1",
",",
"per_page",
"=",
"20",
")",
":",
"# type: (bool, int, int) -> typing.List[Workflow]",
"res",
"=",
"self",
".",
"api",
".",
"get_workflows",
"(",
")",
"results",
"=",
"[",
"Workflow",
"(",
"self",... | https://github.com/Clarifai/clarifai-python/blob/7cd160e56799b5a4b04616a1a75961b974d2e6dc/clarifai/rest/client.py#L975-L996 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/sqlalchemy/sql/compiler.py | python | DDLCompiler.visit_drop_table_comment | (self, drop) | return "COMMENT ON TABLE %s IS NULL" % \
self.preparer.format_table(drop.element) | [] | def visit_drop_table_comment(self, drop):
return "COMMENT ON TABLE %s IS NULL" % \
self.preparer.format_table(drop.element) | [
"def",
"visit_drop_table_comment",
"(",
"self",
",",
"drop",
")",
":",
"return",
"\"COMMENT ON TABLE %s IS NULL\"",
"%",
"self",
".",
"preparer",
".",
"format_table",
"(",
"drop",
".",
"element",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/sqlalchemy/sql/compiler.py#L2612-L2614 | |||
maas/maas | db2f89970c640758a51247c59bf1ec6f60cf4ab5 | src/maasserver/api/blockdevices.py | python | BlockDevicesHandler.create | (self, request, system_id) | @description-title Create a block device
@description Create a physical block device.
@param (string) "{system_id}" [required=true] The machine system_id.
@param (string) "name" [required=true] Name of the block device.
@param (string) "model" [required=false] Model of the block devic... | @description-title Create a block device
@description Create a physical block device. | [
"@description",
"-",
"title",
"Create",
"a",
"block",
"device",
"@description",
"Create",
"a",
"physical",
"block",
"device",
"."
] | def create(self, request, system_id):
"""@description-title Create a block device
@description Create a physical block device.
@param (string) "{system_id}" [required=true] The machine system_id.
@param (string) "name" [required=true] Name of the block device.
@param (string) ... | [
"def",
"create",
"(",
"self",
",",
"request",
",",
"system_id",
")",
":",
"machine",
"=",
"Machine",
".",
"objects",
".",
"get_node_or_404",
"(",
"system_id",
",",
"request",
".",
"user",
",",
"NodePermission",
".",
"admin",
")",
"form",
"=",
"CreatePhysic... | https://github.com/maas/maas/blob/db2f89970c640758a51247c59bf1ec6f60cf4ab5/src/maasserver/api/blockdevices.py#L107-L147 | ||
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/site-packages/jinja2-2.8-py3.3.egg/jinja2/parser.py | python | Parser.parse_statement | (self) | Parse a single statement. | Parse a single statement. | [
"Parse",
"a",
"single",
"statement",
"."
] | def parse_statement(self):
"""Parse a single statement."""
token = self.stream.current
if token.type != 'name':
self.fail('tag name expected', token.lineno)
self._tag_stack.append(token.value)
pop_tag = True
try:
if token.value in _statement_keywor... | [
"def",
"parse_statement",
"(",
"self",
")",
":",
"token",
"=",
"self",
".",
"stream",
".",
"current",
"if",
"token",
".",
"type",
"!=",
"'name'",
":",
"self",
".",
"fail",
"(",
"'tag name expected'",
",",
"token",
".",
"lineno",
")",
"self",
".",
"_tag... | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/jinja2-2.8-py3.3.egg/jinja2/parser.py#L112-L138 | ||
HymanLiuTS/flaskTs | 286648286976e85d9b9a5873632331efcafe0b21 | flasky/lib/python2.7/site-packages/pip/_vendor/distlib/locators.py | python | Locator.clear_errors | (self) | Clear any errors which may have been logged. | Clear any errors which may have been logged. | [
"Clear",
"any",
"errors",
"which",
"may",
"have",
"been",
"logged",
"."
] | def clear_errors(self):
"""
Clear any errors which may have been logged.
"""
# Just get the errors and throw them away
self.get_errors() | [
"def",
"clear_errors",
"(",
"self",
")",
":",
"# Just get the errors and throw them away",
"self",
".",
"get_errors",
"(",
")"
] | https://github.com/HymanLiuTS/flaskTs/blob/286648286976e85d9b9a5873632331efcafe0b21/flasky/lib/python2.7/site-packages/pip/_vendor/distlib/locators.py#L132-L137 | ||
pybliometrics-dev/pybliometrics | 26ad9656e5a1d4c80774937706a0df85776f07d0 | pybliometrics/scopus/utils/parse_content.py | python | listify | (element) | Helper function to turn an element into a list if it isn't a list yet. | Helper function to turn an element into a list if it isn't a list yet. | [
"Helper",
"function",
"to",
"turn",
"an",
"element",
"into",
"a",
"list",
"if",
"it",
"isn",
"t",
"a",
"list",
"yet",
"."
] | def listify(element):
"""Helper function to turn an element into a list if it isn't a list yet.
"""
if isinstance(element, list):
return element
else:
return [element] | [
"def",
"listify",
"(",
"element",
")",
":",
"if",
"isinstance",
"(",
"element",
",",
"list",
")",
":",
"return",
"element",
"else",
":",
"return",
"[",
"element",
"]"
] | https://github.com/pybliometrics-dev/pybliometrics/blob/26ad9656e5a1d4c80774937706a0df85776f07d0/pybliometrics/scopus/utils/parse_content.py#L73-L79 | ||
dieseldev/diesel | 8d48371fce0b79d6631053594bce06e4b9628499 | diesel/util/process.py | python | ProcessPool.pool | (self) | A callable that starts the processes in the pool.
This is useful as the callable to pass to a diesel.Loop when adding a
ProcessPool to your application. | A callable that starts the processes in the pool. | [
"A",
"callable",
"that",
"starts",
"the",
"processes",
"in",
"the",
"pool",
"."
] | def pool(self):
"""A callable that starts the processes in the pool.
This is useful as the callable to pass to a diesel.Loop when adding a
ProcessPool to your application.
"""
for i in xrange(self.concurrency):
proc = spawn(self.handler)
self.available_p... | [
"def",
"pool",
"(",
"self",
")",
":",
"for",
"i",
"in",
"xrange",
"(",
"self",
".",
"concurrency",
")",
":",
"proc",
"=",
"spawn",
"(",
"self",
".",
"handler",
")",
"self",
".",
"available_procs",
".",
"put",
"(",
"proc",
")",
"self",
".",
"all_pro... | https://github.com/dieseldev/diesel/blob/8d48371fce0b79d6631053594bce06e4b9628499/diesel/util/process.py#L186-L196 | ||
MasoniteFramework/masonite | faa448377916e9e0f618ea6bdc82330fa6604efc | src/masonite/stubs/validation/RuleEnclosure.py | python | __class__.rules | (self) | return [
# Rules go here
] | Used to return a list of rules in order to make validation
more reusable.
Returns:
list -- List of rules | Used to return a list of rules in order to make validation
more reusable. | [
"Used",
"to",
"return",
"a",
"list",
"of",
"rules",
"in",
"order",
"to",
"make",
"validation",
"more",
"reusable",
"."
] | def rules(self):
"""Used to return a list of rules in order to make validation
more reusable.
Returns:
list -- List of rules
"""
return [
# Rules go here
] | [
"def",
"rules",
"(",
"self",
")",
":",
"return",
"[",
"# Rules go here",
"]"
] | https://github.com/MasoniteFramework/masonite/blob/faa448377916e9e0f618ea6bdc82330fa6604efc/src/masonite/stubs/validation/RuleEnclosure.py#L9-L18 | |
nicolargo/glances | 00c65933ae1d0ebd3e72dc30fc3c215a83dfaae2 | glances/plugins/glances_help.py | python | Plugin.reset | (self) | No stats. It is just a plugin to display the help. | No stats. It is just a plugin to display the help. | [
"No",
"stats",
".",
"It",
"is",
"just",
"a",
"plugin",
"to",
"display",
"the",
"help",
"."
] | def reset(self):
"""No stats. It is just a plugin to display the help."""
pass | [
"def",
"reset",
"(",
"self",
")",
":",
"pass"
] | https://github.com/nicolargo/glances/blob/00c65933ae1d0ebd3e72dc30fc3c215a83dfaae2/glances/plugins/glances_help.py#L47-L49 | ||
atlassian-api/atlassian-python-api | 6d8545a790c3aae10b75bdc225fb5c3a0aee44db | atlassian/bitbucket/server/common/permissions.py | python | Permissions.add | (self, name, permission) | return | Add the permission for a group/user.
:param name: string: The names of the groups/users
:param permission: string: The permission to grant.
API docs:
- For project groups see https://docs.atlassian.com/bitbucket-server/rest/7.8.0/bitbucket-rest.html#idp160
- For project users s... | Add the permission for a group/user. | [
"Add",
"the",
"permission",
"for",
"a",
"group",
"/",
"user",
"."
] | def add(self, name, permission):
"""
Add the permission for a group/user.
:param name: string: The names of the groups/users
:param permission: string: The permission to grant.
API docs:
- For project groups see https://docs.atlassian.com/bitbucket-server/rest/7.8.0/bit... | [
"def",
"add",
"(",
"self",
",",
"name",
",",
"permission",
")",
":",
"self",
".",
"put",
"(",
"name",
",",
"permission",
")",
"return"
] | https://github.com/atlassian-api/atlassian-python-api/blob/6d8545a790c3aae10b75bdc225fb5c3a0aee44db/atlassian/bitbucket/server/common/permissions.py#L37-L51 | |
GNOME/gnome-music | b7b55c8519f9cc613ca60c01a5ab8cef6b58c92e | gnomemusic/player.py | python | Player.play_pause | (self) | Toggle play/pause state | Toggle play/pause state | [
"Toggle",
"play",
"/",
"pause",
"state"
] | def play_pause(self):
"""Toggle play/pause state"""
if self.props.state == Playback.PLAYING:
self.pause()
else:
self.play() | [
"def",
"play_pause",
"(",
"self",
")",
":",
"if",
"self",
".",
"props",
".",
"state",
"==",
"Playback",
".",
"PLAYING",
":",
"self",
".",
"pause",
"(",
")",
"else",
":",
"self",
".",
"play",
"(",
")"
] | https://github.com/GNOME/gnome-music/blob/b7b55c8519f9cc613ca60c01a5ab8cef6b58c92e/gnomemusic/player.py#L557-L562 | ||
tensorflow/lingvo | ce10019243d954c3c3ebe739f7589b5eebfdf907 | lingvo/core/layers_with_attention.py | python | CCTAttentionLayer.FProp | (self,
theta,
query_vec,
source_paddings,
source_vecs=None,
query_segment_id=None,
source_segment_id=None,
**kwargs) | return h, atten_prob, query_p_c, source_p_c | CCT attention, residual and normalization layer.
Args:
theta: A `.NestedMap` object containing weights' values of this layer and
its children layers.
query_vec: [target_time, target_batch, dim]
source_paddings: [source_time, source_batch]
source_vecs: [source_time, source_batch, dim... | CCT attention, residual and normalization layer. | [
"CCT",
"attention",
"residual",
"and",
"normalization",
"layer",
"."
] | def FProp(self,
theta,
query_vec,
source_paddings,
source_vecs=None,
query_segment_id=None,
source_segment_id=None,
**kwargs):
"""CCT attention, residual and normalization layer.
Args:
theta: A `.NestedMap` object contain... | [
"def",
"FProp",
"(",
"self",
",",
"theta",
",",
"query_vec",
",",
"source_paddings",
",",
"source_vecs",
"=",
"None",
",",
"query_segment_id",
"=",
"None",
",",
"source_segment_id",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"p",
"=",
"self",
".",
... | https://github.com/tensorflow/lingvo/blob/ce10019243d954c3c3ebe739f7589b5eebfdf907/lingvo/core/layers_with_attention.py#L2284-L2386 | |
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v9/services/services/campaign_experiment_service/transports/grpc.py | python | CampaignExperimentServiceGrpcTransport.graduate_campaign_experiment | (
self,
) | return self._stubs["graduate_campaign_experiment"] | r"""Return a callable for the graduate campaign experiment method over gRPC.
Graduates a campaign experiment to a full campaign. The base and
experiment campaigns will start running independently with their
own budgets.
List of thrown errors: `AuthenticationError <>`__
`Authori... | r"""Return a callable for the graduate campaign experiment method over gRPC. | [
"r",
"Return",
"a",
"callable",
"for",
"the",
"graduate",
"campaign",
"experiment",
"method",
"over",
"gRPC",
"."
] | def graduate_campaign_experiment(
self,
) -> Callable[
[campaign_experiment_service.GraduateCampaignExperimentRequest],
campaign_experiment_service.GraduateCampaignExperimentResponse,
]:
r"""Return a callable for the graduate campaign experiment method over gRPC.
Graduat... | [
"def",
"graduate_campaign_experiment",
"(",
"self",
",",
")",
"->",
"Callable",
"[",
"[",
"campaign_experiment_service",
".",
"GraduateCampaignExperimentRequest",
"]",
",",
"campaign_experiment_service",
".",
"GraduateCampaignExperimentResponse",
",",
"]",
":",
"# Generate ... | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v9/services/services/campaign_experiment_service/transports/grpc.py#L366-L401 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/nest/climate_sdm.py | python | ThermostatEntity.hvac_modes | (self) | return supported_modes | List of available operation modes. | List of available operation modes. | [
"List",
"of",
"available",
"operation",
"modes",
"."
] | def hvac_modes(self) -> list[str]:
"""List of available operation modes."""
supported_modes = []
for mode in self._get_device_hvac_modes:
if mode in THERMOSTAT_MODE_MAP:
supported_modes.append(THERMOSTAT_MODE_MAP[mode])
if self.supported_features & SUPPORT_FAN... | [
"def",
"hvac_modes",
"(",
"self",
")",
"->",
"list",
"[",
"str",
"]",
":",
"supported_modes",
"=",
"[",
"]",
"for",
"mode",
"in",
"self",
".",
"_get_device_hvac_modes",
":",
"if",
"mode",
"in",
"THERMOSTAT_MODE_MAP",
":",
"supported_modes",
".",
"append",
... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/nest/climate_sdm.py#L215-L223 | |
libp2p/py-libp2p | d2c2a5f933244ecf005d7422d5a93972ce681f64 | libp2p/pubsub/pubsub.py | python | Pubsub.validate_msg | (self, msg_forwarder: ID, msg: rpc_pb2.Message) | Validate the received message.
:param msg_forwarder: the peer who forward us the message.
:param msg: the message. | Validate the received message. | [
"Validate",
"the",
"received",
"message",
"."
] | async def validate_msg(self, msg_forwarder: ID, msg: rpc_pb2.Message) -> None:
"""
Validate the received message.
:param msg_forwarder: the peer who forward us the message.
:param msg: the message.
"""
sync_topic_validators: List[SyncValidatorFn] = []
async_topic... | [
"async",
"def",
"validate_msg",
"(",
"self",
",",
"msg_forwarder",
":",
"ID",
",",
"msg",
":",
"rpc_pb2",
".",
"Message",
")",
"->",
"None",
":",
"sync_topic_validators",
":",
"List",
"[",
"SyncValidatorFn",
"]",
"=",
"[",
"]",
"async_topic_validators",
":",... | https://github.com/libp2p/py-libp2p/blob/d2c2a5f933244ecf005d7422d5a93972ce681f64/libp2p/pubsub/pubsub.py#L520-L559 | ||
rwth-i6/returnn | f2d718a197a280b0d5f0fd91a7fcb8658560dddb | returnn/datasets/generating.py | python | TimitDataset._demo_audio_play | (self, audio, sample_rate) | :param numpy.ndarray audio: shape (sample_len,)
:param int sample_rate: | :param numpy.ndarray audio: shape (sample_len,)
:param int sample_rate: | [
":",
"param",
"numpy",
".",
"ndarray",
"audio",
":",
"shape",
"(",
"sample_len",
")",
":",
"param",
"int",
"sample_rate",
":"
] | def _demo_audio_play(self, audio, sample_rate):
"""
:param numpy.ndarray audio: shape (sample_len,)
:param int sample_rate:
"""
assert audio.dtype == numpy.float32
assert audio.ndim == 1
try:
# noinspection PyPackageRequirements
import pyaudio
except ImportError:
print(... | [
"def",
"_demo_audio_play",
"(",
"self",
",",
"audio",
",",
"sample_rate",
")",
":",
"assert",
"audio",
".",
"dtype",
"==",
"numpy",
".",
"float32",
"assert",
"audio",
".",
"ndim",
"==",
"1",
"try",
":",
"# noinspection PyPackageRequirements",
"import",
"pyaudi... | https://github.com/rwth-i6/returnn/blob/f2d718a197a280b0d5f0fd91a7fcb8658560dddb/returnn/datasets/generating.py#L1296-L1323 | ||
sopel-irc/sopel | 787baa6e39f9dad57d94600c92e10761c41b21ef | sopel/plugins/rules.py | python | Rule.is_rate_limited | (self, nick) | return (now - last_usage_at) <= rate_limit | [] | def is_rate_limited(self, nick):
metrics = self._metrics_nick.get(nick)
if metrics is None:
return False
last_usage_at, exit_code = metrics
if exit_code == IGNORE_RATE_LIMIT:
return False
now = datetime.datetime.utcnow()
rate_limit = datetime.tim... | [
"def",
"is_rate_limited",
"(",
"self",
",",
"nick",
")",
":",
"metrics",
"=",
"self",
".",
"_metrics_nick",
".",
"get",
"(",
"nick",
")",
"if",
"metrics",
"is",
"None",
":",
"return",
"False",
"last_usage_at",
",",
"exit_code",
"=",
"metrics",
"if",
"exi... | https://github.com/sopel-irc/sopel/blob/787baa6e39f9dad57d94600c92e10761c41b21ef/sopel/plugins/rules.py#L1010-L1021 | |||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py | python | EggMetadata.__init__ | (self, importer) | Create a metadata provider from a zipimporter | Create a metadata provider from a zipimporter | [
"Create",
"a",
"metadata",
"provider",
"from",
"a",
"zipimporter"
] | def __init__(self, importer):
"""Create a metadata provider from a zipimporter"""
self.zip_pre = importer.archive + os.sep
self.loader = importer
if importer.prefix:
self.module_path = os.path.join(importer.archive, importer.prefix)
else:
self.module_path... | [
"def",
"__init__",
"(",
"self",
",",
"importer",
")",
":",
"self",
".",
"zip_pre",
"=",
"importer",
".",
"archive",
"+",
"os",
".",
"sep",
"self",
".",
"loader",
"=",
"importer",
"if",
"importer",
".",
"prefix",
":",
"self",
".",
"module_path",
"=",
... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/pip/_vendor/pkg_resources/__init__.py#L1908-L1917 | ||
microsoft/unilm | 65f15af2a307ebb64cfb25adf54375b002e6fe8d | infoxlm/fairseq/fairseq/models/fairseq_model.py | python | FairseqEncoderDecoderModel.max_decoder_positions | (self) | return self.decoder.max_positions() | Maximum length supported by the decoder. | Maximum length supported by the decoder. | [
"Maximum",
"length",
"supported",
"by",
"the",
"decoder",
"."
] | def max_decoder_positions(self):
"""Maximum length supported by the decoder."""
return self.decoder.max_positions() | [
"def",
"max_decoder_positions",
"(",
"self",
")",
":",
"return",
"self",
".",
"decoder",
".",
"max_positions",
"(",
")"
] | https://github.com/microsoft/unilm/blob/65f15af2a307ebb64cfb25adf54375b002e6fe8d/infoxlm/fairseq/fairseq/models/fairseq_model.py#L251-L253 | |
nylas/sync-engine | b91b94b9a0033be4199006eb234d270779a04443 | inbox/models/mixins.py | python | HasRevisions.versioned_relationships | (self) | return [] | May be overriden by subclasses. This should be the list of
relationship attribute names that should trigger an update revision
when changed. (We want to version changes to some, but not all,
relationship attributes.) | May be overriden by subclasses. This should be the list of
relationship attribute names that should trigger an update revision
when changed. (We want to version changes to some, but not all,
relationship attributes.) | [
"May",
"be",
"overriden",
"by",
"subclasses",
".",
"This",
"should",
"be",
"the",
"list",
"of",
"relationship",
"attribute",
"names",
"that",
"should",
"trigger",
"an",
"update",
"revision",
"when",
"changed",
".",
"(",
"We",
"want",
"to",
"version",
"change... | def versioned_relationships(self):
"""
May be overriden by subclasses. This should be the list of
relationship attribute names that should trigger an update revision
when changed. (We want to version changes to some, but not all,
relationship attributes.)
"""
ret... | [
"def",
"versioned_relationships",
"(",
"self",
")",
":",
"return",
"[",
"]"
] | https://github.com/nylas/sync-engine/blob/b91b94b9a0033be4199006eb234d270779a04443/inbox/models/mixins.py#L16-L24 | |
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/tcss/v20201101/models.py | python | CheckRepeatAssetImageRegistryRequest.__init__ | (self) | r"""
:param Name: 仓库名
:type Name: str | r"""
:param Name: 仓库名
:type Name: str | [
"r",
":",
"param",
"Name",
":",
"仓库名",
":",
"type",
"Name",
":",
"str"
] | def __init__(self):
r"""
:param Name: 仓库名
:type Name: str
"""
self.Name = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"Name",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/tcss/v20201101/models.py#L1158-L1163 | ||
johnboxall/django-paypal | 64566bcb05ad8cc75bc21d37ed82c952aaafaa6f | pro/forms.py | python | PaymentForm.process | (self, request, item) | return response | Process a PayPal direct payment. | Process a PayPal direct payment. | [
"Process",
"a",
"PayPal",
"direct",
"payment",
"."
] | def process(self, request, item):
"""Process a PayPal direct payment."""
from paypal.pro.helpers import PayPalWPP
wpp = PayPalWPP(request)
params = self.cleaned_data
params['creditcardtype'] = self.fields['acct'].card_type
params['expdate'] = self.cleaned_data['expdate']... | [
"def",
"process",
"(",
"self",
",",
"request",
",",
"item",
")",
":",
"from",
"paypal",
".",
"pro",
".",
"helpers",
"import",
"PayPalWPP",
"wpp",
"=",
"PayPalWPP",
"(",
"request",
")",
"params",
"=",
"self",
".",
"cleaned_data",
"params",
"[",
"'creditca... | https://github.com/johnboxall/django-paypal/blob/64566bcb05ad8cc75bc21d37ed82c952aaafaa6f/pro/forms.py#L21-L39 | |
IntelAI/models | 1d7a53ccfad3e6f0e7378c9e3c8840895d63df8c | models/language_translation/tensorflow/transformer_lt_official/inference/fp32/official/utils/hyperparams_flags.py | python | initialize_common_flags | () | Define the common flags across models. | Define the common flags across models. | [
"Define",
"the",
"common",
"flags",
"across",
"models",
"."
] | def initialize_common_flags():
"""Define the common flags across models."""
define_common_hparams_flags()
flags_core.define_device(tpu=True)
flags_core.define_base(
num_gpu=True, model_dir=False, data_dir=False, batch_size=False)
flags_core.define_distribution(worker_hosts=True, task_index=True)
flag... | [
"def",
"initialize_common_flags",
"(",
")",
":",
"define_common_hparams_flags",
"(",
")",
"flags_core",
".",
"define_device",
"(",
"tpu",
"=",
"True",
")",
"flags_core",
".",
"define_base",
"(",
"num_gpu",
"=",
"True",
",",
"model_dir",
"=",
"False",
",",
"dat... | https://github.com/IntelAI/models/blob/1d7a53ccfad3e6f0e7378c9e3c8840895d63df8c/models/language_translation/tensorflow/transformer_lt_official/inference/fp32/official/utils/hyperparams_flags.py#L76-L91 | ||
wxWidgets/Phoenix | b2199e299a6ca6d866aa6f3d0888499136ead9d6 | wx/lib/agw/ultimatelistctrl.py | python | UltimateListItem.GetWindowSize | (self) | return self._windowsize | Returns the associated window size. | Returns the associated window size. | [
"Returns",
"the",
"associated",
"window",
"size",
"."
] | def GetWindowSize(self):
""" Returns the associated window size. """
return self._windowsize | [
"def",
"GetWindowSize",
"(",
"self",
")",
":",
"return",
"self",
".",
"_windowsize"
] | https://github.com/wxWidgets/Phoenix/blob/b2199e299a6ca6d866aa6f3d0888499136ead9d6/wx/lib/agw/ultimatelistctrl.py#L2020-L2023 | |
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/site-packages/nbformat-4.0.1-py3.3.egg/nbformat/v4/convert.py | python | upgrade_outputs | (outputs) | return [upgrade_output(op) for op in outputs] | upgrade outputs of a code cell from v3 to v4 | upgrade outputs of a code cell from v3 to v4 | [
"upgrade",
"outputs",
"of",
"a",
"code",
"cell",
"from",
"v3",
"to",
"v4"
] | def upgrade_outputs(outputs):
"""upgrade outputs of a code cell from v3 to v4"""
return [upgrade_output(op) for op in outputs] | [
"def",
"upgrade_outputs",
"(",
"outputs",
")",
":",
"return",
"[",
"upgrade_output",
"(",
"op",
")",
"for",
"op",
"in",
"outputs",
"]"
] | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/nbformat-4.0.1-py3.3.egg/nbformat/v4/convert.py#L219-L221 | |
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/apps/reports/standard/web_user_activity.py | python | WebUserActivityReport.show_in_user_roles | (cls, *args, **kwargs) | return False | [] | def show_in_user_roles(cls, *args, **kwargs):
return False | [
"def",
"show_in_user_roles",
"(",
"cls",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"False"
] | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/reports/standard/web_user_activity.py#L39-L40 | |||
ofek/hatch | ff67fb61056a5b682951c9d2f6e9ef935d6181f6 | backend/hatchling/builders/config.py | python | BuilderConfig.reproducible | (self) | return self.__reproducible | Whether or not the target should be built in a reproducible manner, defaulting to true. | Whether or not the target should be built in a reproducible manner, defaulting to true. | [
"Whether",
"or",
"not",
"the",
"target",
"should",
"be",
"built",
"in",
"a",
"reproducible",
"manner",
"defaulting",
"to",
"true",
"."
] | def reproducible(self):
"""
Whether or not the target should be built in a reproducible manner, defaulting to true.
"""
if self.__reproducible is None:
if 'reproducible' in self.target_config:
reproducible = self.target_config['reproducible']
i... | [
"def",
"reproducible",
"(",
"self",
")",
":",
"if",
"self",
".",
"__reproducible",
"is",
"None",
":",
"if",
"'reproducible'",
"in",
"self",
".",
"target_config",
":",
"reproducible",
"=",
"self",
".",
"target_config",
"[",
"'reproducible'",
"]",
"if",
"not",... | https://github.com/ofek/hatch/blob/ff67fb61056a5b682951c9d2f6e9ef935d6181f6/backend/hatchling/builders/config.py#L281-L299 | |
kivymd/KivyMD | 1cb82f7d2437770f71be7c5a4f7de4b8da61f352 | kivymd/uix/behaviors/elevation.py | python | CommonElevationBehavior.on_disabled | (self, instance, value) | This function hides the shadow when the widget is disabled.
It sets the shadow to `0`. | This function hides the shadow when the widget is disabled.
It sets the shadow to `0`. | [
"This",
"function",
"hides",
"the",
"shadow",
"when",
"the",
"widget",
"is",
"disabled",
".",
"It",
"sets",
"the",
"shadow",
"to",
"0",
"."
] | def on_disabled(self, instance, value):
"""
This function hides the shadow when the widget is disabled.
It sets the shadow to `0`.
"""
if self.disabled is True:
self._elevation = 0
else:
self._elevation = 0 if self.elevation is None else self.elev... | [
"def",
"on_disabled",
"(",
"self",
",",
"instance",
",",
"value",
")",
":",
"if",
"self",
".",
"disabled",
"is",
"True",
":",
"self",
".",
"_elevation",
"=",
"0",
"else",
":",
"self",
".",
"_elevation",
"=",
"0",
"if",
"self",
".",
"elevation",
"is",... | https://github.com/kivymd/KivyMD/blob/1cb82f7d2437770f71be7c5a4f7de4b8da61f352/kivymd/uix/behaviors/elevation.py#L971-L985 | ||
deeptools/pyGenomeTracks | 488a6d3f9e81c6ca1af9f90484445070ed9c7024 | pygenometracks/readBed.py | python | ReadBed.__next__ | (self) | return bed | :return: bedInterval object | :return: bedInterval object | [
":",
"return",
":",
"bedInterval",
"object"
] | def __next__(self):
"""
:return: bedInterval object
"""
line = self.get_no_comment_line()
bed = self.get_bed_interval(line)
return bed | [
"def",
"__next__",
"(",
"self",
")",
":",
"line",
"=",
"self",
".",
"get_no_comment_line",
"(",
")",
"bed",
"=",
"self",
".",
"get_bed_interval",
"(",
"line",
")",
"return",
"bed"
] | https://github.com/deeptools/pyGenomeTracks/blob/488a6d3f9e81c6ca1af9f90484445070ed9c7024/pygenometracks/readBed.py#L74-L82 | |
aiidateam/aiida-core | c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2 | aiida/engine/processes/calcjobs/tasks.py | python | task_submit_job | (node: CalcJobNode, transport_queue: TransportQueue, cancellable: InterruptableFuture) | Transport task that will attempt to submit a job calculation.
The task will first request a transport from the queue. Once the transport is yielded, the relevant execmanager
function is called, wrapped in the exponential_backoff_retry coroutine, which, in case of a caught exception, will
retry after an int... | Transport task that will attempt to submit a job calculation. | [
"Transport",
"task",
"that",
"will",
"attempt",
"to",
"submit",
"a",
"job",
"calculation",
"."
] | async def task_submit_job(node: CalcJobNode, transport_queue: TransportQueue, cancellable: InterruptableFuture):
"""Transport task that will attempt to submit a job calculation.
The task will first request a transport from the queue. Once the transport is yielded, the relevant execmanager
function is calle... | [
"async",
"def",
"task_submit_job",
"(",
"node",
":",
"CalcJobNode",
",",
"transport_queue",
":",
"TransportQueue",
",",
"cancellable",
":",
"InterruptableFuture",
")",
":",
"if",
"node",
".",
"get_state",
"(",
")",
"==",
"CalcJobState",
".",
"WITHSCHEDULER",
":"... | https://github.com/aiidateam/aiida-core/blob/c743a335480f8bb3a5e4ebd2463a31f9f3b9f9b2/aiida/engine/processes/calcjobs/tasks.py#L113-L156 | ||
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/messaging/smsbackends/amazon_pinpoint/models.py | python | PinpointBackend.get_form_class | (cls) | return PinpointBackendForm | [] | def get_form_class(cls):
return PinpointBackendForm | [
"def",
"get_form_class",
"(",
"cls",
")",
":",
"return",
"PinpointBackendForm"
] | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/messaging/smsbackends/amazon_pinpoint/models.py#L34-L35 | |||
andreikop/enki | 3170059e5cb46dcc77d7fb1457c38a8a5f13af66 | enki/core/actionmanager.py | python | ActionManager.path | (self, action) | return action.path | Get action path by reference to action | Get action path by reference to action | [
"Get",
"action",
"path",
"by",
"reference",
"to",
"action"
] | def path(self, action):
"""Get action path by reference to action
"""
return action.path | [
"def",
"path",
"(",
"self",
",",
"action",
")",
":",
"return",
"action",
".",
"path"
] | https://github.com/andreikop/enki/blob/3170059e5cb46dcc77d7fb1457c38a8a5f13af66/enki/core/actionmanager.py#L97-L100 | |
amimo/dcc | 114326ab5a082a42c7728a375726489e4709ca29 | androguard/decompiler/dad/decompile.py | python | DvMachine.get_class | (self, class_name) | Return the :class:`DvClass` with the given name
The name is partially matched against the known class names and the first result is returned.
For example, the input `foobar` will match on Lfoobar/bla/foo;
:param str class_name:
:return: the class matching on the name
:rtype: Dv... | Return the :class:`DvClass` with the given name | [
"Return",
"the",
":",
"class",
":",
"DvClass",
"with",
"the",
"given",
"name"
] | def get_class(self, class_name):
"""
Return the :class:`DvClass` with the given name
The name is partially matched against the known class names and the first result is returned.
For example, the input `foobar` will match on Lfoobar/bla/foo;
:param str class_name:
:retu... | [
"def",
"get_class",
"(",
"self",
",",
"class_name",
")",
":",
"for",
"name",
",",
"klass",
"in",
"self",
".",
"classes",
".",
"items",
"(",
")",
":",
"# TODO why use the name partially?",
"if",
"class_name",
"in",
"name",
":",
"if",
"isinstance",
"(",
"kla... | https://github.com/amimo/dcc/blob/114326ab5a082a42c7728a375726489e4709ca29/androguard/decompiler/dad/decompile.py#L468-L485 | ||
MontrealCorpusTools/Montreal-Forced-Aligner | 63473f9a4fabd31eec14e1e5022882f85cfdaf31 | montreal_forced_aligner/helper.py | python | score_g2p | (gold: Word, hypo: Word) | return edits, best_length | Computes sufficient statistics for LER calculation.
Parameters
----------
gold: Labels
The reference labels
hypo: Labels
The hypothesized labels
multiple_hypotheses: bool
Flag for whether the hypotheses contain multiple
Returns
-------
int
Edit distance
... | Computes sufficient statistics for LER calculation. | [
"Computes",
"sufficient",
"statistics",
"for",
"LER",
"calculation",
"."
] | def score_g2p(gold: Word, hypo: Word) -> Tuple[int, int]:
"""
Computes sufficient statistics for LER calculation.
Parameters
----------
gold: Labels
The reference labels
hypo: Labels
The hypothesized labels
multiple_hypotheses: bool
Flag for whether the hypotheses co... | [
"def",
"score_g2p",
"(",
"gold",
":",
"Word",
",",
"hypo",
":",
"Word",
")",
"->",
"Tuple",
"[",
"int",
",",
"int",
"]",
":",
"for",
"h",
"in",
"hypo",
".",
"pronunciations",
":",
"if",
"h",
"in",
"gold",
".",
"pronunciations",
":",
"return",
"0",
... | https://github.com/MontrealCorpusTools/Montreal-Forced-Aligner/blob/63473f9a4fabd31eec14e1e5022882f85cfdaf31/montreal_forced_aligner/helper.py#L659-L692 | |
n1nj4sec/pupy | a5d766ea81fdfe3bc2c38c9bdaf10e9b75af3b39 | pupy/packages/linux/all/fsutils_ext.py | python | getselinux | (filepath) | return sectx | [] | def getselinux(filepath):
try:
sectx = getxattr(filepath, 'security.selinux')
except (IOError, OSError):
return None
return sectx | [
"def",
"getselinux",
"(",
"filepath",
")",
":",
"try",
":",
"sectx",
"=",
"getxattr",
"(",
"filepath",
",",
"'security.selinux'",
")",
"except",
"(",
"IOError",
",",
"OSError",
")",
":",
"return",
"None",
"return",
"sectx"
] | https://github.com/n1nj4sec/pupy/blob/a5d766ea81fdfe3bc2c38c9bdaf10e9b75af3b39/pupy/packages/linux/all/fsutils_ext.py#L16-L22 | |||
elastic/rally | 7c58ef6f81f618fbc142dfa58b0ed00a5b05fbae | esrally/log.py | python | install_default_log_config | () | Ensures a log configuration file is present on this machine. The default
log configuration is based on the template in resources/logging.json.
It also ensures that the default log path has been created so log files
can be successfully opened in that directory. | Ensures a log configuration file is present on this machine. The default
log configuration is based on the template in resources/logging.json. | [
"Ensures",
"a",
"log",
"configuration",
"file",
"is",
"present",
"on",
"this",
"machine",
".",
"The",
"default",
"log",
"configuration",
"is",
"based",
"on",
"the",
"template",
"in",
"resources",
"/",
"logging",
".",
"json",
"."
] | def install_default_log_config():
"""
Ensures a log configuration file is present on this machine. The default
log configuration is based on the template in resources/logging.json.
It also ensures that the default log path has been created so log files
can be successfully opened in that directory.
... | [
"def",
"install_default_log_config",
"(",
")",
":",
"log_config",
"=",
"log_config_path",
"(",
")",
"if",
"not",
"io",
".",
"exists",
"(",
"log_config",
")",
":",
"io",
".",
"ensure_dir",
"(",
"io",
".",
"dirname",
"(",
"log_config",
")",
")",
"source_path... | https://github.com/elastic/rally/blob/7c58ef6f81f618fbc142dfa58b0ed00a5b05fbae/esrally/log.py#L46-L66 | ||
mypaint/mypaint | 90b36dbc7b8bd2f323383f7edf608a5e0a3a1a33 | lib/layervis.py | python | LayerViewManager.activate_view_by_name | (self, name) | return self.activate_view(view) | Activates a view by name. | Activates a view by name. | [
"Activates",
"a",
"view",
"by",
"name",
"."
] | def activate_view_by_name(self, name):
"""Activates a view by name."""
view = None
if name is not None:
view = self._views.names.get(name, None)
if view is None:
raise ValueError("no view named %r in views list" % (name,))
return self.activate_view... | [
"def",
"activate_view_by_name",
"(",
"self",
",",
"name",
")",
":",
"view",
"=",
"None",
"if",
"name",
"is",
"not",
"None",
":",
"view",
"=",
"self",
".",
"_views",
".",
"names",
".",
"get",
"(",
"name",
",",
"None",
")",
"if",
"view",
"is",
"None"... | https://github.com/mypaint/mypaint/blob/90b36dbc7b8bd2f323383f7edf608a5e0a3a1a33/lib/layervis.py#L486-L493 | |
chyroc/WechatSogou | 45731524c1e43925c61a340694774a0d022b895f | wechatsogou/identify_image.py | python | identify_image_callback_by_hand | (img) | return input("please input code: ") | 识别二维码
Parameters
----------
img : bytes
验证码图片二进制数据
Returns
-------
str
验证码文字 | 识别二维码 | [
"识别二维码"
] | def identify_image_callback_by_hand(img):
"""识别二维码
Parameters
----------
img : bytes
验证码图片二进制数据
Returns
-------
str
验证码文字
"""
im = readimg(img)
im.show()
return input("please input code: ") | [
"def",
"identify_image_callback_by_hand",
"(",
"img",
")",
":",
"im",
"=",
"readimg",
"(",
"img",
")",
"im",
".",
"show",
"(",
")",
"return",
"input",
"(",
"\"please input code: \"",
")"
] | https://github.com/chyroc/WechatSogou/blob/45731524c1e43925c61a340694774a0d022b895f/wechatsogou/identify_image.py#L16-L31 | |
git-cola/git-cola | b48b8028e0c3baf47faf7b074b9773737358163d | cola/cmds.py | python | DiffStaged.__init__ | (self, context, filename, deleted=None) | [] | def __init__(self, context, filename, deleted=None):
super(DiffStaged, self).__init__(
context, filename, cached=True, deleted=deleted
)
self.new_mode = self.model.mode_index | [
"def",
"__init__",
"(",
"self",
",",
"context",
",",
"filename",
",",
"deleted",
"=",
"None",
")",
":",
"super",
"(",
"DiffStaged",
",",
"self",
")",
".",
"__init__",
"(",
"context",
",",
"filename",
",",
"cached",
"=",
"True",
",",
"deleted",
"=",
"... | https://github.com/git-cola/git-cola/blob/b48b8028e0c3baf47faf7b074b9773737358163d/cola/cmds.py#L1335-L1339 | ||||
fbchat-dev/fbchat | 916a14062d31f3624dfe8dd4ab672648a3e508c0 | fbchat/_threads/_abc.py | python | ThreadABC.set_color | (self, color: str) | Change thread color.
The new color must be one of the following::
"#0084ff", "#44bec7", "#ffc300", "#fa3c4c", "#d696bb", "#6699cc",
"#13cf13", "#ff7e29", "#e68585", "#7646ff", "#20cef5", "#67b868",
"#d4a88c", "#ff5ca1", "#a695c7", "#ff7ca8", "#1adb5b", "#f01d6a",
... | Change thread color. | [
"Change",
"thread",
"color",
"."
] | def set_color(self, color: str):
"""Change thread color.
The new color must be one of the following::
"#0084ff", "#44bec7", "#ffc300", "#fa3c4c", "#d696bb", "#6699cc",
"#13cf13", "#ff7e29", "#e68585", "#7646ff", "#20cef5", "#67b868",
"#d4a88c", "#ff5ca1", "#a695c7",... | [
"def",
"set_color",
"(",
"self",
",",
"color",
":",
"str",
")",
":",
"if",
"color",
"not",
"in",
"SETABLE_COLORS",
":",
"raise",
"ValueError",
"(",
"\"Invalid color! Please use one of: {}\"",
".",
"format",
"(",
"SETABLE_COLORS",
")",
")",
"# Set color to \"\" if ... | https://github.com/fbchat-dev/fbchat/blob/916a14062d31f3624dfe8dd4ab672648a3e508c0/fbchat/_threads/_abc.py#L489-L523 | ||
TengXiaoDai/DistributedCrawling | f5c2439e6ce68dd9b49bde084d76473ff9ed4963 | Lib/site-packages/pip/_vendor/pyparsing.py | python | ParserElement.addCondition | (self, *fns, **kwargs) | return self | Add a boolean predicate function to expression's list of parse actions. See
L{I{setParseAction}<setParseAction>} for function call signatures. Unlike C{setParseAction},
functions passed to C{addCondition} need to return boolean success/fail of the condition.
Optional keyword arguments:
... | Add a boolean predicate function to expression's list of parse actions. See
L{I{setParseAction}<setParseAction>} for function call signatures. Unlike C{setParseAction},
functions passed to C{addCondition} need to return boolean success/fail of the condition. | [
"Add",
"a",
"boolean",
"predicate",
"function",
"to",
"expression",
"s",
"list",
"of",
"parse",
"actions",
".",
"See",
"L",
"{",
"I",
"{",
"setParseAction",
"}",
"<setParseAction",
">",
"}",
"for",
"function",
"call",
"signatures",
".",
"Unlike",
"C",
"{",... | def addCondition(self, *fns, **kwargs):
"""Add a boolean predicate function to expression's list of parse actions. See
L{I{setParseAction}<setParseAction>} for function call signatures. Unlike C{setParseAction},
functions passed to C{addCondition} need to return boolean success/fail of the con... | [
"def",
"addCondition",
"(",
"self",
",",
"*",
"fns",
",",
"*",
"*",
"kwargs",
")",
":",
"msg",
"=",
"kwargs",
".",
"get",
"(",
"\"message\"",
",",
"\"failed user-defined condition\"",
")",
"exc_type",
"=",
"ParseFatalException",
"if",
"kwargs",
".",
"get",
... | https://github.com/TengXiaoDai/DistributedCrawling/blob/f5c2439e6ce68dd9b49bde084d76473ff9ed4963/Lib/site-packages/pip/_vendor/pyparsing.py#L1275-L1300 | |
misterch0c/shadowbroker | e3a069bea47a2c1009697941ac214adc6f90aa8d | windows/Resources/Python/Core/Lib/lib2to3/fixer_base.py | python | BaseFix.__init__ | (self, options, log) | Initializer. Subclass may override.
Args:
options: an dict containing the options passed to RefactoringTool
that could be used to customize the fixer through the command line.
log: a list to append warnings and other messages to. | Initializer. Subclass may override.
Args:
options: an dict containing the options passed to RefactoringTool
that could be used to customize the fixer through the command line.
log: a list to append warnings and other messages to. | [
"Initializer",
".",
"Subclass",
"may",
"override",
".",
"Args",
":",
"options",
":",
"an",
"dict",
"containing",
"the",
"options",
"passed",
"to",
"RefactoringTool",
"that",
"could",
"be",
"used",
"to",
"customize",
"the",
"fixer",
"through",
"the",
"command",... | def __init__(self, options, log):
"""Initializer. Subclass may override.
Args:
options: an dict containing the options passed to RefactoringTool
that could be used to customize the fixer through the command line.
log: a list to append warnings and other mess... | [
"def",
"__init__",
"(",
"self",
",",
"options",
",",
"log",
")",
":",
"self",
".",
"options",
"=",
"options",
"self",
".",
"log",
"=",
"log",
"self",
".",
"compile_pattern",
"(",
")"
] | https://github.com/misterch0c/shadowbroker/blob/e3a069bea47a2c1009697941ac214adc6f90aa8d/windows/Resources/Python/Core/Lib/lib2to3/fixer_base.py#L37-L47 | ||
mtianyan/VueDjangoAntdProBookShop | fd8fa2151c81edde2f8b8e6df8e1ddd799f940c2 | tyadmin_api/custom.py | python | GenericAPIView.get_object | (self) | return obj | Returns the object the view is displaying.
You may want to override this if you need to provide non-standard
queryset lookups. Eg if objects are referenced using multiple
keyword arguments in the url conf. | Returns the object the view is displaying. | [
"Returns",
"the",
"object",
"the",
"view",
"is",
"displaying",
"."
] | def get_object(self):
"""
Returns the object the view is displaying.
You may want to override this if you need to provide non-standard
queryset lookups. Eg if objects are referenced using multiple
keyword arguments in the url conf.
"""
queryset = self.filter_que... | [
"def",
"get_object",
"(",
"self",
")",
":",
"queryset",
"=",
"self",
".",
"filter_queryset",
"(",
"self",
".",
"get_queryset",
"(",
")",
")",
"# Perform the lookup filtering.",
"lookup_url_kwarg",
"=",
"self",
".",
"lookup_url_kwarg",
"or",
"self",
".",
"lookup_... | https://github.com/mtianyan/VueDjangoAntdProBookShop/blob/fd8fa2151c81edde2f8b8e6df8e1ddd799f940c2/tyadmin_api/custom.py#L296-L322 | |
openstack/magnum | fa298eeab19b1d87070d72c7c4fb26cd75b0781e | magnum/db/sqlalchemy/api.py | python | Connection.get_cluster_nodegroup_count | (self, context, cluster_id) | return query.count() | [] | def get_cluster_nodegroup_count(self, context, cluster_id):
query = model_query(models.NodeGroup)
if not context.is_admin:
query = query.filter_by(project_id=context.project_id)
query = query.filter_by(cluster_id=cluster_id)
return query.count() | [
"def",
"get_cluster_nodegroup_count",
"(",
"self",
",",
"context",
",",
"cluster_id",
")",
":",
"query",
"=",
"model_query",
"(",
"models",
".",
"NodeGroup",
")",
"if",
"not",
"context",
".",
"is_admin",
":",
"query",
"=",
"query",
".",
"filter_by",
"(",
"... | https://github.com/openstack/magnum/blob/fa298eeab19b1d87070d72c7c4fb26cd75b0781e/magnum/db/sqlalchemy/api.py#L895-L900 | |||
JiYou/openstack | 8607dd488bde0905044b303eb6e52bdea6806923 | packages/source/glance/glance/api/policy.py | python | Enforcer.enforce | (self, context, action, target) | return self._check(context, action, target,
exception.Forbidden, action=action) | Verifies that the action is valid on the target in this context.
:param context: Glance request context
:param action: String representing the action to be checked
:param object: Dictionary representing the object of the action.
:raises: `glance.common.exception.Forbidden`
... | Verifies that the action is valid on the target in this context. | [
"Verifies",
"that",
"the",
"action",
"is",
"valid",
"on",
"the",
"target",
"in",
"this",
"context",
"."
] | def enforce(self, context, action, target):
"""Verifies that the action is valid on the target in this context.
:param context: Glance request context
:param action: String representing the action to be checked
:param object: Dictionary representing the object of the action.
... | [
"def",
"enforce",
"(",
"self",
",",
"context",
",",
"action",
",",
"target",
")",
":",
"return",
"self",
".",
"_check",
"(",
"context",
",",
"action",
",",
"target",
",",
"exception",
".",
"Forbidden",
",",
"action",
"=",
"action",
")"
] | https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/glance/glance/api/policy.py#L122-L132 | |
neurolib-dev/neurolib | 8d8ed2ceb422e9a1367193495a7e2df96cf4e4a3 | neurolib/models/multimodel/builder/thalamus.py | python | ThalamicNode.__init__ | (
self,
tcr_params=None,
trn_params=None,
connectivity=THALAMUS_NODE_DEFAULT_CONNECTIVITY,
) | :param tcr_params: parameters for the excitatory (TCR) mass
:type tcr_params: dict|None
:param trn_params: parameters for the inhibitory (TRN) mass
:type trn_params: dict|None
:param connectivity: local connectivity matrix
:type connectivity: np.ndarray | :param tcr_params: parameters for the excitatory (TCR) mass
:type tcr_params: dict|None
:param trn_params: parameters for the inhibitory (TRN) mass
:type trn_params: dict|None
:param connectivity: local connectivity matrix
:type connectivity: np.ndarray | [
":",
"param",
"tcr_params",
":",
"parameters",
"for",
"the",
"excitatory",
"(",
"TCR",
")",
"mass",
":",
"type",
"tcr_params",
":",
"dict|None",
":",
"param",
"trn_params",
":",
"parameters",
"for",
"the",
"inhibitory",
"(",
"TRN",
")",
"mass",
":",
"type"... | def __init__(
self,
tcr_params=None,
trn_params=None,
connectivity=THALAMUS_NODE_DEFAULT_CONNECTIVITY,
):
"""
:param tcr_params: parameters for the excitatory (TCR) mass
:type tcr_params: dict|None
:param trn_params: parameters for the inhibitory (TRN)... | [
"def",
"__init__",
"(",
"self",
",",
"tcr_params",
"=",
"None",
",",
"trn_params",
"=",
"None",
",",
"connectivity",
"=",
"THALAMUS_NODE_DEFAULT_CONNECTIVITY",
",",
")",
":",
"tcr_mass",
"=",
"ThalamocorticalMass",
"(",
"params",
"=",
"tcr_params",
")",
"tcr_mas... | https://github.com/neurolib-dev/neurolib/blob/8d8ed2ceb422e9a1367193495a7e2df96cf4e4a3/neurolib/models/multimodel/builder/thalamus.py#L430-L453 | ||
pypa/setuptools | 9f37366aab9cd8f6baa23e6a77cfdb8daf97757e | setuptools/_distutils/dist.py | python | DistributionMetadata.get_maintainer | (self) | return self.maintainer or "UNKNOWN" | [] | def get_maintainer(self):
return self.maintainer or "UNKNOWN" | [
"def",
"get_maintainer",
"(",
"self",
")",
":",
"return",
"self",
".",
"maintainer",
"or",
"\"UNKNOWN\""
] | https://github.com/pypa/setuptools/blob/9f37366aab9cd8f6baa23e6a77cfdb8daf97757e/setuptools/_distutils/dist.py#L1175-L1176 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.