id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
53,800
wummel/dosage
dosagelib/plugins/c.py
CtrlAltDel.namer
def namer(cls, imageUrl, pageUrl): """Remove random junk from image names.""" imgname = imageUrl.split('/')[-1] imgbase = imgname.rsplit('-', 1)[0] imgext = imgname.rsplit('.', 1)[1] return '%s.%s' % (imgbase, imgext)
python
def namer(cls, imageUrl, pageUrl): """Remove random junk from image names.""" imgname = imageUrl.split('/')[-1] imgbase = imgname.rsplit('-', 1)[0] imgext = imgname.rsplit('.', 1)[1] return '%s.%s' % (imgbase, imgext)
[ "def", "namer", "(", "cls", ",", "imageUrl", ",", "pageUrl", ")", ":", "imgname", "=", "imageUrl", ".", "split", "(", "'/'", ")", "[", "-", "1", "]", "imgbase", "=", "imgname", ".", "rsplit", "(", "'-'", ",", "1", ")", "[", "0", "]", "imgext", ...
Remove random junk from image names.
[ "Remove", "random", "junk", "from", "image", "names", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/plugins/c.py#L272-L277
53,801
synw/dataswim
dataswim/data/text.py
Text.flat_
def flat_(self, col, nums=True): """ Returns a flat representation of a column's values """ try: res = "" i = 0 vals = self.df[col].tolist() for el in vals: if nums is True: res = res + str(i) + " " + el ...
python
def flat_(self, col, nums=True): """ Returns a flat representation of a column's values """ try: res = "" i = 0 vals = self.df[col].tolist() for el in vals: if nums is True: res = res + str(i) + " " + el ...
[ "def", "flat_", "(", "self", ",", "col", ",", "nums", "=", "True", ")", ":", "try", ":", "res", "=", "\"\"", "i", "=", "0", "vals", "=", "self", ".", "df", "[", "col", "]", ".", "tolist", "(", ")", "for", "el", "in", "vals", ":", "if", "num...
Returns a flat representation of a column's values
[ "Returns", "a", "flat", "representation", "of", "a", "column", "s", "values" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/text.py#L11-L29
53,802
synw/dataswim
dataswim/data/text.py
Text.mfw_
def mfw_(self, col, sw_lang="english", limit=100): """ Returns a Dataswim instance with the most frequent words in a column exluding the most common stop words """ df = self._mfw(col, sw_lang, limit) if df is None: self.err("Can not find most frequent words") ...
python
def mfw_(self, col, sw_lang="english", limit=100): """ Returns a Dataswim instance with the most frequent words in a column exluding the most common stop words """ df = self._mfw(col, sw_lang, limit) if df is None: self.err("Can not find most frequent words") ...
[ "def", "mfw_", "(", "self", ",", "col", ",", "sw_lang", "=", "\"english\"", ",", "limit", "=", "100", ")", ":", "df", "=", "self", ".", "_mfw", "(", "col", ",", "sw_lang", ",", "limit", ")", "if", "df", "is", "None", ":", "self", ".", "err", "(...
Returns a Dataswim instance with the most frequent words in a column exluding the most common stop words
[ "Returns", "a", "Dataswim", "instance", "with", "the", "most", "frequent", "words", "in", "a", "column", "exluding", "the", "most", "common", "stop", "words" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/text.py#L31-L40
53,803
wummel/dosage
scripts/mklanguages.py
write_languages
def write_languages(f, l): """Write language information.""" f.write("Languages = {%s" % os.linesep) for lang in sorted(l): f.write(" %r: %r,%s" % (lang, l[lang], os.linesep)) f.write("}%s" % os.linesep)
python
def write_languages(f, l): """Write language information.""" f.write("Languages = {%s" % os.linesep) for lang in sorted(l): f.write(" %r: %r,%s" % (lang, l[lang], os.linesep)) f.write("}%s" % os.linesep)
[ "def", "write_languages", "(", "f", ",", "l", ")", ":", "f", ".", "write", "(", "\"Languages = {%s\"", "%", "os", ".", "linesep", ")", "for", "lang", "in", "sorted", "(", "l", ")", ":", "f", ".", "write", "(", "\" %r: %r,%s\"", "%", "(", "lang", ...
Write language information.
[ "Write", "language", "information", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/scripts/mklanguages.py#L32-L37
53,804
ska-sa/hypercube
hypercube/array_factory.py
generic_stitch
def generic_stitch(cube, arrays): """ Creates descriptors associated with array name and then sets the array as a member variable """ for name, ary in arrays.iteritems(): if name not in type(cube).__dict__: setattr(type(cube), name, ArrayDescriptor(name)) setattr(cu...
python
def generic_stitch(cube, arrays): """ Creates descriptors associated with array name and then sets the array as a member variable """ for name, ary in arrays.iteritems(): if name not in type(cube).__dict__: setattr(type(cube), name, ArrayDescriptor(name)) setattr(cu...
[ "def", "generic_stitch", "(", "cube", ",", "arrays", ")", ":", "for", "name", ",", "ary", "in", "arrays", ".", "iteritems", "(", ")", ":", "if", "name", "not", "in", "type", "(", "cube", ")", ".", "__dict__", ":", "setattr", "(", "type", "(", "cube...
Creates descriptors associated with array name and then sets the array as a member variable
[ "Creates", "descriptors", "associated", "with", "array", "name", "and", "then", "sets", "the", "array", "as", "a", "member", "variable" ]
6564a9e65ccd9ed7e7a71bd643f183e1ec645b29
https://github.com/ska-sa/hypercube/blob/6564a9e65ccd9ed7e7a71bd643f183e1ec645b29/hypercube/array_factory.py#L46-L56
53,805
ska-sa/hypercube
hypercube/array_factory.py
create_local_arrays
def create_local_arrays(reified_arrays, array_factory=None): """ Function that creates arrays, given the definitions in the reified_arrays dictionary and the array_factory keyword argument. Arguments --------- reified_arrays : dictionary Dictionary keyed on array name and ar...
python
def create_local_arrays(reified_arrays, array_factory=None): """ Function that creates arrays, given the definitions in the reified_arrays dictionary and the array_factory keyword argument. Arguments --------- reified_arrays : dictionary Dictionary keyed on array name and ar...
[ "def", "create_local_arrays", "(", "reified_arrays", ",", "array_factory", "=", "None", ")", ":", "# By default, create numpy arrays", "if", "array_factory", "is", "None", ":", "array_factory", "=", "np", ".", "empty", "# Construct the array dictionary by calling the", "#...
Function that creates arrays, given the definitions in the reified_arrays dictionary and the array_factory keyword argument. Arguments --------- reified_arrays : dictionary Dictionary keyed on array name and array definitions. Can be obtained via cube.arrays(reify=True) ...
[ "Function", "that", "creates", "arrays", "given", "the", "definitions", "in", "the", "reified_arrays", "dictionary", "and", "the", "array_factory", "keyword", "argument", "." ]
6564a9e65ccd9ed7e7a71bd643f183e1ec645b29
https://github.com/ska-sa/hypercube/blob/6564a9e65ccd9ed7e7a71bd643f183e1ec645b29/hypercube/array_factory.py#L58-L91
53,806
ska-sa/hypercube
hypercube/array_factory.py
create_local_arrays_on_cube
def create_local_arrays_on_cube(cube, reified_arrays=None, array_stitch=None, array_factory=None): """ Function that creates arrays on the supplied hypercube, given the supplied reified_arrays dictionary and array_stitch and array_factory functions. Arguments --------- cube : HyperCube ...
python
def create_local_arrays_on_cube(cube, reified_arrays=None, array_stitch=None, array_factory=None): """ Function that creates arrays on the supplied hypercube, given the supplied reified_arrays dictionary and array_stitch and array_factory functions. Arguments --------- cube : HyperCube ...
[ "def", "create_local_arrays_on_cube", "(", "cube", ",", "reified_arrays", "=", "None", ",", "array_stitch", "=", "None", ",", "array_factory", "=", "None", ")", ":", "# Create a default array stitching method", "if", "array_stitch", "is", "None", ":", "array_stitch", ...
Function that creates arrays on the supplied hypercube, given the supplied reified_arrays dictionary and array_stitch and array_factory functions. Arguments --------- cube : HyperCube A hypercube object on which arrays will be created. Keyword Arguments ----------------- ...
[ "Function", "that", "creates", "arrays", "on", "the", "supplied", "hypercube", "given", "the", "supplied", "reified_arrays", "dictionary", "and", "array_stitch", "and", "array_factory", "functions", "." ]
6564a9e65ccd9ed7e7a71bd643f183e1ec645b29
https://github.com/ska-sa/hypercube/blob/6564a9e65ccd9ed7e7a71bd643f183e1ec645b29/hypercube/array_factory.py#L93-L138
53,807
cslarsen/crianza
crianza/genetic.py
tanimoto_coefficient
def tanimoto_coefficient(a, b): """Measured similarity between two points in a multi-dimensional space. Returns: 1.0 if the two points completely overlap, 0.0 if the two points are infinitely far apart. """ return sum(map(lambda (x,y): float(x)*float(y), zip(a,b))) / sum([ -su...
python
def tanimoto_coefficient(a, b): """Measured similarity between two points in a multi-dimensional space. Returns: 1.0 if the two points completely overlap, 0.0 if the two points are infinitely far apart. """ return sum(map(lambda (x,y): float(x)*float(y), zip(a,b))) / sum([ -su...
[ "def", "tanimoto_coefficient", "(", "a", ",", "b", ")", ":", "return", "sum", "(", "map", "(", "lambda", "(", "x", ",", "y", ")", ":", "float", "(", "x", ")", "*", "float", "(", "y", ")", ",", "zip", "(", "a", ",", "b", ")", ")", ")", "/", ...
Measured similarity between two points in a multi-dimensional space. Returns: 1.0 if the two points completely overlap, 0.0 if the two points are infinitely far apart.
[ "Measured", "similarity", "between", "two", "points", "in", "a", "multi", "-", "dimensional", "space", "." ]
fa044f9d491f37cc06892bad14b2c80b8ac5a7cd
https://github.com/cslarsen/crianza/blob/fa044f9d491f37cc06892bad14b2c80b8ac5a7cd/crianza/genetic.py#L17-L27
53,808
cslarsen/crianza
crianza/genetic.py
weighted_tanimoto
def weighted_tanimoto(a, b, weights): """Same as the Tanimoto coefficient, but wit weights for each dimension.""" weighted = lambda s: map(lambda (x,y): float(x)*float(y), zip(s, weights)) return tanimoto_coefficient(weighted(a), weighted(b))
python
def weighted_tanimoto(a, b, weights): """Same as the Tanimoto coefficient, but wit weights for each dimension.""" weighted = lambda s: map(lambda (x,y): float(x)*float(y), zip(s, weights)) return tanimoto_coefficient(weighted(a), weighted(b))
[ "def", "weighted_tanimoto", "(", "a", ",", "b", ",", "weights", ")", ":", "weighted", "=", "lambda", "s", ":", "map", "(", "lambda", "(", "x", ",", "y", ")", ":", "float", "(", "x", ")", "*", "float", "(", "y", ")", ",", "zip", "(", "s", ",",...
Same as the Tanimoto coefficient, but wit weights for each dimension.
[ "Same", "as", "the", "Tanimoto", "coefficient", "but", "wit", "weights", "for", "each", "dimension", "." ]
fa044f9d491f37cc06892bad14b2c80b8ac5a7cd
https://github.com/cslarsen/crianza/blob/fa044f9d491f37cc06892bad14b2c80b8ac5a7cd/crianza/genetic.py#L29-L32
53,809
cslarsen/crianza
crianza/genetic.py
average
def average(sequence, key): """Averages a sequence based on a key.""" return sum(map(key, sequence)) / float(len(sequence))
python
def average(sequence, key): """Averages a sequence based on a key.""" return sum(map(key, sequence)) / float(len(sequence))
[ "def", "average", "(", "sequence", ",", "key", ")", ":", "return", "sum", "(", "map", "(", "key", ",", "sequence", ")", ")", "/", "float", "(", "len", "(", "sequence", ")", ")" ]
Averages a sequence based on a key.
[ "Averages", "a", "sequence", "based", "on", "a", "key", "." ]
fa044f9d491f37cc06892bad14b2c80b8ac5a7cd
https://github.com/cslarsen/crianza/blob/fa044f9d491f37cc06892bad14b2c80b8ac5a7cd/crianza/genetic.py#L34-L36
53,810
cslarsen/crianza
crianza/genetic.py
stochastic_choice
def stochastic_choice(machines): """Stochastically choose one random machine distributed along their scores.""" if len(machines) < 4: return random.choice(machines) r = random.random() if r < 0.5: return random.choice(machines[:len(machines)/4]) elif r < 0.75: return ran...
python
def stochastic_choice(machines): """Stochastically choose one random machine distributed along their scores.""" if len(machines) < 4: return random.choice(machines) r = random.random() if r < 0.5: return random.choice(machines[:len(machines)/4]) elif r < 0.75: return ran...
[ "def", "stochastic_choice", "(", "machines", ")", ":", "if", "len", "(", "machines", ")", "<", "4", ":", "return", "random", ".", "choice", "(", "machines", ")", "r", "=", "random", ".", "random", "(", ")", "if", "r", "<", "0.5", ":", "return", "ra...
Stochastically choose one random machine distributed along their scores.
[ "Stochastically", "choose", "one", "random", "machine", "distributed", "along", "their", "scores", "." ]
fa044f9d491f37cc06892bad14b2c80b8ac5a7cd
https://github.com/cslarsen/crianza/blob/fa044f9d491f37cc06892bad14b2c80b8ac5a7cd/crianza/genetic.py#L49-L61
53,811
cslarsen/crianza
crianza/genetic.py
randomize
def randomize(vm, length=(10,10), ints=(0,999), strs=(1,10), chars=(32,126), instruction_ratio=0.5, number_string_ratio=0.8, exclude=map(crianza.instructions.lookup, [".", "exit", "read", "write", "str"]), restrict_to=None): """Replaces existing code ...
python
def randomize(vm, length=(10,10), ints=(0,999), strs=(1,10), chars=(32,126), instruction_ratio=0.5, number_string_ratio=0.8, exclude=map(crianza.instructions.lookup, [".", "exit", "read", "write", "str"]), restrict_to=None): """Replaces existing code ...
[ "def", "randomize", "(", "vm", ",", "length", "=", "(", "10", ",", "10", ")", ",", "ints", "=", "(", "0", ",", "999", ")", ",", "strs", "=", "(", "1", ",", "10", ")", ",", "chars", "=", "(", "32", ",", "126", ")", ",", "instruction_ratio", ...
Replaces existing code with completely random instructions. Does not optimize code after generating it. Args: length: Tuple of minimum and maximum code lengths. Code length will be a random number between these two, inclusive values. ints: Integers in the code will be selected at rando...
[ "Replaces", "existing", "code", "with", "completely", "random", "instructions", ".", "Does", "not", "optimize", "code", "after", "generating", "it", "." ]
fa044f9d491f37cc06892bad14b2c80b8ac5a7cd
https://github.com/cslarsen/crianza/blob/fa044f9d491f37cc06892bad14b2c80b8ac5a7cd/crianza/genetic.py#L67-L127
53,812
cslarsen/crianza
crianza/genetic.py
crossover
def crossover(m, f): """Produces an offspring from two Machines, whose code is a combination of the two.""" i = random.randint(0, len(m.code)) j = random.randint(0, len(f.code)) return m.code[:i] + f.code[j:]
python
def crossover(m, f): """Produces an offspring from two Machines, whose code is a combination of the two.""" i = random.randint(0, len(m.code)) j = random.randint(0, len(f.code)) return m.code[:i] + f.code[j:]
[ "def", "crossover", "(", "m", ",", "f", ")", ":", "i", "=", "random", ".", "randint", "(", "0", ",", "len", "(", "m", ".", "code", ")", ")", "j", "=", "random", ".", "randint", "(", "0", ",", "len", "(", "f", ".", "code", ")", ")", "return"...
Produces an offspring from two Machines, whose code is a combination of the two.
[ "Produces", "an", "offspring", "from", "two", "Machines", "whose", "code", "is", "a", "combination", "of", "the", "two", "." ]
fa044f9d491f37cc06892bad14b2c80b8ac5a7cd
https://github.com/cslarsen/crianza/blob/fa044f9d491f37cc06892bad14b2c80b8ac5a7cd/crianza/genetic.py#L129-L134
53,813
cslarsen/crianza
crianza/genetic.py
iterate
def iterate(MachineClass, stop_function=lambda iterations: iterations < 10000, machines=1000, survival_rate=0.05, mutation_rate=0.075, silent=False): """Creates a bunch of machines, runs them for a number of steps and then gives them a fitness score. The best produce offspring that are passed on to...
python
def iterate(MachineClass, stop_function=lambda iterations: iterations < 10000, machines=1000, survival_rate=0.05, mutation_rate=0.075, silent=False): """Creates a bunch of machines, runs them for a number of steps and then gives them a fitness score. The best produce offspring that are passed on to...
[ "def", "iterate", "(", "MachineClass", ",", "stop_function", "=", "lambda", "iterations", ":", "iterations", "<", "10000", ",", "machines", "=", "1000", ",", "survival_rate", "=", "0.05", ",", "mutation_rate", "=", "0.075", ",", "silent", "=", "False", ")", ...
Creates a bunch of machines, runs them for a number of steps and then gives them a fitness score. The best produce offspring that are passed on to the next generation. Args: setup: Function taking a Machine argument, makes the machine ready machine_class: A class that should inherit from M...
[ "Creates", "a", "bunch", "of", "machines", "runs", "them", "for", "a", "number", "of", "steps", "and", "then", "gives", "them", "a", "fitness", "score", ".", "The", "best", "produce", "offspring", "that", "are", "passed", "on", "to", "the", "next", "gene...
fa044f9d491f37cc06892bad14b2c80b8ac5a7cd
https://github.com/cslarsen/crianza/blob/fa044f9d491f37cc06892bad14b2c80b8ac5a7cd/crianza/genetic.py#L209-L318
53,814
cslarsen/crianza
crianza/genetic.py
GeneticMachine.mutate
def mutate(self): """Mutates code.""" # Choose a random position if len(self.code) == 0: return index = random.randint(0, len(self.code)-1) mutation_type = random.random() if mutation_type < 0.5: # Change self.code[index] = self.new()...
python
def mutate(self): """Mutates code.""" # Choose a random position if len(self.code) == 0: return index = random.randint(0, len(self.code)-1) mutation_type = random.random() if mutation_type < 0.5: # Change self.code[index] = self.new()...
[ "def", "mutate", "(", "self", ")", ":", "# Choose a random position", "if", "len", "(", "self", ".", "code", ")", "==", "0", ":", "return", "index", "=", "random", ".", "randint", "(", "0", ",", "len", "(", "self", ".", "code", ")", "-", "1", ")", ...
Mutates code.
[ "Mutates", "code", "." ]
fa044f9d491f37cc06892bad14b2c80b8ac5a7cd
https://github.com/cslarsen/crianza/blob/fa044f9d491f37cc06892bad14b2c80b8ac5a7cd/crianza/genetic.py#L166-L183
53,815
cslarsen/crianza
crianza/genetic.py
GeneticMachine.run
def run(self, steps=10): """Executes up to `steps` instructions.""" try: super(GeneticMachine, self).run(steps) self._error = False except StopIteration: self._error = False except Exception: self._error = True
python
def run(self, steps=10): """Executes up to `steps` instructions.""" try: super(GeneticMachine, self).run(steps) self._error = False except StopIteration: self._error = False except Exception: self._error = True
[ "def", "run", "(", "self", ",", "steps", "=", "10", ")", ":", "try", ":", "super", "(", "GeneticMachine", ",", "self", ")", ".", "run", "(", "steps", ")", "self", ".", "_error", "=", "False", "except", "StopIteration", ":", "self", ".", "_error", "...
Executes up to `steps` instructions.
[ "Executes", "up", "to", "steps", "instructions", "." ]
fa044f9d491f37cc06892bad14b2c80b8ac5a7cd
https://github.com/cslarsen/crianza/blob/fa044f9d491f37cc06892bad14b2c80b8ac5a7cd/crianza/genetic.py#L185-L193
53,816
ojii/django-multilingual-ng
multilingual/validation.py
get_field
def get_field(cls, model, opts, label, field): """ Just like django.contrib.admin.validation.get_field, but knows about translation models. """ trans_model = model._meta.translation_model try: (f, lang_id) = trans_model._meta.translated_fields[field] return f except KeyError...
python
def get_field(cls, model, opts, label, field): """ Just like django.contrib.admin.validation.get_field, but knows about translation models. """ trans_model = model._meta.translation_model try: (f, lang_id) = trans_model._meta.translated_fields[field] return f except KeyError...
[ "def", "get_field", "(", "cls", ",", "model", ",", "opts", ",", "label", ",", "field", ")", ":", "trans_model", "=", "model", ".", "_meta", ".", "translation_model", "try", ":", "(", "f", ",", "lang_id", ")", "=", "trans_model", ".", "_meta", ".", "t...
Just like django.contrib.admin.validation.get_field, but knows about translation models.
[ "Just", "like", "django", ".", "contrib", ".", "admin", ".", "validation", ".", "get_field", "but", "knows", "about", "translation", "models", "." ]
0d320a0732ec59949380d4b5f21e153174d3ecf7
https://github.com/ojii/django-multilingual-ng/blob/0d320a0732ec59949380d4b5f21e153174d3ecf7/multilingual/validation.py#L7-L27
53,817
ojii/django-multilingual-ng
multilingual/validation.py
validate_admin_registration
def validate_admin_registration(cls, model): """ Validates a class specified as a model admin. Right now this means validating prepopulated_fields, as for multilingual models DM handles them by itself. """ if not is_multilingual_model(model): return from django.contrib.admin.valid...
python
def validate_admin_registration(cls, model): """ Validates a class specified as a model admin. Right now this means validating prepopulated_fields, as for multilingual models DM handles them by itself. """ if not is_multilingual_model(model): return from django.contrib.admin.valid...
[ "def", "validate_admin_registration", "(", "cls", ",", "model", ")", ":", "if", "not", "is_multilingual_model", "(", "model", ")", ":", "return", "from", "django", ".", "contrib", ".", "admin", ".", "validation", "import", "check_isdict", ",", "check_isseq", "...
Validates a class specified as a model admin. Right now this means validating prepopulated_fields, as for multilingual models DM handles them by itself.
[ "Validates", "a", "class", "specified", "as", "a", "model", "admin", "." ]
0d320a0732ec59949380d4b5f21e153174d3ecf7
https://github.com/ojii/django-multilingual-ng/blob/0d320a0732ec59949380d4b5f21e153174d3ecf7/multilingual/validation.py#L30-L60
53,818
dirko/pyhacrf
pyhacrf/state_machine.py
DefaultStateMachine._independent_lattice
def _independent_lattice(self, shape, lattice=None): """ Helper to construct the list of nodes and edges. """ I, J = shape if lattice is not None: end_I = min(I, max(lattice[..., 3])) - 1 end_J = min(J, max(lattice[..., 4])) - 1 unvisited_nodes = deque([(i, j...
python
def _independent_lattice(self, shape, lattice=None): """ Helper to construct the list of nodes and edges. """ I, J = shape if lattice is not None: end_I = min(I, max(lattice[..., 3])) - 1 end_J = min(J, max(lattice[..., 4])) - 1 unvisited_nodes = deque([(i, j...
[ "def", "_independent_lattice", "(", "self", ",", "shape", ",", "lattice", "=", "None", ")", ":", "I", ",", "J", "=", "shape", "if", "lattice", "is", "not", "None", ":", "end_I", "=", "min", "(", "I", ",", "max", "(", "lattice", "[", "...", ",", "...
Helper to construct the list of nodes and edges.
[ "Helper", "to", "construct", "the", "list", "of", "nodes", "and", "edges", "." ]
51455681d4edf88e5323313fc0f6b85577ae185c
https://github.com/dirko/pyhacrf/blob/51455681d4edf88e5323313fc0f6b85577ae185c/pyhacrf/state_machine.py#L143-L162
53,819
wummel/dosage
dosagelib/comic.py
ComicStrip.getDownloader
def getDownloader(self, url): """Get an image downloader.""" filename = self.namer(url, self.stripUrl) if filename is None: filename = url.rsplit('/', 1)[1] dirname = getDirname(self.name) return ComicImage(self.name, url, self.stripUrl, dirname, filename, self.sessio...
python
def getDownloader(self, url): """Get an image downloader.""" filename = self.namer(url, self.stripUrl) if filename is None: filename = url.rsplit('/', 1)[1] dirname = getDirname(self.name) return ComicImage(self.name, url, self.stripUrl, dirname, filename, self.sessio...
[ "def", "getDownloader", "(", "self", ",", "url", ")", ":", "filename", "=", "self", ".", "namer", "(", "url", ",", "self", ".", "stripUrl", ")", "if", "filename", "is", "None", ":", "filename", "=", "url", ".", "rsplit", "(", "'/'", ",", "1", ")", ...
Get an image downloader.
[ "Get", "an", "image", "downloader", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/comic.py#L27-L33
53,820
wummel/dosage
dosagelib/comic.py
ComicImage.connect
def connect(self): """Connect to host and get meta information.""" self.urlobj = getImageObject(self.url, self.referrer, self.session) content_type = unquote(self.urlobj.headers.get('content-type', 'application/octet-stream')) content_type = content_type.split(';', 1)[0] if '/' i...
python
def connect(self): """Connect to host and get meta information.""" self.urlobj = getImageObject(self.url, self.referrer, self.session) content_type = unquote(self.urlobj.headers.get('content-type', 'application/octet-stream')) content_type = content_type.split(';', 1)[0] if '/' i...
[ "def", "connect", "(", "self", ")", ":", "self", ".", "urlobj", "=", "getImageObject", "(", "self", ".", "url", ",", "self", ".", "referrer", ",", "self", ".", "session", ")", "content_type", "=", "unquote", "(", "self", ".", "urlobj", ".", "headers", ...
Connect to host and get meta information.
[ "Connect", "to", "host", "and", "get", "meta", "information", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/comic.py#L52-L68
53,821
wummel/dosage
dosagelib/comic.py
ComicImage.save
def save(self, basepath): """Save comic URL to filename on disk.""" out.info(u"Get image URL %s" % self.url, level=1) self.connect() filename = "%s%s" % (self.filename, self.ext) comicDir = os.path.join(basepath, self.dirname) if not os.path.isdir(comicDir): o...
python
def save(self, basepath): """Save comic URL to filename on disk.""" out.info(u"Get image URL %s" % self.url, level=1) self.connect() filename = "%s%s" % (self.filename, self.ext) comicDir = os.path.join(basepath, self.dirname) if not os.path.isdir(comicDir): o...
[ "def", "save", "(", "self", ",", "basepath", ")", ":", "out", ".", "info", "(", "u\"Get image URL %s\"", "%", "self", ".", "url", ",", "level", "=", "1", ")", "self", ".", "connect", "(", ")", "filename", "=", "\"%s%s\"", "%", "(", "self", ".", "fi...
Save comic URL to filename on disk.
[ "Save", "comic", "URL", "to", "filename", "on", "disk", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/comic.py#L70-L95
53,822
genepattern/genepattern-python
gp/core.py
GPServer.authorization_header
def authorization_header(self): """ Returns a string containing the authorization header used to authenticate with GenePattern. This string is included in the header of subsequent requests sent to GenePattern. """ return 'Basic %s' % base64.b64encode(bytes(self.username +...
python
def authorization_header(self): """ Returns a string containing the authorization header used to authenticate with GenePattern. This string is included in the header of subsequent requests sent to GenePattern. """ return 'Basic %s' % base64.b64encode(bytes(self.username +...
[ "def", "authorization_header", "(", "self", ")", ":", "return", "'Basic %s'", "%", "base64", ".", "b64encode", "(", "bytes", "(", "self", ".", "username", "+", "':'", "+", "self", ".", "password", ",", "'ascii'", ")", ")", ".", "decode", "(", "'ascii'", ...
Returns a string containing the authorization header used to authenticate with GenePattern. This string is included in the header of subsequent requests sent to GenePattern.
[ "Returns", "a", "string", "containing", "the", "authorization", "header", "used", "to", "authenticate", "with", "GenePattern", ".", "This", "string", "is", "included", "in", "the", "header", "of", "subsequent", "requests", "sent", "to", "GenePattern", "." ]
9478ea65362b91c72a94f7300c3de8d710bebb71
https://github.com/genepattern/genepattern-python/blob/9478ea65362b91c72a94f7300c3de8d710bebb71/gp/core.py#L28-L34
53,823
genepattern/genepattern-python
gp/core.py
GPServer.upload_file
def upload_file(self, file_name, file_path): """ Upload a file to a server Attempts to upload a local file with path filepath, to the server, where it will be named filename. Args: :param file_name: The name that the uploaded file will be called on the server. ...
python
def upload_file(self, file_name, file_path): """ Upload a file to a server Attempts to upload a local file with path filepath, to the server, where it will be named filename. Args: :param file_name: The name that the uploaded file will be called on the server. ...
[ "def", "upload_file", "(", "self", ",", "file_name", ",", "file_path", ")", ":", "request", "=", "urllib", ".", "request", ".", "Request", "(", "self", ".", "url", "+", "'/rest/v1/data/upload/job_input?name='", "+", "file_name", ")", "if", "self", ".", "auth...
Upload a file to a server Attempts to upload a local file with path filepath, to the server, where it will be named filename. Args: :param file_name: The name that the uploaded file will be called on the server. :param file_path: The path of the local file to upload. ...
[ "Upload", "a", "file", "to", "a", "server" ]
9478ea65362b91c72a94f7300c3de8d710bebb71
https://github.com/genepattern/genepattern-python/blob/9478ea65362b91c72a94f7300c3de8d710bebb71/gp/core.py#L36-L68
53,824
genepattern/genepattern-python
gp/core.py
GPServer.run_job
def run_job(self, job_spec, wait_until_done=True): """ Runs a job defined by jobspec, optionally non-blocking. Takes a GPJobSpec object that defines a request to run a job, and makes the request to the server. By default blocks until the job is finished by polling the server, b...
python
def run_job(self, job_spec, wait_until_done=True): """ Runs a job defined by jobspec, optionally non-blocking. Takes a GPJobSpec object that defines a request to run a job, and makes the request to the server. By default blocks until the job is finished by polling the server, b...
[ "def", "run_job", "(", "self", ",", "job_spec", ",", "wait_until_done", "=", "True", ")", ":", "# names should be a list of names,", "# values should be a list of **lists** of values", "json_string", "=", "json", ".", "dumps", "(", "{", "'lsid'", ":", "job_spec", ".",...
Runs a job defined by jobspec, optionally non-blocking. Takes a GPJobSpec object that defines a request to run a job, and makes the request to the server. By default blocks until the job is finished by polling the server, but can also run asynchronously. Args: :param job_s...
[ "Runs", "a", "job", "defined", "by", "jobspec", "optionally", "non", "-", "blocking", "." ]
9478ea65362b91c72a94f7300c3de8d710bebb71
https://github.com/genepattern/genepattern-python/blob/9478ea65362b91c72a94f7300c3de8d710bebb71/gp/core.py#L70-L109
53,825
genepattern/genepattern-python
gp/core.py
GPServer.get_task_list
def get_task_list(self): """ Queries the GenePattern server and returns a list of GPTask objects, each representing one of the modules installed on the server. Useful for determining which are available on the server. """ request = urllib.request.Request(self.url + '/rest...
python
def get_task_list(self): """ Queries the GenePattern server and returns a list of GPTask objects, each representing one of the modules installed on the server. Useful for determining which are available on the server. """ request = urllib.request.Request(self.url + '/rest...
[ "def", "get_task_list", "(", "self", ")", ":", "request", "=", "urllib", ".", "request", ".", "Request", "(", "self", ".", "url", "+", "'/rest/v1/tasks/all.json'", ")", "if", "self", ".", "authorization_header", "(", ")", "is", "not", "None", ":", "request...
Queries the GenePattern server and returns a list of GPTask objects, each representing one of the modules installed on the server. Useful for determining which are available on the server.
[ "Queries", "the", "GenePattern", "server", "and", "returns", "a", "list", "of", "GPTask", "objects", "each", "representing", "one", "of", "the", "modules", "installed", "on", "the", "server", ".", "Useful", "for", "determining", "which", "are", "available", "o...
9478ea65362b91c72a94f7300c3de8d710bebb71
https://github.com/genepattern/genepattern-python/blob/9478ea65362b91c72a94f7300c3de8d710bebb71/gp/core.py#L111-L129
53,826
genepattern/genepattern-python
gp/core.py
GPServer.get_recent_jobs
def get_recent_jobs(self, n_jobs=10): """ Returns the user's N most recently submitted jobs on the GenePattern server. Args: If not specified, n_jobs = 10. Returns: An array of GPJob objects. """ # Query the server for the list of jobs request = urllib.request....
python
def get_recent_jobs(self, n_jobs=10): """ Returns the user's N most recently submitted jobs on the GenePattern server. Args: If not specified, n_jobs = 10. Returns: An array of GPJob objects. """ # Query the server for the list of jobs request = urllib.request....
[ "def", "get_recent_jobs", "(", "self", ",", "n_jobs", "=", "10", ")", ":", "# Query the server for the list of jobs", "request", "=", "urllib", ".", "request", ".", "Request", "(", "self", ".", "url", "+", "'/rest/v1/jobs/?pageSize='", "+", "str", "(", "n_jobs",...
Returns the user's N most recently submitted jobs on the GenePattern server. Args: If not specified, n_jobs = 10. Returns: An array of GPJob objects.
[ "Returns", "the", "user", "s", "N", "most", "recently", "submitted", "jobs", "on", "the", "GenePattern", "server", "." ]
9478ea65362b91c72a94f7300c3de8d710bebb71
https://github.com/genepattern/genepattern-python/blob/9478ea65362b91c72a94f7300c3de8d710bebb71/gp/core.py#L153-L182
53,827
genepattern/genepattern-python
gp/core.py
GPJob.load_info
def load_info(self): """ Parses the JSON object stored at GPJob.info and assigns its metadata to properties of this GPJob object. Primarily intended to be called from GPJob.get_info(). """ self.task_name = self.info['taskName'] self.task_lsid = self.info['taskLsi...
python
def load_info(self): """ Parses the JSON object stored at GPJob.info and assigns its metadata to properties of this GPJob object. Primarily intended to be called from GPJob.get_info(). """ self.task_name = self.info['taskName'] self.task_lsid = self.info['taskLsi...
[ "def", "load_info", "(", "self", ")", ":", "self", ".", "task_name", "=", "self", ".", "info", "[", "'taskName'", "]", "self", ".", "task_lsid", "=", "self", ".", "info", "[", "'taskLsid'", "]", "self", ".", "user_id", "=", "self", ".", "info", "[", ...
Parses the JSON object stored at GPJob.info and assigns its metadata to properties of this GPJob object. Primarily intended to be called from GPJob.get_info().
[ "Parses", "the", "JSON", "object", "stored", "at", "GPJob", ".", "info", "and", "assigns", "its", "metadata", "to", "properties", "of", "this", "GPJob", "object", "." ]
9478ea65362b91c72a94f7300c3de8d710bebb71
https://github.com/genepattern/genepattern-python/blob/9478ea65362b91c72a94f7300c3de8d710bebb71/gp/core.py#L305-L323
53,828
genepattern/genepattern-python
gp/core.py
GPJob.get_child_jobs
def get_child_jobs(self): """ Queries the GenePattern server for child jobs of this job, creates GPJob objects representing each of them and assigns the list of them to the GPJob.children property. Then return this list. """ # Lazily load info if self.info is None...
python
def get_child_jobs(self): """ Queries the GenePattern server for child jobs of this job, creates GPJob objects representing each of them and assigns the list of them to the GPJob.children property. Then return this list. """ # Lazily load info if self.info is None...
[ "def", "get_child_jobs", "(", "self", ")", ":", "# Lazily load info", "if", "self", ".", "info", "is", "None", ":", "self", ".", "get_info", "(", ")", "# Lazily load children", "if", "self", ".", "children", "is", "not", "None", ":", "return", "self", ".",...
Queries the GenePattern server for child jobs of this job, creates GPJob objects representing each of them and assigns the list of them to the GPJob.children property. Then return this list.
[ "Queries", "the", "GenePattern", "server", "for", "child", "jobs", "of", "this", "job", "creates", "GPJob", "objects", "representing", "each", "of", "them", "and", "assigns", "the", "list", "of", "them", "to", "the", "GPJob", ".", "children", "property", "."...
9478ea65362b91c72a94f7300c3de8d710bebb71
https://github.com/genepattern/genepattern-python/blob/9478ea65362b91c72a94f7300c3de8d710bebb71/gp/core.py#L325-L348
53,829
genepattern/genepattern-python
gp/core.py
GPJob.is_finished
def is_finished(self): """ Queries the server to check if the job has been completed. Returns True or False. """ self.get_info() if 'status' not in self.info: return False if 'isFinished' not in self.info['status']: return False r...
python
def is_finished(self): """ Queries the server to check if the job has been completed. Returns True or False. """ self.get_info() if 'status' not in self.info: return False if 'isFinished' not in self.info['status']: return False r...
[ "def", "is_finished", "(", "self", ")", ":", "self", ".", "get_info", "(", ")", "if", "'status'", "not", "in", "self", ".", "info", ":", "return", "False", "if", "'isFinished'", "not", "in", "self", ".", "info", "[", "'status'", "]", ":", "return", "...
Queries the server to check if the job has been completed. Returns True or False.
[ "Queries", "the", "server", "to", "check", "if", "the", "job", "has", "been", "completed", ".", "Returns", "True", "or", "False", "." ]
9478ea65362b91c72a94f7300c3de8d710bebb71
https://github.com/genepattern/genepattern-python/blob/9478ea65362b91c72a94f7300c3de8d710bebb71/gp/core.py#L350-L362
53,830
genepattern/genepattern-python
gp/core.py
GPJob.has_error
def has_error(self): """ Queries the server to check if the job has an error. Returns True or False. """ self.get_info() if 'status' not in self.info: return False if 'hasError' not in self.info['status']: return False return self...
python
def has_error(self): """ Queries the server to check if the job has an error. Returns True or False. """ self.get_info() if 'status' not in self.info: return False if 'hasError' not in self.info['status']: return False return self...
[ "def", "has_error", "(", "self", ")", ":", "self", ".", "get_info", "(", ")", "if", "'status'", "not", "in", "self", ".", "info", ":", "return", "False", "if", "'hasError'", "not", "in", "self", ".", "info", "[", "'status'", "]", ":", "return", "Fals...
Queries the server to check if the job has an error. Returns True or False.
[ "Queries", "the", "server", "to", "check", "if", "the", "job", "has", "an", "error", ".", "Returns", "True", "or", "False", "." ]
9478ea65362b91c72a94f7300c3de8d710bebb71
https://github.com/genepattern/genepattern-python/blob/9478ea65362b91c72a94f7300c3de8d710bebb71/gp/core.py#L364-L376
53,831
genepattern/genepattern-python
gp/core.py
GPJob.is_pending
def is_pending(self): """ Queries the server to check if the job is pending. Returns True or False. """ self.get_info() if 'status' not in self.info: return False if 'isPending' not in self.info['status']: return False return self...
python
def is_pending(self): """ Queries the server to check if the job is pending. Returns True or False. """ self.get_info() if 'status' not in self.info: return False if 'isPending' not in self.info['status']: return False return self...
[ "def", "is_pending", "(", "self", ")", ":", "self", ".", "get_info", "(", ")", "if", "'status'", "not", "in", "self", ".", "info", ":", "return", "False", "if", "'isPending'", "not", "in", "self", ".", "info", "[", "'status'", "]", ":", "return", "Fa...
Queries the server to check if the job is pending. Returns True or False.
[ "Queries", "the", "server", "to", "check", "if", "the", "job", "is", "pending", ".", "Returns", "True", "or", "False", "." ]
9478ea65362b91c72a94f7300c3de8d710bebb71
https://github.com/genepattern/genepattern-python/blob/9478ea65362b91c72a94f7300c3de8d710bebb71/gp/core.py#L378-L390
53,832
genepattern/genepattern-python
gp/core.py
GPJob.get_tags
def get_tags(self): """ Returns the tags for the job, querying the server if necessary. """ # Lazily load info if self.info is None: self.get_info() if 'tags' in self.info: return [structure['tag']['tag'] for structure in self.info['tags']...
python
def get_tags(self): """ Returns the tags for the job, querying the server if necessary. """ # Lazily load info if self.info is None: self.get_info() if 'tags' in self.info: return [structure['tag']['tag'] for structure in self.info['tags']...
[ "def", "get_tags", "(", "self", ")", ":", "# Lazily load info", "if", "self", ".", "info", "is", "None", ":", "self", ".", "get_info", "(", ")", "if", "'tags'", "in", "self", ".", "info", ":", "return", "[", "structure", "[", "'tag'", "]", "[", "'tag...
Returns the tags for the job, querying the server if necessary.
[ "Returns", "the", "tags", "for", "the", "job", "querying", "the", "server", "if", "necessary", "." ]
9478ea65362b91c72a94f7300c3de8d710bebb71
https://github.com/genepattern/genepattern-python/blob/9478ea65362b91c72a94f7300c3de8d710bebb71/gp/core.py#L403-L415
53,833
genepattern/genepattern-python
gp/core.py
GPJob.get_comments
def get_comments(self): """ Returns the comments for the job, querying the server if necessary. """ # Lazily load info if self.info is None: self.get_info() if 'comments' in self.info: return [structure['text'] for structure in self.info['...
python
def get_comments(self): """ Returns the comments for the job, querying the server if necessary. """ # Lazily load info if self.info is None: self.get_info() if 'comments' in self.info: return [structure['text'] for structure in self.info['...
[ "def", "get_comments", "(", "self", ")", ":", "# Lazily load info", "if", "self", ".", "info", "is", "None", ":", "self", ".", "get_info", "(", ")", "if", "'comments'", "in", "self", ".", "info", ":", "return", "[", "structure", "[", "'text'", "]", "fo...
Returns the comments for the job, querying the server if necessary.
[ "Returns", "the", "comments", "for", "the", "job", "querying", "the", "server", "if", "necessary", "." ]
9478ea65362b91c72a94f7300c3de8d710bebb71
https://github.com/genepattern/genepattern-python/blob/9478ea65362b91c72a94f7300c3de8d710bebb71/gp/core.py#L417-L429
53,834
genepattern/genepattern-python
gp/core.py
GPJob.get_output_files
def get_output_files(self): """ Returns a list of the files output by the job, querying the server if necessary. If the job has output no files, an empty list will be returned. """ # Lazily load info if self.info is None: self.get_info() if 'o...
python
def get_output_files(self): """ Returns a list of the files output by the job, querying the server if necessary. If the job has output no files, an empty list will be returned. """ # Lazily load info if self.info is None: self.get_info() if 'o...
[ "def", "get_output_files", "(", "self", ")", ":", "# Lazily load info", "if", "self", ".", "info", "is", "None", ":", "self", ".", "get_info", "(", ")", "if", "'outputFiles'", "in", "self", ".", "info", ":", "return", "[", "GPFile", "(", "self", ".", "...
Returns a list of the files output by the job, querying the server if necessary. If the job has output no files, an empty list will be returned.
[ "Returns", "a", "list", "of", "the", "files", "output", "by", "the", "job", "querying", "the", "server", "if", "necessary", ".", "If", "the", "job", "has", "output", "no", "files", "an", "empty", "list", "will", "be", "returned", "." ]
9478ea65362b91c72a94f7300c3de8d710bebb71
https://github.com/genepattern/genepattern-python/blob/9478ea65362b91c72a94f7300c3de8d710bebb71/gp/core.py#L431-L444
53,835
genepattern/genepattern-python
gp/core.py
GPJob.get_file
def get_file(self, name): """ Returns the output file with the specified name, if no output files match, returns None. """ files = self.get_output_files() for f in files: if f.get_name() == name: return f return None
python
def get_file(self, name): """ Returns the output file with the specified name, if no output files match, returns None. """ files = self.get_output_files() for f in files: if f.get_name() == name: return f return None
[ "def", "get_file", "(", "self", ",", "name", ")", ":", "files", "=", "self", ".", "get_output_files", "(", ")", "for", "f", "in", "files", ":", "if", "f", ".", "get_name", "(", ")", "==", "name", ":", "return", "f", "return", "None" ]
Returns the output file with the specified name, if no output files match, returns None.
[ "Returns", "the", "output", "file", "with", "the", "specified", "name", "if", "no", "output", "files", "match", "returns", "None", "." ]
9478ea65362b91c72a94f7300c3de8d710bebb71
https://github.com/genepattern/genepattern-python/blob/9478ea65362b91c72a94f7300c3de8d710bebb71/gp/core.py#L446-L455
53,836
genepattern/genepattern-python
gp/core.py
GPJob.wait_until_done
def wait_until_done(self): """ This method will not return until the job is either complete or has reached an error state. This queries the server periodically to check for an update in status. """ wait = 1 while True: time.sleep(wait) self...
python
def wait_until_done(self): """ This method will not return until the job is either complete or has reached an error state. This queries the server periodically to check for an update in status. """ wait = 1 while True: time.sleep(wait) self...
[ "def", "wait_until_done", "(", "self", ")", ":", "wait", "=", "1", "while", "True", ":", "time", ".", "sleep", "(", "wait", ")", "self", ".", "get_info", "(", ")", "if", "self", ".", "info", "[", "'status'", "]", "[", "'isFinished'", "]", ":", "bre...
This method will not return until the job is either complete or has reached an error state. This queries the server periodically to check for an update in status.
[ "This", "method", "will", "not", "return", "until", "the", "job", "is", "either", "complete", "or", "has", "reached", "an", "error", "state", ".", "This", "queries", "the", "server", "periodically", "to", "check", "for", "an", "update", "in", "status", "."...
9478ea65362b91c72a94f7300c3de8d710bebb71
https://github.com/genepattern/genepattern-python/blob/9478ea65362b91c72a94f7300c3de8d710bebb71/gp/core.py#L457-L470
53,837
genepattern/genepattern-python
gp/core.py
GPTask.param_load
def param_load(self): """ Queries the server for the parameter information and other metadata associated with this task """ escaped_uri = urllib.parse.quote(self.uri) request = urllib.request.Request(self.server_data.url + '/rest/v1/tasks/' + escaped_uri) if self....
python
def param_load(self): """ Queries the server for the parameter information and other metadata associated with this task """ escaped_uri = urllib.parse.quote(self.uri) request = urllib.request.Request(self.server_data.url + '/rest/v1/tasks/' + escaped_uri) if self....
[ "def", "param_load", "(", "self", ")", ":", "escaped_uri", "=", "urllib", ".", "parse", ".", "quote", "(", "self", ".", "uri", ")", "request", "=", "urllib", ".", "request", ".", "Request", "(", "self", ".", "server_data", ".", "url", "+", "'/rest/v1/t...
Queries the server for the parameter information and other metadata associated with this task
[ "Queries", "the", "server", "for", "the", "parameter", "information", "and", "other", "metadata", "associated", "with", "this", "task" ]
9478ea65362b91c72a94f7300c3de8d710bebb71
https://github.com/genepattern/genepattern-python/blob/9478ea65362b91c72a94f7300c3de8d710bebb71/gp/core.py#L551-L573
53,838
genepattern/genepattern-python
gp/core.py
GPTaskParam.get_type
def get_type(self): """ Returns either 'File' or 'String'. The type attribute (e.g., java.io.File, java.lang.Integer, java.lang.Float), which might give a hint as to what string should represent, is not enforced and not employed consistently across all tasks, so we ignore. ...
python
def get_type(self): """ Returns either 'File' or 'String'. The type attribute (e.g., java.io.File, java.lang.Integer, java.lang.Float), which might give a hint as to what string should represent, is not enforced and not employed consistently across all tasks, so we ignore. ...
[ "def", "get_type", "(", "self", ")", ":", "if", "'TYPE'", "in", "self", ".", "attributes", "and", "'MODE'", "in", "self", ".", "attributes", ":", "dto_type", "=", "self", ".", "attributes", "[", "'TYPE'", "]", "dto_mode", "=", "self", ".", "attributes", ...
Returns either 'File' or 'String'. The type attribute (e.g., java.io.File, java.lang.Integer, java.lang.Float), which might give a hint as to what string should represent, is not enforced and not employed consistently across all tasks, so we ignore.
[ "Returns", "either", "File", "or", "String", "." ]
9478ea65362b91c72a94f7300c3de8d710bebb71
https://github.com/genepattern/genepattern-python/blob/9478ea65362b91c72a94f7300c3de8d710bebb71/gp/core.py#L671-L685
53,839
genepattern/genepattern-python
gp/core.py
GPTaskParam.get_default_value
def get_default_value(self): """ Return the default value for the parameter. If here is no default value, return None """ if ('default_value' in self.attributes and bool(self.attributes['default_value'].strip())): return self.attributes['default_value'] ...
python
def get_default_value(self): """ Return the default value for the parameter. If here is no default value, return None """ if ('default_value' in self.attributes and bool(self.attributes['default_value'].strip())): return self.attributes['default_value'] ...
[ "def", "get_default_value", "(", "self", ")", ":", "if", "(", "'default_value'", "in", "self", ".", "attributes", "and", "bool", "(", "self", ".", "attributes", "[", "'default_value'", "]", ".", "strip", "(", ")", ")", ")", ":", "return", "self", ".", ...
Return the default value for the parameter. If here is no default value, return None
[ "Return", "the", "default", "value", "for", "the", "parameter", ".", "If", "here", "is", "no", "default", "value", "return", "None" ]
9478ea65362b91c72a94f7300c3de8d710bebb71
https://github.com/genepattern/genepattern-python/blob/9478ea65362b91c72a94f7300c3de8d710bebb71/gp/core.py#L713-L721
53,840
genepattern/genepattern-python
gp/core.py
GPTaskParam.get_choice_status
def get_choice_status(self): """ Returns a message field, which indicates whether choices statically or dynamically defined, and flag indicating whether a dynamic file selection loading error occurred. Throws an error if this is not a choice parameter. """ if 'ch...
python
def get_choice_status(self): """ Returns a message field, which indicates whether choices statically or dynamically defined, and flag indicating whether a dynamic file selection loading error occurred. Throws an error if this is not a choice parameter. """ if 'ch...
[ "def", "get_choice_status", "(", "self", ")", ":", "if", "'choiceInfo'", "not", "in", "self", ".", "dto", "[", "self", ".", "name", "]", ":", "raise", "GPException", "(", "'not a choice parameter'", ")", "status", "=", "self", ".", "dto", "[", "self", "....
Returns a message field, which indicates whether choices statically or dynamically defined, and flag indicating whether a dynamic file selection loading error occurred. Throws an error if this is not a choice parameter.
[ "Returns", "a", "message", "field", "which", "indicates", "whether", "choices", "statically", "or", "dynamically", "defined", "and", "flag", "indicating", "whether", "a", "dynamic", "file", "selection", "loading", "error", "occurred", "." ]
9478ea65362b91c72a94f7300c3de8d710bebb71
https://github.com/genepattern/genepattern-python/blob/9478ea65362b91c72a94f7300c3de8d710bebb71/gp/core.py#L729-L741
53,841
genepattern/genepattern-python
gp/core.py
GPTaskParam.get_choice_href
def get_choice_href(self): """ Returns the HREF of a dynamic choice parameter. Throws an error if this is not a choice parameter. """ if 'choiceInfo' not in self.dto[self.name]: raise GPException('not a choice parameter') return self.dto[self.name]['choiceInf...
python
def get_choice_href(self): """ Returns the HREF of a dynamic choice parameter. Throws an error if this is not a choice parameter. """ if 'choiceInfo' not in self.dto[self.name]: raise GPException('not a choice parameter') return self.dto[self.name]['choiceInf...
[ "def", "get_choice_href", "(", "self", ")", ":", "if", "'choiceInfo'", "not", "in", "self", ".", "dto", "[", "self", ".", "name", "]", ":", "raise", "GPException", "(", "'not a choice parameter'", ")", "return", "self", ".", "dto", "[", "self", ".", "nam...
Returns the HREF of a dynamic choice parameter. Throws an error if this is not a choice parameter.
[ "Returns", "the", "HREF", "of", "a", "dynamic", "choice", "parameter", ".", "Throws", "an", "error", "if", "this", "is", "not", "a", "choice", "parameter", "." ]
9478ea65362b91c72a94f7300c3de8d710bebb71
https://github.com/genepattern/genepattern-python/blob/9478ea65362b91c72a94f7300c3de8d710bebb71/gp/core.py#L743-L751
53,842
genepattern/genepattern-python
gp/core.py
GPTaskParam.get_choice_selected_value
def get_choice_selected_value(self): """ Returns the default selection from a choice menu Throws an error if this is not a choice parameter. """ if 'choiceInfo' not in self.dto[self.name]: raise GPException('not a choice parameter') choice_info_dto = self.dto[...
python
def get_choice_selected_value(self): """ Returns the default selection from a choice menu Throws an error if this is not a choice parameter. """ if 'choiceInfo' not in self.dto[self.name]: raise GPException('not a choice parameter') choice_info_dto = self.dto[...
[ "def", "get_choice_selected_value", "(", "self", ")", ":", "if", "'choiceInfo'", "not", "in", "self", ".", "dto", "[", "self", ".", "name", "]", ":", "raise", "GPException", "(", "'not a choice parameter'", ")", "choice_info_dto", "=", "self", ".", "dto", "[...
Returns the default selection from a choice menu Throws an error if this is not a choice parameter.
[ "Returns", "the", "default", "selection", "from", "a", "choice", "menu", "Throws", "an", "error", "if", "this", "is", "not", "a", "choice", "parameter", "." ]
9478ea65362b91c72a94f7300c3de8d710bebb71
https://github.com/genepattern/genepattern-python/blob/9478ea65362b91c72a94f7300c3de8d710bebb71/gp/core.py#L753-L764
53,843
genepattern/genepattern-python
gp/core.py
GPTaskParam.allow_choice_custom_value
def allow_choice_custom_value(self): """ Returns boolean indicating whether choice parameter supports custom value. If choice parameter supports custom value, user can provide parameter value other than those provided in choice list. """ if 'choiceInfo' not in self.dto[s...
python
def allow_choice_custom_value(self): """ Returns boolean indicating whether choice parameter supports custom value. If choice parameter supports custom value, user can provide parameter value other than those provided in choice list. """ if 'choiceInfo' not in self.dto[s...
[ "def", "allow_choice_custom_value", "(", "self", ")", ":", "if", "'choiceInfo'", "not", "in", "self", ".", "dto", "[", "self", ".", "name", "]", ":", "raise", "GPException", "(", "'not a choice parameter'", ")", "return", "self", ".", "_is_string_true", "(", ...
Returns boolean indicating whether choice parameter supports custom value. If choice parameter supports custom value, user can provide parameter value other than those provided in choice list.
[ "Returns", "boolean", "indicating", "whether", "choice", "parameter", "supports", "custom", "value", "." ]
9478ea65362b91c72a94f7300c3de8d710bebb71
https://github.com/genepattern/genepattern-python/blob/9478ea65362b91c72a94f7300c3de8d710bebb71/gp/core.py#L766-L775
53,844
genepattern/genepattern-python
gp/core.py
GPTaskParam.get_choices
def get_choices(self): """ Returns a list of dictionary objects, one dictionary object per choice. Each object has two keys defined: 'value', 'label'. The 'label' entry is what should be displayed on the UI, the 'value' entry is what is written into GPJobSpec. """ ...
python
def get_choices(self): """ Returns a list of dictionary objects, one dictionary object per choice. Each object has two keys defined: 'value', 'label'. The 'label' entry is what should be displayed on the UI, the 'value' entry is what is written into GPJobSpec. """ ...
[ "def", "get_choices", "(", "self", ")", ":", "if", "'choiceInfo'", "not", "in", "self", ".", "dto", "[", "self", ".", "name", "]", ":", "raise", "GPException", "(", "'not a choice parameter'", ")", "if", "self", ".", "get_choice_status", "(", ")", "[", "...
Returns a list of dictionary objects, one dictionary object per choice. Each object has two keys defined: 'value', 'label'. The 'label' entry is what should be displayed on the UI, the 'value' entry is what is written into GPJobSpec.
[ "Returns", "a", "list", "of", "dictionary", "objects", "one", "dictionary", "object", "per", "choice", "." ]
9478ea65362b91c72a94f7300c3de8d710bebb71
https://github.com/genepattern/genepattern-python/blob/9478ea65362b91c72a94f7300c3de8d710bebb71/gp/core.py#L778-L799
53,845
genepattern/genepattern-python
gp/core.py
GPTaskParam.get_alt_name
def get_alt_name(self): """ Returns the alternate name of a parameter. Only pipeline prompt-when-run parameters can have alternate names and alternate descriptions """ if ('altName' in self.attributes and bool(self.attributes['altName'].strip())): ...
python
def get_alt_name(self): """ Returns the alternate name of a parameter. Only pipeline prompt-when-run parameters can have alternate names and alternate descriptions """ if ('altName' in self.attributes and bool(self.attributes['altName'].strip())): ...
[ "def", "get_alt_name", "(", "self", ")", ":", "if", "(", "'altName'", "in", "self", ".", "attributes", "and", "bool", "(", "self", ".", "attributes", "[", "'altName'", "]", ".", "strip", "(", ")", ")", ")", ":", "return", "self", ".", "attributes", "...
Returns the alternate name of a parameter. Only pipeline prompt-when-run parameters can have alternate names and alternate descriptions
[ "Returns", "the", "alternate", "name", "of", "a", "parameter", ".", "Only", "pipeline", "prompt", "-", "when", "-", "run", "parameters", "can", "have", "alternate", "names", "and", "alternate", "descriptions" ]
9478ea65362b91c72a94f7300c3de8d710bebb71
https://github.com/genepattern/genepattern-python/blob/9478ea65362b91c72a94f7300c3de8d710bebb71/gp/core.py#L801-L811
53,846
genepattern/genepattern-python
gp/core.py
GPTaskParam.get_alt_description
def get_alt_description(self): """ Returns the alternate description of a parameter. Only pipeline prompt-when-run parameters can have alternate names and alternate descriptions """ if 'altDescription' in self.attributes and bool(self.attributes['altDescription'].strip())...
python
def get_alt_description(self): """ Returns the alternate description of a parameter. Only pipeline prompt-when-run parameters can have alternate names and alternate descriptions """ if 'altDescription' in self.attributes and bool(self.attributes['altDescription'].strip())...
[ "def", "get_alt_description", "(", "self", ")", ":", "if", "'altDescription'", "in", "self", ".", "attributes", "and", "bool", "(", "self", ".", "attributes", "[", "'altDescription'", "]", ".", "strip", "(", ")", ")", ":", "return", "self", ".", "attribute...
Returns the alternate description of a parameter. Only pipeline prompt-when-run parameters can have alternate names and alternate descriptions
[ "Returns", "the", "alternate", "description", "of", "a", "parameter", ".", "Only", "pipeline", "prompt", "-", "when", "-", "run", "parameters", "can", "have", "alternate", "names", "and", "alternate", "descriptions" ]
9478ea65362b91c72a94f7300c3de8d710bebb71
https://github.com/genepattern/genepattern-python/blob/9478ea65362b91c72a94f7300c3de8d710bebb71/gp/core.py#L813-L822
53,847
Seeed-Studio/wio-cli
wio/commands/cmd_udp.py
cli
def cli(wio, send): ''' Sends a UDP command to the wio device. \b DOES: Support "VERSION", "SCAN", "Blank?", "DEBUG", "ENDEBUG: 1", "ENDEBUG: 0" "APCFG: AP\\tPWDs\\tTOKENs\\tSNs\\tSERVER_Domains\\tXSERVER_Domain\\t\\r\\n", Note: 1. Ensure your device is Configure Mode. ...
python
def cli(wio, send): ''' Sends a UDP command to the wio device. \b DOES: Support "VERSION", "SCAN", "Blank?", "DEBUG", "ENDEBUG: 1", "ENDEBUG: 0" "APCFG: AP\\tPWDs\\tTOKENs\\tSNs\\tSERVER_Domains\\tXSERVER_Domain\\t\\r\\n", Note: 1. Ensure your device is Configure Mode. ...
[ "def", "cli", "(", "wio", ",", "send", ")", ":", "command", "=", "send", "click", ".", "echo", "(", "\"UDP command: {}\"", ".", "format", "(", "command", ")", ")", "result", "=", "udp", ".", "common_send", "(", "command", ")", "if", "result", "is", "...
Sends a UDP command to the wio device. \b DOES: Support "VERSION", "SCAN", "Blank?", "DEBUG", "ENDEBUG: 1", "ENDEBUG: 0" "APCFG: AP\\tPWDs\\tTOKENs\\tSNs\\tSERVER_Domains\\tXSERVER_Domain\\t\\r\\n", Note: 1. Ensure your device is Configure Mode. 2. Change your computer n...
[ "Sends", "a", "UDP", "command", "to", "the", "wio", "device", "." ]
ce83f4c2d30be7f72d1a128acd123dfc5effa563
https://github.com/Seeed-Studio/wio-cli/blob/ce83f4c2d30be7f72d1a128acd123dfc5effa563/wio/commands/cmd_udp.py#L9-L31
53,848
cslarsen/crianza
crianza/repl.py
print_code
def print_code(vm, out=sys.stdout, ops_per_line=8, registers=True): """Prints code and state for VM.""" if registers: out.write("IP: %d\n" % vm.instruction_pointer) out.write("DS: %s\n" % str(vm.stack)) out.write("RS: %s\n" % str(vm.return_stack)) def to_str(op): if is_embed...
python
def print_code(vm, out=sys.stdout, ops_per_line=8, registers=True): """Prints code and state for VM.""" if registers: out.write("IP: %d\n" % vm.instruction_pointer) out.write("DS: %s\n" % str(vm.stack)) out.write("RS: %s\n" % str(vm.return_stack)) def to_str(op): if is_embed...
[ "def", "print_code", "(", "vm", ",", "out", "=", "sys", ".", "stdout", ",", "ops_per_line", "=", "8", ",", "registers", "=", "True", ")", ":", "if", "registers", ":", "out", ".", "write", "(", "\"IP: %d\\n\"", "%", "vm", ".", "instruction_pointer", ")"...
Prints code and state for VM.
[ "Prints", "code", "and", "state", "for", "VM", "." ]
fa044f9d491f37cc06892bad14b2c80b8ac5a7cd
https://github.com/cslarsen/crianza/blob/fa044f9d491f37cc06892bad14b2c80b8ac5a7cd/crianza/repl.py#L9-L33
53,849
cslarsen/crianza
crianza/repl.py
repl
def repl(optimize=True, persist=True): """Starts a simple REPL for this machine. Args: optimize: Controls whether to run inputted code through the optimizer. persist: If True, the machine is not deleted after each line. """ print("Extra commands for the REPL:") print(".code...
python
def repl(optimize=True, persist=True): """Starts a simple REPL for this machine. Args: optimize: Controls whether to run inputted code through the optimizer. persist: If True, the machine is not deleted after each line. """ print("Extra commands for the REPL:") print(".code...
[ "def", "repl", "(", "optimize", "=", "True", ",", "persist", "=", "True", ")", ":", "print", "(", "\"Extra commands for the REPL:\"", ")", "print", "(", "\".code - print code\"", ")", "print", "(", "\".raw - print raw code\"", ")", "print", "(", "\".quit ...
Starts a simple REPL for this machine. Args: optimize: Controls whether to run inputted code through the optimizer. persist: If True, the machine is not deleted after each line.
[ "Starts", "a", "simple", "REPL", "for", "this", "machine", "." ]
fa044f9d491f37cc06892bad14b2c80b8ac5a7cd
https://github.com/cslarsen/crianza/blob/fa044f9d491f37cc06892bad14b2c80b8ac5a7cd/crianza/repl.py#L35-L96
53,850
synw/dataswim
dataswim/db/__init__.py
Db.connect
def connect(self, url: str): """Connect to the database and set it as main database :param url: path to the database, uses the Sqlalchemy format :type url: str :example: ``ds.connect("sqlite:///mydb.slqite")`` """ try: self.db = dataset.connect(url, row_type...
python
def connect(self, url: str): """Connect to the database and set it as main database :param url: path to the database, uses the Sqlalchemy format :type url: str :example: ``ds.connect("sqlite:///mydb.slqite")`` """ try: self.db = dataset.connect(url, row_type...
[ "def", "connect", "(", "self", ",", "url", ":", "str", ")", ":", "try", ":", "self", ".", "db", "=", "dataset", ".", "connect", "(", "url", ",", "row_type", "=", "stuf", ")", "except", "Exception", "as", "e", ":", "self", ".", "err", "(", "e", ...
Connect to the database and set it as main database :param url: path to the database, uses the Sqlalchemy format :type url: str :example: ``ds.connect("sqlite:///mydb.slqite")``
[ "Connect", "to", "the", "database", "and", "set", "it", "as", "main", "database" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/db/__init__.py#L23-L39
53,851
synw/dataswim
dataswim/db/__init__.py
Db.load
def load(self, table: str): """Set the main dataframe from a table's data :param table: table name :type table: str :example: ``ds.load("mytable")`` """ if self._check_db() is False: return if table not in self.db.tables: self.warning("Th...
python
def load(self, table: str): """Set the main dataframe from a table's data :param table: table name :type table: str :example: ``ds.load("mytable")`` """ if self._check_db() is False: return if table not in self.db.tables: self.warning("Th...
[ "def", "load", "(", "self", ",", "table", ":", "str", ")", ":", "if", "self", ".", "_check_db", "(", ")", "is", "False", ":", "return", "if", "table", "not", "in", "self", ".", "db", ".", "tables", ":", "self", ".", "warning", "(", "\"The table \""...
Set the main dataframe from a table's data :param table: table name :type table: str :example: ``ds.load("mytable")``
[ "Set", "the", "main", "dataframe", "from", "a", "table", "s", "data" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/db/__init__.py#L41-L60
53,852
synw/dataswim
dataswim/db/__init__.py
Db.load_django
def load_django(self, query: "django query"): """Load the main dataframe from a django orm query :param query: django query from a model :type query: django query :example: ``ds.load_django(Mymodel.objects.all())`` """ try: self.df = self._load_django(query)...
python
def load_django(self, query: "django query"): """Load the main dataframe from a django orm query :param query: django query from a model :type query: django query :example: ``ds.load_django(Mymodel.objects.all())`` """ try: self.df = self._load_django(query)...
[ "def", "load_django", "(", "self", ",", "query", ":", "\"django query\"", ")", ":", "try", ":", "self", ".", "df", "=", "self", ".", "_load_django", "(", "query", ")", "except", "Exception", "as", "e", ":", "self", ".", "err", "(", "e", ",", "\"Can n...
Load the main dataframe from a django orm query :param query: django query from a model :type query: django query :example: ``ds.load_django(Mymodel.objects.all())``
[ "Load", "the", "main", "dataframe", "from", "a", "django", "orm", "query" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/db/__init__.py#L62-L73
53,853
synw/dataswim
dataswim/db/__init__.py
Db.load_django_
def load_django_(self, query: "django query") -> "Ds": """Returns a DataSwim instance from a django orm query :param query: django query from a model :type query: django query :return: a dataswim instance with data from a django query :rtype: Ds :example: ``ds2 = ds.loa...
python
def load_django_(self, query: "django query") -> "Ds": """Returns a DataSwim instance from a django orm query :param query: django query from a model :type query: django query :return: a dataswim instance with data from a django query :rtype: Ds :example: ``ds2 = ds.loa...
[ "def", "load_django_", "(", "self", ",", "query", ":", "\"django query\"", ")", "->", "\"Ds\"", ":", "try", ":", "df", "=", "self", ".", "_load_django", "(", "query", ")", "return", "self", ".", "clone_", "(", "df", ")", "except", "Exception", "as", "e...
Returns a DataSwim instance from a django orm query :param query: django query from a model :type query: django query :return: a dataswim instance with data from a django query :rtype: Ds :example: ``ds2 = ds.load_django_(Mymodel.objects.all())``
[ "Returns", "a", "DataSwim", "instance", "from", "a", "django", "orm", "query" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/db/__init__.py#L75-L89
53,854
wummel/dosage
dosagelib/rss.py
parseFeed
def parseFeed(filename, yesterday): """Parse an RSS feed and filter only entries that are newer than yesterday.""" dom = xml.dom.minidom.parse(filename) getText = lambda node, tag: node.getElementsByTagName(tag)[0].childNodes[0].data getNode = lambda tag: dom.getElementsByTagName(tag) content = ge...
python
def parseFeed(filename, yesterday): """Parse an RSS feed and filter only entries that are newer than yesterday.""" dom = xml.dom.minidom.parse(filename) getText = lambda node, tag: node.getElementsByTagName(tag)[0].childNodes[0].data getNode = lambda tag: dom.getElementsByTagName(tag) content = ge...
[ "def", "parseFeed", "(", "filename", ",", "yesterday", ")", ":", "dom", "=", "xml", ".", "dom", ".", "minidom", ".", "parse", "(", "filename", ")", "getText", "=", "lambda", "node", ",", "tag", ":", "node", ".", "getElementsByTagName", "(", "tag", ")",...
Parse an RSS feed and filter only entries that are newer than yesterday.
[ "Parse", "an", "RSS", "feed", "and", "filter", "only", "entries", "that", "are", "newer", "than", "yesterday", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/rss.py#L61-L83
53,855
wummel/dosage
dosagelib/rss.py
Feed.addElement
def addElement(self, parent, tag, value): """Add an RSS item.""" elem = self.rss.createElement(tag) node = self.rss.createTextNode(value) return parent.appendChild(elem).appendChild(node)
python
def addElement(self, parent, tag, value): """Add an RSS item.""" elem = self.rss.createElement(tag) node = self.rss.createTextNode(value) return parent.appendChild(elem).appendChild(node)
[ "def", "addElement", "(", "self", ",", "parent", ",", "tag", ",", "value", ")", ":", "elem", "=", "self", ".", "rss", ".", "createElement", "(", "tag", ")", "node", "=", "self", ".", "rss", ".", "createTextNode", "(", "value", ")", "return", "parent"...
Add an RSS item.
[ "Add", "an", "RSS", "item", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/rss.py#L26-L30
53,856
wummel/dosage
dosagelib/rss.py
Feed.addItem
def addItem(self, title, link, description, date, append=True): """Insert an item.""" item = self.rss.createElement('item') self.addElement(item, 'title', title) self.addElement(item, 'link', link) self.addElement(item, 'description', description) self.addElement(item, '...
python
def addItem(self, title, link, description, date, append=True): """Insert an item.""" item = self.rss.createElement('item') self.addElement(item, 'title', title) self.addElement(item, 'link', link) self.addElement(item, 'description', description) self.addElement(item, '...
[ "def", "addItem", "(", "self", ",", "title", ",", "link", ",", "description", ",", "date", ",", "append", "=", "True", ")", ":", "item", "=", "self", ".", "rss", ".", "createElement", "(", "'item'", ")", "self", ".", "addElement", "(", "item", ",", ...
Insert an item.
[ "Insert", "an", "item", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/rss.py#L32-L49
53,857
wummel/dosage
dosagelib/rss.py
Feed.write
def write(self, path): """Write RSS content to file.""" with open(path, 'wb') as f: f.write(self.getXML())
python
def write(self, path): """Write RSS content to file.""" with open(path, 'wb') as f: f.write(self.getXML())
[ "def", "write", "(", "self", ",", "path", ")", ":", "with", "open", "(", "path", ",", "'wb'", ")", "as", "f", ":", "f", ".", "write", "(", "self", ".", "getXML", "(", ")", ")" ]
Write RSS content to file.
[ "Write", "RSS", "content", "to", "file", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/rss.py#L51-L54
53,858
synw/dataswim
dataswim/data/views.py
View.show
def show(self, rows: int=5, dataframe: pd.DataFrame=None) -> pd.DataFrame: """ Display info about the dataframe :param rows: number of rows to show, defaults to 5 :param rows: int, optional :param dataframe: a pandas dataframe, defaults to None :param datafr...
python
def show(self, rows: int=5, dataframe: pd.DataFrame=None) -> pd.DataFrame: """ Display info about the dataframe :param rows: number of rows to show, defaults to 5 :param rows: int, optional :param dataframe: a pandas dataframe, defaults to None :param datafr...
[ "def", "show", "(", "self", ",", "rows", ":", "int", "=", "5", ",", "dataframe", ":", "pd", ".", "DataFrame", "=", "None", ")", "->", "pd", ".", "DataFrame", ":", "try", ":", "if", "dataframe", "is", "not", "None", ":", "df", "=", "dataframe", "e...
Display info about the dataframe :param rows: number of rows to show, defaults to 5 :param rows: int, optional :param dataframe: a pandas dataframe, defaults to None :param dataframe: pd.DataFrame, optional :return: a pandas dataframe :rtype: pd.DataFrame :examp...
[ "Display", "info", "about", "the", "dataframe" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/views.py#L10-L45
53,859
synw/dataswim
dataswim/data/views.py
View.one
def one(self): """ Shows one row of the dataframe and the field names wiht count :return: a pandas dataframe :rtype: pd.DataFrame :example: ``ds.one()`` """ try: return self.show(1) except Exception as e: self.err(e, self...
python
def one(self): """ Shows one row of the dataframe and the field names wiht count :return: a pandas dataframe :rtype: pd.DataFrame :example: ``ds.one()`` """ try: return self.show(1) except Exception as e: self.err(e, self...
[ "def", "one", "(", "self", ")", ":", "try", ":", "return", "self", ".", "show", "(", "1", ")", "except", "Exception", "as", "e", ":", "self", ".", "err", "(", "e", ",", "self", ".", "one", ",", "\"Can not display dataframe\"", ")" ]
Shows one row of the dataframe and the field names wiht count :return: a pandas dataframe :rtype: pd.DataFrame :example: ``ds.one()``
[ "Shows", "one", "row", "of", "the", "dataframe", "and", "the", "field", "names", "wiht", "count" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/views.py#L47-L60
53,860
synw/dataswim
dataswim/data/views.py
View.tail
def tail(self, rows: int=5): """ Returns the main dataframe's tail :param rows: number of rows to print, defaults to 5 :param rows: int, optional :return: a pandas dataframe :rtype: pd.DataFrame :example: ``ds.tail()`` """ if self.df is None: ...
python
def tail(self, rows: int=5): """ Returns the main dataframe's tail :param rows: number of rows to print, defaults to 5 :param rows: int, optional :return: a pandas dataframe :rtype: pd.DataFrame :example: ``ds.tail()`` """ if self.df is None: ...
[ "def", "tail", "(", "self", ",", "rows", ":", "int", "=", "5", ")", ":", "if", "self", ".", "df", "is", "None", ":", "self", ".", "warning", "(", "\"Dataframe is empty: no tail available\"", ")", "return", "self", ".", "df", ".", "tail", "(", "rows", ...
Returns the main dataframe's tail :param rows: number of rows to print, defaults to 5 :param rows: int, optional :return: a pandas dataframe :rtype: pd.DataFrame :example: ``ds.tail()``
[ "Returns", "the", "main", "dataframe", "s", "tail" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/views.py#L62-L75
53,861
synw/dataswim
dataswim/data/views.py
View.cols_
def cols_(self) -> pd.DataFrame: """ Returns a dataframe with columns info :return: a pandas dataframe :rtype: pd.DataFrame :example: ``ds.cols_()`` """ try: s = self.df.iloc[0] df = pd.DataFrame(s) df = df.rename(columns={0: ...
python
def cols_(self) -> pd.DataFrame: """ Returns a dataframe with columns info :return: a pandas dataframe :rtype: pd.DataFrame :example: ``ds.cols_()`` """ try: s = self.df.iloc[0] df = pd.DataFrame(s) df = df.rename(columns={0: ...
[ "def", "cols_", "(", "self", ")", "->", "pd", ".", "DataFrame", ":", "try", ":", "s", "=", "self", ".", "df", ".", "iloc", "[", "0", "]", "df", "=", "pd", ".", "DataFrame", "(", "s", ")", "df", "=", "df", ".", "rename", "(", "columns", "=", ...
Returns a dataframe with columns info :return: a pandas dataframe :rtype: pd.DataFrame :example: ``ds.cols_()``
[ "Returns", "a", "dataframe", "with", "columns", "info" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/views.py#L77-L100
53,862
synw/dataswim
dataswim/data/views.py
View.types_
def types_(self, col: str) -> pd.DataFrame: """ Display types of values in a column :param col: column name :type col: str :return: a pandas dataframe :rtype: pd.DataFrame :example: ``ds.types_("Col 1")`` """ cols = self.df.columns.values ...
python
def types_(self, col: str) -> pd.DataFrame: """ Display types of values in a column :param col: column name :type col: str :return: a pandas dataframe :rtype: pd.DataFrame :example: ``ds.types_("Col 1")`` """ cols = self.df.columns.values ...
[ "def", "types_", "(", "self", ",", "col", ":", "str", ")", "->", "pd", ".", "DataFrame", ":", "cols", "=", "self", ".", "df", ".", "columns", ".", "values", "all_types", "=", "{", "}", "for", "col", "in", "cols", ":", "local_types", "=", "[", "]"...
Display types of values in a column :param col: column name :type col: str :return: a pandas dataframe :rtype: pd.DataFrame :example: ``ds.types_("Col 1")``
[ "Display", "types", "of", "values", "in", "a", "column" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/views.py#L116-L138
53,863
misli/django-cms-articles
cms_articles/views.py
article
def article(request, slug): """ The main view of the Django-CMS Articles! Takes a request and a slug, renders the article. """ # Get current CMS Page as article tree tree = request.current_page.get_public_object() # Check whether it really is a tree. # It could also be one of its sub-pa...
python
def article(request, slug): """ The main view of the Django-CMS Articles! Takes a request and a slug, renders the article. """ # Get current CMS Page as article tree tree = request.current_page.get_public_object() # Check whether it really is a tree. # It could also be one of its sub-pa...
[ "def", "article", "(", "request", ",", "slug", ")", ":", "# Get current CMS Page as article tree", "tree", "=", "request", ".", "current_page", ".", "get_public_object", "(", ")", "# Check whether it really is a tree.", "# It could also be one of its sub-pages.", "if", "tre...
The main view of the Django-CMS Articles! Takes a request and a slug, renders the article.
[ "The", "main", "view", "of", "the", "Django", "-", "CMS", "Articles!", "Takes", "a", "request", "and", "a", "slug", "renders", "the", "article", "." ]
d96ac77e049022deb4c70d268e4eab74d175145c
https://github.com/misli/django-cms-articles/blob/d96ac77e049022deb4c70d268e4eab74d175145c/cms_articles/views.py#L20-L120
53,864
wummel/dosage
dosagelib/plugins/t.py
TheThinHLine.getComicStrip
def getComicStrip(self, url, data): """The comic strip image is in a separate page.""" pageUrl = self.fetchUrl(url, data, self.indirectImageSearch) pageData = self.getPage(pageUrl) return super(TheThinHLine, self).getComicStrip(pageUrl, pageData)
python
def getComicStrip(self, url, data): """The comic strip image is in a separate page.""" pageUrl = self.fetchUrl(url, data, self.indirectImageSearch) pageData = self.getPage(pageUrl) return super(TheThinHLine, self).getComicStrip(pageUrl, pageData)
[ "def", "getComicStrip", "(", "self", ",", "url", ",", "data", ")", ":", "pageUrl", "=", "self", ".", "fetchUrl", "(", "url", ",", "data", ",", "self", ".", "indirectImageSearch", ")", "pageData", "=", "self", ".", "getPage", "(", "pageUrl", ")", "retur...
The comic strip image is in a separate page.
[ "The", "comic", "strip", "image", "is", "in", "a", "separate", "page", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/plugins/t.py#L178-L182
53,865
wummel/dosage
dosagelib/plugins/t.py
TheThinHLine.namer
def namer(cls, imageUrl, pageUrl): """Use page URL sequence which is apparently increasing.""" num = pageUrl.split('/')[-1] ext = imageUrl.rsplit('.', 1)[1] return "thethinhline-%s.%s" % (num, ext)
python
def namer(cls, imageUrl, pageUrl): """Use page URL sequence which is apparently increasing.""" num = pageUrl.split('/')[-1] ext = imageUrl.rsplit('.', 1)[1] return "thethinhline-%s.%s" % (num, ext)
[ "def", "namer", "(", "cls", ",", "imageUrl", ",", "pageUrl", ")", ":", "num", "=", "pageUrl", ".", "split", "(", "'/'", ")", "[", "-", "1", "]", "ext", "=", "imageUrl", ".", "rsplit", "(", "'.'", ",", "1", ")", "[", "1", "]", "return", "\"theth...
Use page URL sequence which is apparently increasing.
[ "Use", "page", "URL", "sequence", "which", "is", "apparently", "increasing", "." ]
a0109c3a46219f280e6e5e77183674e40da0f304
https://github.com/wummel/dosage/blob/a0109c3a46219f280e6e5e77183674e40da0f304/dosagelib/plugins/t.py#L185-L189
53,866
haikuginger/beekeeper
beekeeper/comms.py
download_as_json
def download_as_json(url): """ Download the data at the URL and load it as JSON """ try: return Response('application/json', request(url=url)).read() except HTTPError as err: raise ResponseException('application/json', err)
python
def download_as_json(url): """ Download the data at the URL and load it as JSON """ try: return Response('application/json', request(url=url)).read() except HTTPError as err: raise ResponseException('application/json', err)
[ "def", "download_as_json", "(", "url", ")", ":", "try", ":", "return", "Response", "(", "'application/json'", ",", "request", "(", "url", "=", "url", ")", ")", ".", "read", "(", ")", "except", "HTTPError", "as", "err", ":", "raise", "ResponseException", ...
Download the data at the URL and load it as JSON
[ "Download", "the", "data", "at", "the", "URL", "and", "load", "it", "as", "JSON" ]
b647d3add0b407ec5dc3a2a39c4f6dac31243b18
https://github.com/haikuginger/beekeeper/blob/b647d3add0b407ec5dc3a2a39c4f6dac31243b18/beekeeper/comms.py#L48-L55
53,867
haikuginger/beekeeper
beekeeper/comms.py
request
def request(*args, **kwargs): """ Make a request with the received arguments and return an HTTPResponse object """ timeout = kwargs.pop('timeout', 5) req = PythonRequest(*args, **kwargs) return REQUEST_OPENER.open(req, timeout=timeout)
python
def request(*args, **kwargs): """ Make a request with the received arguments and return an HTTPResponse object """ timeout = kwargs.pop('timeout', 5) req = PythonRequest(*args, **kwargs) return REQUEST_OPENER.open(req, timeout=timeout)
[ "def", "request", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "timeout", "=", "kwargs", ".", "pop", "(", "'timeout'", ",", "5", ")", "req", "=", "PythonRequest", "(", "*", "args", ",", "*", "*", "kwargs", ")", "return", "REQUEST_OPENER", "...
Make a request with the received arguments and return an HTTPResponse object
[ "Make", "a", "request", "with", "the", "received", "arguments", "and", "return", "an", "HTTPResponse", "object" ]
b647d3add0b407ec5dc3a2a39c4f6dac31243b18
https://github.com/haikuginger/beekeeper/blob/b647d3add0b407ec5dc3a2a39c4f6dac31243b18/beekeeper/comms.py#L57-L64
53,868
haikuginger/beekeeper
beekeeper/comms.py
Request.send
def send(self, **kwargs): """ Send the request defined by the data stored in the object. """ return_full_object = kwargs.get('return_full_object', False) _verbose = kwargs.get('_verbose', False) traversal = kwargs.get('traversal', None) timeout = kwargs.get('_time...
python
def send(self, **kwargs): """ Send the request defined by the data stored in the object. """ return_full_object = kwargs.get('return_full_object', False) _verbose = kwargs.get('_verbose', False) traversal = kwargs.get('traversal', None) timeout = kwargs.get('_time...
[ "def", "send", "(", "self", ",", "*", "*", "kwargs", ")", ":", "return_full_object", "=", "kwargs", ".", "get", "(", "'return_full_object'", ",", "False", ")", "_verbose", "=", "kwargs", ".", "get", "(", "'_verbose'", ",", "False", ")", "traversal", "=",...
Send the request defined by the data stored in the object.
[ "Send", "the", "request", "defined", "by", "the", "data", "stored", "in", "the", "object", "." ]
b647d3add0b407ec5dc3a2a39c4f6dac31243b18
https://github.com/haikuginger/beekeeper/blob/b647d3add0b407ec5dc3a2a39c4f6dac31243b18/beekeeper/comms.py#L86-L111
53,869
haikuginger/beekeeper
beekeeper/comms.py
Request.render_url
def render_url(self): """ Render the final URL based on available variables """ url = self.url.format(**self.replacements) if self.params: return url + '?' + urlencode(self.params) return url
python
def render_url(self): """ Render the final URL based on available variables """ url = self.url.format(**self.replacements) if self.params: return url + '?' + urlencode(self.params) return url
[ "def", "render_url", "(", "self", ")", ":", "url", "=", "self", ".", "url", ".", "format", "(", "*", "*", "self", ".", "replacements", ")", "if", "self", ".", "params", ":", "return", "url", "+", "'?'", "+", "urlencode", "(", "self", ".", "params",...
Render the final URL based on available variables
[ "Render", "the", "final", "URL", "based", "on", "available", "variables" ]
b647d3add0b407ec5dc3a2a39c4f6dac31243b18
https://github.com/haikuginger/beekeeper/blob/b647d3add0b407ec5dc3a2a39c4f6dac31243b18/beekeeper/comms.py#L128-L135
53,870
haikuginger/beekeeper
beekeeper/comms.py
Response.mimetype
def mimetype(self): """ Get the Content-Type header from the response. Strip the ";charset=xxxxx" portion if necessary. If we can't find it, use the predefined format. """ if ';' in self.headers.get('Content-Type', ''): return self.headers['Content-Type'].spli...
python
def mimetype(self): """ Get the Content-Type header from the response. Strip the ";charset=xxxxx" portion if necessary. If we can't find it, use the predefined format. """ if ';' in self.headers.get('Content-Type', ''): return self.headers['Content-Type'].spli...
[ "def", "mimetype", "(", "self", ")", ":", "if", "';'", "in", "self", ".", "headers", ".", "get", "(", "'Content-Type'", ",", "''", ")", ":", "return", "self", ".", "headers", "[", "'Content-Type'", "]", ".", "split", "(", "';'", ")", "[", "0", "]",...
Get the Content-Type header from the response. Strip the ";charset=xxxxx" portion if necessary. If we can't find it, use the predefined format.
[ "Get", "the", "Content", "-", "Type", "header", "from", "the", "response", ".", "Strip", "the", ";", "charset", "=", "xxxxx", "portion", "if", "necessary", ".", "If", "we", "can", "t", "find", "it", "use", "the", "predefined", "format", "." ]
b647d3add0b407ec5dc3a2a39c4f6dac31243b18
https://github.com/haikuginger/beekeeper/blob/b647d3add0b407ec5dc3a2a39c4f6dac31243b18/beekeeper/comms.py#L152-L160
53,871
haikuginger/beekeeper
beekeeper/comms.py
Response.read
def read(self, raw=False, perform_traversal=True): """ Parse the body of the response using the Content-Type header we pulled from the response, or the hive-defined format, if such couldn't be pulled automatically. """ if not raw: response_body = decode(self.d...
python
def read(self, raw=False, perform_traversal=True): """ Parse the body of the response using the Content-Type header we pulled from the response, or the hive-defined format, if such couldn't be pulled automatically. """ if not raw: response_body = decode(self.d...
[ "def", "read", "(", "self", ",", "raw", "=", "False", ",", "perform_traversal", "=", "True", ")", ":", "if", "not", "raw", ":", "response_body", "=", "decode", "(", "self", ".", "data", ",", "self", ".", "mimetype", "(", ")", ",", "encoding", "=", ...
Parse the body of the response using the Content-Type header we pulled from the response, or the hive-defined format, if such couldn't be pulled automatically.
[ "Parse", "the", "body", "of", "the", "response", "using", "the", "Content", "-", "Type", "header", "we", "pulled", "from", "the", "response", "or", "the", "hive", "-", "defined", "format", "if", "such", "couldn", "t", "be", "pulled", "automatically", "." ]
b647d3add0b407ec5dc3a2a39c4f6dac31243b18
https://github.com/haikuginger/beekeeper/blob/b647d3add0b407ec5dc3a2a39c4f6dac31243b18/beekeeper/comms.py#L171-L183
53,872
danpoland/pyramid-restful-framework
pyramid_restful/generics.py
GenericAPIView.get_schema
def get_schema(self, *args, **kwargs): """ Return the schema instance that should be used for validating and deserializing input, and for serializing output. """ klass = self.get_schema_class() # kwargs context value take precedence. kwargs['context'] = dict( ...
python
def get_schema(self, *args, **kwargs): """ Return the schema instance that should be used for validating and deserializing input, and for serializing output. """ klass = self.get_schema_class() # kwargs context value take precedence. kwargs['context'] = dict( ...
[ "def", "get_schema", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "klass", "=", "self", ".", "get_schema_class", "(", ")", "# kwargs context value take precedence.", "kwargs", "[", "'context'", "]", "=", "dict", "(", "self", ".", "get_...
Return the schema instance that should be used for validating and deserializing input, and for serializing output.
[ "Return", "the", "schema", "instance", "that", "should", "be", "used", "for", "validating", "and", "deserializing", "input", "and", "for", "serializing", "output", "." ]
4d8c9db44b1869c3d1fdd59ca304c3166473fcbb
https://github.com/danpoland/pyramid-restful-framework/blob/4d8c9db44b1869c3d1fdd59ca304c3166473fcbb/pyramid_restful/generics.py#L108-L122
53,873
danpoland/pyramid-restful-framework
pyramid_restful/generics.py
GenericAPIView.filter_query
def filter_query(self, query): """ Filter the given query using the filter classes specified on the view if any are specified. """ for filter_class in list(self.filter_classes): query = filter_class().filter_query(self.request, query, self) return query
python
def filter_query(self, query): """ Filter the given query using the filter classes specified on the view if any are specified. """ for filter_class in list(self.filter_classes): query = filter_class().filter_query(self.request, query, self) return query
[ "def", "filter_query", "(", "self", ",", "query", ")", ":", "for", "filter_class", "in", "list", "(", "self", ".", "filter_classes", ")", ":", "query", "=", "filter_class", "(", ")", ".", "filter_query", "(", "self", ".", "request", ",", "query", ",", ...
Filter the given query using the filter classes specified on the view if any are specified.
[ "Filter", "the", "given", "query", "using", "the", "filter", "classes", "specified", "on", "the", "view", "if", "any", "are", "specified", "." ]
4d8c9db44b1869c3d1fdd59ca304c3166473fcbb
https://github.com/danpoland/pyramid-restful-framework/blob/4d8c9db44b1869c3d1fdd59ca304c3166473fcbb/pyramid_restful/generics.py#L124-L132
53,874
danpoland/pyramid-restful-framework
pyramid_restful/generics.py
GenericAPIView.paginate_query
def paginate_query(self, query): """ Return single page of results or `None` if pagination is disabled. """ if self.paginator is None: return None return self.paginator.paginate_query(query, self.request)
python
def paginate_query(self, query): """ Return single page of results or `None` if pagination is disabled. """ if self.paginator is None: return None return self.paginator.paginate_query(query, self.request)
[ "def", "paginate_query", "(", "self", ",", "query", ")", ":", "if", "self", ".", "paginator", "is", "None", ":", "return", "None", "return", "self", ".", "paginator", ".", "paginate_query", "(", "query", ",", "self", ".", "request", ")" ]
Return single page of results or `None` if pagination is disabled.
[ "Return", "single", "page", "of", "results", "or", "None", "if", "pagination", "is", "disabled", "." ]
4d8c9db44b1869c3d1fdd59ca304c3166473fcbb
https://github.com/danpoland/pyramid-restful-framework/blob/4d8c9db44b1869c3d1fdd59ca304c3166473fcbb/pyramid_restful/generics.py#L148-L156
53,875
synw/dataswim
dataswim/data/clean.py
Clean.drop_nan
def drop_nan(self, col: str=None, method: str="all", **kwargs): """ Drop rows with NaN values from the main dataframe :param col: name of the column, defaults to None. Drops in ...
python
def drop_nan(self, col: str=None, method: str="all", **kwargs): """ Drop rows with NaN values from the main dataframe :param col: name of the column, defaults to None. Drops in ...
[ "def", "drop_nan", "(", "self", ",", "col", ":", "str", "=", "None", ",", "method", ":", "str", "=", "\"all\"", ",", "*", "*", "kwargs", ")", ":", "try", ":", "if", "col", "is", "None", ":", "self", ".", "df", "=", "self", ".", "df", ".", "dr...
Drop rows with NaN values from the main dataframe :param col: name of the column, defaults to None. Drops in a...
[ "Drop", "rows", "with", "NaN", "values", "from", "the", "main", "dataframe" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/clean.py#L15-L35
53,876
synw/dataswim
dataswim/data/clean.py
Clean.nan_empty
def nan_empty(self, col: str): """ Fill empty values with NaN values :param col: name of the colum :type col: str :example: ``ds.nan_empty("mycol")`` """ try: self.df[col] = self.df[col].replace('', nan) self.ok("Filled empty values with ...
python
def nan_empty(self, col: str): """ Fill empty values with NaN values :param col: name of the colum :type col: str :example: ``ds.nan_empty("mycol")`` """ try: self.df[col] = self.df[col].replace('', nan) self.ok("Filled empty values with ...
[ "def", "nan_empty", "(", "self", ",", "col", ":", "str", ")", ":", "try", ":", "self", ".", "df", "[", "col", "]", "=", "self", ".", "df", "[", "col", "]", ".", "replace", "(", "''", ",", "nan", ")", "self", ".", "ok", "(", "\"Filled empty valu...
Fill empty values with NaN values :param col: name of the colum :type col: str :example: ``ds.nan_empty("mycol")``
[ "Fill", "empty", "values", "with", "NaN", "values" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/clean.py#L37-L50
53,877
synw/dataswim
dataswim/data/clean.py
Clean.zero_nan
def zero_nan(self, *cols): """ Converts zero values to nan values in selected columns :param \*cols: names of the colums :type \*cols: str, at least one :example: ``ds.zero_nan("mycol1", "mycol2")`` """ if len(cols) == 0: self.warning("Can not nan ze...
python
def zero_nan(self, *cols): """ Converts zero values to nan values in selected columns :param \*cols: names of the colums :type \*cols: str, at least one :example: ``ds.zero_nan("mycol1", "mycol2")`` """ if len(cols) == 0: self.warning("Can not nan ze...
[ "def", "zero_nan", "(", "self", ",", "*", "cols", ")", ":", "if", "len", "(", "cols", ")", "==", "0", ":", "self", ".", "warning", "(", "\"Can not nan zero values if a column name \"", "\"is not provided\"", ")", "df", "=", "self", ".", "_zero_nan", "(", "...
Converts zero values to nan values in selected columns :param \*cols: names of the colums :type \*cols: str, at least one :example: ``ds.zero_nan("mycol1", "mycol2")``
[ "Converts", "zero", "values", "to", "nan", "values", "in", "selected", "columns" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/clean.py#L52-L68
53,878
synw/dataswim
dataswim/data/clean.py
Clean.fill_nan
def fill_nan(self, val: str, *cols): """ Fill NaN values with new values in the main dataframe :param val: new value :type val: str :param \*cols: names of the colums :type \*cols: str, at least one :example: ``ds.fill_nan("new value", "mycol1", "mycol2")`` ...
python
def fill_nan(self, val: str, *cols): """ Fill NaN values with new values in the main dataframe :param val: new value :type val: str :param \*cols: names of the colums :type \*cols: str, at least one :example: ``ds.fill_nan("new value", "mycol1", "mycol2")`` ...
[ "def", "fill_nan", "(", "self", ",", "val", ":", "str", ",", "*", "cols", ")", ":", "df", "=", "self", ".", "_fill_nan", "(", "val", ",", "*", "cols", ")", "if", "df", "is", "not", "None", ":", "self", ".", "df", "=", "df", "else", ":", "self...
Fill NaN values with new values in the main dataframe :param val: new value :type val: str :param \*cols: names of the colums :type \*cols: str, at least one :example: ``ds.fill_nan("new value", "mycol1", "mycol2")``
[ "Fill", "NaN", "values", "with", "new", "values", "in", "the", "main", "dataframe" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/clean.py#L88-L103
53,879
synw/dataswim
dataswim/data/clean.py
Clean.fill_nulls
def fill_nulls(self, col: str): """ Fill all null values with NaN values in a column. Null values are ``None`` or en empty string :param col: column name :type col: str :example: ``ds.fill_nulls("mycol")`` """ n = [None, ""] try: self...
python
def fill_nulls(self, col: str): """ Fill all null values with NaN values in a column. Null values are ``None`` or en empty string :param col: column name :type col: str :example: ``ds.fill_nulls("mycol")`` """ n = [None, ""] try: self...
[ "def", "fill_nulls", "(", "self", ",", "col", ":", "str", ")", ":", "n", "=", "[", "None", ",", "\"\"", "]", "try", ":", "self", ".", "df", "[", "col", "]", "=", "self", ".", "df", "[", "col", "]", ".", "replace", "(", "n", ",", "nan", ")",...
Fill all null values with NaN values in a column. Null values are ``None`` or en empty string :param col: column name :type col: str :example: ``ds.fill_nulls("mycol")``
[ "Fill", "all", "null", "values", "with", "NaN", "values", "in", "a", "column", ".", "Null", "values", "are", "None", "or", "en", "empty", "string" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/clean.py#L124-L138
53,880
synw/dataswim
dataswim/data/clean.py
Clean.to_int
def to_int(self, *cols, **kwargs): """ Convert some column values to integers :param \*cols: names of the colums :type \*cols: str, at least one :param \*\*kwargs: keyword arguments for ``pd.to_numeric`` :type \*\*kwargs: optional :example: ``ds.to_int("mycol1",...
python
def to_int(self, *cols, **kwargs): """ Convert some column values to integers :param \*cols: names of the colums :type \*cols: str, at least one :param \*\*kwargs: keyword arguments for ``pd.to_numeric`` :type \*\*kwargs: optional :example: ``ds.to_int("mycol1",...
[ "def", "to_int", "(", "self", ",", "*", "cols", ",", "*", "*", "kwargs", ")", ":", "try", ":", "for", "col", "in", "cols", ":", "self", ".", "df", "[", "col", "]", "=", "pd", ".", "to_numeric", "(", "self", ".", "df", "[", "col", "]", ",", ...
Convert some column values to integers :param \*cols: names of the colums :type \*cols: str, at least one :param \*\*kwargs: keyword arguments for ``pd.to_numeric`` :type \*\*kwargs: optional :example: ``ds.to_int("mycol1", "mycol2", errors="coerce")``
[ "Convert", "some", "column", "values", "to", "integers" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/clean.py#L140-L157
53,881
synw/dataswim
dataswim/data/clean.py
Clean.to_float
def to_float(self, col: str, **kwargs): """ Convert colums values to float :param col: name of the colum :type col: str, at least one :param \*\*kwargs: keyword arguments for ``df.astype`` :type \*\*kwargs: optional :example: ``ds.to_float("mycol1")`` ""...
python
def to_float(self, col: str, **kwargs): """ Convert colums values to float :param col: name of the colum :type col: str, at least one :param \*\*kwargs: keyword arguments for ``df.astype`` :type \*\*kwargs: optional :example: ``ds.to_float("mycol1")`` ""...
[ "def", "to_float", "(", "self", ",", "col", ":", "str", ",", "*", "*", "kwargs", ")", ":", "try", ":", "self", ".", "df", "[", "col", "]", "=", "self", ".", "df", "[", "col", "]", ".", "astype", "(", "np", ".", "float64", ",", "*", "*", "kw...
Convert colums values to float :param col: name of the colum :type col: str, at least one :param \*\*kwargs: keyword arguments for ``df.astype`` :type \*\*kwargs: optional :example: ``ds.to_float("mycol1")``
[ "Convert", "colums", "values", "to", "float" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/clean.py#L159-L174
53,882
synw/dataswim
dataswim/data/clean.py
Clean.to_type
def to_type(self, dtype: type, *cols, **kwargs): """ Convert colums values to a given type in the main dataframe :param dtype: a type to convert to: ex: ``str`` :type dtype: type :param \*cols: names of the colums :type \*cols: str, at least one :param \...
python
def to_type(self, dtype: type, *cols, **kwargs): """ Convert colums values to a given type in the main dataframe :param dtype: a type to convert to: ex: ``str`` :type dtype: type :param \*cols: names of the colums :type \*cols: str, at least one :param \...
[ "def", "to_type", "(", "self", ",", "dtype", ":", "type", ",", "*", "cols", ",", "*", "*", "kwargs", ")", ":", "try", ":", "allcols", "=", "self", ".", "df", ".", "columns", ".", "values", "for", "col", "in", "cols", ":", "if", "col", "not", "i...
Convert colums values to a given type in the main dataframe :param dtype: a type to convert to: ex: ``str`` :type dtype: type :param \*cols: names of the colums :type \*cols: str, at least one :param \*\*kwargs: keyword arguments for ``df.astype`` :type \*\*kwar...
[ "Convert", "colums", "values", "to", "a", "given", "type", "in", "the", "main", "dataframe" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/clean.py#L176-L198
53,883
synw/dataswim
dataswim/data/clean.py
Clean.fdate
def fdate(self, *cols, precision: str="S", format: str=None): """ Convert column values to formated date string :param \*cols: names of the colums :type \*cols: str, at least one :param precision: time precision: Y, M, D, H, Min S, defaults to "S" :type precision: str, o...
python
def fdate(self, *cols, precision: str="S", format: str=None): """ Convert column values to formated date string :param \*cols: names of the colums :type \*cols: str, at least one :param precision: time precision: Y, M, D, H, Min S, defaults to "S" :type precision: str, o...
[ "def", "fdate", "(", "self", ",", "*", "cols", ",", "precision", ":", "str", "=", "\"S\"", ",", "format", ":", "str", "=", "None", ")", ":", "def", "formatdate", "(", "row", ")", ":", "return", "row", ".", "strftime", "(", "format", ")", "def", "...
Convert column values to formated date string :param \*cols: names of the colums :type \*cols: str, at least one :param precision: time precision: Y, M, D, H, Min S, defaults to "S" :type precision: str, optional :param format: python date format, defaults to None :type ...
[ "Convert", "column", "values", "to", "formated", "date", "string" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/clean.py#L200-L246
53,884
synw/dataswim
dataswim/data/clean.py
Clean.timestamps
def timestamps(self, col: str, **kwargs): """" Add a timestamps column from a date column :param col: name of the timestamps column to add :type col: str :param \*\*kwargs: keyword arguments for ``pd.to_datetime`` ...
python
def timestamps(self, col: str, **kwargs): """" Add a timestamps column from a date column :param col: name of the timestamps column to add :type col: str :param \*\*kwargs: keyword arguments for ``pd.to_datetime`` ...
[ "def", "timestamps", "(", "self", ",", "col", ":", "str", ",", "*", "*", "kwargs", ")", ":", "try", ":", "name", "=", "\"Timestamps\"", "if", "\"name\"", "in", "kwargs", ":", "name", "=", "kwargs", "[", "\"name\"", "]", "if", "\"errors\"", "not", "in...
Add a timestamps column from a date column :param col: name of the timestamps column to add :type col: str :param \*\*kwargs: keyword arguments for ``pd.to_datetime`` ...
[ "Add", "a", "timestamps", "column", "from", "a", "date", "column" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/clean.py#L248-L277
53,885
synw/dataswim
dataswim/data/clean.py
Clean.date
def date(self, col: str, **kwargs): """ Convert a column to date type :param col: column name :type col: str :param \*\*kwargs: keyword arguments for ``pd.to_datetime`` :type \*\*kwargs: optional :example: ``ds.date("mycol")`` """ try: ...
python
def date(self, col: str, **kwargs): """ Convert a column to date type :param col: column name :type col: str :param \*\*kwargs: keyword arguments for ``pd.to_datetime`` :type \*\*kwargs: optional :example: ``ds.date("mycol")`` """ try: ...
[ "def", "date", "(", "self", ",", "col", ":", "str", ",", "*", "*", "kwargs", ")", ":", "try", ":", "self", ".", "df", "[", "col", "]", "=", "pd", ".", "to_datetime", "(", "self", ".", "df", "[", "col", "]", ",", "*", "*", "kwargs", ")", "ex...
Convert a column to date type :param col: column name :type col: str :param \*\*kwargs: keyword arguments for ``pd.to_datetime`` :type \*\*kwargs: optional :example: ``ds.date("mycol")``
[ "Convert", "a", "column", "to", "date", "type" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/clean.py#L279-L293
53,886
synw/dataswim
dataswim/data/clean.py
Clean.dateindex
def dateindex(self, col: str): """ Set a datetime index from a column :param col: column name where to index the date from :type col: str :example: ``ds.dateindex("mycol")`` """ df = self._dateindex(col) if df is None: self.err("Can not creat...
python
def dateindex(self, col: str): """ Set a datetime index from a column :param col: column name where to index the date from :type col: str :example: ``ds.dateindex("mycol")`` """ df = self._dateindex(col) if df is None: self.err("Can not creat...
[ "def", "dateindex", "(", "self", ",", "col", ":", "str", ")", ":", "df", "=", "self", ".", "_dateindex", "(", "col", ")", "if", "df", "is", "None", ":", "self", ".", "err", "(", "\"Can not create date index\"", ")", "return", "self", ".", "df", "=", ...
Set a datetime index from a column :param col: column name where to index the date from :type col: str :example: ``ds.dateindex("mycol")``
[ "Set", "a", "datetime", "index", "from", "a", "column" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/clean.py#L295-L309
53,887
synw/dataswim
dataswim/data/clean.py
Clean.index
def index(self, col: str): """ Set an index to the main dataframe :param col: column name where to index from :type col: str :example: ``ds.index("mycol")`` """ df = self._index(col) if df is None: self.err("Can not create index") ...
python
def index(self, col: str): """ Set an index to the main dataframe :param col: column name where to index from :type col: str :example: ``ds.index("mycol")`` """ df = self._index(col) if df is None: self.err("Can not create index") ...
[ "def", "index", "(", "self", ",", "col", ":", "str", ")", ":", "df", "=", "self", ".", "_index", "(", "col", ")", "if", "df", "is", "None", ":", "self", ".", "err", "(", "\"Can not create index\"", ")", "return", "self", ".", "df", "=", "df" ]
Set an index to the main dataframe :param col: column name where to index from :type col: str :example: ``ds.index("mycol")``
[ "Set", "an", "index", "to", "the", "main", "dataframe" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/clean.py#L320-L333
53,888
synw/dataswim
dataswim/data/clean.py
Clean.strip
def strip(self, col: str): """ Remove leading and trailing white spaces in a column's values :param col: name of the column :type col: str :example: ``ds.strip("mycol")`` """ def remove_ws(row): val = str(row[col]) if " " in val.startswit...
python
def strip(self, col: str): """ Remove leading and trailing white spaces in a column's values :param col: name of the column :type col: str :example: ``ds.strip("mycol")`` """ def remove_ws(row): val = str(row[col]) if " " in val.startswit...
[ "def", "strip", "(", "self", ",", "col", ":", "str", ")", ":", "def", "remove_ws", "(", "row", ")", ":", "val", "=", "str", "(", "row", "[", "col", "]", ")", "if", "\" \"", "in", "val", ".", "startswith", "(", "\" \"", ")", ":", "row", "[", "...
Remove leading and trailing white spaces in a column's values :param col: name of the column :type col: str :example: ``ds.strip("mycol")``
[ "Remove", "leading", "and", "trailing", "white", "spaces", "in", "a", "column", "s", "values" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/clean.py#L345-L365
53,889
synw/dataswim
dataswim/data/clean.py
Clean.strip_cols
def strip_cols(self): """ Remove leading and trailing white spaces in columns names :example: ``ds.strip_cols()`` """ cols = {} skipped = [] for col in self.df.columns.values: try: cols[col] = col.strip() except Exception: ...
python
def strip_cols(self): """ Remove leading and trailing white spaces in columns names :example: ``ds.strip_cols()`` """ cols = {} skipped = [] for col in self.df.columns.values: try: cols[col] = col.strip() except Exception: ...
[ "def", "strip_cols", "(", "self", ")", ":", "cols", "=", "{", "}", "skipped", "=", "[", "]", "for", "col", "in", "self", ".", "df", ".", "columns", ".", "values", ":", "try", ":", "cols", "[", "col", "]", "=", "col", ".", "strip", "(", ")", "...
Remove leading and trailing white spaces in columns names :example: ``ds.strip_cols()``
[ "Remove", "leading", "and", "trailing", "white", "spaces", "in", "columns", "names" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/clean.py#L367-L384
53,890
synw/dataswim
dataswim/data/clean.py
Clean.roundvals
def roundvals(self, col: str, precision: int=2): """ Round floats in a column. Numbers are going to be converted to floats if they are not already :param col: column name :type col: str :param precision: float precision, defaults to 2 :param precision: int, optio...
python
def roundvals(self, col: str, precision: int=2): """ Round floats in a column. Numbers are going to be converted to floats if they are not already :param col: column name :type col: str :param precision: float precision, defaults to 2 :param precision: int, optio...
[ "def", "roundvals", "(", "self", ",", "col", ":", "str", ",", "precision", ":", "int", "=", "2", ")", ":", "try", ":", "self", ".", "df", "[", "col", "]", "=", "self", ".", "df", "[", "col", "]", ".", "astype", "(", "\"float64\"", ")", "self", ...
Round floats in a column. Numbers are going to be converted to floats if they are not already :param col: column name :type col: str :param precision: float precision, defaults to 2 :param precision: int, optional :example: ``ds.roundvals("mycol")``
[ "Round", "floats", "in", "a", "column", ".", "Numbers", "are", "going", "to", "be", "converted", "to", "floats", "if", "they", "are", "not", "already" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/clean.py#L386-L404
53,891
synw/dataswim
dataswim/data/clean.py
Clean.replace
def replace(self, col: str, searchval: str, replaceval: str): """ Replace a value in a column in the main dataframe :param col: column name :type col: str :param searchval: value to replace :type searchval: str :param replaceval: new value :type replaceva...
python
def replace(self, col: str, searchval: str, replaceval: str): """ Replace a value in a column in the main dataframe :param col: column name :type col: str :param searchval: value to replace :type searchval: str :param replaceval: new value :type replaceva...
[ "def", "replace", "(", "self", ",", "col", ":", "str", ",", "searchval", ":", "str", ",", "replaceval", ":", "str", ")", ":", "try", ":", "self", ".", "df", "[", "col", "]", "=", "self", ".", "df", "[", "col", "]", ".", "replace", "(", "searchv...
Replace a value in a column in the main dataframe :param col: column name :type col: str :param searchval: value to replace :type searchval: str :param replaceval: new value :type replaceval: str :example: ``ds.replace("mycol", "value", "new_value")``
[ "Replace", "a", "value", "in", "a", "column", "in", "the", "main", "dataframe" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/clean.py#L406-L422
53,892
ojii/django-multilingual-ng
multilingual/query.py
MultilingualModelQuerySet.for_language
def for_language(self, language_code): """ Set the default language for all objects returned with this query. """ clone = self._clone() clone._default_language = language_code return clone
python
def for_language(self, language_code): """ Set the default language for all objects returned with this query. """ clone = self._clone() clone._default_language = language_code return clone
[ "def", "for_language", "(", "self", ",", "language_code", ")", ":", "clone", "=", "self", ".", "_clone", "(", ")", "clone", ".", "_default_language", "=", "language_code", "return", "clone" ]
Set the default language for all objects returned with this query.
[ "Set", "the", "default", "language", "for", "all", "objects", "returned", "with", "this", "query", "." ]
0d320a0732ec59949380d4b5f21e153174d3ecf7
https://github.com/ojii/django-multilingual-ng/blob/0d320a0732ec59949380d4b5f21e153174d3ecf7/multilingual/query.py#L537-L544
53,893
ojii/django-multilingual-ng
multilingual/query.py
MultilingualModelQuerySet.iterator
def iterator(self): """ Add the default language information to all returned objects. """ default_language = getattr(self, '_default_language', None) for obj in super(MultilingualModelQuerySet, self).iterator(): obj._default_language = default_language yie...
python
def iterator(self): """ Add the default language information to all returned objects. """ default_language = getattr(self, '_default_language', None) for obj in super(MultilingualModelQuerySet, self).iterator(): obj._default_language = default_language yie...
[ "def", "iterator", "(", "self", ")", ":", "default_language", "=", "getattr", "(", "self", ",", "'_default_language'", ",", "None", ")", "for", "obj", "in", "super", "(", "MultilingualModelQuerySet", ",", "self", ")", ".", "iterator", "(", ")", ":", "obj",...
Add the default language information to all returned objects.
[ "Add", "the", "default", "language", "information", "to", "all", "returned", "objects", "." ]
0d320a0732ec59949380d4b5f21e153174d3ecf7
https://github.com/ojii/django-multilingual-ng/blob/0d320a0732ec59949380d4b5f21e153174d3ecf7/multilingual/query.py#L546-L553
53,894
ojii/django-multilingual-ng
multilingual/query.py
MultilingualModelQuerySet._clone
def _clone(self, klass=None, **kwargs): """ Override _clone to preserve additional information needed by MultilingualModelQuerySet. """ clone = super(MultilingualModelQuerySet, self)._clone(klass, **kwargs) clone._default_language = getattr(self, '_default_language', None...
python
def _clone(self, klass=None, **kwargs): """ Override _clone to preserve additional information needed by MultilingualModelQuerySet. """ clone = super(MultilingualModelQuerySet, self)._clone(klass, **kwargs) clone._default_language = getattr(self, '_default_language', None...
[ "def", "_clone", "(", "self", ",", "klass", "=", "None", ",", "*", "*", "kwargs", ")", ":", "clone", "=", "super", "(", "MultilingualModelQuerySet", ",", "self", ")", ".", "_clone", "(", "klass", ",", "*", "*", "kwargs", ")", "clone", ".", "_default_...
Override _clone to preserve additional information needed by MultilingualModelQuerySet.
[ "Override", "_clone", "to", "preserve", "additional", "information", "needed", "by", "MultilingualModelQuerySet", "." ]
0d320a0732ec59949380d4b5f21e153174d3ecf7
https://github.com/ojii/django-multilingual-ng/blob/0d320a0732ec59949380d4b5f21e153174d3ecf7/multilingual/query.py#L555-L562
53,895
Seeed-Studio/wio-cli
wio/commands/cmd_config.py
cli
def cli(wio, get_debug, debug): ''' Change setting of device. \b DOES: The config command lets you change setting of device through upd. 1. Ensure your device is Configure Mode. 2. Change your computer network to Wio's AP. \b EXAMPLE: wio config --debug [on|off]...
python
def cli(wio, get_debug, debug): ''' Change setting of device. \b DOES: The config command lets you change setting of device through upd. 1. Ensure your device is Configure Mode. 2. Change your computer network to Wio's AP. \b EXAMPLE: wio config --debug [on|off]...
[ "def", "cli", "(", "wio", ",", "get_debug", ",", "debug", ")", ":", "if", "debug", ":", "if", "debug", "==", "\"on\"", ":", "cmd", "=", "\"ENDEBUG: 1\"", "elif", "debug", "==", "\"off\"", ":", "cmd", "=", "\"ENDEBUG: 0\"", "if", "not", "cmd", ":", "r...
Change setting of device. \b DOES: The config command lets you change setting of device through upd. 1. Ensure your device is Configure Mode. 2. Change your computer network to Wio's AP. \b EXAMPLE: wio config --debug [on|off], enable/disable wio debug wio confi...
[ "Change", "setting", "of", "device", "." ]
ce83f4c2d30be7f72d1a128acd123dfc5effa563
https://github.com/Seeed-Studio/wio-cli/blob/ce83f4c2d30be7f72d1a128acd123dfc5effa563/wio/commands/cmd_config.py#L14-L61
53,896
synw/dataswim
dataswim/data/select.py
Select.first_
def first_(self): """ Select the first row """ try: val = self.df.iloc[0] return val except Exception as e: self.err(e, "Can not select first row")
python
def first_(self): """ Select the first row """ try: val = self.df.iloc[0] return val except Exception as e: self.err(e, "Can not select first row")
[ "def", "first_", "(", "self", ")", ":", "try", ":", "val", "=", "self", ".", "df", ".", "iloc", "[", "0", "]", "return", "val", "except", "Exception", "as", "e", ":", "self", ".", "err", "(", "e", ",", "\"Can not select first row\"", ")" ]
Select the first row
[ "Select", "the", "first", "row" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/select.py#L13-L21
53,897
synw/dataswim
dataswim/data/select.py
Select.limit
def limit(self, r=5): """ Limit selection to a range in the main dataframe """ try: self.df = self.df[:r] except Exception as e: self.err(e, "Can not limit data")
python
def limit(self, r=5): """ Limit selection to a range in the main dataframe """ try: self.df = self.df[:r] except Exception as e: self.err(e, "Can not limit data")
[ "def", "limit", "(", "self", ",", "r", "=", "5", ")", ":", "try", ":", "self", ".", "df", "=", "self", ".", "df", "[", ":", "r", "]", "except", "Exception", "as", "e", ":", "self", ".", "err", "(", "e", ",", "\"Can not limit data\"", ")" ]
Limit selection to a range in the main dataframe
[ "Limit", "selection", "to", "a", "range", "in", "the", "main", "dataframe" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/select.py#L23-L30
53,898
synw/dataswim
dataswim/data/select.py
Select.limit_
def limit_(self, r=5): """ Returns a DataSwim instance with limited selection """ try: return self._duplicate_(self.df[:r]) except Exception as e: self.err(e, "Can not limit data")
python
def limit_(self, r=5): """ Returns a DataSwim instance with limited selection """ try: return self._duplicate_(self.df[:r]) except Exception as e: self.err(e, "Can not limit data")
[ "def", "limit_", "(", "self", ",", "r", "=", "5", ")", ":", "try", ":", "return", "self", ".", "_duplicate_", "(", "self", ".", "df", "[", ":", "r", "]", ")", "except", "Exception", "as", "e", ":", "self", ".", "err", "(", "e", ",", "\"Can not ...
Returns a DataSwim instance with limited selection
[ "Returns", "a", "DataSwim", "instance", "with", "limited", "selection" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/select.py#L32-L39
53,899
synw/dataswim
dataswim/data/select.py
Select.unique_
def unique_(self, col): """ Returns unique values in a column """ try: df = self.df.drop_duplicates(subset=[col], inplace=False) return list(df[col]) except Exception as e: self.err(e, "Can not select unique data")
python
def unique_(self, col): """ Returns unique values in a column """ try: df = self.df.drop_duplicates(subset=[col], inplace=False) return list(df[col]) except Exception as e: self.err(e, "Can not select unique data")
[ "def", "unique_", "(", "self", ",", "col", ")", ":", "try", ":", "df", "=", "self", ".", "df", ".", "drop_duplicates", "(", "subset", "=", "[", "col", "]", ",", "inplace", "=", "False", ")", "return", "list", "(", "df", "[", "col", "]", ")", "e...
Returns unique values in a column
[ "Returns", "unique", "values", "in", "a", "column" ]
4a4a53f80daa7cd8e8409d76a19ce07296269da2
https://github.com/synw/dataswim/blob/4a4a53f80daa7cd8e8409d76a19ce07296269da2/dataswim/data/select.py#L41-L49