repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
plotly/octogrid
octogrid/builder/builder.py
generate_gml
def generate_gml(username, nodes, edges, cache=False): """ Generate a GML format file representing the given graph attributes """ # file segment that represents all the nodes in graph node_content = "" for i in range(len(nodes)): node_id = "\t\tid %d\n" % (i + 1) node_label = "\...
python
def generate_gml(username, nodes, edges, cache=False): """ Generate a GML format file representing the given graph attributes """ # file segment that represents all the nodes in graph node_content = "" for i in range(len(nodes)): node_id = "\t\tid %d\n" % (i + 1) node_label = "\...
[ "def", "generate_gml", "(", "username", ",", "nodes", ",", "edges", ",", "cache", "=", "False", ")", ":", "# file segment that represents all the nodes in graph", "node_content", "=", "\"\"", "for", "i", "in", "range", "(", "len", "(", "nodes", ")", ")", ":", ...
Generate a GML format file representing the given graph attributes
[ "Generate", "a", "GML", "format", "file", "representing", "the", "given", "graph", "attributes" ]
train
https://github.com/plotly/octogrid/blob/46237a72c79765fe5a48af7065049c692e6457a7/octogrid/builder/builder.py#L53-L84
klen/makesite
makesite/modules/flask/base/ext.py
config_extensions
def config_extensions(app): " Init application with extensions. " cache.init_app(app) db.init_app(app) main.init_app(app) collect.init_app(app) config_babel(app)
python
def config_extensions(app): " Init application with extensions. " cache.init_app(app) db.init_app(app) main.init_app(app) collect.init_app(app) config_babel(app)
[ "def", "config_extensions", "(", "app", ")", ":", "cache", ".", "init_app", "(", "app", ")", "db", ".", "init_app", "(", "app", ")", "main", ".", "init_app", "(", "app", ")", "collect", ".", "init_app", "(", "app", ")", "config_babel", "(", "app", ")...
Init application with extensions.
[ "Init", "application", "with", "extensions", "." ]
train
https://github.com/klen/makesite/blob/f6f77a43a04a256189e8fffbeac1ffd63f35a10c/makesite/modules/flask/base/ext.py#L24-L32
klen/makesite
makesite/modules/flask/base/ext.py
config_babel
def config_babel(app): " Init application with babel. " babel.init_app(app) def get_locale(): return request.accept_languages.best_match(app.config['BABEL_LANGUAGES']) babel.localeselector(get_locale)
python
def config_babel(app): " Init application with babel. " babel.init_app(app) def get_locale(): return request.accept_languages.best_match(app.config['BABEL_LANGUAGES']) babel.localeselector(get_locale)
[ "def", "config_babel", "(", "app", ")", ":", "babel", ".", "init_app", "(", "app", ")", "def", "get_locale", "(", ")", ":", "return", "request", ".", "accept_languages", ".", "best_match", "(", "app", ".", "config", "[", "'BABEL_LANGUAGES'", "]", ")", "b...
Init application with babel.
[ "Init", "application", "with", "babel", "." ]
train
https://github.com/klen/makesite/blob/f6f77a43a04a256189e8fffbeac1ffd63f35a10c/makesite/modules/flask/base/ext.py#L35-L42
attakei/errcron
errcron/bot.py
CrontabMixin.activate_crontab
def activate_crontab(self): """Activate polling function and register first crontab """ self._crontab = [] if hasattr(self, 'CRONTAB'): for crontab_spec in self.CRONTAB: args = cronjob.parse_crontab(crontab_spec) job = cronjob.CronJob() ...
python
def activate_crontab(self): """Activate polling function and register first crontab """ self._crontab = [] if hasattr(self, 'CRONTAB'): for crontab_spec in self.CRONTAB: args = cronjob.parse_crontab(crontab_spec) job = cronjob.CronJob() ...
[ "def", "activate_crontab", "(", "self", ")", ":", "self", ".", "_crontab", "=", "[", "]", "if", "hasattr", "(", "self", ",", "'CRONTAB'", ")", ":", "for", "crontab_spec", "in", "self", ".", "CRONTAB", ":", "args", "=", "cronjob", ".", "parse_crontab", ...
Activate polling function and register first crontab
[ "Activate", "polling", "function", "and", "register", "first", "crontab" ]
train
https://github.com/attakei/errcron/blob/a3938fc7d051daefb6813588fcbeb9592bd00c9a/errcron/bot.py#L32-L51
attakei/errcron
errcron/bot.py
CrontabMixin.poll_crontab
def poll_crontab(self): """Check crontab and run target jobs """ polled_time = self._get_current_time() if polled_time.second >= 30: self.log.debug('Skip cronjobs in {}'.format(polled_time)) return for job in self._crontab: if not job.is_runnab...
python
def poll_crontab(self): """Check crontab and run target jobs """ polled_time = self._get_current_time() if polled_time.second >= 30: self.log.debug('Skip cronjobs in {}'.format(polled_time)) return for job in self._crontab: if not job.is_runnab...
[ "def", "poll_crontab", "(", "self", ")", ":", "polled_time", "=", "self", ".", "_get_current_time", "(", ")", "if", "polled_time", ".", "second", ">=", "30", ":", "self", ".", "log", ".", "debug", "(", "'Skip cronjobs in {}'", ".", "format", "(", "polled_t...
Check crontab and run target jobs
[ "Check", "crontab", "and", "run", "target", "jobs" ]
train
https://github.com/attakei/errcron/blob/a3938fc7d051daefb6813588fcbeb9592bd00c9a/errcron/bot.py#L53-L63
Visgean/urljects
urljects/routemap.py
RouteMap.include
def include(self, location, namespace=None, app_name=None): """ Return an object suitable for url_patterns. :param location: root URL for all URLs from this router :param namespace: passed to url() :param app_name: passed to url() """ sorted_entries = sorted(self...
python
def include(self, location, namespace=None, app_name=None): """ Return an object suitable for url_patterns. :param location: root URL for all URLs from this router :param namespace: passed to url() :param app_name: passed to url() """ sorted_entries = sorted(self...
[ "def", "include", "(", "self", ",", "location", ",", "namespace", "=", "None", ",", "app_name", "=", "None", ")", ":", "sorted_entries", "=", "sorted", "(", "self", ".", "routes", ",", "key", "=", "operator", ".", "itemgetter", "(", "0", ")", ",", "r...
Return an object suitable for url_patterns. :param location: root URL for all URLs from this router :param namespace: passed to url() :param app_name: passed to url()
[ "Return", "an", "object", "suitable", "for", "url_patterns", "." ]
train
https://github.com/Visgean/urljects/blob/29a3ca03f639ea7a9ee2f795ed17941c86b278ba/urljects/routemap.py#L43-L58
klen/makesite
makesite/install.py
Installer.clone_source
def clone_source(self): " Clone source and prepare templates " print_header('Clone src: %s' % self.src, '-') # Get source source_dir = self._get_source() # Append settings from source self.read(op.join(source_dir, settings.CFGNAME)) self.templates += (self.arg...
python
def clone_source(self): " Clone source and prepare templates " print_header('Clone src: %s' % self.src, '-') # Get source source_dir = self._get_source() # Append settings from source self.read(op.join(source_dir, settings.CFGNAME)) self.templates += (self.arg...
[ "def", "clone_source", "(", "self", ")", ":", "print_header", "(", "'Clone src: %s'", "%", "self", ".", "src", ",", "'-'", ")", "# Get source", "source_dir", "=", "self", ".", "_get_source", "(", ")", "# Append settings from source", "self", ".", "read", "(", ...
Clone source and prepare templates
[ "Clone", "source", "and", "prepare", "templates" ]
train
https://github.com/klen/makesite/blob/f6f77a43a04a256189e8fffbeac1ffd63f35a10c/makesite/install.py#L46-L90
klen/makesite
makesite/install.py
Installer._get_source
def _get_source(self): " Get source from CVS or filepath. " source_dir = op.join(self.deploy_dir, 'source') for tp, cmd in settings.SRC_CLONE: if self.src.startswith(tp + '+'): program = which(tp) assert program, '%s not found.' % tp cm...
python
def _get_source(self): " Get source from CVS or filepath. " source_dir = op.join(self.deploy_dir, 'source') for tp, cmd in settings.SRC_CLONE: if self.src.startswith(tp + '+'): program = which(tp) assert program, '%s not found.' % tp cm...
[ "def", "_get_source", "(", "self", ")", ":", "source_dir", "=", "op", ".", "join", "(", "self", ".", "deploy_dir", ",", "'source'", ")", "for", "tp", ",", "cmd", "in", "settings", ".", "SRC_CLONE", ":", "if", "self", ".", "src", ".", "startswith", "(...
Get source from CVS or filepath.
[ "Get", "source", "from", "CVS", "or", "filepath", "." ]
train
https://github.com/klen/makesite/blob/f6f77a43a04a256189e8fffbeac1ffd63f35a10c/makesite/install.py#L102-L120
ask/bundle
bundle/utils.py
quote
def quote(text, ws=plain): """Quote special characters in shell command arguments. E.g ``--foo bar>=10.1`` becomes "--foo bar\>\=10\.1``. """ return "".join(chr in ws and chr or '\\' + chr for chr in text)
python
def quote(text, ws=plain): """Quote special characters in shell command arguments. E.g ``--foo bar>=10.1`` becomes "--foo bar\>\=10\.1``. """ return "".join(chr in ws and chr or '\\' + chr for chr in text)
[ "def", "quote", "(", "text", ",", "ws", "=", "plain", ")", ":", "return", "\"\"", ".", "join", "(", "chr", "in", "ws", "and", "chr", "or", "'\\\\'", "+", "chr", "for", "chr", "in", "text", ")" ]
Quote special characters in shell command arguments. E.g ``--foo bar>=10.1`` becomes "--foo bar\>\=10\.1``.
[ "Quote", "special", "characters", "in", "shell", "command", "arguments", "." ]
train
https://github.com/ask/bundle/blob/bcd8f685f1039beeacce9fdf78dccf2d2e34d81f/bundle/utils.py#L17-L24
klen/makesite
makesite/modules/django/main/utils/views.py
AbstractResponseMixin.render_to_response
def render_to_response(self, context): "Return HttpResponse." return http.HttpResponse( self.render_template(context), content_type=self.mimetype)
python
def render_to_response(self, context): "Return HttpResponse." return http.HttpResponse( self.render_template(context), content_type=self.mimetype)
[ "def", "render_to_response", "(", "self", ",", "context", ")", ":", "return", "http", ".", "HttpResponse", "(", "self", ".", "render_template", "(", "context", ")", ",", "content_type", "=", "self", ".", "mimetype", ")" ]
Return HttpResponse.
[ "Return", "HttpResponse", "." ]
train
https://github.com/klen/makesite/blob/f6f77a43a04a256189e8fffbeac1ffd63f35a10c/makesite/modules/django/main/utils/views.py#L33-L37
plotly/octogrid
octogrid/publisher/publisher.py
prepare_plot_data
def prepare_plot_data(data_file): """ Return a list of Plotly elements representing the network graph """ G = ig.Graph.Read_GML(data_file) layout = G.layout('graphopt') labels = list(G.vs['label']) N = len(labels) E = [e.tuple for e in G.es] community = G.community_multilevel().m...
python
def prepare_plot_data(data_file): """ Return a list of Plotly elements representing the network graph """ G = ig.Graph.Read_GML(data_file) layout = G.layout('graphopt') labels = list(G.vs['label']) N = len(labels) E = [e.tuple for e in G.es] community = G.community_multilevel().m...
[ "def", "prepare_plot_data", "(", "data_file", ")", ":", "G", "=", "ig", ".", "Graph", ".", "Read_GML", "(", "data_file", ")", "layout", "=", "G", ".", "layout", "(", "'graphopt'", ")", "labels", "=", "list", "(", "G", ".", "vs", "[", "'label'", "]", ...
Return a list of Plotly elements representing the network graph
[ "Return", "a", "list", "of", "Plotly", "elements", "representing", "the", "network", "graph" ]
train
https://github.com/plotly/octogrid/blob/46237a72c79765fe5a48af7065049c692e6457a7/octogrid/publisher/publisher.py#L19-L83
plotly/octogrid
octogrid/publisher/publisher.py
publish_network
def publish_network(user=None, reset=False): """ Generate graph network for a user and plot it using Plotly """ username = generate_network(user, reset) network_file = username_to_file(username) plot_data = prepare_plot_data(network_file) data = Data(plot_data) # hide axis line, grid,...
python
def publish_network(user=None, reset=False): """ Generate graph network for a user and plot it using Plotly """ username = generate_network(user, reset) network_file = username_to_file(username) plot_data = prepare_plot_data(network_file) data = Data(plot_data) # hide axis line, grid,...
[ "def", "publish_network", "(", "user", "=", "None", ",", "reset", "=", "False", ")", ":", "username", "=", "generate_network", "(", "user", ",", "reset", ")", "network_file", "=", "username_to_file", "(", "username", ")", "plot_data", "=", "prepare_plot_data",...
Generate graph network for a user and plot it using Plotly
[ "Generate", "graph", "network", "for", "a", "user", "and", "plot", "it", "using", "Plotly" ]
train
https://github.com/plotly/octogrid/blob/46237a72c79765fe5a48af7065049c692e6457a7/octogrid/publisher/publisher.py#L86-L152
array-split/array_split
array_split/split.py
pad_with_object
def pad_with_object(sequence, new_length, obj=None): """ Returns :samp:`sequence` :obj:`list` end-padded with :samp:`{obj}` elements so that the length of the returned list equals :samp:`{new_length}`. :type sequence: iterable :param sequence: Return *listified* sequence which has been end-padded. ...
python
def pad_with_object(sequence, new_length, obj=None): """ Returns :samp:`sequence` :obj:`list` end-padded with :samp:`{obj}` elements so that the length of the returned list equals :samp:`{new_length}`. :type sequence: iterable :param sequence: Return *listified* sequence which has been end-padded. ...
[ "def", "pad_with_object", "(", "sequence", ",", "new_length", ",", "obj", "=", "None", ")", ":", "if", "len", "(", "sequence", ")", "<", "new_length", ":", "sequence", "=", "list", "(", "sequence", ")", "+", "[", "obj", ",", "]", "*", "(", "new_lengt...
Returns :samp:`sequence` :obj:`list` end-padded with :samp:`{obj}` elements so that the length of the returned list equals :samp:`{new_length}`. :type sequence: iterable :param sequence: Return *listified* sequence which has been end-padded. :type new_length: :obj:`int` :param new_length: The lengt...
[ "Returns", ":", "samp", ":", "sequence", ":", "obj", ":", "list", "end", "-", "padded", "with", ":", "samp", ":", "{", "obj", "}", "elements", "so", "that", "the", "length", "of", "the", "returned", "list", "equals", ":", "samp", ":", "{", "new_lengt...
train
https://github.com/array-split/array_split/blob/e07abe3001209394dde809f7e6f505f9f49a1c26/array_split/split.py#L126-L159
array-split/array_split
array_split/split.py
shape_factors
def shape_factors(n, dim=2): """ Returns a :obj:`numpy.ndarray` of factors :samp:`f` such that :samp:`(len(f) == {dim}) and (numpy.product(f) == {n})`. The returned factors are as *square* (*cubic*, etc) as possible. For example:: >>> shape_factors(24, 1) array([24]) >>> shape_...
python
def shape_factors(n, dim=2): """ Returns a :obj:`numpy.ndarray` of factors :samp:`f` such that :samp:`(len(f) == {dim}) and (numpy.product(f) == {n})`. The returned factors are as *square* (*cubic*, etc) as possible. For example:: >>> shape_factors(24, 1) array([24]) >>> shape_...
[ "def", "shape_factors", "(", "n", ",", "dim", "=", "2", ")", ":", "if", "dim", "<=", "1", ":", "factors", "=", "[", "n", ",", "]", "else", ":", "for", "f", "in", "range", "(", "int", "(", "n", "**", "(", "1.0", "/", "float", "(", "dim", ")"...
Returns a :obj:`numpy.ndarray` of factors :samp:`f` such that :samp:`(len(f) == {dim}) and (numpy.product(f) == {n})`. The returned factors are as *square* (*cubic*, etc) as possible. For example:: >>> shape_factors(24, 1) array([24]) >>> shape_factors(24, 2) array([4, 6]) ...
[ "Returns", "a", ":", "obj", ":", "numpy", ".", "ndarray", "of", "factors", ":", "samp", ":", "f", "such", "that", ":", "samp", ":", "(", "len", "(", "f", ")", "==", "{", "dim", "}", ")", "and", "(", "numpy", ".", "product", "(", "f", ")", "==...
train
https://github.com/array-split/array_split/blob/e07abe3001209394dde809f7e6f505f9f49a1c26/array_split/split.py#L179-L215
array-split/array_split
array_split/split.py
calculate_tile_shape_for_max_bytes
def calculate_tile_shape_for_max_bytes( array_shape, array_itemsize, max_tile_bytes, max_tile_shape=None, sub_tile_shape=None, halo=None ): """ Returns a tile shape :samp:`tile_shape` such that :samp:`numpy.product(tile_shape)*numpy.sum({array_itemsize}) <= {max_tile_bytes}`. Als...
python
def calculate_tile_shape_for_max_bytes( array_shape, array_itemsize, max_tile_bytes, max_tile_shape=None, sub_tile_shape=None, halo=None ): """ Returns a tile shape :samp:`tile_shape` such that :samp:`numpy.product(tile_shape)*numpy.sum({array_itemsize}) <= {max_tile_bytes}`. Als...
[ "def", "calculate_tile_shape_for_max_bytes", "(", "array_shape", ",", "array_itemsize", ",", "max_tile_bytes", ",", "max_tile_shape", "=", "None", ",", "sub_tile_shape", "=", "None", ",", "halo", "=", "None", ")", ":", "logger", "=", "_logging", ".", "getLogger", ...
Returns a tile shape :samp:`tile_shape` such that :samp:`numpy.product(tile_shape)*numpy.sum({array_itemsize}) <= {max_tile_bytes}`. Also, if :samp:`{max_tile_shape} is not None` then :samp:`numpy.all(tile_shape <= {max_tile_shape}) is True` and if :samp:`{sub_tile_shape} is not None` the :samp:`num...
[ "Returns", "a", "tile", "shape", ":", "samp", ":", "tile_shape", "such", "that", ":", "samp", ":", "numpy", ".", "product", "(", "tile_shape", ")", "*", "numpy", ".", "sum", "(", "{", "array_itemsize", "}", ")", "<", "=", "{", "max_tile_bytes", "}", ...
train
https://github.com/array-split/array_split/blob/e07abe3001209394dde809f7e6f505f9f49a1c26/array_split/split.py#L218-L395
array-split/array_split
array_split/split.py
calculate_num_slices_per_axis
def calculate_num_slices_per_axis(num_slices_per_axis, num_slices, max_slices_per_axis=None): """ Returns a :obj:`numpy.ndarray` (:samp:`return_array` say) where non-positive elements of the :samp:`{num_slices_per_axis}` sequence have been replaced with positive integer values such that :samp:`numpy.pro...
python
def calculate_num_slices_per_axis(num_slices_per_axis, num_slices, max_slices_per_axis=None): """ Returns a :obj:`numpy.ndarray` (:samp:`return_array` say) where non-positive elements of the :samp:`{num_slices_per_axis}` sequence have been replaced with positive integer values such that :samp:`numpy.pro...
[ "def", "calculate_num_slices_per_axis", "(", "num_slices_per_axis", ",", "num_slices", ",", "max_slices_per_axis", "=", "None", ")", ":", "logger", "=", "_logging", ".", "getLogger", "(", "__name__", ")", "ret_array", "=", "_np", ".", "array", "(", "num_slices_per...
Returns a :obj:`numpy.ndarray` (:samp:`return_array` say) where non-positive elements of the :samp:`{num_slices_per_axis}` sequence have been replaced with positive integer values such that :samp:`numpy.product(return_array) == num_slices` and:: numpy.all( return_array[numpy.where(num_sli...
[ "Returns", "a", ":", "obj", ":", "numpy", ".", "ndarray", "(", ":", "samp", ":", "return_array", "say", ")", "where", "non", "-", "positive", "elements", "of", "the", ":", "samp", ":", "{", "num_slices_per_axis", "}", "sequence", "have", "been", "replace...
train
https://github.com/array-split/array_split/blob/e07abe3001209394dde809f7e6f505f9f49a1c26/array_split/split.py#L398-L481
array-split/array_split
array_split/split.py
convert_halo_to_array_form
def convert_halo_to_array_form(halo, ndim): """ Converts the :samp:`{halo}` argument to a :samp:`(ndim, 2)` shaped array. :type halo: :samp:`None`, :obj:`int`, an :samp:`{ndim}` length sequence of :samp:`int` or :samp:`({ndim}, 2)` shaped array of :samp:`int` :param halo: Halo to be...
python
def convert_halo_to_array_form(halo, ndim): """ Converts the :samp:`{halo}` argument to a :samp:`(ndim, 2)` shaped array. :type halo: :samp:`None`, :obj:`int`, an :samp:`{ndim}` length sequence of :samp:`int` or :samp:`({ndim}, 2)` shaped array of :samp:`int` :param halo: Halo to be...
[ "def", "convert_halo_to_array_form", "(", "halo", ",", "ndim", ")", ":", "dtyp", "=", "_np", ".", "int64", "if", "halo", "is", "None", ":", "halo", "=", "_np", ".", "zeros", "(", "(", "ndim", ",", "2", ")", ",", "dtype", "=", "dtyp", ")", "elif", ...
Converts the :samp:`{halo}` argument to a :samp:`(ndim, 2)` shaped array. :type halo: :samp:`None`, :obj:`int`, an :samp:`{ndim}` length sequence of :samp:`int` or :samp:`({ndim}, 2)` shaped array of :samp:`int` :param halo: Halo to be converted to :samp:`({ndim}, 2)` shaped array form. ...
[ "Converts", "the", ":", "samp", ":", "{", "halo", "}", "argument", "to", "a", ":", "samp", ":", "(", "ndim", "2", ")", "shaped", "array", "." ]
train
https://github.com/array-split/array_split/blob/e07abe3001209394dde809f7e6f505f9f49a1c26/array_split/split.py#L592-L642
array-split/array_split
array_split/split.py
array_split
def array_split( ary, indices_or_sections=None, axis=None, tile_shape=None, max_tile_bytes=None, max_tile_shape=None, sub_tile_shape=None, halo=None ): "To be replaced." return [ ary[slyce] for slyce in shape_split( array_shape=ary.shape, ...
python
def array_split( ary, indices_or_sections=None, axis=None, tile_shape=None, max_tile_bytes=None, max_tile_shape=None, sub_tile_shape=None, halo=None ): "To be replaced." return [ ary[slyce] for slyce in shape_split( array_shape=ary.shape, ...
[ "def", "array_split", "(", "ary", ",", "indices_or_sections", "=", "None", ",", "axis", "=", "None", ",", "tile_shape", "=", "None", ",", "max_tile_bytes", "=", "None", ",", "max_tile_shape", "=", "None", ",", "sub_tile_shape", "=", "None", ",", "halo", "=...
To be replaced.
[ "To", "be", "replaced", "." ]
train
https://github.com/array-split/array_split/blob/e07abe3001209394dde809f7e6f505f9f49a1c26/array_split/split.py#L1588-L1615
array-split/array_split
array_split/split.py
ShapeSplitter.convert_halo_to_array_form
def convert_halo_to_array_form(self, halo): """ Converts the :samp:`{halo}` argument to a :samp:`({self}.array_shape.size, 2)` shaped array. :type halo: :samp:`None`, :obj:`int`, :samp:`self.array_shape.size` length sequence of :samp:`int` or :samp:`(self.array_shape.size, 2...
python
def convert_halo_to_array_form(self, halo): """ Converts the :samp:`{halo}` argument to a :samp:`({self}.array_shape.size, 2)` shaped array. :type halo: :samp:`None`, :obj:`int`, :samp:`self.array_shape.size` length sequence of :samp:`int` or :samp:`(self.array_shape.size, 2...
[ "def", "convert_halo_to_array_form", "(", "self", ",", "halo", ")", ":", "return", "convert_halo_to_array_form", "(", "halo", "=", "halo", ",", "ndim", "=", "len", "(", "self", ".", "array_shape", ")", ")" ]
Converts the :samp:`{halo}` argument to a :samp:`({self}.array_shape.size, 2)` shaped array. :type halo: :samp:`None`, :obj:`int`, :samp:`self.array_shape.size` length sequence of :samp:`int` or :samp:`(self.array_shape.size, 2)` shaped array of :samp:`int` :param halo: ...
[ "Converts", "the", ":", "samp", ":", "{", "halo", "}", "argument", "to", "a", ":", "samp", ":", "(", "{", "self", "}", ".", "array_shape", ".", "size", "2", ")", "shaped", "array", "." ]
train
https://github.com/array-split/array_split/blob/e07abe3001209394dde809f7e6f505f9f49a1c26/array_split/split.py#L795-L807
array-split/array_split
array_split/split.py
ShapeSplitter.check_tile_bounds_policy
def check_tile_bounds_policy(self): """ Raises :obj:`ValueError` if :attr:`tile_bounds_policy` is not in :samp:`[{self}.ARRAY_BOUNDS, {self}.NO_BOUNDS]`. """ if self.tile_bounds_policy not in self.valid_tile_bounds_policies: raise ValueError( "Got self...
python
def check_tile_bounds_policy(self): """ Raises :obj:`ValueError` if :attr:`tile_bounds_policy` is not in :samp:`[{self}.ARRAY_BOUNDS, {self}.NO_BOUNDS]`. """ if self.tile_bounds_policy not in self.valid_tile_bounds_policies: raise ValueError( "Got self...
[ "def", "check_tile_bounds_policy", "(", "self", ")", ":", "if", "self", ".", "tile_bounds_policy", "not", "in", "self", ".", "valid_tile_bounds_policies", ":", "raise", "ValueError", "(", "\"Got self.tile_bounds_policy=%s, which is not in %s.\"", "%", "(", "self", ".", ...
Raises :obj:`ValueError` if :attr:`tile_bounds_policy` is not in :samp:`[{self}.ARRAY_BOUNDS, {self}.NO_BOUNDS]`.
[ "Raises", ":", "obj", ":", "ValueError", "if", ":", "attr", ":", "tile_bounds_policy", "is", "not", "in", ":", "samp", ":", "[", "{", "self", "}", ".", "ARRAY_BOUNDS", "{", "self", "}", ".", "NO_BOUNDS", "]", "." ]
train
https://github.com/array-split/array_split/blob/e07abe3001209394dde809f7e6f505f9f49a1c26/array_split/split.py#L1022-L1032
array-split/array_split
array_split/split.py
ShapeSplitter.check_consistent_parameter_dimensions
def check_consistent_parameter_dimensions(self): """ Ensure that all parameter dimensions are consistent with the :attr:`array_shape` dimension. :raises ValueError: For inconsistent parameter dimensions. """ if self.indices_per_axis is not None: if len(self.i...
python
def check_consistent_parameter_dimensions(self): """ Ensure that all parameter dimensions are consistent with the :attr:`array_shape` dimension. :raises ValueError: For inconsistent parameter dimensions. """ if self.indices_per_axis is not None: if len(self.i...
[ "def", "check_consistent_parameter_dimensions", "(", "self", ")", ":", "if", "self", ".", "indices_per_axis", "is", "not", "None", ":", "if", "len", "(", "self", ".", "indices_per_axis", ")", ">", "len", "(", "self", ".", "array_shape", ")", ":", "raise", ...
Ensure that all parameter dimensions are consistent with the :attr:`array_shape` dimension. :raises ValueError: For inconsistent parameter dimensions.
[ "Ensure", "that", "all", "parameter", "dimensions", "are", "consistent", "with", "the", ":", "attr", ":", "array_shape", "dimension", "." ]
train
https://github.com/array-split/array_split/blob/e07abe3001209394dde809f7e6f505f9f49a1c26/array_split/split.py#L1034-L1089
array-split/array_split
array_split/split.py
ShapeSplitter.check_consistent_parameter_grouping
def check_consistent_parameter_grouping(self): """ Ensures this object does not have conflicting groups of parameters. :raises ValueError: For conflicting or absent parameters. """ parameter_groups = {} if self.indices_per_axis is not None: parameter_groups["...
python
def check_consistent_parameter_grouping(self): """ Ensures this object does not have conflicting groups of parameters. :raises ValueError: For conflicting or absent parameters. """ parameter_groups = {} if self.indices_per_axis is not None: parameter_groups["...
[ "def", "check_consistent_parameter_grouping", "(", "self", ")", ":", "parameter_groups", "=", "{", "}", "if", "self", ".", "indices_per_axis", "is", "not", "None", ":", "parameter_groups", "[", "\"indices_per_axis\"", "]", "=", "{", "\"self.indices_per_axis\"", ":",...
Ensures this object does not have conflicting groups of parameters. :raises ValueError: For conflicting or absent parameters.
[ "Ensures", "this", "object", "does", "not", "have", "conflicting", "groups", "of", "parameters", "." ]
train
https://github.com/array-split/array_split/blob/e07abe3001209394dde809f7e6f505f9f49a1c26/array_split/split.py#L1091-L1149
array-split/array_split
array_split/split.py
ShapeSplitter.update_tile_extent_bounds
def update_tile_extent_bounds(self): """ Updates the :attr:`tile_beg_min` and :attr:`tile_end_max` data members according to :attr:`tile_bounds_policy`. """ if self.tile_bounds_policy == NO_BOUNDS: self.tile_beg_min = self.array_start - self.halo[:, 0] se...
python
def update_tile_extent_bounds(self): """ Updates the :attr:`tile_beg_min` and :attr:`tile_end_max` data members according to :attr:`tile_bounds_policy`. """ if self.tile_bounds_policy == NO_BOUNDS: self.tile_beg_min = self.array_start - self.halo[:, 0] se...
[ "def", "update_tile_extent_bounds", "(", "self", ")", ":", "if", "self", ".", "tile_bounds_policy", "==", "NO_BOUNDS", ":", "self", ".", "tile_beg_min", "=", "self", ".", "array_start", "-", "self", ".", "halo", "[", ":", ",", "0", "]", "self", ".", "til...
Updates the :attr:`tile_beg_min` and :attr:`tile_end_max` data members according to :attr:`tile_bounds_policy`.
[ "Updates", "the", ":", "attr", ":", "tile_beg_min", "and", ":", "attr", ":", "tile_end_max", "data", "members", "according", "to", ":", "attr", ":", "tile_bounds_policy", "." ]
train
https://github.com/array-split/array_split/blob/e07abe3001209394dde809f7e6f505f9f49a1c26/array_split/split.py#L1162-L1173
array-split/array_split
array_split/split.py
ShapeSplitter.set_split_extents_by_indices_per_axis
def set_split_extents_by_indices_per_axis(self): """ Sets split shape :attr:`split_shape` and split extents (:attr:`split_begs` and :attr:`split_ends`) from values in :attr:`indices_per_axis`. """ if self.indices_per_axis is None: raise ValueError("Got None fo...
python
def set_split_extents_by_indices_per_axis(self): """ Sets split shape :attr:`split_shape` and split extents (:attr:`split_begs` and :attr:`split_ends`) from values in :attr:`indices_per_axis`. """ if self.indices_per_axis is None: raise ValueError("Got None fo...
[ "def", "set_split_extents_by_indices_per_axis", "(", "self", ")", ":", "if", "self", ".", "indices_per_axis", "is", "None", ":", "raise", "ValueError", "(", "\"Got None for self.indices_per_axis\"", ")", "self", ".", "logger", ".", "debug", "(", "\"self.array_shape=%s...
Sets split shape :attr:`split_shape` and split extents (:attr:`split_begs` and :attr:`split_ends`) from values in :attr:`indices_per_axis`.
[ "Sets", "split", "shape", ":", "attr", ":", "split_shape", "and", "split", "extents", "(", ":", "attr", ":", "split_begs", "and", ":", "attr", ":", "split_ends", ")", "from", "values", "in", ":", "attr", ":", "indices_per_axis", "." ]
train
https://github.com/array-split/array_split/blob/e07abe3001209394dde809f7e6f505f9f49a1c26/array_split/split.py#L1175-L1207
array-split/array_split
array_split/split.py
ShapeSplitter.calculate_split_from_extents
def calculate_split_from_extents(self): """ Returns split calculated using extents obtained from :attr:`split_begs` and :attr:`split_ends`. All calls to calculate the split end up here to produce the :mod:`numpy` `structured array <http://docs.scipy.org/doc/numpy/user/basics.rec....
python
def calculate_split_from_extents(self): """ Returns split calculated using extents obtained from :attr:`split_begs` and :attr:`split_ends`. All calls to calculate the split end up here to produce the :mod:`numpy` `structured array <http://docs.scipy.org/doc/numpy/user/basics.rec....
[ "def", "calculate_split_from_extents", "(", "self", ")", ":", "self", ".", "logger", ".", "debug", "(", "\"self.split_shape=%s\"", ",", "self", ".", "split_shape", ")", "self", ".", "logger", ".", "debug", "(", "\"self.split_begs=%s\"", ",", "self", ".", "spli...
Returns split calculated using extents obtained from :attr:`split_begs` and :attr:`split_ends`. All calls to calculate the split end up here to produce the :mod:`numpy` `structured array <http://docs.scipy.org/doc/numpy/user/basics.rec.html>`_ of :obj:`tuple`-of-:obj:`slice` elements. ...
[ "Returns", "split", "calculated", "using", "extents", "obtained", "from", ":", "attr", ":", "split_begs", "and", ":", "attr", ":", "split_ends", ".", "All", "calls", "to", "calculate", "the", "split", "end", "up", "here", "to", "produce", "the", ":", "mod"...
train
https://github.com/array-split/array_split/blob/e07abe3001209394dde809f7e6f505f9f49a1c26/array_split/split.py#L1209-L1261
array-split/array_split
array_split/split.py
ShapeSplitter.calculate_axis_split_extents
def calculate_axis_split_extents(self, num_sections, size): """ Divides :samp:`range(0, {size})` into (approximately) equal sized intervals. Returns :samp:`(begs, ends)` where :samp:`slice(begs[i], ends[i])` define the intervals for :samp:`i in range(0, {num_sections})`. :type n...
python
def calculate_axis_split_extents(self, num_sections, size): """ Divides :samp:`range(0, {size})` into (approximately) equal sized intervals. Returns :samp:`(begs, ends)` where :samp:`slice(begs[i], ends[i])` define the intervals for :samp:`i in range(0, {num_sections})`. :type n...
[ "def", "calculate_axis_split_extents", "(", "self", ",", "num_sections", ",", "size", ")", ":", "section_size", "=", "size", "//", "num_sections", "if", "section_size", ">=", "1", ":", "begs", "=", "_np", ".", "arange", "(", "0", ",", "section_size", "*", ...
Divides :samp:`range(0, {size})` into (approximately) equal sized intervals. Returns :samp:`(begs, ends)` where :samp:`slice(begs[i], ends[i])` define the intervals for :samp:`i in range(0, {num_sections})`. :type num_sections: :obj:`int` :param num_sections: Divide :samp:`range(0, {si...
[ "Divides", ":", "samp", ":", "range", "(", "0", "{", "size", "}", ")", "into", "(", "approximately", ")", "equal", "sized", "intervals", ".", "Returns", ":", "samp", ":", "(", "begs", "ends", ")", "where", ":", "samp", ":", "slice", "(", "begs", "[...
train
https://github.com/array-split/array_split/blob/e07abe3001209394dde809f7e6f505f9f49a1c26/array_split/split.py#L1328-L1361
array-split/array_split
array_split/split.py
ShapeSplitter.set_split_extents_by_split_size
def set_split_extents_by_split_size(self): """ Sets split shape :attr:`split_shape` and split extents (:attr:`split_begs` and :attr:`split_ends`) from values in :attr:`split_size` and :attr:`split_num_slices_per_axis`. """ if self.split_size is None: if ( ...
python
def set_split_extents_by_split_size(self): """ Sets split shape :attr:`split_shape` and split extents (:attr:`split_begs` and :attr:`split_ends`) from values in :attr:`split_size` and :attr:`split_num_slices_per_axis`. """ if self.split_size is None: if ( ...
[ "def", "set_split_extents_by_split_size", "(", "self", ")", ":", "if", "self", ".", "split_size", "is", "None", ":", "if", "(", "_np", ".", "all", "(", "[", "s", "is", "not", "None", "for", "s", "in", "self", ".", "split_num_slices_per_axis", "]", ")", ...
Sets split shape :attr:`split_shape` and split extents (:attr:`split_begs` and :attr:`split_ends`) from values in :attr:`split_size` and :attr:`split_num_slices_per_axis`.
[ "Sets", "split", "shape", ":", "attr", ":", "split_shape", "and", "split", "extents", "(", ":", "attr", ":", "split_begs", "and", ":", "attr", ":", "split_ends", ")", "from", "values", "in", ":", "attr", ":", "split_size", "and", ":", "attr", ":", "spl...
train
https://github.com/array-split/array_split/blob/e07abe3001209394dde809f7e6f505f9f49a1c26/array_split/split.py#L1363-L1408
array-split/array_split
array_split/split.py
ShapeSplitter.set_split_extents_by_tile_shape
def set_split_extents_by_tile_shape(self): """ Sets split shape :attr:`split_shape` and split extents (:attr:`split_begs` and :attr:`split_ends`) from value of :attr:`tile_shape`. """ self.split_shape = ((self.array_shape - 1) // self.tile_shape) + 1 self.split_be...
python
def set_split_extents_by_tile_shape(self): """ Sets split shape :attr:`split_shape` and split extents (:attr:`split_begs` and :attr:`split_ends`) from value of :attr:`tile_shape`. """ self.split_shape = ((self.array_shape - 1) // self.tile_shape) + 1 self.split_be...
[ "def", "set_split_extents_by_tile_shape", "(", "self", ")", ":", "self", ".", "split_shape", "=", "(", "(", "self", ".", "array_shape", "-", "1", ")", "//", "self", ".", "tile_shape", ")", "+", "1", "self", ".", "split_begs", "=", "[", "[", "]", ",", ...
Sets split shape :attr:`split_shape` and split extents (:attr:`split_begs` and :attr:`split_ends`) from value of :attr:`tile_shape`.
[ "Sets", "split", "shape", ":", "attr", ":", "split_shape", "and", "split", "extents", "(", ":", "attr", ":", "split_begs", "and", ":", "attr", ":", "split_ends", ")", "from", "value", "of", ":", "attr", ":", "tile_shape", "." ]
train
https://github.com/array-split/array_split/blob/e07abe3001209394dde809f7e6f505f9f49a1c26/array_split/split.py#L1423-L1436
array-split/array_split
array_split/split.py
ShapeSplitter.set_split_extents_by_tile_max_bytes
def set_split_extents_by_tile_max_bytes(self): """ Sets split extents (:attr:`split_begs` and :attr:`split_ends`) calculated using from :attr:`max_tile_bytes` (and :attr:`max_tile_shape`, :attr:`sub_tile_shape`, :attr:`halo`). """ self.tile_shape = \ ...
python
def set_split_extents_by_tile_max_bytes(self): """ Sets split extents (:attr:`split_begs` and :attr:`split_ends`) calculated using from :attr:`max_tile_bytes` (and :attr:`max_tile_shape`, :attr:`sub_tile_shape`, :attr:`halo`). """ self.tile_shape = \ ...
[ "def", "set_split_extents_by_tile_max_bytes", "(", "self", ")", ":", "self", ".", "tile_shape", "=", "calculate_tile_shape_for_max_bytes", "(", "array_shape", "=", "self", ".", "array_shape", ",", "array_itemsize", "=", "self", ".", "array_itemsize", ",", "max_tile_by...
Sets split extents (:attr:`split_begs` and :attr:`split_ends`) calculated using from :attr:`max_tile_bytes` (and :attr:`max_tile_shape`, :attr:`sub_tile_shape`, :attr:`halo`).
[ "Sets", "split", "extents", "(", ":", "attr", ":", "split_begs", "and", ":", "attr", ":", "split_ends", ")", "calculated", "using", "from", ":", "attr", ":", "max_tile_bytes", "(", "and", ":", "attr", ":", "max_tile_shape", ":", "attr", ":", "sub_tile_shap...
train
https://github.com/array-split/array_split/blob/e07abe3001209394dde809f7e6f505f9f49a1c26/array_split/split.py#L1451-L1468
array-split/array_split
array_split/split.py
ShapeSplitter.set_split_extents
def set_split_extents(self): """ Sets split extents (:attr:`split_begs` and :attr:`split_ends`) calculated using selected attributes set from :meth:`__init__`. """ self.check_split_parameters() self.update_tile_extent_bounds() if self.indices_per_axis is...
python
def set_split_extents(self): """ Sets split extents (:attr:`split_begs` and :attr:`split_ends`) calculated using selected attributes set from :meth:`__init__`. """ self.check_split_parameters() self.update_tile_extent_bounds() if self.indices_per_axis is...
[ "def", "set_split_extents", "(", "self", ")", ":", "self", ".", "check_split_parameters", "(", ")", "self", ".", "update_tile_extent_bounds", "(", ")", "if", "self", ".", "indices_per_axis", "is", "not", "None", ":", "self", ".", "set_split_extents_by_indices_per_...
Sets split extents (:attr:`split_begs` and :attr:`split_ends`) calculated using selected attributes set from :meth:`__init__`.
[ "Sets", "split", "extents", "(", ":", "attr", ":", "split_begs", "and", ":", "attr", ":", "split_ends", ")", "calculated", "using", "selected", "attributes", "set", "from", ":", "meth", ":", "__init__", "." ]
train
https://github.com/array-split/array_split/blob/e07abe3001209394dde809f7e6f505f9f49a1c26/array_split/split.py#L1485-L1502
rodynnz/xccdf
src/xccdf/models/tailoring.py
Tailoring.load_children
def load_children(self): """ Load the subelements from the xml_element in its correspondent classes. :returns: List of child objects. :rtype: list :raises CardinalityException: If there is more than one Version child. :raises CardinalityException: If there is no Version ...
python
def load_children(self): """ Load the subelements from the xml_element in its correspondent classes. :returns: List of child objects. :rtype: list :raises CardinalityException: If there is more than one Version child. :raises CardinalityException: If there is no Version ...
[ "def", "load_children", "(", "self", ")", ":", "# Containers", "children", "=", "list", "(", ")", "statuses", "=", "list", "(", ")", "version", "=", "None", "profiles", "=", "list", "(", ")", "# Element load", "for", "element", "in", "self", ".", "xml_el...
Load the subelements from the xml_element in its correspondent classes. :returns: List of child objects. :rtype: list :raises CardinalityException: If there is more than one Version child. :raises CardinalityException: If there is no Version child. :raises CardinalityException: ...
[ "Load", "the", "subelements", "from", "the", "xml_element", "in", "its", "correspondent", "classes", "." ]
train
https://github.com/rodynnz/xccdf/blob/1b9dc2f06b5cce8db2a54c5f95a8f6bcf5cb6981/src/xccdf/models/tailoring.py#L80-L124
rodynnz/xccdf
src/xccdf/models/tailoring.py
Tailoring.update_xml_element
def update_xml_element(self): """ Updates the xml element contents to matches the instance contents. :returns: Updated XML element :rtype: lxml.etree._Element """ if not hasattr(self, 'xml_element'): self.xml_element = etree.Element(self.name, nsmap=NSMAP) ...
python
def update_xml_element(self): """ Updates the xml element contents to matches the instance contents. :returns: Updated XML element :rtype: lxml.etree._Element """ if not hasattr(self, 'xml_element'): self.xml_element = etree.Element(self.name, nsmap=NSMAP) ...
[ "def", "update_xml_element", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'xml_element'", ")", ":", "self", ".", "xml_element", "=", "etree", ".", "Element", "(", "self", ".", "name", ",", "nsmap", "=", "NSMAP", ")", "self", ".", ...
Updates the xml element contents to matches the instance contents. :returns: Updated XML element :rtype: lxml.etree._Element
[ "Updates", "the", "xml", "element", "contents", "to", "matches", "the", "instance", "contents", "." ]
train
https://github.com/rodynnz/xccdf/blob/1b9dc2f06b5cce8db2a54c5f95a8f6bcf5cb6981/src/xccdf/models/tailoring.py#L126-L144
astroswego/plotypus
src/plotypus/lightcurve.py
make_predictor
def make_predictor(regressor=LassoLarsIC(fit_intercept=False), Selector=GridSearchCV, fourier_degree=(2, 25), selector_processes=1, use_baart=False, scoring='r2', scoring_cv=3, **kwargs): """make_predictor(regressor=LassoLarsIC(fit_intercep...
python
def make_predictor(regressor=LassoLarsIC(fit_intercept=False), Selector=GridSearchCV, fourier_degree=(2, 25), selector_processes=1, use_baart=False, scoring='r2', scoring_cv=3, **kwargs): """make_predictor(regressor=LassoLarsIC(fit_intercep...
[ "def", "make_predictor", "(", "regressor", "=", "LassoLarsIC", "(", "fit_intercept", "=", "False", ")", ",", "Selector", "=", "GridSearchCV", ",", "fourier_degree", "=", "(", "2", ",", "25", ")", ",", "selector_processes", "=", "1", ",", "use_baart", "=", ...
make_predictor(regressor=LassoLarsIC(fit_intercept=False), Selector=GridSearchCV, fourier_degree=(2, 25), selector_processes=1, use_baart=False, scoring='r2', scoring_cv=3, **kwargs) Makes a predictor object for use in :func:`get_lightcurve`. **Parameters** regressor : object with "fit" and "transform" m...
[ "make_predictor", "(", "regressor", "=", "LassoLarsIC", "(", "fit_intercept", "=", "False", ")", "Selector", "=", "GridSearchCV", "fourier_degree", "=", "(", "2", "25", ")", "selector_processes", "=", "1", "use_baart", "=", "False", "scoring", "=", "r2", "scor...
train
https://github.com/astroswego/plotypus/blob/b1162194ca1d4f6c00e79afe3e6fb40f0eaffcb9/src/plotypus/lightcurve.py#L35-L81
astroswego/plotypus
src/plotypus/lightcurve.py
get_lightcurve
def get_lightcurve(data, copy=False, name=None, predictor=None, periodogram=Lomb_Scargle, sigma_clipping=mad, scoring='r2', scoring_cv=3, scoring_processes=1, period=None, min_period=0.2, max_period=32, coarse_precision=1e-5,...
python
def get_lightcurve(data, copy=False, name=None, predictor=None, periodogram=Lomb_Scargle, sigma_clipping=mad, scoring='r2', scoring_cv=3, scoring_processes=1, period=None, min_period=0.2, max_period=32, coarse_precision=1e-5,...
[ "def", "get_lightcurve", "(", "data", ",", "copy", "=", "False", ",", "name", "=", "None", ",", "predictor", "=", "None", ",", "periodogram", "=", "Lomb_Scargle", ",", "sigma_clipping", "=", "mad", ",", "scoring", "=", "'r2'", ",", "scoring_cv", "=", "3"...
get_lightcurve(data, copy=False, name=None, predictor=None, periodogram=Lomb_Scargle, sigma_clipping=mad, scoring='r2', scoring_cv=3, scoring_processes=1, period=None, min_period=0.2, max_period=32, coarse_precision=1e-5, fine_precision=1e-9, period_processes=1, sigma=20, shift=None, min_phase_cover=0.0, n_phases=100, ...
[ "get_lightcurve", "(", "data", "copy", "=", "False", "name", "=", "None", "predictor", "=", "None", "periodogram", "=", "Lomb_Scargle", "sigma_clipping", "=", "mad", "scoring", "=", "r2", "scoring_cv", "=", "3", "scoring_processes", "=", "1", "period", "=", ...
train
https://github.com/astroswego/plotypus/blob/b1162194ca1d4f6c00e79afe3e6fb40f0eaffcb9/src/plotypus/lightcurve.py#L84-L307
astroswego/plotypus
src/plotypus/lightcurve.py
get_lightcurve_from_file
def get_lightcurve_from_file(file, *args, use_cols=None, skiprows=0, verbosity=None, **kwargs): """get_lightcurve_from_file(file, *args, use_cols=None, skiprows=0, **kwargs) Fits a light curve to the data contained in *file* using :func:`get_lightcu...
python
def get_lightcurve_from_file(file, *args, use_cols=None, skiprows=0, verbosity=None, **kwargs): """get_lightcurve_from_file(file, *args, use_cols=None, skiprows=0, **kwargs) Fits a light curve to the data contained in *file* using :func:`get_lightcu...
[ "def", "get_lightcurve_from_file", "(", "file", ",", "*", "args", ",", "use_cols", "=", "None", ",", "skiprows", "=", "0", ",", "verbosity", "=", "None", ",", "*", "*", "kwargs", ")", ":", "data", "=", "numpy", ".", "loadtxt", "(", "file", ",", "skip...
get_lightcurve_from_file(file, *args, use_cols=None, skiprows=0, **kwargs) Fits a light curve to the data contained in *file* using :func:`get_lightcurve`. **Parameters** file : str or file File or filename to load data from. use_cols : iterable or None, optional Iterable of colum...
[ "get_lightcurve_from_file", "(", "file", "*", "args", "use_cols", "=", "None", "skiprows", "=", "0", "**", "kwargs", ")" ]
train
https://github.com/astroswego/plotypus/blob/b1162194ca1d4f6c00e79afe3e6fb40f0eaffcb9/src/plotypus/lightcurve.py#L310-L341
astroswego/plotypus
src/plotypus/lightcurve.py
find_outliers
def find_outliers(data, predictor, sigma, method=mad): """find_outliers(data, predictor, sigma, method=mad) Returns a boolean array indicating the outliers in the given *data* array. **Parameters** data : array-like, shape = [n_samples, 2] or [n_samples, 3] Photometry array ...
python
def find_outliers(data, predictor, sigma, method=mad): """find_outliers(data, predictor, sigma, method=mad) Returns a boolean array indicating the outliers in the given *data* array. **Parameters** data : array-like, shape = [n_samples, 2] or [n_samples, 3] Photometry array ...
[ "def", "find_outliers", "(", "data", ",", "predictor", ",", "sigma", ",", "method", "=", "mad", ")", ":", "phase", ",", "mag", ",", "", "*", "err", "=", "data", ".", "T", "residuals", "=", "numpy", ".", "absolute", "(", "predictor", ".", "predict", ...
find_outliers(data, predictor, sigma, method=mad) Returns a boolean array indicating the outliers in the given *data* array. **Parameters** data : array-like, shape = [n_samples, 2] or [n_samples, 3] Photometry array containing columns *phase*, *magnitude*, and (optional) *error*. pre...
[ "find_outliers", "(", "data", "predictor", "sigma", "method", "=", "mad", ")" ]
train
https://github.com/astroswego/plotypus/blob/b1162194ca1d4f6c00e79afe3e6fb40f0eaffcb9/src/plotypus/lightcurve.py#L379-L408
astroswego/plotypus
src/plotypus/lightcurve.py
plot_lightcurve
def plot_lightcurve(name, lightcurve, period, data, output='.', legend=False, sanitize_latex=False, color=True, n_phases=100, err_const=0.005, **kwargs): """plot_lightcurve(name, lightcurve, period, data, output='.', legend=False, color...
python
def plot_lightcurve(name, lightcurve, period, data, output='.', legend=False, sanitize_latex=False, color=True, n_phases=100, err_const=0.005, **kwargs): """plot_lightcurve(name, lightcurve, period, data, output='.', legend=False, color...
[ "def", "plot_lightcurve", "(", "name", ",", "lightcurve", ",", "period", ",", "data", ",", "output", "=", "'.'", ",", "legend", "=", "False", ",", "sanitize_latex", "=", "False", ",", "color", "=", "True", ",", "n_phases", "=", "100", ",", "err_const", ...
plot_lightcurve(name, lightcurve, period, data, output='.', legend=False, color=True, n_phases=100, err_const=0.005, **kwargs) Save a plot of the given *lightcurve* to directory *output*. **Parameters** name : str Name of the star. Used in filename and plot title. lightcurve : array-like, sha...
[ "plot_lightcurve", "(", "name", "lightcurve", "period", "data", "output", "=", ".", "legend", "=", "False", "color", "=", "True", "n_phases", "=", "100", "err_const", "=", "0", ".", "005", "**", "kwargs", ")" ]
train
https://github.com/astroswego/plotypus/blob/b1162194ca1d4f6c00e79afe3e6fb40f0eaffcb9/src/plotypus/lightcurve.py#L411-L492
klen/makesite
makesite/modules/flask/base/core/__init__.py
register_app
def register_app(app): " Configure application. " from .views import urls app.register_blueprint(urls) from .ext import admin admin.init_app(app) from flask_bootstrap import Bootstrap bootstrap = Bootstrap() bootstrap.init_app(app) from flask import render_template app.errorh...
python
def register_app(app): " Configure application. " from .views import urls app.register_blueprint(urls) from .ext import admin admin.init_app(app) from flask_bootstrap import Bootstrap bootstrap = Bootstrap() bootstrap.init_app(app) from flask import render_template app.errorh...
[ "def", "register_app", "(", "app", ")", ":", "from", ".", "views", "import", "urls", "app", ".", "register_blueprint", "(", "urls", ")", "from", ".", "ext", "import", "admin", "admin", ".", "init_app", "(", "app", ")", "from", "flask_bootstrap", "import", ...
Configure application.
[ "Configure", "application", "." ]
train
https://github.com/klen/makesite/blob/f6f77a43a04a256189e8fffbeac1ffd63f35a10c/makesite/modules/flask/base/core/__init__.py#L4-L18
ereOn/azmq
azmq/context.py
Context.socket
def socket(self, socket_type, identity=None, mechanism=None): """ Create and register a new socket. :param socket_type: The type of the socket. :param loop: An optional event loop to associate the socket with. This is the preferred method to create new sockets. """ ...
python
def socket(self, socket_type, identity=None, mechanism=None): """ Create and register a new socket. :param socket_type: The type of the socket. :param loop: An optional event loop to associate the socket with. This is the preferred method to create new sockets. """ ...
[ "def", "socket", "(", "self", ",", "socket_type", ",", "identity", "=", "None", ",", "mechanism", "=", "None", ")", ":", "socket", "=", "Socket", "(", "context", "=", "self", ",", "socket_type", "=", "socket_type", ",", "identity", "=", "identity", ",", ...
Create and register a new socket. :param socket_type: The type of the socket. :param loop: An optional event loop to associate the socket with. This is the preferred method to create new sockets.
[ "Create", "and", "register", "a", "new", "socket", "." ]
train
https://github.com/ereOn/azmq/blob/9f40d6d721eea7f7659ec6cc668811976db59854/azmq/context.py#L39-L56
ereOn/azmq
azmq/context.py
Context.set_zap_authenticator
def set_zap_authenticator(self, zap_authenticator): """ Setup a ZAP authenticator. :param zap_authenticator: A ZAP authenticator instance to use. The context takes ownership of the specified instance. It will close it automatically when it stops. If `None` is specified, ...
python
def set_zap_authenticator(self, zap_authenticator): """ Setup a ZAP authenticator. :param zap_authenticator: A ZAP authenticator instance to use. The context takes ownership of the specified instance. It will close it automatically when it stops. If `None` is specified, ...
[ "def", "set_zap_authenticator", "(", "self", ",", "zap_authenticator", ")", ":", "result", "=", "self", ".", "_zap_authenticator", "if", "result", ":", "self", ".", "unregister_child", "(", "result", ")", "self", ".", "_zap_authenticator", "=", "zap_authenticator"...
Setup a ZAP authenticator. :param zap_authenticator: A ZAP authenticator instance to use. The context takes ownership of the specified instance. It will close it automatically when it stops. If `None` is specified, any previously owner instance is disowned and returned. It b...
[ "Setup", "a", "ZAP", "authenticator", "." ]
train
https://github.com/ereOn/azmq/blob/9f40d6d721eea7f7659ec6cc668811976db59854/azmq/context.py#L58-L86
inveniosoftware/invenio-marc21
invenio_marc21/serializers/dojson.py
DoJSONSerializer.transform_record
def transform_record(self, pid, record, links_factory=None): """Transform record into an intermediate representation. :param pid: The :class:`invenio_pidstore.models.PersistentIdentifier` instance. :param record: The :class:`invenio_records.api.Record` instance. :param links...
python
def transform_record(self, pid, record, links_factory=None): """Transform record into an intermediate representation. :param pid: The :class:`invenio_pidstore.models.PersistentIdentifier` instance. :param record: The :class:`invenio_records.api.Record` instance. :param links...
[ "def", "transform_record", "(", "self", ",", "pid", ",", "record", ",", "links_factory", "=", "None", ")", ":", "return", "self", ".", "dump", "(", "self", ".", "preprocess_record", "(", "pid", ",", "record", ",", "links_factory", "=", "links_factory", ")"...
Transform record into an intermediate representation. :param pid: The :class:`invenio_pidstore.models.PersistentIdentifier` instance. :param record: The :class:`invenio_records.api.Record` instance. :param links_factory: The link factory. (Default: ``None``) :returns: The in...
[ "Transform", "record", "into", "an", "intermediate", "representation", "." ]
train
https://github.com/inveniosoftware/invenio-marc21/blob/b91347b5b000757b6dc9dc1be88d76ca09611905/invenio_marc21/serializers/dojson.py#L39-L49
inveniosoftware/invenio-marc21
invenio_marc21/serializers/dojson.py
DoJSONSerializer.transform_search_hit
def transform_search_hit(self, pid, record_hit, links_factory=None): """Transform search result hit into an intermediate representation. :param pid: The :class:`invenio_pidstore.models.PersistentIdentifier` instance. :param record_hit: A dictionary containing a ``'_source'`` key wit...
python
def transform_search_hit(self, pid, record_hit, links_factory=None): """Transform search result hit into an intermediate representation. :param pid: The :class:`invenio_pidstore.models.PersistentIdentifier` instance. :param record_hit: A dictionary containing a ``'_source'`` key wit...
[ "def", "transform_search_hit", "(", "self", ",", "pid", ",", "record_hit", ",", "links_factory", "=", "None", ")", ":", "return", "self", ".", "dump", "(", "self", ".", "preprocess_search_hit", "(", "pid", ",", "record_hit", ",", "links_factory", "=", "links...
Transform search result hit into an intermediate representation. :param pid: The :class:`invenio_pidstore.models.PersistentIdentifier` instance. :param record_hit: A dictionary containing a ``'_source'`` key with the record data. :param links_factory: The link factory. (...
[ "Transform", "search", "result", "hit", "into", "an", "intermediate", "representation", "." ]
train
https://github.com/inveniosoftware/invenio-marc21/blob/b91347b5b000757b6dc9dc1be88d76ca09611905/invenio_marc21/serializers/dojson.py#L51-L62
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/git.py
GitRepo.contains_repository
def contains_repository(cls, context, directory): """Check whether the given directory contains a local repository.""" directory = cls.get_vcs_directory(context, directory) return context.is_file(os.path.join(directory, 'config'))
python
def contains_repository(cls, context, directory): """Check whether the given directory contains a local repository.""" directory = cls.get_vcs_directory(context, directory) return context.is_file(os.path.join(directory, 'config'))
[ "def", "contains_repository", "(", "cls", ",", "context", ",", "directory", ")", ":", "directory", "=", "cls", ".", "get_vcs_directory", "(", "context", ",", "directory", ")", "return", "context", ".", "is_file", "(", "os", ".", "path", ".", "join", "(", ...
Check whether the given directory contains a local repository.
[ "Check", "whether", "the", "given", "directory", "contains", "a", "local", "repository", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/git.py#L49-L52
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/git.py
GitRepo.get_vcs_directory
def get_vcs_directory(context, directory): """Get the pathname of the directory containing the version control metadata files.""" nested = os.path.join(directory, '.git') return nested if context.is_directory(nested) else directory
python
def get_vcs_directory(context, directory): """Get the pathname of the directory containing the version control metadata files.""" nested = os.path.join(directory, '.git') return nested if context.is_directory(nested) else directory
[ "def", "get_vcs_directory", "(", "context", ",", "directory", ")", ":", "nested", "=", "os", ".", "path", ".", "join", "(", "directory", ",", "'.git'", ")", "return", "nested", "if", "context", ".", "is_directory", "(", "nested", ")", "else", "directory" ]
Get the pathname of the directory containing the version control metadata files.
[ "Get", "the", "pathname", "of", "the", "directory", "containing", "the", "version", "control", "metadata", "files", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/git.py#L55-L58
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/git.py
GitRepo.current_branch
def current_branch(self): """The name of the branch that's currently checked out in the working tree (a string or :data:`None`).""" output = self.context.capture('git', 'rev-parse', '--abbrev-ref', 'HEAD', check=False, silent=True) return output if output != 'HEAD' else None
python
def current_branch(self): """The name of the branch that's currently checked out in the working tree (a string or :data:`None`).""" output = self.context.capture('git', 'rev-parse', '--abbrev-ref', 'HEAD', check=False, silent=True) return output if output != 'HEAD' else None
[ "def", "current_branch", "(", "self", ")", ":", "output", "=", "self", ".", "context", ".", "capture", "(", "'git'", ",", "'rev-parse'", ",", "'--abbrev-ref'", ",", "'HEAD'", ",", "check", "=", "False", ",", "silent", "=", "True", ")", "return", "output"...
The name of the branch that's currently checked out in the working tree (a string or :data:`None`).
[ "The", "name", "of", "the", "branch", "that", "s", "currently", "checked", "out", "in", "the", "working", "tree", "(", "a", "string", "or", ":", "data", ":", "None", ")", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/git.py#L68-L71
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/git.py
GitRepo.is_clean
def is_clean(self): """ :data:`True` if the working tree (and index) is clean, :data:`False` otherwise. The implementation of :attr:`GitRepo.is_clean` checks whether ``git diff`` reports any differences. This command has several variants: 1. ``git diff`` shows the difference be...
python
def is_clean(self): """ :data:`True` if the working tree (and index) is clean, :data:`False` otherwise. The implementation of :attr:`GitRepo.is_clean` checks whether ``git diff`` reports any differences. This command has several variants: 1. ``git diff`` shows the difference be...
[ "def", "is_clean", "(", "self", ")", ":", "# Make sure the local repository exists.", "self", ".", "create", "(", ")", "# Check whether the `git diff HEAD' output is empty.", "listing", "=", "self", ".", "context", ".", "capture", "(", "'git'", ",", "'diff'", ",", "...
:data:`True` if the working tree (and index) is clean, :data:`False` otherwise. The implementation of :attr:`GitRepo.is_clean` checks whether ``git diff`` reports any differences. This command has several variants: 1. ``git diff`` shows the difference between the index and working tree. ...
[ ":", "data", ":", "True", "if", "the", "working", "tree", "(", "and", "index", ")", "is", "clean", ":", "data", ":", "False", "otherwise", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/git.py#L99-L119
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/git.py
GitRepo.known_remotes
def known_remotes(self): """The names of the configured remote repositories (a list of :class:`.Remote` objects).""" objects = [] for line in self.context.capture('git', 'remote', '--verbose').splitlines(): tokens = line.split() if len(tokens) >= 2: name =...
python
def known_remotes(self): """The names of the configured remote repositories (a list of :class:`.Remote` objects).""" objects = [] for line in self.context.capture('git', 'remote', '--verbose').splitlines(): tokens = line.split() if len(tokens) >= 2: name =...
[ "def", "known_remotes", "(", "self", ")", ":", "objects", "=", "[", "]", "for", "line", "in", "self", ".", "context", ".", "capture", "(", "'git'", ",", "'remote'", ",", "'--verbose'", ")", ".", "splitlines", "(", ")", ":", "tokens", "=", "line", "."...
The names of the configured remote repositories (a list of :class:`.Remote` objects).
[ "The", "names", "of", "the", "configured", "remote", "repositories", "(", "a", "list", "of", ":", "class", ":", ".", "Remote", "objects", ")", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/git.py#L122-L143
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/git.py
GitRepo.merge_conflicts
def merge_conflicts(self): """The filenames of any files with merge conflicts (a list of strings).""" filenames = set() listing = self.context.capture('git', 'ls-files', '--unmerged', '-z') for entry in split(listing, '\0'): # The output of `git ls-files --unmerged -z' consis...
python
def merge_conflicts(self): """The filenames of any files with merge conflicts (a list of strings).""" filenames = set() listing = self.context.capture('git', 'ls-files', '--unmerged', '-z') for entry in split(listing, '\0'): # The output of `git ls-files --unmerged -z' consis...
[ "def", "merge_conflicts", "(", "self", ")", ":", "filenames", "=", "set", "(", ")", "listing", "=", "self", ".", "context", ".", "capture", "(", "'git'", ",", "'ls-files'", ",", "'--unmerged'", ",", "'-z'", ")", "for", "entry", "in", "split", "(", "lis...
The filenames of any files with merge conflicts (a list of strings).
[ "The", "filenames", "of", "any", "files", "with", "merge", "conflicts", "(", "a", "list", "of", "strings", ")", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/git.py#L146-L158
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/git.py
GitRepo.expand_branch_name
def expand_branch_name(self, name): """ Expand branch names to their unambiguous form. :param name: The name of a local or remote branch (a string). :returns: The unambiguous form of the branch name (a string). This internal method is used by methods like :func:`find_revision_i...
python
def expand_branch_name(self, name): """ Expand branch names to their unambiguous form. :param name: The name of a local or remote branch (a string). :returns: The unambiguous form of the branch name (a string). This internal method is used by methods like :func:`find_revision_i...
[ "def", "expand_branch_name", "(", "self", ",", "name", ")", ":", "# If no name is given we pick the default revision.", "if", "not", "name", ":", "return", "self", ".", "default_revision", "# Run `git for-each-ref' once and remember the results.", "branches", "=", "list", "...
Expand branch names to their unambiguous form. :param name: The name of a local or remote branch (a string). :returns: The unambiguous form of the branch name (a string). This internal method is used by methods like :func:`find_revision_id()` and :func:`find_revision_number()` to detec...
[ "Expand", "branch", "names", "to", "their", "unambiguous", "form", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/git.py#L167-L206
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/git.py
GitRepo.find_author
def find_author(self): """Get the author information from the version control system.""" return Author(name=self.context.capture('git', 'config', 'user.name', check=False, silent=True), email=self.context.capture('git', 'config', 'user.email', check=False, silent=True))
python
def find_author(self): """Get the author information from the version control system.""" return Author(name=self.context.capture('git', 'config', 'user.name', check=False, silent=True), email=self.context.capture('git', 'config', 'user.email', check=False, silent=True))
[ "def", "find_author", "(", "self", ")", ":", "return", "Author", "(", "name", "=", "self", ".", "context", ".", "capture", "(", "'git'", ",", "'config'", ",", "'user.name'", ",", "check", "=", "False", ",", "silent", "=", "True", ")", ",", "email", "...
Get the author information from the version control system.
[ "Get", "the", "author", "information", "from", "the", "version", "control", "system", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/git.py#L208-L211
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/git.py
GitRepo.find_branches
def find_branches(self): """Find information about the branches in the repository.""" for prefix, name, revision_id in self.find_branches_raw(): yield Revision( branch=name, repository=self, revision_id=revision_id, )
python
def find_branches(self): """Find information about the branches in the repository.""" for prefix, name, revision_id in self.find_branches_raw(): yield Revision( branch=name, repository=self, revision_id=revision_id, )
[ "def", "find_branches", "(", "self", ")", ":", "for", "prefix", ",", "name", ",", "revision_id", "in", "self", ".", "find_branches_raw", "(", ")", ":", "yield", "Revision", "(", "branch", "=", "name", ",", "repository", "=", "self", ",", "revision_id", "...
Find information about the branches in the repository.
[ "Find", "information", "about", "the", "branches", "in", "the", "repository", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/git.py#L213-L220
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/git.py
GitRepo.find_branches_raw
def find_branches_raw(self): """Find information about the branches in the repository.""" listing = self.context.capture('git', 'for-each-ref', '--format=%(refname)\t%(objectname)') for line in listing.splitlines(): match = FOR_EACH_REF_PATTERN.match(line) if match and ma...
python
def find_branches_raw(self): """Find information about the branches in the repository.""" listing = self.context.capture('git', 'for-each-ref', '--format=%(refname)\t%(objectname)') for line in listing.splitlines(): match = FOR_EACH_REF_PATTERN.match(line) if match and ma...
[ "def", "find_branches_raw", "(", "self", ")", ":", "listing", "=", "self", ".", "context", ".", "capture", "(", "'git'", ",", "'for-each-ref'", ",", "'--format=%(refname)\\t%(objectname)'", ")", "for", "line", "in", "listing", ".", "splitlines", "(", ")", ":",...
Find information about the branches in the repository.
[ "Find", "information", "about", "the", "branches", "in", "the", "repository", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/git.py#L222-L230
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/git.py
GitRepo.find_revision_id
def find_revision_id(self, revision=None): """Find the global revision id of the given revision.""" # Make sure the local repository exists. self.create() # Try to find the revision id of the specified revision. revision = self.expand_branch_name(revision) output = self.c...
python
def find_revision_id(self, revision=None): """Find the global revision id of the given revision.""" # Make sure the local repository exists. self.create() # Try to find the revision id of the specified revision. revision = self.expand_branch_name(revision) output = self.c...
[ "def", "find_revision_id", "(", "self", ",", "revision", "=", "None", ")", ":", "# Make sure the local repository exists.", "self", ".", "create", "(", ")", "# Try to find the revision id of the specified revision.", "revision", "=", "self", ".", "expand_branch_name", "("...
Find the global revision id of the given revision.
[ "Find", "the", "global", "revision", "id", "of", "the", "given", "revision", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/git.py#L232-L240
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/git.py
GitRepo.find_revision_number
def find_revision_number(self, revision=None): """Find the local revision number of the given revision.""" # Make sure the local repository exists. self.create() # Try to find the revision number of the specified revision. revision = self.expand_branch_name(revision) outp...
python
def find_revision_number(self, revision=None): """Find the local revision number of the given revision.""" # Make sure the local repository exists. self.create() # Try to find the revision number of the specified revision. revision = self.expand_branch_name(revision) outp...
[ "def", "find_revision_number", "(", "self", ",", "revision", "=", "None", ")", ":", "# Make sure the local repository exists.", "self", ".", "create", "(", ")", "# Try to find the revision number of the specified revision.", "revision", "=", "self", ".", "expand_branch_name...
Find the local revision number of the given revision.
[ "Find", "the", "local", "revision", "number", "of", "the", "given", "revision", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/git.py#L242-L252
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/git.py
GitRepo.find_tags
def find_tags(self): """Find information about the tags in the repository.""" listing = self.context.capture('git', 'show-ref', '--tags', check=False) for line in listing.splitlines(): tokens = line.split() if len(tokens) >= 2 and tokens[1].startswith('refs/tags/'): ...
python
def find_tags(self): """Find information about the tags in the repository.""" listing = self.context.capture('git', 'show-ref', '--tags', check=False) for line in listing.splitlines(): tokens = line.split() if len(tokens) >= 2 and tokens[1].startswith('refs/tags/'): ...
[ "def", "find_tags", "(", "self", ")", ":", "listing", "=", "self", ".", "context", ".", "capture", "(", "'git'", ",", "'show-ref'", ",", "'--tags'", ",", "check", "=", "False", ")", "for", "line", "in", "listing", ".", "splitlines", "(", ")", ":", "t...
Find information about the tags in the repository.
[ "Find", "information", "about", "the", "tags", "in", "the", "repository", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/git.py#L254-L264
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/git.py
GitRepo.get_add_files_command
def get_add_files_command(self, *filenames): """Get the command to include added and/or removed files in the working tree in the next commit.""" command = ['git', 'add'] if filenames: command.append('--') command.extend(filenames) else: command.extend(...
python
def get_add_files_command(self, *filenames): """Get the command to include added and/or removed files in the working tree in the next commit.""" command = ['git', 'add'] if filenames: command.append('--') command.extend(filenames) else: command.extend(...
[ "def", "get_add_files_command", "(", "self", ",", "*", "filenames", ")", ":", "command", "=", "[", "'git'", ",", "'add'", "]", "if", "filenames", ":", "command", ".", "append", "(", "'--'", ")", "command", ".", "extend", "(", "filenames", ")", "else", ...
Get the command to include added and/or removed files in the working tree in the next commit.
[ "Get", "the", "command", "to", "include", "added", "and", "/", "or", "removed", "files", "in", "the", "working", "tree", "in", "the", "next", "commit", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/git.py#L266-L274
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/git.py
GitRepo.get_commit_command
def get_commit_command(self, message, author=None): """Get the command to commit changes to tracked files in the working tree.""" command = ['git'] if author: command.extend(('-c', 'user.name=%s' % author.name)) command.extend(('-c', 'user.email=%s' % author.email)) ...
python
def get_commit_command(self, message, author=None): """Get the command to commit changes to tracked files in the working tree.""" command = ['git'] if author: command.extend(('-c', 'user.name=%s' % author.name)) command.extend(('-c', 'user.email=%s' % author.email)) ...
[ "def", "get_commit_command", "(", "self", ",", "message", ",", "author", "=", "None", ")", ":", "command", "=", "[", "'git'", "]", "if", "author", ":", "command", ".", "extend", "(", "(", "'-c'", ",", "'user.name=%s'", "%", "author", ".", "name", ")", ...
Get the command to commit changes to tracked files in the working tree.
[ "Get", "the", "command", "to", "commit", "changes", "to", "tracked", "files", "in", "the", "working", "tree", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/git.py#L285-L295
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/git.py
GitRepo.get_create_command
def get_create_command(self): """Get the command to create the local repository.""" command = ['git', 'clone' if self.remote else 'init'] if self.bare: command.append('--bare') if self.remote: command.append(self.remote) command.append(self.local) ...
python
def get_create_command(self): """Get the command to create the local repository.""" command = ['git', 'clone' if self.remote else 'init'] if self.bare: command.append('--bare') if self.remote: command.append(self.remote) command.append(self.local) ...
[ "def", "get_create_command", "(", "self", ")", ":", "command", "=", "[", "'git'", ",", "'clone'", "if", "self", ".", "remote", "else", "'init'", "]", "if", "self", ".", "bare", ":", "command", ".", "append", "(", "'--bare'", ")", "if", "self", ".", "...
Get the command to create the local repository.
[ "Get", "the", "command", "to", "create", "the", "local", "repository", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/git.py#L305-L313
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/git.py
GitRepo.get_export_command
def get_export_command(self, directory, revision): """Get the command to export the complete tree from the local repository.""" shell_command = 'git archive %s | tar --extract --directory=%s' return [shell_command % (quote(revision), quote(directory))]
python
def get_export_command(self, directory, revision): """Get the command to export the complete tree from the local repository.""" shell_command = 'git archive %s | tar --extract --directory=%s' return [shell_command % (quote(revision), quote(directory))]
[ "def", "get_export_command", "(", "self", ",", "directory", ",", "revision", ")", ":", "shell_command", "=", "'git archive %s | tar --extract --directory=%s'", "return", "[", "shell_command", "%", "(", "quote", "(", "revision", ")", ",", "quote", "(", "directory", ...
Get the command to export the complete tree from the local repository.
[ "Get", "the", "command", "to", "export", "the", "complete", "tree", "from", "the", "local", "repository", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/git.py#L319-L322
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/git.py
GitRepo.get_merge_command
def get_merge_command(self, revision): """Get the command to merge a revision into the current branch (without committing the result).""" return [ 'git', '-c', 'user.name=%s' % self.author.name, '-c', 'user.email=%s' % self.author.email, 'merge', '--no-com...
python
def get_merge_command(self, revision): """Get the command to merge a revision into the current branch (without committing the result).""" return [ 'git', '-c', 'user.name=%s' % self.author.name, '-c', 'user.email=%s' % self.author.email, 'merge', '--no-com...
[ "def", "get_merge_command", "(", "self", ",", "revision", ")", ":", "return", "[", "'git'", ",", "'-c'", ",", "'user.name=%s'", "%", "self", ".", "author", ".", "name", ",", "'-c'", ",", "'user.email=%s'", "%", "self", ".", "author", ".", "email", ",", ...
Get the command to merge a revision into the current branch (without committing the result).
[ "Get", "the", "command", "to", "merge", "a", "revision", "into", "the", "current", "branch", "(", "without", "committing", "the", "result", ")", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/git.py#L324-L332
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/git.py
GitRepo.get_pull_command
def get_pull_command(self, remote=None, revision=None): """ Get the command to pull changes from a remote repository into the local repository. When you pull a specific branch using git, the default behavior is to pull the change sets from the remote branch into the local repository ...
python
def get_pull_command(self, remote=None, revision=None): """ Get the command to pull changes from a remote repository into the local repository. When you pull a specific branch using git, the default behavior is to pull the change sets from the remote branch into the local repository ...
[ "def", "get_pull_command", "(", "self", ",", "remote", "=", "None", ",", "revision", "=", "None", ")", ":", "if", "revision", ":", "revision", "=", "'%s:%s'", "%", "(", "revision", ",", "revision", ")", "if", "self", ".", "bare", ":", "return", "[", ...
Get the command to pull changes from a remote repository into the local repository. When you pull a specific branch using git, the default behavior is to pull the change sets from the remote branch into the local repository and merge them into the *currently checked out* branch. What M...
[ "Get", "the", "command", "to", "pull", "changes", "from", "a", "remote", "repository", "into", "the", "local", "repository", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/git.py#L334-L373
xolox/python-vcs-repo-mgr
vcs_repo_mgr/backends/git.py
GitRepo.get_push_command
def get_push_command(self, remote=None, revision=None): """Get the command to push changes from the local repository to a remote repository.""" # TODO What about tags? command = ['git', '-c', 'push.default=matching', 'push'] if remote or revision: command.append(remote or 'or...
python
def get_push_command(self, remote=None, revision=None): """Get the command to push changes from the local repository to a remote repository.""" # TODO What about tags? command = ['git', '-c', 'push.default=matching', 'push'] if remote or revision: command.append(remote or 'or...
[ "def", "get_push_command", "(", "self", ",", "remote", "=", "None", ",", "revision", "=", "None", ")", ":", "# TODO What about tags?", "command", "=", "[", "'git'", ",", "'-c'", ",", "'push.default=matching'", ",", "'push'", "]", "if", "remote", "or", "revis...
Get the command to push changes from the local repository to a remote repository.
[ "Get", "the", "command", "to", "push", "changes", "from", "the", "local", "repository", "to", "a", "remote", "repository", "." ]
train
https://github.com/xolox/python-vcs-repo-mgr/blob/fdad2441a3e7ba5deeeddfa1c2f5ebc00c393aed/vcs_repo_mgr/backends/git.py#L375-L383
danielfrg/datasciencebox
datasciencebox/core/cloud/instance.py
Instance.new
def new(cls, settings, *args, **kwargs): """ Create a new Cloud instance based on the Settings """ logger.debug('Initializing new "%s" Instance object' % settings['CLOUD']) cloud = settings['CLOUD'] if cloud == 'bare': self = BareInstance(settings=settings, *a...
python
def new(cls, settings, *args, **kwargs): """ Create a new Cloud instance based on the Settings """ logger.debug('Initializing new "%s" Instance object' % settings['CLOUD']) cloud = settings['CLOUD'] if cloud == 'bare': self = BareInstance(settings=settings, *a...
[ "def", "new", "(", "cls", ",", "settings", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "logger", ".", "debug", "(", "'Initializing new \"%s\" Instance object'", "%", "settings", "[", "'CLOUD'", "]", ")", "cloud", "=", "settings", "[", "'CLOUD'", ...
Create a new Cloud instance based on the Settings
[ "Create", "a", "new", "Cloud", "instance", "based", "on", "the", "Settings" ]
train
https://github.com/danielfrg/datasciencebox/blob/6b7aa642c6616a46547035fcb815acc1de605a6f/datasciencebox/core/cloud/instance.py#L36-L50
array-split/array_split
array_split/logging.py
initialise_loggers
def initialise_loggers(names, log_level=_builtin_logging.WARNING, handler_class=SplitStreamHandler): """ Initialises specified loggers to generate output at the specified logging level. If the specified named loggers do not exist, they are created. :type names: :obj:`list` of :obj:`str` :param ...
python
def initialise_loggers(names, log_level=_builtin_logging.WARNING, handler_class=SplitStreamHandler): """ Initialises specified loggers to generate output at the specified logging level. If the specified named loggers do not exist, they are created. :type names: :obj:`list` of :obj:`str` :param ...
[ "def", "initialise_loggers", "(", "names", ",", "log_level", "=", "_builtin_logging", ".", "WARNING", ",", "handler_class", "=", "SplitStreamHandler", ")", ":", "frmttr", "=", "get_formatter", "(", ")", "for", "name", "in", "names", ":", "logr", "=", "_builtin...
Initialises specified loggers to generate output at the specified logging level. If the specified named loggers do not exist, they are created. :type names: :obj:`list` of :obj:`str` :param names: List of logger names. :type log_level: :obj:`int` :param log_level: Log level for messages, typica...
[ "Initialises", "specified", "loggers", "to", "generate", "output", "at", "the", "specified", "logging", "level", ".", "If", "the", "specified", "named", "loggers", "do", "not", "exist", "they", "are", "created", "." ]
train
https://github.com/array-split/array_split/blob/e07abe3001209394dde809f7e6f505f9f49a1c26/array_split/logging.py#L208-L242
array-split/array_split
array_split/logging.py
_Python2SplitStreamHandler.emit
def emit(self, record): """ Mostly copy-paste from :obj:`logging.StreamHandler`. """ try: msg = self.format(record) if record.levelno < self.splitLevel: stream = self.outStream else: stream = self.errStream f...
python
def emit(self, record): """ Mostly copy-paste from :obj:`logging.StreamHandler`. """ try: msg = self.format(record) if record.levelno < self.splitLevel: stream = self.outStream else: stream = self.errStream f...
[ "def", "emit", "(", "self", ",", "record", ")", ":", "try", ":", "msg", "=", "self", ".", "format", "(", "record", ")", "if", "record", ".", "levelno", "<", "self", ".", "splitLevel", ":", "stream", "=", "self", ".", "outStream", "else", ":", "stre...
Mostly copy-paste from :obj:`logging.StreamHandler`.
[ "Mostly", "copy", "-", "paste", "from", ":", "obj", ":", "logging", ".", "StreamHandler", "." ]
train
https://github.com/array-split/array_split/blob/e07abe3001209394dde809f7e6f505f9f49a1c26/array_split/logging.py#L69-L98
array-split/array_split
array_split/logging.py
_Python3SplitStreamHandler.flush
def flush(self): """ Flushes the stream. """ self.acquire() try: if self.outStream and hasattr(self.outStream, "flush"): self.outStream.flush() if self.errStream and hasattr(self.errStream, "flush"): self.errStream.flush() ...
python
def flush(self): """ Flushes the stream. """ self.acquire() try: if self.outStream and hasattr(self.outStream, "flush"): self.outStream.flush() if self.errStream and hasattr(self.errStream, "flush"): self.errStream.flush() ...
[ "def", "flush", "(", "self", ")", ":", "self", ".", "acquire", "(", ")", "try", ":", "if", "self", ".", "outStream", "and", "hasattr", "(", "self", ".", "outStream", ",", "\"flush\"", ")", ":", "self", ".", "outStream", ".", "flush", "(", ")", "if"...
Flushes the stream.
[ "Flushes", "the", "stream", "." ]
train
https://github.com/array-split/array_split/blob/e07abe3001209394dde809f7e6f505f9f49a1c26/array_split/logging.py#L130-L141
array-split/array_split
array_split/logging.py
_Python3SplitStreamHandler.emit
def emit(self, record): """ Emit a record. If a formatter is specified, it is used to format the record. The record is then written to the stream with a trailing newline. If exception information is present, it is formatted using traceback.print_exception and appended t...
python
def emit(self, record): """ Emit a record. If a formatter is specified, it is used to format the record. The record is then written to the stream with a trailing newline. If exception information is present, it is formatted using traceback.print_exception and appended t...
[ "def", "emit", "(", "self", ",", "record", ")", ":", "try", ":", "msg", "=", "self", ".", "format", "(", "record", ")", "if", "record", ".", "levelno", "<", "self", ".", "splitLevel", ":", "stream", "=", "self", ".", "outStream", "else", ":", "stre...
Emit a record. If a formatter is specified, it is used to format the record. The record is then written to the stream with a trailing newline. If exception information is present, it is formatted using traceback.print_exception and appended to the stream. If the stream has an ...
[ "Emit", "a", "record", "." ]
train
https://github.com/array-split/array_split/blob/e07abe3001209394dde809f7e6f505f9f49a1c26/array_split/logging.py#L143-L166
ttinies/sc2gameLobby
sc2gameLobby/clientManagement.py
ClientController.close
def close(self): """Shut down the socket connection, client and controller""" self._sock = None self._controller = None if hasattr(self, "_port") and self._port: portpicker.return_port(self._port) self._port = None
python
def close(self): """Shut down the socket connection, client and controller""" self._sock = None self._controller = None if hasattr(self, "_port") and self._port: portpicker.return_port(self._port) self._port = None
[ "def", "close", "(", "self", ")", ":", "self", ".", "_sock", "=", "None", "self", ".", "_controller", "=", "None", "if", "hasattr", "(", "self", ",", "\"_port\"", ")", "and", "self", ".", "_port", ":", "portpicker", ".", "return_port", "(", "self", "...
Shut down the socket connection, client and controller
[ "Shut", "down", "the", "socket", "connection", "client", "and", "controller" ]
train
https://github.com/ttinies/sc2gameLobby/blob/5352d51d53ddeb4858e92e682da89c4434123e52/sc2gameLobby/clientManagement.py#L51-L57
ttinies/sc2gameLobby
sc2gameLobby/clientManagement.py
ClientController.connect
def connect(self, url=c.LOCALHOST, port=None, timeout=c.INITIAL_TIMEOUT, debug=False): """socket connect to an already running starcraft2 process""" if port != None: # force a selection to a new port if self._port!=None: # if previously allocated port, return it ...
python
def connect(self, url=c.LOCALHOST, port=None, timeout=c.INITIAL_TIMEOUT, debug=False): """socket connect to an already running starcraft2 process""" if port != None: # force a selection to a new port if self._port!=None: # if previously allocated port, return it ...
[ "def", "connect", "(", "self", ",", "url", "=", "c", ".", "LOCALHOST", ",", "port", "=", "None", ",", "timeout", "=", "c", ".", "INITIAL_TIMEOUT", ",", "debug", "=", "False", ")", ":", "if", "port", "!=", "None", ":", "# force a selection to a new port",...
socket connect to an already running starcraft2 process
[ "socket", "connect", "to", "an", "already", "running", "starcraft2", "process" ]
train
https://github.com/ttinies/sc2gameLobby/blob/5352d51d53ddeb4858e92e682da89c4434123e52/sc2gameLobby/clientManagement.py#L69-L108
ttinies/sc2gameLobby
sc2gameLobby/clientManagement.py
ClientController.debug
def debug(self, *debugReqs): """send a debug command to control the game state's setup""" return self._client.send(debug=sc2api_pb2.RequestDebug(debug=debugReqs))
python
def debug(self, *debugReqs): """send a debug command to control the game state's setup""" return self._client.send(debug=sc2api_pb2.RequestDebug(debug=debugReqs))
[ "def", "debug", "(", "self", ",", "*", "debugReqs", ")", ":", "return", "self", ".", "_client", ".", "send", "(", "debug", "=", "sc2api_pb2", ".", "RequestDebug", "(", "debug", "=", "debugReqs", ")", ")" ]
send a debug command to control the game state's setup
[ "send", "a", "debug", "command", "to", "control", "the", "game", "state", "s", "setup" ]
train
https://github.com/ttinies/sc2gameLobby/blob/5352d51d53ddeb4858e92e682da89c4434123e52/sc2gameLobby/clientManagement.py#L111-L113
Parsl/libsubmit
libsubmit/providers/googlecloud/googlecloud.py
GoogleCloudProvider.submit
def submit(self, command="", blocksize=1, job_name="parsl.auto"): ''' The submit method takes the command string to be executed upon instantiation of a resource most often to start a pilot. Args : - command (str) : The bash command string to be executed. - blocksize (i...
python
def submit(self, command="", blocksize=1, job_name="parsl.auto"): ''' The submit method takes the command string to be executed upon instantiation of a resource most often to start a pilot. Args : - command (str) : The bash command string to be executed. - blocksize (i...
[ "def", "submit", "(", "self", ",", "command", "=", "\"\"", ",", "blocksize", "=", "1", ",", "job_name", "=", "\"parsl.auto\"", ")", ":", "instance", ",", "name", "=", "self", ".", "create_instance", "(", "command", "=", "command", ")", "self", ".", "pr...
The submit method takes the command string to be executed upon instantiation of a resource most often to start a pilot. Args : - command (str) : The bash command string to be executed. - blocksize (int) : Blocksize to be requested KWargs: - job_name (str)...
[ "The", "submit", "method", "takes", "the", "command", "string", "to", "be", "executed", "upon", "instantiation", "of", "a", "resource", "most", "often", "to", "start", "a", "pilot", "." ]
train
https://github.com/Parsl/libsubmit/blob/27a41c16dd6f1c16d830a9ce1c97804920a59f64/libsubmit/providers/googlecloud/googlecloud.py#L118-L138
jidn/flask-resteasy
flask_resteasy.py
unpack
def unpack(rv): """Unpack the response from a view. :param rv: the view response :type rv: either a :class:`werkzeug.wrappers.Response` or a tuple of (data, status_code, headers) """ if isinstance(rv, ResponseBase): return rv status = headers = None if isinstance(rv, tuple...
python
def unpack(rv): """Unpack the response from a view. :param rv: the view response :type rv: either a :class:`werkzeug.wrappers.Response` or a tuple of (data, status_code, headers) """ if isinstance(rv, ResponseBase): return rv status = headers = None if isinstance(rv, tuple...
[ "def", "unpack", "(", "rv", ")", ":", "if", "isinstance", "(", "rv", ",", "ResponseBase", ")", ":", "return", "rv", "status", "=", "headers", "=", "None", "if", "isinstance", "(", "rv", ",", "tuple", ")", ":", "rv", ",", "status", ",", "headers", "...
Unpack the response from a view. :param rv: the view response :type rv: either a :class:`werkzeug.wrappers.Response` or a tuple of (data, status_code, headers)
[ "Unpack", "the", "response", "from", "a", "view", "." ]
train
https://github.com/jidn/flask-resteasy/blob/79d4a50705d4300c91ab3bafefac23782768be2a/flask_resteasy.py#L42-L62
jidn/flask-resteasy
flask_resteasy.py
Api.init_app
def init_app(self, app): """Initialize actions with the app or blueprint. :param app: the Flask application or blueprint object :type app: :class:`~flask.Flask` or :class:`~flask.Blueprint` Examples:: api = Api() api.add_resource(...) api.init_app(b...
python
def init_app(self, app): """Initialize actions with the app or blueprint. :param app: the Flask application or blueprint object :type app: :class:`~flask.Flask` or :class:`~flask.Blueprint` Examples:: api = Api() api.add_resource(...) api.init_app(b...
[ "def", "init_app", "(", "self", ",", "app", ")", ":", "try", ":", "# Assume this is a blueprint and defer initialization", "if", "app", ".", "_got_registered_once", "is", "True", ":", "raise", "ValueError", "(", "\"\"\"Blueprint is already registered with an app.\"\"\"", ...
Initialize actions with the app or blueprint. :param app: the Flask application or blueprint object :type app: :class:`~flask.Flask` or :class:`~flask.Blueprint` Examples:: api = Api() api.add_resource(...) api.init_app(blueprint)
[ "Initialize", "actions", "with", "the", "app", "or", "blueprint", "." ]
train
https://github.com/jidn/flask-resteasy/blob/79d4a50705d4300c91ab3bafefac23782768be2a/flask_resteasy.py#L104-L124
jidn/flask-resteasy
flask_resteasy.py
Api._init_app
def _init_app(self, app): """Initialize actions with the given :class:`flask.Flask` object. :param app: The flask application object :type app: :class:`~flask.Flask` """ for resource, urls, kwargs in self.resources: self._register_view(app, resource, *urls, **kwargs)
python
def _init_app(self, app): """Initialize actions with the given :class:`flask.Flask` object. :param app: The flask application object :type app: :class:`~flask.Flask` """ for resource, urls, kwargs in self.resources: self._register_view(app, resource, *urls, **kwargs)
[ "def", "_init_app", "(", "self", ",", "app", ")", ":", "for", "resource", ",", "urls", ",", "kwargs", "in", "self", ".", "resources", ":", "self", ".", "_register_view", "(", "app", ",", "resource", ",", "*", "urls", ",", "*", "*", "kwargs", ")" ]
Initialize actions with the given :class:`flask.Flask` object. :param app: The flask application object :type app: :class:`~flask.Flask`
[ "Initialize", "actions", "with", "the", "given", ":", "class", ":", "flask", ".", "Flask", "object", "." ]
train
https://github.com/jidn/flask-resteasy/blob/79d4a50705d4300c91ab3bafefac23782768be2a/flask_resteasy.py#L126-L133
jidn/flask-resteasy
flask_resteasy.py
Api._deferred_blueprint_init
def _deferred_blueprint_init(self, setup_state): """Bind resources to the app as recorded in blueprint. Synchronize prefix between blueprint/api and registration options, then perform initialization with setup_state.app :class:`flask.Flask` object. When a :class:`flask.ext.resteasy.Api`...
python
def _deferred_blueprint_init(self, setup_state): """Bind resources to the app as recorded in blueprint. Synchronize prefix between blueprint/api and registration options, then perform initialization with setup_state.app :class:`flask.Flask` object. When a :class:`flask.ext.resteasy.Api`...
[ "def", "_deferred_blueprint_init", "(", "self", ",", "setup_state", ")", ":", "self", ".", "blueprint_setup", "=", "setup_state", "if", "setup_state", ".", "add_url_rule", ".", "__name__", "!=", "'_add_url_rule_patch'", ":", "setup_state", ".", "_original_add_url_rule...
Bind resources to the app as recorded in blueprint. Synchronize prefix between blueprint/api and registration options, then perform initialization with setup_state.app :class:`flask.Flask` object. When a :class:`flask.ext.resteasy.Api` object is initialized with a blueprint, this method...
[ "Bind", "resources", "to", "the", "app", "as", "recorded", "in", "blueprint", "." ]
train
https://github.com/jidn/flask-resteasy/blob/79d4a50705d4300c91ab3bafefac23782768be2a/flask_resteasy.py#L135-L156
jidn/flask-resteasy
flask_resteasy.py
Api._register_view
def _register_view(self, app, resource, *urls, **kwargs): """Bind resources to the app. :param app: an actual :class:`flask.Flask` app :param resource: :param urls: :param endpoint: endpoint name (defaults to :meth:`Resource.__name__.lower` Can be used to reference ...
python
def _register_view(self, app, resource, *urls, **kwargs): """Bind resources to the app. :param app: an actual :class:`flask.Flask` app :param resource: :param urls: :param endpoint: endpoint name (defaults to :meth:`Resource.__name__.lower` Can be used to reference ...
[ "def", "_register_view", "(", "self", ",", "app", ",", "resource", ",", "*", "urls", ",", "*", "*", "kwargs", ")", ":", "endpoint", "=", "kwargs", ".", "pop", "(", "'endpoint'", ",", "None", ")", "or", "resource", ".", "__name__", ".", "lower", "(", ...
Bind resources to the app. :param app: an actual :class:`flask.Flask` app :param resource: :param urls: :param endpoint: endpoint name (defaults to :meth:`Resource.__name__.lower` Can be used to reference this route in :meth:`flask.url_for` :type endpoint: str ...
[ "Bind", "resources", "to", "the", "app", "." ]
train
https://github.com/jidn/flask-resteasy/blob/79d4a50705d4300c91ab3bafefac23782768be2a/flask_resteasy.py#L219-L276
jidn/flask-resteasy
flask_resteasy.py
Api._add_url_rule_patch
def _add_url_rule_patch(blueprint_setup, rule, endpoint=None, view_func=None, **options): """Patch BlueprintSetupState.add_url_rule for delayed creation. Method used for setup state instance corresponding to this Api instance. Exists primarily to enable _make_url's function. :param bl...
python
def _add_url_rule_patch(blueprint_setup, rule, endpoint=None, view_func=None, **options): """Patch BlueprintSetupState.add_url_rule for delayed creation. Method used for setup state instance corresponding to this Api instance. Exists primarily to enable _make_url's function. :param bl...
[ "def", "_add_url_rule_patch", "(", "blueprint_setup", ",", "rule", ",", "endpoint", "=", "None", ",", "view_func", "=", "None", ",", "*", "*", "options", ")", ":", "if", "callable", "(", "rule", ")", ":", "rule", "=", "rule", "(", "blueprint_setup", ".",...
Patch BlueprintSetupState.add_url_rule for delayed creation. Method used for setup state instance corresponding to this Api instance. Exists primarily to enable _make_url's function. :param blueprint_setup: The BlueprintSetupState instance (self) :param rule: A string or callable that...
[ "Patch", "BlueprintSetupState", ".", "add_url_rule", "for", "delayed", "creation", "." ]
train
https://github.com/jidn/flask-resteasy/blob/79d4a50705d4300c91ab3bafefac23782768be2a/flask_resteasy.py#L279-L304
jidn/flask-resteasy
flask_resteasy.py
Api.output
def output(self, resource): """Wrap a resource (as a flask view function). This is for cases where the resource does not directly return a response object. Now everything should be a Response object. :param resource: The resource as a flask view function """ @wraps(reso...
python
def output(self, resource): """Wrap a resource (as a flask view function). This is for cases where the resource does not directly return a response object. Now everything should be a Response object. :param resource: The resource as a flask view function """ @wraps(reso...
[ "def", "output", "(", "self", ",", "resource", ")", ":", "@", "wraps", "(", "resource", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "rv", "=", "resource", "(", "*", "args", ",", "*", "*", "kwargs", ")", "rv", "="...
Wrap a resource (as a flask view function). This is for cases where the resource does not directly return a response object. Now everything should be a Response object. :param resource: The resource as a flask view function
[ "Wrap", "a", "resource", "(", "as", "a", "flask", "view", "function", ")", "." ]
train
https://github.com/jidn/flask-resteasy/blob/79d4a50705d4300c91ab3bafefac23782768be2a/flask_resteasy.py#L306-L320
jidn/flask-resteasy
flask_resteasy.py
Api._make_url
def _make_url(self, url_part, blueprint_prefix): """Create URL from blueprint_prefix, api prefix and resource url. This method is used to defer the construction of the final url in the case that the Api is created with a Blueprint. :param url_part: The part of the url the endpoint is r...
python
def _make_url(self, url_part, blueprint_prefix): """Create URL from blueprint_prefix, api prefix and resource url. This method is used to defer the construction of the final url in the case that the Api is created with a Blueprint. :param url_part: The part of the url the endpoint is r...
[ "def", "_make_url", "(", "self", ",", "url_part", ",", "blueprint_prefix", ")", ":", "parts", "=", "(", "blueprint_prefix", ",", "self", ".", "prefix", ",", "url_part", ")", "return", "''", ".", "join", "(", "_", "for", "_", "in", "parts", "if", "_", ...
Create URL from blueprint_prefix, api prefix and resource url. This method is used to defer the construction of the final url in the case that the Api is created with a Blueprint. :param url_part: The part of the url the endpoint is registered with :param blueprint_prefix: The part of ...
[ "Create", "URL", "from", "blueprint_prefix", "api", "prefix", "and", "resource", "url", "." ]
train
https://github.com/jidn/flask-resteasy/blob/79d4a50705d4300c91ab3bafefac23782768be2a/flask_resteasy.py#L322-L333
jidn/flask-resteasy
flask_resteasy.py
Api.url_for
def url_for(self, resource, **kwargs): """Create a url for the given resource. :param resource: The resource :type resource: :class:`Resource` :param kwargs: Same arguments you would give :class:`flask.url_for` """ if self.blueprint: return flask.url_for('.' ...
python
def url_for(self, resource, **kwargs): """Create a url for the given resource. :param resource: The resource :type resource: :class:`Resource` :param kwargs: Same arguments you would give :class:`flask.url_for` """ if self.blueprint: return flask.url_for('.' ...
[ "def", "url_for", "(", "self", ",", "resource", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "blueprint", ":", "return", "flask", ".", "url_for", "(", "'.'", "+", "resource", ".", "endpoint", ",", "*", "*", "kwargs", ")", "return", "flask", ...
Create a url for the given resource. :param resource: The resource :type resource: :class:`Resource` :param kwargs: Same arguments you would give :class:`flask.url_for`
[ "Create", "a", "url", "for", "the", "given", "resource", "." ]
train
https://github.com/jidn/flask-resteasy/blob/79d4a50705d4300c91ab3bafefac23782768be2a/flask_resteasy.py#L335-L344
SatelliteQE/blinker_herald
blinker_herald/base.py
emit
def emit(only=None, return_vars=None, namespace=None, sender=None, post_result_name='result', capture_result=True): """Decorator to mark a method or function as a signal emitter:: @blinker_herald.emit() def create(self, value1, value2): return client.do.a.create.po...
python
def emit(only=None, return_vars=None, namespace=None, sender=None, post_result_name='result', capture_result=True): """Decorator to mark a method or function as a signal emitter:: @blinker_herald.emit() def create(self, value1, value2): return client.do.a.create.po...
[ "def", "emit", "(", "only", "=", "None", ",", "return_vars", "=", "None", ",", "namespace", "=", "None", ",", "sender", "=", "None", ",", "post_result_name", "=", "'result'", ",", "capture_result", "=", "True", ")", ":", "namespace", "=", "namespace", "o...
Decorator to mark a method or function as a signal emitter:: @blinker_herald.emit() def create(self, value1, value2): return client.do.a.create.post.return.object() The above will cause that method to act as:: # prefixes 'pre' and 'post' + {method name} pre_create ...
[ "Decorator", "to", "mark", "a", "method", "or", "function", "as", "a", "signal", "emitter", "::" ]
train
https://github.com/SatelliteQE/blinker_herald/blob/4af2f38ef63a0e8a71590784f8f26304567cc033/blinker_herald/base.py#L57-L142
Parsl/libsubmit
libsubmit/providers/azure/deployer.py
Deployer.deploy
def deploy(self, job_name, command='', blocksize=1): instances = [] """Deploy the template to a resource group.""" self.client.resource_groups.create_or_update( self.resource_group, { 'location': self.location, } ) template_pa...
python
def deploy(self, job_name, command='', blocksize=1): instances = [] """Deploy the template to a resource group.""" self.client.resource_groups.create_or_update( self.resource_group, { 'location': self.location, } ) template_pa...
[ "def", "deploy", "(", "self", ",", "job_name", ",", "command", "=", "''", ",", "blocksize", "=", "1", ")", ":", "instances", "=", "[", "]", "self", ".", "client", ".", "resource_groups", ".", "create_or_update", "(", "self", ".", "resource_group", ",", ...
Deploy the template to a resource group.
[ "Deploy", "the", "template", "to", "a", "resource", "group", "." ]
train
https://github.com/Parsl/libsubmit/blob/27a41c16dd6f1c16d830a9ce1c97804920a59f64/libsubmit/providers/azure/deployer.py#L39-L74
Parsl/libsubmit
libsubmit/providers/azure/deployer.py
Deployer.destroy
def destroy(self, job_ids): """Destroy the given resource group""" for job_id in job_ids: self.client.resource_groups.delete(self.resource_group)
python
def destroy(self, job_ids): """Destroy the given resource group""" for job_id in job_ids: self.client.resource_groups.delete(self.resource_group)
[ "def", "destroy", "(", "self", ",", "job_ids", ")", ":", "for", "job_id", "in", "job_ids", ":", "self", ".", "client", ".", "resource_groups", ".", "delete", "(", "self", ".", "resource_group", ")" ]
Destroy the given resource group
[ "Destroy", "the", "given", "resource", "group" ]
train
https://github.com/Parsl/libsubmit/blob/27a41c16dd6f1c16d830a9ce1c97804920a59f64/libsubmit/providers/azure/deployer.py#L76-L79
Parsl/libsubmit
libsubmit/providers/azure/deployer.py
Deployer.get_vm
def get_vm(self, resource_group_name, vm_name): ''' you need to retry this just in case the credentials token expires, that's where the decorator comes in this will return all the data about the virtual machine ''' return self.client.virtual_machines.get( reso...
python
def get_vm(self, resource_group_name, vm_name): ''' you need to retry this just in case the credentials token expires, that's where the decorator comes in this will return all the data about the virtual machine ''' return self.client.virtual_machines.get( reso...
[ "def", "get_vm", "(", "self", ",", "resource_group_name", ",", "vm_name", ")", ":", "return", "self", ".", "client", ".", "virtual_machines", ".", "get", "(", "resource_group_name", ",", "vm_name", ",", "expand", "=", "'instanceView'", ")" ]
you need to retry this just in case the credentials token expires, that's where the decorator comes in this will return all the data about the virtual machine
[ "you", "need", "to", "retry", "this", "just", "in", "case", "the", "credentials", "token", "expires", "that", "s", "where", "the", "decorator", "comes", "in", "this", "will", "return", "all", "the", "data", "about", "the", "virtual", "machine" ]
train
https://github.com/Parsl/libsubmit/blob/27a41c16dd6f1c16d830a9ce1c97804920a59f64/libsubmit/providers/azure/deployer.py#L81-L88
Parsl/libsubmit
libsubmit/providers/azure/deployer.py
Deployer.get_vm_status
def get_vm_status(self, vm_name, rgn): ''' this will just return the status of the virtual machine sometime the status may be unknown as shown by the azure portal; in that case statuses[1] doesn't exist, hence retrying on IndexError also, it may take on the order of minutes for t...
python
def get_vm_status(self, vm_name, rgn): ''' this will just return the status of the virtual machine sometime the status may be unknown as shown by the azure portal; in that case statuses[1] doesn't exist, hence retrying on IndexError also, it may take on the order of minutes for t...
[ "def", "get_vm_status", "(", "self", ",", "vm_name", ",", "rgn", ")", ":", "rgn", "=", "rgn", "if", "rgn", "else", "self", ".", "resource_group", "return", "self", ".", "client", ".", "virtual_machines", ".", "get", "(", "rgn", ",", "vm_name", ")", "."...
this will just return the status of the virtual machine sometime the status may be unknown as shown by the azure portal; in that case statuses[1] doesn't exist, hence retrying on IndexError also, it may take on the order of minutes for the status to become available so the decorator will...
[ "this", "will", "just", "return", "the", "status", "of", "the", "virtual", "machine", "sometime", "the", "status", "may", "be", "unknown", "as", "shown", "by", "the", "azure", "portal", ";", "in", "that", "case", "statuses", "[", "1", "]", "doesn", "t", ...
train
https://github.com/Parsl/libsubmit/blob/27a41c16dd6f1c16d830a9ce1c97804920a59f64/libsubmit/providers/azure/deployer.py#L90-L100
wickerwaka/russound_rio
russound_rio/rio.py
Russound._retrieve_cached_zone_variable
def _retrieve_cached_zone_variable(self, zone_id, name): """ Retrieves the cache state of the named variable for a particular zone. If the variable has not been cached then the UncachedVariable exception is raised. """ try: s = self._zone_state[zone_id][name.l...
python
def _retrieve_cached_zone_variable(self, zone_id, name): """ Retrieves the cache state of the named variable for a particular zone. If the variable has not been cached then the UncachedVariable exception is raised. """ try: s = self._zone_state[zone_id][name.l...
[ "def", "_retrieve_cached_zone_variable", "(", "self", ",", "zone_id", ",", "name", ")", ":", "try", ":", "s", "=", "self", ".", "_zone_state", "[", "zone_id", "]", "[", "name", ".", "lower", "(", ")", "]", "logger", ".", "debug", "(", "\"Zone Cache retri...
Retrieves the cache state of the named variable for a particular zone. If the variable has not been cached then the UncachedVariable exception is raised.
[ "Retrieves", "the", "cache", "state", "of", "the", "named", "variable", "for", "a", "particular", "zone", ".", "If", "the", "variable", "has", "not", "been", "cached", "then", "the", "UncachedVariable", "exception", "is", "raised", "." ]
train
https://github.com/wickerwaka/russound_rio/blob/e331985fd1544abec6a1da3637090550d6f93f76/russound_rio/rio.py#L78-L90
wickerwaka/russound_rio
russound_rio/rio.py
Russound._store_cached_zone_variable
def _store_cached_zone_variable(self, zone_id, name, value): """ Stores the current known value of a zone variable into the cache. Calls any zone callbacks. """ zone_state = self._zone_state.setdefault(zone_id, {}) name = name.lower() zone_state[name] = value ...
python
def _store_cached_zone_variable(self, zone_id, name, value): """ Stores the current known value of a zone variable into the cache. Calls any zone callbacks. """ zone_state = self._zone_state.setdefault(zone_id, {}) name = name.lower() zone_state[name] = value ...
[ "def", "_store_cached_zone_variable", "(", "self", ",", "zone_id", ",", "name", ",", "value", ")", ":", "zone_state", "=", "self", ".", "_zone_state", ".", "setdefault", "(", "zone_id", ",", "{", "}", ")", "name", "=", "name", ".", "lower", "(", ")", "...
Stores the current known value of a zone variable into the cache. Calls any zone callbacks.
[ "Stores", "the", "current", "known", "value", "of", "a", "zone", "variable", "into", "the", "cache", ".", "Calls", "any", "zone", "callbacks", "." ]
train
https://github.com/wickerwaka/russound_rio/blob/e331985fd1544abec6a1da3637090550d6f93f76/russound_rio/rio.py#L92-L103
wickerwaka/russound_rio
russound_rio/rio.py
Russound._retrieve_cached_source_variable
def _retrieve_cached_source_variable(self, source_id, name): """ Retrieves the cache state of the named variable for a particular source. If the variable has not been cached then the UncachedVariable exception is raised. """ try: s = self._source_state[source_...
python
def _retrieve_cached_source_variable(self, source_id, name): """ Retrieves the cache state of the named variable for a particular source. If the variable has not been cached then the UncachedVariable exception is raised. """ try: s = self._source_state[source_...
[ "def", "_retrieve_cached_source_variable", "(", "self", ",", "source_id", ",", "name", ")", ":", "try", ":", "s", "=", "self", ".", "_source_state", "[", "source_id", "]", "[", "name", ".", "lower", "(", ")", "]", "logger", ".", "debug", "(", "\"Source C...
Retrieves the cache state of the named variable for a particular source. If the variable has not been cached then the UncachedVariable exception is raised.
[ "Retrieves", "the", "cache", "state", "of", "the", "named", "variable", "for", "a", "particular", "source", ".", "If", "the", "variable", "has", "not", "been", "cached", "then", "the", "UncachedVariable", "exception", "is", "raised", "." ]
train
https://github.com/wickerwaka/russound_rio/blob/e331985fd1544abec6a1da3637090550d6f93f76/russound_rio/rio.py#L105-L117
wickerwaka/russound_rio
russound_rio/rio.py
Russound._store_cached_source_variable
def _store_cached_source_variable(self, source_id, name, value): """ Stores the current known value of a source variable into the cache. Calls any source callbacks. """ source_state = self._source_state.setdefault(source_id, {}) name = name.lower() source_state[na...
python
def _store_cached_source_variable(self, source_id, name, value): """ Stores the current known value of a source variable into the cache. Calls any source callbacks. """ source_state = self._source_state.setdefault(source_id, {}) name = name.lower() source_state[na...
[ "def", "_store_cached_source_variable", "(", "self", ",", "source_id", ",", "name", ",", "value", ")", ":", "source_state", "=", "self", ".", "_source_state", ".", "setdefault", "(", "source_id", ",", "{", "}", ")", "name", "=", "name", ".", "lower", "(", ...
Stores the current known value of a source variable into the cache. Calls any source callbacks.
[ "Stores", "the", "current", "known", "value", "of", "a", "source", "variable", "into", "the", "cache", ".", "Calls", "any", "source", "callbacks", "." ]
train
https://github.com/wickerwaka/russound_rio/blob/e331985fd1544abec6a1da3637090550d6f93f76/russound_rio/rio.py#L119-L130
wickerwaka/russound_rio
russound_rio/rio.py
Russound.connect
def connect(self): """ Connect to the controller and start processing responses. """ logger.info("Connecting to %s:%s", self._host, self._port) reader, writer = yield from asyncio.open_connection( self._host, self._port, loop=self._loop) self._ioloop_futur...
python
def connect(self): """ Connect to the controller and start processing responses. """ logger.info("Connecting to %s:%s", self._host, self._port) reader, writer = yield from asyncio.open_connection( self._host, self._port, loop=self._loop) self._ioloop_futur...
[ "def", "connect", "(", "self", ")", ":", "logger", ".", "info", "(", "\"Connecting to %s:%s\"", ",", "self", ".", "_host", ",", "self", ".", "_port", ")", "reader", ",", "writer", "=", "yield", "from", "asyncio", ".", "open_connection", "(", "self", ".",...
Connect to the controller and start processing responses.
[ "Connect", "to", "the", "controller", "and", "start", "processing", "responses", "." ]
train
https://github.com/wickerwaka/russound_rio/blob/e331985fd1544abec6a1da3637090550d6f93f76/russound_rio/rio.py#L247-L256
wickerwaka/russound_rio
russound_rio/rio.py
Russound.close
def close(self): """ Disconnect from the controller. """ logger.info("Closing connection to %s:%s", self._host, self._port) self._ioloop_future.cancel() try: yield from self._ioloop_future except asyncio.CancelledError: pass
python
def close(self): """ Disconnect from the controller. """ logger.info("Closing connection to %s:%s", self._host, self._port) self._ioloop_future.cancel() try: yield from self._ioloop_future except asyncio.CancelledError: pass
[ "def", "close", "(", "self", ")", ":", "logger", ".", "info", "(", "\"Closing connection to %s:%s\"", ",", "self", ".", "_host", ",", "self", ".", "_port", ")", "self", ".", "_ioloop_future", ".", "cancel", "(", ")", "try", ":", "yield", "from", "self", ...
Disconnect from the controller.
[ "Disconnect", "from", "the", "controller", "." ]
train
https://github.com/wickerwaka/russound_rio/blob/e331985fd1544abec6a1da3637090550d6f93f76/russound_rio/rio.py#L259-L268
wickerwaka/russound_rio
russound_rio/rio.py
Russound.set_zone_variable
def set_zone_variable(self, zone_id, variable, value): """ Set a zone variable to a new value. """ return self._send_cmd("SET %s.%s=\"%s\"" % ( zone_id.device_str(), variable, value))
python
def set_zone_variable(self, zone_id, variable, value): """ Set a zone variable to a new value. """ return self._send_cmd("SET %s.%s=\"%s\"" % ( zone_id.device_str(), variable, value))
[ "def", "set_zone_variable", "(", "self", ",", "zone_id", ",", "variable", ",", "value", ")", ":", "return", "self", ".", "_send_cmd", "(", "\"SET %s.%s=\\\"%s\\\"\"", "%", "(", "zone_id", ".", "device_str", "(", ")", ",", "variable", ",", "value", ")", ")"...
Set a zone variable to a new value.
[ "Set", "a", "zone", "variable", "to", "a", "new", "value", "." ]
train
https://github.com/wickerwaka/russound_rio/blob/e331985fd1544abec6a1da3637090550d6f93f76/russound_rio/rio.py#L271-L276
wickerwaka/russound_rio
russound_rio/rio.py
Russound.get_zone_variable
def get_zone_variable(self, zone_id, variable): """ Retrieve the current value of a zone variable. If the variable is not found in the local cache then the value is requested from the controller. """ try: return self._retrieve_cached_zone_variable(zone_id, variable) ...
python
def get_zone_variable(self, zone_id, variable): """ Retrieve the current value of a zone variable. If the variable is not found in the local cache then the value is requested from the controller. """ try: return self._retrieve_cached_zone_variable(zone_id, variable) ...
[ "def", "get_zone_variable", "(", "self", ",", "zone_id", ",", "variable", ")", ":", "try", ":", "return", "self", ".", "_retrieve_cached_zone_variable", "(", "zone_id", ",", "variable", ")", "except", "UncachedVariable", ":", "return", "(", "yield", "from", "s...
Retrieve the current value of a zone variable. If the variable is not found in the local cache then the value is requested from the controller.
[ "Retrieve", "the", "current", "value", "of", "a", "zone", "variable", ".", "If", "the", "variable", "is", "not", "found", "in", "the", "local", "cache", "then", "the", "value", "is", "requested", "from", "the", "controller", "." ]
train
https://github.com/wickerwaka/russound_rio/blob/e331985fd1544abec6a1da3637090550d6f93f76/russound_rio/rio.py#L279-L288
wickerwaka/russound_rio
russound_rio/rio.py
Russound.get_cached_zone_variable
def get_cached_zone_variable(self, zone_id, variable, default=None): """ Retrieve the current value of a zone variable from the cache or return the default value if the variable is not present. """ try: return self._retrieve_cached_zone_variable(zone_id, variable) except Unc...
python
def get_cached_zone_variable(self, zone_id, variable, default=None): """ Retrieve the current value of a zone variable from the cache or return the default value if the variable is not present. """ try: return self._retrieve_cached_zone_variable(zone_id, variable) except Unc...
[ "def", "get_cached_zone_variable", "(", "self", ",", "zone_id", ",", "variable", ",", "default", "=", "None", ")", ":", "try", ":", "return", "self", ".", "_retrieve_cached_zone_variable", "(", "zone_id", ",", "variable", ")", "except", "UncachedVariable", ":", ...
Retrieve the current value of a zone variable from the cache or return the default value if the variable is not present.
[ "Retrieve", "the", "current", "value", "of", "a", "zone", "variable", "from", "the", "cache", "or", "return", "the", "default", "value", "if", "the", "variable", "is", "not", "present", "." ]
train
https://github.com/wickerwaka/russound_rio/blob/e331985fd1544abec6a1da3637090550d6f93f76/russound_rio/rio.py#L290-L297
wickerwaka/russound_rio
russound_rio/rio.py
Russound.watch_zone
def watch_zone(self, zone_id): """ Add a zone to the watchlist. Zones on the watchlist will push all state changes (and those of the source they are currently connected to) back to the client """ r = yield from self._send_cmd( "WATCH %s ON" % (zone_id.device_str()...
python
def watch_zone(self, zone_id): """ Add a zone to the watchlist. Zones on the watchlist will push all state changes (and those of the source they are currently connected to) back to the client """ r = yield from self._send_cmd( "WATCH %s ON" % (zone_id.device_str()...
[ "def", "watch_zone", "(", "self", ",", "zone_id", ")", ":", "r", "=", "yield", "from", "self", ".", "_send_cmd", "(", "\"WATCH %s ON\"", "%", "(", "zone_id", ".", "device_str", "(", ")", ",", ")", ")", "self", ".", "_watched_zones", ".", "add", "(", ...
Add a zone to the watchlist. Zones on the watchlist will push all state changes (and those of the source they are currently connected to) back to the client
[ "Add", "a", "zone", "to", "the", "watchlist", ".", "Zones", "on", "the", "watchlist", "will", "push", "all", "state", "changes", "(", "and", "those", "of", "the", "source", "they", "are", "currently", "connected", "to", ")", "back", "to", "the", "client"...
train
https://github.com/wickerwaka/russound_rio/blob/e331985fd1544abec6a1da3637090550d6f93f76/russound_rio/rio.py#L300-L308
wickerwaka/russound_rio
russound_rio/rio.py
Russound.unwatch_zone
def unwatch_zone(self, zone_id): """ Remove a zone from the watchlist. """ self._watched_zones.remove(zone_id) return (yield from self._send_cmd("WATCH %s OFF" % (zone_id.device_str(), )))
python
def unwatch_zone(self, zone_id): """ Remove a zone from the watchlist. """ self._watched_zones.remove(zone_id) return (yield from self._send_cmd("WATCH %s OFF" % (zone_id.device_str(), )))
[ "def", "unwatch_zone", "(", "self", ",", "zone_id", ")", ":", "self", ".", "_watched_zones", ".", "remove", "(", "zone_id", ")", "return", "(", "yield", "from", "self", ".", "_send_cmd", "(", "\"WATCH %s OFF\"", "%", "(", "zone_id", ".", "device_str", "(",...
Remove a zone from the watchlist.
[ "Remove", "a", "zone", "from", "the", "watchlist", "." ]
train
https://github.com/wickerwaka/russound_rio/blob/e331985fd1544abec6a1da3637090550d6f93f76/russound_rio/rio.py#L311-L315
wickerwaka/russound_rio
russound_rio/rio.py
Russound.send_zone_event
def send_zone_event(self, zone_id, event_name, *args): """ Send an event to a zone. """ cmd = "EVENT %s!%s %s" % ( zone_id.device_str(), event_name, " ".join(str(x) for x in args)) return (yield from self._send_cmd(cmd))
python
def send_zone_event(self, zone_id, event_name, *args): """ Send an event to a zone. """ cmd = "EVENT %s!%s %s" % ( zone_id.device_str(), event_name, " ".join(str(x) for x in args)) return (yield from self._send_cmd(cmd))
[ "def", "send_zone_event", "(", "self", ",", "zone_id", ",", "event_name", ",", "*", "args", ")", ":", "cmd", "=", "\"EVENT %s!%s %s\"", "%", "(", "zone_id", ".", "device_str", "(", ")", ",", "event_name", ",", "\" \"", ".", "join", "(", "str", "(", "x"...
Send an event to a zone.
[ "Send", "an", "event", "to", "a", "zone", "." ]
train
https://github.com/wickerwaka/russound_rio/blob/e331985fd1544abec6a1da3637090550d6f93f76/russound_rio/rio.py#L318-L323
wickerwaka/russound_rio
russound_rio/rio.py
Russound.enumerate_zones
def enumerate_zones(self): """ Return a list of (zone_id, zone_name) tuples """ zones = [] for controller in range(1, 8): for zone in range(1, 17): zone_id = ZoneID(zone, controller) try: name = yield from self.get_zone_variable(zon...
python
def enumerate_zones(self): """ Return a list of (zone_id, zone_name) tuples """ zones = [] for controller in range(1, 8): for zone in range(1, 17): zone_id = ZoneID(zone, controller) try: name = yield from self.get_zone_variable(zon...
[ "def", "enumerate_zones", "(", "self", ")", ":", "zones", "=", "[", "]", "for", "controller", "in", "range", "(", "1", ",", "8", ")", ":", "for", "zone", "in", "range", "(", "1", ",", "17", ")", ":", "zone_id", "=", "ZoneID", "(", "zone", ",", ...
Return a list of (zone_id, zone_name) tuples
[ "Return", "a", "list", "of", "(", "zone_id", "zone_name", ")", "tuples" ]
train
https://github.com/wickerwaka/russound_rio/blob/e331985fd1544abec6a1da3637090550d6f93f76/russound_rio/rio.py#L326-L338
wickerwaka/russound_rio
russound_rio/rio.py
Russound.set_source_variable
def set_source_variable(self, source_id, variable, value): """ Change the value of a source variable. """ source_id = int(source_id) return self._send_cmd("SET S[%d].%s=\"%s\"" % ( source_id, variable, value))
python
def set_source_variable(self, source_id, variable, value): """ Change the value of a source variable. """ source_id = int(source_id) return self._send_cmd("SET S[%d].%s=\"%s\"" % ( source_id, variable, value))
[ "def", "set_source_variable", "(", "self", ",", "source_id", ",", "variable", ",", "value", ")", ":", "source_id", "=", "int", "(", "source_id", ")", "return", "self", ".", "_send_cmd", "(", "\"SET S[%d].%s=\\\"%s\\\"\"", "%", "(", "source_id", ",", "variable"...
Change the value of a source variable.
[ "Change", "the", "value", "of", "a", "source", "variable", "." ]
train
https://github.com/wickerwaka/russound_rio/blob/e331985fd1544abec6a1da3637090550d6f93f76/russound_rio/rio.py#L341-L345
wickerwaka/russound_rio
russound_rio/rio.py
Russound.get_source_variable
def get_source_variable(self, source_id, variable): """ Get the current value of a source variable. If the variable is not in the cache it will be retrieved from the controller. """ source_id = int(source_id) try: return self._retrieve_cached_source_variable( ...
python
def get_source_variable(self, source_id, variable): """ Get the current value of a source variable. If the variable is not in the cache it will be retrieved from the controller. """ source_id = int(source_id) try: return self._retrieve_cached_source_variable( ...
[ "def", "get_source_variable", "(", "self", ",", "source_id", ",", "variable", ")", ":", "source_id", "=", "int", "(", "source_id", ")", "try", ":", "return", "self", ".", "_retrieve_cached_source_variable", "(", "source_id", ",", "variable", ")", "except", "Un...
Get the current value of a source variable. If the variable is not in the cache it will be retrieved from the controller.
[ "Get", "the", "current", "value", "of", "a", "source", "variable", ".", "If", "the", "variable", "is", "not", "in", "the", "cache", "it", "will", "be", "retrieved", "from", "the", "controller", "." ]
train
https://github.com/wickerwaka/russound_rio/blob/e331985fd1544abec6a1da3637090550d6f93f76/russound_rio/rio.py#L348-L358