id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
46,300
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
46,301
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
46,302
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
46,303
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
46,304
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
46,305
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
46,306
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
46,307
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
46,308
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
46,309
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
46,310
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
46,311
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
46,312
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
46,313
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
46,314
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
46,315
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
46,316
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
46,317
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
46,318
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
46,319
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
46,320
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
46,321
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
46,322
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
46,323
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
46,324
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
46,325
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
46,326
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
46,327
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
46,328
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
46,329
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
46,330
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
46,331
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
46,332
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
46,333
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
46,334
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
46,335
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
46,336
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
46,337
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
46,338
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
46,339
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
46,340
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
46,341
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
46,342
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
46,343
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
46,344
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
46,345
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
46,346
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
46,347
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
46,348
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
46,349
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
46,350
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
46,351
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
46,352
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
46,353
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
46,354
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
46,355
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
46,356
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
46,357
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
46,358
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
46,359
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
46,360
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
46,361
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
46,362
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
46,363
senseobservationsystems/commonsense-python-lib
senseapi.py
SenseAPI.DataProcessorsGet
def DataProcessorsGet(self, parameters): """ List the users data processors. @param parameters (dictonary) - Dictionary containing the parameters of the request. @return (bool) - Boolean indicating whether this call was successful. ...
python
def DataProcessorsGet(self, parameters): """ List the users data processors. @param parameters (dictonary) - Dictionary containing the parameters of the request. @return (bool) - Boolean indicating whether this call was successful. ...
[ "def", "DataProcessorsGet", "(", "self", ",", "parameters", ")", ":", "if", "self", ".", "__SenseApiCall__", "(", "'/dataprocessors.json'", ",", "'GET'", ",", "parameters", "=", "parameters", ")", ":", "return", "True", "else", ":", "self", ".", "__error__", ...
List the users data processors. @param parameters (dictonary) - Dictionary containing the parameters of the request. @return (bool) - Boolean indicating whether this call was successful.
[ "List", "the", "users", "data", "processors", "." ]
aac59a1751ef79eb830b3ca1fab6ef2c83931f87
https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L1797-L1809
46,364
senseobservationsystems/commonsense-python-lib
senseapi.py
SenseAPI.DataProcessorsDelete
def DataProcessorsDelete(self, dataProcessorId): """ Delete a data processor in CommonSense. @param dataProcessorId - The id of the data processor that will be deleted. @return (bool) - Boolean indicating whether GroupsP...
python
def DataProcessorsDelete(self, dataProcessorId): """ Delete a data processor in CommonSense. @param dataProcessorId - The id of the data processor that will be deleted. @return (bool) - Boolean indicating whether GroupsP...
[ "def", "DataProcessorsDelete", "(", "self", ",", "dataProcessorId", ")", ":", "if", "self", ".", "__SenseApiCall__", "(", "'/dataprocessors/{id}.json'", ".", "format", "(", "id", "=", "dataProcessorId", ")", ",", "'DELETE'", ")", ":", "return", "True", "else", ...
Delete a data processor in CommonSense. @param dataProcessorId - The id of the data processor that will be deleted. @return (bool) - Boolean indicating whether GroupsPost was successful.
[ "Delete", "a", "data", "processor", "in", "CommonSense", "." ]
aac59a1751ef79eb830b3ca1fab6ef2c83931f87
https://github.com/senseobservationsystems/commonsense-python-lib/blob/aac59a1751ef79eb830b3ca1fab6ef2c83931f87/senseapi.py#L1830-L1842
46,365
pysal/spglm
spglm/varfuncs.py
NegativeBinomial.deriv
def deriv(self, mu): """ Derivative of the negative binomial variance function. """ p = self._clean(mu) return 1 + 2 * self.alpha * p
python
def deriv(self, mu): """ Derivative of the negative binomial variance function. """ p = self._clean(mu) return 1 + 2 * self.alpha * p
[ "def", "deriv", "(", "self", ",", "mu", ")", ":", "p", "=", "self", ".", "_clean", "(", "mu", ")", "return", "1", "+", "2", "*", "self", ".", "alpha", "*", "p" ]
Derivative of the negative binomial variance function.
[ "Derivative", "of", "the", "negative", "binomial", "variance", "function", "." ]
1339898adcb7e1638f1da83d57aa37392525f018
https://github.com/pysal/spglm/blob/1339898adcb7e1638f1da83d57aa37392525f018/spglm/varfuncs.py#L271-L277
46,366
pysal/spglm
spglm/iwls.py
iwls
def iwls(y, x, family, offset, y_fix, ini_betas=None, tol=1.0e-8, max_iter=200, wi=None): """ Iteratively re-weighted least squares estimation routine Parameters ---------- y : array n*1, dependent variable x : array n*k, designs...
python
def iwls(y, x, family, offset, y_fix, ini_betas=None, tol=1.0e-8, max_iter=200, wi=None): """ Iteratively re-weighted least squares estimation routine Parameters ---------- y : array n*1, dependent variable x : array n*k, designs...
[ "def", "iwls", "(", "y", ",", "x", ",", "family", ",", "offset", ",", "y_fix", ",", "ini_betas", "=", "None", ",", "tol", "=", "1.0e-8", ",", "max_iter", "=", "200", ",", "wi", "=", "None", ")", ":", "n_iter", "=", "0", "diff", "=", "1.0e6", "i...
Iteratively re-weighted least squares estimation routine Parameters ---------- y : array n*1, dependent variable x : array n*k, designs matrix of k independent variables family : family object probability models: Gauss...
[ "Iteratively", "re", "-", "weighted", "least", "squares", "estimation", "routine" ]
1339898adcb7e1638f1da83d57aa37392525f018
https://github.com/pysal/spglm/blob/1339898adcb7e1638f1da83d57aa37392525f018/spglm/iwls.py#L42-L152
46,367
pysal/spglm
spglm/utils.py
_next_regular
def _next_regular(target): """ Find the next regular number greater than or equal to target. Regular numbers are composites of the prime factors 2, 3, and 5. Also known as 5-smooth numbers or Hamming numbers, these are the optimal size for inputs to FFTPACK. Target must be a positive integer. ...
python
def _next_regular(target): """ Find the next regular number greater than or equal to target. Regular numbers are composites of the prime factors 2, 3, and 5. Also known as 5-smooth numbers or Hamming numbers, these are the optimal size for inputs to FFTPACK. Target must be a positive integer. ...
[ "def", "_next_regular", "(", "target", ")", ":", "if", "target", "<=", "6", ":", "return", "target", "# Quickly check if it's already a power of 2", "if", "not", "(", "target", "&", "(", "target", "-", "1", ")", ")", ":", "return", "target", "match", "=", ...
Find the next regular number greater than or equal to target. Regular numbers are composites of the prime factors 2, 3, and 5. Also known as 5-smooth numbers or Hamming numbers, these are the optimal size for inputs to FFTPACK. Target must be a positive integer.
[ "Find", "the", "next", "regular", "number", "greater", "than", "or", "equal", "to", "target", ".", "Regular", "numbers", "are", "composites", "of", "the", "prime", "factors", "2", "3", "and", "5", ".", "Also", "known", "as", "5", "-", "smooth", "numbers"...
1339898adcb7e1638f1da83d57aa37392525f018
https://github.com/pysal/spglm/blob/1339898adcb7e1638f1da83d57aa37392525f018/spglm/utils.py#L201-L246
46,368
nudomarinero/wquantiles
wquantiles.py
quantile_1D
def quantile_1D(data, weights, quantile): """ Compute the weighted quantile of a 1D numpy array. Parameters ---------- data : ndarray Input array (one dimension). weights : ndarray Array with the weights of the same size of `data`. quantile : float Quantile to comput...
python
def quantile_1D(data, weights, quantile): """ Compute the weighted quantile of a 1D numpy array. Parameters ---------- data : ndarray Input array (one dimension). weights : ndarray Array with the weights of the same size of `data`. quantile : float Quantile to comput...
[ "def", "quantile_1D", "(", "data", ",", "weights", ",", "quantile", ")", ":", "# Check the data", "if", "not", "isinstance", "(", "data", ",", "np", ".", "matrix", ")", ":", "data", "=", "np", ".", "asarray", "(", "data", ")", "if", "not", "isinstance"...
Compute the weighted quantile of a 1D numpy array. Parameters ---------- data : ndarray Input array (one dimension). weights : ndarray Array with the weights of the same size of `data`. quantile : float Quantile to compute. It must have a value between 0 and 1. Returns ...
[ "Compute", "the", "weighted", "quantile", "of", "a", "1D", "numpy", "array", "." ]
55120dfd9730688c9dc32020563e53ebb902e7f0
https://github.com/nudomarinero/wquantiles/blob/55120dfd9730688c9dc32020563e53ebb902e7f0/wquantiles.py#L11-L54
46,369
nudomarinero/wquantiles
wquantiles.py
quantile
def quantile(data, weights, quantile): """ Weighted quantile of an array with respect to the last axis. Parameters ---------- data : ndarray Input array. weights : ndarray Array with the weights. It must have the same size of the last axis of `data`. quantile : floa...
python
def quantile(data, weights, quantile): """ Weighted quantile of an array with respect to the last axis. Parameters ---------- data : ndarray Input array. weights : ndarray Array with the weights. It must have the same size of the last axis of `data`. quantile : floa...
[ "def", "quantile", "(", "data", ",", "weights", ",", "quantile", ")", ":", "# TODO: Allow to specify the axis", "nd", "=", "data", ".", "ndim", "if", "nd", "==", "0", ":", "TypeError", "(", "\"data must have at least one dimension\"", ")", "elif", "nd", "==", ...
Weighted quantile of an array with respect to the last axis. Parameters ---------- data : ndarray Input array. weights : ndarray Array with the weights. It must have the same size of the last axis of `data`. quantile : float Quantile to compute. It must have a value...
[ "Weighted", "quantile", "of", "an", "array", "with", "respect", "to", "the", "last", "axis", "." ]
55120dfd9730688c9dc32020563e53ebb902e7f0
https://github.com/nudomarinero/wquantiles/blob/55120dfd9730688c9dc32020563e53ebb902e7f0/wquantiles.py#L57-L86
46,370
biocommons/eutils
eutils/queryservice.py
QueryService.einfo
def einfo(self, args=None): """ execute a NON-cached, throttled einfo query einfo.fcgi?db=<database> Input: Entrez database (&db) or None (returns info on all Entrez databases) Output: XML containing database statistics Example: Find database statistics for Entrez Pro...
python
def einfo(self, args=None): """ execute a NON-cached, throttled einfo query einfo.fcgi?db=<database> Input: Entrez database (&db) or None (returns info on all Entrez databases) Output: XML containing database statistics Example: Find database statistics for Entrez Pro...
[ "def", "einfo", "(", "self", ",", "args", "=", "None", ")", ":", "if", "args", "is", "None", ":", "args", "=", "{", "}", "return", "self", ".", "_query", "(", "'/einfo.fcgi'", ",", "args", ",", "skip_cache", "=", "True", ")" ]
execute a NON-cached, throttled einfo query einfo.fcgi?db=<database> Input: Entrez database (&db) or None (returns info on all Entrez databases) Output: XML containing database statistics Example: Find database statistics for Entrez Protein. QueryService.einfo({'db': 'pr...
[ "execute", "a", "NON", "-", "cached", "throttled", "einfo", "query" ]
0ec7444fd520d2af56114122442ff8f60952db0b
https://github.com/biocommons/eutils/blob/0ec7444fd520d2af56114122442ff8f60952db0b/eutils/queryservice.py#L144-L170
46,371
ryan-roemer/django-cloud-browser
cloud_browser/cloud/base.py
CloudObject.native_obj
def native_obj(self): """Native storage object.""" if self.__native is None: self.__native = self._get_object() return self.__native
python
def native_obj(self): """Native storage object.""" if self.__native is None: self.__native = self._get_object() return self.__native
[ "def", "native_obj", "(", "self", ")", ":", "if", "self", ".", "__native", "is", "None", ":", "self", ".", "__native", "=", "self", ".", "_get_object", "(", ")", "return", "self", ".", "__native" ]
Native storage object.
[ "Native", "storage", "object", "." ]
b06cdd24885a6309e843ed924dbf1705b67e7f48
https://github.com/ryan-roemer/django-cloud-browser/blob/b06cdd24885a6309e843ed924dbf1705b67e7f48/cloud_browser/cloud/base.py#L41-L46
46,372
ryan-roemer/django-cloud-browser
cloud_browser/cloud/base.py
CloudObject.smart_content_type
def smart_content_type(self): """Smart content type.""" content_type = self.content_type if content_type in (None, '', 'application/octet-stream'): content_type, _ = mimetypes.guess_type(self.name) return content_type
python
def smart_content_type(self): """Smart content type.""" content_type = self.content_type if content_type in (None, '', 'application/octet-stream'): content_type, _ = mimetypes.guess_type(self.name) return content_type
[ "def", "smart_content_type", "(", "self", ")", ":", "content_type", "=", "self", ".", "content_type", "if", "content_type", "in", "(", "None", ",", "''", ",", "'application/octet-stream'", ")", ":", "content_type", ",", "_", "=", "mimetypes", ".", "guess_type"...
Smart content type.
[ "Smart", "content", "type", "." ]
b06cdd24885a6309e843ed924dbf1705b67e7f48
https://github.com/ryan-roemer/django-cloud-browser/blob/b06cdd24885a6309e843ed924dbf1705b67e7f48/cloud_browser/cloud/base.py#L73-L79
46,373
ryan-roemer/django-cloud-browser
cloud_browser/cloud/base.py
CloudObject.smart_content_encoding
def smart_content_encoding(self): """Smart content encoding.""" encoding = self.content_encoding if not encoding: base_list = self.basename.split('.') while (not encoding) and len(base_list) > 1: _, encoding = mimetypes.guess_type('.'.join(base_list)) ...
python
def smart_content_encoding(self): """Smart content encoding.""" encoding = self.content_encoding if not encoding: base_list = self.basename.split('.') while (not encoding) and len(base_list) > 1: _, encoding = mimetypes.guess_type('.'.join(base_list)) ...
[ "def", "smart_content_encoding", "(", "self", ")", ":", "encoding", "=", "self", ".", "content_encoding", "if", "not", "encoding", ":", "base_list", "=", "self", ".", "basename", ".", "split", "(", "'.'", ")", "while", "(", "not", "encoding", ")", "and", ...
Smart content encoding.
[ "Smart", "content", "encoding", "." ]
b06cdd24885a6309e843ed924dbf1705b67e7f48
https://github.com/ryan-roemer/django-cloud-browser/blob/b06cdd24885a6309e843ed924dbf1705b67e7f48/cloud_browser/cloud/base.py#L82-L91
46,374
ryan-roemer/django-cloud-browser
cloud_browser/cloud/base.py
CloudContainer.native_container
def native_container(self): """Native container object.""" if self.__native is None: self.__native = self._get_container() return self.__native
python
def native_container(self): """Native container object.""" if self.__native is None: self.__native = self._get_container() return self.__native
[ "def", "native_container", "(", "self", ")", ":", "if", "self", ".", "__native", "is", "None", ":", "self", ".", "__native", "=", "self", ".", "_get_container", "(", ")", "return", "self", ".", "__native" ]
Native container object.
[ "Native", "container", "object", "." ]
b06cdd24885a6309e843ed924dbf1705b67e7f48
https://github.com/ryan-roemer/django-cloud-browser/blob/b06cdd24885a6309e843ed924dbf1705b67e7f48/cloud_browser/cloud/base.py#L119-L124
46,375
ryan-roemer/django-cloud-browser
cloud_browser/cloud/base.py
CloudConnection.native_conn
def native_conn(self): """Native connection object.""" if self.__native is None: self.__native = self._get_connection() return self.__native
python
def native_conn(self): """Native connection object.""" if self.__native is None: self.__native = self._get_connection() return self.__native
[ "def", "native_conn", "(", "self", ")", ":", "if", "self", ".", "__native", "is", "None", ":", "self", ".", "__native", "=", "self", ".", "_get_connection", "(", ")", "return", "self", ".", "__native" ]
Native connection object.
[ "Native", "connection", "object", "." ]
b06cdd24885a6309e843ed924dbf1705b67e7f48
https://github.com/ryan-roemer/django-cloud-browser/blob/b06cdd24885a6309e843ed924dbf1705b67e7f48/cloud_browser/cloud/base.py#L155-L160
46,376
ryan-roemer/django-cloud-browser
cloud_browser/app_settings.py
Setting.validate
def validate(self, name, value): """Validate and return a value.""" if self.valid_set and value not in self.valid_set: raise ImproperlyConfigured( "%s: \"%s\" is not a valid setting (choose between %s)." % (name, value, ", ".join("\"%s\"" % x for x in self.va...
python
def validate(self, name, value): """Validate and return a value.""" if self.valid_set and value not in self.valid_set: raise ImproperlyConfigured( "%s: \"%s\" is not a valid setting (choose between %s)." % (name, value, ", ".join("\"%s\"" % x for x in self.va...
[ "def", "validate", "(", "self", ",", "name", ",", "value", ")", ":", "if", "self", ".", "valid_set", "and", "value", "not", "in", "self", ".", "valid_set", ":", "raise", "ImproperlyConfigured", "(", "\"%s: \\\"%s\\\" is not a valid setting (choose between %s).\"", ...
Validate and return a value.
[ "Validate", "and", "return", "a", "value", "." ]
b06cdd24885a6309e843ed924dbf1705b67e7f48
https://github.com/ryan-roemer/django-cloud-browser/blob/b06cdd24885a6309e843ed924dbf1705b67e7f48/cloud_browser/app_settings.py#L26-L34
46,377
ryan-roemer/django-cloud-browser
cloud_browser/app_settings.py
Setting.get
def get(self, name, default=None): """Get value.""" default = default if default is not None else self.default try: value = getattr(_settings, name) except AttributeError: value = os.environ.get(name, default) if self.from_env else default # Convert en...
python
def get(self, name, default=None): """Get value.""" default = default if default is not None else self.default try: value = getattr(_settings, name) except AttributeError: value = os.environ.get(name, default) if self.from_env else default # Convert en...
[ "def", "get", "(", "self", ",", "name", ",", "default", "=", "None", ")", ":", "default", "=", "default", "if", "default", "is", "not", "None", "else", "self", ".", "default", "try", ":", "value", "=", "getattr", "(", "_settings", ",", "name", ")", ...
Get value.
[ "Get", "value", "." ]
b06cdd24885a6309e843ed924dbf1705b67e7f48
https://github.com/ryan-roemer/django-cloud-browser/blob/b06cdd24885a6309e843ed924dbf1705b67e7f48/cloud_browser/app_settings.py#L40-L51
46,378
ryan-roemer/django-cloud-browser
cloud_browser/app_settings.py
Settings._container_whitelist
def _container_whitelist(self): """Container whitelist.""" if self.__container_whitelist is None: self.__container_whitelist = \ set(self.CLOUD_BROWSER_CONTAINER_WHITELIST or []) return self.__container_whitelist
python
def _container_whitelist(self): """Container whitelist.""" if self.__container_whitelist is None: self.__container_whitelist = \ set(self.CLOUD_BROWSER_CONTAINER_WHITELIST or []) return self.__container_whitelist
[ "def", "_container_whitelist", "(", "self", ")", ":", "if", "self", ".", "__container_whitelist", "is", "None", ":", "self", ".", "__container_whitelist", "=", "set", "(", "self", ".", "CLOUD_BROWSER_CONTAINER_WHITELIST", "or", "[", "]", ")", "return", "self", ...
Container whitelist.
[ "Container", "whitelist", "." ]
b06cdd24885a6309e843ed924dbf1705b67e7f48
https://github.com/ryan-roemer/django-cloud-browser/blob/b06cdd24885a6309e843ed924dbf1705b67e7f48/cloud_browser/app_settings.py#L224-L229
46,379
ryan-roemer/django-cloud-browser
cloud_browser/app_settings.py
Settings._container_blacklist
def _container_blacklist(self): """Container blacklist.""" if self.__container_blacklist is None: self.__container_blacklist = \ set(self.CLOUD_BROWSER_CONTAINER_BLACKLIST or []) return self.__container_blacklist
python
def _container_blacklist(self): """Container blacklist.""" if self.__container_blacklist is None: self.__container_blacklist = \ set(self.CLOUD_BROWSER_CONTAINER_BLACKLIST or []) return self.__container_blacklist
[ "def", "_container_blacklist", "(", "self", ")", ":", "if", "self", ".", "__container_blacklist", "is", "None", ":", "self", ".", "__container_blacklist", "=", "set", "(", "self", ".", "CLOUD_BROWSER_CONTAINER_BLACKLIST", "or", "[", "]", ")", "return", "self", ...
Container blacklist.
[ "Container", "blacklist", "." ]
b06cdd24885a6309e843ed924dbf1705b67e7f48
https://github.com/ryan-roemer/django-cloud-browser/blob/b06cdd24885a6309e843ed924dbf1705b67e7f48/cloud_browser/app_settings.py#L232-L237
46,380
ryan-roemer/django-cloud-browser
cloud_browser/app_settings.py
Settings.container_permitted
def container_permitted(self, name): """Return whether or not a container is permitted. :param name: Container name. :return: ``True`` if container is permitted. :rtype: ``bool`` """ white = self._container_whitelist black = self._container_blacklist ret...
python
def container_permitted(self, name): """Return whether or not a container is permitted. :param name: Container name. :return: ``True`` if container is permitted. :rtype: ``bool`` """ white = self._container_whitelist black = self._container_blacklist ret...
[ "def", "container_permitted", "(", "self", ",", "name", ")", ":", "white", "=", "self", ".", "_container_whitelist", "black", "=", "self", ".", "_container_blacklist", "return", "name", "not", "in", "black", "and", "(", "not", "white", "or", "name", "in", ...
Return whether or not a container is permitted. :param name: Container name. :return: ``True`` if container is permitted. :rtype: ``bool``
[ "Return", "whether", "or", "not", "a", "container", "is", "permitted", "." ]
b06cdd24885a6309e843ed924dbf1705b67e7f48
https://github.com/ryan-roemer/django-cloud-browser/blob/b06cdd24885a6309e843ed924dbf1705b67e7f48/cloud_browser/app_settings.py#L239-L248
46,381
ryan-roemer/django-cloud-browser
cloud_browser/app_settings.py
Settings.app_media_url
def app_media_url(self): """Get application media root from real media root URL.""" url = None media_dir = self.CLOUD_BROWSER_STATIC_MEDIA_DIR if media_dir: url = os.path.join(self.MEDIA_URL, media_dir).rstrip('/') + '/' return url
python
def app_media_url(self): """Get application media root from real media root URL.""" url = None media_dir = self.CLOUD_BROWSER_STATIC_MEDIA_DIR if media_dir: url = os.path.join(self.MEDIA_URL, media_dir).rstrip('/') + '/' return url
[ "def", "app_media_url", "(", "self", ")", ":", "url", "=", "None", "media_dir", "=", "self", ".", "CLOUD_BROWSER_STATIC_MEDIA_DIR", "if", "media_dir", ":", "url", "=", "os", ".", "path", ".", "join", "(", "self", ".", "MEDIA_URL", ",", "media_dir", ")", ...
Get application media root from real media root URL.
[ "Get", "application", "media", "root", "from", "real", "media", "root", "URL", "." ]
b06cdd24885a6309e843ed924dbf1705b67e7f48
https://github.com/ryan-roemer/django-cloud-browser/blob/b06cdd24885a6309e843ed924dbf1705b67e7f48/cloud_browser/app_settings.py#L251-L258
46,382
Kitware/tangelo
tangelo/tangelo/pkgdata/plugin/watch/python/__init__.py
module_getmtime
def module_getmtime(filename): """ Get the mtime associated with a module. If this is a .pyc or .pyo file and a corresponding .py file exists, the time of the .py file is returned. :param filename: filename of the module. :returns: mtime or None if the file doesn"t exist. """ if os.path.sp...
python
def module_getmtime(filename): """ Get the mtime associated with a module. If this is a .pyc or .pyo file and a corresponding .py file exists, the time of the .py file is returned. :param filename: filename of the module. :returns: mtime or None if the file doesn"t exist. """ if os.path.sp...
[ "def", "module_getmtime", "(", "filename", ")", ":", "if", "os", ".", "path", ".", "splitext", "(", "filename", ")", "[", "1", "]", ".", "lower", "(", ")", "in", "(", "\".pyc\"", ",", "\".pyo\"", ")", "and", "os", ".", "path", ".", "exists", "(", ...
Get the mtime associated with a module. If this is a .pyc or .pyo file and a corresponding .py file exists, the time of the .py file is returned. :param filename: filename of the module. :returns: mtime or None if the file doesn"t exist.
[ "Get", "the", "mtime", "associated", "with", "a", "module", ".", "If", "this", "is", "a", ".", "pyc", "or", ".", "pyo", "file", "and", "a", "corresponding", ".", "py", "file", "exists", "the", "time", "of", "the", ".", "py", "file", "is", "returned",...
470034ee9b3d7a01becc1ce5fddc7adc1d5263ef
https://github.com/Kitware/tangelo/blob/470034ee9b3d7a01becc1ce5fddc7adc1d5263ef/tangelo/tangelo/pkgdata/plugin/watch/python/__init__.py#L55-L67
46,383
Kitware/tangelo
tangelo/tangelo/pkgdata/plugin/watch/python/__init__.py
module_reload_changed
def module_reload_changed(key): """ Reload a module if it has changed since we last imported it. This is necessary if module a imports script b, script b is changed, and then module c asks to import script b. :param key: our key used in the WatchList. :returns: True if reloaded. """ im...
python
def module_reload_changed(key): """ Reload a module if it has changed since we last imported it. This is necessary if module a imports script b, script b is changed, and then module c asks to import script b. :param key: our key used in the WatchList. :returns: True if reloaded. """ im...
[ "def", "module_reload_changed", "(", "key", ")", ":", "imp", ".", "acquire_lock", "(", ")", "try", ":", "modkey", "=", "module_sys_modules_key", "(", "key", ")", "if", "not", "modkey", ":", "return", "False", "found", "=", "None", "if", "modkey", ":", "f...
Reload a module if it has changed since we last imported it. This is necessary if module a imports script b, script b is changed, and then module c asks to import script b. :param key: our key used in the WatchList. :returns: True if reloaded.
[ "Reload", "a", "module", "if", "it", "has", "changed", "since", "we", "last", "imported", "it", ".", "This", "is", "necessary", "if", "module", "a", "imports", "script", "b", "script", "b", "is", "changed", "and", "then", "module", "c", "asks", "to", "...
470034ee9b3d7a01becc1ce5fddc7adc1d5263ef
https://github.com/Kitware/tangelo/blob/470034ee9b3d7a01becc1ce5fddc7adc1d5263ef/tangelo/tangelo/pkgdata/plugin/watch/python/__init__.py#L70-L104
46,384
Kitware/tangelo
tangelo/tangelo/pkgdata/plugin/watch/python/__init__.py
module_sys_modules_key
def module_sys_modules_key(key): """ Check if a module is in the sys.modules dictionary in some manner. If so, return the key used in that dictionary. :param key: our key to the module. :returns: the key in sys.modules or None. """ moduleparts = key.split(".") for partnum, part in enum...
python
def module_sys_modules_key(key): """ Check if a module is in the sys.modules dictionary in some manner. If so, return the key used in that dictionary. :param key: our key to the module. :returns: the key in sys.modules or None. """ moduleparts = key.split(".") for partnum, part in enum...
[ "def", "module_sys_modules_key", "(", "key", ")", ":", "moduleparts", "=", "key", ".", "split", "(", "\".\"", ")", "for", "partnum", ",", "part", "in", "enumerate", "(", "moduleparts", ")", ":", "modkey", "=", "\".\"", ".", "join", "(", "moduleparts", "[...
Check if a module is in the sys.modules dictionary in some manner. If so, return the key used in that dictionary. :param key: our key to the module. :returns: the key in sys.modules or None.
[ "Check", "if", "a", "module", "is", "in", "the", "sys", ".", "modules", "dictionary", "in", "some", "manner", ".", "If", "so", "return", "the", "key", "used", "in", "that", "dictionary", "." ]
470034ee9b3d7a01becc1ce5fddc7adc1d5263ef
https://github.com/Kitware/tangelo/blob/470034ee9b3d7a01becc1ce5fddc7adc1d5263ef/tangelo/tangelo/pkgdata/plugin/watch/python/__init__.py#L107-L120
46,385
Kitware/tangelo
tangelo/tangelo/pkgdata/plugin/watch/python/__init__.py
reload_including_local
def reload_including_local(module): """ Reload a module. If it isn"t found, try to include the local service directory. This must be called from a thread that has acquired the import lock. :param module: the module to reload. """ try: reload(module) except ImportError: ...
python
def reload_including_local(module): """ Reload a module. If it isn"t found, try to include the local service directory. This must be called from a thread that has acquired the import lock. :param module: the module to reload. """ try: reload(module) except ImportError: ...
[ "def", "reload_including_local", "(", "module", ")", ":", "try", ":", "reload", "(", "module", ")", "except", "ImportError", ":", "# This can happen if the module was loaded in the immediate script", "# directory. Add the service path and try again.", "if", "not", "hasattr", ...
Reload a module. If it isn"t found, try to include the local service directory. This must be called from a thread that has acquired the import lock. :param module: the module to reload.
[ "Reload", "a", "module", ".", "If", "it", "isn", "t", "found", "try", "to", "include", "the", "local", "service", "directory", ".", "This", "must", "be", "called", "from", "a", "thread", "that", "has", "acquired", "the", "import", "lock", "." ]
470034ee9b3d7a01becc1ce5fddc7adc1d5263ef
https://github.com/Kitware/tangelo/blob/470034ee9b3d7a01becc1ce5fddc7adc1d5263ef/tangelo/tangelo/pkgdata/plugin/watch/python/__init__.py#L123-L148
46,386
Kitware/tangelo
tangelo/tangelo/pkgdata/plugin/watch/python/__init__.py
reload_recent_submodules
def reload_recent_submodules(module, mtime=0, processed=[]): """ Recursively reload submodules which are more recent than a specified timestamp. To be called from a thread that has acquired the import lock to be thread safe. :param module: the module name. The WatchList is checked for modules tha...
python
def reload_recent_submodules(module, mtime=0, processed=[]): """ Recursively reload submodules which are more recent than a specified timestamp. To be called from a thread that has acquired the import lock to be thread safe. :param module: the module name. The WatchList is checked for modules tha...
[ "def", "reload_recent_submodules", "(", "module", ",", "mtime", "=", "0", ",", "processed", "=", "[", "]", ")", ":", "if", "module", ".", "endswith", "(", "\".py\"", ")", ":", "module", "=", "module", "[", ":", "-", "3", "]", "if", "module", "in", ...
Recursively reload submodules which are more recent than a specified timestamp. To be called from a thread that has acquired the import lock to be thread safe. :param module: the module name. The WatchList is checked for modules that list this as a parent. :param mtime: the latest ...
[ "Recursively", "reload", "submodules", "which", "are", "more", "recent", "than", "a", "specified", "timestamp", ".", "To", "be", "called", "from", "a", "thread", "that", "has", "acquired", "the", "import", "lock", "to", "be", "thread", "safe", "." ]
470034ee9b3d7a01becc1ce5fddc7adc1d5263ef
https://github.com/Kitware/tangelo/blob/470034ee9b3d7a01becc1ce5fddc7adc1d5263ef/tangelo/tangelo/pkgdata/plugin/watch/python/__init__.py#L151-L189
46,387
Kitware/tangelo
tangelo/tangelo/pkgdata/plugin/watch/python/__init__.py
watch_import
def watch_import(name, globals=None, *args, **kwargs): """ When a module is asked to be imported, check if we have previously imported it. If so, check if the time stamp of it, a companion yaml file, or any modules it imports have changed. If so, reimport the module. :params: see __builtin__.__im...
python
def watch_import(name, globals=None, *args, **kwargs): """ When a module is asked to be imported, check if we have previously imported it. If so, check if the time stamp of it, a companion yaml file, or any modules it imports have changed. If so, reimport the module. :params: see __builtin__.__im...
[ "def", "watch_import", "(", "name", ",", "globals", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Don\"t monitor builtin modules. types seem special, so don\"t monitor it", "# either.", "monitor", "=", "not", "imp", ".", "is_builtin", "(", ...
When a module is asked to be imported, check if we have previously imported it. If so, check if the time stamp of it, a companion yaml file, or any modules it imports have changed. If so, reimport the module. :params: see __builtin__.__import__
[ "When", "a", "module", "is", "asked", "to", "be", "imported", "check", "if", "we", "have", "previously", "imported", "it", ".", "If", "so", "check", "if", "the", "time", "stamp", "of", "it", "a", "companion", "yaml", "file", "or", "any", "modules", "it...
470034ee9b3d7a01becc1ce5fddc7adc1d5263ef
https://github.com/Kitware/tangelo/blob/470034ee9b3d7a01becc1ce5fddc7adc1d5263ef/tangelo/tangelo/pkgdata/plugin/watch/python/__init__.py#L192-L234
46,388
Kitware/tangelo
tangelo/tangelo/pkgdata/plugin/watch/python/__init__.py
watch_module_cache_get
def watch_module_cache_get(cache, module): """ When we ask to fetch a module with optional config file, check time stamps and dependencies to determine if it should be reloaded or not. :param cache: the cache object that stores whether to check for config files and which files have be...
python
def watch_module_cache_get(cache, module): """ When we ask to fetch a module with optional config file, check time stamps and dependencies to determine if it should be reloaded or not. :param cache: the cache object that stores whether to check for config files and which files have be...
[ "def", "watch_module_cache_get", "(", "cache", ",", "module", ")", ":", "imp", ".", "acquire_lock", "(", ")", "try", ":", "if", "not", "hasattr", "(", "cache", ",", "\"timestamps\"", ")", ":", "cache", ".", "timestamps", "=", "{", "}", "mtime", "=", "o...
When we ask to fetch a module with optional config file, check time stamps and dependencies to determine if it should be reloaded or not. :param cache: the cache object that stores whether to check for config files and which files have been loaded. :param module: the path of the module to...
[ "When", "we", "ask", "to", "fetch", "a", "module", "with", "optional", "config", "file", "check", "time", "stamps", "and", "dependencies", "to", "determine", "if", "it", "should", "be", "reloaded", "or", "not", "." ]
470034ee9b3d7a01becc1ce5fddc7adc1d5263ef
https://github.com/Kitware/tangelo/blob/470034ee9b3d7a01becc1ce5fddc7adc1d5263ef/tangelo/tangelo/pkgdata/plugin/watch/python/__init__.py#L237-L282
46,389
ryan-roemer/django-cloud-browser
cloud_browser/common.py
get_int
def get_int(value, default, test_fn=None): """Convert value to integer. :param value: Integer value. :param default: Default value on failed conversion. :param test_fn: Constraint function. Use default if returns ``False``. :return: Integer value. :rtype: ``int`` """ try: conve...
python
def get_int(value, default, test_fn=None): """Convert value to integer. :param value: Integer value. :param default: Default value on failed conversion. :param test_fn: Constraint function. Use default if returns ``False``. :return: Integer value. :rtype: ``int`` """ try: conve...
[ "def", "get_int", "(", "value", ",", "default", ",", "test_fn", "=", "None", ")", ":", "try", ":", "converted", "=", "int", "(", "value", ")", "except", "ValueError", ":", "return", "default", "test_fn", "=", "test_fn", "if", "test_fn", "else", "lambda",...
Convert value to integer. :param value: Integer value. :param default: Default value on failed conversion. :param test_fn: Constraint function. Use default if returns ``False``. :return: Integer value. :rtype: ``int``
[ "Convert", "value", "to", "integer", "." ]
b06cdd24885a6309e843ed924dbf1705b67e7f48
https://github.com/ryan-roemer/django-cloud-browser/blob/b06cdd24885a6309e843ed924dbf1705b67e7f48/cloud_browser/common.py#L23-L38
46,390
ryan-roemer/django-cloud-browser
cloud_browser/common.py
requires
def requires(module, name=""): """Enforces module presence. The general use here is to allow conditional imports that may fail (e.g., a required python package is not installed) but still allow the rest of the python package to compile and run fine. If the wrapped method with this decorated is invo...
python
def requires(module, name=""): """Enforces module presence. The general use here is to allow conditional imports that may fail (e.g., a required python package is not installed) but still allow the rest of the python package to compile and run fine. If the wrapped method with this decorated is invo...
[ "def", "requires", "(", "module", ",", "name", "=", "\"\"", ")", ":", "def", "wrapped", "(", "method", ")", ":", "\"\"\"Call and enforce method.\"\"\"", "if", "module", "is", "None", ":", "raise", "ImproperlyConfigured", "(", "\"Module '%s' is not installed.\"", "...
Enforces module presence. The general use here is to allow conditional imports that may fail (e.g., a required python package is not installed) but still allow the rest of the python package to compile and run fine. If the wrapped method with this decorated is invoked, then a runtime error is generated...
[ "Enforces", "module", "presence", "." ]
b06cdd24885a6309e843ed924dbf1705b67e7f48
https://github.com/ryan-roemer/django-cloud-browser/blob/b06cdd24885a6309e843ed924dbf1705b67e7f48/cloud_browser/common.py#L51-L70
46,391
ryan-roemer/django-cloud-browser
cloud_browser/common.py
dt_from_header
def dt_from_header(date_str): """Try various RFC conversions to ``datetime`` or return ``None``. :param date_str: Date string. :type date_str: ``string`` :return: Date time. :rtype: :class:`datetime.datetime` or ``None`` """ convert_fns = ( dt_from_rfc8601, dt_from_rfc1123...
python
def dt_from_header(date_str): """Try various RFC conversions to ``datetime`` or return ``None``. :param date_str: Date string. :type date_str: ``string`` :return: Date time. :rtype: :class:`datetime.datetime` or ``None`` """ convert_fns = ( dt_from_rfc8601, dt_from_rfc1123...
[ "def", "dt_from_header", "(", "date_str", ")", ":", "convert_fns", "=", "(", "dt_from_rfc8601", ",", "dt_from_rfc1123", ",", ")", "for", "convert_fn", "in", "convert_fns", ":", "try", ":", "return", "convert_fn", "(", "date_str", ")", "except", "ValueError", "...
Try various RFC conversions to ``datetime`` or return ``None``. :param date_str: Date string. :type date_str: ``string`` :return: Date time. :rtype: :class:`datetime.datetime` or ``None``
[ "Try", "various", "RFC", "conversions", "to", "datetime", "or", "return", "None", "." ]
b06cdd24885a6309e843ed924dbf1705b67e7f48
https://github.com/ryan-roemer/django-cloud-browser/blob/b06cdd24885a6309e843ed924dbf1705b67e7f48/cloud_browser/common.py#L111-L130
46,392
ryan-roemer/django-cloud-browser
cloud_browser/common.py
basename
def basename(path): """Rightmost part of path after separator.""" base_path = path.strip(SEP) sep_ind = base_path.rfind(SEP) if sep_ind < 0: return path return base_path[sep_ind + 1:]
python
def basename(path): """Rightmost part of path after separator.""" base_path = path.strip(SEP) sep_ind = base_path.rfind(SEP) if sep_ind < 0: return path return base_path[sep_ind + 1:]
[ "def", "basename", "(", "path", ")", ":", "base_path", "=", "path", ".", "strip", "(", "SEP", ")", "sep_ind", "=", "base_path", ".", "rfind", "(", "SEP", ")", "if", "sep_ind", "<", "0", ":", "return", "path", "return", "base_path", "[", "sep_ind", "+...
Rightmost part of path after separator.
[ "Rightmost", "part", "of", "path", "after", "separator", "." ]
b06cdd24885a6309e843ed924dbf1705b67e7f48
https://github.com/ryan-roemer/django-cloud-browser/blob/b06cdd24885a6309e843ed924dbf1705b67e7f48/cloud_browser/common.py#L136-L143
46,393
ryan-roemer/django-cloud-browser
cloud_browser/common.py
path_parts
def path_parts(path): """Split path into container, object. :param path: Path to resource (including container). :type path: `string` :return: Container, storage object tuple. :rtype: `tuple` of `string`, `string` """ path = path if path is not None else '' container_path = object_pat...
python
def path_parts(path): """Split path into container, object. :param path: Path to resource (including container). :type path: `string` :return: Container, storage object tuple. :rtype: `tuple` of `string`, `string` """ path = path if path is not None else '' container_path = object_pat...
[ "def", "path_parts", "(", "path", ")", ":", "path", "=", "path", "if", "path", "is", "not", "None", "else", "''", "container_path", "=", "object_path", "=", "''", "parts", "=", "path_list", "(", "path", ")", "if", "len", "(", "parts", ")", ">=", "1",...
Split path into container, object. :param path: Path to resource (including container). :type path: `string` :return: Container, storage object tuple. :rtype: `tuple` of `string`, `string`
[ "Split", "path", "into", "container", "object", "." ]
b06cdd24885a6309e843ed924dbf1705b67e7f48
https://github.com/ryan-roemer/django-cloud-browser/blob/b06cdd24885a6309e843ed924dbf1705b67e7f48/cloud_browser/common.py#L146-L163
46,394
ryan-roemer/django-cloud-browser
cloud_browser/common.py
path_yield
def path_yield(path): """Yield on all path parts.""" for part in (x for x in path.strip(SEP).split(SEP) if x not in (None, '')): yield part
python
def path_yield(path): """Yield on all path parts.""" for part in (x for x in path.strip(SEP).split(SEP) if x not in (None, '')): yield part
[ "def", "path_yield", "(", "path", ")", ":", "for", "part", "in", "(", "x", "for", "x", "in", "path", ".", "strip", "(", "SEP", ")", ".", "split", "(", "SEP", ")", "if", "x", "not", "in", "(", "None", ",", "''", ")", ")", ":", "yield", "part" ...
Yield on all path parts.
[ "Yield", "on", "all", "path", "parts", "." ]
b06cdd24885a6309e843ed924dbf1705b67e7f48
https://github.com/ryan-roemer/django-cloud-browser/blob/b06cdd24885a6309e843ed924dbf1705b67e7f48/cloud_browser/common.py#L166-L169
46,395
ryan-roemer/django-cloud-browser
cloud_browser/common.py
path_join
def path_join(*args): """Join path parts to single path.""" return SEP.join((x for x in args if x not in (None, ''))).strip(SEP)
python
def path_join(*args): """Join path parts to single path.""" return SEP.join((x for x in args if x not in (None, ''))).strip(SEP)
[ "def", "path_join", "(", "*", "args", ")", ":", "return", "SEP", ".", "join", "(", "(", "x", "for", "x", "in", "args", "if", "x", "not", "in", "(", "None", ",", "''", ")", ")", ")", ".", "strip", "(", "SEP", ")" ]
Join path parts to single path.
[ "Join", "path", "parts", "to", "single", "path", "." ]
b06cdd24885a6309e843ed924dbf1705b67e7f48
https://github.com/ryan-roemer/django-cloud-browser/blob/b06cdd24885a6309e843ed924dbf1705b67e7f48/cloud_browser/common.py#L177-L179
46,396
ryan-roemer/django-cloud-browser
cloud_browser/common.py
relpath
def relpath(path, start): """Get relative path to start. Note: Modeled after python2.6 :meth:`os.path.relpath`. """ path_items = path_list(path) start_items = path_list(start) # Find common parts of path. common = [] for pth, stt in zip(path_items, start_items): if pth != stt: ...
python
def relpath(path, start): """Get relative path to start. Note: Modeled after python2.6 :meth:`os.path.relpath`. """ path_items = path_list(path) start_items = path_list(start) # Find common parts of path. common = [] for pth, stt in zip(path_items, start_items): if pth != stt: ...
[ "def", "relpath", "(", "path", ",", "start", ")", ":", "path_items", "=", "path_list", "(", "path", ")", "start_items", "=", "path_list", "(", "start", ")", "# Find common parts of path.", "common", "=", "[", "]", "for", "pth", ",", "stt", "in", "zip", "...
Get relative path to start. Note: Modeled after python2.6 :meth:`os.path.relpath`.
[ "Get", "relative", "path", "to", "start", "." ]
b06cdd24885a6309e843ed924dbf1705b67e7f48
https://github.com/ryan-roemer/django-cloud-browser/blob/b06cdd24885a6309e843ed924dbf1705b67e7f48/cloud_browser/common.py#L182-L203
46,397
bjmorgan/lattice_mc
lattice_mc/species.py
Species.collective_dr_squared
def collective_dr_squared( self ): """ Squared sum of total displacements for these atoms. Args: None Returns: (Float): The square of the summed total displacements for these atoms. """ return sum( np.square( sum( [ atom.dr for atom in self.atoms...
python
def collective_dr_squared( self ): """ Squared sum of total displacements for these atoms. Args: None Returns: (Float): The square of the summed total displacements for these atoms. """ return sum( np.square( sum( [ atom.dr for atom in self.atoms...
[ "def", "collective_dr_squared", "(", "self", ")", ":", "return", "sum", "(", "np", ".", "square", "(", "sum", "(", "[", "atom", ".", "dr", "for", "atom", "in", "self", ".", "atoms", "]", ")", ")", ")" ]
Squared sum of total displacements for these atoms. Args: None Returns: (Float): The square of the summed total displacements for these atoms.
[ "Squared", "sum", "of", "total", "displacements", "for", "these", "atoms", "." ]
7fa7be85f2f23a2d8dfd0830ecdb89d0dbf2bfd5
https://github.com/bjmorgan/lattice_mc/blob/7fa7be85f2f23a2d8dfd0830ecdb89d0dbf2bfd5/lattice_mc/species.py#L46-L56
46,398
bjmorgan/lattice_mc
lattice_mc/species.py
Species.occupations
def occupations( self, site_label ): """ Number of these atoms occupying a specific site type. Args: site_label (Str): Label for the site type being considered. Returns: (Int): Number of atoms occupying sites of type `site_label`. """ return sum(...
python
def occupations( self, site_label ): """ Number of these atoms occupying a specific site type. Args: site_label (Str): Label for the site type being considered. Returns: (Int): Number of atoms occupying sites of type `site_label`. """ return sum(...
[ "def", "occupations", "(", "self", ",", "site_label", ")", ":", "return", "sum", "(", "atom", ".", "site", ".", "label", "==", "site_label", "for", "atom", "in", "self", ".", "atoms", ")" ]
Number of these atoms occupying a specific site type. Args: site_label (Str): Label for the site type being considered. Returns: (Int): Number of atoms occupying sites of type `site_label`.
[ "Number", "of", "these", "atoms", "occupying", "a", "specific", "site", "type", "." ]
7fa7be85f2f23a2d8dfd0830ecdb89d0dbf2bfd5
https://github.com/bjmorgan/lattice_mc/blob/7fa7be85f2f23a2d8dfd0830ecdb89d0dbf2bfd5/lattice_mc/species.py#L58-L68
46,399
futurecolors/django-geoip
django_geoip/utils.py
get_class
def get_class(class_string): """ Convert a string version of a function name to the callable object. """ try: mod_name, class_name = get_mod_func(class_string) if class_name != '': cls = getattr(__import__(mod_name, {}, {}, ['']), class_name) return cls except...
python
def get_class(class_string): """ Convert a string version of a function name to the callable object. """ try: mod_name, class_name = get_mod_func(class_string) if class_name != '': cls = getattr(__import__(mod_name, {}, {}, ['']), class_name) return cls except...
[ "def", "get_class", "(", "class_string", ")", ":", "try", ":", "mod_name", ",", "class_name", "=", "get_mod_func", "(", "class_string", ")", "if", "class_name", "!=", "''", ":", "cls", "=", "getattr", "(", "__import__", "(", "mod_name", ",", "{", "}", ",...
Convert a string version of a function name to the callable object.
[ "Convert", "a", "string", "version", "of", "a", "function", "name", "to", "the", "callable", "object", "." ]
f9eee4bcad40508089b184434b79826f842d7bd0
https://github.com/futurecolors/django-geoip/blob/f9eee4bcad40508089b184434b79826f842d7bd0/django_geoip/utils.py#L4-L15