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 listlengths 20 707 | docstring stringlengths 3 17.3k | docstring_tokens listlengths 3 222 | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value | idx int64 0 252k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
kgori/treeCl | treeCl/utils/fileIO.py | freader | def freader(filename, gz=False, bz=False):
""" Returns a filereader object that can handle gzipped input """
filecheck(filename)
if filename.endswith('.gz'):
gz = True
elif filename.endswith('.bz2'):
bz = True
if gz:
return gzip.open(filename, 'rb')
elif bz:
ret... | python | def freader(filename, gz=False, bz=False):
""" Returns a filereader object that can handle gzipped input """
filecheck(filename)
if filename.endswith('.gz'):
gz = True
elif filename.endswith('.bz2'):
bz = True
if gz:
return gzip.open(filename, 'rb')
elif bz:
ret... | [
"def",
"freader",
"(",
"filename",
",",
"gz",
"=",
"False",
",",
"bz",
"=",
"False",
")",
":",
"filecheck",
"(",
"filename",
")",
"if",
"filename",
".",
"endswith",
"(",
"'.gz'",
")",
":",
"gz",
"=",
"True",
"elif",
"filename",
".",
"endswith",
"(",
... | Returns a filereader object that can handle gzipped input | [
"Returns",
"a",
"filereader",
"object",
"that",
"can",
"handle",
"gzipped",
"input"
] | fed624b3db1c19cc07175ca04e3eda6905a8d305 | https://github.com/kgori/treeCl/blob/fed624b3db1c19cc07175ca04e3eda6905a8d305/treeCl/utils/fileIO.py#L132-L146 | train | 63,200 |
kgori/treeCl | treeCl/utils/fileIO.py | fwriter | def fwriter(filename, gz=False, bz=False):
""" Returns a filewriter object that can write plain or gzipped output.
If gzip or bzip2 compression is asked for then the usual filename extension will be added."""
if filename.endswith('.gz'):
gz = True
elif filename.endswith('.bz2'):
bz = Tr... | python | def fwriter(filename, gz=False, bz=False):
""" Returns a filewriter object that can write plain or gzipped output.
If gzip or bzip2 compression is asked for then the usual filename extension will be added."""
if filename.endswith('.gz'):
gz = True
elif filename.endswith('.bz2'):
bz = Tr... | [
"def",
"fwriter",
"(",
"filename",
",",
"gz",
"=",
"False",
",",
"bz",
"=",
"False",
")",
":",
"if",
"filename",
".",
"endswith",
"(",
"'.gz'",
")",
":",
"gz",
"=",
"True",
"elif",
"filename",
".",
"endswith",
"(",
"'.bz2'",
")",
":",
"bz",
"=",
... | Returns a filewriter object that can write plain or gzipped output.
If gzip or bzip2 compression is asked for then the usual filename extension will be added. | [
"Returns",
"a",
"filewriter",
"object",
"that",
"can",
"write",
"plain",
"or",
"gzipped",
"output",
".",
"If",
"gzip",
"or",
"bzip2",
"compression",
"is",
"asked",
"for",
"then",
"the",
"usual",
"filename",
"extension",
"will",
"be",
"added",
"."
] | fed624b3db1c19cc07175ca04e3eda6905a8d305 | https://github.com/kgori/treeCl/blob/fed624b3db1c19cc07175ca04e3eda6905a8d305/treeCl/utils/fileIO.py#L149-L167 | train | 63,201 |
kgori/treeCl | treeCl/utils/fileIO.py | glob_by_extensions | def glob_by_extensions(directory, extensions):
""" Returns files matched by all extensions in the extensions list """
directorycheck(directory)
files = []
xt = files.extend
for ex in extensions:
xt(glob.glob('{0}/*.{1}'.format(directory, ex)))
return files | python | def glob_by_extensions(directory, extensions):
""" Returns files matched by all extensions in the extensions list """
directorycheck(directory)
files = []
xt = files.extend
for ex in extensions:
xt(glob.glob('{0}/*.{1}'.format(directory, ex)))
return files | [
"def",
"glob_by_extensions",
"(",
"directory",
",",
"extensions",
")",
":",
"directorycheck",
"(",
"directory",
")",
"files",
"=",
"[",
"]",
"xt",
"=",
"files",
".",
"extend",
"for",
"ex",
"in",
"extensions",
":",
"xt",
"(",
"glob",
".",
"glob",
"(",
"... | Returns files matched by all extensions in the extensions list | [
"Returns",
"files",
"matched",
"by",
"all",
"extensions",
"in",
"the",
"extensions",
"list"
] | fed624b3db1c19cc07175ca04e3eda6905a8d305 | https://github.com/kgori/treeCl/blob/fed624b3db1c19cc07175ca04e3eda6905a8d305/treeCl/utils/fileIO.py#L170-L177 | train | 63,202 |
kgori/treeCl | treeCl/utils/fileIO.py | head | def head(filename, n=10):
""" prints the top `n` lines of a file """
with freader(filename) as fr:
for _ in range(n):
print(fr.readline().strip()) | python | def head(filename, n=10):
""" prints the top `n` lines of a file """
with freader(filename) as fr:
for _ in range(n):
print(fr.readline().strip()) | [
"def",
"head",
"(",
"filename",
",",
"n",
"=",
"10",
")",
":",
"with",
"freader",
"(",
"filename",
")",
"as",
"fr",
":",
"for",
"_",
"in",
"range",
"(",
"n",
")",
":",
"print",
"(",
"fr",
".",
"readline",
"(",
")",
".",
"strip",
"(",
")",
")"... | prints the top `n` lines of a file | [
"prints",
"the",
"top",
"n",
"lines",
"of",
"a",
"file"
] | fed624b3db1c19cc07175ca04e3eda6905a8d305 | https://github.com/kgori/treeCl/blob/fed624b3db1c19cc07175ca04e3eda6905a8d305/treeCl/utils/fileIO.py#L190-L194 | train | 63,203 |
synw/django-instant | instant/utils.py | channels_for_role | def channels_for_role(role):
"""
Get the channels for a role
"""
chans = []
chans_names = []
# default channels
if role == "public":
if ENABLE_PUBLIC_CHANNEL is True:
chan = dict(slug=PUBLIC_CHANNEL, path=None)
chans.append(chan)
chans_names.append... | python | def channels_for_role(role):
"""
Get the channels for a role
"""
chans = []
chans_names = []
# default channels
if role == "public":
if ENABLE_PUBLIC_CHANNEL is True:
chan = dict(slug=PUBLIC_CHANNEL, path=None)
chans.append(chan)
chans_names.append... | [
"def",
"channels_for_role",
"(",
"role",
")",
":",
"chans",
"=",
"[",
"]",
"chans_names",
"=",
"[",
"]",
"# default channels",
"if",
"role",
"==",
"\"public\"",
":",
"if",
"ENABLE_PUBLIC_CHANNEL",
"is",
"True",
":",
"chan",
"=",
"dict",
"(",
"slug",
"=",
... | Get the channels for a role | [
"Get",
"the",
"channels",
"for",
"a",
"role"
] | 784ab068a7e83f76723763437ecbcc9294ab029a | https://github.com/synw/django-instant/blob/784ab068a7e83f76723763437ecbcc9294ab029a/instant/utils.py#L41-L96 | train | 63,204 |
kgori/treeCl | treeCl/tree.py | ILS.ils | def ils(self, node, sorting_times=None, force_topology_change=True):
"""
A constrained and approximation of ILS using nearest-neighbour interchange
Process
-------
A node with at least three descendents is selected from an ultrametric tree
(node '2', below)
... | python | def ils(self, node, sorting_times=None, force_topology_change=True):
"""
A constrained and approximation of ILS using nearest-neighbour interchange
Process
-------
A node with at least three descendents is selected from an ultrametric tree
(node '2', below)
... | [
"def",
"ils",
"(",
"self",
",",
"node",
",",
"sorting_times",
"=",
"None",
",",
"force_topology_change",
"=",
"True",
")",
":",
"# node = '2', par = '1', gpar = '0' -- in above diagram",
"n_2",
"=",
"node",
"n_1",
"=",
"n_2",
".",
"parent_node",
"if",
"n_1",
"==... | A constrained and approximation of ILS using nearest-neighbour interchange
Process
-------
A node with at least three descendents is selected from an ultrametric tree
(node '2', below)
---0--... ---0--... ---0--...
| | ... | [
"A",
"constrained",
"and",
"approximation",
"of",
"ILS",
"using",
"nearest",
"-",
"neighbour",
"interchange"
] | fed624b3db1c19cc07175ca04e3eda6905a8d305 | https://github.com/kgori/treeCl/blob/fed624b3db1c19cc07175ca04e3eda6905a8d305/treeCl/tree.py#L464-L581 | train | 63,205 |
kgori/treeCl | treeCl/tree.py | Tree.get_inner_edges | def get_inner_edges(self):
""" Returns a list of the internal edges of the tree. """
inner_edges = [e for e in self._tree.preorder_edge_iter() if e.is_internal()
and e.head_node and e.tail_node]
return inner_edges | python | def get_inner_edges(self):
""" Returns a list of the internal edges of the tree. """
inner_edges = [e for e in self._tree.preorder_edge_iter() if e.is_internal()
and e.head_node and e.tail_node]
return inner_edges | [
"def",
"get_inner_edges",
"(",
"self",
")",
":",
"inner_edges",
"=",
"[",
"e",
"for",
"e",
"in",
"self",
".",
"_tree",
".",
"preorder_edge_iter",
"(",
")",
"if",
"e",
".",
"is_internal",
"(",
")",
"and",
"e",
".",
"head_node",
"and",
"e",
".",
"tail_... | Returns a list of the internal edges of the tree. | [
"Returns",
"a",
"list",
"of",
"the",
"internal",
"edges",
"of",
"the",
"tree",
"."
] | fed624b3db1c19cc07175ca04e3eda6905a8d305 | https://github.com/kgori/treeCl/blob/fed624b3db1c19cc07175ca04e3eda6905a8d305/treeCl/tree.py#L897-L901 | train | 63,206 |
kgori/treeCl | treeCl/tree.py | Tree.intersection | def intersection(self, other):
""" Returns the intersection of the taxon sets of two Trees """
taxa1 = self.labels
taxa2 = other.labels
return taxa1 & taxa2 | python | def intersection(self, other):
""" Returns the intersection of the taxon sets of two Trees """
taxa1 = self.labels
taxa2 = other.labels
return taxa1 & taxa2 | [
"def",
"intersection",
"(",
"self",
",",
"other",
")",
":",
"taxa1",
"=",
"self",
".",
"labels",
"taxa2",
"=",
"other",
".",
"labels",
"return",
"taxa1",
"&",
"taxa2"
] | Returns the intersection of the taxon sets of two Trees | [
"Returns",
"the",
"intersection",
"of",
"the",
"taxon",
"sets",
"of",
"two",
"Trees"
] | fed624b3db1c19cc07175ca04e3eda6905a8d305 | https://github.com/kgori/treeCl/blob/fed624b3db1c19cc07175ca04e3eda6905a8d305/treeCl/tree.py#L907-L911 | train | 63,207 |
kgori/treeCl | treeCl/tree.py | Tree.postorder | def postorder(self, skip_seed=False):
"""
Return a generator that yields the nodes of the tree in postorder.
If skip_seed=True then the root node is not included.
"""
for node in self._tree.postorder_node_iter():
if skip_seed and node is self._tree.seed_node:
... | python | def postorder(self, skip_seed=False):
"""
Return a generator that yields the nodes of the tree in postorder.
If skip_seed=True then the root node is not included.
"""
for node in self._tree.postorder_node_iter():
if skip_seed and node is self._tree.seed_node:
... | [
"def",
"postorder",
"(",
"self",
",",
"skip_seed",
"=",
"False",
")",
":",
"for",
"node",
"in",
"self",
".",
"_tree",
".",
"postorder_node_iter",
"(",
")",
":",
"if",
"skip_seed",
"and",
"node",
"is",
"self",
".",
"_tree",
".",
"seed_node",
":",
"conti... | Return a generator that yields the nodes of the tree in postorder.
If skip_seed=True then the root node is not included. | [
"Return",
"a",
"generator",
"that",
"yields",
"the",
"nodes",
"of",
"the",
"tree",
"in",
"postorder",
".",
"If",
"skip_seed",
"=",
"True",
"then",
"the",
"root",
"node",
"is",
"not",
"included",
"."
] | fed624b3db1c19cc07175ca04e3eda6905a8d305 | https://github.com/kgori/treeCl/blob/fed624b3db1c19cc07175ca04e3eda6905a8d305/treeCl/tree.py#L978-L986 | train | 63,208 |
kgori/treeCl | treeCl/tree.py | Tree.preorder | def preorder(self, skip_seed=False):
"""
Return a generator that yields the nodes of the tree in preorder.
If skip_seed=True then the root node is not included.
"""
for node in self._tree.preorder_node_iter():
if skip_seed and node is self._tree.seed_node:
... | python | def preorder(self, skip_seed=False):
"""
Return a generator that yields the nodes of the tree in preorder.
If skip_seed=True then the root node is not included.
"""
for node in self._tree.preorder_node_iter():
if skip_seed and node is self._tree.seed_node:
... | [
"def",
"preorder",
"(",
"self",
",",
"skip_seed",
"=",
"False",
")",
":",
"for",
"node",
"in",
"self",
".",
"_tree",
".",
"preorder_node_iter",
"(",
")",
":",
"if",
"skip_seed",
"and",
"node",
"is",
"self",
".",
"_tree",
".",
"seed_node",
":",
"continu... | Return a generator that yields the nodes of the tree in preorder.
If skip_seed=True then the root node is not included. | [
"Return",
"a",
"generator",
"that",
"yields",
"the",
"nodes",
"of",
"the",
"tree",
"in",
"preorder",
".",
"If",
"skip_seed",
"=",
"True",
"then",
"the",
"root",
"node",
"is",
"not",
"included",
"."
] | fed624b3db1c19cc07175ca04e3eda6905a8d305 | https://github.com/kgori/treeCl/blob/fed624b3db1c19cc07175ca04e3eda6905a8d305/treeCl/tree.py#L988-L996 | train | 63,209 |
kgori/treeCl | treeCl/tree.py | Tree.prune_to_subset | def prune_to_subset(self, subset, inplace=False):
""" Prunes the Tree to just the taxon set given in `subset` """
if not subset.issubset(self.labels):
print('"subset" is not a subset')
return
if not inplace:
t = self.copy()
else:
t = self
... | python | def prune_to_subset(self, subset, inplace=False):
""" Prunes the Tree to just the taxon set given in `subset` """
if not subset.issubset(self.labels):
print('"subset" is not a subset')
return
if not inplace:
t = self.copy()
else:
t = self
... | [
"def",
"prune_to_subset",
"(",
"self",
",",
"subset",
",",
"inplace",
"=",
"False",
")",
":",
"if",
"not",
"subset",
".",
"issubset",
"(",
"self",
".",
"labels",
")",
":",
"print",
"(",
"'\"subset\" is not a subset'",
")",
"return",
"if",
"not",
"inplace",... | Prunes the Tree to just the taxon set given in `subset` | [
"Prunes",
"the",
"Tree",
"to",
"just",
"the",
"taxon",
"set",
"given",
"in",
"subset"
] | fed624b3db1c19cc07175ca04e3eda6905a8d305 | https://github.com/kgori/treeCl/blob/fed624b3db1c19cc07175ca04e3eda6905a8d305/treeCl/tree.py#L998-L1010 | train | 63,210 |
kgori/treeCl | treeCl/tree.py | Tree.randomise_branch_lengths | def randomise_branch_lengths(
self,
i=(1, 1),
l=(1, 1),
distribution_func=random.gammavariate,
inplace=False,
):
""" Replaces branch lengths with values drawn from the specified
distribution_func. Parameters of the distribution are given in... | python | def randomise_branch_lengths(
self,
i=(1, 1),
l=(1, 1),
distribution_func=random.gammavariate,
inplace=False,
):
""" Replaces branch lengths with values drawn from the specified
distribution_func. Parameters of the distribution are given in... | [
"def",
"randomise_branch_lengths",
"(",
"self",
",",
"i",
"=",
"(",
"1",
",",
"1",
")",
",",
"l",
"=",
"(",
"1",
",",
"1",
")",
",",
"distribution_func",
"=",
"random",
".",
"gammavariate",
",",
"inplace",
"=",
"False",
",",
")",
":",
"if",
"not",
... | Replaces branch lengths with values drawn from the specified
distribution_func. Parameters of the distribution are given in the
tuples i and l, for interior and leaf nodes respectively. | [
"Replaces",
"branch",
"lengths",
"with",
"values",
"drawn",
"from",
"the",
"specified",
"distribution_func",
".",
"Parameters",
"of",
"the",
"distribution",
"are",
"given",
"in",
"the",
"tuples",
"i",
"and",
"l",
"for",
"interior",
"and",
"leaf",
"nodes",
"res... | fed624b3db1c19cc07175ca04e3eda6905a8d305 | https://github.com/kgori/treeCl/blob/fed624b3db1c19cc07175ca04e3eda6905a8d305/treeCl/tree.py#L1012-L1034 | train | 63,211 |
kgori/treeCl | treeCl/tree.py | Tree.randomise_labels | def randomise_labels(
self,
inplace=False,
):
""" Shuffles the leaf labels, but doesn't alter the tree structure """
if not inplace:
t = self.copy()
else:
t = self
names = list(t.labels)
random.shuffle(names)
for l in ... | python | def randomise_labels(
self,
inplace=False,
):
""" Shuffles the leaf labels, but doesn't alter the tree structure """
if not inplace:
t = self.copy()
else:
t = self
names = list(t.labels)
random.shuffle(names)
for l in ... | [
"def",
"randomise_labels",
"(",
"self",
",",
"inplace",
"=",
"False",
",",
")",
":",
"if",
"not",
"inplace",
":",
"t",
"=",
"self",
".",
"copy",
"(",
")",
"else",
":",
"t",
"=",
"self",
"names",
"=",
"list",
"(",
"t",
".",
"labels",
")",
"random"... | Shuffles the leaf labels, but doesn't alter the tree structure | [
"Shuffles",
"the",
"leaf",
"labels",
"but",
"doesn",
"t",
"alter",
"the",
"tree",
"structure"
] | fed624b3db1c19cc07175ca04e3eda6905a8d305 | https://github.com/kgori/treeCl/blob/fed624b3db1c19cc07175ca04e3eda6905a8d305/treeCl/tree.py#L1036-L1052 | train | 63,212 |
kgori/treeCl | treeCl/tree.py | Tree.reversible_deroot | def reversible_deroot(self):
""" Stores info required to restore rootedness to derooted Tree. Returns
the edge that was originally rooted, the length of e1, and the length
of e2.
Dendropy Derooting Process:
In a rooted tree the root node is bifurcating. Derooting makes it
... | python | def reversible_deroot(self):
""" Stores info required to restore rootedness to derooted Tree. Returns
the edge that was originally rooted, the length of e1, and the length
of e2.
Dendropy Derooting Process:
In a rooted tree the root node is bifurcating. Derooting makes it
... | [
"def",
"reversible_deroot",
"(",
"self",
")",
":",
"root_edge",
"=",
"self",
".",
"_tree",
".",
"seed_node",
".",
"edge",
"lengths",
"=",
"dict",
"(",
"[",
"(",
"edge",
",",
"edge",
".",
"length",
")",
"for",
"edge",
"in",
"self",
".",
"_tree",
".",
... | Stores info required to restore rootedness to derooted Tree. Returns
the edge that was originally rooted, the length of e1, and the length
of e2.
Dendropy Derooting Process:
In a rooted tree the root node is bifurcating. Derooting makes it
trifurcating.
Call the two edg... | [
"Stores",
"info",
"required",
"to",
"restore",
"rootedness",
"to",
"derooted",
"Tree",
".",
"Returns",
"the",
"edge",
"that",
"was",
"originally",
"rooted",
"the",
"length",
"of",
"e1",
"and",
"the",
"length",
"of",
"e2",
"."
] | fed624b3db1c19cc07175ca04e3eda6905a8d305 | https://github.com/kgori/treeCl/blob/fed624b3db1c19cc07175ca04e3eda6905a8d305/treeCl/tree.py#L1054-L1089 | train | 63,213 |
kgori/treeCl | treeCl/tree.py | Tree.rlgt | def rlgt(self, time=None, times=1,
disallow_sibling_lgts=False):
""" Uses class LGT to perform random lateral gene transfer on
ultrametric tree """
lgt = LGT(self.copy())
for _ in range(times):
lgt.rlgt(time, disallow_sibling_lgts)
return lgt.tree | python | def rlgt(self, time=None, times=1,
disallow_sibling_lgts=False):
""" Uses class LGT to perform random lateral gene transfer on
ultrametric tree """
lgt = LGT(self.copy())
for _ in range(times):
lgt.rlgt(time, disallow_sibling_lgts)
return lgt.tree | [
"def",
"rlgt",
"(",
"self",
",",
"time",
"=",
"None",
",",
"times",
"=",
"1",
",",
"disallow_sibling_lgts",
"=",
"False",
")",
":",
"lgt",
"=",
"LGT",
"(",
"self",
".",
"copy",
"(",
")",
")",
"for",
"_",
"in",
"range",
"(",
"times",
")",
":",
"... | Uses class LGT to perform random lateral gene transfer on
ultrametric tree | [
"Uses",
"class",
"LGT",
"to",
"perform",
"random",
"lateral",
"gene",
"transfer",
"on",
"ultrametric",
"tree"
] | fed624b3db1c19cc07175ca04e3eda6905a8d305 | https://github.com/kgori/treeCl/blob/fed624b3db1c19cc07175ca04e3eda6905a8d305/treeCl/tree.py#L1130-L1138 | train | 63,214 |
kgori/treeCl | treeCl/tree.py | Tree.scale | def scale(self, factor, inplace=True):
""" Multiplies all branch lengths by factor. """
if not inplace:
t = self.copy()
else:
t = self
t._tree.scale_edges(factor)
t._dirty = True
return t | python | def scale(self, factor, inplace=True):
""" Multiplies all branch lengths by factor. """
if not inplace:
t = self.copy()
else:
t = self
t._tree.scale_edges(factor)
t._dirty = True
return t | [
"def",
"scale",
"(",
"self",
",",
"factor",
",",
"inplace",
"=",
"True",
")",
":",
"if",
"not",
"inplace",
":",
"t",
"=",
"self",
".",
"copy",
"(",
")",
"else",
":",
"t",
"=",
"self",
"t",
".",
"_tree",
".",
"scale_edges",
"(",
"factor",
")",
"... | Multiplies all branch lengths by factor. | [
"Multiplies",
"all",
"branch",
"lengths",
"by",
"factor",
"."
] | fed624b3db1c19cc07175ca04e3eda6905a8d305 | https://github.com/kgori/treeCl/blob/fed624b3db1c19cc07175ca04e3eda6905a8d305/treeCl/tree.py#L1164-L1172 | train | 63,215 |
kgori/treeCl | treeCl/tree.py | Tree.strip | def strip(self, inplace=False):
""" Sets all edge lengths to None """
if not inplace:
t = self.copy()
else:
t = self
for e in t._tree.preorder_edge_iter():
e.length = None
t._dirty = True
return t | python | def strip(self, inplace=False):
""" Sets all edge lengths to None """
if not inplace:
t = self.copy()
else:
t = self
for e in t._tree.preorder_edge_iter():
e.length = None
t._dirty = True
return t | [
"def",
"strip",
"(",
"self",
",",
"inplace",
"=",
"False",
")",
":",
"if",
"not",
"inplace",
":",
"t",
"=",
"self",
".",
"copy",
"(",
")",
"else",
":",
"t",
"=",
"self",
"for",
"e",
"in",
"t",
".",
"_tree",
".",
"preorder_edge_iter",
"(",
")",
... | Sets all edge lengths to None | [
"Sets",
"all",
"edge",
"lengths",
"to",
"None"
] | fed624b3db1c19cc07175ca04e3eda6905a8d305 | https://github.com/kgori/treeCl/blob/fed624b3db1c19cc07175ca04e3eda6905a8d305/treeCl/tree.py#L1174-L1183 | train | 63,216 |
kgori/treeCl | treeCl/tree.py | Tree._name_things | def _name_things(self):
""" Easy names for debugging """
edges = {}
nodes = {None: 'root'}
for n in self._tree.postorder_node_iter():
nodes[n] = '.'.join([str(x.taxon) for x in n.leaf_nodes()])
for e in self._tree.preorder_edge_iter():
edges[e] = ' ---> '.... | python | def _name_things(self):
""" Easy names for debugging """
edges = {}
nodes = {None: 'root'}
for n in self._tree.postorder_node_iter():
nodes[n] = '.'.join([str(x.taxon) for x in n.leaf_nodes()])
for e in self._tree.preorder_edge_iter():
edges[e] = ' ---> '.... | [
"def",
"_name_things",
"(",
"self",
")",
":",
"edges",
"=",
"{",
"}",
"nodes",
"=",
"{",
"None",
":",
"'root'",
"}",
"for",
"n",
"in",
"self",
".",
"_tree",
".",
"postorder_node_iter",
"(",
")",
":",
"nodes",
"[",
"n",
"]",
"=",
"'.'",
".",
"join... | Easy names for debugging | [
"Easy",
"names",
"for",
"debugging"
] | fed624b3db1c19cc07175ca04e3eda6905a8d305 | https://github.com/kgori/treeCl/blob/fed624b3db1c19cc07175ca04e3eda6905a8d305/treeCl/tree.py#L1197-L1208 | train | 63,217 |
pysal/spglm | spglm/glm.py | GLM.fit | def fit(self, ini_betas=None, tol=1.0e-6, max_iter=200, solve='iwls'):
"""
Method that fits a model with a particular estimation routine.
Parameters
----------
ini_betas : array
k*1, initial coefficient values, including constant.
... | python | def fit(self, ini_betas=None, tol=1.0e-6, max_iter=200, solve='iwls'):
"""
Method that fits a model with a particular estimation routine.
Parameters
----------
ini_betas : array
k*1, initial coefficient values, including constant.
... | [
"def",
"fit",
"(",
"self",
",",
"ini_betas",
"=",
"None",
",",
"tol",
"=",
"1.0e-6",
",",
"max_iter",
"=",
"200",
",",
"solve",
"=",
"'iwls'",
")",
":",
"self",
".",
"fit_params",
"[",
"'ini_betas'",
"]",
"=",
"ini_betas",
"self",
".",
"fit_params",
... | Method that fits a model with a particular estimation routine.
Parameters
----------
ini_betas : array
k*1, initial coefficient values, including constant.
Default is None, which calculates initial values during
estima... | [
"Method",
"that",
"fits",
"a",
"model",
"with",
"a",
"particular",
"estimation",
"routine",
"."
] | 1339898adcb7e1638f1da83d57aa37392525f018 | https://github.com/pysal/spglm/blob/1339898adcb7e1638f1da83d57aa37392525f018/spglm/glm.py#L107-L135 | train | 63,218 |
pysal/spglm | spglm/links.py | Logit.inverse | def inverse(self, z):
"""
Inverse of the logit transform
Parameters
----------
z : array-like
The value of the logit transform at `p`
Returns
-------
p : array
Probabilities
Notes
-----
g^(-1)(z) = exp(z)/... | python | def inverse(self, z):
"""
Inverse of the logit transform
Parameters
----------
z : array-like
The value of the logit transform at `p`
Returns
-------
p : array
Probabilities
Notes
-----
g^(-1)(z) = exp(z)/... | [
"def",
"inverse",
"(",
"self",
",",
"z",
")",
":",
"z",
"=",
"np",
".",
"asarray",
"(",
"z",
")",
"t",
"=",
"np",
".",
"exp",
"(",
"-",
"z",
")",
"return",
"1.",
"/",
"(",
"1.",
"+",
"t",
")"
] | Inverse of the logit transform
Parameters
----------
z : array-like
The value of the logit transform at `p`
Returns
-------
p : array
Probabilities
Notes
-----
g^(-1)(z) = exp(z)/(1+exp(z)) | [
"Inverse",
"of",
"the",
"logit",
"transform"
] | 1339898adcb7e1638f1da83d57aa37392525f018 | https://github.com/pysal/spglm/blob/1339898adcb7e1638f1da83d57aa37392525f018/spglm/links.py#L149-L169 | train | 63,219 |
pysal/spglm | spglm/links.py | Power.inverse | def inverse(self, z):
"""
Inverse of the power transform link function
Parameters
----------
`z` : array-like
Value of the transformed mean parameters at `p`
Returns
-------
`p` : array
Mean parameters
Notes
-----... | python | def inverse(self, z):
"""
Inverse of the power transform link function
Parameters
----------
`z` : array-like
Value of the transformed mean parameters at `p`
Returns
-------
`p` : array
Mean parameters
Notes
-----... | [
"def",
"inverse",
"(",
"self",
",",
"z",
")",
":",
"p",
"=",
"np",
".",
"power",
"(",
"z",
",",
"1.",
"/",
"self",
".",
"power",
")",
"return",
"p"
] | Inverse of the power transform link function
Parameters
----------
`z` : array-like
Value of the transformed mean parameters at `p`
Returns
-------
`p` : array
Mean parameters
Notes
-----
g^(-1)(z`) = `z`**(1/`power`) | [
"Inverse",
"of",
"the",
"power",
"transform",
"link",
"function"
] | 1339898adcb7e1638f1da83d57aa37392525f018 | https://github.com/pysal/spglm/blob/1339898adcb7e1638f1da83d57aa37392525f018/spglm/links.py#L279-L299 | train | 63,220 |
pysal/spglm | spglm/links.py | Power.deriv | def deriv(self, p):
"""
Derivative of the power transform
Parameters
----------
p : array-like
Mean parameters
Returns
--------
g'(p) : array
Derivative of power transform of `p`
Notes
-----
g'(`p`) = `pow... | python | def deriv(self, p):
"""
Derivative of the power transform
Parameters
----------
p : array-like
Mean parameters
Returns
--------
g'(p) : array
Derivative of power transform of `p`
Notes
-----
g'(`p`) = `pow... | [
"def",
"deriv",
"(",
"self",
",",
"p",
")",
":",
"return",
"self",
".",
"power",
"*",
"np",
".",
"power",
"(",
"p",
",",
"self",
".",
"power",
"-",
"1",
")"
] | Derivative of the power transform
Parameters
----------
p : array-like
Mean parameters
Returns
--------
g'(p) : array
Derivative of power transform of `p`
Notes
-----
g'(`p`) = `power` * `p`**(`power` - 1) | [
"Derivative",
"of",
"the",
"power",
"transform"
] | 1339898adcb7e1638f1da83d57aa37392525f018 | https://github.com/pysal/spglm/blob/1339898adcb7e1638f1da83d57aa37392525f018/spglm/links.py#L301-L319 | train | 63,221 |
pysal/spglm | spglm/links.py | Power.deriv2 | def deriv2(self, p):
"""
Second derivative of the power transform
Parameters
----------
p : array-like
Mean parameters
Returns
--------
g''(p) : array
Second derivative of the power transform of `p`
Notes
-----
... | python | def deriv2(self, p):
"""
Second derivative of the power transform
Parameters
----------
p : array-like
Mean parameters
Returns
--------
g''(p) : array
Second derivative of the power transform of `p`
Notes
-----
... | [
"def",
"deriv2",
"(",
"self",
",",
"p",
")",
":",
"return",
"self",
".",
"power",
"*",
"(",
"self",
".",
"power",
"-",
"1",
")",
"*",
"np",
".",
"power",
"(",
"p",
",",
"self",
".",
"power",
"-",
"2",
")"
] | Second derivative of the power transform
Parameters
----------
p : array-like
Mean parameters
Returns
--------
g''(p) : array
Second derivative of the power transform of `p`
Notes
-----
g''(`p`) = `power` * (`power` - 1) ... | [
"Second",
"derivative",
"of",
"the",
"power",
"transform"
] | 1339898adcb7e1638f1da83d57aa37392525f018 | https://github.com/pysal/spglm/blob/1339898adcb7e1638f1da83d57aa37392525f018/spglm/links.py#L321-L339 | train | 63,222 |
pysal/spglm | spglm/links.py | Power.inverse_deriv | def inverse_deriv(self, z):
"""
Derivative of the inverse of the power transform
Parameters
----------
z : array-like
`z` is usually the linear predictor for a GLM or GEE model.
Returns
-------
g^(-1)'(z) : array
The value of the ... | python | def inverse_deriv(self, z):
"""
Derivative of the inverse of the power transform
Parameters
----------
z : array-like
`z` is usually the linear predictor for a GLM or GEE model.
Returns
-------
g^(-1)'(z) : array
The value of the ... | [
"def",
"inverse_deriv",
"(",
"self",
",",
"z",
")",
":",
"return",
"np",
".",
"power",
"(",
"z",
",",
"(",
"1",
"-",
"self",
".",
"power",
")",
"/",
"self",
".",
"power",
")",
"/",
"self",
".",
"power"
] | Derivative of the inverse of the power transform
Parameters
----------
z : array-like
`z` is usually the linear predictor for a GLM or GEE model.
Returns
-------
g^(-1)'(z) : array
The value of the derivative of the inverse of the power transform... | [
"Derivative",
"of",
"the",
"inverse",
"of",
"the",
"power",
"transform"
] | 1339898adcb7e1638f1da83d57aa37392525f018 | https://github.com/pysal/spglm/blob/1339898adcb7e1638f1da83d57aa37392525f018/spglm/links.py#L341-L356 | train | 63,223 |
pysal/spglm | spglm/links.py | CDFLink.deriv | def deriv(self, p):
"""
Derivative of CDF link
Parameters
----------
p : array-like
mean parameters
Returns
-------
g'(p) : array
The derivative of CDF transform at `p`
Notes
-----
g'(`p`) = 1./ `dbn`.pdf(... | python | def deriv(self, p):
"""
Derivative of CDF link
Parameters
----------
p : array-like
mean parameters
Returns
-------
g'(p) : array
The derivative of CDF transform at `p`
Notes
-----
g'(`p`) = 1./ `dbn`.pdf(... | [
"def",
"deriv",
"(",
"self",
",",
"p",
")",
":",
"p",
"=",
"self",
".",
"_clean",
"(",
"p",
")",
"return",
"1.",
"/",
"self",
".",
"dbn",
".",
"pdf",
"(",
"self",
".",
"dbn",
".",
"ppf",
"(",
"p",
")",
")"
] | Derivative of CDF link
Parameters
----------
p : array-like
mean parameters
Returns
-------
g'(p) : array
The derivative of CDF transform at `p`
Notes
-----
g'(`p`) = 1./ `dbn`.pdf(`dbn`.ppf(`p`)) | [
"Derivative",
"of",
"CDF",
"link"
] | 1339898adcb7e1638f1da83d57aa37392525f018 | https://github.com/pysal/spglm/blob/1339898adcb7e1638f1da83d57aa37392525f018/spglm/links.py#L602-L621 | train | 63,224 |
pysal/spglm | spglm/links.py | cauchy.deriv2 | def deriv2(self, p):
"""
Second derivative of the Cauchy link function.
Parameters
----------
p: array-like
Probabilities
Returns
-------
g''(p) : array
Value of the second derivative of Cauchy link function at `p`
"""
... | python | def deriv2(self, p):
"""
Second derivative of the Cauchy link function.
Parameters
----------
p: array-like
Probabilities
Returns
-------
g''(p) : array
Value of the second derivative of Cauchy link function at `p`
"""
... | [
"def",
"deriv2",
"(",
"self",
",",
"p",
")",
":",
"a",
"=",
"np",
".",
"pi",
"*",
"(",
"p",
"-",
"0.5",
")",
"d2",
"=",
"2",
"*",
"np",
".",
"pi",
"**",
"2",
"*",
"np",
".",
"sin",
"(",
"a",
")",
"/",
"np",
".",
"cos",
"(",
"a",
")",
... | Second derivative of the Cauchy link function.
Parameters
----------
p: array-like
Probabilities
Returns
-------
g''(p) : array
Value of the second derivative of Cauchy link function at `p` | [
"Second",
"derivative",
"of",
"the",
"Cauchy",
"link",
"function",
"."
] | 1339898adcb7e1638f1da83d57aa37392525f018 | https://github.com/pysal/spglm/blob/1339898adcb7e1638f1da83d57aa37392525f018/spglm/links.py#L678-L694 | train | 63,225 |
pysal/spglm | spglm/links.py | CLogLog.deriv | def deriv(self, p):
"""
Derivative of C-Log-Log transform link function
Parameters
----------
p : array-like
Mean parameters
Returns
-------
g'(p) : array
The derivative of the CLogLog transform link function
Notes
... | python | def deriv(self, p):
"""
Derivative of C-Log-Log transform link function
Parameters
----------
p : array-like
Mean parameters
Returns
-------
g'(p) : array
The derivative of the CLogLog transform link function
Notes
... | [
"def",
"deriv",
"(",
"self",
",",
"p",
")",
":",
"p",
"=",
"self",
".",
"_clean",
"(",
"p",
")",
"return",
"1.",
"/",
"(",
"(",
"p",
"-",
"1",
")",
"*",
"(",
"np",
".",
"log",
"(",
"1",
"-",
"p",
")",
")",
")"
] | Derivative of C-Log-Log transform link function
Parameters
----------
p : array-like
Mean parameters
Returns
-------
g'(p) : array
The derivative of the CLogLog transform link function
Notes
-----
g'(p) = - 1 / ((p-1)*log... | [
"Derivative",
"of",
"C",
"-",
"Log",
"-",
"Log",
"transform",
"link",
"function"
] | 1339898adcb7e1638f1da83d57aa37392525f018 | https://github.com/pysal/spglm/blob/1339898adcb7e1638f1da83d57aa37392525f018/spglm/links.py#L749-L768 | train | 63,226 |
pysal/spglm | spglm/links.py | CLogLog.deriv2 | def deriv2(self, p):
"""
Second derivative of the C-Log-Log ink function
Parameters
----------
p : array-like
Mean parameters
Returns
-------
g''(p) : array
The second derivative of the CLogLog link function
"""
p ... | python | def deriv2(self, p):
"""
Second derivative of the C-Log-Log ink function
Parameters
----------
p : array-like
Mean parameters
Returns
-------
g''(p) : array
The second derivative of the CLogLog link function
"""
p ... | [
"def",
"deriv2",
"(",
"self",
",",
"p",
")",
":",
"p",
"=",
"self",
".",
"_clean",
"(",
"p",
")",
"fl",
"=",
"np",
".",
"log",
"(",
"1",
"-",
"p",
")",
"d2",
"=",
"-",
"1",
"/",
"(",
"(",
"1",
"-",
"p",
")",
"**",
"2",
"*",
"fl",
")",... | Second derivative of the C-Log-Log ink function
Parameters
----------
p : array-like
Mean parameters
Returns
-------
g''(p) : array
The second derivative of the CLogLog link function | [
"Second",
"derivative",
"of",
"the",
"C",
"-",
"Log",
"-",
"Log",
"ink",
"function"
] | 1339898adcb7e1638f1da83d57aa37392525f018 | https://github.com/pysal/spglm/blob/1339898adcb7e1638f1da83d57aa37392525f018/spglm/links.py#L770-L788 | train | 63,227 |
pysal/spglm | spglm/links.py | NegativeBinomial.deriv2 | def deriv2(self,p):
'''
Second derivative of the negative binomial link function.
Parameters
----------
p : array-like
Mean parameters
Returns
-------
g''(p) : array
The second derivative of the negative binomial transform link
... | python | def deriv2(self,p):
'''
Second derivative of the negative binomial link function.
Parameters
----------
p : array-like
Mean parameters
Returns
-------
g''(p) : array
The second derivative of the negative binomial transform link
... | [
"def",
"deriv2",
"(",
"self",
",",
"p",
")",
":",
"numer",
"=",
"-",
"(",
"1",
"+",
"2",
"*",
"self",
".",
"alpha",
"*",
"p",
")",
"denom",
"=",
"(",
"p",
"+",
"self",
".",
"alpha",
"*",
"p",
"**",
"2",
")",
"**",
"2",
"return",
"numer",
... | Second derivative of the negative binomial link function.
Parameters
----------
p : array-like
Mean parameters
Returns
-------
g''(p) : array
The second derivative of the negative binomial transform link
function
Notes
... | [
"Second",
"derivative",
"of",
"the",
"negative",
"binomial",
"link",
"function",
"."
] | 1339898adcb7e1638f1da83d57aa37392525f018 | https://github.com/pysal/spglm/blob/1339898adcb7e1638f1da83d57aa37392525f018/spglm/links.py#L900-L921 | train | 63,228 |
pysal/spglm | spglm/links.py | NegativeBinomial.inverse_deriv | def inverse_deriv(self, z):
'''
Derivative of the inverse of the negative binomial transform
Parameters
-----------
z : array-like
Usually the linear predictor for a GLM or GEE model
Returns
-------
g^(-1)'(z) : array
The value of... | python | def inverse_deriv(self, z):
'''
Derivative of the inverse of the negative binomial transform
Parameters
-----------
z : array-like
Usually the linear predictor for a GLM or GEE model
Returns
-------
g^(-1)'(z) : array
The value of... | [
"def",
"inverse_deriv",
"(",
"self",
",",
"z",
")",
":",
"t",
"=",
"np",
".",
"exp",
"(",
"z",
")",
"return",
"t",
"/",
"(",
"self",
".",
"alpha",
"*",
"(",
"1",
"-",
"t",
")",
"**",
"2",
")"
] | Derivative of the inverse of the negative binomial transform
Parameters
-----------
z : array-like
Usually the linear predictor for a GLM or GEE model
Returns
-------
g^(-1)'(z) : array
The value of the derivative of the inverse of the negative
... | [
"Derivative",
"of",
"the",
"inverse",
"of",
"the",
"negative",
"binomial",
"transform"
] | 1339898adcb7e1638f1da83d57aa37392525f018 | https://github.com/pysal/spglm/blob/1339898adcb7e1638f1da83d57aa37392525f018/spglm/links.py#L923-L939 | train | 63,229 |
biocommons/eutils | eutils/client.py | Client.einfo | def einfo(self, db=None):
"""query the einfo endpoint
:param db: string (optional)
:rtype: EInfo or EInfoDB object
If db is None, the reply is a list of databases, which is returned
in an EInfo object (which has a databases() method).
If db is not None, the reply is in... | python | def einfo(self, db=None):
"""query the einfo endpoint
:param db: string (optional)
:rtype: EInfo or EInfoDB object
If db is None, the reply is a list of databases, which is returned
in an EInfo object (which has a databases() method).
If db is not None, the reply is in... | [
"def",
"einfo",
"(",
"self",
",",
"db",
"=",
"None",
")",
":",
"if",
"db",
"is",
"None",
":",
"return",
"EInfoResult",
"(",
"self",
".",
"_qs",
".",
"einfo",
"(",
")",
")",
".",
"dblist",
"return",
"EInfoResult",
"(",
"self",
".",
"_qs",
".",
"ei... | query the einfo endpoint
:param db: string (optional)
:rtype: EInfo or EInfoDB object
If db is None, the reply is a list of databases, which is returned
in an EInfo object (which has a databases() method).
If db is not None, the reply is information about the specified
... | [
"query",
"the",
"einfo",
"endpoint"
] | 0ec7444fd520d2af56114122442ff8f60952db0b | https://github.com/biocommons/eutils/blob/0ec7444fd520d2af56114122442ff8f60952db0b/eutils/client.py#L52-L68 | train | 63,230 |
biocommons/eutils | eutils/client.py | Client.esearch | def esearch(self, db, term):
"""query the esearch endpoint
"""
esr = ESearchResult(self._qs.esearch({'db': db, 'term': term}))
if esr.count > esr.retmax:
logger.warning("NCBI found {esr.count} results, but we truncated the reply at {esr.retmax}"
" resu... | python | def esearch(self, db, term):
"""query the esearch endpoint
"""
esr = ESearchResult(self._qs.esearch({'db': db, 'term': term}))
if esr.count > esr.retmax:
logger.warning("NCBI found {esr.count} results, but we truncated the reply at {esr.retmax}"
" resu... | [
"def",
"esearch",
"(",
"self",
",",
"db",
",",
"term",
")",
":",
"esr",
"=",
"ESearchResult",
"(",
"self",
".",
"_qs",
".",
"esearch",
"(",
"{",
"'db'",
":",
"db",
",",
"'term'",
":",
"term",
"}",
")",
")",
"if",
"esr",
".",
"count",
">",
"esr"... | query the esearch endpoint | [
"query",
"the",
"esearch",
"endpoint"
] | 0ec7444fd520d2af56114122442ff8f60952db0b | https://github.com/biocommons/eutils/blob/0ec7444fd520d2af56114122442ff8f60952db0b/eutils/client.py#L70-L77 | train | 63,231 |
biocommons/eutils | eutils/client.py | Client.efetch | def efetch(self, db, id):
"""query the efetch endpoint
"""
db = db.lower()
xml = self._qs.efetch({'db': db, 'id': str(id)})
doc = le.XML(xml)
if db in ['gene']:
return EntrezgeneSet(doc)
if db in ['nuccore', 'nucest', 'protein']:
# TODO: GB... | python | def efetch(self, db, id):
"""query the efetch endpoint
"""
db = db.lower()
xml = self._qs.efetch({'db': db, 'id': str(id)})
doc = le.XML(xml)
if db in ['gene']:
return EntrezgeneSet(doc)
if db in ['nuccore', 'nucest', 'protein']:
# TODO: GB... | [
"def",
"efetch",
"(",
"self",
",",
"db",
",",
"id",
")",
":",
"db",
"=",
"db",
".",
"lower",
"(",
")",
"xml",
"=",
"self",
".",
"_qs",
".",
"efetch",
"(",
"{",
"'db'",
":",
"db",
",",
"'id'",
":",
"str",
"(",
"id",
")",
"}",
")",
"doc",
"... | query the efetch endpoint | [
"query",
"the",
"efetch",
"endpoint"
] | 0ec7444fd520d2af56114122442ff8f60952db0b | https://github.com/biocommons/eutils/blob/0ec7444fd520d2af56114122442ff8f60952db0b/eutils/client.py#L79-L96 | train | 63,232 |
asweigart/pygbutton | pygbutton/__init__.py | PygButton.draw | def draw(self, surfaceObj):
"""Blit the current button's appearance to the surface object."""
if self._visible:
if self.buttonDown:
surfaceObj.blit(self.surfaceDown, self._rect)
elif self.mouseOverButton:
surfaceObj.blit(self.surfaceHighlight, self... | python | def draw(self, surfaceObj):
"""Blit the current button's appearance to the surface object."""
if self._visible:
if self.buttonDown:
surfaceObj.blit(self.surfaceDown, self._rect)
elif self.mouseOverButton:
surfaceObj.blit(self.surfaceHighlight, self... | [
"def",
"draw",
"(",
"self",
",",
"surfaceObj",
")",
":",
"if",
"self",
".",
"_visible",
":",
"if",
"self",
".",
"buttonDown",
":",
"surfaceObj",
".",
"blit",
"(",
"self",
".",
"surfaceDown",
",",
"self",
".",
"_rect",
")",
"elif",
"self",
".",
"mouse... | Blit the current button's appearance to the surface object. | [
"Blit",
"the",
"current",
"button",
"s",
"appearance",
"to",
"the",
"surface",
"object",
"."
] | 7fab6a0d53f2b1d2d1d83768464eb2bf2a24802b | https://github.com/asweigart/pygbutton/blob/7fab6a0d53f2b1d2d1d83768464eb2bf2a24802b/pygbutton/__init__.py#L182-L190 | train | 63,233 |
pysal/spglm | spglm/family.py | Family._setlink | def _setlink(self, link):
"""
Helper method to set the link for a family.
Raises a ValueError exception if the link is not available. Note that
the error message might not be that informative because it tells you
that the link should be in the base class for the link function.
... | python | def _setlink(self, link):
"""
Helper method to set the link for a family.
Raises a ValueError exception if the link is not available. Note that
the error message might not be that informative because it tells you
that the link should be in the base class for the link function.
... | [
"def",
"_setlink",
"(",
"self",
",",
"link",
")",
":",
"# TODO: change the links class attribute in the families to hold",
"# meaningful information instead of a list of links instances such as",
"# [<statsmodels.family.links.Log object at 0x9a4240c>,",
"# <statsmodels.family.links.Power obje... | Helper method to set the link for a family.
Raises a ValueError exception if the link is not available. Note that
the error message might not be that informative because it tells you
that the link should be in the base class for the link function.
See glm.GLM for a list of appropriate... | [
"Helper",
"method",
"to",
"set",
"the",
"link",
"for",
"a",
"family",
"."
] | 1339898adcb7e1638f1da83d57aa37392525f018 | https://github.com/pysal/spglm/blob/1339898adcb7e1638f1da83d57aa37392525f018/spglm/family.py#L39-L64 | train | 63,234 |
pysal/spglm | spglm/family.py | Family.weights | def weights(self, mu):
r"""
Weights for IRLS steps
Parameters
----------
mu : array-like
The transformed mean response variable in the exponential family
Returns
-------
w : array
The weights for the IRLS steps
"""
... | python | def weights(self, mu):
r"""
Weights for IRLS steps
Parameters
----------
mu : array-like
The transformed mean response variable in the exponential family
Returns
-------
w : array
The weights for the IRLS steps
"""
... | [
"def",
"weights",
"(",
"self",
",",
"mu",
")",
":",
"return",
"1.",
"/",
"(",
"self",
".",
"link",
".",
"deriv",
"(",
"mu",
")",
"**",
"2",
"*",
"self",
".",
"variance",
"(",
"mu",
")",
")"
] | r"""
Weights for IRLS steps
Parameters
----------
mu : array-like
The transformed mean response variable in the exponential family
Returns
-------
w : array
The weights for the IRLS steps | [
"r",
"Weights",
"for",
"IRLS",
"steps"
] | 1339898adcb7e1638f1da83d57aa37392525f018 | https://github.com/pysal/spglm/blob/1339898adcb7e1638f1da83d57aa37392525f018/spglm/family.py#L96-L111 | train | 63,235 |
pysal/spglm | spglm/family.py | Gaussian.resid_dev | def resid_dev(self, endog, mu, scale=1.):
"""
Gaussian deviance residuals
Parameters
-----------
endog : array-like
Endogenous response variable
mu : array-like
Fitted mean response variable
scale : float, optional
An optional ... | python | def resid_dev(self, endog, mu, scale=1.):
"""
Gaussian deviance residuals
Parameters
-----------
endog : array-like
Endogenous response variable
mu : array-like
Fitted mean response variable
scale : float, optional
An optional ... | [
"def",
"resid_dev",
"(",
"self",
",",
"endog",
",",
"mu",
",",
"scale",
"=",
"1.",
")",
":",
"return",
"(",
"endog",
"-",
"mu",
")",
"/",
"np",
".",
"sqrt",
"(",
"self",
".",
"variance",
"(",
"mu",
")",
")",
"/",
"scale"
] | Gaussian deviance residuals
Parameters
-----------
endog : array-like
Endogenous response variable
mu : array-like
Fitted mean response variable
scale : float, optional
An optional argument to divide the residuals by scale. The default
... | [
"Gaussian",
"deviance",
"residuals"
] | 1339898adcb7e1638f1da83d57aa37392525f018 | https://github.com/pysal/spglm/blob/1339898adcb7e1638f1da83d57aa37392525f018/spglm/family.py#L500-L521 | train | 63,236 |
pysal/spglm | spglm/family.py | Gaussian.deviance | def deviance(self, endog, mu, freq_weights=1., scale=1.):
"""
Gaussian deviance function
Parameters
----------
endog : array-like
Endogenous response variable
mu : array-like
Fitted mean response variable
freq_weights : array-like
... | python | def deviance(self, endog, mu, freq_weights=1., scale=1.):
"""
Gaussian deviance function
Parameters
----------
endog : array-like
Endogenous response variable
mu : array-like
Fitted mean response variable
freq_weights : array-like
... | [
"def",
"deviance",
"(",
"self",
",",
"endog",
",",
"mu",
",",
"freq_weights",
"=",
"1.",
",",
"scale",
"=",
"1.",
")",
":",
"return",
"np",
".",
"sum",
"(",
"(",
"freq_weights",
"*",
"(",
"endog",
"-",
"mu",
")",
"**",
"2",
")",
")",
"/",
"scal... | Gaussian deviance function
Parameters
----------
endog : array-like
Endogenous response variable
mu : array-like
Fitted mean response variable
freq_weights : array-like
1d array of frequency weights. The default is 1.
scale : float, op... | [
"Gaussian",
"deviance",
"function"
] | 1339898adcb7e1638f1da83d57aa37392525f018 | https://github.com/pysal/spglm/blob/1339898adcb7e1638f1da83d57aa37392525f018/spglm/family.py#L523-L545 | train | 63,237 |
pysal/spglm | spglm/family.py | Gaussian.loglike | def loglike(self, endog, mu, freq_weights=1., scale=1.):
"""
The log-likelihood in terms of the fitted mean response.
Parameters
----------
endog : array-like
Endogenous response variable
mu : array-like
Fitted mean response variable
freq_... | python | def loglike(self, endog, mu, freq_weights=1., scale=1.):
"""
The log-likelihood in terms of the fitted mean response.
Parameters
----------
endog : array-like
Endogenous response variable
mu : array-like
Fitted mean response variable
freq_... | [
"def",
"loglike",
"(",
"self",
",",
"endog",
",",
"mu",
",",
"freq_weights",
"=",
"1.",
",",
"scale",
"=",
"1.",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"link",
",",
"L",
".",
"Power",
")",
"and",
"self",
".",
"link",
".",
"power",
"==",
... | The log-likelihood in terms of the fitted mean response.
Parameters
----------
endog : array-like
Endogenous response variable
mu : array-like
Fitted mean response variable
freq_weights : array-like
1d array of frequency weights. The default i... | [
"The",
"log",
"-",
"likelihood",
"in",
"terms",
"of",
"the",
"fitted",
"mean",
"response",
"."
] | 1339898adcb7e1638f1da83d57aa37392525f018 | https://github.com/pysal/spglm/blob/1339898adcb7e1638f1da83d57aa37392525f018/spglm/family.py#L547-L578 | train | 63,238 |
pysal/spglm | spglm/family.py | Gamma.deviance | def deviance(self, endog, mu, freq_weights=1., scale=1.):
r"""
Gamma deviance function
Parameters
-----------
endog : array-like
Endogenous response variable
mu : array-like
Fitted mean response variable
freq_weights : array-like
... | python | def deviance(self, endog, mu, freq_weights=1., scale=1.):
r"""
Gamma deviance function
Parameters
-----------
endog : array-like
Endogenous response variable
mu : array-like
Fitted mean response variable
freq_weights : array-like
... | [
"def",
"deviance",
"(",
"self",
",",
"endog",
",",
"mu",
",",
"freq_weights",
"=",
"1.",
",",
"scale",
"=",
"1.",
")",
":",
"endog_mu",
"=",
"self",
".",
"_clean",
"(",
"endog",
"/",
"mu",
")",
"return",
"2",
"*",
"np",
".",
"sum",
"(",
"freq_wei... | r"""
Gamma deviance function
Parameters
-----------
endog : array-like
Endogenous response variable
mu : array-like
Fitted mean response variable
freq_weights : array-like
1d array of frequency weights. The default is 1.
scale ... | [
"r",
"Gamma",
"deviance",
"function"
] | 1339898adcb7e1638f1da83d57aa37392525f018 | https://github.com/pysal/spglm/blob/1339898adcb7e1638f1da83d57aa37392525f018/spglm/family.py#L633-L655 | train | 63,239 |
pysal/spglm | spglm/family.py | Gamma.resid_dev | def resid_dev(self, endog, mu, scale=1.):
r"""
Gamma deviance residuals
Parameters
-----------
endog : array-like
Endogenous response variable
mu : array-like
Fitted mean response variable
scale : float, optional
An optional ar... | python | def resid_dev(self, endog, mu, scale=1.):
r"""
Gamma deviance residuals
Parameters
-----------
endog : array-like
Endogenous response variable
mu : array-like
Fitted mean response variable
scale : float, optional
An optional ar... | [
"def",
"resid_dev",
"(",
"self",
",",
"endog",
",",
"mu",
",",
"scale",
"=",
"1.",
")",
":",
"endog_mu",
"=",
"self",
".",
"_clean",
"(",
"endog",
"/",
"mu",
")",
"return",
"np",
".",
"sign",
"(",
"endog",
"-",
"mu",
")",
"*",
"np",
".",
"sqrt"... | r"""
Gamma deviance residuals
Parameters
-----------
endog : array-like
Endogenous response variable
mu : array-like
Fitted mean response variable
scale : float, optional
An optional argument to divide the residuals by scale. The defau... | [
"r",
"Gamma",
"deviance",
"residuals"
] | 1339898adcb7e1638f1da83d57aa37392525f018 | https://github.com/pysal/spglm/blob/1339898adcb7e1638f1da83d57aa37392525f018/spglm/family.py#L657-L679 | train | 63,240 |
pysal/spglm | spglm/family.py | Binomial.initialize | def initialize(self, endog, freq_weights):
'''
Initialize the response variable.
Parameters
----------
endog : array
Endogenous response variable
Returns
--------
If `endog` is binary, returns `endog`
If `endog` is a 2d array, then t... | python | def initialize(self, endog, freq_weights):
'''
Initialize the response variable.
Parameters
----------
endog : array
Endogenous response variable
Returns
--------
If `endog` is binary, returns `endog`
If `endog` is a 2d array, then t... | [
"def",
"initialize",
"(",
"self",
",",
"endog",
",",
"freq_weights",
")",
":",
"# if not np.all(np.asarray(freq_weights) == 1):",
"# self.variance = V.Binomial(n=freq_weights)",
"if",
"(",
"endog",
".",
"ndim",
">",
"1",
"and",
"endog",
".",
"shape",
"[",
"1",
"... | Initialize the response variable.
Parameters
----------
endog : array
Endogenous response variable
Returns
--------
If `endog` is binary, returns `endog`
If `endog` is a 2d array, then the input is assumed to be in the format
(successes, fai... | [
"Initialize",
"the",
"response",
"variable",
"."
] | 1339898adcb7e1638f1da83d57aa37392525f018 | https://github.com/pysal/spglm/blob/1339898adcb7e1638f1da83d57aa37392525f018/spglm/family.py#L772-L798 | train | 63,241 |
pysal/spglm | spglm/family.py | Binomial.deviance | def deviance(self, endog, mu, freq_weights=1, scale=1., axis=None):
r'''
Deviance function for either Bernoulli or Binomial data.
Parameters
----------
endog : array-like
Endogenous response variable (already transformed to a probability
if appropriate).
... | python | def deviance(self, endog, mu, freq_weights=1, scale=1., axis=None):
r'''
Deviance function for either Bernoulli or Binomial data.
Parameters
----------
endog : array-like
Endogenous response variable (already transformed to a probability
if appropriate).
... | [
"def",
"deviance",
"(",
"self",
",",
"endog",
",",
"mu",
",",
"freq_weights",
"=",
"1",
",",
"scale",
"=",
"1.",
",",
"axis",
"=",
"None",
")",
":",
"if",
"np",
".",
"shape",
"(",
"self",
".",
"n",
")",
"==",
"(",
")",
"and",
"self",
".",
"n"... | r'''
Deviance function for either Bernoulli or Binomial data.
Parameters
----------
endog : array-like
Endogenous response variable (already transformed to a probability
if appropriate).
mu : array
Fitted mean response variable
freq_we... | [
"r",
"Deviance",
"function",
"for",
"either",
"Bernoulli",
"or",
"Binomial",
"data",
"."
] | 1339898adcb7e1638f1da83d57aa37392525f018 | https://github.com/pysal/spglm/blob/1339898adcb7e1638f1da83d57aa37392525f018/spglm/family.py#L800-L831 | train | 63,242 |
pysal/spglm | spglm/family.py | Binomial.resid_dev | def resid_dev(self, endog, mu, scale=1.):
r"""
Binomial deviance residuals
Parameters
-----------
endog : array-like
Endogenous response variable
mu : array-like
Fitted mean response variable
scale : float, optional
An optional... | python | def resid_dev(self, endog, mu, scale=1.):
r"""
Binomial deviance residuals
Parameters
-----------
endog : array-like
Endogenous response variable
mu : array-like
Fitted mean response variable
scale : float, optional
An optional... | [
"def",
"resid_dev",
"(",
"self",
",",
"endog",
",",
"mu",
",",
"scale",
"=",
"1.",
")",
":",
"mu",
"=",
"self",
".",
"link",
".",
"_clean",
"(",
"mu",
")",
"if",
"np",
".",
"shape",
"(",
"self",
".",
"n",
")",
"==",
"(",
")",
"and",
"self",
... | r"""
Binomial deviance residuals
Parameters
-----------
endog : array-like
Endogenous response variable
mu : array-like
Fitted mean response variable
scale : float, optional
An optional argument to divide the residuals by scale. The de... | [
"r",
"Binomial",
"deviance",
"residuals"
] | 1339898adcb7e1638f1da83d57aa37392525f018 | https://github.com/pysal/spglm/blob/1339898adcb7e1638f1da83d57aa37392525f018/spglm/family.py#L833-L864 | train | 63,243 |
pysal/spglm | spglm/family.py | Binomial.resid_anscombe | def resid_anscombe(self, endog, mu):
'''
The Anscombe residuals
Parameters
----------
endog : array-like
Endogenous response variable
mu : array-like
Fitted mean response variable
Returns
-------
resid_anscombe : array
... | python | def resid_anscombe(self, endog, mu):
'''
The Anscombe residuals
Parameters
----------
endog : array-like
Endogenous response variable
mu : array-like
Fitted mean response variable
Returns
-------
resid_anscombe : array
... | [
"def",
"resid_anscombe",
"(",
"self",
",",
"endog",
",",
"mu",
")",
":",
"cox_snell",
"=",
"lambda",
"x",
":",
"(",
"special",
".",
"betainc",
"(",
"2",
"/",
"3.",
",",
"2",
"/",
"3.",
",",
"x",
")",
"*",
"special",
".",
"beta",
"(",
"2",
"/",
... | The Anscombe residuals
Parameters
----------
endog : array-like
Endogenous response variable
mu : array-like
Fitted mean response variable
Returns
-------
resid_anscombe : array
The Anscombe residuals as defined below.
... | [
"The",
"Anscombe",
"residuals"
] | 1339898adcb7e1638f1da83d57aa37392525f018 | https://github.com/pysal/spglm/blob/1339898adcb7e1638f1da83d57aa37392525f018/spglm/family.py#L900-L928 | train | 63,244 |
jamesls/python-keepassx | keepassx/db.py | Database.find_by_uuid | def find_by_uuid(self, uuid):
"""Find an entry by uuid.
:raise: EntryNotFoundError
"""
for entry in self.entries:
if entry.uuid == uuid:
return entry
raise EntryNotFoundError("Entry not found for uuid: %s" % uuid) | python | def find_by_uuid(self, uuid):
"""Find an entry by uuid.
:raise: EntryNotFoundError
"""
for entry in self.entries:
if entry.uuid == uuid:
return entry
raise EntryNotFoundError("Entry not found for uuid: %s" % uuid) | [
"def",
"find_by_uuid",
"(",
"self",
",",
"uuid",
")",
":",
"for",
"entry",
"in",
"self",
".",
"entries",
":",
"if",
"entry",
".",
"uuid",
"==",
"uuid",
":",
"return",
"entry",
"raise",
"EntryNotFoundError",
"(",
"\"Entry not found for uuid: %s\"",
"%",
"uuid... | Find an entry by uuid.
:raise: EntryNotFoundError | [
"Find",
"an",
"entry",
"by",
"uuid",
"."
] | cf3c8f33b17b8eb6beaa1a8dd83ce1921dcde975 | https://github.com/jamesls/python-keepassx/blob/cf3c8f33b17b8eb6beaa1a8dd83ce1921dcde975/keepassx/db.py#L311-L319 | train | 63,245 |
jamesls/python-keepassx | keepassx/db.py | Database.find_by_title | def find_by_title(self, title):
"""Find an entry by exact title.
:raise: EntryNotFoundError
"""
for entry in self.entries:
if entry.title == title:
return entry
raise EntryNotFoundError("Entry not found for title: %s" % title) | python | def find_by_title(self, title):
"""Find an entry by exact title.
:raise: EntryNotFoundError
"""
for entry in self.entries:
if entry.title == title:
return entry
raise EntryNotFoundError("Entry not found for title: %s" % title) | [
"def",
"find_by_title",
"(",
"self",
",",
"title",
")",
":",
"for",
"entry",
"in",
"self",
".",
"entries",
":",
"if",
"entry",
".",
"title",
"==",
"title",
":",
"return",
"entry",
"raise",
"EntryNotFoundError",
"(",
"\"Entry not found for title: %s\"",
"%",
... | Find an entry by exact title.
:raise: EntryNotFoundError | [
"Find",
"an",
"entry",
"by",
"exact",
"title",
"."
] | cf3c8f33b17b8eb6beaa1a8dd83ce1921dcde975 | https://github.com/jamesls/python-keepassx/blob/cf3c8f33b17b8eb6beaa1a8dd83ce1921dcde975/keepassx/db.py#L321-L330 | train | 63,246 |
jamesls/python-keepassx | keepassx/db.py | Database.fuzzy_search_by_title | def fuzzy_search_by_title(self, title, ignore_groups=None):
"""Find an entry by by fuzzy match.
This will check things such as:
* case insensitive matching
* typo checks
* prefix matches
If the ``ignore_groups`` argument is provided, then any matching
... | python | def fuzzy_search_by_title(self, title, ignore_groups=None):
"""Find an entry by by fuzzy match.
This will check things such as:
* case insensitive matching
* typo checks
* prefix matches
If the ``ignore_groups`` argument is provided, then any matching
... | [
"def",
"fuzzy_search_by_title",
"(",
"self",
",",
"title",
",",
"ignore_groups",
"=",
"None",
")",
":",
"entries",
"=",
"[",
"]",
"# Exact matches trump",
"for",
"entry",
"in",
"self",
".",
"entries",
":",
"if",
"entry",
".",
"title",
"==",
"title",
":",
... | Find an entry by by fuzzy match.
This will check things such as:
* case insensitive matching
* typo checks
* prefix matches
If the ``ignore_groups`` argument is provided, then any matching
entries in the ``ignore_groups`` list will not be returned. This
... | [
"Find",
"an",
"entry",
"by",
"by",
"fuzzy",
"match",
"."
] | cf3c8f33b17b8eb6beaa1a8dd83ce1921dcde975 | https://github.com/jamesls/python-keepassx/blob/cf3c8f33b17b8eb6beaa1a8dd83ce1921dcde975/keepassx/db.py#L332-L376 | train | 63,247 |
imjoey/pyhaproxy | pyhaproxy/parse.py | Parser.build_configuration | def build_configuration(self):
"""Parse the haproxy config file
Raises:
Exception: when there are unsupported section
Returns:
config.Configuration: haproxy config object
"""
configuration = config.Configuration()
pegtree = pegnode.parse(self.fil... | python | def build_configuration(self):
"""Parse the haproxy config file
Raises:
Exception: when there are unsupported section
Returns:
config.Configuration: haproxy config object
"""
configuration = config.Configuration()
pegtree = pegnode.parse(self.fil... | [
"def",
"build_configuration",
"(",
"self",
")",
":",
"configuration",
"=",
"config",
".",
"Configuration",
"(",
")",
"pegtree",
"=",
"pegnode",
".",
"parse",
"(",
"self",
".",
"filestring",
")",
"for",
"section_node",
"in",
"pegtree",
":",
"if",
"isinstance"... | Parse the haproxy config file
Raises:
Exception: when there are unsupported section
Returns:
config.Configuration: haproxy config object | [
"Parse",
"the",
"haproxy",
"config",
"file"
] | 4f0904acfc6bdb29ba6104ce2f6724c0330441d3 | https://github.com/imjoey/pyhaproxy/blob/4f0904acfc6bdb29ba6104ce2f6724c0330441d3/pyhaproxy/parse.py#L25-L55 | train | 63,248 |
imjoey/pyhaproxy | pyhaproxy/parse.py | Parser.build_global | def build_global(self, global_node):
"""parse `global` section, and return the config.Global
Args:
global_node (TreeNode): `global` section treenode
Returns:
config.Global: an object
"""
config_block_lines = self.__build_config_block(
globa... | python | def build_global(self, global_node):
"""parse `global` section, and return the config.Global
Args:
global_node (TreeNode): `global` section treenode
Returns:
config.Global: an object
"""
config_block_lines = self.__build_config_block(
globa... | [
"def",
"build_global",
"(",
"self",
",",
"global_node",
")",
":",
"config_block_lines",
"=",
"self",
".",
"__build_config_block",
"(",
"global_node",
".",
"config_block",
")",
"return",
"config",
".",
"Global",
"(",
"config_block",
"=",
"config_block_lines",
")"
] | parse `global` section, and return the config.Global
Args:
global_node (TreeNode): `global` section treenode
Returns:
config.Global: an object | [
"parse",
"global",
"section",
"and",
"return",
"the",
"config",
".",
"Global"
] | 4f0904acfc6bdb29ba6104ce2f6724c0330441d3 | https://github.com/imjoey/pyhaproxy/blob/4f0904acfc6bdb29ba6104ce2f6724c0330441d3/pyhaproxy/parse.py#L57-L69 | train | 63,249 |
imjoey/pyhaproxy | pyhaproxy/parse.py | Parser.__build_config_block | def __build_config_block(self, config_block_node):
"""parse `config_block` in each section
Args:
config_block_node (TreeNode): Description
Returns:
[line_node1, line_node2, ...]
"""
node_lists = []
for line_node in config_block_node:
... | python | def __build_config_block(self, config_block_node):
"""parse `config_block` in each section
Args:
config_block_node (TreeNode): Description
Returns:
[line_node1, line_node2, ...]
"""
node_lists = []
for line_node in config_block_node:
... | [
"def",
"__build_config_block",
"(",
"self",
",",
"config_block_node",
")",
":",
"node_lists",
"=",
"[",
"]",
"for",
"line_node",
"in",
"config_block_node",
":",
"if",
"isinstance",
"(",
"line_node",
",",
"pegnode",
".",
"ConfigLine",
")",
":",
"node_lists",
".... | parse `config_block` in each section
Args:
config_block_node (TreeNode): Description
Returns:
[line_node1, line_node2, ...] | [
"parse",
"config_block",
"in",
"each",
"section"
] | 4f0904acfc6bdb29ba6104ce2f6724c0330441d3 | https://github.com/imjoey/pyhaproxy/blob/4f0904acfc6bdb29ba6104ce2f6724c0330441d3/pyhaproxy/parse.py#L71-L108 | train | 63,250 |
imjoey/pyhaproxy | pyhaproxy/parse.py | Parser.build_defaults | def build_defaults(self, defaults_node):
"""parse `defaults` sections, and return a config.Defaults
Args:
defaults_node (TreeNode): Description
Returns:
config.Defaults: an object
"""
proxy_name = defaults_node.defaults_header.proxy_name.text
con... | python | def build_defaults(self, defaults_node):
"""parse `defaults` sections, and return a config.Defaults
Args:
defaults_node (TreeNode): Description
Returns:
config.Defaults: an object
"""
proxy_name = defaults_node.defaults_header.proxy_name.text
con... | [
"def",
"build_defaults",
"(",
"self",
",",
"defaults_node",
")",
":",
"proxy_name",
"=",
"defaults_node",
".",
"defaults_header",
".",
"proxy_name",
".",
"text",
"config_block_lines",
"=",
"self",
".",
"__build_config_block",
"(",
"defaults_node",
".",
"config_block... | parse `defaults` sections, and return a config.Defaults
Args:
defaults_node (TreeNode): Description
Returns:
config.Defaults: an object | [
"parse",
"defaults",
"sections",
"and",
"return",
"a",
"config",
".",
"Defaults"
] | 4f0904acfc6bdb29ba6104ce2f6724c0330441d3 | https://github.com/imjoey/pyhaproxy/blob/4f0904acfc6bdb29ba6104ce2f6724c0330441d3/pyhaproxy/parse.py#L110-L124 | train | 63,251 |
imjoey/pyhaproxy | pyhaproxy/parse.py | Parser.build_userlist | def build_userlist(self, userlist_node):
"""parse `userlist` sections, and return a config.Userlist"""
proxy_name = userlist_node.userlist_header.proxy_name.text
config_block_lines = self.__build_config_block(
userlist_node.config_block)
return config.Userlist(
na... | python | def build_userlist(self, userlist_node):
"""parse `userlist` sections, and return a config.Userlist"""
proxy_name = userlist_node.userlist_header.proxy_name.text
config_block_lines = self.__build_config_block(
userlist_node.config_block)
return config.Userlist(
na... | [
"def",
"build_userlist",
"(",
"self",
",",
"userlist_node",
")",
":",
"proxy_name",
"=",
"userlist_node",
".",
"userlist_header",
".",
"proxy_name",
".",
"text",
"config_block_lines",
"=",
"self",
".",
"__build_config_block",
"(",
"userlist_node",
".",
"config_block... | parse `userlist` sections, and return a config.Userlist | [
"parse",
"userlist",
"sections",
"and",
"return",
"a",
"config",
".",
"Userlist"
] | 4f0904acfc6bdb29ba6104ce2f6724c0330441d3 | https://github.com/imjoey/pyhaproxy/blob/4f0904acfc6bdb29ba6104ce2f6724c0330441d3/pyhaproxy/parse.py#L126-L133 | train | 63,252 |
imjoey/pyhaproxy | pyhaproxy/parse.py | Parser.build_listen | def build_listen(self, listen_node):
"""parse `listen` sections, and return a config.Listen
Args:
listen_node (TreeNode): Description
Returns:
config.Listen: an object
"""
proxy_name = listen_node.listen_header.proxy_name.text
service_address_nod... | python | def build_listen(self, listen_node):
"""parse `listen` sections, and return a config.Listen
Args:
listen_node (TreeNode): Description
Returns:
config.Listen: an object
"""
proxy_name = listen_node.listen_header.proxy_name.text
service_address_nod... | [
"def",
"build_listen",
"(",
"self",
",",
"listen_node",
")",
":",
"proxy_name",
"=",
"listen_node",
".",
"listen_header",
".",
"proxy_name",
".",
"text",
"service_address_node",
"=",
"listen_node",
".",
"listen_header",
".",
"service_address",
"# parse the config bloc... | parse `listen` sections, and return a config.Listen
Args:
listen_node (TreeNode): Description
Returns:
config.Listen: an object | [
"parse",
"listen",
"sections",
"and",
"return",
"a",
"config",
".",
"Listen"
] | 4f0904acfc6bdb29ba6104ce2f6724c0330441d3 | https://github.com/imjoey/pyhaproxy/blob/4f0904acfc6bdb29ba6104ce2f6724c0330441d3/pyhaproxy/parse.py#L135-L168 | train | 63,253 |
imjoey/pyhaproxy | pyhaproxy/parse.py | Parser.build_frontend | def build_frontend(self, frontend_node):
"""parse `frontend` sections, and return a config.Frontend
Args:
frontend_node (TreeNode): Description
Raises:
Exception: Description
Returns:
config.Frontend: an object
"""
proxy_name = front... | python | def build_frontend(self, frontend_node):
"""parse `frontend` sections, and return a config.Frontend
Args:
frontend_node (TreeNode): Description
Raises:
Exception: Description
Returns:
config.Frontend: an object
"""
proxy_name = front... | [
"def",
"build_frontend",
"(",
"self",
",",
"frontend_node",
")",
":",
"proxy_name",
"=",
"frontend_node",
".",
"frontend_header",
".",
"proxy_name",
".",
"text",
"service_address_node",
"=",
"frontend_node",
".",
"frontend_header",
".",
"service_address",
"# parse the... | parse `frontend` sections, and return a config.Frontend
Args:
frontend_node (TreeNode): Description
Raises:
Exception: Description
Returns:
config.Frontend: an object | [
"parse",
"frontend",
"sections",
"and",
"return",
"a",
"config",
".",
"Frontend"
] | 4f0904acfc6bdb29ba6104ce2f6724c0330441d3 | https://github.com/imjoey/pyhaproxy/blob/4f0904acfc6bdb29ba6104ce2f6724c0330441d3/pyhaproxy/parse.py#L170-L206 | train | 63,254 |
imjoey/pyhaproxy | pyhaproxy/parse.py | Parser.build_backend | def build_backend(self, backend_node):
"""parse `backend` sections
Args:
backend_node (TreeNode): Description
Returns:
config.Backend: an object
"""
proxy_name = backend_node.backend_header.proxy_name.text
config_block_lines = self.__build_config... | python | def build_backend(self, backend_node):
"""parse `backend` sections
Args:
backend_node (TreeNode): Description
Returns:
config.Backend: an object
"""
proxy_name = backend_node.backend_header.proxy_name.text
config_block_lines = self.__build_config... | [
"def",
"build_backend",
"(",
"self",
",",
"backend_node",
")",
":",
"proxy_name",
"=",
"backend_node",
".",
"backend_header",
".",
"proxy_name",
".",
"text",
"config_block_lines",
"=",
"self",
".",
"__build_config_block",
"(",
"backend_node",
".",
"config_block",
... | parse `backend` sections
Args:
backend_node (TreeNode): Description
Returns:
config.Backend: an object | [
"parse",
"backend",
"sections"
] | 4f0904acfc6bdb29ba6104ce2f6724c0330441d3 | https://github.com/imjoey/pyhaproxy/blob/4f0904acfc6bdb29ba6104ce2f6724c0330441d3/pyhaproxy/parse.py#L208-L220 | train | 63,255 |
ahmedaljazzar/django-mako | djangomako/backends.py | MakoBackend.from_string | def from_string(self, template_code):
"""
Trying to compile and return the compiled template code.
:raises: TemplateSyntaxError if there's a syntax error in
the template.
:param template_code: Textual template source.
:return: Returns a compiled Mako template.
""... | python | def from_string(self, template_code):
"""
Trying to compile and return the compiled template code.
:raises: TemplateSyntaxError if there's a syntax error in
the template.
:param template_code: Textual template source.
:return: Returns a compiled Mako template.
""... | [
"def",
"from_string",
"(",
"self",
",",
"template_code",
")",
":",
"try",
":",
"return",
"self",
".",
"template_class",
"(",
"self",
".",
"engine",
".",
"from_string",
"(",
"template_code",
")",
")",
"except",
"mako_exceptions",
".",
"SyntaxException",
"as",
... | Trying to compile and return the compiled template code.
:raises: TemplateSyntaxError if there's a syntax error in
the template.
:param template_code: Textual template source.
:return: Returns a compiled Mako template. | [
"Trying",
"to",
"compile",
"and",
"return",
"the",
"compiled",
"template",
"code",
"."
] | 3a4099e8ae679f431eeb2c35024b2e6028f8a096 | https://github.com/ahmedaljazzar/django-mako/blob/3a4099e8ae679f431eeb2c35024b2e6028f8a096/djangomako/backends.py#L103-L115 | train | 63,256 |
ahmedaljazzar/django-mako | djangomako/backends.py | Template.render | def render(self, context=None, request=None):
"""
Render the template with a given context. Here we're adding
some context variables that are required for all templates in
the system like the statix url and the CSRF tokens, etc.
:param context: It must be a dict if provided
... | python | def render(self, context=None, request=None):
"""
Render the template with a given context. Here we're adding
some context variables that are required for all templates in
the system like the statix url and the CSRF tokens, etc.
:param context: It must be a dict if provided
... | [
"def",
"render",
"(",
"self",
",",
"context",
"=",
"None",
",",
"request",
"=",
"None",
")",
":",
"if",
"context",
"is",
"None",
":",
"context",
"=",
"{",
"}",
"context",
"[",
"'static'",
"]",
"=",
"static",
"context",
"[",
"'url'",
"]",
"=",
"self... | Render the template with a given context. Here we're adding
some context variables that are required for all templates in
the system like the statix url and the CSRF tokens, etc.
:param context: It must be a dict if provided
:param request: It must be a django.http.HttpRequest if provid... | [
"Render",
"the",
"template",
"with",
"a",
"given",
"context",
".",
"Here",
"we",
"re",
"adding",
"some",
"context",
"variables",
"that",
"are",
"required",
"for",
"all",
"templates",
"in",
"the",
"system",
"like",
"the",
"statix",
"url",
"and",
"the",
"CSR... | 3a4099e8ae679f431eeb2c35024b2e6028f8a096 | https://github.com/ahmedaljazzar/django-mako/blob/3a4099e8ae679f431eeb2c35024b2e6028f8a096/djangomako/backends.py#L144-L199 | train | 63,257 |
pysal/spglm | spglm/base.py | LikelihoodModelResults.conf_int | def conf_int(self, alpha=.05, cols=None, method='default'):
"""
Returns the confidence interval of the fitted parameters.
Parameters
----------
alpha : float, optional
The significance level for the confidence interval.
ie., The default `alpha` = ... | python | def conf_int(self, alpha=.05, cols=None, method='default'):
"""
Returns the confidence interval of the fitted parameters.
Parameters
----------
alpha : float, optional
The significance level for the confidence interval.
ie., The default `alpha` = ... | [
"def",
"conf_int",
"(",
"self",
",",
"alpha",
"=",
".05",
",",
"cols",
"=",
"None",
",",
"method",
"=",
"'default'",
")",
":",
"bse",
"=",
"self",
".",
"bse",
"if",
"self",
".",
"use_t",
":",
"dist",
"=",
"stats",
".",
"t",
"df_resid",
"=",
"geta... | Returns the confidence interval of the fitted parameters.
Parameters
----------
alpha : float, optional
The significance level for the confidence interval.
ie., The default `alpha` = .05 returns a 95% confidence
interval.
cols : array-lik... | [
"Returns",
"the",
"confidence",
"interval",
"of",
"the",
"fitted",
"parameters",
"."
] | 1339898adcb7e1638f1da83d57aa37392525f018 | https://github.com/pysal/spglm/blob/1339898adcb7e1638f1da83d57aa37392525f018/spglm/base.py#L340-L412 | train | 63,258 |
senseobservationsystems/commonsense-python-lib | senseapi.py | MD5Hash | def MD5Hash(password):
"""
Returns md5 hash of a string.
@param password (string) - String to be hashed.
@return (string) - Md5 hash of password.
"""
md5_password = md5.new(password)
password_md5 = md5_password.hexdigest()
return password_md5 | python | def MD5Hash(password):
"""
Returns md5 hash of a string.
@param password (string) - String to be hashed.
@return (string) - Md5 hash of password.
"""
md5_password = md5.new(password)
password_md5 = md5_password.hexdigest()
return password_md5 | [
"def",
"MD5Hash",
"(",
"password",
")",
":",
"md5_password",
"=",
"md5",
".",
"new",
"(",
"password",
")",
"password_md5",
"=",
"md5_password",
".",
"hexdigest",
"(",
")",
"return",
"password_md5"
] | Returns md5 hash of a string.
@param password (string) - String to be hashed.
@return (string) - Md5 hash of password. | [
"Returns",
"md5",
"hash",
"of",
"a",
"string",
"."
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L1854-L1864 | train | 63,259 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.setVerbosity | def setVerbosity(self, verbose):
"""
Set verbosity of the SenseApi object.
@param verbose (boolean) - True of False
@return (boolean) - Boolean indicating whether setVerbosity succeeded
"""
if not (verbose == True or verbose =... | python | def setVerbosity(self, verbose):
"""
Set verbosity of the SenseApi object.
@param verbose (boolean) - True of False
@return (boolean) - Boolean indicating whether setVerbosity succeeded
"""
if not (verbose == True or verbose =... | [
"def",
"setVerbosity",
"(",
"self",
",",
"verbose",
")",
":",
"if",
"not",
"(",
"verbose",
"==",
"True",
"or",
"verbose",
"==",
"False",
")",
":",
"return",
"False",
"else",
":",
"self",
".",
"__verbose__",
"=",
"verbose",
"return",
"True"
] | Set verbosity of the SenseApi object.
@param verbose (boolean) - True of False
@return (boolean) - Boolean indicating whether setVerbosity succeeded | [
"Set",
"verbosity",
"of",
"the",
"SenseApi",
"object",
"."
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L46-L58 | train | 63,260 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.setServer | def setServer(self, server):
"""
Set server to interact with.
@param server (string) - 'live' for live server, 'dev' for test server, 'rc' for release candidate
@return (boolean) - Boolean indicating whether setServer succeeded
"""
... | python | def setServer(self, server):
"""
Set server to interact with.
@param server (string) - 'live' for live server, 'dev' for test server, 'rc' for release candidate
@return (boolean) - Boolean indicating whether setServer succeeded
"""
... | [
"def",
"setServer",
"(",
"self",
",",
"server",
")",
":",
"if",
"server",
"==",
"'live'",
":",
"self",
".",
"__server__",
"=",
"server",
"self",
".",
"__server_url__",
"=",
"'api.sense-os.nl'",
"self",
".",
"setUseHTTPS",
"(",
")",
"return",
"True",
"elif"... | Set server to interact with.
@param server (string) - 'live' for live server, 'dev' for test server, 'rc' for release candidate
@return (boolean) - Boolean indicating whether setServer succeeded | [
"Set",
"server",
"to",
"interact",
"with",
"."
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L60-L84 | train | 63,261 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.getAllSensors | def getAllSensors(self):
"""
Retrieve all the user's own sensors by iterating over the SensorsGet function
@return (list) - Array of sensors
"""
j = 0
sensors = []
parameters = {'page':0, 'per_page':1000, 'owned':1}
while True... | python | def getAllSensors(self):
"""
Retrieve all the user's own sensors by iterating over the SensorsGet function
@return (list) - Array of sensors
"""
j = 0
sensors = []
parameters = {'page':0, 'per_page':1000, 'owned':1}
while True... | [
"def",
"getAllSensors",
"(",
"self",
")",
":",
"j",
"=",
"0",
"sensors",
"=",
"[",
"]",
"parameters",
"=",
"{",
"'page'",
":",
"0",
",",
"'per_page'",
":",
"1000",
",",
"'owned'",
":",
"1",
"}",
"while",
"True",
":",
"parameters",
"[",
"'page'",
"]... | Retrieve all the user's own sensors by iterating over the SensorsGet function
@return (list) - Array of sensors | [
"Retrieve",
"all",
"the",
"user",
"s",
"own",
"sensors",
"by",
"iterating",
"over",
"the",
"SensorsGet",
"function"
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L145-L168 | train | 63,262 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.findSensor | def findSensor(self, sensors, sensor_name, device_type = None):
"""
Find a sensor in the provided list of sensors
@param sensors (list) - List of sensors to search in
@param sensor_name (string) - Name of sensor to find
@param device_type (strin... | python | def findSensor(self, sensors, sensor_name, device_type = None):
"""
Find a sensor in the provided list of sensors
@param sensors (list) - List of sensors to search in
@param sensor_name (string) - Name of sensor to find
@param device_type (strin... | [
"def",
"findSensor",
"(",
"self",
",",
"sensors",
",",
"sensor_name",
",",
"device_type",
"=",
"None",
")",
":",
"if",
"device_type",
"==",
"None",
":",
"for",
"sensor",
"in",
"sensors",
":",
"if",
"sensor",
"[",
"'name'",
"]",
"==",
"sensor_name",
":",
... | Find a sensor in the provided list of sensors
@param sensors (list) - List of sensors to search in
@param sensor_name (string) - Name of sensor to find
@param device_type (string) - Device type of sensor to find, can be None
@return (string... | [
"Find",
"a",
"sensor",
"in",
"the",
"provided",
"list",
"of",
"sensors"
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L171-L191 | train | 63,263 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.AuthenticateSessionId | def AuthenticateSessionId(self, username, password):
"""
Authenticate using a username and password.
The SenseApi object will store the obtained session_id internally until a call to LogoutSessionId is performed.
@param username (string) - CommonSense usern... | python | def AuthenticateSessionId(self, username, password):
"""
Authenticate using a username and password.
The SenseApi object will store the obtained session_id internally until a call to LogoutSessionId is performed.
@param username (string) - CommonSense usern... | [
"def",
"AuthenticateSessionId",
"(",
"self",
",",
"username",
",",
"password",
")",
":",
"self",
".",
"__setAuthenticationMethod__",
"(",
"'authenticating_session_id'",
")",
"parameters",
"=",
"{",
"'username'",
":",
"username",
",",
"'password'",
":",
"password",
... | Authenticate using a username and password.
The SenseApi object will store the obtained session_id internally until a call to LogoutSessionId is performed.
@param username (string) - CommonSense username
@param password (string) - MD5Hash of CommonSense password
... | [
"Authenticate",
"using",
"a",
"username",
"and",
"password",
".",
"The",
"SenseApi",
"object",
"will",
"store",
"the",
"obtained",
"session_id",
"internally",
"until",
"a",
"call",
"to",
"LogoutSessionId",
"is",
"performed",
"."
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L327-L359 | train | 63,264 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.LogoutSessionId | def LogoutSessionId(self):
"""
Logout the current session_id from CommonSense
@return (bool) - Boolean indicating whether LogoutSessionId was successful
"""
if self.__SenseApiCall__('/logout.json', 'POST'):
self.__setAuthenticationMethod__(... | python | def LogoutSessionId(self):
"""
Logout the current session_id from CommonSense
@return (bool) - Boolean indicating whether LogoutSessionId was successful
"""
if self.__SenseApiCall__('/logout.json', 'POST'):
self.__setAuthenticationMethod__(... | [
"def",
"LogoutSessionId",
"(",
"self",
")",
":",
"if",
"self",
".",
"__SenseApiCall__",
"(",
"'/logout.json'",
",",
"'POST'",
")",
":",
"self",
".",
"__setAuthenticationMethod__",
"(",
"'not_authenticated'",
")",
"return",
"True",
"else",
":",
"self",
".",
"__... | Logout the current session_id from CommonSense
@return (bool) - Boolean indicating whether LogoutSessionId was successful | [
"Logout",
"the",
"current",
"session_id",
"from",
"CommonSense"
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L361-L372 | train | 63,265 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.AuthenticateOauth | def AuthenticateOauth (self, oauth_token_key, oauth_token_secret, oauth_consumer_key, oauth_consumer_secret):
"""
Authenticate using Oauth
@param oauth_token_key (string) - A valid oauth token key obtained from CommonSense
@param oauth_token_secret (string) ... | python | def AuthenticateOauth (self, oauth_token_key, oauth_token_secret, oauth_consumer_key, oauth_consumer_secret):
"""
Authenticate using Oauth
@param oauth_token_key (string) - A valid oauth token key obtained from CommonSense
@param oauth_token_secret (string) ... | [
"def",
"AuthenticateOauth",
"(",
"self",
",",
"oauth_token_key",
",",
"oauth_token_secret",
",",
"oauth_consumer_key",
",",
"oauth_consumer_secret",
")",
":",
"self",
".",
"__oauth_consumer__",
"=",
"oauth",
".",
"OAuthConsumer",
"(",
"str",
"(",
"oauth_consumer_key",... | Authenticate using Oauth
@param oauth_token_key (string) - A valid oauth token key obtained from CommonSense
@param oauth_token_secret (string) - A valid oauth token secret obtained from CommonSense
@param oauth_consumer_key (string) - A valid oauth consumer key obta... | [
"Authenticate",
"using",
"Oauth"
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L392-L410 | train | 63,266 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.SensorsDelete | def SensorsDelete(self, sensor_id):
"""
Delete a sensor from CommonSense.
@param sensor_id (int) - Sensor id of sensor to delete from CommonSense.
@return (bool) - Boolean indicating whether SensorsDelete was successful.
"""
i... | python | def SensorsDelete(self, sensor_id):
"""
Delete a sensor from CommonSense.
@param sensor_id (int) - Sensor id of sensor to delete from CommonSense.
@return (bool) - Boolean indicating whether SensorsDelete was successful.
"""
i... | [
"def",
"SensorsDelete",
"(",
"self",
",",
"sensor_id",
")",
":",
"if",
"self",
".",
"__SenseApiCall__",
"(",
"'/sensors/{0}.json'",
".",
"format",
"(",
"sensor_id",
")",
",",
"'DELETE'",
")",
":",
"return",
"True",
"else",
":",
"self",
".",
"__error__",
"=... | Delete a sensor from CommonSense.
@param sensor_id (int) - Sensor id of sensor to delete from CommonSense.
@return (bool) - Boolean indicating whether SensorsDelete was successful. | [
"Delete",
"a",
"sensor",
"from",
"CommonSense",
"."
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L575-L587 | train | 63,267 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.SensorsMetatagsGet | def SensorsMetatagsGet(self, parameters, namespace = None):
"""
Retrieve sensors with their metatags.
@param namespace (string) - Namespace for which to retrieve the metatags.
@param parameters (dictionary - Dictionary containing further parameters.
... | python | def SensorsMetatagsGet(self, parameters, namespace = None):
"""
Retrieve sensors with their metatags.
@param namespace (string) - Namespace for which to retrieve the metatags.
@param parameters (dictionary - Dictionary containing further parameters.
... | [
"def",
"SensorsMetatagsGet",
"(",
"self",
",",
"parameters",
",",
"namespace",
"=",
"None",
")",
":",
"ns",
"=",
"\"default\"",
"if",
"namespace",
"is",
"None",
"else",
"namespace",
"parameters",
"[",
"'namespace'",
"]",
"=",
"ns",
"if",
"self",
".",
"__Se... | Retrieve sensors with their metatags.
@param namespace (string) - Namespace for which to retrieve the metatags.
@param parameters (dictionary - Dictionary containing further parameters.
@return (bool) - Boolean indicating whether SensorsMetatagsget was ... | [
"Retrieve",
"sensors",
"with",
"their",
"metatags",
"."
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L625-L640 | train | 63,268 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.GroupSensorsMetatagsGet | def GroupSensorsMetatagsGet(self, group_id, parameters, namespace = None):
"""
Retrieve sensors in a group with their metatags.
@param group_id (int) - Group id for which to retrieve metatags.
@param namespace (string) - Namespace for which to retrieve the m... | python | def GroupSensorsMetatagsGet(self, group_id, parameters, namespace = None):
"""
Retrieve sensors in a group with their metatags.
@param group_id (int) - Group id for which to retrieve metatags.
@param namespace (string) - Namespace for which to retrieve the m... | [
"def",
"GroupSensorsMetatagsGet",
"(",
"self",
",",
"group_id",
",",
"parameters",
",",
"namespace",
"=",
"None",
")",
":",
"ns",
"=",
"\"default\"",
"if",
"namespace",
"is",
"None",
"else",
"namespace",
"parameters",
"[",
"'namespace'",
"]",
"=",
"ns",
"if"... | Retrieve sensors in a group with their metatags.
@param group_id (int) - Group id for which to retrieve metatags.
@param namespace (string) - Namespace for which to retrieve the metatags.
@param parameters (dictionary) - Dictionary containing further parameters.
... | [
"Retrieve",
"sensors",
"in",
"a",
"group",
"with",
"their",
"metatags",
"."
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L642-L658 | train | 63,269 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.SensorMetatagsGet | def SensorMetatagsGet(self, sensor_id, namespace = None):
"""
Retrieve the metatags of a sensor.
@param sensor_id (int) - Id of the sensor to retrieve metatags from
@param namespace (stirng) - Namespace for which to retrieve metatags.
... | python | def SensorMetatagsGet(self, sensor_id, namespace = None):
"""
Retrieve the metatags of a sensor.
@param sensor_id (int) - Id of the sensor to retrieve metatags from
@param namespace (stirng) - Namespace for which to retrieve metatags.
... | [
"def",
"SensorMetatagsGet",
"(",
"self",
",",
"sensor_id",
",",
"namespace",
"=",
"None",
")",
":",
"ns",
"=",
"\"default\"",
"if",
"namespace",
"is",
"None",
"else",
"namespace",
"if",
"self",
".",
"__SenseApiCall__",
"(",
"'/sensors/{0}/metatags.json'",
".",
... | Retrieve the metatags of a sensor.
@param sensor_id (int) - Id of the sensor to retrieve metatags from
@param namespace (stirng) - Namespace for which to retrieve metatags.
@return (bool) - Boolean indicating whether SensorMetatagsGet was successful | [
"Retrieve",
"the",
"metatags",
"of",
"a",
"sensor",
"."
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L660-L674 | train | 63,270 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.SensorMetatagsPost | def SensorMetatagsPost(self, sensor_id, metatags, namespace = None):
"""
Attach metatags to a sensor for a specific namespace
@param sensor_id (int) - Id of the sensor to attach metatags to
@param namespace (string) - Namespace for which to attach metatags
... | python | def SensorMetatagsPost(self, sensor_id, metatags, namespace = None):
"""
Attach metatags to a sensor for a specific namespace
@param sensor_id (int) - Id of the sensor to attach metatags to
@param namespace (string) - Namespace for which to attach metatags
... | [
"def",
"SensorMetatagsPost",
"(",
"self",
",",
"sensor_id",
",",
"metatags",
",",
"namespace",
"=",
"None",
")",
":",
"ns",
"=",
"\"default\"",
"if",
"namespace",
"is",
"None",
"else",
"namespace",
"if",
"self",
".",
"__SenseApiCall__",
"(",
"\"/sensors/{0}/me... | Attach metatags to a sensor for a specific namespace
@param sensor_id (int) - Id of the sensor to attach metatags to
@param namespace (string) - Namespace for which to attach metatags
@param metatags (dictionary) - Metatags to attach to the sensor
... | [
"Attach",
"metatags",
"to",
"a",
"sensor",
"for",
"a",
"specific",
"namespace"
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L676-L691 | train | 63,271 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.GroupSensorsFind | def GroupSensorsFind(self, group_id, parameters, filters, namespace = None):
"""
Find sensors in a group based on a number of filters on metatags
@param group_id (int) - Id of the group in which to find sensors
@param namespace (string) - Namespace to use in... | python | def GroupSensorsFind(self, group_id, parameters, filters, namespace = None):
"""
Find sensors in a group based on a number of filters on metatags
@param group_id (int) - Id of the group in which to find sensors
@param namespace (string) - Namespace to use in... | [
"def",
"GroupSensorsFind",
"(",
"self",
",",
"group_id",
",",
"parameters",
",",
"filters",
",",
"namespace",
"=",
"None",
")",
":",
"ns",
"=",
"\"default\"",
"if",
"namespace",
"is",
"None",
"else",
"namespace",
"parameters",
"[",
"'namespace'",
"]",
"=",
... | Find sensors in a group based on a number of filters on metatags
@param group_id (int) - Id of the group in which to find sensors
@param namespace (string) - Namespace to use in filtering on metatags
@param parameters (dictionary) - Dictionary containing additional p... | [
"Find",
"sensors",
"in",
"a",
"group",
"based",
"on",
"a",
"number",
"of",
"filters",
"on",
"metatags"
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L744-L761 | train | 63,272 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.MetatagDistinctValuesGet | def MetatagDistinctValuesGet(self, metatag_name, namespace = None):
"""
Find the distinct value of a metatag name in a certain namespace
@param metatag_name (string) - Name of the metatag for which to find the distinct values
@param namespace (stirng) - Name... | python | def MetatagDistinctValuesGet(self, metatag_name, namespace = None):
"""
Find the distinct value of a metatag name in a certain namespace
@param metatag_name (string) - Name of the metatag for which to find the distinct values
@param namespace (stirng) - Name... | [
"def",
"MetatagDistinctValuesGet",
"(",
"self",
",",
"metatag_name",
",",
"namespace",
"=",
"None",
")",
":",
"ns",
"=",
"\"default\"",
"if",
"namespace",
"is",
"None",
"else",
"namespace",
"if",
"self",
".",
"__SenseApiCall__",
"(",
"\"/metatag_name/{0}/distinct_... | Find the distinct value of a metatag name in a certain namespace
@param metatag_name (string) - Name of the metatag for which to find the distinct values
@param namespace (stirng) - Namespace in which to find the distinct values
@return (bool) - Boolean... | [
"Find",
"the",
"distinct",
"value",
"of",
"a",
"metatag",
"name",
"in",
"a",
"certain",
"namespace"
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L763-L777 | train | 63,273 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.SensorDataDelete | def SensorDataDelete(self, sensor_id, data_id):
"""
Delete a sensor datum from a specific sensor in CommonSense.
@param sensor_id (int) - Sensor id of the sensor to delete data from
@param data_id (int) - Id of the data point to delete
... | python | def SensorDataDelete(self, sensor_id, data_id):
"""
Delete a sensor datum from a specific sensor in CommonSense.
@param sensor_id (int) - Sensor id of the sensor to delete data from
@param data_id (int) - Id of the data point to delete
... | [
"def",
"SensorDataDelete",
"(",
"self",
",",
"sensor_id",
",",
"data_id",
")",
":",
"if",
"self",
".",
"__SenseApiCall__",
"(",
"'/sensors/{0}/data/{1}.json'",
".",
"format",
"(",
"sensor_id",
",",
"data_id",
")",
",",
"'DELETE'",
")",
":",
"return",
"True",
... | Delete a sensor datum from a specific sensor in CommonSense.
@param sensor_id (int) - Sensor id of the sensor to delete data from
@param data_id (int) - Id of the data point to delete
@return (bool) - Boolean indicating whether SensorDataDelete was succ... | [
"Delete",
"a",
"sensor",
"datum",
"from",
"a",
"specific",
"sensor",
"in",
"CommonSense",
"."
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L835-L848 | train | 63,274 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.SensorsDataPost | def SensorsDataPost(self, parameters):
"""
Post sensor data to multiple sensors in CommonSense simultaneously.
@param parameters (dictionary) - Data to post to the sensors.
@note - http://www.sense-os.nl/59?nodeId=59&selectedId=11887
... | python | def SensorsDataPost(self, parameters):
"""
Post sensor data to multiple sensors in CommonSense simultaneously.
@param parameters (dictionary) - Data to post to the sensors.
@note - http://www.sense-os.nl/59?nodeId=59&selectedId=11887
... | [
"def",
"SensorsDataPost",
"(",
"self",
",",
"parameters",
")",
":",
"if",
"self",
".",
"__SenseApiCall__",
"(",
"'/sensors/data.json'",
",",
"'POST'",
",",
"parameters",
"=",
"parameters",
")",
":",
"return",
"True",
"else",
":",
"self",
".",
"__error__",
"=... | Post sensor data to multiple sensors in CommonSense simultaneously.
@param parameters (dictionary) - Data to post to the sensors.
@note - http://www.sense-os.nl/59?nodeId=59&selectedId=11887
@return (bool) - Boolean indicating whether Se... | [
"Post",
"sensor",
"data",
"to",
"multiple",
"sensors",
"in",
"CommonSense",
"simultaneously",
"."
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L850-L863 | train | 63,275 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.ServicesDelete | def ServicesDelete (self, sensor_id, service_id):
"""
Delete a service from CommonSense.
@param sensor_id (int) - Sensor id of the sensor the service is connected to.
@param service_id (int) - Sensor id of the service to delete.
@r... | python | def ServicesDelete (self, sensor_id, service_id):
"""
Delete a service from CommonSense.
@param sensor_id (int) - Sensor id of the sensor the service is connected to.
@param service_id (int) - Sensor id of the service to delete.
@r... | [
"def",
"ServicesDelete",
"(",
"self",
",",
"sensor_id",
",",
"service_id",
")",
":",
"if",
"self",
".",
"__SenseApiCall__",
"(",
"'/sensors/{0}/services/{1}.json'",
".",
"format",
"(",
"sensor_id",
",",
"service_id",
")",
",",
"'DELETE'",
")",
":",
"return",
"... | Delete a service from CommonSense.
@param sensor_id (int) - Sensor id of the sensor the service is connected to.
@param service_id (int) - Sensor id of the service to delete.
@return (bool) - Boolean indicating whether ServicesDelete was successful. | [
"Delete",
"a",
"service",
"from",
"CommonSense",
"."
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L903-L916 | train | 63,276 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.ServicesSetUseDataTimestamp | def ServicesSetUseDataTimestamp(self, sensor_id, service_id, parameters):
"""
Indicate whether a math service should use the original timestamps of the incoming data, or let CommonSense timestamp the aggregated data.
@param sensors_id (int) - Sensor id of the sensor the ... | python | def ServicesSetUseDataTimestamp(self, sensor_id, service_id, parameters):
"""
Indicate whether a math service should use the original timestamps of the incoming data, or let CommonSense timestamp the aggregated data.
@param sensors_id (int) - Sensor id of the sensor the ... | [
"def",
"ServicesSetUseDataTimestamp",
"(",
"self",
",",
"sensor_id",
",",
"service_id",
",",
"parameters",
")",
":",
"if",
"self",
".",
"__SenseApiCall__",
"(",
"'/sensors/{0}/services/{1}/SetUseDataTimestamp.json'",
".",
"format",
"(",
"sensor_id",
",",
"service_id",
... | Indicate whether a math service should use the original timestamps of the incoming data, or let CommonSense timestamp the aggregated data.
@param sensors_id (int) - Sensor id of the sensor the service is connected to.
@param service_id (int) - Service id of the service for which ... | [
"Indicate",
"whether",
"a",
"math",
"service",
"should",
"use",
"the",
"original",
"timestamps",
"of",
"the",
"incoming",
"data",
"or",
"let",
"CommonSense",
"timestamp",
"the",
"aggregated",
"data",
"."
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L988-L1003 | train | 63,277 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.CreateUser | def CreateUser (self, parameters):
"""
Create a user
This method creates a user and returns the user object and session
@param parameters (dictionary) - Parameters according to which to create the user.
"""
print "Creating user"
... | python | def CreateUser (self, parameters):
"""
Create a user
This method creates a user and returns the user object and session
@param parameters (dictionary) - Parameters according to which to create the user.
"""
print "Creating user"
... | [
"def",
"CreateUser",
"(",
"self",
",",
"parameters",
")",
":",
"print",
"\"Creating user\"",
"print",
"parameters",
"if",
"self",
".",
"__SenseApiCall__",
"(",
"'/users.json'",
",",
"'POST'",
",",
"parameters",
"=",
"parameters",
")",
":",
"return",
"True",
"e... | Create a user
This method creates a user and returns the user object and session
@param parameters (dictionary) - Parameters according to which to create the user. | [
"Create",
"a",
"user",
"This",
"method",
"creates",
"a",
"user",
"and",
"returns",
"the",
"user",
"object",
"and",
"session"
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L1013-L1026 | train | 63,278 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.UsersUpdate | def UsersUpdate (self, user_id, parameters):
"""
Update the current user.
@param user_id (int) - id of the user to be updated
@param parameters (dictionary) - user object to update the user with
@return (bool) - Boolean indicating ... | python | def UsersUpdate (self, user_id, parameters):
"""
Update the current user.
@param user_id (int) - id of the user to be updated
@param parameters (dictionary) - user object to update the user with
@return (bool) - Boolean indicating ... | [
"def",
"UsersUpdate",
"(",
"self",
",",
"user_id",
",",
"parameters",
")",
":",
"if",
"self",
".",
"__SenseApiCall__",
"(",
"'/users/{0}.json'",
".",
"format",
"(",
"user_id",
")",
",",
"'PUT'",
",",
"parameters",
")",
":",
"return",
"True",
"else",
":",
... | Update the current user.
@param user_id (int) - id of the user to be updated
@param parameters (dictionary) - user object to update the user with
@return (bool) - Boolean indicating whether UserUpdate was successful. | [
"Update",
"the",
"current",
"user",
"."
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L1048-L1061 | train | 63,279 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.UsersChangePassword | def UsersChangePassword (self, current_password, new_password):
"""
Change the password for the current user
@param current_password (string) - md5 hash of the current password of the user
@param new_password (string) - md5 hash of the new password of the us... | python | def UsersChangePassword (self, current_password, new_password):
"""
Change the password for the current user
@param current_password (string) - md5 hash of the current password of the user
@param new_password (string) - md5 hash of the new password of the us... | [
"def",
"UsersChangePassword",
"(",
"self",
",",
"current_password",
",",
"new_password",
")",
":",
"if",
"self",
".",
"__SenseApiCall__",
"(",
"'/change_password'",
",",
"\"POST\"",
",",
"{",
"\"current_password\"",
":",
"current_password",
",",
"\"new_password\"",
... | Change the password for the current user
@param current_password (string) - md5 hash of the current password of the user
@param new_password (string) - md5 hash of the new password of the user (make sure to doublecheck!)
@return (bool) - Boolean indicat... | [
"Change",
"the",
"password",
"for",
"the",
"current",
"user"
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L1063-L1076 | train | 63,280 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.UsersDelete | def UsersDelete (self, user_id):
"""
Delete user.
@return (bool) - Boolean indicating whether UsersDelete was successful.
"""
if self.__SenseApiCall__('/users/{user_id}.json'.format(user_id = user_id), 'DELETE'):
return True
else:... | python | def UsersDelete (self, user_id):
"""
Delete user.
@return (bool) - Boolean indicating whether UsersDelete was successful.
"""
if self.__SenseApiCall__('/users/{user_id}.json'.format(user_id = user_id), 'DELETE'):
return True
else:... | [
"def",
"UsersDelete",
"(",
"self",
",",
"user_id",
")",
":",
"if",
"self",
".",
"__SenseApiCall__",
"(",
"'/users/{user_id}.json'",
".",
"format",
"(",
"user_id",
"=",
"user_id",
")",
",",
"'DELETE'",
")",
":",
"return",
"True",
"else",
":",
"self",
".",
... | Delete user.
@return (bool) - Boolean indicating whether UsersDelete was successful. | [
"Delete",
"user",
"."
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L1078-L1088 | train | 63,281 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.EventsNotificationsDelete | def EventsNotificationsDelete(self, event_notification_id):
"""
Delete an event-notification from CommonSense.
@param event_notification_id (int) - Id of the event-notification to delete.
@return (bool) - Boolean indicating whether EventsNotifi... | python | def EventsNotificationsDelete(self, event_notification_id):
"""
Delete an event-notification from CommonSense.
@param event_notification_id (int) - Id of the event-notification to delete.
@return (bool) - Boolean indicating whether EventsNotifi... | [
"def",
"EventsNotificationsDelete",
"(",
"self",
",",
"event_notification_id",
")",
":",
"if",
"self",
".",
"__SenseApiCall__",
"(",
"'/events/notifications/{0}.json'",
".",
"format",
"(",
"event_notification_id",
")",
",",
"'DELETE'",
")",
":",
"return",
"True",
"e... | Delete an event-notification from CommonSense.
@param event_notification_id (int) - Id of the event-notification to delete.
@return (bool) - Boolean indicating whether EventsNotificationsDelete was successful. | [
"Delete",
"an",
"event",
"-",
"notification",
"from",
"CommonSense",
"."
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L1113-L1125 | train | 63,282 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.TriggersDelete | def TriggersDelete(self, trigger_id):
"""
Delete a trigger from CommonSense.
@param trigger_id (int) - Trigger id of the trigger to delete.
@return (bool) - Boolean indicating whether TriggersDelete was successful.
"""
if self... | python | def TriggersDelete(self, trigger_id):
"""
Delete a trigger from CommonSense.
@param trigger_id (int) - Trigger id of the trigger to delete.
@return (bool) - Boolean indicating whether TriggersDelete was successful.
"""
if self... | [
"def",
"TriggersDelete",
"(",
"self",
",",
"trigger_id",
")",
":",
"if",
"self",
".",
"__SenseApiCall__",
"(",
"'/triggers/{0}'",
".",
"format",
"(",
"trigger_id",
")",
",",
"'DELETE'",
")",
":",
"return",
"True",
"else",
":",
"self",
".",
"__error__",
"="... | Delete a trigger from CommonSense.
@param trigger_id (int) - Trigger id of the trigger to delete.
@return (bool) - Boolean indicating whether TriggersDelete was successful. | [
"Delete",
"a",
"trigger",
"from",
"CommonSense",
"."
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L1168-L1180 | train | 63,283 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.SensorsTriggersNotificationsDelete | def SensorsTriggersNotificationsDelete(self, sensor_id, trigger_id, notification_id):
"""
Disconnect a notification from a sensor-trigger combination.
@param sensor_id (int) - Sensor id if the sensor-trigger combination.
@param trigger_id (int) - Trigger id ... | python | def SensorsTriggersNotificationsDelete(self, sensor_id, trigger_id, notification_id):
"""
Disconnect a notification from a sensor-trigger combination.
@param sensor_id (int) - Sensor id if the sensor-trigger combination.
@param trigger_id (int) - Trigger id ... | [
"def",
"SensorsTriggersNotificationsDelete",
"(",
"self",
",",
"sensor_id",
",",
"trigger_id",
",",
"notification_id",
")",
":",
"if",
"self",
".",
"__SenseApiCall__",
"(",
"'/sensors/{0}/triggers/{1}/notifications/{2}.json'",
".",
"format",
"(",
"sensor_id",
",",
"trig... | Disconnect a notification from a sensor-trigger combination.
@param sensor_id (int) - Sensor id if the sensor-trigger combination.
@param trigger_id (int) - Trigger id of the sensor-trigger combination.
@param notification_id (int) - Notification id of the notificati... | [
"Disconnect",
"a",
"notification",
"from",
"a",
"sensor",
"-",
"trigger",
"combination",
"."
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L1317-L1331 | train | 63,284 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.SensorsTriggersNotificationsPost | def SensorsTriggersNotificationsPost(self, sensor_id, trigger_id, parameters):
"""
Connect a notification to a sensor-trigger combination.
@param sensor_id (int) - Sensor id if the sensor-trigger combination.
@param trigger_id (int) - Trigger id of the senso... | python | def SensorsTriggersNotificationsPost(self, sensor_id, trigger_id, parameters):
"""
Connect a notification to a sensor-trigger combination.
@param sensor_id (int) - Sensor id if the sensor-trigger combination.
@param trigger_id (int) - Trigger id of the senso... | [
"def",
"SensorsTriggersNotificationsPost",
"(",
"self",
",",
"sensor_id",
",",
"trigger_id",
",",
"parameters",
")",
":",
"if",
"self",
".",
"__SenseApiCall__",
"(",
"'/sensors/{0}/triggers/{1}/notifications.json'",
".",
"format",
"(",
"sensor_id",
",",
"trigger_id",
... | Connect a notification to a sensor-trigger combination.
@param sensor_id (int) - Sensor id if the sensor-trigger combination.
@param trigger_id (int) - Trigger id of the sensor-trigger combination.
@param parameters (dictionary) - Dictionary containing the notificati... | [
"Connect",
"a",
"notification",
"to",
"a",
"sensor",
"-",
"trigger",
"combination",
"."
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L1336-L1351 | train | 63,285 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.NotificationsDelete | def NotificationsDelete(self, notification_id):
"""
Delete a notification from CommonSense.
@param notification_id (int) - Notification id of the notification to delete.
@return (bool) - Boolean indicating whether NotificationsDelete was succes... | python | def NotificationsDelete(self, notification_id):
"""
Delete a notification from CommonSense.
@param notification_id (int) - Notification id of the notification to delete.
@return (bool) - Boolean indicating whether NotificationsDelete was succes... | [
"def",
"NotificationsDelete",
"(",
"self",
",",
"notification_id",
")",
":",
"if",
"self",
".",
"__SenseApiCall__",
"(",
"'/notifications/{0}.json'",
".",
"format",
"(",
"notification_id",
")",
",",
"'DELETE'",
")",
":",
"return",
"True",
"else",
":",
"self",
... | Delete a notification from CommonSense.
@param notification_id (int) - Notification id of the notification to delete.
@return (bool) - Boolean indicating whether NotificationsDelete was successful. | [
"Delete",
"a",
"notification",
"from",
"CommonSense",
"."
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L1376-L1388 | train | 63,286 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.DeviceGet | def DeviceGet(self, device_id):
"""
Obtain details of a single device
@param device_id (int) - Device for which to obtain details
"""
if self.__SenseApiCall__('/devices/{0}'.format(device_id), 'GET'):
return True
else:
self.__erro... | python | def DeviceGet(self, device_id):
"""
Obtain details of a single device
@param device_id (int) - Device for which to obtain details
"""
if self.__SenseApiCall__('/devices/{0}'.format(device_id), 'GET'):
return True
else:
self.__erro... | [
"def",
"DeviceGet",
"(",
"self",
",",
"device_id",
")",
":",
"if",
"self",
".",
"__SenseApiCall__",
"(",
"'/devices/{0}'",
".",
"format",
"(",
"device_id",
")",
",",
"'GET'",
")",
":",
"return",
"True",
"else",
":",
"self",
".",
"__error__",
"=",
"\"api ... | Obtain details of a single device
@param device_id (int) - Device for which to obtain details | [
"Obtain",
"details",
"of",
"a",
"single",
"device"
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L1425-L1435 | train | 63,287 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.DeviceSensorsGet | def DeviceSensorsGet(self, device_id, parameters):
"""
Obtain a list of all sensors attached to a device.
@param device_id (int) - Device for which to retrieve sensors
@param parameters (dict) - Search parameters
@return (bool) - Boolean indicating whethe... | python | def DeviceSensorsGet(self, device_id, parameters):
"""
Obtain a list of all sensors attached to a device.
@param device_id (int) - Device for which to retrieve sensors
@param parameters (dict) - Search parameters
@return (bool) - Boolean indicating whethe... | [
"def",
"DeviceSensorsGet",
"(",
"self",
",",
"device_id",
",",
"parameters",
")",
":",
"if",
"self",
".",
"__SenseApiCall__",
"(",
"'/devices/{0}/sensors.json'",
".",
"format",
"(",
"device_id",
")",
",",
"'GET'",
",",
"parameters",
"=",
"parameters",
")",
":"... | Obtain a list of all sensors attached to a device.
@param device_id (int) - Device for which to retrieve sensors
@param parameters (dict) - Search parameters
@return (bool) - Boolean indicating whether DeviceSensorsGet was succesful. | [
"Obtain",
"a",
"list",
"of",
"all",
"sensors",
"attached",
"to",
"a",
"device",
"."
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L1441-L1454 | train | 63,288 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.GroupsDelete | def GroupsDelete(self, group_id):
"""
Delete a group from CommonSense.
@param group_id (int) - group id of group to delete from CommonSense.
@return (bool) - Boolean indicating whether GroupsDelete was successful.
"""
if self.... | python | def GroupsDelete(self, group_id):
"""
Delete a group from CommonSense.
@param group_id (int) - group id of group to delete from CommonSense.
@return (bool) - Boolean indicating whether GroupsDelete was successful.
"""
if self.... | [
"def",
"GroupsDelete",
"(",
"self",
",",
"group_id",
")",
":",
"if",
"self",
".",
"__SenseApiCall__",
"(",
"'/groups/{0}.json'",
".",
"format",
"(",
"group_id",
")",
",",
"'DELETE'",
")",
":",
"return",
"True",
"else",
":",
"self",
".",
"__error__",
"=",
... | Delete a group from CommonSense.
@param group_id (int) - group id of group to delete from CommonSense.
@return (bool) - Boolean indicating whether GroupsDelete was successful. | [
"Delete",
"a",
"group",
"from",
"CommonSense",
"."
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L1507-L1519 | train | 63,289 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.GroupsUsersPost | def GroupsUsersPost(self, parameters, group_id):
"""
Add users to a group in CommonSense.
@param parameters (dictonary) - Dictionary containing the users to add.
@return (bool) - Boolean indicating whether GroupsPost was... | python | def GroupsUsersPost(self, parameters, group_id):
"""
Add users to a group in CommonSense.
@param parameters (dictonary) - Dictionary containing the users to add.
@return (bool) - Boolean indicating whether GroupsPost was... | [
"def",
"GroupsUsersPost",
"(",
"self",
",",
"parameters",
",",
"group_id",
")",
":",
"if",
"self",
".",
"__SenseApiCall__",
"(",
"'/groups/{group_id}/users.json'",
".",
"format",
"(",
"group_id",
"=",
"group_id",
")",
",",
"'POST'",
",",
"parameters",
"=",
"pa... | Add users to a group in CommonSense.
@param parameters (dictonary) - Dictionary containing the users to add.
@return (bool) - Boolean indicating whether GroupsPost was successful. | [
"Add",
"users",
"to",
"a",
"group",
"in",
"CommonSense",
"."
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L1581-L1593 | train | 63,290 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.GroupsUsersDelete | def GroupsUsersDelete(self, group_id, user_id):
"""
Delete a user from a group in CommonSense.
@return (bool) - Boolean indicating whether GroupsPost was successful.
"""
if self.__SenseApiCall__('/groups/{group_id}/users/{user_id}.json'.format(group_id ... | python | def GroupsUsersDelete(self, group_id, user_id):
"""
Delete a user from a group in CommonSense.
@return (bool) - Boolean indicating whether GroupsPost was successful.
"""
if self.__SenseApiCall__('/groups/{group_id}/users/{user_id}.json'.format(group_id ... | [
"def",
"GroupsUsersDelete",
"(",
"self",
",",
"group_id",
",",
"user_id",
")",
":",
"if",
"self",
".",
"__SenseApiCall__",
"(",
"'/groups/{group_id}/users/{user_id}.json'",
".",
"format",
"(",
"group_id",
"=",
"group_id",
",",
"user_id",
"=",
"user_id",
")",
","... | Delete a user from a group in CommonSense.
@return (bool) - Boolean indicating whether GroupsPost was successful. | [
"Delete",
"a",
"user",
"from",
"a",
"group",
"in",
"CommonSense",
"."
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L1595-L1605 | train | 63,291 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.SensorShare | def SensorShare(self, sensor_id, parameters):
"""
Share a sensor with a user
@param sensor_id (int) - Id of sensor to be shared
@param parameters (dictionary) - Additional parameters for the call
@return (bool) - Boolean indicating whether the ShareSensor... | python | def SensorShare(self, sensor_id, parameters):
"""
Share a sensor with a user
@param sensor_id (int) - Id of sensor to be shared
@param parameters (dictionary) - Additional parameters for the call
@return (bool) - Boolean indicating whether the ShareSensor... | [
"def",
"SensorShare",
"(",
"self",
",",
"sensor_id",
",",
"parameters",
")",
":",
"if",
"not",
"parameters",
"[",
"'user'",
"]",
"[",
"'id'",
"]",
":",
"parameters",
"[",
"'user'",
"]",
".",
"pop",
"(",
"'id'",
")",
"if",
"not",
"parameters",
"[",
"'... | Share a sensor with a user
@param sensor_id (int) - Id of sensor to be shared
@param parameters (dictionary) - Additional parameters for the call
@return (bool) - Boolean indicating whether the ShareSensor call was successful | [
"Share",
"a",
"sensor",
"with",
"a",
"user"
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L1625-L1645 | train | 63,292 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.GroupsSensorsPost | def GroupsSensorsPost(self, group_id, sensors):
"""
Share a number of sensors within a group.
@param group_id (int) - Id of the group to share sensors with
@param sensors (dictionary) - Dictionary containing the sensors to share within the groups
... | python | def GroupsSensorsPost(self, group_id, sensors):
"""
Share a number of sensors within a group.
@param group_id (int) - Id of the group to share sensors with
@param sensors (dictionary) - Dictionary containing the sensors to share within the groups
... | [
"def",
"GroupsSensorsPost",
"(",
"self",
",",
"group_id",
",",
"sensors",
")",
":",
"if",
"self",
".",
"__SenseApiCall__",
"(",
"\"/groups/{0}/sensors.json\"",
".",
"format",
"(",
"group_id",
")",
",",
"\"POST\"",
",",
"parameters",
"=",
"sensors",
")",
":",
... | Share a number of sensors within a group.
@param group_id (int) - Id of the group to share sensors with
@param sensors (dictionary) - Dictionary containing the sensors to share within the groups
@return (bool) - Boolean indicating whether the GroupsSens... | [
"Share",
"a",
"number",
"of",
"sensors",
"within",
"a",
"group",
"."
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L1653-L1666 | train | 63,293 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.GroupsSensorsGet | def GroupsSensorsGet(self, group_id, parameters):
"""
Retrieve sensors shared within the group.
@param group_id (int) - Id of the group to retrieve sensors from
@param parameters (dictionary) - Additional parameters for the call
@r... | python | def GroupsSensorsGet(self, group_id, parameters):
"""
Retrieve sensors shared within the group.
@param group_id (int) - Id of the group to retrieve sensors from
@param parameters (dictionary) - Additional parameters for the call
@r... | [
"def",
"GroupsSensorsGet",
"(",
"self",
",",
"group_id",
",",
"parameters",
")",
":",
"if",
"self",
".",
"__SenseApiCall",
"(",
"\"/groups/{0}/sensors.json\"",
".",
"format",
"(",
"group_id",
")",
",",
"\"GET\"",
",",
"parameters",
"=",
"parameters",
")",
":",... | Retrieve sensors shared within the group.
@param group_id (int) - Id of the group to retrieve sensors from
@param parameters (dictionary) - Additional parameters for the call
@return (bool) - Boolean indicating whether GroupsSensorsGet was successful | [
"Retrieve",
"sensors",
"shared",
"within",
"the",
"group",
"."
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L1668-L1681 | train | 63,294 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.GroupsSensorsDelete | def GroupsSensorsDelete(self, group_id, sensor_id):
"""
Stop sharing a sensor within a group
@param group_id (int) - Id of the group to stop sharing the sensor with
@param sensor_id (int) - Id of the sensor to stop sharing
@return ... | python | def GroupsSensorsDelete(self, group_id, sensor_id):
"""
Stop sharing a sensor within a group
@param group_id (int) - Id of the group to stop sharing the sensor with
@param sensor_id (int) - Id of the sensor to stop sharing
@return ... | [
"def",
"GroupsSensorsDelete",
"(",
"self",
",",
"group_id",
",",
"sensor_id",
")",
":",
"if",
"self",
".",
"__SenseApiCall__",
"(",
"\"/groups/{0}/sensors/{1}.json\"",
".",
"format",
"(",
"group_id",
",",
"sensor_id",
")",
",",
"\"DELETE\"",
")",
":",
"return",
... | Stop sharing a sensor within a group
@param group_id (int) - Id of the group to stop sharing the sensor with
@param sensor_id (int) - Id of the sensor to stop sharing
@return (bool) - Boolean indicating whether GroupsSensorsDelete was successful | [
"Stop",
"sharing",
"a",
"sensor",
"within",
"a",
"group"
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L1683-L1696 | train | 63,295 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.DomainsGet | def DomainsGet(self, parameters = None, domain_id = -1):
"""
This method returns the domains of the current user.
The list also contains the domains to which the users has not yet been accepted.
@param parameters (dictonary) - Dictionary containing the para... | python | def DomainsGet(self, parameters = None, domain_id = -1):
"""
This method returns the domains of the current user.
The list also contains the domains to which the users has not yet been accepted.
@param parameters (dictonary) - Dictionary containing the para... | [
"def",
"DomainsGet",
"(",
"self",
",",
"parameters",
"=",
"None",
",",
"domain_id",
"=",
"-",
"1",
")",
":",
"url",
"=",
"''",
"if",
"parameters",
"is",
"None",
"and",
"domain_id",
"<>",
"-",
"1",
":",
"url",
"=",
"'/domains/{0}.json'",
".",
"format",
... | This method returns the domains of the current user.
The list also contains the domains to which the users has not yet been accepted.
@param parameters (dictonary) - Dictionary containing the parameters of the request.
@return (... | [
"This",
"method",
"returns",
"the",
"domains",
"of",
"the",
"current",
"user",
".",
"The",
"list",
"also",
"contains",
"the",
"domains",
"to",
"which",
"the",
"users",
"has",
"not",
"yet",
"been",
"accepted",
"."
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L1704-L1723 | train | 63,296 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.DomainUsersGet | def DomainUsersGet(self, domain_id, parameters):
"""
Retrieve users of the specified domain.
@param domain_id (int) - Id of the domain to retrieve users from
@param parameters (int) - parameters of the api call.
@return (bool) - Bo... | python | def DomainUsersGet(self, domain_id, parameters):
"""
Retrieve users of the specified domain.
@param domain_id (int) - Id of the domain to retrieve users from
@param parameters (int) - parameters of the api call.
@return (bool) - Bo... | [
"def",
"DomainUsersGet",
"(",
"self",
",",
"domain_id",
",",
"parameters",
")",
":",
"if",
"self",
".",
"__SenseApiCall__",
"(",
"'/domains/{0}/users.json'",
".",
"format",
"(",
"domain_id",
")",
",",
"'GET'",
",",
"parameters",
"=",
"parameters",
")",
":",
... | Retrieve users of the specified domain.
@param domain_id (int) - Id of the domain to retrieve users from
@param parameters (int) - parameters of the api call.
@return (bool) - Boolean idicating whether DomainUsersGet was successful. | [
"Retrieve",
"users",
"of",
"the",
"specified",
"domain",
"."
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L1728-L1741 | train | 63,297 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.DomainTokensGet | def DomainTokensGet(self, domain_id):
"""
T his method returns the list of tokens which are available for this domain.
Only domain managers can list domain tokens.
@param domain_id - ID of the domain for which to retrieve tokens
@... | python | def DomainTokensGet(self, domain_id):
"""
T his method returns the list of tokens which are available for this domain.
Only domain managers can list domain tokens.
@param domain_id - ID of the domain for which to retrieve tokens
@... | [
"def",
"DomainTokensGet",
"(",
"self",
",",
"domain_id",
")",
":",
"if",
"self",
".",
"__SenseApiCall__",
"(",
"'/domains/{0}/tokens.json'",
".",
"format",
"(",
"domain_id",
")",
",",
"'GET'",
")",
":",
"return",
"True",
"else",
":",
"self",
".",
"__error__"... | T his method returns the list of tokens which are available for this domain.
Only domain managers can list domain tokens.
@param domain_id - ID of the domain for which to retrieve tokens
@return (bool) - Boolean indicating whether DomainTokensGet was s... | [
"T",
"his",
"method",
"returns",
"the",
"list",
"of",
"tokens",
"which",
"are",
"available",
"for",
"this",
"domain",
".",
"Only",
"domain",
"managers",
"can",
"list",
"domain",
"tokens",
"."
] | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L1764-L1777 | train | 63,298 |
senseobservationsystems/commonsense-python-lib | senseapi.py | SenseAPI.DomainTokensCreate | def DomainTokensCreate(self, domain_id, amount):
"""
This method creates tokens that can be used by users who want to join the domain.
Tokens are automatically deleted after usage.
Only domain managers can create tokens.
"""
if self.__SenseApiCall__('/... | python | def DomainTokensCreate(self, domain_id, amount):
"""
This method creates tokens that can be used by users who want to join the domain.
Tokens are automatically deleted after usage.
Only domain managers can create tokens.
"""
if self.__SenseApiCall__('/... | [
"def",
"DomainTokensCreate",
"(",
"self",
",",
"domain_id",
",",
"amount",
")",
":",
"if",
"self",
".",
"__SenseApiCall__",
"(",
"'/domains/{0}/tokens.json'",
".",
"format",
"(",
"domain_id",
")",
",",
"'POST'",
",",
"parameters",
"=",
"{",
"\"amount\"",
":",
... | This method creates tokens that can be used by users who want to join the domain.
Tokens are automatically deleted after usage.
Only domain managers can create tokens. | [
"This",
"method",
"creates",
"tokens",
"that",
"can",
"be",
"used",
"by",
"users",
"who",
"want",
"to",
"join",
"the",
"domain",
".",
"Tokens",
"are",
"automatically",
"deleted",
"after",
"usage",
".",
"Only",
"domain",
"managers",
"can",
"create",
"tokens",... | aac59a1751ef79eb830b3ca1fab6ef2c83931f87 | https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L1779-L1789 | train | 63,299 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.