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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
pochih/RL-Chatbot | 9f2cbdcb2aacd888279c719415d7e5611465e9b0 | python/model.py | python | Seq2Seq_chatbot.build_generator | (self) | return word_vectors, generated_words, probs, embeds | [] | def build_generator(self):
word_vectors = tf.placeholder(tf.float32, [1, self.n_encode_lstm_step, self.dim_wordvec])
word_vectors_flat = tf.reshape(word_vectors, [-1, self.dim_wordvec])
wordvec_emb = tf.nn.xw_plus_b(word_vectors_flat, self.encode_vector_W, self.encode_vector_b)
wordvec_... | [
"def",
"build_generator",
"(",
"self",
")",
":",
"word_vectors",
"=",
"tf",
".",
"placeholder",
"(",
"tf",
".",
"float32",
",",
"[",
"1",
",",
"self",
".",
"n_encode_lstm_step",
",",
"self",
".",
"dim_wordvec",
"]",
")",
"word_vectors_flat",
"=",
"tf",
"... | https://github.com/pochih/RL-Chatbot/blob/9f2cbdcb2aacd888279c719415d7e5611465e9b0/python/model.py#L97-L147 | |||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/amqp/channel.py | python | Channel.basic_reject | (self, delivery_tag, requeue, argsig='Lb') | return self.send_method(
spec.Basic.Reject, argsig, (delivery_tag, requeue),
) | Reject an incoming message.
This method allows a client to reject a message. It can be
used to interrupt and cancel large incoming messages, or
return untreatable messages to their original queue.
RULE:
The server SHOULD be capable of accepting and process the
... | Reject an incoming message. | [
"Reject",
"an",
"incoming",
"message",
"."
] | def basic_reject(self, delivery_tag, requeue, argsig='Lb'):
"""Reject an incoming message.
This method allows a client to reject a message. It can be
used to interrupt and cancel large incoming messages, or
return untreatable messages to their original queue.
RULE:
... | [
"def",
"basic_reject",
"(",
"self",
",",
"delivery_tag",
",",
"requeue",
",",
"argsig",
"=",
"'Lb'",
")",
":",
"return",
"self",
".",
"send_method",
"(",
"spec",
".",
"Basic",
".",
"Reject",
",",
"argsig",
",",
"(",
"delivery_tag",
",",
"requeue",
")",
... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/amqp/channel.py#L1865-L1936 | |
abr/abr_control | a248ec56166f01791857a766ac58ee0920c0861c | abr_control/interfaces/coppeliasim_files/sim.py | python | simxLoadModel | (clientID, modelPathAndName, options, operationMode) | return (
c_LoadModel(
clientID, modelPathAndName, options, ct.byref(baseHandle), operationMode
),
baseHandle.value,
) | Please have a look at the function description/documentation in the CoppeliaSim user manual | Please have a look at the function description/documentation in the CoppeliaSim user manual | [
"Please",
"have",
"a",
"look",
"at",
"the",
"function",
"description",
"/",
"documentation",
"in",
"the",
"CoppeliaSim",
"user",
"manual"
] | def simxLoadModel(clientID, modelPathAndName, options, operationMode):
"""
Please have a look at the function description/documentation in the CoppeliaSim user manual
"""
baseHandle = ct.c_int()
if (sys.version_info[0] == 3) and (type(modelPathAndName) is str):
modelPathAndName = modelPathAn... | [
"def",
"simxLoadModel",
"(",
"clientID",
",",
"modelPathAndName",
",",
"options",
",",
"operationMode",
")",
":",
"baseHandle",
"=",
"ct",
".",
"c_int",
"(",
")",
"if",
"(",
"sys",
".",
"version_info",
"[",
"0",
"]",
"==",
"3",
")",
"and",
"(",
"type",... | https://github.com/abr/abr_control/blob/a248ec56166f01791857a766ac58ee0920c0861c/abr_control/interfaces/coppeliasim_files/sim.py#L822-L834 | |
llllllllll/codetransformer | c5f551e915df45adc7da7e0b1b635f0cc6a1bb27 | codetransformer/decompiler/__init__.py | python | paramnames | (co) | return args, kwonlyargs, varargs, varkwargs | Get the parameter names from a pycode object.
Returns a 4-tuple of (args, kwonlyargs, varargs, varkwargs).
varargs and varkwargs will be None if the function doesn't take *args or
**kwargs, respectively. | Get the parameter names from a pycode object. | [
"Get",
"the",
"parameter",
"names",
"from",
"a",
"pycode",
"object",
"."
] | def paramnames(co):
"""
Get the parameter names from a pycode object.
Returns a 4-tuple of (args, kwonlyargs, varargs, varkwargs).
varargs and varkwargs will be None if the function doesn't take *args or
**kwargs, respectively.
"""
flags = co.co_flags
varnames = co.co_varnames
argc... | [
"def",
"paramnames",
"(",
"co",
")",
":",
"flags",
"=",
"co",
".",
"co_flags",
"varnames",
"=",
"co",
".",
"co_varnames",
"argcount",
",",
"kwonlyargcount",
"=",
"co",
".",
"co_argcount",
",",
"co",
".",
"co_kwonlyargcount",
"total",
"=",
"argcount",
"+",
... | https://github.com/llllllllll/codetransformer/blob/c5f551e915df45adc7da7e0b1b635f0cc6a1bb27/codetransformer/decompiler/__init__.py#L6-L29 | |
caiiiac/Machine-Learning-with-Python | 1a26c4467da41ca4ebc3d5bd789ea942ef79422f | MachineLearning/venv/lib/python3.5/site-packages/pip/_vendor/distlib/database.py | python | DependencyGraph.to_dot | (self, f, skip_disconnected=True) | Writes a DOT output for the graph to the provided file *f*.
If *skip_disconnected* is set to ``True``, then all distributions
that are not dependent on any other distribution are skipped.
:type f: has to support ``file``-like operations
:type skip_disconnected: ``bool`` | Writes a DOT output for the graph to the provided file *f*. | [
"Writes",
"a",
"DOT",
"output",
"for",
"the",
"graph",
"to",
"the",
"provided",
"file",
"*",
"f",
"*",
"."
] | def to_dot(self, f, skip_disconnected=True):
"""Writes a DOT output for the graph to the provided file *f*.
If *skip_disconnected* is set to ``True``, then all distributions
that are not dependent on any other distribution are skipped.
:type f: has to support ``file``-like operations
... | [
"def",
"to_dot",
"(",
"self",
",",
"f",
",",
"skip_disconnected",
"=",
"True",
")",
":",
"disconnected",
"=",
"[",
"]",
"f",
".",
"write",
"(",
"\"digraph dependencies {\\n\"",
")",
"for",
"dist",
",",
"adjs",
"in",
"self",
".",
"adjacency_list",
".",
"i... | https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/pip/_vendor/distlib/database.py#L1127-L1157 | ||
Chaffelson/nipyapi | d3b186fd701ce308c2812746d98af9120955e810 | nipyapi/nifi/apis/provenance_api.py | python | ProvenanceApi.delete_lineage | (self, id, **kwargs) | Deletes a lineage query
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
... | Deletes a lineage query | [
"Deletes",
"a",
"lineage",
"query"
] | def delete_lineage(self, id, **kwargs):
"""
Deletes a lineage query
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(res... | [
"def",
"delete_lineage",
"(",
"self",
",",
"id",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'_return_http_data_only'",
"]",
"=",
"True",
"if",
"kwargs",
".",
"get",
"(",
"'callback'",
")",
":",
"return",
"self",
".",
"delete_lineage_with_http_info",
... | https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/apis/provenance_api.py#L43-L68 | ||
tomplus/kubernetes_asyncio | f028cc793e3a2c519be6a52a49fb77ff0b014c9b | kubernetes_asyncio/client/models/v1beta1_subject_access_review.py | python | V1beta1SubjectAccessReview.spec | (self, spec) | Sets the spec of this V1beta1SubjectAccessReview.
:param spec: The spec of this V1beta1SubjectAccessReview. # noqa: E501
:type: V1beta1SubjectAccessReviewSpec | Sets the spec of this V1beta1SubjectAccessReview. | [
"Sets",
"the",
"spec",
"of",
"this",
"V1beta1SubjectAccessReview",
"."
] | def spec(self, spec):
"""Sets the spec of this V1beta1SubjectAccessReview.
:param spec: The spec of this V1beta1SubjectAccessReview. # noqa: E501
:type: V1beta1SubjectAccessReviewSpec
"""
if self.local_vars_configuration.client_side_validation and spec is None: # noqa: E501
... | [
"def",
"spec",
"(",
"self",
",",
"spec",
")",
":",
"if",
"self",
".",
"local_vars_configuration",
".",
"client_side_validation",
"and",
"spec",
"is",
"None",
":",
"# noqa: E501",
"raise",
"ValueError",
"(",
"\"Invalid value for `spec`, must not be `None`\"",
")",
"#... | https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1beta1_subject_access_review.py#L152-L162 | ||
loliverhennigh/Phy-Net | 8f7a610d6ed36f734dad7d2d0c9d0ffa2a29aaf1 | model/optimizer.py | python | adam_updates | (params, cost_or_grads, lr=0.001, mom1=0.9, mom2=0.999) | return tf.group(*updates) | Adam optimizer | Adam optimizer | [
"Adam",
"optimizer"
] | def adam_updates(params, cost_or_grads, lr=0.001, mom1=0.9, mom2=0.999):
''' Adam optimizer '''
updates = []
if type(cost_or_grads) is not list:
grads = tf.gradients(cost_or_grads, params)
else:
grads = cost_or_grads
t = tf.Variable(1., 'adam_t')
for p, g in zip(params, grads):
... | [
"def",
"adam_updates",
"(",
"params",
",",
"cost_or_grads",
",",
"lr",
"=",
"0.001",
",",
"mom1",
"=",
"0.9",
",",
"mom2",
"=",
"0.999",
")",
":",
"updates",
"=",
"[",
"]",
"if",
"type",
"(",
"cost_or_grads",
")",
"is",
"not",
"list",
":",
"grads",
... | https://github.com/loliverhennigh/Phy-Net/blob/8f7a610d6ed36f734dad7d2d0c9d0ffa2a29aaf1/model/optimizer.py#L12-L36 | |
PySimpleGUI/PySimpleGUI | 6c0d1fb54f493d45e90180b322fbbe70f7a5af3c | PySimpleGUI.py | python | UserSettings.delete_entry | (self, key, section=None) | Deletes an individual entry. If no filename has been specified up to this point,
then a default filename will be used.
After value has been deleted, the settings file is written to disk.
:param key: Setting to be deleted. Can be any valid dictionary key type (i.e. must be hashable)
:ty... | Deletes an individual entry. If no filename has been specified up to this point,
then a default filename will be used.
After value has been deleted, the settings file is written to disk. | [
"Deletes",
"an",
"individual",
"entry",
".",
"If",
"no",
"filename",
"has",
"been",
"specified",
"up",
"to",
"this",
"point",
"then",
"a",
"default",
"filename",
"will",
"be",
"used",
".",
"After",
"value",
"has",
"been",
"deleted",
"the",
"settings",
"fil... | def delete_entry(self, key, section=None):
"""
Deletes an individual entry. If no filename has been specified up to this point,
then a default filename will be used.
After value has been deleted, the settings file is written to disk.
:param key: Setting to be deleted. Can be an... | [
"def",
"delete_entry",
"(",
"self",
",",
"key",
",",
"section",
"=",
"None",
")",
":",
"if",
"self",
".",
"full_filename",
"is",
"None",
":",
"self",
".",
"set_location",
"(",
")",
"self",
".",
"read",
"(",
")",
"if",
"not",
"self",
".",
"use_config_... | https://github.com/PySimpleGUI/PySimpleGUI/blob/6c0d1fb54f493d45e90180b322fbbe70f7a5af3c/PySimpleGUI.py#L20377-L20403 | ||
FORTH-ICS-INSPIRE/artemis | f0774af8abc25ef5c6b307960c048ff7528d8a9c | backend-services/detection/core/detection.py | python | ConfigHandler.post | (self) | Configures notifier and responds with a success message.
:return: {"success": True | False, "message": < message >} | Configures notifier and responds with a success message.
:return: {"success": True | False, "message": < message >} | [
"Configures",
"notifier",
"and",
"responds",
"with",
"a",
"success",
"message",
".",
":",
"return",
":",
"{",
"success",
":",
"True",
"|",
"False",
"message",
":",
"<",
"message",
">",
"}"
] | def post(self):
"""
Configures notifier and responds with a success message.
:return: {"success": True | False, "message": < message >}
"""
# request ongoing hijack updates for new config
with Connection(RABBITMQ_URI) as connection:
hijack_exchange = create_ex... | [
"def",
"post",
"(",
"self",
")",
":",
"# request ongoing hijack updates for new config",
"with",
"Connection",
"(",
"RABBITMQ_URI",
")",
"as",
"connection",
":",
"hijack_exchange",
"=",
"create_exchange",
"(",
"\"hijack-update\"",
",",
"connection",
",",
"declare",
"=... | https://github.com/FORTH-ICS-INSPIRE/artemis/blob/f0774af8abc25ef5c6b307960c048ff7528d8a9c/backend-services/detection/core/detection.py#L92-L108 | ||
brian-team/brian2 | c212a57cb992b766786b5769ebb830ff12d8a8ad | brian2/_version.py | python | render_git_describe | (pieces) | return rendered | TAG[-DISTANCE-gHEX][-dirty].
Like 'git describe --tags --dirty --always'.
Exceptions:
1: no tags. HEX[-dirty] (note: no 'g' prefix) | TAG[-DISTANCE-gHEX][-dirty]. | [
"TAG",
"[",
"-",
"DISTANCE",
"-",
"gHEX",
"]",
"[",
"-",
"dirty",
"]",
"."
] | def render_git_describe(pieces):
"""TAG[-DISTANCE-gHEX][-dirty].
Like 'git describe --tags --dirty --always'.
Exceptions:
1: no tags. HEX[-dirty] (note: no 'g' prefix)
"""
if pieces["closest-tag"]:
rendered = pieces["closest-tag"]
if pieces["distance"]:
rendered +=... | [
"def",
"render_git_describe",
"(",
"pieces",
")",
":",
"if",
"pieces",
"[",
"\"closest-tag\"",
"]",
":",
"rendered",
"=",
"pieces",
"[",
"\"closest-tag\"",
"]",
"if",
"pieces",
"[",
"\"distance\"",
"]",
":",
"rendered",
"+=",
"\"-%d-g%s\"",
"%",
"(",
"pieces... | https://github.com/brian-team/brian2/blob/c212a57cb992b766786b5769ebb830ff12d8a8ad/brian2/_version.py#L414-L431 | |
Qiskit/qiskit-terra | b66030e3b9192efdd3eb95cf25c6545fe0a13da4 | qiskit/circuit/controlflow/if_else.py | python | _partition_registers | (
registers: Iterable[Register],
) | return qregs, cregs | Partition a sequence of registers into its quantum and classical registers. | Partition a sequence of registers into its quantum and classical registers. | [
"Partition",
"a",
"sequence",
"of",
"registers",
"into",
"its",
"quantum",
"and",
"classical",
"registers",
"."
] | def _partition_registers(
registers: Iterable[Register],
) -> Tuple[Set[QuantumRegister], Set[ClassicalRegister]]:
"""Partition a sequence of registers into its quantum and classical registers."""
qregs = set()
cregs = set()
for register in registers:
if isinstance(register, QuantumRegister)... | [
"def",
"_partition_registers",
"(",
"registers",
":",
"Iterable",
"[",
"Register",
"]",
",",
")",
"->",
"Tuple",
"[",
"Set",
"[",
"QuantumRegister",
"]",
",",
"Set",
"[",
"ClassicalRegister",
"]",
"]",
":",
"qregs",
"=",
"set",
"(",
")",
"cregs",
"=",
... | https://github.com/Qiskit/qiskit-terra/blob/b66030e3b9192efdd3eb95cf25c6545fe0a13da4/qiskit/circuit/controlflow/if_else.py#L491-L505 | |
debian-calibre/calibre | 020fc81d3936a64b2ac51459ecb796666ab6a051 | src/calibre/devices/interface.py | python | DevicePlugin.set_user_blacklisted_devices | (self, devices) | Set the list of device uids that should be ignored by this driver. | Set the list of device uids that should be ignored by this driver. | [
"Set",
"the",
"list",
"of",
"device",
"uids",
"that",
"should",
"be",
"ignored",
"by",
"this",
"driver",
"."
] | def set_user_blacklisted_devices(self, devices):
'''
Set the list of device uids that should be ignored by this driver.
'''
pass | [
"def",
"set_user_blacklisted_devices",
"(",
"self",
",",
"devices",
")",
":",
"pass"
] | https://github.com/debian-calibre/calibre/blob/020fc81d3936a64b2ac51459ecb796666ab6a051/src/calibre/devices/interface.py#L579-L583 | ||
harpribot/deep-summarization | 9b3bb1daae11a1db2386dbe4a71848714e6127f8 | models/gru_bidirectional.py | python | GruBidirectional.get_cell | (self) | return tf.nn.rnn_cell.GRUCell(self.memory_dim) | Return the atomic RNN cell type used for this model
:return: The atomic RNN Cell | Return the atomic RNN cell type used for this model
:return: The atomic RNN Cell | [
"Return",
"the",
"atomic",
"RNN",
"cell",
"type",
"used",
"for",
"this",
"model",
":",
"return",
":",
"The",
"atomic",
"RNN",
"Cell"
] | def get_cell(self):
"""
Return the atomic RNN cell type used for this model
:return: The atomic RNN Cell
"""
return tf.nn.rnn_cell.GRUCell(self.memory_dim) | [
"def",
"get_cell",
"(",
"self",
")",
":",
"return",
"tf",
".",
"nn",
".",
"rnn_cell",
".",
"GRUCell",
"(",
"self",
".",
"memory_dim",
")"
] | https://github.com/harpribot/deep-summarization/blob/9b3bb1daae11a1db2386dbe4a71848714e6127f8/models/gru_bidirectional.py#L15-L21 | |
spatialaudio/nbsphinx | 8f6343a65eb5780715a3d0a26625cd5af9bdcd44 | src/nbsphinx.py | python | depart_codearea_latex | (self, node) | Some changes to code blocks.
* Change frame color and background color
* Add empty lines before and after the code
* Add prompt | Some changes to code blocks. | [
"Some",
"changes",
"to",
"code",
"blocks",
"."
] | def depart_codearea_latex(self, node):
"""Some changes to code blocks.
* Change frame color and background color
* Add empty lines before and after the code
* Add prompt
"""
lines = ''.join(self.popbody()).strip('\n').split('\n')
out = []
out.append('')
out.append('{') # Start a s... | [
"def",
"depart_codearea_latex",
"(",
"self",
",",
"node",
")",
":",
"lines",
"=",
"''",
".",
"join",
"(",
"self",
".",
"popbody",
"(",
")",
")",
".",
"strip",
"(",
"'\\n'",
")",
".",
"split",
"(",
"'\\n'",
")",
"out",
"=",
"[",
"]",
"out",
".",
... | https://github.com/spatialaudio/nbsphinx/blob/8f6343a65eb5780715a3d0a26625cd5af9bdcd44/src/nbsphinx.py#L2155-L2215 | ||
lazylibrarian/LazyLibrarian | ae3c14e9db9328ce81765e094ab2a14ed7155624 | lib/rfeed.py | python | Image.__init__ | (self, url, title, link, width=None, height=None, description=None) | Keyword arguments:
url -- The URL of the image that represents the channel.
title -- Describes the image. It's used in the ALT attribute of the HTML <img> tag when the channel
is rendered in HTML.
link -- The URL of the site. When the channel is rendered the image is a link to t... | Keyword arguments:
url -- The URL of the image that represents the channel.
title -- Describes the image. It's used in the ALT attribute of the HTML <img> tag when the channel
is rendered in HTML.
link -- The URL of the site. When the channel is rendered the image is a link to t... | [
"Keyword",
"arguments",
":",
"url",
"--",
"The",
"URL",
"of",
"the",
"image",
"that",
"represents",
"the",
"channel",
".",
"title",
"--",
"Describes",
"the",
"image",
".",
"It",
"s",
"used",
"in",
"the",
"ALT",
"attribute",
"of",
"the",
"HTML",
"<img",
... | def __init__(self, url, title, link, width=None, height=None, description=None):
""" Keyword arguments:
url -- The URL of the image that represents the channel.
title -- Describes the image. It's used in the ALT attribute of the HTML <img> tag when the channel
is rendered in HTM... | [
"def",
"__init__",
"(",
"self",
",",
"url",
",",
"title",
",",
"link",
",",
"width",
"=",
"None",
",",
"height",
"=",
"None",
",",
"description",
"=",
"None",
")",
":",
"Serializable",
".",
"__init__",
"(",
"self",
")",
"if",
"url",
"is",
"None",
"... | https://github.com/lazylibrarian/LazyLibrarian/blob/ae3c14e9db9328ce81765e094ab2a14ed7155624/lib/rfeed.py#L183-L209 | ||
isce-framework/isce2 | 0e5114a8bede3caf1d533d98e44dfe4b983e3f48 | components/isceobj/Planet/Ellipsoid.py | python | Heritage.sch_to_xyz | (self, posSCH) | return ((r_xyzv + self.pegOVNP).transpose()).tolist()[0] | Given an sch coordinate system (defined by setSCH) and an input SCH
point (a list), return the corresponding earth-centered-earth-fixed
xyz position. | Given an sch coordinate system (defined by setSCH) and an input SCH
point (a list), return the corresponding earth-centered-earth-fixed
xyz position. | [
"Given",
"an",
"sch",
"coordinate",
"system",
"(",
"defined",
"by",
"setSCH",
")",
"and",
"an",
"input",
"SCH",
"point",
"(",
"a",
"list",
")",
"return",
"the",
"corresponding",
"earth",
"-",
"centered",
"-",
"earth",
"-",
"fixed",
"xyz",
"position",
"."... | def sch_to_xyz(self, posSCH):
"""
Given an sch coordinate system (defined by setSCH) and an input SCH
point (a list), return the corresponding earth-centered-earth-fixed
xyz position.
"""
#compute the linear portion of the transformation
#create the SCH sphere o... | [
"def",
"sch_to_xyz",
"(",
"self",
",",
"posSCH",
")",
":",
"#compute the linear portion of the transformation",
"#create the SCH sphere object",
"sph",
"=",
"Ellipsoid",
"(",
")",
"sph",
".",
"a",
"=",
"self",
".",
"pegRadCur",
"sph",
".",
"e2",
"=",
"0.",
"impo... | https://github.com/isce-framework/isce2/blob/0e5114a8bede3caf1d533d98e44dfe4b983e3f48/components/isceobj/Planet/Ellipsoid.py#L574-L602 | |
OpenEIT/OpenEIT | 0448694e8092361ae5ccb45fba81dee543a6244b | OpenEIT/backend/bluetooth/old/build/dlib/Adafruit_BluefruitLE/interfaces/device.py | python | Device.id | (self) | Return a unique identifier for this device. On supported platforms
this will be the MAC address of the device, however on unsupported
platforms (Mac OSX) it will be a unique ID like a UUID. | Return a unique identifier for this device. On supported platforms
this will be the MAC address of the device, however on unsupported
platforms (Mac OSX) it will be a unique ID like a UUID. | [
"Return",
"a",
"unique",
"identifier",
"for",
"this",
"device",
".",
"On",
"supported",
"platforms",
"this",
"will",
"be",
"the",
"MAC",
"address",
"of",
"the",
"device",
"however",
"on",
"unsupported",
"platforms",
"(",
"Mac",
"OSX",
")",
"it",
"will",
"b... | def id(self):
"""Return a unique identifier for this device. On supported platforms
this will be the MAC address of the device, however on unsupported
platforms (Mac OSX) it will be a unique ID like a UUID.
"""
raise NotImplementedError | [
"def",
"id",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/OpenEIT/OpenEIT/blob/0448694e8092361ae5ccb45fba81dee543a6244b/OpenEIT/backend/bluetooth/old/build/dlib/Adafruit_BluefruitLE/interfaces/device.py#L64-L69 | ||
scanny/python-pptx | 71d1ca0b2b3b9178d64cdab565e8503a25a54e0b | pptx/oxml/shapes/shared.py | python | BaseShapeElement.txBody | (self) | return self.find(qn("p:txBody")) | Child ``<p:txBody>`` element, None if not present | Child ``<p:txBody>`` element, None if not present | [
"Child",
"<p",
":",
"txBody",
">",
"element",
"None",
"if",
"not",
"present"
] | def txBody(self):
"""
Child ``<p:txBody>`` element, None if not present
"""
return self.find(qn("p:txBody")) | [
"def",
"txBody",
"(",
"self",
")",
":",
"return",
"self",
".",
"find",
"(",
"qn",
"(",
"\"p:txBody\"",
")",
")"
] | https://github.com/scanny/python-pptx/blob/71d1ca0b2b3b9178d64cdab565e8503a25a54e0b/pptx/oxml/shapes/shared.py#L171-L175 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/asn1crypto/crl.py | python | CertificateList.sha256 | (self) | return self._sha256 | :return:
The SHA-256 hash of the DER-encoded bytes of this certificate list | :return:
The SHA-256 hash of the DER-encoded bytes of this certificate list | [
":",
"return",
":",
"The",
"SHA",
"-",
"256",
"hash",
"of",
"the",
"DER",
"-",
"encoded",
"bytes",
"of",
"this",
"certificate",
"list"
] | def sha256(self):
"""
:return:
The SHA-256 hash of the DER-encoded bytes of this certificate list
"""
if self._sha256 is None:
self._sha256 = hashlib.sha256(self.dump()).digest()
return self._sha256 | [
"def",
"sha256",
"(",
"self",
")",
":",
"if",
"self",
".",
"_sha256",
"is",
"None",
":",
"self",
".",
"_sha256",
"=",
"hashlib",
".",
"sha256",
"(",
"self",
".",
"dump",
"(",
")",
")",
".",
"digest",
"(",
")",
"return",
"self",
".",
"_sha256"
] | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/asn1crypto/crl.py#L528-L536 | |
Maratyszcza/PeachPy | 257881e0a7ce985c1cf96653db1264bf09adf510 | peachpy/encoder.py | python | Encoder.signed_offset | (self, n) | Converts signed integer offset to bytearray representation according to encoder bitness and endianness | Converts signed integer offset to bytearray representation according to encoder bitness and endianness | [
"Converts",
"signed",
"integer",
"offset",
"to",
"bytearray",
"representation",
"according",
"to",
"encoder",
"bitness",
"and",
"endianness"
] | def signed_offset(self, n):
"""Converts signed integer offset to bytearray representation according to encoder bitness and endianness"""
raise ValueError("Can not encode signed offset: encoder bitness not specified") | [
"def",
"signed_offset",
"(",
"self",
",",
"n",
")",
":",
"raise",
"ValueError",
"(",
"\"Can not encode signed offset: encoder bitness not specified\"",
")"
] | https://github.com/Maratyszcza/PeachPy/blob/257881e0a7ce985c1cf96653db1264bf09adf510/peachpy/encoder.py#L165-L167 | ||
IntelLabs/coach | dea46ae0d22b0a0cd30b9fc138a4a2642e1b9d9d | rl_coach/filters/action/attention_discretization.py | python | AttentionDiscretization.__init__ | (self, num_bins_per_dimension: Union[int, List[int]], force_int_bins=False) | :param num_bins_per_dimension: Number of discrete bins to use for each dimension of the action space
:param force_int_bins: If set to True, all the bins will represent integer coordinates in space. | :param num_bins_per_dimension: Number of discrete bins to use for each dimension of the action space
:param force_int_bins: If set to True, all the bins will represent integer coordinates in space. | [
":",
"param",
"num_bins_per_dimension",
":",
"Number",
"of",
"discrete",
"bins",
"to",
"use",
"for",
"each",
"dimension",
"of",
"the",
"action",
"space",
":",
"param",
"force_int_bins",
":",
"If",
"set",
"to",
"True",
"all",
"the",
"bins",
"will",
"represent... | def __init__(self, num_bins_per_dimension: Union[int, List[int]], force_int_bins=False):
"""
:param num_bins_per_dimension: Number of discrete bins to use for each dimension of the action space
:param force_int_bins: If set to True, all the bins will represent integer coordinates in space.
... | [
"def",
"__init__",
"(",
"self",
",",
"num_bins_per_dimension",
":",
"Union",
"[",
"int",
",",
"List",
"[",
"int",
"]",
"]",
",",
"force_int_bins",
"=",
"False",
")",
":",
"# we allow specifying either a single number for all dimensions, or a single number per dimension in... | https://github.com/IntelLabs/coach/blob/dea46ae0d22b0a0cd30b9fc138a4a2642e1b9d9d/rl_coach/filters/action/attention_discretization.py#L35-L48 | ||
glutanimate/review-heatmap | c758478125b60a81c66c87c35b12b7968ec0a348 | src/review_heatmap/libaddon/_vendor/logging/__init__.py | python | critical | (msg, *args, **kwargs) | Log a message with severity 'CRITICAL' on the root logger. If the logger
has no handlers, call basicConfig() to add a console handler with a
pre-defined format. | Log a message with severity 'CRITICAL' on the root logger. If the logger
has no handlers, call basicConfig() to add a console handler with a
pre-defined format. | [
"Log",
"a",
"message",
"with",
"severity",
"CRITICAL",
"on",
"the",
"root",
"logger",
".",
"If",
"the",
"logger",
"has",
"no",
"handlers",
"call",
"basicConfig",
"()",
"to",
"add",
"a",
"console",
"handler",
"with",
"a",
"pre",
"-",
"defined",
"format",
... | def critical(msg, *args, **kwargs):
"""
Log a message with severity 'CRITICAL' on the root logger. If the logger
has no handlers, call basicConfig() to add a console handler with a
pre-defined format.
"""
if len(root.handlers) == 0:
basicConfig()
root.critical(msg, *args, **kwargs) | [
"def",
"critical",
"(",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"len",
"(",
"root",
".",
"handlers",
")",
"==",
"0",
":",
"basicConfig",
"(",
")",
"root",
".",
"critical",
"(",
"msg",
",",
"*",
"args",
",",
"*",
"*",
... | https://github.com/glutanimate/review-heatmap/blob/c758478125b60a81c66c87c35b12b7968ec0a348/src/review_heatmap/libaddon/_vendor/logging/__init__.py#L1849-L1857 | ||
netaddr/netaddr | e84688f7034b7a88ac00a676359be57eb7a78184 | netaddr/ip/__init__.py | python | iprange_to_cidrs | (start, end) | return cidr_list | A function that accepts an arbitrary start and end IP address or subnet
and returns a list of CIDR subnets that fit exactly between the boundaries
of the two with no overlap.
:param start: the start IP address or subnet.
:param end: the end IP address or subnet.
:return: a list of one or more IP ... | A function that accepts an arbitrary start and end IP address or subnet
and returns a list of CIDR subnets that fit exactly between the boundaries
of the two with no overlap. | [
"A",
"function",
"that",
"accepts",
"an",
"arbitrary",
"start",
"and",
"end",
"IP",
"address",
"or",
"subnet",
"and",
"returns",
"a",
"list",
"of",
"CIDR",
"subnets",
"that",
"fit",
"exactly",
"between",
"the",
"boundaries",
"of",
"the",
"two",
"with",
"no... | def iprange_to_cidrs(start, end):
"""
A function that accepts an arbitrary start and end IP address or subnet
and returns a list of CIDR subnets that fit exactly between the boundaries
of the two with no overlap.
:param start: the start IP address or subnet.
:param end: the end IP address or s... | [
"def",
"iprange_to_cidrs",
"(",
"start",
",",
"end",
")",
":",
"cidr_list",
"=",
"[",
"]",
"start",
"=",
"IPNetwork",
"(",
"start",
")",
"end",
"=",
"IPNetwork",
"(",
"end",
")",
"iprange",
"=",
"[",
"start",
".",
"first",
",",
"end",
".",
"last",
... | https://github.com/netaddr/netaddr/blob/e84688f7034b7a88ac00a676359be57eb7a78184/netaddr/ip/__init__.py#L1795-L1828 | |
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/cheroot/ssl/builtin.py | python | _loopback_for_cert | (certificate, private_key, certificate_chain) | Create a loopback connection to parse a cert with a private key. | Create a loopback connection to parse a cert with a private key. | [
"Create",
"a",
"loopback",
"connection",
"to",
"parse",
"a",
"cert",
"with",
"a",
"private",
"key",
"."
] | def _loopback_for_cert(certificate, private_key, certificate_chain):
"""Create a loopback connection to parse a cert with a private key."""
context = ssl.create_default_context(cafile=certificate_chain)
context.load_cert_chain(certificate, private_key)
context.check_hostname = False
context.verify_m... | [
"def",
"_loopback_for_cert",
"(",
"certificate",
",",
"private_key",
",",
"certificate_chain",
")",
":",
"context",
"=",
"ssl",
".",
"create_default_context",
"(",
"cafile",
"=",
"certificate_chain",
")",
"context",
".",
"load_cert_chain",
"(",
"certificate",
",",
... | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/cheroot/ssl/builtin.py#L86-L117 | ||
robhagemans/pcbasic | c3a043b46af66623a801e18a38175be077251ada | pcbasic/basic/eventcycle.py | python | NullQueue.qsize | (self) | return 0 | [] | def qsize(self):
return 0 | [
"def",
"qsize",
"(",
"self",
")",
":",
"return",
"0"
] | https://github.com/robhagemans/pcbasic/blob/c3a043b46af66623a801e18a38175be077251ada/pcbasic/basic/eventcycle.py#L62-L63 | |||
sympy/sympy | d822fcba181155b85ff2b29fe525adbafb22b448 | sympy/integrals/rubi/utility_function.py | python | replace_pow_exp | (z) | return z | This function converts back rubi's `exp` to general SymPy's `exp`.
Examples
========
>>> from sympy.integrals.rubi.utility_function import rubi_exp, replace_pow_exp
>>> expr = rubi_exp(5)
>>> expr
E**5
>>> replace_pow_exp(expr)
exp(5) | This function converts back rubi's `exp` to general SymPy's `exp`. | [
"This",
"function",
"converts",
"back",
"rubi",
"s",
"exp",
"to",
"general",
"SymPy",
"s",
"exp",
"."
] | def replace_pow_exp(z):
"""
This function converts back rubi's `exp` to general SymPy's `exp`.
Examples
========
>>> from sympy.integrals.rubi.utility_function import rubi_exp, replace_pow_exp
>>> expr = rubi_exp(5)
>>> expr
E**5
>>> replace_pow_exp(expr)
exp(5)
"""
z ... | [
"def",
"replace_pow_exp",
"(",
"z",
")",
":",
"z",
"=",
"S",
"(",
"z",
")",
"if",
"z",
".",
"has",
"(",
"_E",
")",
":",
"z",
"=",
"z",
".",
"replace",
"(",
"_E",
",",
"E",
")",
"return",
"z"
] | https://github.com/sympy/sympy/blob/d822fcba181155b85ff2b29fe525adbafb22b448/sympy/integrals/rubi/utility_function.py#L128-L146 | |
CGATOxford/cgat | 326aad4694bdfae8ddc194171bb5d73911243947 | CGAT/Database.py | python | getTables | (dbhandle) | return tuple([x[0] for x in cc]) | get list of tables in an sqlite database | get list of tables in an sqlite database | [
"get",
"list",
"of",
"tables",
"in",
"an",
"sqlite",
"database"
] | def getTables(dbhandle):
"""get list of tables in an sqlite database"""
cc = executewait(
dbhandle, """select name from sqlite_master where type='table'""")
return tuple([x[0] for x in cc]) | [
"def",
"getTables",
"(",
"dbhandle",
")",
":",
"cc",
"=",
"executewait",
"(",
"dbhandle",
",",
"\"\"\"select name from sqlite_master where type='table'\"\"\"",
")",
"return",
"tuple",
"(",
"[",
"x",
"[",
"0",
"]",
"for",
"x",
"in",
"cc",
"]",
")"
] | https://github.com/CGATOxford/cgat/blob/326aad4694bdfae8ddc194171bb5d73911243947/CGAT/Database.py#L69-L73 | |
glitchassassin/lackey | 1ea404a3e003f0ef4dcaa8879ab02b1f568fa0a2 | lackey/PlatformManagerWindows.py | python | PlatformManagerWindows.getForegroundWindow | (self) | return self._user32.GetForegroundWindow() | Returns a handle to the window in the foreground | Returns a handle to the window in the foreground | [
"Returns",
"a",
"handle",
"to",
"the",
"window",
"in",
"the",
"foreground"
] | def getForegroundWindow(self):
""" Returns a handle to the window in the foreground """
return self._user32.GetForegroundWindow() | [
"def",
"getForegroundWindow",
"(",
"self",
")",
":",
"return",
"self",
".",
"_user32",
".",
"GetForegroundWindow",
"(",
")"
] | https://github.com/glitchassassin/lackey/blob/1ea404a3e003f0ef4dcaa8879ab02b1f568fa0a2/lackey/PlatformManagerWindows.py#L575-L577 | |
RJT1990/mantra | 7db4d272a1625c33eaa681b8c2e75c0aa57c6952 | mantraml/ui/core/code.py | python | CodeBase.get_file_icon | (cls, file_name) | Gets an ionicon logo based on the file extension | Gets an ionicon logo based on the file extension | [
"Gets",
"an",
"ionicon",
"logo",
"based",
"on",
"the",
"file",
"extension"
] | def get_file_icon(cls, file_name):
"""
Gets an ionicon logo based on the file extension
"""
if '.py' in file_name:
return 'logo-python'
if any([img in file_name for img in ['.png', '.jpg', '.jpeg']]):
return 'image'
else:
return 'docum... | [
"def",
"get_file_icon",
"(",
"cls",
",",
"file_name",
")",
":",
"if",
"'.py'",
"in",
"file_name",
":",
"return",
"'logo-python'",
"if",
"any",
"(",
"[",
"img",
"in",
"file_name",
"for",
"img",
"in",
"[",
"'.png'",
",",
"'.jpg'",
",",
"'.jpeg'",
"]",
"]... | https://github.com/RJT1990/mantra/blob/7db4d272a1625c33eaa681b8c2e75c0aa57c6952/mantraml/ui/core/code.py#L77-L87 | ||
replit-archive/empythoned | 977ec10ced29a3541a4973dc2b59910805695752 | cpython/Lib/distutils/ccompiler.py | python | CCompiler._setup_compile | (self, outdir, macros, incdirs, sources, depends,
extra) | return macros, objects, extra, pp_opts, build | Process arguments and decide which source files to compile. | Process arguments and decide which source files to compile. | [
"Process",
"arguments",
"and",
"decide",
"which",
"source",
"files",
"to",
"compile",
"."
] | def _setup_compile(self, outdir, macros, incdirs, sources, depends,
extra):
"""Process arguments and decide which source files to compile."""
if outdir is None:
outdir = self.output_dir
elif not isinstance(outdir, str):
raise TypeError, "'output_dir... | [
"def",
"_setup_compile",
"(",
"self",
",",
"outdir",
",",
"macros",
",",
"incdirs",
",",
"sources",
",",
"depends",
",",
"extra",
")",
":",
"if",
"outdir",
"is",
"None",
":",
"outdir",
"=",
"self",
".",
"output_dir",
"elif",
"not",
"isinstance",
"(",
"... | https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/cpython/Lib/distutils/ccompiler.py#L373-L415 | |
facebookincubator/xar | 2c558eb24a9f7202d676945a064be2b993b95861 | xar/xar_builder.py | python | XarBuilder.add_zipfile | (self, zf, dst=None) | Adds a zipfile to the XAR under `dst`. If `dst` is `None`, then the root
of the xar is set to the directory. Throws if any extracted file already
exists. | Adds a zipfile to the XAR under `dst`. If `dst` is `None`, then the root
of the xar is set to the directory. Throws if any extracted file already
exists. | [
"Adds",
"a",
"zipfile",
"to",
"the",
"XAR",
"under",
"dst",
".",
"If",
"dst",
"is",
"None",
"then",
"the",
"root",
"of",
"the",
"xar",
"is",
"set",
"to",
"the",
"directory",
".",
"Throws",
"if",
"any",
"extracted",
"file",
"already",
"exists",
"."
] | def add_zipfile(self, zf, dst=None):
"""
Adds a zipfile to the XAR under `dst`. If `dst` is `None`, then the root
of the xar is set to the directory. Throws if any extracted file already
exists.
"""
self._ensure_unfrozen()
self._staging.extract(zf, dst) | [
"def",
"add_zipfile",
"(",
"self",
",",
"zf",
",",
"dst",
"=",
"None",
")",
":",
"self",
".",
"_ensure_unfrozen",
"(",
")",
"self",
".",
"_staging",
".",
"extract",
"(",
"zf",
",",
"dst",
")"
] | https://github.com/facebookincubator/xar/blob/2c558eb24a9f7202d676945a064be2b993b95861/xar/xar_builder.py#L92-L99 | ||
KhronosGroup/NNEF-Tools | c913758ca687dab8cb7b49e8f1556819a2d0ca25 | nnef_tools/io/tf/lite/flatbuffers/Metadata.py | python | MetadataAddBuffer | (builder, buffer) | [] | def MetadataAddBuffer(builder, buffer): builder.PrependUint32Slot(1, buffer, 0) | [
"def",
"MetadataAddBuffer",
"(",
"builder",
",",
"buffer",
")",
":",
"builder",
".",
"PrependUint32Slot",
"(",
"1",
",",
"buffer",
",",
"0",
")"
] | https://github.com/KhronosGroup/NNEF-Tools/blob/c913758ca687dab8cb7b49e8f1556819a2d0ca25/nnef_tools/io/tf/lite/flatbuffers/Metadata.py#L43-L43 | ||||
facebookresearch/ParlAI | e4d59c30eef44f1f67105961b82a83fd28d7d78b | parlai/utils/bpe.py | python | BPEHelper.copy_codecs_file | (self, target_file: str) | Copy the codecs file to a new location.
Default behavior is to do nothing.
:param target_file:
where to copy the codecs. | Copy the codecs file to a new location. | [
"Copy",
"the",
"codecs",
"file",
"to",
"a",
"new",
"location",
"."
] | def copy_codecs_file(self, target_file: str):
"""
Copy the codecs file to a new location.
Default behavior is to do nothing.
:param target_file:
where to copy the codecs.
"""
pass | [
"def",
"copy_codecs_file",
"(",
"self",
",",
"target_file",
":",
"str",
")",
":",
"pass"
] | https://github.com/facebookresearch/ParlAI/blob/e4d59c30eef44f1f67105961b82a83fd28d7d78b/parlai/utils/bpe.py#L303-L312 | ||
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/Django/django/views/generic/detail.py | python | SingleObjectMixin.get_object | (self, queryset=None) | return obj | Returns the object the view is displaying.
By default this requires `self.queryset` and a `pk` or `slug` argument
in the URLconf, but subclasses can override this to return any object. | Returns the object the view is displaying. | [
"Returns",
"the",
"object",
"the",
"view",
"is",
"displaying",
"."
] | def get_object(self, queryset=None):
"""
Returns the object the view is displaying.
By default this requires `self.queryset` and a `pk` or `slug` argument
in the URLconf, but subclasses can override this to return any object.
"""
# Use a custom queryset if provided; this... | [
"def",
"get_object",
"(",
"self",
",",
"queryset",
"=",
"None",
")",
":",
"# Use a custom queryset if provided; this is required for subclasses",
"# like DateDetailView",
"if",
"queryset",
"is",
"None",
":",
"queryset",
"=",
"self",
".",
"get_queryset",
"(",
")",
"# N... | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/Django/django/views/generic/detail.py#L21-L56 | |
ShuangXieIrene/ssds.pytorch | b5ec682a42c923afe964205b21448e9f141d55bc | ssds/modeling/layers/box.py | python | decode | (
all_cls_head,
all_box_head,
stride=1,
threshold=0.05,
top_n=1000,
anchors=None,
rescore=True,
) | return out_scores, out_boxes, out_classes | Box Decoding and Filtering | Box Decoding and Filtering | [
"Box",
"Decoding",
"and",
"Filtering"
] | def decode(
all_cls_head,
all_box_head,
stride=1,
threshold=0.05,
top_n=1000,
anchors=None,
rescore=True,
):
"Box Decoding and Filtering"
# if torch.cuda.is_available():
# return decode_cuda(all_cls_head.float(), all_box_head.float(),
# anchors.view(-1).tolist(),... | [
"def",
"decode",
"(",
"all_cls_head",
",",
"all_box_head",
",",
"stride",
"=",
"1",
",",
"threshold",
"=",
"0.05",
",",
"top_n",
"=",
"1000",
",",
"anchors",
"=",
"None",
",",
"rescore",
"=",
"True",
",",
")",
":",
"# if torch.cuda.is_available():",
"# ... | https://github.com/ShuangXieIrene/ssds.pytorch/blob/b5ec682a42c923afe964205b21448e9f141d55bc/ssds/modeling/layers/box.py#L408-L477 | |
josauder/procedural_city_generation | e53d9a48440c914f9aad65455b3aebc13d90bc98 | procedural_city_generation/polygons/Polygon2D.py | python | Polygon2D.__init__ | (self, in_list, poly_type="vacant") | Input may be numpy-arrays or Edge-objects | Input may be numpy-arrays or Edge-objects | [
"Input",
"may",
"be",
"numpy",
"-",
"arrays",
"or",
"Edge",
"-",
"objects"
] | def __init__(self, in_list, poly_type="vacant"):
"""Input may be numpy-arrays or Edge-objects"""
if isinstance(in_list[0], Edge):
self.edges = in_list
self.vertices = [edge[0] for edge in self.edges]
else:
self.vertices = in_list
self.edges = [Edg... | [
"def",
"__init__",
"(",
"self",
",",
"in_list",
",",
"poly_type",
"=",
"\"vacant\"",
")",
":",
"if",
"isinstance",
"(",
"in_list",
"[",
"0",
"]",
",",
"Edge",
")",
":",
"self",
".",
"edges",
"=",
"in_list",
"self",
".",
"vertices",
"=",
"[",
"edge",
... | https://github.com/josauder/procedural_city_generation/blob/e53d9a48440c914f9aad65455b3aebc13d90bc98/procedural_city_generation/polygons/Polygon2D.py#L40-L52 | ||
realpython/book2-exercises | cde325eac8e6d8cff2316601c2e5b36bb46af7d0 | web2py/gluon/highlight.py | python | Highlighter.highlight | (self, data) | return ''.join(self.output).expandtabs(4) | Syntax highlight some python code.
Returns html version of code. | Syntax highlight some python code.
Returns html version of code. | [
"Syntax",
"highlight",
"some",
"python",
"code",
".",
"Returns",
"html",
"version",
"of",
"code",
"."
] | def highlight(self, data):
"""
Syntax highlight some python code.
Returns html version of code.
"""
i = 0
mode = self.mode
while i < len(data):
for (token, o_re, style) in Highlighter.all_styles[mode][1]:
if not token in self.suppress_... | [
"def",
"highlight",
"(",
"self",
",",
"data",
")",
":",
"i",
"=",
"0",
"mode",
"=",
"self",
".",
"mode",
"while",
"i",
"<",
"len",
"(",
"data",
")",
":",
"for",
"(",
"token",
",",
"o_re",
",",
"style",
")",
"in",
"Highlighter",
".",
"all_styles",... | https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/web2py/gluon/highlight.py#L202-L233 | |
balanced/status.balancedpayments.com | e51a371079a8fa215732be3cfa57497a9d113d35 | venv/lib/python2.7/site-packages/distribute-0.6.34-py2.7.egg/pkg_resources.py | python | get_default_cache | () | Determine the default cache location
This returns the ``PYTHON_EGG_CACHE`` environment variable, if set.
Otherwise, on Windows, it returns a "Python-Eggs" subdirectory of the
"Application Data" directory. On all other systems, it's "~/.python-eggs". | Determine the default cache location | [
"Determine",
"the",
"default",
"cache",
"location"
] | def get_default_cache():
"""Determine the default cache location
This returns the ``PYTHON_EGG_CACHE`` environment variable, if set.
Otherwise, on Windows, it returns a "Python-Eggs" subdirectory of the
"Application Data" directory. On all other systems, it's "~/.python-eggs".
"""
try:
... | [
"def",
"get_default_cache",
"(",
")",
":",
"try",
":",
"return",
"os",
".",
"environ",
"[",
"'PYTHON_EGG_CACHE'",
"]",
"except",
"KeyError",
":",
"pass",
"if",
"os",
".",
"name",
"!=",
"'nt'",
":",
"return",
"os",
".",
"path",
".",
"expanduser",
"(",
"... | https://github.com/balanced/status.balancedpayments.com/blob/e51a371079a8fa215732be3cfa57497a9d113d35/venv/lib/python2.7/site-packages/distribute-0.6.34-py2.7.egg/pkg_resources.py#L1099-L1138 | ||
implus/PytorchInsight | 2864528f8b83f52c3df76f7c3804aa468b91e5cf | detection/mmdet/models/backbones/resnet_sge.py | python | BasicBlock.norm2 | (self) | return getattr(self, self.norm2_name) | [] | def norm2(self):
return getattr(self, self.norm2_name) | [
"def",
"norm2",
"(",
"self",
")",
":",
"return",
"getattr",
"(",
"self",
",",
"self",
".",
"norm2_name",
")"
] | https://github.com/implus/PytorchInsight/blob/2864528f8b83f52c3df76f7c3804aa468b91e5cf/detection/mmdet/models/backbones/resnet_sge.py#L92-L93 | |||
eirannejad/pyRevit | 49c0b7eb54eb343458ce1365425e6552d0c47d44 | pyrevitlib/rpws/server.py | python | RevitServer.rmdir | (self, nodepath) | return self._delete(api.REQ_CMD_DELETE, nodepath) | Deletes a file, folder, or model under the provided path
Args:
nodepath (str): Path to a file, folder, or model on the server.
Example:
>>> rserver = RevitServer('server01', '2017')
>>> rserver.rmdir('/example/path') | Deletes a file, folder, or model under the provided path | [
"Deletes",
"a",
"file",
"folder",
"or",
"model",
"under",
"the",
"provided",
"path"
] | def rmdir(self, nodepath):
""" Deletes a file, folder, or model under the provided path
Args:
nodepath (str): Path to a file, folder, or model on the server.
Example:
>>> rserver = RevitServer('server01', '2017')
>>> rserver.rmdir('/example/path')
""... | [
"def",
"rmdir",
"(",
"self",
",",
"nodepath",
")",
":",
"return",
"self",
".",
"_delete",
"(",
"api",
".",
"REQ_CMD_DELETE",
",",
"nodepath",
")"
] | https://github.com/eirannejad/pyRevit/blob/49c0b7eb54eb343458ce1365425e6552d0c47d44/pyrevitlib/rpws/server.py#L940-L951 | |
automl/auto-sklearn | cd4fef98620cd4be599b9124f06b12a39c2c3526 | autosklearn/ensemble_builder.py | python | EnsembleBuilder.compute_loss_per_model | (self) | return True | Compute the loss of the predictions on ensemble building data set;
populates self.read_preds and self.read_losses | Compute the loss of the predictions on ensemble building data set;
populates self.read_preds and self.read_losses | [
"Compute",
"the",
"loss",
"of",
"the",
"predictions",
"on",
"ensemble",
"building",
"data",
"set",
";",
"populates",
"self",
".",
"read_preds",
"and",
"self",
".",
"read_losses"
] | def compute_loss_per_model(self):
"""
Compute the loss of the predictions on ensemble building data set;
populates self.read_preds and self.read_losses
"""
self.logger.debug("Read ensemble data set predictions")
if self.y_true_ensemble is None:
try:
... | [
"def",
"compute_loss_per_model",
"(",
"self",
")",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"\"Read ensemble data set predictions\"",
")",
"if",
"self",
".",
"y_true_ensemble",
"is",
"None",
":",
"try",
":",
"self",
".",
"y_true_ensemble",
"=",
"self",
"... | https://github.com/automl/auto-sklearn/blob/cd4fef98620cd4be599b9124f06b12a39c2c3526/autosklearn/ensemble_builder.py#L814-L945 | |
Azure/azure-linux-extensions | a42ef718c746abab2b3c6a21da87b29e76364558 | OSPatching/azure/storage/tableservice.py | python | TableService.delete_entity | (self, table_name, partition_key, row_key,
content_type='application/atom+xml', if_match='*') | Deletes an existing entity in a table.
table_name: Table name.
partition_key: PartitionKey of the entity.
row_key: RowKey of the entity.
content_type: Required. Must be set to application/atom+xml
if_match:
Optional. Specifies the condition for which the delete shoul... | Deletes an existing entity in a table. | [
"Deletes",
"an",
"existing",
"entity",
"in",
"a",
"table",
"."
] | def delete_entity(self, table_name, partition_key, row_key,
content_type='application/atom+xml', if_match='*'):
'''
Deletes an existing entity in a table.
table_name: Table name.
partition_key: PartitionKey of the entity.
row_key: RowKey of the entity.
... | [
"def",
"delete_entity",
"(",
"self",
",",
"table_name",
",",
"partition_key",
",",
"row_key",
",",
"content_type",
"=",
"'application/atom+xml'",
",",
"if_match",
"=",
"'*'",
")",
":",
"_validate_not_none",
"(",
"'table_name'",
",",
"table_name",
")",
"_validate_n... | https://github.com/Azure/azure-linux-extensions/blob/a42ef718c746abab2b3c6a21da87b29e76364558/OSPatching/azure/storage/tableservice.py#L382-L414 | ||
chainer/chainerui | 91c5c26d9154a008079dbb0bcbf69b5590d105f7 | chainerui/views/result_command.py | python | ResultCommandAPI.post | (self, result_id, project_id) | return jsonify({'commands': new_result_dict['commands']}) | POST /api/v1/results/<int:id>/commands. | POST /api/v1/results/<int:id>/commands. | [
"POST",
"/",
"api",
"/",
"v1",
"/",
"results",
"/",
"<int",
":",
"id",
">",
"/",
"commands",
"."
] | def post(self, result_id, project_id):
"""POST /api/v1/results/<int:id>/commands."""
result = db.session.query(Result).filter_by(id=result_id).first()
if result is None:
return jsonify({
'result': None,
'message': 'No interface defined for URL.'
... | [
"def",
"post",
"(",
"self",
",",
"result_id",
",",
"project_id",
")",
":",
"result",
"=",
"db",
".",
"session",
".",
"query",
"(",
"Result",
")",
".",
"filter_by",
"(",
"id",
"=",
"result_id",
")",
".",
"first",
"(",
")",
"if",
"result",
"is",
"Non... | https://github.com/chainer/chainerui/blob/91c5c26d9154a008079dbb0bcbf69b5590d105f7/chainerui/views/result_command.py#L16-L82 | |
snower/forsun | b90d9716b123d98f32575560850e7d8b74aa2612 | forsun/clients/client/Forsun.py | python | Client.create | (self, key, second, minute, hour, day, month, week, action, params) | return self.recv_create() | Parameters:
- key
- second
- minute
- hour
- day
- month
- week
- action
- params | Parameters:
- key
- second
- minute
- hour
- day
- month
- week
- action
- params | [
"Parameters",
":",
"-",
"key",
"-",
"second",
"-",
"minute",
"-",
"hour",
"-",
"day",
"-",
"month",
"-",
"week",
"-",
"action",
"-",
"params"
] | def create(self, key, second, minute, hour, day, month, week, action, params):
"""
Parameters:
- key
- second
- minute
- hour
- day
- month
- week
- action
- params
"""
self.send_create(key, second, minute, ... | [
"def",
"create",
"(",
"self",
",",
"key",
",",
"second",
",",
"minute",
",",
"hour",
",",
"day",
",",
"month",
",",
"week",
",",
"action",
",",
"params",
")",
":",
"self",
".",
"send_create",
"(",
"key",
",",
"second",
",",
"minute",
",",
"hour",
... | https://github.com/snower/forsun/blob/b90d9716b123d98f32575560850e7d8b74aa2612/forsun/clients/client/Forsun.py#L133-L147 | |
nlloyd/SubliminalCollaborator | 5c619e17ddbe8acb9eea8996ec038169ddcd50a1 | libs/twisted/internet/process.py | python | Process.registerProducer | (self, producer, streaming) | Call this to register producer for standard input.
If there is no standard input producer.stopProducing() will
be called immediately. | Call this to register producer for standard input. | [
"Call",
"this",
"to",
"register",
"producer",
"for",
"standard",
"input",
"."
] | def registerProducer(self, producer, streaming):
"""
Call this to register producer for standard input.
If there is no standard input producer.stopProducing() will
be called immediately.
"""
if 0 in self.pipes:
self.pipes[0].registerProducer(producer, streami... | [
"def",
"registerProducer",
"(",
"self",
",",
"producer",
",",
"streaming",
")",
":",
"if",
"0",
"in",
"self",
".",
"pipes",
":",
"self",
".",
"pipes",
"[",
"0",
"]",
".",
"registerProducer",
"(",
"producer",
",",
"streaming",
")",
"else",
":",
"produce... | https://github.com/nlloyd/SubliminalCollaborator/blob/5c619e17ddbe8acb9eea8996ec038169ddcd50a1/libs/twisted/internet/process.py#L870-L880 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/werkzeug/wrappers.py | python | BaseResponse.__repr__ | (self) | return '<%s %s [%s]>' % (
self.__class__.__name__,
body_info,
self.status
) | [] | def __repr__(self):
if self.is_sequence:
body_info = '%d bytes' % sum(map(len, self.iter_encoded()))
else:
body_info = 'streamed' if self.is_streamed else 'likely-streamed'
return '<%s %s [%s]>' % (
self.__class__.__name__,
body_info,
s... | [
"def",
"__repr__",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_sequence",
":",
"body_info",
"=",
"'%d bytes'",
"%",
"sum",
"(",
"map",
"(",
"len",
",",
"self",
".",
"iter_encoded",
"(",
")",
")",
")",
"else",
":",
"body_info",
"=",
"'streamed'",
"i... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/werkzeug/wrappers.py#L877-L886 | |||
biolab/orange3 | 41685e1c7b1d1babe680113685a2d44bcc9fec0b | Orange/widgets/data/utils/pythoneditor/editor.py | python | PythonEditor.selectedPosition | (self, pos) | [] | def selectedPosition(self, pos):
anchorPos, cursorPos = pos
anchorLine, anchorCol = anchorPos
cursorLine, cursorCol = cursorPos
anchorCursor = QTextCursor(self.document().findBlockByNumber(anchorLine))
setPositionInBlock(anchorCursor, anchorCol)
# just get absolute posi... | [
"def",
"selectedPosition",
"(",
"self",
",",
"pos",
")",
":",
"anchorPos",
",",
"cursorPos",
"=",
"pos",
"anchorLine",
",",
"anchorCol",
"=",
"anchorPos",
"cursorLine",
",",
"cursorCol",
"=",
"cursorPos",
"anchorCursor",
"=",
"QTextCursor",
"(",
"self",
".",
... | https://github.com/biolab/orange3/blob/41685e1c7b1d1babe680113685a2d44bcc9fec0b/Orange/widgets/data/utils/pythoneditor/editor.py#L586-L599 | ||||
SALib/SALib | b6b6b5cab3388f3b80590c98d66aca7dc784d894 | src/SALib/analyze/sobol.py | python | cli_action | (args) | [] | def cli_action(args):
problem = read_param_file(args.paramfile)
Y = np.loadtxt(args.model_output_file, delimiter=args.delimiter,
usecols=(args.column,))
analyze(problem, Y, (args.max_order == 2),
num_resamples=args.resamples, print_to_console=True,
parallel=args.p... | [
"def",
"cli_action",
"(",
"args",
")",
":",
"problem",
"=",
"read_param_file",
"(",
"args",
".",
"paramfile",
")",
"Y",
"=",
"np",
".",
"loadtxt",
"(",
"args",
".",
"model_output_file",
",",
"delimiter",
"=",
"args",
".",
"delimiter",
",",
"usecols",
"="... | https://github.com/SALib/SALib/blob/b6b6b5cab3388f3b80590c98d66aca7dc784d894/src/SALib/analyze/sobol.py#L398-L406 | ||||
DataDog/integrations-core | 934674b29d94b70ccc008f76ea172d0cdae05e1e | elastic/datadog_checks/elastic/metrics.py | python | index_stats_for_version | (version) | return index_stats | Get the proper set of index metrics for the specified ES version | Get the proper set of index metrics for the specified ES version | [
"Get",
"the",
"proper",
"set",
"of",
"index",
"metrics",
"for",
"the",
"specified",
"ES",
"version"
] | def index_stats_for_version(version):
"""
Get the proper set of index metrics for the specified ES version
"""
index_stats = {}
if version:
index_stats.update(INDEX_STATS_METRICS)
return index_stats | [
"def",
"index_stats_for_version",
"(",
"version",
")",
":",
"index_stats",
"=",
"{",
"}",
"if",
"version",
":",
"index_stats",
".",
"update",
"(",
"INDEX_STATS_METRICS",
")",
"return",
"index_stats"
] | https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/elastic/datadog_checks/elastic/metrics.py#L759-L768 | |
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/logging/__init__.py | python | Formatter.formatException | (self, ei) | return s | Format and return the specified exception information as a string.
This default implementation just uses
traceback.print_exception() | Format and return the specified exception information as a string. | [
"Format",
"and",
"return",
"the",
"specified",
"exception",
"information",
"as",
"a",
"string",
"."
] | def formatException(self, ei):
"""
Format and return the specified exception information as a string.
This default implementation just uses
traceback.print_exception()
"""
sio = io.StringIO()
tb = ei[2]
# See issues #9427, #1553375. Commented out for now.... | [
"def",
"formatException",
"(",
"self",
",",
"ei",
")",
":",
"sio",
"=",
"io",
".",
"StringIO",
"(",
")",
"tb",
"=",
"ei",
"[",
"2",
"]",
"# See issues #9427, #1553375. Commented out for now.",
"#if getattr(self, 'fullstack', False):",
"# traceback.print_stack(tb.tb_f... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/logging/__init__.py#L624-L641 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/xmlrpc/server.py | python | CGIXMLRPCRequestHandler.handle_xmlrpc | (self, request_text) | Handle a single XML-RPC request | Handle a single XML-RPC request | [
"Handle",
"a",
"single",
"XML",
"-",
"RPC",
"request"
] | def handle_xmlrpc(self, request_text):
"""Handle a single XML-RPC request"""
response = self._marshaled_dispatch(request_text)
print('Content-Type: text/xml')
print('Content-Length: %d' % len(response))
print()
sys.stdout.flush()
sys.stdout.buffer.write(response... | [
"def",
"handle_xmlrpc",
"(",
"self",
",",
"request_text",
")",
":",
"response",
"=",
"self",
".",
"_marshaled_dispatch",
"(",
"request_text",
")",
"print",
"(",
"'Content-Type: text/xml'",
")",
"print",
"(",
"'Content-Length: %d'",
"%",
"len",
"(",
"response",
"... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/xmlrpc/server.py#L637-L647 | ||
clhchtcjj/BiNE | c8a9827827002a4175a86ce0e95bdb15426abfec | model/graph.py | python | Graph.random_walk | (self, nodes, path_length, alpha=0, rand=random.Random(), start=None) | return path | Returns a truncated random walk.
path_length: Length of the random walk.
alpha: probability of restarts.
start: the start node of the random walk. | Returns a truncated random walk. | [
"Returns",
"a",
"truncated",
"random",
"walk",
"."
] | def random_walk(self, nodes, path_length, alpha=0, rand=random.Random(), start=None):
""" Returns a truncated random walk.
path_length: Length of the random walk.
alpha: probability of restarts.
start: the start node of the random walk.
"""
G = self
if start:
path = [start... | [
"def",
"random_walk",
"(",
"self",
",",
"nodes",
",",
"path_length",
",",
"alpha",
"=",
"0",
",",
"rand",
"=",
"random",
".",
"Random",
"(",
")",
",",
"start",
"=",
"None",
")",
":",
"G",
"=",
"self",
"if",
"start",
":",
"path",
"=",
"[",
"start"... | https://github.com/clhchtcjj/BiNE/blob/c8a9827827002a4175a86ce0e95bdb15426abfec/model/graph.py#L169-L195 | |
jamiesun/SublimeEvernote | 62eeccabca6c4051340f0b1b8f7c10548437a9e1 | lib/markdown2.py | python | Markdown._do_code_blocks | (self, text) | return code_block_re.sub(self._code_block_sub, text) | Process Markdown `<pre><code>` blocks. | Process Markdown `<pre><code>` blocks. | [
"Process",
"Markdown",
"<pre",
">",
"<code",
">",
"blocks",
"."
] | def _do_code_blocks(self, text):
"""Process Markdown `<pre><code>` blocks."""
code_block_re = re.compile(r'''
(?:\n\n|\A\n?)
( # $1 = the code block -- one or more lines, starting with a space/tab
(?:
(?:[ ]{%d} | \t) # Lines must star... | [
"def",
"_do_code_blocks",
"(",
"self",
",",
"text",
")",
":",
"code_block_re",
"=",
"re",
".",
"compile",
"(",
"r'''\n (?:\\n\\n|\\A\\n?)\n ( # $1 = the code block -- one or more lines, starting with a space/tab\n (?:\n (?:[... | https://github.com/jamiesun/SublimeEvernote/blob/62eeccabca6c4051340f0b1b8f7c10548437a9e1/lib/markdown2.py#L1504-L1517 | |
CGATOxford/cgat | 326aad4694bdfae8ddc194171bb5d73911243947 | CGAT/Expression.py | python | DEResult_Sleuth.getResults | (self, fdr) | post-process test results table into generic results output
expression and fold changes from Sleuth are natural logs | post-process test results table into generic results output
expression and fold changes from Sleuth are natural logs | [
"post",
"-",
"process",
"test",
"results",
"table",
"into",
"generic",
"results",
"output",
"expression",
"and",
"fold",
"changes",
"from",
"Sleuth",
"are",
"natural",
"logs"
] | def getResults(self, fdr):
''' post-process test results table into generic results output
expression and fold changes from Sleuth are natural logs'''
E.info("Generating output - results table")
df_dict = collections.defaultdict()
n_rows = self.table.shape[0]
df_dict[... | [
"def",
"getResults",
"(",
"self",
",",
"fdr",
")",
":",
"E",
".",
"info",
"(",
"\"Generating output - results table\"",
")",
"df_dict",
"=",
"collections",
".",
"defaultdict",
"(",
")",
"n_rows",
"=",
"self",
".",
"table",
".",
"shape",
"[",
"0",
"]",
"d... | https://github.com/CGATOxford/cgat/blob/326aad4694bdfae8ddc194171bb5d73911243947/CGAT/Expression.py#L1451-L1483 | ||
allenai/document-qa | 2f9fa6878b60ed8a8a31bcf03f802cde292fe48b | docqa/elmo/lm_qa_models.py | python | ElmoQaModel.token_lookup | (self) | return self.lm_model.embed_weights_file is not None | Are we using pre-computed word vectors, or running the LM's CNN to dynmacially derive
word vectors from characters. | Are we using pre-computed word vectors, or running the LM's CNN to dynmacially derive
word vectors from characters. | [
"Are",
"we",
"using",
"pre",
"-",
"computed",
"word",
"vectors",
"or",
"running",
"the",
"LM",
"s",
"CNN",
"to",
"dynmacially",
"derive",
"word",
"vectors",
"from",
"characters",
"."
] | def token_lookup(self):
"""
Are we using pre-computed word vectors, or running the LM's CNN to dynmacially derive
word vectors from characters.
"""
return self.lm_model.embed_weights_file is not None | [
"def",
"token_lookup",
"(",
"self",
")",
":",
"return",
"self",
".",
"lm_model",
".",
"embed_weights_file",
"is",
"not",
"None"
] | https://github.com/allenai/document-qa/blob/2f9fa6878b60ed8a8a31bcf03f802cde292fe48b/docqa/elmo/lm_qa_models.py#L77-L82 | |
MrH0wl/Cloudmare | 65e5bc9888f9d362ab2abfb103ea6c1e869d67aa | thirdparty/click/utils.py | python | LazyFile.close_intelligently | (self) | This function only closes the file if it was opened by the lazy
file wrapper. For instance this will never close stdin. | This function only closes the file if it was opened by the lazy
file wrapper. For instance this will never close stdin. | [
"This",
"function",
"only",
"closes",
"the",
"file",
"if",
"it",
"was",
"opened",
"by",
"the",
"lazy",
"file",
"wrapper",
".",
"For",
"instance",
"this",
"will",
"never",
"close",
"stdin",
"."
] | def close_intelligently(self):
"""This function only closes the file if it was opened by the lazy
file wrapper. For instance this will never close stdin.
"""
if self.should_close:
self.close() | [
"def",
"close_intelligently",
"(",
"self",
")",
":",
"if",
"self",
".",
"should_close",
":",
"self",
".",
"close",
"(",
")"
] | https://github.com/MrH0wl/Cloudmare/blob/65e5bc9888f9d362ab2abfb103ea6c1e869d67aa/thirdparty/click/utils.py#L141-L146 | ||
cooelf/SemBERT | f849452f864b5dd47f94e2911cffc15e9f6a5a2a | run_classifier.py | python | SnliProcessor.get_train_examples | (self, data_dir) | return self._create_examples(
self._read_tsv(os.path.join(data_dir, "train.tsv_tag_label")), "train") | See base class. | See base class. | [
"See",
"base",
"class",
"."
] | def get_train_examples(self, data_dir):
"""See base class."""
return self._create_examples(
self._read_tsv(os.path.join(data_dir, "train.tsv_tag_label")), "train") | [
"def",
"get_train_examples",
"(",
"self",
",",
"data_dir",
")",
":",
"return",
"self",
".",
"_create_examples",
"(",
"self",
".",
"_read_tsv",
"(",
"os",
".",
"path",
".",
"join",
"(",
"data_dir",
",",
"\"train.tsv_tag_label\"",
")",
")",
",",
"\"train\"",
... | https://github.com/cooelf/SemBERT/blob/f849452f864b5dd47f94e2911cffc15e9f6a5a2a/run_classifier.py#L405-L408 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/combinat/partition.py | python | Partition.remove_horizontal_border_strip | (self, k) | return Partitions_with_constraints(n = self.size()-k,
min_length = len(self)-1,
max_length = len(self),
floor = self[1:]+[0],
ceiling = self[:],
... | Return the partitions obtained from ``self`` by removing an
horizontal border strip of length ``k``.
EXAMPLES::
sage: Partition([5,3,1]).remove_horizontal_border_strip(0).list()
[[5, 3, 1]]
sage: Partition([5,3,1]).remove_horizontal_border_strip(1).list()
... | Return the partitions obtained from ``self`` by removing an
horizontal border strip of length ``k``. | [
"Return",
"the",
"partitions",
"obtained",
"from",
"self",
"by",
"removing",
"an",
"horizontal",
"border",
"strip",
"of",
"length",
"k",
"."
] | def remove_horizontal_border_strip(self, k):
"""
Return the partitions obtained from ``self`` by removing an
horizontal border strip of length ``k``.
EXAMPLES::
sage: Partition([5,3,1]).remove_horizontal_border_strip(0).list()
[[5, 3, 1]]
sage: Parti... | [
"def",
"remove_horizontal_border_strip",
"(",
"self",
",",
"k",
")",
":",
"return",
"Partitions_with_constraints",
"(",
"n",
"=",
"self",
".",
"size",
"(",
")",
"-",
"k",
",",
"min_length",
"=",
"len",
"(",
"self",
")",
"-",
"1",
",",
"max_length",
"=",
... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/partition.py#L4718-L4763 | |
inducer/loopy | 55143b21711a534c07bbb14aaa63ff3879a93433 | loopy/target/c/codegen/expression.py | python | ExpressionToCExpressionMapper.wrap_in_typecast_lazy | (self, actual_type_func, needed_dtype, s) | return s | This is similar to *wrap_in_typecast*, but takes a function for
the actual type argument instead of a type. This can be helpful
when actual type argument is expensive to calculate and is not
needed in some cases. | This is similar to *wrap_in_typecast*, but takes a function for
the actual type argument instead of a type. This can be helpful
when actual type argument is expensive to calculate and is not
needed in some cases. | [
"This",
"is",
"similar",
"to",
"*",
"wrap_in_typecast",
"*",
"but",
"takes",
"a",
"function",
"for",
"the",
"actual",
"type",
"argument",
"instead",
"of",
"a",
"type",
".",
"This",
"can",
"be",
"helpful",
"when",
"actual",
"type",
"argument",
"is",
"expens... | def wrap_in_typecast_lazy(self, actual_type_func, needed_dtype, s):
"""This is similar to *wrap_in_typecast*, but takes a function for
the actual type argument instead of a type. This can be helpful
when actual type argument is expensive to calculate and is not
needed in some cases.
... | [
"def",
"wrap_in_typecast_lazy",
"(",
"self",
",",
"actual_type_func",
",",
"needed_dtype",
",",
"s",
")",
":",
"return",
"s"
] | https://github.com/inducer/loopy/blob/55143b21711a534c07bbb14aaa63ff3879a93433/loopy/target/c/codegen/expression.py#L105-L111 | |
jliljebl/flowblade | 995313a509b80e99eb1ad550d945bdda5995093b | flowblade-trunk/Flowblade/tlinerenderserver.py | python | abort_current_renders | () | [] | def abort_current_renders():
iface = _get_iface("abort_current_renders")
if iface != None:
iface.abort_renders() | [
"def",
"abort_current_renders",
"(",
")",
":",
"iface",
"=",
"_get_iface",
"(",
"\"abort_current_renders\"",
")",
"if",
"iface",
"!=",
"None",
":",
"iface",
".",
"abort_renders",
"(",
")"
] | https://github.com/jliljebl/flowblade/blob/995313a509b80e99eb1ad550d945bdda5995093b/flowblade-trunk/Flowblade/tlinerenderserver.py#L88-L91 | ||||
facebookresearch/UnsupervisedMT | d5f2fc29246205abd8d62a4377c2bd4c01e086b8 | PBSMT/src/dictionary.py | python | Dictionary.__len__ | (self) | return len(self.id2word) | Returns the number of words in the dictionary. | Returns the number of words in the dictionary. | [
"Returns",
"the",
"number",
"of",
"words",
"in",
"the",
"dictionary",
"."
] | def __len__(self):
"""
Returns the number of words in the dictionary.
"""
return len(self.id2word) | [
"def",
"__len__",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"id2word",
")"
] | https://github.com/facebookresearch/UnsupervisedMT/blob/d5f2fc29246205abd8d62a4377c2bd4c01e086b8/PBSMT/src/dictionary.py#L16-L20 | |
Abjad/abjad | d0646dfbe83db3dc5ab268f76a0950712b87b7fd | abjad/parsers/base.py | python | Parser.tokenize | (self, string) | Tokenize ``string`` and print results. | Tokenize ``string`` and print results. | [
"Tokenize",
"string",
"and",
"print",
"results",
"."
] | def tokenize(self, string):
"""
Tokenize ``string`` and print results.
"""
self.lexer.input(string)
for token in self.lexer:
print(token) | [
"def",
"tokenize",
"(",
"self",
",",
"string",
")",
":",
"self",
".",
"lexer",
".",
"input",
"(",
"string",
")",
"for",
"token",
"in",
"self",
".",
"lexer",
":",
"print",
"(",
"token",
")"
] | https://github.com/Abjad/abjad/blob/d0646dfbe83db3dc5ab268f76a0950712b87b7fd/abjad/parsers/base.py#L99-L105 | ||
number5/cloud-init | 19948dbaf40309355e1a2dbef116efb0ce66245c | cloudinit/config/cc_rh_subscription.py | python | SubscriptionManager.log_warn | (self, msg) | Simple wrapper for logging warning messages. Useful for unittests | Simple wrapper for logging warning messages. Useful for unittests | [
"Simple",
"wrapper",
"for",
"logging",
"warning",
"messages",
".",
"Useful",
"for",
"unittests"
] | def log_warn(self, msg):
"""Simple wrapper for logging warning messages. Useful for unittests"""
self.log.warning(msg) | [
"def",
"log_warn",
"(",
"self",
",",
"msg",
")",
":",
"self",
".",
"log",
".",
"warning",
"(",
"msg",
")"
] | https://github.com/number5/cloud-init/blob/19948dbaf40309355e1a2dbef116efb0ce66245c/cloudinit/config/cc_rh_subscription.py#L144-L146 | ||
pyglet/pyglet | 2833c1df902ca81aeeffa786c12e7e87d402434b | pyglet/shapes.py | python | Star.rotation | (self) | return self._rotation | Rotation of the star, in degrees. | Rotation of the star, in degrees. | [
"Rotation",
"of",
"the",
"star",
"in",
"degrees",
"."
] | def rotation(self):
"""Rotation of the star, in degrees.
"""
return self._rotation | [
"def",
"rotation",
"(",
"self",
")",
":",
"return",
"self",
".",
"_rotation"
] | https://github.com/pyglet/pyglet/blob/2833c1df902ca81aeeffa786c12e7e87d402434b/pyglet/shapes.py#L1435-L1438 | |
1012598167/flask_mongodb_game | 60c7e0351586656ec38f851592886338e50b4110 | python_flask/venv/Lib/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/distlib/_backport/tarfile.py | python | TarInfo.create_pax_global_header | (cls, pax_headers) | return cls._create_pax_generic_header(pax_headers, XGLTYPE, "utf8") | Return the object as a pax global header block sequence. | Return the object as a pax global header block sequence. | [
"Return",
"the",
"object",
"as",
"a",
"pax",
"global",
"header",
"block",
"sequence",
"."
] | def create_pax_global_header(cls, pax_headers):
"""Return the object as a pax global header block sequence.
"""
return cls._create_pax_generic_header(pax_headers, XGLTYPE, "utf8") | [
"def",
"create_pax_global_header",
"(",
"cls",
",",
"pax_headers",
")",
":",
"return",
"cls",
".",
"_create_pax_generic_header",
"(",
"pax_headers",
",",
"XGLTYPE",
",",
"\"utf8\"",
")"
] | https://github.com/1012598167/flask_mongodb_game/blob/60c7e0351586656ec38f851592886338e50b4110/python_flask/venv/Lib/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/distlib/_backport/tarfile.py#L1093-L1096 | |
DataDog/integrations-core | 934674b29d94b70ccc008f76ea172d0cdae05e1e | couchbase/datadog_checks/couchbase/config_models/defaults.py | python | instance_sync_gateway_url | (field, value) | return 'http://localhost:4986' | [] | def instance_sync_gateway_url(field, value):
return 'http://localhost:4986' | [
"def",
"instance_sync_gateway_url",
"(",
"field",
",",
"value",
")",
":",
"return",
"'http://localhost:4986'"
] | https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/couchbase/datadog_checks/couchbase/config_models/defaults.py#L149-L150 | |||
VivekPa/OptimalPortfolio | cb27cbc6f0832bfc531c085454afe1ca457ea95e | build/lib/optimalportfolio/utility.py | python | volatility | (weights, cov) | return portfolio_volatility | Calculate the volatility of a portfolio.
:param weights: asset weights of the portfolio
:param cov: the covariance of invariants
:return: portfolio variance
:rtype: float | Calculate the volatility of a portfolio.
:param weights: asset weights of the portfolio
:param cov: the covariance of invariants
:return: portfolio variance
:rtype: float | [
"Calculate",
"the",
"volatility",
"of",
"a",
"portfolio",
".",
":",
"param",
"weights",
":",
"asset",
"weights",
"of",
"the",
"portfolio",
":",
"param",
"cov",
":",
"the",
"covariance",
"of",
"invariants",
":",
"return",
":",
"portfolio",
"variance",
":",
... | def volatility(weights, cov):
"""
Calculate the volatility of a portfolio.
:param weights: asset weights of the portfolio
:param cov: the covariance of invariants
:return: portfolio variance
:rtype: float
"""
portfolio_volatility = np.dot(weights.T, np.dot(cov, weights))
return portf... | [
"def",
"volatility",
"(",
"weights",
",",
"cov",
")",
":",
"portfolio_volatility",
"=",
"np",
".",
"dot",
"(",
"weights",
".",
"T",
",",
"np",
".",
"dot",
"(",
"cov",
",",
"weights",
")",
")",
"return",
"portfolio_volatility"
] | https://github.com/VivekPa/OptimalPortfolio/blob/cb27cbc6f0832bfc531c085454afe1ca457ea95e/build/lib/optimalportfolio/utility.py#L46-L55 | |
abingham/traad | 770924d9df89037c9a21f1946096aec35685f73d | traad/bottle.py | python | view | (tpl_name, **defaults) | return decorator | Decorator: renders a template for a handler.
The handler can control its behavior like that:
- return a dict of template vars to fill out the template
- return something other than a dict and the view decorator will not
process the template, but return the handler result as is.
... | Decorator: renders a template for a handler.
The handler can control its behavior like that: | [
"Decorator",
":",
"renders",
"a",
"template",
"for",
"a",
"handler",
".",
"The",
"handler",
"can",
"control",
"its",
"behavior",
"like",
"that",
":"
] | def view(tpl_name, **defaults):
''' Decorator: renders a template for a handler.
The handler can control its behavior like that:
- return a dict of template vars to fill out the template
- return something other than a dict and the view decorator will not
process the templat... | [
"def",
"view",
"(",
"tpl_name",
",",
"*",
"*",
"defaults",
")",
":",
"def",
"decorator",
"(",
"func",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"func",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"result",
"="... | https://github.com/abingham/traad/blob/770924d9df89037c9a21f1946096aec35685f73d/traad/bottle.py#L3465-L3487 | |
nipy/nipy | d16d268938dcd5c15748ca051532c21f57cf8a22 | nipy/algorithms/clustering/gmm.py | python | GMM.estimate | (self, x, niter=100, delta=1.e-4, verbose=0) | return self.bic(l) | Estimation of the model given a dataset x
Parameters
----------
x array of shape (n_samples,dim)
the data from which the model is estimated
niter=100: maximal number of iterations in the estimation process
delta = 1.e-4: increment of data likelihood at which
... | Estimation of the model given a dataset x | [
"Estimation",
"of",
"the",
"model",
"given",
"a",
"dataset",
"x"
] | def estimate(self, x, niter=100, delta=1.e-4, verbose=0):
""" Estimation of the model given a dataset x
Parameters
----------
x array of shape (n_samples,dim)
the data from which the model is estimated
niter=100: maximal number of iterations in the estimation process
... | [
"def",
"estimate",
"(",
"self",
",",
"x",
",",
"niter",
"=",
"100",
",",
"delta",
"=",
"1.e-4",
",",
"verbose",
"=",
"0",
")",
":",
"# check that the data is OK",
"x",
"=",
"self",
".",
"check_x",
"(",
"x",
")",
"# alternation of E/M step until convergence",... | https://github.com/nipy/nipy/blob/d16d268938dcd5c15748ca051532c21f57cf8a22/nipy/algorithms/clustering/gmm.py#L712-L748 | |
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/importlib/metadata/_itertools.py | python | unique_everseen | (iterable, key=None) | List unique elements, preserving order. Remember all elements ever seen. | List unique elements, preserving order. Remember all elements ever seen. | [
"List",
"unique",
"elements",
"preserving",
"order",
".",
"Remember",
"all",
"elements",
"ever",
"seen",
"."
] | def unique_everseen(iterable, key=None):
"List unique elements, preserving order. Remember all elements ever seen."
# unique_everseen('AAAABBBCCDAABBB') --> A B C D
# unique_everseen('ABBCcAD', str.lower) --> A B C D
seen = set()
seen_add = seen.add
if key is None:
for element in filterf... | [
"def",
"unique_everseen",
"(",
"iterable",
",",
"key",
"=",
"None",
")",
":",
"# unique_everseen('AAAABBBCCDAABBB') --> A B C D",
"# unique_everseen('ABBCcAD', str.lower) --> A B C D",
"seen",
"=",
"set",
"(",
")",
"seen_add",
"=",
"seen",
".",
"add",
"if",
"key",
"is... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/importlib/metadata/_itertools.py#L4-L19 | ||
nathanlopez/Stitch | 8e22e91c94237959c02d521aab58dc7e3d994cea | Application/stitch_cmd.py | python | stitch_server.do_ipconfig | (self,line) | [] | def do_ipconfig(self,line):
if windows_client():
cmd = 'ipconfig {}'.format(line)
else:
cmd = 'ifconfig {}'.format(line)
st_print(run_command(cmd)) | [
"def",
"do_ipconfig",
"(",
"self",
",",
"line",
")",
":",
"if",
"windows_client",
"(",
")",
":",
"cmd",
"=",
"'ipconfig {}'",
".",
"format",
"(",
"line",
")",
"else",
":",
"cmd",
"=",
"'ifconfig {}'",
".",
"format",
"(",
"line",
")",
"st_print",
"(",
... | https://github.com/nathanlopez/Stitch/blob/8e22e91c94237959c02d521aab58dc7e3d994cea/Application/stitch_cmd.py#L200-L205 | ||||
davidoren/CuckooSploit | 3fce8183bee8f7917e08f765ce2a01c921f86354 | modules/processing/behavior.py | python | Processes.__init__ | (self, logs_path) | @param logs_path: logs path. | [] | def __init__(self, logs_path):
"""@param logs_path: logs path."""
self._logs_path = logs_path
self.cfg = Config() | [
"def",
"__init__",
"(",
"self",
",",
"logs_path",
")",
":",
"self",
".",
"_logs_path",
"=",
"logs_path",
"self",
".",
"cfg",
"=",
"Config",
"(",
")"
] | https://github.com/davidoren/CuckooSploit/blob/3fce8183bee8f7917e08f765ce2a01c921f86354/modules/processing/behavior.py#L224-L227 | |||
llSourcell/AI_Artist | 3038c06c2e389b9c919c881c9a169efe2fd7810e | lib/python2.7/site-packages/pip/_vendor/lockfile/__init__.py | python | _SharedBase.release | (self) | Release the lock.
If the file is not locked, raise NotLocked. | Release the lock. | [
"Release",
"the",
"lock",
"."
] | def release(self):
"""
Release the lock.
If the file is not locked, raise NotLocked.
"""
raise NotImplemented("implement in subclass") | [
"def",
"release",
"(",
"self",
")",
":",
"raise",
"NotImplemented",
"(",
"\"implement in subclass\"",
")"
] | https://github.com/llSourcell/AI_Artist/blob/3038c06c2e389b9c919c881c9a169efe2fd7810e/lib/python2.7/site-packages/pip/_vendor/lockfile/__init__.py#L185-L191 | ||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/requests/cookies.py | python | RequestsCookieJar.set | (self, name, value, **kwargs) | return c | Dict-like set() that also supports optional domain and path args in
order to resolve naming collisions from using one cookie jar over
multiple domains. | Dict-like set() that also supports optional domain and path args in
order to resolve naming collisions from using one cookie jar over
multiple domains. | [
"Dict",
"-",
"like",
"set",
"()",
"that",
"also",
"supports",
"optional",
"domain",
"and",
"path",
"args",
"in",
"order",
"to",
"resolve",
"naming",
"collisions",
"from",
"using",
"one",
"cookie",
"jar",
"over",
"multiple",
"domains",
"."
] | def set(self, name, value, **kwargs):
"""Dict-like set() that also supports optional domain and path args in
order to resolve naming collisions from using one cookie jar over
multiple domains.
"""
# support client code that unsets cookies by assignment of a None value:
if... | [
"def",
"set",
"(",
"self",
",",
"name",
",",
"value",
",",
"*",
"*",
"kwargs",
")",
":",
"# support client code that unsets cookies by assignment of a None value:",
"if",
"value",
"is",
"None",
":",
"remove_cookie_by_name",
"(",
"self",
",",
"name",
",",
"domain",... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/requests/cookies.py#L201-L216 | |
scikit-fuzzy/scikit-fuzzy | 92ad3c382ac19707086204ac6cdf6e81353345a7 | skfuzzy/image/arraypad.py | python | _prepend_const | (arr, pad_amt, val, axis=-1) | Prepend constant `val` along `axis` of `arr`.
Parameters
----------
arr : ndarray
Input array of arbitrary shape.
pad_amt : int
Amount of padding to prepend.
val : scalar
Constant value to use. For best results should be of type `arr.dtype`;
if not `arr.dtype` will b... | Prepend constant `val` along `axis` of `arr`. | [
"Prepend",
"constant",
"val",
"along",
"axis",
"of",
"arr",
"."
] | def _prepend_const(arr, pad_amt, val, axis=-1):
"""
Prepend constant `val` along `axis` of `arr`.
Parameters
----------
arr : ndarray
Input array of arbitrary shape.
pad_amt : int
Amount of padding to prepend.
val : scalar
Constant value to use. For best results shou... | [
"def",
"_prepend_const",
"(",
"arr",
",",
"pad_amt",
",",
"val",
",",
"axis",
"=",
"-",
"1",
")",
":",
"if",
"pad_amt",
"==",
"0",
":",
"return",
"arr",
"padshape",
"=",
"tuple",
"(",
"x",
"if",
"i",
"!=",
"axis",
"else",
"pad_amt",
"for",
"(",
"... | https://github.com/scikit-fuzzy/scikit-fuzzy/blob/92ad3c382ac19707086204ac6cdf6e81353345a7/skfuzzy/image/arraypad.py#L75-L106 | ||
RJT1990/pyflux | 297f2afc2095acd97c12e827dd500e8ea5da0c0f | pyflux/gpnarx/kernels.py | python | Periodic.Kstarstar | (self, parm, Xstar) | return Periodic_Kstarstar_matrix(Xstar, parm) | Returns K(x*, x*)
Parameters
----------
parm : np.ndarray
Parameters for the K(x*, x*)
Xstar : np.ndarray
Data for prediction
Returns
----------
- K(x*, x*) | Returns K(x*, x*) | [
"Returns",
"K",
"(",
"x",
"*",
"x",
"*",
")"
] | def Kstarstar(self, parm, Xstar):
""" Returns K(x*, x*)
Parameters
----------
parm : np.ndarray
Parameters for the K(x*, x*)
Xstar : np.ndarray
Data for prediction
Returns
----------
- K(x*, x*)
"""
return Periodi... | [
"def",
"Kstarstar",
"(",
"self",
",",
"parm",
",",
"Xstar",
")",
":",
"return",
"Periodic_Kstarstar_matrix",
"(",
"Xstar",
",",
"parm",
")"
] | https://github.com/RJT1990/pyflux/blob/297f2afc2095acd97c12e827dd500e8ea5da0c0f/pyflux/gpnarx/kernels.py#L410-L425 | |
khalim19/gimp-plugin-export-layers | b37255f2957ad322f4d332689052351cdea6e563 | export_layers/pygimplib/_lib/future/future/backports/xmlrpc/server.py | python | SimpleXMLRPCRequestHandler.decode_request_content | (self, data) | [] | def decode_request_content(self, data):
#support gzip encoding of request
encoding = self.headers.get("content-encoding", "identity").lower()
if encoding == "identity":
return data
if encoding == "gzip":
try:
return gzip_decode(data)
ex... | [
"def",
"decode_request_content",
"(",
"self",
",",
"data",
")",
":",
"#support gzip encoding of request",
"encoding",
"=",
"self",
".",
"headers",
".",
"get",
"(",
"\"content-encoding\"",
",",
"\"identity\"",
")",
".",
"lower",
"(",
")",
"if",
"encoding",
"==",
... | https://github.com/khalim19/gimp-plugin-export-layers/blob/b37255f2957ad322f4d332689052351cdea6e563/export_layers/pygimplib/_lib/future/future/backports/xmlrpc/server.py#L534-L549 | ||||
junehui/ImageProcessing | 44f5dd79a1b43d7567a97da725d5cbb15fe64771 | utils/net_compiler.py | python | Layer.__find_first_decimal__ | (self, string_phase) | A function to find series of decimal
:param string_phase: string type key like moving_average_fraction
:return: a list stores decimals found in string_phase | A function to find series of decimal
:param string_phase: string type key like moving_average_fraction
:return: a list stores decimals found in string_phase | [
"A",
"function",
"to",
"find",
"series",
"of",
"decimal",
":",
"param",
"string_phase",
":",
"string",
"type",
"key",
"like",
"moving_average_fraction",
":",
"return",
":",
"a",
"list",
"stores",
"decimals",
"found",
"in",
"string_phase"
] | def __find_first_decimal__(self, string_phase):
"""
A function to find series of decimal
:param string_phase: string type key like moving_average_fraction
:return: a list stores decimals found in string_phase
"""
decimals = ""
for index in range(len(string_phase)):
if isac(string_phase... | [
"def",
"__find_first_decimal__",
"(",
"self",
",",
"string_phase",
")",
":",
"decimals",
"=",
"\"\"",
"for",
"index",
"in",
"range",
"(",
"len",
"(",
"string_phase",
")",
")",
":",
"if",
"isac",
"(",
"string_phase",
"[",
"index",
"]",
")",
":",
"decimals... | https://github.com/junehui/ImageProcessing/blob/44f5dd79a1b43d7567a97da725d5cbb15fe64771/utils/net_compiler.py#L245-L259 | ||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/urllib/request.py | python | FancyURLopener.get_user_passwd | (self, host, realm, clear_cache=0) | return user, passwd | [] | def get_user_passwd(self, host, realm, clear_cache=0):
key = realm + '@' + host.lower()
if key in self.auth_cache:
if clear_cache:
del self.auth_cache[key]
else:
return self.auth_cache[key]
user, passwd = self.prompt_user_passwd(host, realm... | [
"def",
"get_user_passwd",
"(",
"self",
",",
"host",
",",
"realm",
",",
"clear_cache",
"=",
"0",
")",
":",
"key",
"=",
"realm",
"+",
"'@'",
"+",
"host",
".",
"lower",
"(",
")",
"if",
"key",
"in",
"self",
".",
"auth_cache",
":",
"if",
"clear_cache",
... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/urllib/request.py#L2078-L2087 | |||
maas/maas | db2f89970c640758a51247c59bf1ec6f60cf4ab5 | src/maasserver/api/machines.py | python | MachineHandler.virtualblockdevice_set | (handler, machine) | return [
block_device.actual_instance
for block_device in machine.blockdevice_set.all()
if isinstance(block_device.actual_instance, VirtualBlockDevice)
] | Use precached queries instead of attribute on the object. | Use precached queries instead of attribute on the object. | [
"Use",
"precached",
"queries",
"instead",
"of",
"attribute",
"on",
"the",
"object",
"."
] | def virtualblockdevice_set(handler, machine):
"""Use precached queries instead of attribute on the object."""
return [
block_device.actual_instance
for block_device in machine.blockdevice_set.all()
if isinstance(block_device.actual_instance, VirtualBlockDevice)
... | [
"def",
"virtualblockdevice_set",
"(",
"handler",
",",
"machine",
")",
":",
"return",
"[",
"block_device",
".",
"actual_instance",
"for",
"block_device",
"in",
"machine",
".",
"blockdevice_set",
".",
"all",
"(",
")",
"if",
"isinstance",
"(",
"block_device",
".",
... | https://github.com/maas/maas/blob/db2f89970c640758a51247c59bf1ec6f60cf4ab5/src/maasserver/api/machines.py#L438-L444 | |
niftools/blender_niftools_addon | fc28f567e1fa431ec6633cb2a138898136090b29 | io_scene_niftools/modules/nif_import/object/__init__.py | python | Object.set_object_bind | (self, b_obj, b_obj_children, b_armature) | Sets up parent-child relationships for b_obj and all its children and corrects space for children of bones | Sets up parent-child relationships for b_obj and all its children and corrects space for children of bones | [
"Sets",
"up",
"parent",
"-",
"child",
"relationships",
"for",
"b_obj",
"and",
"all",
"its",
"children",
"and",
"corrects",
"space",
"for",
"children",
"of",
"bones"
] | def set_object_bind(self, b_obj, b_obj_children, b_armature):
""" Sets up parent-child relationships for b_obj and all its children and corrects space for children of bones"""
if isinstance(b_obj, bpy.types.Object):
# simple object parentship, no space correction
for b_child in b... | [
"def",
"set_object_bind",
"(",
"self",
",",
"b_obj",
",",
"b_obj_children",
",",
"b_armature",
")",
":",
"if",
"isinstance",
"(",
"b_obj",
",",
"bpy",
".",
"types",
".",
"Object",
")",
":",
"# simple object parentship, no space correction",
"for",
"b_child",
"in... | https://github.com/niftools/blender_niftools_addon/blob/fc28f567e1fa431ec6633cb2a138898136090b29/io_scene_niftools/modules/nif_import/object/__init__.py#L88-L110 | ||
wxGlade/wxGlade | 44ed0d1cba78f27c5c0a56918112a737653b7b27 | new_properties.py | python | _CheckListProperty._tooltip_format_flags | (self, details) | return ret | Create a tooltip text for generic style flags (aka attributes). | Create a tooltip text for generic style flags (aka attributes). | [
"Create",
"a",
"tooltip",
"text",
"for",
"generic",
"style",
"flags",
"(",
"aka",
"attributes",
")",
"."
] | def _tooltip_format_flags(self, details):
"Create a tooltip text for generic style flags (aka attributes)."
ret = []
for attr_name, msg in [ ('default_style', _('This style is the default\n')),
('obsolete', _('This style is obsolete and should not be used.\nD... | [
"def",
"_tooltip_format_flags",
"(",
"self",
",",
"details",
")",
":",
"ret",
"=",
"[",
"]",
"for",
"attr_name",
",",
"msg",
"in",
"[",
"(",
"'default_style'",
",",
"_",
"(",
"'This style is the default\\n'",
")",
")",
",",
"(",
"'obsolete'",
",",
"_",
"... | https://github.com/wxGlade/wxGlade/blob/44ed0d1cba78f27c5c0a56918112a737653b7b27/new_properties.py#L1012-L1026 | |
aiven/pghoard | 1de0d2e33bf087b7ce3b6af556bbf941acfac3a4 | pghoard/rohmu/object_storage/s3.py | python | get_proxy_url | (proxy_info) | return proxy_url | [] | def get_proxy_url(proxy_info):
username = proxy_info.get("user")
password = proxy_info.get("pass")
if username and password:
auth = f"{username}:{password}@"
else:
auth = ""
host = proxy_info["host"]
port = proxy_info["port"]
if proxy_info.get("type") in {"socks5", "socks5h"}... | [
"def",
"get_proxy_url",
"(",
"proxy_info",
")",
":",
"username",
"=",
"proxy_info",
".",
"get",
"(",
"\"user\"",
")",
"password",
"=",
"proxy_info",
".",
"get",
"(",
"\"pass\"",
")",
"if",
"username",
"and",
"password",
":",
"auth",
"=",
"f\"{username}:{pass... | https://github.com/aiven/pghoard/blob/1de0d2e33bf087b7ce3b6af556bbf941acfac3a4/pghoard/rohmu/object_storage/s3.py#L26-L40 | |||
Tautulli/Tautulli | 2410eb33805aaac4bd1c5dad0f71e4f15afaf742 | lib/cherrypy/lib/xmlrpcutil.py | python | respond | (body, encoding='utf-8', allow_none=0) | Construct HTTP response body. | Construct HTTP response body. | [
"Construct",
"HTTP",
"response",
"body",
"."
] | def respond(body, encoding='utf-8', allow_none=0):
"""Construct HTTP response body."""
if not isinstance(body, XMLRPCFault):
body = (body,)
_set_response(
xmlrpc_dumps(
body, methodresponse=1,
encoding=encoding,
allow_none=allow_none
)
) | [
"def",
"respond",
"(",
"body",
",",
"encoding",
"=",
"'utf-8'",
",",
"allow_none",
"=",
"0",
")",
":",
"if",
"not",
"isinstance",
"(",
"body",
",",
"XMLRPCFault",
")",
":",
"body",
"=",
"(",
"body",
",",
")",
"_set_response",
"(",
"xmlrpc_dumps",
"(",
... | https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/cherrypy/lib/xmlrpcutil.py#L43-L54 | ||
ring04h/wyportmap | c4201e2313504e780a7f25238eba2a2d3223e739 | sqlalchemy/orm/session.py | python | sessionmaker.configure | (self, **new_kw) | (Re)configure the arguments for this sessionmaker.
e.g.::
Session = sessionmaker()
Session.configure(bind=create_engine('sqlite://')) | (Re)configure the arguments for this sessionmaker. | [
"(",
"Re",
")",
"configure",
"the",
"arguments",
"for",
"this",
"sessionmaker",
"."
] | def configure(self, **new_kw):
"""(Re)configure the arguments for this sessionmaker.
e.g.::
Session = sessionmaker()
Session.configure(bind=create_engine('sqlite://'))
"""
self.kw.update(new_kw) | [
"def",
"configure",
"(",
"self",
",",
"*",
"*",
"new_kw",
")",
":",
"self",
".",
"kw",
".",
"update",
"(",
"new_kw",
")"
] | https://github.com/ring04h/wyportmap/blob/c4201e2313504e780a7f25238eba2a2d3223e739/sqlalchemy/orm/session.py#L2362-L2371 | ||
GoogleCloudPlatform/appengine-mapreduce | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | python/src/mapreduce/third_party/crc32c.py | python | crc_update | (crc, data) | return crc ^ _MASK | Update CRC-32C checksum with data.
Args:
crc: 32-bit checksum to update as long.
data: byte array, string or iterable over bytes.
Returns:
32-bit updated CRC-32C as long. | Update CRC-32C checksum with data. | [
"Update",
"CRC",
"-",
"32C",
"checksum",
"with",
"data",
"."
] | def crc_update(crc, data):
"""Update CRC-32C checksum with data.
Args:
crc: 32-bit checksum to update as long.
data: byte array, string or iterable over bytes.
Returns:
32-bit updated CRC-32C as long.
"""
# Convert data to byte array if needed
if type(data) != array.array or data.itemsize != 1... | [
"def",
"crc_update",
"(",
"crc",
",",
"data",
")",
":",
"# Convert data to byte array if needed",
"if",
"type",
"(",
"data",
")",
"!=",
"array",
".",
"array",
"or",
"data",
".",
"itemsize",
"!=",
"1",
":",
"buf",
"=",
"array",
".",
"array",
"(",
"\"B\"",... | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/third_party/crc32c.py#L94-L114 | |
Pyomo/pyomo | dbd4faee151084f343b893cc2b0c04cf2b76fd92 | pyomo/contrib/pynumero/sparse/block_vector.py | python | BlockVector.all | (self, axis=None, out=None, keepdims=False) | return results.all(axis=axis, out=out, keepdims=keepdims) | Returns True if all elements evaluate to True. | Returns True if all elements evaluate to True. | [
"Returns",
"True",
"if",
"all",
"elements",
"evaluate",
"to",
"True",
"."
] | def all(self, axis=None, out=None, keepdims=False):
"""
Returns True if all elements evaluate to True.
"""
assert_block_structure(self)
results = np.array([self.get_block(i).all() for i in range(self.nblocks)],
dtype=np.bool)
return results.all... | [
"def",
"all",
"(",
"self",
",",
"axis",
"=",
"None",
",",
"out",
"=",
"None",
",",
"keepdims",
"=",
"False",
")",
":",
"assert_block_structure",
"(",
"self",
")",
"results",
"=",
"np",
".",
"array",
"(",
"[",
"self",
".",
"get_block",
"(",
"i",
")"... | https://github.com/Pyomo/pyomo/blob/dbd4faee151084f343b893cc2b0c04cf2b76fd92/pyomo/contrib/pynumero/sparse/block_vector.py#L344-L351 | |
Blizzard/s2protocol | 4bfe857bb832eee12cc6307dd699e3b74bd7e1b2 | s2protocol/versions/protocol77661.py | python | decode_replay_message_events | (contents) | Decodes and yields each message event from the contents byte string. | Decodes and yields each message event from the contents byte string. | [
"Decodes",
"and",
"yields",
"each",
"message",
"event",
"from",
"the",
"contents",
"byte",
"string",
"."
] | def decode_replay_message_events(contents):
"""Decodes and yields each message event from the contents byte string."""
decoder = BitPackedDecoder(contents, typeinfos)
for event in _decode_event_stream(decoder,
message_eventid_typeid,
... | [
"def",
"decode_replay_message_events",
"(",
"contents",
")",
":",
"decoder",
"=",
"BitPackedDecoder",
"(",
"contents",
",",
"typeinfos",
")",
"for",
"event",
"in",
"_decode_event_stream",
"(",
"decoder",
",",
"message_eventid_typeid",
",",
"message_event_types",
",",
... | https://github.com/Blizzard/s2protocol/blob/4bfe857bb832eee12cc6307dd699e3b74bd7e1b2/s2protocol/versions/protocol77661.py#L452-L459 | ||
graphcore/examples | 46d2b7687b829778369fc6328170a7b14761e5c6 | applications/tensorflow2/bert/data_utils/wikipedia/load_wikipedia_data.py | python | _decode_record | (record, name_to_features, data_type=None, debug=False, test=False) | return inputs, labels | Decodes a record to a TensorFlow example. In each record, the `input_ids` already have masked tokens (with
value [MASK]=103). The returned example will have labels masked with 0's for every non [MASK] token. | Decodes a record to a TensorFlow example. In each record, the `input_ids` already have masked tokens (with
value [MASK]=103). The returned example will have labels masked with 0's for every non [MASK] token. | [
"Decodes",
"a",
"record",
"to",
"a",
"TensorFlow",
"example",
".",
"In",
"each",
"record",
"the",
"input_ids",
"already",
"have",
"masked",
"tokens",
"(",
"with",
"value",
"[",
"MASK",
"]",
"=",
"103",
")",
".",
"The",
"returned",
"example",
"will",
"hav... | def _decode_record(record, name_to_features, data_type=None, debug=False, test=False):
"""
Decodes a record to a TensorFlow example. In each record, the `input_ids` already have masked tokens (with
value [MASK]=103). The returned example will have labels masked with 0's for every non [MASK] token.
"""
... | [
"def",
"_decode_record",
"(",
"record",
",",
"name_to_features",
",",
"data_type",
"=",
"None",
",",
"debug",
"=",
"False",
",",
"test",
"=",
"False",
")",
":",
"example",
"=",
"tf",
".",
"io",
".",
"parse_single_example",
"(",
"record",
",",
"name_to_feat... | https://github.com/graphcore/examples/blob/46d2b7687b829778369fc6328170a7b14761e5c6/applications/tensorflow2/bert/data_utils/wikipedia/load_wikipedia_data.py#L18-L66 | |
ifwe/digsby | f5fe00244744aa131e07f09348d10563f3d8fa99 | digsby/src/util/diagnostic.py | python | write_where_info | () | return windows_newlines(stack_info) | The CPU monitor keeps information from the where() function. | The CPU monitor keeps information from the where() function. | [
"The",
"CPU",
"monitor",
"keeps",
"information",
"from",
"the",
"where",
"()",
"function",
"."
] | def write_where_info():
'The CPU monitor keeps information from the where() function.'
stack_info = ''
# Try to use any pertinent stack information gathered by the CPU monitor first.
try:
import wx
stack_info = '\n\n'.join(wx.GetApp().cpu_watcher.stack_info)
except AttributeError:
... | [
"def",
"write_where_info",
"(",
")",
":",
"stack_info",
"=",
"''",
"# Try to use any pertinent stack information gathered by the CPU monitor first.",
"try",
":",
"import",
"wx",
"stack_info",
"=",
"'\\n\\n'",
".",
"join",
"(",
"wx",
".",
"GetApp",
"(",
")",
".",
"cp... | https://github.com/ifwe/digsby/blob/f5fe00244744aa131e07f09348d10563f3d8fa99/digsby/src/util/diagnostic.py#L790-L807 | |
wistbean/fxxkpython | 88e16d79d8dd37236ba6ecd0d0ff11d63143968c | vip/qyxuan/projects/Snake/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_internal/utils/compat.py | python | get_path_uid | (path) | return file_uid | Return path's uid.
Does not follow symlinks:
https://github.com/pypa/pip/pull/935#discussion_r5307003
Placed this function in compat due to differences on AIX and
Jython, that should eventually go away.
:raises OSError: When path is a symlink or can't be read. | Return path's uid. | [
"Return",
"path",
"s",
"uid",
"."
] | def get_path_uid(path):
# type: (str) -> int
"""
Return path's uid.
Does not follow symlinks:
https://github.com/pypa/pip/pull/935#discussion_r5307003
Placed this function in compat due to differences on AIX and
Jython, that should eventually go away.
:raises OSError: When path is... | [
"def",
"get_path_uid",
"(",
"path",
")",
":",
"# type: (str) -> int",
"if",
"hasattr",
"(",
"os",
",",
"'O_NOFOLLOW'",
")",
":",
"fd",
"=",
"os",
".",
"open",
"(",
"path",
",",
"os",
".",
"O_RDONLY",
"|",
"os",
".",
"O_NOFOLLOW",
")",
"file_uid",
"=",
... | https://github.com/wistbean/fxxkpython/blob/88e16d79d8dd37236ba6ecd0d0ff11d63143968c/vip/qyxuan/projects/Snake/venv/lib/python3.6/site-packages/pip-19.0.3-py3.6.egg/pip/_internal/utils/compat.py#L146-L173 | |
eea/odfpy | 574f0fafad73a15a5b11b115d94821623274b4b0 | odf/attrconverters.py | python | cnv_family | (attribute, arg, element) | return str(arg) | A style family | A style family | [
"A",
"style",
"family"
] | def cnv_family(attribute, arg, element):
""" A style family """
if str(arg) not in ("text", "paragraph", "section", "ruby", "table", "table-column", "table-row", "table-cell",
"graphic", "presentation", "drawing-page", "chart"):
raise ValueError( "'%s' not allowed" % str(arg))
return str(arg) | [
"def",
"cnv_family",
"(",
"attribute",
",",
"arg",
",",
"element",
")",
":",
"if",
"str",
"(",
"arg",
")",
"not",
"in",
"(",
"\"text\"",
",",
"\"paragraph\"",
",",
"\"section\"",
",",
"\"ruby\"",
",",
"\"table\"",
",",
"\"table-column\"",
",",
"\"table-row... | https://github.com/eea/odfpy/blob/574f0fafad73a15a5b11b115d94821623274b4b0/odf/attrconverters.py#L96-L101 | |
mne-tools/mne-python | f90b303ce66a8415e64edd4605b09ac0179c1ebf | mne/io/meas_info.py | python | Info.__repr__ | (self) | return st | Summarize info instead of printing all. | Summarize info instead of printing all. | [
"Summarize",
"info",
"instead",
"of",
"printing",
"all",
"."
] | def __repr__(self):
"""Summarize info instead of printing all."""
MAX_WIDTH = 68
strs = ['<Info | %s non-empty values']
non_empty = 0
titles = _handle_default('titles')
for k, v in self.items():
if k == 'ch_names':
if v:
ent... | [
"def",
"__repr__",
"(",
"self",
")",
":",
"MAX_WIDTH",
"=",
"68",
"strs",
"=",
"[",
"'<Info | %s non-empty values'",
"]",
"non_empty",
"=",
"0",
"titles",
"=",
"_handle_default",
"(",
"'titles'",
")",
"for",
"k",
",",
"v",
"in",
"self",
".",
"items",
"("... | https://github.com/mne-tools/mne-python/blob/f90b303ce66a8415e64edd4605b09ac0179c1ebf/mne/io/meas_info.py#L825-L910 | |
nsacyber/WALKOFF | 52d3311abe99d64cd2a902eb998c5e398efe0e07 | common/walkoff_client/walkoff_client/api/workflow_queue_api.py | python | WorkflowQueueApi.control_workflow_with_http_info | (self, execution, control_workflow, **kwargs) | return self.api_client.call_api(
'/workflowqueue/{execution}', 'PATCH',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=None, # noqa: E501
... | Abort or trigger a workflow # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.control_workflow_with_http_info(execution, control_workflow, async_req=True)
>>> result = thread.get()
... | Abort or trigger a workflow # noqa: E501 | [
"Abort",
"or",
"trigger",
"a",
"workflow",
"#",
"noqa",
":",
"E501"
] | def control_workflow_with_http_info(self, execution, control_workflow, **kwargs): # noqa: E501
"""Abort or trigger a workflow # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.control... | [
"def",
"control_workflow_with_http_info",
"(",
"self",
",",
"execution",
",",
"control_workflow",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"local_var_params",
"=",
"locals",
"(",
")",
"all_params",
"=",
"[",
"'execution'",
",",
"'control_workflow'",
"]",... | https://github.com/nsacyber/WALKOFF/blob/52d3311abe99d64cd2a902eb998c5e398efe0e07/common/walkoff_client/walkoff_client/api/workflow_queue_api.py#L167-L258 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/upcloud/config_flow.py | python | UpCloudConfigFlow._async_show_form | (
self,
step_id: str,
user_input: dict[str, Any] | None = None,
errors: dict[str, str] | None = None,
) | return self.async_show_form(
step_id=step_id,
data_schema=vol.Schema(
{
vol.Required(
CONF_USERNAME, default=user_input.get(CONF_USERNAME, "")
): str,
vol.Required(
CONF_PA... | Show our form. | Show our form. | [
"Show",
"our",
"form",
"."
] | def _async_show_form(
self,
step_id: str,
user_input: dict[str, Any] | None = None,
errors: dict[str, str] | None = None,
) -> FlowResult:
"""Show our form."""
if user_input is None:
user_input = {}
return self.async_show_form(
step_id=... | [
"def",
"_async_show_form",
"(",
"self",
",",
"step_id",
":",
"str",
",",
"user_input",
":",
"dict",
"[",
"str",
",",
"Any",
"]",
"|",
"None",
"=",
"None",
",",
"errors",
":",
"dict",
"[",
"str",
",",
"str",
"]",
"|",
"None",
"=",
"None",
",",
")"... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/upcloud/config_flow.py#L61-L83 | |
dask/distributed | 7ebeda4925bccbd42d2cc6915eaa1cfb37e7192e | distributed/stealing.py | python | _can_steal | (thief, ts, victim) | return True | Determine whether worker ``thief`` can steal task ``ts`` from worker
``victim``.
Assumes that `ts` has some restrictions. | Determine whether worker ``thief`` can steal task ``ts`` from worker
``victim``. | [
"Determine",
"whether",
"worker",
"thief",
"can",
"steal",
"task",
"ts",
"from",
"worker",
"victim",
"."
] | def _can_steal(thief, ts, victim):
"""Determine whether worker ``thief`` can steal task ``ts`` from worker
``victim``.
Assumes that `ts` has some restrictions.
"""
if (
ts.host_restrictions
and get_address_host(thief.address) not in ts.host_restrictions
):
return False
... | [
"def",
"_can_steal",
"(",
"thief",
",",
"ts",
",",
"victim",
")",
":",
"if",
"(",
"ts",
".",
"host_restrictions",
"and",
"get_address_host",
"(",
"thief",
".",
"address",
")",
"not",
"in",
"ts",
".",
"host_restrictions",
")",
":",
"return",
"False",
"eli... | https://github.com/dask/distributed/blob/7ebeda4925bccbd42d2cc6915eaa1cfb37e7192e/distributed/stealing.py#L518-L543 | |
tslearn-team/tslearn | 6c93071b385a89112b82799ae5870daeca1ab88b | tslearn/metrics/dtw_variants.py | python | dtw_subsequence_path | (subseq, longseq) | return path, numpy.sqrt(acc_cost_mat[-1, :][global_optimal_match]) | r"""Compute sub-sequence Dynamic Time Warping (DTW) similarity measure
between a (possibly multidimensional) query and a long time series and
return both the path and the similarity.
DTW is computed as the Euclidean distance between aligned time series,
i.e., if :math:`\pi` is the alignment path:
... | r"""Compute sub-sequence Dynamic Time Warping (DTW) similarity measure
between a (possibly multidimensional) query and a long time series and
return both the path and the similarity. | [
"r",
"Compute",
"sub",
"-",
"sequence",
"Dynamic",
"Time",
"Warping",
"(",
"DTW",
")",
"similarity",
"measure",
"between",
"a",
"(",
"possibly",
"multidimensional",
")",
"query",
"and",
"a",
"long",
"time",
"series",
"and",
"return",
"both",
"the",
"path",
... | def dtw_subsequence_path(subseq, longseq):
r"""Compute sub-sequence Dynamic Time Warping (DTW) similarity measure
between a (possibly multidimensional) query and a long time series and
return both the path and the similarity.
DTW is computed as the Euclidean distance between aligned time series,
i.... | [
"def",
"dtw_subsequence_path",
"(",
"subseq",
",",
"longseq",
")",
":",
"subseq",
"=",
"to_time_series",
"(",
"subseq",
")",
"longseq",
"=",
"to_time_series",
"(",
"longseq",
")",
"acc_cost_mat",
"=",
"subsequence_cost_matrix",
"(",
"subseq",
"=",
"subseq",
",",... | https://github.com/tslearn-team/tslearn/blob/6c93071b385a89112b82799ae5870daeca1ab88b/tslearn/metrics/dtw_variants.py#L860-L917 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage_setup/autogen/interpreters/memory.py | python | MemoryChunk.declare_class_members | (self) | return self.storage_type.declare_chunk_class_members(self.name) | r"""
Return a string giving the declarations of the class members
in a wrapper class for this memory chunk.
EXAMPLES::
sage: from sage_setup.autogen.interpreters import *
sage: mc = MemoryChunkArguments('args', ty_mpfr)
sage: mc.declare_class_members()
... | r"""
Return a string giving the declarations of the class members
in a wrapper class for this memory chunk. | [
"r",
"Return",
"a",
"string",
"giving",
"the",
"declarations",
"of",
"the",
"class",
"members",
"in",
"a",
"wrapper",
"class",
"for",
"this",
"memory",
"chunk",
"."
] | def declare_class_members(self):
r"""
Return a string giving the declarations of the class members
in a wrapper class for this memory chunk.
EXAMPLES::
sage: from sage_setup.autogen.interpreters import *
sage: mc = MemoryChunkArguments('args', ty_mpfr)
... | [
"def",
"declare_class_members",
"(",
"self",
")",
":",
"return",
"self",
".",
"storage_type",
".",
"declare_chunk_class_members",
"(",
"self",
".",
"name",
")"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage_setup/autogen/interpreters/memory.py#L100-L112 | |
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/combinatorics/graycode.py | python | gray_to_bin | (bin_list) | return ''.join(b) | Convert from Gray coding to binary coding.
We assume big endian encoding.
Examples
========
>>> from sympy.combinatorics.graycode import gray_to_bin
>>> gray_to_bin('100')
'111'
See Also
========
bin_to_gray | Convert from Gray coding to binary coding. | [
"Convert",
"from",
"Gray",
"coding",
"to",
"binary",
"coding",
"."
] | def gray_to_bin(bin_list):
"""
Convert from Gray coding to binary coding.
We assume big endian encoding.
Examples
========
>>> from sympy.combinatorics.graycode import gray_to_bin
>>> gray_to_bin('100')
'111'
See Also
========
bin_to_gray
"""
b = [bin_list[0]]
... | [
"def",
"gray_to_bin",
"(",
"bin_list",
")",
":",
"b",
"=",
"[",
"bin_list",
"[",
"0",
"]",
"]",
"for",
"i",
"in",
"xrange",
"(",
"1",
",",
"len",
"(",
"bin_list",
")",
")",
":",
"b",
"+=",
"str",
"(",
"int",
"(",
"b",
"[",
"i",
"-",
"1",
"]... | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/sympy/combinatorics/graycode.py#L323-L343 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.