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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
lemonhu/NER-BERT-pytorch | 5f7577b78020dc5867cc3a4dbb7a2db44bae1fc8 | metrics.py | python | start_of_chunk | (prev_tag, tag, prev_type, type_) | return chunk_start | Checks if a chunk started between the previous and current word.
Args:
prev_tag: previous chunk tag.
tag: current chunk tag.
prev_type: previous type.
type_: current type.
Returns:
chunk_start: boolean. | Checks if a chunk started between the previous and current word. | [
"Checks",
"if",
"a",
"chunk",
"started",
"between",
"the",
"previous",
"and",
"current",
"word",
"."
] | def start_of_chunk(prev_tag, tag, prev_type, type_):
"""Checks if a chunk started between the previous and current word.
Args:
prev_tag: previous chunk tag.
tag: current chunk tag.
prev_type: previous type.
type_: current type.
Returns:
chunk_start: boolean.
"""... | [
"def",
"start_of_chunk",
"(",
"prev_tag",
",",
"tag",
",",
"prev_type",
",",
"type_",
")",
":",
"chunk_start",
"=",
"False",
"if",
"tag",
"==",
"'B'",
":",
"chunk_start",
"=",
"True",
"if",
"tag",
"==",
"'S'",
":",
"chunk_start",
"=",
"True",
"if",
"pr... | https://github.com/lemonhu/NER-BERT-pytorch/blob/5f7577b78020dc5867cc3a4dbb7a2db44bae1fc8/metrics.py#L87-L114 | |
bastula/dicompyler | 2643e0ee145cb7c699b3d36e3e4f07ac9dc7b1f2 | dicompyler/baseplugins/quickopen.py | python | plugin.OnImportPrefsChange | (self, topic, msg) | When the import preferences change, update the values. | When the import preferences change, update the values. | [
"When",
"the",
"import",
"preferences",
"change",
"update",
"the",
"values",
"."
] | def OnImportPrefsChange(self, topic, msg):
"""When the import preferences change, update the values."""
topic = topic.split('.')
if (topic[1] == 'import_location'):
self.path = str(msg)
elif (topic[1] == 'import_location_setting'):
self.import_location_setting = m... | [
"def",
"OnImportPrefsChange",
"(",
"self",
",",
"topic",
",",
"msg",
")",
":",
"topic",
"=",
"topic",
".",
"split",
"(",
"'.'",
")",
"if",
"(",
"topic",
"[",
"1",
"]",
"==",
"'import_location'",
")",
":",
"self",
".",
"path",
"=",
"str",
"(",
"msg"... | https://github.com/bastula/dicompyler/blob/2643e0ee145cb7c699b3d36e3e4f07ac9dc7b1f2/dicompyler/baseplugins/quickopen.py#L49-L55 | ||
syb7573330/im2avatar | f4636d35f622f2f1f3915a2a8f3307f3ee104928 | utils/tf_utils.py | python | avg_pool3d | (inputs,
kernel_size,
scope,
stride=[2, 2, 2],
padding='VALID') | 3D avg pooling.
Args:
inputs: 5-D tensor BxDxHxWxC
kernel_size: a list of 3 ints
stride: a list of 3 ints
Returns:
Variable tensor | 3D avg pooling. | [
"3D",
"avg",
"pooling",
"."
] | def avg_pool3d(inputs,
kernel_size,
scope,
stride=[2, 2, 2],
padding='VALID'):
""" 3D avg pooling.
Args:
inputs: 5-D tensor BxDxHxWxC
kernel_size: a list of 3 ints
stride: a list of 3 ints
Returns:
Variable tensor
"""
with tf.vari... | [
"def",
"avg_pool3d",
"(",
"inputs",
",",
"kernel_size",
",",
"scope",
",",
"stride",
"=",
"[",
"2",
",",
"2",
",",
"2",
"]",
",",
"padding",
"=",
"'VALID'",
")",
":",
"with",
"tf",
".",
"variable_scope",
"(",
"scope",
")",
"as",
"sc",
":",
"kernel_... | https://github.com/syb7573330/im2avatar/blob/f4636d35f622f2f1f3915a2a8f3307f3ee104928/utils/tf_utils.py#L502-L525 | ||
sahana/eden | 1696fa50e90ce967df69f66b571af45356cc18da | modules/s3/s3aaa.py | python | AuthS3.s3_register_onaccept | (self, form) | Sets session.auth.user for authorstamp, etc, and approves user
(to set registration groups, such as AUTHENTICATED, link to Person)
Designed to be called when a user is created through:
- registration via OAuth, LDAP, etc | Sets session.auth.user for authorstamp, etc, and approves user
(to set registration groups, such as AUTHENTICATED, link to Person) | [
"Sets",
"session",
".",
"auth",
".",
"user",
"for",
"authorstamp",
"etc",
"and",
"approves",
"user",
"(",
"to",
"set",
"registration",
"groups",
"such",
"as",
"AUTHENTICATED",
"link",
"to",
"Person",
")"
] | def s3_register_onaccept(self, form):
"""
Sets session.auth.user for authorstamp, etc, and approves user
(to set registration groups, such as AUTHENTICATED, link to Person)
Designed to be called when a user is created through:
- registration via OAuth, LDAP, ... | [
"def",
"s3_register_onaccept",
"(",
"self",
",",
"form",
")",
":",
"user",
"=",
"form",
".",
"vars",
"current",
".",
"session",
".",
"auth",
"=",
"Storage",
"(",
"user",
"=",
"user",
")",
"self",
".",
"s3_approve_user",
"(",
"user",
")"
] | https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/s3/s3aaa.py#L2527-L2538 | ||
replit-archive/empythoned | 977ec10ced29a3541a4973dc2b59910805695752 | cpython/Lib/compiler/symbols.py | python | SymbolVisitor.visitAssign | (self, node, scope) | Propagate assignment flag down to child nodes.
The Assign node doesn't itself contains the variables being
assigned to. Instead, the children in node.nodes are visited
with the assign flag set to true. When the names occur in
those nodes, they are marked as defs.
Some names t... | Propagate assignment flag down to child nodes. | [
"Propagate",
"assignment",
"flag",
"down",
"to",
"child",
"nodes",
"."
] | def visitAssign(self, node, scope):
"""Propagate assignment flag down to child nodes.
The Assign node doesn't itself contains the variables being
assigned to. Instead, the children in node.nodes are visited
with the assign flag set to true. When the names occur in
those nodes,... | [
"def",
"visitAssign",
"(",
"self",
",",
"node",
",",
"scope",
")",
":",
"for",
"n",
"in",
"node",
".",
"nodes",
":",
"self",
".",
"visit",
"(",
"n",
",",
"scope",
",",
"1",
")",
"self",
".",
"visit",
"(",
"node",
".",
"expr",
",",
"scope",
")"
... | https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/cpython/Lib/compiler/symbols.py#L347-L362 | ||
tendenci/tendenci | 0f2c348cc0e7d41bc56f50b00ce05544b083bf1d | tendenci/apps/articles/models.py | python | Article.has_google_publisher | (self) | return self.contributor_type == self.CONTRIBUTOR_PUBLISHER | [] | def has_google_publisher(self):
return self.contributor_type == self.CONTRIBUTOR_PUBLISHER | [
"def",
"has_google_publisher",
"(",
"self",
")",
":",
"return",
"self",
".",
"contributor_type",
"==",
"self",
".",
"CONTRIBUTOR_PUBLISHER"
] | https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/apps/articles/models.py#L154-L155 | |||
google/coursebuilder-core | 08f809db3226d9269e30d5edd0edd33bd22041f4 | coursebuilder/controllers/utils.py | python | BaseHandler.render | (self, template_file, additional_dirs=None, save_location=True) | Renders a template. | Renders a template. | [
"Renders",
"a",
"template",
"."
] | def render(self, template_file, additional_dirs=None, save_location=True):
"""Renders a template."""
prefs = models.StudentPreferencesDAO.load_or_default()
courses.Course.set_current(self.get_course())
models.MemcacheManager.begin_readonly()
try:
template = self.get_... | [
"def",
"render",
"(",
"self",
",",
"template_file",
",",
"additional_dirs",
"=",
"None",
",",
"save_location",
"=",
"True",
")",
":",
"prefs",
"=",
"models",
".",
"StudentPreferencesDAO",
".",
"load_or_default",
"(",
")",
"courses",
".",
"Course",
".",
"set_... | https://github.com/google/coursebuilder-core/blob/08f809db3226d9269e30d5edd0edd33bd22041f4/coursebuilder/controllers/utils.py#L1086-L1110 | ||
berkerpeksag/github-badge | a9a2a4ef1a2a35be6cf4328bbd3c736080dd4af7 | packages/requests/packages/oauthlib/oauth2/draft25/parameters.py | python | prepare_grant_uri | (uri, client_id, response_type, redirect_uri=None,
scope=None, state=None, **kwargs) | return add_params_to_uri(uri, params) | Prepare the authorization grant request URI.
The client constructs the request URI by adding the following
parameters to the query component of the authorization endpoint URI
using the "application/x-www-form-urlencoded" format as defined by
[W3C.REC-html401-19991224]:
response_type
RE... | Prepare the authorization grant request URI. | [
"Prepare",
"the",
"authorization",
"grant",
"request",
"URI",
"."
] | def prepare_grant_uri(uri, client_id, response_type, redirect_uri=None,
scope=None, state=None, **kwargs):
"""Prepare the authorization grant request URI.
The client constructs the request URI by adding the following
parameters to the query component of the authorization endpoint URI
using ... | [
"def",
"prepare_grant_uri",
"(",
"uri",
",",
"client_id",
",",
"response_type",
",",
"redirect_uri",
"=",
"None",
",",
"scope",
"=",
"None",
",",
"state",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"params",
"=",
"[",
"(",
"(",
"u'response_type'",
... | https://github.com/berkerpeksag/github-badge/blob/a9a2a4ef1a2a35be6cf4328bbd3c736080dd4af7/packages/requests/packages/oauthlib/oauth2/draft25/parameters.py#L15-L63 | |
coleifer/huey | b7aebe442514fa9cca376265dce371ae42a17535 | huey/consumer.py | python | Consumer.start | (self) | Start all consumer processes and register signal handlers. | Start all consumer processes and register signal handlers. | [
"Start",
"all",
"consumer",
"processes",
"and",
"register",
"signal",
"handlers",
"."
] | def start(self):
"""
Start all consumer processes and register signal handlers.
"""
if self.huey.immediate:
raise ConfigurationError(
'Consumer cannot be run with Huey instances where immediate '
'is enabled. Please check your configuration and... | [
"def",
"start",
"(",
"self",
")",
":",
"if",
"self",
".",
"huey",
".",
"immediate",
":",
"raise",
"ConfigurationError",
"(",
"'Consumer cannot be run with Huey instances where immediate '",
"'is enabled. Please check your configuration and ensure that '",
"'\"huey.immediate = Fal... | https://github.com/coleifer/huey/blob/b7aebe442514fa9cca376265dce371ae42a17535/huey/consumer.py#L365-L396 | ||
whyliam/whyliam.workflows.youdao | 2dfa7f1de56419dab1c2e70c1a27e5e13ba25a5c | urllib3/packages/rfc3986/_mixin.py | python | URIMixin.scheme_is_valid | (self, require=False) | return validators.scheme_is_valid(self.scheme, require) | Determine if the scheme component is valid.
.. deprecated:: 1.1.0
Use the :class:`~rfc3986.validators.Validator` object instead.
:param str require: Set to ``True`` to require the presence of this
component.
:returns: ``True`` if the scheme is valid. ``False`` otherwis... | Determine if the scheme component is valid. | [
"Determine",
"if",
"the",
"scheme",
"component",
"is",
"valid",
"."
] | def scheme_is_valid(self, require=False):
"""Determine if the scheme component is valid.
.. deprecated:: 1.1.0
Use the :class:`~rfc3986.validators.Validator` object instead.
:param str require: Set to ``True`` to require the presence of this
component.
:returns... | [
"def",
"scheme_is_valid",
"(",
"self",
",",
"require",
"=",
"False",
")",
":",
"warnings",
".",
"warn",
"(",
"\"Please use rfc3986.validators.Validator instead. \"",
"\"This method will be eventually removed.\"",
",",
"DeprecationWarning",
",",
")",
"return",
"validators",
... | https://github.com/whyliam/whyliam.workflows.youdao/blob/2dfa7f1de56419dab1c2e70c1a27e5e13ba25a5c/urllib3/packages/rfc3986/_mixin.py#L158-L175 | |
agoragames/leaderboard-python | 4bc028164c259c3a31c7e6ccb2a8ecb83cfb1da2 | leaderboard/leaderboard.py | python | Leaderboard.total_members_in_score_range | (self, min_score, max_score) | return self.total_members_in_score_range_in(
self.leaderboard_name, min_score, max_score) | Retrieve the total members in a given score range from the leaderboard.
@param min_score [float] Minimum score.
@param max_score [float] Maximum score.
@return the total members in a given score range from the leaderboard. | Retrieve the total members in a given score range from the leaderboard. | [
"Retrieve",
"the",
"total",
"members",
"in",
"a",
"given",
"score",
"range",
"from",
"the",
"leaderboard",
"."
] | def total_members_in_score_range(self, min_score, max_score):
'''
Retrieve the total members in a given score range from the leaderboard.
@param min_score [float] Minimum score.
@param max_score [float] Maximum score.
@return the total members in a given score range from the lea... | [
"def",
"total_members_in_score_range",
"(",
"self",
",",
"min_score",
",",
"max_score",
")",
":",
"return",
"self",
".",
"total_members_in_score_range_in",
"(",
"self",
".",
"leaderboard_name",
",",
"min_score",
",",
"max_score",
")"
] | https://github.com/agoragames/leaderboard-python/blob/4bc028164c259c3a31c7e6ccb2a8ecb83cfb1da2/leaderboard/leaderboard.py#L392-L401 | |
Fuyukai/Kyoukai | 44d47f4b0ece1c509fc5116275982df63ca09438 | kyoukai/backends/http2.py | python | H2KyoukaiProtocol.close | (self, error_code: int=0) | Called to terminate the connection for some reason.
This will close the underlying transport. | Called to terminate the connection for some reason. | [
"Called",
"to",
"terminate",
"the",
"connection",
"for",
"some",
"reason",
"."
] | def close(self, error_code: int=0):
"""
Called to terminate the connection for some reason.
This will close the underlying transport.
"""
# Send a GOAWAY frame.
self.conn.close_connection(error_code)
self.raw_write(self.conn.data_to_send())
self.transpor... | [
"def",
"close",
"(",
"self",
",",
"error_code",
":",
"int",
"=",
"0",
")",
":",
"# Send a GOAWAY frame.",
"self",
".",
"conn",
".",
"close_connection",
"(",
"error_code",
")",
"self",
".",
"raw_write",
"(",
"self",
".",
"conn",
".",
"data_to_send",
"(",
... | https://github.com/Fuyukai/Kyoukai/blob/44d47f4b0ece1c509fc5116275982df63ca09438/kyoukai/backends/http2.py#L532-L542 | ||
pypa/pipenv | b21baade71a86ab3ee1429f71fbc14d4f95fb75d | pipenv/patched/notpip/_vendor/urllib3/util/ssltransport.py | python | SSLTransport.send | (self, data, flags=0) | return response | [] | def send(self, data, flags=0):
if flags != 0:
raise ValueError("non-zero flags not allowed in calls to send")
response = self._ssl_io_loop(self.sslobj.write, data)
return response | [
"def",
"send",
"(",
"self",
",",
"data",
",",
"flags",
"=",
"0",
")",
":",
"if",
"flags",
"!=",
"0",
":",
"raise",
"ValueError",
"(",
"\"non-zero flags not allowed in calls to send\"",
")",
"response",
"=",
"self",
".",
"_ssl_io_loop",
"(",
"self",
".",
"s... | https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/patched/notpip/_vendor/urllib3/util/ssltransport.py#L99-L103 | |||
fake-name/ReadableWebProxy | ed5c7abe38706acc2684a1e6cd80242a03c5f010 | amqpstorm/base.py | python | Stateful.exceptions | (self) | return self._exceptions | Stores all exceptions thrown by this instance.
This is useful for troubleshooting, and is used internally
to check the health of the connection.
:rtype: list | Stores all exceptions thrown by this instance. | [
"Stores",
"all",
"exceptions",
"thrown",
"by",
"this",
"instance",
"."
] | def exceptions(self):
"""Stores all exceptions thrown by this instance.
This is useful for troubleshooting, and is used internally
to check the health of the connection.
:rtype: list
"""
return self._exceptions | [
"def",
"exceptions",
"(",
"self",
")",
":",
"return",
"self",
".",
"_exceptions"
] | https://github.com/fake-name/ReadableWebProxy/blob/ed5c7abe38706acc2684a1e6cd80242a03c5f010/amqpstorm/base.py#L85-L93 | |
rwightman/pytorch-image-models | ccfeb06936549f19c453b7f1f27e8e632cfbe1c2 | timm/models/efficientnet.py | python | efficientnet_em | (pretrained=False, **kwargs) | return model | EfficientNet-Edge-Medium. | EfficientNet-Edge-Medium. | [
"EfficientNet",
"-",
"Edge",
"-",
"Medium",
"."
] | def efficientnet_em(pretrained=False, **kwargs):
""" EfficientNet-Edge-Medium. """
model = _gen_efficientnet_edge(
'efficientnet_em', channel_multiplier=1.0, depth_multiplier=1.1, pretrained=pretrained, **kwargs)
return model | [
"def",
"efficientnet_em",
"(",
"pretrained",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"model",
"=",
"_gen_efficientnet_edge",
"(",
"'efficientnet_em'",
",",
"channel_multiplier",
"=",
"1.0",
",",
"depth_multiplier",
"=",
"1.1",
",",
"pretrained",
"=",
... | https://github.com/rwightman/pytorch-image-models/blob/ccfeb06936549f19c453b7f1f27e8e632cfbe1c2/timm/models/efficientnet.py#L1458-L1462 | |
pypa/setuptools | 9f37366aab9cd8f6baa23e6a77cfdb8daf97757e | setuptools/_vendor/pyparsing.py | python | dictOf | ( key, value ) | return Dict( ZeroOrMore( Group ( key + value ) ) ) | Helper to easily and clearly define a dictionary by specifying the respective patterns
for the key and value. Takes care of defining the C{L{Dict}}, C{L{ZeroOrMore}}, and C{L{Group}} tokens
in the proper order. The key pattern can include delimiting markers or punctuation,
as long as they are suppressed, ... | Helper to easily and clearly define a dictionary by specifying the respective patterns
for the key and value. Takes care of defining the C{L{Dict}}, C{L{ZeroOrMore}}, and C{L{Group}} tokens
in the proper order. The key pattern can include delimiting markers or punctuation,
as long as they are suppressed, ... | [
"Helper",
"to",
"easily",
"and",
"clearly",
"define",
"a",
"dictionary",
"by",
"specifying",
"the",
"respective",
"patterns",
"for",
"the",
"key",
"and",
"value",
".",
"Takes",
"care",
"of",
"defining",
"the",
"C",
"{",
"L",
"{",
"Dict",
"}}",
"C",
"{",
... | def dictOf( key, value ):
"""
Helper to easily and clearly define a dictionary by specifying the respective patterns
for the key and value. Takes care of defining the C{L{Dict}}, C{L{ZeroOrMore}}, and C{L{Group}} tokens
in the proper order. The key pattern can include delimiting markers or punctuation... | [
"def",
"dictOf",
"(",
"key",
",",
"value",
")",
":",
"return",
"Dict",
"(",
"ZeroOrMore",
"(",
"Group",
"(",
"key",
"+",
"value",
")",
")",
")"
] | https://github.com/pypa/setuptools/blob/9f37366aab9cd8f6baa23e6a77cfdb8daf97757e/setuptools/_vendor/pyparsing.py#L4646-L4679 | |
anki/vector-python-sdk | d61fdb07c6278deba750f987b20441fff2df865f | anki_vector/opengl/opengl_viewer.py | python | _OpenGLViewController.initialize | (self) | Sets up the OpenGL window and binds input callbacks to it | Sets up the OpenGL window and binds input callbacks to it | [
"Sets",
"up",
"the",
"OpenGL",
"window",
"and",
"binds",
"input",
"callbacks",
"to",
"it"
] | def initialize(self):
"""Sets up the OpenGL window and binds input callbacks to it
"""
glutKeyboardFunc(self._on_key_down)
glutSpecialFunc(self._on_special_key_down)
# [Keyboard/Special]Up methods aren't supported on some old GLUT implementations
has_keyboard_up = False... | [
"def",
"initialize",
"(",
"self",
")",
":",
"glutKeyboardFunc",
"(",
"self",
".",
"_on_key_down",
")",
"glutSpecialFunc",
"(",
"self",
".",
"_on_special_key_down",
")",
"# [Keyboard/Special]Up methods aren't supported on some old GLUT implementations",
"has_keyboard_up",
"=",... | https://github.com/anki/vector-python-sdk/blob/d61fdb07c6278deba750f987b20441fff2df865f/anki_vector/opengl/opengl_viewer.py#L179-L218 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Demo/parser/unparse.py | python | Unparser._Compare | (self, t) | [] | def _Compare(self, t):
self.write("(")
self.dispatch(t.left)
for o, e in zip(t.ops, t.comparators):
self.write(" " + self.cmpops[o.__class__.__name__] + " ")
self.dispatch(e)
self.write(")") | [
"def",
"_Compare",
"(",
"self",
",",
"t",
")",
":",
"self",
".",
"write",
"(",
"\"(\"",
")",
"self",
".",
"dispatch",
"(",
"t",
".",
"left",
")",
"for",
"o",
",",
"e",
"in",
"zip",
"(",
"t",
".",
"ops",
",",
"t",
".",
"comparators",
")",
":",... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Demo/parser/unparse.py#L452-L458 | ||||
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/ip_messaging/v1/service/user/__init__.py | python | UserPage.__repr__ | (self) | return '<Twilio.IpMessaging.V1.UserPage>' | Provide a friendly representation
:returns: Machine friendly representation
:rtype: str | Provide a friendly representation | [
"Provide",
"a",
"friendly",
"representation"
] | def __repr__(self):
"""
Provide a friendly representation
:returns: Machine friendly representation
:rtype: str
"""
return '<Twilio.IpMessaging.V1.UserPage>' | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"'<Twilio.IpMessaging.V1.UserPage>'"
] | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/ip_messaging/v1/service/user/__init__.py#L198-L205 | |
SciTools/iris | a12d0b15bab3377b23a148e891270b13a0419c38 | lib/iris/util.py | python | rolling_window | (a, window=1, step=1, axis=-1) | return rw | Make an ndarray with a rolling window of the last dimension
Args:
* a : array_like
Array to add rolling window to
Kwargs:
* window : int
Size of rolling window
* step : int
Size of step between rolling windows
* axis : int
Axis to take the rolling window over
... | Make an ndarray with a rolling window of the last dimension | [
"Make",
"an",
"ndarray",
"with",
"a",
"rolling",
"window",
"of",
"the",
"last",
"dimension"
] | def rolling_window(a, window=1, step=1, axis=-1):
"""
Make an ndarray with a rolling window of the last dimension
Args:
* a : array_like
Array to add rolling window to
Kwargs:
* window : int
Size of rolling window
* step : int
Size of step between rolling windows
... | [
"def",
"rolling_window",
"(",
"a",
",",
"window",
"=",
"1",
",",
"step",
"=",
"1",
",",
"axis",
"=",
"-",
"1",
")",
":",
"# NOTE: The implementation of this function originates from",
"# https://github.com/numpy/numpy/pull/31#issuecomment-1304851 04/08/2011",
"if",
"windo... | https://github.com/SciTools/iris/blob/a12d0b15bab3377b23a148e891270b13a0419c38/lib/iris/util.py#L272-L339 | |
kanzure/nanoengineer | 874e4c9f8a9190f093625b267f9767e19f82e6c4 | cad/src/graphics/rendering/mdl/writemdlfile.py | python | writemdlfile | (part, glpane, filename) | return | write the given part into a new MDL file with the given name,
using glpane.displayMode | write the given part into a new MDL file with the given name,
using glpane.displayMode | [
"write",
"the",
"given",
"part",
"into",
"a",
"new",
"MDL",
"file",
"with",
"the",
"given",
"name",
"using",
"glpane",
".",
"displayMode"
] | def writemdlfile(part, glpane, filename): #bruce 050927 replaced assy argument with part and glpane args, added docstring
"""
write the given part into a new MDL file with the given name,
using glpane.displayMode
"""
alist = [] #bruce 050325 changed assy.alist to localvar alist
natoms = 0
# ... | [
"def",
"writemdlfile",
"(",
"part",
",",
"glpane",
",",
"filename",
")",
":",
"#bruce 050927 replaced assy argument with part and glpane args, added docstring",
"alist",
"=",
"[",
"]",
"#bruce 050325 changed assy.alist to localvar alist",
"natoms",
"=",
"0",
"# Specular values ... | https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/graphics/rendering/mdl/writemdlfile.py#L28-L115 | |
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/datetime.py | python | date.year | (self) | return self._year | year (1-9999) | year (1-9999) | [
"year",
"(",
"1",
"-",
"9999",
")"
] | def year(self):
"""year (1-9999)"""
return self._year | [
"def",
"year",
"(",
"self",
")",
":",
"return",
"self",
".",
"_year"
] | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/datetime.py#L744-L746 | |
IBM/lale | b4d6829c143a4735b06083a0e6c70d2cca244162 | lale/operators.py | python | make_union | (*orig_steps) | return make_union_no_concat(*orig_steps) >> ConcatFeatures() | [] | def make_union(*orig_steps): # type: ignore
from lale.lib.lale import ConcatFeatures
return make_union_no_concat(*orig_steps) >> ConcatFeatures() | [
"def",
"make_union",
"(",
"*",
"orig_steps",
")",
":",
"# type: ignore",
"from",
"lale",
".",
"lib",
".",
"lale",
"import",
"ConcatFeatures",
"return",
"make_union_no_concat",
"(",
"*",
"orig_steps",
")",
">>",
"ConcatFeatures",
"(",
")"
] | https://github.com/IBM/lale/blob/b4d6829c143a4735b06083a0e6c70d2cca244162/lale/operators.py#L5403-L5406 | |||
PaddlePaddle/PaddleX | 2bab73f81ab54e328204e7871e6ae4a82e719f5d | static/paddlex_restful/restful/project/evaluate/detection.py | python | DetEvaluator.__init__ | (self, model_path, overlap_thresh=0.5, score_threshold=0.3) | [] | def __init__(self, model_path, overlap_thresh=0.5, score_threshold=0.3):
self.model_path = model_path
self.overlap_thresh = overlap_thresh if overlap_thresh is not None else .5
self.score_threshold = score_threshold if score_threshold is not None else .3 | [
"def",
"__init__",
"(",
"self",
",",
"model_path",
",",
"overlap_thresh",
"=",
"0.5",
",",
"score_threshold",
"=",
"0.3",
")",
":",
"self",
".",
"model_path",
"=",
"model_path",
"self",
".",
"overlap_thresh",
"=",
"overlap_thresh",
"if",
"overlap_thresh",
"is"... | https://github.com/PaddlePaddle/PaddleX/blob/2bab73f81ab54e328204e7871e6ae4a82e719f5d/static/paddlex_restful/restful/project/evaluate/detection.py#L406-L409 | ||||
aws/sagemaker-python-sdk | 9d259b316f7f43838c16f35c10e98a110b56735b | src/sagemaker/local/image.py | python | _delete_tree | (path) | Makes a call to `shutil.rmtree` for the given path.
Args:
path: | Makes a call to `shutil.rmtree` for the given path. | [
"Makes",
"a",
"call",
"to",
"shutil",
".",
"rmtree",
"for",
"the",
"given",
"path",
"."
] | def _delete_tree(path):
"""Makes a call to `shutil.rmtree` for the given path.
Args:
path:
"""
try:
shutil.rmtree(path)
except OSError as exc:
# on Linux, when docker writes to any mounted volume, it uses the container's user. In most
# cases this is root. When the c... | [
"def",
"_delete_tree",
"(",
"path",
")",
":",
"try",
":",
"shutil",
".",
"rmtree",
"(",
"path",
")",
"except",
"OSError",
"as",
"exc",
":",
"# on Linux, when docker writes to any mounted volume, it uses the container's user. In most",
"# cases this is root. When the container... | https://github.com/aws/sagemaker-python-sdk/blob/9d259b316f7f43838c16f35c10e98a110b56735b/src/sagemaker/local/image.py#L952-L969 | ||
scikit-learn/scikit-learn | 1d1aadd0711b87d2a11c80aad15df6f8cf156712 | sklearn/manifold/_t_sne.py | python | TSNE._tsne | (
self,
P,
degrees_of_freedom,
n_samples,
X_embedded,
neighbors=None,
skip_num_points=0,
) | return X_embedded | Runs t-SNE. | Runs t-SNE. | [
"Runs",
"t",
"-",
"SNE",
"."
] | def _tsne(
self,
P,
degrees_of_freedom,
n_samples,
X_embedded,
neighbors=None,
skip_num_points=0,
):
"""Runs t-SNE."""
# t-SNE minimizes the Kullback-Leiber divergence of the Gaussians P
# and the Student's t-distributions Q. The optimi... | [
"def",
"_tsne",
"(",
"self",
",",
"P",
",",
"degrees_of_freedom",
",",
"n_samples",
",",
"X_embedded",
",",
"neighbors",
"=",
"None",
",",
"skip_num_points",
"=",
"0",
",",
")",
":",
"# t-SNE minimizes the Kullback-Leiber divergence of the Gaussians P",
"# and the Stu... | https://github.com/scikit-learn/scikit-learn/blob/1d1aadd0711b87d2a11c80aad15df6f8cf156712/sklearn/manifold/_t_sne.py#L1015-L1088 | |
codelv/enaml-native | 04c3a015bcd649f374c5ecd98fcddba5e4fbdbdc | src/enamlnative/android/android_wifi.py | python | WifiManager.__del__ | (self) | Remove any receivers before destroying | Remove any receivers before destroying | [
"Remove",
"any",
"receivers",
"before",
"destroying"
] | def __del__(self):
""" Remove any receivers before destroying """
app = AndroidApplication.instance()
activity = app.widget
for r in self._receivers:
activity.unregisterReceiver(r)
super(WifiManager, self).__del__() | [
"def",
"__del__",
"(",
"self",
")",
":",
"app",
"=",
"AndroidApplication",
".",
"instance",
"(",
")",
"activity",
"=",
"app",
".",
"widget",
"for",
"r",
"in",
"self",
".",
"_receivers",
":",
"activity",
".",
"unregisterReceiver",
"(",
"r",
")",
"super",
... | https://github.com/codelv/enaml-native/blob/04c3a015bcd649f374c5ecd98fcddba5e4fbdbdc/src/enamlnative/android/android_wifi.py#L419-L425 | ||
deepfakes/faceswap | 09c7d8aca3c608d1afad941ea78e9fd9b64d9219 | lib/gui/custom_widgets.py | python | PopupProgress.progress_bar | (self) | return self._progress_bar | :class:`tkinter.ttk.Progressbar`: The progress bar object within the pop up window. | :class:`tkinter.ttk.Progressbar`: The progress bar object within the pop up window. | [
":",
"class",
":",
"tkinter",
".",
"ttk",
".",
"Progressbar",
":",
"The",
"progress",
"bar",
"object",
"within",
"the",
"pop",
"up",
"window",
"."
] | def progress_bar(self):
""" :class:`tkinter.ttk.Progressbar`: The progress bar object within the pop up window. """
return self._progress_bar | [
"def",
"progress_bar",
"(",
"self",
")",
":",
"return",
"self",
".",
"_progress_bar"
] | https://github.com/deepfakes/faceswap/blob/09c7d8aca3c608d1afad941ea78e9fd9b64d9219/lib/gui/custom_widgets.py#L827-L829 | |
ctxis/canape | 5f0e03424577296bcc60c2008a60a98ec5307e4b | CANAPE.Scripting/Lib/SimpleHTTPServer.py | python | SimpleHTTPRequestHandler.guess_type | (self, path) | Guess the type of a file.
Argument is a PATH (a filename).
Return value is a string of the form type/subtype,
usable for a MIME Content-type header.
The default implementation looks the file's extension
up in the table self.extensions_map, using application/octet-stream
... | Guess the type of a file. | [
"Guess",
"the",
"type",
"of",
"a",
"file",
"."
] | def guess_type(self, path):
"""Guess the type of a file.
Argument is a PATH (a filename).
Return value is a string of the form type/subtype,
usable for a MIME Content-type header.
The default implementation looks the file's extension
up in the table self.extensions_map... | [
"def",
"guess_type",
"(",
"self",
",",
"path",
")",
":",
"base",
",",
"ext",
"=",
"posixpath",
".",
"splitext",
"(",
"path",
")",
"if",
"ext",
"in",
"self",
".",
"extensions_map",
":",
"return",
"self",
".",
"extensions_map",
"[",
"ext",
"]",
"ext",
... | https://github.com/ctxis/canape/blob/5f0e03424577296bcc60c2008a60a98ec5307e4b/CANAPE.Scripting/Lib/SimpleHTTPServer.py#L179-L201 | ||
leo-editor/leo-editor | 383d6776d135ef17d73d935a2f0ecb3ac0e99494 | leo/core/format-code.py | python | formatController.underline | (self,s,p) | return '%s\n%s\n\n' % (p.h.strip(),ch*n) | Return the underlining string to be used at the given level for string s. | Return the underlining string to be used at the given level for string s. | [
"Return",
"the",
"underlining",
"string",
"to",
"be",
"used",
"at",
"the",
"given",
"level",
"for",
"string",
"s",
"."
] | def underline (self,s,p):
'''Return the underlining string to be used at the given level for string s.'''
trace = False and not g.unitTesting
# The user is responsible for top-level overlining.
u = self.getOption('underline_characters') # '''#=+*^~"'`-:><_'''
level = max(0,p.... | [
"def",
"underline",
"(",
"self",
",",
"s",
",",
"p",
")",
":",
"trace",
"=",
"False",
"and",
"not",
"g",
".",
"unitTesting",
"# The user is responsible for top-level overlining.",
"u",
"=",
"self",
".",
"getOption",
"(",
"'underline_characters'",
")",
"# '''#=+... | https://github.com/leo-editor/leo-editor/blob/383d6776d135ef17d73d935a2f0ecb3ac0e99494/leo/core/format-code.py#L339-L352 | |
studioimaginaire/phue | 8ea25484176c3055a30469361977d4bc83ca2a83 | phue.py | python | Light.brightness | (self) | return self._brightness | Get or set the brightness of the light [0-254].
0 is not off | Get or set the brightness of the light [0-254]. | [
"Get",
"or",
"set",
"the",
"brightness",
"of",
"the",
"light",
"[",
"0",
"-",
"254",
"]",
"."
] | def brightness(self):
'''Get or set the brightness of the light [0-254].
0 is not off'''
self._brightness = self._get('bri')
return self._brightness | [
"def",
"brightness",
"(",
"self",
")",
":",
"self",
".",
"_brightness",
"=",
"self",
".",
"_get",
"(",
"'bri'",
")",
"return",
"self",
".",
"_brightness"
] | https://github.com/studioimaginaire/phue/blob/8ea25484176c3055a30469361977d4bc83ca2a83/phue.py#L189-L195 | |
replit-archive/empythoned | 977ec10ced29a3541a4973dc2b59910805695752 | dist/lib/python2.7/mhlib.py | python | Folder.__init__ | (self, mh, name) | Constructor. | Constructor. | [
"Constructor",
"."
] | def __init__(self, mh, name):
"""Constructor."""
self.mh = mh
self.name = name
if not os.path.isdir(self.getfullname()):
raise Error, 'no folder %s' % name | [
"def",
"__init__",
"(",
"self",
",",
"mh",
",",
"name",
")",
":",
"self",
".",
"mh",
"=",
"mh",
"self",
".",
"name",
"=",
"name",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"self",
".",
"getfullname",
"(",
")",
")",
":",
"raise",
"Error... | https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/dist/lib/python2.7/mhlib.py#L245-L250 | ||
mpescimoro/wi-finder | d19c22d662d60da9f51795cad5cbb7042142a2b8 | nmap/nmap.py | python | PortScannerAsync.wait | (self, timeout=None) | return | Wait for the current scan process to finish, or timeout
:param timeout: default = None, wait timeout seconds | Wait for the current scan process to finish, or timeout | [
"Wait",
"for",
"the",
"current",
"scan",
"process",
"to",
"finish",
"or",
"timeout"
] | def wait(self, timeout=None):
"""
Wait for the current scan process to finish, or timeout
:param timeout: default = None, wait timeout seconds
"""
assert type(timeout) in (int, type(None)), 'Wrong type for [timeout], should be an int or None [was {0}]'.format(type(timeout))
... | [
"def",
"wait",
"(",
"self",
",",
"timeout",
"=",
"None",
")",
":",
"assert",
"type",
"(",
"timeout",
")",
"in",
"(",
"int",
",",
"type",
"(",
"None",
")",
")",
",",
"'Wrong type for [timeout], should be an int or None [was {0}]'",
".",
"format",
"(",
"type",... | https://github.com/mpescimoro/wi-finder/blob/d19c22d662d60da9f51795cad5cbb7042142a2b8/nmap/nmap.py#L771-L782 | |
apache/superset | 3d829fc3c838358dd8c798ecaeefd34c502edca0 | superset/datasets/api.py | python | DatasetRestApi.refresh | (self, pk: int) | Refresh a Dataset
---
put:
description: >-
Refreshes and updates columns of a dataset
parameters:
- in: path
schema:
type: integer
name: pk
responses:
200:
description: Dataset delete
... | Refresh a Dataset
---
put:
description: >-
Refreshes and updates columns of a dataset
parameters:
- in: path
schema:
type: integer
name: pk
responses:
200:
description: Dataset delete
... | [
"Refresh",
"a",
"Dataset",
"---",
"put",
":",
"description",
":",
">",
"-",
"Refreshes",
"and",
"updates",
"columns",
"of",
"a",
"dataset",
"parameters",
":",
"-",
"in",
":",
"path",
"schema",
":",
"type",
":",
"integer",
"name",
":",
"pk",
"responses",
... | def refresh(self, pk: int) -> Response:
"""Refresh a Dataset
---
put:
description: >-
Refreshes and updates columns of a dataset
parameters:
- in: path
schema:
type: integer
name: pk
responses:
... | [
"def",
"refresh",
"(",
"self",
",",
"pk",
":",
"int",
")",
"->",
"Response",
":",
"try",
":",
"RefreshDatasetCommand",
"(",
"g",
".",
"user",
",",
"pk",
")",
".",
"run",
"(",
")",
"return",
"self",
".",
"response",
"(",
"200",
",",
"message",
"=",
... | https://github.com/apache/superset/blob/3d829fc3c838358dd8c798ecaeefd34c502edca0/superset/datasets/api.py#L503-L549 | ||
FederatedAI/FATE | 32540492623568ecd1afcb367360133616e02fa3 | python/federatedml/param/base_param.py | python | BaseParam._range | (value, ranges) | return in_range | [] | def _range(value, ranges):
in_range = False
for left_limit, right_limit in ranges:
if (
left_limit - consts.FLOAT_ZERO
<= value
<= right_limit + consts.FLOAT_ZERO
):
in_range = True
break
ret... | [
"def",
"_range",
"(",
"value",
",",
"ranges",
")",
":",
"in_range",
"=",
"False",
"for",
"left_limit",
",",
"right_limit",
"in",
"ranges",
":",
"if",
"(",
"left_limit",
"-",
"consts",
".",
"FLOAT_ZERO",
"<=",
"value",
"<=",
"right_limit",
"+",
"consts",
... | https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/federatedml/param/base_param.py#L345-L356 | |||
sabnzbd/sabnzbd | 52d21e94d3cc6e30764a833fe2a256783d1a8931 | builder/package.py | python | patch_version_file | (release_name) | Patch in the Git commit hash, but only when this is
an unmodified checkout | Patch in the Git commit hash, but only when this is
an unmodified checkout | [
"Patch",
"in",
"the",
"Git",
"commit",
"hash",
"but",
"only",
"when",
"this",
"is",
"an",
"unmodified",
"checkout"
] | def patch_version_file(release_name):
"""Patch in the Git commit hash, but only when this is
an unmodified checkout
"""
git_output = run_git_command(["log", "-1"])
for line in git_output.split("\n"):
if "commit " in line:
commit = line.split(" ")[1].strip()
break
... | [
"def",
"patch_version_file",
"(",
"release_name",
")",
":",
"git_output",
"=",
"run_git_command",
"(",
"[",
"\"log\"",
",",
"\"-1\"",
"]",
")",
"for",
"line",
"in",
"git_output",
".",
"split",
"(",
"\"\\n\"",
")",
":",
"if",
"\"commit \"",
"in",
"line",
":... | https://github.com/sabnzbd/sabnzbd/blob/52d21e94d3cc6e30764a833fe2a256783d1a8931/builder/package.py#L95-L114 | ||
pystitch/stitch | 09a16da2f2af2be6a960e2338de488c8de2c2271 | stitch/stitch.py | python | is_executable | (block, lang, attrs) | return (is_code_block(block) and attrs.get('eval') is not False and
lang is not None) | Return whether a block should be executed.
Must be a code_block, and must not have ``eval=False`` in the block
arguments, and ``lang`` (kernel_name) must not be None. | Return whether a block should be executed.
Must be a code_block, and must not have ``eval=False`` in the block
arguments, and ``lang`` (kernel_name) must not be None. | [
"Return",
"whether",
"a",
"block",
"should",
"be",
"executed",
".",
"Must",
"be",
"a",
"code_block",
"and",
"must",
"not",
"have",
"eval",
"=",
"False",
"in",
"the",
"block",
"arguments",
"and",
"lang",
"(",
"kernel_name",
")",
"must",
"not",
"be",
"None... | def is_executable(block, lang, attrs):
"""
Return whether a block should be executed.
Must be a code_block, and must not have ``eval=False`` in the block
arguments, and ``lang`` (kernel_name) must not be None.
"""
return (is_code_block(block) and attrs.get('eval') is not False and
la... | [
"def",
"is_executable",
"(",
"block",
",",
"lang",
",",
"attrs",
")",
":",
"return",
"(",
"is_code_block",
"(",
"block",
")",
"and",
"attrs",
".",
"get",
"(",
"'eval'",
")",
"is",
"not",
"False",
"and",
"lang",
"is",
"not",
"None",
")"
] | https://github.com/pystitch/stitch/blob/09a16da2f2af2be6a960e2338de488c8de2c2271/stitch/stitch.py#L567-L574 | |
yt-project/yt | dc7b24f9b266703db4c843e329c6c8644d47b824 | yt/data_objects/construction_data_containers.py | python | YTProj.plot | (self, fields=None) | return pw | [] | def plot(self, fields=None):
if hasattr(self.data_source, "left_edge") and hasattr(
self.data_source, "right_edge"
):
left_edge = self.data_source.left_edge
right_edge = self.data_source.right_edge
center = (left_edge + right_edge) / 2.0
width ... | [
"def",
"plot",
"(",
"self",
",",
"fields",
"=",
"None",
")",
":",
"if",
"hasattr",
"(",
"self",
".",
"data_source",
",",
"\"left_edge\"",
")",
"and",
"hasattr",
"(",
"self",
".",
"data_source",
",",
"\"right_edge\"",
")",
":",
"left_edge",
"=",
"self",
... | https://github.com/yt-project/yt/blob/dc7b24f9b266703db4c843e329c6c8644d47b824/yt/data_objects/construction_data_containers.py#L313-L334 | |||
josephwilk/semanticpy | 60af3f190fd44e5c76717c3a126cdc9201624cb5 | semanticpy/porter_stemmer.py | python | PorterStemmer.ends | (self, s) | return 1 | ends(s) is TRUE <=> k0,...k ends with the string s. | ends(s) is TRUE <=> k0,...k ends with the string s. | [
"ends",
"(",
"s",
")",
"is",
"TRUE",
"<",
"=",
">",
"k0",
"...",
"k",
"ends",
"with",
"the",
"string",
"s",
"."
] | def ends(self, s):
"""ends(s) is TRUE <=> k0,...k ends with the string s."""
length = len(s)
if s[length - 1] != self.b[self.k]: # tiny speed-up
return 0
if length > (self.k - self.k0 + 1):
return 0
if self.b[self.k-length+1:self.k+1] != s:
ret... | [
"def",
"ends",
"(",
"self",
",",
"s",
")",
":",
"length",
"=",
"len",
"(",
"s",
")",
"if",
"s",
"[",
"length",
"-",
"1",
"]",
"!=",
"self",
".",
"b",
"[",
"self",
".",
"k",
"]",
":",
"# tiny speed-up",
"return",
"0",
"if",
"length",
">",
"(",... | https://github.com/josephwilk/semanticpy/blob/60af3f190fd44e5c76717c3a126cdc9201624cb5/semanticpy/porter_stemmer.py#L130-L140 | |
karanchahal/distiller | a17ec06cbeafcdd2aea19d7c7663033c951392f5 | distill_archive/research_seed/baselines/rkd_baseline/rkd_baseline_trainer.py | python | main | (hparams) | [] | def main(hparams):
# init module
teacher_base = create_cnn_model(hparams.teacher_model, feature_maps=True, dataset=hparams.dataset)
# Loading from checkpoint
teacher_base = load_model_chk(teacher_base, hparams.path_to_teacher)
# Train Teacher Embedding
trained_teacher_with_embed = RKD_... | [
"def",
"main",
"(",
"hparams",
")",
":",
"# init module",
"teacher_base",
"=",
"create_cnn_model",
"(",
"hparams",
".",
"teacher_model",
",",
"feature_maps",
"=",
"True",
",",
"dataset",
"=",
"hparams",
".",
"dataset",
")",
"# Loading from checkpoint",
"teacher_ba... | https://github.com/karanchahal/distiller/blob/a17ec06cbeafcdd2aea19d7c7663033c951392f5/distill_archive/research_seed/baselines/rkd_baseline/rkd_baseline_trainer.py#L11-L43 | ||||
edisonlz/fastor | 342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3 | base/site-packages/flup/server/ajp.py | python | WSGIServer.run | (self) | return ret | Main loop. Call this after instantiating WSGIServer. SIGHUP, SIGINT,
SIGQUIT, SIGTERM cause it to cleanup and return. (If a SIGHUP
is caught, this method returns True. Returns False otherwise.) | Main loop. Call this after instantiating WSGIServer. SIGHUP, SIGINT,
SIGQUIT, SIGTERM cause it to cleanup and return. (If a SIGHUP
is caught, this method returns True. Returns False otherwise.) | [
"Main",
"loop",
".",
"Call",
"this",
"after",
"instantiating",
"WSGIServer",
".",
"SIGHUP",
"SIGINT",
"SIGQUIT",
"SIGTERM",
"cause",
"it",
"to",
"cleanup",
"and",
"return",
".",
"(",
"If",
"a",
"SIGHUP",
"is",
"caught",
"this",
"method",
"returns",
"True",
... | def run(self):
"""
Main loop. Call this after instantiating WSGIServer. SIGHUP, SIGINT,
SIGQUIT, SIGTERM cause it to cleanup and return. (If a SIGHUP
is caught, this method returns True. Returns False otherwise.)
"""
self.logger.info('%s starting up', self.__class__.__nam... | [
"def",
"run",
"(",
"self",
")",
":",
"self",
".",
"logger",
".",
"info",
"(",
"'%s starting up'",
",",
"self",
".",
"__class__",
".",
"__name__",
")",
"try",
":",
"sock",
"=",
"self",
".",
"_setupSocket",
"(",
")",
"except",
"socket",
".",
"error",
"... | https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/flup/server/ajp.py#L148-L173 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/wagtail_bak/wagtailcore/models.py | python | PagePermissionTester.can_delete | (self) | [] | def can_delete(self):
if not self.user.is_active:
return False
if self.page_is_root: # root node is not a page and can never be deleted, even by superusers
return False
if self.user.is_superuser:
# superusers require no further checks
return True... | [
"def",
"can_delete",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"user",
".",
"is_active",
":",
"return",
"False",
"if",
"self",
".",
"page_is_root",
":",
"# root node is not a page and can never be deleted, even by superusers",
"return",
"False",
"if",
"self",... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/wagtail_bak/wagtailcore/models.py#L1741-L1777 | ||||
SteveDoyle2/pyNastran | eda651ac2d4883d95a34951f8a002ff94f642a1a | pyNastran/dev/bdf_vectorized/cards/elements/shell/ctria6.py | python | CTRIA6._mass_area_normal | (self, element_id=None, xyz_cid0=None,
calculate_mass=True, calculate_area=True,
calculate_normal=True) | return massi, A, normal | Gets the mass, area, and normals of the CTRIA6s on a per
element basis.
Parameters
----------
element_id : (nelements, ) int ndarray; default=None -> all
the elements to consider
:param node_ids: the GRIDs as an (N, ) NDARRAY (or None)
:param xyz_cid0: the ... | Gets the mass, area, and normals of the CTRIA6s on a per
element basis. | [
"Gets",
"the",
"mass",
"area",
"and",
"normals",
"of",
"the",
"CTRIA6s",
"on",
"a",
"per",
"element",
"basis",
"."
] | def _mass_area_normal(self, element_id=None, xyz_cid0=None,
calculate_mass=True, calculate_area=True,
calculate_normal=True):
"""
Gets the mass, area, and normals of the CTRIA6s on a per
element basis.
Parameters
----------
... | [
"def",
"_mass_area_normal",
"(",
"self",
",",
"element_id",
"=",
"None",
",",
"xyz_cid0",
"=",
"None",
",",
"calculate_mass",
"=",
"True",
",",
"calculate_area",
"=",
"True",
",",
"calculate_normal",
"=",
"True",
")",
":",
"if",
"element_id",
"is",
"None",
... | https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/dev/bdf_vectorized/cards/elements/shell/ctria6.py#L126-L167 | |
pymedusa/Medusa | 1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38 | ext/boto/regioninfo.py | python | RegionInfo.connect | (self, **kw_params) | Connect to this Region's endpoint. Returns an connection
object pointing to the endpoint associated with this region.
You may pass any of the arguments accepted by the connection
class's constructor as keyword arguments and they will be
passed along to the connection object.
:rt... | Connect to this Region's endpoint. Returns an connection
object pointing to the endpoint associated with this region.
You may pass any of the arguments accepted by the connection
class's constructor as keyword arguments and they will be
passed along to the connection object. | [
"Connect",
"to",
"this",
"Region",
"s",
"endpoint",
".",
"Returns",
"an",
"connection",
"object",
"pointing",
"to",
"the",
"endpoint",
"associated",
"with",
"this",
"region",
".",
"You",
"may",
"pass",
"any",
"of",
"the",
"arguments",
"accepted",
"by",
"the"... | def connect(self, **kw_params):
"""
Connect to this Region's endpoint. Returns an connection
object pointing to the endpoint associated with this region.
You may pass any of the arguments accepted by the connection
class's constructor as keyword arguments and they will be
... | [
"def",
"connect",
"(",
"self",
",",
"*",
"*",
"kw_params",
")",
":",
"if",
"self",
".",
"connection_cls",
":",
"return",
"self",
".",
"connection_cls",
"(",
"region",
"=",
"self",
",",
"*",
"*",
"kw_params",
")"
] | https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/boto/regioninfo.py#L278-L290 | ||
MarcusOlivecrona/REINVENT | 752935c29d46868d1aa040c0cd9c8d2169c9150a | data_structs.py | python | Vocabulary.tokenize | (self, smiles) | return tokenized | Takes a SMILES and return a list of characters/tokens | Takes a SMILES and return a list of characters/tokens | [
"Takes",
"a",
"SMILES",
"and",
"return",
"a",
"list",
"of",
"characters",
"/",
"tokens"
] | def tokenize(self, smiles):
"""Takes a SMILES and return a list of characters/tokens"""
regex = '(\[[^\[\]]{1,6}\])'
smiles = replace_halogen(smiles)
char_list = re.split(regex, smiles)
tokenized = []
for char in char_list:
if char.startswith('['):
... | [
"def",
"tokenize",
"(",
"self",
",",
"smiles",
")",
":",
"regex",
"=",
"'(\\[[^\\[\\]]{1,6}\\])'",
"smiles",
"=",
"replace_halogen",
"(",
"smiles",
")",
"char_list",
"=",
"re",
".",
"split",
"(",
"regex",
",",
"smiles",
")",
"tokenized",
"=",
"[",
"]",
"... | https://github.com/MarcusOlivecrona/REINVENT/blob/752935c29d46868d1aa040c0cd9c8d2169c9150a/data_structs.py#L42-L55 | |
shiweibsw/Translation-Tools | 2fbbf902364e557fa7017f9a74a8797b7440c077 | venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/colorama/initialise.py | python | wrap_stream | (stream, convert, strip, autoreset, wrap) | return stream | [] | def wrap_stream(stream, convert, strip, autoreset, wrap):
if wrap:
wrapper = AnsiToWin32(stream,
convert=convert, strip=strip, autoreset=autoreset)
if wrapper.should_wrap():
stream = wrapper.stream
return stream | [
"def",
"wrap_stream",
"(",
"stream",
",",
"convert",
",",
"strip",
",",
"autoreset",
",",
"wrap",
")",
":",
"if",
"wrap",
":",
"wrapper",
"=",
"AnsiToWin32",
"(",
"stream",
",",
"convert",
"=",
"convert",
",",
"strip",
"=",
"strip",
",",
"autoreset",
"... | https://github.com/shiweibsw/Translation-Tools/blob/2fbbf902364e557fa7017f9a74a8797b7440c077/venv/Lib/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/colorama/initialise.py#L74-L80 | |||
OpenTreeMap/otm-core | 06600b85880136da46f0a18f9e447aa80b1a8d32 | opentreemap/treemap/search.py | python | create_filter | (instance, filterstr, mapping) | return q | A filter is a string that must be valid json and conform to
the following grammar:
literal = json literal | GMT date string in 'YYYY-MM-DD HH:MM:SS'
model = 'plot' | 'tree' | 'species'
value-property = 'MIN'
| 'MAX'
| 'EXCLUSIVE'
|... | A filter is a string that must be valid json and conform to
the following grammar:
literal = json literal | GMT date string in 'YYYY-MM-DD HH:MM:SS'
model = 'plot' | 'tree' | 'species'
value-property = 'MIN'
| 'MAX'
| 'EXCLUSIVE'
|... | [
"A",
"filter",
"is",
"a",
"string",
"that",
"must",
"be",
"valid",
"json",
"and",
"conform",
"to",
"the",
"following",
"grammar",
":",
"literal",
"=",
"json",
"literal",
"|",
"GMT",
"date",
"string",
"in",
"YYYY",
"-",
"MM",
"-",
"DD",
"HH",
":",
"MM... | def create_filter(instance, filterstr, mapping):
"""
A filter is a string that must be valid json and conform to
the following grammar:
literal = json literal | GMT date string in 'YYYY-MM-DD HH:MM:SS'
model = 'plot' | 'tree' | 'species'
value-property = 'MIN'
... | [
"def",
"create_filter",
"(",
"instance",
",",
"filterstr",
",",
"mapping",
")",
":",
"if",
"filterstr",
"is",
"not",
"None",
"and",
"filterstr",
"!=",
"''",
":",
"query",
"=",
"loads",
"(",
"filterstr",
")",
"convert_filter_units",
"(",
"instance",
",",
"q... | https://github.com/OpenTreeMap/otm-core/blob/06600b85880136da46f0a18f9e447aa80b1a8d32/opentreemap/treemap/search.py#L166-L201 | |
deepmind/dm_control | 806a10e896e7c887635328bfa8352604ad0fedae | dm_control/viewer/renderer.py | python | SceneCamera.zoom_to_scene | (self) | Zooms in on the entire scene. | Zooms in on the entire scene. | [
"Zooms",
"in",
"on",
"the",
"entire",
"scene",
"."
] | def zoom_to_scene(self):
"""Zooms in on the entire scene."""
self.look_at(self._model.stat.center[:],
self._zoom_factor * self._model.stat.extent)
self.settings = self._settings | [
"def",
"zoom_to_scene",
"(",
"self",
")",
":",
"self",
".",
"look_at",
"(",
"self",
".",
"_model",
".",
"stat",
".",
"center",
"[",
":",
"]",
",",
"self",
".",
"_zoom_factor",
"*",
"self",
".",
"_model",
".",
"stat",
".",
"extent",
")",
"self",
"."... | https://github.com/deepmind/dm_control/blob/806a10e896e7c887635328bfa8352604ad0fedae/dm_control/viewer/renderer.py#L503-L508 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/alembic/runtime/migration.py | python | MigrationStep.upgrade_from_script | (cls, revision_map, script) | return RevisionStep(revision_map, script, True) | [] | def upgrade_from_script(cls, revision_map, script):
return RevisionStep(revision_map, script, True) | [
"def",
"upgrade_from_script",
"(",
"cls",
",",
"revision_map",
",",
"script",
")",
":",
"return",
"RevisionStep",
"(",
"revision_map",
",",
"script",
",",
"True",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/alembic/runtime/migration.py#L676-L677 | |||
ljean/modbus-tk | 1159c71794071ae67f73f86fa14dd71c989b4859 | modbus_tk/pymodbusclient.py | python | PyModbusClientTCP.open | (self) | return True | [] | def open(self):
self.client.open()
return True | [
"def",
"open",
"(",
"self",
")",
":",
"self",
".",
"client",
".",
"open",
"(",
")",
"return",
"True"
] | https://github.com/ljean/modbus-tk/blob/1159c71794071ae67f73f86fa14dd71c989b4859/modbus_tk/pymodbusclient.py#L10-L12 | |||
Map-A-Droid/MAD | 81375b5c9ccc5ca3161eb487aa81469d40ded221 | mapadroid/data_manager/__init__.py | python | DataManager.fix_routecalc_on_boot | (self) | [] | def fix_routecalc_on_boot(self) -> None:
rc_sql = "IFNULL(id.`routecalc`, IFNULL(iv.`routecalc`, IFNULL(mon.`routecalc`, " \
"IFNULL(ps.`routecalc`, ra.`routecalc`))))"
sql = "SELECT a.`area_id`, a.`instance_id` AS 'ain', rc.`routecalc_id`, rc.`instance_id` AS 'rcin'\n"\
"... | [
"def",
"fix_routecalc_on_boot",
"(",
"self",
")",
"->",
"None",
":",
"rc_sql",
"=",
"\"IFNULL(id.`routecalc`, IFNULL(iv.`routecalc`, IFNULL(mon.`routecalc`, \"",
"\"IFNULL(ps.`routecalc`, ra.`routecalc`))))\"",
"sql",
"=",
"\"SELECT a.`area_id`, a.`instance_id` AS 'ain', rc.`routecalc_id... | https://github.com/Map-A-Droid/MAD/blob/81375b5c9ccc5ca3161eb487aa81469d40ded221/mapadroid/data_manager/__init__.py#L37-L62 | ||||
JaniceWuo/MovieRecommend | 4c86db64ca45598917d304f535413df3bc9fea65 | movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/models.py | python | PreparedRequest.prepare_content_length | (self, body) | [] | def prepare_content_length(self, body):
if hasattr(body, 'seek') and hasattr(body, 'tell'):
curr_pos = body.tell()
body.seek(0, 2)
end_pos = body.tell()
self.headers['Content-Length'] = builtin_str(max(0, end_pos - curr_pos))
body.seek(curr_pos, 0)
... | [
"def",
"prepare_content_length",
"(",
"self",
",",
"body",
")",
":",
"if",
"hasattr",
"(",
"body",
",",
"'seek'",
")",
"and",
"hasattr",
"(",
"body",
",",
"'tell'",
")",
":",
"curr_pos",
"=",
"body",
".",
"tell",
"(",
")",
"body",
".",
"seek",
"(",
... | https://github.com/JaniceWuo/MovieRecommend/blob/4c86db64ca45598917d304f535413df3bc9fea65/movierecommend/venv1/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/models.py#L472-L484 | ||||
graphql-python/graphql-core | 9ea9c3705d6826322027d9bb539d37c5b25f7af9 | src/graphql/utilities/separate_operations.py | python | separate_operations | (document_ast: DocumentNode) | return separated_document_asts | Separate operations in a given AST document.
This function accepts a single AST document which may contain many operations and
fragments and returns a collection of AST documents each of which contains a single
operation as well the fragment definitions it refers to. | Separate operations in a given AST document. | [
"Separate",
"operations",
"in",
"a",
"given",
"AST",
"document",
"."
] | def separate_operations(document_ast: DocumentNode) -> Dict[str, DocumentNode]:
"""Separate operations in a given AST document.
This function accepts a single AST document which may contain many operations and
fragments and returns a collection of AST documents each of which contains a single
operation... | [
"def",
"separate_operations",
"(",
"document_ast",
":",
"DocumentNode",
")",
"->",
"Dict",
"[",
"str",
",",
"DocumentNode",
"]",
":",
"operations",
":",
"List",
"[",
"OperationDefinitionNode",
"]",
"=",
"[",
"]",
"dep_graph",
":",
"DepGraph",
"=",
"{",
"}",
... | https://github.com/graphql-python/graphql-core/blob/9ea9c3705d6826322027d9bb539d37c5b25f7af9/src/graphql/utilities/separate_operations.py#L19-L66 | |
nasa-jpl-memex/memex-explorer | d2910496238359b3676b4467721017fc82f0b324 | source/base/views.py | python | AddProjectView.get_success_url | (self) | return self.object.get_absolute_url() | [] | def get_success_url(self):
return self.object.get_absolute_url() | [
"def",
"get_success_url",
"(",
"self",
")",
":",
"return",
"self",
".",
"object",
".",
"get_absolute_url",
"(",
")"
] | https://github.com/nasa-jpl-memex/memex-explorer/blob/d2910496238359b3676b4467721017fc82f0b324/source/base/views.py#L97-L98 | |||
witherst/MayaNodeInterface | 30d35bd199cb864b0ae2b21e7ce3dc75c690837d | ui/nodeWidgetsModule.py | python | AbstractAttrObject.setupWidget | (self) | Abstract. This function is called AS SOON AS THE NODE IS CREATED IN THE SCENE, regardless of
if it is connected to another node. | Abstract. This function is called AS SOON AS THE NODE IS CREATED IN THE SCENE, regardless of
if it is connected to another node. | [
"Abstract",
".",
"This",
"function",
"is",
"called",
"AS",
"SOON",
"AS",
"THE",
"NODE",
"IS",
"CREATED",
"IN",
"THE",
"SCENE",
"regardless",
"of",
"if",
"it",
"is",
"connected",
"to",
"another",
"node",
"."
] | def setupWidget(self):
"""
Abstract. This function is called AS SOON AS THE NODE IS CREATED IN THE SCENE, regardless of
if it is connected to another node.
"""
pass | [
"def",
"setupWidget",
"(",
"self",
")",
":",
"pass"
] | https://github.com/witherst/MayaNodeInterface/blob/30d35bd199cb864b0ae2b21e7ce3dc75c690837d/ui/nodeWidgetsModule.py#L159-L164 | ||
XX-net/XX-Net | a9898cfcf0084195fb7e69b6bc834e59aecdf14f | python3.8.2/Lib/OpenSSL/_util.py | python | make_assert | (error) | return openssl_assert | Create an assert function that uses :func:`exception_from_error_queue` to
raise an exception wrapped by *error*. | Create an assert function that uses :func:`exception_from_error_queue` to
raise an exception wrapped by *error*. | [
"Create",
"an",
"assert",
"function",
"that",
"uses",
":",
"func",
":",
"exception_from_error_queue",
"to",
"raise",
"an",
"exception",
"wrapped",
"by",
"*",
"error",
"*",
"."
] | def make_assert(error):
"""
Create an assert function that uses :func:`exception_from_error_queue` to
raise an exception wrapped by *error*.
"""
def openssl_assert(ok):
"""
If *ok* is not True, retrieve the error from OpenSSL and raise it.
"""
if ok is not True:
... | [
"def",
"make_assert",
"(",
"error",
")",
":",
"def",
"openssl_assert",
"(",
"ok",
")",
":",
"\"\"\"\n If *ok* is not True, retrieve the error from OpenSSL and raise it.\n \"\"\"",
"if",
"ok",
"is",
"not",
"True",
":",
"exception_from_error_queue",
"(",
"error"... | https://github.com/XX-net/XX-Net/blob/a9898cfcf0084195fb7e69b6bc834e59aecdf14f/python3.8.2/Lib/OpenSSL/_util.py#L57-L69 | |
samuelclay/NewsBlur | 2c45209df01a1566ea105e04d499367f32ac9ad2 | apps/rss_feeds/management/commands/calculate_scores.py | python | daemonize | () | Detach from the terminal and continue as a daemon. | Detach from the terminal and continue as a daemon. | [
"Detach",
"from",
"the",
"terminal",
"and",
"continue",
"as",
"a",
"daemon",
"."
] | def daemonize():
"""
Detach from the terminal and continue as a daemon.
"""
# swiped from twisted/scripts/twistd.py
# See http://www.erlenstar.demon.co.uk/unix/faq_toc.html#TOC16
if os.fork(): # launch child and...
os._exit(0) # kill off parent
os.setsid()
if os.fork(): # lau... | [
"def",
"daemonize",
"(",
")",
":",
"# swiped from twisted/scripts/twistd.py",
"# See http://www.erlenstar.demon.co.uk/unix/faq_toc.html#TOC16",
"if",
"os",
".",
"fork",
"(",
")",
":",
"# launch child and...",
"os",
".",
"_exit",
"(",
"0",
")",
"# kill off parent",
"os",
... | https://github.com/samuelclay/NewsBlur/blob/2c45209df01a1566ea105e04d499367f32ac9ad2/apps/rss_feeds/management/commands/calculate_scores.py#L48-L67 | ||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/kaiterra/air_quality.py | python | KaiterraAirQuality.air_quality_index_level | (self) | return self._data("aqi_level") | Return the Air Quality Index level. | Return the Air Quality Index level. | [
"Return",
"the",
"Air",
"Quality",
"Index",
"level",
"."
] | def air_quality_index_level(self):
"""Return the Air Quality Index level."""
return self._data("aqi_level") | [
"def",
"air_quality_index_level",
"(",
"self",
")",
":",
"return",
"self",
".",
"_data",
"(",
"\"aqi_level\"",
")"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/kaiterra/air_quality.py#L74-L76 | |
jcmgray/quimb | a54b22c61534be8acbc9efe4da97fb5c7f12057d | quimb/linalg/slepc_linalg.py | python | mfn_multiply_slepc | (mat, vec,
fntype='exp',
MFNType='AUTO',
comm=None,
isherm=False) | return all_out | Compute the action of ``func(mat) @ vec``.
Parameters
----------
mat : operator
Operator to compute function action of.
vec : vector-like
Vector to compute matrix function action on.
func : {'exp', 'sqrt', 'log'}, optional
Function to use.
MFNType : {'krylov', 'expokit'}... | Compute the action of ``func(mat) @ vec``. | [
"Compute",
"the",
"action",
"of",
"func",
"(",
"mat",
")",
"@",
"vec",
"."
] | def mfn_multiply_slepc(mat, vec,
fntype='exp',
MFNType='AUTO',
comm=None,
isherm=False):
"""Compute the action of ``func(mat) @ vec``.
Parameters
----------
mat : operator
Operator to compute function ac... | [
"def",
"mfn_multiply_slepc",
"(",
"mat",
",",
"vec",
",",
"fntype",
"=",
"'exp'",
",",
"MFNType",
"=",
"'AUTO'",
",",
"comm",
"=",
"None",
",",
"isherm",
"=",
"False",
")",
":",
"SLEPc",
",",
"comm",
"=",
"get_slepc",
"(",
"comm",
"=",
"comm",
")",
... | https://github.com/jcmgray/quimb/blob/a54b22c61534be8acbc9efe4da97fb5c7f12057d/quimb/linalg/slepc_linalg.py#L687-L748 | |
beetbox/beets | 2fea53c34dd505ba391cb345424e0613901c8025 | beetsplug/bpd/__init__.py | python | Server._listall | (self, basepath, node, info=False) | Helper function for recursive listing. If info, show
tracks' complete info; otherwise, just show items' paths. | Helper function for recursive listing. If info, show
tracks' complete info; otherwise, just show items' paths. | [
"Helper",
"function",
"for",
"recursive",
"listing",
".",
"If",
"info",
"show",
"tracks",
"complete",
"info",
";",
"otherwise",
"just",
"show",
"items",
"paths",
"."
] | def _listall(self, basepath, node, info=False):
"""Helper function for recursive listing. If info, show
tracks' complete info; otherwise, just show items' paths.
"""
if isinstance(node, int):
# List a single file.
if info:
item = self.lib.get_item(... | [
"def",
"_listall",
"(",
"self",
",",
"basepath",
",",
"node",
",",
"info",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"node",
",",
"int",
")",
":",
"# List a single file.",
"if",
"info",
":",
"item",
"=",
"self",
".",
"lib",
".",
"get_item",
"(... | https://github.com/beetbox/beets/blob/2fea53c34dd505ba391cb345424e0613901c8025/beetsplug/bpd/__init__.py#L1219-L1239 | ||
StepNeverStop/RLs | 25cc97c96cbb19fe859c9387b7547cbada2c89f2 | rls/nn/layers.py | python | NoisyLinear.scale_noise | (size: int) | return x.sign().mul(x.abs().sqrt()) | Set scale to make noise (factorized gaussian noise). | Set scale to make noise (factorized gaussian noise). | [
"Set",
"scale",
"to",
"make",
"noise",
"(",
"factorized",
"gaussian",
"noise",
")",
"."
] | def scale_noise(size: int) -> th.Tensor:
"""Set scale to make noise (factorized gaussian noise)."""
x = th.randn(size)
return x.sign().mul(x.abs().sqrt()) | [
"def",
"scale_noise",
"(",
"size",
":",
"int",
")",
"->",
"th",
".",
"Tensor",
":",
"x",
"=",
"th",
".",
"randn",
"(",
"size",
")",
"return",
"x",
".",
"sign",
"(",
")",
".",
"mul",
"(",
"x",
".",
"abs",
"(",
")",
".",
"sqrt",
"(",
")",
")"... | https://github.com/StepNeverStop/RLs/blob/25cc97c96cbb19fe859c9387b7547cbada2c89f2/rls/nn/layers.py#L92-L96 | |
kuri65536/python-for-android | 26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891 | python-modules/twisted/twisted/web/resource.py | python | Resource.__init__ | (self) | Initialize. | Initialize. | [
"Initialize",
"."
] | def __init__(self):
"""Initialize.
"""
self.children = {} | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"children",
"=",
"{",
"}"
] | https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-modules/twisted/twisted/web/resource.py#L81-L84 | ||
IronLanguages/ironpython3 | 7a7bb2a872eeab0d1009fc8a6e24dca43f65b693 | Src/StdLib/Lib/tkinter/tix.py | python | Grid.info_bbox | (self, x, y) | return self.tk.call(self, 'info', 'bbox', x, y) | [] | def info_bbox(self, x, y):
# This seems to always return '', at least for 'text' displayitems
return self.tk.call(self, 'info', 'bbox', x, y) | [
"def",
"info_bbox",
"(",
"self",
",",
"x",
",",
"y",
")",
":",
"# This seems to always return '', at least for 'text' displayitems",
"return",
"self",
".",
"tk",
".",
"call",
"(",
"self",
",",
"'info'",
",",
"'bbox'",
",",
"x",
",",
"y",
")"
] | https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/tkinter/tix.py#L1849-L1851 | |||
TensorSpeech/TensorflowTTS | 34358d82a4c91fd70344872f8ea8a405ea84aedb | tensorflow_tts/utils/griffin_lim.py | python | TFGriffinLim.call | (self, mel_spec, n_iter=32) | return tf.signal.inverse_stft(
mel_to_linear * phase,
frame_length=self.ds_config["win_length"] or self.ds_config["fft_size"],
frame_step=self.ds_config["hop_size"],
fft_length=self.ds_config["fft_size"],
window_fn=tf.signal.inverse_stft_window_fn(self.ds_conf... | Apply GL algorithm to batched mel spectrograms.
Args:
mel_spec (tf.Tensor): normalized mel spectrogram.
n_iter (int): number of iterations to run GL algorithm.
Returns:
(tf.Tensor): reconstructed signal from GL algorithm. | Apply GL algorithm to batched mel spectrograms.
Args:
mel_spec (tf.Tensor): normalized mel spectrogram.
n_iter (int): number of iterations to run GL algorithm.
Returns:
(tf.Tensor): reconstructed signal from GL algorithm. | [
"Apply",
"GL",
"algorithm",
"to",
"batched",
"mel",
"spectrograms",
".",
"Args",
":",
"mel_spec",
"(",
"tf",
".",
"Tensor",
")",
":",
"normalized",
"mel",
"spectrogram",
".",
"n_iter",
"(",
"int",
")",
":",
"number",
"of",
"iterations",
"to",
"run",
"GL"... | def call(self, mel_spec, n_iter=32):
"""Apply GL algorithm to batched mel spectrograms.
Args:
mel_spec (tf.Tensor): normalized mel spectrogram.
n_iter (int): number of iterations to run GL algorithm.
Returns:
(tf.Tensor): reconstructed signal from GL algorithm... | [
"def",
"call",
"(",
"self",
",",
"mel_spec",
",",
"n_iter",
"=",
"32",
")",
":",
"# de-normalize mel spectogram",
"if",
"self",
".",
"normalized",
":",
"mel_spec",
"=",
"tf",
".",
"math",
".",
"pow",
"(",
"10.0",
",",
"mel_spec",
"*",
"self",
".",
"sca... | https://github.com/TensorSpeech/TensorflowTTS/blob/34358d82a4c91fd70344872f8ea8a405ea84aedb/tensorflow_tts/utils/griffin_lim.py#L117-L166 | |
axcore/tartube | 36dd493642923fe8b9190a41db596c30c043ae90 | tartube/mainwin.py | python | MainWin.on_progress_list_dl_last | (self, menu_item, download_item_obj) | Called from a callback in self.progress_list_popup_menu().
Moves the selected media data object to the bottom of the
downloads.DownloadList, so it is assigned to the last available worker.
Args:
menu_item (Gtk.MenuItem): The menu item that was clicked
download_item_ob... | Called from a callback in self.progress_list_popup_menu(). | [
"Called",
"from",
"a",
"callback",
"in",
"self",
".",
"progress_list_popup_menu",
"()",
"."
] | def on_progress_list_dl_last(self, menu_item, download_item_obj):
"""Called from a callback in self.progress_list_popup_menu().
Moves the selected media data object to the bottom of the
downloads.DownloadList, so it is assigned to the last available worker.
Args:
menu_ite... | [
"def",
"on_progress_list_dl_last",
"(",
"self",
",",
"menu_item",
",",
"download_item_obj",
")",
":",
"if",
"DEBUG_FUNC_FLAG",
":",
"utils",
".",
"debug_time",
"(",
"'mwn 15308 on_progress_list_dl_last'",
")",
"# Check that, since the popup menu was created, the media data obje... | https://github.com/axcore/tartube/blob/36dd493642923fe8b9190a41db596c30c043ae90/tartube/mainwin.py#L16768-L16812 | ||
llSourcell/AI_Artist | 3038c06c2e389b9c919c881c9a169efe2fd7810e | lib/python2.7/site-packages/pip/_vendor/pyparsing.py | python | ZeroOrMore.__init__ | ( self, expr, stopOn=None) | [] | def __init__( self, expr, stopOn=None):
super(ZeroOrMore,self).__init__(expr, stopOn=stopOn)
self.mayReturnEmpty = True | [
"def",
"__init__",
"(",
"self",
",",
"expr",
",",
"stopOn",
"=",
"None",
")",
":",
"super",
"(",
"ZeroOrMore",
",",
"self",
")",
".",
"__init__",
"(",
"expr",
",",
"stopOn",
"=",
"stopOn",
")",
"self",
".",
"mayReturnEmpty",
"=",
"True"
] | https://github.com/llSourcell/AI_Artist/blob/3038c06c2e389b9c919c881c9a169efe2fd7810e/lib/python2.7/site-packages/pip/_vendor/pyparsing.py#L2882-L2884 | ||||
jonathf/chaospy | f1a1ba52b87285afdb65ceaf7f8a3a27907bf25e | chaospy/quadrature/genz_keister.py | python | genz_keister | (order, dist=None, rule=24) | return nodes, weights | Create Genz-Keister quadrature nodes and weights.
Args:
order (int, Sequence[int]):
The order of the quadrature.
dist (Optional[chaospy.Distribution]):
The distribution which density will be used as weight function.
If omitted, standard Gaussian is assumed.
... | Create Genz-Keister quadrature nodes and weights. | [
"Create",
"Genz",
"-",
"Keister",
"quadrature",
"nodes",
"and",
"weights",
"."
] | def genz_keister(order, dist=None, rule=24):
"""
Create Genz-Keister quadrature nodes and weights.
Args:
order (int, Sequence[int]):
The order of the quadrature.
dist (Optional[chaospy.Distribution]):
The distribution which density will be used as weight function.
... | [
"def",
"genz_keister",
"(",
"order",
",",
"dist",
"=",
"None",
",",
"rule",
"=",
"24",
")",
":",
"shape",
"=",
"(",
"1",
",",
")",
"if",
"dist",
"is",
"None",
"else",
"(",
"len",
"(",
"dist",
")",
",",
")",
"order",
"=",
"numpy",
".",
"broadcas... | https://github.com/jonathf/chaospy/blob/f1a1ba52b87285afdb65ceaf7f8a3a27907bf25e/chaospy/quadrature/genz_keister.py#L251-L284 | |
JimmXinu/FanFicFare | bc149a2deb2636320fe50a3e374af6eef8f61889 | included_dependencies/urllib3/util/retry.py | python | _RetryMeta.DEFAULT_METHOD_WHITELIST | (cls) | return cls.DEFAULT_ALLOWED_METHODS | [] | def DEFAULT_METHOD_WHITELIST(cls):
warnings.warn(
"Using 'Retry.DEFAULT_METHOD_WHITELIST' is deprecated and "
"will be removed in v2.0. Use 'Retry.DEFAULT_ALLOWED_METHODS' instead",
DeprecationWarning,
)
return cls.DEFAULT_ALLOWED_METHODS | [
"def",
"DEFAULT_METHOD_WHITELIST",
"(",
"cls",
")",
":",
"warnings",
".",
"warn",
"(",
"\"Using 'Retry.DEFAULT_METHOD_WHITELIST' is deprecated and \"",
"\"will be removed in v2.0. Use 'Retry.DEFAULT_ALLOWED_METHODS' instead\"",
",",
"DeprecationWarning",
",",
")",
"return",
"cls",
... | https://github.com/JimmXinu/FanFicFare/blob/bc149a2deb2636320fe50a3e374af6eef8f61889/included_dependencies/urllib3/util/retry.py#L37-L43 | |||
spyder-ide/spyder | 55da47c032dfcf519600f67f8b30eab467f965e7 | spyder/plugins/editor/widgets/status.py | python | VCSStatus.process_git_data | (self, worker, output, error) | Receive data from git and update gui. | Receive data from git and update gui. | [
"Receive",
"data",
"from",
"git",
"and",
"update",
"gui",
"."
] | def process_git_data(self, worker, output, error):
"""Receive data from git and update gui."""
branches, branch, files_modified = output
text = branch if branch else ''
if len(files_modified):
text = text + ' [{}]'.format(len(files_modified))
self.setVisible(bool(bra... | [
"def",
"process_git_data",
"(",
"self",
",",
"worker",
",",
"output",
",",
"error",
")",
":",
"branches",
",",
"branch",
",",
"files_modified",
"=",
"output",
"text",
"=",
"branch",
"if",
"branch",
"else",
"''",
"if",
"len",
"(",
"files_modified",
")",
"... | https://github.com/spyder-ide/spyder/blob/55da47c032dfcf519600f67f8b30eab467f965e7/spyder/plugins/editor/widgets/status.py#L118-L130 | ||
iopsgroup/imoocc | de810eb6d4c1697b7139305925a5b0ba21225f3f | scanhosts/modules/paramiko_old/proxy.py | python | ProxyCommand.send | (self, content) | return len(content) | Write the content received from the SSH client to the standard
input of the forked command.
@param content: string to be sent to the forked command
@type content: str | Write the content received from the SSH client to the standard
input of the forked command. | [
"Write",
"the",
"content",
"received",
"from",
"the",
"SSH",
"client",
"to",
"the",
"standard",
"input",
"of",
"the",
"forked",
"command",
"."
] | def send(self, content):
"""
Write the content received from the SSH client to the standard
input of the forked command.
@param content: string to be sent to the forked command
@type content: str
"""
try:
self.process.stdin.write(content)
exce... | [
"def",
"send",
"(",
"self",
",",
"content",
")",
":",
"try",
":",
"self",
".",
"process",
".",
"stdin",
".",
"write",
"(",
"content",
")",
"except",
"IOError",
",",
"e",
":",
"# There was a problem with the child process. It probably",
"# died and we can't proceed... | https://github.com/iopsgroup/imoocc/blob/de810eb6d4c1697b7139305925a5b0ba21225f3f/scanhosts/modules/paramiko_old/proxy.py#L52-L68 | |
mongodb/pymodm | be1c7b079df4954ef7e79e46f1b4a9ac9510766c | pymodm/files.py | python | File.open | (self, mode='rb') | Open this file or seek to the beginning if already open. | Open this file or seek to the beginning if already open. | [
"Open",
"this",
"file",
"or",
"seek",
"to",
"the",
"beginning",
"if",
"already",
"open",
"."
] | def open(self, mode='rb'):
"""Open this file or seek to the beginning if already open."""
if self.closed:
self.file = open(self.file.name, mode)
else:
self.file.seek(0) | [
"def",
"open",
"(",
"self",
",",
"mode",
"=",
"'rb'",
")",
":",
"if",
"self",
".",
"closed",
":",
"self",
".",
"file",
"=",
"open",
"(",
"self",
".",
"file",
".",
"name",
",",
"mode",
")",
"else",
":",
"self",
".",
"file",
".",
"seek",
"(",
"... | https://github.com/mongodb/pymodm/blob/be1c7b079df4954ef7e79e46f1b4a9ac9510766c/pymodm/files.py#L175-L180 | ||
DxCx/plugin.video.9anime | 34358c2f701e5ddf19d3276926374a16f63f7b6a | resources/lib/ui/js2py/legecy_translators/nodevisitor.py | python | js_not | (a) | return a+'.neg()' | [] | def js_not(a):
return a+'.neg()' | [
"def",
"js_not",
"(",
"a",
")",
":",
"return",
"a",
"+",
"'.neg()'"
] | https://github.com/DxCx/plugin.video.9anime/blob/34358c2f701e5ddf19d3276926374a16f63f7b6a/resources/lib/ui/js2py/legecy_translators/nodevisitor.py#L373-L374 | |||
SCSSoftware/BlenderTools | 96f323d3bdf2d8cb8ed7f882dcdf036277a802dd | addon/io_scs_tools/properties/object.py | python | ObjectAnimationInventoryItem.anim_range_update | (self, context) | If start or end frame are changed frame range in scene should be adopted to new values
together with FPS reset. | If start or end frame are changed frame range in scene should be adopted to new values
together with FPS reset. | [
"If",
"start",
"or",
"end",
"frame",
"are",
"changed",
"frame",
"range",
"in",
"scene",
"should",
"be",
"adopted",
"to",
"new",
"values",
"together",
"with",
"FPS",
"reset",
"."
] | def anim_range_update(self, context):
"""If start or end frame are changed frame range in scene should be adopted to new values
together with FPS reset.
"""
active_object = context.active_object
if active_object and active_object.type == "ARMATURE" and active_object.animation_d... | [
"def",
"anim_range_update",
"(",
"self",
",",
"context",
")",
":",
"active_object",
"=",
"context",
".",
"active_object",
"if",
"active_object",
"and",
"active_object",
".",
"type",
"==",
"\"ARMATURE\"",
"and",
"active_object",
".",
"animation_data",
":",
"action"... | https://github.com/SCSSoftware/BlenderTools/blob/96f323d3bdf2d8cb8ed7f882dcdf036277a802dd/addon/io_scs_tools/properties/object.py#L195-L211 | ||
hellofresh/eks-rolling-update | 70306efbf8d9a6c587d8f82af60d995827122537 | eksrollup/lib/aws.py | python | get_asg_tag | (tags, tag_name) | return result | Returns a tag on a list of asg tags | Returns a tag on a list of asg tags | [
"Returns",
"a",
"tag",
"on",
"a",
"list",
"of",
"asg",
"tags"
] | def get_asg_tag(tags, tag_name):
"""
Returns a tag on a list of asg tags
"""
result = {}
for tag in tags:
for key, val in tag.items():
if val == tag_name:
result = tag
return result | [
"def",
"get_asg_tag",
"(",
"tags",
",",
"tag_name",
")",
":",
"result",
"=",
"{",
"}",
"for",
"tag",
"in",
"tags",
":",
"for",
"key",
",",
"val",
"in",
"tag",
".",
"items",
"(",
")",
":",
"if",
"val",
"==",
"tag_name",
":",
"result",
"=",
"tag",
... | https://github.com/hellofresh/eks-rolling-update/blob/70306efbf8d9a6c587d8f82af60d995827122537/eksrollup/lib/aws.py#L412-L421 | |
hzlzh/AlfredWorkflow.com | 7055f14f6922c80ea5943839eb0caff11ae57255 | Sources/Workflows/nuomituangou/alp/request/requests/packages/urllib3/packages/ordered_dict.py | python | OrderedDict.viewitems | (self) | return ItemsView(self) | od.viewitems() -> a set-like object providing a view on od's items | od.viewitems() -> a set-like object providing a view on od's items | [
"od",
".",
"viewitems",
"()",
"-",
">",
"a",
"set",
"-",
"like",
"object",
"providing",
"a",
"view",
"on",
"od",
"s",
"items"
] | def viewitems(self):
"od.viewitems() -> a set-like object providing a view on od's items"
return ItemsView(self) | [
"def",
"viewitems",
"(",
"self",
")",
":",
"return",
"ItemsView",
"(",
"self",
")"
] | https://github.com/hzlzh/AlfredWorkflow.com/blob/7055f14f6922c80ea5943839eb0caff11ae57255/Sources/Workflows/nuomituangou/alp/request/requests/packages/urllib3/packages/ordered_dict.py#L258-L260 | |
DamnWidget/anaconda | a9998fb362320f907d5ccbc6fcf5b62baca677c0 | commands/vagrant.py | python | AnacondaVagrantBase.print_status | (self, edit: sublime.Edit) | Print the vagrant command output string into a Sublime Text panel | Print the vagrant command output string into a Sublime Text panel | [
"Print",
"the",
"vagrant",
"command",
"output",
"string",
"into",
"a",
"Sublime",
"Text",
"panel"
] | def print_status(self, edit: sublime.Edit) -> None:
"""Print the vagrant command output string into a Sublime Text panel
"""
vagrant_panel = self.view.window().create_output_panel(
'anaconda_vagrant'
)
vagrant_panel.set_read_only(False)
region = sublime.Regi... | [
"def",
"print_status",
"(",
"self",
",",
"edit",
":",
"sublime",
".",
"Edit",
")",
"->",
"None",
":",
"vagrant_panel",
"=",
"self",
".",
"view",
".",
"window",
"(",
")",
".",
"create_output_panel",
"(",
"'anaconda_vagrant'",
")",
"vagrant_panel",
".",
"set... | https://github.com/DamnWidget/anaconda/blob/a9998fb362320f907d5ccbc6fcf5b62baca677c0/commands/vagrant.py#L34-L51 | ||
igraph/python-igraph | e9f83e8af08f24ea025596e745917197d8b44d94 | src/igraph/drawing/__init__.py | python | Plot.mark_dirty | (self) | Marks the plot as dirty (should be redrawn) | Marks the plot as dirty (should be redrawn) | [
"Marks",
"the",
"plot",
"as",
"dirty",
"(",
"should",
"be",
"redrawn",
")"
] | def mark_dirty(self):
"""Marks the plot as dirty (should be redrawn)"""
self._is_dirty = True | [
"def",
"mark_dirty",
"(",
"self",
")",
":",
"self",
".",
"_is_dirty",
"=",
"True"
] | https://github.com/igraph/python-igraph/blob/e9f83e8af08f24ea025596e745917197d8b44d94/src/igraph/drawing/__init__.py#L253-L255 | ||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/multiprocessing/sharedctypes.py | python | copy | (obj) | return new_obj | [] | def copy(obj):
new_obj = _new_value(type(obj))
ctypes.pointer(new_obj)[0] = obj
return new_obj | [
"def",
"copy",
"(",
"obj",
")",
":",
"new_obj",
"=",
"_new_value",
"(",
"type",
"(",
"obj",
")",
")",
"ctypes",
".",
"pointer",
"(",
"new_obj",
")",
"[",
"0",
"]",
"=",
"obj",
"return",
"new_obj"
] | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/multiprocessing/sharedctypes.py#L121-L124 | |||
stoq/stoq | c26991644d1affcf96bc2e0a0434796cabdf8448 | stoqlib/domain/payment/payment.py | python | Payment.is_cancelled | (self) | return self.status == Payment.STATUS_CANCELLED | Check if the payment was cancelled.
:returns: ``True`` if the payment was cancelled | Check if the payment was cancelled. | [
"Check",
"if",
"the",
"payment",
"was",
"cancelled",
"."
] | def is_cancelled(self):
"""Check if the payment was cancelled.
:returns: ``True`` if the payment was cancelled
"""
return self.status == Payment.STATUS_CANCELLED | [
"def",
"is_cancelled",
"(",
"self",
")",
":",
"return",
"self",
".",
"status",
"==",
"Payment",
".",
"STATUS_CANCELLED"
] | https://github.com/stoq/stoq/blob/c26991644d1affcf96bc2e0a0434796cabdf8448/stoqlib/domain/payment/payment.py#L598-L603 | |
Pymol-Scripts/Pymol-script-repo | bcd7bb7812dc6db1595953dfa4471fa15fb68c77 | modules/pdb2pqr/src/aa.py | python | Amino.addDihedralAngle | (self, value) | Add the value to the list of chiangles
Parameters
value: The value to be added (float) | Add the value to the list of chiangles | [
"Add",
"the",
"value",
"to",
"the",
"list",
"of",
"chiangles"
] | def addDihedralAngle(self, value):
"""
Add the value to the list of chiangles
Parameters
value: The value to be added (float)
"""
self.dihedrals.append(value) | [
"def",
"addDihedralAngle",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"dihedrals",
".",
"append",
"(",
"value",
")"
] | https://github.com/Pymol-Scripts/Pymol-script-repo/blob/bcd7bb7812dc6db1595953dfa4471fa15fb68c77/modules/pdb2pqr/src/aa.py#L140-L147 | ||
kuri65536/python-for-android | 26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891 | python3-alpha/python-libs/gdata/youtube/service.py | python | YouTubeService.GetFormUploadToken | (self, video_entry, uri=YOUTUBE_UPLOAD_TOKEN_URI) | return (post_url, youtube_token) | Receives a YouTube Token and a YouTube PostUrl from a YouTubeVideoEntry.
Needs authentication.
Args:
video_entry: The YouTubeVideoEntry to upload (meta-data only).
uri: An optional string representing the URI from where to fetch the
token information. Defaults to the YOUTUBE_UPLOADTOKEN_... | Receives a YouTube Token and a YouTube PostUrl from a YouTubeVideoEntry. | [
"Receives",
"a",
"YouTube",
"Token",
"and",
"a",
"YouTube",
"PostUrl",
"from",
"a",
"YouTubeVideoEntry",
"."
] | def GetFormUploadToken(self, video_entry, uri=YOUTUBE_UPLOAD_TOKEN_URI):
"""Receives a YouTube Token and a YouTube PostUrl from a YouTubeVideoEntry.
Needs authentication.
Args:
video_entry: The YouTubeVideoEntry to upload (meta-data only).
uri: An optional string representing the URI from wher... | [
"def",
"GetFormUploadToken",
"(",
"self",
",",
"video_entry",
",",
"uri",
"=",
"YOUTUBE_UPLOAD_TOKEN_URI",
")",
":",
"try",
":",
"response",
"=",
"self",
".",
"Post",
"(",
"video_entry",
",",
"uri",
")",
"except",
"gdata",
".",
"service",
".",
"RequestError"... | https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python3-alpha/python-libs/gdata/youtube/service.py#L700-L727 | |
andresriancho/w3af | cd22e5252243a87aaa6d0ddea47cf58dacfe00a9 | w3af/plugins/attack/db/sqlmap/thirdparty/beautifulsoup/beautifulsoup.py | python | ResultSet.__init__ | (self, source) | [] | def __init__(self, source):
list.__init__([])
self.source = source | [
"def",
"__init__",
"(",
"self",
",",
"source",
")",
":",
"list",
".",
"__init__",
"(",
"[",
"]",
")",
"self",
".",
"source",
"=",
"source"
] | https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/plugins/attack/db/sqlmap/thirdparty/beautifulsoup/beautifulsoup.py#L1016-L1018 | ||||
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v9/services/services/asset_service/client.py | python | AssetServiceClient.common_billing_account_path | (billing_account: str,) | return "billingAccounts/{billing_account}".format(
billing_account=billing_account,
) | Return a fully-qualified billing_account string. | Return a fully-qualified billing_account string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"billing_account",
"string",
"."
] | def common_billing_account_path(billing_account: str,) -> str:
"""Return a fully-qualified billing_account string."""
return "billingAccounts/{billing_account}".format(
billing_account=billing_account,
) | [
"def",
"common_billing_account_path",
"(",
"billing_account",
":",
"str",
",",
")",
"->",
"str",
":",
"return",
"\"billingAccounts/{billing_account}\"",
".",
"format",
"(",
"billing_account",
"=",
"billing_account",
",",
")"
] | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v9/services/services/asset_service/client.py#L212-L216 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/manifolds/section_module.py | python | SectionModule.vector_bundle | (self) | return self._vbundle | r"""
Return the overlying vector bundle on which the section module is
defined.
EXAMPLES::
sage: M = Manifold(3, 'M', structure='top')
sage: E = M.vector_bundle(2, 'E')
sage: C0 = E.section_module(); C0
Module C^0(M;E) of sections on the 3-dimens... | r"""
Return the overlying vector bundle on which the section module is
defined. | [
"r",
"Return",
"the",
"overlying",
"vector",
"bundle",
"on",
"which",
"the",
"section",
"module",
"is",
"defined",
"."
] | def vector_bundle(self):
r"""
Return the overlying vector bundle on which the section module is
defined.
EXAMPLES::
sage: M = Manifold(3, 'M', structure='top')
sage: E = M.vector_bundle(2, 'E')
sage: C0 = E.section_module(); C0
Module C^0... | [
"def",
"vector_bundle",
"(",
"self",
")",
":",
"return",
"self",
".",
"_vbundle"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/manifolds/section_module.py#L378-L397 | |
quodlibet/quodlibet | e3099c89f7aa6524380795d325cc14630031886c | quodlibet/qltk/pluginwin.py | python | PluginWindow.unfilter | (self) | Clears all filters applied to the list | Clears all filters applied to the list | [
"Clears",
"all",
"filters",
"applied",
"to",
"the",
"list"
] | def unfilter(self):
"""Clears all filters applied to the list"""
self._enabled_combo.set_active(0)
self._type_combo.set_active(0)
self._filter_entry.set_text(u"") | [
"def",
"unfilter",
"(",
"self",
")",
":",
"self",
".",
"_enabled_combo",
".",
"set_active",
"(",
"0",
")",
"self",
".",
"_type_combo",
".",
"set_active",
"(",
"0",
")",
"self",
".",
"_filter_entry",
".",
"set_text",
"(",
"u\"\"",
")"
] | https://github.com/quodlibet/quodlibet/blob/e3099c89f7aa6524380795d325cc14630031886c/quodlibet/qltk/pluginwin.py#L519-L524 | ||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/tradfri/__init__.py | python | async_setup | (hass: HomeAssistant, config: ConfigType) | return True | Set up the Tradfri component. | Set up the Tradfri component. | [
"Set",
"up",
"the",
"Tradfri",
"component",
"."
] | async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the Tradfri component."""
if (conf := config.get(DOMAIN)) is None:
return True
configured_hosts = [
entry.data.get("host") for entry in hass.config_entries.async_entries(DOMAIN)
]
host = conf.get(CONF... | [
"async",
"def",
"async_setup",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
")",
"->",
"bool",
":",
"if",
"(",
"conf",
":=",
"config",
".",
"get",
"(",
"DOMAIN",
")",
")",
"is",
"None",
":",
"return",
"True",
"configured_hosts",
... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/tradfri/__init__.py#L61-L84 | |
prody/ProDy | b24bbf58aa8fffe463c8548ae50e3955910e5b7f | prody/ensemble/conformation.py | python | Conformation.numAtoms | (self) | return self._ensemble.numAtoms() | Returns number of atoms. | Returns number of atoms. | [
"Returns",
"number",
"of",
"atoms",
"."
] | def numAtoms(self):
"""Returns number of atoms."""
return self._ensemble.numAtoms() | [
"def",
"numAtoms",
"(",
"self",
")",
":",
"return",
"self",
".",
"_ensemble",
".",
"numAtoms",
"(",
")"
] | https://github.com/prody/ProDy/blob/b24bbf58aa8fffe463c8548ae50e3955910e5b7f/prody/ensemble/conformation.py#L35-L38 | |
awslabs/autogluon | 7309118f2ab1c9519f25acf61a283a95af95842b | core/src/autogluon/core/utils/utils.py | python | get_gpu_count_mxnet | () | return num_gpus | [] | def get_gpu_count_mxnet():
try:
import mxnet
num_gpus = mxnet.context.num_gpus()
except Exception:
num_gpus = 0
return num_gpus | [
"def",
"get_gpu_count_mxnet",
"(",
")",
":",
"try",
":",
"import",
"mxnet",
"num_gpus",
"=",
"mxnet",
".",
"context",
".",
"num_gpus",
"(",
")",
"except",
"Exception",
":",
"num_gpus",
"=",
"0",
"return",
"num_gpus"
] | https://github.com/awslabs/autogluon/blob/7309118f2ab1c9519f25acf61a283a95af95842b/core/src/autogluon/core/utils/utils.py#L54-L60 | |||
ninja-ide/ninja-ide | 87d91131bd19fdc3dcfd91eb97ad1e41c49c60c0 | ninja_ide/dependencies/pycodestyle.py | python | read_config | (options, args, arglist, parser) | return options | Read and parse configurations.
If a config file is specified on the command line with the "--config"
option, then only it is used for configuration.
Otherwise, the user configuration (~/.config/pycodestyle) and any local
configurations in the current directory or above will be merged together
(in ... | Read and parse configurations. | [
"Read",
"and",
"parse",
"configurations",
"."
] | def read_config(options, args, arglist, parser):
"""Read and parse configurations.
If a config file is specified on the command line with the "--config"
option, then only it is used for configuration.
Otherwise, the user configuration (~/.config/pycodestyle) and any local
configurations in the cur... | [
"def",
"read_config",
"(",
"options",
",",
"args",
",",
"arglist",
",",
"parser",
")",
":",
"config",
"=",
"RawConfigParser",
"(",
")",
"cli_conf",
"=",
"options",
".",
"config",
"local_dir",
"=",
"os",
".",
"curdir",
"if",
"USER_CONFIG",
"and",
"os",
".... | https://github.com/ninja-ide/ninja-ide/blob/87d91131bd19fdc3dcfd91eb97ad1e41c49c60c0/ninja_ide/dependencies/pycodestyle.py#L2148-L2220 | |
nlloyd/SubliminalCollaborator | 5c619e17ddbe8acb9eea8996ec038169ddcd50a1 | libs/zope/interface/interfaces.py | python | IInterfaceDeclaration.classImplements | (class_, *interfaces) | Declare additional interfaces implemented for instances of a class
The arguments after the class are one or more interfaces or
interface specifications (IDeclaration objects).
The interfaces given (including the interfaces in the
specifications) are added to any interfaces previously
... | Declare additional interfaces implemented for instances of a class | [
"Declare",
"additional",
"interfaces",
"implemented",
"for",
"instances",
"of",
"a",
"class"
] | def classImplements(class_, *interfaces):
"""Declare additional interfaces implemented for instances of a class
The arguments after the class are one or more interfaces or
interface specifications (IDeclaration objects).
The interfaces given (including the interfaces in the
spe... | [
"def",
"classImplements",
"(",
"class_",
",",
"*",
"interfaces",
")",
":"
] | https://github.com/nlloyd/SubliminalCollaborator/blob/5c619e17ddbe8acb9eea8996ec038169ddcd50a1/libs/zope/interface/interfaces.py#L401-L421 | ||
out0fmemory/GoAgent-Always-Available | c4254984fea633ce3d1893fe5901debd9f22c2a9 | server/lib/google/appengine/datastore/datastore_query.py | python | Batch.skipped_results | (self) | return self._skipped_results | The number of results skipped because of an offset in the request.
An offset is satisfied before any results are returned. The start_cursor
points to the position in the query before the skipped results. | The number of results skipped because of an offset in the request. | [
"The",
"number",
"of",
"results",
"skipped",
"because",
"of",
"an",
"offset",
"in",
"the",
"request",
"."
] | def skipped_results(self):
"""The number of results skipped because of an offset in the request.
An offset is satisfied before any results are returned. The start_cursor
points to the position in the query before the skipped results.
"""
return self._skipped_results | [
"def",
"skipped_results",
"(",
"self",
")",
":",
"return",
"self",
".",
"_skipped_results"
] | https://github.com/out0fmemory/GoAgent-Always-Available/blob/c4254984fea633ce3d1893fe5901debd9f22c2a9/server/lib/google/appengine/datastore/datastore_query.py#L2663-L2669 | |
SCSSoftware/BlenderTools | 96f323d3bdf2d8cb8ed7f882dcdf036277a802dd | addon/io_scs_tools/internals/shaders/eut2/dif_anim/anim_blend_factor_ng.py | python | __create_node_group__ | () | Creates add env group.
Inputs: Fresnel Scale, Fresnel Bias, Normal Vector, View Vector, Apply Fresnel,
Reflection Texture Color, Base Texture Alpha, Env Factor Color and Specular Color
Outputs: Environment Addition Color | Creates add env group. | [
"Creates",
"add",
"env",
"group",
"."
] | def __create_node_group__():
"""Creates add env group.
Inputs: Fresnel Scale, Fresnel Bias, Normal Vector, View Vector, Apply Fresnel,
Reflection Texture Color, Base Texture Alpha, Env Factor Color and Specular Color
Outputs: Environment Addition Color
"""
start_pos_x = 0
start_pos_y = 0
... | [
"def",
"__create_node_group__",
"(",
")",
":",
"start_pos_x",
"=",
"0",
"start_pos_y",
"=",
"0",
"pos_x_shift",
"=",
"185",
"blend_fac_g",
"=",
"bpy",
".",
"data",
".",
"node_groups",
".",
"new",
"(",
"type",
"=",
"\"ShaderNodeTree\"",
",",
"name",
"=",
"B... | https://github.com/SCSSoftware/BlenderTools/blob/96f323d3bdf2d8cb8ed7f882dcdf036277a802dd/addon/io_scs_tools/internals/shaders/eut2/dif_anim/anim_blend_factor_ng.py#L56-L141 | ||
jakewaldron/PlexEmail | 8e560407a87f58e02d1f1e8048dacb9be6e35c03 | scripts/cloudinary/poster/encode.py | python | multipart_yielder.next | (self) | return advance_iterator(self) | generator function to yield multipart/form-data representation
of parameters | generator function to yield multipart/form-data representation
of parameters | [
"generator",
"function",
"to",
"yield",
"multipart",
"/",
"form",
"-",
"data",
"representation",
"of",
"parameters"
] | def next(self):
"""generator function to yield multipart/form-data representation
of parameters"""
if self.param_iter is not None:
try:
block = advance_iterator(self.param_iter)
self.current += len(block)
if self.cb:
... | [
"def",
"next",
"(",
"self",
")",
":",
"if",
"self",
".",
"param_iter",
"is",
"not",
"None",
":",
"try",
":",
"block",
"=",
"advance_iterator",
"(",
"self",
".",
"param_iter",
")",
"self",
".",
"current",
"+=",
"len",
"(",
"block",
")",
"if",
"self",
... | https://github.com/jakewaldron/PlexEmail/blob/8e560407a87f58e02d1f1e8048dacb9be6e35c03/scripts/cloudinary/poster/encode.py#L356-L385 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/smtpd.py | python | SMTPChannel.__init__ | (self, server, conn, addr) | [] | def __init__(self, server, conn, addr):
asynchat.async_chat.__init__(self, conn)
self.__server = server
self.__conn = conn
self.__addr = addr
self.__line = []
self.__state = self.COMMAND
self.__greeting = 0
self.__mailfrom = None
self.__rcpttos = [... | [
"def",
"__init__",
"(",
"self",
",",
"server",
",",
"conn",
",",
"addr",
")",
":",
"asynchat",
".",
"async_chat",
".",
"__init__",
"(",
"self",
",",
"conn",
")",
"self",
".",
"__server",
"=",
"server",
"self",
".",
"__conn",
"=",
"conn",
"self",
".",... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/smtpd.py#L109-L132 | ||||
ifwe/digsby | f5fe00244744aa131e07f09348d10563f3d8fa99 | digsby/src/common/Buddy.py | python | Buddy.buddy_icon | (self) | return get_buddy_icon(self, 32, False) | Returns a 32 pixel version of this buddy's icon (or the generic
replacement icon for buddies without icons). | Returns a 32 pixel version of this buddy's icon (or the generic
replacement icon for buddies without icons). | [
"Returns",
"a",
"32",
"pixel",
"version",
"of",
"this",
"buddy",
"s",
"icon",
"(",
"or",
"the",
"generic",
"replacement",
"icon",
"for",
"buddies",
"without",
"icons",
")",
"."
] | def buddy_icon(self):
'''
Returns a 32 pixel version of this buddy's icon (or the generic
replacement icon for buddies without icons).
'''
from gui.buddylist.renderers import get_buddy_icon
return get_buddy_icon(self, 32, False) | [
"def",
"buddy_icon",
"(",
"self",
")",
":",
"from",
"gui",
".",
"buddylist",
".",
"renderers",
"import",
"get_buddy_icon",
"return",
"get_buddy_icon",
"(",
"self",
",",
"32",
",",
"False",
")"
] | https://github.com/ifwe/digsby/blob/f5fe00244744aa131e07f09348d10563f3d8fa99/digsby/src/common/Buddy.py#L631-L638 | |
sympy/sympy | d822fcba181155b85ff2b29fe525adbafb22b448 | sympy/assumptions/refine.py | python | refine_re | (expr, assumptions) | return _refine_reim(expr, assumptions) | Handler for real part.
Examples
========
>>> from sympy.assumptions.refine import refine_re
>>> from sympy import Q, re
>>> from sympy.abc import x
>>> refine_re(re(x), Q.real(x))
x
>>> refine_re(re(x), Q.imaginary(x))
0 | Handler for real part. | [
"Handler",
"for",
"real",
"part",
"."
] | def refine_re(expr, assumptions):
"""
Handler for real part.
Examples
========
>>> from sympy.assumptions.refine import refine_re
>>> from sympy import Q, re
>>> from sympy.abc import x
>>> refine_re(re(x), Q.real(x))
x
>>> refine_re(re(x), Q.imaginary(x))
0
"""
arg... | [
"def",
"refine_re",
"(",
"expr",
",",
"assumptions",
")",
":",
"arg",
"=",
"expr",
".",
"args",
"[",
"0",
"]",
"if",
"ask",
"(",
"Q",
".",
"real",
"(",
"arg",
")",
",",
"assumptions",
")",
":",
"return",
"arg",
"if",
"ask",
"(",
"Q",
".",
"imag... | https://github.com/sympy/sympy/blob/d822fcba181155b85ff2b29fe525adbafb22b448/sympy/assumptions/refine.py#L253-L273 | |
idanr1986/cuckoo-droid | 1350274639473d3d2b0ac740cae133ca53ab7444 | analyzer/android/lib/api/androguard/dvm.py | python | AnnotationsDirectoryItem.get_class_annotations_off | (self) | return self.class_annotations_off | Return the offset from the start of the file to the annotations made directly on the class,
or 0 if the class has no direct annotations
:rtype: int | Return the offset from the start of the file to the annotations made directly on the class,
or 0 if the class has no direct annotations | [
"Return",
"the",
"offset",
"from",
"the",
"start",
"of",
"the",
"file",
"to",
"the",
"annotations",
"made",
"directly",
"on",
"the",
"class",
"or",
"0",
"if",
"the",
"class",
"has",
"no",
"direct",
"annotations"
] | def get_class_annotations_off(self) :
"""
Return the offset from the start of the file to the annotations made directly on the class,
or 0 if the class has no direct annotations
:rtype: int
"""
return self.class_annotations_off | [
"def",
"get_class_annotations_off",
"(",
"self",
")",
":",
"return",
"self",
".",
"class_annotations_off"
] | https://github.com/idanr1986/cuckoo-droid/blob/1350274639473d3d2b0ac740cae133ca53ab7444/analyzer/android/lib/api/androguard/dvm.py#L898-L905 | |
pbugnion/gmaps | 9f37193e6daf6b7020481d15f7461a76cb3fc14e | gmaps/directions.py | python | directions_layer | (
start, end, waypoints=None, avoid_ferries=False,
travel_mode=DEFAULT_TRAVEL_MODE,
avoid_highways=False, avoid_tolls=False, optimize_waypoints=False,
show_markers=True, show_route=True, stroke_color=DEFAULT_STROKE_COLOR,
stroke_weight=6.0, stroke_opacity=0.6) | return Directions(**kwargs) | Create a directions layer.
Add this layer to a :class:`gmaps.Figure` instance to draw
directions on the map.
:Examples:
{examples}
{params}
:returns:
A :class:`gmaps.Directions` widget. | Create a directions layer. | [
"Create",
"a",
"directions",
"layer",
"."
] | def directions_layer(
start, end, waypoints=None, avoid_ferries=False,
travel_mode=DEFAULT_TRAVEL_MODE,
avoid_highways=False, avoid_tolls=False, optimize_waypoints=False,
show_markers=True, show_route=True, stroke_color=DEFAULT_STROKE_COLOR,
stroke_weight=6.0, stroke_opacity=0.6)... | [
"def",
"directions_layer",
"(",
"start",
",",
"end",
",",
"waypoints",
"=",
"None",
",",
"avoid_ferries",
"=",
"False",
",",
"travel_mode",
"=",
"DEFAULT_TRAVEL_MODE",
",",
"avoid_highways",
"=",
"False",
",",
"avoid_tolls",
"=",
"False",
",",
"optimize_waypoint... | https://github.com/pbugnion/gmaps/blob/9f37193e6daf6b7020481d15f7461a76cb3fc14e/gmaps/directions.py#L246-L282 | |
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/cvm/v20170312/models.py | python | EnhancedService.__init__ | (self) | r"""
:param SecurityService: 开启云安全服务。若不指定该参数,则默认开启云安全服务。
:type SecurityService: :class:`tencentcloud.cvm.v20170312.models.RunSecurityServiceEnabled`
:param MonitorService: 开启云监控服务。若不指定该参数,则默认开启云监控服务。
:type MonitorService: :class:`tencentcloud.cvm.v20170312.models.RunMonitorServiceEnabled... | r"""
:param SecurityService: 开启云安全服务。若不指定该参数,则默认开启云安全服务。
:type SecurityService: :class:`tencentcloud.cvm.v20170312.models.RunSecurityServiceEnabled`
:param MonitorService: 开启云监控服务。若不指定该参数,则默认开启云监控服务。
:type MonitorService: :class:`tencentcloud.cvm.v20170312.models.RunMonitorServiceEnabled... | [
"r",
":",
"param",
"SecurityService",
":",
"开启云安全服务。若不指定该参数,则默认开启云安全服务。",
":",
"type",
"SecurityService",
":",
":",
"class",
":",
"tencentcloud",
".",
"cvm",
".",
"v20170312",
".",
"models",
".",
"RunSecurityServiceEnabled",
":",
"param",
"MonitorService",
":",
"开... | def __init__(self):
r"""
:param SecurityService: 开启云安全服务。若不指定该参数,则默认开启云安全服务。
:type SecurityService: :class:`tencentcloud.cvm.v20170312.models.RunSecurityServiceEnabled`
:param MonitorService: 开启云监控服务。若不指定该参数,则默认开启云监控服务。
:type MonitorService: :class:`tencentcloud.cvm.v20170312.mod... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"SecurityService",
"=",
"None",
"self",
".",
"MonitorService",
"=",
"None",
"self",
".",
"AutomationService",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/cvm/v20170312/models.py#L2947-L2958 | ||
StackStorm/st2 | 85ae05b73af422efd3097c9c05351f7f1cc8369e | st2common/st2common/content/utils.py | python | get_pack_resource_file_abs_path | (pack_ref, resource_type, file_path) | return result | Retrieve full absolute path to the pack resource file.
Note: This function also takes care of sanitizing ``file_name`` argument
preventing directory traversal and similar attacks.
:param pack_ref: Pack reference (needs to be the same as directory on disk).
:type pack_ref: ``str``
:param res... | Retrieve full absolute path to the pack resource file. | [
"Retrieve",
"full",
"absolute",
"path",
"to",
"the",
"pack",
"resource",
"file",
"."
] | def get_pack_resource_file_abs_path(pack_ref, resource_type, file_path):
"""
Retrieve full absolute path to the pack resource file.
Note: This function also takes care of sanitizing ``file_name`` argument
preventing directory traversal and similar attacks.
:param pack_ref: Pack reference (ne... | [
"def",
"get_pack_resource_file_abs_path",
"(",
"pack_ref",
",",
"resource_type",
",",
"file_path",
")",
":",
"path_components",
"=",
"[",
"]",
"if",
"resource_type",
"==",
"\"action\"",
":",
"path_components",
".",
"append",
"(",
"\"actions/\"",
")",
"elif",
"reso... | https://github.com/StackStorm/st2/blob/85ae05b73af422efd3097c9c05351f7f1cc8369e/st2common/st2common/content/utils.py#L318-L352 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.