repo
stringlengths
7
55
path
stringlengths
4
223
url
stringlengths
87
315
code
stringlengths
75
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
avg_line_len
float64
7.91
980
Esri/ArcREST
src/arcrest/enrichment/_geoenrichment.py
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/enrichment/_geoenrichment.py#L548-L712
def standardGeographyQuery(self, sourceCountry=None, optionalCountryDataset=None, geographyLayers=None, geographyIDs=None, geographyQuery=None, ...
[ "def", "standardGeographyQuery", "(", "self", ",", "sourceCountry", "=", "None", ",", "optionalCountryDataset", "=", "None", ",", "geographyLayers", "=", "None", ",", "geographyIDs", "=", "None", ",", "geographyQuery", "=", "None", ",", "returnSubGeographyLayer", ...
The GeoEnrichment service provides a helper method that returns standard geography IDs and features for the supported geographic levels in the United States and Canada. As indicated throughout this documentation guide, the GeoEnrichment service uses the concept of a study area to define ...
[ "The", "GeoEnrichment", "service", "provides", "a", "helper", "method", "that", "returns", "standard", "geography", "IDs", "and", "features", "for", "the", "supported", "geographic", "levels", "in", "the", "United", "States", "and", "Canada", ".", "As", "indicat...
python
train
58
PMEAL/OpenPNM
openpnm/topotools/topotools.py
https://github.com/PMEAL/OpenPNM/blob/0547b5724ffedc0a593aae48639d36fe10e0baed/openpnm/topotools/topotools.py#L329-L374
def find_complement(am, sites=None, bonds=None, asmask=False): r""" Finds the complementary sites (or bonds) to a given set of inputs Parameters ---------- am : scipy.sparse matrix The adjacency matrix of the network. sites : array_like (optional) The set of sites for which the...
[ "def", "find_complement", "(", "am", ",", "sites", "=", "None", ",", "bonds", "=", "None", ",", "asmask", "=", "False", ")", ":", "if", "(", "sites", "is", "not", "None", ")", "and", "(", "bonds", "is", "None", ")", ":", "inds", "=", "sp", ".", ...
r""" Finds the complementary sites (or bonds) to a given set of inputs Parameters ---------- am : scipy.sparse matrix The adjacency matrix of the network. sites : array_like (optional) The set of sites for which the complement is sought bonds : array_like (optional) Th...
[ "r", "Finds", "the", "complementary", "sites", "(", "or", "bonds", ")", "to", "a", "given", "set", "of", "inputs" ]
python
train
30.282609
bitesofcode/projexui
projexui/widgets/xlocalebox.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xlocalebox.py#L228-L247
def setBaseLocale(self, locale): """ Sets the base locale that is used with in this widget. All displayed information will be translated to this locale. :param locale | <str> """ locale = str(locale) if self._baseLocale == locale: ...
[ "def", "setBaseLocale", "(", "self", ",", "locale", ")", ":", "locale", "=", "str", "(", "locale", ")", "if", "self", ".", "_baseLocale", "==", "locale", ":", "return", "try", ":", "babel", ".", "Locale", ".", "parse", "(", "locale", ")", "except", "...
Sets the base locale that is used with in this widget. All displayed information will be translated to this locale. :param locale | <str>
[ "Sets", "the", "base", "locale", "that", "is", "used", "with", "in", "this", "widget", ".", "All", "displayed", "information", "will", "be", "translated", "to", "this", "locale", ".", ":", "param", "locale", "|", "<str", ">" ]
python
train
29.45
specialunderwear/django-easymode
easymode/utils/standin.py
https://github.com/specialunderwear/django-easymode/blob/92f674b91fb8c54d6e379e2664e2000872d9c95e/easymode/utils/standin.py#L8-L119
def standin_for(obj, **attrs): """ Returns an object that can be used as a standin for the original object. The standin object will have extra attrs, which you can define passed as keyword arguments. Use standin like this: >>> a = u'I am E.T.' >>> b = standin_for(a, origin='outers...
[ "def", "standin_for", "(", "obj", ",", "*", "*", "attrs", ")", ":", "obj_class", "=", "obj", ".", "__class__", "if", "obj_class", "is", "bool", "or", "obj_class", "is", "NoneType", ":", "# we can not have a standing for bool or NoneType", "# because too many code us...
Returns an object that can be used as a standin for the original object. The standin object will have extra attrs, which you can define passed as keyword arguments. Use standin like this: >>> a = u'I am E.T.' >>> b = standin_for(a, origin='outerspace', package='easymode.utils.standin') ...
[ "Returns", "an", "object", "that", "can", "be", "used", "as", "a", "standin", "for", "the", "original", "object", ".", "The", "standin", "object", "will", "have", "extra", "attrs", "which", "you", "can", "define", "passed", "as", "keyword", "arguments", "....
python
train
33.410714
althonos/pronto
pronto/term.py
https://github.com/althonos/pronto/blob/a768adcba19fb34f26f67cde4a03d317f932c274/pronto/term.py#L406-L411
def parents(self): """~TermList: the parents of all the terms in the list. """ return TermList(unique_everseen( y for x in self for y in x.parents ))
[ "def", "parents", "(", "self", ")", ":", "return", "TermList", "(", "unique_everseen", "(", "y", "for", "x", "in", "self", "for", "y", "in", "x", ".", "parents", ")", ")" ]
~TermList: the parents of all the terms in the list.
[ "~TermList", ":", "the", "parents", "of", "all", "the", "terms", "in", "the", "list", "." ]
python
train
31.333333
pyscaffold/configupdater
src/configupdater/configupdater.py
https://github.com/pyscaffold/configupdater/blob/6ebac0b1fa7b8222baacdd4991d18cfc61659f84/src/configupdater/configupdater.py#L1065-L1072
def to_dict(self): """Transform to dictionary Returns: dict: dictionary with same content """ return {sect: self.__getitem__(sect).to_dict() for sect in self.sections()}
[ "def", "to_dict", "(", "self", ")", ":", "return", "{", "sect", ":", "self", ".", "__getitem__", "(", "sect", ")", ".", "to_dict", "(", ")", "for", "sect", "in", "self", ".", "sections", "(", ")", "}" ]
Transform to dictionary Returns: dict: dictionary with same content
[ "Transform", "to", "dictionary" ]
python
train
27.875
ratt-ru/PyMORESANE
pymoresane/beam_fit.py
https://github.com/ratt-ru/PyMORESANE/blob/b024591ad0bbb69320d08841f28a2c27f62ae1af/pymoresane/beam_fit.py#L6-L69
def beam_fit(psf, cdelt1, cdelt2): """ The following contructs a restoring beam from the psf. This is accoplished by fitting an elliptical Gaussian to the central lobe of the PSF. INPUTS: psf (no default): Array containing the psf for the image in question. cdelt1, cdelt2 (no default...
[ "def", "beam_fit", "(", "psf", ",", "cdelt1", ",", "cdelt2", ")", ":", "if", "psf", ".", "shape", ">", "512", ":", "psf_slice", "=", "tuple", "(", "[", "slice", "(", "psf", ".", "shape", "[", "0", "]", "/", "2", "-", "256", ",", "psf", ".", "...
The following contructs a restoring beam from the psf. This is accoplished by fitting an elliptical Gaussian to the central lobe of the PSF. INPUTS: psf (no default): Array containing the psf for the image in question. cdelt1, cdelt2 (no default): Header of the psf.
[ "The", "following", "contructs", "a", "restoring", "beam", "from", "the", "psf", ".", "This", "is", "accoplished", "by", "fitting", "an", "elliptical", "Gaussian", "to", "the", "central", "lobe", "of", "the", "PSF", "." ]
python
train
42.234375
knagra/farnsworth
workshift/utils.py
https://github.com/knagra/farnsworth/blob/1b6589f0d9fea154f0a1e2231ed906764ed26d26/workshift/utils.py#L665-L703
def update_standings(semester=None, pool_hours=None, moment=None): """ This function acts to update a list of PoolHours objects to adjust their current standing based on the time in the semester. Parameters ---------- semester : workshift.models.Semester, optional pool_hours : list of works...
[ "def", "update_standings", "(", "semester", "=", "None", ",", "pool_hours", "=", "None", ",", "moment", "=", "None", ")", ":", "if", "semester", "is", "None", ":", "try", ":", "semester", "=", "Semester", ".", "objects", ".", "get", "(", "current", "="...
This function acts to update a list of PoolHours objects to adjust their current standing based on the time in the semester. Parameters ---------- semester : workshift.models.Semester, optional pool_hours : list of workshift.models.PoolHours, optional If None, runs on all pool hours for sem...
[ "This", "function", "acts", "to", "update", "a", "list", "of", "PoolHours", "objects", "to", "adjust", "their", "current", "standing", "based", "on", "the", "time", "in", "the", "semester", "." ]
python
train
34.846154
cdeboever3/cdpybio
cdpybio/general.py
https://github.com/cdeboever3/cdpybio/blob/38efdf0e11d01bc00a135921cb91a19c03db5d5c/cdpybio/general.py#L121-L156
def _sample_names(files, kwargs): """ Make sample (or other) names. Parameters: ----------- files : list of string Typically a list of file paths although could be any list of strings that you want to make names for. If neither names nor define_sample_name are provided, the...
[ "def", "_sample_names", "(", "files", ",", "kwargs", ")", ":", "if", "'define_sample_name'", "not", "in", "kwargs", ".", "keys", "(", ")", ":", "define_sample_name", "=", "lambda", "x", ":", "x", "else", ":", "define_sample_name", "=", "kwargs", "[", "'def...
Make sample (or other) names. Parameters: ----------- files : list of string Typically a list of file paths although could be any list of strings that you want to make names for. If neither names nor define_sample_name are provided, then files is returned as is. kwargs : dict ...
[ "Make", "sample", "(", "or", "other", ")", "names", "." ]
python
train
30.194444
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_qos.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_qos.py#L286-L297
def qos_map_cos_traffic_class_name(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") qos = ET.SubElement(config, "qos", xmlns="urn:brocade.com:mgmt:brocade-qos") map = ET.SubElement(qos, "map") cos_traffic_class = ET.SubElement(map, "cos-traffic-cl...
[ "def", "qos_map_cos_traffic_class_name", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "qos", "=", "ET", ".", "SubElement", "(", "config", ",", "\"qos\"", ",", "xmlns", "=", "\"urn:brocade.com:...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
41.666667
hobson/aima
aima/csp.py
https://github.com/hobson/aima/blob/3572b2fb92039b4a1abe384be8545560fbd3d470/aima/csp.py#L273-L288
def min_conflicts(csp, max_steps=100000): """Solve a CSP by stochastic hillclimbing on the number of conflicts.""" # Generate a complete assignment for all vars (probably with conflicts) csp.current = current = {} for var in csp.vars: val = min_conflicts_value(csp, var, current) csp.assi...
[ "def", "min_conflicts", "(", "csp", ",", "max_steps", "=", "100000", ")", ":", "# Generate a complete assignment for all vars (probably with conflicts)", "csp", ".", "current", "=", "current", "=", "{", "}", "for", "var", "in", "csp", ".", "vars", ":", "val", "=...
Solve a CSP by stochastic hillclimbing on the number of conflicts.
[ "Solve", "a", "CSP", "by", "stochastic", "hillclimbing", "on", "the", "number", "of", "conflicts", "." ]
python
valid
42.4375
tensorpack/tensorpack
examples/FasterRCNN/model_mrcnn.py
https://github.com/tensorpack/tensorpack/blob/d7a13cb74c9066bc791d7aafc3b744b60ee79a9f/examples/FasterRCNN/model_mrcnn.py#L16-L51
def maskrcnn_loss(mask_logits, fg_labels, fg_target_masks): """ Args: mask_logits: #fg x #category xhxw fg_labels: #fg, in 1~#class, int64 fg_target_masks: #fgxhxw, float32 """ num_fg = tf.size(fg_labels, out_type=tf.int64) indices = tf.stack([tf.range(num_fg), fg_labels - 1]...
[ "def", "maskrcnn_loss", "(", "mask_logits", ",", "fg_labels", ",", "fg_target_masks", ")", ":", "num_fg", "=", "tf", ".", "size", "(", "fg_labels", ",", "out_type", "=", "tf", ".", "int64", ")", "indices", "=", "tf", ".", "stack", "(", "[", "tf", ".", ...
Args: mask_logits: #fg x #category xhxw fg_labels: #fg, in 1~#class, int64 fg_target_masks: #fgxhxw, float32
[ "Args", ":", "mask_logits", ":", "#fg", "x", "#category", "xhxw", "fg_labels", ":", "#fg", "in", "1~#class", "int64", "fg_target_masks", ":", "#fgxhxw", "float32" ]
python
train
40.472222
RedHatInsights/insights-core
insights/core/dr.py
https://github.com/RedHatInsights/insights-core/blob/b57cbf8ed7c089672426ede0441e0a4f789ef4a1/insights/core/dr.py#L352-L372
def get_subgraphs(graph=None): """ Given a graph of possibly disconnected components, generate all graphs of connected components. graph is a dictionary of dependencies. Keys are components, and values are sets of components on which they depend. """ graph = graph or DEPENDENCIES keys = set(...
[ "def", "get_subgraphs", "(", "graph", "=", "None", ")", ":", "graph", "=", "graph", "or", "DEPENDENCIES", "keys", "=", "set", "(", "graph", ")", "frontier", "=", "set", "(", ")", "seen", "=", "set", "(", ")", "while", "keys", ":", "frontier", ".", ...
Given a graph of possibly disconnected components, generate all graphs of connected components. graph is a dictionary of dependencies. Keys are components, and values are sets of components on which they depend.
[ "Given", "a", "graph", "of", "possibly", "disconnected", "components", "generate", "all", "graphs", "of", "connected", "components", ".", "graph", "is", "a", "dictionary", "of", "dependencies", ".", "Keys", "are", "components", "and", "values", "are", "sets", ...
python
train
37.333333
bfrog/whizzer
whizzer/server.py
https://github.com/bfrog/whizzer/blob/a1e43084b3ac8c1f3fb4ada081777cdbf791fd77/whizzer/server.py#L142-L158
def _readable(self, watcher, events): """Called by the pyev watcher (self.read_watcher) whenever the socket is readable. This means either the socket has been closed or there is a new client connection waiting. """ protocol = self.factory.build(self.loop) try...
[ "def", "_readable", "(", "self", ",", "watcher", ",", "events", ")", ":", "protocol", "=", "self", ".", "factory", ".", "build", "(", "self", ".", "loop", ")", "try", ":", "sock", ",", "address", "=", "self", ".", "sock", ".", "accept", "(", ")", ...
Called by the pyev watcher (self.read_watcher) whenever the socket is readable. This means either the socket has been closed or there is a new client connection waiting.
[ "Called", "by", "the", "pyev", "watcher", "(", "self", ".", "read_watcher", ")", "whenever", "the", "socket", "is", "readable", ".", "This", "means", "either", "the", "socket", "has", "been", "closed", "or", "there", "is", "a", "new", "client", "connection...
python
train
36.411765
choderalab/pymbar
pymbar/timeseries.py
https://github.com/choderalab/pymbar/blob/69d1f0ff680e9ac1c6a51a5a207ea28f3ed86740/pymbar/timeseries.py#L372-L383
def integratedAutocorrelationTimeMultiple(A_kn, fast=False): """Estimate the integrated autocorrelation time from multiple timeseries. See Also -------- statisticalInefficiencyMultiple """ g = statisticalInefficiencyMultiple(A_kn, fast, False) tau = (g - 1.0) / 2.0 return tau
[ "def", "integratedAutocorrelationTimeMultiple", "(", "A_kn", ",", "fast", "=", "False", ")", ":", "g", "=", "statisticalInefficiencyMultiple", "(", "A_kn", ",", "fast", ",", "False", ")", "tau", "=", "(", "g", "-", "1.0", ")", "/", "2.0", "return", "tau" ]
Estimate the integrated autocorrelation time from multiple timeseries. See Also -------- statisticalInefficiencyMultiple
[ "Estimate", "the", "integrated", "autocorrelation", "time", "from", "multiple", "timeseries", "." ]
python
train
25
seantis/suitable
suitable/api.py
https://github.com/seantis/suitable/blob/b056afb753f2b89909edfb6e00ec7c55691135ff/suitable/api.py#L298-L315
def install_strategy_plugins(directories): """ Loads the given strategy plugins, which is a list of directories, a string with a single directory or a string with multiple directories separated by colon. As these plugins are globally loaded and cached by Ansible we do the same here. We could try to...
[ "def", "install_strategy_plugins", "(", "directories", ")", ":", "if", "isinstance", "(", "directories", ",", "str", ")", ":", "directories", "=", "directories", ".", "split", "(", "':'", ")", "for", "directory", "in", "directories", ":", "strategy_loader", "....
Loads the given strategy plugins, which is a list of directories, a string with a single directory or a string with multiple directories separated by colon. As these plugins are globally loaded and cached by Ansible we do the same here. We could try to bind those plugins to the Api instance, but that's...
[ "Loads", "the", "given", "strategy", "plugins", "which", "is", "a", "list", "of", "directories", "a", "string", "with", "a", "single", "directory", "or", "a", "string", "with", "multiple", "directories", "separated", "by", "colon", "." ]
python
train
37.555556
cltk/cltk
cltk/stem/akkadian/stem.py
https://github.com/cltk/cltk/blob/ed9c025b7ec43c949481173251b70e05e4dffd27/cltk/stem/akkadian/stem.py#L50-L79
def get_stem(self, noun, gender, mimation=True): """Return the stem of a noun, given its gender""" stem = '' if mimation and noun[-1:] == 'm': # noun = noun[:-1] pass # Take off ending if gender == 'm': if noun[-2:] in list(self.endings['m']['s...
[ "def", "get_stem", "(", "self", ",", "noun", ",", "gender", ",", "mimation", "=", "True", ")", ":", "stem", "=", "''", "if", "mimation", "and", "noun", "[", "-", "1", ":", "]", "==", "'m'", ":", "# noun = noun[:-1]", "pass", "# Take off ending", "if", ...
Return the stem of a noun, given its gender
[ "Return", "the", "stem", "of", "a", "noun", "given", "its", "gender" ]
python
train
44
Karaage-Cluster/karaage
karaage/institutes/lookups.py
https://github.com/Karaage-Cluster/karaage/blob/2f4c8b4e2d728b3fcbb151160c49000f1c04f5c9/karaage/institutes/lookups.py#L32-L43
def check_auth(self, request): """ to ensure that nobody can get your data via json simply by knowing the URL. public facing forms should write a custom LookupChannel to implement as you wish. also you could choose to return HttpResponseForbidden("who are you?") instead of rais...
[ "def", "check_auth", "(", "self", ",", "request", ")", ":", "if", "not", "request", ".", "user", ".", "is_authenticated", ":", "raise", "PermissionDenied", "if", "not", "is_admin", "(", "request", ")", ":", "raise", "PermissionDenied" ]
to ensure that nobody can get your data via json simply by knowing the URL. public facing forms should write a custom LookupChannel to implement as you wish. also you could choose to return HttpResponseForbidden("who are you?") instead of raising PermissionDenied (401 response)
[ "to", "ensure", "that", "nobody", "can", "get", "your", "data", "via", "json", "simply", "by", "knowing", "the", "URL", ".", "public", "facing", "forms", "should", "write", "a", "custom", "LookupChannel", "to", "implement", "as", "you", "wish", ".", "also"...
python
train
42.833333
allenai/allennlp
allennlp/nn/chu_liu_edmonds.py
https://github.com/allenai/allennlp/blob/648a36f77db7e45784c047176074f98534c76636/allennlp/nn/chu_liu_edmonds.py#L7-L85
def decode_mst(energy: numpy.ndarray, length: int, has_labels: bool = True) -> Tuple[numpy.ndarray, numpy.ndarray]: """ Note: Counter to typical intuition, this function decodes the _maximum_ spanning tree. Decode the optimal MST tree with the Chu-Liu-Edmonds algorithm for...
[ "def", "decode_mst", "(", "energy", ":", "numpy", ".", "ndarray", ",", "length", ":", "int", ",", "has_labels", ":", "bool", "=", "True", ")", "->", "Tuple", "[", "numpy", ".", "ndarray", ",", "numpy", ".", "ndarray", "]", ":", "if", "has_labels", "a...
Note: Counter to typical intuition, this function decodes the _maximum_ spanning tree. Decode the optimal MST tree with the Chu-Liu-Edmonds algorithm for maximum spanning arborescences on graphs. Parameters ---------- energy : ``numpy.ndarray``, required. A tensor with shape (num_label...
[ "Note", ":", "Counter", "to", "typical", "intuition", "this", "function", "decodes", "the", "_maximum_", "spanning", "tree", "." ]
python
train
36.367089
mgedmin/findimports
findimports.py
https://github.com/mgedmin/findimports/blob/c20a50b497390fed15aa3835476f4fad57313e8a/findimports.py#L719-L731
def printUnusedImports(self): """Produce a report of unused imports.""" for module in self.listModules(): names = [(unused.lineno, unused.name) for unused in module.unused_names] names.sort() for lineno, name in names: if not self....
[ "def", "printUnusedImports", "(", "self", ")", ":", "for", "module", "in", "self", ".", "listModules", "(", ")", ":", "names", "=", "[", "(", "unused", ".", "lineno", ",", "unused", ".", "name", ")", "for", "unused", "in", "module", ".", "unused_names"...
Produce a report of unused imports.
[ "Produce", "a", "report", "of", "unused", "imports", "." ]
python
train
47.384615
hyperledger/indy-plenum
stp_core/network/util.py
https://github.com/hyperledger/indy-plenum/blob/dcd144e238af7f17a869ffc9412f13dc488b7020/stp_core/network/util.py#L47-L57
def evenCompare(a: str, b: str) -> bool: """ A deterministic but more evenly distributed comparator than simple alphabetical. Useful when comparing consecutive strings and an even distribution is needed. Provides an even chance of returning true as often as false """ ab = a.encode('utf-8') b...
[ "def", "evenCompare", "(", "a", ":", "str", ",", "b", ":", "str", ")", "->", "bool", ":", "ab", "=", "a", ".", "encode", "(", "'utf-8'", ")", "bb", "=", "b", ".", "encode", "(", "'utf-8'", ")", "ac", "=", "crypto_hash_sha256", "(", "ab", ")", "...
A deterministic but more evenly distributed comparator than simple alphabetical. Useful when comparing consecutive strings and an even distribution is needed. Provides an even chance of returning true as often as false
[ "A", "deterministic", "but", "more", "evenly", "distributed", "comparator", "than", "simple", "alphabetical", ".", "Useful", "when", "comparing", "consecutive", "strings", "and", "an", "even", "distribution", "is", "needed", ".", "Provides", "an", "even", "chance"...
python
train
37.636364
inveniosoftware/kwalitee
kwalitee/cli/check.py
https://github.com/inveniosoftware/kwalitee/blob/9124f8f55b15547fef08c6c43cabced314e70674/kwalitee/cli/check.py#L179-L278
def files(obj, commit='HEAD', skip_merge_commits=False): """Check the files of the commits.""" from ..kwalitee import check_file, SUPPORTED_FILES from ..hooks import run options = obj.options repository = obj.repository if options.get('colors') is not False: colorama.init(autoreset=True...
[ "def", "files", "(", "obj", ",", "commit", "=", "'HEAD'", ",", "skip_merge_commits", "=", "False", ")", ":", "from", ".", ".", "kwalitee", "import", "check_file", ",", "SUPPORTED_FILES", "from", ".", ".", "hooks", "import", "run", "options", "=", "obj", ...
Check the files of the commits.
[ "Check", "the", "files", "of", "the", "commits", "." ]
python
train
35.3
lrq3000/pyFileFixity
pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/lib/profilers/visual/runsnakerun/runsnake.py#L750-L791
def LoadState( self, config_parser ): """Set our window state from the given config_parser instance""" if not config_parser: return if ( not config_parser.has_section( 'window' ) or ( config_parser.has_option( 'window','maximized' ) and co...
[ "def", "LoadState", "(", "self", ",", "config_parser", ")", ":", "if", "not", "config_parser", ":", "return", "if", "(", "not", "config_parser", ".", "has_section", "(", "'window'", ")", "or", "(", "config_parser", ".", "has_option", "(", "'window'", ",", ...
Set our window state from the given config_parser instance
[ "Set", "our", "window", "state", "from", "the", "given", "config_parser", "instance" ]
python
train
37.166667
StackStorm/pybind
pybind/slxos/v17r_1_01a/routing_system/route_map/content/set_/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17r_1_01a/routing_system/route_map/content/set_/__init__.py#L527-L550
def _set_automatic_tag(self, v, load=False): """ Setter method for automatic_tag, mapped from YANG variable /routing_system/route_map/content/set/automatic_tag (container) If this variable is read-only (config: false) in the source YANG file, then _set_automatic_tag is considered as a private method...
[ "def", "_set_automatic_tag", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "v", ",", "...
Setter method for automatic_tag, mapped from YANG variable /routing_system/route_map/content/set/automatic_tag (container) If this variable is read-only (config: false) in the source YANG file, then _set_automatic_tag is considered as a private method. Backends looking to populate this variable should d...
[ "Setter", "method", "for", "automatic_tag", "mapped", "from", "YANG", "variable", "/", "routing_system", "/", "route_map", "/", "content", "/", "set", "/", "automatic_tag", "(", "container", ")", "If", "this", "variable", "is", "read", "-", "only", "(", "con...
python
train
74.458333
pre-commit/pre-commit
pre_commit/parse_shebang.py
https://github.com/pre-commit/pre-commit/blob/72f98d26e690da11dc2e41861d14c58eb21930cb/pre_commit/parse_shebang.py#L62-L78
def normalize_cmd(cmd): """Fixes for the following issues on windows - https://bugs.python.org/issue8557 - windows does not parse shebangs This function also makes deep-path shebangs work just fine """ # Use PATH to determine the executable exe = normexe(cmd[0]) # Figure out the sheban...
[ "def", "normalize_cmd", "(", "cmd", ")", ":", "# Use PATH to determine the executable", "exe", "=", "normexe", "(", "cmd", "[", "0", "]", ")", "# Figure out the shebang from the resulting command", "cmd", "=", "parse_filename", "(", "exe", ")", "+", "(", "exe", ",...
Fixes for the following issues on windows - https://bugs.python.org/issue8557 - windows does not parse shebangs This function also makes deep-path shebangs work just fine
[ "Fixes", "for", "the", "following", "issues", "on", "windows", "-", "https", ":", "//", "bugs", ".", "python", ".", "org", "/", "issue8557", "-", "windows", "does", "not", "parse", "shebangs" ]
python
train
29.235294
ConsenSys/mythril-classic
mythril/laser/smt/__init__.py
https://github.com/ConsenSys/mythril-classic/blob/27af71c34b2ce94f4fae5613ec457f93df1a8f56/mythril/laser/smt/__init__.py#L115-L123
def Bool(value: "__builtins__.bool", annotations: Annotations = None) -> bool.Bool: """ Creates a Bool with concrete value :param value: The boolean value :param annotations: The annotations to initialize the bool with :return: The freshly created Bool() """ raw =...
[ "def", "Bool", "(", "value", ":", "\"__builtins__.bool\"", ",", "annotations", ":", "Annotations", "=", "None", ")", "->", "bool", ".", "Bool", ":", "raw", "=", "z3", ".", "BoolVal", "(", "value", ")", "return", "Bool", "(", "raw", ",", "annotations", ...
Creates a Bool with concrete value :param value: The boolean value :param annotations: The annotations to initialize the bool with :return: The freshly created Bool()
[ "Creates", "a", "Bool", "with", "concrete", "value", ":", "param", "value", ":", "The", "boolean", "value", ":", "param", "annotations", ":", "The", "annotations", "to", "initialize", "the", "bool", "with", ":", "return", ":", "The", "freshly", "created", ...
python
train
40.888889
zenodo/zenodo-accessrequests
zenodo_accessrequests/models.py
https://github.com/zenodo/zenodo-accessrequests/blob/ce2cf3f1425d02ba4f3ad3202cfca43a1892558a/zenodo_accessrequests/models.py#L154-L174
def get_absolute_url(self, endpoint): """Get absolute for secret link (using https scheme). The endpoint is passed to ``url_for`` with ``token`` and ``extra_data`` as keyword arguments. E.g.:: >>> link.extra_data dict(recid=1) >>> link.get_absolute_url('reco...
[ "def", "get_absolute_url", "(", "self", ",", "endpoint", ")", ":", "copy", "=", "deepcopy", "(", "self", ".", "extra_data", ")", "if", "'recid'", "in", "copy", ":", "copy", "[", "'pid_value'", "]", "=", "copy", ".", "pop", "(", "'recid'", ")", "return"...
Get absolute for secret link (using https scheme). The endpoint is passed to ``url_for`` with ``token`` and ``extra_data`` as keyword arguments. E.g.:: >>> link.extra_data dict(recid=1) >>> link.get_absolute_url('record.metadata') translates into:: ...
[ "Get", "absolute", "for", "secret", "link", "(", "using", "https", "scheme", ")", "." ]
python
test
31.238095
totalgood/nlpia
src/nlpia/book/examples/ch10_batching_utils.py
https://github.com/totalgood/nlpia/blob/efa01126275e9cd3c3a5151a644f1c798a9ec53f/src/nlpia/book/examples/ch10_batching_utils.py#L15-L48
def batch(inputs, max_sequence_length=None): """ Args: inputs: list of sentences (integer lists) max_sequence_length: integer specifying how large should `max_time` dimension be. If None, maximum sequence length would be used Outputs: inputs_t...
[ "def", "batch", "(", "inputs", ",", "max_sequence_length", "=", "None", ")", ":", "sequence_lengths", "=", "[", "len", "(", "seq", ")", "for", "seq", "in", "inputs", "]", "batch_size", "=", "len", "(", "inputs", ")", "if", "max_sequence_length", "is", "N...
Args: inputs: list of sentences (integer lists) max_sequence_length: integer specifying how large should `max_time` dimension be. If None, maximum sequence length would be used Outputs: inputs_time_major: input sentences transformed into t...
[ "Args", ":", "inputs", ":", "list", "of", "sentences", "(", "integer", "lists", ")", "max_sequence_length", ":", "integer", "specifying", "how", "large", "should", "max_time", "dimension", "be", ".", "If", "None", "maximum", "sequence", "length", "would", "be"...
python
train
33.705882
DarkEnergySurvey/ugali
ugali/utils/stats.py
https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/utils/stats.py#L201-L244
def supplement(self,coordsys='gal'): """ Add some supplemental columns """ from ugali.utils.projector import gal2cel, gal2cel_angle from ugali.utils.projector import cel2gal, cel2gal_angle coordsys = coordsys.lower() kwargs = dict(usemask=False, asrecarray=True) out = co...
[ "def", "supplement", "(", "self", ",", "coordsys", "=", "'gal'", ")", ":", "from", "ugali", ".", "utils", ".", "projector", "import", "gal2cel", ",", "gal2cel_angle", "from", "ugali", ".", "utils", ".", "projector", "import", "cel2gal", ",", "cel2gal_angle",...
Add some supplemental columns
[ "Add", "some", "supplemental", "columns" ]
python
train
40.681818
proycon/pynlpl
pynlpl/formats/folia.py
https://github.com/proycon/pynlpl/blob/7707f69a91caaa6cde037f0d0379f1d42500a68b/pynlpl/formats/folia.py#L5098-L5103
def gettextdelimiter(self, retaintokenisation=False): """See :meth:`AbstractElement.gettextdelimiter`""" for e in self: if isinstance(e, New) or isinstance(e, Current): return e.gettextdelimiter(retaintokenisation) return ""
[ "def", "gettextdelimiter", "(", "self", ",", "retaintokenisation", "=", "False", ")", ":", "for", "e", "in", "self", ":", "if", "isinstance", "(", "e", ",", "New", ")", "or", "isinstance", "(", "e", ",", "Current", ")", ":", "return", "e", ".", "gett...
See :meth:`AbstractElement.gettextdelimiter`
[ "See", ":", "meth", ":", "AbstractElement", ".", "gettextdelimiter" ]
python
train
45.166667
quintusdias/glymur
glymur/lib/openjpeg.py
https://github.com/quintusdias/glymur/blob/8b8fb091130fff00f1028dc82219e69e3f9baf6d/glymur/lib/openjpeg.py#L441-L445
def cio_close(cio): """Wraps openjpeg library function cio_close. """ OPENJPEG.opj_cio_close.argtypes = [ctypes.POINTER(CioType)] OPENJPEG.opj_cio_close(cio)
[ "def", "cio_close", "(", "cio", ")", ":", "OPENJPEG", ".", "opj_cio_close", ".", "argtypes", "=", "[", "ctypes", ".", "POINTER", "(", "CioType", ")", "]", "OPENJPEG", ".", "opj_cio_close", "(", "cio", ")" ]
Wraps openjpeg library function cio_close.
[ "Wraps", "openjpeg", "library", "function", "cio_close", "." ]
python
train
33.8
openeemeter/eeweather
eeweather/ranking.py
https://github.com/openeemeter/eeweather/blob/d32b7369b26edfa3ee431c60457afeb0593123a7/eeweather/ranking.py#L323-L350
def combine_ranked_stations(rankings): """ Combine :any:`pandas.DataFrame` s of candidate weather stations to form a hybrid ranking dataframe. Parameters ---------- rankings : list of :any:`pandas.DataFrame` Dataframes of ranked weather station candidates and metadata. All ranking d...
[ "def", "combine_ranked_stations", "(", "rankings", ")", ":", "if", "len", "(", "rankings", ")", "==", "0", ":", "raise", "ValueError", "(", "\"Requires at least one ranking.\"", ")", "combined_ranking", "=", "rankings", "[", "0", "]", "for", "ranking", "in", "...
Combine :any:`pandas.DataFrame` s of candidate weather stations to form a hybrid ranking dataframe. Parameters ---------- rankings : list of :any:`pandas.DataFrame` Dataframes of ranked weather station candidates and metadata. All ranking dataframes should have the same columns and must...
[ "Combine", ":", "any", ":", "pandas", ".", "DataFrame", "s", "of", "candidate", "weather", "stations", "to", "form", "a", "hybrid", "ranking", "dataframe", "." ]
python
train
34.321429
frnsys/broca
broca/common/util.py
https://github.com/frnsys/broca/blob/7236dcf54edc0a4a54a55eb93be30800910667e7/broca/common/util.py#L59-L66
def parallel(func, inputs, n_jobs, expand_args=False): """ Convenience wrapper around joblib's parallelization. """ if expand_args: return Parallel(n_jobs=n_jobs)(delayed(func)(*args) for args in inputs) else: return Parallel(n_jobs=n_jobs)(delayed(func)(arg) for arg in inputs)
[ "def", "parallel", "(", "func", ",", "inputs", ",", "n_jobs", ",", "expand_args", "=", "False", ")", ":", "if", "expand_args", ":", "return", "Parallel", "(", "n_jobs", "=", "n_jobs", ")", "(", "delayed", "(", "func", ")", "(", "*", "args", ")", "for...
Convenience wrapper around joblib's parallelization.
[ "Convenience", "wrapper", "around", "joblib", "s", "parallelization", "." ]
python
train
38.375
project-ncl/pnc-cli
pnc_cli/buildconfigurations.py
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/buildconfigurations.py#L432-L438
def add_product_version_to_build_configuration(id=None, name=None, product_version_id=None): """ Associate an existing ProductVersion with a BuildConfiguration """ data = remove_product_version_from_build_configuration_raw(id, name, product_version_id) if data: return utils.format_json_list(...
[ "def", "add_product_version_to_build_configuration", "(", "id", "=", "None", ",", "name", "=", "None", ",", "product_version_id", "=", "None", ")", ":", "data", "=", "remove_product_version_from_build_configuration_raw", "(", "id", ",", "name", ",", "product_version_i...
Associate an existing ProductVersion with a BuildConfiguration
[ "Associate", "an", "existing", "ProductVersion", "with", "a", "BuildConfiguration" ]
python
train
45.571429
gwpy/gwpy
gwpy/signal/window.py
https://github.com/gwpy/gwpy/blob/7a92b917e7dd2d99b15895293a1fa1d66cdb210a/gwpy/signal/window.py#L36-L76
def canonical_name(name): """Find the canonical name for the given window in scipy.signal Parameters ---------- name : `str` the name of the window you want Returns ------- realname : `str` the name of the window as implemented in `scipy.signal.window` Raises -----...
[ "def", "canonical_name", "(", "name", ")", ":", "if", "name", ".", "lower", "(", ")", "==", "'planck'", ":", "# make sure to handle the Planck window", "return", "'planck'", "try", ":", "# use equivalence introduced in scipy 0.16.0", "# pylint: disable=protected-access", ...
Find the canonical name for the given window in scipy.signal Parameters ---------- name : `str` the name of the window you want Returns ------- realname : `str` the name of the window as implemented in `scipy.signal.window` Raises ------- ValueError if ``na...
[ "Find", "the", "canonical", "name", "for", "the", "given", "window", "in", "scipy", ".", "signal" ]
python
train
28.560976
razor-x/scipy-data_fitting
scipy_data_fitting/core.py
https://github.com/razor-x/scipy-data_fitting/blob/c756a645da8629699b3f22244bfb7d5d4d88b179/scipy_data_fitting/core.py#L3-L15
def get_constant(value): """ When `value` is a string, get the corresponding constant from [`scipy.constants`][1]. [1]: http://docs.scipy.org/doc/scipy/reference/constants.html """ if type(value) is str: if hasattr(scipy.constants, value): return getattr(scipy.constants, value) ...
[ "def", "get_constant", "(", "value", ")", ":", "if", "type", "(", "value", ")", "is", "str", ":", "if", "hasattr", "(", "scipy", ".", "constants", ",", "value", ")", ":", "return", "getattr", "(", "scipy", ".", "constants", ",", "value", ")", "else",...
When `value` is a string, get the corresponding constant from [`scipy.constants`][1]. [1]: http://docs.scipy.org/doc/scipy/reference/constants.html
[ "When", "value", "is", "a", "string", "get", "the", "corresponding", "constant", "from", "[", "scipy", ".", "constants", "]", "[", "1", "]", "." ]
python
train
32
pywbem/pywbem
pywbem_mock/_wbemconnection_mock.py
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem_mock/_wbemconnection_mock.py#L1065-L1073
def _get_inst_repo(self, namespace=None): """ Test support method that returns instances from the repository with no processing. It uses the default namespace if input parameter for namespace is None """ if namespace is None: namespace = self.default_namespac...
[ "def", "_get_inst_repo", "(", "self", ",", "namespace", "=", "None", ")", ":", "if", "namespace", "is", "None", ":", "namespace", "=", "self", ".", "default_namespace", "return", "self", ".", "instances", "[", "namespace", "]" ]
Test support method that returns instances from the repository with no processing. It uses the default namespace if input parameter for namespace is None
[ "Test", "support", "method", "that", "returns", "instances", "from", "the", "repository", "with", "no", "processing", ".", "It", "uses", "the", "default", "namespace", "if", "input", "parameter", "for", "namespace", "is", "None" ]
python
train
39.333333
mitsei/dlkit
dlkit/json_/assessment/managers.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/managers.py#L2496-L2513
def get_assessment_basic_authoring_session(self, proxy): """Gets the ``OsidSession`` associated with the assessment authoring service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.assessment.AssessmentBasicAuthoringSession) - an ``AssessmentBasicAuthoringSession`` ...
[ "def", "get_assessment_basic_authoring_session", "(", "self", ",", "proxy", ")", ":", "if", "not", "self", ".", "supports_assessment_basic_authoring", "(", ")", ":", "raise", "errors", ".", "Unimplemented", "(", ")", "# pylint: disable=no-member", "return", "sessions"...
Gets the ``OsidSession`` associated with the assessment authoring service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.assessment.AssessmentBasicAuthoringSession) - an ``AssessmentBasicAuthoringSession`` raise: NullArgument - ``proxy`` is ``null`` raise: Op...
[ "Gets", "the", "OsidSession", "associated", "with", "the", "assessment", "authoring", "service", "." ]
python
train
49.388889
opendatateam/udata
udata/core/spatial/models.py
https://github.com/opendatateam/udata/blob/f016585af94b0ff6bd73738c700324adc8ba7f8f/udata/core/spatial/models.py#L164-L169
def level_i18n_name(self): """In use within templates for dynamic translations.""" for level, name in spatial_granularities: if self.level == level: return name return self.level_name
[ "def", "level_i18n_name", "(", "self", ")", ":", "for", "level", ",", "name", "in", "spatial_granularities", ":", "if", "self", ".", "level", "==", "level", ":", "return", "name", "return", "self", ".", "level_name" ]
In use within templates for dynamic translations.
[ "In", "use", "within", "templates", "for", "dynamic", "translations", "." ]
python
train
38.333333
blueset/ehForwarderBot
ehforwarderbot/middleware.py
https://github.com/blueset/ehForwarderBot/blob/62e8fcfe77b2993aba91623f538f404a90f59f1d/ehforwarderbot/middleware.py#L44-L56
def get_extra_functions(self) -> Dict[str, Callable]: """Get a list of additional features Returns: Dict[str, Callable]: A dict of methods marked as additional features. Method can be called with ``get_extra_functions()["methodName"]()``. """ methods = {} ...
[ "def", "get_extra_functions", "(", "self", ")", "->", "Dict", "[", "str", ",", "Callable", "]", ":", "methods", "=", "{", "}", "for", "mName", "in", "dir", "(", "self", ")", ":", "m", "=", "getattr", "(", "self", ",", "mName", ")", "if", "callable"...
Get a list of additional features Returns: Dict[str, Callable]: A dict of methods marked as additional features. Method can be called with ``get_extra_functions()["methodName"]()``.
[ "Get", "a", "list", "of", "additional", "features" ]
python
train
37.615385
IRC-SPHERE/HyperStream
hyperstream/workflow/workflow.py
https://github.com/IRC-SPHERE/HyperStream/blob/98478f4d31ed938f4aa7c958ed0d4c3ffcb2e780/hyperstream/workflow/workflow.py#L287-L374
def create_multi_output_factor(self, tool, source, splitting_node, sink): """ Creates a multi-output factor. This takes a single node, applies a MultiOutputTool to create multiple nodes on a new plate Instantiates a single tool for all of the input plate values, and connects the ...
[ "def", "create_multi_output_factor", "(", "self", ",", "tool", ",", "source", ",", "splitting_node", ",", "sink", ")", ":", "if", "source", "and", "not", "isinstance", "(", "source", ",", "Node", ")", ":", "raise", "ValueError", "(", "\"Expected Node, got {}\"...
Creates a multi-output factor. This takes a single node, applies a MultiOutputTool to create multiple nodes on a new plate Instantiates a single tool for all of the input plate values, and connects the source and sink nodes with that tool. Note that the tool parameters these are current...
[ "Creates", "a", "multi", "-", "output", "factor", ".", "This", "takes", "a", "single", "node", "applies", "a", "MultiOutputTool", "to", "create", "multiple", "nodes", "on", "a", "new", "plate", "Instantiates", "a", "single", "tool", "for", "all", "of", "th...
python
train
49.420455
dhylands/rshell
rshell/main.py
https://github.com/dhylands/rshell/blob/a92a8fa8074ac792241c83c640a51b394667c324/rshell/main.py#L1848-L1927
def real_filename_complete(self, text, line, begidx, endidx): """Figure out what filenames match the completion.""" # line contains the full command line that's been entered so far. # text contains the portion of the line that readline is trying to complete # text should correspond to l...
[ "def", "real_filename_complete", "(", "self", ",", "text", ",", "line", ",", "begidx", ",", "endidx", ")", ":", "# line contains the full command line that's been entered so far.", "# text contains the portion of the line that readline is trying to complete", "# text should correspon...
Figure out what filenames match the completion.
[ "Figure", "out", "what", "filenames", "match", "the", "completion", "." ]
python
train
47.8125
saltstack/salt
salt/minion.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/minion.py#L1631-L1851
def _thread_return(cls, minion_instance, opts, data): ''' This method should be used as a threading target, start the actual minion side execution. ''' fn_ = os.path.join(minion_instance.proc_dir, data['jid']) if opts['multiprocessing'] and not salt.utils.platform.is_win...
[ "def", "_thread_return", "(", "cls", ",", "minion_instance", ",", "opts", ",", "data", ")", ":", "fn_", "=", "os", ".", "path", ".", "join", "(", "minion_instance", ".", "proc_dir", ",", "data", "[", "'jid'", "]", ")", "if", "opts", "[", "'multiprocess...
This method should be used as a threading target, start the actual minion side execution.
[ "This", "method", "should", "be", "used", "as", "a", "threading", "target", "start", "the", "actual", "minion", "side", "execution", "." ]
python
train
49.80543
RiotGames/cloud-inquisitor
backend/cloud_inquisitor/plugins/views/users.py
https://github.com/RiotGames/cloud-inquisitor/blob/181dc2566ca59fc855f695b7fcc2c3b934e6ee9f/backend/cloud_inquisitor/plugins/views/users.py#L140-L151
def get(self, user_id): """Returns a specific user""" user = db.User.find_one(User.user_id == user_id) roles = db.Role.all() if not user: return self.make_response('Unable to find the user requested, might have been removed', HTTP.NOT_FOUND) return self.make_respons...
[ "def", "get", "(", "self", ",", "user_id", ")", ":", "user", "=", "db", ".", "User", ".", "find_one", "(", "User", ".", "user_id", "==", "user_id", ")", "roles", "=", "db", ".", "Role", ".", "all", "(", ")", "if", "not", "user", ":", "return", ...
Returns a specific user
[ "Returns", "a", "specific", "user" ]
python
train
32.916667
tarmstrong/nbdiff
nbdiff/notebook_diff.py
https://github.com/tarmstrong/nbdiff/blob/3fdfb89f94fc0f4821bc04999ddf53b34d882ab9/nbdiff/notebook_diff.py#L95-L119
def words_diff(before_words, after_words): '''Diff the words in two strings. This is intended for use in diffing prose and other forms of text where line breaks have little semantic value. Parameters ---------- before_words : str A string to be used as the baseline version. after_w...
[ "def", "words_diff", "(", "before_words", ",", "after_words", ")", ":", "before_comps", "=", "before_words", ".", "split", "(", ")", "after_comps", "=", "after_words", ".", "split", "(", ")", "diff_result", "=", "diff", "(", "before_comps", ",", "after_comps",...
Diff the words in two strings. This is intended for use in diffing prose and other forms of text where line breaks have little semantic value. Parameters ---------- before_words : str A string to be used as the baseline version. after_words : str A string to be compared against...
[ "Diff", "the", "words", "in", "two", "strings", "." ]
python
train
25.48
alvinwan/md2py
md2py/md2py.py
https://github.com/alvinwan/md2py/blob/7f28a008367d7d9b5b3c8bbf7baf17985271489f/md2py/md2py.py#L130-L137
def fromMarkdown(md, *args, **kwargs): """ Creates abstraction using path to file :param str path: path to markdown file :return: TreeOfContents object """ return TOC.fromHTML(markdown(md, *args, **kwargs))
[ "def", "fromMarkdown", "(", "md", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "TOC", ".", "fromHTML", "(", "markdown", "(", "md", ",", "*", "args", ",", "*", "*", "kwargs", ")", ")" ]
Creates abstraction using path to file :param str path: path to markdown file :return: TreeOfContents object
[ "Creates", "abstraction", "using", "path", "to", "file" ]
python
train
31
QUANTAXIS/QUANTAXIS
QUANTAXIS/QAFetch/QAQuery_Advance.py
https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QAFetch/QAQuery_Advance.py#L238-L290
def QA_fetch_index_min_adv( code, start, end=None, frequence='1min', if_drop_index=True, collections=DATABASE.index_min): ''' '获取股票分钟线' :param code: :param start: :param end: :param frequence: :param if_drop_index: :param collections: :return: ...
[ "def", "QA_fetch_index_min_adv", "(", "code", ",", "start", ",", "end", "=", "None", ",", "frequence", "=", "'1min'", ",", "if_drop_index", "=", "True", ",", "collections", "=", "DATABASE", ".", "index_min", ")", ":", "if", "frequence", "in", "[", "'1min'"...
'获取股票分钟线' :param code: :param start: :param end: :param frequence: :param if_drop_index: :param collections: :return:
[ "获取股票分钟线", ":", "param", "code", ":", ":", "param", "start", ":", ":", "param", "end", ":", ":", "param", "frequence", ":", ":", "param", "if_drop_index", ":", ":", "param", "collections", ":", ":", "return", ":" ]
python
train
31.698113
SuperCowPowers/workbench
workbench_apps/workbench_cli/workbench_shell.py
https://github.com/SuperCowPowers/workbench/blob/710232756dd717f734253315e3d0b33c9628dafb/workbench_apps/workbench_cli/workbench_shell.py#L169-L177
def tags(self): '''Display tag information for all samples in database''' tags = self.workbench.get_all_tags() if not tags: return tag_df = pd.DataFrame(tags) tag_df = self.vectorize(tag_df, 'tags') print '\n%sSamples in Database%s' % (color.LightPurple, color...
[ "def", "tags", "(", "self", ")", ":", "tags", "=", "self", ".", "workbench", ".", "get_all_tags", "(", ")", "if", "not", "tags", ":", "return", "tag_df", "=", "pd", ".", "DataFrame", "(", "tags", ")", "tag_df", "=", "self", ".", "vectorize", "(", "...
Display tag information for all samples in database
[ "Display", "tag", "information", "for", "all", "samples", "in", "database" ]
python
train
38.888889
openstack/horizon
horizon/tabs/views.py
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/horizon/tabs/views.py#L46-L56
def get_context_data(self, **kwargs): """Adds the ``tab_group`` variable to the context data.""" context = super(TabView, self).get_context_data(**kwargs) try: tab_group = self.get_tabs(self.request, **kwargs) context["tab_group"] = tab_group # Make sure our d...
[ "def", "get_context_data", "(", "self", ",", "*", "*", "kwargs", ")", ":", "context", "=", "super", "(", "TabView", ",", "self", ")", ".", "get_context_data", "(", "*", "*", "kwargs", ")", "try", ":", "tab_group", "=", "self", ".", "get_tabs", "(", "...
Adds the ``tab_group`` variable to the context data.
[ "Adds", "the", "tab_group", "variable", "to", "the", "context", "data", "." ]
python
train
44.363636
cloudant/python-cloudant
src/cloudant/database.py
https://github.com/cloudant/python-cloudant/blob/e0ba190f6ba07fe3522a668747128214ad573c7e/src/cloudant/database.py#L883-L898
def set_revision_limit(self, limit): """ Sets the limit of historical revisions to store for any single document in the current remote database. :param int limit: Number of revisions to store for any single document in the current remote database. :returns: Revision...
[ "def", "set_revision_limit", "(", "self", ",", "limit", ")", ":", "url", "=", "'/'", ".", "join", "(", "(", "self", ".", "database_url", ",", "'_revs_limit'", ")", ")", "resp", "=", "self", ".", "r_session", ".", "put", "(", "url", ",", "data", "=", ...
Sets the limit of historical revisions to store for any single document in the current remote database. :param int limit: Number of revisions to store for any single document in the current remote database. :returns: Revision limit set operation status in JSON format
[ "Sets", "the", "limit", "of", "historical", "revisions", "to", "store", "for", "any", "single", "document", "in", "the", "current", "remote", "database", "." ]
python
train
36.4375
andela-sjames/paystack-python
paystackapi/customer.py
https://github.com/andela-sjames/paystack-python/blob/c9e4bddcb76e1490fefc362e71a21486400dccd4/paystackapi/customer.py#L50-L65
def update(cls, customer_id, **kwargs): """ Static method defined to update paystack customer data by id. Args: customer_id: paystack customer id. first_name: customer's first name(optional). last_name: customer's last name(optional). email: custo...
[ "def", "update", "(", "cls", ",", "customer_id", ",", "*", "*", "kwargs", ")", ":", "return", "cls", "(", ")", ".", "requests", ".", "put", "(", "'customer/{customer_id}'", ".", "format", "(", "*", "*", "locals", "(", ")", ")", ",", "data", "=", "k...
Static method defined to update paystack customer data by id. Args: customer_id: paystack customer id. first_name: customer's first name(optional). last_name: customer's last name(optional). email: customer's email address(optional). phone:customer's ...
[ "Static", "method", "defined", "to", "update", "paystack", "customer", "data", "by", "id", "." ]
python
train
36.5625
coinkite/connectrum
connectrum/svr_info.py
https://github.com/coinkite/connectrum/blob/99948f92cc5c3ecb1a8a70146294014e608e50fc/connectrum/svr_info.py#L203-L211
def add_single(self, hostname, ports, nickname=None, **kws): ''' Explicitly add a single entry. Hostname is a FQDN and ports is either a single int (assumed to be TCP port) or Electrum protocol/port number specification with spaces in between. ''' nickname = n...
[ "def", "add_single", "(", "self", ",", "hostname", ",", "ports", ",", "nickname", "=", "None", ",", "*", "*", "kws", ")", ":", "nickname", "=", "nickname", "or", "hostname", "self", "[", "hostname", ".", "lower", "(", ")", "]", "=", "ServerInfo", "("...
Explicitly add a single entry. Hostname is a FQDN and ports is either a single int (assumed to be TCP port) or Electrum protocol/port number specification with spaces in between.
[ "Explicitly", "add", "a", "single", "entry", ".", "Hostname", "is", "a", "FQDN", "and", "ports", "is", "either", "a", "single", "int", "(", "assumed", "to", "be", "TCP", "port", ")", "or", "Electrum", "protocol", "/", "port", "number", "specification", "...
python
train
45.555556
casacore/python-casacore
casacore/tables/table.py
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/tables/table.py#L1104-L1124
def putcell(self, columnname, rownr, value): """Put a value into one or more table cells. The columnname and (0-relative) rownrs indicate the table cells. rownr can be a single row number or a sequence of row numbers. If multiple rownrs are given, the given value is put in all those ro...
[ "def", "putcell", "(", "self", ",", "columnname", ",", "rownr", ",", "value", ")", ":", "self", ".", "_putcell", "(", "columnname", ",", "rownr", ",", "value", ")" ]
Put a value into one or more table cells. The columnname and (0-relative) rownrs indicate the table cells. rownr can be a single row number or a sequence of row numbers. If multiple rownrs are given, the given value is put in all those rows. The given value has to be convertible to th...
[ "Put", "a", "value", "into", "one", "or", "more", "table", "cells", "." ]
python
train
44.333333
limodou/uliweb
uliweb/core/commands.py
https://github.com/limodou/uliweb/blob/34472f25e4bc0b954a35346672f94e84ef18b076/uliweb/core/commands.py#L34-L51
def get_answer(message, answers='Yn', default='Y', quit=''): """ Get an answer from stdin, the answers should be 'Y/n' etc. If you don't want the user can quit in the loop, then quit should be None. """ if quit and quit not in answers: answers = answers + quit message = ...
[ "def", "get_answer", "(", "message", ",", "answers", "=", "'Yn'", ",", "default", "=", "'Y'", ",", "quit", "=", "''", ")", ":", "if", "quit", "and", "quit", "not", "in", "answers", ":", "answers", "=", "answers", "+", "quit", "message", "=", "message...
Get an answer from stdin, the answers should be 'Y/n' etc. If you don't want the user can quit in the loop, then quit should be None.
[ "Get", "an", "answer", "from", "stdin", "the", "answers", "should", "be", "Y", "/", "n", "etc", ".", "If", "you", "don", "t", "want", "the", "user", "can", "quit", "in", "the", "loop", "then", "quit", "should", "be", "None", "." ]
python
train
37.166667
AndrewAnnex/SpiceyPy
spiceypy/spiceypy.py
https://github.com/AndrewAnnex/SpiceyPy/blob/fc20a9b9de68b58eed5b332f0c051fb343a6e335/spiceypy/spiceypy.py#L86-L108
def spiceFoundExceptionThrower(f): """ Decorator for wrapping functions that use status codes """ @functools.wraps(f) def wrapper(*args, **kwargs): res = f(*args, **kwargs) if config.catch_false_founds: found = res[-1] if isinstance(found, bool) and not found:...
[ "def", "spiceFoundExceptionThrower", "(", "f", ")", ":", "@", "functools", ".", "wraps", "(", "f", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "res", "=", "f", "(", "*", "args", ",", "*", "*", "kwargs", ")", "if", ...
Decorator for wrapping functions that use status codes
[ "Decorator", "for", "wrapping", "functions", "that", "use", "status", "codes" ]
python
train
37.782609
google/mobly
mobly/controllers/monsoon.py
https://github.com/google/mobly/blob/38ba2cf7d29a20e6a2fca1718eecb337df38db26/mobly/controllers/monsoon.py#L181-L263
def GetStatus(self): """Requests and waits for status. Returns: status dictionary. """ # status packet format STATUS_FORMAT = ">BBBhhhHhhhHBBBxBbHBHHHHBbbHHBBBbbbbbbbbbBH" STATUS_FIELDS = [ "packetType", "firmwareVersion", ...
[ "def", "GetStatus", "(", "self", ")", ":", "# status packet format", "STATUS_FORMAT", "=", "\">BBBhhhHhhhHBBBxBbHBHHHHBbbHHBBBbbbbbbbbbBH\"", "STATUS_FIELDS", "=", "[", "\"packetType\"", ",", "\"firmwareVersion\"", ",", "\"protocolVersion\"", ",", "\"mainFineCurrent\"", ",", ...
Requests and waits for status. Returns: status dictionary.
[ "Requests", "and", "waits", "for", "status", "." ]
python
train
36.228916
jkenlooper/chill
src/chill/api.py
https://github.com/jkenlooper/chill/blob/35360c17c2a3b769ecb5406c6dabcf4cc70bd76f/src/chill/api.py#L120-L154
def render_node(_node_id, value=None, noderequest={}, **kw): "Recursively render a node's value" if value == None: kw.update( noderequest ) results = _query(_node_id, **kw) current_app.logger.debug("results: %s", results) if results: values = [] for (resul...
[ "def", "render_node", "(", "_node_id", ",", "value", "=", "None", ",", "noderequest", "=", "{", "}", ",", "*", "*", "kw", ")", ":", "if", "value", "==", "None", ":", "kw", ".", "update", "(", "noderequest", ")", "results", "=", "_query", "(", "_nod...
Recursively render a node's value
[ "Recursively", "render", "a", "node", "s", "value" ]
python
train
47.857143
elastic/apm-agent-python
elasticapm/instrumentation/packages/dbapi2.py
https://github.com/elastic/apm-agent-python/blob/2975663d7bd22282dc39336b2c37b37c12c7a774/elasticapm/instrumentation/packages/dbapi2.py#L151-L190
def extract_signature(sql): """ Extracts a minimal signature from a given SQL query :param sql: the SQL statement :return: a string representing the signature """ sql = force_text(sql) sql = sql.strip() first_space = sql.find(" ") if first_space < 0: return sql second_sp...
[ "def", "extract_signature", "(", "sql", ")", ":", "sql", "=", "force_text", "(", "sql", ")", "sql", "=", "sql", ".", "strip", "(", ")", "first_space", "=", "sql", ".", "find", "(", "\" \"", ")", "if", "first_space", "<", "0", ":", "return", "sql", ...
Extracts a minimal signature from a given SQL query :param sql: the SQL statement :return: a string representing the signature
[ "Extracts", "a", "minimal", "signature", "from", "a", "given", "SQL", "query", ":", "param", "sql", ":", "the", "SQL", "statement", ":", "return", ":", "a", "string", "representing", "the", "signature" ]
python
train
28.975
insightindustry/validator-collection
validator_collection/validators.py
https://github.com/insightindustry/validator-collection/blob/8c8047a0fa36cc88a021771279898278c4cc98e3/validator_collection/validators.py#L2556-L2600
def mac_address(value, allow_empty = False, **kwargs): """Validate that ``value`` is a valid MAC address. :param value: The value to validate. :type value: :class:`str <python:str>` / :obj:`None <python:None>` :param allow_empty: If ``True``, returns :obj:`None <python:...
[ "def", "mac_address", "(", "value", ",", "allow_empty", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "not", "value", "and", "not", "allow_empty", ":", "raise", "errors", ".", "EmptyValueError", "(", "'value (%s) was empty'", "%", "value", ")", "e...
Validate that ``value`` is a valid MAC address. :param value: The value to validate. :type value: :class:`str <python:str>` / :obj:`None <python:None>` :param allow_empty: If ``True``, returns :obj:`None <python:None>` if ``value`` is empty. If ``False``, raises a :class:`EmptyValueError <vali...
[ "Validate", "that", "value", "is", "a", "valid", "MAC", "address", "." ]
python
train
35.933333
angr/claripy
claripy/backends/__init__.py
https://github.com/angr/claripy/blob/4ed61924880af1ea8fb778047d896ec0156412a6/claripy/backends/__init__.py#L579-L593
def max(self, expr, extra_constraints=(), solver=None, model_callback=None): """ Return the maximum value of expr. :param expr: expression (an AST) to evaluate :param solver: a solver object, native to the backend, to assist in the evaluation (for example, a z3.So...
[ "def", "max", "(", "self", ",", "expr", ",", "extra_constraints", "=", "(", ")", ",", "solver", "=", "None", ",", "model_callback", "=", "None", ")", ":", "if", "self", ".", "_solver_required", "and", "solver", "is", "None", ":", "raise", "BackendError",...
Return the maximum value of expr. :param expr: expression (an AST) to evaluate :param solver: a solver object, native to the backend, to assist in the evaluation (for example, a z3.Solver) :param extra_constraints: extra constraints (as ASTs) to add to the solver for this...
[ "Return", "the", "maximum", "value", "of", "expr", "." ]
python
train
59.133333
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/core/debugger.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/debugger.py#L476-L480
def do_pdef(self, arg): """The debugger interface to magic_pdef""" namespaces = [('Locals', self.curframe.f_locals), ('Globals', self.curframe.f_globals)] self.shell.find_line_magic('pdef')(arg, namespaces=namespaces)
[ "def", "do_pdef", "(", "self", ",", "arg", ")", ":", "namespaces", "=", "[", "(", "'Locals'", ",", "self", ".", "curframe", ".", "f_locals", ")", ",", "(", "'Globals'", ",", "self", ".", "curframe", ".", "f_globals", ")", "]", "self", ".", "shell", ...
The debugger interface to magic_pdef
[ "The", "debugger", "interface", "to", "magic_pdef" ]
python
test
51.8
dwavesystems/dimod
dimod/binary_quadratic_model.py
https://github.com/dwavesystems/dimod/blob/beff1b7f86b559d923ac653c1de6d593876d6d38/dimod/binary_quadratic_model.py#L1654-L1758
def to_serializable(self, use_bytes=False, bias_dtype=np.float32, bytes_type=bytes): """Convert the binary quadratic model to a serializable object. Args: use_bytes (bool, optional, default=False): If True, a compact representation representing the bi...
[ "def", "to_serializable", "(", "self", ",", "use_bytes", "=", "False", ",", "bias_dtype", "=", "np", ".", "float32", ",", "bytes_type", "=", "bytes", ")", ":", "from", "dimod", ".", "package_info", "import", "__version__", "schema_version", "=", "\"2.0.0\"", ...
Convert the binary quadratic model to a serializable object. Args: use_bytes (bool, optional, default=False): If True, a compact representation representing the biases as bytes is used. bias_dtype (numpy.dtype, optional, default=numpy.float32): If `use_b...
[ "Convert", "the", "binary", "quadratic", "model", "to", "a", "serializable", "object", "." ]
python
train
38.752381
materialsproject/pymatgen
pymatgen/analysis/structure_matcher.py
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/structure_matcher.py#L1033-L1074
def get_s2_like_s1(self, struct1, struct2, include_ignored_species=True): """ Performs transformations on struct2 to put it in a basis similar to struct1 (without changing any of the inter-site distances) Args: struct1 (Structure): Reference structure struct2 (St...
[ "def", "get_s2_like_s1", "(", "self", ",", "struct1", ",", "struct2", ",", "include_ignored_species", "=", "True", ")", ":", "s1", ",", "s2", "=", "self", ".", "_process_species", "(", "[", "struct1", ",", "struct2", "]", ")", "trans", "=", "self", ".", ...
Performs transformations on struct2 to put it in a basis similar to struct1 (without changing any of the inter-site distances) Args: struct1 (Structure): Reference structure struct2 (Structure): Structure to transform. include_ignored_species (bool): Defaults to True...
[ "Performs", "transformations", "on", "struct2", "to", "put", "it", "in", "a", "basis", "similar", "to", "struct1", "(", "without", "changing", "any", "of", "the", "inter", "-", "site", "distances", ")" ]
python
train
41
incuna/django-wkhtmltopdf
wkhtmltopdf/views.py
https://github.com/incuna/django-wkhtmltopdf/blob/4e73f604c48f7f449c916c4257a72af59517322c/wkhtmltopdf/views.py#L134-L161
def render_to_response(self, context, **response_kwargs): """ Returns a PDF response with a template rendered with the given context. """ filename = response_kwargs.pop('filename', None) cmd_options = response_kwargs.pop('cmd_options', None) if issubclass(self.response_c...
[ "def", "render_to_response", "(", "self", ",", "context", ",", "*", "*", "response_kwargs", ")", ":", "filename", "=", "response_kwargs", ".", "pop", "(", "'filename'", ",", "None", ")", "cmd_options", "=", "response_kwargs", ".", "pop", "(", "'cmd_options'", ...
Returns a PDF response with a template rendered with the given context.
[ "Returns", "a", "PDF", "response", "with", "a", "template", "rendered", "with", "the", "given", "context", "." ]
python
test
39.035714
mitsei/dlkit
dlkit/authz_adapter/resource/sessions.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/authz_adapter/resource/sessions.py#L327-L333
def get_resources_by_search(self, resource_query, resource_search): """Pass through to provider ResourceSearchSession.get_resources_by_search""" # Implemented from azosid template for - # osid.resource.ResourceSearchSession.get_resources_by_search_template if not self._can('search'): ...
[ "def", "get_resources_by_search", "(", "self", ",", "resource_query", ",", "resource_search", ")", ":", "# Implemented from azosid template for -", "# osid.resource.ResourceSearchSession.get_resources_by_search_template", "if", "not", "self", ".", "_can", "(", "'search'", ")", ...
Pass through to provider ResourceSearchSession.get_resources_by_search
[ "Pass", "through", "to", "provider", "ResourceSearchSession", ".", "get_resources_by_search" ]
python
train
63.142857
bigchaindb/bigchaindb-driver
bigchaindb_driver/driver.py
https://github.com/bigchaindb/bigchaindb-driver/blob/c294a535f0696bd19483ae11a4882b74e6fc061e/bigchaindb_driver/driver.py#L320-L337
def send_async(self, transaction, headers=None): """Submit a transaction to the Federation with the mode `async`. Args: transaction (dict): the transaction to be sent to the Federation node(s). headers (dict): Optional headers to pass to the request. Ret...
[ "def", "send_async", "(", "self", ",", "transaction", ",", "headers", "=", "None", ")", ":", "return", "self", ".", "transport", ".", "forward_request", "(", "method", "=", "'POST'", ",", "path", "=", "self", ".", "path", ",", "json", "=", "transaction",...
Submit a transaction to the Federation with the mode `async`. Args: transaction (dict): the transaction to be sent to the Federation node(s). headers (dict): Optional headers to pass to the request. Returns: dict: The transaction sent to the Federati...
[ "Submit", "a", "transaction", "to", "the", "Federation", "with", "the", "mode", "async", "." ]
python
train
32.555556
mikedh/trimesh
trimesh/base.py
https://github.com/mikedh/trimesh/blob/25e059bf6d4caa74f62ffd58ce4f61a90ee4e518/trimesh/base.py#L1774-L1800
def smoothed(self, angle=.4): """ Return a version of the current mesh which will render nicely, without changing source mesh. Parameters ------------- angle : float Angle in radians, face pairs with angles smaller than this value will appear smoothed...
[ "def", "smoothed", "(", "self", ",", "angle", "=", ".4", ")", ":", "# smooth should be recomputed if visuals change", "self", ".", "visual", ".", "_verify_crc", "(", ")", "cached", "=", "self", ".", "visual", ".", "_cache", "[", "'smoothed'", "]", "if", "cac...
Return a version of the current mesh which will render nicely, without changing source mesh. Parameters ------------- angle : float Angle in radians, face pairs with angles smaller than this value will appear smoothed Returns --------- smooth...
[ "Return", "a", "version", "of", "the", "current", "mesh", "which", "will", "render", "nicely", "without", "changing", "source", "mesh", "." ]
python
train
29.555556
mitsei/dlkit
dlkit/json_/assessment/sessions.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/sessions.py#L305-L325
def has_previous_assessment_section(self, assessment_section_id): """Tests if there is a previous assessment section in the assessment following the given assessment section ``Id``. arg: assessment_section_id (osid.id.Id): ``Id`` of the ``AssessmentSection`` return: (boolean)...
[ "def", "has_previous_assessment_section", "(", "self", ",", "assessment_section_id", ")", ":", "try", ":", "self", ".", "get_previous_assessment_section", "(", "assessment_section_id", ")", "except", "errors", ".", "IllegalState", ":", "return", "False", "else", ":", ...
Tests if there is a previous assessment section in the assessment following the given assessment section ``Id``. arg: assessment_section_id (osid.id.Id): ``Id`` of the ``AssessmentSection`` return: (boolean) - ``true`` if there is a previous assessment section, ``fals...
[ "Tests", "if", "there", "is", "a", "previous", "assessment", "section", "in", "the", "assessment", "following", "the", "given", "assessment", "section", "Id", "." ]
python
train
47.047619
SuperCowPowers/workbench
workbench/workers/pcap_bro.py
https://github.com/SuperCowPowers/workbench/blob/710232756dd717f734253315e3d0b33c9628dafb/workbench/workers/pcap_bro.py#L113-L125
def subprocess_manager(self, exec_args): ''' Bro subprocess manager ''' try: sp = gevent.subprocess.Popen(exec_args, stdout=gevent.subprocess.PIPE, stderr=gevent.subprocess.PIPE) except OSError: raise RuntimeError('Could not run bro executable (either not installed or not...
[ "def", "subprocess_manager", "(", "self", ",", "exec_args", ")", ":", "try", ":", "sp", "=", "gevent", ".", "subprocess", ".", "Popen", "(", "exec_args", ",", "stdout", "=", "gevent", ".", "subprocess", ".", "PIPE", ",", "stderr", "=", "gevent", ".", "...
Bro subprocess manager
[ "Bro", "subprocess", "manager" ]
python
train
52.076923
tomplus/kubernetes_asyncio
kubernetes_asyncio/client/api/core_v1_api.py
https://github.com/tomplus/kubernetes_asyncio/blob/f9ab15317ec921409714c7afef11aeb0f579985d/kubernetes_asyncio/client/api/core_v1_api.py#L3799-L3826
def connect_post_namespaced_pod_exec(self, name, namespace, **kwargs): # noqa: E501 """connect_post_namespaced_pod_exec # noqa: E501 connect POST requests to exec of Pod # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please...
[ "def", "connect_post_namespaced_pod_exec", "(", "self", ",", "name", ",", "namespace", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ")", ":", "...
connect_post_namespaced_pod_exec # noqa: E501 connect POST requests to exec of Pod # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.connect_post_namespaced_pod_exec(name, namespace, ...
[ "connect_post_namespaced_pod_exec", "#", "noqa", ":", "E501" ]
python
train
64.535714
Microsoft/azure-devops-python-api
azure-devops/azure/devops/v5_1/gallery/gallery_client.py
https://github.com/Microsoft/azure-devops-python-api/blob/4777ffda2f5052fabbaddb2abe9cb434e0cf1aa8/azure-devops/azure/devops/v5_1/gallery/gallery_client.py#L1416-L1436
def delete_response(self, publisher_name, extension_name, question_id, response_id): """DeleteResponse. [Preview API] Deletes a response for an extension. (soft delete) :param str publisher_name: Name of the publisher who published the extension. :param str extension_name: Name of the ex...
[ "def", "delete_response", "(", "self", ",", "publisher_name", ",", "extension_name", ",", "question_id", ",", "response_id", ")", ":", "route_values", "=", "{", "}", "if", "publisher_name", "is", "not", "None", ":", "route_values", "[", "'publisherName'", "]", ...
DeleteResponse. [Preview API] Deletes a response for an extension. (soft delete) :param str publisher_name: Name of the publisher who published the extension. :param str extension_name: Name of the extension. :param long question_id: Identifies the question whose response is to be delete...
[ "DeleteResponse", ".", "[", "Preview", "API", "]", "Deletes", "a", "response", "for", "an", "extension", ".", "(", "soft", "delete", ")", ":", "param", "str", "publisher_name", ":", "Name", "of", "the", "publisher", "who", "published", "the", "extension", ...
python
train
60.190476
PBR/MQ2
MQ2/mq2.py
https://github.com/PBR/MQ2/blob/6d84dea47e6751333004743f588f03158e35c28d/MQ2/mq2.py#L58-L92
def _get_arguments(): # pragma: no cover """ Handle the command line arguments given to this program """ LOG.debug('Parse command line argument') parser = argparse.ArgumentParser( description='Command line interface for the MQ² program') parser.add_argument( '-z', '--zipfile', dest='in...
[ "def", "_get_arguments", "(", ")", ":", "# pragma: no cover", "LOG", ".", "debug", "(", "'Parse command line argument'", ")", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Command line interface for the MQ² program')", "", "parser", ".", ...
Handle the command line arguments given to this program
[ "Handle", "the", "command", "line", "arguments", "given", "to", "this", "program" ]
python
train
36.342857
jantman/awslimitchecker
awslimitchecker/services/apigateway.py
https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/apigateway.py#L55-L71
def find_usage(self): """ Determine the current usage for each limit of this service, and update corresponding Limit via :py:meth:`~.AwsLimit._add_current_usage`. """ logger.debug("Checking usage for service %s", self.service_name) self.connect() for lim i...
[ "def", "find_usage", "(", "self", ")", ":", "logger", ".", "debug", "(", "\"Checking usage for service %s\"", ",", "self", ".", "service_name", ")", "self", ".", "connect", "(", ")", "for", "lim", "in", "self", ".", "limits", ".", "values", "(", ")", ":"...
Determine the current usage for each limit of this service, and update corresponding Limit via :py:meth:`~.AwsLimit._add_current_usage`.
[ "Determine", "the", "current", "usage", "for", "each", "limit", "of", "this", "service", "and", "update", "corresponding", "Limit", "via", ":", "py", ":", "meth", ":", "~", ".", "AwsLimit", ".", "_add_current_usage", "." ]
python
train
35.647059
DataDog/integrations-core
kafka_consumer/datadog_checks/kafka_consumer/kafka_consumer.py
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kafka_consumer/datadog_checks/kafka_consumer/kafka_consumer.py#L291-L346
def _get_broker_offsets(self, instance, topics): """ Fetch highwater offsets for each topic/partition from Kafka cluster. Do this for all partitions in the cluster because even if it has no consumers, we may want to measure whether producers are successfully producing. No need t...
[ "def", "_get_broker_offsets", "(", "self", ",", "instance", ",", "topics", ")", ":", "# Connect to Kafka", "highwater_offsets", "=", "{", "}", "topic_partitions_without_a_leader", "=", "[", "]", "topics_to_fetch", "=", "defaultdict", "(", "set", ")", "cli", "=", ...
Fetch highwater offsets for each topic/partition from Kafka cluster. Do this for all partitions in the cluster because even if it has no consumers, we may want to measure whether producers are successfully producing. No need to limit this for performance because fetching broker offsets ...
[ "Fetch", "highwater", "offsets", "for", "each", "topic", "/", "partition", "from", "Kafka", "cluster", "." ]
python
train
45.982143
acutesoftware/AIKIF
aikif/dataTools/cls_sql_code_generator.py
https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/dataTools/cls_sql_code_generator.py#L97-L177
def reverse_pivot_to_fact(self, staging_table, piv_column, piv_list, from_column, meas_names, meas_values, new_line): """ For each column in the piv_list, append ALL from_column's using the group_list e.g. Input Table YEAR Person Q1 Q2 2010 Fre...
[ "def", "reverse_pivot_to_fact", "(", "self", ",", "staging_table", ",", "piv_column", ",", "piv_list", ",", "from_column", ",", "meas_names", ",", "meas_values", ",", "new_line", ")", ":", "self", ".", "sql_text", "+=", "'\\n-----------------------------\\n--Reverse P...
For each column in the piv_list, append ALL from_column's using the group_list e.g. Input Table YEAR Person Q1 Q2 2010 Fred Spain 14 2010 Jane Spain 13.995 Output Table Year Person Question ...
[ "For", "each", "column", "in", "the", "piv_list", "append", "ALL", "from_column", "s", "using", "the", "group_list", "e", ".", "g", ".", "Input", "Table", "YEAR", "Person", "Q1", "Q2", "2010", "Fred", "Spain", "14", "2010", "Jane", "Spain", "13", ".", ...
python
train
42.802469
Nachtfeuer/pipeline
spline/tools/query.py
https://github.com/Nachtfeuer/pipeline/blob/04ca18c4e95e4349532bb45b768206393e1f2c13/spline/tools/query.py#L42-L52
def flatten(*sequence): """Flatten nested sequences into one.""" result = [] for entry in sequence: if isinstance(entry, list): result += Select.flatten(*entry) elif isinstance(entry, tuple): result += Select.flatten(*entry) els...
[ "def", "flatten", "(", "*", "sequence", ")", ":", "result", "=", "[", "]", "for", "entry", "in", "sequence", ":", "if", "isinstance", "(", "entry", ",", "list", ")", ":", "result", "+=", "Select", ".", "flatten", "(", "*", "entry", ")", "elif", "is...
Flatten nested sequences into one.
[ "Flatten", "nested", "sequences", "into", "one", "." ]
python
train
33.727273
SatelliteQE/nailgun
nailgun/entities.py
https://github.com/SatelliteQE/nailgun/blob/c36d8c20862e87bf6975bd48ac1ca40a9e634eaa/nailgun/entities.py#L2760-L2780
def add(self, synchronous=True, **kwargs): """Add provided Content View Component. :param synchronous: What should happen if the server returns an HTTP 202 (accepted) status code? Wait for the task to complete if ``True``. Immediately return the server's response otherwise. ...
[ "def", "add", "(", "self", ",", "synchronous", "=", "True", ",", "*", "*", "kwargs", ")", ":", "kwargs", "=", "kwargs", ".", "copy", "(", ")", "# shadow the passed-in kwargs", "if", "'data'", "not", "in", "kwargs", ":", "# data is required", "kwargs", "[",...
Add provided Content View Component. :param synchronous: What should happen if the server returns an HTTP 202 (accepted) status code? Wait for the task to complete if ``True``. Immediately return the server's response otherwise. :param kwargs: Arguments to pass to requests. ...
[ "Add", "provided", "Content", "View", "Component", "." ]
python
train
49.809524
fitnr/convertdate
convertdate/french_republican.py
https://github.com/fitnr/convertdate/blob/e920f168a87f99183b0aa7290d6c3af222582d43/convertdate/french_republican.py#L98-L115
def to_jd(year, month, day, method=None): '''Obtain Julian day from a given French Revolutionary calendar date.''' method = method or 'equinox' if day < 1 or day > 30: raise ValueError("Invalid day for this calendar") if month > 13: raise ValueError("Invalid month for this calendar") ...
[ "def", "to_jd", "(", "year", ",", "month", ",", "day", ",", "method", "=", "None", ")", ":", "method", "=", "method", "or", "'equinox'", "if", "day", "<", "1", "or", "day", ">", "30", ":", "raise", "ValueError", "(", "\"Invalid day for this calendar\"", ...
Obtain Julian day from a given French Revolutionary calendar date.
[ "Obtain", "Julian", "day", "from", "a", "given", "French", "Revolutionary", "calendar", "date", "." ]
python
train
32.222222
saltstack/salt
salt/modules/boto_ec2.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_ec2.py#L723-L748
def get_id(name=None, tags=None, region=None, key=None, keyid=None, profile=None, in_states=None, filters=None): ''' Given instance properties, return the instance id if it exists. CLI Example: .. code-block:: bash salt myminion boto_ec2.get_id myinstance ''' instance_ids...
[ "def", "get_id", "(", "name", "=", "None", ",", "tags", "=", "None", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ",", "in_states", "=", "None", ",", "filters", "=", "None", ")", ":"...
Given instance properties, return the instance id if it exists. CLI Example: .. code-block:: bash salt myminion boto_ec2.get_id myinstance
[ "Given", "instance", "properties", "return", "the", "instance", "id", "if", "it", "exists", "." ]
python
train
33.692308
blue-yonder/tsfresh
tsfresh/feature_extraction/feature_calculators.py
https://github.com/blue-yonder/tsfresh/blob/c72c9c574371cf7dd7d54e00a466792792e5d202/tsfresh/feature_extraction/feature_calculators.py#L1399-L1435
def c3(x, lag): """ This function calculates the value of .. math:: \\frac{1}{n-2lag} \sum_{i=0}^{n-2lag} x_{i + 2 \cdot lag}^2 \cdot x_{i + lag} \cdot x_{i} which is .. math:: \\mathbb{E}[L^2(X)^2 \cdot L(X) \cdot X] where :math:`\\mathbb{E}` is the mean and :math:`L` is t...
[ "def", "c3", "(", "x", ",", "lag", ")", ":", "if", "not", "isinstance", "(", "x", ",", "(", "np", ".", "ndarray", ",", "pd", ".", "Series", ")", ")", ":", "x", "=", "np", ".", "asarray", "(", "x", ")", "n", "=", "x", ".", "size", "if", "2...
This function calculates the value of .. math:: \\frac{1}{n-2lag} \sum_{i=0}^{n-2lag} x_{i + 2 \cdot lag}^2 \cdot x_{i + lag} \cdot x_{i} which is .. math:: \\mathbb{E}[L^2(X)^2 \cdot L(X) \cdot X] where :math:`\\mathbb{E}` is the mean and :math:`L` is the lag operator. It was prop...
[ "This", "function", "calculates", "the", "value", "of" ]
python
train
28.432432
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Taskmaster.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Taskmaster.py#L375-L390
def make_ready_all(self): """ Marks all targets in a task ready for execution. This is used when the interface needs every target Node to be visited--the canonical example being the "scons -c" option. """ T = self.tm.trace if T: T.write(self.trace_message('Task.m...
[ "def", "make_ready_all", "(", "self", ")", ":", "T", "=", "self", ".", "tm", ".", "trace", "if", "T", ":", "T", ".", "write", "(", "self", ".", "trace_message", "(", "'Task.make_ready_all()'", ",", "self", ".", "node", ")", ")", "self", ".", "out_of_...
Marks all targets in a task ready for execution. This is used when the interface needs every target Node to be visited--the canonical example being the "scons -c" option.
[ "Marks", "all", "targets", "in", "a", "task", "ready", "for", "execution", "." ]
python
train
39.75
timothyb0912/pylogit
pylogit/base_multinomial_cm_v2.py
https://github.com/timothyb0912/pylogit/blob/f83b0fd6debaa7358d87c3828428f6d4ead71357/pylogit/base_multinomial_cm_v2.py#L425-L440
def check_type_of_param_list_elements(param_list): """ Ensures that all elements of param_list are ndarrays or None. Raises a helpful ValueError if otherwise. """ try: assert isinstance(param_list[0], np.ndarray) assert all([(x is None or isinstance(x, np.ndarray)) ...
[ "def", "check_type_of_param_list_elements", "(", "param_list", ")", ":", "try", ":", "assert", "isinstance", "(", "param_list", "[", "0", "]", ",", "np", ".", "ndarray", ")", "assert", "all", "(", "[", "(", "x", "is", "None", "or", "isinstance", "(", "x"...
Ensures that all elements of param_list are ndarrays or None. Raises a helpful ValueError if otherwise.
[ "Ensures", "that", "all", "elements", "of", "param_list", "are", "ndarrays", "or", "None", ".", "Raises", "a", "helpful", "ValueError", "if", "otherwise", "." ]
python
train
35.375
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/config/configurable.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/config/configurable.py#L288-L330
def instance(cls, *args, **kwargs): """Returns a global instance of this class. This method create a new instance if none have previously been created and returns a previously created instance is one already exists. The arguments and keyword arguments passed to this method are passed ...
[ "def", "instance", "(", "cls", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Create and save the instance", "if", "cls", ".", "_instance", "is", "None", ":", "inst", "=", "cls", "(", "*", "args", ",", "*", "*", "kwargs", ")", "# Now make sure...
Returns a global instance of this class. This method create a new instance if none have previously been created and returns a previously created instance is one already exists. The arguments and keyword arguments passed to this method are passed on to the :meth:`__init__` method of the...
[ "Returns", "a", "global", "instance", "of", "this", "class", "." ]
python
test
35.790698
pyviz/holoviews
holoviews/plotting/bokeh/util.py
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/util.py#L358-L370
def font_size_to_pixels(size): """ Convert a fontsize to a pixel value """ if size is None or not isinstance(size, basestring): return conversions = {'em': 16, 'pt': 16/12.} val = re.findall('\d+', size) unit = re.findall('[a-z]+', size) if (val and not unit) or (val and unit[0] ...
[ "def", "font_size_to_pixels", "(", "size", ")", ":", "if", "size", "is", "None", "or", "not", "isinstance", "(", "size", ",", "basestring", ")", ":", "return", "conversions", "=", "{", "'em'", ":", "16", ",", "'pt'", ":", "16", "/", "12.", "}", "val"...
Convert a fontsize to a pixel value
[ "Convert", "a", "fontsize", "to", "a", "pixel", "value" ]
python
train
34
python-openxml/python-docx
docx/image/tiff.py
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/image/tiff.py#L138-L145
def _make_stream_reader(cls, stream): """ Return a |StreamReader| instance with wrapping *stream* and having "endian-ness" determined by the 'MM' or 'II' indicator in the TIFF stream header. """ endian = cls._detect_endian(stream) return StreamReader(stream, endia...
[ "def", "_make_stream_reader", "(", "cls", ",", "stream", ")", ":", "endian", "=", "cls", ".", "_detect_endian", "(", "stream", ")", "return", "StreamReader", "(", "stream", ",", "endian", ")" ]
Return a |StreamReader| instance with wrapping *stream* and having "endian-ness" determined by the 'MM' or 'II' indicator in the TIFF stream header.
[ "Return", "a", "|StreamReader|", "instance", "with", "wrapping", "*", "stream", "*", "and", "having", "endian", "-", "ness", "determined", "by", "the", "MM", "or", "II", "indicator", "in", "the", "TIFF", "stream", "header", "." ]
python
train
39.375
wakatime/wakatime
wakatime/packages/pygments/lexers/asm.py
https://github.com/wakatime/wakatime/blob/74519ace04e8472f3a3993269963732b9946a01d/wakatime/packages/pygments/lexers/asm.py#L100-L146
def _objdump_lexer_tokens(asm_lexer): """ Common objdump lexer tokens to wrap an ASM lexer. """ hex_re = r'[0-9A-Za-z]' return { 'root': [ # File name & format: ('(.*?)(:)( +file format )(.*?)$', bygroups(Name.Label, Punctuation, Text, String)), ...
[ "def", "_objdump_lexer_tokens", "(", "asm_lexer", ")", ":", "hex_re", "=", "r'[0-9A-Za-z]'", "return", "{", "'root'", ":", "[", "# File name & format:", "(", "'(.*?)(:)( +file format )(.*?)$'", ",", "bygroups", "(", "Name", ".", "Label", ",", "Punctuation", ",", "...
Common objdump lexer tokens to wrap an ASM lexer.
[ "Common", "objdump", "lexer", "tokens", "to", "wrap", "an", "ASM", "lexer", "." ]
python
train
45.212766
ihgazni2/elist
elist/elist.py
https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L6094-L6101
def leaf_handler(self,*args): '''#leaf child handler''' desc = self.desc pdesc = self.pdesc desc['leaf'] = True desc['sons_count'] = 0 pdesc['leaf_son_paths'].append(copy.deepcopy(desc['path'])) pdesc['leaf_descendant_paths'].append(copy.deepcopy(desc['path']))
[ "def", "leaf_handler", "(", "self", ",", "*", "args", ")", ":", "desc", "=", "self", ".", "desc", "pdesc", "=", "self", ".", "pdesc", "desc", "[", "'leaf'", "]", "=", "True", "desc", "[", "'sons_count'", "]", "=", "0", "pdesc", "[", "'leaf_son_paths'...
#leaf child handler
[ "#leaf", "child", "handler" ]
python
valid
38.75
googledatalab/pydatalab
google/datalab/ml/_dataset.py
https://github.com/googledatalab/pydatalab/blob/d9031901d5bca22fe0d5925d204e6698df9852e1/google/datalab/ml/_dataset.py#L95-L103
def size(self): """The size of the schema. If the underlying data source changes, it may be outdated. """ if self._size is None: self._size = 0 for csv_file in self.files: self._size += sum(1 if line else 0 for line in _util.open_local_or_gcs(csv_file, 'r')) return self._size
[ "def", "size", "(", "self", ")", ":", "if", "self", ".", "_size", "is", "None", ":", "self", ".", "_size", "=", "0", "for", "csv_file", "in", "self", ".", "files", ":", "self", ".", "_size", "+=", "sum", "(", "1", "if", "line", "else", "0", "fo...
The size of the schema. If the underlying data source changes, it may be outdated.
[ "The", "size", "of", "the", "schema", ".", "If", "the", "underlying", "data", "source", "changes", "it", "may", "be", "outdated", "." ]
python
train
33.888889
rootpy/rootpy
rootpy/plotting/base.py
https://github.com/rootpy/rootpy/blob/3926935e1f2100d8ba68070c2ab44055d4800f73/rootpy/plotting/base.py#L350-L359
def SetFillStyle(self, style): """ *style* may be any fill style understood by ROOT or matplotlib. For full documentation of accepted *style* arguments, see :class:`rootpy.plotting.style.FillStyle`. """ self._fillstyle = FillStyle(style) if isinstance(self, ROOT....
[ "def", "SetFillStyle", "(", "self", ",", "style", ")", ":", "self", ".", "_fillstyle", "=", "FillStyle", "(", "style", ")", "if", "isinstance", "(", "self", ",", "ROOT", ".", "TAttFill", ")", ":", "ROOT", ".", "TAttFill", ".", "SetFillStyle", "(", "sel...
*style* may be any fill style understood by ROOT or matplotlib. For full documentation of accepted *style* arguments, see :class:`rootpy.plotting.style.FillStyle`.
[ "*", "style", "*", "may", "be", "any", "fill", "style", "understood", "by", "ROOT", "or", "matplotlib", "." ]
python
train
39.1
ManiacalLabs/BiblioPixel
bibliopixel/colors/conversions.py
https://github.com/ManiacalLabs/BiblioPixel/blob/fd97e6c651a4bbcade64733847f4eec8f7704b7c/bibliopixel/colors/conversions.py#L5-L60
def hsv2rgb_raw(hsv): """ Converts an HSV tuple to RGB. Intended for internal use. You should use hsv2rgb_spectrum or hsv2rgb_rainbow instead. """ HSV_SECTION_3 = 0x40 h, s, v = hsv # The brightness floor is minimum number that all of # R, G, and B will be set to. invsat = 255 - s...
[ "def", "hsv2rgb_raw", "(", "hsv", ")", ":", "HSV_SECTION_3", "=", "0x40", "h", ",", "s", ",", "v", "=", "hsv", "# The brightness floor is minimum number that all of", "# R, G, and B will be set to.", "invsat", "=", "255", "-", "s", "brightness_floor", "=", "(", "v...
Converts an HSV tuple to RGB. Intended for internal use. You should use hsv2rgb_spectrum or hsv2rgb_rainbow instead.
[ "Converts", "an", "HSV", "tuple", "to", "RGB", ".", "Intended", "for", "internal", "use", ".", "You", "should", "use", "hsv2rgb_spectrum", "or", "hsv2rgb_rainbow", "instead", "." ]
python
valid
30.142857
jaredLunde/vital-tools
vital/debug/__init__.py
https://github.com/jaredLunde/vital-tools/blob/ea924c9bbb6ec22aa66f8095f018b1ee0099ac04/vital/debug/__init__.py#L1567-L1578
def set_level(self, level): """ Sets :attr:loglevel to @level @level: #str one or several :attr:levels """ if not level: return None self.levelmap = set() for char in level: self.levelmap = self.levelmap.union(self.levels[char]) self.l...
[ "def", "set_level", "(", "self", ",", "level", ")", ":", "if", "not", "level", ":", "return", "None", "self", ".", "levelmap", "=", "set", "(", ")", "for", "char", "in", "level", ":", "self", ".", "levelmap", "=", "self", ".", "levelmap", ".", "uni...
Sets :attr:loglevel to @level @level: #str one or several :attr:levels
[ "Sets", ":", "attr", ":", "loglevel", "to", "@level" ]
python
train
29.416667
hydraplatform/hydra-base
hydra_base/lib/attributes.py
https://github.com/hydraplatform/hydra-base/blob/9251ff7946505f7a272c87837390acd1c435bc6e/hydra_base/lib/attributes.py#L108-L118
def get_attribute_by_name_and_dimension(name, dimension_id=None,**kwargs): """ Get a specific attribute by its name. dimension_id can be None, because in attribute the dimension_id is not anymore mandatory """ try: attr_i = db.DBSession.query(Attr).filter(and_(Attr.name==name, Attr.d...
[ "def", "get_attribute_by_name_and_dimension", "(", "name", ",", "dimension_id", "=", "None", ",", "*", "*", "kwargs", ")", ":", "try", ":", "attr_i", "=", "db", ".", "DBSession", ".", "query", "(", "Attr", ")", ".", "filter", "(", "and_", "(", "Attr", ...
Get a specific attribute by its name. dimension_id can be None, because in attribute the dimension_id is not anymore mandatory
[ "Get", "a", "specific", "attribute", "by", "its", "name", ".", "dimension_id", "can", "be", "None", "because", "in", "attribute", "the", "dimension_id", "is", "not", "anymore", "mandatory" ]
python
train
41.090909
tensorflow/datasets
tensorflow_datasets/core/download/resource.py
https://github.com/tensorflow/datasets/blob/46ceb0cf7b4690f38ecbbc689e4d659a903d08dc/tensorflow_datasets/core/download/resource.py#L243-L248
def get_extract_method(path): """Returns `ExtractMethod` to use on resource at path. Cannot be None.""" info_path = _get_info_path(path) info = _read_info(info_path) fname = info.get('original_fname', path) if info else path return _guess_extract_method(fname)
[ "def", "get_extract_method", "(", "path", ")", ":", "info_path", "=", "_get_info_path", "(", "path", ")", "info", "=", "_read_info", "(", "info_path", ")", "fname", "=", "info", ".", "get", "(", "'original_fname'", ",", "path", ")", "if", "info", "else", ...
Returns `ExtractMethod` to use on resource at path. Cannot be None.
[ "Returns", "ExtractMethod", "to", "use", "on", "resource", "at", "path", ".", "Cannot", "be", "None", "." ]
python
train
44.166667
AndresMWeber/Nomenclate
nomenclate/core/nameparser.py
https://github.com/AndresMWeber/Nomenclate/blob/e6d6fc28beac042bad588e56fbe77531d2de6b6f/nomenclate/core/nameparser.py#L238-L261
def get_string_camel_patterns(cls, name, min_length=0): """ Finds all permutations of possible camel casing of the given name :param name: str, the name we need to get all possible permutations and abbreviations for :param min_length: int, minimum length we want for abbreviations :retur...
[ "def", "get_string_camel_patterns", "(", "cls", ",", "name", ",", "min_length", "=", "0", ")", ":", "# Have to check for longest first and remove duplicates", "patterns", "=", "[", "]", "abbreviations", "=", "list", "(", "set", "(", "cls", ".", "_get_abbreviations",...
Finds all permutations of possible camel casing of the given name :param name: str, the name we need to get all possible permutations and abbreviations for :param min_length: int, minimum length we want for abbreviations :return: list(list(str)), list casing permutations of list of abbreviation...
[ "Finds", "all", "permutations", "of", "possible", "camel", "casing", "of", "the", "given", "name" ]
python
train
55.666667
pywbem/pywbem
pywbem/tupleparse.py
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/tupleparse.py#L530-L541
def parse_value_object(self, tup_tree): """ :: <!ELEMENT VALUE.OBJECT (CLASS | INSTANCE)> """ self.check_node(tup_tree, 'VALUE.OBJECT') child = self.one_child(tup_tree, ('CLASS', 'INSTANCE')) return (name(tup_tree), attrs(tup_tree), child)
[ "def", "parse_value_object", "(", "self", ",", "tup_tree", ")", ":", "self", ".", "check_node", "(", "tup_tree", ",", "'VALUE.OBJECT'", ")", "child", "=", "self", ".", "one_child", "(", "tup_tree", ",", "(", "'CLASS'", ",", "'INSTANCE'", ")", ")", "return"...
:: <!ELEMENT VALUE.OBJECT (CLASS | INSTANCE)>
[ "::" ]
python
train
24.5
gilsho/kryptonite
kryptonite/cipher.py
https://github.com/gilsho/kryptonite/blob/d20a15e4fd28cb880180b827099168dd87eb0291/kryptonite/cipher.py#L46-L52
def sign(self, msg): """sign a message""" signature = SHA256.new() signature.update(self._mackey1) signature.update(msg) signature.update(self._mackey2) return signature.digest()
[ "def", "sign", "(", "self", ",", "msg", ")", ":", "signature", "=", "SHA256", ".", "new", "(", ")", "signature", ".", "update", "(", "self", ".", "_mackey1", ")", "signature", ".", "update", "(", "msg", ")", "signature", ".", "update", "(", "self", ...
sign a message
[ "sign", "a", "message" ]
python
train
31.428571
saltstack/salt
salt/modules/nspawn.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/nspawn.py#L286-L329
def _run(name, cmd, output=None, no_start=False, stdin=None, python_shell=True, preserve_state=False, output_loglevel='debug', ignore_retcode=False, use_vt=False, keep_env=None): ''' Common logic for nspawn.run functions ...
[ "def", "_run", "(", "name", ",", "cmd", ",", "output", "=", "None", ",", "no_start", "=", "False", ",", "stdin", "=", "None", ",", "python_shell", "=", "True", ",", "preserve_state", "=", "False", ",", "output_loglevel", "=", "'debug'", ",", "ignore_retc...
Common logic for nspawn.run functions
[ "Common", "logic", "for", "nspawn", ".", "run", "functions" ]
python
train
26.136364
Cito/DBUtils
DBUtils/SteadyDB.py
https://github.com/Cito/DBUtils/blob/90e8825e038f08c82044b8e50831480175fa026a/DBUtils/SteadyDB.py#L342-L373
def _ping_check(self, ping=1, reconnect=True): """Check whether the connection is still alive using ping(). If the the underlying connection is not active and the ping parameter is set accordingly, the connection will be recreated unless the connection is currently inside a transaction....
[ "def", "_ping_check", "(", "self", ",", "ping", "=", "1", ",", "reconnect", "=", "True", ")", ":", "if", "ping", "&", "self", ".", "_ping", ":", "try", ":", "# if possible, ping the connection", "alive", "=", "self", ".", "_con", ".", "ping", "(", ")",...
Check whether the connection is still alive using ping(). If the the underlying connection is not active and the ping parameter is set accordingly, the connection will be recreated unless the connection is currently inside a transaction.
[ "Check", "whether", "the", "connection", "is", "still", "alive", "using", "ping", "()", "." ]
python
train
37
jab/bidict
bidict/_orderedbase.py
https://github.com/jab/bidict/blob/1a1ba9758651aed9c4f58384eff006d2e2ad6835/bidict/_orderedbase.py#L288-L296
def equals_order_sensitive(self, other): """Order-sensitive equality check. *See also* :ref:`eq-order-insensitive` """ # Same short-circuit as BidictBase.__eq__. Factoring out not worth function call overhead. if not isinstance(other, Mapping) or len(self) != len(other): ...
[ "def", "equals_order_sensitive", "(", "self", ",", "other", ")", ":", "# Same short-circuit as BidictBase.__eq__. Factoring out not worth function call overhead.", "if", "not", "isinstance", "(", "other", ",", "Mapping", ")", "or", "len", "(", "self", ")", "!=", "len", ...
Order-sensitive equality check. *See also* :ref:`eq-order-insensitive`
[ "Order", "-", "sensitive", "equality", "check", "." ]
python
test
45.555556
openvax/mhcflurry
mhcflurry/common.py
https://github.com/openvax/mhcflurry/blob/deb7c1629111254b484a2711619eb2347db36524/mhcflurry/common.py#L14-L68
def set_keras_backend(backend=None, gpu_device_nums=None, num_threads=None): """ Configure Keras backend to use GPU or CPU. Only tensorflow is supported. Parameters ---------- backend : string, optional one of 'tensorflow-default', 'tensorflow-cpu', 'tensorflow-gpu' gpu_device_nums : l...
[ "def", "set_keras_backend", "(", "backend", "=", "None", ",", "gpu_device_nums", "=", "None", ",", "num_threads", "=", "None", ")", ":", "os", ".", "environ", "[", "\"KERAS_BACKEND\"", "]", "=", "\"tensorflow\"", "original_backend", "=", "backend", "if", "not"...
Configure Keras backend to use GPU or CPU. Only tensorflow is supported. Parameters ---------- backend : string, optional one of 'tensorflow-default', 'tensorflow-cpu', 'tensorflow-gpu' gpu_device_nums : list of int, optional GPU devices to potentially use num_threads : int, optio...
[ "Configure", "Keras", "backend", "to", "use", "GPU", "or", "CPU", ".", "Only", "tensorflow", "is", "supported", "." ]
python
train
34.018182