repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
3 values
summary
stringlengths
4
350
polysquare/cmake-ast
cmakeast/ast.py
_InlineRSTRecorder.maybe_start_recording
def maybe_start_recording(tokens, index): """Return a new _InlineRSTRecorder when its time to record.""" if tokens[index].type == TokenType.BeginInlineRST: return _InlineRSTRecorder(index)
python
def maybe_start_recording(tokens, index): """Return a new _InlineRSTRecorder when its time to record.""" if tokens[index].type == TokenType.BeginInlineRST: return _InlineRSTRecorder(index)
[ "def", "maybe_start_recording", "(", "tokens", ",", "index", ")", ":", "if", "tokens", "[", "index", "]", ".", "type", "==", "TokenType", ".", "BeginInlineRST", ":", "return", "_InlineRSTRecorder", "(", "index", ")" ]
Return a new _InlineRSTRecorder when its time to record.
[ "Return", "a", "new", "_InlineRSTRecorder", "when", "its", "time", "to", "record", "." ]
431a32d595d76f1f8f993eb6ddcc79effbadff9d
https://github.com/polysquare/cmake-ast/blob/431a32d595d76f1f8f993eb6ddcc79effbadff9d/cmakeast/ast.py#L666-L669
train
Return a new _InlineRSTRecorder when its time to record.
polysquare/cmake-ast
cmakeast/ast.py
_InlineRSTRecorder.consume_token
def consume_token(self, tokens, index, tokens_len): """Consume a token. Returns a tuple of (tokens, tokens_len, index) when consumption is completed and tokens have been merged together. """ del tokens_len if tokens[index].type == TokenType.EndInlineRST: ret...
python
def consume_token(self, tokens, index, tokens_len): """Consume a token. Returns a tuple of (tokens, tokens_len, index) when consumption is completed and tokens have been merged together. """ del tokens_len if tokens[index].type == TokenType.EndInlineRST: ret...
[ "def", "consume_token", "(", "self", ",", "tokens", ",", "index", ",", "tokens_len", ")", ":", "del", "tokens_len", "if", "tokens", "[", "index", "]", ".", "type", "==", "TokenType", ".", "EndInlineRST", ":", "return", "_paste_tokens_line_by_line", "(", "tok...
Consume a token. Returns a tuple of (tokens, tokens_len, index) when consumption is completed and tokens have been merged together.
[ "Consume", "a", "token", "." ]
431a32d595d76f1f8f993eb6ddcc79effbadff9d
https://github.com/polysquare/cmake-ast/blob/431a32d595d76f1f8f993eb6ddcc79effbadff9d/cmakeast/ast.py#L671-L683
train
Consume a token.
polysquare/cmake-ast
cmakeast/ast.py
_MultilineStringRecorder.maybe_start_recording
def maybe_start_recording(tokens, index): """Return a new _MultilineStringRecorder when its time to record.""" if _is_begin_quoted_type(tokens[index].type): string_type = _get_string_type_from_token(tokens[index].type) return _MultilineStringRecorder(index, string_type) ...
python
def maybe_start_recording(tokens, index): """Return a new _MultilineStringRecorder when its time to record.""" if _is_begin_quoted_type(tokens[index].type): string_type = _get_string_type_from_token(tokens[index].type) return _MultilineStringRecorder(index, string_type) ...
[ "def", "maybe_start_recording", "(", "tokens", ",", "index", ")", ":", "if", "_is_begin_quoted_type", "(", "tokens", "[", "index", "]", ".", "type", ")", ":", "string_type", "=", "_get_string_type_from_token", "(", "tokens", "[", "index", "]", ".", "type", "...
Return a new _MultilineStringRecorder when its time to record.
[ "Return", "a", "new", "_MultilineStringRecorder", "when", "its", "time", "to", "record", "." ]
431a32d595d76f1f8f993eb6ddcc79effbadff9d
https://github.com/polysquare/cmake-ast/blob/431a32d595d76f1f8f993eb6ddcc79effbadff9d/cmakeast/ast.py#L696-L702
train
Return a new _MultilineStringRecorder when its time to record.
polysquare/cmake-ast
cmakeast/ast.py
_MultilineStringRecorder.consume_token
def consume_token(self, tokens, index, tokens_len): """Consume a token. Returns tuple of (tokens, tokens_len, index) when consumption is completed and tokens have been merged together. """ del tokens_len consumption_ended = False q_type = self.quote_type ...
python
def consume_token(self, tokens, index, tokens_len): """Consume a token. Returns tuple of (tokens, tokens_len, index) when consumption is completed and tokens have been merged together. """ del tokens_len consumption_ended = False q_type = self.quote_type ...
[ "def", "consume_token", "(", "self", ",", "tokens", ",", "index", ",", "tokens_len", ")", ":", "del", "tokens_len", "consumption_ended", "=", "False", "q_type", "=", "self", ".", "quote_type", "begin_literal_type", "=", "getattr", "(", "TokenType", ",", "\"Beg...
Consume a token. Returns tuple of (tokens, tokens_len, index) when consumption is completed and tokens have been merged together.
[ "Consume", "a", "token", "." ]
431a32d595d76f1f8f993eb6ddcc79effbadff9d
https://github.com/polysquare/cmake-ast/blob/431a32d595d76f1f8f993eb6ddcc79effbadff9d/cmakeast/ast.py#L704-L768
train
Consume a token.
vmonaco/pohmm
examples/keystroke.py
stratified_kfold
def stratified_kfold(df, n_folds): """ Create stratified k-folds from an indexed dataframe """ sessions = pd.DataFrame.from_records(list(df.index.unique())).groupby(0).apply(lambda x: x[1].unique()) sessions.apply(lambda x: np.random.shuffle(x)) folds = [] for i in range(n_folds): id...
python
def stratified_kfold(df, n_folds): """ Create stratified k-folds from an indexed dataframe """ sessions = pd.DataFrame.from_records(list(df.index.unique())).groupby(0).apply(lambda x: x[1].unique()) sessions.apply(lambda x: np.random.shuffle(x)) folds = [] for i in range(n_folds): id...
[ "def", "stratified_kfold", "(", "df", ",", "n_folds", ")", ":", "sessions", "=", "pd", ".", "DataFrame", ".", "from_records", "(", "list", "(", "df", ".", "index", ".", "unique", "(", ")", ")", ")", ".", "groupby", "(", "0", ")", ".", "apply", "(",...
Create stratified k-folds from an indexed dataframe
[ "Create", "stratified", "k", "-", "folds", "from", "an", "indexed", "dataframe" ]
c00f8a62d3005a171d424549a55d46c421859ae9
https://github.com/vmonaco/pohmm/blob/c00f8a62d3005a171d424549a55d46c421859ae9/examples/keystroke.py#L15-L26
train
Create stratified k - folds from an indexed dataframe
vmonaco/pohmm
examples/keystroke.py
preprocess
def preprocess(df): """Convert the CMU dataset from row vectors into time/duration row observations""" def process_row(idx_row): idx, row = idx_row # press-press latency tau = 1000 * row[4::3].astype(float).values tau = np.r_[np.median(tau), tau] # duration dur...
python
def preprocess(df): """Convert the CMU dataset from row vectors into time/duration row observations""" def process_row(idx_row): idx, row = idx_row # press-press latency tau = 1000 * row[4::3].astype(float).values tau = np.r_[np.median(tau), tau] # duration dur...
[ "def", "preprocess", "(", "df", ")", ":", "def", "process_row", "(", "idx_row", ")", ":", "idx", ",", "row", "=", "idx_row", "# press-press latency", "tau", "=", "1000", "*", "row", "[", "4", ":", ":", "3", "]", ".", "astype", "(", "float", ")", "....
Convert the CMU dataset from row vectors into time/duration row observations
[ "Convert", "the", "CMU", "dataset", "from", "row", "vectors", "into", "time", "/", "duration", "row", "observations" ]
c00f8a62d3005a171d424549a55d46c421859ae9
https://github.com/vmonaco/pohmm/blob/c00f8a62d3005a171d424549a55d46c421859ae9/examples/keystroke.py#L34-L58
train
Convert the CMU dataset from row vectors into time and duration row observations
vmonaco/pohmm
examples/keystroke.py
keystroke_model
def keystroke_model(): """Generates a 2-state model with lognormal emissions and frequency smoothing""" model = Pohmm(n_hidden_states=2, init_spread=2, emissions=['lognormal', 'lognormal'], smoothing='freq', init_method='obs', ...
python
def keystroke_model(): """Generates a 2-state model with lognormal emissions and frequency smoothing""" model = Pohmm(n_hidden_states=2, init_spread=2, emissions=['lognormal', 'lognormal'], smoothing='freq', init_method='obs', ...
[ "def", "keystroke_model", "(", ")", ":", "model", "=", "Pohmm", "(", "n_hidden_states", "=", "2", ",", "init_spread", "=", "2", ",", "emissions", "=", "[", "'lognormal'", ",", "'lognormal'", "]", ",", "smoothing", "=", "'freq'", ",", "init_method", "=", ...
Generates a 2-state model with lognormal emissions and frequency smoothing
[ "Generates", "a", "2", "-", "state", "model", "with", "lognormal", "emissions", "and", "frequency", "smoothing" ]
c00f8a62d3005a171d424549a55d46c421859ae9
https://github.com/vmonaco/pohmm/blob/c00f8a62d3005a171d424549a55d46c421859ae9/examples/keystroke.py#L123-L131
train
Generates a 2 - state model with lognormal emissions and frequency smoothing
teepark/greenhouse
greenhouse/backdoor.py
run_backdoor
def run_backdoor(address, namespace=None): """start a server that runs python interpreters on connections made to it .. note:: this function blocks effectively indefinitely -- it runs the listening socket loop in the current greenlet. to keep the current greenlet free, :func:`schedule<...
python
def run_backdoor(address, namespace=None): """start a server that runs python interpreters on connections made to it .. note:: this function blocks effectively indefinitely -- it runs the listening socket loop in the current greenlet. to keep the current greenlet free, :func:`schedule<...
[ "def", "run_backdoor", "(", "address", ",", "namespace", "=", "None", ")", ":", "log", ".", "info", "(", "\"starting on %r\"", "%", "(", "address", ",", ")", ")", "serversock", "=", "io", ".", "Socket", "(", ")", "serversock", ".", "setsockopt", "(", "...
start a server that runs python interpreters on connections made to it .. note:: this function blocks effectively indefinitely -- it runs the listening socket loop in the current greenlet. to keep the current greenlet free, :func:`schedule<greenhouse.scheduler.schedule>` this function. ...
[ "start", "a", "server", "that", "runs", "python", "interpreters", "on", "connections", "made", "to", "it" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/backdoor.py#L40-L67
train
start a server that runs python interpreters on connections made to it
teepark/greenhouse
greenhouse/backdoor.py
backdoor_handler
def backdoor_handler(clientsock, namespace=None): """start an interactive python interpreter on an existing connection .. note:: this function will block for as long as the connection remains alive. :param sock: the socket on which to serve the interpreter :type sock: :class:`Socket<greenhouse...
python
def backdoor_handler(clientsock, namespace=None): """start an interactive python interpreter on an existing connection .. note:: this function will block for as long as the connection remains alive. :param sock: the socket on which to serve the interpreter :type sock: :class:`Socket<greenhouse...
[ "def", "backdoor_handler", "(", "clientsock", ",", "namespace", "=", "None", ")", ":", "namespace", "=", "{", "}", "if", "namespace", "is", "None", "else", "namespace", ".", "copy", "(", ")", "console", "=", "code", ".", "InteractiveConsole", "(", "namespa...
start an interactive python interpreter on an existing connection .. note:: this function will block for as long as the connection remains alive. :param sock: the socket on which to serve the interpreter :type sock: :class:`Socket<greenhouse.io.sockets.Socket>` :param namespace: the lo...
[ "start", "an", "interactive", "python", "interpreter", "on", "an", "existing", "connection" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/backdoor.py#L70-L112
train
start an interactive python interpreter on a socket
twidi/django-adv-cache-tag
adv_cache_tag/tag.py
CacheTag.prepare_params
def prepare_params(self): """ Prepare the parameters passed to the templatetag """ if self.options.resolve_fragment: self.fragment_name = self.node.fragment_name.resolve(self.context) else: self.fragment_name = str(self.node.fragment_name) # Re...
python
def prepare_params(self): """ Prepare the parameters passed to the templatetag """ if self.options.resolve_fragment: self.fragment_name = self.node.fragment_name.resolve(self.context) else: self.fragment_name = str(self.node.fragment_name) # Re...
[ "def", "prepare_params", "(", "self", ")", ":", "if", "self", ".", "options", ".", "resolve_fragment", ":", "self", ".", "fragment_name", "=", "self", ".", "node", ".", "fragment_name", ".", "resolve", "(", "self", ".", "context", ")", "else", ":", "self...
Prepare the parameters passed to the templatetag
[ "Prepare", "the", "parameters", "passed", "to", "the", "templatetag" ]
811f8db4dac73667c7d2fe0ea97a24969593eb8a
https://github.com/twidi/django-adv-cache-tag/blob/811f8db4dac73667c7d2fe0ea97a24969593eb8a/adv_cache_tag/tag.py#L234-L256
train
Prepare the parameters passed to the templatetag.
twidi/django-adv-cache-tag
adv_cache_tag/tag.py
CacheTag.get_expire_time
def get_expire_time(self): """ Return the expire time passed to the templatetag. Must be None or an integer. """ try: expire_time = self.node.expire_time.resolve(self.context) except template.VariableDoesNotExist: raise template.TemplateSyntaxError...
python
def get_expire_time(self): """ Return the expire time passed to the templatetag. Must be None or an integer. """ try: expire_time = self.node.expire_time.resolve(self.context) except template.VariableDoesNotExist: raise template.TemplateSyntaxError...
[ "def", "get_expire_time", "(", "self", ")", ":", "try", ":", "expire_time", "=", "self", ".", "node", ".", "expire_time", ".", "resolve", "(", "self", ".", "context", ")", "except", "template", ".", "VariableDoesNotExist", ":", "raise", "template", ".", "T...
Return the expire time passed to the templatetag. Must be None or an integer.
[ "Return", "the", "expire", "time", "passed", "to", "the", "templatetag", ".", "Must", "be", "None", "or", "an", "integer", "." ]
811f8db4dac73667c7d2fe0ea97a24969593eb8a
https://github.com/twidi/django-adv-cache-tag/blob/811f8db4dac73667c7d2fe0ea97a24969593eb8a/adv_cache_tag/tag.py#L258-L281
train
Return the expire time passed to the templatetag. Must be None or an integer.
twidi/django-adv-cache-tag
adv_cache_tag/tag.py
CacheTag.get_version
def get_version(self): """ Return the stringified version passed to the templatetag. """ if not self.node.version: return None try: version = smart_str('%s' % self.node.version.resolve(self.context)) except template.VariableDoesNotExist: ...
python
def get_version(self): """ Return the stringified version passed to the templatetag. """ if not self.node.version: return None try: version = smart_str('%s' % self.node.version.resolve(self.context)) except template.VariableDoesNotExist: ...
[ "def", "get_version", "(", "self", ")", ":", "if", "not", "self", ".", "node", ".", "version", ":", "return", "None", "try", ":", "version", "=", "smart_str", "(", "'%s'", "%", "self", ".", "node", ".", "version", ".", "resolve", "(", "self", ".", ...
Return the stringified version passed to the templatetag.
[ "Return", "the", "stringified", "version", "passed", "to", "the", "templatetag", "." ]
811f8db4dac73667c7d2fe0ea97a24969593eb8a
https://github.com/twidi/django-adv-cache-tag/blob/811f8db4dac73667c7d2fe0ea97a24969593eb8a/adv_cache_tag/tag.py#L283-L295
train
Return the stringified version passed to the templatetag.
twidi/django-adv-cache-tag
adv_cache_tag/tag.py
CacheTag.hash_args
def hash_args(self): """ Take all the arguments passed after the fragment name and return a hashed version which will be used in the cache key """ return hashlib.md5(force_bytes(':'.join([urlquote(force_bytes(var)) for var in self.vary_on]))).hexdigest()
python
def hash_args(self): """ Take all the arguments passed after the fragment name and return a hashed version which will be used in the cache key """ return hashlib.md5(force_bytes(':'.join([urlquote(force_bytes(var)) for var in self.vary_on]))).hexdigest()
[ "def", "hash_args", "(", "self", ")", ":", "return", "hashlib", ".", "md5", "(", "force_bytes", "(", "':'", ".", "join", "(", "[", "urlquote", "(", "force_bytes", "(", "var", ")", ")", "for", "var", "in", "self", ".", "vary_on", "]", ")", ")", ")",...
Take all the arguments passed after the fragment name and return a hashed version which will be used in the cache key
[ "Take", "all", "the", "arguments", "passed", "after", "the", "fragment", "name", "and", "return", "a", "hashed", "version", "which", "will", "be", "used", "in", "the", "cache", "key" ]
811f8db4dac73667c7d2fe0ea97a24969593eb8a
https://github.com/twidi/django-adv-cache-tag/blob/811f8db4dac73667c7d2fe0ea97a24969593eb8a/adv_cache_tag/tag.py#L297-L302
train
Take all the arguments passed after the fragment name and return a hashed version of the cache key.
twidi/django-adv-cache-tag
adv_cache_tag/tag.py
CacheTag.get_cache_key_args
def get_cache_key_args(self): """ Return the arguments to be passed to the base cache key returned by `get_base_cache_key`. """ cache_key_args = dict( nodename=self.node.nodename, name=self.fragment_name, hash=self.hash_args(), ) if sel...
python
def get_cache_key_args(self): """ Return the arguments to be passed to the base cache key returned by `get_base_cache_key`. """ cache_key_args = dict( nodename=self.node.nodename, name=self.fragment_name, hash=self.hash_args(), ) if sel...
[ "def", "get_cache_key_args", "(", "self", ")", ":", "cache_key_args", "=", "dict", "(", "nodename", "=", "self", ".", "node", ".", "nodename", ",", "name", "=", "self", ".", "fragment_name", ",", "hash", "=", "self", ".", "hash_args", "(", ")", ",", ")...
Return the arguments to be passed to the base cache key returned by `get_base_cache_key`.
[ "Return", "the", "arguments", "to", "be", "passed", "to", "the", "base", "cache", "key", "returned", "by", "get_base_cache_key", "." ]
811f8db4dac73667c7d2fe0ea97a24969593eb8a
https://github.com/twidi/django-adv-cache-tag/blob/811f8db4dac73667c7d2fe0ea97a24969593eb8a/adv_cache_tag/tag.py#L326-L338
train
Return the arguments to be passed to the base cache key returned by get_base_cache_key.
twidi/django-adv-cache-tag
adv_cache_tag/tag.py
CacheTag.cache_set
def cache_set(self, to_cache): """ Set content into the cache """ self.cache.set(self.cache_key, to_cache, self.expire_time)
python
def cache_set(self, to_cache): """ Set content into the cache """ self.cache.set(self.cache_key, to_cache, self.expire_time)
[ "def", "cache_set", "(", "self", ",", "to_cache", ")", ":", "self", ".", "cache", ".", "set", "(", "self", ".", "cache_key", ",", "to_cache", ",", "self", ".", "expire_time", ")" ]
Set content into the cache
[ "Set", "content", "into", "the", "cache" ]
811f8db4dac73667c7d2fe0ea97a24969593eb8a
https://github.com/twidi/django-adv-cache-tag/blob/811f8db4dac73667c7d2fe0ea97a24969593eb8a/adv_cache_tag/tag.py#L362-L366
train
Set content into the cache
twidi/django-adv-cache-tag
adv_cache_tag/tag.py
CacheTag.join_content_version
def join_content_version(self, to_cache): """ Add the version(s) to the content to cache : internal version at first and then the template version if versioning is activated. Each version, and the content, are separated with `VERSION_SEPARATOR`. This method is called after the en...
python
def join_content_version(self, to_cache): """ Add the version(s) to the content to cache : internal version at first and then the template version if versioning is activated. Each version, and the content, are separated with `VERSION_SEPARATOR`. This method is called after the en...
[ "def", "join_content_version", "(", "self", ",", "to_cache", ")", ":", "parts", "=", "[", "self", ".", "INTERNAL_VERSION", "]", "if", "self", ".", "options", ".", "versioning", ":", "parts", ".", "append", "(", "force_bytes", "(", "self", ".", "version", ...
Add the version(s) to the content to cache : internal version at first and then the template version if versioning is activated. Each version, and the content, are separated with `VERSION_SEPARATOR`. This method is called after the encoding (if "compress" or "compress_spaces" options are...
[ "Add", "the", "version", "(", "s", ")", "to", "the", "content", "to", "cache", ":", "internal", "version", "at", "first", "and", "then", "the", "template", "version", "if", "versioning", "is", "activated", ".", "Each", "version", "and", "the", "content", ...
811f8db4dac73667c7d2fe0ea97a24969593eb8a
https://github.com/twidi/django-adv-cache-tag/blob/811f8db4dac73667c7d2fe0ea97a24969593eb8a/adv_cache_tag/tag.py#L368-L381
train
Join the version of the content to cache.
twidi/django-adv-cache-tag
adv_cache_tag/tag.py
CacheTag.split_content_version
def split_content_version(self): """ Remove and return the version(s) from the cached content. First the internal version, and if versioning is activated, the template one. And finally save the content, but only if all versions match. The content saved is the encoded one (if "com...
python
def split_content_version(self): """ Remove and return the version(s) from the cached content. First the internal version, and if versioning is activated, the template one. And finally save the content, but only if all versions match. The content saved is the encoded one (if "com...
[ "def", "split_content_version", "(", "self", ")", ":", "try", ":", "nb_parts", "=", "2", "if", "self", ".", "options", ".", "versioning", ":", "nb_parts", "=", "3", "parts", "=", "self", ".", "content", ".", "split", "(", "self", ".", "VERSION_SEPARATOR"...
Remove and return the version(s) from the cached content. First the internal version, and if versioning is activated, the template one. And finally save the content, but only if all versions match. The content saved is the encoded one (if "compress" or "compress_spaces" options are on). ...
[ "Remove", "and", "return", "the", "version", "(", "s", ")", "from", "the", "cached", "content", ".", "First", "the", "internal", "version", "and", "if", "versioning", "is", "activated", "the", "template", "one", ".", "And", "finally", "save", "the", "conte...
811f8db4dac73667c7d2fe0ea97a24969593eb8a
https://github.com/twidi/django-adv-cache-tag/blob/811f8db4dac73667c7d2fe0ea97a24969593eb8a/adv_cache_tag/tag.py#L383-L406
train
Split the content of the cached content into internal and internal versions.
twidi/django-adv-cache-tag
adv_cache_tag/tag.py
CacheTag.decode_content
def decode_content(self): """ Decode (decompress...) the content got from the cache, to the final html """ self.content = pickle.loads(zlib.decompress(self.content))
python
def decode_content(self): """ Decode (decompress...) the content got from the cache, to the final html """ self.content = pickle.loads(zlib.decompress(self.content))
[ "def", "decode_content", "(", "self", ")", ":", "self", ".", "content", "=", "pickle", ".", "loads", "(", "zlib", ".", "decompress", "(", "self", ".", "content", ")", ")" ]
Decode (decompress...) the content got from the cache, to the final html
[ "Decode", "(", "decompress", "...", ")", "the", "content", "got", "from", "the", "cache", "to", "the", "final", "html" ]
811f8db4dac73667c7d2fe0ea97a24969593eb8a
https://github.com/twidi/django-adv-cache-tag/blob/811f8db4dac73667c7d2fe0ea97a24969593eb8a/adv_cache_tag/tag.py#L408-L413
train
Decode the content from the cache to the final
twidi/django-adv-cache-tag
adv_cache_tag/tag.py
CacheTag.render_node
def render_node(self): """ Render the template and save the generated content """ self.content = self.node.nodelist.render(self.context)
python
def render_node(self): """ Render the template and save the generated content """ self.content = self.node.nodelist.render(self.context)
[ "def", "render_node", "(", "self", ")", ":", "self", ".", "content", "=", "self", ".", "node", ".", "nodelist", ".", "render", "(", "self", ".", "context", ")" ]
Render the template and save the generated content
[ "Render", "the", "template", "and", "save", "the", "generated", "content" ]
811f8db4dac73667c7d2fe0ea97a24969593eb8a
https://github.com/twidi/django-adv-cache-tag/blob/811f8db4dac73667c7d2fe0ea97a24969593eb8a/adv_cache_tag/tag.py#L421-L425
train
Render the template and save the generated content
twidi/django-adv-cache-tag
adv_cache_tag/tag.py
CacheTag.create_content
def create_content(self): """ Render the template, apply options on it, and save it to the cache. """ self.render_node() if self.options.compress_spaces: self.content = self.RE_SPACELESS.sub(' ', self.content) if self.options.compress: to_cache =...
python
def create_content(self): """ Render the template, apply options on it, and save it to the cache. """ self.render_node() if self.options.compress_spaces: self.content = self.RE_SPACELESS.sub(' ', self.content) if self.options.compress: to_cache =...
[ "def", "create_content", "(", "self", ")", ":", "self", ".", "render_node", "(", ")", "if", "self", ".", "options", ".", "compress_spaces", ":", "self", ".", "content", "=", "self", ".", "RE_SPACELESS", ".", "sub", "(", "' '", ",", "self", ".", "conten...
Render the template, apply options on it, and save it to the cache.
[ "Render", "the", "template", "apply", "options", "on", "it", "and", "save", "it", "to", "the", "cache", "." ]
811f8db4dac73667c7d2fe0ea97a24969593eb8a
https://github.com/twidi/django-adv-cache-tag/blob/811f8db4dac73667c7d2fe0ea97a24969593eb8a/adv_cache_tag/tag.py#L427-L448
train
Render the template and save it to the cache.
twidi/django-adv-cache-tag
adv_cache_tag/tag.py
CacheTag.load_content
def load_content(self): """ It's the main method of the class. Try to load the template from cache, get the versions and decode the content. If something was wrong during this process (or if we had a `__regenerate__` value to True in the context), create new content and ...
python
def load_content(self): """ It's the main method of the class. Try to load the template from cache, get the versions and decode the content. If something was wrong during this process (or if we had a `__regenerate__` value to True in the context), create new content and ...
[ "def", "load_content", "(", "self", ")", ":", "self", ".", "content", "=", "None", "if", "not", "self", ".", "regenerate", ":", "try", ":", "self", ".", "content", "=", "self", ".", "cache_get", "(", ")", "except", "Exception", ":", "if", "is_template_...
It's the main method of the class. Try to load the template from cache, get the versions and decode the content. If something was wrong during this process (or if we had a `__regenerate__` value to True in the context), create new content and save it in cache.
[ "It", "s", "the", "main", "method", "of", "the", "class", ".", "Try", "to", "load", "the", "template", "from", "cache", "get", "the", "versions", "and", "decode", "the", "content", ".", "If", "something", "was", "wrong", "during", "this", "process", "(",...
811f8db4dac73667c7d2fe0ea97a24969593eb8a
https://github.com/twidi/django-adv-cache-tag/blob/811f8db4dac73667c7d2fe0ea97a24969593eb8a/adv_cache_tag/tag.py#L450-L490
train
This method loads the content of the template from the cache and stores it in the internal version and content in the internal version.
twidi/django-adv-cache-tag
adv_cache_tag/tag.py
CacheTag.render
def render(self): """ Try to load content (from cache or by rendering the template). If it fails, return an empty string or raise the exception if it's a TemplateSyntaxError. With this, we can no parse and render the content included in the {% nocache %} blocks, but only ...
python
def render(self): """ Try to load content (from cache or by rendering the template). If it fails, return an empty string or raise the exception if it's a TemplateSyntaxError. With this, we can no parse and render the content included in the {% nocache %} blocks, but only ...
[ "def", "render", "(", "self", ")", ":", "try", ":", "self", ".", "load_content", "(", ")", "except", "template", ".", "TemplateSyntaxError", ":", "raise", "except", "Exception", ":", "if", "is_template_debug_activated", "(", ")", ":", "raise", "logger", ".",...
Try to load content (from cache or by rendering the template). If it fails, return an empty string or raise the exception if it's a TemplateSyntaxError. With this, we can no parse and render the content included in the {% nocache %} blocks, but only if we have have this tag and if we don...
[ "Try", "to", "load", "content", "(", "from", "cache", "or", "by", "rendering", "the", "template", ")", ".", "If", "it", "fails", "return", "an", "empty", "string", "or", "raise", "the", "exception", "if", "it", "s", "a", "TemplateSyntaxError", ".", "With...
811f8db4dac73667c7d2fe0ea97a24969593eb8a
https://github.com/twidi/django-adv-cache-tag/blob/811f8db4dac73667c7d2fe0ea97a24969593eb8a/adv_cache_tag/tag.py#L493-L516
train
Renders the content of the current fragment.
twidi/django-adv-cache-tag
adv_cache_tag/tag.py
CacheTag.get_all_tags_and_filters_by_function
def get_all_tags_and_filters_by_function(): """ Return a dict with all the template tags (in the `tags` entry) and filters (in the `filters` entry) that are available. Both entries are a dict with the function as key, and a tuple with (library name, function name) as value. ...
python
def get_all_tags_and_filters_by_function(): """ Return a dict with all the template tags (in the `tags` entry) and filters (in the `filters` entry) that are available. Both entries are a dict with the function as key, and a tuple with (library name, function name) as value. ...
[ "def", "get_all_tags_and_filters_by_function", "(", ")", ":", "libraries", "=", "get_template_libraries", "(", ")", "force", "=", "False", "# We'll force the update of the cache if new libraries where added", "if", "hasattr", "(", "CacheTag", ".", "get_all_tags_and_filters_by_f...
Return a dict with all the template tags (in the `tags` entry) and filters (in the `filters` entry) that are available. Both entries are a dict with the function as key, and a tuple with (library name, function name) as value. This is cached after the first call.
[ "Return", "a", "dict", "with", "all", "the", "template", "tags", "(", "in", "the", "tags", "entry", ")", "and", "filters", "(", "in", "the", "filters", "entry", ")", "that", "are", "available", ".", "Both", "entries", "are", "a", "dict", "with", "the",...
811f8db4dac73667c7d2fe0ea97a24969593eb8a
https://github.com/twidi/django-adv-cache-tag/blob/811f8db4dac73667c7d2fe0ea97a24969593eb8a/adv_cache_tag/tag.py#L519-L559
train
Returns a dict with all the template tags and filters that are available.
twidi/django-adv-cache-tag
adv_cache_tag/tag.py
CacheTag.get_templatetag_module
def get_templatetag_module(cls): """ Return the templatetags module name for which the current class is used. It's used to render the nocache blocks by loading the correct module """ if cls not in CacheTag._templatetags_modules: # find the library including the main t...
python
def get_templatetag_module(cls): """ Return the templatetags module name for which the current class is used. It's used to render the nocache blocks by loading the correct module """ if cls not in CacheTag._templatetags_modules: # find the library including the main t...
[ "def", "get_templatetag_module", "(", "cls", ")", ":", "if", "cls", "not", "in", "CacheTag", ".", "_templatetags_modules", ":", "# find the library including the main templatetag of the current class", "all_tags", "=", "cls", ".", "get_all_tags_and_filters_by_function", "(", ...
Return the templatetags module name for which the current class is used. It's used to render the nocache blocks by loading the correct module
[ "Return", "the", "templatetags", "module", "name", "for", "which", "the", "current", "class", "is", "used", ".", "It", "s", "used", "to", "render", "the", "nocache", "blocks", "by", "loading", "the", "correct", "module" ]
811f8db4dac73667c7d2fe0ea97a24969593eb8a
https://github.com/twidi/django-adv-cache-tag/blob/811f8db4dac73667c7d2fe0ea97a24969593eb8a/adv_cache_tag/tag.py#L562-L571
train
Returns the templatetags module name for which the current class is used.
twidi/django-adv-cache-tag
adv_cache_tag/tag.py
CacheTag.render_nocache
def render_nocache(self): """ Render the `nocache` blocks of the content and return the whole html """ tmpl = template.Template(''.join([ # start by loading the cache library template.BLOCK_TAG_START, 'load %s' % self.get_templatetag_module(), ...
python
def render_nocache(self): """ Render the `nocache` blocks of the content and return the whole html """ tmpl = template.Template(''.join([ # start by loading the cache library template.BLOCK_TAG_START, 'load %s' % self.get_templatetag_module(), ...
[ "def", "render_nocache", "(", "self", ")", ":", "tmpl", "=", "template", ".", "Template", "(", "''", ".", "join", "(", "[", "# start by loading the cache library", "template", ".", "BLOCK_TAG_START", ",", "'load %s'", "%", "self", ".", "get_templatetag_module", ...
Render the `nocache` blocks of the content and return the whole html
[ "Render", "the", "nocache", "blocks", "of", "the", "content", "and", "return", "the", "whole", "html" ]
811f8db4dac73667c7d2fe0ea97a24969593eb8a
https://github.com/twidi/django-adv-cache-tag/blob/811f8db4dac73667c7d2fe0ea97a24969593eb8a/adv_cache_tag/tag.py#L573-L588
train
Render the nocache blocks of the content and return the whole nocache html
twidi/django-adv-cache-tag
adv_cache_tag/tag.py
CacheTag.get_template_node_arguments
def get_template_node_arguments(cls, tokens): """ Return the arguments taken from the templatetag that will be used to the Node class. Take a list of all tokens and return a list of real tokens. Here should be done some validations (number of tokens...) and eventually som...
python
def get_template_node_arguments(cls, tokens): """ Return the arguments taken from the templatetag that will be used to the Node class. Take a list of all tokens and return a list of real tokens. Here should be done some validations (number of tokens...) and eventually som...
[ "def", "get_template_node_arguments", "(", "cls", ",", "tokens", ")", ":", "if", "len", "(", "tokens", ")", "<", "3", ":", "raise", "template", ".", "TemplateSyntaxError", "(", "\"'%r' tag requires at least 2 arguments.\"", "%", "tokens", "[", "0", "]", ")", "...
Return the arguments taken from the templatetag that will be used to the Node class. Take a list of all tokens and return a list of real tokens. Here should be done some validations (number of tokens...) and eventually some parsing...
[ "Return", "the", "arguments", "taken", "from", "the", "templatetag", "that", "will", "be", "used", "to", "the", "Node", "class", ".", "Take", "a", "list", "of", "all", "tokens", "and", "return", "a", "list", "of", "real", "tokens", ".", "Here", "should",...
811f8db4dac73667c7d2fe0ea97a24969593eb8a
https://github.com/twidi/django-adv-cache-tag/blob/811f8db4dac73667c7d2fe0ea97a24969593eb8a/adv_cache_tag/tag.py#L591-L602
train
Return the arguments taken from the templatetag that will be used to the Node class.
twidi/django-adv-cache-tag
adv_cache_tag/tag.py
CacheTag.register
def register(cls, library_register, nodename='cache', nocache_nodename='nocache'): """ Register all needed templatetags, with these parameters : * library_register : the `register` object (result of `template.Library()`) in your templatetag module * nodename : the...
python
def register(cls, library_register, nodename='cache', nocache_nodename='nocache'): """ Register all needed templatetags, with these parameters : * library_register : the `register` object (result of `template.Library()`) in your templatetag module * nodename : the...
[ "def", "register", "(", "cls", ",", "library_register", ",", "nodename", "=", "'cache'", ",", "nocache_nodename", "=", "'nocache'", ")", ":", "if", "cls", "in", "CacheTag", ".", "_templatetags", ":", "raise", "RuntimeError", "(", "'The adv-cache-tag class %s is al...
Register all needed templatetags, with these parameters : * library_register : the `register` object (result of `template.Library()`) in your templatetag module * nodename : the node to use for the cache templatetag (the default is "cache") * nocache_n...
[ "Register", "all", "needed", "templatetags", "with", "these", "parameters", ":", "*", "library_register", ":", "the", "register", "object", "(", "result", "of", "template", ".", "Library", "()", ")", "in", "your", "templatetag", "module", "*", "nodename", ":",...
811f8db4dac73667c7d2fe0ea97a24969593eb8a
https://github.com/twidi/django-adv-cache-tag/blob/811f8db4dac73667c7d2fe0ea97a24969593eb8a/adv_cache_tag/tag.py#L605-L726
train
Register all needed templatetags with the given class.
marchete/django-adldap-sync
adldap_sync/callbacks.py
user_active_directory_deactivate
def user_active_directory_deactivate(user, attributes, created, updated): """ Deactivate user accounts based on Active Directory's userAccountControl flags. Requires 'userAccountControl' to be included in LDAP_SYNC_USER_EXTRA_ATTRIBUTES. """ try: user_account_control = int(attribu...
python
def user_active_directory_deactivate(user, attributes, created, updated): """ Deactivate user accounts based on Active Directory's userAccountControl flags. Requires 'userAccountControl' to be included in LDAP_SYNC_USER_EXTRA_ATTRIBUTES. """ try: user_account_control = int(attribu...
[ "def", "user_active_directory_deactivate", "(", "user", ",", "attributes", ",", "created", ",", "updated", ")", ":", "try", ":", "user_account_control", "=", "int", "(", "attributes", "[", "'userAccountControl'", "]", "[", "0", "]", ")", "if", "user_account_cont...
Deactivate user accounts based on Active Directory's userAccountControl flags. Requires 'userAccountControl' to be included in LDAP_SYNC_USER_EXTRA_ATTRIBUTES.
[ "Deactivate", "user", "accounts", "based", "on", "Active", "Directory", "s", "userAccountControl", "flags", ".", "Requires", "userAccountControl", "to", "be", "included", "in", "LDAP_SYNC_USER_EXTRA_ATTRIBUTES", "." ]
f6be226a4fb2a433d22e95043bd656ce902f8254
https://github.com/marchete/django-adldap-sync/blob/f6be226a4fb2a433d22e95043bd656ce902f8254/adldap_sync/callbacks.py#L1-L12
train
Deactivate user accounts based on Active Directory s userAccountControl flags.
nickpandolfi/Cyther
cyther/parser.py
_get_contents_between
def _get_contents_between(string, opener, closer): """ Get the contents of a string between two characters """ opener_location = string.index(opener) closer_location = string.index(closer) content = string[opener_location + 1:closer_location] return content
python
def _get_contents_between(string, opener, closer): """ Get the contents of a string between two characters """ opener_location = string.index(opener) closer_location = string.index(closer) content = string[opener_location + 1:closer_location] return content
[ "def", "_get_contents_between", "(", "string", ",", "opener", ",", "closer", ")", ":", "opener_location", "=", "string", ".", "index", "(", "opener", ")", "closer_location", "=", "string", ".", "index", "(", "closer", ")", "content", "=", "string", "[", "o...
Get the contents of a string between two characters
[ "Get", "the", "contents", "of", "a", "string", "between", "two", "characters" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/parser.py#L29-L36
train
Get the contents of a string between two characters.
nickpandolfi/Cyther
cyther/parser.py
_check_whitespace
def _check_whitespace(string): """ Make sure thre is no whitespace in the given string. Will raise a ValueError if whitespace is detected """ if string.count(' ') + string.count('\t') + string.count('\n') > 0: raise ValueError(INSTRUCTION_HAS_WHITESPACE)
python
def _check_whitespace(string): """ Make sure thre is no whitespace in the given string. Will raise a ValueError if whitespace is detected """ if string.count(' ') + string.count('\t') + string.count('\n') > 0: raise ValueError(INSTRUCTION_HAS_WHITESPACE)
[ "def", "_check_whitespace", "(", "string", ")", ":", "if", "string", ".", "count", "(", "' '", ")", "+", "string", ".", "count", "(", "'\\t'", ")", "+", "string", ".", "count", "(", "'\\n'", ")", ">", "0", ":", "raise", "ValueError", "(", "INSTRUCTIO...
Make sure thre is no whitespace in the given string. Will raise a ValueError if whitespace is detected
[ "Make", "sure", "thre", "is", "no", "whitespace", "in", "the", "given", "string", ".", "Will", "raise", "a", "ValueError", "if", "whitespace", "is", "detected" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/parser.py#L39-L45
train
Check that there are no whitespace in the given string. Will raise a ValueError if whitespace is detected.
nickpandolfi/Cyther
cyther/parser.py
_check_enclosing_characters
def _check_enclosing_characters(string, opener, closer): """ Makes sure that the enclosing characters for a definition set make sense 1) There is only one set 2) They are in the right order (opening, then closing) """ opener_count = string.count(opener) closer_count = string.count(closer) ...
python
def _check_enclosing_characters(string, opener, closer): """ Makes sure that the enclosing characters for a definition set make sense 1) There is only one set 2) They are in the right order (opening, then closing) """ opener_count = string.count(opener) closer_count = string.count(closer) ...
[ "def", "_check_enclosing_characters", "(", "string", ",", "opener", ",", "closer", ")", ":", "opener_count", "=", "string", ".", "count", "(", "opener", ")", "closer_count", "=", "string", ".", "count", "(", "closer", ")", "total", "=", "opener_count", "+", ...
Makes sure that the enclosing characters for a definition set make sense 1) There is only one set 2) They are in the right order (opening, then closing)
[ "Makes", "sure", "that", "the", "enclosing", "characters", "for", "a", "definition", "set", "make", "sense", "1", ")", "There", "is", "only", "one", "set", "2", ")", "They", "are", "in", "the", "right", "order", "(", "opening", "then", "closing", ")" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/parser.py#L48-L68
train
Checks that the characters in the string are valid definition sets.
nickpandolfi/Cyther
cyther/parser.py
_check_parameters
def _check_parameters(parameters, symbols): """ Checks that the parameters given are not empty. Ones with prefix symbols can be denoted by including the prefix in symbols """ for param in parameters: if not param: raise ValueError(EMPTY_PARAMETER) elif (param[0] in symbol...
python
def _check_parameters(parameters, symbols): """ Checks that the parameters given are not empty. Ones with prefix symbols can be denoted by including the prefix in symbols """ for param in parameters: if not param: raise ValueError(EMPTY_PARAMETER) elif (param[0] in symbol...
[ "def", "_check_parameters", "(", "parameters", ",", "symbols", ")", ":", "for", "param", "in", "parameters", ":", "if", "not", "param", ":", "raise", "ValueError", "(", "EMPTY_PARAMETER", ")", "elif", "(", "param", "[", "0", "]", "in", "symbols", ")", "a...
Checks that the parameters given are not empty. Ones with prefix symbols can be denoted by including the prefix in symbols
[ "Checks", "that", "the", "parameters", "given", "are", "not", "empty", ".", "Ones", "with", "prefix", "symbols", "can", "be", "denoted", "by", "including", "the", "prefix", "in", "symbols" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/parser.py#L71-L81
train
Checks that the given parameters are not empty.
nickpandolfi/Cyther
cyther/parser.py
_check_dependencies
def _check_dependencies(string): """ Checks the dependencies constructor. Looks to make sure that the dependencies are the first things defined """ opener, closer = '(', ')' _check_enclosing_characters(string, opener, closer) if opener in string: if string[0] != opener: r...
python
def _check_dependencies(string): """ Checks the dependencies constructor. Looks to make sure that the dependencies are the first things defined """ opener, closer = '(', ')' _check_enclosing_characters(string, opener, closer) if opener in string: if string[0] != opener: r...
[ "def", "_check_dependencies", "(", "string", ")", ":", "opener", ",", "closer", "=", "'('", ",", "')'", "_check_enclosing_characters", "(", "string", ",", "opener", ",", "closer", ")", "if", "opener", "in", "string", ":", "if", "string", "[", "0", "]", "...
Checks the dependencies constructor. Looks to make sure that the dependencies are the first things defined
[ "Checks", "the", "dependencies", "constructor", ".", "Looks", "to", "make", "sure", "that", "the", "dependencies", "are", "the", "first", "things", "defined" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/parser.py#L84-L97
train
Checks the dependencies constructor.
nickpandolfi/Cyther
cyther/parser.py
_check_building_options
def _check_building_options(string): """ Checks the building options to make sure that they are defined last, after the task name and the dependencies """ opener, closer = '{', '}' _check_enclosing_characters(string, opener, closer) if opener in string: if string[-1] != closer: ...
python
def _check_building_options(string): """ Checks the building options to make sure that they are defined last, after the task name and the dependencies """ opener, closer = '{', '}' _check_enclosing_characters(string, opener, closer) if opener in string: if string[-1] != closer: ...
[ "def", "_check_building_options", "(", "string", ")", ":", "opener", ",", "closer", "=", "'{'", ",", "'}'", "_check_enclosing_characters", "(", "string", ",", "opener", ",", "closer", ")", "if", "opener", "in", "string", ":", "if", "string", "[", "-", "1",...
Checks the building options to make sure that they are defined last, after the task name and the dependencies
[ "Checks", "the", "building", "options", "to", "make", "sure", "that", "they", "are", "defined", "last", "after", "the", "task", "name", "and", "the", "dependencies" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/parser.py#L100-L113
train
Checks the building options to make sure that they are defined last after the task name and the dependencies of the task.
nickpandolfi/Cyther
cyther/parser.py
_check_flow_operator
def _check_flow_operator(string): """ Checks the flow operator ('>') to make sure that it: 1) Is non empty 2) There is only one of them """ greater_than_count = string.count('>') if greater_than_count > 1: raise ValueError(MULTIPLE_FLOW_OPERATORS) elif (string[0] == '>') or (stri...
python
def _check_flow_operator(string): """ Checks the flow operator ('>') to make sure that it: 1) Is non empty 2) There is only one of them """ greater_than_count = string.count('>') if greater_than_count > 1: raise ValueError(MULTIPLE_FLOW_OPERATORS) elif (string[0] == '>') or (stri...
[ "def", "_check_flow_operator", "(", "string", ")", ":", "greater_than_count", "=", "string", ".", "count", "(", "'>'", ")", "if", "greater_than_count", ">", "1", ":", "raise", "ValueError", "(", "MULTIPLE_FLOW_OPERATORS", ")", "elif", "(", "string", "[", "0", ...
Checks the flow operator ('>') to make sure that it: 1) Is non empty 2) There is only one of them
[ "Checks", "the", "flow", "operator", "(", ">", ")", "to", "make", "sure", "that", "it", ":", "1", ")", "Is", "non", "empty", "2", ")", "There", "is", "only", "one", "of", "them" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/parser.py#L116-L132
train
Checks the flow operator in the string and returns a boolean indicating if it is a valid one.
nickpandolfi/Cyther
cyther/parser.py
_parse_dependencies
def _parse_dependencies(string): """ This function actually parses the dependencies are sorts them into the buildable and given dependencies """ contents = _get_contents_between(string, '(', ')') unsorted_dependencies = contents.split(',') _check_parameters(unsorted_dependencies, ('?',)) ...
python
def _parse_dependencies(string): """ This function actually parses the dependencies are sorts them into the buildable and given dependencies """ contents = _get_contents_between(string, '(', ')') unsorted_dependencies = contents.split(',') _check_parameters(unsorted_dependencies, ('?',)) ...
[ "def", "_parse_dependencies", "(", "string", ")", ":", "contents", "=", "_get_contents_between", "(", "string", ",", "'('", ",", "')'", ")", "unsorted_dependencies", "=", "contents", ".", "split", "(", "','", ")", "_check_parameters", "(", "unsorted_dependencies",...
This function actually parses the dependencies are sorts them into the buildable and given dependencies
[ "This", "function", "actually", "parses", "the", "dependencies", "are", "sorts", "them", "into", "the", "buildable", "and", "given", "dependencies" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/parser.py#L135-L153
train
This function actually parses the dependencies into buildable_dependencies given_dependencies and string
nickpandolfi/Cyther
cyther/parser.py
_parse_building_options
def _parse_building_options(string): """ This will parse and sort the building options defined in the '{}' constructor. Will only allow one of each argument """ contents = _get_contents_between(string, '{', '}') unsorted_options = contents.split(',') _check_parameters(unsorted_options, ('@',...
python
def _parse_building_options(string): """ This will parse and sort the building options defined in the '{}' constructor. Will only allow one of each argument """ contents = _get_contents_between(string, '{', '}') unsorted_options = contents.split(',') _check_parameters(unsorted_options, ('@',...
[ "def", "_parse_building_options", "(", "string", ")", ":", "contents", "=", "_get_contents_between", "(", "string", ",", "'{'", ",", "'}'", ")", "unsorted_options", "=", "contents", ".", "split", "(", "','", ")", "_check_parameters", "(", "unsorted_options", ","...
This will parse and sort the building options defined in the '{}' constructor. Will only allow one of each argument
[ "This", "will", "parse", "and", "sort", "the", "building", "options", "defined", "in", "the", "{}", "constructor", ".", "Will", "only", "allow", "one", "of", "each", "argument" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/parser.py#L156-L183
train
Parses the build options from the string
nickpandolfi/Cyther
cyther/parser.py
parseString
def parseString(string): """ This function takes an entire instruction in the form of a string, and will parse the entire string and return a dictionary of the fields gathered from the parsing """ buildable_dependencies = [] given_dependencies = [] output_directory = None output_form...
python
def parseString(string): """ This function takes an entire instruction in the form of a string, and will parse the entire string and return a dictionary of the fields gathered from the parsing """ buildable_dependencies = [] given_dependencies = [] output_directory = None output_form...
[ "def", "parseString", "(", "string", ")", ":", "buildable_dependencies", "=", "[", "]", "given_dependencies", "=", "[", "]", "output_directory", "=", "None", "output_format", "=", "None", "building_directory", "=", "None", "output_name", "=", "None", "_check_white...
This function takes an entire instruction in the form of a string, and will parse the entire string and return a dictionary of the fields gathered from the parsing
[ "This", "function", "takes", "an", "entire", "instruction", "in", "the", "form", "of", "a", "string", "and", "will", "parse", "the", "entire", "string", "and", "return", "a", "dictionary", "of", "the", "fields", "gathered", "from", "the", "parsing" ]
9fb0bd77af594008aa6ee8af460aa8c953abf5bc
https://github.com/nickpandolfi/Cyther/blob/9fb0bd77af594008aa6ee8af460aa8c953abf5bc/cyther/parser.py#L195-L241
train
This function takes an instruction in the form of a string and returns a dictionary of the fields that are present in the string.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/account.py
Account.GetAlias
def GetAlias(session=None): """Return specified alias or if none the alias associated with the provided credentials. >>> clc.v2.Account.GetAlias() u'BTDI' """ if session is not None: return session['alias'] if not clc.ALIAS: clc.v2.API._Login() retu...
python
def GetAlias(session=None): """Return specified alias or if none the alias associated with the provided credentials. >>> clc.v2.Account.GetAlias() u'BTDI' """ if session is not None: return session['alias'] if not clc.ALIAS: clc.v2.API._Login() retu...
[ "def", "GetAlias", "(", "session", "=", "None", ")", ":", "if", "session", "is", "not", "None", ":", "return", "session", "[", "'alias'", "]", "if", "not", "clc", ".", "ALIAS", ":", "clc", ".", "v2", ".", "API", ".", "_Login", "(", ")", "return", ...
Return specified alias or if none the alias associated with the provided credentials. >>> clc.v2.Account.GetAlias() u'BTDI'
[ "Return", "specified", "alias", "or", "if", "none", "the", "alias", "associated", "with", "the", "provided", "credentials", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/account.py#L35-L45
train
Return specified alias or if none the alias associated with the provided credentials.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/account.py
Account.GetLocation
def GetLocation(session=None): """Return specified location or if none the default location associated with the provided credentials and alias. >>> clc.v2.Account.GetLocation() u'WA1' """ if session is not None: return session['location'] if not clc.LOCATION...
python
def GetLocation(session=None): """Return specified location or if none the default location associated with the provided credentials and alias. >>> clc.v2.Account.GetLocation() u'WA1' """ if session is not None: return session['location'] if not clc.LOCATION...
[ "def", "GetLocation", "(", "session", "=", "None", ")", ":", "if", "session", "is", "not", "None", ":", "return", "session", "[", "'location'", "]", "if", "not", "clc", ".", "LOCATION", ":", "clc", ".", "v2", ".", "API", ".", "_Login", "(", ")", "r...
Return specified location or if none the default location associated with the provided credentials and alias. >>> clc.v2.Account.GetLocation() u'WA1'
[ "Return", "specified", "location", "or", "if", "none", "the", "default", "location", "associated", "with", "the", "provided", "credentials", "and", "alias", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/account.py#L49-L59
train
Return specified location or if none the default location associated with the provided credentials and alias.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/account.py
Account.PrimaryDatacenter
def PrimaryDatacenter(self): """Returns the primary datacenter object associated with the account. >>> clc.v2.Account(alias='BTDI').PrimaryDatacenter() <clc.APIv2.datacenter.Datacenter instance at 0x10a45ce18> >>> print _ WA1 """ return(clc.v2.Datacenter(alias=...
python
def PrimaryDatacenter(self): """Returns the primary datacenter object associated with the account. >>> clc.v2.Account(alias='BTDI').PrimaryDatacenter() <clc.APIv2.datacenter.Datacenter instance at 0x10a45ce18> >>> print _ WA1 """ return(clc.v2.Datacenter(alias=...
[ "def", "PrimaryDatacenter", "(", "self", ")", ":", "return", "(", "clc", ".", "v2", ".", "Datacenter", "(", "alias", "=", "self", ".", "alias", ",", "location", "=", "self", ".", "data", "[", "'primaryDataCenter'", "]", ",", "session", "=", "self", "."...
Returns the primary datacenter object associated with the account. >>> clc.v2.Account(alias='BTDI').PrimaryDatacenter() <clc.APIv2.datacenter.Datacenter instance at 0x10a45ce18> >>> print _ WA1
[ "Returns", "the", "primary", "datacenter", "object", "associated", "with", "the", "account", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/account.py#L94-L104
train
Returns the primary datacenter object associated with the account.
sio2project/filetracker
filetracker/client/data_store.py
DataStore.add_file
def add_file(self, name, filename, compress_hint=True): """Saves the actual file in the store. ``compress_hint`` suggests whether the file should be compressed before transfer Works like :meth:`add_stream`, but ``filename`` is the name of an existing file in the fil...
python
def add_file(self, name, filename, compress_hint=True): """Saves the actual file in the store. ``compress_hint`` suggests whether the file should be compressed before transfer Works like :meth:`add_stream`, but ``filename`` is the name of an existing file in the fil...
[ "def", "add_file", "(", "self", ",", "name", ",", "filename", ",", "compress_hint", "=", "True", ")", ":", "return", "self", ".", "add_stream", "(", "name", ",", "open", "(", "filename", ",", "'rb'", ")", ")" ]
Saves the actual file in the store. ``compress_hint`` suggests whether the file should be compressed before transfer Works like :meth:`add_stream`, but ``filename`` is the name of an existing file in the filesystem.
[ "Saves", "the", "actual", "file", "in", "the", "store", "." ]
359b474850622e3d0c25ee2596d7242c02f84efb
https://github.com/sio2project/filetracker/blob/359b474850622e3d0c25ee2596d7242c02f84efb/filetracker/client/data_store.py#L38-L47
train
Adds a file to the store.
sio2project/filetracker
filetracker/client/data_store.py
DataStore.get_file
def get_file(self, name, filename): """Saves the content of file named ``name`` to ``filename``. Works like :meth:`get_stream`, but ``filename`` is the name of a file which will be created (or overwritten). Returns the full versioned name of the retrieved file. """ ...
python
def get_file(self, name, filename): """Saves the content of file named ``name`` to ``filename``. Works like :meth:`get_stream`, but ``filename`` is the name of a file which will be created (or overwritten). Returns the full versioned name of the retrieved file. """ ...
[ "def", "get_file", "(", "self", ",", "name", ",", "filename", ")", ":", "stream", ",", "vname", "=", "self", ".", "get_stream", "(", "name", ")", "path", ",", "version", "=", "split_name", "(", "vname", ")", "dir_path", "=", "os", ".", "path", ".", ...
Saves the content of file named ``name`` to ``filename``. Works like :meth:`get_stream`, but ``filename`` is the name of a file which will be created (or overwritten). Returns the full versioned name of the retrieved file.
[ "Saves", "the", "content", "of", "file", "named", "name", "to", "filename", "." ]
359b474850622e3d0c25ee2596d7242c02f84efb
https://github.com/sio2project/filetracker/blob/359b474850622e3d0c25ee2596d7242c02f84efb/filetracker/client/data_store.py#L80-L98
train
Saves the content of file named name to filename.
mjirik/imtools
imtools/gen_vtk_tree.py
vt2vtk_file
def vt2vtk_file(vessel_tree, outfile, text_label=None, lc_all="C"): """ vessel_tree structure :param vessel_tree: vt structure :param outfile: filename with .vtk extension :param text_label: text label like 'porta' or 'hepatic_veins' :param lc_all: LC_ALL locale settings. Controls float numbers...
python
def vt2vtk_file(vessel_tree, outfile, text_label=None, lc_all="C"): """ vessel_tree structure :param vessel_tree: vt structure :param outfile: filename with .vtk extension :param text_label: text label like 'porta' or 'hepatic_veins' :param lc_all: LC_ALL locale settings. Controls float numbers...
[ "def", "vt2vtk_file", "(", "vessel_tree", ",", "outfile", ",", "text_label", "=", "None", ",", "lc_all", "=", "\"C\"", ")", ":", "polyData", "=", "vt2polyData", "(", "vessel_tree", ",", "text_label", "=", "text_label", ")", "if", "lc_all", "is", "not", "No...
vessel_tree structure :param vessel_tree: vt structure :param outfile: filename with .vtk extension :param text_label: text label like 'porta' or 'hepatic_veins' :param lc_all: LC_ALL locale settings. Controls float numbers format (dot or colon). If is set to "C" dot is used. If None is...
[ "vessel_tree", "structure", ":", "param", "vessel_tree", ":", "vt", "structure", ":", "param", "outfile", ":", "filename", "with", ".", "vtk", "extension", ":", "param", "text_label", ":", "text", "label", "like", "porta", "or", "hepatic_veins", ":", "param", ...
eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a
https://github.com/mjirik/imtools/blob/eb29fa59df0e0684d8334eb3bc5ef36ea46d1d3a/imtools/gen_vtk_tree.py#L35-L59
train
Convert a vessel tree to a vtk file.
cltl/KafNafParserPy
KafNafParserPy/temporal_data.py
CtemporalRelations.remove_this_tlink
def remove_this_tlink(self,tlink_id): """ Removes the tlink for the given tlink identifier @type tlink_id: string @param tlink_id: the tlink identifier to be removed """ for tlink in self.get_tlinks(): if tlink.get_id() == tlink_id: self.node.r...
python
def remove_this_tlink(self,tlink_id): """ Removes the tlink for the given tlink identifier @type tlink_id: string @param tlink_id: the tlink identifier to be removed """ for tlink in self.get_tlinks(): if tlink.get_id() == tlink_id: self.node.r...
[ "def", "remove_this_tlink", "(", "self", ",", "tlink_id", ")", ":", "for", "tlink", "in", "self", ".", "get_tlinks", "(", ")", ":", "if", "tlink", ".", "get_id", "(", ")", "==", "tlink_id", ":", "self", ".", "node", ".", "remove", "(", "tlink", ".", ...
Removes the tlink for the given tlink identifier @type tlink_id: string @param tlink_id: the tlink identifier to be removed
[ "Removes", "the", "tlink", "for", "the", "given", "tlink", "identifier" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/temporal_data.py#L344-L353
train
Removes the tlink for the given tlink identifier
cltl/KafNafParserPy
KafNafParserPy/temporal_data.py
CtemporalRelations.remove_this_predicateAnchor
def remove_this_predicateAnchor(self,predAnch_id): """ Removes the predicate anchor for the given predicate anchor identifier @type predAnch_id: string @param predAnch_id: the predicate anchor identifier to be removed """ for predAnch in self.get_predicateAnchors(): ...
python
def remove_this_predicateAnchor(self,predAnch_id): """ Removes the predicate anchor for the given predicate anchor identifier @type predAnch_id: string @param predAnch_id: the predicate anchor identifier to be removed """ for predAnch in self.get_predicateAnchors(): ...
[ "def", "remove_this_predicateAnchor", "(", "self", ",", "predAnch_id", ")", ":", "for", "predAnch", "in", "self", ".", "get_predicateAnchors", "(", ")", ":", "if", "predAnch", ".", "get_id", "(", ")", "==", "predAnch_id", ":", "self", ".", "node", ".", "re...
Removes the predicate anchor for the given predicate anchor identifier @type predAnch_id: string @param predAnch_id: the predicate anchor identifier to be removed
[ "Removes", "the", "predicate", "anchor", "for", "the", "given", "predicate", "anchor", "identifier" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/temporal_data.py#L363-L372
train
Removes the predicate anchor for the given predicate anchor identifier.
teepark/greenhouse
greenhouse/io/descriptor.py
wait_fds
def wait_fds(fd_events, inmask=1, outmask=2, timeout=None): """wait for the first of a number of file descriptors to have activity .. note:: this method can block it will return once there is relevant activity on the file descriptors, or the timeout expires :param fd_events: two-t...
python
def wait_fds(fd_events, inmask=1, outmask=2, timeout=None): """wait for the first of a number of file descriptors to have activity .. note:: this method can block it will return once there is relevant activity on the file descriptors, or the timeout expires :param fd_events: two-t...
[ "def", "wait_fds", "(", "fd_events", ",", "inmask", "=", "1", ",", "outmask", "=", "2", ",", "timeout", "=", "None", ")", ":", "current", "=", "compat", ".", "getcurrent", "(", ")", "activated", "=", "{", "}", "poll_regs", "=", "{", "}", "callback_re...
wait for the first of a number of file descriptors to have activity .. note:: this method can block it will return once there is relevant activity on the file descriptors, or the timeout expires :param fd_events: two-tuples, each one a file descriptor and a mask made up of the inmask ...
[ "wait", "for", "the", "first", "of", "a", "number", "of", "file", "descriptors", "to", "have", "activity" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/io/descriptor.py#L13-L87
train
wait for the first of a number of file descriptors to have activity on the file descriptors in fd_events
EVEprosper/ProsperCommon
setup.py
get_version
def get_version(package_name): """find __version__ for making package Args: package_name (str): path to _version.py folder (abspath > relpath) Returns: str: __version__ value """ module = 'prosper.' + package_name + '._version' package = importlib.import_module(module) ve...
python
def get_version(package_name): """find __version__ for making package Args: package_name (str): path to _version.py folder (abspath > relpath) Returns: str: __version__ value """ module = 'prosper.' + package_name + '._version' package = importlib.import_module(module) ve...
[ "def", "get_version", "(", "package_name", ")", ":", "module", "=", "'prosper.'", "+", "package_name", "+", "'._version'", "package", "=", "importlib", ".", "import_module", "(", "module", ")", "version", "=", "package", ".", "__version__", "return", "version" ]
find __version__ for making package Args: package_name (str): path to _version.py folder (abspath > relpath) Returns: str: __version__ value
[ "find", "__version__", "for", "making", "package" ]
bcada3b25420099e1f204db8d55eb268e7b4dc27
https://github.com/EVEprosper/ProsperCommon/blob/bcada3b25420099e1f204db8d55eb268e7b4dc27/setup.py#L13-L28
train
find __version__ for making package
EVEprosper/ProsperCommon
setup.py
hack_find_packages
def hack_find_packages(include_str): """patches setuptools.find_packages issue setuptools.find_packages(path='') doesn't work as intended Returns: list: append <include_str>. onto every element of setuptools.find_pacakges() call """ new_list = [include_str] for element in find_package...
python
def hack_find_packages(include_str): """patches setuptools.find_packages issue setuptools.find_packages(path='') doesn't work as intended Returns: list: append <include_str>. onto every element of setuptools.find_pacakges() call """ new_list = [include_str] for element in find_package...
[ "def", "hack_find_packages", "(", "include_str", ")", ":", "new_list", "=", "[", "include_str", "]", "for", "element", "in", "find_packages", "(", "include_str", ")", ":", "new_list", ".", "append", "(", "include_str", "+", "'.'", "+", "element", ")", "retur...
patches setuptools.find_packages issue setuptools.find_packages(path='') doesn't work as intended Returns: list: append <include_str>. onto every element of setuptools.find_pacakges() call
[ "patches", "setuptools", ".", "find_packages", "issue" ]
bcada3b25420099e1f204db8d55eb268e7b4dc27
https://github.com/EVEprosper/ProsperCommon/blob/bcada3b25420099e1f204db8d55eb268e7b4dc27/setup.py#L30-L43
train
patches setuptools. find_packages issue setuptools. find_packages doesn t work as intended
EVEprosper/ProsperCommon
setup.py
include_all_subfiles
def include_all_subfiles(*args): """Slurps up all files in a directory (non recursive) for data_files section Note: Not recursive, only includes flat files Returns: list: list of all non-directories in a file """ file_list = [] for path_included in args: local_path = p...
python
def include_all_subfiles(*args): """Slurps up all files in a directory (non recursive) for data_files section Note: Not recursive, only includes flat files Returns: list: list of all non-directories in a file """ file_list = [] for path_included in args: local_path = p...
[ "def", "include_all_subfiles", "(", "*", "args", ")", ":", "file_list", "=", "[", "]", "for", "path_included", "in", "args", ":", "local_path", "=", "path", ".", "join", "(", "HERE", ",", "path_included", ")", "for", "file", "in", "listdir", "(", "local_...
Slurps up all files in a directory (non recursive) for data_files section Note: Not recursive, only includes flat files Returns: list: list of all non-directories in a file
[ "Slurps", "up", "all", "files", "in", "a", "directory", "(", "non", "recursive", ")", "for", "data_files", "section" ]
bcada3b25420099e1f204db8d55eb268e7b4dc27
https://github.com/EVEprosper/ProsperCommon/blob/bcada3b25420099e1f204db8d55eb268e7b4dc27/setup.py#L45-L65
train
Slurps up all files in a directory for data_files section
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/queue.py
Requests.WaitUntilComplete
def WaitUntilComplete(self,poll_freq=2,timeout=None): """Poll until all request objects have completed. If status is 'notStarted' or 'executing' continue polling. If status is 'succeeded' then success Else log as error poll_freq option is in seconds Returns an Int the number of unsuccessful requests. Th...
python
def WaitUntilComplete(self,poll_freq=2,timeout=None): """Poll until all request objects have completed. If status is 'notStarted' or 'executing' continue polling. If status is 'succeeded' then success Else log as error poll_freq option is in seconds Returns an Int the number of unsuccessful requests. Th...
[ "def", "WaitUntilComplete", "(", "self", ",", "poll_freq", "=", "2", ",", "timeout", "=", "None", ")", ":", "start_time", "=", "time", ".", "time", "(", ")", "while", "len", "(", "self", ".", "requests", ")", ":", "cur_requests", "=", "[", "]", "for"...
Poll until all request objects have completed. If status is 'notStarted' or 'executing' continue polling. If status is 'succeeded' then success Else log as error poll_freq option is in seconds Returns an Int the number of unsuccessful requests. This behavior is subject to change. >>> clc.v2.Server(alia...
[ "Poll", "until", "all", "request", "objects", "have", "completed", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/queue.py#L119-L153
train
Wait until all requests have completed.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/queue.py
Request.WaitUntilComplete
def WaitUntilComplete(self,poll_freq=2,timeout=None): """Poll until status is completed. If status is 'notStarted' or 'executing' continue polling. If status is 'succeeded' return Else raise exception poll_freq option is in seconds """ start_time = time.time() while not self.time_completed: status...
python
def WaitUntilComplete(self,poll_freq=2,timeout=None): """Poll until status is completed. If status is 'notStarted' or 'executing' continue polling. If status is 'succeeded' return Else raise exception poll_freq option is in seconds """ start_time = time.time() while not self.time_completed: status...
[ "def", "WaitUntilComplete", "(", "self", ",", "poll_freq", "=", "2", ",", "timeout", "=", "None", ")", ":", "start_time", "=", "time", ".", "time", "(", ")", "while", "not", "self", ".", "time_completed", ":", "status", "=", "self", ".", "Status", "(",...
Poll until status is completed. If status is 'notStarted' or 'executing' continue polling. If status is 'succeeded' return Else raise exception poll_freq option is in seconds
[ "Poll", "until", "status", "is", "completed", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/queue.py#L197-L222
train
Wait until the request is completed.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/queue.py
Request.Server
def Server(self): """Return server associated with this request. >>> d = clc.v2.Datacenter() >>> q = clc.v2.Server.Create(name="api2",cpu=1,memory=1,group_id=d.Groups().Get("Default Group").id,template=d.Templates().Search("centos-6-64")[0].id,network_id=d.Networks().networks[0].id,ttl=4000) >>> q.WaitUntilCom...
python
def Server(self): """Return server associated with this request. >>> d = clc.v2.Datacenter() >>> q = clc.v2.Server.Create(name="api2",cpu=1,memory=1,group_id=d.Groups().Get("Default Group").id,template=d.Templates().Search("centos-6-64")[0].id,network_id=d.Networks().networks[0].id,ttl=4000) >>> q.WaitUntilCom...
[ "def", "Server", "(", "self", ")", ":", "if", "self", ".", "context_key", "==", "'newserver'", ":", "server_id", "=", "clc", ".", "v2", ".", "API", ".", "Call", "(", "'GET'", ",", "self", ".", "context_val", ",", "session", "=", "self", ".", "session...
Return server associated with this request. >>> d = clc.v2.Datacenter() >>> q = clc.v2.Server.Create(name="api2",cpu=1,memory=1,group_id=d.Groups().Get("Default Group").id,template=d.Templates().Search("centos-6-64")[0].id,network_id=d.Networks().networks[0].id,ttl=4000) >>> q.WaitUntilComplete() 0 >>> q.suc...
[ "Return", "server", "associated", "with", "this", "request", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/queue.py#L225-L243
train
Return server associated with this request.
thilux/tvdb_client
tvdb_client/clients/ApiV2Client.py
ApiV2Client.__get_header_with_auth
def __get_header_with_auth(self): """ This private method returns the HTTP heder filled with the Authorization information with the user token. The token validity is monitored whenever this function is called, so according to the swagger page of TheTVDB (https://api.thetvdb.com/swagger) ...
python
def __get_header_with_auth(self): """ This private method returns the HTTP heder filled with the Authorization information with the user token. The token validity is monitored whenever this function is called, so according to the swagger page of TheTVDB (https://api.thetvdb.com/swagger) ...
[ "def", "__get_header_with_auth", "(", "self", ")", ":", "auth_header", "=", "self", ".", "__get_header", "(", ")", "auth_header", "[", "'Authorization'", "]", "=", "'Bearer %s'", "%", "self", ".", "__token", "token_renew_time", "=", "self", ".", "__auth_time", ...
This private method returns the HTTP heder filled with the Authorization information with the user token. The token validity is monitored whenever this function is called, so according to the swagger page of TheTVDB (https://api.thetvdb.com/swagger) the tokens are valid for 24 hours, therefore if a toke...
[ "This", "private", "method", "returns", "the", "HTTP", "heder", "filled", "with", "the", "Authorization", "information", "with", "the", "user", "token", ".", "The", "token", "validity", "is", "monitored", "whenever", "this", "function", "is", "called", "so", "...
2d5106f260367c0abe1284683697874df6343f78
https://github.com/thilux/tvdb_client/blob/2d5106f260367c0abe1284683697874df6343f78/tvdb_client/clients/ApiV2Client.py#L54-L77
train
This private method returns the HTTP heder filled with the Authorization information with the user token.
thilux/tvdb_client
tvdb_client/clients/ApiV2Client.py
ApiV2Client.login
def login(self): """ This method performs the login on TheTVDB given the api key, user name and account identifier. :return: None """ auth_data = dict() auth_data['apikey'] = self.api_key auth_data['username'] = self.username auth_data['userkey'] = self.a...
python
def login(self): """ This method performs the login on TheTVDB given the api key, user name and account identifier. :return: None """ auth_data = dict() auth_data['apikey'] = self.api_key auth_data['username'] = self.username auth_data['userkey'] = self.a...
[ "def", "login", "(", "self", ")", ":", "auth_data", "=", "dict", "(", ")", "auth_data", "[", "'apikey'", "]", "=", "self", ".", "api_key", "auth_data", "[", "'username'", "]", "=", "self", ".", "username", "auth_data", "[", "'userkey'", "]", "=", "self...
This method performs the login on TheTVDB given the api key, user name and account identifier. :return: None
[ "This", "method", "performs", "the", "login", "on", "TheTVDB", "given", "the", "api", "key", "user", "name", "and", "account", "identifier", "." ]
2d5106f260367c0abe1284683697874df6343f78
https://github.com/thilux/tvdb_client/blob/2d5106f260367c0abe1284683697874df6343f78/tvdb_client/clients/ApiV2Client.py#L79-L99
train
This method performs the login on TheTVDB given the api key user name and account identifier.
thilux/tvdb_client
tvdb_client/clients/ApiV2Client.py
ApiV2Client.search_series
def search_series(self, name=None, imdb_id=None, zap2it_id=None): """ Searchs for a series in TheTVDB by either its name, imdb_id or zap2it_id. :param name: the name of the series to look for :param imdb_id: the IMDB id of the series to look for :param zap2it_id: the zap2it id o...
python
def search_series(self, name=None, imdb_id=None, zap2it_id=None): """ Searchs for a series in TheTVDB by either its name, imdb_id or zap2it_id. :param name: the name of the series to look for :param imdb_id: the IMDB id of the series to look for :param zap2it_id: the zap2it id o...
[ "def", "search_series", "(", "self", ",", "name", "=", "None", ",", "imdb_id", "=", "None", ",", "zap2it_id", "=", "None", ")", ":", "arguments", "=", "locals", "(", ")", "optional_parameters", "=", "{", "'name'", ":", "'name'", ",", "'imdb_id'", ":", ...
Searchs for a series in TheTVDB by either its name, imdb_id or zap2it_id. :param name: the name of the series to look for :param imdb_id: the IMDB id of the series to look for :param zap2it_id: the zap2it id of the series to look for. :return: a python dictionary with either the result ...
[ "Searchs", "for", "a", "series", "in", "TheTVDB", "by", "either", "its", "name", "imdb_id", "or", "zap2it_id", "." ]
2d5106f260367c0abe1284683697874df6343f78
https://github.com/thilux/tvdb_client/blob/2d5106f260367c0abe1284683697874df6343f78/tvdb_client/clients/ApiV2Client.py#L102-L120
train
Search for a series in TheTVDB by either its name imdb_id or zap2it_id.
thilux/tvdb_client
tvdb_client/clients/ApiV2Client.py
ApiV2Client.get_series_actors
def get_series_actors(self, series_id): """ Retrieves the information on the actors of a particular series, given its TheTVDB id. :param series_id: the TheTVDB id of the series :return: a python dictionary with either the result of the search or an error from TheTVDB. """ ...
python
def get_series_actors(self, series_id): """ Retrieves the information on the actors of a particular series, given its TheTVDB id. :param series_id: the TheTVDB id of the series :return: a python dictionary with either the result of the search or an error from TheTVDB. """ ...
[ "def", "get_series_actors", "(", "self", ",", "series_id", ")", ":", "raw_response", "=", "requests_util", ".", "run_request", "(", "'get'", ",", "self", ".", "API_BASE_URL", "+", "'/series/%d/actors'", "%", "series_id", ",", "headers", "=", "self", ".", "__ge...
Retrieves the information on the actors of a particular series, given its TheTVDB id. :param series_id: the TheTVDB id of the series :return: a python dictionary with either the result of the search or an error from TheTVDB.
[ "Retrieves", "the", "information", "on", "the", "actors", "of", "a", "particular", "series", "given", "its", "TheTVDB", "id", "." ]
2d5106f260367c0abe1284683697874df6343f78
https://github.com/thilux/tvdb_client/blob/2d5106f260367c0abe1284683697874df6343f78/tvdb_client/clients/ApiV2Client.py#L137-L148
train
Returns the information on the actors of a particular series given its TheTVDB id.
thilux/tvdb_client
tvdb_client/clients/ApiV2Client.py
ApiV2Client.get_series_episodes
def get_series_episodes(self, series_id, page=1): """ Retrieves all episodes for a particular series given its TheTVDB id. It retrieves a maximum of 100 results per page. :param series_id: The TheTVDB id of the series. :param page: The page number. If none is provided, 1 is used...
python
def get_series_episodes(self, series_id, page=1): """ Retrieves all episodes for a particular series given its TheTVDB id. It retrieves a maximum of 100 results per page. :param series_id: The TheTVDB id of the series. :param page: The page number. If none is provided, 1 is used...
[ "def", "get_series_episodes", "(", "self", ",", "series_id", ",", "page", "=", "1", ")", ":", "raw_response", "=", "requests_util", ".", "run_request", "(", "'get'", ",", "self", ".", "API_BASE_URL", "+", "'/series/%d/episodes?page=%d'", "%", "(", "series_id", ...
Retrieves all episodes for a particular series given its TheTVDB id. It retrieves a maximum of 100 results per page. :param series_id: The TheTVDB id of the series. :param page: The page number. If none is provided, 1 is used by default. :return: a python dictionary with either the resu...
[ "Retrieves", "all", "episodes", "for", "a", "particular", "series", "given", "its", "TheTVDB", "id", ".", "It", "retrieves", "a", "maximum", "of", "100", "results", "per", "page", "." ]
2d5106f260367c0abe1284683697874df6343f78
https://github.com/thilux/tvdb_client/blob/2d5106f260367c0abe1284683697874df6343f78/tvdb_client/clients/ApiV2Client.py#L151-L164
train
This method returns all the episodes for a particular series given its TheTVDB id. It returns a maximum of 100 results per page.
thilux/tvdb_client
tvdb_client/clients/ApiV2Client.py
ApiV2Client.get_series_episodes
def get_series_episodes(self, series_id, episode_number=None, aired_season=None, aired_episode=None, dvd_season=None, dvd_episode=None, imdb_id=None, page=1): """ Retrieves all episodes for a particular series given its TheTVDB and filtered by additional optional details. ...
python
def get_series_episodes(self, series_id, episode_number=None, aired_season=None, aired_episode=None, dvd_season=None, dvd_episode=None, imdb_id=None, page=1): """ Retrieves all episodes for a particular series given its TheTVDB and filtered by additional optional details. ...
[ "def", "get_series_episodes", "(", "self", ",", "series_id", ",", "episode_number", "=", "None", ",", "aired_season", "=", "None", ",", "aired_episode", "=", "None", ",", "dvd_season", "=", "None", ",", "dvd_episode", "=", "None", ",", "imdb_id", "=", "None"...
Retrieves all episodes for a particular series given its TheTVDB and filtered by additional optional details. :param series_id: The TheTVDB id of the series. :param episode_number: The optional absolute episode number. :param aired_season: The optional aired season number. :param aired_...
[ "Retrieves", "all", "episodes", "for", "a", "particular", "series", "given", "its", "TheTVDB", "and", "filtered", "by", "additional", "optional", "details", "." ]
2d5106f260367c0abe1284683697874df6343f78
https://github.com/thilux/tvdb_client/blob/2d5106f260367c0abe1284683697874df6343f78/tvdb_client/clients/ApiV2Client.py#L167-L194
train
This method returns all the episodes for a particular series given its TheTVDB and filtered by optional details.
thilux/tvdb_client
tvdb_client/clients/ApiV2Client.py
ApiV2Client.get_series_images
def get_series_images(self, series_id, image_type=None, resolution=None, sub_key=None): """ Retrieves the url to images (posters, fanart) for the series, seasons and episodes of a series given its TheTVDB id and filtered by additional parameters. :param series_id: The TheTVDB id of the ...
python
def get_series_images(self, series_id, image_type=None, resolution=None, sub_key=None): """ Retrieves the url to images (posters, fanart) for the series, seasons and episodes of a series given its TheTVDB id and filtered by additional parameters. :param series_id: The TheTVDB id of the ...
[ "def", "get_series_images", "(", "self", ",", "series_id", ",", "image_type", "=", "None", ",", "resolution", "=", "None", ",", "sub_key", "=", "None", ")", ":", "arguments", "=", "locals", "(", ")", "optional_parameters", "=", "{", "'image_type'", ":", "'...
Retrieves the url to images (posters, fanart) for the series, seasons and episodes of a series given its TheTVDB id and filtered by additional parameters. :param series_id: The TheTVDB id of the series. :param image_type: The optional type of image: posters, fanart, thumbnail, etc. :par...
[ "Retrieves", "the", "url", "to", "images", "(", "posters", "fanart", ")", "for", "the", "series", "seasons", "and", "episodes", "of", "a", "series", "given", "its", "TheTVDB", "id", "and", "filtered", "by", "additional", "parameters", "." ]
2d5106f260367c0abe1284683697874df6343f78
https://github.com/thilux/tvdb_client/blob/2d5106f260367c0abe1284683697874df6343f78/tvdb_client/clients/ApiV2Client.py#L226-L249
train
This method returns the url to images for the series seasons and episodes of a series given its TheTVDB id and optional parameters.
thilux/tvdb_client
tvdb_client/clients/ApiV2Client.py
ApiV2Client.get_updated
def get_updated(self, from_time, to_time=None): """ Retrives a list of series that have changed on TheTVDB since a provided from time parameter and optionally to an specified to time. :param from_time: An epoch representation of the date from which to restrict the query to. :par...
python
def get_updated(self, from_time, to_time=None): """ Retrives a list of series that have changed on TheTVDB since a provided from time parameter and optionally to an specified to time. :param from_time: An epoch representation of the date from which to restrict the query to. :par...
[ "def", "get_updated", "(", "self", ",", "from_time", ",", "to_time", "=", "None", ")", ":", "arguments", "=", "locals", "(", ")", "optional_parameters", "=", "{", "'to_time'", ":", "'toTime'", "}", "query_string", "=", "'fromTime=%s&%s'", "%", "(", "from_tim...
Retrives a list of series that have changed on TheTVDB since a provided from time parameter and optionally to an specified to time. :param from_time: An epoch representation of the date from which to restrict the query to. :param to_time: An optional epcoh representation of the date to which to...
[ "Retrives", "a", "list", "of", "series", "that", "have", "changed", "on", "TheTVDB", "since", "a", "provided", "from", "time", "parameter", "and", "optionally", "to", "an", "specified", "to", "time", "." ]
2d5106f260367c0abe1284683697874df6343f78
https://github.com/thilux/tvdb_client/blob/2d5106f260367c0abe1284683697874df6343f78/tvdb_client/clients/ApiV2Client.py#L252-L271
train
Returns a list of series that have changed on TheTVDB since a provided from time parameter and optionally to an optional to time parameter.
thilux/tvdb_client
tvdb_client/clients/ApiV2Client.py
ApiV2Client.get_user
def get_user(self): """ Retrieves information about the user currently using the api. :return: a python dictionary with either the result of the search or an error from TheTVDB. """ return self.parse_raw_response(requests_util.run_request('get', self.API_BASE_URL + '/user', ...
python
def get_user(self): """ Retrieves information about the user currently using the api. :return: a python dictionary with either the result of the search or an error from TheTVDB. """ return self.parse_raw_response(requests_util.run_request('get', self.API_BASE_URL + '/user', ...
[ "def", "get_user", "(", "self", ")", ":", "return", "self", ".", "parse_raw_response", "(", "requests_util", ".", "run_request", "(", "'get'", ",", "self", ".", "API_BASE_URL", "+", "'/user'", ",", "headers", "=", "self", ".", "__get_header_with_auth", "(", ...
Retrieves information about the user currently using the api. :return: a python dictionary with either the result of the search or an error from TheTVDB.
[ "Retrieves", "information", "about", "the", "user", "currently", "using", "the", "api", "." ]
2d5106f260367c0abe1284683697874df6343f78
https://github.com/thilux/tvdb_client/blob/2d5106f260367c0abe1284683697874df6343f78/tvdb_client/clients/ApiV2Client.py#L274-L282
train
Retrieves information about the user currently using the API.
thilux/tvdb_client
tvdb_client/clients/ApiV2Client.py
ApiV2Client.get_user_favorites
def get_user_favorites(self): """ Retrieves the list of tv series the current user has flagged as favorite. :return: a python dictionary with either the result of the search or an error from TheTVDB. """ return self.parse_raw_response(requests_util.run_request('get', self.API_B...
python
def get_user_favorites(self): """ Retrieves the list of tv series the current user has flagged as favorite. :return: a python dictionary with either the result of the search or an error from TheTVDB. """ return self.parse_raw_response(requests_util.run_request('get', self.API_B...
[ "def", "get_user_favorites", "(", "self", ")", ":", "return", "self", ".", "parse_raw_response", "(", "requests_util", ".", "run_request", "(", "'get'", ",", "self", ".", "API_BASE_URL", "+", "'/user/favorites'", ",", "headers", "=", "self", ".", "__get_header_w...
Retrieves the list of tv series the current user has flagged as favorite. :return: a python dictionary with either the result of the search or an error from TheTVDB.
[ "Retrieves", "the", "list", "of", "tv", "series", "the", "current", "user", "has", "flagged", "as", "favorite", "." ]
2d5106f260367c0abe1284683697874df6343f78
https://github.com/thilux/tvdb_client/blob/2d5106f260367c0abe1284683697874df6343f78/tvdb_client/clients/ApiV2Client.py#L285-L293
train
Retrieves the list of tv series the current user has flagged as favorite.
thilux/tvdb_client
tvdb_client/clients/ApiV2Client.py
ApiV2Client.delete_user_favorite
def delete_user_favorite(self, series_id): """ Deletes the series of the provided id from the favorites list of the current user. :param series_id: The TheTVDB id of the series. :return: a python dictionary with either the result of the search or an error from TheTVDB. """ ...
python
def delete_user_favorite(self, series_id): """ Deletes the series of the provided id from the favorites list of the current user. :param series_id: The TheTVDB id of the series. :return: a python dictionary with either the result of the search or an error from TheTVDB. """ ...
[ "def", "delete_user_favorite", "(", "self", ",", "series_id", ")", ":", "return", "self", ".", "parse_raw_response", "(", "requests_util", ".", "run_request", "(", "'delete'", ",", "self", ".", "API_BASE_URL", "+", "'/user/favorites/%d'", "%", "series_id", ",", ...
Deletes the series of the provided id from the favorites list of the current user. :param series_id: The TheTVDB id of the series. :return: a python dictionary with either the result of the search or an error from TheTVDB.
[ "Deletes", "the", "series", "of", "the", "provided", "id", "from", "the", "favorites", "list", "of", "the", "current", "user", "." ]
2d5106f260367c0abe1284683697874df6343f78
https://github.com/thilux/tvdb_client/blob/2d5106f260367c0abe1284683697874df6343f78/tvdb_client/clients/ApiV2Client.py#L296-L306
train
Delete the user s favorites list of the current user.
thilux/tvdb_client
tvdb_client/clients/ApiV2Client.py
ApiV2Client.__get_user_ratings
def __get_user_ratings(self): """ Returns a list of the ratings provided by the current user. :return: a python dictionary with either the result of the search or an error from TheTVDB. """ return self.parse_raw_response(requests_util.run_request('get', self.API_BASE_URL + '/us...
python
def __get_user_ratings(self): """ Returns a list of the ratings provided by the current user. :return: a python dictionary with either the result of the search or an error from TheTVDB. """ return self.parse_raw_response(requests_util.run_request('get', self.API_BASE_URL + '/us...
[ "def", "__get_user_ratings", "(", "self", ")", ":", "return", "self", ".", "parse_raw_response", "(", "requests_util", ".", "run_request", "(", "'get'", ",", "self", ".", "API_BASE_URL", "+", "'/user/ratings'", ",", "headers", "=", "self", ".", "__get_header_wit...
Returns a list of the ratings provided by the current user. :return: a python dictionary with either the result of the search or an error from TheTVDB.
[ "Returns", "a", "list", "of", "the", "ratings", "provided", "by", "the", "current", "user", "." ]
2d5106f260367c0abe1284683697874df6343f78
https://github.com/thilux/tvdb_client/blob/2d5106f260367c0abe1284683697874df6343f78/tvdb_client/clients/ApiV2Client.py#L322-L330
train
Returns a list of the ratings provided by the current user.
thilux/tvdb_client
tvdb_client/clients/ApiV2Client.py
ApiV2Client.get_user_ratings
def get_user_ratings(self, item_type=None): """ Returns a list of the ratings for the type of item provided, for the current user. :param item_type: One of: series, episode or banner. :return: a python dictionary with either the result of the search or an error from TheTVDB. """...
python
def get_user_ratings(self, item_type=None): """ Returns a list of the ratings for the type of item provided, for the current user. :param item_type: One of: series, episode or banner. :return: a python dictionary with either the result of the search or an error from TheTVDB. """...
[ "def", "get_user_ratings", "(", "self", ",", "item_type", "=", "None", ")", ":", "if", "item_type", ":", "query_string", "=", "'itemType=%s'", "%", "item_type", "return", "self", ".", "parse_raw_response", "(", "requests_util", ".", "run_request", "(", "'get'", ...
Returns a list of the ratings for the type of item provided, for the current user. :param item_type: One of: series, episode or banner. :return: a python dictionary with either the result of the search or an error from TheTVDB.
[ "Returns", "a", "list", "of", "the", "ratings", "for", "the", "type", "of", "item", "provided", "for", "the", "current", "user", "." ]
2d5106f260367c0abe1284683697874df6343f78
https://github.com/thilux/tvdb_client/blob/2d5106f260367c0abe1284683697874df6343f78/tvdb_client/clients/ApiV2Client.py#L333-L348
train
Returns a list of the ratings for the type of item provided for the current user.
thilux/tvdb_client
tvdb_client/clients/ApiV2Client.py
ApiV2Client.add_user_rating
def add_user_rating(self, item_type, item_id, item_rating): """ Adds the rating for the item indicated for the current user. :param item_type: One of: series, episode, banner. :param item_id: The TheTVDB id of the item. :param item_rating: The rating from 0 to 10. :retur...
python
def add_user_rating(self, item_type, item_id, item_rating): """ Adds the rating for the item indicated for the current user. :param item_type: One of: series, episode, banner. :param item_id: The TheTVDB id of the item. :param item_rating: The rating from 0 to 10. :retur...
[ "def", "add_user_rating", "(", "self", ",", "item_type", ",", "item_id", ",", "item_rating", ")", ":", "raw_response", "=", "requests_util", ".", "run_request", "(", "'put'", ",", "self", ".", "API_BASE_URL", "+", "'/user/ratings/%s/%d/%d'", "%", "(", "item_type...
Adds the rating for the item indicated for the current user. :param item_type: One of: series, episode, banner. :param item_id: The TheTVDB id of the item. :param item_rating: The rating from 0 to 10. :return:
[ "Adds", "the", "rating", "for", "the", "item", "indicated", "for", "the", "current", "user", "." ]
2d5106f260367c0abe1284683697874df6343f78
https://github.com/thilux/tvdb_client/blob/2d5106f260367c0abe1284683697874df6343f78/tvdb_client/clients/ApiV2Client.py#L351-L366
train
Adds the rating for the item indicated for the current user.
thilux/tvdb_client
tvdb_client/clients/ApiV2Client.py
ApiV2Client.delete_user_rating
def delete_user_rating(self, item_type, item_id): """ Deletes from the list of rating of the current user, the rating provided for the specified element type. :param item_type: One of: series, episode, banner. :param item_id: The TheTVDB Id of the item. :return: a python diction...
python
def delete_user_rating(self, item_type, item_id): """ Deletes from the list of rating of the current user, the rating provided for the specified element type. :param item_type: One of: series, episode, banner. :param item_id: The TheTVDB Id of the item. :return: a python diction...
[ "def", "delete_user_rating", "(", "self", ",", "item_type", ",", "item_id", ")", ":", "raw_response", "=", "requests_util", ".", "run_request", "(", "'delete'", ",", "self", ".", "API_BASE_URL", "+", "'/user/ratings/%s/%d'", "%", "(", "item_type", ",", "item_id"...
Deletes from the list of rating of the current user, the rating provided for the specified element type. :param item_type: One of: series, episode, banner. :param item_id: The TheTVDB Id of the item. :return: a python dictionary with either the result of the search or an error from TheTVDB.
[ "Deletes", "from", "the", "list", "of", "rating", "of", "the", "current", "user", "the", "rating", "provided", "for", "the", "specified", "element", "type", "." ]
2d5106f260367c0abe1284683697874df6343f78
https://github.com/thilux/tvdb_client/blob/2d5106f260367c0abe1284683697874df6343f78/tvdb_client/clients/ApiV2Client.py#L369-L382
train
Deletes the user rating of the current user.
thilux/tvdb_client
tvdb_client/clients/ApiV2Client.py
ApiV2Client.get_episode
def get_episode(self, episode_id): """ Returns the full information of the episode belonging to the Id provided. :param episode_id: The TheTVDB id of the episode. :return: a python dictionary with either the result of the search or an error from TheTVDB. """ raw_respons...
python
def get_episode(self, episode_id): """ Returns the full information of the episode belonging to the Id provided. :param episode_id: The TheTVDB id of the episode. :return: a python dictionary with either the result of the search or an error from TheTVDB. """ raw_respons...
[ "def", "get_episode", "(", "self", ",", "episode_id", ")", ":", "raw_response", "=", "requests_util", ".", "run_request", "(", "'get'", ",", "self", ".", "API_BASE_URL", "+", "'/episodes/%d'", "%", "episode_id", ",", "headers", "=", "self", ".", "__get_header_...
Returns the full information of the episode belonging to the Id provided. :param episode_id: The TheTVDB id of the episode. :return: a python dictionary with either the result of the search or an error from TheTVDB.
[ "Returns", "the", "full", "information", "of", "the", "episode", "belonging", "to", "the", "Id", "provided", "." ]
2d5106f260367c0abe1284683697874df6343f78
https://github.com/thilux/tvdb_client/blob/2d5106f260367c0abe1284683697874df6343f78/tvdb_client/clients/ApiV2Client.py#L385-L396
train
Returns the full information of the episode with the given id.
thilux/tvdb_client
tvdb_client/clients/ApiV2Client.py
ApiV2Client.get_languages
def get_languages(self): """ Returns a list of all language options available in TheTVDB. :return: a python dictionary with either the result of the search or an error from TheTVDB. """ raw_response = requests_util.run_request('get', self.API_BASE_URL + '/languages', ...
python
def get_languages(self): """ Returns a list of all language options available in TheTVDB. :return: a python dictionary with either the result of the search or an error from TheTVDB. """ raw_response = requests_util.run_request('get', self.API_BASE_URL + '/languages', ...
[ "def", "get_languages", "(", "self", ")", ":", "raw_response", "=", "requests_util", ".", "run_request", "(", "'get'", ",", "self", ".", "API_BASE_URL", "+", "'/languages'", ",", "headers", "=", "self", ".", "__get_header_with_auth", "(", ")", ")", "return", ...
Returns a list of all language options available in TheTVDB. :return: a python dictionary with either the result of the search or an error from TheTVDB.
[ "Returns", "a", "list", "of", "all", "language", "options", "available", "in", "TheTVDB", "." ]
2d5106f260367c0abe1284683697874df6343f78
https://github.com/thilux/tvdb_client/blob/2d5106f260367c0abe1284683697874df6343f78/tvdb_client/clients/ApiV2Client.py#L399-L409
train
Returns a list of all language options available in TheTVDB.
thilux/tvdb_client
tvdb_client/clients/ApiV2Client.py
ApiV2Client.get_language
def get_language(self, language_id): """ Retrieves information about the language of the given id. :param language_id: The TheTVDB Id of the language. :return: a python dictionary with either the result of the search or an error from TheTVDB. """ raw_response = requests...
python
def get_language(self, language_id): """ Retrieves information about the language of the given id. :param language_id: The TheTVDB Id of the language. :return: a python dictionary with either the result of the search or an error from TheTVDB. """ raw_response = requests...
[ "def", "get_language", "(", "self", ",", "language_id", ")", ":", "raw_response", "=", "requests_util", ".", "run_request", "(", "'get'", ",", "self", ".", "API_BASE_URL", "+", "'/languages/%d'", "%", "language_id", ",", "headers", "=", "self", ".", "__get_hea...
Retrieves information about the language of the given id. :param language_id: The TheTVDB Id of the language. :return: a python dictionary with either the result of the search or an error from TheTVDB.
[ "Retrieves", "information", "about", "the", "language", "of", "the", "given", "id", "." ]
2d5106f260367c0abe1284683697874df6343f78
https://github.com/thilux/tvdb_client/blob/2d5106f260367c0abe1284683697874df6343f78/tvdb_client/clients/ApiV2Client.py#L412-L423
train
Retrieves information about the language of the given id.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv1/__init__.py
SetCredentials
def SetCredentials(api_key,api_passwd): """Establish API key and password associated with APIv1 commands.""" global V1_API_KEY global V1_API_PASSWD global _V1_ENABLED _V1_ENABLED = True V1_API_KEY = api_key V1_API_PASSWD = api_passwd
python
def SetCredentials(api_key,api_passwd): """Establish API key and password associated with APIv1 commands.""" global V1_API_KEY global V1_API_PASSWD global _V1_ENABLED _V1_ENABLED = True V1_API_KEY = api_key V1_API_PASSWD = api_passwd
[ "def", "SetCredentials", "(", "api_key", ",", "api_passwd", ")", ":", "global", "V1_API_KEY", "global", "V1_API_PASSWD", "global", "_V1_ENABLED", "_V1_ENABLED", "=", "True", "V1_API_KEY", "=", "api_key", "V1_API_PASSWD", "=", "api_passwd" ]
Establish API key and password associated with APIv1 commands.
[ "Establish", "API", "key", "and", "password", "associated", "with", "APIv1", "commands", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv1/__init__.py#L54-L61
train
Establish API key and password associated with APIv1 commands.
vmonaco/pohmm
pohmm/utils.py
normalize
def normalize(A, axis=None, inplace=False): """ Normalize the input array so that it sums to 1. Parameters ---------- A: array, shape (n_samples, n_features) Non-normalized input data. axis: int Dimension along which normalization is performed. Returns ------- norma...
python
def normalize(A, axis=None, inplace=False): """ Normalize the input array so that it sums to 1. Parameters ---------- A: array, shape (n_samples, n_features) Non-normalized input data. axis: int Dimension along which normalization is performed. Returns ------- norma...
[ "def", "normalize", "(", "A", ",", "axis", "=", "None", ",", "inplace", "=", "False", ")", ":", "if", "not", "inplace", ":", "A", "=", "A", ".", "copy", "(", ")", "A", "+=", "np", ".", "finfo", "(", "float", ")", ".", "eps", "Asum", "=", "A",...
Normalize the input array so that it sums to 1. Parameters ---------- A: array, shape (n_samples, n_features) Non-normalized input data. axis: int Dimension along which normalization is performed. Returns ------- normalized_A: array, shape (n_samples, n_features) A ...
[ "Normalize", "the", "input", "array", "so", "that", "it", "sums", "to", "1", "." ]
c00f8a62d3005a171d424549a55d46c421859ae9
https://github.com/vmonaco/pohmm/blob/c00f8a62d3005a171d424549a55d46c421859ae9/pohmm/utils.py#L40-L68
train
Normalizes the input array so that it sums to 1 along the prescribed axis.
vmonaco/pohmm
pohmm/utils.py
ph2full
def ph2full(ptrans, htrans): """ Convert a p-state transition matrix and h-state matrices to the full transation matrix The full transmat hase N=n_pstates*n_hstates states """ n_pstates = len(ptrans) n_hstates = len(htrans[0, 0]) N = n_pstates * n_hstates trans = np.zeros((N, N)) fo...
python
def ph2full(ptrans, htrans): """ Convert a p-state transition matrix and h-state matrices to the full transation matrix The full transmat hase N=n_pstates*n_hstates states """ n_pstates = len(ptrans) n_hstates = len(htrans[0, 0]) N = n_pstates * n_hstates trans = np.zeros((N, N)) fo...
[ "def", "ph2full", "(", "ptrans", ",", "htrans", ")", ":", "n_pstates", "=", "len", "(", "ptrans", ")", "n_hstates", "=", "len", "(", "htrans", "[", "0", ",", "0", "]", ")", "N", "=", "n_pstates", "*", "n_hstates", "trans", "=", "np", ".", "zeros", ...
Convert a p-state transition matrix and h-state matrices to the full transation matrix The full transmat hase N=n_pstates*n_hstates states
[ "Convert", "a", "p", "-", "state", "transition", "matrix", "and", "h", "-", "state", "matrices", "to", "the", "full", "transation", "matrix" ]
c00f8a62d3005a171d424549a55d46c421859ae9
https://github.com/vmonaco/pohmm/blob/c00f8a62d3005a171d424549a55d46c421859ae9/pohmm/utils.py#L71-L85
train
Convert a p - state transition matrix and h - state matrices to the full transation matrix
vmonaco/pohmm
pohmm/utils.py
full2ph
def full2ph(trans, n_pstates): """ Convert a full transmat to the respective p-state and h-state transmats """ n_hstates = len(trans) / n_pstates htrans = np.zeros((n_pstates, n_pstates, n_hstates, n_hstates)) for pidx1, pidx2 in product(range(n_pstates), range(n_pstates)): idx1 = pidx1...
python
def full2ph(trans, n_pstates): """ Convert a full transmat to the respective p-state and h-state transmats """ n_hstates = len(trans) / n_pstates htrans = np.zeros((n_pstates, n_pstates, n_hstates, n_hstates)) for pidx1, pidx2 in product(range(n_pstates), range(n_pstates)): idx1 = pidx1...
[ "def", "full2ph", "(", "trans", ",", "n_pstates", ")", ":", "n_hstates", "=", "len", "(", "trans", ")", "/", "n_pstates", "htrans", "=", "np", ".", "zeros", "(", "(", "n_pstates", ",", "n_pstates", ",", "n_hstates", ",", "n_hstates", ")", ")", "for", ...
Convert a full transmat to the respective p-state and h-state transmats
[ "Convert", "a", "full", "transmat", "to", "the", "respective", "p", "-", "state", "and", "h", "-", "state", "transmats" ]
c00f8a62d3005a171d424549a55d46c421859ae9
https://github.com/vmonaco/pohmm/blob/c00f8a62d3005a171d424549a55d46c421859ae9/pohmm/utils.py#L88-L103
train
Convert a full transmat to the respective p - state and h - state transmats
vmonaco/pohmm
pohmm/utils.py
gen_stochastic_matrix
def gen_stochastic_matrix(size, random_state=None): """ Generate a unfiformly-random stochastic array or matrix """ if not type(size) is tuple: size = (1, size) assert len(size) == 2 n = random_state.uniform(size=(size[0], size[1] - 1)) n = np.concatenate([np.zeros((size[0], 1)), n...
python
def gen_stochastic_matrix(size, random_state=None): """ Generate a unfiformly-random stochastic array or matrix """ if not type(size) is tuple: size = (1, size) assert len(size) == 2 n = random_state.uniform(size=(size[0], size[1] - 1)) n = np.concatenate([np.zeros((size[0], 1)), n...
[ "def", "gen_stochastic_matrix", "(", "size", ",", "random_state", "=", "None", ")", ":", "if", "not", "type", "(", "size", ")", "is", "tuple", ":", "size", "=", "(", "1", ",", "size", ")", "assert", "len", "(", "size", ")", "==", "2", "n", "=", "...
Generate a unfiformly-random stochastic array or matrix
[ "Generate", "a", "unfiformly", "-", "random", "stochastic", "array", "or", "matrix" ]
c00f8a62d3005a171d424549a55d46c421859ae9
https://github.com/vmonaco/pohmm/blob/c00f8a62d3005a171d424549a55d46c421859ae9/pohmm/utils.py#L106-L119
train
Generate a unfiformly - random stochastic array or matrix
vmonaco/pohmm
pohmm/utils.py
steadystate
def steadystate(A, max_iter=100): """ Empirically determine the steady state probabilities from a stochastic matrix """ P = np.linalg.matrix_power(A, max_iter) # Determine the unique rows in A v = [] for i in range(len(P)): if not np.any([np.allclose(P[i], vi, ) for vi in v]): ...
python
def steadystate(A, max_iter=100): """ Empirically determine the steady state probabilities from a stochastic matrix """ P = np.linalg.matrix_power(A, max_iter) # Determine the unique rows in A v = [] for i in range(len(P)): if not np.any([np.allclose(P[i], vi, ) for vi in v]): ...
[ "def", "steadystate", "(", "A", ",", "max_iter", "=", "100", ")", ":", "P", "=", "np", ".", "linalg", ".", "matrix_power", "(", "A", ",", "max_iter", ")", "# Determine the unique rows in A", "v", "=", "[", "]", "for", "i", "in", "range", "(", "len", ...
Empirically determine the steady state probabilities from a stochastic matrix
[ "Empirically", "determine", "the", "steady", "state", "probabilities", "from", "a", "stochastic", "matrix" ]
c00f8a62d3005a171d424549a55d46c421859ae9
https://github.com/vmonaco/pohmm/blob/c00f8a62d3005a171d424549a55d46c421859ae9/pohmm/utils.py#L122-L134
train
Empirically determine the steady state probabilities from a stochastic matrix A
teepark/greenhouse
greenhouse/io/ipc.py
pipe
def pipe(): """create an inter-process communication pipe :returns: a pair of :class:`File` objects ``(read, write)`` for the two ends of the pipe """ r, w = os.pipe() return File.fromfd(r, 'rb'), File.fromfd(w, 'wb')
python
def pipe(): """create an inter-process communication pipe :returns: a pair of :class:`File` objects ``(read, write)`` for the two ends of the pipe """ r, w = os.pipe() return File.fromfd(r, 'rb'), File.fromfd(w, 'wb')
[ "def", "pipe", "(", ")", ":", "r", ",", "w", "=", "os", ".", "pipe", "(", ")", "return", "File", ".", "fromfd", "(", "r", ",", "'rb'", ")", ",", "File", ".", "fromfd", "(", "w", ",", "'wb'", ")" ]
create an inter-process communication pipe :returns: a pair of :class:`File` objects ``(read, write)`` for the two ends of the pipe
[ "create", "an", "inter", "-", "process", "communication", "pipe" ]
8fd1be4f5443ba090346b5ec82fdbeb0a060d956
https://github.com/teepark/greenhouse/blob/8fd1be4f5443ba090346b5ec82fdbeb0a060d956/greenhouse/io/ipc.py#L11-L19
train
create an inter - process communication pipe
cltl/KafNafParserPy
KafNafParserPy/span_data.py
Cspan.get_id_head
def get_id_head(self): ''' Returns the id of the target that is set as "head" @rtype: string @return: the target id (or None) of the head target ''' id_head = None for target_node in self: if target_node.is_head(): id_head = target_nod...
python
def get_id_head(self): ''' Returns the id of the target that is set as "head" @rtype: string @return: the target id (or None) of the head target ''' id_head = None for target_node in self: if target_node.is_head(): id_head = target_nod...
[ "def", "get_id_head", "(", "self", ")", ":", "id_head", "=", "None", "for", "target_node", "in", "self", ":", "if", "target_node", ".", "is_head", "(", ")", ":", "id_head", "=", "target_node", ".", "get_id", "(", ")", "break", "return", "id_head" ]
Returns the id of the target that is set as "head" @rtype: string @return: the target id (or None) of the head target
[ "Returns", "the", "id", "of", "the", "target", "that", "is", "set", "as", "head" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/span_data.py#L99-L110
train
Returns the id of the head target that is set as head target
cltl/KafNafParserPy
KafNafParserPy/span_data.py
Cspan.add_target_id
def add_target_id(self,this_id): """ Adds a new target to the span with the specified id @type this_id: string @param this_id: the id of the new target """ new_target = Ctarget() new_target.set_id(this_id) self.node.append(new_target.get_node())
python
def add_target_id(self,this_id): """ Adds a new target to the span with the specified id @type this_id: string @param this_id: the id of the new target """ new_target = Ctarget() new_target.set_id(this_id) self.node.append(new_target.get_node())
[ "def", "add_target_id", "(", "self", ",", "this_id", ")", ":", "new_target", "=", "Ctarget", "(", ")", "new_target", ".", "set_id", "(", "this_id", ")", "self", ".", "node", ".", "append", "(", "new_target", ".", "get_node", "(", ")", ")" ]
Adds a new target to the span with the specified id @type this_id: string @param this_id: the id of the new target
[ "Adds", "a", "new", "target", "to", "the", "span", "with", "the", "specified", "id" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/span_data.py#L112-L120
train
Adds a new target to the span with the specified id
cltl/KafNafParserPy
KafNafParserPy/span_data.py
Cspan.create_from_ids
def create_from_ids(self,list_ids): """ Adds new targets to the span with the specified ids @type list_ids: list @param list_ids: list of identifiers """ for this_id in list_ids: new_target = Ctarget() new_target.set_id(this_id) self.no...
python
def create_from_ids(self,list_ids): """ Adds new targets to the span with the specified ids @type list_ids: list @param list_ids: list of identifiers """ for this_id in list_ids: new_target = Ctarget() new_target.set_id(this_id) self.no...
[ "def", "create_from_ids", "(", "self", ",", "list_ids", ")", ":", "for", "this_id", "in", "list_ids", ":", "new_target", "=", "Ctarget", "(", ")", "new_target", ".", "set_id", "(", "this_id", ")", "self", ".", "node", ".", "append", "(", "new_target", "....
Adds new targets to the span with the specified ids @type list_ids: list @param list_ids: list of identifiers
[ "Adds", "new", "targets", "to", "the", "span", "with", "the", "specified", "ids" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/span_data.py#L122-L131
train
Adds new targets to the span with the specified ids
cltl/KafNafParserPy
KafNafParserPy/span_data.py
Cspan.create_from_targets
def create_from_targets(self,list_targs): """ Adds new targets to the span that are defined in a list @type list_targs: list @param list_targs: list of Ctargets """ for this_target in list_targs: self.node.append(this_target.get_node())
python
def create_from_targets(self,list_targs): """ Adds new targets to the span that are defined in a list @type list_targs: list @param list_targs: list of Ctargets """ for this_target in list_targs: self.node.append(this_target.get_node())
[ "def", "create_from_targets", "(", "self", ",", "list_targs", ")", ":", "for", "this_target", "in", "list_targs", ":", "self", ".", "node", ".", "append", "(", "this_target", ".", "get_node", "(", ")", ")" ]
Adds new targets to the span that are defined in a list @type list_targs: list @param list_targs: list of Ctargets
[ "Adds", "new", "targets", "to", "the", "span", "that", "are", "defined", "in", "a", "list" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/span_data.py#L133-L140
train
Adds new targets to the span that are defined in a list
cltl/KafNafParserPy
KafNafParserPy/attribution_data.py
Cattribution.get_statement
def get_statement(self, statement_id): """ Returns the statement object for the supplied identifier @type statement_id: string @param statement_id: statement identifier """ if statement_id in self.idx: return Cstatement(self.idx[statement_id], self.type) ...
python
def get_statement(self, statement_id): """ Returns the statement object for the supplied identifier @type statement_id: string @param statement_id: statement identifier """ if statement_id in self.idx: return Cstatement(self.idx[statement_id], self.type) ...
[ "def", "get_statement", "(", "self", ",", "statement_id", ")", ":", "if", "statement_id", "in", "self", ".", "idx", ":", "return", "Cstatement", "(", "self", ".", "idx", "[", "statement_id", "]", ",", "self", ".", "type", ")", "else", ":", "return", "N...
Returns the statement object for the supplied identifier @type statement_id: string @param statement_id: statement identifier
[ "Returns", "the", "statement", "object", "for", "the", "supplied", "identifier" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/attribution_data.py#L279-L288
train
Returns the statement object for the supplied identifier
cltl/KafNafParserPy
KafNafParserPy/attribution_data.py
Cattribution.add_statement
def add_statement(self, statement_obj): """ Adds a statement object to the layer @type statement_obj: L{Cstatement} @param statement_obj: the statement object """ if statement_obj.get_id() in self.idx: raise ValueError("Statement with id {} already exists!" ...
python
def add_statement(self, statement_obj): """ Adds a statement object to the layer @type statement_obj: L{Cstatement} @param statement_obj: the statement object """ if statement_obj.get_id() in self.idx: raise ValueError("Statement with id {} already exists!" ...
[ "def", "add_statement", "(", "self", ",", "statement_obj", ")", ":", "if", "statement_obj", ".", "get_id", "(", ")", "in", "self", ".", "idx", ":", "raise", "ValueError", "(", "\"Statement with id {} already exists!\"", ".", "format", "(", "statement_obj", ".", ...
Adds a statement object to the layer @type statement_obj: L{Cstatement} @param statement_obj: the statement object
[ "Adds", "a", "statement", "object", "to", "the", "layer" ]
9bc32e803c176404b255ba317479b8780ed5f569
https://github.com/cltl/KafNafParserPy/blob/9bc32e803c176404b255ba317479b8780ed5f569/KafNafParserPy/attribution_data.py#L290-L300
train
Adds a statement object to the layer.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/datacenter.py
Datacenter.Datacenters
def Datacenters(alias=None, session=None): """Return all cloud locations available to the calling alias. >>> clc.v2.Datacenter.Datacenters(alias=None) [<clc.APIv2.datacenter.Datacenter instance at 0x101462fc8>, <clc.APIv2.datacenter.Datacenter instance at 0x101464320>] """ if not alias: alias = clc.v2.Acco...
python
def Datacenters(alias=None, session=None): """Return all cloud locations available to the calling alias. >>> clc.v2.Datacenter.Datacenters(alias=None) [<clc.APIv2.datacenter.Datacenter instance at 0x101462fc8>, <clc.APIv2.datacenter.Datacenter instance at 0x101464320>] """ if not alias: alias = clc.v2.Acco...
[ "def", "Datacenters", "(", "alias", "=", "None", ",", "session", "=", "None", ")", ":", "if", "not", "alias", ":", "alias", "=", "clc", ".", "v2", ".", "Account", ".", "GetAlias", "(", "session", "=", "session", ")", "datacenters", "=", "[", "]", "...
Return all cloud locations available to the calling alias. >>> clc.v2.Datacenter.Datacenters(alias=None) [<clc.APIv2.datacenter.Datacenter instance at 0x101462fc8>, <clc.APIv2.datacenter.Datacenter instance at 0x101464320>]
[ "Return", "all", "cloud", "locations", "available", "to", "the", "calling", "alias", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/datacenter.py#L27-L40
train
Get all available datacenters for the calling account.
CenturyLinkCloud/clc-python-sdk
src/clc/APIv2/datacenter.py
Datacenter.RootGroup
def RootGroup(self): """Returns group object for datacenter root group. >>> clc.v2.Datacenter().RootGroup() <clc.APIv2.group.Group object at 0x105feacd0> >>> print _ WA1 Hardware """ return(clc.v2.Group(id=self.root_group_id,alias=self.alias,session=self.session))
python
def RootGroup(self): """Returns group object for datacenter root group. >>> clc.v2.Datacenter().RootGroup() <clc.APIv2.group.Group object at 0x105feacd0> >>> print _ WA1 Hardware """ return(clc.v2.Group(id=self.root_group_id,alias=self.alias,session=self.session))
[ "def", "RootGroup", "(", "self", ")", ":", "return", "(", "clc", ".", "v2", ".", "Group", "(", "id", "=", "self", ".", "root_group_id", ",", "alias", "=", "self", ".", "alias", ",", "session", "=", "self", ".", "session", ")", ")" ]
Returns group object for datacenter root group. >>> clc.v2.Datacenter().RootGroup() <clc.APIv2.group.Group object at 0x105feacd0> >>> print _ WA1 Hardware
[ "Returns", "group", "object", "for", "datacenter", "root", "group", "." ]
f4dba40c627cb08dd4b7d0d277e8d67578010b05
https://github.com/CenturyLinkCloud/clc-python-sdk/blob/f4dba40c627cb08dd4b7d0d277e8d67578010b05/src/clc/APIv2/datacenter.py#L81-L91
train
Returns root group object for datacenter root group.
blag/django-secure-mail
secure_mail/utils.py
addresses_for_key
def addresses_for_key(gpg, key): """ Takes a key and extracts the email addresses for it. """ return [address.split("<")[-1].strip(">") for address in gpg.list_keys().key_map[key['fingerprint']]["uids"] if address]
python
def addresses_for_key(gpg, key): """ Takes a key and extracts the email addresses for it. """ return [address.split("<")[-1].strip(">") for address in gpg.list_keys().key_map[key['fingerprint']]["uids"] if address]
[ "def", "addresses_for_key", "(", "gpg", ",", "key", ")", ":", "return", "[", "address", ".", "split", "(", "\"<\"", ")", "[", "-", "1", "]", ".", "strip", "(", "\">\"", ")", "for", "address", "in", "gpg", ".", "list_keys", "(", ")", ".", "key_map",...
Takes a key and extracts the email addresses for it.
[ "Takes", "a", "key", "and", "extracts", "the", "email", "addresses", "for", "it", "." ]
52987b6ce829e6de2dc8ab38ed3190bc2752b341
https://github.com/blag/django-secure-mail/blob/52987b6ce829e6de2dc8ab38ed3190bc2752b341/secure_mail/utils.py#L25-L31
train
Returns a list of email addresses for a given key.
pyfca/pyfca
pyfca/implications.py
L
def L(g,i): """recursively constructs L line for g; i = len(g)-1""" g1 = g&(2**i) if i: n = Lwidth(i) Ln = L(g,i-1) if g1: return Ln<<(2*n) | Ln<<n | Ln else: return int('1'*n,2)<<(2*n) | Ln<<n | Ln else: if g1: return...
python
def L(g,i): """recursively constructs L line for g; i = len(g)-1""" g1 = g&(2**i) if i: n = Lwidth(i) Ln = L(g,i-1) if g1: return Ln<<(2*n) | Ln<<n | Ln else: return int('1'*n,2)<<(2*n) | Ln<<n | Ln else: if g1: return...
[ "def", "L", "(", "g", ",", "i", ")", ":", "g1", "=", "g", "&", "(", "2", "**", "i", ")", "if", "i", ":", "n", "=", "Lwidth", "(", "i", ")", "Ln", "=", "L", "(", "g", ",", "i", "-", "1", ")", "if", "g1", ":", "return", "Ln", "<<", "(...
recursively constructs L line for g; i = len(g)-1
[ "recursively", "constructs", "L", "line", "for", "g", ";", "i", "=", "len", "(", "g", ")", "-", "1" ]
cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0
https://github.com/pyfca/pyfca/blob/cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0/pyfca/implications.py#L33-L47
train
recursively constructs L line for g
pyfca/pyfca
pyfca/implications.py
H
def H(g,i): """recursively constructs H line for g; i = len(g)-1""" g1 = g&(2**i) if i: n = Hwidth(i) i=i-1 Hn = H(g,i) if g1: return Hn<<(2*n) | Hn<<n | Hn else: return int('1'*n,2)<<(2*n) | L(g,i)<<n | Hn else: if g1...
python
def H(g,i): """recursively constructs H line for g; i = len(g)-1""" g1 = g&(2**i) if i: n = Hwidth(i) i=i-1 Hn = H(g,i) if g1: return Hn<<(2*n) | Hn<<n | Hn else: return int('1'*n,2)<<(2*n) | L(g,i)<<n | Hn else: if g1...
[ "def", "H", "(", "g", ",", "i", ")", ":", "g1", "=", "g", "&", "(", "2", "**", "i", ")", "if", "i", ":", "n", "=", "Hwidth", "(", "i", ")", "i", "=", "i", "-", "1", "Hn", "=", "H", "(", "g", ",", "i", ")", "if", "g1", ":", "return",...
recursively constructs H line for g; i = len(g)-1
[ "recursively", "constructs", "H", "line", "for", "g", ";", "i", "=", "len", "(", "g", ")", "-", "1" ]
cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0
https://github.com/pyfca/pyfca/blob/cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0/pyfca/implications.py#L48-L63
train
recursively constructs H line for g ; i = 0
pyfca/pyfca
pyfca/implications.py
UV_H
def UV_H(Hg,gw): """ Constructs implications and intents based on H gw = g width Hg = H(g), g is the binary coding of the attribute set UV = all non-trivial (!V⊂U) implications U->V with UuV closed; in ternary coding (1=V,2=U) K = all closed sets """ lefts = set() K = [] UV = [] ...
python
def UV_H(Hg,gw): """ Constructs implications and intents based on H gw = g width Hg = H(g), g is the binary coding of the attribute set UV = all non-trivial (!V⊂U) implications U->V with UuV closed; in ternary coding (1=V,2=U) K = all closed sets """ lefts = set() K = [] UV = [] ...
[ "def", "UV_H", "(", "Hg", ",", "gw", ")", ":", "lefts", "=", "set", "(", ")", "K", "=", "[", "]", "UV", "=", "[", "]", "p", "=", "Hwidth", "(", "gw", ")", "pp", "=", "2", "**", "p", "while", "p", ":", "pp", "=", "pp", ">>", "1", "p", ...
Constructs implications and intents based on H gw = g width Hg = H(g), g is the binary coding of the attribute set UV = all non-trivial (!V⊂U) implications U->V with UuV closed; in ternary coding (1=V,2=U) K = all closed sets
[ "Constructs", "implications", "and", "intents", "based", "on", "H", "gw", "=", "g", "width", "Hg", "=", "H", "(", "g", ")", "g", "is", "the", "binary", "coding", "of", "the", "attribute", "set", "UV", "=", "all", "non", "-", "trivial", "(", "!V⊂U", ...
cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0
https://github.com/pyfca/pyfca/blob/cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0/pyfca/implications.py#L65-L90
train
Constructs implications and intents based on Hg and gw.
pyfca/pyfca
pyfca/implications.py
A
def A(g,i): """recursively constructs A line for g; i = len(g)-1""" g1 = g&(2**i) if i: n = Awidth(i) An = A(g,i-1) if g1: return An<<n | An else: return int('1'*n,2)<<n | An else: if g1: return int('00',2) else: ...
python
def A(g,i): """recursively constructs A line for g; i = len(g)-1""" g1 = g&(2**i) if i: n = Awidth(i) An = A(g,i-1) if g1: return An<<n | An else: return int('1'*n,2)<<n | An else: if g1: return int('00',2) else: ...
[ "def", "A", "(", "g", ",", "i", ")", ":", "g1", "=", "g", "&", "(", "2", "**", "i", ")", "if", "i", ":", "n", "=", "Awidth", "(", "i", ")", "An", "=", "A", "(", "g", ",", "i", "-", "1", ")", "if", "g1", ":", "return", "An", "<<", "n...
recursively constructs A line for g; i = len(g)-1
[ "recursively", "constructs", "A", "line", "for", "g", ";", "i", "=", "len", "(", "g", ")", "-", "1" ]
cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0
https://github.com/pyfca/pyfca/blob/cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0/pyfca/implications.py#L93-L107
train
recursively constructs A line for g ; i = 0
pyfca/pyfca
pyfca/implications.py
B
def B(g,i): """recursively constructs B line for g; i = len(g)-1""" g1 = g&(2**i) if i: nA = Awidth(i) nB = Bwidth(i) i=i-1 Bn = B(g,i) if g1: return Bn << (nA+nB) | int('1'*nA,2) << nB | Bn else: return int('1'*nB,2) << (nA+...
python
def B(g,i): """recursively constructs B line for g; i = len(g)-1""" g1 = g&(2**i) if i: nA = Awidth(i) nB = Bwidth(i) i=i-1 Bn = B(g,i) if g1: return Bn << (nA+nB) | int('1'*nA,2) << nB | Bn else: return int('1'*nB,2) << (nA+...
[ "def", "B", "(", "g", ",", "i", ")", ":", "g1", "=", "g", "&", "(", "2", "**", "i", ")", "if", "i", ":", "nA", "=", "Awidth", "(", "i", ")", "nB", "=", "Bwidth", "(", "i", ")", "i", "=", "i", "-", "1", "Bn", "=", "B", "(", "g", ",",...
recursively constructs B line for g; i = len(g)-1
[ "recursively", "constructs", "B", "line", "for", "g", ";", "i", "=", "len", "(", "g", ")", "-", "1" ]
cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0
https://github.com/pyfca/pyfca/blob/cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0/pyfca/implications.py#L109-L125
train
recursively constructs B line for g ; i = 0
pyfca/pyfca
pyfca/implications.py
B012
def B012(t,i): """ Constructs ternary implication coding (0=not there, 2=U, 1=V) t is B column position i = |M|-1 to 0 """ if not i: return "1" nA = Awidth(i) nB = Bwidth(i) nBB = nB + nA if t < nB: return "0"+B012(t,i-1) elif t < nBB: return "1"+A012(...
python
def B012(t,i): """ Constructs ternary implication coding (0=not there, 2=U, 1=V) t is B column position i = |M|-1 to 0 """ if not i: return "1" nA = Awidth(i) nB = Bwidth(i) nBB = nB + nA if t < nB: return "0"+B012(t,i-1) elif t < nBB: return "1"+A012(...
[ "def", "B012", "(", "t", ",", "i", ")", ":", "if", "not", "i", ":", "return", "\"1\"", "nA", "=", "Awidth", "(", "i", ")", "nB", "=", "Bwidth", "(", "i", ")", "nBB", "=", "nB", "+", "nA", "if", "t", "<", "nB", ":", "return", "\"0\"", "+", ...
Constructs ternary implication coding (0=not there, 2=U, 1=V) t is B column position i = |M|-1 to 0
[ "Constructs", "ternary", "implication", "coding", "(", "0", "=", "not", "there", "2", "=", "U", "1", "=", "V", ")", "t", "is", "B", "column", "position", "i", "=", "|M|", "-", "1", "to", "0" ]
cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0
https://github.com/pyfca/pyfca/blob/cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0/pyfca/implications.py#L135-L151
train
Constructs ternary implication coding for a single A - column tree.
pyfca/pyfca
pyfca/implications.py
UV_B
def UV_B(Bg,gw): """ returns the implications UV based on B Bg = B(g), g∈2^M gw = |M|, M is the set of all attributes """ UV = [] p = Bwidth(gw) pp = 2**p while p: pp = pp>>1 p = p-1 if Bg&pp: uv = B012(p,gw-1) UV.append(uv) return ...
python
def UV_B(Bg,gw): """ returns the implications UV based on B Bg = B(g), g∈2^M gw = |M|, M is the set of all attributes """ UV = [] p = Bwidth(gw) pp = 2**p while p: pp = pp>>1 p = p-1 if Bg&pp: uv = B012(p,gw-1) UV.append(uv) return ...
[ "def", "UV_B", "(", "Bg", ",", "gw", ")", ":", "UV", "=", "[", "]", "p", "=", "Bwidth", "(", "gw", ")", "pp", "=", "2", "**", "p", "while", "p", ":", "pp", "=", "pp", ">>", "1", "p", "=", "p", "-", "1", "if", "Bg", "&", "pp", ":", "uv...
returns the implications UV based on B Bg = B(g), g∈2^M gw = |M|, M is the set of all attributes
[ "returns", "the", "implications", "UV", "based", "on", "B", "Bg", "=", "B", "(", "g", ")", "g∈2^M", "gw", "=", "|M|", "M", "is", "the", "set", "of", "all", "attributes" ]
cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0
https://github.com/pyfca/pyfca/blob/cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0/pyfca/implications.py#L153-L168
train
returns the implications UV based on Bg and gw
pyfca/pyfca
pyfca/implications.py
omega
def omega(imps): """ Calculates a measure for the size of the implication basis: \sum |U||V| """ if isinstance(imps,v_Us_dict): return sum([omega(V) for U,V in imps.items()])#|V|=1 if isinstance(imps,list): return sum([omega(x) for x in imps]) if isinstance(imps,str): #im...
python
def omega(imps): """ Calculates a measure for the size of the implication basis: \sum |U||V| """ if isinstance(imps,v_Us_dict): return sum([omega(V) for U,V in imps.items()])#|V|=1 if isinstance(imps,list): return sum([omega(x) for x in imps]) if isinstance(imps,str): #im...
[ "def", "omega", "(", "imps", ")", ":", "if", "isinstance", "(", "imps", ",", "v_Us_dict", ")", ":", "return", "sum", "(", "[", "omega", "(", "V", ")", "for", "U", ",", "V", "in", "imps", ".", "items", "(", ")", "]", ")", "#|V|=1", "if", "isinst...
Calculates a measure for the size of the implication basis: \sum |U||V|
[ "Calculates", "a", "measure", "for", "the", "size", "of", "the", "implication", "basis", ":", "\\", "sum", "|U||V|" ]
cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0
https://github.com/pyfca/pyfca/blob/cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0/pyfca/implications.py#L170-L191
train
Calculates the size of the implication basis for the size of the implication basis.
pyfca/pyfca
pyfca/implications.py
respects
def respects(g,imp): """ g is an int, where each bit is an attribute implication UV is ternary coded 1 = ∈V, 2 = ∈U, 0 otherwise g and UV have the same number of digits """ if isinstance(g,str): g = int(g,2) if isinstance(imp,int): imp = istr(imp,3,g.bit_length()) V = int...
python
def respects(g,imp): """ g is an int, where each bit is an attribute implication UV is ternary coded 1 = ∈V, 2 = ∈U, 0 otherwise g and UV have the same number of digits """ if isinstance(g,str): g = int(g,2) if isinstance(imp,int): imp = istr(imp,3,g.bit_length()) V = int...
[ "def", "respects", "(", "g", ",", "imp", ")", ":", "if", "isinstance", "(", "g", ",", "str", ")", ":", "g", "=", "int", "(", "g", ",", "2", ")", "if", "isinstance", "(", "imp", ",", "int", ")", ":", "imp", "=", "istr", "(", "imp", ",", "3",...
g is an int, where each bit is an attribute implication UV is ternary coded 1 = ∈V, 2 = ∈U, 0 otherwise g and UV have the same number of digits
[ "g", "is", "an", "int", "where", "each", "bit", "is", "an", "attribute", "implication", "UV", "is", "ternary", "coded", "1", "=", "∈V", "2", "=", "∈U", "0", "otherwise", "g", "and", "UV", "have", "the", "same", "number", "of", "digits" ]
cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0
https://github.com/pyfca/pyfca/blob/cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0/pyfca/implications.py#L387-L401
train
Returns True if g and imp are equal.
pyfca/pyfca
pyfca/implications.py
LL
def LL(n): """constructs the LL context""" if (n<=0):return Context('0') else: LL1=LL(n-1) r1 = C1(3**(n-1),2**(n-1)) - LL1 - LL1 r2 = LL1 - LL1 - LL1 return r1 + r2
python
def LL(n): """constructs the LL context""" if (n<=0):return Context('0') else: LL1=LL(n-1) r1 = C1(3**(n-1),2**(n-1)) - LL1 - LL1 r2 = LL1 - LL1 - LL1 return r1 + r2
[ "def", "LL", "(", "n", ")", ":", "if", "(", "n", "<=", "0", ")", ":", "return", "Context", "(", "'0'", ")", "else", ":", "LL1", "=", "LL", "(", "n", "-", "1", ")", "r1", "=", "C1", "(", "3", "**", "(", "n", "-", "1", ")", ",", "2", "*...
constructs the LL context
[ "constructs", "the", "LL", "context" ]
cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0
https://github.com/pyfca/pyfca/blob/cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0/pyfca/implications.py#L532-L539
train
constructs the LL context
pyfca/pyfca
pyfca/implications.py
HH
def HH(n): """constructs the HH context""" if (n<=0):return Context('1') else: LL1=LL(n-1) HH1=HH(n-1) r1 = C1(3**(n-1),2**(n-1)) - LL1 - HH1 r2 = HH1 - HH1 - HH1 return r1 + r2
python
def HH(n): """constructs the HH context""" if (n<=0):return Context('1') else: LL1=LL(n-1) HH1=HH(n-1) r1 = C1(3**(n-1),2**(n-1)) - LL1 - HH1 r2 = HH1 - HH1 - HH1 return r1 + r2
[ "def", "HH", "(", "n", ")", ":", "if", "(", "n", "<=", "0", ")", ":", "return", "Context", "(", "'1'", ")", "else", ":", "LL1", "=", "LL", "(", "n", "-", "1", ")", "HH1", "=", "HH", "(", "n", "-", "1", ")", "r1", "=", "C1", "(", "3", ...
constructs the HH context
[ "constructs", "the", "HH", "context" ]
cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0
https://github.com/pyfca/pyfca/blob/cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0/pyfca/implications.py#L540-L548
train
constructs the HH context
pyfca/pyfca
pyfca/implications.py
AA
def AA(n): """constructs the AA context""" if (n<=1):return Context('10\n00') else: AA1=AA(n-1) r1 = C1(2**(n-1),2**(n-1)) - AA1 r2 = AA1 - AA1 return r1 + r2
python
def AA(n): """constructs the AA context""" if (n<=1):return Context('10\n00') else: AA1=AA(n-1) r1 = C1(2**(n-1),2**(n-1)) - AA1 r2 = AA1 - AA1 return r1 + r2
[ "def", "AA", "(", "n", ")", ":", "if", "(", "n", "<=", "1", ")", ":", "return", "Context", "(", "'10\\n00'", ")", "else", ":", "AA1", "=", "AA", "(", "n", "-", "1", ")", "r1", "=", "C1", "(", "2", "**", "(", "n", "-", "1", ")", ",", "2"...
constructs the AA context
[ "constructs", "the", "AA", "context" ]
cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0
https://github.com/pyfca/pyfca/blob/cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0/pyfca/implications.py#L550-L557
train
constructs the AA context
pyfca/pyfca
pyfca/implications.py
BB
def BB(n): """constructs the BB context""" if (n<=1):return Context('0\n1') else: BB1=BB(n-1) AA1=AA(n-1) r1 = C1((n-1)*2**(n-2),2**(n-1)) - AA1 - BB1 r2 = BB1 - C1(2**(n-1),2**(n-1)) - BB1; return r1 + r2
python
def BB(n): """constructs the BB context""" if (n<=1):return Context('0\n1') else: BB1=BB(n-1) AA1=AA(n-1) r1 = C1((n-1)*2**(n-2),2**(n-1)) - AA1 - BB1 r2 = BB1 - C1(2**(n-1),2**(n-1)) - BB1; return r1 + r2
[ "def", "BB", "(", "n", ")", ":", "if", "(", "n", "<=", "1", ")", ":", "return", "Context", "(", "'0\\n1'", ")", "else", ":", "BB1", "=", "BB", "(", "n", "-", "1", ")", "AA1", "=", "AA", "(", "n", "-", "1", ")", "r1", "=", "C1", "(", "("...
constructs the BB context
[ "constructs", "the", "BB", "context" ]
cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0
https://github.com/pyfca/pyfca/blob/cf8cea9e76076dbf4bb3f38996dcb5491b0eb0b0/pyfca/implications.py#L558-L566
train
constructs the BB context