Search is not available for this dataset
text
stringlengths
75
104k
def scan(l,**kwargs): ''' from elist.elist import * from elist.jprint import pobj l = [1,[4],2,[3,[5,6]]] desc = description(l) l = [1,2,[4],[3,[5,6]]] desc = description(l) ''' if('itermode' in kwargs): itermode = True else: itermode = Fal...
def fullfill_descendants_info(desc_matrix): ''' flat_offset ''' pathloc_mapping = {} locpath_mapping = {} #def leaf_handler(desc,pdesc,offset): def leaf_handler(desc,pdesc): #desc['flat_offset'] = (offset,offset+1) desc['non_leaf_son_paths'] = [] desc['leaf_son_pat...
def pathlist_to_getStr(path_list): ''' >>> pathlist_to_getStr([1, '1', 2]) "[1]['1'][2]" >>> ''' t1 = path_list.__repr__() t1 = t1.lstrip('[') t1 = t1.rstrip(']') t2 = t1.split(", ") s = '' for i in range(0,t2.__len__()): s = ''.join((s,'[',t2[i],']'))...
def getStr_to_pathlist(gs): ''' gs = "[1]['1'][2]" getStr_to_pathlist(gs) gs = "['u']['u1']" getStr_to_pathlist(gs) ''' def numize(w): try: int(w) except: try: float(w) except: return(w) ...
def get_block_op_pairs(pairs_str): ''' # >>> get_block_op_pairs("{}[]") # {1: ('{', '}'), 2: ('[', ']')} # >>> get_block_op_pairs("{}[]()") # {1: ('{', '}'), 2: ('[', ']'), 3: ('(', ')')} # >>> get_block_op_pairs("{}[]()<>") # {1: ('{', '}'), 2: ('[', ']'), 3: ('(',...
def is_lop(ch,block_op_pairs_dict=get_block_op_pairs('{}[]()')): ''' # is_lop('{',block_op_pairs_dict) # is_lop('[',block_op_pairs_dict) # is_lop('}',block_op_pairs_dict) # is_lop(']',block_op_pairs_dict) # is_lop('a',block_op_pairs_dict) ''' for i in range(1,block_op_pairs_dict.__len__(...
def get_next_char_level_in_j_str(curr_lv,curr_seq,j_str,block_op_pairs_dict=get_block_op_pairs("{}[]()")): ''' the first-char is level-1 when current is non-op, next-char-level = curr-level when current is lop, non-paired-rop-next-char-level = lop-level+1; when current is lop, paired-ro...
def str_display_width(s): ''' from elist.utils import * str_display_width('a') str_display_width('去') ''' s= str(s) width = 0 len = s.__len__() for i in range(0,len): sublen = s[i].encode().__len__() sublen = int(sublen/2 + 1/2) width = width + sub...
def get_wfsmat(l): ''' l = ['v_7', 'v_3', 'v_1', 'v_4', ['v_4', 'v_2'], 'v_5', 'v_6', 'v_1', 'v_6', 'v_7', 'v_5', ['v_4', ['v_1', 'v_8', 'v_3', 'v_4', 'v_2', 'v_7', [['v_3', 'v_2'], 'v_4', 'v_5', 'v_1', 'v_3', 'v_1', 'v_2', 'v_5', 'v_8', 'v_8', 'v_7'], 'v_5', 'v_8', 'v_7', 'v_1', 'v_5'], 'v_6'], 'v_4', 'v_5'...
def wfs2mat(wfs): ''' wfs = [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [4, 0], [4, 1], [11, 0], [11, 1], [11, 2], [11, 1, 0], [11, 1, 1], [11, 1, 2], [11, 1, 3], [11, 1, 4], [11, 1, 5], [11, 1, 6], [11, 1, 7], [11, 1, 8], [11, 1, 9], [11, 1, 10], [11, 1, 11], [11,...
def dfs2wfsmat(dfs): ''' dfs = [[0], [1], [2], [3], [4], [4, 0], [4, 1], [5], [6], [7], [8], [9], [10], [11], [11, 0], [11, 1], [11, 1, 0], [11, 1, 1], [11, 1, 2], [11, 1, 3], [11, 1, 4], [11, 1, 5], [11, 1, 6], [11, 1, 6, 0], [11, 1, 6, 0, 0], [11, 1, 6, 0, 1], [11, 1, 6, 1], [11, 1, 6, 2], [11, 1, 6, 3], ...
def parent_handler(self,lcache,i,*args): ''' _update_pdesc_sons_info ''' pdesc = lcache.desc[i] pdesc['sons_count'] = self.sibs_len pdesc['leaf_son_paths'] = [] pdesc['non_leaf_son_paths'] = [] pdesc['leaf_descendant_paths'] = [] pdesc['non_lea...
def child_begin_handler(self,scache,*args): ''' _creat_child_desc update depth,parent_breadth_path,parent_path,sib_seq,path,lsib_path,rsib_path,lcin_path,rcin_path ''' pdesc = self.pdesc depth = scache.depth sib_seq = self.sib_seq sibs_len = self.s...
def leaf_handler(self,*args): '''#leaf child handler''' desc = self.desc pdesc = self.pdesc desc['leaf'] = True desc['sons_count'] = 0 pdesc['leaf_son_paths'].append(copy.deepcopy(desc['path'])) pdesc['leaf_descendant_paths'].append(copy.deepcopy(desc['path']))
def non_leaf_handler(self,lcache): '''#nonleaf child handler''' desc = self.desc pdesc = self.pdesc desc['leaf'] = False pdesc['non_leaf_son_paths'].append(copy.deepcopy(desc['path'])) pdesc['non_leaf_descendant_paths'].append(copy.deepcopy(desc['path'])) lcache.n...
def child_end_handler(self,scache): ''' _upgrade_breadth_info update breadth, breadth_path, and add desc to desc_level ''' desc = self.desc desc_level = scache.desc_level breadth = desc_level.__len__() desc['breadth'] = breadth desc['breadt...
def parse(self, source): """Parse command content from the LaTeX source. Parameters ---------- source : `str` The full source of the tex document. Yields ------ parsed_command : `ParsedCommand` Yields parsed commands instances for each oc...
def _parse_command(self, source, start_index): """Parse a single command. Parameters ---------- source : `str` The full source of the tex document. start_index : `int` Character index in ``source`` where the command begins. Returns ------...
def _parse_whitespace_argument(source, name): r"""Attempt to parse a single token on the first line of this source. This method is used for parsing whitespace-delimited arguments, like ``\input file``. The source should ideally contain `` file`` along with a newline character. ...
def _tmdd_datetime_to_iso(dt, include_offset=True, include_seconds=True): """ dt is an xml Element with <date>, <time>, and optionally <offset> children. returns an ISO8601 string """ datestring = dt.findtext('date') timestring = dt.findtext('time') assert len(datestring) == 8 assert len...
def _generate_automatic_headline(c): """The only field that maps closely to Open511 <headline>, a required field, is optional in TMDD. So we sometimes need to generate our own.""" # Start with the event type, e.g. "Incident" headline = c.data['event_type'].replace('_', ' ').title() if c.data['roads'...
def _get_severity(c): """ 1. Collect all <severity> and <impact-level> values. 2. Convert impact-level of 1-3 to MINOR, 4-7 to MODERATE, 8-10 to MAJOR 3. Map severity -> none to MINOR, natural-disaster to MAJOR, other to UNKNOWN 4. Pick the highest severity. """ severities = c.feu.xpath('eve...
def list_from_document(cls, doc): """Returns a list of TMDDEventConverter elements. doc is an XML Element containing one or more <FEU> events """ objs = [] for feu in doc.xpath('//FEU'): detail_els = feu.xpath('event-element-details/event-element-detail') ...
def add_geo(self, geo_location): """ Saves a <geo-location> Element, to be incoporated into the Open511 geometry field. """ if not geo_location.xpath('latitude') and geo_location.xpath('longitude'): raise Exception("Invalid geo-location %s" % etree.tostring(geo_locati...
def clone(src, dst_path, skip_globals, skip_dimensions, skip_variables): """ Mostly ripped from nc3tonc4 in netCDF4-python. Added ability to skip dimension and variables. Removed all of the unpacking logic for shorts. """ if os.path.exists(dst_path): os.unlink(dst_path) ...
def get_dataframe_from_variable(nc, data_var): """ Returns a Pandas DataFrame of the data. This always returns positive down depths """ time_var = nc.get_variables_by_attributes(standard_name='time')[0] depth_vars = nc.get_variables_by_attributes(axis=lambda v: v is not None and v.lower() == 'z...
async def github_request(session, api_token, query=None, mutation=None, variables=None): """Send a request to the GitHub v4 (GraphQL) API. The request is asynchronous, with asyncio. Parameters ---------- session : `aiohttp.ClientSession` Your application's aiohttp ...
def load(cls, query_name): """Load a pre-made query. These queries are distributed with lsstprojectmeta. See :file:`lsstrojectmeta/data/githubv4/README.rst` inside the package repository for details on available queries. Parameters ---------- query_name : `str` ...
def read_git_commit_timestamp_for_file(filepath, repo_path=None, repo=None): """Obtain the timestamp for the most recent commit to a given file in a Git repository. Parameters ---------- filepath : `str` Absolute or repository-relative path for a file. repo_path : `str`, optional ...
def get_content_commit_date(extensions, acceptance_callback=None, root_dir='.'): """Get the datetime for the most recent commit to a project that affected certain types of content. Parameters ---------- extensions : sequence of 'str' Extensions of files to consid...
def _iter_filepaths_with_extension(extname, root_dir='.'): """Iterative over relative filepaths of files in a directory, and sub-directories, with the given extension. Parameters ---------- extname : `str` Extension name (such as 'txt' or 'rst'). Extension comparison is case sensiti...
def get_variables_by_attributes(self, **kwargs): """ Returns variables that match specific conditions. * Can pass in key=value parameters and variables are returned that contain all of the matches. For example, >>> # Get variables with x-axis attribute. >>> vs = nc.get_variabl...
def json_attributes(self, vfuncs=None): """ vfuncs can be any callable that accepts a single argument, the Variable object, and returns a dictionary of new attributes to set. These will overwrite existing attributes """ vfuncs = vfuncs or [] js = {'global': {}} ...
def ensure_pandoc(func): """Decorate a function that uses pypandoc to ensure that pandoc is installed if necessary. """ logger = logging.getLogger(__name__) @functools.wraps(func) def _install_and_run(*args, **kwargs): try: # First try to run pypandoc function re...
def convert_text(content, from_fmt, to_fmt, deparagraph=False, mathjax=False, smart=True, extra_args=None): """Convert text from one markup format to another using pandoc. This function is a thin wrapper around `pypandoc.convert_text`. Parameters ---------- content : `str` ...
def convert_lsstdoc_tex( content, to_fmt, deparagraph=False, mathjax=False, smart=True, extra_args=None): """Convert lsstdoc-class LaTeX to another markup format. This function is a thin wrapper around `convert_text` that automatically includes common lsstdoc LaTeX macros. Parameters ...
def decode_jsonld(jsonld_text): """Decode a JSON-LD dataset, including decoding datetime strings into `datetime.datetime` objects. Parameters ---------- encoded_dataset : `str` The JSON-LD dataset encoded as a string. Returns ------- jsonld_dataset : `dict` A JSON-LD da...
def default(self, obj): """Encode values as JSON strings. This method overrides the default implementation from `json.JSONEncoder`. """ if isinstance(obj, datetime.datetime): return self._encode_datetime(obj) # Fallback to the default encoding return...
def _encode_datetime(self, dt): """Encode a datetime in the format '%Y-%m-%dT%H:%M:%SZ'. The datetime can be naieve (doesn't have timezone info) or aware (it does have a tzinfo attribute set). Regardless, the datetime is transformed into UTC. """ if dt.tzinfo is None: ...
def find_repos(self, depth=10): '''Get all git repositories within this environment''' repos = [] for root, subdirs, files in walk_dn(self.root, depth=depth): if 'modules' in root: continue if '.git' in subdirs: repos.append(root) ...
def clone(self, repo_path, destination, branch=None): '''Clone a repository to a destination relative to envrionment root''' logger.debug('Installing ' + repo_path) if not destination.startswith(self.env_path): destination = unipath(self.env_path, destination) if branch: ...
def pull(self, repo_path, *args): '''Clone a repository to a destination relative to envrionment root''' logger.debug('Pulling ' + repo_path) if not repo_path.startswith(self.env_path): repo_path = unipath(self.env_path, repo_path) return shell.run('git', 'pull', *args, **{...
def install(self, package): '''Install a python package using pip''' logger.debug('Installing ' + package) shell.run(self.pip_path, 'install', package)
def upgrade(self, package): '''Update a python package using pip''' logger.debug('Upgrading ' + package) shell.run(self.pip_path, 'install', '--upgrade', '--no-deps', package) shell.run(self.pip_path, 'install', package)
def df_quantile(df, nb=100): """Returns the nb quantiles for datas in a dataframe """ quantiles = np.linspace(0, 1., nb) res = pd.DataFrame() for q in quantiles: res = res.append(df.quantile(q), ignore_index=True) return res
def mean(a, rep=0.75, **kwargs): """Compute the average along a 1D array like ma.mean, but with a representativity coefficient : if ma.count(a)/ma.size(a)>=rep, then the result is a masked value """ return rfunc(a, ma.mean, rep, **kwargs)
def max(a, rep=0.75, **kwargs): """Compute the max along a 1D array like ma.mean, but with a representativity coefficient : if ma.count(a)/ma.size(a)>=rep, then the result is a masked value """ return rfunc(a, ma.max, rep, **kwargs)
def min(a, rep=0.75, **kwargs): """Compute the min along a 1D array like ma.mean, but with a representativity coefficient : if ma.count(a)/ma.size(a)>=rep, then the result is a masked value """ return rfunc(a, ma.min, rep, **kwargs)
def rfunc(a, rfunc=None, rep=0.75, **kwargs): """Applies func on a if a comes with a representativity coefficient rep, i.e. ma.count(a)/ma.size(a)>=rep. If not, returns a masked array """ if float(ma.count(a)) / ma.size(a) < rep: return ma.masked else: if rfunc is None: r...
def rmse(a, b): """Returns the root mean square error betwwen a and b """ return np.sqrt(np.square(a - b).mean())
def nmse(a, b): """Returns the normalized mean square error of a and b """ return np.square(a - b).mean() / (a.mean() * b.mean())
def mfbe(a, b): """Returns the mean fractionalized bias error """ return 2 * bias(a, b) / (a.mean() + b.mean())
def fa(a, b, alpha=2): """Returns the factor of 'alpha' (2 or 5 normally) """ return np.sum((a > b / alpha) & (a < b * alpha), dtype=float) / len(a) * 100
def foex(a, b): """Returns the factor of exceedance """ return (np.sum(a > b, dtype=float) / len(a) - 0.5) * 100
def correlation(a, b): """Computes the correlation between a and b, says the Pearson's correlation coefficient R """ diff1 = a - a.mean() diff2 = b - b.mean() return (diff1 * diff2).mean() / (np.sqrt(np.square(diff1).mean() * np.square(diff2).mean()))
def gmb(a, b): """Geometric mean bias """ return np.exp(np.log(a).mean() - np.log(b).mean())
def gmv(a, b): """Geometric mean variance """ return np.exp(np.square(np.log(a) - np.log(b)).mean())
def fmt(a, b): """Figure of merit in time """ return 100 * np.min([a, b], axis=0).sum() / np.max([a, b], axis=0).sum()
def fullStats(a, b): """Performs several stats on a against b, typically a is the predictions array, and b the observations array Returns: A dataFrame of stat name, stat description, result """ stats = [ ['bias', 'Bias', bias(a, b)], ['stderr', 'Standard Deviation Error', s...
def site_path(self): '''Path to environments site-packages''' if platform == 'win': return unipath(self.path, 'Lib', 'site-packages') py_ver = 'python{0}'.format(sys.version[:3]) return unipath(self.path, 'lib', py_ver, 'site-packages')
def _pre_activate(self): ''' Prior to activating, store everything necessary to deactivate this environment. ''' if 'CPENV_CLEAN_ENV' not in os.environ: if platform == 'win': os.environ['PROMPT'] = '$P$G' else: os.environ['...
def _activate(self): ''' Do some serious mangling to the current python environment... This is necessary to activate an environment via python. ''' old_syspath = set(sys.path) site.addsitedir(self.site_path) site.addsitedir(self.bin_path) new_syspaths = s...
def remove(self): ''' Remove this environment ''' self.run_hook('preremove') utils.rmtree(self.path) self.run_hook('postremove')
def command(self): '''Command used to launch this application module''' cmd = self.config.get('command', None) if cmd is None: return cmd = cmd[platform] return cmd['path'], cmd['args']
def create(name_or_path=None, config=None): '''Create a virtual environment. You can pass either the name of a new environment to create in your CPENV_HOME directory OR specify a full path to create an environment outisde your CPENV_HOME. Create an environment in CPENV_HOME:: >>> cpenv.create(...
def remove(name_or_path): '''Remove an environment or module :param name_or_path: name or path to environment or module ''' r = resolve(name_or_path) r.resolved[0].remove() EnvironmentCache.discard(r.resolved[0]) EnvironmentCache.save()
def launch(module_name, *args, **kwargs): '''Activates and launches a module :param module_name: name of module to launch ''' r = resolve(module_name) r.activate() mod = r.resolved[0] mod.launch(*args, **kwargs)
def deactivate(): '''Deactivates an environment by restoring all env vars to a clean state stored prior to activating environments ''' if 'CPENV_ACTIVE' not in os.environ or 'CPENV_CLEAN_ENV' not in os.environ: raise EnvironmentError('Can not deactivate environment...') utils.restore_env_f...
def get_home_path(): ''':returns: your home path...CPENV_HOME env var OR ~/.cpenv''' home = unipath(os.environ.get('CPENV_HOME', '~/.cpenv')) home_modules = unipath(home, 'modules') if not os.path.exists(home): os.makedirs(home) if not os.path.exists(home_modules): os.makedirs(home_...
def get_module_paths(): ''':returns: paths in CPENV_MODULES env var and CPENV_HOME/modules''' module_paths = [] cpenv_modules_path = os.environ.get('CPENV_MODULES', None) if cpenv_modules_path: module_paths.extend(cpenv_modules_path.split(os.pathsep)) module_paths.append(unipath(get_home_...
def get_environments(): '''Returns a list of all known virtual environments as :class:`VirtualEnvironment` instances. This includes those in CPENV_HOME and any others that are cached(created by the current user or activated once by full path.) ''' environments = set() cwd = os.getcwd() ...
def get_modules(): '''Returns a list of available modules.''' modules = set() cwd = os.getcwd() for d in os.listdir(cwd): if d == 'module.yml': modules.add(Module(cwd)) path = unipath(cwd, d) if utils.is_module(path): modules.add(Module(cwd)) modu...
def get_active_modules(): ''':returns: a list of active :class:`Module` s or []''' modules = os.environ.get('CPENV_ACTIVE_MODULES', None) if modules: modules = modules.split(os.pathsep) return [Module(module) for module in modules] return []
def add_active_module(module): '''Add a module to CPENV_ACTIVE_MODULES environment variable''' modules = set(get_active_modules()) modules.add(module) new_modules_path = os.pathsep.join([m.path for m in modules]) os.environ['CPENV_ACTIVE_MODULES'] = str(new_modules_path)
def rem_active_module(module): '''Remove a module from CPENV_ACTIVE_MODULES environment variable''' modules = set(get_active_modules()) modules.discard(module) new_modules_path = os.pathsep.join([m.path for m in modules]) os.environ['CPENV_ACTIVE_MODULES'] = str(new_modules_path)
def format_objects(objects, children=False, columns=None, header=True): '''Format a list of environments and modules for terminal output''' columns = columns or ('NAME', 'TYPE', 'PATH') objects = sorted(objects, key=_type_and_name) data = [] for obj in objects: if isinstance(obj, cpenv.Virt...
def info(): '''Show context info''' env = cpenv.get_active_env() modules = [] if env: modules = env.get_modules() active_modules = cpenv.get_active_modules() if not env and not modules and not active_modules: click.echo('\nNo active modules...') return click.echo(b...
def list_(): '''List available environments and modules''' environments = cpenv.get_environments() modules = cpenv.get_modules() click.echo(format_objects(environments + modules, children=True))
def activate(paths, skip_local, skip_shared): '''Activate an environment''' if not paths: ctx = click.get_current_context() if cpenv.get_active_env(): ctx.invoke(info) return click.echo(ctx.get_help()) examples = ( '\nExamples: \n' ...
def create(name_or_path, config): '''Create a new environment.''' if not name_or_path: ctx = click.get_current_context() click.echo(ctx.get_help()) examples = ( '\nExamples:\n' ' cpenv create my_env\n' ' cpenv create ./relative/path/to/my_env\n'...
def remove(name_or_path): '''Remove an environment''' click.echo() try: r = cpenv.resolve(name_or_path) except cpenv.ResolveError as e: click.echo(e) return obj = r.resolved[0] if not isinstance(obj, cpenv.VirtualEnvironment): click.echo('{} is a module. Use `cp...
def list_(): '''List available environments and modules''' click.echo('Cached Environments') environments = list(EnvironmentCache) click.echo(format_objects(environments, children=False))
def add(path): '''Add an environment to the cache. Allows you to activate the environment by name instead of by full path''' click.echo('\nAdding {} to cache......'.format(path), nl=False) try: r = cpenv.resolve(path) except Exception as e: click.echo(bold_red('FAILED')) cli...
def remove(path): '''Remove a cached environment. Removed paths will no longer be able to be activated by name''' r = cpenv.resolve(path) if isinstance(r.resolved[0], cpenv.VirtualEnvironment): EnvironmentCache.discard(r.resolved[0]) EnvironmentCache.save()
def create(name_or_path, config): '''Create a new template module. You can also specify a filesystem path like "./modules/new_module" ''' click.echo('Creating module {}...'.format(name_or_path), nl=False) try: module = cpenv.create_module(name_or_path, config) except Exception as e: ...
def add(name, path, branch, type): '''Add a module to an environment. PATH can be a git repository path or a filesystem path. ''' if not name and not path: ctx = click.get_current_context() click.echo(ctx.get_help()) examples = ( '\nExamples:\n' ' cpenv mo...
def remove(name, local): '''Remove a module named NAME. Will remove the first resolved module named NAME. You can also specify a full path to a module. Use the --local option to ensure removal of modules local to the currently active environment.''' click.echo() if not local: # Use resolver to find mod...
def localize(name): '''Copy a global module to the active environment.''' env = cpenv.get_active_env() if not env: click.echo('You need to activate an environment first.') return try: r = cpenv.resolve(name) except cpenv.ResolveError as e: click.echo('\n' + str(e)) ...
def path_resolver(resolver, path): '''Resolves VirtualEnvironments with a relative or absolute path''' path = unipath(path) if is_environment(path): return VirtualEnvironment(path) raise ResolveError
def home_resolver(resolver, path): '''Resolves VirtualEnvironments in CPENV_HOME''' from .api import get_home_path path = unipath(get_home_path(), path) if is_environment(path): return VirtualEnvironment(path) raise ResolveError
def cache_resolver(resolver, path): '''Resolves VirtualEnvironments in EnvironmentCache''' env = resolver.cache.find(path) if env: return env raise ResolveError
def module_resolver(resolver, path): '''Resolves module in previously resolved environment.''' if resolver.resolved: if isinstance(resolver.resolved[0], VirtualEnvironment): env = resolver.resolved[0] mod = env.get_module(path) if mod: return mod ...
def modules_path_resolver(resolver, path): '''Resolves modules in CPENV_MODULES path and CPENV_HOME/modules''' from .api import get_module_paths for module_dir in get_module_paths(): mod_path = unipath(module_dir, path) if is_module(mod_path): return Module(mod_path) rais...
def active_env_module_resolver(resolver, path): '''Resolves modules in currently active environment.''' from .api import get_active_env env = get_active_env() if not env: raise ResolveError mod = env.get_module(path) if not mod: raise ResolveError return mod
def redirect_resolver(resolver, path): '''Resolves environment from .cpenv file...recursively walks up the tree in attempt to find a .cpenv file''' if not os.path.exists(path): raise ResolveError if os.path.isfile(path): path = os.path.dirname(path) for root, _, _ in walk_up(path)...
def _engine_affinity(obj): """Which engine or engines are preferred for processing this object Returns: (location, weight) location (integer or tuple): engine id (or in the case of a distributed array a tuple (engine_id_list, distaxis)). weight(integer): Proportional to the cost of moving the ...
def _ufunc_move_input(obj, location, bshape): """Copy ufunc input `obj` to new engine location(s) unless obj is scalar. If the input is requested to be distributed to multiple engines, this function will also take care of broadcasting along the distributed axis. If the input obj is a scalar, it will b...
def _ufunc_dispatch(ufunc, method, i, inputs, **kwargs): """Route ufunc execution intelligently to local host or remote engine(s) depending on where the inputs are, to minimize the need to move data. Args: see numpy documentation for __numpy_ufunc__ """ #__print_ufunc(ufunc, method, i, inputs,...
def transpose(a, axes=None): """Returns a view of the array with axes transposed. For a 1-D array, this has no effect. For a 2-D array, this is the usual matrix transpose. For an n-D array, if axes are given, their order indicates how the axes are permuted Args: a (array_like): Input arr...
def rollaxis(a, axis, start=0): """Roll the specified axis backwards, until it lies in a given position. Args: a (array_like): Input array. axis (int): The axis to roll backwards. The positions of the other axes do not change relative to one another. start (int, optional): The axis ...