repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
ska-sa/montblanc
montblanc/util/__init__.py
redistribute_threads
def redistribute_threads(blockdimx, blockdimy, blockdimz, dimx, dimy, dimz): """ Redistribute threads from the Z dimension towards the X dimension. Also clamp number of threads to the problem dimension size, if necessary """ # Shift threads from the z dimension # into the y dimension ...
python
def redistribute_threads(blockdimx, blockdimy, blockdimz, dimx, dimy, dimz): """ Redistribute threads from the Z dimension towards the X dimension. Also clamp number of threads to the problem dimension size, if necessary """ # Shift threads from the z dimension # into the y dimension ...
[ "def", "redistribute_threads", "(", "blockdimx", ",", "blockdimy", ",", "blockdimz", ",", "dimx", ",", "dimy", ",", "dimz", ")", ":", "# Shift threads from the z dimension", "# into the y dimension", "while", "blockdimz", ">", "dimz", ":", "tmp", "=", "blockdimz", ...
Redistribute threads from the Z dimension towards the X dimension. Also clamp number of threads to the problem dimension size, if necessary
[ "Redistribute", "threads", "from", "the", "Z", "dimension", "towards", "the", "X", "dimension", ".", "Also", "clamp", "number", "of", "threads", "to", "the", "problem", "dimension", "size", "if", "necessary" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/util/__init__.py#L387-L426
ska-sa/montblanc
montblanc/util/__init__.py
register_default_dimensions
def register_default_dimensions(cube, slvr_cfg): """ Register the default dimensions for a RIME solver """ import montblanc.src_types as mbs # Pull out the configuration options for the basics autocor = slvr_cfg['auto_correlations'] ntime = 10 na = 7 nbands = 1 nchan = 16 npol = 4...
python
def register_default_dimensions(cube, slvr_cfg): """ Register the default dimensions for a RIME solver """ import montblanc.src_types as mbs # Pull out the configuration options for the basics autocor = slvr_cfg['auto_correlations'] ntime = 10 na = 7 nbands = 1 nchan = 16 npol = 4...
[ "def", "register_default_dimensions", "(", "cube", ",", "slvr_cfg", ")", ":", "import", "montblanc", ".", "src_types", "as", "mbs", "# Pull out the configuration options for the basics", "autocor", "=", "slvr_cfg", "[", "'auto_correlations'", "]", "ntime", "=", "10", ...
Register the default dimensions for a RIME solver
[ "Register", "the", "default", "dimensions", "for", "a", "RIME", "solver" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/util/__init__.py#L429-L482
ska-sa/montblanc
montblanc/impl/rime/tensorflow/helpers/cluster_gen.py
get_ip_address
def get_ip_address(ifname): """ Hack to get IP address from the interface """ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) return socket.inet_ntoa(fcntl.ioctl( s.fileno(), 0x8915, # SIOCGIFADDR struct.pack('256s', ifname[:15]) )[20:24])
python
def get_ip_address(ifname): """ Hack to get IP address from the interface """ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) return socket.inet_ntoa(fcntl.ioctl( s.fileno(), 0x8915, # SIOCGIFADDR struct.pack('256s', ifname[:15]) )[20:24])
[ "def", "get_ip_address", "(", "ifname", ")", ":", "s", "=", "socket", ".", "socket", "(", "socket", ".", "AF_INET", ",", "socket", ".", "SOCK_DGRAM", ")", "return", "socket", ".", "inet_ntoa", "(", "fcntl", ".", "ioctl", "(", "s", ".", "fileno", "(", ...
Hack to get IP address from the interface
[ "Hack", "to", "get", "IP", "address", "from", "the", "interface" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/helpers/cluster_gen.py#L26-L34
ska-sa/montblanc
install/cuda.py
nvcc_compiler_settings
def nvcc_compiler_settings(): """ Find nvcc and the CUDA installation """ search_paths = os.environ.get('PATH', '').split(os.pathsep) nvcc_path = find_in_path('nvcc', search_paths) default_cuda_path = os.path.join('usr', 'local', 'cuda') cuda_path = os.environ.get('CUDA_PATH', default_cuda_path) ...
python
def nvcc_compiler_settings(): """ Find nvcc and the CUDA installation """ search_paths = os.environ.get('PATH', '').split(os.pathsep) nvcc_path = find_in_path('nvcc', search_paths) default_cuda_path = os.path.join('usr', 'local', 'cuda') cuda_path = os.environ.get('CUDA_PATH', default_cuda_path) ...
[ "def", "nvcc_compiler_settings", "(", ")", ":", "search_paths", "=", "os", ".", "environ", ".", "get", "(", "'PATH'", ",", "''", ")", ".", "split", "(", "os", ".", "pathsep", ")", "nvcc_path", "=", "find_in_path", "(", "'nvcc'", ",", "search_paths", ")",...
Find nvcc and the CUDA installation
[ "Find", "nvcc", "and", "the", "CUDA", "installation" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/install/cuda.py#L48-L115
ska-sa/montblanc
install/cuda.py
inspect_cuda_version_and_devices
def inspect_cuda_version_and_devices(compiler, settings): """ Poor mans deviceQuery. Returns CUDA_VERSION information and CUDA device information in JSON format """ try: output = build_and_run(compiler, ''' #include <cuda.h> #include <stdio.h> __device__ ...
python
def inspect_cuda_version_and_devices(compiler, settings): """ Poor mans deviceQuery. Returns CUDA_VERSION information and CUDA device information in JSON format """ try: output = build_and_run(compiler, ''' #include <cuda.h> #include <stdio.h> __device__ ...
[ "def", "inspect_cuda_version_and_devices", "(", "compiler", ",", "settings", ")", ":", "try", ":", "output", "=", "build_and_run", "(", "compiler", ",", "'''\n #include <cuda.h>\n #include <stdio.h>\n\n __device__ void test(int * in, int * out)\n ...
Poor mans deviceQuery. Returns CUDA_VERSION information and CUDA device information in JSON format
[ "Poor", "mans", "deviceQuery", ".", "Returns", "CUDA_VERSION", "information", "and", "CUDA", "device", "information", "in", "JSON", "format" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/install/cuda.py#L117-L176
ska-sa/montblanc
install/cuda.py
customize_compiler_for_nvcc
def customize_compiler_for_nvcc(compiler, nvcc_settings): """inject deep into distutils to customize gcc/nvcc dispatch """ # tell the compiler it can process .cu files compiler.src_extensions.append('.cu') # save references to the default compiler_so and _compile methods default_compiler_so = comp...
python
def customize_compiler_for_nvcc(compiler, nvcc_settings): """inject deep into distutils to customize gcc/nvcc dispatch """ # tell the compiler it can process .cu files compiler.src_extensions.append('.cu') # save references to the default compiler_so and _compile methods default_compiler_so = comp...
[ "def", "customize_compiler_for_nvcc", "(", "compiler", ",", "nvcc_settings", ")", ":", "# tell the compiler it can process .cu files", "compiler", ".", "src_extensions", ".", "append", "(", "'.cu'", ")", "# save references to the default compiler_so and _compile methods", "defaul...
inject deep into distutils to customize gcc/nvcc dispatch
[ "inject", "deep", "into", "distutils", "to", "customize", "gcc", "/", "nvcc", "dispatch" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/install/cuda.py#L215-L238
ska-sa/montblanc
install/cuda.py
inspect_cuda
def inspect_cuda(): """ Return cuda device information and nvcc/cuda setup """ nvcc_settings = nvcc_compiler_settings() sysconfig.get_config_vars() nvcc_compiler = ccompiler.new_compiler() sysconfig.customize_compiler(nvcc_compiler) customize_compiler_for_nvcc(nvcc_compiler, nvcc_settings) ...
python
def inspect_cuda(): """ Return cuda device information and nvcc/cuda setup """ nvcc_settings = nvcc_compiler_settings() sysconfig.get_config_vars() nvcc_compiler = ccompiler.new_compiler() sysconfig.customize_compiler(nvcc_compiler) customize_compiler_for_nvcc(nvcc_compiler, nvcc_settings) ...
[ "def", "inspect_cuda", "(", ")", ":", "nvcc_settings", "=", "nvcc_compiler_settings", "(", ")", "sysconfig", ".", "get_config_vars", "(", ")", "nvcc_compiler", "=", "ccompiler", ".", "new_compiler", "(", ")", "sysconfig", ".", "customize_compiler", "(", "nvcc_comp...
Return cuda device information and nvcc/cuda setup
[ "Return", "cuda", "device", "information", "and", "nvcc", "/", "cuda", "setup" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/install/cuda.py#L241-L251
ska-sa/montblanc
montblanc/solvers/rime_solver.py
RIMESolver.template_dict
def template_dict(self): """ Returns a dictionary suitable for templating strings with properties and dimensions related to this Solver object. Used in templated GPU kernels. """ slvr = self D = { # Constants 'LIGHTSPEED': montblanc.const...
python
def template_dict(self): """ Returns a dictionary suitable for templating strings with properties and dimensions related to this Solver object. Used in templated GPU kernels. """ slvr = self D = { # Constants 'LIGHTSPEED': montblanc.const...
[ "def", "template_dict", "(", "self", ")", ":", "slvr", "=", "self", "D", "=", "{", "# Constants", "'LIGHTSPEED'", ":", "montblanc", ".", "constants", ".", "C", ",", "}", "# Map any types", "D", ".", "update", "(", "self", ".", "type_dict", "(", ")", ")...
Returns a dictionary suitable for templating strings with properties and dimensions related to this Solver object. Used in templated GPU kernels.
[ "Returns", "a", "dictionary", "suitable", "for", "templating", "strings", "with", "properties", "and", "dimensions", "related", "to", "this", "Solver", "object", "." ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/solvers/rime_solver.py#L84-L108
ska-sa/montblanc
montblanc/factory.py
rime_solver
def rime_solver(slvr_cfg): """ Factory function that produces a RIME solver """ from montblanc.impl.rime.tensorflow.RimeSolver import RimeSolver return RimeSolver(slvr_cfg)
python
def rime_solver(slvr_cfg): """ Factory function that produces a RIME solver """ from montblanc.impl.rime.tensorflow.RimeSolver import RimeSolver return RimeSolver(slvr_cfg)
[ "def", "rime_solver", "(", "slvr_cfg", ")", ":", "from", "montblanc", ".", "impl", ".", "rime", ".", "tensorflow", ".", "RimeSolver", "import", "RimeSolver", "return", "RimeSolver", "(", "slvr_cfg", ")" ]
Factory function that produces a RIME solver
[ "Factory", "function", "that", "produces", "a", "RIME", "solver" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/factory.py#L21-L24
ska-sa/montblanc
montblanc/impl/rime/tensorflow/sources/source_provider.py
find_sources
def find_sources(obj, argspec=None): """ Returns a dictionary of source methods found on this object, keyed on method name. Source methods are identified.by argspec, a list of argument specifiers. So for e.g. an argpsec of :code:`[['self', 'context'], ['s', 'c']]` would match methods looking lik...
python
def find_sources(obj, argspec=None): """ Returns a dictionary of source methods found on this object, keyed on method name. Source methods are identified.by argspec, a list of argument specifiers. So for e.g. an argpsec of :code:`[['self', 'context'], ['s', 'c']]` would match methods looking lik...
[ "def", "find_sources", "(", "obj", ",", "argspec", "=", "None", ")", ":", "if", "argspec", "is", "None", ":", "argspec", "=", "[", "DEFAULT_ARGSPEC", "]", "return", "{", "n", ":", "m", "for", "n", ",", "m", "in", "inspect", ".", "getmembers", "(", ...
Returns a dictionary of source methods found on this object, keyed on method name. Source methods are identified.by argspec, a list of argument specifiers. So for e.g. an argpsec of :code:`[['self', 'context'], ['s', 'c']]` would match methods looking like: .. code-block:: python def f(sel...
[ "Returns", "a", "dictionary", "of", "source", "methods", "found", "on", "this", "object", "keyed", "on", "method", "name", ".", "Source", "methods", "are", "identified", ".", "by", "argspec", "a", "list", "of", "argument", "specifiers", ".", "So", "for", "...
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/source_provider.py#L59-L92
ska-sa/montblanc
montblanc/impl/rime/tensorflow/sources/source_provider.py
SourceProvider.sources
def sources(self): """ Returns a dictionary of source methods found on this object, keyed on method name. Source methods are identified by (self, context) arguments on this object. For example: .. code-block:: python def f(self, context): ... ...
python
def sources(self): """ Returns a dictionary of source methods found on this object, keyed on method name. Source methods are identified by (self, context) arguments on this object. For example: .. code-block:: python def f(self, context): ... ...
[ "def", "sources", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_sources", "except", "AttributeError", ":", "self", ".", "_sources", "=", "find_sources", "(", "self", ")", "return", "self", ".", "_sources" ]
Returns a dictionary of source methods found on this object, keyed on method name. Source methods are identified by (self, context) arguments on this object. For example: .. code-block:: python def f(self, context): ... is a source method, but ...
[ "Returns", "a", "dictionary", "of", "source", "methods", "found", "on", "this", "object", "keyed", "on", "method", "name", ".", "Source", "methods", "are", "identified", "by", "(", "self", "context", ")", "arguments", "on", "this", "object", ".", "For", "e...
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/source_provider.py#L113-L140
ska-sa/montblanc
montblanc/util/parallactic_angles.py
parallactic_angles
def parallactic_angles(times, antenna_positions, field_centre): """ Computes parallactic angles per timestep for the given reference antenna position and field centre. Arguments: times: ndarray Array of unique times with shape (ntime,), obtained from TIME column of MS ta...
python
def parallactic_angles(times, antenna_positions, field_centre): """ Computes parallactic angles per timestep for the given reference antenna position and field centre. Arguments: times: ndarray Array of unique times with shape (ntime,), obtained from TIME column of MS ta...
[ "def", "parallactic_angles", "(", "times", ",", "antenna_positions", ",", "field_centre", ")", ":", "import", "pyrap", ".", "quanta", "as", "pq", "try", ":", "# Create direction measure for the zenith", "zenith", "=", "pm", ".", "direction", "(", "'AZEL'", ",", ...
Computes parallactic angles per timestep for the given reference antenna position and field centre. Arguments: times: ndarray Array of unique times with shape (ntime,), obtained from TIME column of MS table antenna_positions: ndarray of shape (na, 3) Antenna ...
[ "Computes", "parallactic", "angles", "per", "timestep", "for", "the", "given", "reference", "antenna", "position", "and", "field", "centre", "." ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/util/parallactic_angles.py#L34-L83
ska-sa/montblanc
montblanc/logsetup.py
setup_logging
def setup_logging(): """ Setup logging configuration """ # Console formatter, mention name cfmt = logging.Formatter(('%(name)s - %(levelname)s - %(message)s')) # File formatter, mention time ffmt = logging.Formatter(('%(asctime)s - %(levelname)s - %(message)s')) # Console handler ch = log...
python
def setup_logging(): """ Setup logging configuration """ # Console formatter, mention name cfmt = logging.Formatter(('%(name)s - %(levelname)s - %(message)s')) # File formatter, mention time ffmt = logging.Formatter(('%(asctime)s - %(levelname)s - %(message)s')) # Console handler ch = log...
[ "def", "setup_logging", "(", ")", ":", "# Console formatter, mention name", "cfmt", "=", "logging", ".", "Formatter", "(", "(", "'%(name)s - %(levelname)s - %(message)s'", ")", ")", "# File formatter, mention time", "ffmt", "=", "logging", ".", "Formatter", "(", "(", ...
Setup logging configuration
[ "Setup", "logging", "configuration" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/logsetup.py#L24-L58
ska-sa/montblanc
montblanc/impl/rime/tensorflow/sources/defaults_source_provider.py
constant_cache
def constant_cache(method): """ Caches constant arrays associated with an array name. The intent of this decorator is to avoid the cost of recreating and storing many arrays of constant data, especially data created by np.zeros or np.ones. Instead, a single array of the first given shape is cre...
python
def constant_cache(method): """ Caches constant arrays associated with an array name. The intent of this decorator is to avoid the cost of recreating and storing many arrays of constant data, especially data created by np.zeros or np.ones. Instead, a single array of the first given shape is cre...
[ "def", "constant_cache", "(", "method", ")", ":", "@", "functools", ".", "wraps", "(", "method", ")", "def", "wrapper", "(", "self", ",", "context", ")", ":", "# Defer to method if no caching is enabled", "if", "not", "self", ".", "_is_cached", ":", "return", ...
Caches constant arrays associated with an array name. The intent of this decorator is to avoid the cost of recreating and storing many arrays of constant data, especially data created by np.zeros or np.ones. Instead, a single array of the first given shape is created and any further requests for co...
[ "Caches", "constant", "arrays", "associated", "with", "an", "array", "name", "." ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/defaults_source_provider.py#L30-L77
ska-sa/montblanc
montblanc/impl/rime/tensorflow/sources/defaults_source_provider.py
chunk_cache
def chunk_cache(method): """ Caches chunks of default data. This decorator caches generated default data so as to avoid recomputing it on a subsequent queries to the provider. """ @functools.wraps(method) def wrapper(self, context): # Defer to the method if no caching is enable...
python
def chunk_cache(method): """ Caches chunks of default data. This decorator caches generated default data so as to avoid recomputing it on a subsequent queries to the provider. """ @functools.wraps(method) def wrapper(self, context): # Defer to the method if no caching is enable...
[ "def", "chunk_cache", "(", "method", ")", ":", "@", "functools", ".", "wraps", "(", "method", ")", "def", "wrapper", "(", "self", ",", "context", ")", ":", "# Defer to the method if no caching is enabled", "if", "not", "self", ".", "_is_cached", ":", "return",...
Caches chunks of default data. This decorator caches generated default data so as to avoid recomputing it on a subsequent queries to the provider.
[ "Caches", "chunks", "of", "default", "data", "." ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/defaults_source_provider.py#L79-L109
ska-sa/montblanc
montblanc/impl/rime/tensorflow/RimeSolver.py
_create_defaults_source_provider
def _create_defaults_source_provider(cube, data_source): """ Create a DefaultsSourceProvider object. This provides default data sources for each array defined on the hypercube. The data sources may either by obtained from the arrays 'default' data source or the 'test' data source. """ from m...
python
def _create_defaults_source_provider(cube, data_source): """ Create a DefaultsSourceProvider object. This provides default data sources for each array defined on the hypercube. The data sources may either by obtained from the arrays 'default' data source or the 'test' data source. """ from m...
[ "def", "_create_defaults_source_provider", "(", "cube", ",", "data_source", ")", ":", "from", "montblanc", ".", "impl", ".", "rime", ".", "tensorflow", ".", "sources", "import", "(", "find_sources", ",", "DEFAULT_ARGSPEC", ")", "from", "montblanc", ".", "impl", ...
Create a DefaultsSourceProvider object. This provides default data sources for each array defined on the hypercube. The data sources may either by obtained from the arrays 'default' data source or the 'test' data source.
[ "Create", "a", "DefaultsSourceProvider", "object", ".", "This", "provides", "default", "data", "sources", "for", "each", "array", "defined", "on", "the", "hypercube", ".", "The", "data", "sources", "may", "either", "by", "obtained", "from", "the", "arrays", "d...
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/RimeSolver.py#L758-L812
ska-sa/montblanc
montblanc/impl/rime/tensorflow/RimeSolver.py
_construct_tensorflow_expression
def _construct_tensorflow_expression(slvr_cfg, feed_data, device, shard): """ Constructs a tensorflow expression for computing the RIME """ zero = tf.constant(0) src_count = zero src_ph_vars = feed_data.src_ph_vars LSA = feed_data.local polarisation_type = slvr_cfg['polarisation_type'] # ...
python
def _construct_tensorflow_expression(slvr_cfg, feed_data, device, shard): """ Constructs a tensorflow expression for computing the RIME """ zero = tf.constant(0) src_count = zero src_ph_vars = feed_data.src_ph_vars LSA = feed_data.local polarisation_type = slvr_cfg['polarisation_type'] # ...
[ "def", "_construct_tensorflow_expression", "(", "slvr_cfg", ",", "feed_data", ",", "device", ",", "shard", ")", ":", "zero", "=", "tf", ".", "constant", "(", "0", ")", "src_count", "=", "zero", "src_ph_vars", "=", "feed_data", ".", "src_ph_vars", "LSA", "=",...
Constructs a tensorflow expression for computing the RIME
[ "Constructs", "a", "tensorflow", "expression", "for", "computing", "the", "RIME" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/RimeSolver.py#L924-L1104
ska-sa/montblanc
montblanc/impl/rime/tensorflow/RimeSolver.py
_get_data
def _get_data(data_source, context): """ Get data from the data source, checking the return values """ try: # Get data from the data source data = data_source.source(context) # Complain about None values if data is None: raise ValueError("'None' returned from " ...
python
def _get_data(data_source, context): """ Get data from the data source, checking the return values """ try: # Get data from the data source data = data_source.source(context) # Complain about None values if data is None: raise ValueError("'None' returned from " ...
[ "def", "_get_data", "(", "data_source", ",", "context", ")", ":", "try", ":", "# Get data from the data source", "data", "=", "data_source", ".", "source", "(", "context", ")", "# Complain about None values", "if", "data", "is", "None", ":", "raise", "ValueError",...
Get data from the data source, checking the return values
[ "Get", "data", "from", "the", "data", "source", "checking", "the", "return", "values" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/RimeSolver.py#L1106-L1138
ska-sa/montblanc
montblanc/impl/rime/tensorflow/RimeSolver.py
_supply_data
def _supply_data(data_sink, context): """ Supply data to the data sink """ try: data_sink.sink(context) except Exception as e: ex = ValueError("An exception occurred while " "supplying data to data sink '{ds}'\n\n" "{e}\n\n" "{help}".format(ds=context.name...
python
def _supply_data(data_sink, context): """ Supply data to the data sink """ try: data_sink.sink(context) except Exception as e: ex = ValueError("An exception occurred while " "supplying data to data sink '{ds}'\n\n" "{e}\n\n" "{help}".format(ds=context.name...
[ "def", "_supply_data", "(", "data_sink", ",", "context", ")", ":", "try", ":", "data_sink", ".", "sink", "(", "context", ")", "except", "Exception", "as", "e", ":", "ex", "=", "ValueError", "(", "\"An exception occurred while \"", "\"supplying data to data sink '{...
Supply data to the data sink
[ "Supply", "data", "to", "the", "data", "sink" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/RimeSolver.py#L1140-L1151
ska-sa/montblanc
montblanc/impl/rime/tensorflow/RimeSolver.py
_apply_source_provider_dim_updates
def _apply_source_provider_dim_updates(cube, source_providers, budget_dims): """ Given a list of source_providers, apply the list of suggested dimension updates given in provider.updated_dimensions() to the supplied hypercube. Dimension global_sizes are always updated with the supplied sizes and ...
python
def _apply_source_provider_dim_updates(cube, source_providers, budget_dims): """ Given a list of source_providers, apply the list of suggested dimension updates given in provider.updated_dimensions() to the supplied hypercube. Dimension global_sizes are always updated with the supplied sizes and ...
[ "def", "_apply_source_provider_dim_updates", "(", "cube", ",", "source_providers", ",", "budget_dims", ")", ":", "# Create a mapping between a dimension and a", "# list of (global_size, provider_name) tuples", "update_map", "=", "collections", ".", "defaultdict", "(", "list", "...
Given a list of source_providers, apply the list of suggested dimension updates given in provider.updated_dimensions() to the supplied hypercube. Dimension global_sizes are always updated with the supplied sizes and lower_extent is always set to 0. upper_extent is set to any reductions (current upp...
[ "Given", "a", "list", "of", "source_providers", "apply", "the", "list", "of", "suggested", "dimension", "updates", "given", "in", "provider", ".", "updated_dimensions", "()", "to", "the", "supplied", "hypercube", "." ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/RimeSolver.py#L1234-L1317
ska-sa/montblanc
montblanc/impl/rime/tensorflow/RimeSolver.py
_setup_hypercube
def _setup_hypercube(cube, slvr_cfg): """ Sets up the hypercube given a solver configuration """ mbu.register_default_dimensions(cube, slvr_cfg) # Configure the dimensions of the beam cube cube.register_dimension('beam_lw', 2, description='E Beam cube l width') cube.reg...
python
def _setup_hypercube(cube, slvr_cfg): """ Sets up the hypercube given a solver configuration """ mbu.register_default_dimensions(cube, slvr_cfg) # Configure the dimensions of the beam cube cube.register_dimension('beam_lw', 2, description='E Beam cube l width') cube.reg...
[ "def", "_setup_hypercube", "(", "cube", ",", "slvr_cfg", ")", ":", "mbu", ".", "register_default_dimensions", "(", "cube", ",", "slvr_cfg", ")", "# Configure the dimensions of the beam cube", "cube", ".", "register_dimension", "(", "'beam_lw'", ",", "2", ",", "descr...
Sets up the hypercube given a solver configuration
[ "Sets", "up", "the", "hypercube", "given", "a", "solver", "configuration" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/RimeSolver.py#L1319-L1357
ska-sa/montblanc
montblanc/impl/rime/tensorflow/RimeSolver.py
_partition
def _partition(iter_dims, data_sources): """ Partition data sources into 1. Dictionary of data sources associated with radio sources. 2. List of data sources to feed multiple times. 3. List of data sources to feed once. """ src_nr_vars = set(source_var_types().values()) iter_dims = set...
python
def _partition(iter_dims, data_sources): """ Partition data sources into 1. Dictionary of data sources associated with radio sources. 2. List of data sources to feed multiple times. 3. List of data sources to feed once. """ src_nr_vars = set(source_var_types().values()) iter_dims = set...
[ "def", "_partition", "(", "iter_dims", ",", "data_sources", ")", ":", "src_nr_vars", "=", "set", "(", "source_var_types", "(", ")", ".", "values", "(", ")", ")", "iter_dims", "=", "set", "(", "iter_dims", ")", "src_data_sources", "=", "collections", ".", "...
Partition data sources into 1. Dictionary of data sources associated with radio sources. 2. List of data sources to feed multiple times. 3. List of data sources to feed once.
[ "Partition", "data", "sources", "into" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/RimeSolver.py#L1359-L1397
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" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/RimeSolver.py#L356-L362
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" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/RimeSolver.py#L364-L427
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" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/RimeSolver.py#L517-L526
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" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/RimeSolver.py#L529-L535
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" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/RimeSolver.py#L537-L571
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", "." ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/__init__.py#L50-L87
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" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/fits_beam_source_provider.py#L163-L211
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" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/fits_beam_source_provider.py#L213-L226
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" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/fits_beam_source_provider.py#L237-L261
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", "." ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/fits_beam_source_provider.py#L333-L360
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" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/fits_beam_source_provider.py#L370-L385
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" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sinks/ms_sink_provider.py#L54-L86
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" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/cached_source_provider.py#L29-L56
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", "." ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/cached_source_provider.py#L58-L66
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" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/cached_source_provider.py#L132-L138
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" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/cached_source_provider.py#L140-L146
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" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/config.py#L67-L87
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" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/config.py#L89-L95
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" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/config.py#L97-L103
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", "]]" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/config.py#L134-L141
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", "]]" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/config.py#L143-L150
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" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/ms_source_provider.py#L93-L96
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" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/ms_source_provider.py#L98-L104
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" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/ms_source_provider.py#L106-L141
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" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/ms_source_provider.py#L143-L149
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" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/ms_source_provider.py#L151-L157
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" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/ms_source_provider.py#L159-L167
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" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/ms_source_provider.py#L170-L177
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" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/ms_source_provider.py#L179-L186
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" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sources/ms_source_provider.py#L188-L197
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" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/__init__.py#L21-L30
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", "." ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/configuration.py#L10-L73
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" ]
train
https://github.com/tjguk/winshell/blob/1509d211ab3403dd1cff6113e4e13462d6dec35b/winshell.py#L83-L85
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" ]
train
https://github.com/tjguk/winshell/blob/1509d211ab3403dd1cff6113e4e13462d6dec35b/winshell.py#L87-L89
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", "." ]
train
https://github.com/tjguk/winshell/blob/1509d211ab3403dd1cff6113e4e13462d6dec35b/winshell.py#L266-L294
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", "." ]
train
https://github.com/tjguk/winshell/blob/1509d211ab3403dd1cff6113e4e13462d6dec35b/winshell.py#L296-L324
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", "." ]
train
https://github.com/tjguk/winshell/blob/1509d211ab3403dd1cff6113e4e13462d6dec35b/winshell.py#L326-L354
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", ...
train
https://github.com/tjguk/winshell/blob/1509d211ab3403dd1cff6113e4e13462d6dec35b/winshell.py#L356-L382
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", ".", ")" ]
train
https://github.com/tjguk/winshell/blob/1509d211ab3403dd1cff6113e4e13462d6dec35b/winshell.py#L586-L645
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", ":" ]
train
https://github.com/tjguk/winshell/blob/1509d211ab3403dd1cff6113e4e13462d6dec35b/winshell.py#L1084-L1107
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", ...
train
https://github.com/tjguk/winshell/blob/1509d211ab3403dd1cff6113e4e13462d6dec35b/winshell.py#L937-L949
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" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/queue_wrapper.py#L8-L18
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", "(",...
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/queue_wrapper.py#L152-L167
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", "." ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/util/parsing.py#L12-L122
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...
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sinks/sink_provider.py#L53-L73
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...
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/impl/rime/tensorflow/sinks/sink_provider.py#L97-L120
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" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/util/ant_uvw.py#L86-L121
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" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/util/ant_uvw.py#L128-L177
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" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/util/ant_uvw.py#L184-L205
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", "." ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/util/ant_uvw.py#L208-L279
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",...
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/src_types.py#L61-L106
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", "." ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/src_types.py#L108-L132
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",...
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/src_types.py#L134-L174
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",...
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/src_types.py#L176-L186
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", "." ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/src_types.py#L188-L197
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" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/examples/MS_tf_example.py#L44-L59
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" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/examples/MS_tf_example.py#L61-L66
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" ]
train
https://github.com/ska-sa/montblanc/blob/8a2e742e7500bcc6196489b735f87b233075dd2d/montblanc/examples/MS_tf_example.py#L76-L81
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", "." ]
train
https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/auths.py#L67-L99
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", "." ]
train
https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/issues/milestone.py#L60-L74
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", "." ]
train
https://github.com/bwohlberg/jonga/blob/1947d40d78d814fbdc3a973ceffec4b69b4623f2/jonga.py#L25-L62
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", "." ]
train
https://github.com/bwohlberg/jonga/blob/1947d40d78d814fbdc3a973ceffec4b69b4623f2/jonga.py#L111-L137
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" ]
train
https://github.com/bwohlberg/jonga/blob/1947d40d78d814fbdc3a973ceffec4b69b4623f2/jonga.py#L232-L295
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" ]
train
https://github.com/bwohlberg/jonga/blob/1947d40d78d814fbdc3a973ceffec4b69b4623f2/jonga.py#L306-L325
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" ]
train
https://github.com/bwohlberg/jonga/blob/1947d40d78d814fbdc3a973ceffec4b69b4623f2/jonga.py#L331-L354
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" ]
train
https://github.com/bwohlberg/jonga/blob/1947d40d78d814fbdc3a973ceffec4b69b4623f2/jonga.py#L358-L466
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", "." ]
train
https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/pulls.py#L222-L238
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" ]
train
https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/pulls.py#L240-L244
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", "." ]
train
https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/pulls.py#L246-L252
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", "." ]
train
https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/pulls.py#L254-L264
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", "." ]
train
https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/pulls.py#L278-L288
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", "." ]
train
https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/pulls.py#L290-L300
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", "." ]
train
https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/pulls.py#L303-L316
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" ]
train
https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/pulls.py#L318-L322
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", "." ]
train
https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/pulls.py#L344-L362
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", "." ]
train
https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/pulls.py#L414-L427
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", "." ]
train
https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L66-L77
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", "." ]
train
https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/orgs.py#L80-L87