repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
ska-sa/montblanc | montblanc/impl/rime/tensorflow/RimeSolver.py | RimeSolver._feed | def _feed(self, cube, data_sources, data_sinks, global_iter_args):
""" Feed stub """
try:
self._feed_impl(cube, data_sources, data_sinks, global_iter_args)
except Exception as e:
montblanc.log.exception("Feed Exception")
raise | python | def _feed(self, cube, data_sources, data_sinks, global_iter_args):
""" Feed stub """
try:
self._feed_impl(cube, data_sources, data_sinks, global_iter_args)
except Exception as e:
montblanc.log.exception("Feed Exception")
raise | [
"def",
"_feed",
"(",
"self",
",",
"cube",
",",
"data_sources",
",",
"data_sinks",
",",
"global_iter_args",
")",
":",
"try",
":",
"self",
".",
"_feed_impl",
"(",
"cube",
",",
"data_sources",
",",
"data_sinks",
",",
"global_iter_args",
")",
"except",
"Exceptio... | Feed stub | [
"Feed",
"stub"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/RimeSolver.py#L356-L362 | train |
ska-sa/montblanc | montblanc/impl/rime/tensorflow/RimeSolver.py | RimeSolver._feed_impl | def _feed_impl(self, cube, data_sources, data_sinks, global_iter_args):
""" Implementation of staging_area feeding """
session = self._tf_session
FD = self._tf_feed_data
LSA = FD.local
# Get source strides out before the local sizes are modified during
# the source loops... | python | def _feed_impl(self, cube, data_sources, data_sinks, global_iter_args):
""" Implementation of staging_area feeding """
session = self._tf_session
FD = self._tf_feed_data
LSA = FD.local
# Get source strides out before the local sizes are modified during
# the source loops... | [
"def",
"_feed_impl",
"(",
"self",
",",
"cube",
",",
"data_sources",
",",
"data_sinks",
",",
"global_iter_args",
")",
":",
"session",
"=",
"self",
".",
"_tf_session",
"FD",
"=",
"self",
".",
"_tf_feed_data",
"LSA",
"=",
"FD",
".",
"local",
"# Get source strid... | Implementation of staging_area feeding | [
"Implementation",
"of",
"staging_area",
"feeding"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/RimeSolver.py#L364-L427 | train |
ska-sa/montblanc | montblanc/impl/rime/tensorflow/RimeSolver.py | RimeSolver._compute | def _compute(self, feed_dict, shard):
""" Call the tensorflow compute """
try:
descriptor, enq = self._tfrun(self._tf_expr[shard], feed_dict=feed_dict)
self._inputs_waiting.decrement(shard)
except Exception as e:
montblanc.log.exception("Compute Exception")
... | python | def _compute(self, feed_dict, shard):
""" Call the tensorflow compute """
try:
descriptor, enq = self._tfrun(self._tf_expr[shard], feed_dict=feed_dict)
self._inputs_waiting.decrement(shard)
except Exception as e:
montblanc.log.exception("Compute Exception")
... | [
"def",
"_compute",
"(",
"self",
",",
"feed_dict",
",",
"shard",
")",
":",
"try",
":",
"descriptor",
",",
"enq",
"=",
"self",
".",
"_tfrun",
"(",
"self",
".",
"_tf_expr",
"[",
"shard",
"]",
",",
"feed_dict",
"=",
"feed_dict",
")",
"self",
".",
"_input... | Call the tensorflow compute | [
"Call",
"the",
"tensorflow",
"compute"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/RimeSolver.py#L517-L526 | train |
ska-sa/montblanc | montblanc/impl/rime/tensorflow/RimeSolver.py | RimeSolver._consume | def _consume(self, data_sinks, cube, global_iter_args):
""" Consume stub """
try:
return self._consume_impl(data_sinks, cube, global_iter_args)
except Exception as e:
montblanc.log.exception("Consumer Exception")
raise e, None, sys.exc_info()[2] | python | def _consume(self, data_sinks, cube, global_iter_args):
""" Consume stub """
try:
return self._consume_impl(data_sinks, cube, global_iter_args)
except Exception as e:
montblanc.log.exception("Consumer Exception")
raise e, None, sys.exc_info()[2] | [
"def",
"_consume",
"(",
"self",
",",
"data_sinks",
",",
"cube",
",",
"global_iter_args",
")",
":",
"try",
":",
"return",
"self",
".",
"_consume_impl",
"(",
"data_sinks",
",",
"cube",
",",
"global_iter_args",
")",
"except",
"Exception",
"as",
"e",
":",
"mon... | Consume stub | [
"Consume",
"stub"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/RimeSolver.py#L529-L535 | train |
ska-sa/montblanc | montblanc/impl/rime/tensorflow/RimeSolver.py | RimeSolver._consume_impl | def _consume_impl(self, data_sinks, cube, global_iter_args):
""" Consume """
LSA = self._tf_feed_data.local
output = self._tfrun(LSA.output.get_op)
# Expect the descriptor in the first tuple position
assert len(output) > 0
assert LSA.output.fed_arrays[0] == 'descriptor'... | python | def _consume_impl(self, data_sinks, cube, global_iter_args):
""" Consume """
LSA = self._tf_feed_data.local
output = self._tfrun(LSA.output.get_op)
# Expect the descriptor in the first tuple position
assert len(output) > 0
assert LSA.output.fed_arrays[0] == 'descriptor'... | [
"def",
"_consume_impl",
"(",
"self",
",",
"data_sinks",
",",
"cube",
",",
"global_iter_args",
")",
":",
"LSA",
"=",
"self",
".",
"_tf_feed_data",
".",
"local",
"output",
"=",
"self",
".",
"_tfrun",
"(",
"LSA",
".",
"output",
".",
"get_op",
")",
"# Expect... | Consume | [
"Consume"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/RimeSolver.py#L537-L571 | train |
ska-sa/montblanc | montblanc/__init__.py | rime_solver_cfg | def rime_solver_cfg(**kwargs):
"""
Produces a SolverConfiguration object, inherited from
a simple python dict, and containing the options required
to configure the RIME Solver.
Keyword arguments
-----------------
Any keyword arguments are inserted into the
returned dict.
Returns
... | python | def rime_solver_cfg(**kwargs):
"""
Produces a SolverConfiguration object, inherited from
a simple python dict, and containing the options required
to configure the RIME Solver.
Keyword arguments
-----------------
Any keyword arguments are inserted into the
returned dict.
Returns
... | [
"def",
"rime_solver_cfg",
"(",
"*",
"*",
"kwargs",
")",
":",
"from",
"configuration",
"import",
"(",
"load_config",
",",
"config_validator",
",",
"raise_validator_errors",
")",
"def",
"_merge_copy",
"(",
"d1",
",",
"d2",
")",
":",
"return",
"{",
"k",
":",
... | Produces a SolverConfiguration object, inherited from
a simple python dict, and containing the options required
to configure the RIME Solver.
Keyword arguments
-----------------
Any keyword arguments are inserted into the
returned dict.
Returns
-------
A SolverConfiguration object. | [
"Produces",
"a",
"SolverConfiguration",
"object",
"inherited",
"from",
"a",
"simple",
"python",
"dict",
"and",
"containing",
"the",
"options",
"required",
"to",
"configure",
"the",
"RIME",
"Solver",
"."
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/__init__.py#L50-L87 | train |
ska-sa/montblanc | montblanc/impl/rime/tensorflow/sources/fits_beam_source_provider.py | _create_filenames | def _create_filenames(filename_schema, feed_type):
"""
Returns a dictionary of beam filename pairs,
keyed on correlation,from the cartesian product
of correlations and real, imaginary pairs
Given 'beam_$(corr)_$(reim).fits' returns:
{
'xx' : ('beam_xx_re.fits', 'beam_xx_im.fits'),
'... | python | def _create_filenames(filename_schema, feed_type):
"""
Returns a dictionary of beam filename pairs,
keyed on correlation,from the cartesian product
of correlations and real, imaginary pairs
Given 'beam_$(corr)_$(reim).fits' returns:
{
'xx' : ('beam_xx_re.fits', 'beam_xx_im.fits'),
'... | [
"def",
"_create_filenames",
"(",
"filename_schema",
",",
"feed_type",
")",
":",
"template",
"=",
"FitsFilenameTemplate",
"(",
"filename_schema",
")",
"def",
"_re_im_filenames",
"(",
"corr",
",",
"template",
")",
":",
"try",
":",
"return",
"tuple",
"(",
"template... | Returns a dictionary of beam filename pairs,
keyed on correlation,from the cartesian product
of correlations and real, imaginary pairs
Given 'beam_$(corr)_$(reim).fits' returns:
{
'xx' : ('beam_xx_re.fits', 'beam_xx_im.fits'),
'xy' : ('beam_xy_re.fits', 'beam_xy_im.fits'),
...
'... | [
"Returns",
"a",
"dictionary",
"of",
"beam",
"filename",
"pairs",
"keyed",
"on",
"correlation",
"from",
"the",
"cartesian",
"product",
"of",
"correlations",
"and",
"real",
"imaginary",
"pairs"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/fits_beam_source_provider.py#L163-L211 | train |
ska-sa/montblanc | montblanc/impl/rime/tensorflow/sources/fits_beam_source_provider.py | _open_fits_files | def _open_fits_files(filenames):
"""
Given a {correlation: filename} mapping for filenames
returns a {correlation: file handle} mapping
"""
kw = { 'mode' : 'update', 'memmap' : False }
def _fh(fn):
""" Returns a filehandle or None if file does not exist """
return fits.open(fn, ... | python | def _open_fits_files(filenames):
"""
Given a {correlation: filename} mapping for filenames
returns a {correlation: file handle} mapping
"""
kw = { 'mode' : 'update', 'memmap' : False }
def _fh(fn):
""" Returns a filehandle or None if file does not exist """
return fits.open(fn, ... | [
"def",
"_open_fits_files",
"(",
"filenames",
")",
":",
"kw",
"=",
"{",
"'mode'",
":",
"'update'",
",",
"'memmap'",
":",
"False",
"}",
"def",
"_fh",
"(",
"fn",
")",
":",
"\"\"\" Returns a filehandle or None if file does not exist \"\"\"",
"return",
"fits",
".",
"... | Given a {correlation: filename} mapping for filenames
returns a {correlation: file handle} mapping | [
"Given",
"a",
"{",
"correlation",
":",
"filename",
"}",
"mapping",
"for",
"filenames",
"returns",
"a",
"{",
"correlation",
":",
"file",
"handle",
"}",
"mapping"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/fits_beam_source_provider.py#L213-L226 | train |
ska-sa/montblanc | montblanc/impl/rime/tensorflow/sources/fits_beam_source_provider.py | _create_axes | def _create_axes(filenames, file_dict):
""" Create a FitsAxes object """
try:
# Loop through the file_dictionary, finding the
# first open FITS file.
f = iter(f for tup in file_dict.itervalues()
for f in tup if f is not None).next()
except StopIteration as e:
rai... | python | def _create_axes(filenames, file_dict):
""" Create a FitsAxes object """
try:
# Loop through the file_dictionary, finding the
# first open FITS file.
f = iter(f for tup in file_dict.itervalues()
for f in tup if f is not None).next()
except StopIteration as e:
rai... | [
"def",
"_create_axes",
"(",
"filenames",
",",
"file_dict",
")",
":",
"try",
":",
"# Loop through the file_dictionary, finding the",
"# first open FITS file.",
"f",
"=",
"iter",
"(",
"f",
"for",
"tup",
"in",
"file_dict",
".",
"itervalues",
"(",
")",
"for",
"f",
"... | Create a FitsAxes object | [
"Create",
"a",
"FitsAxes",
"object"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/fits_beam_source_provider.py#L237-L261 | train |
ska-sa/montblanc | montblanc/impl/rime/tensorflow/sources/fits_beam_source_provider.py | FitsBeamSourceProvider._initialise | def _initialise(self, feed_type="linear"):
"""
Initialise the object by generating appropriate filenames,
opening associated file handles and inspecting the FITS axes
of these files.
"""
self._filenames = filenames = _create_filenames(self._filename_schema,
... | python | def _initialise(self, feed_type="linear"):
"""
Initialise the object by generating appropriate filenames,
opening associated file handles and inspecting the FITS axes
of these files.
"""
self._filenames = filenames = _create_filenames(self._filename_schema,
... | [
"def",
"_initialise",
"(",
"self",
",",
"feed_type",
"=",
"\"linear\"",
")",
":",
"self",
".",
"_filenames",
"=",
"filenames",
"=",
"_create_filenames",
"(",
"self",
".",
"_filename_schema",
",",
"feed_type",
")",
"self",
".",
"_files",
"=",
"files",
"=",
... | Initialise the object by generating appropriate filenames,
opening associated file handles and inspecting the FITS axes
of these files. | [
"Initialise",
"the",
"object",
"by",
"generating",
"appropriate",
"filenames",
"opening",
"associated",
"file",
"handles",
"and",
"inspecting",
"the",
"FITS",
"axes",
"of",
"these",
"files",
"."
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/fits_beam_source_provider.py#L333-L360 | train |
ska-sa/montblanc | montblanc/impl/rime/tensorflow/sources/fits_beam_source_provider.py | FitsBeamSourceProvider.ebeam | def ebeam(self, context):
""" ebeam cube data source """
if context.shape != self.shape:
raise ValueError("Partial feeding of the "
"beam cube is not yet supported %s %s." % (context.shape, self.shape))
ebeam = np.empty(context.shape, context.dtype)
# Iterat... | python | def ebeam(self, context):
""" ebeam cube data source """
if context.shape != self.shape:
raise ValueError("Partial feeding of the "
"beam cube is not yet supported %s %s." % (context.shape, self.shape))
ebeam = np.empty(context.shape, context.dtype)
# Iterat... | [
"def",
"ebeam",
"(",
"self",
",",
"context",
")",
":",
"if",
"context",
".",
"shape",
"!=",
"self",
".",
"shape",
":",
"raise",
"ValueError",
"(",
"\"Partial feeding of the \"",
"\"beam cube is not yet supported %s %s.\"",
"%",
"(",
"context",
".",
"shape",
",",... | ebeam cube data source | [
"ebeam",
"cube",
"data",
"source"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/fits_beam_source_provider.py#L370-L385 | train |
ska-sa/montblanc | montblanc/impl/rime/tensorflow/sinks/ms_sink_provider.py | MSSinkProvider.model_vis | def model_vis(self, context):
""" model visibility data sink """
column = self._vis_column
msshape = None
# Do we have a column descriptor for the supplied column?
try:
coldesc = self._manager.column_descriptors[column]
except KeyError as e:
colde... | python | def model_vis(self, context):
""" model visibility data sink """
column = self._vis_column
msshape = None
# Do we have a column descriptor for the supplied column?
try:
coldesc = self._manager.column_descriptors[column]
except KeyError as e:
colde... | [
"def",
"model_vis",
"(",
"self",
",",
"context",
")",
":",
"column",
"=",
"self",
".",
"_vis_column",
"msshape",
"=",
"None",
"# Do we have a column descriptor for the supplied column?",
"try",
":",
"coldesc",
"=",
"self",
".",
"_manager",
".",
"column_descriptors",... | model visibility data sink | [
"model",
"visibility",
"data",
"sink"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sinks/ms_sink_provider.py#L54-L86 | train |
ska-sa/montblanc | montblanc/impl/rime/tensorflow/sources/cached_source_provider.py | _cache | def _cache(method):
"""
Decorator for caching data source return values
Create a key index for the proxied array in the context.
Iterate over the array shape descriptor e.g. (ntime, nbl, 3)
returning tuples containing the lower and upper extents
of string dimensions. Takes (0, d) in the case of... | python | def _cache(method):
"""
Decorator for caching data source return values
Create a key index for the proxied array in the context.
Iterate over the array shape descriptor e.g. (ntime, nbl, 3)
returning tuples containing the lower and upper extents
of string dimensions. Takes (0, d) in the case of... | [
"def",
"_cache",
"(",
"method",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"method",
")",
"def",
"memoizer",
"(",
"self",
",",
"context",
")",
":",
"# Construct the key for the given index",
"idx",
"=",
"context",
".",
"array_extents",
"(",
"context",
".... | Decorator for caching data source return values
Create a key index for the proxied array in the context.
Iterate over the array shape descriptor e.g. (ntime, nbl, 3)
returning tuples containing the lower and upper extents
of string dimensions. Takes (0, d) in the case of an integer
dimensions. | [
"Decorator",
"for",
"caching",
"data",
"source",
"return",
"values"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/cached_source_provider.py#L29-L56 | train |
ska-sa/montblanc | montblanc/impl/rime/tensorflow/sources/cached_source_provider.py | _proxy | def _proxy(method):
"""
Decorator returning a method that proxies a data source.
"""
@functools.wraps(method)
def memoizer(self, context):
return method(context)
return memoizer | python | def _proxy(method):
"""
Decorator returning a method that proxies a data source.
"""
@functools.wraps(method)
def memoizer(self, context):
return method(context)
return memoizer | [
"def",
"_proxy",
"(",
"method",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"method",
")",
"def",
"memoizer",
"(",
"self",
",",
"context",
")",
":",
"return",
"method",
"(",
"context",
")",
"return",
"memoizer"
] | Decorator returning a method that proxies a data source. | [
"Decorator",
"returning",
"a",
"method",
"that",
"proxies",
"a",
"data",
"source",
"."
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/cached_source_provider.py#L58-L66 | train |
ska-sa/montblanc | montblanc/impl/rime/tensorflow/sources/cached_source_provider.py | CachedSourceProvider.start | def start(self, start_context):
""" Perform any logic on solution start """
for p in self._providers:
p.start(start_context)
if self._clear_start:
self.clear_cache() | python | def start(self, start_context):
""" Perform any logic on solution start """
for p in self._providers:
p.start(start_context)
if self._clear_start:
self.clear_cache() | [
"def",
"start",
"(",
"self",
",",
"start_context",
")",
":",
"for",
"p",
"in",
"self",
".",
"_providers",
":",
"p",
".",
"start",
"(",
"start_context",
")",
"if",
"self",
".",
"_clear_start",
":",
"self",
".",
"clear_cache",
"(",
")"
] | Perform any logic on solution start | [
"Perform",
"any",
"logic",
"on",
"solution",
"start"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/cached_source_provider.py#L132-L138 | train |
ska-sa/montblanc | montblanc/impl/rime/tensorflow/sources/cached_source_provider.py | CachedSourceProvider.stop | def stop(self, stop_context):
""" Perform any logic on solution stop """
for p in self._providers:
p.stop(stop_context)
if self._clear_stop:
self.clear_cache() | python | def stop(self, stop_context):
""" Perform any logic on solution stop """
for p in self._providers:
p.stop(stop_context)
if self._clear_stop:
self.clear_cache() | [
"def",
"stop",
"(",
"self",
",",
"stop_context",
")",
":",
"for",
"p",
"in",
"self",
".",
"_providers",
":",
"p",
".",
"stop",
"(",
"stop_context",
")",
"if",
"self",
".",
"_clear_stop",
":",
"self",
".",
"clear_cache",
"(",
")"
] | Perform any logic on solution stop | [
"Perform",
"any",
"logic",
"on",
"solution",
"stop"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/cached_source_provider.py#L140-L146 | train |
ska-sa/montblanc | montblanc/impl/rime/tensorflow/config.py | default_base_ant_pairs | def default_base_ant_pairs(self, context):
""" Compute base antenna pairs """
k = 0 if context.cfg['auto_correlations'] == True else 1
na = context.dim_global_size('na')
gen = (i.astype(context.dtype) for i in np.triu_indices(na, k))
# Cache np.triu_indices(na, k) as its likely that (na, k) will
... | python | def default_base_ant_pairs(self, context):
""" Compute base antenna pairs """
k = 0 if context.cfg['auto_correlations'] == True else 1
na = context.dim_global_size('na')
gen = (i.astype(context.dtype) for i in np.triu_indices(na, k))
# Cache np.triu_indices(na, k) as its likely that (na, k) will
... | [
"def",
"default_base_ant_pairs",
"(",
"self",
",",
"context",
")",
":",
"k",
"=",
"0",
"if",
"context",
".",
"cfg",
"[",
"'auto_correlations'",
"]",
"==",
"True",
"else",
"1",
"na",
"=",
"context",
".",
"dim_global_size",
"(",
"'na'",
")",
"gen",
"=",
... | Compute base antenna pairs | [
"Compute",
"base",
"antenna",
"pairs"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/config.py#L67-L87 | train |
ska-sa/montblanc | montblanc/impl/rime/tensorflow/config.py | default_antenna1 | def default_antenna1(self, context):
""" Default antenna1 values """
ant1, ant2 = default_base_ant_pairs(self, context)
(tl, tu), (bl, bu) = context.dim_extents('ntime', 'nbl')
ant1_result = np.empty(context.shape, context.dtype)
ant1_result[:,:] = ant1[np.newaxis,bl:bu]
return ant1_result | python | def default_antenna1(self, context):
""" Default antenna1 values """
ant1, ant2 = default_base_ant_pairs(self, context)
(tl, tu), (bl, bu) = context.dim_extents('ntime', 'nbl')
ant1_result = np.empty(context.shape, context.dtype)
ant1_result[:,:] = ant1[np.newaxis,bl:bu]
return ant1_result | [
"def",
"default_antenna1",
"(",
"self",
",",
"context",
")",
":",
"ant1",
",",
"ant2",
"=",
"default_base_ant_pairs",
"(",
"self",
",",
"context",
")",
"(",
"tl",
",",
"tu",
")",
",",
"(",
"bl",
",",
"bu",
")",
"=",
"context",
".",
"dim_extents",
"("... | Default antenna1 values | [
"Default",
"antenna1",
"values"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/config.py#L89-L95 | train |
ska-sa/montblanc | montblanc/impl/rime/tensorflow/config.py | default_antenna2 | def default_antenna2(self, context):
""" Default antenna2 values """
ant1, ant2 = default_base_ant_pairs(self, context)
(tl, tu), (bl, bu) = context.dim_extents('ntime', 'nbl')
ant2_result = np.empty(context.shape, context.dtype)
ant2_result[:,:] = ant2[np.newaxis,bl:bu]
return ant2_result | python | def default_antenna2(self, context):
""" Default antenna2 values """
ant1, ant2 = default_base_ant_pairs(self, context)
(tl, tu), (bl, bu) = context.dim_extents('ntime', 'nbl')
ant2_result = np.empty(context.shape, context.dtype)
ant2_result[:,:] = ant2[np.newaxis,bl:bu]
return ant2_result | [
"def",
"default_antenna2",
"(",
"self",
",",
"context",
")",
":",
"ant1",
",",
"ant2",
"=",
"default_base_ant_pairs",
"(",
"self",
",",
"context",
")",
"(",
"tl",
",",
"tu",
")",
",",
"(",
"bl",
",",
"bu",
")",
"=",
"context",
".",
"dim_extents",
"("... | Default antenna2 values | [
"Default",
"antenna2",
"values"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/config.py#L97-L103 | train |
ska-sa/montblanc | montblanc/impl/rime/tensorflow/config.py | identity_on_pols | def identity_on_pols(self, context):
"""
Returns [[1, 0], tiled up to other dimensions
[0, 1]]
"""
A = np.empty(context.shape, context.dtype)
A[:,:,:] = [[[1,0,0,1]]]
return A | python | def identity_on_pols(self, context):
"""
Returns [[1, 0], tiled up to other dimensions
[0, 1]]
"""
A = np.empty(context.shape, context.dtype)
A[:,:,:] = [[[1,0,0,1]]]
return A | [
"def",
"identity_on_pols",
"(",
"self",
",",
"context",
")",
":",
"A",
"=",
"np",
".",
"empty",
"(",
"context",
".",
"shape",
",",
"context",
".",
"dtype",
")",
"A",
"[",
":",
",",
":",
",",
":",
"]",
"=",
"[",
"[",
"[",
"1",
",",
"0",
",",
... | Returns [[1, 0], tiled up to other dimensions
[0, 1]] | [
"Returns",
"[[",
"1",
"0",
"]",
"tiled",
"up",
"to",
"other",
"dimensions",
"[",
"0",
"1",
"]]"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/config.py#L134-L141 | train |
ska-sa/montblanc | montblanc/impl/rime/tensorflow/config.py | default_stokes | def default_stokes(self, context):
"""
Returns [[1, 0], tiled up to other dimensions
[0, 0]]
"""
A = np.empty(context.shape, context.dtype)
A[:,:,:] = [[[1,0,0,0]]]
return A | python | def default_stokes(self, context):
"""
Returns [[1, 0], tiled up to other dimensions
[0, 0]]
"""
A = np.empty(context.shape, context.dtype)
A[:,:,:] = [[[1,0,0,0]]]
return A | [
"def",
"default_stokes",
"(",
"self",
",",
"context",
")",
":",
"A",
"=",
"np",
".",
"empty",
"(",
"context",
".",
"shape",
",",
"context",
".",
"dtype",
")",
"A",
"[",
":",
",",
":",
",",
":",
"]",
"=",
"[",
"[",
"[",
"1",
",",
"0",
",",
"... | Returns [[1, 0], tiled up to other dimensions
[0, 0]] | [
"Returns",
"[[",
"1",
"0",
"]",
"tiled",
"up",
"to",
"other",
"dimensions",
"[",
"0",
"0",
"]]"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/config.py#L143-L150 | train |
ska-sa/montblanc | montblanc/impl/rime/tensorflow/sources/ms_source_provider.py | MSSourceProvider.frequency | def frequency(self, context):
""" Frequency data source """
channels = self._manager.spectral_window_table.getcol(MS.CHAN_FREQ)
return channels.reshape(context.shape).astype(context.dtype) | python | def frequency(self, context):
""" Frequency data source """
channels = self._manager.spectral_window_table.getcol(MS.CHAN_FREQ)
return channels.reshape(context.shape).astype(context.dtype) | [
"def",
"frequency",
"(",
"self",
",",
"context",
")",
":",
"channels",
"=",
"self",
".",
"_manager",
".",
"spectral_window_table",
".",
"getcol",
"(",
"MS",
".",
"CHAN_FREQ",
")",
"return",
"channels",
".",
"reshape",
"(",
"context",
".",
"shape",
")",
"... | Frequency data source | [
"Frequency",
"data",
"source"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/ms_source_provider.py#L93-L96 | train |
ska-sa/montblanc | montblanc/impl/rime/tensorflow/sources/ms_source_provider.py | MSSourceProvider.ref_frequency | def ref_frequency(self, context):
""" Reference frequency data source """
num_chans = self._manager.spectral_window_table.getcol(MS.NUM_CHAN)
ref_freqs = self._manager.spectral_window_table.getcol(MS.REF_FREQUENCY)
data = np.hstack((np.repeat(rf, bs) for bs, rf in zip(num_chans, ref_fre... | python | def ref_frequency(self, context):
""" Reference frequency data source """
num_chans = self._manager.spectral_window_table.getcol(MS.NUM_CHAN)
ref_freqs = self._manager.spectral_window_table.getcol(MS.REF_FREQUENCY)
data = np.hstack((np.repeat(rf, bs) for bs, rf in zip(num_chans, ref_fre... | [
"def",
"ref_frequency",
"(",
"self",
",",
"context",
")",
":",
"num_chans",
"=",
"self",
".",
"_manager",
".",
"spectral_window_table",
".",
"getcol",
"(",
"MS",
".",
"NUM_CHAN",
")",
"ref_freqs",
"=",
"self",
".",
"_manager",
".",
"spectral_window_table",
"... | Reference frequency data source | [
"Reference",
"frequency",
"data",
"source"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/ms_source_provider.py#L98-L104 | train |
ska-sa/montblanc | montblanc/impl/rime/tensorflow/sources/ms_source_provider.py | MSSourceProvider.uvw | def uvw(self, context):
""" Per-antenna UVW coordinate data source """
# Hacky access of private member
cube = context._cube
# Create antenna1 source context
a1_actual = cube.array("antenna1", reify=True)
a1_ctx = SourceContext("antenna1", cube, context.cfg,
... | python | def uvw(self, context):
""" Per-antenna UVW coordinate data source """
# Hacky access of private member
cube = context._cube
# Create antenna1 source context
a1_actual = cube.array("antenna1", reify=True)
a1_ctx = SourceContext("antenna1", cube, context.cfg,
... | [
"def",
"uvw",
"(",
"self",
",",
"context",
")",
":",
"# Hacky access of private member",
"cube",
"=",
"context",
".",
"_cube",
"# Create antenna1 source context",
"a1_actual",
"=",
"cube",
".",
"array",
"(",
"\"antenna1\"",
",",
"reify",
"=",
"True",
")",
"a1_ct... | Per-antenna UVW coordinate data source | [
"Per",
"-",
"antenna",
"UVW",
"coordinate",
"data",
"source"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/ms_source_provider.py#L106-L141 | train |
ska-sa/montblanc | montblanc/impl/rime/tensorflow/sources/ms_source_provider.py | MSSourceProvider.antenna1 | def antenna1(self, context):
""" antenna1 data source """
lrow, urow = MS.uvw_row_extents(context)
antenna1 = self._manager.ordered_uvw_table.getcol(
MS.ANTENNA1, startrow=lrow, nrow=urow-lrow)
return antenna1.reshape(context.shape).astype(context.dtype) | python | def antenna1(self, context):
""" antenna1 data source """
lrow, urow = MS.uvw_row_extents(context)
antenna1 = self._manager.ordered_uvw_table.getcol(
MS.ANTENNA1, startrow=lrow, nrow=urow-lrow)
return antenna1.reshape(context.shape).astype(context.dtype) | [
"def",
"antenna1",
"(",
"self",
",",
"context",
")",
":",
"lrow",
",",
"urow",
"=",
"MS",
".",
"uvw_row_extents",
"(",
"context",
")",
"antenna1",
"=",
"self",
".",
"_manager",
".",
"ordered_uvw_table",
".",
"getcol",
"(",
"MS",
".",
"ANTENNA1",
",",
"... | antenna1 data source | [
"antenna1",
"data",
"source"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/ms_source_provider.py#L143-L149 | train |
ska-sa/montblanc | montblanc/impl/rime/tensorflow/sources/ms_source_provider.py | MSSourceProvider.antenna2 | def antenna2(self, context):
""" antenna2 data source """
lrow, urow = MS.uvw_row_extents(context)
antenna2 = self._manager.ordered_uvw_table.getcol(
MS.ANTENNA2, startrow=lrow, nrow=urow-lrow)
return antenna2.reshape(context.shape).astype(context.dtype) | python | def antenna2(self, context):
""" antenna2 data source """
lrow, urow = MS.uvw_row_extents(context)
antenna2 = self._manager.ordered_uvw_table.getcol(
MS.ANTENNA2, startrow=lrow, nrow=urow-lrow)
return antenna2.reshape(context.shape).astype(context.dtype) | [
"def",
"antenna2",
"(",
"self",
",",
"context",
")",
":",
"lrow",
",",
"urow",
"=",
"MS",
".",
"uvw_row_extents",
"(",
"context",
")",
"antenna2",
"=",
"self",
".",
"_manager",
".",
"ordered_uvw_table",
".",
"getcol",
"(",
"MS",
".",
"ANTENNA2",
",",
"... | antenna2 data source | [
"antenna2",
"data",
"source"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/ms_source_provider.py#L151-L157 | train |
ska-sa/montblanc | montblanc/impl/rime/tensorflow/sources/ms_source_provider.py | MSSourceProvider.parallactic_angles | def parallactic_angles(self, context):
""" parallactic angle data source """
# Time and antenna extents
(lt, ut), (la, ua) = context.dim_extents('ntime', 'na')
return (mbu.parallactic_angles(self._times[lt:ut],
self._antenna_positions[la:ua], self._phase_dir)
... | python | def parallactic_angles(self, context):
""" parallactic angle data source """
# Time and antenna extents
(lt, ut), (la, ua) = context.dim_extents('ntime', 'na')
return (mbu.parallactic_angles(self._times[lt:ut],
self._antenna_positions[la:ua], self._phase_dir)
... | [
"def",
"parallactic_angles",
"(",
"self",
",",
"context",
")",
":",
"# Time and antenna extents",
"(",
"lt",
",",
"ut",
")",
",",
"(",
"la",
",",
"ua",
")",
"=",
"context",
".",
"dim_extents",
"(",
"'ntime'",
",",
"'na'",
")",
"return",
"(",
"mbu",
"."... | parallactic angle data source | [
"parallactic",
"angle",
"data",
"source"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/ms_source_provider.py#L159-L167 | train |
ska-sa/montblanc | montblanc/impl/rime/tensorflow/sources/ms_source_provider.py | MSSourceProvider.observed_vis | def observed_vis(self, context):
""" Observed visibility data source """
lrow, urow = MS.row_extents(context)
data = self._manager.ordered_main_table.getcol(
self._vis_column, startrow=lrow, nrow=urow-lrow)
return data.reshape(context.shape).astype(context.dtype) | python | def observed_vis(self, context):
""" Observed visibility data source """
lrow, urow = MS.row_extents(context)
data = self._manager.ordered_main_table.getcol(
self._vis_column, startrow=lrow, nrow=urow-lrow)
return data.reshape(context.shape).astype(context.dtype) | [
"def",
"observed_vis",
"(",
"self",
",",
"context",
")",
":",
"lrow",
",",
"urow",
"=",
"MS",
".",
"row_extents",
"(",
"context",
")",
"data",
"=",
"self",
".",
"_manager",
".",
"ordered_main_table",
".",
"getcol",
"(",
"self",
".",
"_vis_column",
",",
... | Observed visibility data source | [
"Observed",
"visibility",
"data",
"source"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/ms_source_provider.py#L170-L177 | train |
ska-sa/montblanc | montblanc/impl/rime/tensorflow/sources/ms_source_provider.py | MSSourceProvider.flag | def flag(self, context):
""" Flag data source """
lrow, urow = MS.row_extents(context)
flag = self._manager.ordered_main_table.getcol(
MS.FLAG, startrow=lrow, nrow=urow-lrow)
return flag.reshape(context.shape).astype(context.dtype) | python | def flag(self, context):
""" Flag data source """
lrow, urow = MS.row_extents(context)
flag = self._manager.ordered_main_table.getcol(
MS.FLAG, startrow=lrow, nrow=urow-lrow)
return flag.reshape(context.shape).astype(context.dtype) | [
"def",
"flag",
"(",
"self",
",",
"context",
")",
":",
"lrow",
",",
"urow",
"=",
"MS",
".",
"row_extents",
"(",
"context",
")",
"flag",
"=",
"self",
".",
"_manager",
".",
"ordered_main_table",
".",
"getcol",
"(",
"MS",
".",
"FLAG",
",",
"startrow",
"=... | Flag data source | [
"Flag",
"data",
"source"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/ms_source_provider.py#L179-L186 | train |
ska-sa/montblanc | montblanc/impl/rime/tensorflow/sources/ms_source_provider.py | MSSourceProvider.weight | def weight(self, context):
""" Weight data source """
lrow, urow = MS.row_extents(context)
weight = self._manager.ordered_main_table.getcol(
MS.WEIGHT, startrow=lrow, nrow=urow-lrow)
# WEIGHT is applied across all channels
weight = np.repeat(weight, self._manager.ch... | python | def weight(self, context):
""" Weight data source """
lrow, urow = MS.row_extents(context)
weight = self._manager.ordered_main_table.getcol(
MS.WEIGHT, startrow=lrow, nrow=urow-lrow)
# WEIGHT is applied across all channels
weight = np.repeat(weight, self._manager.ch... | [
"def",
"weight",
"(",
"self",
",",
"context",
")",
":",
"lrow",
",",
"urow",
"=",
"MS",
".",
"row_extents",
"(",
"context",
")",
"weight",
"=",
"self",
".",
"_manager",
".",
"ordered_main_table",
".",
"getcol",
"(",
"MS",
".",
"WEIGHT",
",",
"startrow"... | Weight data source | [
"Weight",
"data",
"source"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/ms_source_provider.py#L188-L197 | train |
ska-sa/montblanc | montblanc/impl/rime/tensorflow/__init__.py | load_tf_lib | def load_tf_lib():
""" Load the tensorflow library """
from os.path import join as pjoin
import pkg_resources
import tensorflow as tf
path = pjoin('ext', 'rime.so')
rime_lib_path = pkg_resources.resource_filename("montblanc", path)
return tf.load_op_library(rime_lib_path) | python | def load_tf_lib():
""" Load the tensorflow library """
from os.path import join as pjoin
import pkg_resources
import tensorflow as tf
path = pjoin('ext', 'rime.so')
rime_lib_path = pkg_resources.resource_filename("montblanc", path)
return tf.load_op_library(rime_lib_path) | [
"def",
"load_tf_lib",
"(",
")",
":",
"from",
"os",
".",
"path",
"import",
"join",
"as",
"pjoin",
"import",
"pkg_resources",
"import",
"tensorflow",
"as",
"tf",
"path",
"=",
"pjoin",
"(",
"'ext'",
",",
"'rime.so'",
")",
"rime_lib_path",
"=",
"pkg_resources",
... | Load the tensorflow library | [
"Load",
"the",
"tensorflow",
"library"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/__init__.py#L21-L30 | train |
ska-sa/montblanc | montblanc/configuration.py | raise_validator_errors | def raise_validator_errors(validator):
"""
Raise any errors associated with the validator.
Parameters
----------
validator : :class:`cerberus.Validator`
Validator
Raises
------
ValueError
Raised if errors existed on `validator`.
Message describing each error and... | python | def raise_validator_errors(validator):
"""
Raise any errors associated with the validator.
Parameters
----------
validator : :class:`cerberus.Validator`
Validator
Raises
------
ValueError
Raised if errors existed on `validator`.
Message describing each error and... | [
"def",
"raise_validator_errors",
"(",
"validator",
")",
":",
"if",
"len",
"(",
"validator",
".",
"_errors",
")",
"==",
"0",
":",
"return",
"def",
"_path_str",
"(",
"path",
",",
"name",
"=",
"None",
")",
":",
"\"\"\" String of the document/schema path. `cfg[\"foo... | Raise any errors associated with the validator.
Parameters
----------
validator : :class:`cerberus.Validator`
Validator
Raises
------
ValueError
Raised if errors existed on `validator`.
Message describing each error and information
associated with the configurat... | [
"Raise",
"any",
"errors",
"associated",
"with",
"the",
"validator",
"."
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/configuration.py#L10-L73 | train |
tjguk/winshell | winshell.py | indented | def indented(text, level, indent=2):
"""Take a multiline text and indent it as a block"""
return "\n".join("%s%s" % (level * indent * " ", s) for s in text.splitlines()) | python | def indented(text, level, indent=2):
"""Take a multiline text and indent it as a block"""
return "\n".join("%s%s" % (level * indent * " ", s) for s in text.splitlines()) | [
"def",
"indented",
"(",
"text",
",",
"level",
",",
"indent",
"=",
"2",
")",
":",
"return",
"\"\\n\"",
".",
"join",
"(",
"\"%s%s\"",
"%",
"(",
"level",
"*",
"indent",
"*",
"\" \"",
",",
"s",
")",
"for",
"s",
"in",
"text",
".",
"splitlines",
"(",
"... | Take a multiline text and indent it as a block | [
"Take",
"a",
"multiline",
"text",
"and",
"indent",
"it",
"as",
"a",
"block"
] | 1509d211ab3403dd1cff6113e4e13462d6dec35b | https://github.com/tjguk/winshell/blob/1509d211ab3403dd1cff6113e4e13462d6dec35b/winshell.py#L83-L85 | train |
tjguk/winshell | winshell.py | dumped | def dumped(text, level, indent=2):
"""Put curly brackets round an indented text"""
return indented("{\n%s\n}" % indented(text, level + 1, indent) or "None", level, indent) + "\n" | python | def dumped(text, level, indent=2):
"""Put curly brackets round an indented text"""
return indented("{\n%s\n}" % indented(text, level + 1, indent) or "None", level, indent) + "\n" | [
"def",
"dumped",
"(",
"text",
",",
"level",
",",
"indent",
"=",
"2",
")",
":",
"return",
"indented",
"(",
"\"{\\n%s\\n}\"",
"%",
"indented",
"(",
"text",
",",
"level",
"+",
"1",
",",
"indent",
")",
"or",
"\"None\"",
",",
"level",
",",
"indent",
")",
... | Put curly brackets round an indented text | [
"Put",
"curly",
"brackets",
"round",
"an",
"indented",
"text"
] | 1509d211ab3403dd1cff6113e4e13462d6dec35b | https://github.com/tjguk/winshell/blob/1509d211ab3403dd1cff6113e4e13462d6dec35b/winshell.py#L87-L89 | train |
tjguk/winshell | winshell.py | copy_file | def copy_file(
source_path,
target_path,
allow_undo=True,
no_confirm=False,
rename_on_collision=True,
silent=False,
extra_flags=0,
hWnd=None
):
"""Perform a shell-based file copy. Copying in
this way allows the possibility of undo, auto-renaming,
and showing the "flying file"... | python | def copy_file(
source_path,
target_path,
allow_undo=True,
no_confirm=False,
rename_on_collision=True,
silent=False,
extra_flags=0,
hWnd=None
):
"""Perform a shell-based file copy. Copying in
this way allows the possibility of undo, auto-renaming,
and showing the "flying file"... | [
"def",
"copy_file",
"(",
"source_path",
",",
"target_path",
",",
"allow_undo",
"=",
"True",
",",
"no_confirm",
"=",
"False",
",",
"rename_on_collision",
"=",
"True",
",",
"silent",
"=",
"False",
",",
"extra_flags",
"=",
"0",
",",
"hWnd",
"=",
"None",
")",
... | Perform a shell-based file copy. Copying in
this way allows the possibility of undo, auto-renaming,
and showing the "flying file" animation during the copy.
The default options allow for undo, don't automatically
clobber on a name clash, automatically rename on collision
and display the animation. | [
"Perform",
"a",
"shell",
"-",
"based",
"file",
"copy",
".",
"Copying",
"in",
"this",
"way",
"allows",
"the",
"possibility",
"of",
"undo",
"auto",
"-",
"renaming",
"and",
"showing",
"the",
"flying",
"file",
"animation",
"during",
"the",
"copy",
"."
] | 1509d211ab3403dd1cff6113e4e13462d6dec35b | https://github.com/tjguk/winshell/blob/1509d211ab3403dd1cff6113e4e13462d6dec35b/winshell.py#L266-L294 | train |
tjguk/winshell | winshell.py | move_file | def move_file(
source_path,
target_path,
allow_undo=True,
no_confirm=False,
rename_on_collision=True,
silent=False,
extra_flags=0,
hWnd=None
):
"""Perform a shell-based file move. Moving in
this way allows the possibility of undo, auto-renaming,
and showing the "flying file" ... | python | def move_file(
source_path,
target_path,
allow_undo=True,
no_confirm=False,
rename_on_collision=True,
silent=False,
extra_flags=0,
hWnd=None
):
"""Perform a shell-based file move. Moving in
this way allows the possibility of undo, auto-renaming,
and showing the "flying file" ... | [
"def",
"move_file",
"(",
"source_path",
",",
"target_path",
",",
"allow_undo",
"=",
"True",
",",
"no_confirm",
"=",
"False",
",",
"rename_on_collision",
"=",
"True",
",",
"silent",
"=",
"False",
",",
"extra_flags",
"=",
"0",
",",
"hWnd",
"=",
"None",
")",
... | Perform a shell-based file move. Moving in
this way allows the possibility of undo, auto-renaming,
and showing the "flying file" animation during the copy.
The default options allow for undo, don't automatically
clobber on a name clash, automatically rename on collision
and display the animation. | [
"Perform",
"a",
"shell",
"-",
"based",
"file",
"move",
".",
"Moving",
"in",
"this",
"way",
"allows",
"the",
"possibility",
"of",
"undo",
"auto",
"-",
"renaming",
"and",
"showing",
"the",
"flying",
"file",
"animation",
"during",
"the",
"copy",
"."
] | 1509d211ab3403dd1cff6113e4e13462d6dec35b | https://github.com/tjguk/winshell/blob/1509d211ab3403dd1cff6113e4e13462d6dec35b/winshell.py#L296-L324 | train |
tjguk/winshell | winshell.py | rename_file | def rename_file(
source_path,
target_path,
allow_undo=True,
no_confirm=False,
rename_on_collision=True,
silent=False,
extra_flags=0,
hWnd=None
):
"""Perform a shell-based file rename. Renaming in
this way allows the possibility of undo, auto-renaming,
and showing the "flying ... | python | def rename_file(
source_path,
target_path,
allow_undo=True,
no_confirm=False,
rename_on_collision=True,
silent=False,
extra_flags=0,
hWnd=None
):
"""Perform a shell-based file rename. Renaming in
this way allows the possibility of undo, auto-renaming,
and showing the "flying ... | [
"def",
"rename_file",
"(",
"source_path",
",",
"target_path",
",",
"allow_undo",
"=",
"True",
",",
"no_confirm",
"=",
"False",
",",
"rename_on_collision",
"=",
"True",
",",
"silent",
"=",
"False",
",",
"extra_flags",
"=",
"0",
",",
"hWnd",
"=",
"None",
")"... | Perform a shell-based file rename. Renaming in
this way allows the possibility of undo, auto-renaming,
and showing the "flying file" animation during the copy.
The default options allow for undo, don't automatically
clobber on a name clash, automatically rename on collision
and display the animatio... | [
"Perform",
"a",
"shell",
"-",
"based",
"file",
"rename",
".",
"Renaming",
"in",
"this",
"way",
"allows",
"the",
"possibility",
"of",
"undo",
"auto",
"-",
"renaming",
"and",
"showing",
"the",
"flying",
"file",
"animation",
"during",
"the",
"copy",
"."
] | 1509d211ab3403dd1cff6113e4e13462d6dec35b | https://github.com/tjguk/winshell/blob/1509d211ab3403dd1cff6113e4e13462d6dec35b/winshell.py#L326-L354 | train |
tjguk/winshell | winshell.py | delete_file | def delete_file(
source_path,
allow_undo=True,
no_confirm=False,
silent=False,
extra_flags=0,
hWnd=None
):
"""Perform a shell-based file delete. Deleting in
this way uses the system recycle bin, allows the
possibility of undo, and showing the "flying file"
animation during the de... | python | def delete_file(
source_path,
allow_undo=True,
no_confirm=False,
silent=False,
extra_flags=0,
hWnd=None
):
"""Perform a shell-based file delete. Deleting in
this way uses the system recycle bin, allows the
possibility of undo, and showing the "flying file"
animation during the de... | [
"def",
"delete_file",
"(",
"source_path",
",",
"allow_undo",
"=",
"True",
",",
"no_confirm",
"=",
"False",
",",
"silent",
"=",
"False",
",",
"extra_flags",
"=",
"0",
",",
"hWnd",
"=",
"None",
")",
":",
"return",
"_file_operation",
"(",
"shellcon",
".",
"... | Perform a shell-based file delete. Deleting in
this way uses the system recycle bin, allows the
possibility of undo, and showing the "flying file"
animation during the delete.
The default options allow for undo, don't automatically
clobber on a name clash and display the animation. | [
"Perform",
"a",
"shell",
"-",
"based",
"file",
"delete",
".",
"Deleting",
"in",
"this",
"way",
"uses",
"the",
"system",
"recycle",
"bin",
"allows",
"the",
"possibility",
"of",
"undo",
"and",
"showing",
"the",
"flying",
"file",
"animation",
"during",
"the",
... | 1509d211ab3403dd1cff6113e4e13462d6dec35b | https://github.com/tjguk/winshell/blob/1509d211ab3403dd1cff6113e4e13462d6dec35b/winshell.py#L356-L382 | train |
tjguk/winshell | winshell.py | structured_storage | def structured_storage(filename):
"""Pick out info from MS documents with embedded
structured storage(typically MS Word docs etc.)
Returns a dictionary of information found
"""
if not pythoncom.StgIsStorageFile(filename):
return {}
flags = storagecon.STGM_READ | storagecon.STGM_SHARE... | python | def structured_storage(filename):
"""Pick out info from MS documents with embedded
structured storage(typically MS Word docs etc.)
Returns a dictionary of information found
"""
if not pythoncom.StgIsStorageFile(filename):
return {}
flags = storagecon.STGM_READ | storagecon.STGM_SHARE... | [
"def",
"structured_storage",
"(",
"filename",
")",
":",
"if",
"not",
"pythoncom",
".",
"StgIsStorageFile",
"(",
"filename",
")",
":",
"return",
"{",
"}",
"flags",
"=",
"storagecon",
".",
"STGM_READ",
"|",
"storagecon",
".",
"STGM_SHARE_EXCLUSIVE",
"storage",
"... | Pick out info from MS documents with embedded
structured storage(typically MS Word docs etc.)
Returns a dictionary of information found | [
"Pick",
"out",
"info",
"from",
"MS",
"documents",
"with",
"embedded",
"structured",
"storage",
"(",
"typically",
"MS",
"Word",
"docs",
"etc",
".",
")"
] | 1509d211ab3403dd1cff6113e4e13462d6dec35b | https://github.com/tjguk/winshell/blob/1509d211ab3403dd1cff6113e4e13462d6dec35b/winshell.py#L586-L645 | train |
tjguk/winshell | winshell.py | CreateShortcut | def CreateShortcut(Path, Target, Arguments="", StartIn="", Icon=("", 0), Description=""):
"""Create a Windows shortcut:
Path - As what file should the shortcut be created?
Target - What command should the desktop use?
Arguments - What arguments should be supplied to the command?
StartIn - What fold... | python | def CreateShortcut(Path, Target, Arguments="", StartIn="", Icon=("", 0), Description=""):
"""Create a Windows shortcut:
Path - As what file should the shortcut be created?
Target - What command should the desktop use?
Arguments - What arguments should be supplied to the command?
StartIn - What fold... | [
"def",
"CreateShortcut",
"(",
"Path",
",",
"Target",
",",
"Arguments",
"=",
"\"\"",
",",
"StartIn",
"=",
"\"\"",
",",
"Icon",
"=",
"(",
"\"\"",
",",
"0",
")",
",",
"Description",
"=",
"\"\"",
")",
":",
"lnk",
"=",
"shortcut",
"(",
"Target",
")",
"l... | Create a Windows shortcut:
Path - As what file should the shortcut be created?
Target - What command should the desktop use?
Arguments - What arguments should be supplied to the command?
StartIn - What folder should the command start in?
Icon -(filename, index) What icon should be used for the shor... | [
"Create",
"a",
"Windows",
"shortcut",
":"
] | 1509d211ab3403dd1cff6113e4e13462d6dec35b | https://github.com/tjguk/winshell/blob/1509d211ab3403dd1cff6113e4e13462d6dec35b/winshell.py#L1084-L1107 | train |
tjguk/winshell | winshell.py | ShellRecycleBin.undelete | def undelete(self, original_filepath):
"""Restore the most recent version of a filepath, returning
the filepath it was restored to(as rename-on-collision will
apply if a file already exists at that path).
"""
candidates = self.versions(original_filepath)
if not candidates... | python | def undelete(self, original_filepath):
"""Restore the most recent version of a filepath, returning
the filepath it was restored to(as rename-on-collision will
apply if a file already exists at that path).
"""
candidates = self.versions(original_filepath)
if not candidates... | [
"def",
"undelete",
"(",
"self",
",",
"original_filepath",
")",
":",
"candidates",
"=",
"self",
".",
"versions",
"(",
"original_filepath",
")",
"if",
"not",
"candidates",
":",
"raise",
"x_not_found_in_recycle_bin",
"(",
"\"%s not found in the Recycle Bin\"",
"%",
"or... | Restore the most recent version of a filepath, returning
the filepath it was restored to(as rename-on-collision will
apply if a file already exists at that path). | [
"Restore",
"the",
"most",
"recent",
"version",
"of",
"a",
"filepath",
"returning",
"the",
"filepath",
"it",
"was",
"restored",
"to",
"(",
"as",
"rename",
"-",
"on",
"-",
"collision",
"will",
"apply",
"if",
"a",
"file",
"already",
"exists",
"at",
"that",
... | 1509d211ab3403dd1cff6113e4e13462d6dec35b | https://github.com/tjguk/winshell/blob/1509d211ab3403dd1cff6113e4e13462d6dec35b/winshell.py#L937-L949 | train |
ska-sa/montblanc | montblanc/impl/rime/tensorflow/queue_wrapper.py | _get_queue_types | def _get_queue_types(fed_arrays, data_sources):
"""
Given a list of arrays to feed in fed_arrays, return
a list of associated queue types, obtained from tuples
in the data_sources dictionary
"""
try:
return [data_sources[n].dtype for n in fed_arrays]
except KeyError as e:
rai... | python | def _get_queue_types(fed_arrays, data_sources):
"""
Given a list of arrays to feed in fed_arrays, return
a list of associated queue types, obtained from tuples
in the data_sources dictionary
"""
try:
return [data_sources[n].dtype for n in fed_arrays]
except KeyError as e:
rai... | [
"def",
"_get_queue_types",
"(",
"fed_arrays",
",",
"data_sources",
")",
":",
"try",
":",
"return",
"[",
"data_sources",
"[",
"n",
"]",
".",
"dtype",
"for",
"n",
"in",
"fed_arrays",
"]",
"except",
"KeyError",
"as",
"e",
":",
"raise",
"ValueError",
"(",
"\... | Given a list of arrays to feed in fed_arrays, return
a list of associated queue types, obtained from tuples
in the data_sources dictionary | [
"Given",
"a",
"list",
"of",
"arrays",
"to",
"feed",
"in",
"fed_arrays",
"return",
"a",
"list",
"of",
"associated",
"queue",
"types",
"obtained",
"from",
"tuples",
"in",
"the",
"data_sources",
"dictionary"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/queue_wrapper.py#L8-L18 | train |
ska-sa/montblanc | montblanc/impl/rime/tensorflow/queue_wrapper.py | create_queue_wrapper | def create_queue_wrapper(name, queue_size, fed_arrays, data_sources, *args, **kwargs):
"""
Arguments
name: string
Name of the queue
queue_size: integer
Size of the queue
fed_arrays: list
array names that will be fed by this queue
data_sources: ... | python | def create_queue_wrapper(name, queue_size, fed_arrays, data_sources, *args, **kwargs):
"""
Arguments
name: string
Name of the queue
queue_size: integer
Size of the queue
fed_arrays: list
array names that will be fed by this queue
data_sources: ... | [
"def",
"create_queue_wrapper",
"(",
"name",
",",
"queue_size",
",",
"fed_arrays",
",",
"data_sources",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"qtype",
"=",
"SingleInputMultiQueueWrapper",
"if",
"'count'",
"in",
"kwargs",
"else",
"QueueWrapper",
"... | Arguments
name: string
Name of the queue
queue_size: integer
Size of the queue
fed_arrays: list
array names that will be fed by this queue
data_sources: dict
(lambda/method, dtype) tuples, keyed on array names | [
"Arguments",
"name",
":",
"string",
"Name",
"of",
"the",
"queue",
"queue_size",
":",
"integer",
"Size",
"of",
"the",
"queue",
"fed_arrays",
":",
"list",
"array",
"names",
"that",
"will",
"be",
"fed",
"by",
"this",
"queue",
"data_sources",
":",
"dict",
"(",... | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/queue_wrapper.py#L152-L167 | train |
ska-sa/montblanc | montblanc/util/parsing.py | parse_python_assigns | def parse_python_assigns(assign_str):
"""
Parses a string, containing assign statements
into a dictionary.
.. code-block:: python
h5 = katdal.open('123456789.h5')
kwargs = parse_python_assigns("spw=3; scans=[1,2];"
"targets='bpcal,radec';"
... | python | def parse_python_assigns(assign_str):
"""
Parses a string, containing assign statements
into a dictionary.
.. code-block:: python
h5 = katdal.open('123456789.h5')
kwargs = parse_python_assigns("spw=3; scans=[1,2];"
"targets='bpcal,radec';"
... | [
"def",
"parse_python_assigns",
"(",
"assign_str",
")",
":",
"if",
"not",
"assign_str",
":",
"return",
"{",
"}",
"def",
"_eval_value",
"(",
"stmt_value",
")",
":",
"# If the statement value is a call to a builtin, try evaluate it",
"if",
"isinstance",
"(",
"stmt_value",
... | Parses a string, containing assign statements
into a dictionary.
.. code-block:: python
h5 = katdal.open('123456789.h5')
kwargs = parse_python_assigns("spw=3; scans=[1,2];"
"targets='bpcal,radec';"
"channels=slice(0,20... | [
"Parses",
"a",
"string",
"containing",
"assign",
"statements",
"into",
"a",
"dictionary",
"."
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/util/parsing.py#L12-L122 | train |
ska-sa/montblanc | montblanc/impl/rime/tensorflow/sinks/sink_provider.py | find_sinks | def find_sinks(obj):
"""
Returns a dictionary of sink methods found on this object,
keyed on method name. Sink methods are identified by
(self, context) arguments on this object. For example:
def f(self, context):
...
is a sink method, but
def f(self, ctx):
...
is not... | python | def find_sinks(obj):
"""
Returns a dictionary of sink methods found on this object,
keyed on method name. Sink methods are identified by
(self, context) arguments on this object. For example:
def f(self, context):
...
is a sink method, but
def f(self, ctx):
...
is not... | [
"def",
"find_sinks",
"(",
"obj",
")",
":",
"SINK_ARGSPEC",
"=",
"[",
"'self'",
",",
"'context'",
"]",
"return",
"{",
"n",
":",
"m",
"for",
"n",
",",
"m",
"in",
"inspect",
".",
"getmembers",
"(",
"obj",
",",
"inspect",
".",
"ismethod",
")",
"if",
"i... | Returns a dictionary of sink methods found on this object,
keyed on method name. Sink methods are identified by
(self, context) arguments on this object. For example:
def f(self, context):
...
is a sink method, but
def f(self, ctx):
...
is not. | [
"Returns",
"a",
"dictionary",
"of",
"sink",
"methods",
"found",
"on",
"this",
"object",
"keyed",
"on",
"method",
"name",
".",
"Sink",
"methods",
"are",
"identified",
"by",
"(",
"self",
"context",
")",
"arguments",
"on",
"this",
"object",
".",
"For",
"examp... | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sinks/sink_provider.py#L53-L73 | train |
ska-sa/montblanc | montblanc/impl/rime/tensorflow/sinks/sink_provider.py | SinkProvider.sinks | def sinks(self):
"""
Returns a dictionary of sink methods found on this object,
keyed on method name. Sink methods are identified by
(self, context) arguments on this object. For example:
def f(self, context):
...
is a sink method, but
def f(self, c... | python | def sinks(self):
"""
Returns a dictionary of sink methods found on this object,
keyed on method name. Sink methods are identified by
(self, context) arguments on this object. For example:
def f(self, context):
...
is a sink method, but
def f(self, c... | [
"def",
"sinks",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"_sinks",
"except",
"AttributeError",
":",
"self",
".",
"_sinks",
"=",
"find_sinks",
"(",
"self",
")",
"return",
"self",
".",
"_sinks"
] | Returns a dictionary of sink methods found on this object,
keyed on method name. Sink methods are identified by
(self, context) arguments on this object. For example:
def f(self, context):
...
is a sink method, but
def f(self, ctx):
...
is not. | [
"Returns",
"a",
"dictionary",
"of",
"sink",
"methods",
"found",
"on",
"this",
"object",
"keyed",
"on",
"method",
"name",
".",
"Sink",
"methods",
"are",
"identified",
"by",
"(",
"self",
"context",
")",
"arguments",
"on",
"this",
"object",
".",
"For",
"examp... | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sinks/sink_provider.py#L97-L120 | train |
ska-sa/montblanc | montblanc/util/ant_uvw.py | _antenna_uvw | def _antenna_uvw(uvw, antenna1, antenna2, chunks, nr_of_antenna):
""" numba implementation of antenna_uvw """
if antenna1.ndim != 1:
raise ValueError("antenna1 shape should be (row,)")
if antenna2.ndim != 1:
raise ValueError("antenna2 shape should be (row,)")
if uvw.ndim != 2 or uvw.s... | python | def _antenna_uvw(uvw, antenna1, antenna2, chunks, nr_of_antenna):
""" numba implementation of antenna_uvw """
if antenna1.ndim != 1:
raise ValueError("antenna1 shape should be (row,)")
if antenna2.ndim != 1:
raise ValueError("antenna2 shape should be (row,)")
if uvw.ndim != 2 or uvw.s... | [
"def",
"_antenna_uvw",
"(",
"uvw",
",",
"antenna1",
",",
"antenna2",
",",
"chunks",
",",
"nr_of_antenna",
")",
":",
"if",
"antenna1",
".",
"ndim",
"!=",
"1",
":",
"raise",
"ValueError",
"(",
"\"antenna1 shape should be (row,)\"",
")",
"if",
"antenna2",
".",
... | numba implementation of antenna_uvw | [
"numba",
"implementation",
"of",
"antenna_uvw"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/util/ant_uvw.py#L86-L121 | train |
ska-sa/montblanc | montblanc/util/ant_uvw.py | _raise_decomposition_errors | def _raise_decomposition_errors(uvw, antenna1, antenna2,
chunks, ant_uvw, max_err):
""" Raises informative exception for an invalid decomposition """
start = 0
problem_str = []
for ci, chunk in enumerate(chunks):
end = start + chunk
ant1 = antenna1[sta... | python | def _raise_decomposition_errors(uvw, antenna1, antenna2,
chunks, ant_uvw, max_err):
""" Raises informative exception for an invalid decomposition """
start = 0
problem_str = []
for ci, chunk in enumerate(chunks):
end = start + chunk
ant1 = antenna1[sta... | [
"def",
"_raise_decomposition_errors",
"(",
"uvw",
",",
"antenna1",
",",
"antenna2",
",",
"chunks",
",",
"ant_uvw",
",",
"max_err",
")",
":",
"start",
"=",
"0",
"problem_str",
"=",
"[",
"]",
"for",
"ci",
",",
"chunk",
"in",
"enumerate",
"(",
"chunks",
")"... | Raises informative exception for an invalid decomposition | [
"Raises",
"informative",
"exception",
"for",
"an",
"invalid",
"decomposition"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/util/ant_uvw.py#L128-L177 | train |
ska-sa/montblanc | montblanc/util/ant_uvw.py | _raise_missing_antenna_errors | def _raise_missing_antenna_errors(ant_uvw, max_err):
""" Raises an informative error for missing antenna """
# Find antenna uvw coordinates where any UVW component was nan
# nan + real == nan
problems = np.nonzero(np.add.reduce(np.isnan(ant_uvw), axis=2))
problem_str = []
for c, a in zip(*prob... | python | def _raise_missing_antenna_errors(ant_uvw, max_err):
""" Raises an informative error for missing antenna """
# Find antenna uvw coordinates where any UVW component was nan
# nan + real == nan
problems = np.nonzero(np.add.reduce(np.isnan(ant_uvw), axis=2))
problem_str = []
for c, a in zip(*prob... | [
"def",
"_raise_missing_antenna_errors",
"(",
"ant_uvw",
",",
"max_err",
")",
":",
"# Find antenna uvw coordinates where any UVW component was nan",
"# nan + real == nan",
"problems",
"=",
"np",
".",
"nonzero",
"(",
"np",
".",
"add",
".",
"reduce",
"(",
"np",
".",
"isn... | Raises an informative error for missing antenna | [
"Raises",
"an",
"informative",
"error",
"for",
"missing",
"antenna"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/util/ant_uvw.py#L184-L205 | train |
ska-sa/montblanc | montblanc/util/ant_uvw.py | antenna_uvw | def antenna_uvw(uvw, antenna1, antenna2, chunks,
nr_of_antenna, check_missing=False,
check_decomposition=False, max_err=100):
"""
Computes per-antenna UVW coordinates from baseline ``uvw``,
``antenna1`` and ``antenna2`` coordinates logically grouped
into baseline chunks.
... | python | def antenna_uvw(uvw, antenna1, antenna2, chunks,
nr_of_antenna, check_missing=False,
check_decomposition=False, max_err=100):
"""
Computes per-antenna UVW coordinates from baseline ``uvw``,
``antenna1`` and ``antenna2`` coordinates logically grouped
into baseline chunks.
... | [
"def",
"antenna_uvw",
"(",
"uvw",
",",
"antenna1",
",",
"antenna2",
",",
"chunks",
",",
"nr_of_antenna",
",",
"check_missing",
"=",
"False",
",",
"check_decomposition",
"=",
"False",
",",
"max_err",
"=",
"100",
")",
":",
"ant_uvw",
"=",
"_antenna_uvw",
"(",
... | Computes per-antenna UVW coordinates from baseline ``uvw``,
``antenna1`` and ``antenna2`` coordinates logically grouped
into baseline chunks.
The example below illustrates two baseline chunks
of size 6 and 5, respectively.
.. code-block:: python
uvw = ...
ant1 = np.array([0, 0, 0,... | [
"Computes",
"per",
"-",
"antenna",
"UVW",
"coordinates",
"from",
"baseline",
"uvw",
"antenna1",
"and",
"antenna2",
"coordinates",
"logically",
"grouped",
"into",
"baseline",
"chunks",
"."
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/util/ant_uvw.py#L208-L279 | train |
ska-sa/montblanc | montblanc/src_types.py | default_sources | def default_sources(**kwargs):
"""
Returns a dictionary mapping source types
to number of sources. If the number of sources
for the source type is supplied in the kwargs
these will be placed in the dictionary.
e.g. if we have 'point', 'gaussian' and 'sersic'
source types, then
default_... | python | def default_sources(**kwargs):
"""
Returns a dictionary mapping source types
to number of sources. If the number of sources
for the source type is supplied in the kwargs
these will be placed in the dictionary.
e.g. if we have 'point', 'gaussian' and 'sersic'
source types, then
default_... | [
"def",
"default_sources",
"(",
"*",
"*",
"kwargs",
")",
":",
"S",
"=",
"OrderedDict",
"(",
")",
"total",
"=",
"0",
"invalid_types",
"=",
"[",
"t",
"for",
"t",
"in",
"kwargs",
".",
"keys",
"(",
")",
"if",
"t",
"not",
"in",
"SOURCE_VAR_TYPES",
"]",
"... | Returns a dictionary mapping source types
to number of sources. If the number of sources
for the source type is supplied in the kwargs
these will be placed in the dictionary.
e.g. if we have 'point', 'gaussian' and 'sersic'
source types, then
default_sources(point=10, gaussian=20)
will re... | [
"Returns",
"a",
"dictionary",
"mapping",
"source",
"types",
"to",
"number",
"of",
"sources",
".",
"If",
"the",
"number",
"of",
"sources",
"for",
"the",
"source",
"type",
"is",
"supplied",
"in",
"the",
"kwargs",
"these",
"will",
"be",
"placed",
"in",
"the",... | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/src_types.py#L61-L106 | train |
ska-sa/montblanc | montblanc/src_types.py | sources_to_nr_vars | def sources_to_nr_vars(sources):
"""
Converts a source type to number of sources mapping into
a source numbering variable to number of sources mapping.
If, for example, we have 'point', 'gaussian' and 'sersic'
source types, then passing the following dict as an argument
sources_to_nr_vars({'po... | python | def sources_to_nr_vars(sources):
"""
Converts a source type to number of sources mapping into
a source numbering variable to number of sources mapping.
If, for example, we have 'point', 'gaussian' and 'sersic'
source types, then passing the following dict as an argument
sources_to_nr_vars({'po... | [
"def",
"sources_to_nr_vars",
"(",
"sources",
")",
":",
"sources",
"=",
"default_sources",
"(",
"*",
"*",
"sources",
")",
"try",
":",
"return",
"OrderedDict",
"(",
"(",
"SOURCE_VAR_TYPES",
"[",
"name",
"]",
",",
"nr",
")",
"for",
"name",
",",
"nr",
"in",
... | Converts a source type to number of sources mapping into
a source numbering variable to number of sources mapping.
If, for example, we have 'point', 'gaussian' and 'sersic'
source types, then passing the following dict as an argument
sources_to_nr_vars({'point':10, 'gaussian': 20})
will return an... | [
"Converts",
"a",
"source",
"type",
"to",
"number",
"of",
"sources",
"mapping",
"into",
"a",
"source",
"numbering",
"variable",
"to",
"number",
"of",
"sources",
"mapping",
"."
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/src_types.py#L108-L132 | train |
ska-sa/montblanc | montblanc/src_types.py | source_range_tuple | def source_range_tuple(start, end, nr_var_dict):
"""
Given a range of source numbers, as well as a dictionary
containing the numbers of each source, returns a dictionary
containing tuples of the start and end index
for each source variable type.
"""
starts = np.array([0 for nr_var in SOURCE... | python | def source_range_tuple(start, end, nr_var_dict):
"""
Given a range of source numbers, as well as a dictionary
containing the numbers of each source, returns a dictionary
containing tuples of the start and end index
for each source variable type.
"""
starts = np.array([0 for nr_var in SOURCE... | [
"def",
"source_range_tuple",
"(",
"start",
",",
"end",
",",
"nr_var_dict",
")",
":",
"starts",
"=",
"np",
".",
"array",
"(",
"[",
"0",
"for",
"nr_var",
"in",
"SOURCE_VAR_TYPES",
".",
"itervalues",
"(",
")",
"]",
")",
"ends",
"=",
"np",
".",
"array",
... | Given a range of source numbers, as well as a dictionary
containing the numbers of each source, returns a dictionary
containing tuples of the start and end index
for each source variable type. | [
"Given",
"a",
"range",
"of",
"source",
"numbers",
"as",
"well",
"as",
"a",
"dictionary",
"containing",
"the",
"numbers",
"of",
"each",
"source",
"returns",
"a",
"dictionary",
"containing",
"tuples",
"of",
"the",
"start",
"and",
"end",
"index",
"for",
"each",... | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/src_types.py#L134-L174 | train |
ska-sa/montblanc | montblanc/src_types.py | source_range | def source_range(start, end, nr_var_dict):
"""
Given a range of source numbers, as well as a dictionary
containing the numbers of each source, returns a dictionary
containing tuples of the start and end index
for each source variable type.
"""
return OrderedDict((k, e-s)
for k, (s, ... | python | def source_range(start, end, nr_var_dict):
"""
Given a range of source numbers, as well as a dictionary
containing the numbers of each source, returns a dictionary
containing tuples of the start and end index
for each source variable type.
"""
return OrderedDict((k, e-s)
for k, (s, ... | [
"def",
"source_range",
"(",
"start",
",",
"end",
",",
"nr_var_dict",
")",
":",
"return",
"OrderedDict",
"(",
"(",
"k",
",",
"e",
"-",
"s",
")",
"for",
"k",
",",
"(",
"s",
",",
"e",
")",
"in",
"source_range_tuple",
"(",
"start",
",",
"end",
",",
"... | Given a range of source numbers, as well as a dictionary
containing the numbers of each source, returns a dictionary
containing tuples of the start and end index
for each source variable type. | [
"Given",
"a",
"range",
"of",
"source",
"numbers",
"as",
"well",
"as",
"a",
"dictionary",
"containing",
"the",
"numbers",
"of",
"each",
"source",
"returns",
"a",
"dictionary",
"containing",
"tuples",
"of",
"the",
"start",
"and",
"end",
"index",
"for",
"each",... | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/src_types.py#L176-L186 | train |
ska-sa/montblanc | montblanc/src_types.py | source_range_slices | def source_range_slices(start, end, nr_var_dict):
"""
Given a range of source numbers, as well as a dictionary
containing the numbers of each source, returns a dictionary
containing slices for each source variable type.
"""
return OrderedDict((k, slice(s,e,1))
for k, (s, e)
in s... | python | def source_range_slices(start, end, nr_var_dict):
"""
Given a range of source numbers, as well as a dictionary
containing the numbers of each source, returns a dictionary
containing slices for each source variable type.
"""
return OrderedDict((k, slice(s,e,1))
for k, (s, e)
in s... | [
"def",
"source_range_slices",
"(",
"start",
",",
"end",
",",
"nr_var_dict",
")",
":",
"return",
"OrderedDict",
"(",
"(",
"k",
",",
"slice",
"(",
"s",
",",
"e",
",",
"1",
")",
")",
"for",
"k",
",",
"(",
"s",
",",
"e",
")",
"in",
"source_range_tuple"... | Given a range of source numbers, as well as a dictionary
containing the numbers of each source, returns a dictionary
containing slices for each source variable type. | [
"Given",
"a",
"range",
"of",
"source",
"numbers",
"as",
"well",
"as",
"a",
"dictionary",
"containing",
"the",
"numbers",
"of",
"each",
"source",
"returns",
"a",
"dictionary",
"containing",
"slices",
"for",
"each",
"source",
"variable",
"type",
"."
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/src_types.py#L188-L197 | train |
ska-sa/montblanc | montblanc/examples/MS_tf_example.py | RadioSourceProvider.point_lm | def point_lm(self, context):
""" Return a lm coordinate array to montblanc """
lm = np.empty(context.shape, context.dtype)
# Print the array schema
montblanc.log.info(context.array_schema.shape)
# Print the space of iteration
montblanc.log.info(context.iter_args)
... | python | def point_lm(self, context):
""" Return a lm coordinate array to montblanc """
lm = np.empty(context.shape, context.dtype)
# Print the array schema
montblanc.log.info(context.array_schema.shape)
# Print the space of iteration
montblanc.log.info(context.iter_args)
... | [
"def",
"point_lm",
"(",
"self",
",",
"context",
")",
":",
"lm",
"=",
"np",
".",
"empty",
"(",
"context",
".",
"shape",
",",
"context",
".",
"dtype",
")",
"# Print the array schema",
"montblanc",
".",
"log",
".",
"info",
"(",
"context",
".",
"array_schema... | Return a lm coordinate array to montblanc | [
"Return",
"a",
"lm",
"coordinate",
"array",
"to",
"montblanc"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/examples/MS_tf_example.py#L44-L59 | train |
ska-sa/montblanc | montblanc/examples/MS_tf_example.py | RadioSourceProvider.point_stokes | def point_stokes(self, context):
""" Return a stokes parameter array to montblanc """
stokes = np.empty(context.shape, context.dtype)
stokes[:,:,0] = 1
stokes[:,:,1:4] = 0
return stokes | python | def point_stokes(self, context):
""" Return a stokes parameter array to montblanc """
stokes = np.empty(context.shape, context.dtype)
stokes[:,:,0] = 1
stokes[:,:,1:4] = 0
return stokes | [
"def",
"point_stokes",
"(",
"self",
",",
"context",
")",
":",
"stokes",
"=",
"np",
".",
"empty",
"(",
"context",
".",
"shape",
",",
"context",
".",
"dtype",
")",
"stokes",
"[",
":",
",",
":",
",",
"0",
"]",
"=",
"1",
"stokes",
"[",
":",
",",
":... | Return a stokes parameter array to montblanc | [
"Return",
"a",
"stokes",
"parameter",
"array",
"to",
"montblanc"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/examples/MS_tf_example.py#L61-L66 | train |
ska-sa/montblanc | montblanc/examples/MS_tf_example.py | RadioSourceProvider.ref_frequency | def ref_frequency(self, context):
""" Return a reference frequency array to montblanc """
ref_freq = np.empty(context.shape, context.dtype)
ref_freq[:] = 1.415e9
return ref_freq | python | def ref_frequency(self, context):
""" Return a reference frequency array to montblanc """
ref_freq = np.empty(context.shape, context.dtype)
ref_freq[:] = 1.415e9
return ref_freq | [
"def",
"ref_frequency",
"(",
"self",
",",
"context",
")",
":",
"ref_freq",
"=",
"np",
".",
"empty",
"(",
"context",
".",
"shape",
",",
"context",
".",
"dtype",
")",
"ref_freq",
"[",
":",
"]",
"=",
"1.415e9",
"return",
"ref_freq"
] | Return a reference frequency array to montblanc | [
"Return",
"a",
"reference",
"frequency",
"array",
"to",
"montblanc"
] | 8a2e742e7500bcc6196489b735f87b233075dd2d | https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/examples/MS_tf_example.py#L76-L81 | train |
kislyuk/aegea | aegea/packages/github3/auths.py | Authorization.update | def update(self, scopes=[], add_scopes=[], rm_scopes=[], note='',
note_url=''):
"""Update this authorization.
:param list scopes: (optional), replaces the authorization scopes with
these
:param list add_scopes: (optional), scopes to be added
:param list rm_sco... | python | def update(self, scopes=[], add_scopes=[], rm_scopes=[], note='',
note_url=''):
"""Update this authorization.
:param list scopes: (optional), replaces the authorization scopes with
these
:param list add_scopes: (optional), scopes to be added
:param list rm_sco... | [
"def",
"update",
"(",
"self",
",",
"scopes",
"=",
"[",
"]",
",",
"add_scopes",
"=",
"[",
"]",
",",
"rm_scopes",
"=",
"[",
"]",
",",
"note",
"=",
"''",
",",
"note_url",
"=",
"''",
")",
":",
"success",
"=",
"False",
"json",
"=",
"None",
"if",
"sc... | Update this authorization.
:param list scopes: (optional), replaces the authorization scopes with
these
:param list add_scopes: (optional), scopes to be added
:param list rm_scopes: (optional), scopes to be removed
:param str note: (optional), new note about authorization
... | [
"Update",
"this",
"authorization",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/auths.py#L67-L99 | train |
kislyuk/aegea | aegea/packages/github3/issues/milestone.py | Milestone.iter_labels | def iter_labels(self, number=-1, etag=None):
"""Iterate over the labels for every issue associated with this
milestone.
.. versionchanged:: 0.9
Add etag parameter.
:param int number: (optional), number of labels to return. Default: -1
returns all available labe... | python | def iter_labels(self, number=-1, etag=None):
"""Iterate over the labels for every issue associated with this
milestone.
.. versionchanged:: 0.9
Add etag parameter.
:param int number: (optional), number of labels to return. Default: -1
returns all available labe... | [
"def",
"iter_labels",
"(",
"self",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'labels'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_iter",
"(",
"int",... | Iterate over the labels for every issue associated with this
milestone.
.. versionchanged:: 0.9
Add etag parameter.
:param int number: (optional), number of labels to return. Default: -1
returns all available labels.
:param str etag: (optional), ETag header fro... | [
"Iterate",
"over",
"the",
"labels",
"for",
"every",
"issue",
"associated",
"with",
"this",
"milestone",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/issues/milestone.py#L60-L74 | train |
bwohlberg/jonga | jonga.py | current_function | def current_function(frame):
"""
Get reference to currently running function from inspect/trace stack frame.
Parameters
----------
frame : stack frame
Stack frame obtained via trace or inspect
Returns
-------
fnc : function reference
Currently running function
"""
... | python | def current_function(frame):
"""
Get reference to currently running function from inspect/trace stack frame.
Parameters
----------
frame : stack frame
Stack frame obtained via trace or inspect
Returns
-------
fnc : function reference
Currently running function
"""
... | [
"def",
"current_function",
"(",
"frame",
")",
":",
"if",
"frame",
"is",
"None",
":",
"return",
"None",
"code",
"=",
"frame",
".",
"f_code",
"# Attempting to extract the function reference for these calls appears",
"# to be problematic",
"if",
"code",
".",
"co_name",
"... | Get reference to currently running function from inspect/trace stack frame.
Parameters
----------
frame : stack frame
Stack frame obtained via trace or inspect
Returns
-------
fnc : function reference
Currently running function | [
"Get",
"reference",
"to",
"currently",
"running",
"function",
"from",
"inspect",
"/",
"trace",
"stack",
"frame",
"."
] | 1947d40d78d814fbdc3a973ceffec4b69b4623f2 | https://github.com/bwohlberg/jonga/blob/1947d40d78d814fbdc3a973ceffec4b69b4623f2/jonga.py#L25-L62 | train |
bwohlberg/jonga | jonga.py | current_module_name | def current_module_name(frame):
"""
Get name of module of currently running function from inspect/trace
stack frame.
Parameters
----------
frame : stack frame
Stack frame obtained via trace or inspect
Returns
-------
modname : string
Currently running function module na... | python | def current_module_name(frame):
"""
Get name of module of currently running function from inspect/trace
stack frame.
Parameters
----------
frame : stack frame
Stack frame obtained via trace or inspect
Returns
-------
modname : string
Currently running function module na... | [
"def",
"current_module_name",
"(",
"frame",
")",
":",
"if",
"frame",
"is",
"None",
":",
"return",
"None",
"if",
"hasattr",
"(",
"frame",
".",
"f_globals",
",",
"'__name__'",
")",
":",
"return",
"frame",
".",
"f_globals",
"[",
"'__name__'",
"]",
"else",
"... | Get name of module of currently running function from inspect/trace
stack frame.
Parameters
----------
frame : stack frame
Stack frame obtained via trace or inspect
Returns
-------
modname : string
Currently running function module name | [
"Get",
"name",
"of",
"module",
"of",
"currently",
"running",
"function",
"from",
"inspect",
"/",
"trace",
"stack",
"frame",
"."
] | 1947d40d78d814fbdc3a973ceffec4b69b4623f2 | https://github.com/bwohlberg/jonga/blob/1947d40d78d814fbdc3a973ceffec4b69b4623f2/jonga.py#L111-L137 | train |
bwohlberg/jonga | jonga.py | CallTracer._trace | def _trace(self, frame, event, arg):
"""
Build a record of called functions using the trace mechanism
"""
# Return if this is not a function call
if event != 'call':
return
# Filter calling and called functions by module names
src_mod = current_modul... | python | def _trace(self, frame, event, arg):
"""
Build a record of called functions using the trace mechanism
"""
# Return if this is not a function call
if event != 'call':
return
# Filter calling and called functions by module names
src_mod = current_modul... | [
"def",
"_trace",
"(",
"self",
",",
"frame",
",",
"event",
",",
"arg",
")",
":",
"# Return if this is not a function call",
"if",
"event",
"!=",
"'call'",
":",
"return",
"# Filter calling and called functions by module names",
"src_mod",
"=",
"current_module_name",
"(",
... | Build a record of called functions using the trace mechanism | [
"Build",
"a",
"record",
"of",
"called",
"functions",
"using",
"the",
"trace",
"mechanism"
] | 1947d40d78d814fbdc3a973ceffec4b69b4623f2 | https://github.com/bwohlberg/jonga/blob/1947d40d78d814fbdc3a973ceffec4b69b4623f2/jonga.py#L232-L295 | train |
bwohlberg/jonga | jonga.py | CallTracer.stop | def stop(self):
"""Stop tracing"""
# Stop tracing
sys.settrace(None)
# Build group structure if group filter is defined
if self.grpflt is not None:
# Iterate over graph nodes (functions)
for k in self.fncts:
# Construct group identity str... | python | def stop(self):
"""Stop tracing"""
# Stop tracing
sys.settrace(None)
# Build group structure if group filter is defined
if self.grpflt is not None:
# Iterate over graph nodes (functions)
for k in self.fncts:
# Construct group identity str... | [
"def",
"stop",
"(",
"self",
")",
":",
"# Stop tracing",
"sys",
".",
"settrace",
"(",
"None",
")",
"# Build group structure if group filter is defined",
"if",
"self",
".",
"grpflt",
"is",
"not",
"None",
":",
"# Iterate over graph nodes (functions)",
"for",
"k",
"in",... | Stop tracing | [
"Stop",
"tracing"
] | 1947d40d78d814fbdc3a973ceffec4b69b4623f2 | https://github.com/bwohlberg/jonga/blob/1947d40d78d814fbdc3a973ceffec4b69b4623f2/jonga.py#L306-L325 | train |
bwohlberg/jonga | jonga.py | CallTracer._clrgen | def _clrgen(n, h0, hr):
"""Default colour generating function
Parameters
----------
n : int
Number of colours to generate
h0 : float
Initial H value in HSV colour specification
hr : float
Size of H value range to use for colour generation
... | python | def _clrgen(n, h0, hr):
"""Default colour generating function
Parameters
----------
n : int
Number of colours to generate
h0 : float
Initial H value in HSV colour specification
hr : float
Size of H value range to use for colour generation
... | [
"def",
"_clrgen",
"(",
"n",
",",
"h0",
",",
"hr",
")",
":",
"n0",
"=",
"n",
"if",
"n",
"==",
"1",
"else",
"n",
"-",
"1",
"clst",
"=",
"[",
"'%f,%f,%f'",
"%",
"(",
"h0",
"+",
"hr",
"*",
"hi",
"/",
"n0",
",",
"0.35",
",",
"0.85",
")",
"for"... | Default colour generating function
Parameters
----------
n : int
Number of colours to generate
h0 : float
Initial H value in HSV colour specification
hr : float
Size of H value range to use for colour generation
(final H value is h0 + hr)... | [
"Default",
"colour",
"generating",
"function"
] | 1947d40d78d814fbdc3a973ceffec4b69b4623f2 | https://github.com/bwohlberg/jonga/blob/1947d40d78d814fbdc3a973ceffec4b69b4623f2/jonga.py#L331-L354 | train |
bwohlberg/jonga | jonga.py | CallTracer.graph | def graph(self, fnm=None, size=None, fntsz=None, fntfm=None, clrgen=None,
rmsz=False, prog='dot'):
"""
Construct call graph
Parameters
----------
fnm : None or string, optional (default None)
Filename of graph file to be written. File type is determined b... | python | def graph(self, fnm=None, size=None, fntsz=None, fntfm=None, clrgen=None,
rmsz=False, prog='dot'):
"""
Construct call graph
Parameters
----------
fnm : None or string, optional (default None)
Filename of graph file to be written. File type is determined b... | [
"def",
"graph",
"(",
"self",
",",
"fnm",
"=",
"None",
",",
"size",
"=",
"None",
",",
"fntsz",
"=",
"None",
",",
"fntfm",
"=",
"None",
",",
"clrgen",
"=",
"None",
",",
"rmsz",
"=",
"False",
",",
"prog",
"=",
"'dot'",
")",
":",
"# Default colour gene... | Construct call graph
Parameters
----------
fnm : None or string, optional (default None)
Filename of graph file to be written. File type is determined by
the file extentions (e.g. dot for 'graph.dot' and SVG for
'graph.svg'). If None, a file is not written.
... | [
"Construct",
"call",
"graph"
] | 1947d40d78d814fbdc3a973ceffec4b69b4623f2 | https://github.com/bwohlberg/jonga/blob/1947d40d78d814fbdc3a973ceffec4b69b4623f2/jonga.py#L358-L466 | train |
kislyuk/aegea | aegea/packages/github3/pulls.py | PullRequest.create_review_comment | def create_review_comment(self, body, commit_id, path, position):
"""Create a review comment on this pull request.
All parameters are required by the GitHub API.
:param str body: The comment text itself
:param str commit_id: The SHA of the commit to comment on
:param str path: ... | python | def create_review_comment(self, body, commit_id, path, position):
"""Create a review comment on this pull request.
All parameters are required by the GitHub API.
:param str body: The comment text itself
:param str commit_id: The SHA of the commit to comment on
:param str path: ... | [
"def",
"create_review_comment",
"(",
"self",
",",
"body",
",",
"commit_id",
",",
"path",
",",
"position",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'comments'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"data",
"=",
"{",
"'body'",
":... | Create a review comment on this pull request.
All parameters are required by the GitHub API.
:param str body: The comment text itself
:param str commit_id: The SHA of the commit to comment on
:param str path: The relative path of the file to comment on
:param int position: The ... | [
"Create",
"a",
"review",
"comment",
"on",
"this",
"pull",
"request",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/pulls.py#L222-L238 | train |
kislyuk/aegea | aegea/packages/github3/pulls.py | PullRequest.diff | def diff(self):
"""Return the diff"""
resp = self._get(self._api,
headers={'Accept': 'application/vnd.github.diff'})
return resp.content if self._boolean(resp, 200, 404) else None | python | def diff(self):
"""Return the diff"""
resp = self._get(self._api,
headers={'Accept': 'application/vnd.github.diff'})
return resp.content if self._boolean(resp, 200, 404) else None | [
"def",
"diff",
"(",
"self",
")",
":",
"resp",
"=",
"self",
".",
"_get",
"(",
"self",
".",
"_api",
",",
"headers",
"=",
"{",
"'Accept'",
":",
"'application/vnd.github.diff'",
"}",
")",
"return",
"resp",
".",
"content",
"if",
"self",
".",
"_boolean",
"("... | Return the diff | [
"Return",
"the",
"diff"
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/pulls.py#L240-L244 | train |
kislyuk/aegea | aegea/packages/github3/pulls.py | PullRequest.is_merged | def is_merged(self):
"""Checks to see if the pull request was merged.
:returns: bool
"""
url = self._build_url('merge', base_url=self._api)
return self._boolean(self._get(url), 204, 404) | python | def is_merged(self):
"""Checks to see if the pull request was merged.
:returns: bool
"""
url = self._build_url('merge', base_url=self._api)
return self._boolean(self._get(url), 204, 404) | [
"def",
"is_merged",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'merge'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_boolean",
"(",
"self",
".",
"_get",
"(",
"url",
")",
",",
"204",
",",
"404",
... | Checks to see if the pull request was merged.
:returns: bool | [
"Checks",
"to",
"see",
"if",
"the",
"pull",
"request",
"was",
"merged",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/pulls.py#L246-L252 | train |
kislyuk/aegea | aegea/packages/github3/pulls.py | PullRequest.iter_comments | def iter_comments(self, number=-1, etag=None):
"""Iterate over the comments on this pull request.
:param int number: (optional), number of comments to return. Default:
-1 returns all available comments.
:param str etag: (optional), ETag from a previous request to the same
... | python | def iter_comments(self, number=-1, etag=None):
"""Iterate over the comments on this pull request.
:param int number: (optional), number of comments to return. Default:
-1 returns all available comments.
:param str etag: (optional), ETag from a previous request to the same
... | [
"def",
"iter_comments",
"(",
"self",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'comments'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_iter",
"(",
"i... | Iterate over the comments on this pull request.
:param int number: (optional), number of comments to return. Default:
-1 returns all available comments.
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`ReviewCo... | [
"Iterate",
"over",
"the",
"comments",
"on",
"this",
"pull",
"request",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/pulls.py#L254-L264 | train |
kislyuk/aegea | aegea/packages/github3/pulls.py | PullRequest.iter_files | def iter_files(self, number=-1, etag=None):
"""Iterate over the files associated with this pull request.
:param int number: (optional), number of files to return. Default:
-1 returns all available files.
:param str etag: (optional), ETag from a previous request to the same
... | python | def iter_files(self, number=-1, etag=None):
"""Iterate over the files associated with this pull request.
:param int number: (optional), number of files to return. Default:
-1 returns all available files.
:param str etag: (optional), ETag from a previous request to the same
... | [
"def",
"iter_files",
"(",
"self",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'files'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_iter",
"(",
"int",
... | Iterate over the files associated with this pull request.
:param int number: (optional), number of files to return. Default:
-1 returns all available files.
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`Pull... | [
"Iterate",
"over",
"the",
"files",
"associated",
"with",
"this",
"pull",
"request",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/pulls.py#L278-L288 | train |
kislyuk/aegea | aegea/packages/github3/pulls.py | PullRequest.iter_issue_comments | def iter_issue_comments(self, number=-1, etag=None):
"""Iterate over the issue comments on this pull request.
:param int number: (optional), number of comments to return. Default:
-1 returns all available comments.
:param str etag: (optional), ETag from a previous request to the sam... | python | def iter_issue_comments(self, number=-1, etag=None):
"""Iterate over the issue comments on this pull request.
:param int number: (optional), number of comments to return. Default:
-1 returns all available comments.
:param str etag: (optional), ETag from a previous request to the sam... | [
"def",
"iter_issue_comments",
"(",
"self",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"base_url",
"=",
"self",
".",
"links",
"[",
"'comments'",
"]",
")",
"return",
"self",
".",
"_iter... | Iterate over the issue comments on this pull request.
:param int number: (optional), number of comments to return. Default:
-1 returns all available comments.
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`Is... | [
"Iterate",
"over",
"the",
"issue",
"comments",
"on",
"this",
"pull",
"request",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/pulls.py#L290-L300 | train |
kislyuk/aegea | aegea/packages/github3/pulls.py | PullRequest.merge | def merge(self, commit_message='', sha=None):
"""Merge this pull request.
:param str commit_message: (optional), message to be used for the
merge commit
:returns: bool
"""
parameters = {'commit_message': commit_message}
if sha:
parameters['sha'] =... | python | def merge(self, commit_message='', sha=None):
"""Merge this pull request.
:param str commit_message: (optional), message to be used for the
merge commit
:returns: bool
"""
parameters = {'commit_message': commit_message}
if sha:
parameters['sha'] =... | [
"def",
"merge",
"(",
"self",
",",
"commit_message",
"=",
"''",
",",
"sha",
"=",
"None",
")",
":",
"parameters",
"=",
"{",
"'commit_message'",
":",
"commit_message",
"}",
"if",
"sha",
":",
"parameters",
"[",
"'sha'",
"]",
"=",
"sha",
"url",
"=",
"self",... | Merge this pull request.
:param str commit_message: (optional), message to be used for the
merge commit
:returns: bool | [
"Merge",
"this",
"pull",
"request",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/pulls.py#L303-L316 | train |
kislyuk/aegea | aegea/packages/github3/pulls.py | PullRequest.patch | def patch(self):
"""Return the patch"""
resp = self._get(self._api,
headers={'Accept': 'application/vnd.github.patch'})
return resp.content if self._boolean(resp, 200, 404) else None | python | def patch(self):
"""Return the patch"""
resp = self._get(self._api,
headers={'Accept': 'application/vnd.github.patch'})
return resp.content if self._boolean(resp, 200, 404) else None | [
"def",
"patch",
"(",
"self",
")",
":",
"resp",
"=",
"self",
".",
"_get",
"(",
"self",
".",
"_api",
",",
"headers",
"=",
"{",
"'Accept'",
":",
"'application/vnd.github.patch'",
"}",
")",
"return",
"resp",
".",
"content",
"if",
"self",
".",
"_boolean",
"... | Return the patch | [
"Return",
"the",
"patch"
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/pulls.py#L318-L322 | train |
kislyuk/aegea | aegea/packages/github3/pulls.py | PullRequest.update | def update(self, title=None, body=None, state=None):
"""Update this pull request.
:param str title: (optional), title of the pull
:param str body: (optional), body of the pull request
:param str state: (optional), ('open', 'closed')
:returns: bool
"""
data = {'ti... | python | def update(self, title=None, body=None, state=None):
"""Update this pull request.
:param str title: (optional), title of the pull
:param str body: (optional), body of the pull request
:param str state: (optional), ('open', 'closed')
:returns: bool
"""
data = {'ti... | [
"def",
"update",
"(",
"self",
",",
"title",
"=",
"None",
",",
"body",
"=",
"None",
",",
"state",
"=",
"None",
")",
":",
"data",
"=",
"{",
"'title'",
":",
"title",
",",
"'body'",
":",
"body",
",",
"'state'",
":",
"state",
"}",
"json",
"=",
"None",... | Update this pull request.
:param str title: (optional), title of the pull
:param str body: (optional), body of the pull request
:param str state: (optional), ('open', 'closed')
:returns: bool | [
"Update",
"this",
"pull",
"request",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/pulls.py#L344-L362 | train |
kislyuk/aegea | aegea/packages/github3/pulls.py | ReviewComment.reply | def reply(self, body):
"""Reply to this review comment with a new review comment.
:param str body: The text of the comment.
:returns: The created review comment.
:rtype: :class:`~github3.pulls.ReviewComment`
"""
url = self._build_url('comments', base_url=self.pull_reques... | python | def reply(self, body):
"""Reply to this review comment with a new review comment.
:param str body: The text of the comment.
:returns: The created review comment.
:rtype: :class:`~github3.pulls.ReviewComment`
"""
url = self._build_url('comments', base_url=self.pull_reques... | [
"def",
"reply",
"(",
"self",
",",
"body",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'comments'",
",",
"base_url",
"=",
"self",
".",
"pull_request_url",
")",
"index",
"=",
"self",
".",
"_api",
".",
"rfind",
"(",
"'/'",
")",
"+",
"1",
"i... | Reply to this review comment with a new review comment.
:param str body: The text of the comment.
:returns: The created review comment.
:rtype: :class:`~github3.pulls.ReviewComment` | [
"Reply",
"to",
"this",
"review",
"comment",
"with",
"a",
"new",
"review",
"comment",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/pulls.py#L414-L427 | train |
kislyuk/aegea | aegea/packages/github3/orgs.py | Team.add_member | def add_member(self, login):
"""Add ``login`` to this team.
:returns: bool
"""
warnings.warn(
'This is no longer supported by the GitHub API, see '
'https://developer.github.com/changes/2014-09-23-one-more-week'
'-before-the-add-team-member-api-breaki... | python | def add_member(self, login):
"""Add ``login`` to this team.
:returns: bool
"""
warnings.warn(
'This is no longer supported by the GitHub API, see '
'https://developer.github.com/changes/2014-09-23-one-more-week'
'-before-the-add-team-member-api-breaki... | [
"def",
"add_member",
"(",
"self",
",",
"login",
")",
":",
"warnings",
".",
"warn",
"(",
"'This is no longer supported by the GitHub API, see '",
"'https://developer.github.com/changes/2014-09-23-one-more-week'",
"'-before-the-add-team-member-api-breaking-change/'",
",",
"DeprecationW... | Add ``login`` to this team.
:returns: bool | [
"Add",
"login",
"to",
"this",
"team",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L66-L77 | train |
kislyuk/aegea | aegea/packages/github3/orgs.py | Team.add_repo | def add_repo(self, repo):
"""Add ``repo`` to this team.
:param str repo: (required), form: 'user/repo'
:returns: bool
"""
url = self._build_url('repos', repo, base_url=self._api)
return self._boolean(self._put(url), 204, 404) | python | def add_repo(self, repo):
"""Add ``repo`` to this team.
:param str repo: (required), form: 'user/repo'
:returns: bool
"""
url = self._build_url('repos', repo, base_url=self._api)
return self._boolean(self._put(url), 204, 404) | [
"def",
"add_repo",
"(",
"self",
",",
"repo",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'repos'",
",",
"repo",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_boolean",
"(",
"self",
".",
"_put",
"(",
"url",
")",... | Add ``repo`` to this team.
:param str repo: (required), form: 'user/repo'
:returns: bool | [
"Add",
"repo",
"to",
"this",
"team",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L80-L87 | train |
kislyuk/aegea | aegea/packages/github3/orgs.py | Team.edit | def edit(self, name, permission=''):
"""Edit this team.
:param str name: (required)
:param str permission: (optional), ('pull', 'push', 'admin')
:returns: bool
"""
if name:
data = {'name': name, 'permission': permission}
json = self._json(self._pa... | python | def edit(self, name, permission=''):
"""Edit this team.
:param str name: (required)
:param str permission: (optional), ('pull', 'push', 'admin')
:returns: bool
"""
if name:
data = {'name': name, 'permission': permission}
json = self._json(self._pa... | [
"def",
"edit",
"(",
"self",
",",
"name",
",",
"permission",
"=",
"''",
")",
":",
"if",
"name",
":",
"data",
"=",
"{",
"'name'",
":",
"name",
",",
"'permission'",
":",
"permission",
"}",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_patch",... | Edit this team.
:param str name: (required)
:param str permission: (optional), ('pull', 'push', 'admin')
:returns: bool | [
"Edit",
"this",
"team",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L98-L111 | train |
kislyuk/aegea | aegea/packages/github3/orgs.py | Team.has_repo | def has_repo(self, repo):
"""Checks if this team has access to ``repo``
:param str repo: (required), form: 'user/repo'
:returns: bool
"""
url = self._build_url('repos', repo, base_url=self._api)
return self._boolean(self._get(url), 204, 404) | python | def has_repo(self, repo):
"""Checks if this team has access to ``repo``
:param str repo: (required), form: 'user/repo'
:returns: bool
"""
url = self._build_url('repos', repo, base_url=self._api)
return self._boolean(self._get(url), 204, 404) | [
"def",
"has_repo",
"(",
"self",
",",
"repo",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'repos'",
",",
"repo",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_boolean",
"(",
"self",
".",
"_get",
"(",
"url",
")",... | Checks if this team has access to ``repo``
:param str repo: (required), form: 'user/repo'
:returns: bool | [
"Checks",
"if",
"this",
"team",
"has",
"access",
"to",
"repo"
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L113-L120 | train |
kislyuk/aegea | aegea/packages/github3/orgs.py | Team.invite | def invite(self, username):
"""Invite the user to join this team.
This returns a dictionary like so::
{'state': 'pending', 'url': 'https://api.github.com/teams/...'}
:param str username: (required), user to invite to join this team.
:returns: dictionary
"""
... | python | def invite(self, username):
"""Invite the user to join this team.
This returns a dictionary like so::
{'state': 'pending', 'url': 'https://api.github.com/teams/...'}
:param str username: (required), user to invite to join this team.
:returns: dictionary
"""
... | [
"def",
"invite",
"(",
"self",
",",
"username",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'memberships'",
",",
"username",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_json",
"(",
"self",
".",
"_put",
"(",
"url... | Invite the user to join this team.
This returns a dictionary like so::
{'state': 'pending', 'url': 'https://api.github.com/teams/...'}
:param str username: (required), user to invite to join this team.
:returns: dictionary | [
"Invite",
"the",
"user",
"to",
"join",
"this",
"team",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L123-L134 | train |
kislyuk/aegea | aegea/packages/github3/orgs.py | Team.membership_for | def membership_for(self, username):
"""Retrieve the membership information for the user.
:param str username: (required), name of the user
:returns: dictionary
"""
url = self._build_url('memberships', username, base_url=self._api)
json = self._json(self._get(url), 200)
... | python | def membership_for(self, username):
"""Retrieve the membership information for the user.
:param str username: (required), name of the user
:returns: dictionary
"""
url = self._build_url('memberships', username, base_url=self._api)
json = self._json(self._get(url), 200)
... | [
"def",
"membership_for",
"(",
"self",
",",
"username",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'memberships'",
",",
"username",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"json",
"=",
"self",
".",
"_json",
"(",
"self",
".",
"_get",
... | Retrieve the membership information for the user.
:param str username: (required), name of the user
:returns: dictionary | [
"Retrieve",
"the",
"membership",
"information",
"for",
"the",
"user",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L171-L179 | train |
kislyuk/aegea | aegea/packages/github3/orgs.py | Team.remove_member | def remove_member(self, login):
"""Remove ``login`` from this team.
:param str login: (required), login of the member to remove
:returns: bool
"""
warnings.warn(
'This is no longer supported by the GitHub API, see '
'https://developer.github.com/changes/2... | python | def remove_member(self, login):
"""Remove ``login`` from this team.
:param str login: (required), login of the member to remove
:returns: bool
"""
warnings.warn(
'This is no longer supported by the GitHub API, see '
'https://developer.github.com/changes/2... | [
"def",
"remove_member",
"(",
"self",
",",
"login",
")",
":",
"warnings",
".",
"warn",
"(",
"'This is no longer supported by the GitHub API, see '",
"'https://developer.github.com/changes/2014-09-23-one-more-week'",
"'-before-the-add-team-member-api-breaking-change/'",
",",
"Deprecati... | Remove ``login`` from this team.
:param str login: (required), login of the member to remove
:returns: bool | [
"Remove",
"login",
"from",
"this",
"team",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L182-L194 | train |
kislyuk/aegea | aegea/packages/github3/orgs.py | Team.revoke_membership | def revoke_membership(self, username):
"""Revoke this user's team membership.
:param str username: (required), name of the team member
:returns: bool
"""
url = self._build_url('memberships', username, base_url=self._api)
return self._boolean(self._delete(url), 204, 404) | python | def revoke_membership(self, username):
"""Revoke this user's team membership.
:param str username: (required), name of the team member
:returns: bool
"""
url = self._build_url('memberships', username, base_url=self._api)
return self._boolean(self._delete(url), 204, 404) | [
"def",
"revoke_membership",
"(",
"self",
",",
"username",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'memberships'",
",",
"username",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_boolean",
"(",
"self",
".",
"_delet... | Revoke this user's team membership.
:param str username: (required), name of the team member
:returns: bool | [
"Revoke",
"this",
"user",
"s",
"team",
"membership",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L197-L204 | train |
kislyuk/aegea | aegea/packages/github3/orgs.py | Team.remove_repo | def remove_repo(self, repo):
"""Remove ``repo`` from this team.
:param str repo: (required), form: 'user/repo'
:returns: bool
"""
url = self._build_url('repos', repo, base_url=self._api)
return self._boolean(self._delete(url), 204, 404) | python | def remove_repo(self, repo):
"""Remove ``repo`` from this team.
:param str repo: (required), form: 'user/repo'
:returns: bool
"""
url = self._build_url('repos', repo, base_url=self._api)
return self._boolean(self._delete(url), 204, 404) | [
"def",
"remove_repo",
"(",
"self",
",",
"repo",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'repos'",
",",
"repo",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_boolean",
"(",
"self",
".",
"_delete",
"(",
"url",
... | Remove ``repo`` from this team.
:param str repo: (required), form: 'user/repo'
:returns: bool | [
"Remove",
"repo",
"from",
"this",
"team",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L207-L214 | train |
kislyuk/aegea | aegea/packages/github3/orgs.py | Organization.add_member | def add_member(self, login, team):
"""Add ``login`` to ``team`` and thereby to this organization.
.. warning::
This method is no longer valid. To add a member to a team, you
must now retrieve the team directly, and use the ``invite``
method.
Any user that is... | python | def add_member(self, login, team):
"""Add ``login`` to ``team`` and thereby to this organization.
.. warning::
This method is no longer valid. To add a member to a team, you
must now retrieve the team directly, and use the ``invite``
method.
Any user that is... | [
"def",
"add_member",
"(",
"self",
",",
"login",
",",
"team",
")",
":",
"warnings",
".",
"warn",
"(",
"'This is no longer supported by the GitHub API, see '",
"'https://developer.github.com/changes/2014-09-23-one-more-week'",
"'-before-the-add-team-member-api-breaking-change/'",
","... | Add ``login`` to ``team`` and thereby to this organization.
.. warning::
This method is no longer valid. To add a member to a team, you
must now retrieve the team directly, and use the ``invite``
method.
Any user that is to be added to an organization, must be added... | [
"Add",
"login",
"to",
"team",
"and",
"thereby",
"to",
"this",
"organization",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L256-L286 | train |
kislyuk/aegea | aegea/packages/github3/orgs.py | Organization.add_repo | def add_repo(self, repo, team):
"""Add ``repo`` to ``team``.
.. note::
This method is of complexity O(n). This iterates over all teams in
your organization and only adds the repo when the team name
matches the team parameter above. If you want constant time, you
... | python | def add_repo(self, repo, team):
"""Add ``repo`` to ``team``.
.. note::
This method is of complexity O(n). This iterates over all teams in
your organization and only adds the repo when the team name
matches the team parameter above. If you want constant time, you
... | [
"def",
"add_repo",
"(",
"self",
",",
"repo",
",",
"team",
")",
":",
"for",
"t",
"in",
"self",
".",
"iter_teams",
"(",
")",
":",
"if",
"team",
"==",
"t",
".",
"name",
":",
"return",
"t",
".",
"add_repo",
"(",
"repo",
")",
"return",
"False"
] | Add ``repo`` to ``team``.
.. note::
This method is of complexity O(n). This iterates over all teams in
your organization and only adds the repo when the team name
matches the team parameter above. If you want constant time, you
should retrieve the team and call `... | [
"Add",
"repo",
"to",
"team",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L289-L305 | train |
kislyuk/aegea | aegea/packages/github3/orgs.py | Organization.create_repo | def create_repo(self,
name,
description='',
homepage='',
private=False,
has_issues=True,
has_wiki=True,
has_downloads=True,
team_id=0,
auto_... | python | def create_repo(self,
name,
description='',
homepage='',
private=False,
has_issues=True,
has_wiki=True,
has_downloads=True,
team_id=0,
auto_... | [
"def",
"create_repo",
"(",
"self",
",",
"name",
",",
"description",
"=",
"''",
",",
"homepage",
"=",
"''",
",",
"private",
"=",
"False",
",",
"has_issues",
"=",
"True",
",",
"has_wiki",
"=",
"True",
",",
"has_downloads",
"=",
"True",
",",
"team_id",
"=... | Create a repository for this organization if the authenticated user
is a member.
:param str name: (required), name of the repository
:param str description: (optional)
:param str homepage: (optional)
:param bool private: (optional), If ``True``, create a private
repo... | [
"Create",
"a",
"repository",
"for",
"this",
"organization",
"if",
"the",
"authenticated",
"user",
"is",
"a",
"member",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L308-L351 | train |
kislyuk/aegea | aegea/packages/github3/orgs.py | Organization.conceal_member | def conceal_member(self, login):
"""Conceal ``login``'s membership in this organization.
:returns: bool
"""
url = self._build_url('public_members', login, base_url=self._api)
return self._boolean(self._delete(url), 204, 404) | python | def conceal_member(self, login):
"""Conceal ``login``'s membership in this organization.
:returns: bool
"""
url = self._build_url('public_members', login, base_url=self._api)
return self._boolean(self._delete(url), 204, 404) | [
"def",
"conceal_member",
"(",
"self",
",",
"login",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'public_members'",
",",
"login",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_boolean",
"(",
"self",
".",
"_delete",
... | Conceal ``login``'s membership in this organization.
:returns: bool | [
"Conceal",
"login",
"s",
"membership",
"in",
"this",
"organization",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L354-L360 | train |
kislyuk/aegea | aegea/packages/github3/orgs.py | Organization.create_team | def create_team(self, name, repo_names=[], permission=''):
"""Assuming the authenticated user owns this organization,
create and return a new team.
:param str name: (required), name to be given to the team
:param list repo_names: (optional) repositories, e.g.
['github/dotfil... | python | def create_team(self, name, repo_names=[], permission=''):
"""Assuming the authenticated user owns this organization,
create and return a new team.
:param str name: (required), name to be given to the team
:param list repo_names: (optional) repositories, e.g.
['github/dotfil... | [
"def",
"create_team",
"(",
"self",
",",
"name",
",",
"repo_names",
"=",
"[",
"]",
",",
"permission",
"=",
"''",
")",
":",
"data",
"=",
"{",
"'name'",
":",
"name",
",",
"'repo_names'",
":",
"repo_names",
",",
"'permission'",
":",
"permission",
"}",
"url... | Assuming the authenticated user owns this organization,
create and return a new team.
:param str name: (required), name to be given to the team
:param list repo_names: (optional) repositories, e.g.
['github/dotfiles']
:param str permission: (optional), options:
... | [
"Assuming",
"the",
"authenticated",
"user",
"owns",
"this",
"organization",
"create",
"and",
"return",
"a",
"new",
"team",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L363-L385 | train |
kislyuk/aegea | aegea/packages/github3/orgs.py | Organization.edit | def edit(self,
billing_email=None,
company=None,
email=None,
location=None,
name=None):
"""Edit this organization.
:param str billing_email: (optional) Billing email address (private)
:param str company: (optional)
:param ... | python | def edit(self,
billing_email=None,
company=None,
email=None,
location=None,
name=None):
"""Edit this organization.
:param str billing_email: (optional) Billing email address (private)
:param str company: (optional)
:param ... | [
"def",
"edit",
"(",
"self",
",",
"billing_email",
"=",
"None",
",",
"company",
"=",
"None",
",",
"email",
"=",
"None",
",",
"location",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"json",
"=",
"None",
"data",
"=",
"{",
"'billing_email'",
":",
... | Edit this organization.
:param str billing_email: (optional) Billing email address (private)
:param str company: (optional)
:param str email: (optional) Public email address
:param str location: (optional)
:param str name: (optional)
:returns: bool | [
"Edit",
"this",
"organization",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L388-L414 | train |
kislyuk/aegea | aegea/packages/github3/orgs.py | Organization.is_public_member | def is_public_member(self, login):
"""Check if the user with login ``login`` is a public member.
:returns: bool
"""
url = self._build_url('public_members', login, base_url=self._api)
return self._boolean(self._get(url), 204, 404) | python | def is_public_member(self, login):
"""Check if the user with login ``login`` is a public member.
:returns: bool
"""
url = self._build_url('public_members', login, base_url=self._api)
return self._boolean(self._get(url), 204, 404) | [
"def",
"is_public_member",
"(",
"self",
",",
"login",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'public_members'",
",",
"login",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_boolean",
"(",
"self",
".",
"_get",
"... | Check if the user with login ``login`` is a public member.
:returns: bool | [
"Check",
"if",
"the",
"user",
"with",
"login",
"login",
"is",
"a",
"public",
"member",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L424-L430 | train |
kislyuk/aegea | aegea/packages/github3/orgs.py | Organization.iter_repos | def iter_repos(self, type='', number=-1, etag=None):
"""Iterate over repos for this organization.
:param str type: (optional), accepted values:
('all', 'public', 'member', 'private', 'forks', 'sources'), API
default: 'all'
:param int number: (optional), number of members... | python | def iter_repos(self, type='', number=-1, etag=None):
"""Iterate over repos for this organization.
:param str type: (optional), accepted values:
('all', 'public', 'member', 'private', 'forks', 'sources'), API
default: 'all'
:param int number: (optional), number of members... | [
"def",
"iter_repos",
"(",
"self",
",",
"type",
"=",
"''",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'repos'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"params",
"=",
"{",... | Iterate over repos for this organization.
:param str type: (optional), accepted values:
('all', 'public', 'member', 'private', 'forks', 'sources'), API
default: 'all'
:param int number: (optional), number of members to return. Default:
-1 will return all available.
... | [
"Iterate",
"over",
"repos",
"for",
"this",
"organization",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L468-L484 | train |
kislyuk/aegea | aegea/packages/github3/orgs.py | Organization.iter_teams | def iter_teams(self, number=-1, etag=None):
"""Iterate over teams that are part of this organization.
:param int number: (optional), number of teams to return. Default: -1
returns all available teams.
:param str etag: (optional), ETag from a previous request to the same
... | python | def iter_teams(self, number=-1, etag=None):
"""Iterate over teams that are part of this organization.
:param int number: (optional), number of teams to return. Default: -1
returns all available teams.
:param str etag: (optional), ETag from a previous request to the same
... | [
"def",
"iter_teams",
"(",
"self",
",",
"number",
"=",
"-",
"1",
",",
"etag",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'teams'",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_iter",
"(",
"int",
... | Iterate over teams that are part of this organization.
:param int number: (optional), number of teams to return. Default: -1
returns all available teams.
:param str etag: (optional), ETag from a previous request to the same
endpoint
:returns: generator of :class:`Team <T... | [
"Iterate",
"over",
"teams",
"that",
"are",
"part",
"of",
"this",
"organization",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L487-L497 | train |
kislyuk/aegea | aegea/packages/github3/orgs.py | Organization.publicize_member | def publicize_member(self, login):
"""Make ``login``'s membership in this organization public.
:returns: bool
"""
url = self._build_url('public_members', login, base_url=self._api)
return self._boolean(self._put(url), 204, 404) | python | def publicize_member(self, login):
"""Make ``login``'s membership in this organization public.
:returns: bool
"""
url = self._build_url('public_members', login, base_url=self._api)
return self._boolean(self._put(url), 204, 404) | [
"def",
"publicize_member",
"(",
"self",
",",
"login",
")",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'public_members'",
",",
"login",
",",
"base_url",
"=",
"self",
".",
"_api",
")",
"return",
"self",
".",
"_boolean",
"(",
"self",
".",
"_put",
"... | Make ``login``'s membership in this organization public.
:returns: bool | [
"Make",
"login",
"s",
"membership",
"in",
"this",
"organization",
"public",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L500-L506 | train |
kislyuk/aegea | aegea/packages/github3/orgs.py | Organization.remove_repo | def remove_repo(self, repo, team):
"""Remove ``repo`` from ``team``.
:param str repo: (required), form: 'user/repo'
:param str team: (required)
:returns: bool
"""
for t in self.iter_teams():
if team == t.name:
return t.remove_repo(repo)
... | python | def remove_repo(self, repo, team):
"""Remove ``repo`` from ``team``.
:param str repo: (required), form: 'user/repo'
:param str team: (required)
:returns: bool
"""
for t in self.iter_teams():
if team == t.name:
return t.remove_repo(repo)
... | [
"def",
"remove_repo",
"(",
"self",
",",
"repo",
",",
"team",
")",
":",
"for",
"t",
"in",
"self",
".",
"iter_teams",
"(",
")",
":",
"if",
"team",
"==",
"t",
".",
"name",
":",
"return",
"t",
".",
"remove_repo",
"(",
"repo",
")",
"return",
"False"
] | Remove ``repo`` from ``team``.
:param str repo: (required), form: 'user/repo'
:param str team: (required)
:returns: bool | [
"Remove",
"repo",
"from",
"team",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L519-L529 | train |
kislyuk/aegea | aegea/packages/github3/orgs.py | Organization.team | def team(self, team_id):
"""Returns Team object with information about team specified by
``team_id``.
:param int team_id: (required), unique id for the team
:returns: :class:`Team <Team>`
"""
json = None
if int(team_id) > 0:
url = self._build_url('tea... | python | def team(self, team_id):
"""Returns Team object with information about team specified by
``team_id``.
:param int team_id: (required), unique id for the team
:returns: :class:`Team <Team>`
"""
json = None
if int(team_id) > 0:
url = self._build_url('tea... | [
"def",
"team",
"(",
"self",
",",
"team_id",
")",
":",
"json",
"=",
"None",
"if",
"int",
"(",
"team_id",
")",
">",
"0",
":",
"url",
"=",
"self",
".",
"_build_url",
"(",
"'teams'",
",",
"str",
"(",
"team_id",
")",
")",
"json",
"=",
"self",
".",
"... | Returns Team object with information about team specified by
``team_id``.
:param int team_id: (required), unique id for the team
:returns: :class:`Team <Team>` | [
"Returns",
"Team",
"object",
"with",
"information",
"about",
"team",
"specified",
"by",
"team_id",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L532-L543 | train |
kislyuk/aegea | aegea/packages/github3/orgs.py | Membership.edit | def edit(self, state):
"""Edit the user's membership.
:param str state: (required), the state the membership should be in.
Only accepts ``"active"``.
:returns: itself
"""
if state and state.lower() == 'active':
data = dumps({'state': state.lower()})
... | python | def edit(self, state):
"""Edit the user's membership.
:param str state: (required), the state the membership should be in.
Only accepts ``"active"``.
:returns: itself
"""
if state and state.lower() == 'active':
data = dumps({'state': state.lower()})
... | [
"def",
"edit",
"(",
"self",
",",
"state",
")",
":",
"if",
"state",
"and",
"state",
".",
"lower",
"(",
")",
"==",
"'active'",
":",
"data",
"=",
"dumps",
"(",
"{",
"'state'",
":",
"state",
".",
"lower",
"(",
")",
"}",
")",
"json",
"=",
"self",
".... | Edit the user's membership.
:param str state: (required), the state the membership should be in.
Only accepts ``"active"``.
:returns: itself | [
"Edit",
"the",
"user",
"s",
"membership",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L567-L578 | train |
kislyuk/aegea | aegea/packages/github3/repos/release.py | Release.delete | def delete(self):
"""Users with push access to the repository can delete a release.
:returns: True if successful; False if not successful
"""
url = self._api
return self._boolean(
self._delete(url, headers=Release.CUSTOM_HEADERS),
204,
404
... | python | def delete(self):
"""Users with push access to the repository can delete a release.
:returns: True if successful; False if not successful
"""
url = self._api
return self._boolean(
self._delete(url, headers=Release.CUSTOM_HEADERS),
204,
404
... | [
"def",
"delete",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"_api",
"return",
"self",
".",
"_boolean",
"(",
"self",
".",
"_delete",
"(",
"url",
",",
"headers",
"=",
"Release",
".",
"CUSTOM_HEADERS",
")",
",",
"204",
",",
"404",
")"
] | Users with push access to the repository can delete a release.
:returns: True if successful; False if not successful | [
"Users",
"with",
"push",
"access",
"to",
"the",
"repository",
"can",
"delete",
"a",
"release",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/release.py#L57-L67 | train |
kislyuk/aegea | aegea/packages/github3/repos/release.py | Release.edit | def edit(self, tag_name=None, target_commitish=None, name=None, body=None,
draft=None, prerelease=None):
"""Users with push access to the repository can edit a release.
If the edit is successful, this object will update itself.
:param str tag_name: (optional), Name of the tag to u... | python | def edit(self, tag_name=None, target_commitish=None, name=None, body=None,
draft=None, prerelease=None):
"""Users with push access to the repository can edit a release.
If the edit is successful, this object will update itself.
:param str tag_name: (optional), Name of the tag to u... | [
"def",
"edit",
"(",
"self",
",",
"tag_name",
"=",
"None",
",",
"target_commitish",
"=",
"None",
",",
"name",
"=",
"None",
",",
"body",
"=",
"None",
",",
"draft",
"=",
"None",
",",
"prerelease",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_api"... | Users with push access to the repository can edit a release.
If the edit is successful, this object will update itself.
:param str tag_name: (optional), Name of the tag to use
:param str target_commitish: (optional), The "commitish" value that
determines where the Git tag is create... | [
"Users",
"with",
"push",
"access",
"to",
"the",
"repository",
"can",
"edit",
"a",
"release",
"."
] | 94957e9dba036eae3052e2662c208b259c08399a | https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/repos/release.py#L70-L106 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.