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
sympy/sympy
d822fcba181155b85ff2b29fe525adbafb22b448
sympy/stats/random_matrix_models.py
python
CircularEnsembleModel._compute_joint_eigen_distribution
(self, beta)
return Lambda(tuple(syms), f/Zbn)
Helper function to compute the joint distribution of phases of the complex eigen values of matrices belonging to any circular ensembles.
Helper function to compute the joint distribution of phases of the complex eigen values of matrices belonging to any circular ensembles.
[ "Helper", "function", "to", "compute", "the", "joint", "distribution", "of", "phases", "of", "the", "complex", "eigen", "values", "of", "matrices", "belonging", "to", "any", "circular", "ensembles", "." ]
def _compute_joint_eigen_distribution(self, beta): """ Helper function to compute the joint distribution of phases of the complex eigen values of matrices belonging to any circular ensembles. """ n = self.dimension Zbn = ((2*pi)**n)*(gamma(beta*n/2 + 1)/S(gamma(be...
[ "def", "_compute_joint_eigen_distribution", "(", "self", ",", "beta", ")", ":", "n", "=", "self", ".", "dimension", "Zbn", "=", "(", "(", "2", "*", "pi", ")", "**", "n", ")", "*", "(", "gamma", "(", "beta", "*", "n", "/", "2", "+", "1", ")", "/...
https://github.com/sympy/sympy/blob/d822fcba181155b85ff2b29fe525adbafb22b448/sympy/stats/random_matrix_models.py#L255-L269
cbrgm/telegram-robot-rss
58fe98de427121fdc152c8df0721f1891174e6c9
venv/lib/python2.7/site-packages/future/backports/email/_encoded_words.py
python
decode
(ew)
return string, charset, lang, defects
Decode encoded word and return (string, charset, lang, defects) tuple. An RFC 2047/2243 encoded word has the form: =?charset*lang?cte?encoded_string?= where '*lang' may be omitted but the other parts may not be. This function expects exactly such a string (that is, it does not check the synt...
Decode encoded word and return (string, charset, lang, defects) tuple.
[ "Decode", "encoded", "word", "and", "return", "(", "string", "charset", "lang", "defects", ")", "tuple", "." ]
def decode(ew): """Decode encoded word and return (string, charset, lang, defects) tuple. An RFC 2047/2243 encoded word has the form: =?charset*lang?cte?encoded_string?= where '*lang' may be omitted but the other parts may not be. This function expects exactly such a string (that is, it does...
[ "def", "decode", "(", "ew", ")", ":", "_", ",", "charset", ",", "cte", ",", "cte_string", ",", "_", "=", "str", "(", "ew", ")", ".", "split", "(", "'?'", ")", "charset", ",", "_", ",", "lang", "=", "charset", ".", "partition", "(", "'*'", ")", ...
https://github.com/cbrgm/telegram-robot-rss/blob/58fe98de427121fdc152c8df0721f1891174e6c9/venv/lib/python2.7/site-packages/future/backports/email/_encoded_words.py#L150-L189
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/boto-2.46.1/boto/configservice/__init__.py
python
regions
()
return get_regions('configservice', connection_cls=ConfigServiceConnection)
Get all available regions for the AWS Config service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo`
Get all available regions for the AWS Config service.
[ "Get", "all", "available", "regions", "for", "the", "AWS", "Config", "service", "." ]
def regions(): """ Get all available regions for the AWS Config service. :rtype: list :return: A list of :class:`boto.regioninfo.RegionInfo` """ from boto.configservice.layer1 import ConfigServiceConnection return get_regions('configservice', connection_cls=ConfigServiceConnection)
[ "def", "regions", "(", ")", ":", "from", "boto", ".", "configservice", ".", "layer1", "import", "ConfigServiceConnection", "return", "get_regions", "(", "'configservice'", ",", "connection_cls", "=", "ConfigServiceConnection", ")" ]
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/boto-2.46.1/boto/configservice/__init__.py#L27-L35
CGCookie/retopoflow
3d8b3a47d1d661f99ab0aeb21d31370bf15de35e
retopoflow/rfmesh/rfmesh_wrapper.py
python
BMElemWrapper.__hash__
(self)
return hash(self.bmelem)
[]
def __hash__(self): return hash(self.bmelem)
[ "def", "__hash__", "(", "self", ")", ":", "return", "hash", "(", "self", ".", "bmelem", ")" ]
https://github.com/CGCookie/retopoflow/blob/3d8b3a47d1d661f99ab0aeb21d31370bf15de35e/retopoflow/rfmesh/rfmesh_wrapper.py#L89-L90
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/schemes/toric/morphism.py
python
SchemeMorphism_fan_toric_variety_dominant.fiber_generic
(self)
return X, fm.index()
r""" Return the generic fiber. OUTPUT: - a tuple `(X, n)`, where `X` is a :class:`toric variety <sage.schemes.toric.variety.ToricVariety_field>` with the embedding morphism into domain of ``self`` and `n` is an integer. The fiber over the base point with homogeneou...
r""" Return the generic fiber.
[ "r", "Return", "the", "generic", "fiber", "." ]
def fiber_generic(self): r""" Return the generic fiber. OUTPUT: - a tuple `(X, n)`, where `X` is a :class:`toric variety <sage.schemes.toric.variety.ToricVariety_field>` with the embedding morphism into domain of ``self`` and `n` is an integer. The fiber ov...
[ "def", "fiber_generic", "(", "self", ")", ":", "from", "sage", ".", "schemes", ".", "toric", ".", "variety", "import", "ToricVariety", "fm", "=", "self", ".", "fan_morphism", "(", ")", "X", "=", "ToricVariety", "(", "fm", ".", "kernel_fan", "(", ")", "...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/schemes/toric/morphism.py#L1381-L1444
donnemartin/data-science-ipython-notebooks
5b3c00d462c6e9200315afe46d0093948621eb95
scipy/thinkstats2.py
python
_DictWrapper.Render
(self, **options)
return zip(*sorted(self.Items()))
Generates a sequence of points suitable for plotting. Note: options are ignored Returns: tuple of (sorted value sequence, freq/prob sequence)
Generates a sequence of points suitable for plotting.
[ "Generates", "a", "sequence", "of", "points", "suitable", "for", "plotting", "." ]
def Render(self, **options): """Generates a sequence of points suitable for plotting. Note: options are ignored Returns: tuple of (sorted value sequence, freq/prob sequence) """ if min(self.d.keys()) is np.nan: logging.warning('Hist: contains NaN, may no...
[ "def", "Render", "(", "self", ",", "*", "*", "options", ")", ":", "if", "min", "(", "self", ".", "d", ".", "keys", "(", ")", ")", "is", "np", ".", "nan", ":", "logging", ".", "warning", "(", "'Hist: contains NaN, may not render correctly.'", ")", "retu...
https://github.com/donnemartin/data-science-ipython-notebooks/blob/5b3c00d462c6e9200315afe46d0093948621eb95/scipy/thinkstats2.py#L284-L295
pabigot/pyxb
14737c23a125fd12c954823ad64fc4497816fae3
pyxb/utils/fac.py
python
State.__get_automaton
(self)
return self.__automaton
Link to the L{Automaton} to which the state belongs.
Link to the L{Automaton} to which the state belongs.
[ "Link", "to", "the", "L", "{", "Automaton", "}", "to", "which", "the", "state", "belongs", "." ]
def __get_automaton (self): """Link to the L{Automaton} to which the state belongs.""" return self.__automaton
[ "def", "__get_automaton", "(", "self", ")", ":", "return", "self", ".", "__automaton" ]
https://github.com/pabigot/pyxb/blob/14737c23a125fd12c954823ad64fc4497816fae3/pyxb/utils/fac.py#L180-L182
steeve/xbmctorrent
e6bcb1037668959e1e3cb5ba8cf3e379c6638da9
resources/site-packages/concurrent/futures/process.py
python
ProcessPoolExecutor.shutdown
(self, wait=True)
[]
def shutdown(self, wait=True): with self._shutdown_lock: self._shutdown_thread = True if self._queue_management_thread: # Wake up queue management thread self._result_queue.put(None) if wait: self._queue_management_thread.join() # T...
[ "def", "shutdown", "(", "self", ",", "wait", "=", "True", ")", ":", "with", "self", ".", "_shutdown_lock", ":", "self", ".", "_shutdown_thread", "=", "True", "if", "self", ".", "_queue_management_thread", ":", "# Wake up queue management thread", "self", ".", ...
https://github.com/steeve/xbmctorrent/blob/e6bcb1037668959e1e3cb5ba8cf3e379c6638da9/resources/site-packages/concurrent/futures/process.py#L347-L360
geometalab/Vector-Tiles-Reader-QGIS-Plugin
a31ae86959c8f3b7d6f332f84191cd7ca4683e1d
ext-libs/shapely/coords.py
python
BoundsOp.__call__
(self, this)
return (minx, miny, maxx, maxy)
[]
def __call__(self, this): self._validate(this) env = this.envelope if env.geom_type == 'Point': return env.bounds cs = lgeos.GEOSGeom_getCoordSeq(env.exterior._geom) cs_len = c_uint(0) lgeos.GEOSCoordSeq_getSize(cs, byref(cs_len)) minx = 1.e+20 ...
[ "def", "__call__", "(", "self", ",", "this", ")", ":", "self", ".", "_validate", "(", "this", ")", "env", "=", "this", ".", "envelope", "if", "env", ".", "geom_type", "==", "'Point'", ":", "return", "env", ".", "bounds", "cs", "=", "lgeos", ".", "G...
https://github.com/geometalab/Vector-Tiles-Reader-QGIS-Plugin/blob/a31ae86959c8f3b7d6f332f84191cd7ca4683e1d/ext-libs/shapely/coords.py#L164-L186
huggingface/datasets
249b4a38390bf1543f5b6e2f3dc208b5689c1c13
datasets/wiki_bio/wiki_bio.py
python
_get_table
(infobox_line)
return infobox_line_as_table
Converts the infobox into a one row table.
Converts the infobox into a one row table.
[ "Converts", "the", "infobox", "into", "a", "one", "row", "table", "." ]
def _get_table(infobox_line): """Converts the infobox into a one row table.""" cells = infobox_line.split("\t") # remove empty cells cells = list(filter(lambda x: x.find("<none>") == -1, cells)) columns = set([cell[0 : cell.split(":")[0].rfind("_")] for cell in cells]) table = {col: dict() for c...
[ "def", "_get_table", "(", "infobox_line", ")", ":", "cells", "=", "infobox_line", ".", "split", "(", "\"\\t\"", ")", "# remove empty cells", "cells", "=", "list", "(", "filter", "(", "lambda", "x", ":", "x", ".", "find", "(", "\"<none>\"", ")", "==", "-"...
https://github.com/huggingface/datasets/blob/249b4a38390bf1543f5b6e2f3dc208b5689c1c13/datasets/wiki_bio/wiki_bio.py#L64-L89
catap/namebench
9913a7a1a7955a3759eb18cbe73b421441a7a00f
nb_third_party/jinja2/utils.py
python
LRUCache.setdefault
(self, key, default=None)
Set `default` if the key is not in the cache otherwise leave unchanged. Return the value of this key.
Set `default` if the key is not in the cache otherwise leave unchanged. Return the value of this key.
[ "Set", "default", "if", "the", "key", "is", "not", "in", "the", "cache", "otherwise", "leave", "unchanged", ".", "Return", "the", "value", "of", "this", "key", "." ]
def setdefault(self, key, default=None): """Set `default` if the key is not in the cache otherwise leave unchanged. Return the value of this key. """ try: return self[key] except KeyError: self[key] = default return default
[ "def", "setdefault", "(", "self", ",", "key", ",", "default", "=", "None", ")", ":", "try", ":", "return", "self", "[", "key", "]", "except", "KeyError", ":", "self", "[", "key", "]", "=", "default", "return", "default" ]
https://github.com/catap/namebench/blob/9913a7a1a7955a3759eb18cbe73b421441a7a00f/nb_third_party/jinja2/utils.py#L607-L615
robinhood/faust
01b4c0ad8390221db71751d80001b0fd879291e2
faust/livecheck/runners.py
python
TestRunner.on_error
(self, exc: BaseException)
Call when test execution raises error.
Call when test execution raises error.
[ "Call", "when", "test", "execution", "raises", "error", "." ]
async def on_error(self, exc: BaseException) -> None: """Call when test execution raises error.""" self.end() self.state = State.ERROR self.error = exc self.log.exception('Test raised: %r', exc) await self.case.on_test_error(self, exc) await self._finalize_report(...
[ "async", "def", "on_error", "(", "self", ",", "exc", ":", "BaseException", ")", "->", "None", ":", "self", ".", "end", "(", ")", "self", ".", "state", "=", "State", ".", "ERROR", "self", ".", "error", "=", "exc", "self", ".", "log", ".", "exception...
https://github.com/robinhood/faust/blob/01b4c0ad8390221db71751d80001b0fd879291e2/faust/livecheck/runners.py#L178-L185
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
runtime/python/lib/python2.7/distutils/versionpredicate.py
python
split_provision
(value)
return m.group(1), ver
Return the name and optional version number of a provision. The version number, if given, will be returned as a `StrictVersion` instance, otherwise it will be `None`. >>> split_provision('mypkg') ('mypkg', None) >>> split_provision(' mypkg( 1.2 ) ') ('mypkg', StrictVersion ('1.2'))
Return the name and optional version number of a provision.
[ "Return", "the", "name", "and", "optional", "version", "number", "of", "a", "provision", "." ]
def split_provision(value): """Return the name and optional version number of a provision. The version number, if given, will be returned as a `StrictVersion` instance, otherwise it will be `None`. >>> split_provision('mypkg') ('mypkg', None) >>> split_provision(' mypkg( 1.2 ) ') ('mypkg',...
[ "def", "split_provision", "(", "value", ")", ":", "global", "_provision_rx", "if", "_provision_rx", "is", "None", ":", "_provision_rx", "=", "re", ".", "compile", "(", "\"([a-zA-Z_]\\w*(?:\\.[a-zA-Z_]\\w*)*)(?:\\s*\\(\\s*([^)\\s]+)\\s*\\))?$\"", ")", "value", "=", "valu...
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/distutils/versionpredicate.py#L142-L164
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/plotly/graph_objs/surface/colorbar/_tickfont.py
python
Tickfont.size
(self)
return self["size"]
The 'size' property is a number and may be specified as: - An int or float in the interval [1, inf] Returns ------- int|float
The 'size' property is a number and may be specified as: - An int or float in the interval [1, inf]
[ "The", "size", "property", "is", "a", "number", "and", "may", "be", "specified", "as", ":", "-", "An", "int", "or", "float", "in", "the", "interval", "[", "1", "inf", "]" ]
def size(self): """ The 'size' property is a number and may be specified as: - An int or float in the interval [1, inf] Returns ------- int|float """ return self["size"]
[ "def", "size", "(", "self", ")", ":", "return", "self", "[", "\"size\"", "]" ]
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/surface/colorbar/_tickfont.py#L104-L113
entropy1337/infernal-twin
10995cd03312e39a48ade0f114ebb0ae3a711bb8
Modules/build/pip/pip/_vendor/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.py
python
match_hostname
(cert, hostname)
Verify that *cert* (in decoded format as returned by SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125 rules are followed, but IP addresses are not accepted for *hostname*. CertificateError is raised on failure. On success, the function returns nothing.
Verify that *cert* (in decoded format as returned by SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125 rules are followed, but IP addresses are not accepted for *hostname*.
[ "Verify", "that", "*", "cert", "*", "(", "in", "decoded", "format", "as", "returned", "by", "SSLSocket", ".", "getpeercert", "()", ")", "matches", "the", "*", "hostname", "*", ".", "RFC", "2818", "and", "RFC", "6125", "rules", "are", "followed", "but", ...
def match_hostname(cert, hostname): """Verify that *cert* (in decoded format as returned by SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125 rules are followed, but IP addresses are not accepted for *hostname*. CertificateError is raised on failure. On success, the function r...
[ "def", "match_hostname", "(", "cert", ",", "hostname", ")", ":", "if", "not", "cert", ":", "raise", "ValueError", "(", "\"empty or no certificate\"", ")", "dnsnames", "=", "[", "]", "san", "=", "cert", ".", "get", "(", "'subjectAltName'", ",", "(", ")", ...
https://github.com/entropy1337/infernal-twin/blob/10995cd03312e39a48ade0f114ebb0ae3a711bb8/Modules/build/pip/pip/_vendor/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.py#L67-L105
jayleicn/scipy-lecture-notes-zh-CN
cc87204fcc4bd2f4702f7c29c83cb8ed5c94b7d6
sphinxext/plot_directive.py
python
mark_plot_labels
(app, document)
To make plots referenceable, we need to move the reference from the "htmlonly" (or "latexonly") node to the actual figure node itself.
To make plots referenceable, we need to move the reference from the "htmlonly" (or "latexonly") node to the actual figure node itself.
[ "To", "make", "plots", "referenceable", "we", "need", "to", "move", "the", "reference", "from", "the", "htmlonly", "(", "or", "latexonly", ")", "node", "to", "the", "actual", "figure", "node", "itself", "." ]
def mark_plot_labels(app, document): """ To make plots referenceable, we need to move the reference from the "htmlonly" (or "latexonly") node to the actual figure node itself. """ for name, explicit in document.nametypes.iteritems(): if not explicit: continue labelid ...
[ "def", "mark_plot_labels", "(", "app", ",", "document", ")", ":", "for", "name", ",", "explicit", "in", "document", ".", "nametypes", ".", "iteritems", "(", ")", ":", "if", "not", "explicit", ":", "continue", "labelid", "=", "document", ".", "nameids", "...
https://github.com/jayleicn/scipy-lecture-notes-zh-CN/blob/cc87204fcc4bd2f4702f7c29c83cb8ed5c94b7d6/sphinxext/plot_directive.py#L348-L376
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
asdl/visitor.py
python
AsdlVisitor.VisitSum
(self, sum, name, depth)
[]
def VisitSum(self, sum, name, depth): if asdl.is_simple(sum): self.VisitSimpleSum(sum, name, depth) else: self.VisitCompoundSum(sum, name, depth)
[ "def", "VisitSum", "(", "self", ",", "sum", ",", "name", ",", "depth", ")", ":", "if", "asdl", ".", "is_simple", "(", "sum", ")", ":", "self", ".", "VisitSimpleSum", "(", "sum", ",", "name", ",", "depth", ")", "else", ":", "self", ".", "VisitCompou...
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/asdl/visitor.py#L48-L52
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/PyYaml/lib3/yaml/__init__.py
python
safe_dump_all
(documents, stream=None, **kwds)
return dump_all(documents, stream, Dumper=SafeDumper, **kwds)
Serialize a sequence of Python objects into a YAML stream. Produce only basic YAML tags. If stream is None, return the produced string instead.
Serialize a sequence of Python objects into a YAML stream. Produce only basic YAML tags. If stream is None, return the produced string instead.
[ "Serialize", "a", "sequence", "of", "Python", "objects", "into", "a", "YAML", "stream", ".", "Produce", "only", "basic", "YAML", "tags", ".", "If", "stream", "is", "None", "return", "the", "produced", "string", "instead", "." ]
def safe_dump_all(documents, stream=None, **kwds): """ Serialize a sequence of Python objects into a YAML stream. Produce only basic YAML tags. If stream is None, return the produced string instead. """ return dump_all(documents, stream, Dumper=SafeDumper, **kwds)
[ "def", "safe_dump_all", "(", "documents", ",", "stream", "=", "None", ",", "*", "*", "kwds", ")", ":", "return", "dump_all", "(", "documents", ",", "stream", ",", "Dumper", "=", "SafeDumper", ",", "*", "*", "kwds", ")" ]
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/PyYaml/lib3/yaml/__init__.py#L202-L208
SpaceNetChallenge/SpaceNet_Off_Nadir_Solutions
014c4ca27a70b5907a183e942228004c989dcbe4
number13/number13/src/Mask_RCNN/mrcnn/parallel_model.py
python
ParallelModel.summary
(self, *args, **kwargs)
Override summary() to display summaries of both, the wrapper and inner models.
Override summary() to display summaries of both, the wrapper and inner models.
[ "Override", "summary", "()", "to", "display", "summaries", "of", "both", "the", "wrapper", "and", "inner", "models", "." ]
def summary(self, *args, **kwargs): """Override summary() to display summaries of both, the wrapper and inner models.""" super(ParallelModel, self).summary(*args, **kwargs) self.inner_model.summary(*args, **kwargs)
[ "def", "summary", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "super", "(", "ParallelModel", ",", "self", ")", ".", "summary", "(", "*", "args", ",", "*", "*", "kwargs", ")", "self", ".", "inner_model", ".", "summary", "(", ...
https://github.com/SpaceNetChallenge/SpaceNet_Off_Nadir_Solutions/blob/014c4ca27a70b5907a183e942228004c989dcbe4/number13/number13/src/Mask_RCNN/mrcnn/parallel_model.py#L48-L52
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/docutils-0.14/docutils/utils/math/math2html.py
python
Options.parsefootnotes
(self)
Parse footnotes options.
Parse footnotes options.
[ "Parse", "footnotes", "options", "." ]
def parsefootnotes(self): "Parse footnotes options." if not Options.footnotes: return Options.marginfoot = False Options.letterfoot = False Options.hoverfoot = False options = Options.footnotes.split(',') for option in options: footoption = option + 'foot' if hasattr(Option...
[ "def", "parsefootnotes", "(", "self", ")", ":", "if", "not", "Options", ".", "footnotes", ":", "return", "Options", ".", "marginfoot", "=", "False", "Options", ".", "letterfoot", "=", "False", "Options", ".", "hoverfoot", "=", "False", "options", "=", "Opt...
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/docutils-0.14/docutils/utils/math/math2html.py#L1185-L1202
smart-mobile-software/gitstack
d9fee8f414f202143eb6e620529e8e5539a2af56
python/Lib/random.py
python
Random.jumpahead
(self, n)
Change the internal state to one that is likely far away from the current state. This method will not be in Py3.x, so it is better to simply reseed.
Change the internal state to one that is likely far away from the current state. This method will not be in Py3.x, so it is better to simply reseed.
[ "Change", "the", "internal", "state", "to", "one", "that", "is", "likely", "far", "away", "from", "the", "current", "state", ".", "This", "method", "will", "not", "be", "in", "Py3", ".", "x", "so", "it", "is", "better", "to", "simply", "reseed", "." ]
def jumpahead(self, n): """Change the internal state to one that is likely far away from the current state. This method will not be in Py3.x, so it is better to simply reseed. """ # The super.jumpahead() method uses shuffling to change state, # so it needs a large and "i...
[ "def", "jumpahead", "(", "self", ",", "n", ")", ":", "# The super.jumpahead() method uses shuffling to change state,", "# so it needs a large and \"interesting\" n to work with. Here,", "# we use hashing to create a large n for the shuffle.", "s", "=", "repr", "(", "n", ")", "+", ...
https://github.com/smart-mobile-software/gitstack/blob/d9fee8f414f202143eb6e620529e8e5539a2af56/python/Lib/random.py#L145-L155
jazzband/django-downloadview
6dbf06c4ea430b305fba97a2c56482f595360f8d
demo/demoproject/virtual/views.py
python
GeneratedDownloadView.get_file
(self)
return VirtualFile(file_obj, name="hello-world.txt")
Return wrapper on ``StringIteratorIO`` object.
Return wrapper on ``StringIteratorIO`` object.
[ "Return", "wrapper", "on", "StringIteratorIO", "object", "." ]
def get_file(self): """Return wrapper on ``StringIteratorIO`` object.""" file_obj = TextIteratorIO(generate_hello()) return VirtualFile(file_obj, name="hello-world.txt")
[ "def", "get_file", "(", "self", ")", ":", "file_obj", "=", "TextIteratorIO", "(", "generate_hello", "(", ")", ")", "return", "VirtualFile", "(", "file_obj", ",", "name", "=", "\"hello-world.txt\"", ")" ]
https://github.com/jazzband/django-downloadview/blob/6dbf06c4ea430b305fba97a2c56482f595360f8d/demo/demoproject/virtual/views.py#L28-L31
StellarCN/py-stellar-base
f5fa47f4d96f215889d99249fb25c7be002f5cf3
stellar_sdk/server_async.py
python
ServerAsync.fee_stats
(self)
return FeeStatsCallBuilder(horizon_url=self.horizon_url, client=self._client)
:return: New :class:`stellar_sdk.call_builder.call_builder_async.FeeStatsCallBuilder` object configured by a current Horizon server configuration.
:return: New :class:`stellar_sdk.call_builder.call_builder_async.FeeStatsCallBuilder` object configured by a current Horizon server configuration.
[ ":", "return", ":", "New", ":", "class", ":", "stellar_sdk", ".", "call_builder", ".", "call_builder_async", ".", "FeeStatsCallBuilder", "object", "configured", "by", "a", "current", "Horizon", "server", "configuration", "." ]
def fee_stats(self) -> FeeStatsCallBuilder: """ :return: New :class:`stellar_sdk.call_builder.call_builder_async.FeeStatsCallBuilder` object configured by a current Horizon server configuration. """ return FeeStatsCallBuilder(horizon_url=self.horizon_url, client=self._client)
[ "def", "fee_stats", "(", "self", ")", "->", "FeeStatsCallBuilder", ":", "return", "FeeStatsCallBuilder", "(", "horizon_url", "=", "self", ".", "horizon_url", ",", "client", "=", "self", ".", "_client", ")" ]
https://github.com/StellarCN/py-stellar-base/blob/f5fa47f4d96f215889d99249fb25c7be002f5cf3/stellar_sdk/server_async.py#L201-L206
saltstack/salt
fae5bc757ad0f1716483ce7ae180b451545c2058
salt/modules/neutron.py
python
list_floatingips
(profile=None)
return conn.list_floatingips()
Fetch a list of all floatingIPs for a tenant CLI Example: .. code-block:: bash salt '*' neutron.list_floatingips salt '*' neutron.list_floatingips profile=openstack1 :param profile: Profile to build on (Optional) :return: List of floatingIP
Fetch a list of all floatingIPs for a tenant
[ "Fetch", "a", "list", "of", "all", "floatingIPs", "for", "a", "tenant" ]
def list_floatingips(profile=None): """ Fetch a list of all floatingIPs for a tenant CLI Example: .. code-block:: bash salt '*' neutron.list_floatingips salt '*' neutron.list_floatingips profile=openstack1 :param profile: Profile to build on (Optional) :return: List of floati...
[ "def", "list_floatingips", "(", "profile", "=", "None", ")", ":", "conn", "=", "_auth", "(", "profile", ")", "return", "conn", ".", "list_floatingips", "(", ")" ]
https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/neutron.py#L775-L790
DataDog/integrations-core
934674b29d94b70ccc008f76ea172d0cdae05e1e
cilium/datadog_checks/cilium/config_models/defaults.py
python
instance_kerberos_hostname
(field, value)
return get_default_field_value(field, value)
[]
def instance_kerberos_hostname(field, value): return get_default_field_value(field, value)
[ "def", "instance_kerberos_hostname", "(", "field", ",", "value", ")", ":", "return", "get_default_field_value", "(", "field", ",", "value", ")" ]
https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/cilium/datadog_checks/cilium/config_models/defaults.py#L169-L170
pgq/skytools-legacy
8b7e6c118572a605d28b7a3403c96aeecfd0d272
python/skytools/sqltools.py
python
CopyPipe.write
(self, data)
New data from psycopg
New data from psycopg
[ "New", "data", "from", "psycopg" ]
def write(self, data): "New data from psycopg" if self.write_hook: data = self.write_hook(self, data) self.total_bytes += len(data) self.total_rows += data.count("\n") if self.buf.tell() >= self.limit: pos = data.find('\n') if pos >= 0: ...
[ "def", "write", "(", "self", ",", "data", ")", ":", "if", "self", ".", "write_hook", ":", "data", "=", "self", ".", "write_hook", "(", "self", ",", "data", ")", "self", ".", "total_bytes", "+=", "len", "(", "data", ")", "self", ".", "total_rows", "...
https://github.com/pgq/skytools-legacy/blob/8b7e6c118572a605d28b7a3403c96aeecfd0d272/python/skytools/sqltools.py#L368-L387
aianaconda/TensorFlow_Engineering_Implementation
cb787e359da9ac5a08d00cd2458fecb4cb5a3a31
code/8-30 mask_rcnn_utils.py
python
compute_ap
(gt_boxes, gt_class_ids, gt_masks, pred_boxes, pred_class_ids, pred_scores, pred_masks, iou_threshold=0.5)
return mAP, precisions, recalls, overlaps
Compute Average Precision at a set IoU threshold (default 0.5). Returns: mAP: Mean Average Precision precisions: List of precisions at different class score thresholds. recalls: List of recall values at different class score thresholds. overlaps: [pred_boxes, gt_boxes] IoU overlaps.
Compute Average Precision at a set IoU threshold (default 0.5).
[ "Compute", "Average", "Precision", "at", "a", "set", "IoU", "threshold", "(", "default", "0", ".", "5", ")", "." ]
def compute_ap(gt_boxes, gt_class_ids, gt_masks, pred_boxes, pred_class_ids, pred_scores, pred_masks, iou_threshold=0.5): """Compute Average Precision at a set IoU threshold (default 0.5). Returns: mAP: Mean Average Precision precisions: List of precisions at different cla...
[ "def", "compute_ap", "(", "gt_boxes", ",", "gt_class_ids", ",", "gt_masks", ",", "pred_boxes", ",", "pred_class_ids", ",", "pred_scores", ",", "pred_masks", ",", "iou_threshold", "=", "0.5", ")", ":", "# Get matches and overlaps", "gt_match", ",", "pred_match", ",...
https://github.com/aianaconda/TensorFlow_Engineering_Implementation/blob/cb787e359da9ac5a08d00cd2458fecb4cb5a3a31/code/8-30 mask_rcnn_utils.py#L527-L564
williballenthin/python-registry
11e857623469dd28ed14519a08d2db7c8228ca0c
Registry/RegistryParse.py
python
HBINCell.offset
(self)
return self._offset
Accessor for absolute offset of this HBINCell.
Accessor for absolute offset of this HBINCell.
[ "Accessor", "for", "absolute", "offset", "of", "this", "HBINCell", "." ]
def offset(self): """ Accessor for absolute offset of this HBINCell. """ return self._offset
[ "def", "offset", "(", "self", ")", ":", "return", "self", ".", "_offset" ]
https://github.com/williballenthin/python-registry/blob/11e857623469dd28ed14519a08d2db7c8228ca0c/Registry/RegistryParse.py#L597-L601
Source-Python-Dev-Team/Source.Python
d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb
addons/source-python/packages/site-packages/configobj.py
python
Section.restore_default
(self, key)
return default
Restore (and return) default value for the specified key. This method will only work for a ConfigObj that was created with a configspec and has been validated. If there is no default value for this key, ``KeyError`` is raised.
Restore (and return) default value for the specified key. This method will only work for a ConfigObj that was created with a configspec and has been validated. If there is no default value for this key, ``KeyError`` is raised.
[ "Restore", "(", "and", "return", ")", "default", "value", "for", "the", "specified", "key", ".", "This", "method", "will", "only", "work", "for", "a", "ConfigObj", "that", "was", "created", "with", "a", "configspec", "and", "has", "been", "validated", ".",...
def restore_default(self, key): """ Restore (and return) default value for the specified key. This method will only work for a ConfigObj that was created with a configspec and has been validated. If there is no default value for this key, ``KeyError`` is raised....
[ "def", "restore_default", "(", "self", ",", "key", ")", ":", "default", "=", "self", ".", "default_values", "[", "key", "]", "dict", ".", "__setitem__", "(", "self", ",", "key", ",", "default", ")", "if", "key", "not", "in", "self", ".", "defaults", ...
https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/packages/site-packages/configobj.py#L1038-L1051
kornia/kornia
b12d6611b1c41d47b2c93675f0ea344b5314a688
kornia/enhance/adjust.py
python
_blend_one
(input1: torch.Tensor, input2: torch.Tensor, factor: torch.Tensor)
return torch.clamp(res, 0, 1)
r"""Blend two images into one. Args: input1: image tensor with shapes like :math:`(H, W)` or :math:`(D, H, W)`. input2: image tensor with shapes like :math:`(H, W)` or :math:`(D, H, W)`. factor: factor 0-dim tensor. Returns: : image tensor with the batch in the zero position.
r"""Blend two images into one.
[ "r", "Blend", "two", "images", "into", "one", "." ]
def _blend_one(input1: torch.Tensor, input2: torch.Tensor, factor: torch.Tensor) -> torch.Tensor: r"""Blend two images into one. Args: input1: image tensor with shapes like :math:`(H, W)` or :math:`(D, H, W)`. input2: image tensor with shapes like :math:`(H, W)` or :math:`(D, H, W)`. fa...
[ "def", "_blend_one", "(", "input1", ":", "torch", ".", "Tensor", ",", "input2", ":", "torch", ".", "Tensor", ",", "factor", ":", "torch", ".", "Tensor", ")", "->", "torch", ".", "Tensor", ":", "if", "not", "isinstance", "(", "input1", ",", "torch", "...
https://github.com/kornia/kornia/blob/b12d6611b1c41d47b2c93675f0ea344b5314a688/kornia/enhance/adjust.py#L601-L627
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/vlc_telnet/config_flow.py
python
VLCTelnetConfigFlow.async_step_reauth_confirm
( self, user_input: dict[str, Any] | None = None )
return self.async_show_form( step_id="reauth_confirm", description_placeholders={CONF_HOST: self.entry.data[CONF_HOST]}, data_schema=STEP_REAUTH_DATA_SCHEMA, errors=errors, )
Handle reauth confirm.
Handle reauth confirm.
[ "Handle", "reauth", "confirm", "." ]
async def async_step_reauth_confirm( self, user_input: dict[str, Any] | None = None ) -> FlowResult: """Handle reauth confirm.""" assert self.entry errors = {} if user_input is not None: try: await validate_input(self.hass, {**self.entry.data, **u...
[ "async", "def", "async_step_reauth_confirm", "(", "self", ",", "user_input", ":", "dict", "[", "str", ",", "Any", "]", "|", "None", "=", "None", ")", "->", "FlowResult", ":", "assert", "self", ".", "entry", "errors", "=", "{", "}", "if", "user_input", ...
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/vlc_telnet/config_flow.py#L114-L149
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AppServer/lib/django-1.5/django/contrib/gis/gdal/field.py
python
Field.type_name
(self)
return capi.get_field_type_name(self.type)
Return the OGR field type name for this Field.
Return the OGR field type name for this Field.
[ "Return", "the", "OGR", "field", "type", "name", "for", "this", "Field", "." ]
def type_name(self): "Return the OGR field type name for this Field." return capi.get_field_type_name(self.type)
[ "def", "type_name", "(", "self", ")", ":", "return", "capi", ".", "get_field_type_name", "(", "self", ".", "type", ")" ]
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.5/django/contrib/gis/gdal/field.py#L90-L92
openyou/emokit
7f25321a1c3a240f5b64a1572e5f106807b1beea
python/render.py
python
Grapher.__init__
(self, screen, name, i, old_model=False)
Initializes graph worker
Initializes graph worker
[ "Initializes", "graph", "worker" ]
def __init__(self, screen, name, i, old_model=False): """ Initializes graph worker """ self.screen = screen self.name = name self.range = float(1 << 13) self.x_offset = 40 self.y = i * gheight self.buffer = [] font = pygame.font.Font(None, ...
[ "def", "__init__", "(", "self", ",", "screen", ",", "name", ",", "i", ",", "old_model", "=", "False", ")", ":", "self", ".", "screen", "=", "screen", "self", ".", "name", "=", "name", "self", ".", "range", "=", "float", "(", "1", "<<", "13", ")",...
https://github.com/openyou/emokit/blob/7f25321a1c3a240f5b64a1572e5f106807b1beea/python/render.py#L28-L44
bbfamily/abu
2de85ae57923a720dac99a545b4f856f6b87304b
abupy/FactorBuyBu/ABuFactorBuyDemo.py
python
AbuFactorBuyBreakReocrdHitDemo.make_ump_block_decision
(self, ml_feature_dict)
return False
即是可以再次根据裁判之间的配合数据进行训练学习,让裁判自己学习怎么配合,自己做出最正确的判断, 而不是像上面的示例使用固定值3来做为裁决阀值,AbuFactorBuyBreakReocrdHitDemo类似 AbuFactorBuyBreakUmpDemo但是不对交易进行决策,只是把每一个裁判的对应交易命中的分类簇个数进行记录,更新在特征数据里 :param ml_feature_dict: 需要决策的当前买入时刻交易特征dict :return: bool, 对ml_feature_dict所描述的交易特征是否进行拦截
即是可以再次根据裁判之间的配合数据进行训练学习,让裁判自己学习怎么配合,自己做出最正确的判断, 而不是像上面的示例使用固定值3来做为裁决阀值,AbuFactorBuyBreakReocrdHitDemo类似 AbuFactorBuyBreakUmpDemo但是不对交易进行决策,只是把每一个裁判的对应交易命中的分类簇个数进行记录,更新在特征数据里 :param ml_feature_dict: 需要决策的当前买入时刻交易特征dict :return: bool, 对ml_feature_dict所描述的交易特征是否进行拦截
[ "即是可以再次根据裁判之间的配合数据进行训练学习,让裁判自己学习怎么配合,自己做出最正确的判断,", "而不是像上面的示例使用固定值3来做为裁决阀值,AbuFactorBuyBreakReocrdHitDemo类似", "AbuFactorBuyBreakUmpDemo但是不对交易进行决策,只是把每一个裁判的对应交易命中的分类簇个数进行记录,更新在特征数据里", ":", "param", "ml_feature_dict", ":", "需要决策的当前买入时刻交易特征dict", ":", "return", ":", "bool", "对ml_feature_dict所描述...
def make_ump_block_decision(self, ml_feature_dict): """ 即是可以再次根据裁判之间的配合数据进行训练学习,让裁判自己学习怎么配合,自己做出最正确的判断, 而不是像上面的示例使用固定值3来做为裁决阀值,AbuFactorBuyBreakReocrdHitDemo类似 AbuFactorBuyBreakUmpDemo但是不对交易进行决策,只是把每一个裁判的对应交易命中的分类簇个数进行记录,更新在特征数据里 :param ml_feature_dict: 需要决策的当前买入时刻交易特征dict ...
[ "def", "make_ump_block_decision", "(", "self", ",", "ml_feature_dict", ")", ":", "ump", "=", "self", ".", "ump_manger", "# 统计角度主裁对应这次交易命中的分类簇个数", "deg_hit_cnt", "=", "ump", ".", "ump_main_deg", ".", "predict_hit_kwargs", "(", "*", "*", "ml_feature_dict", ")", "# 统...
https://github.com/bbfamily/abu/blob/2de85ae57923a720dac99a545b4f856f6b87304b/abupy/FactorBuyBu/ABuFactorBuyDemo.py#L144-L165
scrapy/scrapy
b04cfa48328d5d5749dca6f50fa34e0cfc664c89
scrapy/utils/curl.py
python
curl_to_request_kwargs
(curl_command: str, ignore_unknown_options: bool = True)
return result
Convert a cURL command syntax to Request kwargs. :param str curl_command: string containing the curl command :param bool ignore_unknown_options: If true, only a warning is emitted when cURL options are unknown. Otherwise raises an ...
Convert a cURL command syntax to Request kwargs.
[ "Convert", "a", "cURL", "command", "syntax", "to", "Request", "kwargs", "." ]
def curl_to_request_kwargs(curl_command: str, ignore_unknown_options: bool = True) -> dict: """Convert a cURL command syntax to Request kwargs. :param str curl_command: string containing the curl command :param bool ignore_unknown_options: If true, only a warning is emitted when ...
[ "def", "curl_to_request_kwargs", "(", "curl_command", ":", "str", ",", "ignore_unknown_options", ":", "bool", "=", "True", ")", "->", "dict", ":", "curl_args", "=", "split", "(", "curl_command", ")", "if", "curl_args", "[", "0", "]", "!=", "'curl'", ":", "...
https://github.com/scrapy/scrapy/blob/b04cfa48328d5d5749dca6f50fa34e0cfc664c89/scrapy/utils/curl.py#L57-L106
poppinace/indexnet_matting
4beb06a47db2eecca87b8003a11f0b268506cea3
scripts/hlvggnet.py
python
hlvgg16
(pretrained=False, **kwargs)
return model
Constructs a VGG-16 model. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet
Constructs a VGG-16 model.
[ "Constructs", "a", "VGG", "-", "16", "model", "." ]
def hlvgg16(pretrained=False, **kwargs): """Constructs a VGG-16 model. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet """ model = DeepMatting(input_chn=4, output_chn=1, use_pretrained=pretrained) if pretrained: corresp_name = CORRESP_NAME # lo...
[ "def", "hlvgg16", "(", "pretrained", "=", "False", ",", "*", "*", "kwargs", ")", ":", "model", "=", "DeepMatting", "(", "input_chn", "=", "4", ",", "output_chn", "=", "1", ",", "use_pretrained", "=", "pretrained", ")", "if", "pretrained", ":", "corresp_n...
https://github.com/poppinace/indexnet_matting/blob/4beb06a47db2eecca87b8003a11f0b268506cea3/scripts/hlvggnet.py#L253-L280
khalim19/gimp-plugin-export-layers
b37255f2957ad322f4d332689052351cdea6e563
export_layers/pygimplib/_lib/future/future/backports/socket.py
python
SocketIO.close
(self)
Close the SocketIO object. This doesn't close the underlying socket, except if all references to it have disappeared.
Close the SocketIO object. This doesn't close the underlying socket, except if all references to it have disappeared.
[ "Close", "the", "SocketIO", "object", ".", "This", "doesn", "t", "close", "the", "underlying", "socket", "except", "if", "all", "references", "to", "it", "have", "disappeared", "." ]
def close(self): """Close the SocketIO object. This doesn't close the underlying socket, except if all references to it have disappeared. """ if self.closed: return io.RawIOBase.close(self) self._sock._decref_socketios() self._sock = None
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "closed", ":", "return", "io", ".", "RawIOBase", ".", "close", "(", "self", ")", "self", ".", "_sock", ".", "_decref_socketios", "(", ")", "self", ".", "_sock", "=", "None" ]
https://github.com/khalim19/gimp-plugin-export-layers/blob/b37255f2957ad322f4d332689052351cdea6e563/export_layers/pygimplib/_lib/future/future/backports/socket.py#L376-L384
BindsNET/bindsnet
f2eabd77793831c1391fccf5b22e2e4e4564ae7c
bindsnet/preprocessing/preprocessing.py
python
AbstractPreprocessor.__check_file
(cachedfile: str, cache: dict)
return False
Compares the csv file and the saved file to see if a new encoding needs to be generated. :param cachedfile: The filename of the cached data. :param cache: Dictionary containing the current csv file hash. This is updated if the cache file has valid data. :return: Whether the ...
Compares the csv file and the saved file to see if a new encoding needs to be generated.
[ "Compares", "the", "csv", "file", "and", "the", "saved", "file", "to", "see", "if", "a", "new", "encoding", "needs", "to", "be", "generated", "." ]
def __check_file(cachedfile: str, cache: dict) -> bool: # language=rst """ Compares the csv file and the saved file to see if a new encoding needs to be generated. :param cachedfile: The filename of the cached data. :param cache: Dictionary containing the current csv fil...
[ "def", "__check_file", "(", "cachedfile", ":", "str", ",", "cache", ":", "dict", ")", "->", "bool", ":", "# language=rst", "# try opening the cached file", "try", ":", "with", "open", "(", "cachedfile", ",", "\"rb\"", ")", "as", "f", ":", "temp", "=", "pic...
https://github.com/BindsNET/bindsnet/blob/f2eabd77793831c1391fccf5b22e2e4e4564ae7c/bindsnet/preprocessing/preprocessing.py#L72-L96
davidmcclure/open-syllabus-project
078cfd4c5a257fbfb0901d43bfbc6350824eed4e
osp/workers/client.py
python
Client.status
(self)
List pending/failed counts for each worker.
List pending/failed counts for each worker.
[ "List", "pending", "/", "failed", "counts", "for", "each", "worker", "." ]
def status(self): """ List pending/failed counts for each worker. """ term = Terminal() for url in self.worker_urls: click.echo(url) # Get the queue counts. r = requests.get(url+'/rq/queues.json') for queue in r.json()['queues...
[ "def", "status", "(", "self", ")", ":", "term", "=", "Terminal", "(", ")", "for", "url", "in", "self", ".", "worker_urls", ":", "click", ".", "echo", "(", "url", ")", "# Get the queue counts.", "r", "=", "requests", ".", "get", "(", "url", "+", "'/rq...
https://github.com/davidmcclure/open-syllabus-project/blob/078cfd4c5a257fbfb0901d43bfbc6350824eed4e/osp/workers/client.py#L117-L140
demisto/content
5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07
Packs/Campaign/Scripts/IsIncidentPartOfCampaign/IsIncidentPartOfCampaign.py
python
get_incidents_ids_by_type
(incident_type: str)
Get list of incidents ids with the given type. Args: Incident_type(str): the incident type name. Returns: List of ids as strings.
Get list of incidents ids with the given type. Args: Incident_type(str): the incident type name.
[ "Get", "list", "of", "incidents", "ids", "with", "the", "given", "type", ".", "Args", ":", "Incident_type", "(", "str", ")", ":", "the", "incident", "type", "name", "." ]
def get_incidents_ids_by_type(incident_type: str) -> Iterable[str]: """ Get list of incidents ids with the given type. Args: Incident_type(str): the incident type name. Returns: List of ids as strings. """ search_args = { 'type': incident_type, 'page': 0, ...
[ "def", "get_incidents_ids_by_type", "(", "incident_type", ":", "str", ")", "->", "Iterable", "[", "str", "]", ":", "search_args", "=", "{", "'type'", ":", "incident_type", ",", "'page'", ":", "0", ",", "'sort'", ":", "{", "'field'", ":", "'occurred'", ",",...
https://github.com/demisto/content/blob/5c664a65b992ac8ca90ac3f11b1b2cdf11ee9b07/Packs/Campaign/Scripts/IsIncidentPartOfCampaign/IsIncidentPartOfCampaign.py#L10-L39
pydicom/pynetdicom
f57d8214c82b63c8e76638af43ce331f584a80fa
pynetdicom/pdu.py
python
A_ABORT_RQ.from_primitive
(self, primitive: _AbortType)
Setup the current PDU using an A-ABORT or A-P-ABORT primitive. Parameters ---------- primitive : pdu_primitives.A_ABORT or pdu_primitives.A_P_ABORT The primitive to use to set the current PDU field values.
Setup the current PDU using an A-ABORT or A-P-ABORT primitive.
[ "Setup", "the", "current", "PDU", "using", "an", "A", "-", "ABORT", "or", "A", "-", "P", "-", "ABORT", "primitive", "." ]
def from_primitive(self, primitive: _AbortType) -> None: """Setup the current PDU using an A-ABORT or A-P-ABORT primitive. Parameters ---------- primitive : pdu_primitives.A_ABORT or pdu_primitives.A_P_ABORT The primitive to use to set the current PDU field values. "...
[ "def", "from_primitive", "(", "self", ",", "primitive", ":", "_AbortType", ")", "->", "None", ":", "from", "pynetdicom", ".", "pdu_primitives", "import", "A_ABORT", ",", "A_P_ABORT", "# User initiated abort", "if", "isinstance", "(", "primitive", ",", "A_ABORT", ...
https://github.com/pydicom/pynetdicom/blob/f57d8214c82b63c8e76638af43ce331f584a80fa/pynetdicom/pdu.py#L1971-L1991
VirtueSecurity/aws-extender
d123b7e1a845847709ba3a481f11996bddc68a1c
BappModules/boto/cloudsearch/domain.py
python
Domain.delete
(self)
return self.layer1.delete_domain(self.name)
Delete this domain and all index data associated with it.
Delete this domain and all index data associated with it.
[ "Delete", "this", "domain", "and", "all", "index", "data", "associated", "with", "it", "." ]
def delete(self): """ Delete this domain and all index data associated with it. """ return self.layer1.delete_domain(self.name)
[ "def", "delete", "(", "self", ")", ":", "return", "self", ".", "layer1", ".", "delete_domain", "(", "self", ".", "name", ")" ]
https://github.com/VirtueSecurity/aws-extender/blob/d123b7e1a845847709ba3a481f11996bddc68a1c/BappModules/boto/cloudsearch/domain.py#L178-L182
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/whoosh/scoring.py
python
pl2
(tf, cf, qf, dc, fl, avgfl, c)
return norm * qf * (TF * log(1.0 / f) + f * rec_log2_of_e + 0.5 * log(2 * pi * TF) + TF * (log(TF) - rec_log2_of_e))
[]
def pl2(tf, cf, qf, dc, fl, avgfl, c): # tf - term frequency in the current document # cf - term frequency in the collection # qf - term frequency in the query # dc - doc count # fl - field length in the current document # avgfl - average field length across all documents # c -free parameter...
[ "def", "pl2", "(", "tf", ",", "cf", ",", "qf", ",", "dc", ",", "fl", ",", "avgfl", ",", "c", ")", ":", "# tf - term frequency in the current document", "# cf - term frequency in the collection", "# qf - term frequency in the query", "# dc - doc count", "# fl - field lengt...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/whoosh/scoring.py#L389-L404
yuxiaokui/Intranet-Penetration
f57678a204840c83cbf3308e3470ae56c5ff514b
proxy/XX-Net/code/default/gae_proxy/server/lib/google/appengine/tools/appcfg.py
python
TempChangeField
(obj, field_name, new_value)
Context manager to change a field value on an object temporarily. Args: obj: The object to change the field on. field_name: The field name to change. new_value: The new value. Yields: The old value.
Context manager to change a field value on an object temporarily.
[ "Context", "manager", "to", "change", "a", "field", "value", "on", "an", "object", "temporarily", "." ]
def TempChangeField(obj, field_name, new_value): """Context manager to change a field value on an object temporarily. Args: obj: The object to change the field on. field_name: The field name to change. new_value: The new value. Yields: The old value. """ old_value = getattr(obj, field_name) ...
[ "def", "TempChangeField", "(", "obj", ",", "field_name", ",", "new_value", ")", ":", "old_value", "=", "getattr", "(", "obj", ",", "field_name", ")", "setattr", "(", "obj", ",", "field_name", ",", "new_value", ")", "yield", "old_value", "setattr", "(", "ob...
https://github.com/yuxiaokui/Intranet-Penetration/blob/f57678a204840c83cbf3308e3470ae56c5ff514b/proxy/XX-Net/code/default/gae_proxy/server/lib/google/appengine/tools/appcfg.py#L254-L268
IronLanguages/main
a949455434b1fda8c783289e897e78a9a0caabb5
External.LCA_RESTRICTED/Languages/IronPython/27/Lib/site-packages/adodbapi/adodbapi.py
python
Cursor.callproc
(self, procname, parameters=None)
return self._executeHelper(procname,True,parameters)
Call a stored database procedure with the given name. The sequence of parameters must contain one entry for each argument that the procedure expects. The result of the call is returned as modified copy of the input sequence. Input parameters are left untouched, output and input/outp...
Call a stored database procedure with the given name.
[ "Call", "a", "stored", "database", "procedure", "with", "the", "given", "name", "." ]
def callproc(self, procname, parameters=None): """Call a stored database procedure with the given name. The sequence of parameters must contain one entry for each argument that the procedure expects. The result of the call is returned as modified copy of the input sequence. ...
[ "def", "callproc", "(", "self", ",", "procname", ",", "parameters", "=", "None", ")", ":", "self", ".", "messages", "=", "[", "]", "return", "self", ".", "_executeHelper", "(", "procname", ",", "True", ",", "parameters", ")" ]
https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/site-packages/adodbapi/adodbapi.py#L530-L542
snakeztc/NeuralDialog-ZSDG
1d1548457a16a2e07567dc8532ea8b2fba178540
zsdg/main.py
python
LossManager.pprint
(self, name, window=None, prefix=None)
[]
def pprint(self, name, window=None, prefix=None): str_losses = [] for key, loss in self.losses.items(): if loss is None: continue avg_loss = np.average(loss) if window is None else np.average(loss[-window:]) str_losses.append("{} {:.3f}".format(key, av...
[ "def", "pprint", "(", "self", ",", "name", ",", "window", "=", "None", ",", "prefix", "=", "None", ")", ":", "str_losses", "=", "[", "]", "for", "key", ",", "loss", "in", "self", ".", "losses", ".", "items", "(", ")", ":", "if", "loss", "is", "...
https://github.com/snakeztc/NeuralDialog-ZSDG/blob/1d1548457a16a2e07567dc8532ea8b2fba178540/zsdg/main.py#L63-L75
microsoft/DeepSpeed
3a4cb042433a2e8351887922f8362d3752c52a42
deepspeed/ops/sparse_attention/sparsity_config.py
python
VariableSparsityConfig.set_local_layout
(self, h, layout)
return layout
Sets local attention layout used by the given head in the sparse attention. Arguments: h: required: an integer determining head index layout: required: a tensor of dimension (num_heads, num_blocks, num_blocks) containing sparsity layout of all head; may not be completely set at this st...
Sets local attention layout used by the given head in the sparse attention. Arguments: h: required: an integer determining head index layout: required: a tensor of dimension (num_heads, num_blocks, num_blocks) containing sparsity layout of all head; may not be completely set at this st...
[ "Sets", "local", "attention", "layout", "used", "by", "the", "given", "head", "in", "the", "sparse", "attention", ".", "Arguments", ":", "h", ":", "required", ":", "an", "integer", "determining", "head", "index", "layout", ":", "required", ":", "a", "tenso...
def set_local_layout(self, h, layout): """Sets local attention layout used by the given head in the sparse attention. Arguments: h: required: an integer determining head index layout: required: a tensor of dimension (num_heads, num_blocks, num_blocks) containing sparsity layout...
[ "def", "set_local_layout", "(", "self", ",", "h", ",", "layout", ")", ":", "num_blocks", "=", "layout", ".", "shape", "[", "1", "]", "start_block_idx", "=", "0", "end_block_idx", "=", "0", "for", "block_size", "in", "self", ".", "local_window_blocks", ":",...
https://github.com/microsoft/DeepSpeed/blob/3a4cb042433a2e8351887922f8362d3752c52a42/deepspeed/ops/sparse_attention/sparsity_config.py#L331-L362
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/sympy/assumptions/ask.py
python
AssumptionKeys.infinitesimal
(self)
return Predicate('zero')
See documentation of ``Q.zero``.
See documentation of ``Q.zero``.
[ "See", "documentation", "of", "Q", ".", "zero", "." ]
def infinitesimal(self): """ See documentation of ``Q.zero``. """ return Predicate('zero')
[ "def", "infinitesimal", "(", "self", ")", ":", "return", "Predicate", "(", "'zero'", ")" ]
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/sympy/assumptions/ask.py#L388-L392
arthurk/django-disqus
0db52c240906c6663189c0a7aca9979a0db004d1
disqus/api.py
python
DisqusClient._get_request
(self, request_url, request_method, **params)
return request
Return a Request object that has the GET parameters attached to the url or the POST data attached to the object.
Return a Request object that has the GET parameters attached to the url or the POST data attached to the object.
[ "Return", "a", "Request", "object", "that", "has", "the", "GET", "parameters", "attached", "to", "the", "url", "or", "the", "POST", "data", "attached", "to", "the", "object", "." ]
def _get_request(self, request_url, request_method, **params): """ Return a Request object that has the GET parameters attached to the url or the POST data attached to the object. """ if request_method == 'GET': if params: request_url += '&%s' % urlenc...
[ "def", "_get_request", "(", "self", ",", "request_url", ",", "request_method", ",", "*", "*", "params", ")", ":", "if", "request_method", "==", "'GET'", ":", "if", "params", ":", "request_url", "+=", "'&%s'", "%", "urlencode", "(", "params", ")", "request"...
https://github.com/arthurk/django-disqus/blob/0db52c240906c6663189c0a7aca9979a0db004d1/disqus/api.py#L65-L76
isnowfy/pydown
71ecc891868cd2a34b7e5fe662c99474f2d0fd7f
pygments/lexers/_postgres_builtins.py
python
parse_keywords
(f)
return kw
[]
def parse_keywords(f): kw = [] for m in re.finditer( r'\s*<entry><token>([^<]+)</token></entry>\s*' r'<entry>([^<]+)</entry>', f.read()): kw.append(m.group(1)) if not kw: raise ValueError('no keyword found') kw.sort() return kw
[ "def", "parse_keywords", "(", "f", ")", ":", "kw", "=", "[", "]", "for", "m", "in", "re", ".", "finditer", "(", "r'\\s*<entry><token>([^<]+)</token></entry>\\s*'", "r'<entry>([^<]+)</entry>'", ",", "f", ".", "read", "(", ")", ")", ":", "kw", ".", "append", ...
https://github.com/isnowfy/pydown/blob/71ecc891868cd2a34b7e5fe662c99474f2d0fd7f/pygments/lexers/_postgres_builtins.py#L29-L40
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/PIL/ImageFilter.py
python
ModeFilter.filter
(self, image)
return image.modefilter(self.size)
[]
def filter(self, image): return image.modefilter(self.size)
[ "def", "filter", "(", "self", ",", "image", ")", ":", "return", "image", ".", "modefilter", "(", "self", ".", "size", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/PIL/ImageFilter.py#L145-L146
jantman/misc-scripts
dba5680bafbc5c5d2d9d4abcc305c57df373cd26
smart_check.py
python
parse_args
(argv)
return args
parse arguments/options
parse arguments/options
[ "parse", "arguments", "/", "options" ]
def parse_args(argv): """ parse arguments/options """ p = argparse.ArgumentParser( description='Check SMART for all disks, exit non-zero if any changed' ) p.add_argument('-v', '--verbose', dest='verbose', action='count', default=0, help='verbose output. specify twice f...
[ "def", "parse_args", "(", "argv", ")", ":", "p", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Check SMART for all disks, exit non-zero if any changed'", ")", "p", ".", "add_argument", "(", "'-v'", ",", "'--verbose'", ",", "dest", "=", "'verbo...
https://github.com/jantman/misc-scripts/blob/dba5680bafbc5c5d2d9d4abcc305c57df373cd26/smart_check.py#L525-L578
googleads/google-ads-python
2a1d6062221f6aad1992a6bcca0e7e4a93d2db86
google/ads/googleads/v9/services/services/campaign_experiment_service/client.py
python
CampaignExperimentServiceClient.parse_common_project_path
(path: str)
return m.groupdict() if m else {}
Parse a project path into its component segments.
Parse a project path into its component segments.
[ "Parse", "a", "project", "path", "into", "its", "component", "segments", "." ]
def parse_common_project_path(path: str) -> Dict[str, str]: """Parse a project path into its component segments.""" m = re.match(r"^projects/(?P<project>.+?)$", path) return m.groupdict() if m else {}
[ "def", "parse_common_project_path", "(", "path", ":", "str", ")", "->", "Dict", "[", "str", ",", "str", "]", ":", "m", "=", "re", ".", "match", "(", "r\"^projects/(?P<project>.+?)$\"", ",", "path", ")", "return", "m", ".", "groupdict", "(", ")", "if", ...
https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v9/services/services/campaign_experiment_service/client.py#L296-L299
larryhastings/gilectomy
4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a
Lib/xml/sax/xmlreader.py
python
IncrementalParser.feed
(self, data)
This method gives the raw XML data in the data parameter to the parser and makes it parse the data, emitting the corresponding events. It is allowed for XML constructs to be split across several calls to feed. feed may raise SAXException.
This method gives the raw XML data in the data parameter to the parser and makes it parse the data, emitting the corresponding events. It is allowed for XML constructs to be split across several calls to feed.
[ "This", "method", "gives", "the", "raw", "XML", "data", "in", "the", "data", "parameter", "to", "the", "parser", "and", "makes", "it", "parse", "the", "data", "emitting", "the", "corresponding", "events", ".", "It", "is", "allowed", "for", "XML", "construc...
def feed(self, data): """This method gives the raw XML data in the data parameter to the parser and makes it parse the data, emitting the corresponding events. It is allowed for XML constructs to be split across several calls to feed. feed may raise SAXException.""" rais...
[ "def", "feed", "(", "self", ",", "data", ")", ":", "raise", "NotImplementedError", "(", "\"This method must be implemented!\"", ")" ]
https://github.com/larryhastings/gilectomy/blob/4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a/Lib/xml/sax/xmlreader.py#L129-L136
ukdtom/ExportTools.bundle
49aba4292a2897f640162a833c2792480aa4f0b6
Contents/Libraries/Shared/xlsxwriter/sharedstrings.py
python
SharedStringTable._get_strings
(self)
return self.string_array
Return the sorted string list.
Return the sorted string list.
[ "Return", "the", "sorted", "string", "list", "." ]
def _get_strings(self): """" Return the sorted string list. """ return self.string_array
[ "def", "_get_strings", "(", "self", ")", ":", "return", "self", ".", "string_array" ]
https://github.com/ukdtom/ExportTools.bundle/blob/49aba4292a2897f640162a833c2792480aa4f0b6/Contents/Libraries/Shared/xlsxwriter/sharedstrings.py#L163-L165
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/setuptools/_vendor/pyparsing.py
python
makeHTMLTags
(tagStr)
return _makeTags( tagStr, False )
Helper to construct opening and closing tag expressions for HTML, given a tag name. Matches tags in either upper or lower case, attributes with namespaces and with quoted or unquoted values. Example:: text = '<td>More info at the <a href="http://pyparsing.wikispaces.com">pyparsing</a> wiki page</td>' ...
Helper to construct opening and closing tag expressions for HTML, given a tag name. Matches tags in either upper or lower case, attributes with namespaces and with quoted or unquoted values.
[ "Helper", "to", "construct", "opening", "and", "closing", "tag", "expressions", "for", "HTML", "given", "a", "tag", "name", ".", "Matches", "tags", "in", "either", "upper", "or", "lower", "case", "attributes", "with", "namespaces", "and", "with", "quoted", "...
def makeHTMLTags(tagStr): """ Helper to construct opening and closing tag expressions for HTML, given a tag name. Matches tags in either upper or lower case, attributes with namespaces and with quoted or unquoted values. Example:: text = '<td>More info at the <a href="http://pyparsing.wikispace...
[ "def", "makeHTMLTags", "(", "tagStr", ")", ":", "return", "_makeTags", "(", "tagStr", ",", "False", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/setuptools/_vendor/pyparsing.py#L4863-L4880
oracle/oci-python-sdk
3c1604e4e212008fb6718e2f68cdb5ef71fd5793
src/oci/_vendor/chardet/euckrprober.py
python
EUCKRProber.charset_name
(self)
return "EUC-KR"
[]
def charset_name(self): return "EUC-KR"
[ "def", "charset_name", "(", "self", ")", ":", "return", "\"EUC-KR\"" ]
https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/_vendor/chardet/euckrprober.py#L20-L21
thombashi/pytablewriter
120392a8723a8ca13a6a519e7e3d11c447e9d9c7
pytablewriter/writer/text/_text_writer.py
python
TextTableWriter.clear_theme
(self)
Remove all of the style filters.
Remove all of the style filters.
[ "Remove", "all", "of", "the", "style", "filters", "." ]
def clear_theme(self) -> None: """Remove all of the style filters.""" super().clear_theme() if not self._col_separator_style_filters: return self._col_separator_style_filters = [] self._clear_preprocess()
[ "def", "clear_theme", "(", "self", ")", "->", "None", ":", "super", "(", ")", ".", "clear_theme", "(", ")", "if", "not", "self", ".", "_col_separator_style_filters", ":", "return", "self", ".", "_col_separator_style_filters", "=", "[", "]", "self", ".", "_...
https://github.com/thombashi/pytablewriter/blob/120392a8723a8ca13a6a519e7e3d11c447e9d9c7/pytablewriter/writer/text/_text_writer.py#L195-L204
gtimelog/gtimelog
50aeccbd3aa8ac2dde4419b033b2467444186213
src/gtimelog/settings.py
python
Settings.get_task_list_cache_file
(self)
return os.path.join(self.get_data_dir(), 'remote-tasks.txt')
[]
def get_task_list_cache_file(self): return os.path.join(self.get_data_dir(), 'remote-tasks.txt')
[ "def", "get_task_list_cache_file", "(", "self", ")", ":", "return", "os", ".", "path", ".", "join", "(", "self", ".", "get_data_dir", "(", ")", ",", "'remote-tasks.txt'", ")" ]
https://github.com/gtimelog/gtimelog/blob/50aeccbd3aa8ac2dde4419b033b2467444186213/src/gtimelog/settings.py#L88-L89
plotly/plotly.py
cfad7862594b35965c0e000813bd7805e8494a5b
packages/python/plotly/plotly/graph_objs/layout/_annotation.py
python
Annotation.x
(self)
return self["x"]
Sets the annotation's x position. If the axis `type` is "log", then you must take the log of your desired range. If the axis `type` is "date", it should be date strings, like date data, though Date objects and unix milliseconds will be accepted and converted to strings. If the axis `type...
Sets the annotation's x position. If the axis `type` is "log", then you must take the log of your desired range. If the axis `type` is "date", it should be date strings, like date data, though Date objects and unix milliseconds will be accepted and converted to strings. If the axis `type...
[ "Sets", "the", "annotation", "s", "x", "position", ".", "If", "the", "axis", "type", "is", "log", "then", "you", "must", "take", "the", "log", "of", "your", "desired", "range", ".", "If", "the", "axis", "type", "is", "date", "it", "should", "be", "da...
def x(self): """ Sets the annotation's x position. If the axis `type` is "log", then you must take the log of your desired range. If the axis `type` is "date", it should be date strings, like date data, though Date objects and unix milliseconds will be accepted and conver...
[ "def", "x", "(", "self", ")", ":", "return", "self", "[", "\"x\"", "]" ]
https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/layout/_annotation.py#L1005-L1021
pypr/pysph
9cb9a859934939307c65a25cbf73e4ecc83fea4a
pysph/sph/integrator_gpu_helper.py
python
GPUIntegrator._setup_methods
(self)
This sets up a few methods of this class. This is unfortunately a bit hacky right now and should be cleaned later. It creates the methods for the following: self.one_timestep: this is the same as the integrator's method. self.initialize, self.stage1 ... self.stagen are create...
This sets up a few methods of this class.
[ "This", "sets", "up", "a", "few", "methods", "of", "this", "class", "." ]
def _setup_methods(self): """This sets up a few methods of this class. This is unfortunately a bit hacky right now and should be cleaned later. It creates the methods for the following: self.one_timestep: this is the same as the integrator's method. self.initialize, s...
[ "def", "_setup_methods", "(", "self", ")", ":", "code", "=", "self", ".", "helper", ".", "get_timestep_code", "(", ")", "ns", "=", "{", "}", "exec", "(", "code", ",", "ns", ")", "self", ".", "one_timestep", "=", "types", ".", "MethodType", "(", "ns",...
https://github.com/pypr/pysph/blob/9cb9a859934939307c65a25cbf73e4ecc83fea4a/pysph/sph/integrator_gpu_helper.py#L32-L52
yt-project/yt
dc7b24f9b266703db4c843e329c6c8644d47b824
yt/frontends/ahf/data_structures.py
python
AHFHalosDataset._skip_cache
(self)
return True
[]
def _skip_cache(self): return True
[ "def", "_skip_cache", "(", "self", ")", ":", "return", "True" ]
https://github.com/yt-project/yt/blob/dc7b24f9b266703db4c843e329c6c8644d47b824/yt/frontends/ahf/data_structures.py#L160-L161
uwescience/TrafficCruising-DSSG2017
cd4476ea1a3f1c589c01029c22d75a31f3910d6a
pipeline/graph_generator.py
python
graph_generator
(path)
return grapharray
Creates directed and undirected graphs of downtown Seattle. path [str]: path to nodes.geojson Returns an list of Networkx graph objects: undirected graph (index 0) and directed graph (index 1).
Creates directed and undirected graphs of downtown Seattle.
[ "Creates", "directed", "and", "undirected", "graphs", "of", "downtown", "Seattle", "." ]
def graph_generator(path): """Creates directed and undirected graphs of downtown Seattle. path [str]: path to nodes.geojson Returns an list of Networkx graph objects: undirected graph (index 0) and directed graph (index 1).""" # import node data from the geojson file taken from OSM with open...
[ "def", "graph_generator", "(", "path", ")", ":", "# import node data from the geojson file taken from OSM", "with", "open", "(", "path", ")", "as", "f", ":", "data", "=", "json", ".", "load", "(", "f", ")", "nodes_dict", "=", "{", "}", "downtownSeattleGraph", ...
https://github.com/uwescience/TrafficCruising-DSSG2017/blob/cd4476ea1a3f1c589c01029c22d75a31f3910d6a/pipeline/graph_generator.py#L5-L479
openedx/edx-platform
68dd185a0ab45862a2a61e0f803d7e03d2be71b5
common/lib/xmodule/xmodule/modulestore/__init__.py
python
ModuleStoreRead.get_orphans
(self, course_key, **kwargs)
Get all of the xblocks in the given course which have no parents and are not of types which are usually orphaned. NOTE: may include xblocks which still have references via xblocks which don't use children to point to their dependents.
Get all of the xblocks in the given course which have no parents and are not of types which are usually orphaned. NOTE: may include xblocks which still have references via xblocks which don't use children to point to their dependents.
[ "Get", "all", "of", "the", "xblocks", "in", "the", "given", "course", "which", "have", "no", "parents", "and", "are", "not", "of", "types", "which", "are", "usually", "orphaned", ".", "NOTE", ":", "may", "include", "xblocks", "which", "still", "have", "r...
def get_orphans(self, course_key, **kwargs): """ Get all of the xblocks in the given course which have no parents and are not of types which are usually orphaned. NOTE: may include xblocks which still have references via xblocks which don't use children to point to their dependents. ...
[ "def", "get_orphans", "(", "self", ",", "course_key", ",", "*", "*", "kwargs", ")", ":", "pass" ]
https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/common/lib/xmodule/xmodule/modulestore/__init__.py#L946-L952
pypa/pip
7f8a6844037fb7255cfd0d34ff8e8cf44f2598d4
src/pip/_internal/utils/misc.py
python
is_installable_dir
(path: str)
return False
Is path is a directory containing pyproject.toml or setup.py? If pyproject.toml exists, this is a PEP 517 project. Otherwise we look for a legacy setuptools layout by identifying setup.py. We don't check for the setup.cfg because using it without setup.py is only available for PEP 517 projects, which a...
Is path is a directory containing pyproject.toml or setup.py?
[ "Is", "path", "is", "a", "directory", "containing", "pyproject", ".", "toml", "or", "setup", ".", "py?" ]
def is_installable_dir(path: str) -> bool: """Is path is a directory containing pyproject.toml or setup.py? If pyproject.toml exists, this is a PEP 517 project. Otherwise we look for a legacy setuptools layout by identifying setup.py. We don't check for the setup.cfg because using it without setup.py i...
[ "def", "is_installable_dir", "(", "path", ":", "str", ")", "->", "bool", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "path", ")", ":", "return", "False", "if", "os", ".", "path", ".", "isfile", "(", "os", ".", "path", ".", "join", "("...
https://github.com/pypa/pip/blob/7f8a6844037fb7255cfd0d34ff8e8cf44f2598d4/src/pip/_internal/utils/misc.py#L250-L264
politeauthority/docker-pretty-ps
6162cffdc66e440d8bb552d6ac16413c1a2c3f27
dockerprettyps/__init__.py
python
version
()
return True
Displays docker-pretty-ps version to the cli. Unit tested: test_version
Displays docker-pretty-ps version to the cli. Unit tested: test_version
[ "Displays", "docker", "-", "pretty", "-", "ps", "version", "to", "the", "cli", ".", "Unit", "tested", ":", "test_version" ]
def version(): """ Displays docker-pretty-ps version to the cli. Unit tested: test_version """ spacing = " " print(__title__) print("\t%sdocker-pretty-ps%s Version: %s" % (BOLD, ENDC, __version__)) pri...
[ "def", "version", "(", ")", ":", "spacing", "=", "\" \"", "print", "(", "__title__", ")", "print", "(", "\"\\t%sdocker-pretty-ps%s Version: %s\"", "%", "(", "BOLD", ",", "ENDC", ",", "__ve...
https://github.com/politeauthority/docker-pretty-ps/blob/6162cffdc66e440d8bb552d6ac16413c1a2c3f27/dockerprettyps/__init__.py#L164-L176
DataDog/dd-agent
526559be731b6e47b12d7aa8b6d45cb8d9ac4d68
util.py
python
chunks
(iterable, chunk_size)
Generate sequences of `chunk_size` elements from `iterable`.
Generate sequences of `chunk_size` elements from `iterable`.
[ "Generate", "sequences", "of", "chunk_size", "elements", "from", "iterable", "." ]
def chunks(iterable, chunk_size): """Generate sequences of `chunk_size` elements from `iterable`.""" iterable = iter(iterable) while True: chunk = [None] * chunk_size count = 0 try: for _ in range(chunk_size): chunk[count] = iterable.next() ...
[ "def", "chunks", "(", "iterable", ",", "chunk_size", ")", ":", "iterable", "=", "iter", "(", "iterable", ")", "while", "True", ":", "chunk", "=", "[", "None", "]", "*", "chunk_size", "count", "=", "0", "try", ":", "for", "_", "in", "range", "(", "c...
https://github.com/DataDog/dd-agent/blob/526559be731b6e47b12d7aa8b6d45cb8d9ac4d68/util.py#L148-L162
autotest/autotest
4614ae5f550cc888267b9a419e4b90deb54f8fae
scheduler/scheduler_models.py
python
Job.request_abort
(self)
Request that this Job be aborted on the next scheduler cycle.
Request that this Job be aborted on the next scheduler cycle.
[ "Request", "that", "this", "Job", "be", "aborted", "on", "the", "next", "scheduler", "cycle", "." ]
def request_abort(self): """Request that this Job be aborted on the next scheduler cycle.""" self.model().abort()
[ "def", "request_abort", "(", "self", ")", ":", "self", ".", "model", "(", ")", ".", "abort", "(", ")" ]
https://github.com/autotest/autotest/blob/4614ae5f550cc888267b9a419e4b90deb54f8fae/scheduler/scheduler_models.py#L1352-L1354
salabim/salabim
e0de846b042daf2dc71aaf43d8adc6486b57f376
salabim.py
python
Component._release
(self, r, q=None, s0=None, bumped_by=None)
[]
def _release(self, r, q=None, s0=None, bumped_by=None): if r not in self._claims: raise ValueError(self.name() + " not claiming from resource " + r.name()) if q is None: q = self._claims[r] if q > self._claims[r]: q = self._claims[r] r._claimed_quantit...
[ "def", "_release", "(", "self", ",", "r", ",", "q", "=", "None", ",", "s0", "=", "None", ",", "bumped_by", "=", "None", ")", ":", "if", "r", "not", "in", "self", ".", "_claims", ":", "raise", "ValueError", "(", "self", ".", "name", "(", ")", "+...
https://github.com/salabim/salabim/blob/e0de846b042daf2dc71aaf43d8adc6486b57f376/salabim.py#L13459-L13483
mcahny/vps
138503edbc9e70de744dc0c9fa4b71c799a94d5d
mmdet/models/flow_modules/FlowNet2__.py
python
FlowNet2SD.__init__
(self, args, batchNorm=False, div_flow=20)
[]
def __init__(self, args, batchNorm=False, div_flow=20): super(FlowNet2SD,self).__init__(args, batchNorm=batchNorm) self.rgb_max = args.rgb_max self.div_flow = div_flow
[ "def", "__init__", "(", "self", ",", "args", ",", "batchNorm", "=", "False", ",", "div_flow", "=", "20", ")", ":", "super", "(", "FlowNet2SD", ",", "self", ")", ".", "__init__", "(", "args", ",", "batchNorm", "=", "batchNorm", ")", "self", ".", "rgb_...
https://github.com/mcahny/vps/blob/138503edbc9e70de744dc0c9fa4b71c799a94d5d/mmdet/models/flow_modules/FlowNet2__.py#L310-L313
JDAI-CV/fast-reid
31d99b793fe0937461b9c9bc8a8a11f88bf5642c
fastreid/modeling/losses/triplet_loss.py
python
hard_example_mining
(dist_mat, is_pos, is_neg)
return dist_ap, dist_an
For each anchor, find the hardest positive and negative sample. Args: dist_mat: pair wise distance between samples, shape [N, M] is_pos: positive index with shape [N, M] is_neg: negative index with shape [N, M] Returns: dist_ap: pytorch Variable, distance(anchor, positive); shape [N] ...
For each anchor, find the hardest positive and negative sample. Args: dist_mat: pair wise distance between samples, shape [N, M] is_pos: positive index with shape [N, M] is_neg: negative index with shape [N, M] Returns: dist_ap: pytorch Variable, distance(anchor, positive); shape [N] ...
[ "For", "each", "anchor", "find", "the", "hardest", "positive", "and", "negative", "sample", ".", "Args", ":", "dist_mat", ":", "pair", "wise", "distance", "between", "samples", "shape", "[", "N", "M", "]", "is_pos", ":", "positive", "index", "with", "shape...
def hard_example_mining(dist_mat, is_pos, is_neg): """For each anchor, find the hardest positive and negative sample. Args: dist_mat: pair wise distance between samples, shape [N, M] is_pos: positive index with shape [N, M] is_neg: negative index with shape [N, M] Returns: dist_ap: p...
[ "def", "hard_example_mining", "(", "dist_mat", ",", "is_pos", ",", "is_neg", ")", ":", "assert", "len", "(", "dist_mat", ".", "size", "(", ")", ")", "==", "2", "# `dist_ap` means distance(anchor, positive)", "# both `dist_ap` and `relative_p_inds` with shape [N]", "dist...
https://github.com/JDAI-CV/fast-reid/blob/31d99b793fe0937461b9c9bc8a8a11f88bf5642c/fastreid/modeling/losses/triplet_loss.py#L21-L47
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/ast.py
python
_Unparser.visit_Set
(self, node)
[]
def visit_Set(self, node): if node.elts: with self.delimit("{", "}"): self.interleave(lambda: self.write(", "), self.traverse, node.elts) else: # `{}` would be interpreted as a dictionary literal, and # `set` might be shadowed. Thus: self.w...
[ "def", "visit_Set", "(", "self", ",", "node", ")", ":", "if", "node", ".", "elts", ":", "with", "self", ".", "delimit", "(", "\"{\"", ",", "\"}\"", ")", ":", "self", ".", "interleave", "(", "lambda", ":", "self", ".", "write", "(", "\", \"", ")", ...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/ast.py#L1283-L1290
midgetspy/Sick-Beard
171a607e41b7347a74cc815f6ecce7968d9acccf
cherrypy/_cpdispatch.py
python
RoutesDispatcher.find_handler
(self, path_info)
return handler
Find the right page handler, and set request.config.
Find the right page handler, and set request.config.
[ "Find", "the", "right", "page", "handler", "and", "set", "request", ".", "config", "." ]
def find_handler(self, path_info): """Find the right page handler, and set request.config.""" import routes request = cherrypy.serving.request config = routes.request_config() config.mapper = self.mapper if hasattr(request, 'wsgi_environ'): c...
[ "def", "find_handler", "(", "self", ",", "path_info", ")", ":", "import", "routes", "request", "=", "cherrypy", ".", "serving", ".", "request", "config", "=", "routes", ".", "request_config", "(", ")", "config", ".", "mapper", "=", "self", ".", "mapper", ...
https://github.com/midgetspy/Sick-Beard/blob/171a607e41b7347a74cc815f6ecce7968d9acccf/cherrypy/_cpdispatch.py#L424-L499
IronLanguages/ironpython2
51fdedeeda15727717fb8268a805f71b06c0b9f1
Src/StdLib/Lib/site-packages/win32comext/axdebug/gateways.py
python
RemoteDebugApplicationEvents.OnEnterBreakPoint
(self, rdat)
rdat -- PyIRemoteDebugApplicationThread
rdat -- PyIRemoteDebugApplicationThread
[ "rdat", "--", "PyIRemoteDebugApplicationThread" ]
def OnEnterBreakPoint(self, rdat): """rdat -- PyIRemoteDebugApplicationThread """ RaiseNotImpl("OnEnterBreakPoint")
[ "def", "OnEnterBreakPoint", "(", "self", ",", "rdat", ")", ":", "RaiseNotImpl", "(", "\"OnEnterBreakPoint\"", ")" ]
https://github.com/IronLanguages/ironpython2/blob/51fdedeeda15727717fb8268a805f71b06c0b9f1/Src/StdLib/Lib/site-packages/win32comext/axdebug/gateways.py#L381-L384
OpenAgricultureFoundation/openag-device-software
a51d2de399c0a6781ae51d0dcfaae1583d75f346
device/peripherals/classes/peripheral/manager.py
python
PeripheralManager._enable_manual_mode
(self)
Processes enable manual mode event request.
Processes enable manual mode event request.
[ "Processes", "enable", "manual", "mode", "event", "request", "." ]
def _enable_manual_mode(self) -> None: """Processes enable manual mode event request.""" self.logger.debug("Processing enable manual mode event request") # Check peripheral is in acceptible mode if not self.valid_transition(self.mode, modes.MANUAL): message = "Unable to enab...
[ "def", "_enable_manual_mode", "(", "self", ")", "->", "None", ":", "self", ".", "logger", ".", "debug", "(", "\"Processing enable manual mode event request\"", ")", "# Check peripheral is in acceptible mode", "if", "not", "self", ".", "valid_transition", "(", "self", ...
https://github.com/OpenAgricultureFoundation/openag-device-software/blob/a51d2de399c0a6781ae51d0dcfaae1583d75f346/device/peripherals/classes/peripheral/manager.py#L616-L627
aws-samples/aws-kube-codesuite
ab4e5ce45416b83bffb947ab8d234df5437f4fca
src/kubernetes/client/models/v1_persistent_volume_claim_list.py
python
V1PersistentVolumeClaimList.api_version
(self, api_version)
Sets the api_version of this V1PersistentVolumeClaimList. APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conven...
Sets the api_version of this V1PersistentVolumeClaimList. APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conven...
[ "Sets", "the", "api_version", "of", "this", "V1PersistentVolumeClaimList", ".", "APIVersion", "defines", "the", "versioned", "schema", "of", "this", "representation", "of", "an", "object", ".", "Servers", "should", "convert", "recognized", "schemas", "to", "the", ...
def api_version(self, api_version): """ Sets the api_version of this V1PersistentVolumeClaimList. APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: ht...
[ "def", "api_version", "(", "self", ",", "api_version", ")", ":", "self", ".", "_api_version", "=", "api_version" ]
https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/kubernetes/client/models/v1_persistent_volume_claim_list.py#L64-L73
linxid/Machine_Learning_Study_Path
558e82d13237114bbb8152483977806fc0c222af
Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/wheel.py
python
Wheel.__init__
(self, filename=None, sign=False, verify=False)
Initialise an instance using a (valid) filename.
Initialise an instance using a (valid) filename.
[ "Initialise", "an", "instance", "using", "a", "(", "valid", ")", "filename", "." ]
def __init__(self, filename=None, sign=False, verify=False): """ Initialise an instance using a (valid) filename. """ self.sign = sign self.should_verify = verify self.buildver = '' self.pyver = [PYVER] self.abi = ['none'] self.arch = ['any'] ...
[ "def", "__init__", "(", "self", ",", "filename", "=", "None", ",", "sign", "=", "False", ",", "verify", "=", "False", ")", ":", "self", ".", "sign", "=", "sign", "self", ".", "should_verify", "=", "verify", "self", ".", "buildver", "=", "''", "self",...
https://github.com/linxid/Machine_Learning_Study_Path/blob/558e82d13237114bbb8152483977806fc0c222af/Machine Learning In Action/Chapter8-Regression/venv/Lib/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/wheel.py#L144-L183
XX-net/XX-Net
a9898cfcf0084195fb7e69b6bc834e59aecdf14f
python3.8.2/Lib/site-packages/pip/_vendor/urllib3/packages/rfc3986/builder.py
python
URIBuilder.add_port
(self, port)
return URIBuilder( scheme=self.scheme, userinfo=self.userinfo, host=self.host, port='{}'.format(port_int), path=self.path, query=self.query, fragment=self.fragment, )
Add port to the URI. .. code-block:: python >>> URIBuilder().add_port(80) URIBuilder(scheme=None, userinfo=None, host=None, port='80', path=None, query=None, fragment=None) >>> URIBuilder().add_port(443) URIBuilder(scheme=None, userinfo=None...
Add port to the URI.
[ "Add", "port", "to", "the", "URI", "." ]
def add_port(self, port): """Add port to the URI. .. code-block:: python >>> URIBuilder().add_port(80) URIBuilder(scheme=None, userinfo=None, host=None, port='80', path=None, query=None, fragment=None) >>> URIBuilder().add_port(443) ...
[ "def", "add_port", "(", "self", ",", "port", ")", ":", "port_int", "=", "int", "(", "port", ")", "if", "port_int", "<", "0", ":", "raise", "ValueError", "(", "'ports are not allowed to be negative. You provided {}'", ".", "format", "(", "port_int", ",", ")", ...
https://github.com/XX-net/XX-Net/blob/a9898cfcf0084195fb7e69b6bc834e59aecdf14f/python3.8.2/Lib/site-packages/pip/_vendor/urllib3/packages/rfc3986/builder.py#L143-L180
google-research/planet
c04226b6db136f5269625378cd6a0aa875a92842
planet/tools/chunk_sequence.py
python
chunk_sequence
(sequence, chunk_length, randomize=True, num_chunks=None)
Split a nested dict of sequence tensors into a batch of chunks. This function does not expect a batch of sequences, but a single sequence. A `length` key is added if it did not exist already. When `randomize` is set, up to `chunk_length - 1` initial frames will be discarded. Final frames that do not fit into a...
Split a nested dict of sequence tensors into a batch of chunks.
[ "Split", "a", "nested", "dict", "of", "sequence", "tensors", "into", "a", "batch", "of", "chunks", "." ]
def chunk_sequence(sequence, chunk_length, randomize=True, num_chunks=None): """Split a nested dict of sequence tensors into a batch of chunks. This function does not expect a batch of sequences, but a single sequence. A `length` key is added if it did not exist already. When `randomize` is set, up to `chunk_l...
[ "def", "chunk_sequence", "(", "sequence", ",", "chunk_length", ",", "randomize", "=", "True", ",", "num_chunks", "=", "None", ")", ":", "with", "tf", ".", "device", "(", "'/cpu:0'", ")", ":", "if", "'length'", "in", "sequence", ":", "length", "=", "seque...
https://github.com/google-research/planet/blob/c04226b6db136f5269625378cd6a0aa875a92842/planet/tools/chunk_sequence.py#L25-L73
xonsh/xonsh
b76d6f994f22a4078f602f8b386f4ec280c8461f
xonsh/parsers/base.py
python
BaseParser.p_continue_stmt
(self, p)
continue_stmt : CONTINUE
continue_stmt : CONTINUE
[ "continue_stmt", ":", "CONTINUE" ]
def p_continue_stmt(self, p): """continue_stmt : CONTINUE""" p[0] = ast.Continue(lineno=self.lineno, col_offset=self.col)
[ "def", "p_continue_stmt", "(", "self", ",", "p", ")", ":", "p", "[", "0", "]", "=", "ast", ".", "Continue", "(", "lineno", "=", "self", ".", "lineno", ",", "col_offset", "=", "self", ".", "col", ")" ]
https://github.com/xonsh/xonsh/blob/b76d6f994f22a4078f602f8b386f4ec280c8461f/xonsh/parsers/base.py#L1361-L1363
21dotco/two1-python
4e833300fd5a58363e3104ed4c097631e5d296d3
two1/commands/util/logger.py
python
ClickLogger.critical
(self, msg, *args, **kwargs)
Calls Logger.critical with extra set to kwargs
Calls Logger.critical with extra set to kwargs
[ "Calls", "Logger", ".", "critical", "with", "extra", "set", "to", "kwargs" ]
def critical(self, msg, *args, **kwargs): """ Calls Logger.critical with extra set to kwargs """ super(ClickLogger, self).critical(msg, *args, extra=kwargs)
[ "def", "critical", "(", "self", ",", "msg", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "super", "(", "ClickLogger", ",", "self", ")", ".", "critical", "(", "msg", ",", "*", "args", ",", "extra", "=", "kwargs", ")" ]
https://github.com/21dotco/two1-python/blob/4e833300fd5a58363e3104ed4c097631e5d296d3/two1/commands/util/logger.py#L134-L136
fonttools/fonttools
892322aaff6a89bea5927379ec06bc0da3dfb7df
Lib/fontTools/ttLib/sfnt.py
python
DirectoryEntry.saveData
(self, file, data)
[]
def saveData(self, file, data): if hasattr(self.__class__, 'encodeData'): data = self.encodeData(data) self.length = len(data) file.seek(self.offset) file.write(data)
[ "def", "saveData", "(", "self", ",", "file", ",", "data", ")", ":", "if", "hasattr", "(", "self", ".", "__class__", ",", "'encodeData'", ")", ":", "data", "=", "self", ".", "encodeData", "(", "data", ")", "self", ".", "length", "=", "len", "(", "da...
https://github.com/fonttools/fonttools/blob/892322aaff6a89bea5927379ec06bc0da3dfb7df/Lib/fontTools/ttLib/sfnt.py#L485-L490
natewong1313/bird-bot
0a76dca2157c021c6cd5734928b1ffcf46a2b3b2
sites/bestbuy.py
python
BestBuy.monitor
(self)
[]
def monitor(self): headers = { "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9", "accept-encoding": "gzip, deflate, br", "accept-language": "en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7", ...
[ "def", "monitor", "(", "self", ")", ":", "headers", "=", "{", "\"accept\"", ":", "\"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9\"", ",", "\"accept-encoding\"", ":", "\"gzip, deflate, br\"", ",", "\"acc...
https://github.com/natewong1313/bird-bot/blob/0a76dca2157c021c6cd5734928b1ffcf46a2b3b2/sites/bestbuy.py#L58-L89
Chaffelson/nipyapi
d3b186fd701ce308c2812746d98af9120955e810
nipyapi/nifi/models/parameter_context_dto.py
python
ParameterContextDTO.parameters
(self, parameters)
Sets the parameters of this ParameterContextDTO. The Parameters for the Parameter Context :param parameters: The parameters of this ParameterContextDTO. :type: list[ParameterEntity]
Sets the parameters of this ParameterContextDTO. The Parameters for the Parameter Context
[ "Sets", "the", "parameters", "of", "this", "ParameterContextDTO", ".", "The", "Parameters", "for", "the", "Parameter", "Context" ]
def parameters(self, parameters): """ Sets the parameters of this ParameterContextDTO. The Parameters for the Parameter Context :param parameters: The parameters of this ParameterContextDTO. :type: list[ParameterEntity] """ self._parameters = parameters
[ "def", "parameters", "(", "self", ",", "parameters", ")", ":", "self", ".", "_parameters", "=", "parameters" ]
https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/parameter_context_dto.py#L134-L143
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/StdLib/Lib/_weakrefset.py
python
WeakSet.__ior__
(self, other)
return self
[]
def __ior__(self, other): self.update(other) return self
[ "def", "__ior__", "(", "self", ",", "other", ")", ":", "self", ".", "update", "(", "other", ")", "return", "self" ]
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/_weakrefset.py#L122-L124
picoCTF/picoCTF
ec33d05208b51b56760d8f72f4971ea70712bc3b
picoCTF-web/api/user.py
python
is_teacher
(uid=None)
return user.get("teacher", False)
Determine if a user is a teacher. Args: uid: user's uid Returns: True if the user is a teacher, False otherwise
Determine if a user is a teacher.
[ "Determine", "if", "a", "user", "is", "a", "teacher", "." ]
def is_teacher(uid=None): """ Determine if a user is a teacher. Args: uid: user's uid Returns: True if the user is a teacher, False otherwise """ user = get_user(uid=uid) return user.get("teacher", False)
[ "def", "is_teacher", "(", "uid", "=", "None", ")", ":", "user", "=", "get_user", "(", "uid", "=", "uid", ")", "return", "user", ".", "get", "(", "\"teacher\"", ",", "False", ")" ]
https://github.com/picoCTF/picoCTF/blob/ec33d05208b51b56760d8f72f4971ea70712bc3b/picoCTF-web/api/user.py#L304-L314
cea-sec/miasm
09376c524aedc7920a7eda304d6095e12f6958f4
miasm/expression/expression.py
python
ExprInt_from
(expr, i)
return ExprInt(i, expr.size)
Generate ExprInt with size equal to expression
Generate ExprInt with size equal to expression
[ "Generate", "ExprInt", "with", "size", "equal", "to", "expression" ]
def ExprInt_from(expr, i): "Generate ExprInt with size equal to expression" warnings.warn('DEPRECATION WARNING: use ExprInt(i, expr.size) instead of'\ 'ExprInt_from(expr, i))') return ExprInt(i, expr.size)
[ "def", "ExprInt_from", "(", "expr", ",", "i", ")", ":", "warnings", ".", "warn", "(", "'DEPRECATION WARNING: use ExprInt(i, expr.size) instead of'", "'ExprInt_from(expr, i))'", ")", "return", "ExprInt", "(", "i", ",", "expr", ".", "size", ")" ]
https://github.com/cea-sec/miasm/blob/09376c524aedc7920a7eda304d6095e12f6958f4/miasm/expression/expression.py#L1653-L1657
milo2012/osintstalker
189d4b7513b672c318d3bfdbf61766ce574516f8
fbstalker1.py
python
parseTimeline
(html,username)
reportFile.write("\nDate/Time of Facebook Posts\n") for timePost in timeOfPostList: reportFile.write(timePost+'\n')
reportFile.write("\nDate/Time of Facebook Posts\n") for timePost in timeOfPostList: reportFile.write(timePost+'\n')
[ "reportFile", ".", "write", "(", "\\", "nDate", "/", "Time", "of", "Facebook", "Posts", "\\", "n", ")", "for", "timePost", "in", "timeOfPostList", ":", "reportFile", ".", "write", "(", "timePost", "+", "\\", "n", ")" ]
def parseTimeline(html,username): soup = BeautifulSoup(html) tlTime = soup.findAll("abbr") temp123 = soup.findAll("div",{"role" : "article"}) placesCheckin = [] timeOfPostList = [] counter = 0 for y in temp123: soup1 = BeautifulSoup(str(y)) tlDateTimeLoc = soup1.findAll("a",{"class" : "uiLinkSubtle"}) #...
[ "def", "parseTimeline", "(", "html", ",", "username", ")", ":", "soup", "=", "BeautifulSoup", "(", "html", ")", "tlTime", "=", "soup", ".", "findAll", "(", "\"abbr\"", ")", "temp123", "=", "soup", ".", "findAll", "(", "\"div\"", ",", "{", "\"role\"", "...
https://github.com/milo2012/osintstalker/blob/189d4b7513b672c318d3bfdbf61766ce574516f8/fbstalker1.py#L467-L812
khanhnamle1994/natural-language-processing
01d450d5ac002b0156ef4cf93a07cb508c1bcdc5
assignment1/.env/lib/python2.7/site-packages/IPython/parallel/client/client.py
python
Client.__iter__
(self)
Since we define getitem, Client is iterable but unless we also define __iter__, it won't work correctly unless engine IDs start at zero and are continuous.
Since we define getitem, Client is iterable
[ "Since", "we", "define", "getitem", "Client", "is", "iterable" ]
def __iter__(self): """Since we define getitem, Client is iterable but unless we also define __iter__, it won't work correctly unless engine IDs start at zero and are continuous. """ for eid in self.ids: yield self.direct_view(eid)
[ "def", "__iter__", "(", "self", ")", ":", "for", "eid", "in", "self", ".", "ids", ":", "yield", "self", ".", "direct_view", "(", "eid", ")" ]
https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/IPython/parallel/client/client.py#L925-L932
OpenMDAO/OpenMDAO
f47eb5485a0bb5ea5d2ae5bd6da4b94dc6b296bd
openmdao/visualization/html_utils.py
python
read_files
(filenames, directory, extension)
return libs
Read files (based on filenames) from a directory with a given extension. Parameters ---------- filenames : list of str List of names of files to read. directory : str Pathname of directory. extension : str Extension of file names. Returns ------- dict Di...
Read files (based on filenames) from a directory with a given extension.
[ "Read", "files", "(", "based", "on", "filenames", ")", "from", "a", "directory", "with", "a", "given", "extension", "." ]
def read_files(filenames, directory, extension): """ Read files (based on filenames) from a directory with a given extension. Parameters ---------- filenames : list of str List of names of files to read. directory : str Pathname of directory. extension : str Extensio...
[ "def", "read_files", "(", "filenames", ",", "directory", ",", "extension", ")", ":", "libs", "=", "dict", "(", ")", "for", "name", "in", "filenames", ":", "with", "open", "(", "os", ".", "path", ".", "join", "(", "directory", ",", "'.'", ".", "join",...
https://github.com/OpenMDAO/OpenMDAO/blob/f47eb5485a0bb5ea5d2ae5bd6da4b94dc6b296bd/openmdao/visualization/html_utils.py#L194-L216
pymedusa/Medusa
1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38
ext/diskcache/djangocache.py
python
DjangoCache.pop
( self, key, default=None, version=None, expire_time=False, tag=False, retry=True, )
return self._cache.pop(key, default, expire_time, tag, retry)
Remove corresponding item for `key` from cache and return value. If `key` is missing, return `default`. Operation is atomic. Concurrent operations will be serialized. :param key: key for item :param default: return value if key is missing (default None) :param int version: key...
Remove corresponding item for `key` from cache and return value.
[ "Remove", "corresponding", "item", "for", "key", "from", "cache", "and", "return", "value", "." ]
def pop( self, key, default=None, version=None, expire_time=False, tag=False, retry=True, ): """Remove corresponding item for `key` from cache and return value. If `key` is missing, return `default`. Operation is atomic. Concurrent op...
[ "def", "pop", "(", "self", ",", "key", ",", "default", "=", "None", ",", "version", "=", "None", ",", "expire_time", "=", "False", ",", "tag", "=", "False", ",", "retry", "=", "True", ",", ")", ":", "key", "=", "self", ".", "make_key", "(", "key"...
https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/diskcache/djangocache.py#L184-L210
onnx/keras-onnx
3b6da290c21bbbbf418577f3e2c528986a2965c5
keras2onnx/_graph_cvt.py
python
disable_lower_using_switch_merge
(graph_def)
return output_graph_def
Set '_lower_using_switch_merge' attributes to False. Sets the attribute to False in the NodeDefs in the main graph and the NodeDefs in each function's graph. Args: graph_def: GraphDef proto. Returns: GraphDef
Set '_lower_using_switch_merge' attributes to False.
[ "Set", "_lower_using_switch_merge", "attributes", "to", "False", "." ]
def disable_lower_using_switch_merge(graph_def): """Set '_lower_using_switch_merge' attributes to False. Sets the attribute to False in the NodeDefs in the main graph and the NodeDefs in each function's graph. Args: graph_def: GraphDef proto. Returns: GraphDef """ output_graph_def = graph_pb2.G...
[ "def", "disable_lower_using_switch_merge", "(", "graph_def", ")", ":", "output_graph_def", "=", "graph_pb2", ".", "GraphDef", "(", ")", "output_graph_def", ".", "CopyFrom", "(", "graph_def", ")", "def", "disable_control_flow_lowering", "(", "node", ")", ":", "if", ...
https://github.com/onnx/keras-onnx/blob/3b6da290c21bbbbf418577f3e2c528986a2965c5/keras2onnx/_graph_cvt.py#L45-L71
maxjiang93/ugscnn
89cdd512e21a2d0cbb884e52ee75645c39ad6ed7
experiments/exp1_sphere_mnist/prepare_data.py
python
rand_rotation_matrix
(deflection=1.0, randnums=None)
return M
Creates a random rotation matrix. deflection: the magnitude of the rotation. For 0, no rotation; for 1, competely random rotation. Small deflection => small perturbation. randnums: 3 random numbers in the range [0, 1]. If `None`, they will be auto-generated. # http://blog.lostinmyterminal.com/python/201...
Creates a random rotation matrix. deflection: the magnitude of the rotation. For 0, no rotation; for 1, competely random rotation. Small deflection => small perturbation. randnums: 3 random numbers in the range [0, 1]. If `None`, they will be auto-generated. # http://blog.lostinmyterminal.com/python/201...
[ "Creates", "a", "random", "rotation", "matrix", ".", "deflection", ":", "the", "magnitude", "of", "the", "rotation", ".", "For", "0", "no", "rotation", ";", "for", "1", "competely", "random", "rotation", ".", "Small", "deflection", "=", ">", "small", "pert...
def rand_rotation_matrix(deflection=1.0, randnums=None): """ Creates a random rotation matrix. deflection: the magnitude of the rotation. For 0, no rotation; for 1, competely random rotation. Small deflection => small perturbation. randnums: 3 random numbers in the range [0, 1]. If `None`, they will...
[ "def", "rand_rotation_matrix", "(", "deflection", "=", "1.0", ",", "randnums", "=", "None", ")", ":", "if", "randnums", "is", "None", ":", "randnums", "=", "np", ".", "random", ".", "uniform", "(", "size", "=", "(", "3", ",", ")", ")", "theta", ",", ...
https://github.com/maxjiang93/ugscnn/blob/89cdd512e21a2d0cbb884e52ee75645c39ad6ed7/experiments/exp1_sphere_mnist/prepare_data.py#L28-L67
usb-tools/Facedancer
e688fe61dc34087db333432394e1f90e52ac3794
legacy-applets/USBMassStorage.py
python
FAT32DiskImage.handle_mbr_read
(self, address)
return response
Returns a master boot record directing the target device to our emulated FAT32 partition.
Returns a master boot record directing the target device to our emulated FAT32 partition.
[ "Returns", "a", "master", "boot", "record", "directing", "the", "target", "device", "to", "our", "emulated", "FAT32", "partition", "." ]
def handle_mbr_read(self, address): """ Returns a master boot record directing the target device to our emulated FAT32 partition. """ response = 440 * b'\0' # bootstrap code + timestamp response += b'\xDE\xAD\xBE\xEF' # disk s...
[ "def", "handle_mbr_read", "(", "self", ",", "address", ")", ":", "response", "=", "440", "*", "b'\\0'", "# bootstrap code + timestamp", "response", "+=", "b'\\xDE\\xAD\\xBE\\xEF'", "# disk signature (we're making one up)", "response", "+=", "b'\\x00\\x00'", "# 0 = not copy ...
https://github.com/usb-tools/Facedancer/blob/e688fe61dc34087db333432394e1f90e52ac3794/legacy-applets/USBMassStorage.py#L527-L539
4shadoww/hakkuframework
409a11fc3819d251f86faa3473439f8c19066a21
lib/scapy/config.py
python
lsc
()
Displays Scapy's default commands
Displays Scapy's default commands
[ "Displays", "Scapy", "s", "default", "commands" ]
def lsc(): # type: () -> None """Displays Scapy's default commands""" print(repr(conf.commands))
[ "def", "lsc", "(", ")", ":", "# type: () -> None", "print", "(", "repr", "(", "conf", ".", "commands", ")", ")" ]
https://github.com/4shadoww/hakkuframework/blob/409a11fc3819d251f86faa3473439f8c19066a21/lib/scapy/config.py#L321-L324
citrusCS/csgo-menu-maker
60e055b4b6f61c7081fc231da47be51eb6e1d47f
csgomenumaker/command/command.py
python
Command.combine
(self)
return output
Return an executable string of console commands representing this instance and possibly its children. Will only evaluate children if combine() hasn't been called on them yet.
Return an executable string of console commands representing this instance and possibly its children.
[ "Return", "an", "executable", "string", "of", "console", "commands", "representing", "this", "instance", "and", "possibly", "its", "children", "." ]
def combine(self): """ Return an executable string of console commands representing this instance and possibly its children. Will only evaluate children if combine() hasn't been called on them yet. """ # If the contents of this command should be hidden from the m...
[ "def", "combine", "(", "self", ")", ":", "# If the contents of this command should be hidden from the main .cfg,", "# discard them.", "if", "self", ".", "hide_children", ":", "return", "\"\"", "# Set the evaluation state of this instance to COMBINE, as its code has", "# been generate...
https://github.com/citrusCS/csgo-menu-maker/blob/60e055b4b6f61c7081fc231da47be51eb6e1d47f/csgomenumaker/command/command.py#L96-L127
chen3feng/blade-build
360b4c9ddb9087fb811af3aef2830301cf48805e
src/blade/inclusion_check.py
python
Checker._check_direct_headers
(self, full_src, direct_hdrs, suppressd_hdrs, missing_dep_hdrs, undeclared_hdrs, check_msg)
Verify directly included header files is in deps.
Verify directly included header files is in deps.
[ "Verify", "directly", "included", "header", "files", "is", "in", "deps", "." ]
def _check_direct_headers(self, full_src, direct_hdrs, suppressd_hdrs, missing_dep_hdrs, undeclared_hdrs, check_msg): """Verify directly included header files is in deps.""" msg = [] for hdr in direct_hdrs: if hdr in self.declared_hdrs: c...
[ "def", "_check_direct_headers", "(", "self", ",", "full_src", ",", "direct_hdrs", ",", "suppressd_hdrs", ",", "missing_dep_hdrs", ",", "undeclared_hdrs", ",", "check_msg", ")", ":", "msg", "=", "[", "]", "for", "hdr", "in", "direct_hdrs", ":", "if", "hdr", "...
https://github.com/chen3feng/blade-build/blob/360b4c9ddb9087fb811af3aef2830301cf48805e/src/blade/inclusion_check.py#L225-L258
puddletag/puddletag
e5fb85c34ff2e699ca35274298d1921f2598be98
source/puddlestuff/functions.py
python
enconvert
(text, enc_name)
return text.encode("latin1", 'replace').decode(enc_name, 'replace')
Convert from non-standard encoding, "Convert to encoding: $0, Encoding: $1" &Encoding, combo, cp1250, cp1251, cp1252, cp1253, cp1254, cp1255, cp1256, cp1257, cp1258,\ euc_jp, cp932, euc_jis_2004, shift_jis, johab, big5, big5hkscs, gb2312, gb18030, gbk, hz
Convert from non-standard encoding, "Convert to encoding: $0, Encoding: $1" &Encoding, combo, cp1250, cp1251, cp1252, cp1253, cp1254, cp1255, cp1256, cp1257, cp1258,\ euc_jp, cp932, euc_jis_2004, shift_jis, johab, big5, big5hkscs, gb2312, gb18030, gbk, hz
[ "Convert", "from", "non", "-", "standard", "encoding", "Convert", "to", "encoding", ":", "$0", "Encoding", ":", "$1", "&Encoding", "combo", "cp1250", "cp1251", "cp1252", "cp1253", "cp1254", "cp1255", "cp1256", "cp1257", "cp1258", "\\", "euc_jp", "cp932", "euc_...
def enconvert(text, enc_name): ''' Convert from non-standard encoding, "Convert to encoding: $0, Encoding: $1" &Encoding, combo, cp1250, cp1251, cp1252, cp1253, cp1254, cp1255, cp1256, cp1257, cp1258,\ euc_jp, cp932, euc_jis_2004, shift_jis, johab, big5, big5hkscs, gb2312, gb18030, gbk, hz''' return text.encode...
[ "def", "enconvert", "(", "text", ",", "enc_name", ")", ":", "return", "text", ".", "encode", "(", "\"latin1\"", ",", "'replace'", ")", ".", "decode", "(", "enc_name", ",", "'replace'", ")" ]
https://github.com/puddletag/puddletag/blob/e5fb85c34ff2e699ca35274298d1921f2598be98/source/puddlestuff/functions.py#L173-L177
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/min/mailbox.py
python
Mailbox.remove
(self, key)
Remove the keyed message; raise KeyError if it doesn't exist.
Remove the keyed message; raise KeyError if it doesn't exist.
[ "Remove", "the", "keyed", "message", ";", "raise", "KeyError", "if", "it", "doesn", "t", "exist", "." ]
def remove(self, key): """Remove the keyed message; raise KeyError if it doesn't exist.""" raise NotImplementedError('Method must be implemented by subclass')
[ "def", "remove", "(", "self", ",", "key", ")", ":", "raise", "NotImplementedError", "(", "'Method must be implemented by subclass'", ")" ]
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/min/mailbox.py#L46-L48
gdraheim/docker-systemctl-replacement
9cbe1a00eb4bdac6ff05b96ca34ec9ed3d8fc06c
files/docker/systemctl3.py
python
SystemctlConf.filename
(self)
return None
returns the last filename that was parsed
returns the last filename that was parsed
[ "returns", "the", "last", "filename", "that", "was", "parsed" ]
def filename(self): """ returns the last filename that was parsed """ files = self.data.filenames() if files: return files[0] return None
[ "def", "filename", "(", "self", ")", ":", "files", "=", "self", ".", "data", ".", "filenames", "(", ")", "if", "files", ":", "return", "files", "[", "0", "]", "return", "None" ]
https://github.com/gdraheim/docker-systemctl-replacement/blob/9cbe1a00eb4bdac6ff05b96ca34ec9ed3d8fc06c/files/docker/systemctl3.py#L810-L815