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
x0rz/EQGRP_Lost_in_Translation
6692b1486f562f027567a49523b8c151a4050988
windows/fuzzbunch/pyreadline/console/ironpython_console.py
python
Console.pos
(self, x=None, y=None)
return x,y
Move or query the window cursor.
Move or query the window cursor.
[ "Move", "or", "query", "the", "window", "cursor", "." ]
def pos(self, x=None, y=None): '''Move or query the window cursor.''' if x is not None: System.Console.CursorLeft=x else: x=System.Console.CursorLeft if y is not None: System.Console.CursorTop=y else: y=System.Console.CursorTop ...
[ "def", "pos", "(", "self", ",", "x", "=", "None", ",", "y", "=", "None", ")", ":", "if", "x", "is", "not", "None", ":", "System", ".", "Console", ".", "CursorLeft", "=", "x", "else", ":", "x", "=", "System", ".", "Console", ".", "CursorLeft", "...
https://github.com/x0rz/EQGRP_Lost_in_Translation/blob/6692b1486f562f027567a49523b8c151a4050988/windows/fuzzbunch/pyreadline/console/ironpython_console.py#L105-L115
twisted/klein
365f033010b76c6a060531d0abcd4146c726918f
src/klein/_plating.py
python
PlatedElement.lookupRenderMethod
(self, name)
@return: a renderer.
[]
def lookupRenderMethod(self, name): """ @return: a renderer. """ if name in self._renderers: wrapped = self._renderers[name] @modified("plated render wrapper", wrapped) def renderWrapper( request: IRequest, tag: Tag, *args: Any, **kw: ...
[ "def", "lookupRenderMethod", "(", "self", ",", "name", ")", ":", "if", "name", "in", "self", ".", "_renderers", ":", "wrapped", "=", "self", ".", "_renderers", "[", "name", "]", "@", "modified", "(", "\"plated render wrapper\"", ",", "wrapped", ")", "def",...
https://github.com/twisted/klein/blob/365f033010b76c6a060531d0abcd4146c726918f/src/klein/_plating.py#L162-L192
haiwen/seahub
e92fcd44e3e46260597d8faa9347cb8222b8b10d
seahub/api2/models.py
python
TokenV2.save
(self, *args, **kwargs)
return super(TokenV2, self).save(*args, **kwargs)
[]
def save(self, *args, **kwargs): if not self.key: self.key = self.generate_key() return super(TokenV2, self).save(*args, **kwargs)
[ "def", "save", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "key", ":", "self", ".", "key", "=", "self", ".", "generate_key", "(", ")", "return", "super", "(", "TokenV2", ",", "self", ")", ".", "sa...
https://github.com/haiwen/seahub/blob/e92fcd44e3e46260597d8faa9347cb8222b8b10d/seahub/api2/models.py#L193-L196
achael/eht-imaging
bbd3aeb06bef52bf89fa1c06de71e5509a5b0015
ehtim/imager.py
python
Imager.out_last
(self)
return self._out_list[-1]
Return last result.
Return last result.
[ "Return", "last", "result", "." ]
def out_last(self): """Return last result. """ if self.nruns == 0: print("No imager runs yet!") return return self._out_list[-1]
[ "def", "out_last", "(", "self", ")", ":", "if", "self", ".", "nruns", "==", "0", ":", "print", "(", "\"No imager runs yet!\"", ")", "return", "return", "self", ".", "_out_list", "[", "-", "1", "]" ]
https://github.com/achael/eht-imaging/blob/bbd3aeb06bef52bf89fa1c06de71e5509a5b0015/ehtim/imager.py#L693-L699
hakril/PythonForWindows
61e027a678d5b87aa64fcf8a37a6661a86236589
windows/winproxy/apis/advapi32.py
python
ConvertSecurityDescriptorToStringSecurityDescriptorW
(SecurityDescriptor, RequestedStringSDRevision, SecurityInformation, StringSecurityDescriptor, StringSecurityDescriptorLen)
return ConvertSecurityDescriptorToStringSecurityDescriptorW.ctypes_function(SecurityDescriptor, RequestedStringSDRevision, SecurityInformation, StringSecurityDescriptor, StringSecurityDescriptorLen)
[]
def ConvertSecurityDescriptorToStringSecurityDescriptorW(SecurityDescriptor, RequestedStringSDRevision, SecurityInformation, StringSecurityDescriptor, StringSecurityDescriptorLen): return ConvertSecurityDescriptorToStringSecurityDescriptorW.ctypes_function(SecurityDescriptor, RequestedStringSDRevision, SecurityInfor...
[ "def", "ConvertSecurityDescriptorToStringSecurityDescriptorW", "(", "SecurityDescriptor", ",", "RequestedStringSDRevision", ",", "SecurityInformation", ",", "StringSecurityDescriptor", ",", "StringSecurityDescriptorLen", ")", ":", "return", "ConvertSecurityDescriptorToStringSecurityDes...
https://github.com/hakril/PythonForWindows/blob/61e027a678d5b87aa64fcf8a37a6661a86236589/windows/winproxy/apis/advapi32.py#L216-L217
realpython/book2-exercises
cde325eac8e6d8cff2316601c2e5b36bb46af7d0
web2py/venv/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py
python
TarIter.__iter__
(self)
return self
Return iterator object.
Return iterator object.
[ "Return", "iterator", "object", "." ]
def __iter__(self): """Return iterator object. """ return self
[ "def", "__iter__", "(", "self", ")", ":", "return", "self" ]
https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/web2py/venv/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py#L2565-L2568
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/min/_pydecimal.py
python
Decimal._check_nans
(self, other=None, context=None)
return 0
Returns whether the number is not actually one. if self, other are sNaN, signal if self, other are NaN return nan return 0 Done before operations.
Returns whether the number is not actually one.
[ "Returns", "whether", "the", "number", "is", "not", "actually", "one", "." ]
def _check_nans(self, other=None, context=None): """Returns whether the number is not actually one. if self, other are sNaN, signal if self, other are NaN return nan return 0 Done before operations. """ self_is_nan = self._isnan() if other is None: ...
[ "def", "_check_nans", "(", "self", ",", "other", "=", "None", ",", "context", "=", "None", ")", ":", "self_is_nan", "=", "self", ".", "_isnan", "(", ")", "if", "other", "is", "None", ":", "other_is_nan", "=", "False", "else", ":", "other_is_nan", "=", ...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/min/_pydecimal.py#L745-L775
TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials
5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e
deep-learning/fastai-docs/fastai_docs-master/dev_nb/nb_004b.py
python
to_fp16
(learn:Learner, loss_scale:float=512., flat_master:bool=False)
return learn
Transforms the learner in FP16 precision
Transforms the learner in FP16 precision
[ "Transforms", "the", "learner", "in", "FP16", "precision" ]
def to_fp16(learn:Learner, loss_scale:float=512., flat_master:bool=False)->Learner: "Transforms the learner in FP16 precision" learn.model = model2half(learn.model) learn.mp_cb = MixedPrecision(learn, loss_scale=loss_scale, flat_master=flat_master) learn.callbacks.append(learn.mp_cb) return learn
[ "def", "to_fp16", "(", "learn", ":", "Learner", ",", "loss_scale", ":", "float", "=", "512.", ",", "flat_master", ":", "bool", "=", "False", ")", "->", "Learner", ":", "learn", ".", "model", "=", "model2half", "(", "learn", ".", "model", ")", "learn", ...
https://github.com/TarrySingh/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials/blob/5bb97d7e3ffd913abddb4cfa7d78a1b4c868890e/deep-learning/fastai-docs/fastai_docs-master/dev_nb/nb_004b.py#L134-L139
leo-editor/leo-editor
383d6776d135ef17d73d935a2f0ecb3ac0e99494
leo/plugins/obsolete/wxGui.py
python
wxLeoTree.item2vnode
(self,item)
Override baseNativeTreeWidget.item2vnode.
Override baseNativeTreeWidget.item2vnode.
[ "Override", "baseNativeTreeWidget", ".", "item2vnode", "." ]
def item2vnode (self,item): '''Override baseNativeTreeWidget.item2vnode.''' w = self.treeWidget if item and item.IsOk(): v = self.getItemData(item) return v else: return None
[ "def", "item2vnode", "(", "self", ",", "item", ")", ":", "w", "=", "self", ".", "treeWidget", "if", "item", "and", "item", ".", "IsOk", "(", ")", ":", "v", "=", "self", ".", "getItemData", "(", "item", ")", "return", "v", "else", ":", "return", "...
https://github.com/leo-editor/leo-editor/blob/383d6776d135ef17d73d935a2f0ecb3ac0e99494/leo/plugins/obsolete/wxGui.py#L4166-L4176
holoviz/hvplot
25f3285c8ac315e96929b57504e4674d40b947b5
hvplot/interactive.py
python
Interactive.eval
(self)
return obj
Returns the currrent state of the interactive expression. The returned object is no longer interactive.
Returns the currrent state of the interactive expression. The returned object is no longer interactive.
[ "Returns", "the", "currrent", "state", "of", "the", "interactive", "expression", ".", "The", "returned", "object", "is", "no", "longer", "interactive", "." ]
def eval(self): """ Returns the currrent state of the interactive expression. The returned object is no longer interactive. """ obj = self._current if self._method: return getattr(obj, self._method, obj) return obj
[ "def", "eval", "(", "self", ")", ":", "obj", "=", "self", ".", "_current", "if", "self", ".", "_method", ":", "return", "getattr", "(", "obj", ",", "self", ".", "_method", ",", "obj", ")", "return", "obj" ]
https://github.com/holoviz/hvplot/blob/25f3285c8ac315e96929b57504e4674d40b947b5/hvplot/interactive.py#L370-L378
numenta/numenta-apps
02903b0062c89c2c259b533eea2df6e8bb44eaf3
taurus_metric_collectors/taurus_metric_collectors/common_services/metric_maintenance_agent.py
python
_purgeDeprecatedCompanies
()
Purge cached data and Taurus Engine metrics/models corresponding to symbols that are in xignite_security table, but not in metrics configuration.
Purge cached data and Taurus Engine metrics/models corresponding to symbols that are in xignite_security table, but not in metrics configuration.
[ "Purge", "cached", "data", "and", "Taurus", "Engine", "metrics", "/", "models", "corresponding", "to", "symbols", "that", "are", "in", "xignite_security", "table", "but", "not", "in", "metrics", "configuration", "." ]
def _purgeDeprecatedCompanies(): """Purge cached data and Taurus Engine metrics/models corresponding to symbols that are in xignite_security table, but not in metrics configuration. """ activeCompanySymbols = set(security[0] for security in metric_utils.getAllMetricSecurities()) ...
[ "def", "_purgeDeprecatedCompanies", "(", ")", ":", "activeCompanySymbols", "=", "set", "(", "security", "[", "0", "]", "for", "security", "in", "metric_utils", ".", "getAllMetricSecurities", "(", ")", ")", "deprecatedSymbols", "=", "set", "(", "_queryCachedCompany...
https://github.com/numenta/numenta-apps/blob/02903b0062c89c2c259b533eea2df6e8bb44eaf3/taurus_metric_collectors/taurus_metric_collectors/common_services/metric_maintenance_agent.py#L122-L138
cloudant/bigcouch
8e9c1ec0ed1676ff152f10658f5c83a1a91fa8fe
couchjs/scons/scons-time.py
python
SConsTimer.doc_to_help
(self, obj)
return self.outdent(doc)
Translates an object's __doc__ string into help text. This strips a consistent number of spaces from each line in the help text, essentially "outdenting" the text to the left-most column.
Translates an object's __doc__ string into help text.
[ "Translates", "an", "object", "s", "__doc__", "string", "into", "help", "text", "." ]
def doc_to_help(self, obj): """ Translates an object's __doc__ string into help text. This strips a consistent number of spaces from each line in the help text, essentially "outdenting" the text to the left-most column. """ doc = obj.__doc__ if doc is Non...
[ "def", "doc_to_help", "(", "self", ",", "obj", ")", ":", "doc", "=", "obj", ".", "__doc__", "if", "doc", "is", "None", ":", "return", "''", "return", "self", ".", "outdent", "(", "doc", ")" ]
https://github.com/cloudant/bigcouch/blob/8e9c1ec0ed1676ff152f10658f5c83a1a91fa8fe/couchjs/scons/scons-time.py#L576-L587
edisonlz/fastor
342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3
base/site-packages/redis_model/models/base.py
python
ModelBase._initialize_attributes
(self,model_class, name, bases, attrs)
Initialize the attributes of the model. param: model_class:object name:string bases:base model attrs:attribute
Initialize the attributes of the model. param: model_class:object name:string bases:base model attrs:attribute
[ "Initialize", "the", "attributes", "of", "the", "model", ".", "param", ":", "model_class", ":", "object", "name", ":", "string", "bases", ":", "base", "model", "attrs", ":", "attribute" ]
def _initialize_attributes(self,model_class, name, bases, attrs): """ Initialize the attributes of the model. param: model_class:object name:string bases:base model attrs:attribute """ #主要功能:添加属性列表 model_class.attributes = {...
[ "def", "_initialize_attributes", "(", "self", ",", "model_class", ",", "name", ",", "bases", ",", "attrs", ")", ":", "#主要功能:添加属性列表", "model_class", ".", "attributes", "=", "{", "}", "for", "k", ",", "v", "in", "attrs", ".", "iteritems", "(", ")", ":", ...
https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/redis_model/models/base.py#L56-L70
pytorch/translate
564d011b10b4cef4e110c092c2912277ed64c713
pytorch_translate/transformer_aan.py
python
TransformerAANDecoder.max_positions
(self)
return min(self.max_target_positions, self.embed_positions.max_positions)
Maximum output length supported by the decoder.
Maximum output length supported by the decoder.
[ "Maximum", "output", "length", "supported", "by", "the", "decoder", "." ]
def max_positions(self): """Maximum output length supported by the decoder.""" if self.embed_positions is None: return self.max_target_positions return min(self.max_target_positions, self.embed_positions.max_positions)
[ "def", "max_positions", "(", "self", ")", ":", "if", "self", ".", "embed_positions", "is", "None", ":", "return", "self", ".", "max_target_positions", "return", "min", "(", "self", ".", "max_target_positions", ",", "self", ".", "embed_positions", ".", "max_pos...
https://github.com/pytorch/translate/blob/564d011b10b4cef4e110c092c2912277ed64c713/pytorch_translate/transformer_aan.py#L494-L498
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/coding/relative_finite_field_extension.py
python
RelativeFiniteFieldExtension._latex_
(self)
return "\\textnormal{Relative field extension between %s and %s}" % (self.absolute_field()._latex_(), self.relative_field()._latex_())
r""" Returns a latex representation of ``self``. EXAMPLES:: sage: from sage.coding.relative_finite_field_extension import * sage: Fqm.<aa> = GF(16) sage: Fq.<a> = GF(4) sage: latex(RelativeFiniteFieldExtension(Fqm, Fq)) \textnormal{Relative f...
r""" Returns a latex representation of ``self``.
[ "r", "Returns", "a", "latex", "representation", "of", "self", "." ]
def _latex_(self): r""" Returns a latex representation of ``self``. EXAMPLES:: sage: from sage.coding.relative_finite_field_extension import * sage: Fqm.<aa> = GF(16) sage: Fq.<a> = GF(4) sage: latex(RelativeFiniteFieldExtension(Fqm, Fq)) ...
[ "def", "_latex_", "(", "self", ")", ":", "return", "\"\\\\textnormal{Relative field extension between %s and %s}\"", "%", "(", "self", ".", "absolute_field", "(", ")", ".", "_latex_", "(", ")", ",", "self", ".", "relative_field", "(", ")", ".", "_latex_", "(", ...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/coding/relative_finite_field_extension.py#L153-L166
thaines/helit
04bd36ee0fb6b762c63d746e2cd8813641dceda9
handwriting/corpus/extract_text.py
python
each_prefixed_paragraph
(lines, attribution, prefix)
Same as each_named_paragraph, but where each title has a prefix.
Same as each_named_paragraph, but where each title has a prefix.
[ "Same", "as", "each_named_paragraph", "but", "where", "each", "title", "has", "a", "prefix", "." ]
def each_prefixed_paragraph(lines, attribution, prefix): """Same as each_named_paragraph, but where each title has a prefix.""" buf = [] title = 'Unknown' for line in lines: line = line.strip() line = line.replace('_','') if has_letters(line): buf.append(line) elif len(buf)!=0:...
[ "def", "each_prefixed_paragraph", "(", "lines", ",", "attribution", ",", "prefix", ")", ":", "buf", "=", "[", "]", "title", "=", "'Unknown'", "for", "line", "in", "lines", ":", "line", "=", "line", ".", "strip", "(", ")", "line", "=", "line", ".", "r...
https://github.com/thaines/helit/blob/04bd36ee0fb6b762c63d746e2cd8813641dceda9/handwriting/corpus/extract_text.py#L140-L163
hack12306/12306-booking
726c830c2e771d5cd8e09772e7646e480dddb086
booking/remind.py
python
remind_left_ticket
()
有票提醒
有票提醒
[ "有票提醒" ]
def remind_left_ticket(): """ 有票提醒 """ cmd = 'open %s --hide --background' % settings.TRAIN_AUDIO_FILE os.system(cmd)
[ "def", "remind_left_ticket", "(", ")", ":", "cmd", "=", "'open %s --hide --background'", "%", "settings", ".", "TRAIN_AUDIO_FILE", "os", ".", "system", "(", "cmd", ")" ]
https://github.com/hack12306/12306-booking/blob/726c830c2e771d5cd8e09772e7646e480dddb086/booking/remind.py#L14-L19
realpython/book2-exercises
cde325eac8e6d8cff2316601c2e5b36bb46af7d0
web2py/venv/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py
python
ssl_wrap_socket
(sock, keyfile=None, certfile=None, cert_reqs=None, ca_certs=None, server_hostname=None, ssl_version=None, ciphers=None, ssl_context=None, ca_cert_dir=None)
return context.wrap_socket(sock)
All arguments except for server_hostname, ssl_context, and ca_cert_dir have the same meaning as they do when using :func:`ssl.wrap_socket`. :param server_hostname: When SNI is supported, the expected hostname of the certificate :param ssl_context: A pre-made :class:`SSLContext` object. If n...
All arguments except for server_hostname, ssl_context, and ca_cert_dir have the same meaning as they do when using :func:`ssl.wrap_socket`.
[ "All", "arguments", "except", "for", "server_hostname", "ssl_context", "and", "ca_cert_dir", "have", "the", "same", "meaning", "as", "they", "do", "when", "using", ":", "func", ":", "ssl", ".", "wrap_socket", "." ]
def ssl_wrap_socket(sock, keyfile=None, certfile=None, cert_reqs=None, ca_certs=None, server_hostname=None, ssl_version=None, ciphers=None, ssl_context=None, ca_cert_dir=None): """ All arguments except for server_hostname, ssl_context, and ca_cert_dir ...
[ "def", "ssl_wrap_socket", "(", "sock", ",", "keyfile", "=", "None", ",", "certfile", "=", "None", ",", "cert_reqs", "=", "None", ",", "ca_certs", "=", "None", ",", "server_hostname", "=", "None", ",", "ssl_version", "=", "None", ",", "ciphers", "=", "Non...
https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/web2py/venv/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py#L267-L320
wrye-bash/wrye-bash
d495c47cfdb44475befa523438a40c4419cb386f
Mopy/bash/basher/files_links.py
python
File_Redate._perform_refresh
(self)
Refreshes the data store -
Refreshes the data store -
[ "Refreshes", "the", "data", "store", "-" ]
def _perform_refresh(self): """Refreshes the data store - """ self.window.data_store.refresh(refresh_infos=False)
[ "def", "_perform_refresh", "(", "self", ")", ":", "self", ".", "window", ".", "data_store", ".", "refresh", "(", "refresh_infos", "=", "False", ")" ]
https://github.com/wrye-bash/wrye-bash/blob/d495c47cfdb44475befa523438a40c4419cb386f/Mopy/bash/basher/files_links.py#L345-L347
igraph/python-igraph
e9f83e8af08f24ea025596e745917197d8b44d94
src/igraph/statistics.py
python
RunningMean.mean
(self)
return self._mean
Returns the current mean
Returns the current mean
[ "Returns", "the", "current", "mean" ]
def mean(self): """Returns the current mean""" return self._mean
[ "def", "mean", "(", "self", ")", ":", "return", "self", ".", "_mean" ]
https://github.com/igraph/python-igraph/blob/e9f83e8af08f24ea025596e745917197d8b44d94/src/igraph/statistics.py#L423-L425
yhlleo/tensorflow.cifar10
cd950323e7157e30391c123b665804b6276e38a6
cifar10.py
python
loss
(logits, labels)
return tf.add_n(tf.get_collection('losses'), name='total_loss')
Add L2Loss to all the trainable variables. Add summary for for "Loss" and "Loss/avg". Args: logits: Logits from inference(). labels: Labels from distorted_inputs or inputs(). 1-D tensor of shape [batch_size] Returns: Loss tensor of type float.
Add L2Loss to all the trainable variables.
[ "Add", "L2Loss", "to", "all", "the", "trainable", "variables", "." ]
def loss(logits, labels): """Add L2Loss to all the trainable variables. Add summary for for "Loss" and "Loss/avg". Args: logits: Logits from inference(). labels: Labels from distorted_inputs or inputs(). 1-D tensor of shape [batch_size] Returns: Loss tensor of type float. """ # Res...
[ "def", "loss", "(", "logits", ",", "labels", ")", ":", "# Reshape the labels into a dense Tensor of", "# shape [batch_size, NUM_CLASSES].", "sparse_labels", "=", "tf", ".", "reshape", "(", "labels", ",", "[", "FLAGS", ".", "batch_size", ",", "1", "]", ")", "# indi...
https://github.com/yhlleo/tensorflow.cifar10/blob/cd950323e7157e30391c123b665804b6276e38a6/cifar10.py#L257-L287
robinhood/faust
01b4c0ad8390221db71751d80001b0fd879291e2
faust/channels.py
python
get_topic_name
(self)
Get the topic name, or raise if this is not a named channel.
Get the topic name, or raise if this is not a named channel.
[ "Get", "the", "topic", "name", "or", "raise", "if", "this", "is", "not", "a", "named", "channel", "." ]
def get_topic_name(self) -> str: """Get the topic name, or raise if this is not a named channel.""" raise NotImplementedError('Channels are unnamed topics')
[ "def", "get_topic_name", "(", "self", ")", "->", "str", ":", "raise", "NotImplementedError", "(", "'Channels are unnamed topics'", ")" ]
https://github.com/robinhood/faust/blob/01b4c0ad8390221db71751d80001b0fd879291e2/faust/channels.py#L191-L193
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/sympy/solvers/ode.py
python
_nonlinear_3eq_order1_type1
(x, y, z, t, eq)
return [sol1, sol2, sol3]
r""" Equations: .. math:: a x' = (b - c) y z, \enspace b y' = (c - a) z x, \enspace c z' = (a - b) x y First Integrals: .. math:: a x^{2} + b y^{2} + c z^{2} = C_1 .. math:: a^{2} x^{2} + b^{2} y^{2} + c^{2} z^{2} = C_2 where `C_1` and `C_2` are arbitrary constants. On solving the integrals...
r""" Equations:
[ "r", "Equations", ":" ]
def _nonlinear_3eq_order1_type1(x, y, z, t, eq): r""" Equations: .. math:: a x' = (b - c) y z, \enspace b y' = (c - a) z x, \enspace c z' = (a - b) x y First Integrals: .. math:: a x^{2} + b y^{2} + c z^{2} = C_1 .. math:: a^{2} x^{2} + b^{2} y^{2} + c^{2} z^{2} = C_2 where `C_1` and `C...
[ "def", "_nonlinear_3eq_order1_type1", "(", "x", ",", "y", ",", "z", ",", "t", ",", "eq", ")", ":", "C1", ",", "C2", "=", "get_numbered_constants", "(", "eq", ",", "num", "=", "2", ")", "u", ",", "v", ",", "w", "=", "symbols", "(", "'u, v, w'", ")...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/sympy/solvers/ode.py#L9025-L9072
JinnLynn/alfred-workflows
1fc663b00f56b4dc3f9fa2212a8600e6da616fc1
lib/six/__init__.py
python
with_metaclass
(meta, base=object)
return meta("NewBase", (base,), {})
Create a base class with a metaclass.
Create a base class with a metaclass.
[ "Create", "a", "base", "class", "with", "a", "metaclass", "." ]
def with_metaclass(meta, base=object): """Create a base class with a metaclass.""" return meta("NewBase", (base,), {})
[ "def", "with_metaclass", "(", "meta", ",", "base", "=", "object", ")", ":", "return", "meta", "(", "\"NewBase\"", ",", "(", "base", ",", ")", ",", "{", "}", ")" ]
https://github.com/JinnLynn/alfred-workflows/blob/1fc663b00f56b4dc3f9fa2212a8600e6da616fc1/lib/six/__init__.py#L402-L404
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/PIL/PngImagePlugin.py
python
PngImageFile.load_end
(self)
internal: finished reading image data
internal: finished reading image data
[ "internal", ":", "finished", "reading", "image", "data" ]
def load_end(self): "internal: finished reading image data" self.png.close() self.png = None
[ "def", "load_end", "(", "self", ")", ":", "self", ".", "png", ".", "close", "(", ")", "self", ".", "png", "=", "None" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/PIL/PngImagePlugin.py#L611-L615
WilsonWangTHU/mbbl
bb88a016de2fcd8ea0ed9c4d5c539817d2b476e7
mbbl/env/gym_env/noise_gym_cartpole.py
python
env._set_groundtruth_api
(self)
@brief: In this function, we could provide the ground-truth dynamics and rewards APIs for the agent to call. For the new environments, if we don't set their ground-truth apis, then we cannot test the algorithm using ground-truth dynamics or...
[]
def _set_groundtruth_api(self): """ @brief: In this function, we could provide the ground-truth dynamics and rewards APIs for the agent to call. For the new environments, if we don't set their ground-truth apis, then we cannot test the algorithm us...
[ "def", "_set_groundtruth_api", "(", "self", ")", ":", "self", ".", "_set_reward_api", "(", ")", "self", ".", "_set_dynamics_api", "(", ")" ]
https://github.com/WilsonWangTHU/mbbl/blob/bb88a016de2fcd8ea0ed9c4d5c539817d2b476e7/mbbl/env/gym_env/noise_gym_cartpole.py#L98-L107
ironport/shrapnel
9496a64c46271b0c5cef0feb8f2cdf33cb752bb6
coro/http/client.py
python
request.wake
(self)
signal that a reply to this request has been received
signal that a reply to this request has been received
[ "signal", "that", "a", "reply", "to", "this", "request", "has", "been", "received" ]
def wake (self): "signal that a reply to this request has been received" if self.rfile and self.force: self.content = self.rfile.read() self.latch.wake_all() if self.rfile and not self.force: self.rfile.wait()
[ "def", "wake", "(", "self", ")", ":", "if", "self", ".", "rfile", "and", "self", ".", "force", ":", "self", ".", "content", "=", "self", ".", "rfile", ".", "read", "(", ")", "self", ".", "latch", ".", "wake_all", "(", ")", "if", "self", ".", "r...
https://github.com/ironport/shrapnel/blob/9496a64c46271b0c5cef0feb8f2cdf33cb752bb6/coro/http/client.py#L41-L47
sefakilic/goodreads
5187100d66b87c87db8b095bbf576e1b92422a23
goodreads/event.py
python
GoodreadsEvent.start_at
(self)
return self._event_dict['start_at']['#text']
Event starts at
Event starts at
[ "Event", "starts", "at" ]
def start_at(self): """Event starts at""" return self._event_dict['start_at']['#text']
[ "def", "start_at", "(", "self", ")", ":", "return", "self", ".", "_event_dict", "[", "'start_at'", "]", "[", "'#text'", "]" ]
https://github.com/sefakilic/goodreads/blob/5187100d66b87c87db8b095bbf576e1b92422a23/goodreads/event.py#L102-L104
materialsproject/fireworks
83a907c19baf2a5c9fdcf63996f9797c3c85b785
fireworks/core/launchpad.py
python
LaunchPad.defuse_wf
(self, fw_id, defuse_all_states=True)
Defuse the workflow containing the given firework id. Args: fw_id (int): firework id defuse_all_states (bool)
Defuse the workflow containing the given firework id.
[ "Defuse", "the", "workflow", "containing", "the", "given", "firework", "id", "." ]
def defuse_wf(self, fw_id, defuse_all_states=True): """ Defuse the workflow containing the given firework id. Args: fw_id (int): firework id defuse_all_states (bool) """ wf = self.get_wf_by_fw_id_lzyfw(fw_id) for fw in wf: if fw.state ...
[ "def", "defuse_wf", "(", "self", ",", "fw_id", ",", "defuse_all_states", "=", "True", ")", ":", "wf", "=", "self", ".", "get_wf_by_fw_id_lzyfw", "(", "fw_id", ")", "for", "fw", "in", "wf", ":", "if", "fw", ".", "state", "not", "in", "[", "\"COMPLETED\"...
https://github.com/materialsproject/fireworks/blob/83a907c19baf2a5c9fdcf63996f9797c3c85b785/fireworks/core/launchpad.py#L1052-L1063
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/plotly/graph_objs/scatter/_legendgrouptitle.py
python
Legendgrouptitle.__init__
(self, arg=None, font=None, text=None, **kwargs)
Construct a new Legendgrouptitle object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.scatter.Legendgrouptitle` font Sets this legend group's title font. ...
Construct a new Legendgrouptitle object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.scatter.Legendgrouptitle` font Sets this legend group's title font. ...
[ "Construct", "a", "new", "Legendgrouptitle", "object", "Parameters", "----------", "arg", "dict", "of", "properties", "compatible", "with", "this", "constructor", "or", "an", "instance", "of", ":", "class", ":", "plotly", ".", "graph_objs", ".", "scatter", ".", ...
def __init__(self, arg=None, font=None, text=None, **kwargs): """ Construct a new Legendgrouptitle object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.scatter...
[ "def", "__init__", "(", "self", ",", "arg", "=", "None", ",", "font", "=", "None", ",", "text", "=", "None", ",", "*", "*", "kwargs", ")", ":", "super", "(", "Legendgrouptitle", ",", "self", ")", ".", "__init__", "(", "\"legendgrouptitle\"", ")", "if...
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/scatter/_legendgrouptitle.py#L91-L154
robinhood/faust
01b4c0ad8390221db71751d80001b0fd879291e2
faust/streams.py
python
Stream.on_stop
(self)
Signal that the stream is stopping.
Signal that the stream is stopping.
[ "Signal", "that", "the", "stream", "is", "stopping", "." ]
async def on_stop(self) -> None: """Signal that the stream is stopping.""" self._passive = False self._passive_started.clear() for table_or_stream in self.combined: await table_or_stream.remove_from_stream(self)
[ "async", "def", "on_stop", "(", "self", ")", "->", "None", ":", "self", ".", "_passive", "=", "False", "self", ".", "_passive_started", ".", "clear", "(", ")", "for", "table_or_stream", "in", "self", ".", "combined", ":", "await", "table_or_stream", ".", ...
https://github.com/robinhood/faust/blob/01b4c0ad8390221db71751d80001b0fd879291e2/faust/streams.py#L740-L745
krintoxi/NoobSec-Toolkit
38738541cbc03cedb9a3b3ed13b629f781ad64f6
NoobSecToolkit - MAC OSX/tools/inject/plugins/generic/search.py
python
Search.searchTable
(self)
[]
def searchTable(self): bruteForce = False if Backend.isDbms(DBMS.MYSQL) and not kb.data.has_information_schema: errMsg = "information_schema not available, " errMsg += "back-end DBMS is MySQL < 5.0" bruteForce = True if bruteForce: message = "do ...
[ "def", "searchTable", "(", "self", ")", ":", "bruteForce", "=", "False", "if", "Backend", ".", "isDbms", "(", "DBMS", ".", "MYSQL", ")", "and", "not", "kb", ".", "data", ".", "has_information_schema", ":", "errMsg", "=", "\"information_schema not available, \"...
https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/tools/inject/plugins/generic/search.py#L139-L333
jparkhill/TensorMol
d52104dc7ee46eec8301d332a95d672270ac0bd1
TensorMol/TFNetworks/TFBehlerParinelloSymEE.py
python
MolInstance_DirectBP_Charge_SymFunction.train_step
(self, step)
return
Perform a single training step (complete processing of all input), using minibatches of size self.batch_size. Training object including dipole, energy and gradient Args: step: the index of this step.
Perform a single training step (complete processing of all input), using minibatches of size self.batch_size. Training object including dipole, energy and gradient
[ "Perform", "a", "single", "training", "step", "(", "complete", "processing", "of", "all", "input", ")", "using", "minibatches", "of", "size", "self", ".", "batch_size", ".", "Training", "object", "including", "dipole", "energy", "and", "gradient" ]
def train_step(self, step): """ Perform a single training step (complete processing of all input), using minibatches of size self.batch_size. Training object including dipole, energy and gradient Args: step: the index of this step. """ Ncase_train = self.TData.NTrain start_time = time.time() train_l...
[ "def", "train_step", "(", "self", ",", "step", ")", ":", "Ncase_train", "=", "self", ".", "TData", ".", "NTrain", "start_time", "=", "time", ".", "time", "(", ")", "train_loss", "=", "0.0", "num_of_mols", "=", "0", "pre_output", "=", "np", ".", "zeros"...
https://github.com/jparkhill/TensorMol/blob/d52104dc7ee46eec8301d332a95d672270ac0bd1/TensorMol/TFNetworks/TFBehlerParinelloSymEE.py#L2156-L2189
tribe29/checkmk
6260f2512e159e311f426e16b84b19d0b8e9ad0c
cmk/gui/livestatus_utils/commands/downtimes.py
python
delete_downtime
(connection, downtime_id)
Delete a scheduled downtime based upon the downtime id
Delete a scheduled downtime based upon the downtime id
[ "Delete", "a", "scheduled", "downtime", "based", "upon", "the", "downtime", "id" ]
def delete_downtime(connection, downtime_id): """Delete a scheduled downtime based upon the downtime id""" with detailed_connection(connection) as conn: entry = Query( [Downtimes.is_service], Downtimes.id == downtime_id, ).fetchone(conn) if entry["is_service"]: ...
[ "def", "delete_downtime", "(", "connection", ",", "downtime_id", ")", ":", "with", "detailed_connection", "(", "connection", ")", "as", "conn", ":", "entry", "=", "Query", "(", "[", "Downtimes", ".", "is_service", "]", ",", "Downtimes", ".", "id", "==", "d...
https://github.com/tribe29/checkmk/blob/6260f2512e159e311f426e16b84b19d0b8e9ad0c/cmk/gui/livestatus_utils/commands/downtimes.py#L110-L120
Azure/azure-storage-python
4306898850dd21617644fc537a57d025e833db74
azure-storage-blob/azure/storage/blob/blockblobservice.py
python
BlockBlobService.__init__
(self, account_name=None, account_key=None, sas_token=None, is_emulated=False, protocol=DEFAULT_PROTOCOL, endpoint_suffix=SERVICE_HOST_BASE, custom_domain=None, request_session=None, connection_string=None, socket_timeout=None, token_credential=None)
:param str account_name: The storage account name. This is used to authenticate requests signed with an account key and to construct the storage endpoint. It is required unless a connection string is given, or if a custom domain is used with anonymous authentication. ...
:param str account_name: The storage account name. This is used to authenticate requests signed with an account key and to construct the storage endpoint. It is required unless a connection string is given, or if a custom domain is used with anonymous authentication. ...
[ ":", "param", "str", "account_name", ":", "The", "storage", "account", "name", ".", "This", "is", "used", "to", "authenticate", "requests", "signed", "with", "an", "account", "key", "and", "to", "construct", "the", "storage", "endpoint", ".", "It", "is", "...
def __init__(self, account_name=None, account_key=None, sas_token=None, is_emulated=False, protocol=DEFAULT_PROTOCOL, endpoint_suffix=SERVICE_HOST_BASE, custom_domain=None, request_session=None, connection_string=None, socket_timeout=None, token_credential=None): ''' :p...
[ "def", "__init__", "(", "self", ",", "account_name", "=", "None", ",", "account_key", "=", "None", ",", "sas_token", "=", "None", ",", "is_emulated", "=", "False", ",", "protocol", "=", "DEFAULT_PROTOCOL", ",", "endpoint_suffix", "=", "SERVICE_HOST_BASE", ",",...
https://github.com/Azure/azure-storage-python/blob/4306898850dd21617644fc537a57d025e833db74/azure-storage-blob/azure/storage/blob/blockblobservice.py#L101-L150
PaddlePaddle/Research
2da0bd6c72d60e9df403aff23a7802779561c4a1
KG/DuEE_baseline/bin/utils/utils.py
python
read_by_lines
(path, encoding="utf-8")
return result
read the data by line
read the data by line
[ "read", "the", "data", "by", "line" ]
def read_by_lines(path, encoding="utf-8"): """read the data by line""" result = list() with open(path, "r") as infile: for line in infile: result.append(line.strip().decode(encoding)) return result
[ "def", "read_by_lines", "(", "path", ",", "encoding", "=", "\"utf-8\"", ")", ":", "result", "=", "list", "(", ")", "with", "open", "(", "path", ",", "\"r\"", ")", "as", "infile", ":", "for", "line", "in", "infile", ":", "result", ".", "append", "(", ...
https://github.com/PaddlePaddle/Research/blob/2da0bd6c72d60e9df403aff23a7802779561c4a1/KG/DuEE_baseline/bin/utils/utils.py#L9-L15
caiiiac/Machine-Learning-with-Python
1a26c4467da41ca4ebc3d5bd789ea942ef79422f
MachineLearning/venv/lib/python3.5/site-packages/sklearn/linear_model/stochastic_gradient.py
python
BaseSGDRegressor.fit
(self, X, y, coef_init=None, intercept_init=None, sample_weight=None)
return self._fit(X, y, alpha=self.alpha, C=1.0, loss=self.loss, learning_rate=self.learning_rate, coef_init=coef_init, intercept_init=intercept_init, sample_weight=sample_weight)
Fit linear model with Stochastic Gradient Descent. Parameters ---------- X : {array-like, sparse matrix}, shape (n_samples, n_features) Training data y : numpy array, shape (n_samples,) Target values coef_init : array, shape (n_features,) Th...
Fit linear model with Stochastic Gradient Descent.
[ "Fit", "linear", "model", "with", "Stochastic", "Gradient", "Descent", "." ]
def fit(self, X, y, coef_init=None, intercept_init=None, sample_weight=None): """Fit linear model with Stochastic Gradient Descent. Parameters ---------- X : {array-like, sparse matrix}, shape (n_samples, n_features) Training data y : numpy array, shape ...
[ "def", "fit", "(", "self", ",", "X", ",", "y", ",", "coef_init", "=", "None", ",", "intercept_init", "=", "None", ",", "sample_weight", "=", "None", ")", ":", "return", "self", ".", "_fit", "(", "X", ",", "y", ",", "alpha", "=", "self", ".", "alp...
https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/sklearn/linear_model/stochastic_gradient.py#L944-L973
microsoft/ptvsd
99c8513921021d2cc7cd82e132b65c644c256768
src/ptvsd/_vendored/pydevd/stubs/_django_manager_body.py
python
_update
(self, *args, **kwargs)
A version of update that accepts field objects instead of field names. Used primarily for model saving and not intended for use by general code (it requires too much poking around at model internals to be useful at that level).
A version of update that accepts field objects instead of field names. Used primarily for model saving and not intended for use by general code (it requires too much poking around at model internals to be useful at that level).
[ "A", "version", "of", "update", "that", "accepts", "field", "objects", "instead", "of", "field", "names", ".", "Used", "primarily", "for", "model", "saving", "and", "not", "intended", "for", "use", "by", "general", "code", "(", "it", "requires", "too", "mu...
def _update(self, *args, **kwargs): """ A version of update that accepts field objects instead of field names. Used primarily for model saving and not intended for use by general code (it requires too much poking around at model internals to be useful at that level). """
[ "def", "_update", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":" ]
https://github.com/microsoft/ptvsd/blob/99c8513921021d2cc7cd82e132b65c644c256768/src/ptvsd/_vendored/pydevd/stubs/_django_manager_body.py#L68-L74
Source-Python-Dev-Team/Source.Python
d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb
addons/source-python/Python3/email/message.py
python
Message.keys
(self)
return [k for k, v in self._headers]
Return a list of all the message's header field names. These will be sorted in the order they appeared in the original message, or were added to the message, and may contain duplicates. Any fields deleted and re-inserted are always appended to the header list.
Return a list of all the message's header field names.
[ "Return", "a", "list", "of", "all", "the", "message", "s", "header", "field", "names", "." ]
def keys(self): """Return a list of all the message's header field names. These will be sorted in the order they appeared in the original message, or were added to the message, and may contain duplicates. Any fields deleted and re-inserted are always appended to the header list....
[ "def", "keys", "(", "self", ")", ":", "return", "[", "k", "for", "k", ",", "v", "in", "self", ".", "_headers", "]" ]
https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/Python3/email/message.py#L430-L438
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/ticker.py
python
FixedLocator.set_params
(self, nbins=None)
Set parameters within this locator.
Set parameters within this locator.
[ "Set", "parameters", "within", "this", "locator", "." ]
def set_params(self, nbins=None): """Set parameters within this locator.""" if nbins is not None: self.nbins = nbins
[ "def", "set_params", "(", "self", ",", "nbins", "=", "None", ")", ":", "if", "nbins", "is", "not", "None", ":", "self", ".", "nbins", "=", "nbins" ]
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/ticker.py#L1542-L1545
general03/flask-autoindex
424246242c9f40aeb9ac2c8c63f4d2234024256e
.eggs/Werkzeug-1.0.1-py3.7.egg/werkzeug/wrappers/base_response.py
python
BaseResponse.get_app_iter
(self, environ)
return ClosingIterator(iterable, self.close)
Returns the application iterator for the given environ. Depending on the request method and the current status code the return value might be an empty response rather than the one from the response. If the request method is `HEAD` or the status code is in a range where the HTTP specifi...
Returns the application iterator for the given environ. Depending on the request method and the current status code the return value might be an empty response rather than the one from the response.
[ "Returns", "the", "application", "iterator", "for", "the", "given", "environ", ".", "Depending", "on", "the", "request", "method", "and", "the", "current", "status", "code", "the", "return", "value", "might", "be", "an", "empty", "response", "rather", "than", ...
def get_app_iter(self, environ): """Returns the application iterator for the given environ. Depending on the request method and the current status code the return value might be an empty response rather than the one from the response. If the request method is `HEAD` or the status code ...
[ "def", "get_app_iter", "(", "self", ",", "environ", ")", ":", "status", "=", "self", ".", "status_code", "if", "(", "environ", "[", "\"REQUEST_METHOD\"", "]", "==", "\"HEAD\"", "or", "100", "<=", "status", "<", "200", "or", "status", "in", "(", "204", ...
https://github.com/general03/flask-autoindex/blob/424246242c9f40aeb9ac2c8c63f4d2234024256e/.eggs/Werkzeug-1.0.1-py3.7.egg/werkzeug/wrappers/base_response.py#L644-L671
Liusifei/UVC
36bc6b2c99366a6d1a6033229d395f3c88ff656b
libs/vis_utils.py
python
compute_color
(u, v)
return img
compute optical flow color map :param u: optical flow horizontal map :param v: optical flow vertical map :return: optical flow in color code
compute optical flow color map :param u: optical flow horizontal map :param v: optical flow vertical map :return: optical flow in color code
[ "compute", "optical", "flow", "color", "map", ":", "param", "u", ":", "optical", "flow", "horizontal", "map", ":", "param", "v", ":", "optical", "flow", "vertical", "map", ":", "return", ":", "optical", "flow", "in", "color", "code" ]
def compute_color(u, v): """ compute optical flow color map :param u: optical flow horizontal map :param v: optical flow vertical map :return: optical flow in color code """ [h, w] = u.shape img = np.zeros([h, w, 3]) nanIdx = np.isnan(u) | np.isnan(v) u[nanIdx] = 0 v[nanIdx] ...
[ "def", "compute_color", "(", "u", ",", "v", ")", ":", "[", "h", ",", "w", "]", "=", "u", ".", "shape", "img", "=", "np", ".", "zeros", "(", "[", "h", ",", "w", ",", "3", "]", ")", "nanIdx", "=", "np", ".", "isnan", "(", "u", ")", "|", "...
https://github.com/Liusifei/UVC/blob/36bc6b2c99366a6d1a6033229d395f3c88ff656b/libs/vis_utils.py#L66-L107
mikew/ss-plex.bundle
031566c06205e08a8cb15c57a0c143fba5270493
Contents/Libraries/Shared/ss/mechanize/_opener.py
python
OpenerDirector.retrieve
(self, fullurl, filename=None, reporthook=None, data=None, timeout=_sockettimeout._GLOBAL_DEFAULT_TIMEOUT, open=open_file)
return result
Returns (filename, headers). For remote objects, the default filename will refer to a temporary file. Temporary files are removed when the OpenerDirector.close() method is called. For file: URLs, at present the returned filename is None. This may change in future. If...
Returns (filename, headers).
[ "Returns", "(", "filename", "headers", ")", "." ]
def retrieve(self, fullurl, filename=None, reporthook=None, data=None, timeout=_sockettimeout._GLOBAL_DEFAULT_TIMEOUT, open=open_file): """Returns (filename, headers). For remote objects, the default filename will refer to a temporary file. Temporary files are...
[ "def", "retrieve", "(", "self", ",", "fullurl", ",", "filename", "=", "None", ",", "reporthook", "=", "None", ",", "data", "=", "None", ",", "timeout", "=", "_sockettimeout", ".", "_GLOBAL_DEFAULT_TIMEOUT", ",", "open", "=", "open_file", ")", ":", "req", ...
https://github.com/mikew/ss-plex.bundle/blob/031566c06205e08a8cb15c57a0c143fba5270493/Contents/Libraries/Shared/ss/mechanize/_opener.py#L230-L298
Tautulli/Tautulli
2410eb33805aaac4bd1c5dad0f71e4f15afaf742
lib/gntp/core.py
python
GNTPRegister.validate
(self)
Validate required headers and validate notification headers
Validate required headers and validate notification headers
[ "Validate", "required", "headers", "and", "validate", "notification", "headers" ]
def validate(self): '''Validate required headers and validate notification headers''' for header in self._requiredHeaders: if not self.headers.get(header, False): raise errors.ParseError('Missing Registration Header: ' + header) for notice in self.notifications: for header in self._requiredNotificationH...
[ "def", "validate", "(", "self", ")", ":", "for", "header", "in", "self", ".", "_requiredHeaders", ":", "if", "not", "self", ".", "headers", ".", "get", "(", "header", ",", "False", ")", ":", "raise", "errors", ".", "ParseError", "(", "'Missing Registrati...
https://github.com/Tautulli/Tautulli/blob/2410eb33805aaac4bd1c5dad0f71e4f15afaf742/lib/gntp/core.py#L307-L315
delira-dev/delira
cd3ad277d6fad5f837d6c5147e6eee2ada648596
delira/data_loading/augmenter.py
python
Augmenter.__iter__
(self)
Makes the Augmenter iterable by generators Returns ------- Generator a generator function yielding the arguments
Makes the Augmenter iterable by generators Returns ------- Generator a generator function yielding the arguments
[ "Makes", "the", "Augmenter", "iterable", "by", "generators", "Returns", "-------", "Generator", "a", "generator", "function", "yielding", "the", "arguments" ]
def __iter__(self): """ Makes the Augmenter iterable by generators Returns ------- Generator a generator function yielding the arguments """ yield from self._augmenter
[ "def", "__iter__", "(", "self", ")", ":", "yield", "from", "self", ".", "_augmenter" ]
https://github.com/delira-dev/delira/blob/cd3ad277d6fad5f837d6c5147e6eee2ada648596/delira/data_loading/augmenter.py#L503-L511
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/mhlib.py
python
Folder.removefromallsequences
(self, list)
Remove one or more messages from all sequences (including last) -- but not from 'cur'!!!
Remove one or more messages from all sequences (including last) -- but not from 'cur'!!!
[ "Remove", "one", "or", "more", "messages", "from", "all", "sequences", "(", "including", "last", ")", "--", "but", "not", "from", "cur", "!!!" ]
def removefromallsequences(self, list): """Remove one or more messages from all sequences (including last) -- but not from 'cur'!!!""" if hasattr(self, 'last') and self.last in list: del self.last sequences = self.getsequences() changed = 0 for name, seq in se...
[ "def", "removefromallsequences", "(", "self", ",", "list", ")", ":", "if", "hasattr", "(", "self", ",", "'last'", ")", "and", "self", ".", "last", "in", "list", ":", "del", "self", ".", "last", "sequences", "=", "self", ".", "getsequences", "(", ")", ...
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/mhlib.py#L630-L647
XX-net/XX-Net
a9898cfcf0084195fb7e69b6bc834e59aecdf14f
python3.8.2/Lib/_pyio.py
python
IOBase.writelines
(self, lines)
Write a list of lines to the stream. Line separators are not added, so it is usual for each of the lines provided to have a line separator at the end.
Write a list of lines to the stream.
[ "Write", "a", "list", "of", "lines", "to", "the", "stream", "." ]
def writelines(self, lines): """Write a list of lines to the stream. Line separators are not added, so it is usual for each of the lines provided to have a line separator at the end. """ self._checkClosed() for line in lines: self.write(line)
[ "def", "writelines", "(", "self", ",", "lines", ")", ":", "self", ".", "_checkClosed", "(", ")", "for", "line", "in", "lines", ":", "self", ".", "write", "(", "line", ")" ]
https://github.com/XX-net/XX-Net/blob/a9898cfcf0084195fb7e69b6bc834e59aecdf14f/python3.8.2/Lib/_pyio.py#L593-L601
selinon/selinon
3613153566d454022a138639f0375c63f490c4cb
selinon/selective_run_function.py
python
SelectiveRunFunction.from_dict
(cls, dict_)
return cls(name, import_path)
Instantiate selective run function based on definition in a dictionary. :return: selective run function that will be used based on configuration :rtype: SelectiveRunFunction
Instantiate selective run function based on definition in a dictionary.
[ "Instantiate", "selective", "run", "function", "based", "on", "definition", "in", "a", "dictionary", "." ]
def from_dict(cls, dict_): """Instantiate selective run function based on definition in a dictionary. :return: selective run function that will be used based on configuration :rtype: SelectiveRunFunction """ if not dict_: return cls.get_default() unknown_con...
[ "def", "from_dict", "(", "cls", ",", "dict_", ")", ":", "if", "not", "dict_", ":", "return", "cls", ".", "get_default", "(", ")", "unknown_conf", "=", "check_conf_keys", "(", "dict_", ",", "known_conf_opts", "=", "(", "'name'", ",", "'import'", ")", ")",...
https://github.com/selinon/selinon/blob/3613153566d454022a138639f0375c63f490c4cb/selinon/selective_run_function.py#L54-L71
lifting-bits/mcsema
b7492e2ffb9f2fa64b5ef269753ba1d134bdf2f2
tools/mcsema_disass/ida7/util.py
python
get_destructor_segment
()
Returns the start address of the global destructor section
Returns the start address of the global destructor section
[ "Returns", "the", "start", "address", "of", "the", "global", "destructor", "section" ]
def get_destructor_segment(): """Returns the start address of the global destructor section""" for seg_ea in idautils.Segments(): seg_name = idc.get_segm_name(seg_ea).lower() if seg_name in [".fini_array", ".dtor"]: return seg_ea;
[ "def", "get_destructor_segment", "(", ")", ":", "for", "seg_ea", "in", "idautils", ".", "Segments", "(", ")", ":", "seg_name", "=", "idc", ".", "get_segm_name", "(", "seg_ea", ")", ".", "lower", "(", ")", "if", "seg_name", "in", "[", "\".fini_array\"", "...
https://github.com/lifting-bits/mcsema/blob/b7492e2ffb9f2fa64b5ef269753ba1d134bdf2f2/tools/mcsema_disass/ida7/util.py#L404-L409
armancohan/long-summarization
1328d4f37b3a3a460f455e93e84ed4ddcd10dab1
model.py
python
SummarizationModel._add_seq2seq
(self)
Add the whole sequence-to-sequence model to the graph.
Add the whole sequence-to-sequence model to the graph.
[ "Add", "the", "whole", "sequence", "-", "to", "-", "sequence", "model", "to", "the", "graph", "." ]
def _add_seq2seq(self): """Add the whole sequence-to-sequence model to the graph.""" hps = self._hps vsize = self._vocab.size() # size of the vocabulary with tf.variable_scope('seq2seq'): # Some initializers self.rand_unif_init = tf.random_uniform_initializer(-hps.rand_unif_init_mag, hp...
[ "def", "_add_seq2seq", "(", "self", ")", ":", "hps", "=", "self", ".", "_hps", "vsize", "=", "self", ".", "_vocab", ".", "size", "(", ")", "# size of the vocabulary", "with", "tf", ".", "variable_scope", "(", "'seq2seq'", ")", ":", "# Some initializers", "...
https://github.com/armancohan/long-summarization/blob/1328d4f37b3a3a460f455e93e84ed4ddcd10dab1/model.py#L243-L519
sahana/eden
1696fa50e90ce967df69f66b571af45356cc18da
static/scripts/tools/pep8.py
python
Checker.check_logical
(self)
Build a line from tokens and run all logical checks on it.
Build a line from tokens and run all logical checks on it.
[ "Build", "a", "line", "from", "tokens", "and", "run", "all", "logical", "checks", "on", "it", "." ]
def check_logical(self): """ Build a line from tokens and run all logical checks on it. """ options.counters['logical lines'] = \ options.counters.get('logical lines', 0) + 1 self.build_tokens_line() first_line = self.lines[self.mapping[0][1][2][0] - 1] ...
[ "def", "check_logical", "(", "self", ")", ":", "options", ".", "counters", "[", "'logical lines'", "]", "=", "options", ".", "counters", ".", "get", "(", "'logical lines'", ",", "0", ")", "+", "1", "self", ".", "build_tokens_line", "(", ")", "first_line", ...
https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/static/scripts/tools/pep8.py#L577-L606
ihaveamac/ninfs
dee583ba3205c4e050e0b193a85a4177eb334159
ninfs/mount/ncch.py
python
NCCHContainerMount.init
(self, path, _setup_romfs=True)
[]
def init(self, path, _setup_romfs=True): decrypted_filename = '/decrypted.' + ('cxi' if self.reader.flags.executable else 'cfa') self.files[decrypted_filename] = NCCHSection.FullDecrypted self.files['/ncch.bin'] = NCCHSection.Header if NCCHSection.ExtendedHeader in self.reader.sections...
[ "def", "init", "(", "self", ",", "path", ",", "_setup_romfs", "=", "True", ")", ":", "decrypted_filename", "=", "'/decrypted.'", "+", "(", "'cxi'", "if", "self", ".", "reader", ".", "flags", ".", "executable", "else", "'cfa'", ")", "self", ".", "files", ...
https://github.com/ihaveamac/ninfs/blob/dee583ba3205c4e050e0b193a85a4177eb334159/ninfs/mount/ncch.py#L52-L74
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/lib-python/3/fileinput.py
python
isfirstline
()
return _state.isfirstline()
Returns true the line just read is the first line of its file, otherwise returns false.
Returns true the line just read is the first line of its file, otherwise returns false.
[ "Returns", "true", "the", "line", "just", "read", "is", "the", "first", "line", "of", "its", "file", "otherwise", "returns", "false", "." ]
def isfirstline(): """ Returns true the line just read is the first line of its file, otherwise returns false. """ if not _state: raise RuntimeError("no active input()") return _state.isfirstline()
[ "def", "isfirstline", "(", ")", ":", "if", "not", "_state", ":", "raise", "RuntimeError", "(", "\"no active input()\"", ")", "return", "_state", ".", "isfirstline", "(", ")" ]
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/fileinput.py#L167-L174
svip-lab/impersonator
b041dd415157c1e7f5b46e579a1ad4dffabb2e66
thirdparty/his_evaluators/his_evaluators/evaluators/motion_imitation.py
python
MotionImitationRunnerProcessor.post_format_metric_file_list
(self, si_preds_files, si_ref_files, ci_preds_files, ci_ref_files)
return si_preds_ref_files, ci_preds_ref_files
make [(si_pred, si_ref), ...], and [(ci_pred, ci_ref), ...] Args: si_preds_files: si_ref_files: ci_preds_files: ci_ref_files: Returns: si_preds_ref_files: ci_preds_ref_files:
make [(si_pred, si_ref), ...], and [(ci_pred, ci_ref), ...] Args: si_preds_files: si_ref_files: ci_preds_files: ci_ref_files:
[ "make", "[", "(", "si_pred", "si_ref", ")", "...", "]", "and", "[", "(", "ci_pred", "ci_ref", ")", "...", "]", "Args", ":", "si_preds_files", ":", "si_ref_files", ":", "ci_preds_files", ":", "ci_ref_files", ":" ]
def post_format_metric_file_list(self, si_preds_files, si_ref_files, ci_preds_files, ci_ref_files): """ make [(si_pred, si_ref), ...], and [(ci_pred, ci_ref), ...] Args: si_preds_files: si_ref_files: ci_preds_files: ci_ref_files: Retur...
[ "def", "post_format_metric_file_list", "(", "self", ",", "si_preds_files", ",", "si_ref_files", ",", "ci_preds_files", ",", "ci_ref_files", ")", ":", "si_preds_ref_files", "=", "list", "(", "zip", "(", "si_preds_files", ",", "si_ref_files", ")", ")", "ci_preds_ref_f...
https://github.com/svip-lab/impersonator/blob/b041dd415157c1e7f5b46e579a1ad4dffabb2e66/thirdparty/his_evaluators/his_evaluators/evaluators/motion_imitation.py#L143-L159
openai/multiagent-competition
b2e081a192429913b7d21a89525901d59c85e7f3
gym-compete/gym_compete/new_envs/agents/agent.py
python
Agent.set_env
(self, env)
[]
def set_env(self, env): self.env = env self._env_init = True self._set_body() self._set_joint() if self.n_agents > 1: self._set_other_joint() self.set_observation_space() self.set_action_space()
[ "def", "set_env", "(", "self", ",", "env", ")", ":", "self", ".", "env", "=", "env", "self", ".", "_env_init", "=", "True", "self", ".", "_set_body", "(", ")", "self", ".", "_set_joint", "(", ")", "if", "self", ".", "n_agents", ">", "1", ":", "se...
https://github.com/openai/multiagent-competition/blob/b2e081a192429913b7d21a89525901d59c85e7f3/gym-compete/gym_compete/new_envs/agents/agent.py#L33-L41
BEEmod/BEE2.4
02767f3cf476581789425ab308ca1bea978f6a74
src/app/sound.py
python
PygletSound.fx
(self, sound: str)
Play a sound effect.
Play a sound effect.
[ "Play", "a", "sound", "effect", "." ]
async def fx(self, sound: str) -> None: """Play a sound effect.""" global sounds if play_sound: try: snd = self.sources[sound] except KeyError: # We were called before the BG thread loaded em, load it now. LOGGER.warning('So...
[ "async", "def", "fx", "(", "self", ",", "sound", ":", "str", ")", "->", "None", ":", "global", "sounds", "if", "play_sound", ":", "try", ":", "snd", "=", "self", ".", "sources", "[", "sound", "]", "except", "KeyError", ":", "# We were called before the B...
https://github.com/BEEmod/BEE2.4/blob/02767f3cf476581789425ab308ca1bea978f6a74/src/app/sound.py#L127-L144
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/django/http/multipartparser.py
python
ChunkIter.__next__
(self)
[]
def __next__(self): try: data = self.flo.read(self.chunk_size) except InputStreamExhausted: raise StopIteration() if data: return data else: raise StopIteration()
[ "def", "__next__", "(", "self", ")", ":", "try", ":", "data", "=", "self", ".", "flo", ".", "read", "(", "self", ".", "chunk_size", ")", "except", "InputStreamExhausted", ":", "raise", "StopIteration", "(", ")", "if", "data", ":", "return", "data", "el...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/django/http/multipartparser.py#L447-L455
monero-ecosystem/monero-python
9c3c841624f635a4fd154f1f278206af8a6d2c1d
monero/wallet.py
python
Wallet.address
(self)
return self.accounts[0].address()
Returns wallet's master address. :rtype: :class:`Address <monero.address.Address>`
Returns wallet's master address.
[ "Returns", "wallet", "s", "master", "address", "." ]
def address(self): """ Returns wallet's master address. :rtype: :class:`Address <monero.address.Address>` """ return self.accounts[0].address()
[ "def", "address", "(", "self", ")", ":", "return", "self", ".", "accounts", "[", "0", "]", ".", "address", "(", ")" ]
https://github.com/monero-ecosystem/monero-python/blob/9c3c841624f635a4fd154f1f278206af8a6d2c1d/monero/wallet.py#L180-L186
Buroni/booksoup
da4470654a820e6450fdb6759d6d625c5fd3b5eb
booksoup/BookSoup.py
python
BookSoup.load_conversation
(self, search_name, interval="month")
return None
[]
def load_conversation(self, search_name, interval="month"): # If search_name is an integer, simply get the HTML file whose name is that integer. if isinstance(search_name, int): contact = Conversation(os.path.join(self.__path, "messages", str(search_name)+".html"), interval=interval) ...
[ "def", "load_conversation", "(", "self", ",", "search_name", ",", "interval", "=", "\"month\"", ")", ":", "# If search_name is an integer, simply get the HTML file whose name is that integer.", "if", "isinstance", "(", "search_name", ",", "int", ")", ":", "contact", "=", ...
https://github.com/Buroni/booksoup/blob/da4470654a820e6450fdb6759d6d625c5fd3b5eb/booksoup/BookSoup.py#L33-L51
returntocorp/bento
05b365da71b65170d41fe92a702480ab76c1d17c
bento/git.py
python
user_email
(path: Optional[Path] = None)
[]
def user_email(path: Optional[Path] = None) -> Optional[str]: r = repo(path) if r is None: return None try: return r.config_reader().get_value("user", "email").strip("\"'") except configparser.NoSectionError: return None except configparser.NoOptionError: return None
[ "def", "user_email", "(", "path", ":", "Optional", "[", "Path", "]", "=", "None", ")", "->", "Optional", "[", "str", "]", ":", "r", "=", "repo", "(", "path", ")", "if", "r", "is", "None", ":", "return", "None", "try", ":", "return", "r", ".", "...
https://github.com/returntocorp/bento/blob/05b365da71b65170d41fe92a702480ab76c1d17c/bento/git.py#L25-L34
nosmokingbandit/watcher
dadacd21a5790ee609058a98a17fcc8954d24439
lib/sqlalchemy/sql/selectable.py
python
Select.self_group
(self, against=None)
return FromGrouping(self)
return a 'grouping' construct as per the ClauseElement specification. This produces an element that can be embedded in an expression. Note that this method is called automatically as needed when constructing expressions and should not require explicit use.
return a 'grouping' construct as per the ClauseElement specification.
[ "return", "a", "grouping", "construct", "as", "per", "the", "ClauseElement", "specification", "." ]
def self_group(self, against=None): """return a 'grouping' construct as per the ClauseElement specification. This produces an element that can be embedded in an expression. Note that this method is called automatically as needed when constructing expressions and should not requi...
[ "def", "self_group", "(", "self", ",", "against", "=", "None", ")", ":", "if", "isinstance", "(", "against", ",", "CompoundSelect", ")", "and", "not", "self", ".", "_needs_parens_for_grouping", "(", ")", ":", "return", "self", "return", "FromGrouping", "(", ...
https://github.com/nosmokingbandit/watcher/blob/dadacd21a5790ee609058a98a17fcc8954d24439/lib/sqlalchemy/sql/selectable.py#L3485-L3497
omz/PythonistaAppTemplate
f560f93f8876d82a21d108977f90583df08d55af
PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/matplotlib/colors.py
python
LinearSegmentedColormap.__init__
(self, name, segmentdata, N=256, gamma=1.0)
Create color map from linear mapping segments segmentdata argument is a dictionary with a red, green and blue entries. Each entry should be a list of *x*, *y0*, *y1* tuples, forming rows in a table. Entries for alpha are optional. Example: suppose you want red to increase from 0 to 1 o...
Create color map from linear mapping segments
[ "Create", "color", "map", "from", "linear", "mapping", "segments" ]
def __init__(self, name, segmentdata, N=256, gamma=1.0): """Create color map from linear mapping segments segmentdata argument is a dictionary with a red, green and blue entries. Each entry should be a list of *x*, *y0*, *y1* tuples, forming rows in a table. Entries for alpha are option...
[ "def", "__init__", "(", "self", ",", "name", ",", "segmentdata", ",", "N", "=", "256", ",", "gamma", "=", "1.0", ")", ":", "# True only if all colors in map are identical; needed for contouring.", "self", ".", "monochrome", "=", "False", "Colormap", ".", "__init__...
https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib_ext/matplotlib/colors.py#L669-L720
vicariousinc/science_rcn
821d8ce4c7d3a7bf0827fc00a5a405a9f87cc67e
science_rcn/preproc.py
python
get_gabor_filters
(size=21, filter_scale=4., num_orients=16, weights=False)
return filts
Get Gabor filter bank. See Preproc for parameters and returns.
Get Gabor filter bank. See Preproc for parameters and returns.
[ "Get", "Gabor", "filter", "bank", ".", "See", "Preproc", "for", "parameters", "and", "returns", "." ]
def get_gabor_filters(size=21, filter_scale=4., num_orients=16, weights=False): """Get Gabor filter bank. See Preproc for parameters and returns.""" def _get_sparse_gaussian(): """Sparse Gaussian.""" size = 2 * np.ceil(np.sqrt(2.) * filter_scale) + 1 alt = np.zeros((int(size), int(size))...
[ "def", "get_gabor_filters", "(", "size", "=", "21", ",", "filter_scale", "=", "4.", ",", "num_orients", "=", "16", ",", "weights", "=", "False", ")", ":", "def", "_get_sparse_gaussian", "(", ")", ":", "\"\"\"Sparse Gaussian.\"\"\"", "size", "=", "2", "*", ...
https://github.com/vicariousinc/science_rcn/blob/821d8ce4c7d3a7bf0827fc00a5a405a9f87cc67e/science_rcn/preproc.py#L97-L120
gwpy/gwpy
82becd78d166a32985cb657a54d0d39f6a207739
gwpy/io/datafind.py
python
_error_missing_channels
(required, found, gpstime, allow_tape)
Raise an exception if required channels are not found
Raise an exception if required channels are not found
[ "Raise", "an", "exception", "if", "required", "channels", "are", "not", "found" ]
def _error_missing_channels(required, found, gpstime, allow_tape): """Raise an exception if required channels are not found """ missing = set(required) - set(found) if not missing: # success return # failure msg = "Cannot locate the following channel(s) in any known frametype" if ...
[ "def", "_error_missing_channels", "(", "required", ",", "found", ",", "gpstime", ",", "allow_tape", ")", ":", "missing", "=", "set", "(", "required", ")", "-", "set", "(", "found", ")", "if", "not", "missing", ":", "# success", "return", "# failure", "msg"...
https://github.com/gwpy/gwpy/blob/82becd78d166a32985cb657a54d0d39f6a207739/gwpy/io/datafind.py#L394-L410
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/plotly/graph_objs/layout/_xaxis.py
python
XAxis.tickformatstopdefaults
(self)
return self["tickformatstopdefaults"]
When used in a template (as layout.template.layout.xaxis.tickformatstopdefaults), sets the default property values to use for elements of layout.xaxis.tickformatstops The 'tickformatstopdefaults' property is an instance of Tickformatstop that may be specified as: -...
When used in a template (as layout.template.layout.xaxis.tickformatstopdefaults), sets the default property values to use for elements of layout.xaxis.tickformatstops The 'tickformatstopdefaults' property is an instance of Tickformatstop that may be specified as: -...
[ "When", "used", "in", "a", "template", "(", "as", "layout", ".", "template", ".", "layout", ".", "xaxis", ".", "tickformatstopdefaults", ")", "sets", "the", "default", "property", "values", "to", "use", "for", "elements", "of", "layout", ".", "xaxis", ".",...
def tickformatstopdefaults(self): """ When used in a template (as layout.template.layout.xaxis.tickformatstopdefaults), sets the default property values to use for elements of layout.xaxis.tickformatstops The 'tickformatstopdefaults' property is an instance of Tickfo...
[ "def", "tickformatstopdefaults", "(", "self", ")", ":", "return", "self", "[", "\"tickformatstopdefaults\"", "]" ]
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/layout/_xaxis.py#L1927-L1946
nlloyd/SubliminalCollaborator
5c619e17ddbe8acb9eea8996ec038169ddcd50a1
libs/twisted/spread/pb.py
python
Broker.dontNotifyOnDisconnect
(self, notifier)
Remove a callback from list of disconnect callbacks.
Remove a callback from list of disconnect callbacks.
[ "Remove", "a", "callback", "from", "list", "of", "disconnect", "callbacks", "." ]
def dontNotifyOnDisconnect(self, notifier): """Remove a callback from list of disconnect callbacks.""" try: self.disconnects.remove(notifier) except ValueError: pass
[ "def", "dontNotifyOnDisconnect", "(", "self", ",", "notifier", ")", ":", "try", ":", "self", ".", "disconnects", ".", "remove", "(", "notifier", ")", "except", "ValueError", ":", "pass" ]
https://github.com/nlloyd/SubliminalCollaborator/blob/5c619e17ddbe8acb9eea8996ec038169ddcd50a1/libs/twisted/spread/pb.py#L678-L683
mozillazg/pypy
2ff5cd960c075c991389f842c6d59e71cf0cb7d0
pypy/module/cpyext/stubs.py
python
PySys_ResetWarnOptions
(space)
Reset sys.warnoptions to an empty list.
Reset sys.warnoptions to an empty list.
[ "Reset", "sys", ".", "warnoptions", "to", "an", "empty", "list", "." ]
def PySys_ResetWarnOptions(space): """Reset sys.warnoptions to an empty list.""" raise NotImplementedError
[ "def", "PySys_ResetWarnOptions", "(", "space", ")", ":", "raise", "NotImplementedError" ]
https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/pypy/module/cpyext/stubs.py#L1324-L1326
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/lib/django-1.2/django/core/serializers/base.py
python
Serializer.handle_fk_field
(self, obj, field)
Called to handle a ForeignKey field.
Called to handle a ForeignKey field.
[ "Called", "to", "handle", "a", "ForeignKey", "field", "." ]
def handle_fk_field(self, obj, field): """ Called to handle a ForeignKey field. """ raise NotImplementedError
[ "def", "handle_fk_field", "(", "self", ",", "obj", ",", "field", ")", ":", "raise", "NotImplementedError" ]
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.2/django/core/serializers/base.py#L93-L97
lipiji/hierarchical-encoder-decoder
fa4ab3ddfbbb55ffebafedaa17b1b22472fc0936
utils_pg.py
python
use_gpu
(gpu_id)
[]
def use_gpu(gpu_id): if gpu_id > -1: theano.sandbox.cuda.use("gpu" + str(gpu_id))
[ "def", "use_gpu", "(", "gpu_id", ")", ":", "if", "gpu_id", ">", "-", "1", ":", "theano", ".", "sandbox", ".", "cuda", ".", "use", "(", "\"gpu\"", "+", "str", "(", "gpu_id", ")", ")" ]
https://github.com/lipiji/hierarchical-encoder-decoder/blob/fa4ab3ddfbbb55ffebafedaa17b1b22472fc0936/utils_pg.py#L9-L11
F-Secure/mittn
7808552dc85a7998895038fdb2fa5c5bbed90c3e
mittn/httpfuzzer/steps.py
python
step_impl
(context)
Go through responses and store any that contain a string from user-supplied list of strings into the database
Go through responses and store any that contain a string from user-supplied list of strings into the database
[ "Go", "through", "responses", "and", "store", "any", "that", "contain", "a", "string", "from", "user", "-", "supplied", "list", "of", "strings", "into", "the", "database" ]
def step_impl(context): """Go through responses and store any that contain a string from user-supplied list of strings into the database """ # Create a regex from the error response list error_list = [] for row in context.table: error_list.append(row['string']) error_list_regex = "(...
[ "def", "step_impl", "(", "context", ")", ":", "# Create a regex from the error response list", "error_list", "=", "[", "]", "for", "row", "in", "context", ".", "table", ":", "error_list", ".", "append", "(", "row", "[", "'string'", "]", ")", "error_list_regex", ...
https://github.com/F-Secure/mittn/blob/7808552dc85a7998895038fdb2fa5c5bbed90c3e/mittn/httpfuzzer/steps.py#L209-L231
quantopian/zipline
014f1fc339dc8b7671d29be2d85ce57d3daec343
zipline/utils/memoize.py
python
weak_lru_cache
(maxsize=100)
return desc
Weak least-recently-used cache decorator. If *maxsize* is set to None, the LRU features are disabled and the cache can grow without bound. Arguments to the cached function must be hashable. Any that are weak- referenceable will be stored by weak reference. Once any of the args have been garbage c...
Weak least-recently-used cache decorator.
[ "Weak", "least", "-", "recently", "-", "used", "cache", "decorator", "." ]
def weak_lru_cache(maxsize=100): """Weak least-recently-used cache decorator. If *maxsize* is set to None, the LRU features are disabled and the cache can grow without bound. Arguments to the cached function must be hashable. Any that are weak- referenceable will be stored by weak reference. Once...
[ "def", "weak_lru_cache", "(", "maxsize", "=", "100", ")", ":", "class", "desc", "(", "lazyval", ")", ":", "def", "__get__", "(", "self", ",", "instance", ",", "owner", ")", ":", "if", "instance", "is", "None", ":", "return", "self", "try", ":", "retu...
https://github.com/quantopian/zipline/blob/014f1fc339dc8b7671d29be2d85ce57d3daec343/zipline/utils/memoize.py#L211-L248
inasafe/inasafe
355eb2ce63f516b9c26af0c86a24f99e53f63f87
safe/gui/tools/wizard/step_fc25_hazlayer_from_browser.py
python
StepFcHazLayerFromBrowser.get_next_step
(self)
return new_step
Find the proper step when user clicks the Next button. :returns: The step to be switched to :rtype: WizardStep instance or None
Find the proper step when user clicks the Next button.
[ "Find", "the", "proper", "step", "when", "user", "clicks", "the", "Next", "button", "." ]
def get_next_step(self): """Find the proper step when user clicks the Next button. :returns: The step to be switched to :rtype: WizardStep instance or None """ if self.parent.is_selected_layer_keywordless: # insert keyword creation thread here self.parent...
[ "def", "get_next_step", "(", "self", ")", ":", "if", "self", ".", "parent", ".", "is_selected_layer_keywordless", ":", "# insert keyword creation thread here", "self", ".", "parent", ".", "parent_step", "=", "self", "self", ".", "parent", ".", "existing_keywords", ...
https://github.com/inasafe/inasafe/blob/355eb2ce63f516b9c26af0c86a24f99e53f63f87/safe/gui/tools/wizard/step_fc25_hazlayer_from_browser.py#L46-L60
ncbi-nlp/bluebert
ccc828c74e0eed942fd1ececff3638babc38269c
bert/run_classifier.py
python
MrpcProcessor._create_examples
(self, lines, set_type)
return examples
Creates examples for the training and dev sets.
Creates examples for the training and dev sets.
[ "Creates", "examples", "for", "the", "training", "and", "dev", "sets", "." ]
def _create_examples(self, lines, set_type): """Creates examples for the training and dev sets.""" examples = [] for (i, line) in enumerate(lines): if i == 0: continue guid = "%s-%s" % (set_type, i) text_a = tokenization.convert_to_unicode(line[3]) text_b = tokenization.conve...
[ "def", "_create_examples", "(", "self", ",", "lines", ",", "set_type", ")", ":", "examples", "=", "[", "]", "for", "(", "i", ",", "line", ")", "in", "enumerate", "(", "lines", ")", ":", "if", "i", "==", "0", ":", "continue", "guid", "=", "\"%s-%s\"...
https://github.com/ncbi-nlp/bluebert/blob/ccc828c74e0eed942fd1ececff3638babc38269c/bert/run_classifier.py#L317-L332
chribsen/simple-machine-learning-examples
dc94e52a4cebdc8bb959ff88b81ff8cfeca25022
venv/lib/python2.7/site-packages/scipy/_lib/_util.py
python
_lazywhere
(cond, arrays, f, fillvalue=None, f2=None)
return out
np.where(cond, x, fillvalue) always evaluates x even where cond is False. This one only evaluates f(arr1[cond], arr2[cond], ...). For example, >>> a, b = np.array([1, 2, 3, 4]), np.array([5, 6, 7, 8]) >>> def f(a, b): return a*b >>> _lazywhere(a > 2, (a, b), f, np.nan) array([ nan, nan,...
np.where(cond, x, fillvalue) always evaluates x even where cond is False. This one only evaluates f(arr1[cond], arr2[cond], ...). For example, >>> a, b = np.array([1, 2, 3, 4]), np.array([5, 6, 7, 8]) >>> def f(a, b): return a*b >>> _lazywhere(a > 2, (a, b), f, np.nan) array([ nan, nan,...
[ "np", ".", "where", "(", "cond", "x", "fillvalue", ")", "always", "evaluates", "x", "even", "where", "cond", "is", "False", ".", "This", "one", "only", "evaluates", "f", "(", "arr1", "[", "cond", "]", "arr2", "[", "cond", "]", "...", ")", ".", "For...
def _lazywhere(cond, arrays, f, fillvalue=None, f2=None): """ np.where(cond, x, fillvalue) always evaluates x even where cond is False. This one only evaluates f(arr1[cond], arr2[cond], ...). For example, >>> a, b = np.array([1, 2, 3, 4]), np.array([5, 6, 7, 8]) >>> def f(a, b): return a...
[ "def", "_lazywhere", "(", "cond", ",", "arrays", ",", "f", ",", "fillvalue", "=", "None", ",", "f2", "=", "None", ")", ":", "if", "fillvalue", "is", "None", ":", "if", "f2", "is", "None", ":", "raise", "ValueError", "(", "\"One of (fillvalue, f2) must be...
https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/scipy/_lib/_util.py#L26-L59
cudamat/cudamat
21baa0a82f189fae40cab3ab607c11cabfee8899
cudamat/cudamat.py
python
CUDAMatrix.add_row_vec
(self, vec, target=None)
return target
Add vector vec to every row of the matrix. If a target is provided, it is used to store the result instead of self.
Add vector vec to every row of the matrix. If a target is provided, it is used to store the result instead of self.
[ "Add", "vector", "vec", "to", "every", "row", "of", "the", "matrix", ".", "If", "a", "target", "is", "provided", "it", "is", "used", "to", "store", "the", "result", "instead", "of", "self", "." ]
def add_row_vec(self, vec, target=None): """ Add vector vec to every row of the matrix. If a target is provided, it is used to store the result instead of self. """ if not target: target = self err_code = _cudamat.add_row_vec(self.p_mat, vec.p_mat, target.p_...
[ "def", "add_row_vec", "(", "self", ",", "vec", ",", "target", "=", "None", ")", ":", "if", "not", "target", ":", "target", "=", "self", "err_code", "=", "_cudamat", ".", "add_row_vec", "(", "self", ".", "p_mat", ",", "vec", ".", "p_mat", ",", "target...
https://github.com/cudamat/cudamat/blob/21baa0a82f189fae40cab3ab607c11cabfee8899/cudamat/cudamat.py#L557-L570
deepmind/hanabi-learning-environment
54e79594f4b6fb40ebb3004289c6db0e34a8b5fb
hanabi_learning_environment/pyhanabi.py
python
HanabiGame.hand_size
(self)
return lib.HandSize(self._game)
Returns the maximum number of cards in each player hand. The number of cards in a player's hand may be smaller than this maximum a) at the beginning of the game before cards are dealt out, b) after any Play or Discard action and before the subsequent deal event, and c) after the deck is empty and cards...
Returns the maximum number of cards in each player hand.
[ "Returns", "the", "maximum", "number", "of", "cards", "in", "each", "player", "hand", "." ]
def hand_size(self): """Returns the maximum number of cards in each player hand. The number of cards in a player's hand may be smaller than this maximum a) at the beginning of the game before cards are dealt out, b) after any Play or Discard action and before the subsequent deal event, and c) after...
[ "def", "hand_size", "(", "self", ")", ":", "return", "lib", ".", "HandSize", "(", "self", ".", "_game", ")" ]
https://github.com/deepmind/hanabi-learning-environment/blob/54e79594f4b6fb40ebb3004289c6db0e34a8b5fb/hanabi_learning_environment/pyhanabi.py#L748-L756
SirVer/ultisnips
2c83e40ce66814bf813457bb58ea96184ab9bb81
pythonx/UltiSnips/snippet/definition/base.py
python
SnippetDefinition._re_match
(self, trigger)
return False
Test if a the current regex trigger matches `trigger`. If so, set _last_re and _matched.
Test if a the current regex trigger matches `trigger`.
[ "Test", "if", "a", "the", "current", "regex", "trigger", "matches", "trigger", "." ]
def _re_match(self, trigger): """Test if a the current regex trigger matches `trigger`. If so, set _last_re and _matched. """ for match in re.finditer(self._trigger, trigger): if match.end() != len(trigger): continue else: self._m...
[ "def", "_re_match", "(", "self", ",", "trigger", ")", ":", "for", "match", "in", "re", ".", "finditer", "(", "self", ".", "_trigger", ",", "trigger", ")", ":", "if", "match", ".", "end", "(", ")", "!=", "len", "(", "trigger", ")", ":", "continue", ...
https://github.com/SirVer/ultisnips/blob/2c83e40ce66814bf813457bb58ea96184ab9bb81/pythonx/UltiSnips/snippet/definition/base.py#L124-L138
google/capirca
679e3885e3a5e5e129dc2dfab204ec44d63b26a4
capirca/lib/windows_ipsec.py
python
Term._ComposeFilter
(self, srcaddr, dstaddr, proto, srcmask, dstmask, srcport, dstport)
return (self.CMD_PREFIX + self._FILTER_FORMAT.substitute( name=self.term_name + self._LIST_SUFFIX, atoms=' '.join(atoms)))
Convert the given parameters to a netsh filter rule string.
Convert the given parameters to a netsh filter rule string.
[ "Convert", "the", "given", "parameters", "to", "a", "netsh", "filter", "rule", "string", "." ]
def _ComposeFilter(self, srcaddr, dstaddr, proto, srcmask, dstmask, srcport, dstport): """Convert the given parameters to a netsh filter rule string.""" atoms = [] if srcmask == 0: atoms.append(self._ADDR_ATOM.substitute(dir='src', addr='any', mask='')) else: mask_atom ...
[ "def", "_ComposeFilter", "(", "self", ",", "srcaddr", ",", "dstaddr", ",", "proto", ",", "srcmask", ",", "dstmask", ",", "srcport", ",", "dstport", ")", ":", "atoms", "=", "[", "]", "if", "srcmask", "==", "0", ":", "atoms", ".", "append", "(", "self"...
https://github.com/google/capirca/blob/679e3885e3a5e5e129dc2dfab204ec44d63b26a4/capirca/lib/windows_ipsec.py#L138-L168
TencentCloud/tencentcloud-sdk-python
3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2
tencentcloud/tcr/v20190924/models.py
python
DescribeInstanceTokenResponse.__init__
(self)
r""" :param TotalCount: 长期访问凭证总数 :type TotalCount: int :param Tokens: 长期访问凭证列表 :type Tokens: list of TcrInstanceToken :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str
r""" :param TotalCount: 长期访问凭证总数 :type TotalCount: int :param Tokens: 长期访问凭证列表 :type Tokens: list of TcrInstanceToken :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str
[ "r", ":", "param", "TotalCount", ":", "长期访问凭证总数", ":", "type", "TotalCount", ":", "int", ":", "param", "Tokens", ":", "长期访问凭证列表", ":", "type", "Tokens", ":", "list", "of", "TcrInstanceToken", ":", "param", "RequestId", ":", "唯一请求", "ID,每次请求都会返回。定位问题时需要提供该次请求的"...
def __init__(self): r""" :param TotalCount: 长期访问凭证总数 :type TotalCount: int :param Tokens: 长期访问凭证列表 :type Tokens: list of TcrInstanceToken :param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 :type RequestId: str """ self.TotalCount = None ...
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "TotalCount", "=", "None", "self", ".", "Tokens", "=", "None", "self", ".", "RequestId", "=", "None" ]
https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/tcr/v20190924/models.py#L2836-L2847
tp4a/teleport
1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad
server/www/packages/packages-linux/x64/cryptography/x509/name.py
python
RelativeDistinguishedName.get_attributes_for_oid
(self, oid)
return [i for i in self if i.oid == oid]
[]
def get_attributes_for_oid(self, oid): return [i for i in self if i.oid == oid]
[ "def", "get_attributes_for_oid", "(", "self", ",", "oid", ")", ":", "return", "[", "i", "for", "i", "in", "self", "if", "i", ".", "oid", "==", "oid", "]" ]
https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-linux/x64/cryptography/x509/name.py#L162-L163
pandas-dev/pandas
5ba7d714014ae8feaccc0dd4a98890828cf2832d
pandas/core/ops/__init__.py
python
should_reindex_frame_op
( left: DataFrame, right, op, axis, default_axis, fill_value, level )
return False
Check if this is an operation between DataFrames that will need to reindex.
Check if this is an operation between DataFrames that will need to reindex.
[ "Check", "if", "this", "is", "an", "operation", "between", "DataFrames", "that", "will", "need", "to", "reindex", "." ]
def should_reindex_frame_op( left: DataFrame, right, op, axis, default_axis, fill_value, level ) -> bool: """ Check if this is an operation between DataFrames that will need to reindex. """ assert isinstance(left, ABCDataFrame) if op is operator.pow or op is roperator.rpow: # GH#32685 p...
[ "def", "should_reindex_frame_op", "(", "left", ":", "DataFrame", ",", "right", ",", "op", ",", "axis", ",", "default_axis", ",", "fill_value", ",", "level", ")", "->", "bool", ":", "assert", "isinstance", "(", "left", ",", "ABCDataFrame", ")", "if", "op", ...
https://github.com/pandas-dev/pandas/blob/5ba7d714014ae8feaccc0dd4a98890828cf2832d/pandas/core/ops/__init__.py#L315-L341
partho-maple/coding-interview-gym
f9b28916da31935a27900794cfb8b91be3b38b9b
leetcode.com/python/21_Merge_Two_Sorted_Lists.py
python
MyLinkedList.getNode
(self, index)
return node
:type index: int :rtype: Node | None
:type index: int :rtype: Node | None
[ ":", "type", "index", ":", "int", ":", "rtype", ":", "Node", "|", "None" ]
def getNode(self, index): """ :type index: int :rtype: Node | None """ if index >= self.size or index < 0: return None node = self.first while index > 0: node = node.next index -= 1 return node
[ "def", "getNode", "(", "self", ",", "index", ")", ":", "if", "index", ">=", "self", ".", "size", "or", "index", "<", "0", ":", "return", "None", "node", "=", "self", ".", "first", "while", "index", ">", "0", ":", "node", "=", "node", ".", "next",...
https://github.com/partho-maple/coding-interview-gym/blob/f9b28916da31935a27900794cfb8b91be3b38b9b/leetcode.com/python/21_Merge_Two_Sorted_Lists.py#L23-L34
luispedro/milk
abc2a28b526c199414d42c0a26092938968c3caf
milk/unsupervised/nnmf/hoyer.py
python
sparse_nnmf
(V, r, sparsenessW=None, sparsenessH=None, max_iter=10000, R=None)
return W,H
W,H = hoyer.sparse_nnmf(V, r, sparsenessW = None, sparsenessH = None, max_iter=10000, R=None) Implement sparse nonnegative matrix factorisation. Parameters ---------- V : 2-D matrix input feature matrix r : integer number of latent features sparsenessW : double, optional ...
W,H = hoyer.sparse_nnmf(V, r, sparsenessW = None, sparsenessH = None, max_iter=10000, R=None)
[ "W", "H", "=", "hoyer", ".", "sparse_nnmf", "(", "V", "r", "sparsenessW", "=", "None", "sparsenessH", "=", "None", "max_iter", "=", "10000", "R", "=", "None", ")" ]
def sparse_nnmf(V, r, sparsenessW=None, sparsenessH=None, max_iter=10000, R=None): ''' W,H = hoyer.sparse_nnmf(V, r, sparsenessW = None, sparsenessH = None, max_iter=10000, R=None) Implement sparse nonnegative matrix factorisation. Parameters ---------- V : 2-D matrix input feature mat...
[ "def", "sparse_nnmf", "(", "V", ",", "r", ",", "sparsenessW", "=", "None", ",", "sparsenessH", "=", "None", ",", "max_iter", "=", "10000", ",", "R", "=", "None", ")", ":", "n", ",", "m", "=", "V", ".", "shape", "R", "=", "get_nprandom", "(", "R",...
https://github.com/luispedro/milk/blob/abc2a28b526c199414d42c0a26092938968c3caf/milk/unsupervised/nnmf/hoyer.py#L75-L143
astropy/photutils
3caa48e4e4d139976ed7457dc41583fb2c56ba20
photutils/psf/matching/windows.py
python
SplitCosineBellWindow.__call__
(self, shape)
return f
Return a 2D split cosine bell. Parameters ---------- shape : tuple of int The size of the output array along each axis. Returns ------- result : `~numpy.ndarray` A 2D array containing the cosine bell values.
Return a 2D split cosine bell.
[ "Return", "a", "2D", "split", "cosine", "bell", "." ]
def __call__(self, shape): """ Return a 2D split cosine bell. Parameters ---------- shape : tuple of int The size of the output array along each axis. Returns ------- result : `~numpy.ndarray` A 2D array containing the cosine bell...
[ "def", "__call__", "(", "self", ",", "shape", ")", ":", "radial_dist", "=", "_radial_distance", "(", "shape", ")", "npts", "=", "(", "np", ".", "array", "(", "shape", ")", ".", "min", "(", ")", "-", "1.", ")", "/", "2.", "r_inner", "=", "self", "...
https://github.com/astropy/photutils/blob/3caa48e4e4d139976ed7457dc41583fb2c56ba20/photutils/psf/matching/windows.py#L79-L108
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/users/models.py
python
UserReportingMetadataStaging.add_heartbeat
(cls, domain, user_id, app_id, build_id, sync_date, device_id, app_version, num_unsent_forms, num_quarantined_forms, commcare_version, build_profile_id)
[]
def add_heartbeat(cls, domain, user_id, app_id, build_id, sync_date, device_id, app_version, num_unsent_forms, num_quarantined_forms, commcare_version, build_profile_id): params = { 'domain': domain, 'user_id': user_id, 'app_id': app_id, 'build_id': build_...
[ "def", "add_heartbeat", "(", "cls", ",", "domain", ",", "user_id", ",", "app_id", ",", "build_id", ",", "sync_date", ",", "device_id", ",", "app_version", ",", "num_unsent_forms", ",", "num_quarantined_forms", ",", "commcare_version", ",", "build_profile_id", ")",...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/users/models.py#L2935-L2978
Epistimio/orion
732e739d99561020dbe620760acf062ade746006
src/orion/core/evc/adapters.py
python
apply_if_valid
(name, trial, callback=None, raise_if_not=True)
return False
Detect a parameter in trial and call a callback on it if provided Parameters ---------- name: str Name of the param to look for trial: `orion.core.worker.trial.Trial` Instance of trial to investigate callback: None of callable Function to call with (trial, param) with a para...
Detect a parameter in trial and call a callback on it if provided
[ "Detect", "a", "parameter", "in", "trial", "and", "call", "a", "callback", "on", "it", "if", "provided" ]
def apply_if_valid(name, trial, callback=None, raise_if_not=True): """Detect a parameter in trial and call a callback on it if provided Parameters ---------- name: str Name of the param to look for trial: `orion.core.worker.trial.Trial` Instance of trial to investigate callback:...
[ "def", "apply_if_valid", "(", "name", ",", "trial", ",", "callback", "=", "None", ",", "raise_if_not", "=", "True", ")", ":", "for", "param", "in", "trial", ".", "_params", ":", "# pylint: disable=protected-access", "if", "param", ".", "name", "==", "name", ...
https://github.com/Epistimio/orion/blob/732e739d99561020dbe620760acf062ade746006/src/orion/core/evc/adapters.py#L228-L262
optuna/optuna
2c44c1a405ba059efd53f4b9c8e849d20fb95c0a
optuna/study/_optimize.py
python
_optimize
( study: "optuna.Study", func: "optuna.study.study.ObjectiveFuncType", n_trials: Optional[int] = None, timeout: Optional[float] = None, n_jobs: int = 1, catch: Tuple[Type[Exception], ...] = (), callbacks: Optional[List[Callable[["optuna.Study", FrozenTrial], None]]] = None, gc_after_tria...
[]
def _optimize( study: "optuna.Study", func: "optuna.study.study.ObjectiveFuncType", n_trials: Optional[int] = None, timeout: Optional[float] = None, n_jobs: int = 1, catch: Tuple[Type[Exception], ...] = (), callbacks: Optional[List[Callable[["optuna.Study", FrozenTrial], None]]] = None, ...
[ "def", "_optimize", "(", "study", ":", "\"optuna.Study\"", ",", "func", ":", "\"optuna.study.study.ObjectiveFuncType\"", ",", "n_trials", ":", "Optional", "[", "int", "]", "=", "None", ",", "timeout", ":", "Optional", "[", "float", "]", "=", "None", ",", "n_...
https://github.com/optuna/optuna/blob/2c44c1a405ba059efd53f4b9c8e849d20fb95c0a/optuna/study/_optimize.py#L40-L125
vita-epfl/monoloco
f5e82c48e8ee5af352f2c9b1690050f4e02fc1b6
monoloco/prep/preprocess_nu.py
python
factory
(dataset, dir_nuscenes)
return nusc, scenes, split_train, split_val
Define dataset type and split training and validation
Define dataset type and split training and validation
[ "Define", "dataset", "type", "and", "split", "training", "and", "validation" ]
def factory(dataset, dir_nuscenes): """Define dataset type and split training and validation""" assert dataset in ['nuscenes', 'nuscenes_mini', 'nuscenes_teaser'] if dataset == 'nuscenes_mini': version = 'v1.0-mini' else: version = 'v1.0-trainval' nusc = NuScenes(version=version, d...
[ "def", "factory", "(", "dataset", ",", "dir_nuscenes", ")", ":", "assert", "dataset", "in", "[", "'nuscenes'", ",", "'nuscenes_mini'", ",", "'nuscenes_teaser'", "]", "if", "dataset", "==", "'nuscenes_mini'", ":", "version", "=", "'v1.0-mini'", "else", ":", "ve...
https://github.com/vita-epfl/monoloco/blob/f5e82c48e8ee5af352f2c9b1690050f4e02fc1b6/monoloco/prep/preprocess_nu.py#L185-L209
yaml/pyyaml
8cdff2c80573b8be8e8ad28929264a913a63aa33
lib/yaml/__init__.py
python
add_multi_constructor
(tag_prefix, multi_constructor, Loader=None)
Add a multi-constructor for the given tag prefix. Multi-constructor is called for a node if its tag starts with tag_prefix. Multi-constructor accepts a Loader instance, a tag suffix, and a node object and produces the corresponding Python object.
Add a multi-constructor for the given tag prefix. Multi-constructor is called for a node if its tag starts with tag_prefix. Multi-constructor accepts a Loader instance, a tag suffix, and a node object and produces the corresponding Python object.
[ "Add", "a", "multi", "-", "constructor", "for", "the", "given", "tag", "prefix", ".", "Multi", "-", "constructor", "is", "called", "for", "a", "node", "if", "its", "tag", "starts", "with", "tag_prefix", ".", "Multi", "-", "constructor", "accepts", "a", "...
def add_multi_constructor(tag_prefix, multi_constructor, Loader=None): """ Add a multi-constructor for the given tag prefix. Multi-constructor is called for a node if its tag starts with tag_prefix. Multi-constructor accepts a Loader instance, a tag suffix, and a node object and produces the corresp...
[ "def", "add_multi_constructor", "(", "tag_prefix", ",", "multi_constructor", ",", "Loader", "=", "None", ")", ":", "if", "Loader", "is", "None", ":", "loader", ".", "Loader", ".", "add_multi_constructor", "(", "tag_prefix", ",", "multi_constructor", ")", "loader...
https://github.com/yaml/pyyaml/blob/8cdff2c80573b8be8e8ad28929264a913a63aa33/lib/yaml/__init__.py#L315-L327
NervanaSystems/neon
8c3fb8a93b4a89303467b25817c60536542d08bd
neon/layers/layer.py
python
BranchNode.bprop
(self, error, alpha=1.0, beta=0.0)
Branch nodes should be skipped in bprop, since their deltas are shared Arguments: error (Tensor): deltas back propagated from the adjacent higher layer alpha (float, optional): scale to apply to input for activation gradient bprop. Defaults to 1.0 ...
Branch nodes should be skipped in bprop, since their deltas are shared
[ "Branch", "nodes", "should", "be", "skipped", "in", "bprop", "since", "their", "deltas", "are", "shared" ]
def bprop(self, error, alpha=1.0, beta=0.0): """ Branch nodes should be skipped in bprop, since their deltas are shared Arguments: error (Tensor): deltas back propagated from the adjacent higher layer alpha (float, optional): scale to apply to input for activation ...
[ "def", "bprop", "(", "self", ",", "error", ",", "alpha", "=", "1.0", ",", "beta", "=", "0.0", ")", ":", "pass" ]
https://github.com/NervanaSystems/neon/blob/8c3fb8a93b4a89303467b25817c60536542d08bd/neon/layers/layer.py#L417-L431
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/plotly/graph_objs/layout/_shape.py
python
Shape.yanchor
(self)
return self["yanchor"]
Only relevant in conjunction with `ysizemode` set to "pixel". Specifies the anchor point on the y axis to which `y0`, `y1` and y coordinates within `path` are relative to. E.g. useful to attach a pixel sized shape to a certain data value. No effect when `ysizemode` not set to "pixel". ...
Only relevant in conjunction with `ysizemode` set to "pixel". Specifies the anchor point on the y axis to which `y0`, `y1` and y coordinates within `path` are relative to. E.g. useful to attach a pixel sized shape to a certain data value. No effect when `ysizemode` not set to "pixel". ...
[ "Only", "relevant", "in", "conjunction", "with", "ysizemode", "set", "to", "pixel", ".", "Specifies", "the", "anchor", "point", "on", "the", "y", "axis", "to", "which", "y0", "y1", "and", "y", "coordinates", "within", "path", "are", "relative", "to", ".", ...
def yanchor(self): """ Only relevant in conjunction with `ysizemode` set to "pixel". Specifies the anchor point on the y axis to which `y0`, `y1` and y coordinates within `path` are relative to. E.g. useful to attach a pixel sized shape to a certain data value. No effect ...
[ "def", "yanchor", "(", "self", ")", ":", "return", "self", "[", "\"yanchor\"", "]" ]
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/layout/_shape.py#L528-L542
nchammas/flintrock
fad4e15877a5bf7058395ecbc7be717b21ef6b85
flintrock/flintrock.py
python
format_message
(*, message: str, indent: int=4, wrap: int=70)
return textwrap.indent( textwrap.fill( textwrap.dedent(text=message), width=wrap), prefix=' ' * indent)
Format a lengthy message for printing to screen.
Format a lengthy message for printing to screen.
[ "Format", "a", "lengthy", "message", "for", "printing", "to", "screen", "." ]
def format_message(*, message: str, indent: int=4, wrap: int=70): """ Format a lengthy message for printing to screen. """ return textwrap.indent( textwrap.fill( textwrap.dedent(text=message), width=wrap), prefix=' ' * indent)
[ "def", "format_message", "(", "*", ",", "message", ":", "str", ",", "indent", ":", "int", "=", "4", ",", "wrap", ":", "int", "=", "70", ")", ":", "return", "textwrap", ".", "indent", "(", "textwrap", ".", "fill", "(", "textwrap", ".", "dedent", "("...
https://github.com/nchammas/flintrock/blob/fad4e15877a5bf7058395ecbc7be717b21ef6b85/flintrock/flintrock.py#L46-L54
openstack/nova
b49b7663e1c3073917d5844b81d38db8e86d05c4
nova/compute/manager.py
python
ComputeManager._confirm_snapshot_based_resize_delete_port_bindings
( self, ctxt, instance)
Delete port bindings for the source host when confirming snapshot-based resize on the source host." :param ctxt: nova auth RequestContext :param instance: Instance object that was resized/cold migrated
Delete port bindings for the source host when confirming snapshot-based resize on the source host."
[ "Delete", "port", "bindings", "for", "the", "source", "host", "when", "confirming", "snapshot", "-", "based", "resize", "on", "the", "source", "host", "." ]
def _confirm_snapshot_based_resize_delete_port_bindings( self, ctxt, instance): """Delete port bindings for the source host when confirming snapshot-based resize on the source host." :param ctxt: nova auth RequestContext :param instance: Instance object that was resized/cold...
[ "def", "_confirm_snapshot_based_resize_delete_port_bindings", "(", "self", ",", "ctxt", ",", "instance", ")", ":", "LOG", ".", "debug", "(", "'Deleting port bindings for source host.'", ",", "instance", "=", "instance", ")", "try", ":", "self", ".", "network_api", "...
https://github.com/openstack/nova/blob/b49b7663e1c3073917d5844b81d38db8e86d05c4/nova/compute/manager.py#L4562-L4579
assertpy/assertpy
c970c6612a80aa10769dc612324630d27019e1b5
assertpy/string.py
python
StringMixin.contains_ignoring_case
(self, *items)
return self
Asserts that val is string and contains the given item or items. Walks val and checks for item or items using the ``==`` operator and ``str.lower()``. Args: *items: the item or items expected to be contained Examples: Usage:: assert_that('foo').contain...
Asserts that val is string and contains the given item or items.
[ "Asserts", "that", "val", "is", "string", "and", "contains", "the", "given", "item", "or", "items", "." ]
def contains_ignoring_case(self, *items): """Asserts that val is string and contains the given item or items. Walks val and checks for item or items using the ``==`` operator and ``str.lower()``. Args: *items: the item or items expected to be contained Examples: ...
[ "def", "contains_ignoring_case", "(", "self", ",", "*", "items", ")", ":", "if", "len", "(", "items", ")", "==", "0", ":", "raise", "ValueError", "(", "'one or more args must be given'", ")", "if", "isinstance", "(", "self", ".", "val", ",", "str_types", "...
https://github.com/assertpy/assertpy/blob/c970c6612a80aa10769dc612324630d27019e1b5/assertpy/string.py#L77-L136
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
Python-2.7.13/Lib/urllib2.py
python
FileHandler.file_open
(self, req)
[]
def file_open(self, req): url = req.get_selector() if url[:2] == '//' and url[2:3] != '/' and (req.host and req.host != 'localhost'): req.type = 'ftp' return self.parent.open(req) else: return self.open_local_file(req)
[ "def", "file_open", "(", "self", ",", "req", ")", ":", "url", "=", "req", ".", "get_selector", "(", ")", "if", "url", "[", ":", "2", "]", "==", "'//'", "and", "url", "[", "2", ":", "3", "]", "!=", "'/'", "and", "(", "req", ".", "host", "and",...
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/urllib2.py#L1329-L1336
blurstudio/cross3d
277968d1227de740fc87ef61005c75034420eadf
cross3d/studiomax/studiomaxscene.py
python
StudiomaxScene.renderOutputPath
(self)
return mxs.rendOutputFilename
\remarks return the render output file path for the scene \return <str>
\remarks return the render output file path for the scene \return <str>
[ "\\", "remarks", "return", "the", "render", "output", "file", "path", "for", "the", "scene", "\\", "return", "<str", ">" ]
def renderOutputPath(self): """ \remarks return the render output file path for the scene \return <str> """ return mxs.rendOutputFilename
[ "def", "renderOutputPath", "(", "self", ")", ":", "return", "mxs", ".", "rendOutputFilename" ]
https://github.com/blurstudio/cross3d/blob/277968d1227de740fc87ef61005c75034420eadf/cross3d/studiomax/studiomaxscene.py#L2836-L2841
golismero/golismero
7d605b937e241f51c1ca4f47b20f755eeefb9d76
golismero/api/data/vulnerability/suspicious/header.py
python
SuspiciousHeader.name
(self)
return self.__name
:returns: Header name. :rtype: str
:returns: Header name. :rtype: str
[ ":", "returns", ":", "Header", "name", ".", ":", "rtype", ":", "str" ]
def name(self): """ :returns: Header name. :rtype: str """ return self.__name
[ "def", "name", "(", "self", ")", ":", "return", "self", ".", "__name" ]
https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/golismero/api/data/vulnerability/suspicious/header.py#L79-L84
ceph/ceph-ansible
583e60af84180f0414d67ee52c3ec7cd64ddb4dd
library/ceph_key.py
python
get_key
(cluster, user, user_key, name, dest, container_image=None)
return cmd_list
Get a CephX key (write on the filesystem)
Get a CephX key (write on the filesystem)
[ "Get", "a", "CephX", "key", "(", "write", "on", "the", "filesystem", ")" ]
def get_key(cluster, user, user_key, name, dest, container_image=None): ''' Get a CephX key (write on the filesystem) ''' cmd_list = [] args = [ 'get', name, '-o', dest, ] cmd_list.append(generate_ceph_cmd(sub_cmd=['auth'], ...
[ "def", "get_key", "(", "cluster", ",", "user", ",", "user_key", ",", "name", ",", "dest", ",", "container_image", "=", "None", ")", ":", "cmd_list", "=", "[", "]", "args", "=", "[", "'get'", ",", "name", ",", "'-o'", ",", "dest", ",", "]", "cmd_lis...
https://github.com/ceph/ceph-ansible/blob/583e60af84180f0414d67ee52c3ec7cd64ddb4dd/library/ceph_key.py#L339-L360
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/StdLib/Lib/tkinter/__init__.py
python
Wm.wm_overrideredirect
(self, boolean=None)
return self._getboolean(self.tk.call( 'wm', 'overrideredirect', self._w, boolean))
Instruct the window manager to ignore this widget if BOOLEAN is given with 1. Return the current value if None is given.
Instruct the window manager to ignore this widget if BOOLEAN is given with 1. Return the current value if None is given.
[ "Instruct", "the", "window", "manager", "to", "ignore", "this", "widget", "if", "BOOLEAN", "is", "given", "with", "1", ".", "Return", "the", "current", "value", "if", "None", "is", "given", "." ]
def wm_overrideredirect(self, boolean=None): """Instruct the window manager to ignore this widget if BOOLEAN is given with 1. Return the current value if None is given.""" return self._getboolean(self.tk.call( 'wm', 'overrideredirect', self._w, boolean))
[ "def", "wm_overrideredirect", "(", "self", ",", "boolean", "=", "None", ")", ":", "return", "self", ".", "_getboolean", "(", "self", ".", "tk", ".", "call", "(", "'wm'", ",", "'overrideredirect'", ",", "self", ".", "_w", ",", "boolean", ")", ")" ]
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/tkinter/__init__.py#L1776-L1781
aleju/imgaug
0101108d4fed06bc5056c4a03e2bcb0216dac326
imgaug/augmenters/color.py
python
RemoveSaturation.__init__
(self, mul=1, from_colorspace=CSPACE_RGB, seed=None, name=None, random_state="deprecated", deterministic="deprecated")
[]
def __init__(self, mul=1, from_colorspace=CSPACE_RGB, seed=None, name=None, random_state="deprecated", deterministic="deprecated"): mul = iap.Subtract( 1.0, iap.handle_continuous_param(mul, "mul", value_range=(0.0,...
[ "def", "__init__", "(", "self", ",", "mul", "=", "1", ",", "from_colorspace", "=", "CSPACE_RGB", ",", "seed", "=", "None", ",", "name", "=", "None", ",", "random_state", "=", "\"deprecated\"", ",", "deterministic", "=", "\"deprecated\"", ")", ":", "mul", ...
https://github.com/aleju/imgaug/blob/0101108d4fed06bc5056c4a03e2bcb0216dac326/imgaug/augmenters/color.py#L2180-L2194