text
stringlengths
18
773k
def wait_until(predicate, timeout=30): """Wait until predicate returns a truthy value or the timeout is reached. >>> wait_until(lambda: True, timeout=10) """ not_expired = Timeout(timeout) while not_expired(): r = predicate() if r: break
def _find_matching_version(versions, version_pattern): """ Return the first matching version >>> _find_matching_version(['1.1.4', '1.0.12', '1.0.5'], '1.0.x') '1.0.12' >>> _find_matching_version(['1.1.4', '1.0.6', '1.0.5'], '2.x.x') """ pattern = fnmatch.translate(version_pattern.replace('...
def _build_tarball(src_repo) -> str: """ Build a tarball from src and return the path to it """ run = partial(subprocess.run, cwd=src_repo, check=True) run(['git', 'clean', '-xdff']) src_repo = Path(src_repo) if os.path.exists(src_repo / 'es' / 'upstream'): run(['git', 'submodule', 'update',...
def _crates_cache() -> str: """ Return the path to the crates cache folder """ return os.environ.get( 'XDG_CACHE_HOME', os.path.join(os.path.expanduser('~'), '.cache', 'cr8', 'crates'))
def get_crate(version, crate_root=None): """Retrieve a Crate tarball, extract it and return the path. Args: version: The Crate version to get. Can be specified in different ways: - A concrete version like '0.55.0' - A version including a `x` as wildcards. Like: '1.1...
def _parse_options(options: List[str]) -> Dict[str, str]: """ Parse repeatable CLI options >>> opts = _parse_options(['cluster.name=foo', 'CRATE_JAVA_OPTS="-Dxy=foo"']) >>> print(json.dumps(opts, sort_keys=True)) {"CRATE_JAVA_OPTS": "\\"-Dxy=foo\\"", "cluster.name": "foo"} """ try: retu...
def run_crate( version, env=None, setting=None, crate_root=None, keep_data=False, disable_java_magic=False, ): """Launch a crate instance. Supported version specifications: - Concrete version like "0.55.0" or with wildcard: "1.1.x" - An alias (one...
def start(self): """Start the process. This will block until the Crate cluster is ready to process requests. """ log.info('Starting Crate process') self.process = proc = self.enter_context(subprocess.Popen( self.cmd, stdin=subprocess.DEVNULL, ...
def _parse(line): """ Parse protocol and bound address from log message >>> AddrConsumer._parse('NONE') (None, None) >>> AddrConsumer._parse('[INFO ][i.c.p.h.CrateNettyHttpServerTransport] [Widderstein] publish_address {127.0.0.1:4200}, bound_addresses {[fe80::1]:4200}, {[::1]:4200}, {...
def _calc_block_mean_variance(image, mask, blocksize): """Adaptively determines image background. Args: image: image converted 1-channel image. mask: 1-channel mask, same size as image. blocksize: adaptive algorithm parameter. Returns: image of same size as input with foreg...
def threshold(image, block_size=DEFAULT_BLOCKSIZE, mask=None): """Applies adaptive thresholding to the given image. Args: image: BGRA image. block_size: optional int block_size to use for adaptive thresholding. mask: optional mask. Returns: Thresholded image. """ if ...
def find_version(include_dev_version=True, root='%(pwd)s', version_file='%(root)s/version.txt', version_module_paths=(), git_args=None, vcs_args=None, decrement_dev_version=None, strip_prefix='v', Popen=subprocess.Popen, open=open): """Find an appr...
def setup(dist, attr, value): """A hook for simplifying ``vcversioner`` use from distutils. This hook, when installed properly, allows vcversioner to automatically run when specifying a ``vcversioner`` argument to ``setup``. For example:: from setuptools import setup setup( setup_re...
def to_insert(table, d): """Generate an insert statement using the given table and dictionary. Args: table (str): table name d (dict): dictionary with column names as keys and values as values. Returns: tuple of statement and arguments >>> to_insert('doc.foobar', {'name': 'Marv...
def insert_json(table=None, bulk_size=1000, concurrency=25, hosts=None, output_fmt=None): """Insert JSON lines fed into stdin into a Crate cluster. If no hosts are specified the statements will be printed. Args: table: Target table na...
def _get_dominant_angle(lines, domination_type=MEDIAN): """Picks dominant angle of a set of lines. Args: lines: iterable of (x1, y1, x2, y2) tuples that define lines. domination_type: either MEDIAN or MEAN. Returns: Dominant angle value in radians. Raises: ValueError: ...
def _normalize_angle(angle, range, step): """Finds an angle that matches the given one modulo step. Increments and decrements the given value with a given step. Args: range: a 2-tuple of min and max target values. step: tuning step. Returns: Normalized value within a given ran...
def get_collectors(self, limit=1000, offset=0): """Returns a dict of collectors. Args: limit (int): number of collectors to return offset (int): the offset of where the list of collectors should begin from """ options = { 'limit': limit, '...
def find(self, name): """Returns a dict of collector's details if found. Args: name (str): name of collector searching for """ collectors = self.get_collectors() for collector in collectors: if name.lower() == collector['name'].lower(): s...
def delete(self, collector_id=None): """Delete a collector from inventory. Args: collector_id (int): id of collector (optional) """ cid = self.collector_id if collector_id: cid = collector_id # param to delete id url = '{0}/{1}'.format(s...
def info(self, collector_id): """Return a dict of collector. Args: collector_id (int): id of collector (optional) """ cid = self.collector_id if collector_id: cid = collector_id url = '{0}/{1}'.format(self.url, cid) request = requests.get...
def _dotnotation_for_nested_dictionary(d, key, dots): """ Flattens nested data structures using dot notation. :param dict d: Original or nested dictionary :param str key: :param dict dots: Dotted dictionary so far :return dict: Dotted dictionary so far """ if key == 'chronData': ...
def create_dataframe(ensemble): """ Create a data frame from given nested lists of ensemble data :param list ensemble: Ensemble data :return obj: Dataframe """ logger_dataframes.info("enter ens_to_df") # "Flatten" the nested lists. Bring all nested lists up to top-level. Output looks like [ ...
def lipd_to_df(metadata, csvs): """ Create an organized collection of data frames from LiPD data :param dict metadata: LiPD data :param dict csvs: Csv data :return dict: One data frame per table, organized in a dictionary by name """ dfs = {} logger_dataframes.info("enter lipd_to_df") ...
def ts_to_df(metadata): """ Create a data frame from one TimeSeries object :param dict metadata: Time Series dictionary :return dict: One data frame per table, organized in a dictionary by name """ logger_dataframes.info("enter ts_to_df") dfs = {} # Plot the variable + values vs year, a...
def _plot_ts_cols(ts): """ Get variable + values vs year, age, depth (whichever are available) :param dict ts: TimeSeries dictionary :return dict: Key: variableName, Value: Panda Series object """ logger_dataframes.info("enter get_ts_cols()") d = {} # Not entirely necessary, but this wi...
def _get_dfs(csvs): """ LiPD Version 1.2 Create a data frame for each table for the given key :param dict csvs: LiPD metadata dictionary :return dict: paleo data data frames """ logger_dataframes.info("enter get_lipd_cols") # placeholders for the incoming data frames dfs = {"chronDat...
def _get_key_data(d, key): """ Generic function to grab dictionary data by key with error handling :return: """ d2 = "" try: d2 = d[key] except KeyError: logger_dataframes.info("get_key_data: KeyError: {}".format(key)) return d2
def get_filtered_dfs(lib, expr): """ Main: Get all data frames that match the given expression :return dict: Filenames and data frames (filtered) """ logger_dataframes.info("enter get_filtered_dfs") dfs = {} tt = None # Process all lipds files or one lipds file? specific_files = _c...
def _match_dfs_expr(lo_meta, expr, tt): """ Use the given expression to get all data frames that match the criteria (i.e. "paleo measurement tables") :param dict lo_meta: Lipd object metadata :param str expr: Search expression :param str tt: Table type (chron or paleo) :return list: All filename...
def _match_filenames_w_dfs(filenames, lo_dfs): """ Match a list of filenames to their data frame counterparts. Return data frames :param list filenames: Filenames of data frames to retrieve :param dict lo_dfs: All data frames :return dict: Filenames and data frames (filtered) """ logger_data...
def _check_expr_filename(expr): """ Split the expression and look to see if there's a specific filename that the user wants to process. :param str expr: Search expression :return str: Filename or None """ expr_lst = expr.split() f = [x for x in expr_lst if x not in DATA_FRAMES and x.endswith...
def lipd_read(path): """ Loads a LiPD file from local path. Unzip, read, and process data Steps: create tmp, unzip lipd, read files into memory, manipulate data, move to original dir, delete tmp. :param str path: Source path :return none: """ _j = {} dir_original = os.getcwd() # Im...
def lipd_write(_json, path): """ Saves current state of LiPD object data. Outputs to a LiPD file. Steps: create tmp, create bag dir, get dsn, splice csv from json, write csv, clean json, write json, create bagit, zip up bag folder, place lipd in target dst, move to original dir, delete tmp :par...
def _bulk_size_generator(num_records, bulk_size, active): """ Generate bulk_size until num_records is reached or active becomes false >>> gen = _bulk_size_generator(155, 50, [True]) >>> list(gen) [50, 50, 50, 5] """ while active and num_records > 0: req_size = min(num_records, bulk_size...
def insert_fake_data(hosts=None, table=None, num_records=1e5, bulk_size=1000, concurrency=25, mapping_file=None): """Generate random data and insert it into a table. This will read the table schema and then...
def main(self): """ Main function that gets file(s), creates outputs, and runs all operations. :return dict: Updated or original data for jsonld file """ logger_doi_resolver.info("enter doi_resolver") for idx, pub in enumerate(self.root_dict['pub']): # Retriev...
def compare_replace(pub_dict, fetch_dict): """ Take in our Original Pub, and Fetched Pub. For each Fetched entry that has data, overwrite the Original entry :param pub_dict: (dict) Original pub dictionary :param fetch_dict: (dict) Fetched pub dictionary from doi.org :return: (dic...
def noaa_citation(self, doi_string): """ Special instructions for moving noaa data to the correct fields :param doi_string: (str) NOAA url :return: None """ # Append location 1 if 'link' in self.root_dict['pub'][0]: self.root_dict['pub'][0]['link'].app...
def illegal_doi(self, doi_string): """ DOI string did not match the regex. Determine what the data is. :param doi_string: (str) Malformed DOI string :return: None """ logger_doi_resolver.info("enter illegal_doi") # Ignores empty or irrelevant strings (blank, space...
def compile_fetch(self, raw, doi_id): """ Loop over Raw and add selected items to Fetch with proper formatting :param dict raw: JSON data from doi.org :param str doi_id: :return dict: """ fetch_dict = OrderedDict() order = {'author': 'author', 'type': 'typ...
def get_data(self, doi_id, idx): """ Resolve DOI and compile all attributes into one dictionary :param str doi_id: :param int idx: Publication index :return dict: Updated publication dictionary """ tmp_dict = self.root_dict['pub'][0].copy() try: ...
def find_doi(self, curr_dict): """ Recursively search the file for the DOI id. More taxing, but more flexible when dictionary structuring isn't absolute :param dict curr_dict: Current dictionary being searched :return dict bool: Recursive - Current dictionary, False flag that DOI was not...
def cast_values_csvs(d, idx, x): """ Attempt to cast string to float. If error, keep as a string. :param dict d: Data :param int idx: Index number :param str x: Data :return any: """ try: d[idx].append(float(x)) except ValueError: d[idx].append(x) # logger_mi...
def cast_float(x): """ Attempt to cleanup string or convert to number value. :param any x: :return float: """ try: x = float(x) except ValueError: try: x = x.strip() except AttributeError as e: logger_misc.warn("parse_str: AttributeError: Stri...
def cast_int(x): """ Cast unknown type into integer :param any x: :return int: """ try: x = int(x) except ValueError: try: x = x.strip() except AttributeError as e: logger_misc.warn("parse_str: AttributeError: String not number or word, {}, {}...
def clean_doi(doi_string): """ Use regex to extract all DOI ids from string (i.e. 10.1029/2005pa001215) :param str doi_string: Raw DOI string value from input file. Often not properly formatted. :return list: DOI ids. May contain 0, 1, or multiple ids. """ regex = re.compile(r'\b(10[.][0-9]{3,}...
def decimal_precision(row): """ Change the "precision" of values before writing to CSV. Each value is rounded to 3 numbers. ex: 300 -> 300 ex: 300.123456 -> 300.123 ex: 3.123456e-25 - > 3.123e-25 :param tuple row: Row of numbers to process :return list row: Processed row """ # _row...
def fix_coordinate_decimal(d): """ Coordinate decimal degrees calculated by an excel formula are often too long as a repeating decimal. Round them down to 5 decimals :param dict d: Metadata :return dict d: Metadata """ try: for idx, n in enumerate(d["geo"]["geometry"]["coordinates"]...
def generate_timestamp(fmt=None): """ Generate a timestamp to mark when this file was last modified. :param str fmt: Special format instructions :return str: YYYY-MM-DD format, or specified format """ if fmt: time = dt.datetime.now().strftime(fmt) else: time = dt.date.today(...
def generate_tsid(size=8): """ Generate a TSid string. Use the "PYT" prefix for traceability, and 8 trailing generated characters ex: PYT9AG234GS :return str: TSid """ chars = string.ascii_uppercase + string.digits _gen = "".join(random.choice(chars) for _ in range(size)) return "PYT" +...
def get_appended_name(name, columns): """ Append numbers to a name until it no longer conflicts with the other names in a column. Necessary to avoid overwriting columns and losing data. Loop a preset amount of times to avoid an infinite loop. There shouldn't ever be more than two or three identical vari...
def get_authors_as_str(x): """ Take author or investigator data, and convert it to a concatenated string of names. Author data structure has a few variations, so account for all. :param any x: Author data :return str: Author string """ _authors = "" # if it's a string already, we're don...
def get_dsn(d): """ Get the dataset name from a record :param dict d: Metadata :return str: Dataset name """ try: return d["dataSetName"] except Exception as e: logger_misc.warn("get_dsn: Exception: No datasetname found, unable to continue: {}".format(e)) exit(1)
def get_ensemble_counts(d): """ Determine if this is a 1 or 2 column ensemble. Then determine how many columns and rows it has. :param dict d: Metadata (table) :return dict _rows_cols: Row and column counts """ _rows_cols = {"rows": 0, "cols": 0} try: if len(d) == 1: fo...
def get_missing_value_key(d): """ Get the Missing Value entry from a table of data. If none is found, try the columns. If still none found, prompt user. :param dict d: Table of data :return str _mv: Missing Value """ _mv = "nan" # Attempt to find a table-level missing value key try...
def get_variable_name_col(d): """ Get the variable name from a table or column :param dict d: Metadata (column) :return str var: Variable name """ var = "" try: var = d["variableName"] except KeyError: try: var = d["name"] except KeyError: ...
def get_table_key(key, d, fallback=""): """ Try to get a table name from a data table :param str key: Key to try first :param dict d: Data table :param str fallback: (optional) If we don't find a table name, use this as a generic name fallback. :return str var: Data table name """ try: ...
def is_ensemble(d): """ Check if a table of data is an ensemble table. Is the first values index a list? ensemble. Int/float? not ensemble. :param dict d: Table data :return bool: Ensemble or not ensemble """ for var, data in d.items(): try: if isinstance(data["number"], lis...
def load_fn_matches_ext(file_path, file_type): """ Check that the file extension matches the target extension given. :param str file_path: Path to be checked :param str file_type: Target extension :return bool correct_ext: Extension match or does not match """ correct_ext = False curr_e...
def match_operators(inp, relate, cut): """ Compare two items. Match a string operator to an operator function :param str inp: Comparison item :param str relate: Comparison operator :param any cut: Comparison item :return bool truth: Comparison truth """ logger_misc.info("enter match_ope...
def match_arr_lengths(l): """ Check that all the array lengths match so that a DataFrame can be created successfully. :param list l: Nested arrays :return bool: Valid or invalid """ try: # length of first list. use as basis to check other list lengths against. inner_len = len(l[...
def mv_files(src, dst): """ Move all files from one directory to another :param str src: Source directory :param str dst: Destination directory :return none: """ # list the files in the src directory files = os.listdir(src) # loop for each file found for file in files: #...
def normalize_name(s): """ Remove foreign accents and characters to normalize the string. Prevents encoding errors. :param str s: String :return str s: String """ # Normalize the string into a byte string form s = unicodedata.normalize('NFKD', s).encode('ascii', 'ignore') # Remove the b...
def path_type(path, target): """ Determine if given path is file, directory, or other. Compare with target to see if it's the type we wanted. :param str path: Path :param str target: Target type wanted :return bool: Path is what it claims to be (True) or mismatch (False) """ if os.path.isfi...
def print_filename(path): """ Print out lipd filename that is being read or written :param str path: all file metadata :return str: filename """ if os.path.basename(path): return os.path.basename(path) return path
def prompt_protocol(): """ Prompt user if they would like to save pickle file as a dictionary or an object. :return str: Answer """ stop = 3 ans = "" while True and stop > 0: ans = input("Save as (d)ictionary or (o)bject?\n" "* Note:\n" "Dicti...
def put_tsids(x): """ (Recursive) Add in TSids into any columns that do not have them. Look for "columns" keys, and then start looping and adding generated TSids to each column :param any x: Unknown :return any x: Unknown """ try: if isinstance(x, dict): try: ...
def rm_empty_fields(x): """ (Recursive) Go through N number of nested data types and remove all empty entries. :param any x: Unknown :return any x: Unknown """ # No logger here because the function is recursive. # Int types don't matter. Return as-is. if not isinstance(x, int) and not i...
def rm_empty_doi(d): """ If an "identifier" dictionary has no doi ID, then it has no use. Delete it. :param dict d: Metadata :return dict d: Metadata """ logger_misc.info("enter remove_empty_doi") try: # Check each publication dictionary for pub in d['pub']: # If...
def rm_files(path, extension): """ Remove all files in the given directory with the given extension :param str path: Directory :param str extension: File type to remove :return none: """ files = list_files(extension, path) for file in files: if file.endswith(extension): ...
def rm_values_fields(x): """ (Recursive) Remove all "values" fields from the metadata :param any x: Any data type :return dict x: Metadata (values removed) """ if isinstance(x, dict): if "values" in x: del x["values"] else: for k, v in x.items(): ...
def rm_missing_values_table(d): """ Loop for each table column and remove the missingValue key & data :param dict d: Metadata (table) :return dict d: Metadata (table) """ try: for k, v in d["columns"].items(): d["columns"][k] = rm_keys_from_dict(v, ["missingValue"]) exce...
def rm_keys_from_dict(d, keys): """ Given a dictionary and a key list, remove any data in the dictionary with the given keys. :param dict d: Metadata :param list keys: Keys to be removed :return dict d: Metadata """ # Loop for each key given for key in keys: # Is the key in the ...
def _replace_missing_values_table(values, mv): """ Receive all table column values as a list of lists. Loop for each column of values :param list values: Metadata (columns) :param any mv: Missing value currently in use :return list: Metadata (columns) """ for idx, column in enumerate(value...
def _replace_missing_values_column(values, mv): """ Replace missing values in the values list where applicable :param list values: Metadata (column values) :return list values: Metadata (column values) """ for idx, v in enumerate(values): try: if v in EMPTY or v == mv: ...
def split_path_and_file(s): """ Given a full path to a file, split and return a path and filename :param str s: Path :return str _path: Directory Path :return str _filename: Filename """ _path = s _filename = "" try: x = os.path.split(s) _path = x[0] _filenam...
def unwrap_arrays(l): """ Unwrap nested lists to be one "flat" list of lists. Mainly for prepping ensemble data for DataFrame() creation :param list l: Nested lists :return list l2: Flattened lists """ # keep processing until all nesting is removed process = True # fail safe: cap the lo...
def extract(d, whichtables, mode, time): """ LiPD Version 1.3 Main function to initiate LiPD to TSOs conversion. Each object has a "paleoNumber" or "chronNumber" "tableNumber" "modelNumber" "time_id" "mode" - chronData or paleoData "tableType" - "meas" "ens" "summ" :param ...
def _extract_fund(l, _root): """ Creates flat funding dictionary. :param list l: Funding entries """ logger_ts.info("enter _extract_funding") for idx, i in enumerate(l): for k, v in i.items(): _root['funding' + str(idx + 1) + '_' + k] = v return _root
def _extract_geo(d, _root): """ Extract geo data from input :param dict d: Geo :return dict _root: Root data """ logger_ts.info("enter ts_extract_geo") # May not need these if the key names are corrected in the future. # COORDINATE ORDER: [LON, LAT, ELEV] x = ['geo_meanLon', 'geo_mea...
def _extract_pub(l, _root): """ Extract publication data from one or more publication entries. :param list l: Publication :return dict _root: Root data """ logger_ts.info("enter _extract_pub") # For each publication entry for idx, pub in enumerate(l): logger_ts.info("processing p...
def _extract_authors(pub, idx, _root): """ Create a concatenated string of author names. Separate names with semi-colons. :param any pub: Publication author structure is ambiguous :param int idx: Index number of Pub """ logger_ts.info("enter extract_authors") try: # DOI Author data. ...
def _extract_pc(d, root, pc, whichtables): """ Extract all data from a PaleoData dictionary. :param dict d: PaleoData dictionary :param dict root: Time series root data :param str pc: paleoData or chronData :param str whichtables: all, meas, summ, or ens :return list _ts: Time series """...
def _extract_method(method): """ Make a timeseries-formatted version of model method data :param dict method: Method data :return dict _method: Method data, formatted """ _method = {} for k,v in method.items(): _method["method_" + k] = v return _method
def _extract_special(current, table_data): """ Extract year, age, and depth column from table data :param dict table_data: Data at the table level :param dict current: Current data :return dict current: """ logger_ts.info("enter extract_special") try: # Add age, year, and depth c...
def _extract_table_root(d, current, pc): """ Extract data from the root level of a paleoData table. :param dict d: paleoData table :param dict current: Current root data :param str pc: paleoData or chronData :return dict current: Current root data """ logger_ts.info("enter extract_table_...
def _extract_table_model(table_data, current, tt): """ Add in modelNumber and summaryNumber fields if this is a summary table :param dict table_data: Table data :param dict current: LiPD root data :param str tt: Table type "summ", "ens", "meas" :return dict current: Current root data """ ...
def _extract_table(table_data, current, pc, ts, tt): """ Use the given table data to create a time series entry for each column in the table. :param dict table_data: Table data :param dict current: LiPD root data :param str pc: paleoData or chronData :param list ts: Time series (so far) :pa...
def _extract_columns(d, tmp_tso, pc): """ Extract data from one paleoData column :param dict d: Column dictionary :param dict tmp_tso: TSO dictionary with only root items :return dict: Finished TSO """ logger_ts.info("enter extract_columns") for k, v in d.items(): if isinstance(v...
def collapse(l, raw): """ LiPD Version 1.3 Main function to initiate time series to LiPD conversion Each object has a: "paleoNumber" or "chronNumber" "tableNumber" "modelNumber" "time_id" "mode" - chronData or paleoData "tableType" - "meas" "ens" "summ" :param list l: Time ...
def _get_current_names(current, dsn, pc): """ Get the table name and variable name from the given time series entry :param dict current: Time series entry :param str pc: paleoData or chronData :return str _table_name: :return str _variable_name: """ _table_name = "" _variable_name =...
def _collapse_root(master, current, dsn, pc): """ Collapse the root items of the current time series entry :param dict master: LiPD data (so far) :param dict current: Current time series entry :param str dsn: Dataset name :param str pc: paleoData or chronData (mode) :return dict master: ...
def _collapse_author(s): """ Split author string back into organized dictionary :param str s: Formatted names string "Last, F.; Last, F.; etc.." :return list of dict: One dictionary per author name """ logger_ts.info("enter collapse_author") l = [] authors = s.split(';') for author i...
def _collapse_pc(master, current, dsn, pc): """ Collapse the paleo or chron for the current time series entry :param dict master: LiPD data (so far) :param dict current: Current time series entry :param str dsn: Dataset name :param str pc: paleoData or chronData :return dict master: """...
def _collapse_table_root(current, dsn, pc): """ Create a table with items in root given the current time series entry :param dict current: Current time series entry :param str dsn: Dataset name :param str pc: paleoData or chronData :return dict _tmp_table: Table data """ logger_ts.info("...
def _collapse_column(current, pc): """ Collapse the column data and :param current: :param pc: :return: """ _tmp_column = {} try: for k, v in current.items(): try: # We do not want to store these table keys at the column level. if not a...
def mode_ts(ec, mode="", ts=None): """ Get string for the mode :param str ec: extract or collapse :param str mode: "paleo" or "chron" mode :param list ts: Time series (for collapse) :return str phrase: Phrase """ phrase = "" if ec == "extract": if mode=="chron": p...
def translate_expression(expression): """ Check if the expression is valid, then check turn it into an expression that can be used for filtering. :return list of lists: One or more matches. Each list has 3 strings. """ logger_ts.info("enter translate_expression") m = re_filter_expr.findall(expre...
def get_matches(expr_lst, ts): """ Get a list of TimeSeries objects that match the given expression. :param list expr_lst: Expression :param list ts: TimeSeries :return list new_ts: Matched time series objects :return list idxs: Indices of matched objects """ logger_ts.info("enter get_ma...