Selection Overview¶
Here you will find an overview of psv’s objects and methods, but not the objects attributes which are generated dynamically by psv.
Api¶
Selections¶
- class
psv.core.objects.selections.Selection(selection, api_mother)¶
addcolumn(columnname, columndata='', add_to_columns=True)¶Adds a column :param columnname: Name of the column to add. :param columndata: The default value of the new column. :param add_to_columns: Determines whether this column should
be added to the internal tracker.
all_output()¶Sets all rows to output
columns¶
disable(selectionfirstarg_data=None, **kwargs)¶
enable(selectionfirstarg_data=None, **kwargs)¶
fast_add(sel)¶faster than __add__, but doesn’t guarantee no repeats.
find(selectionfirstarg_data=None, **kwargs)¶
find_all(selectionfirstarg_data=None, **kwargs)¶
flip(selectionfirstarg_data=None, **kwargs)¶
flip_output()¶flips all output boolean for all rows in this selection
grab(*args)¶Grabs specified columns from every row
Returns: tupleof the result.
len_no_output()¶
lenoutput()¶
merge(*args, force_saftey=True)¶Merges selctions
- Note: This merge’s algorithm relies on the uniqueness of the rows.
- duplicate rows will be only represented by 1 row.
Note: This Merge relies on all data in a row being hashable, use non_hash_merge if you can’t guarantee this.
- Saftey Note: You will lose saftey on some of Selection’s functionality
- (such as creating sub-selections) or finding a row if all rows don’t have the same exact columns)
no_output()¶Sets all rows to not output
non_hash_merge(*args)¶This merge uses the exploits the __output__ flag of a row instead of it’s hashed contents This allows merging of of rows that contain unhashable mutable data such as sets or dict. This doesn’t remove duplicate rows but is slightly faster and can handle all datatyps.
- Note: This merge is effectively single-threaded and editing the outputflag during
- running will effect results of the merge and may have unattended conquences the state of this selection.
nonoutputtedrows¶
output(loc=None, columns=None, quote_all=None, encoding='utf-8')¶
outputs(columns=None, quote_all=None, encoding='utf-8')¶Outputs to str
outputtedrows¶
remove_duplicates(soft=True)¶Removes duplicates. if soft is true, return a selection else: edit this object
rows¶
safe_merge(*args)¶This is much slower but is hashes rows as processed instead of preprocessing them
safe_select(selectionfirstarg_data=None, **kwargs)¶Method for selecting part of the csv document. generates a function based of the parameters given.
- This instantly processes the select instead of lazy loading.
- Preventing race conditions under most uses cases.
select(selectionfirstarg_data=None, **kwargs)¶Method for selecting part of the csv document. generates a function based of the parameters given.
single_find(selectionfirstarg_data=None, **kwargs)¶Find a single row based off search criteria given. will raise error if returns more than one result
tabulate(limit=100, format='grid', only_ascii=True, columns=None, text_limit=None, remove_newline=True)¶
unique(*args)¶Grabs specified columns from every row
Returns: setof the result.