partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
serialize_action
This function returns the conventional form of the actions.
nautilus/conventions/actions.py
def serialize_action(action_type, payload, **extra_fields): """ This function returns the conventional form of the actions. """ action_dict = dict( action_type=action_type, payload=payload, **extra_fields ) # return a serializable version return json.dumps(action...
def serialize_action(action_type, payload, **extra_fields): """ This function returns the conventional form of the actions. """ action_dict = dict( action_type=action_type, payload=payload, **extra_fields ) # return a serializable version return json.dumps(action...
[ "This", "function", "returns", "the", "conventional", "form", "of", "the", "actions", "." ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/conventions/actions.py#L27-L37
[ "def", "serialize_action", "(", "action_type", ",", "payload", ",", "*", "*", "extra_fields", ")", ":", "action_dict", "=", "dict", "(", "action_type", "=", "action_type", ",", "payload", "=", "payload", ",", "*", "*", "extra_fields", ")", "# return a serializ...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
fields_for_model
This function returns the fields for a schema that matches the provided nautilus model. Args: model (nautilus.model.BaseModel): The model to base the field list on Returns: (dict<field_name: str, graphqlType>): A mapping of field names to graphql types
nautilus/api/util/fields_for_model.py
def fields_for_model(model): """ This function returns the fields for a schema that matches the provided nautilus model. Args: model (nautilus.model.BaseModel): The model to base the field list on Returns: (dict<field_name: str, graphqlType>): A mapping of f...
def fields_for_model(model): """ This function returns the fields for a schema that matches the provided nautilus model. Args: model (nautilus.model.BaseModel): The model to base the field list on Returns: (dict<field_name: str, graphqlType>): A mapping of f...
[ "This", "function", "returns", "the", "fields", "for", "a", "schema", "that", "matches", "the", "provided", "nautilus", "model", "." ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/api/util/fields_for_model.py#L4-L21
[ "def", "fields_for_model", "(", "model", ")", ":", "# the attribute arguments (no filters)", "args", "=", "{", "field", ".", "name", ".", "lower", "(", ")", ":", "convert_peewee_field", "(", "field", ")", "for", "field", "in", "model", ".", "fields", "(", ")...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
create_connection_model
Create an SQL Alchemy table that connects the provides services
nautilus/models/util.py
def create_connection_model(service): """ Create an SQL Alchemy table that connects the provides services """ # the services connected services = service._services # the mixins / base for the model bases = (BaseModel,) # the fields of the derived attributes = {model_service_name(service): f...
def create_connection_model(service): """ Create an SQL Alchemy table that connects the provides services """ # the services connected services = service._services # the mixins / base for the model bases = (BaseModel,) # the fields of the derived attributes = {model_service_name(service): f...
[ "Create", "an", "SQL", "Alchemy", "table", "that", "connects", "the", "provides", "services" ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/models/util.py#L5-L16
[ "def", "create_connection_model", "(", "service", ")", ":", "# the services connected", "services", "=", "service", ".", "_services", "# the mixins / base for the model", "bases", "=", "(", "BaseModel", ",", ")", "# the fields of the derived", "attributes", "=", "{", "m...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
create_handler
This factory returns an action handler that creates a new instance of the specified model when a create action is recieved, assuming the action follows nautilus convetions. Args: Model (nautilus.BaseModel): The model to create when the action received. Retur...
nautilus/network/events/actionHandlers/createHandler.py
def create_handler(Model, name=None, **kwds): """ This factory returns an action handler that creates a new instance of the specified model when a create action is recieved, assuming the action follows nautilus convetions. Args: Model (nautilus.BaseModel): The model to c...
def create_handler(Model, name=None, **kwds): """ This factory returns an action handler that creates a new instance of the specified model when a create action is recieved, assuming the action follows nautilus convetions. Args: Model (nautilus.BaseModel): The model to c...
[ "This", "factory", "returns", "an", "action", "handler", "that", "creates", "a", "new", "instance", "of", "the", "specified", "model", "when", "a", "create", "action", "is", "recieved", "assuming", "the", "action", "follows", "nautilus", "convetions", "." ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/network/events/actionHandlers/createHandler.py#L12-L83
[ "def", "create_handler", "(", "Model", ",", "name", "=", "None", ",", "*", "*", "kwds", ")", ":", "async", "def", "action_handler", "(", "service", ",", "action_type", ",", "payload", ",", "props", ",", "notify", "=", "True", ",", "*", "*", "kwds", "...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
GraphEntity._has_id
Equality checks are overwitten to perform the actual check in a semantic way.
nautilus/api/util/graph_entity.py
async def _has_id(self, *args, **kwds): """ Equality checks are overwitten to perform the actual check in a semantic way. """ # if there is only one positional argument if len(args) == 1: # parse the appropriate query result = await parse_s...
async def _has_id(self, *args, **kwds): """ Equality checks are overwitten to perform the actual check in a semantic way. """ # if there is only one positional argument if len(args) == 1: # parse the appropriate query result = await parse_s...
[ "Equality", "checks", "are", "overwitten", "to", "perform", "the", "actual", "check", "in", "a", "semantic", "way", "." ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/api/util/graph_entity.py#L102-L122
[ "async", "def", "_has_id", "(", "self", ",", "*", "args", ",", "*", "*", "kwds", ")", ":", "# if there is only one positional argument", "if", "len", "(", "args", ")", "==", "1", ":", "# parse the appropriate query", "result", "=", "await", "parse_string", "("...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
GraphEntity._find_id
This method performs a depth-first search for the given uid in the dictionary of results.
nautilus/api/util/graph_entity.py
def _find_id(self, result, uid): """ This method performs a depth-first search for the given uid in the dictionary of results. """ # if the result is a list if isinstance(result, list): # if the list has a valid entry if any([self._find_id(value, uid) ...
def _find_id(self, result, uid): """ This method performs a depth-first search for the given uid in the dictionary of results. """ # if the result is a list if isinstance(result, list): # if the list has a valid entry if any([self._find_id(value, uid) ...
[ "This", "method", "performs", "a", "depth", "-", "first", "search", "for", "the", "given", "uid", "in", "the", "dictionary", "of", "results", "." ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/api/util/graph_entity.py#L126-L167
[ "def", "_find_id", "(", "self", ",", "result", ",", "uid", ")", ":", "# if the result is a list", "if", "isinstance", "(", "result", ",", "list", ")", ":", "# if the list has a valid entry", "if", "any", "(", "[", "self", ".", "_find_id", "(", "value", ",", ...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
Block.add_before
Returns a builder inserting a new block before the current block
src/configupdater/configupdater.py
def add_before(self): """Returns a builder inserting a new block before the current block""" idx = self._container.structure.index(self) return BlockBuilder(self._container, idx)
def add_before(self): """Returns a builder inserting a new block before the current block""" idx = self._container.structure.index(self) return BlockBuilder(self._container, idx)
[ "Returns", "a", "builder", "inserting", "a", "new", "block", "before", "the", "current", "block" ]
pyscaffold/configupdater
python
https://github.com/pyscaffold/configupdater/blob/6ebac0b1fa7b8222baacdd4991d18cfc61659f84/src/configupdater/configupdater.py#L115-L118
[ "def", "add_before", "(", "self", ")", ":", "idx", "=", "self", ".", "_container", ".", "structure", ".", "index", "(", "self", ")", "return", "BlockBuilder", "(", "self", ".", "_container", ",", "idx", ")" ]
6ebac0b1fa7b8222baacdd4991d18cfc61659f84
train
Block.add_after
Returns a builder inserting a new block after the current block
src/configupdater/configupdater.py
def add_after(self): """Returns a builder inserting a new block after the current block""" idx = self._container.structure.index(self) return BlockBuilder(self._container, idx+1)
def add_after(self): """Returns a builder inserting a new block after the current block""" idx = self._container.structure.index(self) return BlockBuilder(self._container, idx+1)
[ "Returns", "a", "builder", "inserting", "a", "new", "block", "after", "the", "current", "block" ]
pyscaffold/configupdater
python
https://github.com/pyscaffold/configupdater/blob/6ebac0b1fa7b8222baacdd4991d18cfc61659f84/src/configupdater/configupdater.py#L121-L124
[ "def", "add_after", "(", "self", ")", ":", "idx", "=", "self", ".", "_container", ".", "structure", ".", "index", "(", "self", ")", "return", "BlockBuilder", "(", "self", ".", "_container", ",", "idx", "+", "1", ")" ]
6ebac0b1fa7b8222baacdd4991d18cfc61659f84
train
BlockBuilder.comment
Creates a comment block Args: text (str): content of comment without # comment_prefix (str): character indicating start of comment Returns: self for chaining
src/configupdater/configupdater.py
def comment(self, text, comment_prefix='#'): """Creates a comment block Args: text (str): content of comment without # comment_prefix (str): character indicating start of comment Returns: self for chaining """ comment = Comment(self._containe...
def comment(self, text, comment_prefix='#'): """Creates a comment block Args: text (str): content of comment without # comment_prefix (str): character indicating start of comment Returns: self for chaining """ comment = Comment(self._containe...
[ "Creates", "a", "comment", "block" ]
pyscaffold/configupdater
python
https://github.com/pyscaffold/configupdater/blob/6ebac0b1fa7b8222baacdd4991d18cfc61659f84/src/configupdater/configupdater.py#L133-L151
[ "def", "comment", "(", "self", ",", "text", ",", "comment_prefix", "=", "'#'", ")", ":", "comment", "=", "Comment", "(", "self", ".", "_container", ")", "if", "not", "text", ".", "startswith", "(", "comment_prefix", ")", ":", "text", "=", "\"{} {}\"", ...
6ebac0b1fa7b8222baacdd4991d18cfc61659f84
train
BlockBuilder.section
Creates a section block Args: section (str or :class:`Section`): name of section or object Returns: self for chaining
src/configupdater/configupdater.py
def section(self, section): """Creates a section block Args: section (str or :class:`Section`): name of section or object Returns: self for chaining """ if not isinstance(self._container, ConfigUpdater): raise ValueError("Sections can only be...
def section(self, section): """Creates a section block Args: section (str or :class:`Section`): name of section or object Returns: self for chaining """ if not isinstance(self._container, ConfigUpdater): raise ValueError("Sections can only be...
[ "Creates", "a", "section", "block" ]
pyscaffold/configupdater
python
https://github.com/pyscaffold/configupdater/blob/6ebac0b1fa7b8222baacdd4991d18cfc61659f84/src/configupdater/configupdater.py#L153-L174
[ "def", "section", "(", "self", ",", "section", ")", ":", "if", "not", "isinstance", "(", "self", ".", "_container", ",", "ConfigUpdater", ")", ":", "raise", "ValueError", "(", "\"Sections can only be added at section level!\"", ")", "if", "isinstance", "(", "sec...
6ebac0b1fa7b8222baacdd4991d18cfc61659f84
train
BlockBuilder.space
Creates a vertical space of newlines Args: newlines (int): number of empty lines Returns: self for chaining
src/configupdater/configupdater.py
def space(self, newlines=1): """Creates a vertical space of newlines Args: newlines (int): number of empty lines Returns: self for chaining """ space = Space() for line in range(newlines): space.add_line('\n') self._container....
def space(self, newlines=1): """Creates a vertical space of newlines Args: newlines (int): number of empty lines Returns: self for chaining """ space = Space() for line in range(newlines): space.add_line('\n') self._container....
[ "Creates", "a", "vertical", "space", "of", "newlines" ]
pyscaffold/configupdater
python
https://github.com/pyscaffold/configupdater/blob/6ebac0b1fa7b8222baacdd4991d18cfc61659f84/src/configupdater/configupdater.py#L176-L190
[ "def", "space", "(", "self", ",", "newlines", "=", "1", ")", ":", "space", "=", "Space", "(", ")", "for", "line", "in", "range", "(", "newlines", ")", ":", "space", ".", "add_line", "(", "'\\n'", ")", "self", ".", "_container", ".", "structure", "....
6ebac0b1fa7b8222baacdd4991d18cfc61659f84
train
BlockBuilder.option
Creates a new option inside a section Args: key (str): key of the option value (str or None): value of the option **kwargs: are passed to the constructor of :class:`Option` Returns: self for chaining
src/configupdater/configupdater.py
def option(self, key, value=None, **kwargs): """Creates a new option inside a section Args: key (str): key of the option value (str or None): value of the option **kwargs: are passed to the constructor of :class:`Option` Returns: self for chainin...
def option(self, key, value=None, **kwargs): """Creates a new option inside a section Args: key (str): key of the option value (str or None): value of the option **kwargs: are passed to the constructor of :class:`Option` Returns: self for chainin...
[ "Creates", "a", "new", "option", "inside", "a", "section" ]
pyscaffold/configupdater
python
https://github.com/pyscaffold/configupdater/blob/6ebac0b1fa7b8222baacdd4991d18cfc61659f84/src/configupdater/configupdater.py#L192-L209
[ "def", "option", "(", "self", ",", "key", ",", "value", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "not", "isinstance", "(", "self", ".", "_container", ",", "Section", ")", ":", "raise", "ValueError", "(", "\"Options can only be added inside a s...
6ebac0b1fa7b8222baacdd4991d18cfc61659f84
train
Section.add_comment
Add a Comment object to the section Used during initial parsing mainly Args: line (str): one line in the comment
src/configupdater/configupdater.py
def add_comment(self, line): """Add a Comment object to the section Used during initial parsing mainly Args: line (str): one line in the comment """ if not isinstance(self.last_item, Comment): comment = Comment(self._structure) self._structur...
def add_comment(self, line): """Add a Comment object to the section Used during initial parsing mainly Args: line (str): one line in the comment """ if not isinstance(self.last_item, Comment): comment = Comment(self._structure) self._structur...
[ "Add", "a", "Comment", "object", "to", "the", "section" ]
pyscaffold/configupdater
python
https://github.com/pyscaffold/configupdater/blob/6ebac0b1fa7b8222baacdd4991d18cfc61659f84/src/configupdater/configupdater.py#L254-L266
[ "def", "add_comment", "(", "self", ",", "line", ")", ":", "if", "not", "isinstance", "(", "self", ".", "last_item", ",", "Comment", ")", ":", "comment", "=", "Comment", "(", "self", ".", "_structure", ")", "self", ".", "_structure", ".", "append", "(",...
6ebac0b1fa7b8222baacdd4991d18cfc61659f84
train
Section.add_space
Add a Space object to the section Used during initial parsing mainly Args: line (str): one line that defines the space, maybe whitespaces
src/configupdater/configupdater.py
def add_space(self, line): """Add a Space object to the section Used during initial parsing mainly Args: line (str): one line that defines the space, maybe whitespaces """ if not isinstance(self.last_item, Space): space = Space(self._structure) ...
def add_space(self, line): """Add a Space object to the section Used during initial parsing mainly Args: line (str): one line that defines the space, maybe whitespaces """ if not isinstance(self.last_item, Space): space = Space(self._structure) ...
[ "Add", "a", "Space", "object", "to", "the", "section" ]
pyscaffold/configupdater
python
https://github.com/pyscaffold/configupdater/blob/6ebac0b1fa7b8222baacdd4991d18cfc61659f84/src/configupdater/configupdater.py#L268-L280
[ "def", "add_space", "(", "self", ",", "line", ")", ":", "if", "not", "isinstance", "(", "self", ".", "last_item", ",", "Space", ")", ":", "space", "=", "Space", "(", "self", ".", "_structure", ")", "self", ".", "_structure", ".", "append", "(", "spac...
6ebac0b1fa7b8222baacdd4991d18cfc61659f84
train
Section.to_dict
Transform to dictionary Returns: dict: dictionary with same content
src/configupdater/configupdater.py
def to_dict(self): """Transform to dictionary Returns: dict: dictionary with same content """ return {key: self.__getitem__(key).value for key in self.options()}
def to_dict(self): """Transform to dictionary Returns: dict: dictionary with same content """ return {key: self.__getitem__(key).value for key in self.options()}
[ "Transform", "to", "dictionary" ]
pyscaffold/configupdater
python
https://github.com/pyscaffold/configupdater/blob/6ebac0b1fa7b8222baacdd4991d18cfc61659f84/src/configupdater/configupdater.py#L356-L362
[ "def", "to_dict", "(", "self", ")", ":", "return", "{", "key", ":", "self", ".", "__getitem__", "(", "key", ")", ".", "value", "for", "key", "in", "self", ".", "options", "(", ")", "}" ]
6ebac0b1fa7b8222baacdd4991d18cfc61659f84
train
Section.set
Set an option for chaining. Args: option (str): option name value (str): value, default None
src/configupdater/configupdater.py
def set(self, option, value=None): """Set an option for chaining. Args: option (str): option name value (str): value, default None """ option = self._container.optionxform(option) if option in self.options(): self.__getitem__(option).value = v...
def set(self, option, value=None): """Set an option for chaining. Args: option (str): option name value (str): value, default None """ option = self._container.optionxform(option) if option in self.options(): self.__getitem__(option).value = v...
[ "Set", "an", "option", "for", "chaining", "." ]
pyscaffold/configupdater
python
https://github.com/pyscaffold/configupdater/blob/6ebac0b1fa7b8222baacdd4991d18cfc61659f84/src/configupdater/configupdater.py#L379-L391
[ "def", "set", "(", "self", ",", "option", ",", "value", "=", "None", ")", ":", "option", "=", "self", ".", "_container", ".", "optionxform", "(", "option", ")", "if", "option", "in", "self", ".", "options", "(", ")", ":", "self", ".", "__getitem__", ...
6ebac0b1fa7b8222baacdd4991d18cfc61659f84
train
Option.set_values
Sets the value to a given list of options, e.g. multi-line values Args: values (list): list of values separator (str): separator for values, default: line separator indent (str): indentation depth in case of line separator
src/configupdater/configupdater.py
def set_values(self, values, separator='\n', indent=4*' '): """Sets the value to a given list of options, e.g. multi-line values Args: values (list): list of values separator (str): separator for values, default: line separator indent (str): indentation depth in case...
def set_values(self, values, separator='\n', indent=4*' '): """Sets the value to a given list of options, e.g. multi-line values Args: values (list): list of values separator (str): separator for values, default: line separator indent (str): indentation depth in case...
[ "Sets", "the", "value", "to", "a", "given", "list", "of", "options", "e", ".", "g", ".", "multi", "-", "line", "values" ]
pyscaffold/configupdater
python
https://github.com/pyscaffold/configupdater/blob/6ebac0b1fa7b8222baacdd4991d18cfc61659f84/src/configupdater/configupdater.py#L478-L492
[ "def", "set_values", "(", "self", ",", "values", ",", "separator", "=", "'\\n'", ",", "indent", "=", "4", "*", "' '", ")", ":", "self", ".", "_updated", "=", "True", "self", ".", "_multiline_value_joined", "=", "True", "self", ".", "_values", "=", "val...
6ebac0b1fa7b8222baacdd4991d18cfc61659f84
train
ConfigUpdater.read
Read and parse a filename. Args: filename (str): path to file encoding (str): encoding of file, default None
src/configupdater/configupdater.py
def read(self, filename, encoding=None): """Read and parse a filename. Args: filename (str): path to file encoding (str): encoding of file, default None """ with open(filename, encoding=encoding) as fp: self._read(fp, filename) self._filename ...
def read(self, filename, encoding=None): """Read and parse a filename. Args: filename (str): path to file encoding (str): encoding of file, default None """ with open(filename, encoding=encoding) as fp: self._read(fp, filename) self._filename ...
[ "Read", "and", "parse", "a", "filename", "." ]
pyscaffold/configupdater
python
https://github.com/pyscaffold/configupdater/blob/6ebac0b1fa7b8222baacdd4991d18cfc61659f84/src/configupdater/configupdater.py#L597-L606
[ "def", "read", "(", "self", ",", "filename", ",", "encoding", "=", "None", ")", ":", "with", "open", "(", "filename", ",", "encoding", "=", "encoding", ")", "as", "fp", ":", "self", ".", "_read", "(", "fp", ",", "filename", ")", "self", ".", "_file...
6ebac0b1fa7b8222baacdd4991d18cfc61659f84
train
ConfigUpdater.update_file
Update the read-in configuration file.
src/configupdater/configupdater.py
def update_file(self): """Update the read-in configuration file. """ if self._filename is None: raise NoConfigFileReadError() with open(self._filename, 'w') as fb: self.write(fb)
def update_file(self): """Update the read-in configuration file. """ if self._filename is None: raise NoConfigFileReadError() with open(self._filename, 'w') as fb: self.write(fb)
[ "Update", "the", "read", "-", "in", "configuration", "file", "." ]
pyscaffold/configupdater
python
https://github.com/pyscaffold/configupdater/blob/6ebac0b1fa7b8222baacdd4991d18cfc61659f84/src/configupdater/configupdater.py#L825-L831
[ "def", "update_file", "(", "self", ")", ":", "if", "self", ".", "_filename", "is", "None", ":", "raise", "NoConfigFileReadError", "(", ")", "with", "open", "(", "self", ".", "_filename", ",", "'w'", ")", "as", "fb", ":", "self", ".", "write", "(", "f...
6ebac0b1fa7b8222baacdd4991d18cfc61659f84
train
ConfigUpdater.validate_format
Call ConfigParser to validate config Args: kwargs: are passed to :class:`configparser.ConfigParser`
src/configupdater/configupdater.py
def validate_format(self, **kwargs): """Call ConfigParser to validate config Args: kwargs: are passed to :class:`configparser.ConfigParser` """ args = dict( dict_type=self._dict, allow_no_value=self._allow_no_value, inline_comment_prefixes...
def validate_format(self, **kwargs): """Call ConfigParser to validate config Args: kwargs: are passed to :class:`configparser.ConfigParser` """ args = dict( dict_type=self._dict, allow_no_value=self._allow_no_value, inline_comment_prefixes...
[ "Call", "ConfigParser", "to", "validate", "config" ]
pyscaffold/configupdater
python
https://github.com/pyscaffold/configupdater/blob/6ebac0b1fa7b8222baacdd4991d18cfc61659f84/src/configupdater/configupdater.py#L833-L849
[ "def", "validate_format", "(", "self", ",", "*", "*", "kwargs", ")", ":", "args", "=", "dict", "(", "dict_type", "=", "self", ".", "_dict", ",", "allow_no_value", "=", "self", ".", "_allow_no_value", ",", "inline_comment_prefixes", "=", "self", ".", "_inli...
6ebac0b1fa7b8222baacdd4991d18cfc61659f84
train
ConfigUpdater.add_section
Create a new section in the configuration. Raise DuplicateSectionError if a section by the specified name already exists. Raise ValueError if name is DEFAULT. Args: section (str or :class:`Section`): name or Section type
src/configupdater/configupdater.py
def add_section(self, section): """Create a new section in the configuration. Raise DuplicateSectionError if a section by the specified name already exists. Raise ValueError if name is DEFAULT. Args: section (str or :class:`Section`): name or Section type """ ...
def add_section(self, section): """Create a new section in the configuration. Raise DuplicateSectionError if a section by the specified name already exists. Raise ValueError if name is DEFAULT. Args: section (str or :class:`Section`): name or Section type """ ...
[ "Create", "a", "new", "section", "in", "the", "configuration", "." ]
pyscaffold/configupdater
python
https://github.com/pyscaffold/configupdater/blob/6ebac0b1fa7b8222baacdd4991d18cfc61659f84/src/configupdater/configupdater.py#L912-L928
[ "def", "add_section", "(", "self", ",", "section", ")", ":", "if", "section", "in", "self", ".", "sections", "(", ")", ":", "raise", "DuplicateSectionError", "(", "section", ")", "if", "isinstance", "(", "section", ",", "str", ")", ":", "# create a new sec...
6ebac0b1fa7b8222baacdd4991d18cfc61659f84
train
ConfigUpdater.options
Returns list of configuration options for the named section. Args: section (str): name of section Returns: list: list of option names
src/configupdater/configupdater.py
def options(self, section): """Returns list of configuration options for the named section. Args: section (str): name of section Returns: list: list of option names """ if not self.has_section(section): raise NoSectionError(section) from None...
def options(self, section): """Returns list of configuration options for the named section. Args: section (str): name of section Returns: list: list of option names """ if not self.has_section(section): raise NoSectionError(section) from None...
[ "Returns", "list", "of", "configuration", "options", "for", "the", "named", "section", "." ]
pyscaffold/configupdater
python
https://github.com/pyscaffold/configupdater/blob/6ebac0b1fa7b8222baacdd4991d18cfc61659f84/src/configupdater/configupdater.py#L941-L952
[ "def", "options", "(", "self", ",", "section", ")", ":", "if", "not", "self", ".", "has_section", "(", "section", ")", ":", "raise", "NoSectionError", "(", "section", ")", "from", "None", "return", "self", ".", "__getitem__", "(", "section", ")", ".", ...
6ebac0b1fa7b8222baacdd4991d18cfc61659f84
train
ConfigUpdater.get
Gets an option value for a given section. Args: section (str): section name option (str): option name Returns: :class:`Option`: Option object holding key/value pair
src/configupdater/configupdater.py
def get(self, section, option): """Gets an option value for a given section. Args: section (str): section name option (str): option name Returns: :class:`Option`: Option object holding key/value pair """ if not self.has_section(section): ...
def get(self, section, option): """Gets an option value for a given section. Args: section (str): section name option (str): option name Returns: :class:`Option`: Option object holding key/value pair """ if not self.has_section(section): ...
[ "Gets", "an", "option", "value", "for", "a", "given", "section", "." ]
pyscaffold/configupdater
python
https://github.com/pyscaffold/configupdater/blob/6ebac0b1fa7b8222baacdd4991d18cfc61659f84/src/configupdater/configupdater.py#L954-L974
[ "def", "get", "(", "self", ",", "section", ",", "option", ")", ":", "if", "not", "self", ".", "has_section", "(", "section", ")", ":", "raise", "NoSectionError", "(", "section", ")", "from", "None", "section", "=", "self", ".", "__getitem__", "(", "sec...
6ebac0b1fa7b8222baacdd4991d18cfc61659f84
train
ConfigUpdater.items
Return a list of (name, value) tuples for options or sections. If section is given, return a list of tuples with (name, value) for each option in the section. Otherwise, return a list of tuples with (section_name, section_type) for each section. Args: section (str): optiona...
src/configupdater/configupdater.py
def items(self, section=_UNSET): """Return a list of (name, value) tuples for options or sections. If section is given, return a list of tuples with (name, value) for each option in the section. Otherwise, return a list of tuples with (section_name, section_type) for each section. ...
def items(self, section=_UNSET): """Return a list of (name, value) tuples for options or sections. If section is given, return a list of tuples with (name, value) for each option in the section. Otherwise, return a list of tuples with (section_name, section_type) for each section. ...
[ "Return", "a", "list", "of", "(", "name", "value", ")", "tuples", "for", "options", "or", "sections", "." ]
pyscaffold/configupdater
python
https://github.com/pyscaffold/configupdater/blob/6ebac0b1fa7b8222baacdd4991d18cfc61659f84/src/configupdater/configupdater.py#L976-L993
[ "def", "items", "(", "self", ",", "section", "=", "_UNSET", ")", ":", "if", "section", "is", "_UNSET", ":", "return", "[", "(", "sect", ".", "name", ",", "sect", ")", "for", "sect", "in", "self", ".", "sections_blocks", "(", ")", "]", "section", "=...
6ebac0b1fa7b8222baacdd4991d18cfc61659f84
train
ConfigUpdater.has_option
Checks for the existence of a given option in a given section. Args: section (str): name of section option (str): name of option Returns: bool: whether the option exists in the given section
src/configupdater/configupdater.py
def has_option(self, section, option): """Checks for the existence of a given option in a given section. Args: section (str): name of section option (str): name of option Returns: bool: whether the option exists in the given section """ if se...
def has_option(self, section, option): """Checks for the existence of a given option in a given section. Args: section (str): name of section option (str): name of option Returns: bool: whether the option exists in the given section """ if se...
[ "Checks", "for", "the", "existence", "of", "a", "given", "option", "in", "a", "given", "section", "." ]
pyscaffold/configupdater
python
https://github.com/pyscaffold/configupdater/blob/6ebac0b1fa7b8222baacdd4991d18cfc61659f84/src/configupdater/configupdater.py#L995-L1009
[ "def", "has_option", "(", "self", ",", "section", ",", "option", ")", ":", "if", "section", "not", "in", "self", ".", "sections", "(", ")", ":", "return", "False", "else", ":", "option", "=", "self", ".", "optionxform", "(", "option", ")", "return", ...
6ebac0b1fa7b8222baacdd4991d18cfc61659f84
train
ConfigUpdater.set
Set an option. Args: section (str): section name option (str): option name value (str): value, default None
src/configupdater/configupdater.py
def set(self, section, option, value=None): """Set an option. Args: section (str): section name option (str): option name value (str): value, default None """ try: section = self.__getitem__(section) except KeyError: ra...
def set(self, section, option, value=None): """Set an option. Args: section (str): section name option (str): option name value (str): value, default None """ try: section = self.__getitem__(section) except KeyError: ra...
[ "Set", "an", "option", "." ]
pyscaffold/configupdater
python
https://github.com/pyscaffold/configupdater/blob/6ebac0b1fa7b8222baacdd4991d18cfc61659f84/src/configupdater/configupdater.py#L1011-L1028
[ "def", "set", "(", "self", ",", "section", ",", "option", ",", "value", "=", "None", ")", ":", "try", ":", "section", "=", "self", ".", "__getitem__", "(", "section", ")", "except", "KeyError", ":", "raise", "NoSectionError", "(", "section", ")", "from...
6ebac0b1fa7b8222baacdd4991d18cfc61659f84
train
ConfigUpdater.remove_option
Remove an option. Args: section (str): section name option (str): option name Returns: bool: whether the option was actually removed
src/configupdater/configupdater.py
def remove_option(self, section, option): """Remove an option. Args: section (str): section name option (str): option name Returns: bool: whether the option was actually removed """ try: section = self.__getitem__(section) ...
def remove_option(self, section, option): """Remove an option. Args: section (str): section name option (str): option name Returns: bool: whether the option was actually removed """ try: section = self.__getitem__(section) ...
[ "Remove", "an", "option", "." ]
pyscaffold/configupdater
python
https://github.com/pyscaffold/configupdater/blob/6ebac0b1fa7b8222baacdd4991d18cfc61659f84/src/configupdater/configupdater.py#L1030-L1048
[ "def", "remove_option", "(", "self", ",", "section", ",", "option", ")", ":", "try", ":", "section", "=", "self", ".", "__getitem__", "(", "section", ")", "except", "KeyError", ":", "raise", "NoSectionError", "(", "section", ")", "from", "None", "option", ...
6ebac0b1fa7b8222baacdd4991d18cfc61659f84
train
ConfigUpdater.remove_section
Remove a file section. Args: name: name of the section Returns: bool: whether the section was actually removed
src/configupdater/configupdater.py
def remove_section(self, name): """Remove a file section. Args: name: name of the section Returns: bool: whether the section was actually removed """ existed = self.has_section(name) if existed: idx = self._get_section_idx(name) ...
def remove_section(self, name): """Remove a file section. Args: name: name of the section Returns: bool: whether the section was actually removed """ existed = self.has_section(name) if existed: idx = self._get_section_idx(name) ...
[ "Remove", "a", "file", "section", "." ]
pyscaffold/configupdater
python
https://github.com/pyscaffold/configupdater/blob/6ebac0b1fa7b8222baacdd4991d18cfc61659f84/src/configupdater/configupdater.py#L1050-L1063
[ "def", "remove_section", "(", "self", ",", "name", ")", ":", "existed", "=", "self", ".", "has_section", "(", "name", ")", "if", "existed", ":", "idx", "=", "self", ".", "_get_section_idx", "(", "name", ")", "del", "self", ".", "_structure", "[", "idx"...
6ebac0b1fa7b8222baacdd4991d18cfc61659f84
train
ConfigUpdater.to_dict
Transform to dictionary Returns: dict: dictionary with same content
src/configupdater/configupdater.py
def to_dict(self): """Transform to dictionary Returns: dict: dictionary with same content """ return {sect: self.__getitem__(sect).to_dict() for sect in self.sections()}
def to_dict(self): """Transform to dictionary Returns: dict: dictionary with same content """ return {sect: self.__getitem__(sect).to_dict() for sect in self.sections()}
[ "Transform", "to", "dictionary" ]
pyscaffold/configupdater
python
https://github.com/pyscaffold/configupdater/blob/6ebac0b1fa7b8222baacdd4991d18cfc61659f84/src/configupdater/configupdater.py#L1065-L1072
[ "def", "to_dict", "(", "self", ")", ":", "return", "{", "sect", ":", "self", ".", "__getitem__", "(", "sect", ")", ".", "to_dict", "(", ")", "for", "sect", "in", "self", ".", "sections", "(", ")", "}" ]
6ebac0b1fa7b8222baacdd4991d18cfc61659f84
train
render_template
This function renders the template desginated by the argument to the designated directory using the given context. Args: template (string) : the source template to use (relative to ./templates) out_dir (string) : the name of the output directory context (dict) : the ...
nautilus/management/util/render_template.py
def render_template(template, out_dir='.', context=None): ''' This function renders the template desginated by the argument to the designated directory using the given context. Args: template (string) : the source template to use (relative to ./templates) out_dir (st...
def render_template(template, out_dir='.', context=None): ''' This function renders the template desginated by the argument to the designated directory using the given context. Args: template (string) : the source template to use (relative to ./templates) out_dir (st...
[ "This", "function", "renders", "the", "template", "desginated", "by", "the", "argument", "to", "the", "designated", "directory", "using", "the", "given", "context", "." ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/management/util/render_template.py#L6-L86
[ "def", "render_template", "(", "template", ",", "out_dir", "=", "'.'", ",", "context", "=", "None", ")", ":", "# the directory containing templates", "template_directory", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "os"...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
publish
Publish a message with the specified action_type and payload over the event system. Useful for debugging.
nautilus/management/scripts/events/publish.py
def publish(type, payload): """ Publish a message with the specified action_type and payload over the event system. Useful for debugging. """ async def _produce(): # fire an action with the given values await producer.send(action_type=type, payload=payload) # notify t...
def publish(type, payload): """ Publish a message with the specified action_type and payload over the event system. Useful for debugging. """ async def _produce(): # fire an action with the given values await producer.send(action_type=type, payload=payload) # notify t...
[ "Publish", "a", "message", "with", "the", "specified", "action_type", "and", "payload", "over", "the", "event", "system", ".", "Useful", "for", "debugging", "." ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/management/scripts/events/publish.py#L15-L38
[ "def", "publish", "(", "type", ",", "payload", ")", ":", "async", "def", "_produce", "(", ")", ":", "# fire an action with the given values", "await", "producer", ".", "send", "(", "action_type", "=", "type", ",", "payload", "=", "payload", ")", "# notify the ...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
delete_handler
This factory returns an action handler that deletes a new instance of the specified model when a delete action is recieved, assuming the action follows nautilus convetions. Args: Model (nautilus.BaseModel): The model to delete when the action received. Retur...
nautilus/network/events/actionHandlers/deleteHandler.py
def delete_handler(Model, name=None, **kwds): """ This factory returns an action handler that deletes a new instance of the specified model when a delete action is recieved, assuming the action follows nautilus convetions. Args: Model (nautilus.BaseModel): The model to d...
def delete_handler(Model, name=None, **kwds): """ This factory returns an action handler that deletes a new instance of the specified model when a delete action is recieved, assuming the action follows nautilus convetions. Args: Model (nautilus.BaseModel): The model to d...
[ "This", "factory", "returns", "an", "action", "handler", "that", "deletes", "a", "new", "instance", "of", "the", "specified", "model", "when", "a", "delete", "action", "is", "recieved", "assuming", "the", "action", "follows", "nautilus", "convetions", "." ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/network/events/actionHandlers/deleteHandler.py#L10-L71
[ "def", "delete_handler", "(", "Model", ",", "name", "=", "None", ",", "*", "*", "kwds", ")", ":", "# necessary imports", "from", "nautilus", ".", "database", "import", "db", "async", "def", "action_handler", "(", "service", ",", "action_type", ",", "payload"...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
read_handler
This factory returns an action handler that responds to read requests by resolving the payload as a graphql query against the internal schema. Args: Model (nautilus.BaseModel): The model to delete when the action received. Returns: function(type, payloa...
nautilus/network/events/actionHandlers/readHandler.py
def read_handler(Model, name=None, **kwds): """ This factory returns an action handler that responds to read requests by resolving the payload as a graphql query against the internal schema. Args: Model (nautilus.BaseModel): The model to delete when the action r...
def read_handler(Model, name=None, **kwds): """ This factory returns an action handler that responds to read requests by resolving the payload as a graphql query against the internal schema. Args: Model (nautilus.BaseModel): The model to delete when the action r...
[ "This", "factory", "returns", "an", "action", "handler", "that", "responds", "to", "read", "requests", "by", "resolving", "the", "payload", "as", "a", "graphql", "query", "against", "the", "internal", "schema", "." ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/network/events/actionHandlers/readHandler.py#L6-L56
[ "def", "read_handler", "(", "Model", ",", "name", "=", "None", ",", "*", "*", "kwds", ")", ":", "async", "def", "action_handler", "(", "service", ",", "action_type", ",", "payload", ",", "props", ",", "*", "*", "kwds", ")", ":", "# if the payload represe...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
crud_handler
This action handler factory reaturns an action handler that responds to actions with CRUD types (following nautilus conventions) and performs the necessary mutation on the model's database. Args: Model (nautilus.BaseModel): The model to delete when the action receive...
nautilus/network/events/actionHandlers/crudHandler.py
def crud_handler(Model, name=None, **kwds): """ This action handler factory reaturns an action handler that responds to actions with CRUD types (following nautilus conventions) and performs the necessary mutation on the model's database. Args: Model (nautilus.BaseModel):...
def crud_handler(Model, name=None, **kwds): """ This action handler factory reaturns an action handler that responds to actions with CRUD types (following nautilus conventions) and performs the necessary mutation on the model's database. Args: Model (nautilus.BaseModel):...
[ "This", "action", "handler", "factory", "reaturns", "an", "action", "handler", "that", "responds", "to", "actions", "with", "CRUD", "types", "(", "following", "nautilus", "conventions", ")", "and", "performs", "the", "necessary", "mutation", "on", "the", "model"...
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/network/events/actionHandlers/crudHandler.py#L1-L25
[ "def", "crud_handler", "(", "Model", ",", "name", "=", "None", ",", "*", "*", "kwds", ")", ":", "# import the necessary modules", "from", "nautilus", ".", "network", ".", "events", "import", "combine_action_handlers", "from", ".", "import", "update_handler", ","...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
ask
Publish a message with the specified action_type and payload over the event system. Useful for debugging.
nautilus/management/scripts/events/ask.py
def ask(type, payload): """ Publish a message with the specified action_type and payload over the event system. Useful for debugging. """ async def _produce(): # notify the user that we were successful print("Dispatching action with type {}...".format(type)) # fire an...
def ask(type, payload): """ Publish a message with the specified action_type and payload over the event system. Useful for debugging. """ async def _produce(): # notify the user that we were successful print("Dispatching action with type {}...".format(type)) # fire an...
[ "Publish", "a", "message", "with", "the", "specified", "action_type", "and", "payload", "over", "the", "event", "system", ".", "Useful", "for", "debugging", "." ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/management/scripts/events/ask.py#L15-L40
[ "def", "ask", "(", "type", ",", "payload", ")", ":", "async", "def", "_produce", "(", ")", ":", "# notify the user that we were successful", "print", "(", "\"Dispatching action with type {}...\"", ".", "format", "(", "type", ")", ")", "# fire an action with the given ...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
Config._from_type
This method converts a type into a dict.
nautilus/config/config.py
def _from_type(self, config): """ This method converts a type into a dict. """ def is_user_attribute(attr): return ( not attr.startswith('__') and not isinstance(getattr(config, attr), collections.abc.Callable) ) return...
def _from_type(self, config): """ This method converts a type into a dict. """ def is_user_attribute(attr): return ( not attr.startswith('__') and not isinstance(getattr(config, attr), collections.abc.Callable) ) return...
[ "This", "method", "converts", "a", "type", "into", "a", "dict", "." ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/config/config.py#L41-L52
[ "def", "_from_type", "(", "self", ",", "config", ")", ":", "def", "is_user_attribute", "(", "attr", ")", ":", "return", "(", "not", "attr", ".", "startswith", "(", "'__'", ")", "and", "not", "isinstance", "(", "getattr", "(", "config", ",", "attr", ")"...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
walk_query
This function traverses a query and collects the corresponding information in a dictionary.
nautilus/api/util/walk_query.py
async def walk_query(obj, object_resolver, connection_resolver, errors, current_user=None, __naut_name=None, obey_auth=True, **filters): """ This function traverses a query and collects the corresponding information in a dictionary. """ # if the object has no selection set if not hasattr...
async def walk_query(obj, object_resolver, connection_resolver, errors, current_user=None, __naut_name=None, obey_auth=True, **filters): """ This function traverses a query and collects the corresponding information in a dictionary. """ # if the object has no selection set if not hasattr...
[ "This", "function", "traverses", "a", "query", "and", "collects", "the", "corresponding", "information", "in", "a", "dictionary", "." ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/api/util/walk_query.py#L1-L102
[ "async", "def", "walk_query", "(", "obj", ",", "object_resolver", ",", "connection_resolver", ",", "errors", ",", "current_user", "=", "None", ",", "__naut_name", "=", "None", ",", "obey_auth", "=", "True", ",", "*", "*", "filters", ")", ":", "# if the objec...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
query_handler
This action handler interprets the payload as a query to be executed by the api gateway service.
nautilus/network/events/actionHandlers/queryHandler.py
async def query_handler(service, action_type, payload, props, **kwds): """ This action handler interprets the payload as a query to be executed by the api gateway service. """ # check that the action type indicates a query if action_type == query_action_type(): print('encountered...
async def query_handler(service, action_type, payload, props, **kwds): """ This action handler interprets the payload as a query to be executed by the api gateway service. """ # check that the action type indicates a query if action_type == query_action_type(): print('encountered...
[ "This", "action", "handler", "interprets", "the", "payload", "as", "a", "query", "to", "be", "executed", "by", "the", "api", "gateway", "service", "." ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/network/events/actionHandlers/queryHandler.py#L5-L29
[ "async", "def", "query_handler", "(", "service", ",", "action_type", ",", "payload", ",", "props", ",", "*", "*", "kwds", ")", ":", "# check that the action type indicates a query", "if", "action_type", "==", "query_action_type", "(", ")", ":", "print", "(", "'e...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
summarize_mutation_io
This function returns the standard summary for mutations inputs and outputs
nautilus/api/util/summarize_mutation_io.py
def summarize_mutation_io(name, type, required=False): """ This function returns the standard summary for mutations inputs and outputs """ return dict( name=name, type=type, required=required )
def summarize_mutation_io(name, type, required=False): """ This function returns the standard summary for mutations inputs and outputs """ return dict( name=name, type=type, required=required )
[ "This", "function", "returns", "the", "standard", "summary", "for", "mutations", "inputs", "and", "outputs" ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/api/util/summarize_mutation_io.py#L1-L10
[ "def", "summarize_mutation_io", "(", "name", ",", "type", ",", "required", "=", "False", ")", ":", "return", "dict", "(", "name", "=", "name", ",", "type", "=", "type", ",", "required", "=", "required", ")" ]
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
crud_mutation_name
This function returns the name of a mutation that performs the specified crud action on the given model service
nautilus/conventions/api.py
def crud_mutation_name(action, model): """ This function returns the name of a mutation that performs the specified crud action on the given model service """ model_string = get_model_string(model) # make sure the mutation name is correctly camelcases model_string = model_string[0].u...
def crud_mutation_name(action, model): """ This function returns the name of a mutation that performs the specified crud action on the given model service """ model_string = get_model_string(model) # make sure the mutation name is correctly camelcases model_string = model_string[0].u...
[ "This", "function", "returns", "the", "name", "of", "a", "mutation", "that", "performs", "the", "specified", "crud", "action", "on", "the", "given", "model", "service" ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/conventions/api.py#L15-L25
[ "def", "crud_mutation_name", "(", "action", ",", "model", ")", ":", "model_string", "=", "get_model_string", "(", "model", ")", "# make sure the mutation name is correctly camelcases", "model_string", "=", "model_string", "[", "0", "]", ".", "upper", "(", ")", "+", ...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
create_mutation_inputs
Args: service : The service being created by the mutation Returns: (list) : a list of all of the fields availible for the service, with the required ones respected.
nautilus/conventions/api.py
def create_mutation_inputs(service): """ Args: service : The service being created by the mutation Returns: (list) : a list of all of the fields availible for the service, with the required ones respected. """ # grab the default list of field summaries...
def create_mutation_inputs(service): """ Args: service : The service being created by the mutation Returns: (list) : a list of all of the fields availible for the service, with the required ones respected. """ # grab the default list of field summaries...
[ "Args", ":", "service", ":", "The", "service", "being", "created", "by", "the", "mutation", "Returns", ":", "(", "list", ")", ":", "a", "list", "of", "all", "of", "the", "fields", "availible", "for", "the", "service", "with", "the", "required", "ones", ...
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/conventions/api.py#L28-L42
[ "def", "create_mutation_inputs", "(", "service", ")", ":", "# grab the default list of field summaries", "inputs", "=", "_service_mutation_summaries", "(", "service", ")", "# make sure the pk isn't in the list", "inputs", ".", "remove", "(", "[", "field", "for", "field", ...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
update_mutation_inputs
Args: service : The service being updated by the mutation Returns: (list) : a list of all of the fields availible for the service. Pk is a required field in order to filter the results
nautilus/conventions/api.py
def update_mutation_inputs(service): """ Args: service : The service being updated by the mutation Returns: (list) : a list of all of the fields availible for the service. Pk is a required field in order to filter the results """ # grab the default lis...
def update_mutation_inputs(service): """ Args: service : The service being updated by the mutation Returns: (list) : a list of all of the fields availible for the service. Pk is a required field in order to filter the results """ # grab the default lis...
[ "Args", ":", "service", ":", "The", "service", "being", "updated", "by", "the", "mutation", "Returns", ":", "(", "list", ")", ":", "a", "list", "of", "all", "of", "the", "fields", "availible", "for", "the", "service", ".", "Pk", "is", "a", "required", ...
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/conventions/api.py#L57-L80
[ "def", "update_mutation_inputs", "(", "service", ")", ":", "# grab the default list of field summaries", "inputs", "=", "_service_mutation_summaries", "(", "service", ")", "# visit each field", "for", "field", "in", "inputs", ":", "# if we're looking at the id field", "if", ...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
delete_mutation_inputs
Args: service : The service being deleted by the mutation Returns: ([str]): the only input for delete is the pk of the service.
nautilus/conventions/api.py
def delete_mutation_inputs(service): """ Args: service : The service being deleted by the mutation Returns: ([str]): the only input for delete is the pk of the service. """ from nautilus.api.util import summarize_mutation_io # the only input for delete events is...
def delete_mutation_inputs(service): """ Args: service : The service being deleted by the mutation Returns: ([str]): the only input for delete is the pk of the service. """ from nautilus.api.util import summarize_mutation_io # the only input for delete events is...
[ "Args", ":", "service", ":", "The", "service", "being", "deleted", "by", "the", "mutation", "Returns", ":", "(", "[", "str", "]", ")", ":", "the", "only", "input", "for", "delete", "is", "the", "pk", "of", "the", "service", "." ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/conventions/api.py#L96-L106
[ "def", "delete_mutation_inputs", "(", "service", ")", ":", "from", "nautilus", ".", "api", ".", "util", "import", "summarize_mutation_io", "# the only input for delete events is the pk of the service record", "return", "[", "summarize_mutation_io", "(", "name", "=", "'pk'",...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
_summarize_o_mutation_type
This function create the actual mutation io summary corresponding to the model
nautilus/conventions/api.py
def _summarize_o_mutation_type(model): """ This function create the actual mutation io summary corresponding to the model """ from nautilus.api.util import summarize_mutation_io # compute the appropriate name for the object object_type_name = get_model_string(model) # return a mutation ...
def _summarize_o_mutation_type(model): """ This function create the actual mutation io summary corresponding to the model """ from nautilus.api.util import summarize_mutation_io # compute the appropriate name for the object object_type_name = get_model_string(model) # return a mutation ...
[ "This", "function", "create", "the", "actual", "mutation", "io", "summary", "corresponding", "to", "the", "model" ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/conventions/api.py#L134-L147
[ "def", "_summarize_o_mutation_type", "(", "model", ")", ":", "from", "nautilus", ".", "api", ".", "util", "import", "summarize_mutation_io", "# compute the appropriate name for the object", "object_type_name", "=", "get_model_string", "(", "model", ")", "# return a mutation...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
_summarize_object_type
This function returns the summary for a given model
nautilus/conventions/api.py
def _summarize_object_type(model): """ This function returns the summary for a given model """ # the fields for the service's model model_fields = {field.name: field for field in list(model.fields())} # summarize the model return { 'fields': [{ 'name': key, ...
def _summarize_object_type(model): """ This function returns the summary for a given model """ # the fields for the service's model model_fields = {field.name: field for field in list(model.fields())} # summarize the model return { 'fields': [{ 'name': key, ...
[ "This", "function", "returns", "the", "summary", "for", "a", "given", "model" ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/conventions/api.py#L149-L162
[ "def", "_summarize_object_type", "(", "model", ")", ":", "# the fields for the service's model", "model_fields", "=", "{", "field", ".", "name", ":", "field", "for", "field", "in", "list", "(", "model", ".", "fields", "(", ")", ")", "}", "# summarize the model",...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
combine_action_handlers
This function combines the given action handlers into a single function which will call all of them.
nautilus/network/events/util.py
def combine_action_handlers(*handlers): """ This function combines the given action handlers into a single function which will call all of them. """ # make sure each of the given handlers is callable for handler in handlers: # if the handler is not a function if not (isco...
def combine_action_handlers(*handlers): """ This function combines the given action handlers into a single function which will call all of them. """ # make sure each of the given handlers is callable for handler in handlers: # if the handler is not a function if not (isco...
[ "This", "function", "combines", "the", "given", "action", "handlers", "into", "a", "single", "function", "which", "will", "call", "all", "of", "them", "." ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/network/events/util.py#L6-L26
[ "def", "combine_action_handlers", "(", "*", "handlers", ")", ":", "# make sure each of the given handlers is callable", "for", "handler", "in", "handlers", ":", "# if the handler is not a function", "if", "not", "(", "iscoroutinefunction", "(", "handler", ")", "or", "isco...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
update_handler
This factory returns an action handler that updates a new instance of the specified model when a update action is recieved, assuming the action follows nautilus convetions. Args: Model (nautilus.BaseModel): The model to update when the action received. Retur...
nautilus/network/events/actionHandlers/updateHandler.py
def update_handler(Model, name=None, **kwds): """ This factory returns an action handler that updates a new instance of the specified model when a update action is recieved, assuming the action follows nautilus convetions. Args: Model (nautilus.BaseModel): The model to u...
def update_handler(Model, name=None, **kwds): """ This factory returns an action handler that updates a new instance of the specified model when a update action is recieved, assuming the action follows nautilus convetions. Args: Model (nautilus.BaseModel): The model to u...
[ "This", "factory", "returns", "an", "action", "handler", "that", "updates", "a", "new", "instance", "of", "the", "specified", "model", "when", "a", "update", "action", "is", "recieved", "assuming", "the", "action", "follows", "nautilus", "convetions", "." ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/network/events/actionHandlers/updateHandler.py#L10-L83
[ "def", "update_handler", "(", "Model", ",", "name", "=", "None", ",", "*", "*", "kwds", ")", ":", "async", "def", "action_handler", "(", "service", ",", "action_type", ",", "payload", ",", "props", ",", "notify", "=", "True", ",", "*", "*", "kwds", "...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
graphql_mutation_from_summary
This function returns a graphql mutation corresponding to the provided summary.
nautilus/api/util/graphql_mutation_from_summary.py
def graphql_mutation_from_summary(summary): """ This function returns a graphql mutation corresponding to the provided summary. """ # get the name of the mutation from the summary mutation_name = summary['name'] # print(summary) # the treat the "type" string as a gra input_...
def graphql_mutation_from_summary(summary): """ This function returns a graphql mutation corresponding to the provided summary. """ # get the name of the mutation from the summary mutation_name = summary['name'] # print(summary) # the treat the "type" string as a gra input_...
[ "This", "function", "returns", "a", "graphql", "mutation", "corresponding", "to", "the", "provided", "summary", "." ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/api/util/graphql_mutation_from_summary.py#L6-L38
[ "def", "graphql_mutation_from_summary", "(", "summary", ")", ":", "# get the name of the mutation from the summary", "mutation_name", "=", "summary", "[", "'name'", "]", "# print(summary)", "# the treat the \"type\" string as a gra", "input_name", "=", "mutation_name", "+", "\"...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
arg_string_from_dict
This function takes a series of ditionaries and creates an argument string for a graphql query
nautilus/api/util/arg_string_from_dict.py
def arg_string_from_dict(arg_dict, **kwds): """ This function takes a series of ditionaries and creates an argument string for a graphql query """ # the filters dictionary filters = { **arg_dict, **kwds, } # return the correctly formed string return ", ".join(...
def arg_string_from_dict(arg_dict, **kwds): """ This function takes a series of ditionaries and creates an argument string for a graphql query """ # the filters dictionary filters = { **arg_dict, **kwds, } # return the correctly formed string return ", ".join(...
[ "This", "function", "takes", "a", "series", "of", "ditionaries", "and", "creates", "an", "argument", "string", "for", "a", "graphql", "query" ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/api/util/arg_string_from_dict.py#L3-L14
[ "def", "arg_string_from_dict", "(", "arg_dict", ",", "*", "*", "kwds", ")", ":", "# the filters dictionary", "filters", "=", "{", "*", "*", "arg_dict", ",", "*", "*", "kwds", ",", "}", "# return the correctly formed string", "return", "\", \"", ".", "join", "(...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
create_model_schema
This function creates a graphql schema that provides a single model
nautilus/api/util/create_model_schema.py
def create_model_schema(target_model): """ This function creates a graphql schema that provides a single model """ from nautilus.database import db # create the schema instance schema = graphene.Schema(auto_camelcase=False) # grab the primary key from the model primary_key = target_model.prim...
def create_model_schema(target_model): """ This function creates a graphql schema that provides a single model """ from nautilus.database import db # create the schema instance schema = graphene.Schema(auto_camelcase=False) # grab the primary key from the model primary_key = target_model.prim...
[ "This", "function", "creates", "a", "graphql", "schema", "that", "provides", "a", "single", "model" ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/api/util/create_model_schema.py#L9-L48
[ "def", "create_model_schema", "(", "target_model", ")", ":", "from", "nautilus", ".", "database", "import", "db", "# create the schema instance", "schema", "=", "graphene", ".", "Schema", "(", "auto_camelcase", "=", "False", ")", "# grab the primary key from the model",...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
connection_service_name
the name of a service that manages the connection between services
nautilus/conventions/services.py
def connection_service_name(service, *args): ''' the name of a service that manages the connection between services ''' # if the service is a string if isinstance(service, str): return service return normalize_string(type(service).__name__)
def connection_service_name(service, *args): ''' the name of a service that manages the connection between services ''' # if the service is a string if isinstance(service, str): return service return normalize_string(type(service).__name__)
[ "the", "name", "of", "a", "service", "that", "manages", "the", "connection", "between", "services" ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/conventions/services.py#L22-L28
[ "def", "connection_service_name", "(", "service", ",", "*", "args", ")", ":", "# if the service is a string", "if", "isinstance", "(", "service", ",", "str", ")", ":", "return", "service", "return", "normalize_string", "(", "type", "(", "service", ")", ".", "_...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
read_session_token
This function verifies the token using the secret key and returns its contents.
nautilus/auth/util/read_session_token.py
def read_session_token(secret_key, token): """ This function verifies the token using the secret key and returns its contents. """ return jwt.decode(token.encode('utf-8'), secret_key, algorithms=[token_encryption_algorithm()] )
def read_session_token(secret_key, token): """ This function verifies the token using the secret key and returns its contents. """ return jwt.decode(token.encode('utf-8'), secret_key, algorithms=[token_encryption_algorithm()] )
[ "This", "function", "verifies", "the", "token", "using", "the", "secret", "key", "and", "returns", "its", "contents", "." ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/auth/util/read_session_token.py#L6-L13
[ "def", "read_session_token", "(", "secret_key", ",", "token", ")", ":", "return", "jwt", ".", "decode", "(", "token", ".", "encode", "(", "'utf-8'", ")", ",", "secret_key", ",", "algorithms", "=", "[", "token_encryption_algorithm", "(", ")", "]", ")" ]
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
ServiceActionHandler.handle_action
The default action Handler has no action.
nautilus/services/service.py
async def handle_action(self, action_type, payload, **kwds): """ The default action Handler has no action. """ # if there is a service attached to the action handler if hasattr(self, 'service'): # handle roll calls await roll_call_handler(self.service,...
async def handle_action(self, action_type, payload, **kwds): """ The default action Handler has no action. """ # if there is a service attached to the action handler if hasattr(self, 'service'): # handle roll calls await roll_call_handler(self.service,...
[ "The", "default", "action", "Handler", "has", "no", "action", "." ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/services/service.py#L47-L54
[ "async", "def", "handle_action", "(", "self", ",", "action_type", ",", "payload", ",", "*", "*", "kwds", ")", ":", "# if there is a service attached to the action handler", "if", "hasattr", "(", "self", ",", "'service'", ")", ":", "# handle roll calls", "await", "...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
Service.announce
This method is used to announce the existence of the service
nautilus/services/service.py
async def announce(self): """ This method is used to announce the existence of the service """ # send a serialized event await self.event_broker.send( action_type=intialize_service_action(), payload=json.dumps(self.summarize()) )
async def announce(self): """ This method is used to announce the existence of the service """ # send a serialized event await self.event_broker.send( action_type=intialize_service_action(), payload=json.dumps(self.summarize()) )
[ "This", "method", "is", "used", "to", "announce", "the", "existence", "of", "the", "service" ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/services/service.py#L166-L174
[ "async", "def", "announce", "(", "self", ")", ":", "# send a serialized event", "await", "self", ".", "event_broker", ".", "send", "(", "action_type", "=", "intialize_service_action", "(", ")", ",", "payload", "=", "json", ".", "dumps", "(", "self", ".", "su...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
Service.run
This function starts the service's network intefaces. Args: port (int): The port for the http server.
nautilus/services/service.py
def run(self, host="localhost", port=8000, shutdown_timeout=60.0, **kwargs): """ This function starts the service's network intefaces. Args: port (int): The port for the http server. """ print("Running service on http://localhost:%i. " % port + \ ...
def run(self, host="localhost", port=8000, shutdown_timeout=60.0, **kwargs): """ This function starts the service's network intefaces. Args: port (int): The port for the http server. """ print("Running service on http://localhost:%i. " % port + \ ...
[ "This", "function", "starts", "the", "service", "s", "network", "intefaces", "." ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/services/service.py#L208-L257
[ "def", "run", "(", "self", ",", "host", "=", "\"localhost\"", ",", "port", "=", "8000", ",", "shutdown_timeout", "=", "60.0", ",", "*", "*", "kwargs", ")", ":", "print", "(", "\"Running service on http://localhost:%i. \"", "%", "port", "+", "\"Press Ctrl+C to ...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
Service.cleanup
This function is called when the service has finished running regardless of intentionally or not.
nautilus/services/service.py
def cleanup(self): """ This function is called when the service has finished running regardless of intentionally or not. """ # if an event broker has been created for this service if self.event_broker: # stop the event broker self.event_br...
def cleanup(self): """ This function is called when the service has finished running regardless of intentionally or not. """ # if an event broker has been created for this service if self.event_broker: # stop the event broker self.event_br...
[ "This", "function", "is", "called", "when", "the", "service", "has", "finished", "running", "regardless", "of", "intentionally", "or", "not", "." ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/services/service.py#L260-L284
[ "def", "cleanup", "(", "self", ")", ":", "# if an event broker has been created for this service", "if", "self", ".", "event_broker", ":", "# stop the event broker", "self", ".", "event_broker", ".", "stop", "(", ")", "# attempt", "try", ":", "# close the http server", ...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
Service.add_http_endpoint
This method provides a programatic way of added invidual routes to the http server. Args: url (str): the url to be handled by the request_handler request_handler (nautilus.network.RequestHandler): The request handler
nautilus/services/service.py
def add_http_endpoint(self, url, request_handler): """ This method provides a programatic way of added invidual routes to the http server. Args: url (str): the url to be handled by the request_handler request_handler (nautilus.network.RequestH...
def add_http_endpoint(self, url, request_handler): """ This method provides a programatic way of added invidual routes to the http server. Args: url (str): the url to be handled by the request_handler request_handler (nautilus.network.RequestH...
[ "This", "method", "provides", "a", "programatic", "way", "of", "added", "invidual", "routes", "to", "the", "http", "server", "." ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/services/service.py#L287-L296
[ "def", "add_http_endpoint", "(", "self", ",", "url", ",", "request_handler", ")", ":", "self", ".", "app", ".", "router", ".", "add_route", "(", "'*'", ",", "url", ",", "request_handler", ")" ]
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
Service.route
This method provides a decorator for adding endpoints to the http server. Args: route (str): The url to be handled by the RequestHandled config (dict): Configuration for the request handler Example: .. code-block:: python ...
nautilus/services/service.py
def route(cls, route, config=None): """ This method provides a decorator for adding endpoints to the http server. Args: route (str): The url to be handled by the RequestHandled config (dict): Configuration for the request handler ...
def route(cls, route, config=None): """ This method provides a decorator for adding endpoints to the http server. Args: route (str): The url to be handled by the RequestHandled config (dict): Configuration for the request handler ...
[ "This", "method", "provides", "a", "decorator", "for", "adding", "endpoints", "to", "the", "http", "server", "." ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/services/service.py#L300-L334
[ "def", "route", "(", "cls", ",", "route", ",", "config", "=", "None", ")", ":", "def", "decorator", "(", "wrapped_class", ",", "*", "*", "kwds", ")", ":", "# add the endpoint at the given route", "cls", ".", "_routes", ".", "append", "(", "dict", "(", "u...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
generate_session_token
This function generates a session token signed by the secret key which can be used to extract the user credentials in a verifiable way.
nautilus/auth/util/generate_session_token.py
def generate_session_token(secret_key, **payload): """ This function generates a session token signed by the secret key which can be used to extract the user credentials in a verifiable way. """ return jwt.encode(payload, secret_key, algorithm=token_encryption_algorithm()).decode('utf-8')
def generate_session_token(secret_key, **payload): """ This function generates a session token signed by the secret key which can be used to extract the user credentials in a verifiable way. """ return jwt.encode(payload, secret_key, algorithm=token_encryption_algorithm()).decode('utf-8')
[ "This", "function", "generates", "a", "session", "token", "signed", "by", "the", "secret", "key", "which", "can", "be", "used", "to", "extract", "the", "user", "credentials", "in", "a", "verifiable", "way", "." ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/auth/util/generate_session_token.py#L6-L11
[ "def", "generate_session_token", "(", "secret_key", ",", "*", "*", "payload", ")", ":", "return", "jwt", ".", "encode", "(", "payload", ",", "secret_key", ",", "algorithm", "=", "token_encryption_algorithm", "(", ")", ")", ".", "decode", "(", "'utf-8'", ")" ...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
summarize_mutation
This function provides a standard representation of mutations to be used when services announce themselves
nautilus/api/util/summarize_mutation.py
def summarize_mutation(mutation_name, event, inputs, outputs, isAsync=False): """ This function provides a standard representation of mutations to be used when services announce themselves """ return dict( name=mutation_name, event=event, isAsync=isAsync, inpu...
def summarize_mutation(mutation_name, event, inputs, outputs, isAsync=False): """ This function provides a standard representation of mutations to be used when services announce themselves """ return dict( name=mutation_name, event=event, isAsync=isAsync, inpu...
[ "This", "function", "provides", "a", "standard", "representation", "of", "mutations", "to", "be", "used", "when", "services", "announce", "themselves" ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/api/util/summarize_mutation.py#L1-L12
[ "def", "summarize_mutation", "(", "mutation_name", ",", "event", ",", "inputs", ",", "outputs", ",", "isAsync", "=", "False", ")", ":", "return", "dict", "(", "name", "=", "mutation_name", ",", "event", "=", "event", ",", "isAsync", "=", "isAsync", ",", ...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
PasswordHash.new
Creates a PasswordHash from the given password.
nautilus/auth/primitives/passwordHash.py
def new(cls, password, rounds): """Creates a PasswordHash from the given password.""" if isinstance(password, str): password = password.encode('utf-8') return cls(cls._new(password, rounds))
def new(cls, password, rounds): """Creates a PasswordHash from the given password.""" if isinstance(password, str): password = password.encode('utf-8') return cls(cls._new(password, rounds))
[ "Creates", "a", "PasswordHash", "from", "the", "given", "password", "." ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/auth/primitives/passwordHash.py#L51-L55
[ "def", "new", "(", "cls", ",", "password", ",", "rounds", ")", ":", "if", "isinstance", "(", "password", ",", "str", ")", ":", "password", "=", "password", ".", "encode", "(", "'utf-8'", ")", "return", "cls", "(", "cls", ".", "_new", "(", "password",...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
PasswordHash.coerce
Ensure that loaded values are PasswordHashes.
nautilus/auth/primitives/passwordHash.py
def coerce(cls, key, value): """Ensure that loaded values are PasswordHashes.""" if isinstance(value, PasswordHash): return value return super(PasswordHash, cls).coerce(key, value)
def coerce(cls, key, value): """Ensure that loaded values are PasswordHashes.""" if isinstance(value, PasswordHash): return value return super(PasswordHash, cls).coerce(key, value)
[ "Ensure", "that", "loaded", "values", "are", "PasswordHashes", "." ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/auth/primitives/passwordHash.py#L59-L63
[ "def", "coerce", "(", "cls", ",", "key", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "PasswordHash", ")", ":", "return", "value", "return", "super", "(", "PasswordHash", ",", "cls", ")", ".", "coerce", "(", "key", ",", "value", ")"...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
PasswordHash.rehash
Recreates the internal hash.
nautilus/auth/primitives/passwordHash.py
def rehash(self, password): """Recreates the internal hash.""" self.hash = self._new(password, self.desired_rounds) self.rounds = self.desired_rounds
def rehash(self, password): """Recreates the internal hash.""" self.hash = self._new(password, self.desired_rounds) self.rounds = self.desired_rounds
[ "Recreates", "the", "internal", "hash", "." ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/auth/primitives/passwordHash.py#L75-L78
[ "def", "rehash", "(", "self", ",", "password", ")", ":", "self", ".", "hash", "=", "self", ".", "_new", "(", "password", ",", "self", ".", "desired_rounds", ")", "self", ".", "rounds", "=", "self", ".", "desired_rounds" ]
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
ModelService.init_db
This function configures the database used for models to make the configuration parameters.
nautilus/services/modelService.py
def init_db(self): """ This function configures the database used for models to make the configuration parameters. """ # get the database url from the configuration db_url = self.config.get('database_url', 'sqlite:///nautilus.db') # configure the nautilus ...
def init_db(self): """ This function configures the database used for models to make the configuration parameters. """ # get the database url from the configuration db_url = self.config.get('database_url', 'sqlite:///nautilus.db') # configure the nautilus ...
[ "This", "function", "configures", "the", "database", "used", "for", "models", "to", "make", "the", "configuration", "parameters", "." ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/services/modelService.py#L101-L109
[ "def", "init_db", "(", "self", ")", ":", "# get the database url from the configuration", "db_url", "=", "self", ".", "config", ".", "get", "(", "'database_url'", ",", "'sqlite:///nautilus.db'", ")", "# configure the nautilus database to the url", "nautilus", ".", "databa...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
APIGateway.auth_criteria
This attribute provides the mapping of services to their auth requirement Returns: (dict) : the mapping from services to their auth requirements.
nautilus/services/apiGateway.py
def auth_criteria(self): """ This attribute provides the mapping of services to their auth requirement Returns: (dict) : the mapping from services to their auth requirements. """ # the dictionary we will return auth = {} # go over each at...
def auth_criteria(self): """ This attribute provides the mapping of services to their auth requirement Returns: (dict) : the mapping from services to their auth requirements. """ # the dictionary we will return auth = {} # go over each at...
[ "This", "attribute", "provides", "the", "mapping", "of", "services", "to", "their", "auth", "requirement" ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/services/apiGateway.py#L87-L109
[ "def", "auth_criteria", "(", "self", ")", ":", "# the dictionary we will return", "auth", "=", "{", "}", "# go over each attribute of the service", "for", "attr", "in", "dir", "(", "self", ")", ":", "# make sure we could hit an infinite loop", "if", "attr", "!=", "'au...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
APIGateway.login_user
This function handles the registration of the given user credentials in the database
nautilus/services/apiGateway.py
async def login_user(self, password, **kwds): """ This function handles the registration of the given user credentials in the database """ # find the matching user with the given email user_data = (await self._get_matching_user(fields=list(kwds.keys()), **kwds))['data'] ...
async def login_user(self, password, **kwds): """ This function handles the registration of the given user credentials in the database """ # find the matching user with the given email user_data = (await self._get_matching_user(fields=list(kwds.keys()), **kwds))['data'] ...
[ "This", "function", "handles", "the", "registration", "of", "the", "given", "user", "credentials", "in", "the", "database" ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/services/apiGateway.py#L144-L172
[ "async", "def", "login_user", "(", "self", ",", "password", ",", "*", "*", "kwds", ")", ":", "# find the matching user with the given email", "user_data", "=", "(", "await", "self", ".", "_get_matching_user", "(", "fields", "=", "list", "(", "kwds", ".", "keys...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
APIGateway.register_user
This function is used to provide a sessionToken for later requests. Args: uid (str): The
nautilus/services/apiGateway.py
async def register_user(self, password, **kwds): """ This function is used to provide a sessionToken for later requests. Args: uid (str): The """ # so make one user = await self._create_remote_user(password=password, **kwds) # if there is ...
async def register_user(self, password, **kwds): """ This function is used to provide a sessionToken for later requests. Args: uid (str): The """ # so make one user = await self._create_remote_user(password=password, **kwds) # if there is ...
[ "This", "function", "is", "used", "to", "provide", "a", "sessionToken", "for", "later", "requests", "." ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/services/apiGateway.py#L175-L207
[ "async", "def", "register_user", "(", "self", ",", "password", ",", "*", "*", "kwds", ")", ":", "# so make one", "user", "=", "await", "self", ".", "_create_remote_user", "(", "password", "=", "password", ",", "*", "*", "kwds", ")", "# if there is no pk fiel...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
APIGateway.object_resolver
This function resolves a given object in the remote backend services
nautilus/services/apiGateway.py
async def object_resolver(self, object_name, fields, obey_auth=False, current_user=None, **filters): """ This function resolves a given object in the remote backend services """ try: # check if an object with that name has been registered registered = [model ...
async def object_resolver(self, object_name, fields, obey_auth=False, current_user=None, **filters): """ This function resolves a given object in the remote backend services """ try: # check if an object with that name has been registered registered = [model ...
[ "This", "function", "resolves", "a", "given", "object", "in", "the", "remote", "backend", "services" ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/services/apiGateway.py#L210-L293
[ "async", "def", "object_resolver", "(", "self", ",", "object_name", ",", "fields", ",", "obey_auth", "=", "False", ",", "current_user", "=", "None", ",", "*", "*", "filters", ")", ":", "try", ":", "# check if an object with that name has been registered", "registe...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
APIGateway.mutation_resolver
the default behavior for mutations is to look up the event, publish the correct event type with the args as the body, and return the fields contained in the result
nautilus/services/apiGateway.py
async def mutation_resolver(self, mutation_name, args, fields): """ the default behavior for mutations is to look up the event, publish the correct event type with the args as the body, and return the fields contained in the result """ try: # make...
async def mutation_resolver(self, mutation_name, args, fields): """ the default behavior for mutations is to look up the event, publish the correct event type with the args as the body, and return the fields contained in the result """ try: # make...
[ "the", "default", "behavior", "for", "mutations", "is", "to", "look", "up", "the", "event", "publish", "the", "correct", "event", "type", "with", "the", "args", "as", "the", "body", "and", "return", "the", "fields", "contained", "in", "the", "result" ]
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/services/apiGateway.py#L350-L385
[ "async", "def", "mutation_resolver", "(", "self", ",", "mutation_name", ",", "args", ",", "fields", ")", ":", "try", ":", "# make sure we can identify the mutation", "mutation_summary", "=", "[", "mutation", "for", "mutation", "in", "self", ".", "_external_service_d...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
APIGateway._check_for_matching_user
This function checks if there is a user with the same uid in the remote user service Args: **kwds : the filters of the user to check for Returns: (bool): wether or not there is a matching user
nautilus/services/apiGateway.py
async def _check_for_matching_user(self, **user_filters): """ This function checks if there is a user with the same uid in the remote user service Args: **kwds : the filters of the user to check for Returns: (bool): wether or not th...
async def _check_for_matching_user(self, **user_filters): """ This function checks if there is a user with the same uid in the remote user service Args: **kwds : the filters of the user to check for Returns: (bool): wether or not th...
[ "This", "function", "checks", "if", "there", "is", "a", "user", "with", "the", "same", "uid", "in", "the", "remote", "user", "service", "Args", ":", "**", "kwds", ":", "the", "filters", "of", "the", "user", "to", "check", "for", "Returns", ":", "(", ...
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/services/apiGateway.py#L434-L447
[ "async", "def", "_check_for_matching_user", "(", "self", ",", "*", "*", "user_filters", ")", ":", "# there is a matching user if there are no errors and no results from", "user_data", "=", "self", ".", "_get_matching_user", "(", "user_filters", ")", "# return true if there we...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
APIGateway._create_remote_user
This method creates a service record in the remote user service with the given email. Args: uid (str): the user identifier to create Returns: (dict): a summary of the user that was created
nautilus/services/apiGateway.py
async def _create_remote_user(self, **payload): """ This method creates a service record in the remote user service with the given email. Args: uid (str): the user identifier to create Returns: (dict): a summary of the user that was...
async def _create_remote_user(self, **payload): """ This method creates a service record in the remote user service with the given email. Args: uid (str): the user identifier to create Returns: (dict): a summary of the user that was...
[ "This", "method", "creates", "a", "service", "record", "in", "the", "remote", "user", "service", "with", "the", "given", "email", ".", "Args", ":", "uid", "(", "str", ")", ":", "the", "user", "identifier", "to", "create", "Returns", ":", "(", "dict", "...
AlecAivazis/graphql-over-kafka
python
https://github.com/AlecAivazis/graphql-over-kafka/blob/70e2acef27a2f87355590be1a6ca60ce3ab4d09c/nautilus/services/apiGateway.py#L450-L468
[ "async", "def", "_create_remote_user", "(", "self", ",", "*", "*", "payload", ")", ":", "# the action for reading user entries", "read_action", "=", "get_crud_action", "(", "method", "=", "'create'", ",", "model", "=", "'user'", ")", "# see if there is a matching user...
70e2acef27a2f87355590be1a6ca60ce3ab4d09c
train
calculate_wer
Calculation of WER with Levenshtein distance. Works only for iterables up to 254 elements (uint8). O(nm) time and space complexity. >>> calculate_wer("who is there".split(), "is there".split()) 1 >>> calculate_wer("who is there".split(), "".split()) 3 >>> calcula...
asr/align.py
def calculate_wer(reference, hypothesis): """ Calculation of WER with Levenshtein distance. Works only for iterables up to 254 elements (uint8). O(nm) time and space complexity. >>> calculate_wer("who is there".split(), "is there".split()) 1 >>> calculate_wer("who is...
def calculate_wer(reference, hypothesis): """ Calculation of WER with Levenshtein distance. Works only for iterables up to 254 elements (uint8). O(nm) time and space complexity. >>> calculate_wer("who is there".split(), "is there".split()) 1 >>> calculate_wer("who is...
[ "Calculation", "of", "WER", "with", "Levenshtein", "distance", ".", "Works", "only", "for", "iterables", "up", "to", "254", "elements", "(", "uint8", ")", ".", "O", "(", "nm", ")", "time", "and", "space", "complexity", "." ]
MartinThoma/asr
python
https://github.com/MartinThoma/asr/blob/b453074761a4a2f1ee40cd5315b2e000c3b72142/asr/align.py#L7-L42
[ "def", "calculate_wer", "(", "reference", ",", "hypothesis", ")", ":", "# initialisation", "import", "numpy", "d", "=", "numpy", ".", "zeros", "(", "(", "len", "(", "reference", ")", "+", "1", ")", "*", "(", "len", "(", "hypothesis", ")", "+", "1", "...
b453074761a4a2f1ee40cd5315b2e000c3b72142
train
get_parser
Get a parser object
asr/align.py
def get_parser(): """Get a parser object""" from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter parser = ArgumentParser(description=__doc__, formatter_class=ArgumentDefaultsHelpFormatter) parser.add_argument("-s1", dest="s1", help="sequence 1") parser.add_a...
def get_parser(): """Get a parser object""" from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter parser = ArgumentParser(description=__doc__, formatter_class=ArgumentDefaultsHelpFormatter) parser.add_argument("-s1", dest="s1", help="sequence 1") parser.add_a...
[ "Get", "a", "parser", "object" ]
MartinThoma/asr
python
https://github.com/MartinThoma/asr/blob/b453074761a4a2f1ee40cd5315b2e000c3b72142/asr/align.py#L45-L52
[ "def", "get_parser", "(", ")", ":", "from", "argparse", "import", "ArgumentParser", ",", "ArgumentDefaultsHelpFormatter", "parser", "=", "ArgumentParser", "(", "description", "=", "__doc__", ",", "formatter_class", "=", "ArgumentDefaultsHelpFormatter", ")", "parser", ...
b453074761a4a2f1ee40cd5315b2e000c3b72142
train
_async_request_soup
Perform a GET web request and return a bs4 parser
pyteleloisirs/pyteleloisirs.py
async def _async_request_soup(url): ''' Perform a GET web request and return a bs4 parser ''' from bs4 import BeautifulSoup import aiohttp _LOGGER.debug('GET %s', url) async with aiohttp.ClientSession() as session: resp = await session.get(url) text = await resp.text() ...
async def _async_request_soup(url): ''' Perform a GET web request and return a bs4 parser ''' from bs4 import BeautifulSoup import aiohttp _LOGGER.debug('GET %s', url) async with aiohttp.ClientSession() as session: resp = await session.get(url) text = await resp.text() ...
[ "Perform", "a", "GET", "web", "request", "and", "return", "a", "bs4", "parser" ]
pschmitt/pyteleloisirs
python
https://github.com/pschmitt/pyteleloisirs/blob/d63610fd3729862455ac42afca440469f8063fba/pyteleloisirs/pyteleloisirs.py#L15-L25
[ "async", "def", "_async_request_soup", "(", "url", ")", ":", "from", "bs4", "import", "BeautifulSoup", "import", "aiohttp", "_LOGGER", ".", "debug", "(", "'GET %s'", ",", "url", ")", "async", "with", "aiohttp", ".", "ClientSession", "(", ")", "as", "session"...
d63610fd3729862455ac42afca440469f8063fba
train
async_determine_channel
Check whether the current channel is correct. If not try to determine it using fuzzywuzzy
pyteleloisirs/pyteleloisirs.py
async def async_determine_channel(channel): ''' Check whether the current channel is correct. If not try to determine it using fuzzywuzzy ''' from fuzzywuzzy import process channel_data = await async_get_channels() if not channel_data: _LOGGER.error('No channel data. Cannot determine...
async def async_determine_channel(channel): ''' Check whether the current channel is correct. If not try to determine it using fuzzywuzzy ''' from fuzzywuzzy import process channel_data = await async_get_channels() if not channel_data: _LOGGER.error('No channel data. Cannot determine...
[ "Check", "whether", "the", "current", "channel", "is", "correct", ".", "If", "not", "try", "to", "determine", "it", "using", "fuzzywuzzy" ]
pschmitt/pyteleloisirs
python
https://github.com/pschmitt/pyteleloisirs/blob/d63610fd3729862455ac42afca440469f8063fba/pyteleloisirs/pyteleloisirs.py#L28-L45
[ "async", "def", "async_determine_channel", "(", "channel", ")", ":", "from", "fuzzywuzzy", "import", "process", "channel_data", "=", "await", "async_get_channels", "(", ")", "if", "not", "channel_data", ":", "_LOGGER", ".", "error", "(", "'No channel data. Cannot de...
d63610fd3729862455ac42afca440469f8063fba
train
async_get_channels
Get channel list and corresponding urls
pyteleloisirs/pyteleloisirs.py
async def async_get_channels(no_cache=False, refresh_interval=4): ''' Get channel list and corresponding urls ''' # Check cache now = datetime.datetime.now() max_cache_age = datetime.timedelta(hours=refresh_interval) if not no_cache and 'channels' in _CACHE: cache = _CACHE.get('chann...
async def async_get_channels(no_cache=False, refresh_interval=4): ''' Get channel list and corresponding urls ''' # Check cache now = datetime.datetime.now() max_cache_age = datetime.timedelta(hours=refresh_interval) if not no_cache and 'channels' in _CACHE: cache = _CACHE.get('chann...
[ "Get", "channel", "list", "and", "corresponding", "urls" ]
pschmitt/pyteleloisirs
python
https://github.com/pschmitt/pyteleloisirs/blob/d63610fd3729862455ac42afca440469f8063fba/pyteleloisirs/pyteleloisirs.py#L48-L80
[ "async", "def", "async_get_channels", "(", "no_cache", "=", "False", ",", "refresh_interval", "=", "4", ")", ":", "# Check cache", "now", "=", "datetime", ".", "datetime", ".", "now", "(", ")", "max_cache_age", "=", "datetime", ".", "timedelta", "(", "hours"...
d63610fd3729862455ac42afca440469f8063fba
train
resize_program_image
Resize a program's thumbnail to the desired dimension
pyteleloisirs/pyteleloisirs.py
def resize_program_image(img_url, img_size=300): ''' Resize a program's thumbnail to the desired dimension ''' match = re.match(r'.+/(\d+)x(\d+)/.+', img_url) if not match: _LOGGER.warning('Could not compute current image resolution of %s', img_url) return img...
def resize_program_image(img_url, img_size=300): ''' Resize a program's thumbnail to the desired dimension ''' match = re.match(r'.+/(\d+)x(\d+)/.+', img_url) if not match: _LOGGER.warning('Could not compute current image resolution of %s', img_url) return img...
[ "Resize", "a", "program", "s", "thumbnail", "to", "the", "desired", "dimension" ]
pschmitt/pyteleloisirs
python
https://github.com/pschmitt/pyteleloisirs/blob/d63610fd3729862455ac42afca440469f8063fba/pyteleloisirs/pyteleloisirs.py#L83-L99
[ "def", "resize_program_image", "(", "img_url", ",", "img_size", "=", "300", ")", ":", "match", "=", "re", ".", "match", "(", "r'.+/(\\d+)x(\\d+)/.+'", ",", "img_url", ")", "if", "not", "match", ":", "_LOGGER", ".", "warning", "(", "'Could not compute current i...
d63610fd3729862455ac42afca440469f8063fba
train
get_current_program_progress
Get the current progress of the program in %
pyteleloisirs/pyteleloisirs.py
def get_current_program_progress(program): ''' Get the current progress of the program in % ''' now = datetime.datetime.now() program_duration = get_program_duration(program) if not program_duration: return progress = now - program.get('start_time') return progress.seconds * 100 ...
def get_current_program_progress(program): ''' Get the current progress of the program in % ''' now = datetime.datetime.now() program_duration = get_program_duration(program) if not program_duration: return progress = now - program.get('start_time') return progress.seconds * 100 ...
[ "Get", "the", "current", "progress", "of", "the", "program", "in", "%" ]
pschmitt/pyteleloisirs
python
https://github.com/pschmitt/pyteleloisirs/blob/d63610fd3729862455ac42afca440469f8063fba/pyteleloisirs/pyteleloisirs.py#L102-L111
[ "def", "get_current_program_progress", "(", "program", ")", ":", "now", "=", "datetime", ".", "datetime", ".", "now", "(", ")", "program_duration", "=", "get_program_duration", "(", "program", ")", "if", "not", "program_duration", ":", "return", "progress", "=",...
d63610fd3729862455ac42afca440469f8063fba
train
get_program_duration
Get a program's duration in seconds
pyteleloisirs/pyteleloisirs.py
def get_program_duration(program): ''' Get a program's duration in seconds ''' program_start = program.get('start_time') program_end = program.get('end_time') if not program_start or not program_end: _LOGGER.error('Could not determine program start and/or end times.') _LOGGER.deb...
def get_program_duration(program): ''' Get a program's duration in seconds ''' program_start = program.get('start_time') program_end = program.get('end_time') if not program_start or not program_end: _LOGGER.error('Could not determine program start and/or end times.') _LOGGER.deb...
[ "Get", "a", "program", "s", "duration", "in", "seconds" ]
pschmitt/pyteleloisirs
python
https://github.com/pschmitt/pyteleloisirs/blob/d63610fd3729862455ac42afca440469f8063fba/pyteleloisirs/pyteleloisirs.py#L114-L125
[ "def", "get_program_duration", "(", "program", ")", ":", "program_start", "=", "program", ".", "get", "(", "'start_time'", ")", "program_end", "=", "program", ".", "get", "(", "'end_time'", ")", "if", "not", "program_start", "or", "not", "program_end", ":", ...
d63610fd3729862455ac42afca440469f8063fba
train
get_remaining_time
Get the remaining time in seconds of a program that is currently on.
pyteleloisirs/pyteleloisirs.py
def get_remaining_time(program): ''' Get the remaining time in seconds of a program that is currently on. ''' now = datetime.datetime.now() program_start = program.get('start_time') program_end = program.get('end_time') if not program_start or not program_end: _LOGGER.error('Could no...
def get_remaining_time(program): ''' Get the remaining time in seconds of a program that is currently on. ''' now = datetime.datetime.now() program_start = program.get('start_time') program_end = program.get('end_time') if not program_start or not program_end: _LOGGER.error('Could no...
[ "Get", "the", "remaining", "time", "in", "seconds", "of", "a", "program", "that", "is", "currently", "on", "." ]
pschmitt/pyteleloisirs
python
https://github.com/pschmitt/pyteleloisirs/blob/d63610fd3729862455ac42afca440469f8063fba/pyteleloisirs/pyteleloisirs.py#L128-L144
[ "def", "get_remaining_time", "(", "program", ")", ":", "now", "=", "datetime", ".", "datetime", ".", "now", "(", ")", "program_start", "=", "program", ".", "get", "(", "'start_time'", ")", "program_end", "=", "program", ".", "get", "(", "'end_time'", ")", ...
d63610fd3729862455ac42afca440469f8063fba
train
extract_program_summary
Extract the summary data from a program's detail page
pyteleloisirs/pyteleloisirs.py
def extract_program_summary(data): ''' Extract the summary data from a program's detail page ''' from bs4 import BeautifulSoup soup = BeautifulSoup(data, 'html.parser') try: return soup.find( 'div', {'class': 'episode-synopsis'} ).find_all('div')[-1].text.strip() ...
def extract_program_summary(data): ''' Extract the summary data from a program's detail page ''' from bs4 import BeautifulSoup soup = BeautifulSoup(data, 'html.parser') try: return soup.find( 'div', {'class': 'episode-synopsis'} ).find_all('div')[-1].text.strip() ...
[ "Extract", "the", "summary", "data", "from", "a", "program", "s", "detail", "page" ]
pschmitt/pyteleloisirs
python
https://github.com/pschmitt/pyteleloisirs/blob/d63610fd3729862455ac42afca440469f8063fba/pyteleloisirs/pyteleloisirs.py#L147-L160
[ "def", "extract_program_summary", "(", "data", ")", ":", "from", "bs4", "import", "BeautifulSoup", "soup", "=", "BeautifulSoup", "(", "data", ",", "'html.parser'", ")", "try", ":", "return", "soup", ".", "find", "(", "'div'", ",", "{", "'class'", ":", "'ep...
d63610fd3729862455ac42afca440469f8063fba
train
async_set_summary
Set a program's summary
pyteleloisirs/pyteleloisirs.py
async def async_set_summary(program): ''' Set a program's summary ''' import aiohttp async with aiohttp.ClientSession() as session: resp = await session.get(program.get('url')) text = await resp.text() summary = extract_program_summary(text) program['summary'] = summa...
async def async_set_summary(program): ''' Set a program's summary ''' import aiohttp async with aiohttp.ClientSession() as session: resp = await session.get(program.get('url')) text = await resp.text() summary = extract_program_summary(text) program['summary'] = summa...
[ "Set", "a", "program", "s", "summary" ]
pschmitt/pyteleloisirs
python
https://github.com/pschmitt/pyteleloisirs/blob/d63610fd3729862455ac42afca440469f8063fba/pyteleloisirs/pyteleloisirs.py#L163-L173
[ "async", "def", "async_set_summary", "(", "program", ")", ":", "import", "aiohttp", "async", "with", "aiohttp", ".", "ClientSession", "(", ")", "as", "session", ":", "resp", "=", "await", "session", ".", "get", "(", "program", ".", "get", "(", "'url'", "...
d63610fd3729862455ac42afca440469f8063fba
train
async_get_program_guide
Get the program data for a channel
pyteleloisirs/pyteleloisirs.py
async def async_get_program_guide(channel, no_cache=False, refresh_interval=4): ''' Get the program data for a channel ''' chan = await async_determine_channel(channel) now = datetime.datetime.now() max_cache_age = datetime.timedelta(hours=refresh_interval) if not no_cache and 'guide' in _CA...
async def async_get_program_guide(channel, no_cache=False, refresh_interval=4): ''' Get the program data for a channel ''' chan = await async_determine_channel(channel) now = datetime.datetime.now() max_cache_age = datetime.timedelta(hours=refresh_interval) if not no_cache and 'guide' in _CA...
[ "Get", "the", "program", "data", "for", "a", "channel" ]
pschmitt/pyteleloisirs
python
https://github.com/pschmitt/pyteleloisirs/blob/d63610fd3729862455ac42afca440469f8063fba/pyteleloisirs/pyteleloisirs.py#L176-L232
[ "async", "def", "async_get_program_guide", "(", "channel", ",", "no_cache", "=", "False", ",", "refresh_interval", "=", "4", ")", ":", "chan", "=", "await", "async_determine_channel", "(", "channel", ")", "now", "=", "datetime", ".", "datetime", ".", "now", ...
d63610fd3729862455ac42afca440469f8063fba
train
async_get_current_program
Get the current program info
pyteleloisirs/pyteleloisirs.py
async def async_get_current_program(channel, no_cache=False): ''' Get the current program info ''' chan = await async_determine_channel(channel) guide = await async_get_program_guide(chan, no_cache) if not guide: _LOGGER.warning('Could not retrieve TV program for %s', channel) re...
async def async_get_current_program(channel, no_cache=False): ''' Get the current program info ''' chan = await async_determine_channel(channel) guide = await async_get_program_guide(chan, no_cache) if not guide: _LOGGER.warning('Could not retrieve TV program for %s', channel) re...
[ "Get", "the", "current", "program", "info" ]
pschmitt/pyteleloisirs
python
https://github.com/pschmitt/pyteleloisirs/blob/d63610fd3729862455ac42afca440469f8063fba/pyteleloisirs/pyteleloisirs.py#L235-L249
[ "async", "def", "async_get_current_program", "(", "channel", ",", "no_cache", "=", "False", ")", ":", "chan", "=", "await", "async_determine_channel", "(", "channel", ")", "guide", "=", "await", "async_get_program_guide", "(", "chan", ",", "no_cache", ")", "if",...
d63610fd3729862455ac42afca440469f8063fba
train
PublishManager.publish
Get or create publish
aptly/publisher/__init__.py
def publish(self, distribution, storage=""): """ Get or create publish """ try: return self._publishes[distribution] except KeyError: self._publishes[distribution] = Publish(self.client, distribution, timestamp=self.timestamp, storage=(storage or self.stor...
def publish(self, distribution, storage=""): """ Get or create publish """ try: return self._publishes[distribution] except KeyError: self._publishes[distribution] = Publish(self.client, distribution, timestamp=self.timestamp, storage=(storage or self.stor...
[ "Get", "or", "create", "publish" ]
tcpcloud/python-aptly
python
https://github.com/tcpcloud/python-aptly/blob/7eb4ce1c508666bad0e6a0d4c5c561b1485ed558/aptly/publisher/__init__.py#L29-L37
[ "def", "publish", "(", "self", ",", "distribution", ",", "storage", "=", "\"\"", ")", ":", "try", ":", "return", "self", ".", "_publishes", "[", "distribution", "]", "except", "KeyError", ":", "self", ".", "_publishes", "[", "distribution", "]", "=", "Pu...
7eb4ce1c508666bad0e6a0d4c5c561b1485ed558
train
PublishManager.add
Add mirror or repo to publish
aptly/publisher/__init__.py
def add(self, snapshot, distributions, component='main', storage=""): """ Add mirror or repo to publish """ for dist in distributions: self.publish(dist, storage=storage).add(snapshot, component)
def add(self, snapshot, distributions, component='main', storage=""): """ Add mirror or repo to publish """ for dist in distributions: self.publish(dist, storage=storage).add(snapshot, component)
[ "Add", "mirror", "or", "repo", "to", "publish" ]
tcpcloud/python-aptly
python
https://github.com/tcpcloud/python-aptly/blob/7eb4ce1c508666bad0e6a0d4c5c561b1485ed558/aptly/publisher/__init__.py#L39-L42
[ "def", "add", "(", "self", ",", "snapshot", ",", "distributions", ",", "component", "=", "'main'", ",", "storage", "=", "\"\"", ")", ":", "for", "dist", "in", "distributions", ":", "self", ".", "publish", "(", "dist", ",", "storage", "=", "storage", ")...
7eb4ce1c508666bad0e6a0d4c5c561b1485ed558
train
PublishManager._publish_match
Check if publish name matches list of names or regex patterns
aptly/publisher/__init__.py
def _publish_match(self, publish, names=False, name_only=False): """ Check if publish name matches list of names or regex patterns """ if names: for name in names: if not name_only and isinstance(name, re._pattern_type): if re.match(name, p...
def _publish_match(self, publish, names=False, name_only=False): """ Check if publish name matches list of names or regex patterns """ if names: for name in names: if not name_only and isinstance(name, re._pattern_type): if re.match(name, p...
[ "Check", "if", "publish", "name", "matches", "list", "of", "names", "or", "regex", "patterns" ]
tcpcloud/python-aptly
python
https://github.com/tcpcloud/python-aptly/blob/7eb4ce1c508666bad0e6a0d4c5c561b1485ed558/aptly/publisher/__init__.py#L87-L102
[ "def", "_publish_match", "(", "self", ",", "publish", ",", "names", "=", "False", ",", "name_only", "=", "False", ")", ":", "if", "names", ":", "for", "name", "in", "names", ":", "if", "not", "name_only", "and", "isinstance", "(", "name", ",", "re", ...
7eb4ce1c508666bad0e6a0d4c5c561b1485ed558
train
PublishManager.get_repo_information
fill two dictionnaries : one containing all the packages for every repository and the second one associating to every component of every publish its repository
aptly/publisher/__init__.py
def get_repo_information(config, client, fill_repo=False, components=[]): """ fill two dictionnaries : one containing all the packages for every repository and the second one associating to every component of every publish its repository""" repo_dict = {} publish_dict = {} f...
def get_repo_information(config, client, fill_repo=False, components=[]): """ fill two dictionnaries : one containing all the packages for every repository and the second one associating to every component of every publish its repository""" repo_dict = {} publish_dict = {} f...
[ "fill", "two", "dictionnaries", ":", "one", "containing", "all", "the", "packages", "for", "every", "repository", "and", "the", "second", "one", "associating", "to", "every", "component", "of", "every", "publish", "its", "repository" ]
tcpcloud/python-aptly
python
https://github.com/tcpcloud/python-aptly/blob/7eb4ce1c508666bad0e6a0d4c5c561b1485ed558/aptly/publisher/__init__.py#L144-L161
[ "def", "get_repo_information", "(", "config", ",", "client", ",", "fill_repo", "=", "False", ",", "components", "=", "[", "]", ")", ":", "repo_dict", "=", "{", "}", "publish_dict", "=", "{", "}", "for", "origin", "in", "[", "'repo'", ",", "'mirror'", "...
7eb4ce1c508666bad0e6a0d4c5c561b1485ed558
train
Publish.compare
Compare two publishes It expects that other publish is same or older than this one Return tuple (diff, equal) of dict {'component': ['snapshot']}
aptly/publisher/__init__.py
def compare(self, other, components=[]): """ Compare two publishes It expects that other publish is same or older than this one Return tuple (diff, equal) of dict {'component': ['snapshot']} """ lg.debug("Comparing publish %s (%s) and %s (%s)" % (self.name, self.storage ...
def compare(self, other, components=[]): """ Compare two publishes It expects that other publish is same or older than this one Return tuple (diff, equal) of dict {'component': ['snapshot']} """ lg.debug("Comparing publish %s (%s) and %s (%s)" % (self.name, self.storage ...
[ "Compare", "two", "publishes", "It", "expects", "that", "other", "publish", "is", "same", "or", "older", "than", "this", "one" ]
tcpcloud/python-aptly
python
https://github.com/tcpcloud/python-aptly/blob/7eb4ce1c508666bad0e6a0d4c5c561b1485ed558/aptly/publisher/__init__.py#L275-L302
[ "def", "compare", "(", "self", ",", "other", ",", "components", "=", "[", "]", ")", ":", "lg", ".", "debug", "(", "\"Comparing publish %s (%s) and %s (%s)\"", "%", "(", "self", ".", "name", ",", "self", ".", "storage", "or", "\"local\"", ",", "other", "....
7eb4ce1c508666bad0e6a0d4c5c561b1485ed558
train
Publish._get_publish
Find this publish on remote
aptly/publisher/__init__.py
def _get_publish(self): """ Find this publish on remote """ publishes = self._get_publishes(self.client) for publish in publishes: if publish['Distribution'] == self.distribution and \ publish['Prefix'].replace("/", "_") == (self.prefix or '.') and...
def _get_publish(self): """ Find this publish on remote """ publishes = self._get_publishes(self.client) for publish in publishes: if publish['Distribution'] == self.distribution and \ publish['Prefix'].replace("/", "_") == (self.prefix or '.') and...
[ "Find", "this", "publish", "on", "remote" ]
tcpcloud/python-aptly
python
https://github.com/tcpcloud/python-aptly/blob/7eb4ce1c508666bad0e6a0d4c5c561b1485ed558/aptly/publisher/__init__.py#L351-L361
[ "def", "_get_publish", "(", "self", ")", ":", "publishes", "=", "self", ".", "_get_publishes", "(", "self", ".", "client", ")", "for", "publish", "in", "publishes", ":", "if", "publish", "[", "'Distribution'", "]", "==", "self", ".", "distribution", "and",...
7eb4ce1c508666bad0e6a0d4c5c561b1485ed558
train
Publish.save_publish
Serialize publish in YAML
aptly/publisher/__init__.py
def save_publish(self, save_path): """ Serialize publish in YAML """ timestamp = time.strftime("%Y%m%d%H%M%S") yaml_dict = {} yaml_dict["publish"] = self.name yaml_dict["name"] = timestamp yaml_dict["components"] = [] yaml_dict["storage"] = self.s...
def save_publish(self, save_path): """ Serialize publish in YAML """ timestamp = time.strftime("%Y%m%d%H%M%S") yaml_dict = {} yaml_dict["publish"] = self.name yaml_dict["name"] = timestamp yaml_dict["components"] = [] yaml_dict["storage"] = self.s...
[ "Serialize", "publish", "in", "YAML" ]
tcpcloud/python-aptly
python
https://github.com/tcpcloud/python-aptly/blob/7eb4ce1c508666bad0e6a0d4c5c561b1485ed558/aptly/publisher/__init__.py#L367-L392
[ "def", "save_publish", "(", "self", ",", "save_path", ")", ":", "timestamp", "=", "time", ".", "strftime", "(", "\"%Y%m%d%H%M%S\"", ")", "yaml_dict", "=", "{", "}", "yaml_dict", "[", "\"publish\"", "]", "=", "self", ".", "name", "yaml_dict", "[", "\"name\"...
7eb4ce1c508666bad0e6a0d4c5c561b1485ed558
train
Publish.restore_publish
Restore publish from config file
aptly/publisher/__init__.py
def restore_publish(self, config, components, recreate=False): """ Restore publish from config file """ if "all" in components: components = [] try: self.load() publish = True except NoSuchPublish: publish = False ...
def restore_publish(self, config, components, recreate=False): """ Restore publish from config file """ if "all" in components: components = [] try: self.load() publish = True except NoSuchPublish: publish = False ...
[ "Restore", "publish", "from", "config", "file" ]
tcpcloud/python-aptly
python
https://github.com/tcpcloud/python-aptly/blob/7eb4ce1c508666bad0e6a0d4c5c561b1485ed558/aptly/publisher/__init__.py#L467-L541
[ "def", "restore_publish", "(", "self", ",", "config", ",", "components", ",", "recreate", "=", "False", ")", ":", "if", "\"all\"", "in", "components", ":", "components", "=", "[", "]", "try", ":", "self", ".", "load", "(", ")", "publish", "=", "True", ...
7eb4ce1c508666bad0e6a0d4c5c561b1485ed558
train
Publish.load
Load publish info from remote
aptly/publisher/__init__.py
def load(self): """ Load publish info from remote """ publish = self._get_publish() self.architectures = publish['Architectures'] for source in publish['Sources']: component = source['Component'] snapshot = source['Name'] self.publish_s...
def load(self): """ Load publish info from remote """ publish = self._get_publish() self.architectures = publish['Architectures'] for source in publish['Sources']: component = source['Component'] snapshot = source['Name'] self.publish_s...
[ "Load", "publish", "info", "from", "remote" ]
tcpcloud/python-aptly
python
https://github.com/tcpcloud/python-aptly/blob/7eb4ce1c508666bad0e6a0d4c5c561b1485ed558/aptly/publisher/__init__.py#L543-L559
[ "def", "load", "(", "self", ")", ":", "publish", "=", "self", ".", "_get_publish", "(", ")", "self", ".", "architectures", "=", "publish", "[", "'Architectures'", "]", "for", "source", "in", "publish", "[", "'Sources'", "]", ":", "component", "=", "sourc...
7eb4ce1c508666bad0e6a0d4c5c561b1485ed558
train
Publish.get_packages
Return package refs for given components
aptly/publisher/__init__.py
def get_packages(self, component=None, components=[], packages=None): """ Return package refs for given components """ if component: components = [component] package_refs = [] for snapshot in self.publish_snapshots: if component and snapshot['Comp...
def get_packages(self, component=None, components=[], packages=None): """ Return package refs for given components """ if component: components = [component] package_refs = [] for snapshot in self.publish_snapshots: if component and snapshot['Comp...
[ "Return", "package", "refs", "for", "given", "components" ]
tcpcloud/python-aptly
python
https://github.com/tcpcloud/python-aptly/blob/7eb4ce1c508666bad0e6a0d4c5c561b1485ed558/aptly/publisher/__init__.py#L561-L583
[ "def", "get_packages", "(", "self", ",", "component", "=", "None", ",", "components", "=", "[", "]", ",", "packages", "=", "None", ")", ":", "if", "component", ":", "components", "=", "[", "component", "]", "package_refs", "=", "[", "]", "for", "snapsh...
7eb4ce1c508666bad0e6a0d4c5c561b1485ed558
train
Publish.parse_package_ref
Return tuple of architecture, package_name, version, id
aptly/publisher/__init__.py
def parse_package_ref(self, ref): """ Return tuple of architecture, package_name, version, id """ if not ref: return None parsed = re.match('(.*)\ (.*)\ (.*)\ (.*)', ref) return parsed.groups()
def parse_package_ref(self, ref): """ Return tuple of architecture, package_name, version, id """ if not ref: return None parsed = re.match('(.*)\ (.*)\ (.*)\ (.*)', ref) return parsed.groups()
[ "Return", "tuple", "of", "architecture", "package_name", "version", "id" ]
tcpcloud/python-aptly
python
https://github.com/tcpcloud/python-aptly/blob/7eb4ce1c508666bad0e6a0d4c5c561b1485ed558/aptly/publisher/__init__.py#L585-L592
[ "def", "parse_package_ref", "(", "self", ",", "ref", ")", ":", "if", "not", "ref", ":", "return", "None", "parsed", "=", "re", ".", "match", "(", "'(.*)\\ (.*)\\ (.*)\\ (.*)'", ",", "ref", ")", "return", "parsed", ".", "groups", "(", ")" ]
7eb4ce1c508666bad0e6a0d4c5c561b1485ed558
train
Publish.add
Add snapshot of component to publish
aptly/publisher/__init__.py
def add(self, snapshot, component='main'): """ Add snapshot of component to publish """ try: self.components[component].append(snapshot) except KeyError: self.components[component] = [snapshot]
def add(self, snapshot, component='main'): """ Add snapshot of component to publish """ try: self.components[component].append(snapshot) except KeyError: self.components[component] = [snapshot]
[ "Add", "snapshot", "of", "component", "to", "publish" ]
tcpcloud/python-aptly
python
https://github.com/tcpcloud/python-aptly/blob/7eb4ce1c508666bad0e6a0d4c5c561b1485ed558/aptly/publisher/__init__.py#L594-L601
[ "def", "add", "(", "self", ",", "snapshot", ",", "component", "=", "'main'", ")", ":", "try", ":", "self", ".", "components", "[", "component", "]", ".", "append", "(", "snapshot", ")", "except", "KeyError", ":", "self", ".", "components", "[", "compon...
7eb4ce1c508666bad0e6a0d4c5c561b1485ed558
train
Publish._find_snapshot
Find snapshot on remote by name or regular expression
aptly/publisher/__init__.py
def _find_snapshot(self, name): """ Find snapshot on remote by name or regular expression """ remote_snapshots = self._get_snapshots(self.client) for remote in reversed(remote_snapshots): if remote["Name"] == name or \ re.match(name, remote["Name"]...
def _find_snapshot(self, name): """ Find snapshot on remote by name or regular expression """ remote_snapshots = self._get_snapshots(self.client) for remote in reversed(remote_snapshots): if remote["Name"] == name or \ re.match(name, remote["Name"]...
[ "Find", "snapshot", "on", "remote", "by", "name", "or", "regular", "expression" ]
tcpcloud/python-aptly
python
https://github.com/tcpcloud/python-aptly/blob/7eb4ce1c508666bad0e6a0d4c5c561b1485ed558/aptly/publisher/__init__.py#L603-L612
[ "def", "_find_snapshot", "(", "self", ",", "name", ")", ":", "remote_snapshots", "=", "self", ".", "_get_snapshots", "(", "self", ".", "client", ")", "for", "remote", "in", "reversed", "(", "remote_snapshots", ")", ":", "if", "remote", "[", "\"Name\"", "]"...
7eb4ce1c508666bad0e6a0d4c5c561b1485ed558
train
Publish._get_source_snapshots
Get list of source snapshot names of given snapshot TODO: we have to decide by description at the moment
aptly/publisher/__init__.py
def _get_source_snapshots(self, snapshot, fallback_self=False): """ Get list of source snapshot names of given snapshot TODO: we have to decide by description at the moment """ if not snapshot: return [] source_snapshots = re.findall(r"'([\w\d\.-]+)'", snaps...
def _get_source_snapshots(self, snapshot, fallback_self=False): """ Get list of source snapshot names of given snapshot TODO: we have to decide by description at the moment """ if not snapshot: return [] source_snapshots = re.findall(r"'([\w\d\.-]+)'", snaps...
[ "Get", "list", "of", "source", "snapshot", "names", "of", "given", "snapshot" ]
tcpcloud/python-aptly
python
https://github.com/tcpcloud/python-aptly/blob/7eb4ce1c508666bad0e6a0d4c5c561b1485ed558/aptly/publisher/__init__.py#L614-L628
[ "def", "_get_source_snapshots", "(", "self", ",", "snapshot", ",", "fallback_self", "=", "False", ")", ":", "if", "not", "snapshot", ":", "return", "[", "]", "source_snapshots", "=", "re", ".", "findall", "(", "r\"'([\\w\\d\\.-]+)'\"", ",", "snapshot", "[", ...
7eb4ce1c508666bad0e6a0d4c5c561b1485ed558
train
Publish.merge_snapshots
Create component snapshots by merging other snapshots of same component
aptly/publisher/__init__.py
def merge_snapshots(self): """ Create component snapshots by merging other snapshots of same component """ self.publish_snapshots = [] for component, snapshots in self.components.items(): if len(snapshots) <= 1: # Only one snapshot, no need to merge ...
def merge_snapshots(self): """ Create component snapshots by merging other snapshots of same component """ self.publish_snapshots = [] for component, snapshots in self.components.items(): if len(snapshots) <= 1: # Only one snapshot, no need to merge ...
[ "Create", "component", "snapshots", "by", "merging", "other", "snapshots", "of", "same", "component" ]
tcpcloud/python-aptly
python
https://github.com/tcpcloud/python-aptly/blob/7eb4ce1c508666bad0e6a0d4c5c561b1485ed558/aptly/publisher/__init__.py#L630-L690
[ "def", "merge_snapshots", "(", "self", ")", ":", "self", ".", "publish_snapshots", "=", "[", "]", "for", "component", ",", "snapshots", "in", "self", ".", "components", ".", "items", "(", ")", ":", "if", "len", "(", "snapshots", ")", "<=", "1", ":", ...
7eb4ce1c508666bad0e6a0d4c5c561b1485ed558
train
timing_decorator
Prints the time func takes to execute.
nestcheck/io_utils.py
def timing_decorator(func): """Prints the time func takes to execute.""" @functools.wraps(func) def wrapper(*args, **kwargs): """ Wrapper for printing execution time. Parameters ---------- print_time: bool, optional whether or not to print time function t...
def timing_decorator(func): """Prints the time func takes to execute.""" @functools.wraps(func) def wrapper(*args, **kwargs): """ Wrapper for printing execution time. Parameters ---------- print_time: bool, optional whether or not to print time function t...
[ "Prints", "the", "time", "func", "takes", "to", "execute", "." ]
ejhigson/nestcheck
python
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/io_utils.py#L14-L36
[ "def", "timing_decorator", "(", "func", ")", ":", "@", "functools", ".", "wraps", "(", "func", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "\"\"\"\n Wrapper for printing execution time.\n\n Parameters\n ----------\n...
29151c314deb89746fd674f27f6ce54b77603189