id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
246,700
mattimck/python-exist
exist/exist.py
Exist.arquire_attributes
def arquire_attributes(self, attributes, active=True): """ Claims a list of attributes for the current client. Can also disable attributes. Returns update response object. """ attribute_update = self._post_object(self.update_api.attributes.acquire, attributes) return Exis...
python
def arquire_attributes(self, attributes, active=True): """ Claims a list of attributes for the current client. Can also disable attributes. Returns update response object. """ attribute_update = self._post_object(self.update_api.attributes.acquire, attributes) return Exis...
[ "def", "arquire_attributes", "(", "self", ",", "attributes", ",", "active", "=", "True", ")", ":", "attribute_update", "=", "self", ".", "_post_object", "(", "self", ".", "update_api", ".", "attributes", ".", "acquire", ",", "attributes", ")", "return", "Exi...
Claims a list of attributes for the current client. Can also disable attributes. Returns update response object.
[ "Claims", "a", "list", "of", "attributes", "for", "the", "current", "client", ".", "Can", "also", "disable", "attributes", ".", "Returns", "update", "response", "object", "." ]
2c4be9d176d8e8007c4e020ee7cd6263a2096abb
https://github.com/mattimck/python-exist/blob/2c4be9d176d8e8007c4e020ee7cd6263a2096abb/exist/exist.py#L72-L78
246,701
mattimck/python-exist
exist/exist.py
Exist.owned_attributes
def owned_attributes(self): """ Returns a list of attributes owned by this service. """ attributes = self._get_object(self.update_api.attributes.owned) return [ExistOwnedAttributeResponse(attribute) for attribute in attributes]
python
def owned_attributes(self): """ Returns a list of attributes owned by this service. """ attributes = self._get_object(self.update_api.attributes.owned) return [ExistOwnedAttributeResponse(attribute) for attribute in attributes]
[ "def", "owned_attributes", "(", "self", ")", ":", "attributes", "=", "self", ".", "_get_object", "(", "self", ".", "update_api", ".", "attributes", ".", "owned", ")", "return", "[", "ExistOwnedAttributeResponse", "(", "attribute", ")", "for", "attribute", "in"...
Returns a list of attributes owned by this service.
[ "Returns", "a", "list", "of", "attributes", "owned", "by", "this", "service", "." ]
2c4be9d176d8e8007c4e020ee7cd6263a2096abb
https://github.com/mattimck/python-exist/blob/2c4be9d176d8e8007c4e020ee7cd6263a2096abb/exist/exist.py#L87-L92
246,702
frejanordsiek/GeminiMotorDrive
GeminiMotorDrive/compilers/move_sequence.py
compile_sequence
def compile_sequence(cycles, program_or_profile='program', unit_converter=None): """ Makes the command list for a move sequence. Constructs the list of commands to execute the given sequence of motion. Program/command line commands or profile commands can be generated depending on ...
python
def compile_sequence(cycles, program_or_profile='program', unit_converter=None): """ Makes the command list for a move sequence. Constructs the list of commands to execute the given sequence of motion. Program/command line commands or profile commands can be generated depending on ...
[ "def", "compile_sequence", "(", "cycles", ",", "program_or_profile", "=", "'program'", ",", "unit_converter", "=", "None", ")", ":", "# If needed, cycles needs to be converted to motor units.", "if", "unit_converter", "is", "None", ":", "cv_cycles", "=", "cycles", "else...
Makes the command list for a move sequence. Constructs the list of commands to execute the given sequence of motion. Program/command line commands or profile commands can be generated depending on the value of `program_or_profile` so that the commands can be used to construct a program or profile later...
[ "Makes", "the", "command", "list", "for", "a", "move", "sequence", "." ]
8de347ffb91228fbfe3832098b4996fa0141d8f1
https://github.com/frejanordsiek/GeminiMotorDrive/blob/8de347ffb91228fbfe3832098b4996fa0141d8f1/GeminiMotorDrive/compilers/move_sequence.py#L28-L265
246,703
frejanordsiek/GeminiMotorDrive
GeminiMotorDrive/compilers/move_sequence.py
get_sequence_time
def get_sequence_time(cycles, unit_converter=None, eres=None): """ Calculates the time the move sequence will take to complete. Calculates the amount of time it will take to complete the given move sequence. Types of motion supported are moves from one position to another (the motion will always come t...
python
def get_sequence_time(cycles, unit_converter=None, eres=None): """ Calculates the time the move sequence will take to complete. Calculates the amount of time it will take to complete the given move sequence. Types of motion supported are moves from one position to another (the motion will always come t...
[ "def", "get_sequence_time", "(", "cycles", ",", "unit_converter", "=", "None", ",", "eres", "=", "None", ")", ":", "# If we are doing unit conversion, then that is equivalent to motor", "# units but with eres equal to one.", "if", "unit_converter", "is", "not", "None", ":",...
Calculates the time the move sequence will take to complete. Calculates the amount of time it will take to complete the given move sequence. Types of motion supported are moves from one position to another (the motion will always come to a stop before doing the next motion), waiting a given interval of...
[ "Calculates", "the", "time", "the", "move", "sequence", "will", "take", "to", "complete", "." ]
8de347ffb91228fbfe3832098b4996fa0141d8f1
https://github.com/frejanordsiek/GeminiMotorDrive/blob/8de347ffb91228fbfe3832098b4996fa0141d8f1/GeminiMotorDrive/compilers/move_sequence.py#L268-L318
246,704
frejanordsiek/GeminiMotorDrive
GeminiMotorDrive/compilers/move_sequence.py
move_time
def move_time(move, eres): """ Calculates the time it takes to do a move. Calculates how long it will take to complete a move of the motor. It is assumed that the motor will decerate to a stop for the end of the move as opposed to keep moving at velocity. Everything is in motor units which are enc...
python
def move_time(move, eres): """ Calculates the time it takes to do a move. Calculates how long it will take to complete a move of the motor. It is assumed that the motor will decerate to a stop for the end of the move as opposed to keep moving at velocity. Everything is in motor units which are enc...
[ "def", "move_time", "(", "move", ",", "eres", ")", ":", "# Grab the move parameters. If the deceleration is given as zero,", "# that means it has the same value as the acceleration. Distance is", "# converted to the same units as the others by dividing by the", "# encoder resolution. The absol...
Calculates the time it takes to do a move. Calculates how long it will take to complete a move of the motor. It is assumed that the motor will decerate to a stop for the end of the move as opposed to keep moving at velocity. Everything is in motor units which are encoder counts for distance, pitch...
[ "Calculates", "the", "time", "it", "takes", "to", "do", "a", "move", "." ]
8de347ffb91228fbfe3832098b4996fa0141d8f1
https://github.com/frejanordsiek/GeminiMotorDrive/blob/8de347ffb91228fbfe3832098b4996fa0141d8f1/GeminiMotorDrive/compilers/move_sequence.py#L321-L397
246,705
frejanordsiek/GeminiMotorDrive
GeminiMotorDrive/compilers/move_sequence.py
convert_sequence_to_motor_units
def convert_sequence_to_motor_units(cycles, unit_converter): """ Converts a move sequence to motor units. Converts a move sequence to motor units using the provied converter. Parameters ---------- cycles : iterable of dicts The iterable of cycles of motion to do one after another. See ...
python
def convert_sequence_to_motor_units(cycles, unit_converter): """ Converts a move sequence to motor units. Converts a move sequence to motor units using the provied converter. Parameters ---------- cycles : iterable of dicts The iterable of cycles of motion to do one after another. See ...
[ "def", "convert_sequence_to_motor_units", "(", "cycles", ",", "unit_converter", ")", ":", "# Make a deep copy of cycles so that the conversions don't damage", "# the original one.", "cv_cycles", "=", "copy", ".", "deepcopy", "(", "cycles", ")", "# Go through each cycle and do the...
Converts a move sequence to motor units. Converts a move sequence to motor units using the provied converter. Parameters ---------- cycles : iterable of dicts The iterable of cycles of motion to do one after another. See ``compile_sequence`` for format. unit_converter : UnitConvert...
[ "Converts", "a", "move", "sequence", "to", "motor", "units", "." ]
8de347ffb91228fbfe3832098b4996fa0141d8f1
https://github.com/frejanordsiek/GeminiMotorDrive/blob/8de347ffb91228fbfe3832098b4996fa0141d8f1/GeminiMotorDrive/compilers/move_sequence.py#L399-L442
246,706
Sean1708/HipPy
hippy/compiler.py
Compiler.compile
def compile(self): """Return Hip string if already compiled else compile it.""" if self.buffer is None: self.buffer = self._compile_value(self.data, 0) return self.buffer.strip()
python
def compile(self): """Return Hip string if already compiled else compile it.""" if self.buffer is None: self.buffer = self._compile_value(self.data, 0) return self.buffer.strip()
[ "def", "compile", "(", "self", ")", ":", "if", "self", ".", "buffer", "is", "None", ":", "self", ".", "buffer", "=", "self", ".", "_compile_value", "(", "self", ".", "data", ",", "0", ")", "return", "self", ".", "buffer", ".", "strip", "(", ")" ]
Return Hip string if already compiled else compile it.
[ "Return", "Hip", "string", "if", "already", "compiled", "else", "compile", "it", "." ]
d0ea8fb1e417f1fedaa8e215e3d420b90c4de691
https://github.com/Sean1708/HipPy/blob/d0ea8fb1e417f1fedaa8e215e3d420b90c4de691/hippy/compiler.py#L15-L20
246,707
Sean1708/HipPy
hippy/compiler.py
Compiler._compile_value
def _compile_value(self, data, indent_level): """Dispatch to correct compilation method.""" if isinstance(data, dict): return self._compile_key_val(data, indent_level) elif isinstance(data, list): return self._compile_list(data, indent_level) else: ret...
python
def _compile_value(self, data, indent_level): """Dispatch to correct compilation method.""" if isinstance(data, dict): return self._compile_key_val(data, indent_level) elif isinstance(data, list): return self._compile_list(data, indent_level) else: ret...
[ "def", "_compile_value", "(", "self", ",", "data", ",", "indent_level", ")", ":", "if", "isinstance", "(", "data", ",", "dict", ")", ":", "return", "self", ".", "_compile_key_val", "(", "data", ",", "indent_level", ")", "elif", "isinstance", "(", "data", ...
Dispatch to correct compilation method.
[ "Dispatch", "to", "correct", "compilation", "method", "." ]
d0ea8fb1e417f1fedaa8e215e3d420b90c4de691
https://github.com/Sean1708/HipPy/blob/d0ea8fb1e417f1fedaa8e215e3d420b90c4de691/hippy/compiler.py#L22-L29
246,708
Sean1708/HipPy
hippy/compiler.py
Compiler._compile_literal
def _compile_literal(self, data): """Write correct representation of literal.""" if data is None: return 'nil' elif data is True: return 'yes' elif data is False: return 'no' else: return repr(data)
python
def _compile_literal(self, data): """Write correct representation of literal.""" if data is None: return 'nil' elif data is True: return 'yes' elif data is False: return 'no' else: return repr(data)
[ "def", "_compile_literal", "(", "self", ",", "data", ")", ":", "if", "data", "is", "None", ":", "return", "'nil'", "elif", "data", "is", "True", ":", "return", "'yes'", "elif", "data", "is", "False", ":", "return", "'no'", "else", ":", "return", "repr"...
Write correct representation of literal.
[ "Write", "correct", "representation", "of", "literal", "." ]
d0ea8fb1e417f1fedaa8e215e3d420b90c4de691
https://github.com/Sean1708/HipPy/blob/d0ea8fb1e417f1fedaa8e215e3d420b90c4de691/hippy/compiler.py#L31-L40
246,709
Sean1708/HipPy
hippy/compiler.py
Compiler._compile_list
def _compile_list(self, data, indent_level): """Correctly write possibly nested list.""" if len(data) == 0: return '--' elif not any(isinstance(i, (dict, list)) for i in data): return ', '.join(self._compile_literal(value) for value in data) else: # 'e...
python
def _compile_list(self, data, indent_level): """Correctly write possibly nested list.""" if len(data) == 0: return '--' elif not any(isinstance(i, (dict, list)) for i in data): return ', '.join(self._compile_literal(value) for value in data) else: # 'e...
[ "def", "_compile_list", "(", "self", ",", "data", ",", "indent_level", ")", ":", "if", "len", "(", "data", ")", "==", "0", ":", "return", "'--'", "elif", "not", "any", "(", "isinstance", "(", "i", ",", "(", "dict", ",", "list", ")", ")", "for", "...
Correctly write possibly nested list.
[ "Correctly", "write", "possibly", "nested", "list", "." ]
d0ea8fb1e417f1fedaa8e215e3d420b90c4de691
https://github.com/Sean1708/HipPy/blob/d0ea8fb1e417f1fedaa8e215e3d420b90c4de691/hippy/compiler.py#L42-L80
246,710
Sean1708/HipPy
hippy/compiler.py
Compiler._compile_key_val
def _compile_key_val(self, data, indent_level): """Compile a dictionary.""" buffer = '' for (key, val) in data.items(): buffer += self._indent * indent_level # TODO: assumes key is a string buffer += key + ':' if isinstance(val, dict): ...
python
def _compile_key_val(self, data, indent_level): """Compile a dictionary.""" buffer = '' for (key, val) in data.items(): buffer += self._indent * indent_level # TODO: assumes key is a string buffer += key + ':' if isinstance(val, dict): ...
[ "def", "_compile_key_val", "(", "self", ",", "data", ",", "indent_level", ")", ":", "buffer", "=", "''", "for", "(", "key", ",", "val", ")", "in", "data", ".", "items", "(", ")", ":", "buffer", "+=", "self", ".", "_indent", "*", "indent_level", "# TO...
Compile a dictionary.
[ "Compile", "a", "dictionary", "." ]
d0ea8fb1e417f1fedaa8e215e3d420b90c4de691
https://github.com/Sean1708/HipPy/blob/d0ea8fb1e417f1fedaa8e215e3d420b90c4de691/hippy/compiler.py#L82-L103
246,711
boronine/discipline
disciplinesite/tools.py
word
def word(cap=False): """ This function generates a fake word by creating between two and three random syllables and then joining them together. """ syllables = [] for x in range(random.randint(2,3)): syllables.append(_syllable()) word = "".join(syllables) if cap: word = word[0].u...
python
def word(cap=False): """ This function generates a fake word by creating between two and three random syllables and then joining them together. """ syllables = [] for x in range(random.randint(2,3)): syllables.append(_syllable()) word = "".join(syllables) if cap: word = word[0].u...
[ "def", "word", "(", "cap", "=", "False", ")", ":", "syllables", "=", "[", "]", "for", "x", "in", "range", "(", "random", ".", "randint", "(", "2", ",", "3", ")", ")", ":", "syllables", ".", "append", "(", "_syllable", "(", ")", ")", "word", "="...
This function generates a fake word by creating between two and three random syllables and then joining them together.
[ "This", "function", "generates", "a", "fake", "word", "by", "creating", "between", "two", "and", "three", "random", "syllables", "and", "then", "joining", "them", "together", "." ]
68bea9bc2198cc91cee49a6e2d0f3333cc9bf476
https://github.com/boronine/discipline/blob/68bea9bc2198cc91cee49a6e2d0f3333cc9bf476/disciplinesite/tools.py#L23-L32
246,712
treycucco/bidon
bidon/db/access/data_access.py
transaction
def transaction(data_access): """Wrap statements in a transaction. If the statements succeed, commit, otherwise rollback. :param data_access: a DataAccess instance """ old_autocommit = data_access.autocommit data_access.autocommit = False try: yield data_access except RollbackTransaction as ex: d...
python
def transaction(data_access): """Wrap statements in a transaction. If the statements succeed, commit, otherwise rollback. :param data_access: a DataAccess instance """ old_autocommit = data_access.autocommit data_access.autocommit = False try: yield data_access except RollbackTransaction as ex: d...
[ "def", "transaction", "(", "data_access", ")", ":", "old_autocommit", "=", "data_access", ".", "autocommit", "data_access", ".", "autocommit", "=", "False", "try", ":", "yield", "data_access", "except", "RollbackTransaction", "as", "ex", ":", "data_access", ".", ...
Wrap statements in a transaction. If the statements succeed, commit, otherwise rollback. :param data_access: a DataAccess instance
[ "Wrap", "statements", "in", "a", "transaction", ".", "If", "the", "statements", "succeed", "commit", "otherwise", "rollback", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/data_access.py#L425-L442
246,713
treycucco/bidon
bidon/db/access/data_access.py
autocommit
def autocommit(data_access): """Make statements autocommit. :param data_access: a DataAccess instance """ if not data_access.autocommit: data_access.commit() old_autocommit = data_access.autocommit data_access.autocommit = True try: yield data_access finally: data_access.autocommit = old_au...
python
def autocommit(data_access): """Make statements autocommit. :param data_access: a DataAccess instance """ if not data_access.autocommit: data_access.commit() old_autocommit = data_access.autocommit data_access.autocommit = True try: yield data_access finally: data_access.autocommit = old_au...
[ "def", "autocommit", "(", "data_access", ")", ":", "if", "not", "data_access", ".", "autocommit", ":", "data_access", ".", "commit", "(", ")", "old_autocommit", "=", "data_access", ".", "autocommit", "data_access", ".", "autocommit", "=", "True", "try", ":", ...
Make statements autocommit. :param data_access: a DataAccess instance
[ "Make", "statements", "autocommit", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/data_access.py#L446-L458
246,714
treycucco/bidon
bidon/db/access/data_access.py
DataAccess.autocommit
def autocommit(self, value): """Set the autocommit value. :param value: the new autocommit value """ logger.debug("Setting autocommit from %s to %s", self.autocommit, value) self.core.set_autocommit(self.connection, value)
python
def autocommit(self, value): """Set the autocommit value. :param value: the new autocommit value """ logger.debug("Setting autocommit from %s to %s", self.autocommit, value) self.core.set_autocommit(self.connection, value)
[ "def", "autocommit", "(", "self", ",", "value", ")", ":", "logger", ".", "debug", "(", "\"Setting autocommit from %s to %s\"", ",", "self", ".", "autocommit", ",", "value", ")", "self", ".", "core", ".", "set_autocommit", "(", "self", ".", "connection", ",",...
Set the autocommit value. :param value: the new autocommit value
[ "Set", "the", "autocommit", "value", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/data_access.py#L79-L85
246,715
treycucco/bidon
bidon/db/access/data_access.py
DataAccess._configure_connection
def _configure_connection(self, name, value): """Sets a Postgres run-time connection configuration parameter. :param name: the name of the parameter :param value: a list of values matching the placeholders """ self.update("pg_settings", dict(setting=value), dict(name=name))
python
def _configure_connection(self, name, value): """Sets a Postgres run-time connection configuration parameter. :param name: the name of the parameter :param value: a list of values matching the placeholders """ self.update("pg_settings", dict(setting=value), dict(name=name))
[ "def", "_configure_connection", "(", "self", ",", "name", ",", "value", ")", ":", "self", ".", "update", "(", "\"pg_settings\"", ",", "dict", "(", "setting", "=", "value", ")", ",", "dict", "(", "name", "=", "name", ")", ")" ]
Sets a Postgres run-time connection configuration parameter. :param name: the name of the parameter :param value: a list of values matching the placeholders
[ "Sets", "a", "Postgres", "run", "-", "time", "connection", "configuration", "parameter", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/data_access.py#L87-L93
246,716
treycucco/bidon
bidon/db/access/data_access.py
DataAccess.open
def open(self, *, autocommit=False): """Sets the connection with the core's open method. :param autocommit: the default autocommit state :type autocommit: boolean :return: self """ if self.connection is not None: raise Exception("Connection already set") self.connection = self.core.op...
python
def open(self, *, autocommit=False): """Sets the connection with the core's open method. :param autocommit: the default autocommit state :type autocommit: boolean :return: self """ if self.connection is not None: raise Exception("Connection already set") self.connection = self.core.op...
[ "def", "open", "(", "self", ",", "*", ",", "autocommit", "=", "False", ")", ":", "if", "self", ".", "connection", "is", "not", "None", ":", "raise", "Exception", "(", "\"Connection already set\"", ")", "self", ".", "connection", "=", "self", ".", "core",...
Sets the connection with the core's open method. :param autocommit: the default autocommit state :type autocommit: boolean :return: self
[ "Sets", "the", "connection", "with", "the", "core", "s", "open", "method", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/data_access.py#L95-L110
246,717
treycucco/bidon
bidon/db/access/data_access.py
DataAccess.close
def close(self, *, commit=True): """Closes the connection via the core's close method. :param commit: if true the current transaction is commited, otherwise it is rolled back :type commit: boolean :return: self """ self.core.close(self.connection, commit=commit) self.connection = None r...
python
def close(self, *, commit=True): """Closes the connection via the core's close method. :param commit: if true the current transaction is commited, otherwise it is rolled back :type commit: boolean :return: self """ self.core.close(self.connection, commit=commit) self.connection = None r...
[ "def", "close", "(", "self", ",", "*", ",", "commit", "=", "True", ")", ":", "self", ".", "core", ".", "close", "(", "self", ".", "connection", ",", "commit", "=", "commit", ")", "self", ".", "connection", "=", "None", "return", "self" ]
Closes the connection via the core's close method. :param commit: if true the current transaction is commited, otherwise it is rolled back :type commit: boolean :return: self
[ "Closes", "the", "connection", "via", "the", "core", "s", "close", "method", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/data_access.py#L112-L121
246,718
treycucco/bidon
bidon/db/access/data_access.py
DataAccess.execute
def execute(self, query_string, params=None): """Executes a query. Returns the resulting cursor. :query_string: the parameterized query string :params: can be either a tuple or a dictionary, and must match the parameterization style of the query :return: a cursor object """ cr = se...
python
def execute(self, query_string, params=None): """Executes a query. Returns the resulting cursor. :query_string: the parameterized query string :params: can be either a tuple or a dictionary, and must match the parameterization style of the query :return: a cursor object """ cr = se...
[ "def", "execute", "(", "self", ",", "query_string", ",", "params", "=", "None", ")", ":", "cr", "=", "self", ".", "connection", ".", "cursor", "(", ")", "logger", ".", "info", "(", "\"SQL: %s (%s)\"", ",", "query_string", ",", "params", ")", "self", "....
Executes a query. Returns the resulting cursor. :query_string: the parameterized query string :params: can be either a tuple or a dictionary, and must match the parameterization style of the query :return: a cursor object
[ "Executes", "a", "query", ".", "Returns", "the", "resulting", "cursor", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/data_access.py#L123-L139
246,719
treycucco/bidon
bidon/db/access/data_access.py
DataAccess.callproc
def callproc(self, name, params, param_types=None): """Calls a procedure. :param name: the name of the procedure :param params: a list or tuple of parameters to pass to the procedure. :param param_types: a list or tuple of type names. If given, each param will be cast via sql_wr...
python
def callproc(self, name, params, param_types=None): """Calls a procedure. :param name: the name of the procedure :param params: a list or tuple of parameters to pass to the procedure. :param param_types: a list or tuple of type names. If given, each param will be cast via sql_wr...
[ "def", "callproc", "(", "self", ",", "name", ",", "params", ",", "param_types", "=", "None", ")", ":", "if", "param_types", ":", "placeholders", "=", "[", "self", ".", "sql_writer", ".", "typecast", "(", "self", ".", "sql_writer", ".", "to_placeholder", ...
Calls a procedure. :param name: the name of the procedure :param params: a list or tuple of parameters to pass to the procedure. :param param_types: a list or tuple of type names. If given, each param will be cast via sql_writers typecast method. This is useful to disambiguate proce...
[ "Calls", "a", "procedure", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/data_access.py#L141-L161
246,720
treycucco/bidon
bidon/db/access/data_access.py
DataAccess.get_callproc_signature
def get_callproc_signature(self, name, param_types): """Returns a procedure's signature from the name and list of types. :name: the name of the procedure :params: can be either strings, or 2-tuples. 2-tuples must be of the form (name, db_type). :return: the procedure's signature """ if isinstan...
python
def get_callproc_signature(self, name, param_types): """Returns a procedure's signature from the name and list of types. :name: the name of the procedure :params: can be either strings, or 2-tuples. 2-tuples must be of the form (name, db_type). :return: the procedure's signature """ if isinstan...
[ "def", "get_callproc_signature", "(", "self", ",", "name", ",", "param_types", ")", ":", "if", "isinstance", "(", "param_types", "[", "0", "]", ",", "(", "list", ",", "tuple", ")", ")", ":", "params", "=", "[", "self", ".", "sql_writer", ".", "to_place...
Returns a procedure's signature from the name and list of types. :name: the name of the procedure :params: can be either strings, or 2-tuples. 2-tuples must be of the form (name, db_type). :return: the procedure's signature
[ "Returns", "a", "procedure", "s", "signature", "from", "the", "name", "and", "list", "of", "types", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/data_access.py#L163-L175
246,721
treycucco/bidon
bidon/db/access/data_access.py
DataAccess.find
def find(self, table_name, constraints=None, *, columns=None, order_by=None): """Returns the first record that matches the given criteria. :table_name: the name of the table to search on :constraints: is any construct that can be parsed by SqlWriter.parse_constraints. :columns: either a string or a lis...
python
def find(self, table_name, constraints=None, *, columns=None, order_by=None): """Returns the first record that matches the given criteria. :table_name: the name of the table to search on :constraints: is any construct that can be parsed by SqlWriter.parse_constraints. :columns: either a string or a lis...
[ "def", "find", "(", "self", ",", "table_name", ",", "constraints", "=", "None", ",", "*", ",", "columns", "=", "None", ",", "order_by", "=", "None", ")", ":", "query_string", ",", "params", "=", "self", ".", "sql_writer", ".", "get_find_all_query", "(", ...
Returns the first record that matches the given criteria. :table_name: the name of the table to search on :constraints: is any construct that can be parsed by SqlWriter.parse_constraints. :columns: either a string or a list of column names :order_by: the order by clause
[ "Returns", "the", "first", "record", "that", "matches", "the", "given", "criteria", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/data_access.py#L177-L188
246,722
treycucco/bidon
bidon/db/access/data_access.py
DataAccess.find_all
def find_all(self, table_name, constraints=None, *, columns=None, order_by=None, limiting=None): """Returns all records that match a given criteria. :table_name: the name of the table to search on :constraints: is any construct that can be parsed by SqlWriter.parse_constraints. :columns: either a strin...
python
def find_all(self, table_name, constraints=None, *, columns=None, order_by=None, limiting=None): """Returns all records that match a given criteria. :table_name: the name of the table to search on :constraints: is any construct that can be parsed by SqlWriter.parse_constraints. :columns: either a strin...
[ "def", "find_all", "(", "self", ",", "table_name", ",", "constraints", "=", "None", ",", "*", ",", "columns", "=", "None", ",", "order_by", "=", "None", ",", "limiting", "=", "None", ")", ":", "query_string", ",", "params", "=", "self", ".", "sql_write...
Returns all records that match a given criteria. :table_name: the name of the table to search on :constraints: is any construct that can be parsed by SqlWriter.parse_constraints. :columns: either a string or a list of column names :order_by: the order by clause
[ "Returns", "all", "records", "that", "match", "a", "given", "criteria", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/data_access.py#L190-L201
246,723
treycucco/bidon
bidon/db/access/data_access.py
DataAccess.page
def page(self, table_name, paging, constraints=None, *, columns=None, order_by=None, get_count=True): """Performs a find_all method with paging. :param table_name: the name of the table to search on :param paging: is a tuple containing (page, page_size). :param constraints: is any construct ...
python
def page(self, table_name, paging, constraints=None, *, columns=None, order_by=None, get_count=True): """Performs a find_all method with paging. :param table_name: the name of the table to search on :param paging: is a tuple containing (page, page_size). :param constraints: is any construct ...
[ "def", "page", "(", "self", ",", "table_name", ",", "paging", ",", "constraints", "=", "None", ",", "*", ",", "columns", "=", "None", ",", "order_by", "=", "None", ",", "get_count", "=", "True", ")", ":", "if", "get_count", ":", "count", "=", "self",...
Performs a find_all method with paging. :param table_name: the name of the table to search on :param paging: is a tuple containing (page, page_size). :param constraints: is any construct that can be parsed by SqlWriter.parse_constraints. :param columns: either a string or a list of column names :pa...
[ "Performs", "a", "find_all", "method", "with", "paging", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/data_access.py#L203-L229
246,724
treycucco/bidon
bidon/db/access/data_access.py
DataAccess.update
def update(self, table_name, values, constraints=None, *, returning=None): """Builds and executes and update statement. :param table_name: the name of the table to update :param values: can be either a dict or an enuerable of 2-tuples in the form (column, value). :param constraints: can be any construc...
python
def update(self, table_name, values, constraints=None, *, returning=None): """Builds and executes and update statement. :param table_name: the name of the table to update :param values: can be either a dict or an enuerable of 2-tuples in the form (column, value). :param constraints: can be any construc...
[ "def", "update", "(", "self", ",", "table_name", ",", "values", ",", "constraints", "=", "None", ",", "*", ",", "returning", "=", "None", ")", ":", "if", "constraints", "is", "None", ":", "constraints", "=", "\"1=1\"", "assignments", ",", "assignment_param...
Builds and executes and update statement. :param table_name: the name of the table to update :param values: can be either a dict or an enuerable of 2-tuples in the form (column, value). :param constraints: can be any construct that can be parsed by SqlWriter.parse_constraints. Howev...
[ "Builds", "and", "executes", "and", "update", "statement", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/data_access.py#L231-L267
246,725
treycucco/bidon
bidon/db/access/data_access.py
DataAccess.delete
def delete(self, table_name, constraints=None): """Builds and executes an delete statement. :param table_name: the name of the table to delete from :param constraints: can be any construct that can be parsed by SqlWriter.parse_constraints. :return: a cursor object """ if constraints is None: ...
python
def delete(self, table_name, constraints=None): """Builds and executes an delete statement. :param table_name: the name of the table to delete from :param constraints: can be any construct that can be parsed by SqlWriter.parse_constraints. :return: a cursor object """ if constraints is None: ...
[ "def", "delete", "(", "self", ",", "table_name", ",", "constraints", "=", "None", ")", ":", "if", "constraints", "is", "None", ":", "constraints", "=", "\"1=1\"", "where", ",", "params", "=", "self", ".", "sql_writer", ".", "parse_constraints", "(", "const...
Builds and executes an delete statement. :param table_name: the name of the table to delete from :param constraints: can be any construct that can be parsed by SqlWriter.parse_constraints. :return: a cursor object
[ "Builds", "and", "executes", "an", "delete", "statement", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/data_access.py#L342-L353
246,726
treycucco/bidon
bidon/db/access/data_access.py
DataAccess.count
def count(self, table_name, constraints=None, *, extract="index"): """Returns the count of records in a table. If the default cursor is a tuple or named tuple, this method will work without specifying an extract parameter. If it is a dict cursor, it is necessary to specify any value other than 'index' ...
python
def count(self, table_name, constraints=None, *, extract="index"): """Returns the count of records in a table. If the default cursor is a tuple or named tuple, this method will work without specifying an extract parameter. If it is a dict cursor, it is necessary to specify any value other than 'index' ...
[ "def", "count", "(", "self", ",", "table_name", ",", "constraints", "=", "None", ",", "*", ",", "extract", "=", "\"index\"", ")", ":", "where", ",", "params", "=", "self", ".", "sql_writer", ".", "parse_constraints", "(", "constraints", ")", "sql", "=", ...
Returns the count of records in a table. If the default cursor is a tuple or named tuple, this method will work without specifying an extract parameter. If it is a dict cursor, it is necessary to specify any value other than 'index' for extract. This method will not work with cursors that aren't like tuple...
[ "Returns", "the", "count", "of", "records", "in", "a", "table", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/data_access.py#L355-L371
246,727
treycucco/bidon
bidon/db/access/data_access.py
DataAccess.get_scalar
def get_scalar(self, cursor, index=0): """Returns a single value from the first returned record from a cursor. By default it will get cursor.fecthone()[0] which works with tuples and namedtuples. For dict cursor it is necessary to specify index. This method will not work with cursors that aren't indexa...
python
def get_scalar(self, cursor, index=0): """Returns a single value from the first returned record from a cursor. By default it will get cursor.fecthone()[0] which works with tuples and namedtuples. For dict cursor it is necessary to specify index. This method will not work with cursors that aren't indexa...
[ "def", "get_scalar", "(", "self", ",", "cursor", ",", "index", "=", "0", ")", ":", "if", "isinstance", "(", "index", ",", "int", ")", ":", "return", "cursor", ".", "fetchone", "(", ")", "[", "index", "]", "else", ":", "return", "get_value", "(", "c...
Returns a single value from the first returned record from a cursor. By default it will get cursor.fecthone()[0] which works with tuples and namedtuples. For dict cursor it is necessary to specify index. This method will not work with cursors that aren't indexable. :param cursor: a cursor object :...
[ "Returns", "a", "single", "value", "from", "the", "first", "returned", "record", "from", "a", "cursor", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/data_access.py#L373-L386
246,728
treycucco/bidon
bidon/db/access/data_access.py
Upsert.target_str
def target_str(self): """Returns the string representation of the target property.""" if isinstance(self.target, tuple): return "({})".format(", ".join(self.target)) else: return self.target
python
def target_str(self): """Returns the string representation of the target property.""" if isinstance(self.target, tuple): return "({})".format(", ".join(self.target)) else: return self.target
[ "def", "target_str", "(", "self", ")", ":", "if", "isinstance", "(", "self", ".", "target", ",", "tuple", ")", ":", "return", "\"({})\"", ".", "format", "(", "\", \"", ".", "join", "(", "self", ".", "target", ")", ")", "else", ":", "return", "self", ...
Returns the string representation of the target property.
[ "Returns", "the", "string", "representation", "of", "the", "target", "property", "." ]
d9f24596841d0e69e8ac70a1d1a1deecea95e340
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/data_access.py#L409-L414
246,729
sys-git/certifiable
certifiable/cli_impl/core/certify_number.py
cli_certify_core_number
def cli_certify_core_number( config, min_value, max_value, value, ): """Console script for certify_number""" verbose = config['verbose'] if verbose: click.echo(Back.GREEN + Fore.BLACK + "ACTION: certify-int") def parser(v): # Attempt a json/pickle decode: try: v ...
python
def cli_certify_core_number( config, min_value, max_value, value, ): """Console script for certify_number""" verbose = config['verbose'] if verbose: click.echo(Back.GREEN + Fore.BLACK + "ACTION: certify-int") def parser(v): # Attempt a json/pickle decode: try: v ...
[ "def", "cli_certify_core_number", "(", "config", ",", "min_value", ",", "max_value", ",", "value", ",", ")", ":", "verbose", "=", "config", "[", "'verbose'", "]", "if", "verbose", ":", "click", ".", "echo", "(", "Back", ".", "GREEN", "+", "Fore", ".", ...
Console script for certify_number
[ "Console", "script", "for", "certify_number" ]
a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8
https://github.com/sys-git/certifiable/blob/a3c33c0d4f3ac2c53be9eded3fae633fa5f697f8/certifiable/cli_impl/core/certify_number.py#L24-L68
246,730
alexhayes/django-toolkit
django_toolkit/url/resolve.py
resolve_url
def resolve_url(url, desktop_user_agent=None, mobile_user_agent=None): """ Url Resolver Given a url a list of resolved urls is returned for desktop and mobile user agents """ if not desktop_user_agent: desktop_user_agent = DESKTOP_USER_AGENT if not mobile_user_agent: mobile_user_...
python
def resolve_url(url, desktop_user_agent=None, mobile_user_agent=None): """ Url Resolver Given a url a list of resolved urls is returned for desktop and mobile user agents """ if not desktop_user_agent: desktop_user_agent = DESKTOP_USER_AGENT if not mobile_user_agent: mobile_user_...
[ "def", "resolve_url", "(", "url", ",", "desktop_user_agent", "=", "None", ",", "mobile_user_agent", "=", "None", ")", ":", "if", "not", "desktop_user_agent", ":", "desktop_user_agent", "=", "DESKTOP_USER_AGENT", "if", "not", "mobile_user_agent", ":", "mobile_user_ag...
Url Resolver Given a url a list of resolved urls is returned for desktop and mobile user agents
[ "Url", "Resolver", "Given", "a", "url", "a", "list", "of", "resolved", "urls", "is", "returned", "for", "desktop", "and", "mobile", "user", "agents" ]
b64106392fad596defc915b8235fe6e1d0013b5b
https://github.com/alexhayes/django-toolkit/blob/b64106392fad596defc915b8235fe6e1d0013b5b/django_toolkit/url/resolve.py#L22-L51
246,731
jorgeecardona/dynect
dynect/__init__.py
DynectAuth.token
def token(self): " Get token when needed." if hasattr(self, '_token'): return getattr(self, '_token') # Json formatted auth. data = json.dumps({'customer_name': self.customer, 'user_name': self.username, 'password': self...
python
def token(self): " Get token when needed." if hasattr(self, '_token'): return getattr(self, '_token') # Json formatted auth. data = json.dumps({'customer_name': self.customer, 'user_name': self.username, 'password': self...
[ "def", "token", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "'_token'", ")", ":", "return", "getattr", "(", "self", ",", "'_token'", ")", "# Json formatted auth.", "data", "=", "json", ".", "dumps", "(", "{", "'customer_name'", ":", "self",...
Get token when needed.
[ "Get", "token", "when", "needed", "." ]
d2cd85bc510f00108a3a5bfe515f45daae15a482
https://github.com/jorgeecardona/dynect/blob/d2cd85bc510f00108a3a5bfe515f45daae15a482/dynect/__init__.py#L27-L62
246,732
jorgeecardona/dynect
dynect/__init__.py
DynectAuth.parse_error
def parse_error(self, response): " Parse authentication errors." # Check invalid credentials. if self.check_error(response, 'failure', 'INVALID_DATA'): raise self.CredentialsError( self.response_message(response, 'ERROR'))
python
def parse_error(self, response): " Parse authentication errors." # Check invalid credentials. if self.check_error(response, 'failure', 'INVALID_DATA'): raise self.CredentialsError( self.response_message(response, 'ERROR'))
[ "def", "parse_error", "(", "self", ",", "response", ")", ":", "# Check invalid credentials.", "if", "self", ".", "check_error", "(", "response", ",", "'failure'", ",", "'INVALID_DATA'", ")", ":", "raise", "self", ".", "CredentialsError", "(", "self", ".", "res...
Parse authentication errors.
[ "Parse", "authentication", "errors", "." ]
d2cd85bc510f00108a3a5bfe515f45daae15a482
https://github.com/jorgeecardona/dynect/blob/d2cd85bc510f00108a3a5bfe515f45daae15a482/dynect/__init__.py#L64-L70
246,733
jorgeecardona/dynect
dynect/__init__.py
DynectAuth.check_error
def check_error(self, response, status, err_cd): " Check an error in the response." if 'status' not in response: return False if response['status'] != status: return False if 'msgs' not in response: return False if not isinstance(response['...
python
def check_error(self, response, status, err_cd): " Check an error in the response." if 'status' not in response: return False if response['status'] != status: return False if 'msgs' not in response: return False if not isinstance(response['...
[ "def", "check_error", "(", "self", ",", "response", ",", "status", ",", "err_cd", ")", ":", "if", "'status'", "not", "in", "response", ":", "return", "False", "if", "response", "[", "'status'", "]", "!=", "status", ":", "return", "False", "if", "'msgs'",...
Check an error in the response.
[ "Check", "an", "error", "in", "the", "response", "." ]
d2cd85bc510f00108a3a5bfe515f45daae15a482
https://github.com/jorgeecardona/dynect/blob/d2cd85bc510f00108a3a5bfe515f45daae15a482/dynect/__init__.py#L72-L95
246,734
jorgeecardona/dynect
dynect/__init__.py
Dynect.hook_response
def hook_response(self, response): " Detect any failure." # Decode content with json. response._content = json.loads(response.content) return response
python
def hook_response(self, response): " Detect any failure." # Decode content with json. response._content = json.loads(response.content) return response
[ "def", "hook_response", "(", "self", ",", "response", ")", ":", "# Decode content with json.", "response", ".", "_content", "=", "json", ".", "loads", "(", "response", ".", "content", ")", "return", "response" ]
Detect any failure.
[ "Detect", "any", "failure", "." ]
d2cd85bc510f00108a3a5bfe515f45daae15a482
https://github.com/jorgeecardona/dynect/blob/d2cd85bc510f00108a3a5bfe515f45daae15a482/dynect/__init__.py#L173-L177
246,735
jorgeecardona/dynect
dynect/__init__.py
Dynect.check_errors
def check_errors(self, response): " Check some common errors." # Read content. content = response.content if 'status' not in content: raise self.GeneralError('We expect a status field.') # Return the decoded content if status is success. if content['status'...
python
def check_errors(self, response): " Check some common errors." # Read content. content = response.content if 'status' not in content: raise self.GeneralError('We expect a status field.') # Return the decoded content if status is success. if content['status'...
[ "def", "check_errors", "(", "self", ",", "response", ")", ":", "# Read content.", "content", "=", "response", ".", "content", "if", "'status'", "not", "in", "content", ":", "raise", "self", ".", "GeneralError", "(", "'We expect a status field.'", ")", "# Return ...
Check some common errors.
[ "Check", "some", "common", "errors", "." ]
d2cd85bc510f00108a3a5bfe515f45daae15a482
https://github.com/jorgeecardona/dynect/blob/d2cd85bc510f00108a3a5bfe515f45daae15a482/dynect/__init__.py#L199-L239
246,736
jorgeecardona/dynect
dynect/__init__.py
Dynect.add_address
def add_address(self, fqdn, address, ttl=0): " Add a new address to a domain." data = {'rdata': {'address': address}, 'ttl': str(ttl)} # Make request. response = self.post('/REST/ARecord/%s/%s' % ( self.zone, fqdn), data=data) return Address(self, data=response.con...
python
def add_address(self, fqdn, address, ttl=0): " Add a new address to a domain." data = {'rdata': {'address': address}, 'ttl': str(ttl)} # Make request. response = self.post('/REST/ARecord/%s/%s' % ( self.zone, fqdn), data=data) return Address(self, data=response.con...
[ "def", "add_address", "(", "self", ",", "fqdn", ",", "address", ",", "ttl", "=", "0", ")", ":", "data", "=", "{", "'rdata'", ":", "{", "'address'", ":", "address", "}", ",", "'ttl'", ":", "str", "(", "ttl", ")", "}", "# Make request.", "response", ...
Add a new address to a domain.
[ "Add", "a", "new", "address", "to", "a", "domain", "." ]
d2cd85bc510f00108a3a5bfe515f45daae15a482
https://github.com/jorgeecardona/dynect/blob/d2cd85bc510f00108a3a5bfe515f45daae15a482/dynect/__init__.py#L242-L251
246,737
jorgeecardona/dynect
dynect/__init__.py
Dynect.publish
def publish(self): " Publish last changes." # Publish changes. response = self.put('/REST/Zone/%s' % ( self.zone, ), data={'publish': True}) return response.content['data']['serial']
python
def publish(self): " Publish last changes." # Publish changes. response = self.put('/REST/Zone/%s' % ( self.zone, ), data={'publish': True}) return response.content['data']['serial']
[ "def", "publish", "(", "self", ")", ":", "# Publish changes.", "response", "=", "self", ".", "put", "(", "'/REST/Zone/%s'", "%", "(", "self", ".", "zone", ",", ")", ",", "data", "=", "{", "'publish'", ":", "True", "}", ")", "return", "response", ".", ...
Publish last changes.
[ "Publish", "last", "changes", "." ]
d2cd85bc510f00108a3a5bfe515f45daae15a482
https://github.com/jorgeecardona/dynect/blob/d2cd85bc510f00108a3a5bfe515f45daae15a482/dynect/__init__.py#L254-L261
246,738
jorgeecardona/dynect
dynect/__init__.py
Dynect.list_address
def list_address(self, domain): " Get the list of addresses of a single domain." try: response = self.get('/REST/ARecord/%s/%s' % ( self.zone, domain)) except self.NotFoundError: return [] # Return a generator with the addresses. addresse...
python
def list_address(self, domain): " Get the list of addresses of a single domain." try: response = self.get('/REST/ARecord/%s/%s' % ( self.zone, domain)) except self.NotFoundError: return [] # Return a generator with the addresses. addresse...
[ "def", "list_address", "(", "self", ",", "domain", ")", ":", "try", ":", "response", "=", "self", ".", "get", "(", "'/REST/ARecord/%s/%s'", "%", "(", "self", ".", "zone", ",", "domain", ")", ")", "except", "self", ".", "NotFoundError", ":", "return", "...
Get the list of addresses of a single domain.
[ "Get", "the", "list", "of", "addresses", "of", "a", "single", "domain", "." ]
d2cd85bc510f00108a3a5bfe515f45daae15a482
https://github.com/jorgeecardona/dynect/blob/d2cd85bc510f00108a3a5bfe515f45daae15a482/dynect/__init__.py#L264-L275
246,739
jorgeecardona/dynect
dynect/__init__.py
Dynect.remove_address
def remove_address(self, fqdn, address): " Remove an address of a domain." # Get a list of addresses. for record in self.list_address(fqdn): if record.address == address: record.delete() break
python
def remove_address(self, fqdn, address): " Remove an address of a domain." # Get a list of addresses. for record in self.list_address(fqdn): if record.address == address: record.delete() break
[ "def", "remove_address", "(", "self", ",", "fqdn", ",", "address", ")", ":", "# Get a list of addresses.", "for", "record", "in", "self", ".", "list_address", "(", "fqdn", ")", ":", "if", "record", ".", "address", "==", "address", ":", "record", ".", "dele...
Remove an address of a domain.
[ "Remove", "an", "address", "of", "a", "domain", "." ]
d2cd85bc510f00108a3a5bfe515f45daae15a482
https://github.com/jorgeecardona/dynect/blob/d2cd85bc510f00108a3a5bfe515f45daae15a482/dynect/__init__.py#L277-L284
246,740
jorgeecardona/dynect
dynect/__init__.py
Node.delete
def delete(self): " Delete the address." response = self.dyn.delete(self.delete_url) return response.content['job_id']
python
def delete(self): " Delete the address." response = self.dyn.delete(self.delete_url) return response.content['job_id']
[ "def", "delete", "(", "self", ")", ":", "response", "=", "self", ".", "dyn", ".", "delete", "(", "self", ".", "delete_url", ")", "return", "response", ".", "content", "[", "'job_id'", "]" ]
Delete the address.
[ "Delete", "the", "address", "." ]
d2cd85bc510f00108a3a5bfe515f45daae15a482
https://github.com/jorgeecardona/dynect/blob/d2cd85bc510f00108a3a5bfe515f45daae15a482/dynect/__init__.py#L314-L317
246,741
jorgeecardona/dynect
dynect/__init__.py
DynectRecord.delete
def delete(self): " Delete the record." response = self.dyn.delete(self.url) return response.content['job_id']
python
def delete(self): " Delete the record." response = self.dyn.delete(self.url) return response.content['job_id']
[ "def", "delete", "(", "self", ")", ":", "response", "=", "self", ".", "dyn", ".", "delete", "(", "self", ".", "url", ")", "return", "response", ".", "content", "[", "'job_id'", "]" ]
Delete the record.
[ "Delete", "the", "record", "." ]
d2cd85bc510f00108a3a5bfe515f45daae15a482
https://github.com/jorgeecardona/dynect/blob/d2cd85bc510f00108a3a5bfe515f45daae15a482/dynect/__init__.py#L348-L352
246,742
KnowledgeLinks/rdfframework
rdfframework/connections/connmanager.py
make_tstore_conn
def make_tstore_conn(params, **kwargs): """ Returns a triplestore connection args: attr_name: The name the connection will be assigned in the config manager params: The paramaters of the connection kwargs: log_level: logging level to use """ ...
python
def make_tstore_conn(params, **kwargs): """ Returns a triplestore connection args: attr_name: The name the connection will be assigned in the config manager params: The paramaters of the connection kwargs: log_level: logging level to use """ ...
[ "def", "make_tstore_conn", "(", "params", ",", "*", "*", "kwargs", ")", ":", "log", ".", "setLevel", "(", "params", ".", "get", "(", "'log_level'", ",", "__LOG_LEVEL__", ")", ")", "log", ".", "debug", "(", "\"\\n%s\"", ",", "params", ")", "params", "."...
Returns a triplestore connection args: attr_name: The name the connection will be assigned in the config manager params: The paramaters of the connection kwargs: log_level: logging level to use
[ "Returns", "a", "triplestore", "connection" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/connections/connmanager.py#L264-L283
246,743
KnowledgeLinks/rdfframework
rdfframework/connections/connmanager.py
ConnManager.set_conn
def set_conn(self, **kwargs): """ takes a connection and creates the connection """ # log = logging.getLogger("%s.%s" % (self.log, inspect.stack()[0][3])) log.setLevel(kwargs.get('log_level',self.log_level)) conn_name = kwargs.get("name") if not conn_name: raise Nam...
python
def set_conn(self, **kwargs): """ takes a connection and creates the connection """ # log = logging.getLogger("%s.%s" % (self.log, inspect.stack()[0][3])) log.setLevel(kwargs.get('log_level',self.log_level)) conn_name = kwargs.get("name") if not conn_name: raise Nam...
[ "def", "set_conn", "(", "self", ",", "*", "*", "kwargs", ")", ":", "# log = logging.getLogger(\"%s.%s\" % (self.log, inspect.stack()[0][3]))", "log", ".", "setLevel", "(", "kwargs", ".", "get", "(", "'log_level'", ",", "self", ".", "log_level", ")", ")", "conn_nam...
takes a connection and creates the connection
[ "takes", "a", "connection", "and", "creates", "the", "connection" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/connections/connmanager.py#L106-L132
246,744
KnowledgeLinks/rdfframework
rdfframework/connections/connmanager.py
ConnManager.get
def get(self, conn_name, default=None, **kwargs): """ returns the specified connection args: conn_name: the name of the connection """ if isinstance(conn_name, RdfwConnections): return conn_name try: return self.conns[conn_name] excep...
python
def get(self, conn_name, default=None, **kwargs): """ returns the specified connection args: conn_name: the name of the connection """ if isinstance(conn_name, RdfwConnections): return conn_name try: return self.conns[conn_name] excep...
[ "def", "get", "(", "self", ",", "conn_name", ",", "default", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "conn_name", ",", "RdfwConnections", ")", ":", "return", "conn_name", "try", ":", "return", "self", ".", "conns", "[",...
returns the specified connection args: conn_name: the name of the connection
[ "returns", "the", "specified", "connection" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/connections/connmanager.py#L135-L149
246,745
KnowledgeLinks/rdfframework
rdfframework/connections/connmanager.py
ConnManager.load
def load(self, conn_list, **kwargs): """ Takes a list of connections and sets them in the manager args: conn_list: list of connection defitions """ for conn in conn_list: conn['delay_check'] = kwargs.get('delay_check', False) self.set_conn(**conn) ...
python
def load(self, conn_list, **kwargs): """ Takes a list of connections and sets them in the manager args: conn_list: list of connection defitions """ for conn in conn_list: conn['delay_check'] = kwargs.get('delay_check', False) self.set_conn(**conn) ...
[ "def", "load", "(", "self", ",", "conn_list", ",", "*", "*", "kwargs", ")", ":", "for", "conn", "in", "conn_list", ":", "conn", "[", "'delay_check'", "]", "=", "kwargs", ".", "get", "(", "'delay_check'", ",", "False", ")", "self", ".", "set_conn", "(...
Takes a list of connections and sets them in the manager args: conn_list: list of connection defitions
[ "Takes", "a", "list", "of", "connections", "and", "sets", "them", "in", "the", "manager" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/connections/connmanager.py#L151-L164
246,746
KnowledgeLinks/rdfframework
rdfframework/connections/connmanager.py
ConnManager.failing
def failing(self): """ Tests to see if all connections are working returns: dictionary of all failing connections """ log_levels = {key: conn.log_level for key, conn in self.conns.items() if hasattr(conn, 'log_level')} for key in log_levels: ...
python
def failing(self): """ Tests to see if all connections are working returns: dictionary of all failing connections """ log_levels = {key: conn.log_level for key, conn in self.conns.items() if hasattr(conn, 'log_level')} for key in log_levels: ...
[ "def", "failing", "(", "self", ")", ":", "log_levels", "=", "{", "key", ":", "conn", ".", "log_level", "for", "key", ",", "conn", "in", "self", ".", "conns", ".", "items", "(", ")", "if", "hasattr", "(", "conn", ",", "'log_level'", ")", "}", "for",...
Tests to see if all connections are working returns: dictionary of all failing connections
[ "Tests", "to", "see", "if", "all", "connections", "are", "working" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/connections/connmanager.py#L167-L181
246,747
KnowledgeLinks/rdfframework
rdfframework/connections/connmanager.py
ConnManager.wait_for_conns
def wait_for_conns(self, timeout=60, start_delay=0, interval=5, **kwargs): ''' delays unitil all connections are working args: timeout: number of seconds to try to connecting. Error out when timeout is reached start_delay: number of seconds to...
python
def wait_for_conns(self, timeout=60, start_delay=0, interval=5, **kwargs): ''' delays unitil all connections are working args: timeout: number of seconds to try to connecting. Error out when timeout is reached start_delay: number of seconds to...
[ "def", "wait_for_conns", "(", "self", ",", "timeout", "=", "60", ",", "start_delay", "=", "0", ",", "interval", "=", "5", ",", "*", "*", "kwargs", ")", ":", "log", ".", "setLevel", "(", "kwargs", ".", "get", "(", "'log_level'", ",", "self", ".", "l...
delays unitil all connections are working args: timeout: number of seconds to try to connecting. Error out when timeout is reached start_delay: number of seconds to wait before checking status interval: number of seconds to wait betwee...
[ "delays", "unitil", "all", "connections", "are", "working" ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/connections/connmanager.py#L183-L233
246,748
KnowledgeLinks/rdfframework
rdfframework/connections/connmanager.py
ConnManager.active
def active(self): """ returns a dictionary of connections set as active. """ return {key: value for key, value in self.conns.items() if value.active}
python
def active(self): """ returns a dictionary of connections set as active. """ return {key: value for key, value in self.conns.items() if value.active}
[ "def", "active", "(", "self", ")", ":", "return", "{", "key", ":", "value", "for", "key", ",", "value", "in", "self", ".", "conns", ".", "items", "(", ")", "if", "value", ".", "active", "}" ]
returns a dictionary of connections set as active.
[ "returns", "a", "dictionary", "of", "connections", "set", "as", "active", "." ]
9ec32dcc4bed51650a4b392cc5c15100fef7923a
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/connections/connmanager.py#L258-L262
246,749
UT-ET/offer
offer/offerCLI.py
main
def main(): """Host a file.""" description = """Host a file on the LAN.""" argParser = _argparse.ArgumentParser(description=description) argParser.add_argument('file', help='File to host') argParser.add_argument('-p', '--port', help='Port to us...
python
def main(): """Host a file.""" description = """Host a file on the LAN.""" argParser = _argparse.ArgumentParser(description=description) argParser.add_argument('file', help='File to host') argParser.add_argument('-p', '--port', help='Port to us...
[ "def", "main", "(", ")", ":", "description", "=", "\"\"\"Host a file on the LAN.\"\"\"", "argParser", "=", "_argparse", ".", "ArgumentParser", "(", "description", "=", "description", ")", "argParser", ".", "add_argument", "(", "'file'", ",", "help", "=", "'File to...
Host a file.
[ "Host", "a", "file", "." ]
8dee15337b60999040feb3529333b871fb5e258f
https://github.com/UT-ET/offer/blob/8dee15337b60999040feb3529333b871fb5e258f/offer/offerCLI.py#L88-L151
246,750
daknuett/py_register_machine2
machines/small.py
small_register_machine
def small_register_machine(rom_size = 50, ram_size = 200, flash_size = 500): """ An unprogrammend Register Machine with * one OutputRegister to ``sys.stdout`` (``out0``) * 15 General Purpose Register (``r0 - r14``) returns : ``(Processor, ROM, RAM, Flash)`` """ rom = memory.ROM(rom_size) ram = memory.RAM(ram...
python
def small_register_machine(rom_size = 50, ram_size = 200, flash_size = 500): """ An unprogrammend Register Machine with * one OutputRegister to ``sys.stdout`` (``out0``) * 15 General Purpose Register (``r0 - r14``) returns : ``(Processor, ROM, RAM, Flash)`` """ rom = memory.ROM(rom_size) ram = memory.RAM(ram...
[ "def", "small_register_machine", "(", "rom_size", "=", "50", ",", "ram_size", "=", "200", ",", "flash_size", "=", "500", ")", ":", "rom", "=", "memory", ".", "ROM", "(", "rom_size", ")", "ram", "=", "memory", ".", "RAM", "(", "ram_size", ")", "flash", ...
An unprogrammend Register Machine with * one OutputRegister to ``sys.stdout`` (``out0``) * 15 General Purpose Register (``r0 - r14``) returns : ``(Processor, ROM, RAM, Flash)``
[ "An", "unprogrammend", "Register", "Machine", "with" ]
599c53cd7576297d0d7a53344ed5d9aa98acc751
https://github.com/daknuett/py_register_machine2/blob/599c53cd7576297d0d7a53344ed5d9aa98acc751/machines/small.py#L12-L54
246,751
svasilev94/GraphLibrary
graphlibrary/digraph.py
DiGraph.add_edge
def add_edge(self, u, v, **attr): """ Add an edge from u to v and update edge attributes """ if u not in self.vertices: self.vertices[u] = [] self.pred[u] = [] self.succ[u] = [] if v not in self.vertices: self.vertices[v] =...
python
def add_edge(self, u, v, **attr): """ Add an edge from u to v and update edge attributes """ if u not in self.vertices: self.vertices[u] = [] self.pred[u] = [] self.succ[u] = [] if v not in self.vertices: self.vertices[v] =...
[ "def", "add_edge", "(", "self", ",", "u", ",", "v", ",", "*", "*", "attr", ")", ":", "if", "u", "not", "in", "self", ".", "vertices", ":", "self", ".", "vertices", "[", "u", "]", "=", "[", "]", "self", ".", "pred", "[", "u", "]", "=", "[", ...
Add an edge from u to v and update edge attributes
[ "Add", "an", "edge", "from", "u", "to", "v", "and", "update", "edge", "attributes" ]
bf979a80bdea17eeb25955f0c119ca8f711ef62b
https://github.com/svasilev94/GraphLibrary/blob/bf979a80bdea17eeb25955f0c119ca8f711ef62b/graphlibrary/digraph.py#L35-L52
246,752
svasilev94/GraphLibrary
graphlibrary/digraph.py
DiGraph.has_successor
def has_successor(self, u, v): """ Check if vertex u has successor v """ if u not in self.vertices: raise GraphInsertError("Vertex %s doesn't exist." % (u,)) return (u in self.succ and v in self.succ[u])
python
def has_successor(self, u, v): """ Check if vertex u has successor v """ if u not in self.vertices: raise GraphInsertError("Vertex %s doesn't exist." % (u,)) return (u in self.succ and v in self.succ[u])
[ "def", "has_successor", "(", "self", ",", "u", ",", "v", ")", ":", "if", "u", "not", "in", "self", ".", "vertices", ":", "raise", "GraphInsertError", "(", "\"Vertex %s doesn't exist.\"", "%", "(", "u", ",", ")", ")", "return", "(", "u", "in", "self", ...
Check if vertex u has successor v
[ "Check", "if", "vertex", "u", "has", "successor", "v" ]
bf979a80bdea17eeb25955f0c119ca8f711ef62b
https://github.com/svasilev94/GraphLibrary/blob/bf979a80bdea17eeb25955f0c119ca8f711ef62b/graphlibrary/digraph.py#L99-L105
246,753
svasilev94/GraphLibrary
graphlibrary/digraph.py
DiGraph.has_predecessor
def has_predecessor(self, u, v): """ Check if vertex u has predecessor v """ if u not in self.vertices: raise GraphInsertError("Vertex %s doesn't exist." % (u,)) return(u in self.pred and v in self.pred[u])
python
def has_predecessor(self, u, v): """ Check if vertex u has predecessor v """ if u not in self.vertices: raise GraphInsertError("Vertex %s doesn't exist." % (u,)) return(u in self.pred and v in self.pred[u])
[ "def", "has_predecessor", "(", "self", ",", "u", ",", "v", ")", ":", "if", "u", "not", "in", "self", ".", "vertices", ":", "raise", "GraphInsertError", "(", "\"Vertex %s doesn't exist.\"", "%", "(", "u", ",", ")", ")", "return", "(", "u", "in", "self",...
Check if vertex u has predecessor v
[ "Check", "if", "vertex", "u", "has", "predecessor", "v" ]
bf979a80bdea17eeb25955f0c119ca8f711ef62b
https://github.com/svasilev94/GraphLibrary/blob/bf979a80bdea17eeb25955f0c119ca8f711ef62b/graphlibrary/digraph.py#L107-L113
246,754
nickmilon/Hellas
Hellas/Thebes.py
format_header
def format_header(frmt, return_len=False): """creates a header string from a new style format string useful when printing dictionaries :param str frmt: a new style format string :returns: a table header string assumptions for frmt specs: - all have a separator = '|' and include a key size form...
python
def format_header(frmt, return_len=False): """creates a header string from a new style format string useful when printing dictionaries :param str frmt: a new style format string :returns: a table header string assumptions for frmt specs: - all have a separator = '|' and include a key size form...
[ "def", "format_header", "(", "frmt", ",", "return_len", "=", "False", ")", ":", "names", "=", "re", ".", "sub", "(", "\"{(.*?):.*?}\"", ",", "r\"\\1\"", ",", "frmt", ")", "names", "=", "[", "i", "for", "i", "in", "names", ".", "split", "(", "\"|\"", ...
creates a header string from a new style format string useful when printing dictionaries :param str frmt: a new style format string :returns: a table header string assumptions for frmt specs: - all have a separator = '|' and include a key size format directive i.e.: '{key:size}' - no other...
[ "creates", "a", "header", "string", "from", "a", "new", "style", "format", "string", "useful", "when", "printing", "dictionaries" ]
542e4778692fbec90753942946f20100412ec9ee
https://github.com/nickmilon/Hellas/blob/542e4778692fbec90753942946f20100412ec9ee/Hellas/Thebes.py#L11-L40
246,755
Tinche/django-bower-cache
registry/admin.py
ClonedRepoAdmin.save_form
def save_form(self, request, form, change): """Here we pluck out the data to create a new cloned repo. Form is an instance of NewRepoForm. """ name = form.cleaned_data['name'] origin_url = form.cleaned_data['origin_url'] res = ClonedRepo(name=name, origin=origin_url) ...
python
def save_form(self, request, form, change): """Here we pluck out the data to create a new cloned repo. Form is an instance of NewRepoForm. """ name = form.cleaned_data['name'] origin_url = form.cleaned_data['origin_url'] res = ClonedRepo(name=name, origin=origin_url) ...
[ "def", "save_form", "(", "self", ",", "request", ",", "form", ",", "change", ")", ":", "name", "=", "form", ".", "cleaned_data", "[", "'name'", "]", "origin_url", "=", "form", ".", "cleaned_data", "[", "'origin_url'", "]", "res", "=", "ClonedRepo", "(", ...
Here we pluck out the data to create a new cloned repo. Form is an instance of NewRepoForm.
[ "Here", "we", "pluck", "out", "the", "data", "to", "create", "a", "new", "cloned", "repo", "." ]
5245b2ee80c33c09d85ce0bf8f047825d9df2118
https://github.com/Tinche/django-bower-cache/blob/5245b2ee80c33c09d85ce0bf8f047825d9df2118/registry/admin.py#L65-L76
246,756
Tinche/django-bower-cache
registry/admin.py
ClonedRepoAdmin.add_view
def add_view(self, request, **kwargs): """A custom add_view, to catch exceptions from 'save_model'. Just to be clear, this is very filthy. """ try: return super(ClonedRepoAdmin, self).add_view(request, **kwargs) except ValidationError: # Rerender the f...
python
def add_view(self, request, **kwargs): """A custom add_view, to catch exceptions from 'save_model'. Just to be clear, this is very filthy. """ try: return super(ClonedRepoAdmin, self).add_view(request, **kwargs) except ValidationError: # Rerender the f...
[ "def", "add_view", "(", "self", ",", "request", ",", "*", "*", "kwargs", ")", ":", "try", ":", "return", "super", "(", "ClonedRepoAdmin", ",", "self", ")", ".", "add_view", "(", "request", ",", "*", "*", "kwargs", ")", "except", "ValidationError", ":",...
A custom add_view, to catch exceptions from 'save_model'. Just to be clear, this is very filthy.
[ "A", "custom", "add_view", "to", "catch", "exceptions", "from", "save_model", "." ]
5245b2ee80c33c09d85ce0bf8f047825d9df2118
https://github.com/Tinche/django-bower-cache/blob/5245b2ee80c33c09d85ce0bf8f047825d9df2118/registry/admin.py#L82-L91
246,757
Tinche/django-bower-cache
registry/admin.py
ClonedRepoAdmin.git_pull_view
def git_pull_view(self, request, repo_name): """Perform a git pull and redirect back to the repo.""" LOG.info("Pull requested for %s." % repo_name) repo = get_object_or_404(self.model, name=repo_name) repo.pull() self.message_user(request, "Repo %s successfully updated." % repo_n...
python
def git_pull_view(self, request, repo_name): """Perform a git pull and redirect back to the repo.""" LOG.info("Pull requested for %s." % repo_name) repo = get_object_or_404(self.model, name=repo_name) repo.pull() self.message_user(request, "Repo %s successfully updated." % repo_n...
[ "def", "git_pull_view", "(", "self", ",", "request", ",", "repo_name", ")", ":", "LOG", ".", "info", "(", "\"Pull requested for %s.\"", "%", "repo_name", ")", "repo", "=", "get_object_or_404", "(", "self", ".", "model", ",", "name", "=", "repo_name", ")", ...
Perform a git pull and redirect back to the repo.
[ "Perform", "a", "git", "pull", "and", "redirect", "back", "to", "the", "repo", "." ]
5245b2ee80c33c09d85ce0bf8f047825d9df2118
https://github.com/Tinche/django-bower-cache/blob/5245b2ee80c33c09d85ce0bf8f047825d9df2118/registry/admin.py#L102-L109
246,758
Tinche/django-bower-cache
registry/admin.py
ClonedRepoAdmin.update_all_view
def update_all_view(self, request): """Update all repositories and redirect back to the repo list.""" LOG.info("Total update requested.") total_count = errors = 0 for repo in self.model.objects.all(): total_count += 1 try: repo.pull() e...
python
def update_all_view(self, request): """Update all repositories and redirect back to the repo list.""" LOG.info("Total update requested.") total_count = errors = 0 for repo in self.model.objects.all(): total_count += 1 try: repo.pull() e...
[ "def", "update_all_view", "(", "self", ",", "request", ")", ":", "LOG", ".", "info", "(", "\"Total update requested.\"", ")", "total_count", "=", "errors", "=", "0", "for", "repo", "in", "self", ".", "model", ".", "objects", ".", "all", "(", ")", ":", ...
Update all repositories and redirect back to the repo list.
[ "Update", "all", "repositories", "and", "redirect", "back", "to", "the", "repo", "list", "." ]
5245b2ee80c33c09d85ce0bf8f047825d9df2118
https://github.com/Tinche/django-bower-cache/blob/5245b2ee80c33c09d85ce0bf8f047825d9df2118/registry/admin.py#L111-L125
246,759
Tinche/django-bower-cache
registry/admin.py
NewRepoForm.clean
def clean(self): """Validate the new repo form. Might perform a request to upstream Bower.""" cleaned_data = super(NewRepoForm, self).clean() origin_url = cleaned_data['origin_url'] origin_source = cleaned_data['origin_source'] if origin_source == 'origin_url' and not...
python
def clean(self): """Validate the new repo form. Might perform a request to upstream Bower.""" cleaned_data = super(NewRepoForm, self).clean() origin_url = cleaned_data['origin_url'] origin_source = cleaned_data['origin_source'] if origin_source == 'origin_url' and not...
[ "def", "clean", "(", "self", ")", ":", "cleaned_data", "=", "super", "(", "NewRepoForm", ",", "self", ")", ".", "clean", "(", ")", "origin_url", "=", "cleaned_data", "[", "'origin_url'", "]", "origin_source", "=", "cleaned_data", "[", "'origin_source'", "]",...
Validate the new repo form. Might perform a request to upstream Bower.
[ "Validate", "the", "new", "repo", "form", "." ]
5245b2ee80c33c09d85ce0bf8f047825d9df2118
https://github.com/Tinche/django-bower-cache/blob/5245b2ee80c33c09d85ce0bf8f047825d9df2118/registry/admin.py#L137-L168
246,760
s-ball/i18nparse
i18nparse/i18nparse.py
activate
def activate(lang=None): """Activate a translation for lang. If lang is None, then the language of locale.getdefaultlocale() is used. If the translation file does not exist, the original messages will be used. """ if lang is None: lang = locale.getlocale()[0] tr = gettext.translation("argparse", os...
python
def activate(lang=None): """Activate a translation for lang. If lang is None, then the language of locale.getdefaultlocale() is used. If the translation file does not exist, the original messages will be used. """ if lang is None: lang = locale.getlocale()[0] tr = gettext.translation("argparse", os...
[ "def", "activate", "(", "lang", "=", "None", ")", ":", "if", "lang", "is", "None", ":", "lang", "=", "locale", ".", "getlocale", "(", ")", "[", "0", "]", "tr", "=", "gettext", ".", "translation", "(", "\"argparse\"", ",", "os", ".", "path", ".", ...
Activate a translation for lang. If lang is None, then the language of locale.getdefaultlocale() is used. If the translation file does not exist, the original messages will be used.
[ "Activate", "a", "translation", "for", "lang", "." ]
cc70cbf31903caf45ebfdcb62a57744b6fe9d0df
https://github.com/s-ball/i18nparse/blob/cc70cbf31903caf45ebfdcb62a57744b6fe9d0df/i18nparse/i18nparse.py#L11-L22
246,761
geertj/looping
lib/looping/pyside.py
PySideEventLoop.run
def run(self): """Run until there are no more events. This only looks at events scheduled through the event loop. """ self._stop = False while not self._stop: have_sources = self._timers or self._readers or self._writers if not self._processor.pending and ...
python
def run(self): """Run until there are no more events. This only looks at events scheduled through the event loop. """ self._stop = False while not self._stop: have_sources = self._timers or self._readers or self._writers if not self._processor.pending and ...
[ "def", "run", "(", "self", ")", ":", "self", ".", "_stop", "=", "False", "while", "not", "self", ".", "_stop", ":", "have_sources", "=", "self", ".", "_timers", "or", "self", ".", "_readers", "or", "self", ".", "_writers", "if", "not", "self", ".", ...
Run until there are no more events. This only looks at events scheduled through the event loop.
[ "Run", "until", "there", "are", "no", "more", "events", ".", "This", "only", "looks", "at", "events", "scheduled", "through", "the", "event", "loop", "." ]
b60303714685aede18b37c0d80f8f55175ad7a65
https://github.com/geertj/looping/blob/b60303714685aede18b37c0d80f8f55175ad7a65/lib/looping/pyside.py#L97-L111
246,762
edeposit/edeposit.amqp.harvester
src/edeposit/amqp/harvester/structures.py
Author.to_namedtuple
def to_namedtuple(self): """ Convert class to namedtuple. Note: This method is neccessary for AMQP communication. Returns: namedtuple: Representation of the class as simple structure. """ keys = filter(lambda x: not x.startswith("_"), self.__dict...
python
def to_namedtuple(self): """ Convert class to namedtuple. Note: This method is neccessary for AMQP communication. Returns: namedtuple: Representation of the class as simple structure. """ keys = filter(lambda x: not x.startswith("_"), self.__dict...
[ "def", "to_namedtuple", "(", "self", ")", ":", "keys", "=", "filter", "(", "lambda", "x", ":", "not", "x", ".", "startswith", "(", "\"_\"", ")", ",", "self", ".", "__dict__", ")", "opt_nt", "=", "namedtuple", "(", "self", ".", "__class__", ".", "__na...
Convert class to namedtuple. Note: This method is neccessary for AMQP communication. Returns: namedtuple: Representation of the class as simple structure.
[ "Convert", "class", "to", "namedtuple", "." ]
38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e
https://github.com/edeposit/edeposit.amqp.harvester/blob/38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e/src/edeposit/amqp/harvester/structures.py#L26-L40
246,763
edeposit/edeposit.amqp.harvester
src/edeposit/amqp/harvester/structures.py
Publication._get_hash
def _get_hash(self): """ Create hash of the class. Hash should be unique for given ebook, so ISBN is main component of the hash if provided. Returns: str: Hash. """ if self.optionals and self.optionals.ISBN: isbn = self.optionals.ISBN.rep...
python
def _get_hash(self): """ Create hash of the class. Hash should be unique for given ebook, so ISBN is main component of the hash if provided. Returns: str: Hash. """ if self.optionals and self.optionals.ISBN: isbn = self.optionals.ISBN.rep...
[ "def", "_get_hash", "(", "self", ")", ":", "if", "self", ".", "optionals", "and", "self", ".", "optionals", ".", "ISBN", ":", "isbn", "=", "self", ".", "optionals", ".", "ISBN", ".", "replace", "(", "\"-\"", ",", "\"\"", ")", "if", "len", "(", "isb...
Create hash of the class. Hash should be unique for given ebook, so ISBN is main component of the hash if provided. Returns: str: Hash.
[ "Create", "hash", "of", "the", "class", "." ]
38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e
https://github.com/edeposit/edeposit.amqp.harvester/blob/38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e/src/edeposit/amqp/harvester/structures.py#L178-L199
246,764
kmedian/luriegold
luriegold/luriegold_func.py
luriegold
def luriegold(R): """Lurie-Goldberg Algorithm to adjust a correlation matrix to be semipositive definite Philip M. Lurie and Matthew S. Goldberg (1998), An Approximate Method for Sampling Correlated Random Variables from Partially-Specified Distributions, Management Science, Vol 44, No. 2, Fe...
python
def luriegold(R): """Lurie-Goldberg Algorithm to adjust a correlation matrix to be semipositive definite Philip M. Lurie and Matthew S. Goldberg (1998), An Approximate Method for Sampling Correlated Random Variables from Partially-Specified Distributions, Management Science, Vol 44, No. 2, Fe...
[ "def", "luriegold", "(", "R", ")", ":", "# subfunctions", "def", "xtotril", "(", "x", ",", "idx", ",", "mat", ")", ":", "\"\"\"Create 'L' lower triangular matrix.\"\"\"", "mat", "[", "idx", "]", "=", "x", "return", "mat", "def", "xtocorr", "(", "x", ",", ...
Lurie-Goldberg Algorithm to adjust a correlation matrix to be semipositive definite Philip M. Lurie and Matthew S. Goldberg (1998), An Approximate Method for Sampling Correlated Random Variables from Partially-Specified Distributions, Management Science, Vol 44, No. 2, February 1998, pp 20...
[ "Lurie", "-", "Goldberg", "Algorithm", "to", "adjust", "a", "correlation", "matrix", "to", "be", "semipositive", "definite" ]
9aa77fb3f7277e44973b472cc81aa15bbe171414
https://github.com/kmedian/luriegold/blob/9aa77fb3f7277e44973b472cc81aa15bbe171414/luriegold/luriegold_func.py#L6-L68
246,765
calvinku96/labreporthelper
labreporthelper/manage.py
generate_datasets_list
def generate_datasets_list(settings, argv): """ generate datasets list to activate args: settings: dictionary from settings file argv: list from sys.argv """ datasets_string_list = settings["DATASETS_LIST"] datasets_list = [] if len(argv) == 2: ...
python
def generate_datasets_list(settings, argv): """ generate datasets list to activate args: settings: dictionary from settings file argv: list from sys.argv """ datasets_string_list = settings["DATASETS_LIST"] datasets_list = [] if len(argv) == 2: ...
[ "def", "generate_datasets_list", "(", "settings", ",", "argv", ")", ":", "datasets_string_list", "=", "settings", "[", "\"DATASETS_LIST\"", "]", "datasets_list", "=", "[", "]", "if", "len", "(", "argv", ")", "==", "2", ":", "try", ":", "datasets_items", "=",...
generate datasets list to activate args: settings: dictionary from settings file argv: list from sys.argv
[ "generate", "datasets", "list", "to", "activate" ]
4d436241f389c02eb188c313190df62ab28c3763
https://github.com/calvinku96/labreporthelper/blob/4d436241f389c02eb188c313190df62ab28c3763/labreporthelper/manage.py#L15-L54
246,766
calvinku96/labreporthelper
labreporthelper/manage.py
manage
def manage(settingspath, root_dir, argv): """ Manage all processes """ # add settings.json to environment variables os.environ[ENV_VAR_SETTINGS] = settingspath # add root_dir os.environ[ENV_VAR_ROOT_DIR] = root_dir # get datasets list with open(settingspath) as settings_file: ...
python
def manage(settingspath, root_dir, argv): """ Manage all processes """ # add settings.json to environment variables os.environ[ENV_VAR_SETTINGS] = settingspath # add root_dir os.environ[ENV_VAR_ROOT_DIR] = root_dir # get datasets list with open(settingspath) as settings_file: ...
[ "def", "manage", "(", "settingspath", ",", "root_dir", ",", "argv", ")", ":", "# add settings.json to environment variables", "os", ".", "environ", "[", "ENV_VAR_SETTINGS", "]", "=", "settingspath", "# add root_dir", "os", ".", "environ", "[", "ENV_VAR_ROOT_DIR", "]...
Manage all processes
[ "Manage", "all", "processes" ]
4d436241f389c02eb188c313190df62ab28c3763
https://github.com/calvinku96/labreporthelper/blob/4d436241f389c02eb188c313190df62ab28c3763/labreporthelper/manage.py#L95-L115
246,767
shaypal5/utilp
utilp/func/_path.py
is_pathname_valid
def is_pathname_valid(pathname: str) -> bool: """Checks if the given path name is valid. Returns ------- `True` if the passed pathname is a valid pathname for the current OS; `False` otherwise. """ # If this pathname is either not a string or is but is empty, this pathname # is invalid....
python
def is_pathname_valid(pathname: str) -> bool: """Checks if the given path name is valid. Returns ------- `True` if the passed pathname is a valid pathname for the current OS; `False` otherwise. """ # If this pathname is either not a string or is but is empty, this pathname # is invalid....
[ "def", "is_pathname_valid", "(", "pathname", ":", "str", ")", "->", "bool", ":", "# If this pathname is either not a string or is but is empty, this pathname", "# is invalid.", "try", ":", "if", "not", "isinstance", "(", "pathname", ",", "str", ")", "or", "not", "path...
Checks if the given path name is valid. Returns ------- `True` if the passed pathname is a valid pathname for the current OS; `False` otherwise.
[ "Checks", "if", "the", "given", "path", "name", "is", "valid", "." ]
932abaf8ccfd06557632b7dbebc7775da1de8430
https://github.com/shaypal5/utilp/blob/932abaf8ccfd06557632b7dbebc7775da1de8430/utilp/func/_path.py#L25-L91
246,768
shaypal5/utilp
utilp/func/_path.py
is_path_creatable
def is_path_creatable(pathname: str) -> bool: """Checks whether the given path is creatable. Returns ------- `True` if the current user has sufficient permissions to create the passed pathname; `False` otherwise. """ # Parent directory of the passed path. If empty, we substitute the current...
python
def is_path_creatable(pathname: str) -> bool: """Checks whether the given path is creatable. Returns ------- `True` if the current user has sufficient permissions to create the passed pathname; `False` otherwise. """ # Parent directory of the passed path. If empty, we substitute the current...
[ "def", "is_path_creatable", "(", "pathname", ":", "str", ")", "->", "bool", ":", "# Parent directory of the passed path. If empty, we substitute the current", "# working directory (CWD) instead.", "dirname", "=", "os", ".", "path", ".", "dirname", "(", "pathname", ")", "o...
Checks whether the given path is creatable. Returns ------- `True` if the current user has sufficient permissions to create the passed pathname; `False` otherwise.
[ "Checks", "whether", "the", "given", "path", "is", "creatable", "." ]
932abaf8ccfd06557632b7dbebc7775da1de8430
https://github.com/shaypal5/utilp/blob/932abaf8ccfd06557632b7dbebc7775da1de8430/utilp/func/_path.py#L98-L109
246,769
shaypal5/utilp
utilp/func/_path.py
path_exists_or_creatable
def path_exists_or_creatable(pathname: str) -> bool: """Checks whether the given path exists or is creatable. This function is guaranteed to _never_ raise exceptions. Returns ------- `True` if the passed pathname is a valid pathname for the current OS _and_ either currently exists or is hypoth...
python
def path_exists_or_creatable(pathname: str) -> bool: """Checks whether the given path exists or is creatable. This function is guaranteed to _never_ raise exceptions. Returns ------- `True` if the passed pathname is a valid pathname for the current OS _and_ either currently exists or is hypoth...
[ "def", "path_exists_or_creatable", "(", "pathname", ":", "str", ")", "->", "bool", ":", "try", ":", "# To prevent \"os\" module calls from raising undesirable exceptions on", "# invalid pathnames, is_pathname_valid() is explicitly called first.", "return", "is_pathname_valid", "(", ...
Checks whether the given path exists or is creatable. This function is guaranteed to _never_ raise exceptions. Returns ------- `True` if the passed pathname is a valid pathname for the current OS _and_ either currently exists or is hypothetically creatable; `False` otherwise.
[ "Checks", "whether", "the", "given", "path", "exists", "or", "is", "creatable", "." ]
932abaf8ccfd06557632b7dbebc7775da1de8430
https://github.com/shaypal5/utilp/blob/932abaf8ccfd06557632b7dbebc7775da1de8430/utilp/func/_path.py#L112-L132
246,770
shaypal5/utilp
utilp/func/_path.py
is_path_sibling_creatable
def is_path_sibling_creatable(pathname: str) -> bool: """Checks whether current user can create siblings of the given path. Returns ------- `True` if the current user has sufficient permissions to create siblings (i.e., arbitrary files in the parent directory) of the passed pathname; `False` ot...
python
def is_path_sibling_creatable(pathname: str) -> bool: """Checks whether current user can create siblings of the given path. Returns ------- `True` if the current user has sufficient permissions to create siblings (i.e., arbitrary files in the parent directory) of the passed pathname; `False` ot...
[ "def", "is_path_sibling_creatable", "(", "pathname", ":", "str", ")", "->", "bool", ":", "# Parent directory of the passed path. If empty, we substitute the current", "# working directory (CWD) instead.", "dirname", "=", "os", ".", "path", ".", "dirname", "(", "pathname", "...
Checks whether current user can create siblings of the given path. Returns ------- `True` if the current user has sufficient permissions to create siblings (i.e., arbitrary files in the parent directory) of the passed pathname; `False` otherwise.
[ "Checks", "whether", "current", "user", "can", "create", "siblings", "of", "the", "given", "path", "." ]
932abaf8ccfd06557632b7dbebc7775da1de8430
https://github.com/shaypal5/utilp/blob/932abaf8ccfd06557632b7dbebc7775da1de8430/utilp/func/_path.py#L135-L158
246,771
shaypal5/utilp
utilp/func/_path.py
path_exists_or_creatable_portable
def path_exists_or_creatable_portable(pathname: str) -> bool: """OS-portable check for whether current path exists or is creatable. This function is guaranteed to _never_ raise exceptions. Returns ------ `True` if the passed pathname is a valid pathname on the current OS _and_ either currently...
python
def path_exists_or_creatable_portable(pathname: str) -> bool: """OS-portable check for whether current path exists or is creatable. This function is guaranteed to _never_ raise exceptions. Returns ------ `True` if the passed pathname is a valid pathname on the current OS _and_ either currently...
[ "def", "path_exists_or_creatable_portable", "(", "pathname", ":", "str", ")", "->", "bool", ":", "try", ":", "# To prevent \"os\" module calls from raising undesirable exceptions on", "# invalid pathnames, is_pathname_valid() is explicitly called first.", "return", "is_pathname_valid",...
OS-portable check for whether current path exists or is creatable. This function is guaranteed to _never_ raise exceptions. Returns ------ `True` if the passed pathname is a valid pathname on the current OS _and_ either currently exists or is hypothetically creatable in a cross-platform manner...
[ "OS", "-", "portable", "check", "for", "whether", "current", "path", "exists", "or", "is", "creatable", "." ]
932abaf8ccfd06557632b7dbebc7775da1de8430
https://github.com/shaypal5/utilp/blob/932abaf8ccfd06557632b7dbebc7775da1de8430/utilp/func/_path.py#L161-L182
246,772
d0c0nnor/jocelyn
src/jocelyn/__init__.py
Q
def Q(name): """Gets a variable from the current sketch. Processing has a number of methods and variables with the same name, 'mousePressed' for example. This allows us to disambiguate. Also casts numeric values as floats to make it easier to translate code from pde to python. """ retval =...
python
def Q(name): """Gets a variable from the current sketch. Processing has a number of methods and variables with the same name, 'mousePressed' for example. This allows us to disambiguate. Also casts numeric values as floats to make it easier to translate code from pde to python. """ retval =...
[ "def", "Q", "(", "name", ")", ":", "retval", "=", "PApplet", ".", "getDeclaredField", "(", "name", ")", ".", "get", "(", "Sketch", ".", "get_instance", "(", ")", ")", "if", "isinstance", "(", "retval", ",", "(", "long", ",", "int", ")", ")", ":", ...
Gets a variable from the current sketch. Processing has a number of methods and variables with the same name, 'mousePressed' for example. This allows us to disambiguate. Also casts numeric values as floats to make it easier to translate code from pde to python.
[ "Gets", "a", "variable", "from", "the", "current", "sketch", ".", "Processing", "has", "a", "number", "of", "methods", "and", "variables", "with", "the", "same", "name", "mousePressed", "for", "example", ".", "This", "allows", "us", "to", "disambiguate", "."...
a9bb73ab89d7488cec1b1bcd6d612f7a56d9b01c
https://github.com/d0c0nnor/jocelyn/blob/a9bb73ab89d7488cec1b1bcd6d612f7a56d9b01c/src/jocelyn/__init__.py#L150-L163
246,773
edeposit/edeposit.amqp.harvester
src/edeposit/amqp/harvester/autoparser/conf_reader.py
_get_source
def _get_source(link): """ Return source of the `link` whether it is filename or url. Args: link (str): Filename or URL. Returns: str: Content. Raises: UserWarning: When the `link` couldn't be resolved. """ if link.startswith("http://") or link.startswith("https://...
python
def _get_source(link): """ Return source of the `link` whether it is filename or url. Args: link (str): Filename or URL. Returns: str: Content. Raises: UserWarning: When the `link` couldn't be resolved. """ if link.startswith("http://") or link.startswith("https://...
[ "def", "_get_source", "(", "link", ")", ":", "if", "link", ".", "startswith", "(", "\"http://\"", ")", "or", "link", ".", "startswith", "(", "\"https://\"", ")", ":", "down", "=", "httpkie", ".", "Downloader", "(", ")", "return", "down", ".", "download",...
Return source of the `link` whether it is filename or url. Args: link (str): Filename or URL. Returns: str: Content. Raises: UserWarning: When the `link` couldn't be resolved.
[ "Return", "source", "of", "the", "link", "whether", "it", "is", "filename", "or", "url", "." ]
38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e
https://github.com/edeposit/edeposit.amqp.harvester/blob/38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e/src/edeposit/amqp/harvester/autoparser/conf_reader.py#L18-L39
246,774
edeposit/edeposit.amqp.harvester
src/edeposit/amqp/harvester/autoparser/conf_reader.py
_process_config_item
def _process_config_item(item, dirname): """ Process one item from the configuration file, which contains multiple items saved as dictionary. This function reads additional data from the config and do some replacements - for example, if you specify url, it will download data from this url and s...
python
def _process_config_item(item, dirname): """ Process one item from the configuration file, which contains multiple items saved as dictionary. This function reads additional data from the config and do some replacements - for example, if you specify url, it will download data from this url and s...
[ "def", "_process_config_item", "(", "item", ",", "dirname", ")", ":", "item", "=", "copy", ".", "deepcopy", "(", "item", ")", "html", "=", "item", ".", "get", "(", "\"html\"", ",", "None", ")", "if", "not", "html", ":", "raise", "UserWarning", "(", "...
Process one item from the configuration file, which contains multiple items saved as dictionary. This function reads additional data from the config and do some replacements - for example, if you specify url, it will download data from this url and so on. Args: item (dict): Item, which wil...
[ "Process", "one", "item", "from", "the", "configuration", "file", "which", "contains", "multiple", "items", "saved", "as", "dictionary", "." ]
38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e
https://github.com/edeposit/edeposit.amqp.harvester/blob/38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e/src/edeposit/amqp/harvester/autoparser/conf_reader.py#L42-L89
246,775
edeposit/edeposit.amqp.harvester
src/edeposit/amqp/harvester/autoparser/conf_reader.py
read_config
def read_config(file_name): """ Read YAML file with configuration and pointers to example data. Args: file_name (str): Name of the file, where the configuration is stored. Returns: dict: Parsed and processed data (see :func:`_process_config_item`). Example YAML file:: html...
python
def read_config(file_name): """ Read YAML file with configuration and pointers to example data. Args: file_name (str): Name of the file, where the configuration is stored. Returns: dict: Parsed and processed data (see :func:`_process_config_item`). Example YAML file:: html...
[ "def", "read_config", "(", "file_name", ")", ":", "dirname", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "abspath", "(", "file_name", ")", ")", "dirname", "=", "os", ".", "path", ".", "relpath", "(", "dirname", ")", "# create...
Read YAML file with configuration and pointers to example data. Args: file_name (str): Name of the file, where the configuration is stored. Returns: dict: Parsed and processed data (see :func:`_process_config_item`). Example YAML file:: html: simple_xml.xml first: ...
[ "Read", "YAML", "file", "with", "configuration", "and", "pointers", "to", "example", "data", "." ]
38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e
https://github.com/edeposit/edeposit.amqp.harvester/blob/38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e/src/edeposit/amqp/harvester/autoparser/conf_reader.py#L92-L136
246,776
andrewjsledge/django-hash-filter
django_hash_filter/templatetags/hash_filter.py
hash
def hash(value, arg): """ Returns a hex-digest of the passed in value for the hash algorithm given. """ arg = str(arg).lower() if sys.version_info >= (3,0): value = value.encode("utf-8") if not arg in get_available_hashes(): raise TemplateSyntaxError("The %s hash algorithm does n...
python
def hash(value, arg): """ Returns a hex-digest of the passed in value for the hash algorithm given. """ arg = str(arg).lower() if sys.version_info >= (3,0): value = value.encode("utf-8") if not arg in get_available_hashes(): raise TemplateSyntaxError("The %s hash algorithm does n...
[ "def", "hash", "(", "value", ",", "arg", ")", ":", "arg", "=", "str", "(", "arg", ")", ".", "lower", "(", ")", "if", "sys", ".", "version_info", ">=", "(", "3", ",", "0", ")", ":", "value", "=", "value", ".", "encode", "(", "\"utf-8\"", ")", ...
Returns a hex-digest of the passed in value for the hash algorithm given.
[ "Returns", "a", "hex", "-", "digest", "of", "the", "passed", "in", "value", "for", "the", "hash", "algorithm", "given", "." ]
ea90b2903938e0733d3abfafed308a8d041d9fe7
https://github.com/andrewjsledge/django-hash-filter/blob/ea90b2903938e0733d3abfafed308a8d041d9fe7/django_hash_filter/templatetags/hash_filter.py#L13-L27
246,777
tBaxter/django-fretboard
fretboard/templatetags/paginator.py
paginator
def paginator(context, adjacent_pages=2): """ To be used in conjunction with the object_list generic view. Adds pagination context variables for use in displaying first, adjacent and last page links in addition to those created by the object_list generic view. """ current_page = context.ge...
python
def paginator(context, adjacent_pages=2): """ To be used in conjunction with the object_list generic view. Adds pagination context variables for use in displaying first, adjacent and last page links in addition to those created by the object_list generic view. """ current_page = context.ge...
[ "def", "paginator", "(", "context", ",", "adjacent_pages", "=", "2", ")", ":", "current_page", "=", "context", ".", "get", "(", "'page'", ")", "paginator", "=", "context", ".", "get", "(", "'paginator'", ")", "if", "not", "paginator", ":", "return", "pag...
To be used in conjunction with the object_list generic view. Adds pagination context variables for use in displaying first, adjacent and last page links in addition to those created by the object_list generic view.
[ "To", "be", "used", "in", "conjunction", "with", "the", "object_list", "generic", "view", ".", "Adds", "pagination", "context", "variables", "for", "use", "in", "displaying", "first", "adjacent", "and", "last", "page", "links", "in", "addition", "to", "those",...
3c3f9557089821283f315a07f3e5a57a2725ab3b
https://github.com/tBaxter/django-fretboard/blob/3c3f9557089821283f315a07f3e5a57a2725ab3b/fretboard/templatetags/paginator.py#L7-L41
246,778
genericclient/genericclient-base
genericclient_base/utils.py
parse_headers_link
def parse_headers_link(headers): """Returns the parsed header links of the response, if any.""" header = CaseInsensitiveDict(headers).get('link') l = {} if header: links = parse_link(header) for link in links: key = link.get('rel') or link.get('url') l[key] = ...
python
def parse_headers_link(headers): """Returns the parsed header links of the response, if any.""" header = CaseInsensitiveDict(headers).get('link') l = {} if header: links = parse_link(header) for link in links: key = link.get('rel') or link.get('url') l[key] = ...
[ "def", "parse_headers_link", "(", "headers", ")", ":", "header", "=", "CaseInsensitiveDict", "(", "headers", ")", ".", "get", "(", "'link'", ")", "l", "=", "{", "}", "if", "header", ":", "links", "=", "parse_link", "(", "header", ")", "for", "link", "i...
Returns the parsed header links of the response, if any.
[ "Returns", "the", "parsed", "header", "links", "of", "the", "response", "if", "any", "." ]
193f7c879c40decaf03504af633f593b88e4abc5
https://github.com/genericclient/genericclient-base/blob/193f7c879c40decaf03504af633f593b88e4abc5/genericclient_base/utils.py#L60-L74
246,779
zyga/python-phablet
phablet.py
Phablet.run
def run(self, cmd, timeout=None, key=None): """ Run a command on the phablet device using ssh :param cmd: a list of strings to execute as a command :param timeout: a timeout (in seconds) for device discovery :param key: a path to a public ssh ...
python
def run(self, cmd, timeout=None, key=None): """ Run a command on the phablet device using ssh :param cmd: a list of strings to execute as a command :param timeout: a timeout (in seconds) for device discovery :param key: a path to a public ssh ...
[ "def", "run", "(", "self", ",", "cmd", ",", "timeout", "=", "None", ",", "key", "=", "None", ")", ":", "if", "not", "isinstance", "(", "cmd", ",", "list", ")", ":", "raise", "TypeError", "(", "\"cmd needs to be a list\"", ")", "if", "not", "all", "("...
Run a command on the phablet device using ssh :param cmd: a list of strings to execute as a command :param timeout: a timeout (in seconds) for device discovery :param key: a path to a public ssh key to use for connection :returns: the exit...
[ "Run", "a", "command", "on", "the", "phablet", "device", "using", "ssh" ]
c281045dfb8b55dd2888e1efe9631f72ffc77ac8
https://github.com/zyga/python-phablet/blob/c281045dfb8b55dd2888e1efe9631f72ffc77ac8/phablet.py#L165-L187
246,780
zyga/python-phablet
phablet.py
Phablet.connect
def connect(self, timeout=None, key=None): """ Perform one-time setup procedure. :param timeout: a timeout (in seconds) for device discovery :param key: a path to a public ssh key to use for connection This method will allow you to execute :meth:`cmdline...
python
def connect(self, timeout=None, key=None): """ Perform one-time setup procedure. :param timeout: a timeout (in seconds) for device discovery :param key: a path to a public ssh key to use for connection This method will allow you to execute :meth:`cmdline...
[ "def", "connect", "(", "self", ",", "timeout", "=", "None", ",", "key", "=", "None", ")", ":", "if", "self", ".", "port", "is", "not", "None", ":", "return", "self", ".", "_wait_for_device", "(", "timeout", ")", "self", ".", "_setup_port_forwarding", "...
Perform one-time setup procedure. :param timeout: a timeout (in seconds) for device discovery :param key: a path to a public ssh key to use for connection This method will allow you to execute :meth:`cmdline()` repeatedly without incurring the extra overhead of ...
[ "Perform", "one", "-", "time", "setup", "procedure", "." ]
c281045dfb8b55dd2888e1efe9631f72ffc77ac8
https://github.com/zyga/python-phablet/blob/c281045dfb8b55dd2888e1efe9631f72ffc77ac8/phablet.py#L189-L213
246,781
kodexlab/reliure
reliure/options.py
Option.FromType
def FromType(name, otype): """ ValueOption subclasses factory, creates a convenient option to store data from a given Type. attribute precedence : * ``|attrs| > 0`` (``multi`` and ``uniq`` are implicit) => NotImplementedError * ``uniq`` (``multi`` is implicit) => NotImp...
python
def FromType(name, otype): """ ValueOption subclasses factory, creates a convenient option to store data from a given Type. attribute precedence : * ``|attrs| > 0`` (``multi`` and ``uniq`` are implicit) => NotImplementedError * ``uniq`` (``multi`` is implicit) => NotImp...
[ "def", "FromType", "(", "name", ",", "otype", ")", ":", "if", "otype", ".", "attrs", "is", "not", "None", "and", "len", "(", "otype", ".", "attrs", ")", ":", "raise", "NotImplementedError", "(", "\"for otype, options can't have attributs\"", ")", "#return Vect...
ValueOption subclasses factory, creates a convenient option to store data from a given Type. attribute precedence : * ``|attrs| > 0`` (``multi`` and ``uniq`` are implicit) => NotImplementedError * ``uniq`` (``multi`` is implicit) => NotImplementedError * ``multi`` and `...
[ "ValueOption", "subclasses", "factory", "creates", "a", "convenient", "option", "to", "store", "data", "from", "a", "given", "Type", "." ]
0450c7a9254c5c003162738458bbe0c49e777ba5
https://github.com/kodexlab/reliure/blob/0450c7a9254c5c003162738458bbe0c49e777ba5/reliure/options.py#L24-L50
246,782
heikomuller/sco-datastore
scodata/datastore.py
ObjectStore.upsert_object_property
def upsert_object_property(self, identifier, properties, ignore_constraints=False): """Manipulate an object's property set. Inserts or updates properties in given dictionary. If a property key does not exist in the object's property set it is created. If the value is None an existing property is...
python
def upsert_object_property(self, identifier, properties, ignore_constraints=False): """Manipulate an object's property set. Inserts or updates properties in given dictionary. If a property key does not exist in the object's property set it is created. If the value is None an existing property is...
[ "def", "upsert_object_property", "(", "self", ",", "identifier", ",", "properties", ",", "ignore_constraints", "=", "False", ")", ":", "# Retrieve the object with the gievn identifier. This is a (sub-)class", "# of ObjectHandle", "obj", "=", "self", ".", "get_object", "(", ...
Manipulate an object's property set. Inserts or updates properties in given dictionary. If a property key does not exist in the object's property set it is created. If the value is None an existing property is deleted. Existing object properties that are not present in the given propert...
[ "Manipulate", "an", "object", "s", "property", "set", ".", "Inserts", "or", "updates", "properties", "in", "given", "dictionary", ".", "If", "a", "property", "key", "does", "not", "exist", "in", "the", "object", "s", "property", "set", "it", "is", "created...
7180a6b51150667e47629da566aedaa742e39342
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/datastore.py#L334-L386
246,783
heikomuller/sco-datastore
scodata/datastore.py
MongoDBStore.delete_object
def delete_object(self, identifier, erase=False): """Delete the entry with given identifier in the database. Returns the handle for the deleted object or None if object identifier is unknown. If the read-only property of the object is set to true a ValueError is raised. Paramet...
python
def delete_object(self, identifier, erase=False): """Delete the entry with given identifier in the database. Returns the handle for the deleted object or None if object identifier is unknown. If the read-only property of the object is set to true a ValueError is raised. Paramet...
[ "def", "delete_object", "(", "self", ",", "identifier", ",", "erase", "=", "False", ")", ":", "# Get object to ensure that it exists.", "db_object", "=", "self", ".", "get_object", "(", "identifier", ")", "# Set active flag to False if object exists.", "if", "db_object"...
Delete the entry with given identifier in the database. Returns the handle for the deleted object or None if object identifier is unknown. If the read-only property of the object is set to true a ValueError is raised. Parameters ---------- identifier : string ...
[ "Delete", "the", "entry", "with", "given", "identifier", "in", "the", "database", ".", "Returns", "the", "handle", "for", "the", "deleted", "object", "or", "None", "if", "object", "identifier", "is", "unknown", "." ]
7180a6b51150667e47629da566aedaa742e39342
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/datastore.py#L418-L454
246,784
heikomuller/sco-datastore
scodata/datastore.py
MongoDBStore.get_object
def get_object(self, identifier, include_inactive=False): """Retrieve object with given identifier from the database. Parameters ---------- identifier : string Unique object identifier include_inactive : Boolean Flag indicating whether inactive (i.e., del...
python
def get_object(self, identifier, include_inactive=False): """Retrieve object with given identifier from the database. Parameters ---------- identifier : string Unique object identifier include_inactive : Boolean Flag indicating whether inactive (i.e., del...
[ "def", "get_object", "(", "self", ",", "identifier", ",", "include_inactive", "=", "False", ")", ":", "# Find all objects with given identifier. The result size is expected", "# to be zero or one", "query", "=", "{", "'_id'", ":", "identifier", "}", "if", "not", "includ...
Retrieve object with given identifier from the database. Parameters ---------- identifier : string Unique object identifier include_inactive : Boolean Flag indicating whether inactive (i.e., deleted) object should be included in the search (i.e., retu...
[ "Retrieve", "object", "with", "given", "identifier", "from", "the", "database", "." ]
7180a6b51150667e47629da566aedaa742e39342
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/datastore.py#L488-L515
246,785
heikomuller/sco-datastore
scodata/datastore.py
MongoDBStore.insert_object
def insert_object(self, db_object): """Create new entry in the database. Parameters ---------- db_object : (Sub-class of)ObjectHandle """ # Create object using the to_dict() method. obj = self.to_dict(db_object) obj['active'] = True self.collecti...
python
def insert_object(self, db_object): """Create new entry in the database. Parameters ---------- db_object : (Sub-class of)ObjectHandle """ # Create object using the to_dict() method. obj = self.to_dict(db_object) obj['active'] = True self.collecti...
[ "def", "insert_object", "(", "self", ",", "db_object", ")", ":", "# Create object using the to_dict() method.", "obj", "=", "self", ".", "to_dict", "(", "db_object", ")", "obj", "[", "'active'", "]", "=", "True", "self", ".", "collection", ".", "insert_one", ...
Create new entry in the database. Parameters ---------- db_object : (Sub-class of)ObjectHandle
[ "Create", "new", "entry", "in", "the", "database", "." ]
7180a6b51150667e47629da566aedaa742e39342
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/datastore.py#L517-L527
246,786
heikomuller/sco-datastore
scodata/datastore.py
MongoDBStore.list_objects
def list_objects(self, query=None, limit=-1, offset=-1): """List of all objects in the database. Optinal parameter limit and offset for pagination. A dictionary of key,value-pairs can be given as addictional query condition for document properties. Parameters ---------- ...
python
def list_objects(self, query=None, limit=-1, offset=-1): """List of all objects in the database. Optinal parameter limit and offset for pagination. A dictionary of key,value-pairs can be given as addictional query condition for document properties. Parameters ---------- ...
[ "def", "list_objects", "(", "self", ",", "query", "=", "None", ",", "limit", "=", "-", "1", ",", "offset", "=", "-", "1", ")", ":", "result", "=", "[", "]", "# Build the document query", "doc", "=", "{", "'active'", ":", "True", "}", "if", "not", "...
List of all objects in the database. Optinal parameter limit and offset for pagination. A dictionary of key,value-pairs can be given as addictional query condition for document properties. Parameters ---------- query : Dictionary Filter objects by property-value pair...
[ "List", "of", "all", "objects", "in", "the", "database", ".", "Optinal", "parameter", "limit", "and", "offset", "for", "pagination", ".", "A", "dictionary", "of", "key", "value", "-", "pairs", "can", "be", "given", "as", "addictional", "query", "condition", ...
7180a6b51150667e47629da566aedaa742e39342
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/datastore.py#L529-L565
246,787
heikomuller/sco-datastore
scodata/datastore.py
MongoDBStore.to_dict
def to_dict(self, db_obj): """Create a Json-like dictionary for objects managed by this object store. Parameters ---------- db_obj : (Sub-class of)ObjectHandle Returns ------- (JSON) Json-like object, i.e., dictionary. """ # B...
python
def to_dict(self, db_obj): """Create a Json-like dictionary for objects managed by this object store. Parameters ---------- db_obj : (Sub-class of)ObjectHandle Returns ------- (JSON) Json-like object, i.e., dictionary. """ # B...
[ "def", "to_dict", "(", "self", ",", "db_obj", ")", ":", "# Base Json serialization for database objects", "return", "{", "'_id'", ":", "db_obj", ".", "identifier", ",", "'timestamp'", ":", "str", "(", "db_obj", ".", "timestamp", ".", "isoformat", "(", ")", ")"...
Create a Json-like dictionary for objects managed by this object store. Parameters ---------- db_obj : (Sub-class of)ObjectHandle Returns ------- (JSON) Json-like object, i.e., dictionary.
[ "Create", "a", "Json", "-", "like", "dictionary", "for", "objects", "managed", "by", "this", "object", "store", "." ]
7180a6b51150667e47629da566aedaa742e39342
https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/datastore.py#L582-L599
246,788
praekeltfoundation/seed-service-rating
ratings/tasks.py
SendInviteMessage.compile_msg_payload
def compile_msg_payload(self, invite): """ Determine recipient, message content, return it as a dict that can be Posted to the message sender """ self.l.info("Compiling the outbound message payload") update_invite = False # Determine the recipient address if "to_...
python
def compile_msg_payload(self, invite): """ Determine recipient, message content, return it as a dict that can be Posted to the message sender """ self.l.info("Compiling the outbound message payload") update_invite = False # Determine the recipient address if "to_...
[ "def", "compile_msg_payload", "(", "self", ",", "invite", ")", ":", "self", ".", "l", ".", "info", "(", "\"Compiling the outbound message payload\"", ")", "update_invite", "=", "False", "# Determine the recipient address", "if", "\"to_addr\"", "in", "invite", ".", "...
Determine recipient, message content, return it as a dict that can be Posted to the message sender
[ "Determine", "recipient", "message", "content", "return", "it", "as", "a", "dict", "that", "can", "be", "Posted", "to", "the", "message", "sender" ]
73f7974a5bcb6e1f32a756be5274b200084c2670
https://github.com/praekeltfoundation/seed-service-rating/blob/73f7974a5bcb6e1f32a756be5274b200084c2670/ratings/tasks.py#L60-L100
246,789
praekeltfoundation/seed-service-rating
ratings/tasks.py
SendInviteMessage.send_message
def send_message(self, payload): """ Create a post request to the message sender """ self.l.info("Creating outbound message request") result = ms_client.create_outbound(payload) self.l.info("Created outbound message request") return result
python
def send_message(self, payload): """ Create a post request to the message sender """ self.l.info("Creating outbound message request") result = ms_client.create_outbound(payload) self.l.info("Created outbound message request") return result
[ "def", "send_message", "(", "self", ",", "payload", ")", ":", "self", ".", "l", ".", "info", "(", "\"Creating outbound message request\"", ")", "result", "=", "ms_client", ".", "create_outbound", "(", "payload", ")", "self", ".", "l", ".", "info", "(", "\"...
Create a post request to the message sender
[ "Create", "a", "post", "request", "to", "the", "message", "sender" ]
73f7974a5bcb6e1f32a756be5274b200084c2670
https://github.com/praekeltfoundation/seed-service-rating/blob/73f7974a5bcb6e1f32a756be5274b200084c2670/ratings/tasks.py#L102-L108
246,790
praekeltfoundation/seed-service-rating
ratings/tasks.py
SendInviteMessage.run
def run(self, invite_id, **kwargs): """ Sends a message about service rating to invitee """ self.l = self.get_logger(**kwargs) self.l.info("Looking up the invite") invite = Invite.objects.get(id=invite_id) msg_payload = self.compile_msg_payload(invite) result = se...
python
def run(self, invite_id, **kwargs): """ Sends a message about service rating to invitee """ self.l = self.get_logger(**kwargs) self.l.info("Looking up the invite") invite = Invite.objects.get(id=invite_id) msg_payload = self.compile_msg_payload(invite) result = se...
[ "def", "run", "(", "self", ",", "invite_id", ",", "*", "*", "kwargs", ")", ":", "self", ".", "l", "=", "self", ".", "get_logger", "(", "*", "*", "kwargs", ")", "self", ".", "l", ".", "info", "(", "\"Looking up the invite\"", ")", "invite", "=", "In...
Sends a message about service rating to invitee
[ "Sends", "a", "message", "about", "service", "rating", "to", "invitee" ]
73f7974a5bcb6e1f32a756be5274b200084c2670
https://github.com/praekeltfoundation/seed-service-rating/blob/73f7974a5bcb6e1f32a756be5274b200084c2670/ratings/tasks.py#L110-L121
246,791
praekelt/vumi-http-api
vumi_http_api/concurrency_limiter.py
ConcurrencyLimitManager.stop
def stop(self, key): """ Stop a concurrent operation. This gets the concurrency limiter for the given key (creating it if necessary) and stops a concurrent operation on it. If the concurrency limiter is empty, it is deleted. """ self._get_limiter(key).stop() ...
python
def stop(self, key): """ Stop a concurrent operation. This gets the concurrency limiter for the given key (creating it if necessary) and stops a concurrent operation on it. If the concurrency limiter is empty, it is deleted. """ self._get_limiter(key).stop() ...
[ "def", "stop", "(", "self", ",", "key", ")", ":", "self", ".", "_get_limiter", "(", "key", ")", ".", "stop", "(", ")", "self", ".", "_cleanup_limiter", "(", "key", ")" ]
Stop a concurrent operation. This gets the concurrency limiter for the given key (creating it if necessary) and stops a concurrent operation on it. If the concurrency limiter is empty, it is deleted.
[ "Stop", "a", "concurrent", "operation", "." ]
0d7cf1cb71794c93272c19095cf8c37f4c250a59
https://github.com/praekelt/vumi-http-api/blob/0d7cf1cb71794c93272c19095cf8c37f4c250a59/vumi_http_api/concurrency_limiter.py#L143-L152
246,792
minhhoit/yacms
yacms/core/templatetags/yacms_tags.py
fields_for
def fields_for(context, form, template="includes/form_fields.html"): """ Renders fields for a form with an optional template choice. """ context["form_for_fields"] = form return get_template(template).render(context)
python
def fields_for(context, form, template="includes/form_fields.html"): """ Renders fields for a form with an optional template choice. """ context["form_for_fields"] = form return get_template(template).render(context)
[ "def", "fields_for", "(", "context", ",", "form", ",", "template", "=", "\"includes/form_fields.html\"", ")", ":", "context", "[", "\"form_for_fields\"", "]", "=", "form", "return", "get_template", "(", "template", ")", ".", "render", "(", "context", ")" ]
Renders fields for a form with an optional template choice.
[ "Renders", "fields", "for", "a", "form", "with", "an", "optional", "template", "choice", "." ]
2921b706b7107c6e8c5f2bbf790ff11f85a2167f
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/core/templatetags/yacms_tags.py#L104-L109
246,793
minhhoit/yacms
yacms/core/templatetags/yacms_tags.py
sort_by
def sort_by(items, attr): """ General sort filter - sorts by either attribute or key. """ def key_func(item): try: return getattr(item, attr) except AttributeError: try: return item[attr] except TypeError: getattr(item, ...
python
def sort_by(items, attr): """ General sort filter - sorts by either attribute or key. """ def key_func(item): try: return getattr(item, attr) except AttributeError: try: return item[attr] except TypeError: getattr(item, ...
[ "def", "sort_by", "(", "items", ",", "attr", ")", ":", "def", "key_func", "(", "item", ")", ":", "try", ":", "return", "getattr", "(", "item", ",", "attr", ")", "except", "AttributeError", ":", "try", ":", "return", "item", "[", "attr", "]", "except"...
General sort filter - sorts by either attribute or key.
[ "General", "sort", "filter", "-", "sorts", "by", "either", "attribute", "or", "key", "." ]
2921b706b7107c6e8c5f2bbf790ff11f85a2167f
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/core/templatetags/yacms_tags.py#L121-L133
246,794
minhhoit/yacms
yacms/core/templatetags/yacms_tags.py
gravatar_url
def gravatar_url(email, size=32): """ Return the full URL for a Gravatar given an email hash. """ bits = (md5(email.lower().encode("utf-8")).hexdigest(), size) return "//www.gravatar.com/avatar/%s?s=%s&d=identicon&r=PG" % bits
python
def gravatar_url(email, size=32): """ Return the full URL for a Gravatar given an email hash. """ bits = (md5(email.lower().encode("utf-8")).hexdigest(), size) return "//www.gravatar.com/avatar/%s?s=%s&d=identicon&r=PG" % bits
[ "def", "gravatar_url", "(", "email", ",", "size", "=", "32", ")", ":", "bits", "=", "(", "md5", "(", "email", ".", "lower", "(", ")", ".", "encode", "(", "\"utf-8\"", ")", ")", ".", "hexdigest", "(", ")", ",", "size", ")", "return", "\"//www.gravat...
Return the full URL for a Gravatar given an email hash.
[ "Return", "the", "full", "URL", "for", "a", "Gravatar", "given", "an", "email", "hash", "." ]
2921b706b7107c6e8c5f2bbf790ff11f85a2167f
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/core/templatetags/yacms_tags.py#L203-L208
246,795
minhhoit/yacms
yacms/core/templatetags/yacms_tags.py
metablock
def metablock(parsed): """ Remove HTML tags, entities and superfluous characters from meta blocks. """ parsed = " ".join(parsed.replace("\n", "").split()).replace(" ,", ",") return escape(strip_tags(decode_entities(parsed)))
python
def metablock(parsed): """ Remove HTML tags, entities and superfluous characters from meta blocks. """ parsed = " ".join(parsed.replace("\n", "").split()).replace(" ,", ",") return escape(strip_tags(decode_entities(parsed)))
[ "def", "metablock", "(", "parsed", ")", ":", "parsed", "=", "\" \"", ".", "join", "(", "parsed", ".", "replace", "(", "\"\\n\"", ",", "\"\"", ")", ".", "split", "(", ")", ")", ".", "replace", "(", "\" ,\"", ",", "\",\"", ")", "return", "escape", "(...
Remove HTML tags, entities and superfluous characters from meta blocks.
[ "Remove", "HTML", "tags", "entities", "and", "superfluous", "characters", "from", "meta", "blocks", "." ]
2921b706b7107c6e8c5f2bbf790ff11f85a2167f
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/core/templatetags/yacms_tags.py#L212-L218
246,796
minhhoit/yacms
yacms/core/templatetags/yacms_tags.py
pagination_for
def pagination_for(context, current_page, page_var="page", exclude_vars=""): """ Include the pagination template and data for persisting querystring in pagination links. Can also contain a comma separated string of var names in the current querystring to exclude from the pagination links, via the ``...
python
def pagination_for(context, current_page, page_var="page", exclude_vars=""): """ Include the pagination template and data for persisting querystring in pagination links. Can also contain a comma separated string of var names in the current querystring to exclude from the pagination links, via the ``...
[ "def", "pagination_for", "(", "context", ",", "current_page", ",", "page_var", "=", "\"page\"", ",", "exclude_vars", "=", "\"\"", ")", ":", "querystring", "=", "context", "[", "\"request\"", "]", ".", "GET", ".", "copy", "(", ")", "exclude_vars", "=", "[",...
Include the pagination template and data for persisting querystring in pagination links. Can also contain a comma separated string of var names in the current querystring to exclude from the pagination links, via the ``exclude_vars`` arg.
[ "Include", "the", "pagination", "template", "and", "data", "for", "persisting", "querystring", "in", "pagination", "links", ".", "Can", "also", "contain", "a", "comma", "separated", "string", "of", "var", "names", "in", "the", "current", "querystring", "to", "...
2921b706b7107c6e8c5f2bbf790ff11f85a2167f
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/core/templatetags/yacms_tags.py#L222-L239
246,797
minhhoit/yacms
yacms/core/templatetags/yacms_tags.py
search_form
def search_form(context, search_model_names=None): """ Includes the search form with a list of models to use as choices for filtering the search by. Models should be a string with models in the format ``app_label.model_name`` separated by spaces. The string ``all`` can also be used, in which case th...
python
def search_form(context, search_model_names=None): """ Includes the search form with a list of models to use as choices for filtering the search by. Models should be a string with models in the format ``app_label.model_name`` separated by spaces. The string ``all`` can also be used, in which case th...
[ "def", "search_form", "(", "context", ",", "search_model_names", "=", "None", ")", ":", "template_vars", "=", "{", "\"request\"", ":", "context", "[", "\"request\"", "]", ",", "}", "if", "not", "search_model_names", "or", "not", "settings", ".", "SEARCH_MODEL_...
Includes the search form with a list of models to use as choices for filtering the search by. Models should be a string with models in the format ``app_label.model_name`` separated by spaces. The string ``all`` can also be used, in which case the models defined by the ``SEARCH_MODEL_CHOICES`` setting wi...
[ "Includes", "the", "search", "form", "with", "a", "list", "of", "models", "to", "use", "as", "choices", "for", "filtering", "the", "search", "by", ".", "Models", "should", "be", "a", "string", "with", "models", "in", "the", "format", "app_label", ".", "m...
2921b706b7107c6e8c5f2bbf790ff11f85a2167f
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/core/templatetags/yacms_tags.py#L243-L270
246,798
minhhoit/yacms
yacms/core/templatetags/yacms_tags.py
richtext_filters
def richtext_filters(content): """ Takes a value edited via the WYSIWYG editor, and passes it through each of the functions specified by the RICHTEXT_FILTERS setting. """ for filter_name in settings.RICHTEXT_FILTERS: filter_func = import_dotted_path(filter_name) content = filter_func...
python
def richtext_filters(content): """ Takes a value edited via the WYSIWYG editor, and passes it through each of the functions specified by the RICHTEXT_FILTERS setting. """ for filter_name in settings.RICHTEXT_FILTERS: filter_func = import_dotted_path(filter_name) content = filter_func...
[ "def", "richtext_filters", "(", "content", ")", ":", "for", "filter_name", "in", "settings", ".", "RICHTEXT_FILTERS", ":", "filter_func", "=", "import_dotted_path", "(", "filter_name", ")", "content", "=", "filter_func", "(", "content", ")", "return", "content" ]
Takes a value edited via the WYSIWYG editor, and passes it through each of the functions specified by the RICHTEXT_FILTERS setting.
[ "Takes", "a", "value", "edited", "via", "the", "WYSIWYG", "editor", "and", "passes", "it", "through", "each", "of", "the", "functions", "specified", "by", "the", "RICHTEXT_FILTERS", "setting", "." ]
2921b706b7107c6e8c5f2bbf790ff11f85a2167f
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/core/templatetags/yacms_tags.py#L466-L474
246,799
minhhoit/yacms
yacms/core/templatetags/yacms_tags.py
editable
def editable(parsed, context, token): """ Add the required HTML to the parsed content for in-line editing, such as the icon and edit form if the object is deemed to be editable - either it has an ``editable`` method which returns ``True``, or the logged in user has change permissions for the mod...
python
def editable(parsed, context, token): """ Add the required HTML to the parsed content for in-line editing, such as the icon and edit form if the object is deemed to be editable - either it has an ``editable`` method which returns ``True``, or the logged in user has change permissions for the mod...
[ "def", "editable", "(", "parsed", ",", "context", ",", "token", ")", ":", "def", "parse_field", "(", "field", ")", ":", "field", "=", "field", ".", "split", "(", "\".\"", ")", "obj", "=", "context", ".", "get", "(", "field", ".", "pop", "(", "0", ...
Add the required HTML to the parsed content for in-line editing, such as the icon and edit form if the object is deemed to be editable - either it has an ``editable`` method which returns ``True``, or the logged in user has change permissions for the model.
[ "Add", "the", "required", "HTML", "to", "the", "parsed", "content", "for", "in", "-", "line", "editing", "such", "as", "the", "icon", "and", "edit", "form", "if", "the", "object", "is", "deemed", "to", "be", "editable", "-", "either", "it", "has", "an"...
2921b706b7107c6e8c5f2bbf790ff11f85a2167f
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/core/templatetags/yacms_tags.py#L478-L514