repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
baszoetekouw/janus-py
sr/sr.py
ServiceRegistry.update
def update(self, eid, entity, note=None): """ update(int, dict, string): Merges the supplied dict into the entity record with the supplied eid. Places the supplied note as update message. """ # fetch the current entity newentity = self.get(eid) for field in ('createdAtDate', 'id', 'isActive', 'parent...
python
def update(self, eid, entity, note=None): """ update(int, dict, string): Merges the supplied dict into the entity record with the supplied eid. Places the supplied note as update message. """ # fetch the current entity newentity = self.get(eid) for field in ('createdAtDate', 'id', 'isActive', 'parent...
[ "def", "update", "(", "self", ",", "eid", ",", "entity", ",", "note", "=", "None", ")", ":", "# fetch the current entity", "newentity", "=", "self", ".", "get", "(", "eid", ")", "for", "field", "in", "(", "'createdAtDate'", ",", "'id'", ",", "'isActive'"...
update(int, dict, string): Merges the supplied dict into the entity record with the supplied eid. Places the supplied note as update message.
[ "update", "(", "int", "dict", "string", ")", ":", "Merges", "the", "supplied", "dict", "into", "the", "entity", "record", "with", "the", "supplied", "eid", ".", "Places", "the", "supplied", "note", "as", "update", "message", "." ]
train
https://github.com/baszoetekouw/janus-py/blob/4f2034436eef010ec8d77e168f6198123b5eb226/sr/sr.py#L210-L231
baszoetekouw/janus-py
sr/sr.py
ServiceRegistry.delete
def delete(self, eid): """ Removes the entity with the given eid """ result = self._http_req('connections/%u' % eid, method='DELETE') status = result['status'] if not status == 302: raise ServiceRegistryError(status, "Could not delete entity %u: %u" % (eid,status)) self.debug(0x01,result) return res...
python
def delete(self, eid): """ Removes the entity with the given eid """ result = self._http_req('connections/%u' % eid, method='DELETE') status = result['status'] if not status == 302: raise ServiceRegistryError(status, "Could not delete entity %u: %u" % (eid,status)) self.debug(0x01,result) return res...
[ "def", "delete", "(", "self", ",", "eid", ")", ":", "result", "=", "self", ".", "_http_req", "(", "'connections/%u'", "%", "eid", ",", "method", "=", "'DELETE'", ")", "status", "=", "result", "[", "'status'", "]", "if", "not", "status", "==", "302", ...
Removes the entity with the given eid
[ "Removes", "the", "entity", "with", "the", "given", "eid" ]
train
https://github.com/baszoetekouw/janus-py/blob/4f2034436eef010ec8d77e168f6198123b5eb226/sr/sr.py#L233-L243
baszoetekouw/janus-py
sr/sr.py
ServiceRegistry.add
def add(self, entity): """ Adds the supplied dict as a new entity """ result = self._http_req('connections', method='POST', payload=entity) status = result['status'] if not status==201: raise ServiceRegistryError(status,"Couldn't add entity") self.debug(0x01,result) return result['decoded']
python
def add(self, entity): """ Adds the supplied dict as a new entity """ result = self._http_req('connections', method='POST', payload=entity) status = result['status'] if not status==201: raise ServiceRegistryError(status,"Couldn't add entity") self.debug(0x01,result) return result['decoded']
[ "def", "add", "(", "self", ",", "entity", ")", ":", "result", "=", "self", ".", "_http_req", "(", "'connections'", ",", "method", "=", "'POST'", ",", "payload", "=", "entity", ")", "status", "=", "result", "[", "'status'", "]", "if", "not", "status", ...
Adds the supplied dict as a new entity
[ "Adds", "the", "supplied", "dict", "as", "a", "new", "entity" ]
train
https://github.com/baszoetekouw/janus-py/blob/4f2034436eef010ec8d77e168f6198123b5eb226/sr/sr.py#L245-L255
baszoetekouw/janus-py
sr/sr.py
ServiceRegistry.connectiontable
def connectiontable(self, state='prodaccepted'): """ Returns a matrix of all entities showing which ones are connected together. """ entities = self.list_full(state) # sort entities idps = OrderedDict() sps = OrderedDict() for eid, entity in entities.items(): if entity['isActive'] and entity['state...
python
def connectiontable(self, state='prodaccepted'): """ Returns a matrix of all entities showing which ones are connected together. """ entities = self.list_full(state) # sort entities idps = OrderedDict() sps = OrderedDict() for eid, entity in entities.items(): if entity['isActive'] and entity['state...
[ "def", "connectiontable", "(", "self", ",", "state", "=", "'prodaccepted'", ")", ":", "entities", "=", "self", ".", "list_full", "(", "state", ")", "# sort entities", "idps", "=", "OrderedDict", "(", ")", "sps", "=", "OrderedDict", "(", ")", "for", "eid", ...
Returns a matrix of all entities showing which ones are connected together.
[ "Returns", "a", "matrix", "of", "all", "entities", "showing", "which", "ones", "are", "connected", "together", "." ]
train
https://github.com/baszoetekouw/janus-py/blob/4f2034436eef010ec8d77e168f6198123b5eb226/sr/sr.py#L258-L296
staffanm/layeredconfig
layeredconfig/layeredconfig.py
LayeredConfig.write
def write(config): """Commits any pending modifications, ie save a configuration file if it has been marked "dirty" as a result of an normal assignment. The modifications are written to the first writable source in this config object. .. note:: This is a static metho...
python
def write(config): """Commits any pending modifications, ie save a configuration file if it has been marked "dirty" as a result of an normal assignment. The modifications are written to the first writable source in this config object. .. note:: This is a static metho...
[ "def", "write", "(", "config", ")", ":", "root", "=", "config", "while", "root", ".", "_parent", ":", "root", "=", "root", ".", "_parent", "for", "source", "in", "root", ".", "_sources", ":", "if", "source", ".", "writable", "and", "source", ".", "di...
Commits any pending modifications, ie save a configuration file if it has been marked "dirty" as a result of an normal assignment. The modifications are written to the first writable source in this config object. .. note:: This is a static method, ie not a method on any obje...
[ "Commits", "any", "pending", "modifications", "ie", "save", "a", "configuration", "file", "if", "it", "has", "been", "marked", "dirty", "as", "a", "result", "of", "an", "normal", "assignment", ".", "The", "modifications", "are", "written", "to", "the", "firs...
train
https://github.com/staffanm/layeredconfig/blob/f3dad66729854f5c34910c7533f88d39b223a977/layeredconfig/layeredconfig.py#L102-L125
staffanm/layeredconfig
layeredconfig/layeredconfig.py
LayeredConfig.set
def set(config, key, value, sourceid="defaults"): """Sets a value in this config object *without* marking any source dirty, and with exact control of exactly where to set the value. This is mostly useful for low-level trickery with config objects. :param config: The configuratio...
python
def set(config, key, value, sourceid="defaults"): """Sets a value in this config object *without* marking any source dirty, and with exact control of exactly where to set the value. This is mostly useful for low-level trickery with config objects. :param config: The configuratio...
[ "def", "set", "(", "config", ",", "key", ",", "value", ",", "sourceid", "=", "\"defaults\"", ")", ":", "for", "source", "in", "config", ".", "_sources", ":", "if", "source", ".", "identifier", "==", "sourceid", ":", "source", ".", "set", "(", "key", ...
Sets a value in this config object *without* marking any source dirty, and with exact control of exactly where to set the value. This is mostly useful for low-level trickery with config objects. :param config: The configuration object to set values on :param key: The parameter n...
[ "Sets", "a", "value", "in", "this", "config", "object", "*", "without", "*", "marking", "any", "source", "dirty", "and", "with", "exact", "control", "of", "exactly", "where", "to", "set", "the", "value", ".", "This", "is", "mostly", "useful", "for", "low...
train
https://github.com/staffanm/layeredconfig/blob/f3dad66729854f5c34910c7533f88d39b223a977/layeredconfig/layeredconfig.py#L128-L142
staffanm/layeredconfig
layeredconfig/layeredconfig.py
LayeredConfig.get
def get(config, key, default=None): """Gets a value from the config object, or return a default value if the parameter does not exist, like :py:meth:`dict.get` does. """ if hasattr(config, key): return getattr(config, key) else: return default
python
def get(config, key, default=None): """Gets a value from the config object, or return a default value if the parameter does not exist, like :py:meth:`dict.get` does. """ if hasattr(config, key): return getattr(config, key) else: return default
[ "def", "get", "(", "config", ",", "key", ",", "default", "=", "None", ")", ":", "if", "hasattr", "(", "config", ",", "key", ")", ":", "return", "getattr", "(", "config", ",", "key", ")", "else", ":", "return", "default" ]
Gets a value from the config object, or return a default value if the parameter does not exist, like :py:meth:`dict.get` does.
[ "Gets", "a", "value", "from", "the", "config", "object", "or", "return", "a", "default", "value", "if", "the", "parameter", "does", "not", "exist", "like", ":", "py", ":", "meth", ":", "dict", ".", "get", "does", "." ]
train
https://github.com/staffanm/layeredconfig/blob/f3dad66729854f5c34910c7533f88d39b223a977/layeredconfig/layeredconfig.py#L146-L154
staffanm/layeredconfig
layeredconfig/layeredconfig.py
LayeredConfig.dump
def dump(config): """Returns the entire content of the config object in a way that can be easily examined, compared or dumped to a string or file. :param config: The configuration object to dump :rtype: dict """ def _dump(element): if not isinstance(element,...
python
def dump(config): """Returns the entire content of the config object in a way that can be easily examined, compared or dumped to a string or file. :param config: The configuration object to dump :rtype: dict """ def _dump(element): if not isinstance(element,...
[ "def", "dump", "(", "config", ")", ":", "def", "_dump", "(", "element", ")", ":", "if", "not", "isinstance", "(", "element", ",", "config", ".", "__class__", ")", ":", "return", "element", "section", "=", "dict", "(", ")", "for", "key", ",", "subsect...
Returns the entire content of the config object in a way that can be easily examined, compared or dumped to a string or file. :param config: The configuration object to dump :rtype: dict
[ "Returns", "the", "entire", "content", "of", "the", "config", "object", "in", "a", "way", "that", "can", "be", "easily", "examined", "compared", "or", "dumped", "to", "a", "string", "or", "file", "." ]
train
https://github.com/staffanm/layeredconfig/blob/f3dad66729854f5c34910c7533f88d39b223a977/layeredconfig/layeredconfig.py#L157-L176
jameswenzel/PokeAPI.py
PokeAPI.py
_make_methods
def _make_methods(): "Automagically generates methods based on the API endpoints" for k, v in PokeAPI().get_endpoints().items(): string = "\t@BaseAPI._memoize\n" string += ("\tdef get_{0}(self, id_or_name='', limit=None," .format(k.replace('-', '_')) + ' offset=None):\n') ...
python
def _make_methods(): "Automagically generates methods based on the API endpoints" for k, v in PokeAPI().get_endpoints().items(): string = "\t@BaseAPI._memoize\n" string += ("\tdef get_{0}(self, id_or_name='', limit=None," .format(k.replace('-', '_')) + ' offset=None):\n') ...
[ "def", "_make_methods", "(", ")", ":", "for", "k", ",", "v", "in", "PokeAPI", "(", ")", ".", "get_endpoints", "(", ")", ".", "items", "(", ")", ":", "string", "=", "\"\\t@BaseAPI._memoize\\n\"", "string", "+=", "(", "\"\\tdef get_{0}(self, id_or_name='', limit...
Automagically generates methods based on the API endpoints
[ "Automagically", "generates", "methods", "based", "on", "the", "API", "endpoints" ]
train
https://github.com/jameswenzel/PokeAPI.py/blob/9d0000c84456a2da4409e3e9141cc0b48ac1271f/PokeAPI.py#L402-L414
emilydolson/avida-spatial-tools
avidaspatial/visualizations.py
heat_map
def heat_map(grid, name, **kwargs): """ Generic function for making a heat map based on the values in a grid. Arguments: grid - the grid of numbers or binary strings to be visualized. name - string indicating what the file storing the image should be called. kwargs...
python
def heat_map(grid, name, **kwargs): """ Generic function for making a heat map based on the values in a grid. Arguments: grid - the grid of numbers or binary strings to be visualized. name - string indicating what the file storing the image should be called. kwargs...
[ "def", "heat_map", "(", "grid", ",", "name", ",", "*", "*", "kwargs", ")", ":", "denom", ",", "palette", "=", "get_kwargs", "(", "grid", ",", "kwargs", ")", "if", "\"mask_zeros\"", "in", "kwargs", ":", "mask_zeros", "=", "kwargs", "[", "\"mask_zeros\"", ...
Generic function for making a heat map based on the values in a grid. Arguments: grid - the grid of numbers or binary strings to be visualized. name - string indicating what the file storing the image should be called. kwargs: palette - a seaborn palette (li...
[ "Generic", "function", "for", "making", "a", "heat", "map", "based", "on", "the", "values", "in", "a", "grid", "." ]
train
https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/visualizations.py#L14-L38
emilydolson/avida-spatial-tools
avidaspatial/visualizations.py
paired_environment_phenotype_movie
def paired_environment_phenotype_movie(environment, phenotypes, **kwargs): """ Makes an animation overlaying colored circles representing phenotypes over an imshow() plot indicating the resources present in each cell. By default, color is determined using the palettes in the EnvironmentFile object p...
python
def paired_environment_phenotype_movie(environment, phenotypes, **kwargs): """ Makes an animation overlaying colored circles representing phenotypes over an imshow() plot indicating the resources present in each cell. By default, color is determined using the palettes in the EnvironmentFile object p...
[ "def", "paired_environment_phenotype_movie", "(", "environment", ",", "phenotypes", ",", "*", "*", "kwargs", ")", ":", "denom", ",", "palette", "=", "get_kwargs", "(", "environment", ",", "kwargs", ")", "# Create figure to do plotting", "fig", "=", "plt", ".", "...
Makes an animation overlaying colored circles representing phenotypes over an imshow() plot indicating the resources present in each cell. By default, color is determined using the palettes in the EnvironmentFile object passed as the first parameter. The easiest way to change color palettes is to assign...
[ "Makes", "an", "animation", "overlaying", "colored", "circles", "representing", "phenotypes", "over", "an", "imshow", "()", "plot", "indicating", "the", "resources", "present", "in", "each", "cell", ".", "By", "default", "color", "is", "determined", "using", "th...
train
https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/visualizations.py#L41-L108
emilydolson/avida-spatial-tools
avidaspatial/visualizations.py
make_movie
def make_movie(phenotypes, **kwargs): """ Makes an animation overlaying colored circles representing phenotypes over an imshow() plot indicating the resources present in each cell. By default, color is determined using the palettes in the EnvironmentFile object passed as the first parameter. The eas...
python
def make_movie(phenotypes, **kwargs): """ Makes an animation overlaying colored circles representing phenotypes over an imshow() plot indicating the resources present in each cell. By default, color is determined using the palettes in the EnvironmentFile object passed as the first parameter. The eas...
[ "def", "make_movie", "(", "phenotypes", ",", "*", "*", "kwargs", ")", ":", "denom", ",", "palette", "=", "get_kwargs", "(", "phenotypes", ",", "kwargs", ")", "# Create figure to do plotting", "fig", "=", "plt", ".", "figure", "(", "figsize", "=", "(", "20"...
Makes an animation overlaying colored circles representing phenotypes over an imshow() plot indicating the resources present in each cell. By default, color is determined using the palettes in the EnvironmentFile object passed as the first parameter. The easiest way to change color palettes is to assign...
[ "Makes", "an", "animation", "overlaying", "colored", "circles", "representing", "phenotypes", "over", "an", "imshow", "()", "plot", "indicating", "the", "resources", "present", "in", "each", "cell", ".", "By", "default", "color", "is", "determined", "using", "th...
train
https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/visualizations.py#L111-L160
emilydolson/avida-spatial-tools
avidaspatial/visualizations.py
plot_phens
def plot_phens(phen_grid, **kwargs): """ Plots circles colored according to the values in phen_grid. -1 serves as a sentinel value, indicating that a circle should not be plotted in that location. """ denom, palette = get_kwargs(phen_grid, kwargs, True) grid = color_grid(phen_grid, palette...
python
def plot_phens(phen_grid, **kwargs): """ Plots circles colored according to the values in phen_grid. -1 serves as a sentinel value, indicating that a circle should not be plotted in that location. """ denom, palette = get_kwargs(phen_grid, kwargs, True) grid = color_grid(phen_grid, palette...
[ "def", "plot_phens", "(", "phen_grid", ",", "*", "*", "kwargs", ")", ":", "denom", ",", "palette", "=", "get_kwargs", "(", "phen_grid", ",", "kwargs", ",", "True", ")", "grid", "=", "color_grid", "(", "phen_grid", ",", "palette", ",", "denom", ")", "fo...
Plots circles colored according to the values in phen_grid. -1 serves as a sentinel value, indicating that a circle should not be plotted in that location.
[ "Plots", "circles", "colored", "according", "to", "the", "values", "in", "phen_grid", "." ]
train
https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/visualizations.py#L163-L179
emilydolson/avida-spatial-tools
avidaspatial/visualizations.py
plot_phens_circles
def plot_phens_circles(phen_grid, **kwargs): """ Plots phenotypes represented as concentric circles. Each circle represents one task that the phenotype can perform, with larger circles representing more complex tasks. Arguments: phen_grid - a 2D array of strings representing binary numbers kwa...
python
def plot_phens_circles(phen_grid, **kwargs): """ Plots phenotypes represented as concentric circles. Each circle represents one task that the phenotype can perform, with larger circles representing more complex tasks. Arguments: phen_grid - a 2D array of strings representing binary numbers kwa...
[ "def", "plot_phens_circles", "(", "phen_grid", ",", "*", "*", "kwargs", ")", ":", "denom", ",", "palette", "=", "get_kwargs", "(", "phen_grid", ",", "kwargs", ",", "True", ")", "n_tasks", "=", "len", "(", "palette", ")", "grid", "=", "phen_grid", "for", ...
Plots phenotypes represented as concentric circles. Each circle represents one task that the phenotype can perform, with larger circles representing more complex tasks. Arguments: phen_grid - a 2D array of strings representing binary numbers kwargs: palette - a seaborn palette (list of ...
[ "Plots", "phenotypes", "represented", "as", "concentric", "circles", ".", "Each", "circle", "represents", "one", "task", "that", "the", "phenotype", "can", "perform", "with", "larger", "circles", "representing", "more", "complex", "tasks", "." ]
train
https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/visualizations.py#L182-L227
emilydolson/avida-spatial-tools
avidaspatial/visualizations.py
plot_phens_blits
def plot_phens_blits(phen_grid, patches, **kwargs): """ A version of plot_phens designed to be used in animations. Takes a 2D array of phenotypes and a list of matplotlib patch objects that have already been added to the current axes and recolors the patches based on the array. """ denom, palet...
python
def plot_phens_blits(phen_grid, patches, **kwargs): """ A version of plot_phens designed to be used in animations. Takes a 2D array of phenotypes and a list of matplotlib patch objects that have already been added to the current axes and recolors the patches based on the array. """ denom, palet...
[ "def", "plot_phens_blits", "(", "phen_grid", ",", "patches", ",", "*", "*", "kwargs", ")", ":", "denom", ",", "palette", "=", "get_kwargs", "(", "phen_grid", ",", "kwargs", ")", "grid", "=", "color_grid", "(", "phen_grid", ",", "palette", ",", "denom", "...
A version of plot_phens designed to be used in animations. Takes a 2D array of phenotypes and a list of matplotlib patch objects that have already been added to the current axes and recolors the patches based on the array.
[ "A", "version", "of", "plot_phens", "designed", "to", "be", "used", "in", "animations", ".", "Takes", "a", "2D", "array", "of", "phenotypes", "and", "a", "list", "of", "matplotlib", "patch", "objects", "that", "have", "already", "been", "added", "to", "the...
train
https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/visualizations.py#L230-L249
emilydolson/avida-spatial-tools
avidaspatial/visualizations.py
plot_world
def plot_world(world, **kwargs): """ Addes a heat-map representing the data in world (an EnvironmentFile object) to the current plot. kwargs: palette - a seaborn palette (list of RGB values) indicating how to color values. Will be converted to a continuous ...
python
def plot_world(world, **kwargs): """ Addes a heat-map representing the data in world (an EnvironmentFile object) to the current plot. kwargs: palette - a seaborn palette (list of RGB values) indicating how to color values. Will be converted to a continuous ...
[ "def", "plot_world", "(", "world", ",", "*", "*", "kwargs", ")", ":", "denom", ",", "palette", "=", "get_kwargs", "(", "world", ",", "kwargs", ",", "False", ")", "world", "=", "color_grid", "(", "world", ",", "palette", ",", "denom", ",", "True", ")"...
Addes a heat-map representing the data in world (an EnvironmentFile object) to the current plot. kwargs: palette - a seaborn palette (list of RGB values) indicating how to color values. Will be converted to a continuous colormap if necessary ...
[ "Addes", "a", "heat", "-", "map", "representing", "the", "data", "in", "world", "(", "an", "EnvironmentFile", "object", ")", "to", "the", "current", "plot", "." ]
train
https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/visualizations.py#L252-L274
emilydolson/avida-spatial-tools
avidaspatial/visualizations.py
paired_environment_phenotype_grid
def paired_environment_phenotype_grid(environment, phenotypes, **kwargs): """ Plots the given environment (EnvironmentFile object) and phenotypes (2d array of numbers or binary strings) onto the same image and saves the image based on the name of the environment file. The environment file will be re...
python
def paired_environment_phenotype_grid(environment, phenotypes, **kwargs): """ Plots the given environment (EnvironmentFile object) and phenotypes (2d array of numbers or binary strings) onto the same image and saves the image based on the name of the environment file. The environment file will be re...
[ "def", "paired_environment_phenotype_grid", "(", "environment", ",", "phenotypes", ",", "*", "*", "kwargs", ")", ":", "denom", ",", "palette", "=", "get_kwargs", "(", "environment", ",", "kwargs", ")", "print", "(", "\"plot world\"", ")", "plot_world", "(", "e...
Plots the given environment (EnvironmentFile object) and phenotypes (2d array of numbers or binary strings) onto the same image and saves the image based on the name of the environment file. The environment file will be represented by coloring square cells, while the phenotypes are circles overlaid on t...
[ "Plots", "the", "given", "environment", "(", "EnvironmentFile", "object", ")", "and", "phenotypes", "(", "2d", "array", "of", "numbers", "or", "binary", "strings", ")", "onto", "the", "same", "image", "and", "saves", "the", "image", "based", "on", "the", "...
train
https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/visualizations.py#L277-L314
emilydolson/avida-spatial-tools
avidaspatial/visualizations.py
paired_environment_phenotype_grid_circles
def paired_environment_phenotype_grid_circles(environment, phenotypes, **kwargs): """ Plots the given environment (EnvironmentFile object) and phenotypes (2d array of binary strings) onto the same image and saves the image based on the name of the environmen...
python
def paired_environment_phenotype_grid_circles(environment, phenotypes, **kwargs): """ Plots the given environment (EnvironmentFile object) and phenotypes (2d array of binary strings) onto the same image and saves the image based on the name of the environmen...
[ "def", "paired_environment_phenotype_grid_circles", "(", "environment", ",", "phenotypes", ",", "*", "*", "kwargs", ")", ":", "denom", ",", "palette", "=", "get_kwargs", "(", "environment", ",", "kwargs", ")", "plot_world", "(", "environment", ",", "palette", "=...
Plots the given environment (EnvironmentFile object) and phenotypes (2d array of binary strings) onto the same image and saves the image based on the name of the environment file. The environment file will be represented by coloring square cells, while the phenotypes are represented as concentric circle...
[ "Plots", "the", "given", "environment", "(", "EnvironmentFile", "object", ")", "and", "phenotypes", "(", "2d", "array", "of", "binary", "strings", ")", "onto", "the", "same", "image", "and", "saves", "the", "image", "based", "on", "the", "name", "of", "the...
train
https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/visualizations.py#L317-L355
emilydolson/avida-spatial-tools
avidaspatial/visualizations.py
color_grid
def color_grid(data, palette, denom=9.0, mask_zeros=True): """ Convert the given data (2d array of numbers or binary strings) to a 2d array of RGB or RGBA values which can then be visualized as a heat map. Arguments: data - 2d array of numbers or binary strings palette - a seaborn palette (list...
python
def color_grid(data, palette, denom=9.0, mask_zeros=True): """ Convert the given data (2d array of numbers or binary strings) to a 2d array of RGB or RGBA values which can then be visualized as a heat map. Arguments: data - 2d array of numbers or binary strings palette - a seaborn palette (list...
[ "def", "color_grid", "(", "data", ",", "palette", ",", "denom", "=", "9.0", ",", "mask_zeros", "=", "True", ")", ":", "grid", "=", "[", "]", "try", ":", "# If this isn't numeric, don't bother with this block", "float", "(", "data", "[", "0", "]", "[", "0",...
Convert the given data (2d array of numbers or binary strings) to a 2d array of RGB or RGBA values which can then be visualized as a heat map. Arguments: data - 2d array of numbers or binary strings palette - a seaborn palette (list of RGB values) indicating how to convert data to colors....
[ "Convert", "the", "given", "data", "(", "2d", "array", "of", "numbers", "or", "binary", "strings", ")", "to", "a", "2d", "array", "of", "RGB", "or", "RGBA", "values", "which", "can", "then", "be", "visualized", "as", "a", "heat", "map", "." ]
train
https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/visualizations.py#L358-L402
emilydolson/avida-spatial-tools
avidaspatial/visualizations.py
color_array_by_value
def color_array_by_value(value, palette, denom, mask_zeros): """ Figure out the appropriate RGB or RGBA color for the given numerical value based on the palette, denom, and whether zeros should be masked. """ if value == -1: # sentinel value return -1 if value == 0 and mask_zeros: # T...
python
def color_array_by_value(value, palette, denom, mask_zeros): """ Figure out the appropriate RGB or RGBA color for the given numerical value based on the palette, denom, and whether zeros should be masked. """ if value == -1: # sentinel value return -1 if value == 0 and mask_zeros: # T...
[ "def", "color_array_by_value", "(", "value", ",", "palette", ",", "denom", ",", "mask_zeros", ")", ":", "if", "value", "==", "-", "1", ":", "# sentinel value", "return", "-", "1", "if", "value", "==", "0", "and", "mask_zeros", ":", "# This value is masked", ...
Figure out the appropriate RGB or RGBA color for the given numerical value based on the palette, denom, and whether zeros should be masked.
[ "Figure", "out", "the", "appropriate", "RGB", "or", "RGBA", "color", "for", "the", "given", "numerical", "value", "based", "on", "the", "palette", "denom", "and", "whether", "zeros", "should", "be", "masked", "." ]
train
https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/visualizations.py#L405-L422
emilydolson/avida-spatial-tools
avidaspatial/visualizations.py
color_array_by_hue_mix
def color_array_by_hue_mix(value, palette): """ Figure out the appropriate color for a binary string value by averaging the colors corresponding the indices of each one that it contains. Makes for visualizations that intuitively show patch overlap. """ if int(value, 2) > 0: # Convert bi...
python
def color_array_by_hue_mix(value, palette): """ Figure out the appropriate color for a binary string value by averaging the colors corresponding the indices of each one that it contains. Makes for visualizations that intuitively show patch overlap. """ if int(value, 2) > 0: # Convert bi...
[ "def", "color_array_by_hue_mix", "(", "value", ",", "palette", ")", ":", "if", "int", "(", "value", ",", "2", ")", ">", "0", ":", "# Convert bits to list and reverse order to avoid issues with", "# differing lengths", "int_list", "=", "[", "int", "(", "i", ")", ...
Figure out the appropriate color for a binary string value by averaging the colors corresponding the indices of each one that it contains. Makes for visualizations that intuitively show patch overlap.
[ "Figure", "out", "the", "appropriate", "color", "for", "a", "binary", "string", "value", "by", "averaging", "the", "colors", "corresponding", "the", "indices", "of", "each", "one", "that", "it", "contains", ".", "Makes", "for", "visualizations", "that", "intui...
train
https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/visualizations.py#L425-L458
emilydolson/avida-spatial-tools
avidaspatial/visualizations.py
color_percentages
def color_percentages(file_list, n_tasks=9, file_name="color_percent.png", intensification_factor=1.2): """ Creates an image in which each cell in the avida grid is represented as a square of 9 sub-cells. Each of these 9 sub-cells represents a different task, and is colored such th...
python
def color_percentages(file_list, n_tasks=9, file_name="color_percent.png", intensification_factor=1.2): """ Creates an image in which each cell in the avida grid is represented as a square of 9 sub-cells. Each of these 9 sub-cells represents a different task, and is colored such th...
[ "def", "color_percentages", "(", "file_list", ",", "n_tasks", "=", "9", ",", "file_name", "=", "\"color_percent.png\"", ",", "intensification_factor", "=", "1.2", ")", ":", "# Load data", "data", "=", "task_percentages", "(", "load_grid_data", "(", "file_list", ")...
Creates an image in which each cell in the avida grid is represented as a square of 9 sub-cells. Each of these 9 sub-cells represents a different task, and is colored such that cooler colors represent more complex tasks. The saturation of each sub-cell indicates the percentage of grids in the given data...
[ "Creates", "an", "image", "in", "which", "each", "cell", "in", "the", "avida", "grid", "is", "represented", "as", "a", "square", "of", "9", "sub", "-", "cells", ".", "Each", "of", "these", "9", "sub", "-", "cells", "represents", "a", "different", "task...
train
https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/visualizations.py#L461-L507
emilydolson/avida-spatial-tools
avidaspatial/visualizations.py
color_percentages2
def color_percentages2(file_list): """ Super experimental """ data = task_percentages(load_grid_data(file_list)) grid = [[]] * len(data) for i in range(len(grid)): grid[i] = [[]]*len(data[0]) for i in range(len(data)): for j in range(len(data[0])): r = sum(data[...
python
def color_percentages2(file_list): """ Super experimental """ data = task_percentages(load_grid_data(file_list)) grid = [[]] * len(data) for i in range(len(grid)): grid[i] = [[]]*len(data[0]) for i in range(len(data)): for j in range(len(data[0])): r = sum(data[...
[ "def", "color_percentages2", "(", "file_list", ")", ":", "data", "=", "task_percentages", "(", "load_grid_data", "(", "file_list", ")", ")", "grid", "=", "[", "[", "]", "]", "*", "len", "(", "data", ")", "for", "i", "in", "range", "(", "len", "(", "g...
Super experimental
[ "Super", "experimental" ]
train
https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/visualizations.py#L510-L528
emilydolson/avida-spatial-tools
avidaspatial/visualizations.py
make_imshow_plot
def make_imshow_plot(grid, name): """ Takes a grid of RGB or RGBA values and a filename to save the figure into. Generates a figure by coloring all grid cells appropriately. """ plt.tick_params(labelbottom="off", labeltop="off", labelleft="off", labelright="off", bottom="off", to...
python
def make_imshow_plot(grid, name): """ Takes a grid of RGB or RGBA values and a filename to save the figure into. Generates a figure by coloring all grid cells appropriately. """ plt.tick_params(labelbottom="off", labeltop="off", labelleft="off", labelright="off", bottom="off", to...
[ "def", "make_imshow_plot", "(", "grid", ",", "name", ")", ":", "plt", ".", "tick_params", "(", "labelbottom", "=", "\"off\"", ",", "labeltop", "=", "\"off\"", ",", "labelleft", "=", "\"off\"", ",", "labelright", "=", "\"off\"", ",", "bottom", "=", "\"off\"...
Takes a grid of RGB or RGBA values and a filename to save the figure into. Generates a figure by coloring all grid cells appropriately.
[ "Takes", "a", "grid", "of", "RGB", "or", "RGBA", "values", "and", "a", "filename", "to", "save", "the", "figure", "into", ".", "Generates", "a", "figure", "by", "coloring", "all", "grid", "cells", "appropriately", "." ]
train
https://github.com/emilydolson/avida-spatial-tools/blob/7beb0166ccefad5fa722215b030ac2a53d62b59e/avidaspatial/visualizations.py#L531-L541
JukeboxPipeline/jukebox-core
src/jukeboxcore/filesys.py
copy_file
def copy_file(old, new): """Copy the old file to the location of the new file :param old: The file to copy :type old: :class:`JB_File` :param new: The JB_File for the new location :type new: :class:`JB_File` :returns: None :rtype: None :raises: None """ oldp = old.get_fullpath()...
python
def copy_file(old, new): """Copy the old file to the location of the new file :param old: The file to copy :type old: :class:`JB_File` :param new: The JB_File for the new location :type new: :class:`JB_File` :returns: None :rtype: None :raises: None """ oldp = old.get_fullpath()...
[ "def", "copy_file", "(", "old", ",", "new", ")", ":", "oldp", "=", "old", ".", "get_fullpath", "(", ")", "newp", "=", "new", ".", "get_fullpath", "(", ")", "log", ".", "info", "(", "\"Copying %s to %s\"", ",", "oldp", ",", "newp", ")", "new", ".", ...
Copy the old file to the location of the new file :param old: The file to copy :type old: :class:`JB_File` :param new: The JB_File for the new location :type new: :class:`JB_File` :returns: None :rtype: None :raises: None
[ "Copy", "the", "old", "file", "to", "the", "location", "of", "the", "new", "file" ]
train
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/filesys.py#L13-L28
JukeboxPipeline/jukebox-core
src/jukeboxcore/filesys.py
delete_file
def delete_file(f): """Delete the given file :param f: the file to delete :type f: :class:`JB_File` :returns: None :rtype: None :raises: :class:`OSError` """ fp = f.get_fullpath() log.info("Deleting file %s", fp) os.remove(fp)
python
def delete_file(f): """Delete the given file :param f: the file to delete :type f: :class:`JB_File` :returns: None :rtype: None :raises: :class:`OSError` """ fp = f.get_fullpath() log.info("Deleting file %s", fp) os.remove(fp)
[ "def", "delete_file", "(", "f", ")", ":", "fp", "=", "f", ".", "get_fullpath", "(", ")", "log", ".", "info", "(", "\"Deleting file %s\"", ",", "fp", ")", "os", ".", "remove", "(", "fp", ")" ]
Delete the given file :param f: the file to delete :type f: :class:`JB_File` :returns: None :rtype: None :raises: :class:`OSError`
[ "Delete", "the", "given", "file" ]
train
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/filesys.py#L31-L42
JukeboxPipeline/jukebox-core
src/jukeboxcore/filesys.py
TaskFileInfo.get_next
def get_next(cls, task, releasetype, typ, descriptor=None): """Returns a TaskFileInfo that with the next available version and the provided info :param task: the task of the taskfile :type task: :class:`jukeboxcore.djadapter.models.Task` :param releasetype: the releasetype :type...
python
def get_next(cls, task, releasetype, typ, descriptor=None): """Returns a TaskFileInfo that with the next available version and the provided info :param task: the task of the taskfile :type task: :class:`jukeboxcore.djadapter.models.Task` :param releasetype: the releasetype :type...
[ "def", "get_next", "(", "cls", ",", "task", ",", "releasetype", ",", "typ", ",", "descriptor", "=", "None", ")", ":", "qs", "=", "dj", ".", "taskfiles", ".", "filter", "(", "task", "=", "task", ",", "releasetype", "=", "releasetype", ",", "descriptor",...
Returns a TaskFileInfo that with the next available version and the provided info :param task: the task of the taskfile :type task: :class:`jukeboxcore.djadapter.models.Task` :param releasetype: the releasetype :type releasetype: str - :data:`jukeboxcore.djadapter.RELEASETYPES` ...
[ "Returns", "a", "TaskFileInfo", "that", "with", "the", "next", "available", "version", "and", "the", "provided", "info" ]
train
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/filesys.py#L150-L170
JukeboxPipeline/jukebox-core
src/jukeboxcore/filesys.py
TaskFileInfo.create_from_taskfile
def create_from_taskfile(self, taskfile): """Create a new TaskFileInfo and return it for the given taskfile :param taskfile: the taskfile to represent :type taskfile: :class:`jukeboxcore.djadapter.models.TaskFile` :returns: a taskfileinfo :rtype: :class:`TaskFileInfo` :r...
python
def create_from_taskfile(self, taskfile): """Create a new TaskFileInfo and return it for the given taskfile :param taskfile: the taskfile to represent :type taskfile: :class:`jukeboxcore.djadapter.models.TaskFile` :returns: a taskfileinfo :rtype: :class:`TaskFileInfo` :r...
[ "def", "create_from_taskfile", "(", "self", ",", "taskfile", ")", ":", "return", "TaskFileInfo", "(", "task", "=", "taskfile", ".", "task", ",", "version", "=", "taskfile", ".", "version", ",", "releasetype", "=", "taskfile", ".", "releasetype", ",", "descri...
Create a new TaskFileInfo and return it for the given taskfile :param taskfile: the taskfile to represent :type taskfile: :class:`jukeboxcore.djadapter.models.TaskFile` :returns: a taskfileinfo :rtype: :class:`TaskFileInfo` :raises: None
[ "Create", "a", "new", "TaskFileInfo", "and", "return", "it", "for", "the", "given", "taskfile" ]
train
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/filesys.py#L173-L183
JukeboxPipeline/jukebox-core
src/jukeboxcore/filesys.py
TaskFileInfo.create_db_entry
def create_db_entry(self, comment=''): """Create a db entry for this task file info and link it with a optional comment :param comment: a comment for the task file entry :type comment: str :returns: The created TaskFile django instance and the comment. If the comment was empty, ...
python
def create_db_entry(self, comment=''): """Create a db entry for this task file info and link it with a optional comment :param comment: a comment for the task file entry :type comment: str :returns: The created TaskFile django instance and the comment. If the comment was empty, ...
[ "def", "create_db_entry", "(", "self", ",", "comment", "=", "''", ")", ":", "jbfile", "=", "JB_File", "(", "self", ")", "p", "=", "jbfile", ".", "get_fullpath", "(", ")", "user", "=", "dj", ".", "get_current_user", "(", ")", "tf", "=", "dj", ".", "...
Create a db entry for this task file info and link it with a optional comment :param comment: a comment for the task file entry :type comment: str :returns: The created TaskFile django instance and the comment. If the comment was empty, None is returned instead :rtype: tuple of ...
[ "Create", "a", "db", "entry", "for", "this", "task", "file", "info", "and", "link", "it", "with", "a", "optional", "comment" ]
train
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/filesys.py#L195-L222
JukeboxPipeline/jukebox-core
src/jukeboxcore/filesys.py
AttrElement.get_dir
def get_dir(self, obj): """Return the dirattr of obj formatted with the dirfomat specified in the constructor. If the attr is None then ``None`` is returned not the string ``\'None\'``. :param obj: the fileinfo with information. :type obj: :class:`FileInfo` :returns: the directo...
python
def get_dir(self, obj): """Return the dirattr of obj formatted with the dirfomat specified in the constructor. If the attr is None then ``None`` is returned not the string ``\'None\'``. :param obj: the fileinfo with information. :type obj: :class:`FileInfo` :returns: the directo...
[ "def", "get_dir", "(", "self", ",", "obj", ")", ":", "if", "self", ".", "_dirattr", "is", "None", ":", "return", "a", "=", "attrgetter", "(", "self", ".", "_dirattr", ")", "(", "obj", ")", "if", "a", "is", "None", ":", "return", "s", "=", "self",...
Return the dirattr of obj formatted with the dirfomat specified in the constructor. If the attr is None then ``None`` is returned not the string ``\'None\'``. :param obj: the fileinfo with information. :type obj: :class:`FileInfo` :returns: the directory or None :rtype: str|None...
[ "Return", "the", "dirattr", "of", "obj", "formatted", "with", "the", "dirfomat", "specified", "in", "the", "constructor", ".", "If", "the", "attr", "is", "None", "then", "None", "is", "returned", "not", "the", "string", "\\", "None", "\\", "." ]
train
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/filesys.py#L359-L375
JukeboxPipeline/jukebox-core
src/jukeboxcore/filesys.py
AttrElement.get_chunk
def get_chunk(self, obj): """Return the chunkattr of obj formatted with the chunkfomat specified in the constructor If the attr is None then ``None`` is returned not the string ``\'None\'``. :param obj: the fileinfo with information. :type obj: :class:`FileInfo` :returns: the ch...
python
def get_chunk(self, obj): """Return the chunkattr of obj formatted with the chunkfomat specified in the constructor If the attr is None then ``None`` is returned not the string ``\'None\'``. :param obj: the fileinfo with information. :type obj: :class:`FileInfo` :returns: the ch...
[ "def", "get_chunk", "(", "self", ",", "obj", ")", ":", "if", "self", ".", "_chunkattr", "is", "None", ":", "return", "a", "=", "attrgetter", "(", "self", ".", "_chunkattr", ")", "(", "obj", ")", "if", "a", "is", "None", ":", "return", "s", "=", "...
Return the chunkattr of obj formatted with the chunkfomat specified in the constructor If the attr is None then ``None`` is returned not the string ``\'None\'``. :param obj: the fileinfo with information. :type obj: :class:`FileInfo` :returns: the chunk or None :rtype: str|None ...
[ "Return", "the", "chunkattr", "of", "obj", "formatted", "with", "the", "chunkfomat", "specified", "in", "the", "constructor", "If", "the", "attr", "is", "None", "then", "None", "is", "returned", "not", "the", "string", "\\", "None", "\\", "." ]
train
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/filesys.py#L377-L393
JukeboxPipeline/jukebox-core
src/jukeboxcore/filesys.py
TaskGroupElement.get_dir
def get_dir(self, taskinfo): """Return ``assets/`` + assettypename if it is for an assettask or ``shots/`` + sequencename if is is for a shottask :param obj: the fileinfo with information. :type obj: :class:`TaskFileInfo` :returns: ``assets`` or ``shots`` depending on the assetflag of t...
python
def get_dir(self, taskinfo): """Return ``assets/`` + assettypename if it is for an assettask or ``shots/`` + sequencename if is is for a shottask :param obj: the fileinfo with information. :type obj: :class:`TaskFileInfo` :returns: ``assets`` or ``shots`` depending on the assetflag of t...
[ "def", "get_dir", "(", "self", ",", "taskinfo", ")", ":", "if", "taskinfo", ".", "task", ".", "department", ".", "assetflag", ":", "atname", "=", "taskinfo", ".", "task", ".", "element", ".", "atype", ".", "name", "d", "=", "os", ".", "path", ".", ...
Return ``assets/`` + assettypename if it is for an assettask or ``shots/`` + sequencename if is is for a shottask :param obj: the fileinfo with information. :type obj: :class:`TaskFileInfo` :returns: ``assets`` or ``shots`` depending on the assetflag of the task of taskinfo :rtype: str ...
[ "Return", "assets", "/", "+", "assettypename", "if", "it", "is", "for", "an", "assettask", "or", "shots", "/", "+", "sequencename", "if", "is", "is", "for", "a", "shottask" ]
train
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/filesys.py#L419-L435
JukeboxPipeline/jukebox-core
src/jukeboxcore/filesys.py
JB_File.get_ext
def get_ext(self, obj=None): """Return the file extension :param obj: the fileinfo with information. If None, this will use the stored object of JB_File :type obj: :class:`FileInfo` :returns: the file extension :rtype: str :raises: None """ if obj is None...
python
def get_ext(self, obj=None): """Return the file extension :param obj: the fileinfo with information. If None, this will use the stored object of JB_File :type obj: :class:`FileInfo` :returns: the file extension :rtype: str :raises: None """ if obj is None...
[ "def", "get_ext", "(", "self", ",", "obj", "=", "None", ")", ":", "if", "obj", "is", "None", ":", "obj", "=", "self", ".", "_obj", "return", "self", ".", "_extel", ".", "get_ext", "(", "obj", ")" ]
Return the file extension :param obj: the fileinfo with information. If None, this will use the stored object of JB_File :type obj: :class:`FileInfo` :returns: the file extension :rtype: str :raises: None
[ "Return", "the", "file", "extension" ]
train
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/filesys.py#L545-L556
JukeboxPipeline/jukebox-core
src/jukeboxcore/filesys.py
JB_File.get_path
def get_path(self, obj=None): """Return the path (excluding the filename) :param obj: the fileinfo with information. If None, this will use the stored object of JB_File :type obj: :class:`FileInfo` :returns: the path to the file :rtype: str :raises: None """ ...
python
def get_path(self, obj=None): """Return the path (excluding the filename) :param obj: the fileinfo with information. If None, this will use the stored object of JB_File :type obj: :class:`FileInfo` :returns: the path to the file :rtype: str :raises: None """ ...
[ "def", "get_path", "(", "self", ",", "obj", "=", "None", ")", ":", "if", "obj", "is", "None", ":", "obj", "=", "self", ".", "_obj", "chunks", "=", "[", "]", "for", "e", "in", "self", ".", "_elements", ":", "d", "=", "e", ".", "get_dir", "(", ...
Return the path (excluding the filename) :param obj: the fileinfo with information. If None, this will use the stored object of JB_File :type obj: :class:`FileInfo` :returns: the path to the file :rtype: str :raises: None
[ "Return", "the", "path", "(", "excluding", "the", "filename", ")" ]
train
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/filesys.py#L558-L575
JukeboxPipeline/jukebox-core
src/jukeboxcore/filesys.py
JB_File.get_name
def get_name(self, obj=None, withext=True): """Return the filename :param obj: the fileinfo with information. If None, this will use the stored object of JB_File :type obj: :class:`FileInfo` :param withext: If True, return with the fileextension. :type withext: bool :ret...
python
def get_name(self, obj=None, withext=True): """Return the filename :param obj: the fileinfo with information. If None, this will use the stored object of JB_File :type obj: :class:`FileInfo` :param withext: If True, return with the fileextension. :type withext: bool :ret...
[ "def", "get_name", "(", "self", ",", "obj", "=", "None", ",", "withext", "=", "True", ")", ":", "if", "obj", "is", "None", ":", "obj", "=", "self", ".", "_obj", "chunks", "=", "[", "]", "for", "e", "in", "self", ".", "_elements", ":", "c", "=",...
Return the filename :param obj: the fileinfo with information. If None, this will use the stored object of JB_File :type obj: :class:`FileInfo` :param withext: If True, return with the fileextension. :type withext: bool :returns: the filename, default is with fileextension ...
[ "Return", "the", "filename" ]
train
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/filesys.py#L577-L598
JukeboxPipeline/jukebox-core
src/jukeboxcore/filesys.py
JB_File.get_fullpath
def get_fullpath(self, withext=True): """Return the filepath with the filename :param withext: If True, return with the fileextension. :type withext: bool :returns: None :rtype: None :raises: None """ p = self.get_path(self._obj) n = self.get_name...
python
def get_fullpath(self, withext=True): """Return the filepath with the filename :param withext: If True, return with the fileextension. :type withext: bool :returns: None :rtype: None :raises: None """ p = self.get_path(self._obj) n = self.get_name...
[ "def", "get_fullpath", "(", "self", ",", "withext", "=", "True", ")", ":", "p", "=", "self", ".", "get_path", "(", "self", ".", "_obj", ")", "n", "=", "self", ".", "get_name", "(", "self", ".", "_obj", ",", "withext", ")", "fp", "=", "os", ".", ...
Return the filepath with the filename :param withext: If True, return with the fileextension. :type withext: bool :returns: None :rtype: None :raises: None
[ "Return", "the", "filepath", "with", "the", "filename" ]
train
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/filesys.py#L600-L612
JukeboxPipeline/jukebox-core
src/jukeboxcore/filesys.py
JB_File.create_directory
def create_directory(self, path=None): """Create the directory for the given path. If path is None use the path of this instance :param path: the path to create :type path: str :returns: None :rtype: None :raises: OSError """ if path is None: ...
python
def create_directory(self, path=None): """Create the directory for the given path. If path is None use the path of this instance :param path: the path to create :type path: str :returns: None :rtype: None :raises: OSError """ if path is None: ...
[ "def", "create_directory", "(", "self", ",", "path", "=", "None", ")", ":", "if", "path", "is", "None", ":", "path", "=", "self", ".", "get_path", "(", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "os", ".", "makedir...
Create the directory for the given path. If path is None use the path of this instance :param path: the path to create :type path: str :returns: None :rtype: None :raises: OSError
[ "Create", "the", "directory", "for", "the", "given", "path", ".", "If", "path", "is", "None", "use", "the", "path", "of", "this", "instance" ]
train
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/filesys.py#L643-L655
thespacedoctor/astrocalc
astrocalc/coords/translate.py
translate.get
def get(self): """ *translate the coordinates* **Return:** - ``ra`` -- the right-ascension of the translated coordinate - ``dec`` -- the declination of the translated coordinate """ self.log.info('starting the ``get`` method') # PRECISION TEST ...
python
def get(self): """ *translate the coordinates* **Return:** - ``ra`` -- the right-ascension of the translated coordinate - ``dec`` -- the declination of the translated coordinate """ self.log.info('starting the ``get`` method') # PRECISION TEST ...
[ "def", "get", "(", "self", ")", ":", "self", ".", "log", ".", "info", "(", "'starting the ``get`` method'", ")", "# PRECISION TEST", "decprecision", "=", "len", "(", "repr", "(", "self", ".", "dec", ")", ".", "split", "(", "\".\"", ")", "[", "-", "1", ...
*translate the coordinates* **Return:** - ``ra`` -- the right-ascension of the translated coordinate - ``dec`` -- the declination of the translated coordinate
[ "*", "translate", "the", "coordinates", "*" ]
train
https://github.com/thespacedoctor/astrocalc/blob/dfbebf9b86d7b2d2110c48a6a4f4194bf8885b86/astrocalc/coords/translate.py#L93-L129
sbarham/dsrt
build/lib/dsrt/application/Application.py
Application.dispatch_subcommand
def dispatch_subcommand(self, parser): ''' Note that the way we're doing this is elegant, but dangerous. It doesn't require, but does encourage, us to define no Application# methods beyond those corresponding to the supported subcommands ''' # read in the subcommand ...
python
def dispatch_subcommand(self, parser): ''' Note that the way we're doing this is elegant, but dangerous. It doesn't require, but does encourage, us to define no Application# methods beyond those corresponding to the supported subcommands ''' # read in the subcommand ...
[ "def", "dispatch_subcommand", "(", "self", ",", "parser", ")", ":", "# read in the subcommand", "args", "=", "parser", ".", "parse_args", "(", "sys", ".", "argv", "[", "1", ":", "2", "]", ")", "# check that the subcommand is good", "if", "not", "hasattr", "(",...
Note that the way we're doing this is elegant, but dangerous. It doesn't require, but does encourage, us to define no Application# methods beyond those corresponding to the supported subcommands
[ "Note", "that", "the", "way", "we", "re", "doing", "this", "is", "elegant", "but", "dangerous", ".", "It", "doesn", "t", "require", "but", "does", "encourage", "us", "to", "define", "no", "Application#", "methods", "beyond", "those", "corresponding", "to", ...
train
https://github.com/sbarham/dsrt/blob/bc664739f2f52839461d3e72773b71146fd56a9a/build/lib/dsrt/application/Application.py#L49-L67
sbarham/dsrt
build/lib/dsrt/application/Application.py
Application.corpus
def corpus(self): '''Command to add a corpus to the dsrt library''' # Initialize the addcorpus subcommand's argparser description = '''The corpus subcommand has a number of subcommands of its own, including: list\t-\tlists all available corpora in dsrt's library add\t-\t...
python
def corpus(self): '''Command to add a corpus to the dsrt library''' # Initialize the addcorpus subcommand's argparser description = '''The corpus subcommand has a number of subcommands of its own, including: list\t-\tlists all available corpora in dsrt's library add\t-\t...
[ "def", "corpus", "(", "self", ")", ":", "# Initialize the addcorpus subcommand's argparser", "description", "=", "'''The corpus subcommand has a number of subcommands of its own, including:\n list\\t-\\tlists all available corpora in dsrt's library\n add\\t-\\tadds a corpus t...
Command to add a corpus to the dsrt library
[ "Command", "to", "add", "a", "corpus", "to", "the", "dsrt", "library" ]
train
https://github.com/sbarham/dsrt/blob/bc664739f2f52839461d3e72773b71146fd56a9a/build/lib/dsrt/application/Application.py#L69-L90
sbarham/dsrt
build/lib/dsrt/application/Application.py
Application.dataset
def dataset(self): '''Command for manipulating or viewing datasets; has a number of subcommands''' # Initialize the addcorpus subcommand's argparser description = '''The dataset subcommand has a number of subcommands of its own, including: list\t-\tlists all available datasets in ds...
python
def dataset(self): '''Command for manipulating or viewing datasets; has a number of subcommands''' # Initialize the addcorpus subcommand's argparser description = '''The dataset subcommand has a number of subcommands of its own, including: list\t-\tlists all available datasets in ds...
[ "def", "dataset", "(", "self", ")", ":", "# Initialize the addcorpus subcommand's argparser", "description", "=", "'''The dataset subcommand has a number of subcommands of its own, including:\n list\\t-\\tlists all available datasets in dsrt's library\n prepare\\t-\\tprocesse...
Command for manipulating or viewing datasets; has a number of subcommands
[ "Command", "for", "manipulating", "or", "viewing", "datasets", ";", "has", "a", "number", "of", "subcommands" ]
train
https://github.com/sbarham/dsrt/blob/bc664739f2f52839461d3e72773b71146fd56a9a/build/lib/dsrt/application/Application.py#L115-L136
sbarham/dsrt
build/lib/dsrt/application/Application.py
Application.dataset_prepare
def dataset_prepare(self): '''Subcommand of dataset for processing a corpus into a dataset''' # Initialize the prepare subcommand's argparser parser = argparse.ArgumentParser(description='Preprocess a raw dialogue corpus into a dsrt dataset') self.init_dataset_prepare_args(parser) ...
python
def dataset_prepare(self): '''Subcommand of dataset for processing a corpus into a dataset''' # Initialize the prepare subcommand's argparser parser = argparse.ArgumentParser(description='Preprocess a raw dialogue corpus into a dsrt dataset') self.init_dataset_prepare_args(parser) ...
[ "def", "dataset_prepare", "(", "self", ")", ":", "# Initialize the prepare subcommand's argparser", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Preprocess a raw dialogue corpus into a dsrt dataset'", ")", "self", ".", "init_dataset_prepare_args"...
Subcommand of dataset for processing a corpus into a dataset
[ "Subcommand", "of", "dataset", "for", "processing", "a", "corpus", "into", "a", "dataset" ]
train
https://github.com/sbarham/dsrt/blob/bc664739f2f52839461d3e72773b71146fd56a9a/build/lib/dsrt/application/Application.py#L138-L150
sbarham/dsrt
build/lib/dsrt/application/Application.py
Application.dataset_list
def dataset_list(self): '''Subcommand of dataset for listing available datasets''' # Initialize the prepare subcommand's argparser parser = argparse.ArgumentParser(description='Preprocess a raw dialogue corpus into a dsrt dataset') self.init_dataset_list_args(parser) # Parse th...
python
def dataset_list(self): '''Subcommand of dataset for listing available datasets''' # Initialize the prepare subcommand's argparser parser = argparse.ArgumentParser(description='Preprocess a raw dialogue corpus into a dsrt dataset') self.init_dataset_list_args(parser) # Parse th...
[ "def", "dataset_list", "(", "self", ")", ":", "# Initialize the prepare subcommand's argparser", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Preprocess a raw dialogue corpus into a dsrt dataset'", ")", "self", ".", "init_dataset_list_args", "(...
Subcommand of dataset for listing available datasets
[ "Subcommand", "of", "dataset", "for", "listing", "available", "datasets" ]
train
https://github.com/sbarham/dsrt/blob/bc664739f2f52839461d3e72773b71146fd56a9a/build/lib/dsrt/application/Application.py#L152-L163
sbarham/dsrt
build/lib/dsrt/application/Application.py
Application.train
def train(self): '''The 'train' subcommand''' # Initialize the train subcommand's argparser parser = argparse.ArgumentParser(description='Train a dialogue model on a dialogue corpus or a dsrt dataset') self.init_train_args(parser) # Parse the args we got args = parser.p...
python
def train(self): '''The 'train' subcommand''' # Initialize the train subcommand's argparser parser = argparse.ArgumentParser(description='Train a dialogue model on a dialogue corpus or a dsrt dataset') self.init_train_args(parser) # Parse the args we got args = parser.p...
[ "def", "train", "(", "self", ")", ":", "# Initialize the train subcommand's argparser", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Train a dialogue model on a dialogue corpus or a dsrt dataset'", ")", "self", ".", "init_train_args", "(", "p...
The 'train' subcommand
[ "The", "train", "subcommand" ]
train
https://github.com/sbarham/dsrt/blob/bc664739f2f52839461d3e72773b71146fd56a9a/build/lib/dsrt/application/Application.py#L165-L177
sbarham/dsrt
build/lib/dsrt/application/Application.py
Application.load_corpus
def load_corpus(self, path, config): '''Load a dialogue corpus; eventually, support pickles and potentially other formats''' # use the default dataset if no path is provided # TODO -- change this to use a pre-saved dataset if path == '': path = self.default_path_to_corpus ...
python
def load_corpus(self, path, config): '''Load a dialogue corpus; eventually, support pickles and potentially other formats''' # use the default dataset if no path is provided # TODO -- change this to use a pre-saved dataset if path == '': path = self.default_path_to_corpus ...
[ "def", "load_corpus", "(", "self", ",", "path", ",", "config", ")", ":", "# use the default dataset if no path is provided", "# TODO -- change this to use a pre-saved dataset", "if", "path", "==", "''", ":", "path", "=", "self", ".", "default_path_to_corpus", "self", "....
Load a dialogue corpus; eventually, support pickles and potentially other formats
[ "Load", "a", "dialogue", "corpus", ";", "eventually", "support", "pickles", "and", "potentially", "other", "formats" ]
train
https://github.com/sbarham/dsrt/blob/bc664739f2f52839461d3e72773b71146fd56a9a/build/lib/dsrt/application/Application.py#L197-L205
sbarham/dsrt
build/lib/dsrt/application/Application.py
Application.init_dataset_prepare_args
def init_dataset_prepare_args(self, parser): '''Only invoked conditionally if subcommand is 'prepare' ''' parser.add_argument('-f', '--configuration', dest='config', default=DEFAULT_USER_CONFIG_PATH, help='the path to the configuration file to use -- ./config.yaml by default'...
python
def init_dataset_prepare_args(self, parser): '''Only invoked conditionally if subcommand is 'prepare' ''' parser.add_argument('-f', '--configuration', dest='config', default=DEFAULT_USER_CONFIG_PATH, help='the path to the configuration file to use -- ./config.yaml by default'...
[ "def", "init_dataset_prepare_args", "(", "self", ",", "parser", ")", ":", "parser", ".", "add_argument", "(", "'-f'", ",", "'--configuration'", ",", "dest", "=", "'config'", ",", "default", "=", "DEFAULT_USER_CONFIG_PATH", ",", "help", "=", "'the path to the confi...
Only invoked conditionally if subcommand is 'prepare'
[ "Only", "invoked", "conditionally", "if", "subcommand", "is", "prepare" ]
train
https://github.com/sbarham/dsrt/blob/bc664739f2f52839461d3e72773b71146fd56a9a/build/lib/dsrt/application/Application.py#L231-L236
sbarham/dsrt
build/lib/dsrt/application/Application.py
Application.init_train_args
def init_train_args(self, parser): '''Only invoked conditionally if subcommand is 'train' ''' parser.add_argument('-f', '--configuration', dest='config', default=DEFAULT_USER_CONFIG_PATH, help='the path to the configuration file to use -- ./config.yaml by default') pa...
python
def init_train_args(self, parser): '''Only invoked conditionally if subcommand is 'train' ''' parser.add_argument('-f', '--configuration', dest='config', default=DEFAULT_USER_CONFIG_PATH, help='the path to the configuration file to use -- ./config.yaml by default') pa...
[ "def", "init_train_args", "(", "self", ",", "parser", ")", ":", "parser", ".", "add_argument", "(", "'-f'", ",", "'--configuration'", ",", "dest", "=", "'config'", ",", "default", "=", "DEFAULT_USER_CONFIG_PATH", ",", "help", "=", "'the path to the configuration f...
Only invoked conditionally if subcommand is 'train'
[ "Only", "invoked", "conditionally", "if", "subcommand", "is", "train" ]
train
https://github.com/sbarham/dsrt/blob/bc664739f2f52839461d3e72773b71146fd56a9a/build/lib/dsrt/application/Application.py#L242-L246
steder/goose
goose/core.py
executeBatch
def executeBatch(cursor, sql, regex=r"(?mx) ([^';]* (?:'[^']*'[^';]*)*)", comment_regex=r"(?mx) (?:^\s*$)|(?:--.*$)"): """ Takes a SQL file and executes it as many separate statements. TODO: replace regexes with something easier to grok and extend. """ # First, st...
python
def executeBatch(cursor, sql, regex=r"(?mx) ([^';]* (?:'[^']*'[^';]*)*)", comment_regex=r"(?mx) (?:^\s*$)|(?:--.*$)"): """ Takes a SQL file and executes it as many separate statements. TODO: replace regexes with something easier to grok and extend. """ # First, st...
[ "def", "executeBatch", "(", "cursor", ",", "sql", ",", "regex", "=", "r\"(?mx) ([^';]* (?:'[^']*'[^';]*)*)\"", ",", "comment_regex", "=", "r\"(?mx) (?:^\\s*$)|(?:--.*$)\"", ")", ":", "# First, strip comments", "sql", "=", "\"\\n\"", ".", "join", "(", "[", "x", ".", ...
Takes a SQL file and executes it as many separate statements. TODO: replace regexes with something easier to grok and extend.
[ "Takes", "a", "SQL", "file", "and", "executes", "it", "as", "many", "separate", "statements", "." ]
train
https://github.com/steder/goose/blob/e9290b39fdd7b3842052e40995ee833eaf8f15db/goose/core.py#L30-L69
steder/goose
goose/core.py
DatabaseMigrator.howToMigrate
def howToMigrate(self, fromVersion, toVersion=None): """Given a starting version and an ending version returns filenames of all the migrations in that range, exclusive. e.g.: [fromVersion, toVersion) """ # slice notation [start:end:step] # by adding a step of 1 we make a...
python
def howToMigrate(self, fromVersion, toVersion=None): """Given a starting version and an ending version returns filenames of all the migrations in that range, exclusive. e.g.: [fromVersion, toVersion) """ # slice notation [start:end:step] # by adding a step of 1 we make a...
[ "def", "howToMigrate", "(", "self", ",", "fromVersion", ",", "toVersion", "=", "None", ")", ":", "# slice notation [start:end:step]", "# by adding a step of 1 we make a slice from 0:0 be empty", "# rather than containing the whole list.", "if", "toVersion", "is", "not", "None",...
Given a starting version and an ending version returns filenames of all the migrations in that range, exclusive. e.g.: [fromVersion, toVersion)
[ "Given", "a", "starting", "version", "and", "an", "ending", "version", "returns", "filenames", "of", "all", "the", "migrations", "in", "that", "range", "exclusive", "." ]
train
https://github.com/steder/goose/blob/e9290b39fdd7b3842052e40995ee833eaf8f15db/goose/core.py#L113-L125
steder/goose
goose/core.py
DatabaseMigrator.runSql
def runSql(self, migrationName, version): """ Given a migration name and version lookup the sql file and run it. """ sys.stdout.write("Running migration %s to version %s: ..."%(migrationName, version)) sqlPath = os.path.join(self.migrationDirectory, migrationName) sql = o...
python
def runSql(self, migrationName, version): """ Given a migration name and version lookup the sql file and run it. """ sys.stdout.write("Running migration %s to version %s: ..."%(migrationName, version)) sqlPath = os.path.join(self.migrationDirectory, migrationName) sql = o...
[ "def", "runSql", "(", "self", ",", "migrationName", ",", "version", ")", ":", "sys", ".", "stdout", ".", "write", "(", "\"Running migration %s to version %s: ...\"", "%", "(", "migrationName", ",", "version", ")", ")", "sqlPath", "=", "os", ".", "path", ".",...
Given a migration name and version lookup the sql file and run it.
[ "Given", "a", "migration", "name", "and", "version", "lookup", "the", "sql", "file", "and", "run", "it", "." ]
train
https://github.com/steder/goose/blob/e9290b39fdd7b3842052e40995ee833eaf8f15db/goose/core.py#L140-L162
realestate-com-au/dashmat
dashmat/core_modules/splunk/splunk-sdk-1.3.0/splunklib/modularinput/event_writer.py
EventWriter.write_event
def write_event(self, event): """Writes an ``Event`` object to Splunk. :param event: An ``Event`` object. """ if not self.header_written: self._out.write("<stream>") self.header_written = True event.write_to(self._out)
python
def write_event(self, event): """Writes an ``Event`` object to Splunk. :param event: An ``Event`` object. """ if not self.header_written: self._out.write("<stream>") self.header_written = True event.write_to(self._out)
[ "def", "write_event", "(", "self", ",", "event", ")", ":", "if", "not", "self", ".", "header_written", ":", "self", ".", "_out", ".", "write", "(", "\"<stream>\"", ")", "self", ".", "header_written", "=", "True", "event", ".", "write_to", "(", "self", ...
Writes an ``Event`` object to Splunk. :param event: An ``Event`` object.
[ "Writes", "an", "Event", "object", "to", "Splunk", "." ]
train
https://github.com/realestate-com-au/dashmat/blob/433886e52698f0ddb9956f087b76041966c3bcd1/dashmat/core_modules/splunk/splunk-sdk-1.3.0/splunklib/modularinput/event_writer.py#L50-L60
realestate-com-au/dashmat
dashmat/core_modules/splunk/splunk-sdk-1.3.0/splunklib/modularinput/event_writer.py
EventWriter.log
def log(self, severity, message): """Logs messages about the state of this modular input to Splunk. These messages will show up in Splunk's internal logs. :param severity: ``string``, severity of message, see severities defined as class constants. :param message: ``string``, message to ...
python
def log(self, severity, message): """Logs messages about the state of this modular input to Splunk. These messages will show up in Splunk's internal logs. :param severity: ``string``, severity of message, see severities defined as class constants. :param message: ``string``, message to ...
[ "def", "log", "(", "self", ",", "severity", ",", "message", ")", ":", "self", ".", "_err", ".", "write", "(", "\"%s %s\\n\"", "%", "(", "severity", ",", "message", ")", ")", "self", ".", "_err", ".", "flush", "(", ")" ]
Logs messages about the state of this modular input to Splunk. These messages will show up in Splunk's internal logs. :param severity: ``string``, severity of message, see severities defined as class constants. :param message: ``string``, message to log.
[ "Logs", "messages", "about", "the", "state", "of", "this", "modular", "input", "to", "Splunk", ".", "These", "messages", "will", "show", "up", "in", "Splunk", "s", "internal", "logs", "." ]
train
https://github.com/realestate-com-au/dashmat/blob/433886e52698f0ddb9956f087b76041966c3bcd1/dashmat/core_modules/splunk/splunk-sdk-1.3.0/splunklib/modularinput/event_writer.py#L62-L71
rackerlabs/txkazoo
txkazoo/client.py
TxKazooClient
def TxKazooClient(reactor, pool, client): """Create a client for txkazoo. :param twisted.internet.interfaces.IReactorThreads reactor: The reactor used to interact with the thread pool. :param ThreadPool pool: The thread pool to which blocking calls will be deferred. :param kazoo.client....
python
def TxKazooClient(reactor, pool, client): """Create a client for txkazoo. :param twisted.internet.interfaces.IReactorThreads reactor: The reactor used to interact with the thread pool. :param ThreadPool pool: The thread pool to which blocking calls will be deferred. :param kazoo.client....
[ "def", "TxKazooClient", "(", "reactor", ",", "pool", ",", "client", ")", ":", "make_thimble", "=", "partial", "(", "Thimble", ",", "reactor", ",", "pool", ")", "wrapper", "=", "_RunCallbacksInReactorThreadWrapper", "(", "reactor", ",", "client", ")", "client_t...
Create a client for txkazoo. :param twisted.internet.interfaces.IReactorThreads reactor: The reactor used to interact with the thread pool. :param ThreadPool pool: The thread pool to which blocking calls will be deferred. :param kazoo.client.KazooClient client: The blocking Kazoo client, wh...
[ "Create", "a", "client", "for", "txkazoo", "." ]
train
https://github.com/rackerlabs/txkazoo/blob/a0989138cc08df7acd1d410f7e48708553839f46/txkazoo/client.py#L115-L147
rackerlabs/txkazoo
txkazoo/client.py
_RunCallbacksInReactorThreadWrapper.add_listener
def add_listener(self, listener): """Add the given listener to the wrapped client. The listener will be wrapped, so that it will be called in the reactor thread. This way, it can safely use Twisted APIs. """ internal_listener = partial(self._call_in_reactor_thread, listener) ...
python
def add_listener(self, listener): """Add the given listener to the wrapped client. The listener will be wrapped, so that it will be called in the reactor thread. This way, it can safely use Twisted APIs. """ internal_listener = partial(self._call_in_reactor_thread, listener) ...
[ "def", "add_listener", "(", "self", ",", "listener", ")", ":", "internal_listener", "=", "partial", "(", "self", ".", "_call_in_reactor_thread", ",", "listener", ")", "self", ".", "_internal_listeners", "[", "listener", "]", "=", "internal_listener", "return", "...
Add the given listener to the wrapped client. The listener will be wrapped, so that it will be called in the reactor thread. This way, it can safely use Twisted APIs.
[ "Add", "the", "given", "listener", "to", "the", "wrapped", "client", "." ]
train
https://github.com/rackerlabs/txkazoo/blob/a0989138cc08df7acd1d410f7e48708553839f46/txkazoo/client.py#L49-L57
rackerlabs/txkazoo
txkazoo/client.py
_RunCallbacksInReactorThreadWrapper.remove_listener
def remove_listener(self, listener): """Remove the given listener from the wrapped client. :param listener: A listener previously passed to :meth:`add_listener`. """ internal_listener = self._internal_listeners.pop(listener) return self._client.remove_listener(internal_listener)
python
def remove_listener(self, listener): """Remove the given listener from the wrapped client. :param listener: A listener previously passed to :meth:`add_listener`. """ internal_listener = self._internal_listeners.pop(listener) return self._client.remove_listener(internal_listener)
[ "def", "remove_listener", "(", "self", ",", "listener", ")", ":", "internal_listener", "=", "self", ".", "_internal_listeners", ".", "pop", "(", "listener", ")", "return", "self", ".", "_client", ".", "remove_listener", "(", "internal_listener", ")" ]
Remove the given listener from the wrapped client. :param listener: A listener previously passed to :meth:`add_listener`.
[ "Remove", "the", "given", "listener", "from", "the", "wrapped", "client", "." ]
train
https://github.com/rackerlabs/txkazoo/blob/a0989138cc08df7acd1d410f7e48708553839f46/txkazoo/client.py#L59-L65
rackerlabs/txkazoo
txkazoo/client.py
_RunCallbacksInReactorThreadWrapper._wrapped_method_with_watch_fn
def _wrapped_method_with_watch_fn(self, f, *args, **kwargs): """A wrapped method with a watch function. When this method is called, it will call the underlying method with the same arguments, *except* that if the ``watch`` argument isn't :data:`None`, it will be replaced with a wrapper ...
python
def _wrapped_method_with_watch_fn(self, f, *args, **kwargs): """A wrapped method with a watch function. When this method is called, it will call the underlying method with the same arguments, *except* that if the ``watch`` argument isn't :data:`None`, it will be replaced with a wrapper ...
[ "def", "_wrapped_method_with_watch_fn", "(", "self", ",", "f", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "bound_args", "=", "signature", "(", "f", ")", ".", "bind", "(", "*", "args", ",", "*", "*", "kwargs", ")", "orig_watch", "=", "bound_...
A wrapped method with a watch function. When this method is called, it will call the underlying method with the same arguments, *except* that if the ``watch`` argument isn't :data:`None`, it will be replaced with a wrapper around that watch function, so that the watch function will be c...
[ "A", "wrapped", "method", "with", "a", "watch", "function", "." ]
train
https://github.com/rackerlabs/txkazoo/blob/a0989138cc08df7acd1d410f7e48708553839f46/txkazoo/client.py#L67-L85
rackerlabs/txkazoo
txkazoo/client.py
_RunCallbacksInReactorThreadWrapper._call_in_reactor_thread
def _call_in_reactor_thread(self, f, *args, **kwargs): """Call the given function with args in the reactor thread.""" self._reactor.callFromThread(f, *args, **kwargs)
python
def _call_in_reactor_thread(self, f, *args, **kwargs): """Call the given function with args in the reactor thread.""" self._reactor.callFromThread(f, *args, **kwargs)
[ "def", "_call_in_reactor_thread", "(", "self", ",", "f", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_reactor", ".", "callFromThread", "(", "f", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
Call the given function with args in the reactor thread.
[ "Call", "the", "given", "function", "with", "args", "in", "the", "reactor", "thread", "." ]
train
https://github.com/rackerlabs/txkazoo/blob/a0989138cc08df7acd1d410f7e48708553839f46/txkazoo/client.py#L87-L89
sbarham/dsrt
dsrt/application/Application.py
Application.converse
def converse(self): '''The 'converse' subcommand''' # Initialize the converse subcommand's argparser parser = argparse.ArgumentParser(description='Initiate a conversation with a trained dialogue model') self.init_converse_args(parser) # Parse the args we got args = pars...
python
def converse(self): '''The 'converse' subcommand''' # Initialize the converse subcommand's argparser parser = argparse.ArgumentParser(description='Initiate a conversation with a trained dialogue model') self.init_converse_args(parser) # Parse the args we got args = pars...
[ "def", "converse", "(", "self", ")", ":", "# Initialize the converse subcommand's argparser", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Initiate a conversation with a trained dialogue model'", ")", "self", ".", "init_converse_args", "(", "...
The 'converse' subcommand
[ "The", "converse", "subcommand" ]
train
https://github.com/sbarham/dsrt/blob/bc664739f2f52839461d3e72773b71146fd56a9a/dsrt/application/Application.py#L179-L191
sbarham/dsrt
dsrt/application/Application.py
Application.init_train_args
def init_train_args(self, parser): '''Only invoked conditionally if subcommand is 'train' ''' parser.add_argument('-f', '--configuration', dest='config', default=DEFAULT_USER_CONFIG_PATH, help='the path to the configuration file to use -- ./config.yaml by default') pa...
python
def init_train_args(self, parser): '''Only invoked conditionally if subcommand is 'train' ''' parser.add_argument('-f', '--configuration', dest='config', default=DEFAULT_USER_CONFIG_PATH, help='the path to the configuration file to use -- ./config.yaml by default') pa...
[ "def", "init_train_args", "(", "self", ",", "parser", ")", ":", "parser", ".", "add_argument", "(", "'-f'", ",", "'--configuration'", ",", "dest", "=", "'config'", ",", "default", "=", "DEFAULT_USER_CONFIG_PATH", ",", "help", "=", "'the path to the configuration f...
Only invoked conditionally if subcommand is 'train'
[ "Only", "invoked", "conditionally", "if", "subcommand", "is", "train" ]
train
https://github.com/sbarham/dsrt/blob/bc664739f2f52839461d3e72773b71146fd56a9a/dsrt/application/Application.py#L242-L249
sbarham/dsrt
dsrt/application/Application.py
Application.init_converse_args
def init_converse_args(self, parser): '''Only invoked conditionally if subcommand is 'converse' ''' parser.add_argument('-f', '--configuration', dest='config', default=DEFAULT_USER_CONFIG_PATH, help='the path to the configuration file to use -- ./config.yaml by default') ...
python
def init_converse_args(self, parser): '''Only invoked conditionally if subcommand is 'converse' ''' parser.add_argument('-f', '--configuration', dest='config', default=DEFAULT_USER_CONFIG_PATH, help='the path to the configuration file to use -- ./config.yaml by default') ...
[ "def", "init_converse_args", "(", "self", ",", "parser", ")", ":", "parser", ".", "add_argument", "(", "'-f'", ",", "'--configuration'", ",", "dest", "=", "'config'", ",", "default", "=", "DEFAULT_USER_CONFIG_PATH", ",", "help", "=", "'the path to the configuratio...
Only invoked conditionally if subcommand is 'converse'
[ "Only", "invoked", "conditionally", "if", "subcommand", "is", "converse" ]
train
https://github.com/sbarham/dsrt/blob/bc664739f2f52839461d3e72773b71146fd56a9a/dsrt/application/Application.py#L251-L255
baguette-io/baguette-messaging
farine/rpc/client.py
Client.callback
def callback(self, result, message): """ Method called automatically when a message is received. This will be executed before exiting self.start(). """ self.results.put(result) message.ack()
python
def callback(self, result, message): """ Method called automatically when a message is received. This will be executed before exiting self.start(). """ self.results.put(result) message.ack()
[ "def", "callback", "(", "self", ",", "result", ",", "message", ")", ":", "self", ".", "results", ".", "put", "(", "result", ")", "message", ".", "ack", "(", ")" ]
Method called automatically when a message is received. This will be executed before exiting self.start().
[ "Method", "called", "automatically", "when", "a", "message", "is", "received", ".", "This", "will", "be", "executed", "before", "exiting", "self", ".", "start", "()", "." ]
train
https://github.com/baguette-io/baguette-messaging/blob/8d1c4707ea7eace8617fed2d97df2fcc9d0cdee1/farine/rpc/client.py#L31-L37
capslockwizard/zdock-parser
zdock_parser/__init__.py
_read_next_timestep
def _read_next_timestep(self, ts=None): """copy next frame into timestep""" if self.ts.frame >= self.n_frames-1: raise IOError(errno.EIO, 'trying to go over trajectory limit') if ts is None: ts = self.ts ts.frame += 1 self.zdock_inst._set_pose_num(ts.frame+1) ts._pos ...
python
def _read_next_timestep(self, ts=None): """copy next frame into timestep""" if self.ts.frame >= self.n_frames-1: raise IOError(errno.EIO, 'trying to go over trajectory limit') if ts is None: ts = self.ts ts.frame += 1 self.zdock_inst._set_pose_num(ts.frame+1) ts._pos ...
[ "def", "_read_next_timestep", "(", "self", ",", "ts", "=", "None", ")", ":", "if", "self", ".", "ts", ".", "frame", ">=", "self", ".", "n_frames", "-", "1", ":", "raise", "IOError", "(", "errno", ".", "EIO", ",", "'trying to go over trajectory limit'", "...
copy next frame into timestep
[ "copy", "next", "frame", "into", "timestep" ]
train
https://github.com/capslockwizard/zdock-parser/blob/3c83d47775c985f595cf0a7e4e6fefca5dbc9ed7/zdock_parser/__init__.py#L36-L48
capslockwizard/zdock-parser
zdock_parser/__init__.py
ZDOCK._set_pose_num
def _set_pose_num(self, pose_num): """WARNING: Applies only to the MDAnalysis_Wrapper """ current_mobile_coord = self.mobile_origin_coord self.static_mobile_copy_uni.trajectory.ts._pos[self.static_num_atoms:,:] = self.zdock_trans_rot(self.grid_size, self.grid_spacing, self.init_t...
python
def _set_pose_num(self, pose_num): """WARNING: Applies only to the MDAnalysis_Wrapper """ current_mobile_coord = self.mobile_origin_coord self.static_mobile_copy_uni.trajectory.ts._pos[self.static_num_atoms:,:] = self.zdock_trans_rot(self.grid_size, self.grid_spacing, self.init_t...
[ "def", "_set_pose_num", "(", "self", ",", "pose_num", ")", ":", "current_mobile_coord", "=", "self", ".", "mobile_origin_coord", "self", ".", "static_mobile_copy_uni", ".", "trajectory", ".", "ts", ".", "_pos", "[", "self", ".", "static_num_atoms", ":", ",", "...
WARNING: Applies only to the MDAnalysis_Wrapper
[ "WARNING", ":", "Applies", "only", "to", "the", "MDAnalysis_Wrapper" ]
train
https://github.com/capslockwizard/zdock-parser/blob/3c83d47775c985f595cf0a7e4e6fefca5dbc9ed7/zdock_parser/__init__.py#L211-L217
PhilippeFerreiraDeSousa/bitext-matching
lib/enpc_aligner/IBM2_func.py
viterbi_alignment
def viterbi_alignment(es, fs, t, a): ''' return dictionary e in es -> f in fs ''' max_a = collections.defaultdict(float) l_e = len(es) l_f = len(fs) for (j, e) in enumerate(es, 1): current_max = (0, -1) for (i, f) in enumerate(fs, 1): ...
python
def viterbi_alignment(es, fs, t, a): ''' return dictionary e in es -> f in fs ''' max_a = collections.defaultdict(float) l_e = len(es) l_f = len(fs) for (j, e) in enumerate(es, 1): current_max = (0, -1) for (i, f) in enumerate(fs, 1): ...
[ "def", "viterbi_alignment", "(", "es", ",", "fs", ",", "t", ",", "a", ")", ":", "max_a", "=", "collections", ".", "defaultdict", "(", "float", ")", "l_e", "=", "len", "(", "es", ")", "l_f", "=", "len", "(", "fs", ")", "for", "(", "j", ",", "e",...
return dictionary e in es -> f in fs
[ "return", "dictionary", "e", "in", "es", "-", ">", "f", "in", "fs" ]
train
https://github.com/PhilippeFerreiraDeSousa/bitext-matching/blob/195c3e98775cfa5e63e4bb0bb1da6f741880d980/lib/enpc_aligner/IBM2_func.py#L85-L102
PhilippeFerreiraDeSousa/bitext-matching
lib/enpc_aligner/IBM2_func.py
matrix
def matrix( m, n, lst, m_text: list=None, n_text: list=None): """ m: row n: column lst: items >>> print(_matrix(2, 3, [(1, 1), (2, 3)])) |x| | | | | |x| """ fmt = "" if n_text: fmt += " {}\n".format(" ".join(n_text)) for ...
python
def matrix( m, n, lst, m_text: list=None, n_text: list=None): """ m: row n: column lst: items >>> print(_matrix(2, 3, [(1, 1), (2, 3)])) |x| | | | | |x| """ fmt = "" if n_text: fmt += " {}\n".format(" ".join(n_text)) for ...
[ "def", "matrix", "(", "m", ",", "n", ",", "lst", ",", "m_text", ":", "list", "=", "None", ",", "n_text", ":", "list", "=", "None", ")", ":", "fmt", "=", "\"\"", "if", "n_text", ":", "fmt", "+=", "\" {}\\n\"", ".", "format", "(", "\" \"", ".",...
m: row n: column lst: items >>> print(_matrix(2, 3, [(1, 1), (2, 3)])) |x| | | | | |x|
[ "m", ":", "row", "n", ":", "column", "lst", ":", "items", ">>>", "print", "(", "_matrix", "(", "2", "3", "[", "(", "1", "1", ")", "(", "2", "3", ")", "]", "))", "|x|", "|", "|", "|", "|", "|x|" ]
train
https://github.com/PhilippeFerreiraDeSousa/bitext-matching/blob/195c3e98775cfa5e63e4bb0bb1da6f741880d980/lib/enpc_aligner/IBM2_func.py#L104-L131
PhilippeFerreiraDeSousa/bitext-matching
lib/enpc_aligner/IBM2_func.py
show_matrix
def show_matrix(es, fs, t, a): ''' print matrix according to viterbi alignment like fs ------------- e|x| | | | s| |x| | | | | | |x| | | |x| | ------------- ''' max_a = viterbi_alignment(es, fs, t, a).items() m = len(es) n = len(fs) retur...
python
def show_matrix(es, fs, t, a): ''' print matrix according to viterbi alignment like fs ------------- e|x| | | | s| |x| | | | | | |x| | | |x| | ------------- ''' max_a = viterbi_alignment(es, fs, t, a).items() m = len(es) n = len(fs) retur...
[ "def", "show_matrix", "(", "es", ",", "fs", ",", "t", ",", "a", ")", ":", "max_a", "=", "viterbi_alignment", "(", "es", ",", "fs", ",", "t", ",", "a", ")", ".", "items", "(", ")", "m", "=", "len", "(", "es", ")", "n", "=", "len", "(", "fs",...
print matrix according to viterbi alignment like fs ------------- e|x| | | | s| |x| | | | | | |x| | | |x| | -------------
[ "print", "matrix", "according", "to", "viterbi", "alignment", "like", "fs", "-------------", "e|x|", "|", "|", "|", "s|", "|x|", "|", "|", "|", "|", "|", "|x|", "|", "|", "|x|", "|", "-------------" ]
train
https://github.com/PhilippeFerreiraDeSousa/bitext-matching/blob/195c3e98775cfa5e63e4bb0bb1da6f741880d980/lib/enpc_aligner/IBM2_func.py#L133-L148
rackerlabs/txkazoo
txkazoo/recipe/watchers.py
watch_children
def watch_children(kzclient, path, func, allow_session_lost=True, send_event=False, ChildrenWatch=ChildrenWatch): """ Install a Kazoo :obj:`ChildrenWatch` on the given path. The given `func` will be called in the reactor thread when any children are created or dele...
python
def watch_children(kzclient, path, func, allow_session_lost=True, send_event=False, ChildrenWatch=ChildrenWatch): """ Install a Kazoo :obj:`ChildrenWatch` on the given path. The given `func` will be called in the reactor thread when any children are created or dele...
[ "def", "watch_children", "(", "kzclient", ",", "path", ",", "func", ",", "allow_session_lost", "=", "True", ",", "send_event", "=", "False", ",", "ChildrenWatch", "=", "ChildrenWatch", ")", ":", "def", "wrapped_func", "(", "*", "args", ",", "*", "*", "kwar...
Install a Kazoo :obj:`ChildrenWatch` on the given path. The given `func` will be called in the reactor thread when any children are created or deleted, or if the node itself is deleted. Returns a Deferred which usually has no result, but may fail with an exception if e.g. the path does not exist.
[ "Install", "a", "Kazoo", ":", "obj", ":", "ChildrenWatch", "on", "the", "given", "path", "." ]
train
https://github.com/rackerlabs/txkazoo/blob/a0989138cc08df7acd1d410f7e48708553839f46/txkazoo/recipe/watchers.py#L22-L45
tiffon/take
take/scanner.py
Scanner._make_marker_token
def _make_marker_token(self, type_): """Make a token that has no content""" tok = Token(type_, '', self.line, self.line_num, self.start, self.start) return tok
python
def _make_marker_token(self, type_): """Make a token that has no content""" tok = Token(type_, '', self.line, self.line_num, self.start, self.start) return tok
[ "def", "_make_marker_token", "(", "self", ",", "type_", ")", ":", "tok", "=", "Token", "(", "type_", ",", "''", ",", "self", ".", "line", ",", "self", ".", "line_num", ",", "self", ".", "start", ",", "self", ".", "start", ")", "return", "tok" ]
Make a token that has no content
[ "Make", "a", "token", "that", "has", "no", "content" ]
train
https://github.com/tiffon/take/blob/907a2c4a72f5cbd357eadd4837fa4cae23647096/take/scanner.py#L134-L142
pip-services3-python/pip-services3-commons-python
pip_services3_commons/convert/JsonConverter.py
JsonConverter.to_nullable_map
def to_nullable_map(value): """ Converts JSON string into map object or returns null when conversion is not possible. :param value: the JSON string to convert. :return: Map object value or null when conversion is not supported. """ if value == None: return N...
python
def to_nullable_map(value): """ Converts JSON string into map object or returns null when conversion is not possible. :param value: the JSON string to convert. :return: Map object value or null when conversion is not supported. """ if value == None: return N...
[ "def", "to_nullable_map", "(", "value", ")", ":", "if", "value", "==", "None", ":", "return", "None", "# Parse JSON", "try", ":", "value", "=", "json", ".", "loads", "(", "value", ")", "return", "RecursiveMapConverter", ".", "to_nullable_map", "(", "value", ...
Converts JSON string into map object or returns null when conversion is not possible. :param value: the JSON string to convert. :return: Map object value or null when conversion is not supported.
[ "Converts", "JSON", "string", "into", "map", "object", "or", "returns", "null", "when", "conversion", "is", "not", "possible", "." ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/convert/JsonConverter.py#L53-L69
pip-services3-python/pip-services3-commons-python
pip_services3_commons/convert/JsonConverter.py
JsonConverter.to_map_with_default
def to_map_with_default(value, default_value): """ Converts JSON string into map object or returns default value when conversion is not possible. :param value: the JSON string to convert. :param default_value: the default value. :return: Map object value or default when conver...
python
def to_map_with_default(value, default_value): """ Converts JSON string into map object or returns default value when conversion is not possible. :param value: the JSON string to convert. :param default_value: the default value. :return: Map object value or default when conver...
[ "def", "to_map_with_default", "(", "value", ",", "default_value", ")", ":", "result", "=", "JsonConverter", ".", "to_nullable_map", "(", "value", ")", "return", "result", "if", "result", "!=", "None", "else", "default_value" ]
Converts JSON string into map object or returns default value when conversion is not possible. :param value: the JSON string to convert. :param default_value: the default value. :return: Map object value or default when conversion is not supported.
[ "Converts", "JSON", "string", "into", "map", "object", "or", "returns", "default", "value", "when", "conversion", "is", "not", "possible", "." ]
train
https://github.com/pip-services3-python/pip-services3-commons-python/blob/22cbbb3e91e49717f65c083d36147fdb07ba9e3b/pip_services3_commons/convert/JsonConverter.py#L84-L95
FlaskGuys/Flask-Imagine
flask_imagine/filters/relative_resize.py
RelativeResizeFilter.apply
def apply(self, resource): """ :param resource: Image :return: Image """ if isinstance(resource, Image.Image): return getattr(self, '_' + self.method)(resource) else: raise ValueError('Unsupported resource format: %s' % str(type(resource)))
python
def apply(self, resource): """ :param resource: Image :return: Image """ if isinstance(resource, Image.Image): return getattr(self, '_' + self.method)(resource) else: raise ValueError('Unsupported resource format: %s' % str(type(resource)))
[ "def", "apply", "(", "self", ",", "resource", ")", ":", "if", "isinstance", "(", "resource", ",", "Image", ".", "Image", ")", ":", "return", "getattr", "(", "self", ",", "'_'", "+", "self", ".", "method", ")", "(", "resource", ")", "else", ":", "ra...
:param resource: Image :return: Image
[ ":", "param", "resource", ":", "Image", ":", "return", ":", "Image" ]
train
https://github.com/FlaskGuys/Flask-Imagine/blob/f79c6517ecb5480b63a2b3b8554edb6e2ac8be8c/flask_imagine/filters/relative_resize.py#L39-L47
FlaskGuys/Flask-Imagine
flask_imagine/filters/relative_resize.py
RelativeResizeFilter._heighten
def _heighten(self, resource): """ Change image size by height :param resource: Image :return: Image """ original_width, original_height = resource.size target_height = self.value target_width = int((float(target_height) / original_height) * original_widt...
python
def _heighten(self, resource): """ Change image size by height :param resource: Image :return: Image """ original_width, original_height = resource.size target_height = self.value target_width = int((float(target_height) / original_height) * original_widt...
[ "def", "_heighten", "(", "self", ",", "resource", ")", ":", "original_width", ",", "original_height", "=", "resource", ".", "size", "target_height", "=", "self", ".", "value", "target_width", "=", "int", "(", "(", "float", "(", "target_height", ")", "/", "...
Change image size by height :param resource: Image :return: Image
[ "Change", "image", "size", "by", "height", ":", "param", "resource", ":", "Image", ":", "return", ":", "Image" ]
train
https://github.com/FlaskGuys/Flask-Imagine/blob/f79c6517ecb5480b63a2b3b8554edb6e2ac8be8c/flask_imagine/filters/relative_resize.py#L49-L62
FlaskGuys/Flask-Imagine
flask_imagine/filters/relative_resize.py
RelativeResizeFilter._increase
def _increase(self, resource): """ Increase image size :param resource: Image :return: Image """ original_width, original_height = resource.size target_width = original_width + self.value target_height = original_height + self.value resource = re...
python
def _increase(self, resource): """ Increase image size :param resource: Image :return: Image """ original_width, original_height = resource.size target_width = original_width + self.value target_height = original_height + self.value resource = re...
[ "def", "_increase", "(", "self", ",", "resource", ")", ":", "original_width", ",", "original_height", "=", "resource", ".", "size", "target_width", "=", "original_width", "+", "self", ".", "value", "target_height", "=", "original_height", "+", "self", ".", "va...
Increase image size :param resource: Image :return: Image
[ "Increase", "image", "size", ":", "param", "resource", ":", "Image", ":", "return", ":", "Image" ]
train
https://github.com/FlaskGuys/Flask-Imagine/blob/f79c6517ecb5480b63a2b3b8554edb6e2ac8be8c/flask_imagine/filters/relative_resize.py#L79-L92
FlaskGuys/Flask-Imagine
flask_imagine/filters/relative_resize.py
RelativeResizeFilter._decrease
def _decrease(self, resource): """ Decrease image size :param resource: :return: """ original_width, original_height = resource.size if original_width > self.value and original_height > self.value: target_width = original_width - self.value ...
python
def _decrease(self, resource): """ Decrease image size :param resource: :return: """ original_width, original_height = resource.size if original_width > self.value and original_height > self.value: target_width = original_width - self.value ...
[ "def", "_decrease", "(", "self", ",", "resource", ")", ":", "original_width", ",", "original_height", "=", "resource", ".", "size", "if", "original_width", ">", "self", ".", "value", "and", "original_height", ">", "self", ".", "value", ":", "target_width", "...
Decrease image size :param resource: :return:
[ "Decrease", "image", "size", ":", "param", "resource", ":", ":", "return", ":" ]
train
https://github.com/FlaskGuys/Flask-Imagine/blob/f79c6517ecb5480b63a2b3b8554edb6e2ac8be8c/flask_imagine/filters/relative_resize.py#L94-L110
FlaskGuys/Flask-Imagine
flask_imagine/filters/relative_resize.py
RelativeResizeFilter._scale
def _scale(self, resource): """ Scale image :param resource: Image :return: Image """ original_width, original_height = resource.size target_width = int(round(original_width * self.value)) target_height = int(round(original_height * self.value)) ...
python
def _scale(self, resource): """ Scale image :param resource: Image :return: Image """ original_width, original_height = resource.size target_width = int(round(original_width * self.value)) target_height = int(round(original_height * self.value)) ...
[ "def", "_scale", "(", "self", ",", "resource", ")", ":", "original_width", ",", "original_height", "=", "resource", ".", "size", "target_width", "=", "int", "(", "round", "(", "original_width", "*", "self", ".", "value", ")", ")", "target_height", "=", "in...
Scale image :param resource: Image :return: Image
[ "Scale", "image", ":", "param", "resource", ":", "Image", ":", "return", ":", "Image" ]
train
https://github.com/FlaskGuys/Flask-Imagine/blob/f79c6517ecb5480b63a2b3b8554edb6e2ac8be8c/flask_imagine/filters/relative_resize.py#L112-L127
roboogle/gtkmvc3
gtkmvco/gtkmvc3/progen/model.py
ProgenModel.generate_project
def generate_project(self): """ Generate the whole project. Returns True if at least one file has been generated, False otherwise.""" # checks needed properties if not self.name or not self.destdir or \ not os.path.isdir(self.destdir): raise ValueError(...
python
def generate_project(self): """ Generate the whole project. Returns True if at least one file has been generated, False otherwise.""" # checks needed properties if not self.name or not self.destdir or \ not os.path.isdir(self.destdir): raise ValueError(...
[ "def", "generate_project", "(", "self", ")", ":", "# checks needed properties", "if", "not", "self", ".", "name", "or", "not", "self", ".", "destdir", "or", "not", "os", ".", "path", ".", "isdir", "(", "self", ".", "destdir", ")", ":", "raise", "ValueErr...
Generate the whole project. Returns True if at least one file has been generated, False otherwise.
[ "Generate", "the", "whole", "project", ".", "Returns", "True", "if", "at", "least", "one", "file", "has", "been", "generated", "False", "otherwise", "." ]
train
https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/gtkmvc3/progen/model.py#L97-L141
roboogle/gtkmvc3
gtkmvco/gtkmvc3/progen/model.py
ProgenModel.__generate_tree
def __generate_tree(self, top, src, resources, models, ctrls, views, utils): """Creates directories and packages""" res = self.__mkdir(top) for fn in (src, models, ctrls, views, utils): res = self.__mkpkg(fn) or res res = self.__mkdir(resources) or res res = self.__mkdir(os.path....
python
def __generate_tree(self, top, src, resources, models, ctrls, views, utils): """Creates directories and packages""" res = self.__mkdir(top) for fn in (src, models, ctrls, views, utils): res = self.__mkpkg(fn) or res res = self.__mkdir(resources) or res res = self.__mkdir(os.path....
[ "def", "__generate_tree", "(", "self", ",", "top", ",", "src", ",", "resources", ",", "models", ",", "ctrls", ",", "views", ",", "utils", ")", ":", "res", "=", "self", ".", "__mkdir", "(", "top", ")", "for", "fn", "in", "(", "src", ",", "models", ...
Creates directories and packages
[ "Creates", "directories", "and", "packages" ]
train
https://github.com/roboogle/gtkmvc3/blob/63405fd8d2056be26af49103b13a8d5e57fe4dff/gtkmvco/gtkmvc3/progen/model.py#L144-L152
BackSlasher/opengridview
opengridview/__init__.py
main
def main(): """Main entry point""" # Quit when interrupted import signal signal.signal(signal.SIGINT, signal.SIG_DFL) # Arguments: # --separator STRING/REGEX - how to split a row into cells (only relevant for CSV parser) # --flatten - flatten item hashes. {'a':{'b':'c'}} --> {'a_b':'c'} ...
python
def main(): """Main entry point""" # Quit when interrupted import signal signal.signal(signal.SIGINT, signal.SIG_DFL) # Arguments: # --separator STRING/REGEX - how to split a row into cells (only relevant for CSV parser) # --flatten - flatten item hashes. {'a':{'b':'c'}} --> {'a_b':'c'} ...
[ "def", "main", "(", ")", ":", "# Quit when interrupted", "import", "signal", "signal", ".", "signal", "(", "signal", ".", "SIGINT", ",", "signal", ".", "SIG_DFL", ")", "# Arguments:", "# --separator STRING/REGEX - how to split a row into cells (only relevant for CSV parser)...
Main entry point
[ "Main", "entry", "point" ]
train
https://github.com/BackSlasher/opengridview/blob/a820d1e33b17a32fa6f44729111d3b0e99dc58fd/opengridview/__init__.py#L14-L55
tkrajina/TileStitcher
tilestitcher/__init__.py
SlippyMapTiles._deg2num
def _deg2num(self, lat_deg, lon_deg, zoom, leave_float=False): """ Taken from http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Python """ lat_rad = mod_math.radians(lat_deg) n = 2.0 ** zoom xtile = (lon_deg + 180.0) / 360.0 * n ytile = (1.0 - mod_math.log(mod_math.tan(lat_...
python
def _deg2num(self, lat_deg, lon_deg, zoom, leave_float=False): """ Taken from http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Python """ lat_rad = mod_math.radians(lat_deg) n = 2.0 ** zoom xtile = (lon_deg + 180.0) / 360.0 * n ytile = (1.0 - mod_math.log(mod_math.tan(lat_...
[ "def", "_deg2num", "(", "self", ",", "lat_deg", ",", "lon_deg", ",", "zoom", ",", "leave_float", "=", "False", ")", ":", "lat_rad", "=", "mod_math", ".", "radians", "(", "lat_deg", ")", "n", "=", "2.0", "**", "zoom", "xtile", "=", "(", "lon_deg", "+"...
Taken from http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Python
[ "Taken", "from", "http", ":", "//", "wiki", ".", "openstreetmap", ".", "org", "/", "wiki", "/", "Slippy_map_tilenames#Python" ]
train
https://github.com/tkrajina/TileStitcher/blob/aba142f273a864e86a863e206e215214217e5202/tilestitcher/__init__.py#L70-L79
tkrajina/TileStitcher
tilestitcher/__init__.py
SlippyMapTiles._num2deg
def _num2deg(self, tile): """ Taken from http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Python """ n = 2.0 ** tile.zoom lon_deg = tile.x / n * 360.0 - 180.0 lat_rad = mod_math.atan(mod_math.sinh(mod_math.pi * (1 - 2 * tile.y / n))) lat_deg = mod_math.degrees(lat_rad) ...
python
def _num2deg(self, tile): """ Taken from http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Python """ n = 2.0 ** tile.zoom lon_deg = tile.x / n * 360.0 - 180.0 lat_rad = mod_math.atan(mod_math.sinh(mod_math.pi * (1 - 2 * tile.y / n))) lat_deg = mod_math.degrees(lat_rad) ...
[ "def", "_num2deg", "(", "self", ",", "tile", ")", ":", "n", "=", "2.0", "**", "tile", ".", "zoom", "lon_deg", "=", "tile", ".", "x", "/", "n", "*", "360.0", "-", "180.0", "lat_rad", "=", "mod_math", ".", "atan", "(", "mod_math", ".", "sinh", "(",...
Taken from http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Python
[ "Taken", "from", "http", ":", "//", "wiki", ".", "openstreetmap", ".", "org", "/", "wiki", "/", "Slippy_map_tilenames#Python" ]
train
https://github.com/tkrajina/TileStitcher/blob/aba142f273a864e86a863e206e215214217e5202/tilestitcher/__init__.py#L81-L87
tkrajina/TileStitcher
tilestitcher/__init__.py
SlippyMapTiles.get_image
def get_image(self, latitute_range, longitude_range, width, height, polyline=None, polyline_color=None, \ polyline_width=None, attribution=None, dots=None): assert len(latitute_range) == 2 assert latitute_range[0] < latitute_range[1] assert len(longitude_range) == 2 ass...
python
def get_image(self, latitute_range, longitude_range, width, height, polyline=None, polyline_color=None, \ polyline_width=None, attribution=None, dots=None): assert len(latitute_range) == 2 assert latitute_range[0] < latitute_range[1] assert len(longitude_range) == 2 ass...
[ "def", "get_image", "(", "self", ",", "latitute_range", ",", "longitude_range", ",", "width", ",", "height", ",", "polyline", "=", "None", ",", "polyline_color", "=", "None", ",", "polyline_width", "=", "None", ",", "attribution", "=", "None", ",", "dots", ...
DEBUG: draw = mod_imagedraw.Draw(stitched) draw.ellipse((image_info.center_x - 2, image_info.center_y - 2, image_info.center_x + 2, image_info.center_y + 2), fill=(0, 0, 0)) red = (255, 0, 0) draw.ellipse((image_info.widthheight_window_1[0] - 2, image_info.widthheight_window_1[1] - 2, ...
[ "DEBUG", ":", "draw", "=", "mod_imagedraw", ".", "Draw", "(", "stitched", ")", "draw", ".", "ellipse", "((", "image_info", ".", "center_x", "-", "2", "image_info", ".", "center_y", "-", "2", "image_info", ".", "center_x", "+", "2", "image_info", ".", "ce...
train
https://github.com/tkrajina/TileStitcher/blob/aba142f273a864e86a863e206e215214217e5202/tilestitcher/__init__.py#L168-L214
knetsolutions/smallcli
smallcli/resources/ssh.py
ssh.scp_put
def scp_put(self, src, dst): """Copy src file from local system to dst on remote system.""" cmd = [ 'scp', '-B', '-oStrictHostKeyChecking=no', '-oUserKnownHostsFile=/dev/null', '-oLogLevel=ERROR'] if self._key is not None: ...
python
def scp_put(self, src, dst): """Copy src file from local system to dst on remote system.""" cmd = [ 'scp', '-B', '-oStrictHostKeyChecking=no', '-oUserKnownHostsFile=/dev/null', '-oLogLevel=ERROR'] if self._key is not None: ...
[ "def", "scp_put", "(", "self", ",", "src", ",", "dst", ")", ":", "cmd", "=", "[", "'scp'", ",", "'-B'", ",", "'-oStrictHostKeyChecking=no'", ",", "'-oUserKnownHostsFile=/dev/null'", ",", "'-oLogLevel=ERROR'", "]", "if", "self", ".", "_key", "is", "not", "Non...
Copy src file from local system to dst on remote system.
[ "Copy", "src", "file", "from", "local", "system", "to", "dst", "on", "remote", "system", "." ]
train
https://github.com/knetsolutions/smallcli/blob/4e0e4407e0f827d2abcb13401fddf4d747d1655e/smallcli/resources/ssh.py#L49-L69
etcher-be/elib_miz
elib_miz/mission.py
BaseMissionObject.get_country_by_name
def get_country_by_name(self, country_name: str) -> typing.Optional['Country']: """ Gets a country from its name Args: country_name: country name Returns: Country """ VALID_STR.validate(country_name, 'get_country_by_name', exc=ValueError) if country_...
python
def get_country_by_name(self, country_name: str) -> typing.Optional['Country']: """ Gets a country from its name Args: country_name: country name Returns: Country """ VALID_STR.validate(country_name, 'get_country_by_name', exc=ValueError) if country_...
[ "def", "get_country_by_name", "(", "self", ",", "country_name", ":", "str", ")", "->", "typing", ".", "Optional", "[", "'Country'", "]", ":", "VALID_STR", ".", "validate", "(", "country_name", ",", "'get_country_by_name'", ",", "exc", "=", "ValueError", ")", ...
Gets a country from its name Args: country_name: country name Returns: Country
[ "Gets", "a", "country", "from", "its", "name" ]
train
https://github.com/etcher-be/elib_miz/blob/f28db58fadb2cd9341e0ae4d65101c0cc7d8f3d7/elib_miz/mission.py#L46-L64
etcher-be/elib_miz
elib_miz/mission.py
BaseMissionObject.get_country_by_id
def get_country_by_id(self, country_id: int) -> typing.Optional['Country']: """ Gets a country from its name Args: country_id: country id Returns: Country """ VALID_POSITIVE_INT.validate(country_id, 'get_country_by_id') if country_id not in self._cou...
python
def get_country_by_id(self, country_id: int) -> typing.Optional['Country']: """ Gets a country from its name Args: country_id: country id Returns: Country """ VALID_POSITIVE_INT.validate(country_id, 'get_country_by_id') if country_id not in self._cou...
[ "def", "get_country_by_id", "(", "self", ",", "country_id", ":", "int", ")", "->", "typing", ".", "Optional", "[", "'Country'", "]", ":", "VALID_POSITIVE_INT", ".", "validate", "(", "country_id", ",", "'get_country_by_id'", ")", "if", "country_id", "not", "in"...
Gets a country from its name Args: country_id: country id Returns: Country
[ "Gets", "a", "country", "from", "its", "name" ]
train
https://github.com/etcher-be/elib_miz/blob/f28db58fadb2cd9341e0ae4d65101c0cc7d8f3d7/elib_miz/mission.py#L66-L84
etcher-be/elib_miz
elib_miz/mission.py
BaseMissionObject.get_group_by_id
def get_group_by_id(self, group_id: str) -> typing.Optional['Group']: """ Gets a group by id Args: group_id: group id Returns: Group """ VALID_POSITIVE_INT.validate(group_id, 'get_group_by_id', exc=ValueError) for group in self.groups: i...
python
def get_group_by_id(self, group_id: str) -> typing.Optional['Group']: """ Gets a group by id Args: group_id: group id Returns: Group """ VALID_POSITIVE_INT.validate(group_id, 'get_group_by_id', exc=ValueError) for group in self.groups: i...
[ "def", "get_group_by_id", "(", "self", ",", "group_id", ":", "str", ")", "->", "typing", ".", "Optional", "[", "'Group'", "]", ":", "VALID_POSITIVE_INT", ".", "validate", "(", "group_id", ",", "'get_group_by_id'", ",", "exc", "=", "ValueError", ")", "for", ...
Gets a group by id Args: group_id: group id Returns: Group
[ "Gets", "a", "group", "by", "id" ]
train
https://github.com/etcher-be/elib_miz/blob/f28db58fadb2cd9341e0ae4d65101c0cc7d8f3d7/elib_miz/mission.py#L114-L128
etcher-be/elib_miz
elib_miz/mission.py
BaseMissionObject.get_clients_groups
def get_clients_groups(self) -> typing.Iterator['Group']: """ Gets all clients groups Returns: generator of Groups """ for group in self.groups: if group.group_is_client_group: yield group
python
def get_clients_groups(self) -> typing.Iterator['Group']: """ Gets all clients groups Returns: generator of Groups """ for group in self.groups: if group.group_is_client_group: yield group
[ "def", "get_clients_groups", "(", "self", ")", "->", "typing", ".", "Iterator", "[", "'Group'", "]", ":", "for", "group", "in", "self", ".", "groups", ":", "if", "group", ".", "group_is_client_group", ":", "yield", "group" ]
Gets all clients groups Returns: generator of Groups
[ "Gets", "all", "clients", "groups" ]
train
https://github.com/etcher-be/elib_miz/blob/f28db58fadb2cd9341e0ae4d65101c0cc7d8f3d7/elib_miz/mission.py#L130-L139
etcher-be/elib_miz
elib_miz/mission.py
BaseMissionObject.get_group_by_name
def get_group_by_name(self, group_name: str) -> typing.Optional['Group']: """ Gets a group from its name Args: group_name: Returns: Group """ VALID_STR.validate(group_name, 'get_group_by_name') for group in self.groups: if group.group_na...
python
def get_group_by_name(self, group_name: str) -> typing.Optional['Group']: """ Gets a group from its name Args: group_name: Returns: Group """ VALID_STR.validate(group_name, 'get_group_by_name') for group in self.groups: if group.group_na...
[ "def", "get_group_by_name", "(", "self", ",", "group_name", ":", "str", ")", "->", "typing", ".", "Optional", "[", "'Group'", "]", ":", "VALID_STR", ".", "validate", "(", "group_name", ",", "'get_group_by_name'", ")", "for", "group", "in", "self", ".", "gr...
Gets a group from its name Args: group_name: Returns: Group
[ "Gets", "a", "group", "from", "its", "name" ]
train
https://github.com/etcher-be/elib_miz/blob/f28db58fadb2cd9341e0ae4d65101c0cc7d8f3d7/elib_miz/mission.py#L141-L155
etcher-be/elib_miz
elib_miz/mission.py
BaseMissionObject.get_unit_by_name
def get_unit_by_name(self, unit_name: str) -> typing.Optional['BaseUnit']: """ Gets a unit from its name Args: unit_name: unit name Returns: """ VALID_STR.validate(unit_name, 'get_unit_by_name') for unit in self.units: if unit.unit_name ...
python
def get_unit_by_name(self, unit_name: str) -> typing.Optional['BaseUnit']: """ Gets a unit from its name Args: unit_name: unit name Returns: """ VALID_STR.validate(unit_name, 'get_unit_by_name') for unit in self.units: if unit.unit_name ...
[ "def", "get_unit_by_name", "(", "self", ",", "unit_name", ":", "str", ")", "->", "typing", ".", "Optional", "[", "'BaseUnit'", "]", ":", "VALID_STR", ".", "validate", "(", "unit_name", ",", "'get_unit_by_name'", ")", "for", "unit", "in", "self", ".", "unit...
Gets a unit from its name Args: unit_name: unit name Returns:
[ "Gets", "a", "unit", "from", "its", "name" ]
train
https://github.com/etcher-be/elib_miz/blob/f28db58fadb2cd9341e0ae4d65101c0cc7d8f3d7/elib_miz/mission.py#L157-L171
etcher-be/elib_miz
elib_miz/mission.py
BaseMissionObject.get_unit_by_id
def get_unit_by_id(self, unit_id: str) -> typing.Optional['BaseUnit']: """ Gets a unit from its ID Args: unit_id: unit id Returns: Unit """ VALID_POSITIVE_INT.validate(unit_id, 'get_unit_by_id') for unit in self.units: if unit.unit_id ==...
python
def get_unit_by_id(self, unit_id: str) -> typing.Optional['BaseUnit']: """ Gets a unit from its ID Args: unit_id: unit id Returns: Unit """ VALID_POSITIVE_INT.validate(unit_id, 'get_unit_by_id') for unit in self.units: if unit.unit_id ==...
[ "def", "get_unit_by_id", "(", "self", ",", "unit_id", ":", "str", ")", "->", "typing", ".", "Optional", "[", "'BaseUnit'", "]", ":", "VALID_POSITIVE_INT", ".", "validate", "(", "unit_id", ",", "'get_unit_by_id'", ")", "for", "unit", "in", "self", ".", "uni...
Gets a unit from its ID Args: unit_id: unit id Returns: Unit
[ "Gets", "a", "unit", "from", "its", "ID" ]
train
https://github.com/etcher-be/elib_miz/blob/f28db58fadb2cd9341e0ae4d65101c0cc7d8f3d7/elib_miz/mission.py#L173-L187
etcher-be/elib_miz
elib_miz/mission.py
BaseMissionObject.units
def units(self) -> typing.Iterator['BaseUnit']: """ Iterates over all units Returns: generator of Unit """ for group in self.groups: for unit in group.units: yield unit
python
def units(self) -> typing.Iterator['BaseUnit']: """ Iterates over all units Returns: generator of Unit """ for group in self.groups: for unit in group.units: yield unit
[ "def", "units", "(", "self", ")", "->", "typing", ".", "Iterator", "[", "'BaseUnit'", "]", ":", "for", "group", "in", "self", ".", "groups", ":", "for", "unit", "in", "group", ".", "units", ":", "yield", "unit" ]
Iterates over all units Returns: generator of Unit
[ "Iterates", "over", "all", "units" ]
train
https://github.com/etcher-be/elib_miz/blob/f28db58fadb2cd9341e0ae4d65101c0cc7d8f3d7/elib_miz/mission.py#L190-L199
etcher-be/elib_miz
elib_miz/mission.py
BaseMissionObject.groups
def groups(self) -> typing.Iterator['Group']: """ Iterates over all groups Returns: generator of Group """ for country in self.countries: for group in country.groups: yield group
python
def groups(self) -> typing.Iterator['Group']: """ Iterates over all groups Returns: generator of Group """ for country in self.countries: for group in country.groups: yield group
[ "def", "groups", "(", "self", ")", "->", "typing", ".", "Iterator", "[", "'Group'", "]", ":", "for", "country", "in", "self", ".", "countries", ":", "for", "group", "in", "country", ".", "groups", ":", "yield", "group" ]
Iterates over all groups Returns: generator of Group
[ "Iterates", "over", "all", "groups" ]
train
https://github.com/etcher-be/elib_miz/blob/f28db58fadb2cd9341e0ae4d65101c0cc7d8f3d7/elib_miz/mission.py#L202-L211
etcher-be/elib_miz
elib_miz/mission.py
BaseMissionObject.next_group_id
def next_group_id(self) -> int: """ Returns: next free GroupId """ ids: typing.Set[int] = set() for group in chain(self._blue_coa.groups, self._red_coa.groups): # type: ignore id_ = group.group_id if id_ in ids: raise IndexError(group.gro...
python
def next_group_id(self) -> int: """ Returns: next free GroupId """ ids: typing.Set[int] = set() for group in chain(self._blue_coa.groups, self._red_coa.groups): # type: ignore id_ = group.group_id if id_ in ids: raise IndexError(group.gro...
[ "def", "next_group_id", "(", "self", ")", "->", "int", ":", "ids", ":", "typing", ".", "Set", "[", "int", "]", "=", "set", "(", ")", "for", "group", "in", "chain", "(", "self", ".", "_blue_coa", ".", "groups", ",", "self", ".", "_red_coa", ".", "...
Returns: next free GroupId
[ "Returns", ":", "next", "free", "GroupId" ]
train
https://github.com/etcher-be/elib_miz/blob/f28db58fadb2cd9341e0ae4d65101c0cc7d8f3d7/elib_miz/mission.py#L214-L225
etcher-be/elib_miz
elib_miz/mission.py
BaseMissionObject.next_unit_id
def next_unit_id(self) -> int: """ Returns: next free Unit ID """ ids: typing.Set[int] = set() for unit in chain(self._blue_coa.units, self._red_coa.units): # type: ignore id_ = unit.unit_id if id_ in ids: raise IndexError(unit.unit_name)...
python
def next_unit_id(self) -> int: """ Returns: next free Unit ID """ ids: typing.Set[int] = set() for unit in chain(self._blue_coa.units, self._red_coa.units): # type: ignore id_ = unit.unit_id if id_ in ids: raise IndexError(unit.unit_name)...
[ "def", "next_unit_id", "(", "self", ")", "->", "int", ":", "ids", ":", "typing", ".", "Set", "[", "int", "]", "=", "set", "(", ")", "for", "unit", "in", "chain", "(", "self", ".", "_blue_coa", ".", "units", ",", "self", ".", "_red_coa", ".", "uni...
Returns: next free Unit ID
[ "Returns", ":", "next", "free", "Unit", "ID" ]
train
https://github.com/etcher-be/elib_miz/blob/f28db58fadb2cd9341e0ae4d65101c0cc7d8f3d7/elib_miz/mission.py#L228-L239
etcher-be/elib_miz
elib_miz/mission.py
BaseMissionObject.coalitions
def coalitions(self) -> typing.Iterator['Coalition']: """ Returns: generator over all coalitions """ for coalition in [self._blue_coa, self._red_coa]: yield coalition
python
def coalitions(self) -> typing.Iterator['Coalition']: """ Returns: generator over all coalitions """ for coalition in [self._blue_coa, self._red_coa]: yield coalition
[ "def", "coalitions", "(", "self", ")", "->", "typing", ".", "Iterator", "[", "'Coalition'", "]", ":", "for", "coalition", "in", "[", "self", ".", "_blue_coa", ",", "self", ".", "_red_coa", "]", ":", "yield", "coalition" ]
Returns: generator over all coalitions
[ "Returns", ":", "generator", "over", "all", "coalitions" ]
train
https://github.com/etcher-be/elib_miz/blob/f28db58fadb2cd9341e0ae4d65101c0cc7d8f3d7/elib_miz/mission.py#L242-L248
etcher-be/elib_miz
elib_miz/mission.py
BaseMissionObject.countries
def countries(self) -> typing.Iterator['Country']: """ Returns: generator over all countries """ for coalition in self.coalitions: for country in coalition.countries: yield country
python
def countries(self) -> typing.Iterator['Country']: """ Returns: generator over all countries """ for coalition in self.coalitions: for country in coalition.countries: yield country
[ "def", "countries", "(", "self", ")", "->", "typing", ".", "Iterator", "[", "'Country'", "]", ":", "for", "coalition", "in", "self", ".", "coalitions", ":", "for", "country", "in", "coalition", ".", "countries", ":", "yield", "country" ]
Returns: generator over all countries
[ "Returns", ":", "generator", "over", "all", "countries" ]
train
https://github.com/etcher-be/elib_miz/blob/f28db58fadb2cd9341e0ae4d65101c0cc7d8f3d7/elib_miz/mission.py#L251-L258
etcher-be/elib_miz
elib_miz/mission.py
BaseMissionObject.mission_start_date_as_string
def mission_start_date_as_string(self) -> str: """ Returns: mission start date as string """ return self._start_date_as_string(self.day, self.month, self.year)
python
def mission_start_date_as_string(self) -> str: """ Returns: mission start date as string """ return self._start_date_as_string(self.day, self.month, self.year)
[ "def", "mission_start_date_as_string", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_start_date_as_string", "(", "self", ".", "day", ",", "self", ".", "month", ",", "self", ".", "year", ")" ]
Returns: mission start date as string
[ "Returns", ":", "mission", "start", "date", "as", "string" ]
train
https://github.com/etcher-be/elib_miz/blob/f28db58fadb2cd9341e0ae4d65101c0cc7d8f3d7/elib_miz/mission.py#L370-L374
etcher-be/elib_miz
elib_miz/mission.py
Mission.farps
def farps(self) -> typing.Iterator['Static']: """ Returns: generator over all FARPs objects """ for coa in [self._blue_coa, self._red_coa]: if coa is not None: for farp in coa.farps: yield farp
python
def farps(self) -> typing.Iterator['Static']: """ Returns: generator over all FARPs objects """ for coa in [self._blue_coa, self._red_coa]: if coa is not None: for farp in coa.farps: yield farp
[ "def", "farps", "(", "self", ")", "->", "typing", ".", "Iterator", "[", "'Static'", "]", ":", "for", "coa", "in", "[", "self", ".", "_blue_coa", ",", "self", ".", "_red_coa", "]", ":", "if", "coa", "is", "not", "None", ":", "for", "farp", "in", "...
Returns: generator over all FARPs objects
[ "Returns", ":", "generator", "over", "all", "FARPs", "objects" ]
train
https://github.com/etcher-be/elib_miz/blob/f28db58fadb2cd9341e0ae4d65101c0cc7d8f3d7/elib_miz/mission.py#L492-L499
etcher-be/elib_miz
elib_miz/mission.py
Coalition.bullseye_position
def bullseye_position(self) -> typing.Tuple[float, float]: """ Returns: bullseye position """ return self.bullseye_x, self.bullseye_y
python
def bullseye_position(self) -> typing.Tuple[float, float]: """ Returns: bullseye position """ return self.bullseye_x, self.bullseye_y
[ "def", "bullseye_position", "(", "self", ")", "->", "typing", ".", "Tuple", "[", "float", ",", "float", "]", ":", "return", "self", ".", "bullseye_x", ",", "self", ".", "bullseye_y" ]
Returns: bullseye position
[ "Returns", ":", "bullseye", "position" ]
train
https://github.com/etcher-be/elib_miz/blob/f28db58fadb2cd9341e0ae4d65101c0cc7d8f3d7/elib_miz/mission.py#L544-L548
etcher-be/elib_miz
elib_miz/mission.py
Coalition.countries
def countries(self) -> typing.Iterator['Country']: """ Returns: generator over all countries in this coalition """ for k in self._section_country: if k not in self._countries.keys(): country = Country(self.d, self.l10n, self.coa_color, k) self....
python
def countries(self) -> typing.Iterator['Country']: """ Returns: generator over all countries in this coalition """ for k in self._section_country: if k not in self._countries.keys(): country = Country(self.d, self.l10n, self.coa_color, k) self....
[ "def", "countries", "(", "self", ")", "->", "typing", ".", "Iterator", "[", "'Country'", "]", ":", "for", "k", "in", "self", ".", "_section_country", ":", "if", "k", "not", "in", "self", ".", "_countries", ".", "keys", "(", ")", ":", "country", "=", ...
Returns: generator over all countries in this coalition
[ "Returns", ":", "generator", "over", "all", "countries", "in", "this", "coalition" ]
train
https://github.com/etcher-be/elib_miz/blob/f28db58fadb2cd9341e0ae4d65101c0cc7d8f3d7/elib_miz/mission.py#L566-L576
etcher-be/elib_miz
elib_miz/mission.py
Coalition.get_country_by_name
def get_country_by_name(self, country_name) -> 'Country': """ Gets a country in this coalition by its name Args: country_name: country name Returns: Country """ VALID_STR.validate(country_name, 'get_country_by_name', exc=ValueError) if country_name n...
python
def get_country_by_name(self, country_name) -> 'Country': """ Gets a country in this coalition by its name Args: country_name: country name Returns: Country """ VALID_STR.validate(country_name, 'get_country_by_name', exc=ValueError) if country_name n...
[ "def", "get_country_by_name", "(", "self", ",", "country_name", ")", "->", "'Country'", ":", "VALID_STR", ".", "validate", "(", "country_name", ",", "'get_country_by_name'", ",", "exc", "=", "ValueError", ")", "if", "country_name", "not", "in", "self", ".", "_...
Gets a country in this coalition by its name Args: country_name: country name Returns: Country
[ "Gets", "a", "country", "in", "this", "coalition", "by", "its", "name" ]
train
https://github.com/etcher-be/elib_miz/blob/f28db58fadb2cd9341e0ae4d65101c0cc7d8f3d7/elib_miz/mission.py#L578-L595