iode.Tables.search
- Tables.search(pattern: str, word: bool = True, case_sensitive: bool = True, in_name: bool = True, in_formula: bool = True, in_text: bool = True, list_result: str = '_RES') List[str]
Return a list of all objects from the current database having a specific pattern in their names or LEC expression, comment…
The following characters in pattern have a special meaning:
* : any character sequence, even empty
? : any character (one and only one)
@ : any alphanumerical char [A-Za-z0-9]
& : any non alphanumerical char
| : any alphanumeric character or none at the beginning and end of a string
! : any non-alphanumeric character or none at the beginning and end of a string
`` : escape the next character
The Search method depends on the type of object:
Comments: the name and text of the comments are analyzed
Equations: the name and LEC form of the equations are analyzed
Identities: the name and LEC form of the identities are analyzed
Lists: the name and text of the lists are analyzed
Scalars: the name of the scalars is analyzed
Tables: the table name, titles and LEC forms are analyzed
Variables: the name of the variables is analyzed
- Parameters:
- pattern: str
string to search
- word: bool, optional
Whether or not the pattern to be searched for must be a whole word and not part of a word. Default to True.
- case_sensitive: bool, optional
Whether or not the search is case sensitive. Default to True.
- in_name: bool, optional
Whether or not to also search in object names. Default to True.
- in_formula: bool, optional
Whether or not to also search in LEC expressions (for Equations, Identities and Tables (LEC cells)). Default to True.
- in_text: bool, optional
Whether or not to also search in texts (for Comments, lists, Equations (comment) and Tables (text cells)). Default to True.
- list_result: str, optional
Name of the IODE list in which the resulting list of objects is saved. Default to _RES.
- Returns:
- list(str)
Examples
>>> from iode import SAMPLE_DATA_DIR >>> from iode import comments, equations, identities, lists, tables >>> comments.load(f"{SAMPLE_DATA_DIR}/fun.cmt") Loading .../fun.cmt 317 objects loaded >>> equations.load(f"{SAMPLE_DATA_DIR}/fun.eqs") Loading .../fun.eqs 274 objects loaded >>> identities.load(f"{SAMPLE_DATA_DIR}/fun.idt") Loading .../fun.idt 48 objects loaded >>> lists.load(f"{SAMPLE_DATA_DIR}/fun.lst") Loading .../fun.lst 17 objects loaded >>> tables.load(f"{SAMPLE_DATA_DIR}/fun.tbl") Loading .../fun.tbl 46 objects loaded
>>> # get list of comments containing 'Bruto' >>> comments.search("Bruto") ['GOSF', 'GOSG', 'GOSH', 'GOSH_', ..., 'VIF', 'VIG', 'YDH', 'YDH_']
>>> # get list of equations containing 'AOUC' >>> equations.search("AOUC") ['AOUC', 'PC', 'PIF', 'PXS', 'QXAB']
>>> # get list of identities containing 'NDOMY' >>> identities.search("NDOMY") ['LCLASS', 'LKEYN', 'UCLASS']
>>> # get list of IODE lists containing 'AOUC' >>> lists.search("AOUC") ['COPY0', 'ENDO0', 'TOTAL0']
>>> # get list of IODE tables containing 'AOUC' in cells >>> tables.search("AOUC") ['ANAPRIX', 'MULT1FR', 'MULT1RESU', 'T1', 'T1NIVEAU']