diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3fbf1dee..92b0ba2e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -77,7 +77,7 @@ jobs: - name: Generate libdoc run: | mkdir -p docs - libdoc src/Tables docs/keywords.html + libdoc -F MARKDOWN src/Tables docs/keywords.html cp docs/keywords.html docs/index.html touch docs/.nojekyll diff --git a/pyproject.toml b/pyproject.toml index 6e0f037b..45302c45 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,7 +44,10 @@ dev = [ "pytest-cov", "pre-commit", "mypy", - "robotframework-robocop" + "robotframework-robocop", + "robotframework==7.5", + "markdown", + "Pygments" ] [project.urls] @@ -114,13 +117,16 @@ exclude_lines = [ dependencies = [ "ruff", "pytest", - "pytest-cov" + "pytest-cov", + "robotframework==7.5", + "markdown", + "Pygments" ] [tool.hatch.envs.dev.scripts] lint = "ruff check ." atest = "robot tests/atest/" utest = "pytest --cov=Tables --cov-report=term-missing --cov-branch --cov-fail-under=95" -docs = "libdoc src/Tables results/keyword_docs.html" +docs = "libdoc -F MARKDOWN src/Tables results/keyword_docs.html" [tool.mypy] python_version = "3.10" diff --git a/src/Tables/__init__.py b/src/Tables/__init__.py index 462ac95f..6aa56cec 100644 --- a/src/Tables/__init__.py +++ b/src/Tables/__init__.py @@ -31,24 +31,24 @@ class Tables(HybridCore): """ ``TableLibrary`` is a generic automation library for working with files like csv, parquet, etc. - == Table of content == + ## Table of content %TOC% - == Supported File Types == + # Supported File Types - CSV - Excel - Parquet - TXT -> will be interpreted as CSV file - More coming soon... - == Supported File Encoding == + # Supported File Encoding - utf-8 - utf-16 - latin-1 - further more... (define your own file encoding with the given library argument) - == Live Data Streaming == + # Live Data Streaming Some keywords allow you to write the inserted or appended data directly into an output table file. By default, the table library writes the modified table data first into the internal cache. In this case, you decide when to write the data into a file. @@ -58,108 +58,128 @@ class Tables(HybridCore): Afterwards, every keyword that allows the on-the-fly streaming, writes the new data directly into the file system instead of modifying the table just in the cache. Example: - | # enable the streaming on-the-fly - | Configure Streaming True Test - | - | VAR ${filepath} = ${CURDIR}/results/test_writer_live_streaming_append_row.csv - | VAR @{headers} = counter random - | ${uuid} = Tables.Create Table headers=${headers} file_path=${filepath} - | - | # append ten rows on-the-fly within the given csv file - | FOR ${i} IN RANGE ${10} - | ${random} = Generate Random String 10 - | VAR @{row} = ${i} ${random} - | Tables.Append Row ${row} - | - | ${table_content} = Tables.Read Table ${filepath} - | Should Be Equal ${table_content}[-1][1] ${random} - | END - - == Excel Files == + ```robotframework + *** Test Cases *** + Enable live data streaming + # enable the streaming on-the-fly + Configure Streaming True Test + + VAR ${filepath} = ${CURDIR}/results/test_writer_live_streaming_append_row.csv + VAR @{headers} = counter random + ${uuid} = Tables.Create Table headers=${headers} file_path=${filepath} + + # append ten rows on-the-fly within the given csv file + FOR ${i} IN RANGE ${10} + ${random} = Generate Random String 10 + VAR @{row} = ${i} ${random} + Tables.Append Row ${row} + + ${table_content} = Tables.Read Table ${filepath} + Should Be Equal ${table_content}[-1][1] ${random} + END + ``` + + # Excel Files + We have included a basic handling of ``Excel`` files, but for more complex excel features, please take a look at the following library: - [https://pypi.org/project/robotframework-excelsage|robotframework-excelsage]. - \nThis library got especially written to work with Excel files, sheets, etc... - - == Examples == - === File Format - CSV === - | # Reading CSV file with header column - | ${content} = Tables.Read Table ${CURDIR}${/}testdata${/}example_01.csv - | ${result} = BuiltIn.Evaluate "${content}[0][0]" == "index" - | BuiltIn.Should Be True ${result} - | - | - | # Reading CSV file without header column - | Tables.Configure Ignore Header True - | ${content} = Tables.Read Table ${CURDIR}${/}testdata${/}example_01.csv - | ${result} = BuiltIn.Evaluate "index" not in "${content}" - | BuiltIn.Should Be True ${result} - - === File Format - Parquet === - | Tables.Configure File Type Parquet - | ${content} = Tables.Read Table ${CURDIR}${/}testdata${/}example_05.parquet - | ${result} = BuiltIn.Evaluate "${content}[0][0]" == "_time" - | BuiltIn.Should Be True ${result} - - === Create new empty table - don't save to file system === - | # Create some data which should be inserted into the new table - | VAR @{headers} = name age - | VAR @{person1} = Michael 34 - | VAR @{person2} = John 19 - | - | # Create empty table object - internally in cache - | ${uuid} = Tables.Create Table headers=${headers} - | - | # Append some rows - | Tables.Append Row ${person1} - | Tables.Append Row ${person2} - | Count Table ${uuid} Rows equal ${3} - | - | # Append a column - | VAR @{column1} = city MG ERL - | Tables.Append Column ${column1} - | Count Table ${uuid} Columns equal ${3} - | - | # Optional: Set new table cell value - | Get Table Cell 1 1 equals 34 - | Tables.Set Table Cell 25 0 1 - | Get Table Cell 1 1 equals 25 - | - | # Insert a new row into the existing table object - | VAR @{insert_row} = Lu 26 Hamburg - | Insert Row ${insert_row} 0 - | Get Table Cell 1 0 equals Lu - | Count Table ${uuid} Rows equal ${4} - - === Create new empty table - save to file system === - | # Generate new headers which should be used in the table - | VAR @{headers} = name age - | - | # Create new table object - | ${uuid} = Create Table ${headers} - | - | # Generate some random data & append as rows to new table - | FOR ${_} IN RANGE ${100} - | ${a} = Generate Random String - | ${b} = Generate Random String - | VAR @{data} ${a} ${b} - | Tables.Append Row ${data} - | END - | - | # Ensure that data got written into internal table object - | Count Table ${uuid} Rows equals ${101} - | - | # Write table to specific file path -> write from cache into persistant file - | Write Table ${uuid} ${CURDIR}/results/test_writer_new_table.csv - | - | # Check table content again, but now read table from file path! - | Count Table ${CURDIR}/results/test_writer_new_table.csv Rows equals ${101} - - === Parquet === - | Tables.Configure File Type Parquet - | ${content} = Tables.Read Table ${CURDIR}${/}testdata${/}example_05.parquet - | ${result} = BuiltIn.Evaluate "${content}[0][0]" == "_time" - | BuiltIn.Should Be True ${result} + [robotframework-excelsage](https://pypi.org/project/robotframework-excelsage). + + This library got especially written to work with Excel files, sheets, etc... + + # Examples + + ## File Format - CSV + + ```robotframework + *** Test Cases *** + Reading CSV file with header column + ${content} = Tables.Read Table ${CURDIR}${/}testdata${/}example_01.csv + ${result} = BuiltIn.Evaluate "${content}[0][0]" == "index" + BuiltIn.Should Be True ${result} + + + Reading CSV file without header column + Tables.Configure Ignore Header True + ${content} = Tables.Read Table ${CURDIR}${/}testdata${/}example_01.csv + ${result} = BuiltIn.Evaluate "index" not in "${content}" + BuiltIn.Should Be True ${result} + ``` + + ## File Format - Parquet + + ```robotframework + *** Test Cases *** + Read Parquet Table File + Tables.Configure File Type Parquet + ${content} = Tables.Read Table ${CURDIR}${/}testdata${/}example_05.parquet + ${result} = BuiltIn.Evaluate "${content}[0][0]" == "_time" + BuiltIn.Should Be True ${result} + ``` + + ## Create new empty table - don't save to file system + + ```robotframework + *** Test Cases *** + Create empty table saved in cache + # Create some data which should be inserted into the new table + VAR @{headers} = name age + VAR @{person1} = Michael 34 + VAR @{person2} = John 19 + + # Create empty table object - internally in cache + ${uuid} = Tables.Create Table headers=${headers} + + # Append some rows + Tables.Append Row ${person1} + Tables.Append Row ${person2} + Count Table ${uuid} Rows equal ${3} + + # Append a column + VAR @{column1} = city MG ERL + Tables.Append Column ${column1} + Count Table ${uuid} Columns equal ${3} + + # Optional: Set new table cell value + Get Table Cell 1 1 equals 34 + Tables.Set Table Cell 25 0 1 + Get Table Cell 1 1 equals 25 + + # Insert a new row into the existing table object + VAR @{insert_row} = Lu 26 Hamburg + Insert Row ${insert_row} 0 + Get Table Cell 1 0 equals Lu + Count Table ${uuid} Rows equal ${4} + ``` + + ## Create new empty table - save to file system + + ```robotframework + *** Test Cases *** + Create empty table & save to file system + # Generate new headers which should be used in the table + VAR @{headers} = name age + + # Create new table object + ${uuid} = Create Table ${headers} + + # Generate some random data & append as rows to new table + FOR ${_} IN RANGE ${100} + ${a} = Generate Random String + ${b} = Generate Random String + VAR @{data} ${a} ${b} + Tables.Append Row ${data} + END + + # Ensure that data got written into internal table object + Count Table ${uuid} Rows equals ${101} + + # Write table to specific file path -> write from cache into persistant file + Write Table ${uuid} ${CURDIR}/results/test_writer_new_table.csv + + # Check table content again, but now read table from file path! + Count Table ${CURDIR}/results/test_writer_new_table.csv Rows equals ${101} + ``` """ def __init__( # noqa: PLR0913 @@ -175,17 +195,15 @@ def __init__( # noqa: PLR0913 missing_as_none: bool = False, ): """ - ``TableLibrary`` can be controlled by the following arguments: - - | =`Argument`= | =`Description`= | - | ``file_type`` | Choose the file type to test initially. | - | ``file_encoding`` | Defiine the file encoding - select from given hints or define your own by string value. | - | ``separator`` | Define a separator for parsing the files. | - | ``ignore_header`` | Define if headers in files should be ignored. Default is ``False`` | - | ``line_terminator`` | Define the required line terminator for your table files. Default is ``False`` | - | ``quoting`` | Define which values should be surrounded with quotes, please check the CSV quoting for more details. Default is ``MINIMAL`` | - | ``quoting_character`` | Define quoting character to use for writing table files. Default is ``\"`` | - | ``missing_as_none`` | Return parsed missing values as Python ``None`` instead of pandas missing values. Default is ``False`` | + Args: + file_type: Choose the file type to test initially. + file_encoding: Defiine the file encoding - select from given hints or define your own by string value. + separator: Define a separator for parsing the files. + ignore_header: Define if headers in files should be ignored. Default is ``False`` + line_terminator: Define the required line terminator for your table files. Default is ``False`` + quoting: Define which values should be surrounded with quotes, please check the CSV quoting for more details. Default is ``MINIMAL`` + quoting_character: Define quoting character to use for writing table files. Default is ``\"`` + missing_as_none: Return parsed missing values as Python ``None`` instead of pandas missing values. Default is ``False`` """ # required variables for SettingsScope mechanism diff --git a/src/Tables/keywords/configuration.py b/src/Tables/keywords/configuration.py index efb45730..f5f6e471 100644 --- a/src/Tables/keywords/configuration.py +++ b/src/Tables/keywords/configuration.py @@ -30,11 +30,33 @@ class ConfigCtx: class Configuration(LibraryAttributes): @keyword(tags=["Configuration"]) - def get_library_configuration(self) -> dict: + def get_library_configuration(self) -> ConfigCtx: """ Keyword returns the current internal library configuration. - Return value is type ``ConfigCtx`` and contains all relevant configuration parameters. + Returns: + Return value is type ``ConfigCtx`` and contains all relevant configuration parameters. + + ## ConfigCtx Dto + ```python + class ConfigCtx: + file_type: FileType + separator: Delimiter + quoting: Quoting + quoting_character: QuotingCharacter + line_terminator: LineTerminator + file_encoding: FileEncoding + ignore_header: bool + enable_streaming: bool + missing_as_none: bool + ``` + + ## Example + ```robotframework + *** Test Cases *** + Get Library Configuration + &{cfg} = Get Library Configuration + ``` """ return asdict( ConfigCtx( @@ -55,13 +77,18 @@ def configure_file_type(self, file_type: FileType, scope: Scope = Scope.Suite): """ Change the internal file type during your test execution dynamically. - | =`Arguments`= | =`Description`= | - | ``file_type`` | Choose the new file type | - - == Example == - | Configure File Type CSV - | Configure File Type Excel - | Configure File Type Parquet + Args: + file_type: Choose the new file type. + scope: Scope in which the setting applies. + + ## Example + ```robotframework + *** Test Cases *** + Configure File Type + Configure File Type CSV + Configure File Type Excel + Configure File Type Parquet + ``` """ old_config = self.file_type self.file_type_stack.set(file_type, scope) @@ -73,13 +100,18 @@ def configure_separator(self, separator: Delimiter, scope: Scope = Scope.Suite): """ Change the internal separator during your test execution dynamically. - | =`Arguments`= | =`Description`= | - | ``separator`` | Define a new separator | - - == Example == - | Configure Delimiter ; - | Configure Delimiter , - | Configure Delimiter \\t + Args: + separator: Define a new separator. + scope: Scope in which the setting applies. + + ## Example + ```robotframework + *** Test Cases *** + Configure Separator + Configure Separator ; + Configure Separator , + Configure Separator \\t + ``` """ old_config = self.separator self.separator_stack.set(separator, scope) @@ -91,13 +123,18 @@ def configure_quoting(self, quoting: Quoting, scope: Scope = Scope.Suite): """ Change the internal quoting mode during your test execution dynamically. - | =`Arguments`= | =`Description`= | - | ``quoting`` | Define a new quoting mode | - - == Example == - | Configure Quoting MINIMAL - | Configure Quoting NONNUMERIC - | Configure Quoting NONE + Args: + quoting: Define a new quoting mode. + scope: Scope in which the setting applies. + + ## Example + ```robotframework + *** Test Cases *** + Configure Quoting + Configure Quoting MINIMAL + Configure Quoting NONNUMERIC + Configure Quoting NONE + ``` """ old_config = self.quoting self.quoting_stack.set(quoting, scope) @@ -109,12 +146,17 @@ def configure_quoting_character(self, quoting_character: QuotingCharacter, scope """ Change the internal quoting character during your test execution dynamically. - | =`Arguments`= | =`Description`= | - | ``quoting`` | Define a new quoting mode | - - == Example == - | Configure Quoting Character " - | Configure Quoting Character ' + Args: + quoting_character: Define a new quoting character. + scope: Scope in which the setting applies. + + ## Example + ```robotframework + *** Test Cases *** + Configure Quoting Character + Configure Quoting Character " + Configure Quoting Character ' + ``` """ old_config = self.quoting_character self.quoting_character_stack.set(quoting_character, scope) @@ -126,12 +168,17 @@ def configure_line_terminator(self, line_terminator: LineTerminator, scope: Scop """ Change the internal line terminator during your test execution dynamically. - | =`Arguments`= | =`Description`= | - | ``line_terminator`` | Define a new line_terminator | - - == Example == - | Configure Line Terminator LF - | Configure Line Terminator CRLF + Args: + line_terminator: Define a new line terminator. + scope: Scope in which the setting applies. + + ## Example + ```robotframework + *** Test Cases *** + Configure Line Terminator + Configure Line Terminator LF + Configure Line Terminator CRLF + ``` """ old_config = self.line_terminator self.line_terminator_stack.set(line_terminator, scope) @@ -143,15 +190,20 @@ def configure_file_encoding(self, file_encoding: FileEncoding | str, scope: Scop """ Change the internal file encoding during your test execution dynamically. - | =`Arguments`= | =`Description`= | - | ``file_encoding`` | Define a new file encoding | + Args: + file_encoding: Define a new file encoding. + scope: Scope in which the setting applies. - == Example == - | Configure File Encoding UTF_8 - | Configure File Encoding UTF_16 - | Configure File Encoding LATIN_1 + ## Example + ```robotframework + *** Test Cases *** + Configure File Encoding + Configure File Encoding UTF_8 + Configure File Encoding UTF_16 + Configure File Encoding LATIN_1 + ``` - see [Python Encoding Names|https://docs.python.org/3/library/codecs.html#standard-encodings] + See [Python Encoding Names](https://docs.python.org/3/library/codecs.html#standard-encodings). """ old_config = self.file_encoding self.file_encoding_stack.set( @@ -165,12 +217,17 @@ def configure_ignore_header(self, ignore_header: bool, scope: Scope = Scope.Suit """ Change the internal setting to (not) ignore the data header lines during your test execution dynamically. - | =`Arguments`= | =`Description`= | - | ``ignore_header`` | Ignore / recognize header columns | - - == Example == - | Configure Ignore Header True - | Configure Ignore Header False + Args: + ignore_header: Ignore or recognize header columns. + scope: Scope in which the setting applies. + + ## Example + ```robotframework + *** Test Cases *** + Configure Ignore Header + Configure Ignore Header True + Configure Ignore Header False + ``` """ old_config = self.ignore_header @@ -183,19 +240,24 @@ def configure_streaming(self, enable_streaming: bool, scope: Scope = Scope.Suite """ Enable / disable the direct streaming of data into the given table file. - = Default Behaviour = + ## Default Behaviour By default, you can open a table, modify the content in the internal cache of the Table library and afterwards to write it into a table file. - = Behaviour using Streaming = + ## Behaviour Using Streaming Using the streaming behaviour enables you to write e.g. rows directly into the table file instead of the internal cache. This can be required in case you need the data immediately in the file, and not in the cache. - | =`Arguments`= | =`Description`= | - | ``enable_streaming`` | Set to ``True`` to enable the streaming - default: ``False`` | - - == Example == - | Configure Streaming True - | Configure Streaming False + Args: + enable_streaming: Set to `True` to enable streaming. Default: `False`. + scope: Scope in which the setting applies. + + ## Example + ```robotframework + *** Test Cases *** + Configure Streaming + Configure Streaming True + Configure Streaming False + ``` """ old_config = self.enable_streaming self.enable_streaming_stack.set(enable_streaming, scope) @@ -212,13 +274,17 @@ def configure_missing_as_none(self, missing_as_none: bool, scope: Scope = Scope. Values recognized as missing by the active parser, such as ``N/A`` and ``NULL``, are included. DataFrame results and the library's internal DataFrames are not changed. - | =`Arguments`= | =`Description`= | - | ``missing_as_none`` | Set to ``True`` to return missing values as Python ``None``. Default: ``False`` | - | ``scope`` | Scope in which the setting applies. | - - == Example == - | Configure Missing As None True - | Configure Missing As None False + Args: + missing_as_none: Set to `True` to return missing values as Python `None`. Default: `False`. + scope: Scope in which the setting applies. + + ## Example + ```robotframework + *** Test Cases *** + Configure Missing As None + Configure Missing As None True + Configure Missing As None False + ``` """ old_config = self.missing_as_none self.missing_as_none_stack.set(missing_as_none, scope) diff --git a/src/Tables/keywords/excel.py b/src/Tables/keywords/excel.py index e636eafb..5d8d6798 100644 --- a/src/Tables/keywords/excel.py +++ b/src/Tables/keywords/excel.py @@ -48,16 +48,20 @@ def excel_open(self, alias: str, path: str, sheet_name: str | list[str | int] | Opened file will be stored internally & further keywords can be executed to read & validate the excel data from this data. - | =`Arguments`= | =`Description`= | - | ``alias`` | Define a alias name to identified the open excel file | - | ``path`` | Path to the excel file | - | ``sheet_name`` | Define one or more sheet names to read only specific sheets from the file - default is ``None``to read the complete file | - - == Return Value == - Keyword will return the given alias name. - - == Example == - | Excel Open ${directory_to_file}/excel_file.xlsx + Args: + alias: Define an alias name to identify the opened Excel file. + path: Path to the Excel file. + sheet_name: Define one or more sheet names to read only specific sheets. The default is `None`, which reads the complete file. + + Returns: + Keyword will return the given alias name. + + ## Example + ```robotframework + *** Test Cases *** + Open Excel File + Excel Open ${directory_to_file}/excel_file.xlsx + ``` """ self._file_type_validation() self.file_reader.file_exists(path) @@ -72,14 +76,17 @@ def excel_close(self, alias: str | None = None) -> bool: """ Keyword to close all or just the given excel file. - | =`Arguments`= | =`Description`= | - | ``alias`` | Optional: If given, only the file with this alias is closed. | - - == Example == - | ${alias} = Excel Open statistics ${directory_to_file}/excel_file.xlsx - | - | Excel Close ${alias} # close only one file - | Excel Close # close all opened files + Args: + alias: Optional. If given, only the file with this alias is closed. + + ## Example + ```robotframework + *** Test Cases *** + Close Excel Files + ${alias} = Excel Open statistics ${directory_to_file}/excel_file.xlsx + Excel Close ${alias} # close only one file + Excel Close # close all opened files + ``` """ if not self.df: logger.info("Nothing to close - no file is opened!") @@ -103,8 +110,12 @@ def excel_get_open_files(self) -> list: Keyword returns a list of all currently opened excel files.\n It returns the file name alias, defined when the files were opened. - == Example == - | @{files} = Excel Get Open Files + ## Example + ```robotframework + *** Test Cases *** + Get Open Excel Files + @{files} = Excel Get Open Files + ``` """ files = [] try: @@ -119,12 +130,16 @@ def excel_file_switch(self, alias: str): """ Keyword to switch between opened excel files - only if more than one file is opened. - | =`Arguments`= | =`Description`= | - | ``alias`` | The defined ``alias`` of the file to switch to. | + Args: + alias: The defined alias of the file to switch to. - == Example == - | Excel File Switch file_a - | Excel File Switch file_b + ## Example + ```robotframework + *** Test Cases *** + Switch Excel Files + Excel File Switch file_a + Excel File Switch file_b + ``` """ if len(self.data) <= 1: raise KeyError( @@ -139,11 +154,15 @@ def excel_sheet_read(self, sheet_name: str) -> list[list[Any]]: The currently opened excel file is taken for reading the data - see ``File Open`` & ``File Switch`` keywords. - | =`Arguments`= | =`Description`= | - | ``sheet_name`` | Excel sheet name to read the data from - must be read during file open keyword. | + Args: + sheet_name: Excel sheet name to read. It must have been read during the file open keyword. - == Example == - | ${sheet_data} = Excel Sheet Read Sheet_Persons + ## Example + ```robotframework + *** Test Cases *** + Read Excel Sheet + ${sheet_data} = Excel Sheet Read Sheet_Persons + ``` """ df = self.data[self.current_file].get(sheet_name) if df is None: @@ -155,7 +174,11 @@ def excel_get_available_sheets(self) -> list: """ Keyword returns the available sheets within the currently opened excel file. - == Example == - | @{sheets} = Excel Get Available Sheets + ## Example + ```robotframework + *** Test Cases *** + Get Available Excel Sheets + @{sheets} = Excel Get Available Sheets + ``` """ return list(self.data[self.current_file].keys()) diff --git a/src/Tables/keywords/getter.py b/src/Tables/keywords/getter.py index 253cfb8e..77e7b2fa 100644 --- a/src/Tables/keywords/getter.py +++ b/src/Tables/keywords/getter.py @@ -33,18 +33,24 @@ def read_table( """ Keyword reads a table from the given path & returns the content. - | =`Arguments`= | =`Description`= | - | ``path`` | Specify the path of the your table file. | - | ``return_type`` | You can declare what type of table format it should be returned. Either list of lists, list of dictionaries or a pandas datarframe. Default: List of lists. | - - == Return Value == - Keyword returns the complete content of the given file.\n - Raises an error if the file does not exist! - - == Example == - | ${data} = Read Table ${CURDIR}/testdata/statistics.csv List of lists - | ${result} = BuiltIn.Evaluate "${content}[0][0]" == "index" - | BuiltIn.Should Be True ${result} # checking if the first column is 'index' + Args: + path: Specify the path of the your table file. + return_type: You can declare what type of table format it should be returned. Either list of lists, list of dictionaries or a pandas datarframe. Default: List of lists. + + Returns: + Keyword returns the complete content of the given file.\n + + Raises: + FileNotFoundError: Raises an error if the file does not exist! + + ## Example + ```robotframework + *** Test Cases *** + Read Table + ${data} = Read Table ${CURDIR}/testdata/statistics.csv List of lists + ${result} = BuiltIn.Evaluate "${content}[0][0]" == "index" + BuiltIn.Should Be True ${result} # checking if the first column is 'index' + ``` """ table_df = self.file_reader.read_table_file(path) if return_type == TableFormat["Dataframe"]: @@ -82,17 +88,20 @@ def open_table( Keyword which is similar to read_table but saves the table in form of an alias. The saved table can be further modified but it will not change the file which was the table was opened from. - | =`Arguments`= | =`Description`= | - | ``path`` | Specify the path of the given tables file. | - | ``alias`` | Define an alias name to identified opened table file. | + Args: + path: Specify the path of the given table file. + alias: Define an alias name to identify the opened table file. - == Return Value == - Returns the alias string. + Returns: + The alias string. - == Example == - | # Opening and saving multiple tables in cache - | Tables.Open Table table 1 table.csv - | Tables.Open Table table 2 table_1.csv # currently table 2 is active + ## Example + ```robotframework + *** Test Cases *** + Open And Save Multiple Tables + Tables.Open Table table 1 table.csv + Tables.Open Table table 2 table_1.csv # currently table 2 is active + ``` """ if not alias: alias = str(uuid4()) @@ -114,27 +123,29 @@ def create_table( Creating a new empty table requires headers. This leads to a better understanding of the data for each column and wont be a problem for further workflows with the table data. - == Arguments == - | =Argument= | =Description= | - | ``headers`` | Define headers for the new table file. | - | ``alias`` | Optional - if not given, uuid is generated as unique alias. | - | ``file_path`` | Optional - if given, new table will be immediately stored to the file system. | - - == Important == + Args: + headers: Define headers for the new table file. + alias: Optional. If not given, a UUID is generated as a unique alias. + file_path: Optional. If given, the new table is immediately stored in the file system. + ## Important Adding ``initial`` data to the empty table, MUST be done via ``Append Row`` or ``Append Column`` keyword - see example. - == Example == + ## Example This example creates a new empty table, appends row & columns and writes it to a new csv file. - | VAR @{headers} = name age - | VAR @{person_1} = name age - | ${uuid} = Create Table headers=${headers} - | Append Row ${person_1} - | - | VAR @{new_column} = city MG - | Append Column ${new_column} - | - | Write Table ${uuid} ${filepath} + ```robotframework + *** Test Cases *** + Create And Write Table + VAR @{headers} = name age + VAR @{person_1} = name age + ${uuid} = Create Table headers=${headers} + Append Row ${person_1} + + VAR @{new_column} = city MG + Append Column ${new_column} + + Write Table ${uuid} ${filepath} + ``` """ if not alias: alias = str(uuid4()) @@ -154,17 +165,20 @@ def close_table(self, alias: str | None = None) -> bool: """ Keyword which closes specific or all of the tables. - | =`Arguments`= | =`Description`= | - | ``alias`` | Use the name of saved alias. If None was selected, then all copened tables will be closed. | + Args: + alias: Use the alias of the saved table. If omitted, all opened tables are closed. - == Return Value == - Returns True if the table is successfully closed. False if no open tables are available. + Returns: + ``True`` if the table is successfully closed; ``False`` if no tables are open. - == Example == - | Tables.Open Table table 1 table.csv - | Tables.Open Table table 2 table_1.csv - | - | Tables.Close Table table 1 # close table 1 + ## Example + ```robotframework + *** Test Cases *** + Close A Table + Tables.Open Table table 1 table.csv + Tables.Open Table table 2 table_1.csv + Tables.Close Table table 1 # close table 1 + ``` """ expected: bool = self.file_reader.close_table_dataframe(alias=alias) return expected @@ -177,17 +191,20 @@ def switch_table( """ Keyword which switches into current working table. - | =`Arguments`= | =`Description`= | - | ``alias`` | Use the name of saved alias. | + Args: + alias: Use the alias of the saved table. - == Return Value == - Return the string of the alias it switched to. + Returns: + The alias that was selected as the current table. - == Example == - | Tables.Open Table table 1 table.csv - | Tables.Open Table table 2 table_1.csv # current active table - | - | Tables.Switch Table table 1 # switched to 'table 1' as current active table + ## Example + ```robotframework + *** Test Cases *** + Switch Between Tables + Tables.Open Table table 1 table.csv + Tables.Open Table table 2 table_1.csv # current active table + Tables.Switch Table table 1 # switch to table 1 + ``` """ self.file_reader.table_dataframe_switch(alias=alias) return alias @@ -197,20 +214,23 @@ def get_table(self, return_type: TableFormat = TableFormat["List of lists"]) -> """ Keyword which returns a table in form of either list of lists, list of dicts, pandas dataframe. - | =`Arguments`= | =`Description`= | - | ``return_type`` | Choose what type of table format it should return. Default: list of lists| + If ``Configure Missing As None`` is enabled, missing values are returned as Python ``None`` for list and dictionary results. DataFrame results are unchanged. - If ``Configure Missing As None`` is enabled, missing values are returned as - Python ``None`` for list and dictionary results. DataFrame results are unchanged. + Args: + return_type: Choose the table format to return. Default: list of lists. - == Return Value == - Return table in form as either list of lists, list of dicts or dataframe. + Returns: + The table as a list of lists, list of dictionaries, or DataFrame. - == Example == - | Tables.Open Table table 1 table.csv - | @{lists} = Tables.Get Table - | @{dicts} = Tables.Get Table List of dicts - | @{dataframe} = Tables.Get Table Dataframe + ## Example + ```robotframework + *** Test Cases *** + Get Table In Different Formats + Tables.Open Table table 1 table.csv + @{lists} = Tables.Get Table + @{dicts} = Tables.Get Table List of dicts + @{dataframe} = Tables.Get Table Dataframe + ``` """ current_df = self.file_reader.file_sync.table_storage[self.file_reader.file_sync.current_file].data table_df = self.file_reader.validate_table_to_dataframe(data=current_df) @@ -229,24 +249,27 @@ def get_table_cell( """ Keyword reads the currently opened table cell (see opened_table) with the given row & column index. - | =`Arguments`= | =`Description`= | - | ``row`` | Row to read the cell from | - | ``column`` | Column to read the cell from. Can be index number or a name of a column as a string. If string, ignore_header must be False. | - | ``assertion_operator`` | See ``robotframework-assertion-engine`` for more details. Only numerical operators are allowed | - | ``assertion_expected`` | See ``robotframework-assertion-engine`` for more details | - | ``message`` | Custom error message for failed assertion | - If ``Configure Missing As None`` is enabled, a missing cell is returned as Python ``None`` and assertions are evaluated against the converted value. - == Return Value == - Keyword returns the value of the given cell. - In case of a failed assertion, the keyword will just fail without returning anything. - - == Example == - | Tables.Configure Ignore Header False - | Tables.Open Table table 1 ${CURDIR}${/}testdata${/}example_01.csv - | Get Table Cell 1 name == sascha + Args: + row: Row to read the cell from. + column: Column to read from. Can be an index or a column name. A string requires ``ignore_header`` to be False. + assertion_operator: See ``robotframework-assertion-engine`` for more details. Only numerical operators are allowed. + assertion_expected: Expected value for the assertion. + message: Custom error message for a failed assertion. + + Returns: + The value of the selected cell. + + ## Example + ```robotframework + *** Test Cases *** + Get A Table Cell + Tables.Configure Ignore Header False + Tables.Open Table table 1 ${CURDIR}${/}testdata${/}example_01.csv + Get Table Cell 1 name == sascha + ``` """ cell = None current_df = self.file_reader.file_sync.table_storage[self.file_reader.file_sync.current_file].data @@ -277,22 +300,26 @@ def get_table_column( Keyword to read the given table column from current opened table (see open_table). If ignore_header = True and searched column is a string then it will raise an error. - | =`Arguments`= | =`Description`= | - | ``column`` | Column header name (str) or index (int) to return values from | - | ``assertion_operator`` | See ``robotframework-assertion-engine`` for more details. Only numerical operators are allowed | - | ``assertion_expected`` | See ``robotframework-assertion-engine`` for more details | - | ``message`` | Custom error message for failed assertion | - If ``Configure Missing As None`` is enabled, missing column values are returned as Python ``None`` and assertions are evaluated against the converted values. - == Return Value == - Returns column values as a list. - - == Example == - | Tables.Configure Ignore Header False - | Tables.Open Table table 1 example_01.csv - | Get Table Column name contains alex + Args: + column: Column header name or index to return values from. + assertion_operator: See ``robotframework-assertion-engine`` for more details. Only collection operators are allowed. + assertion_expected: Expected value for the assertion. + message: Custom error message for a failed assertion. + + Returns: + The selected column values as a list. + + ## Example + ```robotframework + *** Test Cases *** + Get A Table Column + Tables.Configure Ignore Header False + Tables.Open Table table 1 example_01.csv + Get Table Column name contains alex + ``` """ valid_assertions = [ AssertionOperator["contains"], @@ -326,22 +353,27 @@ def get_table_row( ) -> list[Any]: """ Keyword to read the given table column from current opened table (see open_table). - | =`Arguments`= | =`Description`= | - | ``row`` | Row index (int) to read values from | - | ``assertion_operator`` | See ``robotframework-assertion-engine`` for more details. Only numerical operators are allowed. | - | ``assertion_expected`` | See ``robotframework-assertion-engine`` for more details | - | ``message`` | Custom error message for failed assertion | If ``Configure Missing As None`` is enabled, missing row values are returned as Python ``None`` and assertions are evaluated against the converted values. - == Return Value == - Returns row values as a list. - - == Example == - | Tables.Configure Ignore Header False - | Tables.Open Table table 1 example_01.csv - | Tables.Get Table Row 0 contains age + Args: + row: Row index to return values from. + assertion_operator: See ``robotframework-assertion-engine`` for more details. Only collection operators are allowed. + assertion_expected: Expected value for the assertion. + message: Custom error message for a failed assertion. + + Returns: + The selected row values as a list. + + ## Example + ```robotframework + *** Test Cases *** + Get A Table Row + Tables.Configure Ignore Header False + Tables.Open Table table 1 example_01.csv + Tables.Get Table Row 0 contains age + ``` """ valid_assertions = [ AssertionOperator["contains"], @@ -376,26 +408,31 @@ def count_table( # noqa PLR0913 """ Keyword for counting rows or columns in the provided table. - | =`Arguments`= | =`Description`= | - | ``path`` | Either a filepath or a saved variable of 'Open Table' keyword. | - | ``axis`` | Select 'Columns' or 'Rows' depending which axis should be checked | - | ``assertion_operator`` | See ``robotframework-assertion-engine`` for more details. Only numerical operators are allowed | - | ``assertion_expected`` | See ``robotframework-assertion-engine`` for more details | - | ``message`` | Custom error message for failed assertion | - - == Return Value == - Keyword returns a number count of either rows or columns. - - == Example == - | CSV: - | VAR ${file_path} ${CURDIR}${/}testdata${/}example_01.csv - | Tables.Open Table table 1 ${file_path} - | Tables.Count Table table 1 Rows == ${6} - | Tables.Count Table table 1 Columns == ${3} - | - | VAR ${file_path} ${CURDIR}${/}testdata${/}example_01.csv - | ${row_count} Tables.Count Table ${file_path} Rows - | BuiltIn.Should Be Equal ${row_count} ${6} + Args: + path: File path or alias returned by ``Open Table``. + axis: Select ``Columns`` or ``Rows`` to determine what is counted. + assertion_operator: See ``robotframework-assertion-engine`` for more details. Numerical and evaluation operators are allowed. + assertion_expected: Expected count for the assertion. + message: Custom error message for a failed assertion. + continue_on_failure: Whether the test should continue after a failed assertion. + + Returns: + The number of rows or columns. + + ## Example + ```robotframework + *** Test Cases *** + Count Table Rows And Columns + # CSV + VAR ${file_path} ${CURDIR}${/}testdata${/}example_01.csv + Tables.Open Table table 1 ${file_path} + Tables.Count Table table 1 Rows == ${6} + Tables.Count Table table 1 Columns == ${3} + + VAR ${file_path} ${CURDIR}${/}testdata${/}example_01.csv + ${row_count} Tables.Count Table ${file_path} Rows + BuiltIn.Should Be Equal ${row_count} ${6} + ``` """ casted_path = self.file_reader.cast_path_type(path) if isinstance(casted_path, Path): diff --git a/src/Tables/keywords/modifier.py b/src/Tables/keywords/modifier.py index b88595e3..89bd00ce 100644 --- a/src/Tables/keywords/modifier.py +++ b/src/Tables/keywords/modifier.py @@ -40,22 +40,25 @@ def insert_row(self, row_data: list, row_index: int, header: bool = True) -> Dat """ Keyword to insert a new row into the currently opened table (see 'Open Table') at the given index. - | =`Arguments`= | =`Description`= | - | ``row_data`` | List of values which should be inserted to the table. Must match the lenght of table row. | - | ``row_index`` | Define the index of the row to modify. | - | ``header`` | Set to ``True`` if header should be recognized during file modifications - if ``False`, its ignored. If Header = False and row index = 0 it will overwrite a possible header, if there is one! | - - == Return Value == - Returns the dataframe of the changed table. - - == Example == - | VAR ${csv_path} = test_writer.csv - | VAR @{row_list} = 2001 04 - | VAR @{column_list} = column 1 column 2 - - | Tables.Open Table table 1 ${csv_path} - | Tables.Insert Row ${row_list} 0 header=True # inserting the 0 row with a header in mind - | Tables.Insert Row ${column_list} 0 header=False # inserting the 0 row with no header in mind + Args: + row_data: List of values to insert. Must match the length of a table row. + row_index: Define the index of the row to modify. + header: Set to `True` if the header should be recognized. If `False` and `row_index` is `0`, a possible header is overwritten. + + Returns: + Returns the dataframe of the changed table. + + ## Example + ```robotframework + *** Test Cases *** + Insert Rows + VAR ${csv_path} = test_writer.csv + VAR @{row_list} = 2001 04 + VAR @{column_list} = column 1 column 2 + Tables.Open Table table 1 ${csv_path} + Tables.Insert Row ${row_list} 0 header=True + Tables.Insert Row ${column_list} 0 header=False + ``` """ return self.file_writer.modify_table(action=ModifyAction.Insert_Row, data=row_data, row=row_index, header=header) @@ -65,19 +68,22 @@ def insert_column(self, column_data: list, column_index: int) -> DataFrame: """ Keyword to insert a new column into the currently opened table (see 'Open Table') at the given index. - | =`Arguments`= | =`Description`= | - | ``column_data`` | List of values which should be inserted to the table. Must match the size of table column. | - | ``column_index`` | Define the index of the column to modify. | - - == Return Value == - Returns the dataframe of the changed table. - - == Example == - | VAR ${csv_path} = test_writer.csv - | VAR @{column_list} = month june july - - | Tables.Open Table table 1 ${csv_path} - | Tables.Insert Column ${column_list} 1 # inserting between index 0 and 1 + Args: + column_data: List of values to insert. Must match the size of a table column. + column_index: Define the index of the column to modify. + + Returns: + Returns the dataframe of the changed table. + + ## Example + ```robotframework + *** Test Cases *** + Insert A Column + VAR ${csv_path} = test_writer.csv + VAR @{column_list} = month june july + Tables.Open Table table 1 ${csv_path} + Tables.Insert Column ${column_list} 1 + ``` """ return self.file_writer.modify_table( @@ -91,18 +97,21 @@ def append_row(self, row_data: list) -> DataFrame: """ Keyword to append a new row into the currently opened table (see 'Open Table') at the end of the table. - | =`Arguments`= | =`Description`= | - | ``row_data`` | List of values which should be inserted to the table. Must match the lenght of table row. | - - == Return Value == - Returns the dataframe of the changed table. - - == Example == - | VAR ${csv_path} = test_writer.csv - | VAR @{row_list} = 2001 04 - - | Tables.Open Table table 1 ${csv_path} - | Tables.Append Row ${row_list} + Args: + row_data: List of values to append. Must match the length of a table row. + + Returns: + Returns the dataframe of the changed table. + + ## Example + ```robotframework + *** Test Cases *** + Append A Row + VAR ${csv_path} = test_writer.csv + VAR @{row_list} = 2001 04 + Tables.Open Table table 1 ${csv_path} + Tables.Append Row ${row_list} + ``` """ return self.file_writer.modify_table(action=ModifyAction.Append_Row, data=row_data, row=1) @@ -115,19 +124,21 @@ def append_column( """ Keyword to append a new column into the currently opened table (see 'Open Table') at the end of the table. - | =`Arguments`= | =`Description`= | - | ``column_data`` | List of values which should be inserted to the table. Must match the lenght of table column. | - - == Return Value == - Returns the dataframe of the changed table. - - == Example == - | VAR ${csv_path} = test_writer.csv - | VAR @{column_list} = month june july - - - | Tables.Open Table table 1 ${csv_path} - | Tables.Append Column ${column_list} + Args: + column_data: List of values to append. Must match the length of a table column. + + Returns: + Returns the dataframe of the changed table. + + ## Example + ```robotframework + *** Test Cases *** + Append A Column + VAR ${csv_path} = test_writer.csv + VAR @{column_list} = month june july + Tables.Open Table table 1 ${csv_path} + Tables.Append Column ${column_list} + ``` """ return self.file_writer.modify_table( @@ -141,20 +152,22 @@ def remove_row(self, row_index: int, header: bool = True) -> DataFrame: """ Keyword to remove the given row from the currently opened table (see 'Open Table'). - | =`Arguments`= | =`Description`= | - | ``row_index`` | Define the index of the row to modify. | - | ``header`` | Set to ``True`` if header should be recognized during file modifications - if ``False`, its ignored. If Header = False and row index = 0 it will remove a possible header, if there is one!| - - == Return Value == - Returns the dataframe of the changed table. - - == Example == - | VAR ${csv_path} = test_writer.csv - - - | Tables.Open Table table 1 ${csv_path} - | Tables.Remove Row 1 header=True # remove the 1st row after the header - | Tables.Remove Row 0 header=False # remove the 0st row without headers + Args: + row_index: Define the index of the row to modify. + header: Set to `True` if the header should be recognized. If `False` and `row_index` is `0`, a possible header is removed. + + Returns: + Returns the dataframe of the changed table. + + ## Example + ```robotframework + *** Test Cases *** + Remove Rows + VAR ${csv_path} = test_writer.csv + Tables.Open Table table 1 ${csv_path} + Tables.Remove Row 1 header=True + Tables.Remove Row 0 header=False + ``` """ return self.file_writer.modify_table(action=ModifyAction.Remove_Row, row=row_index, header=header) @@ -167,19 +180,21 @@ def remove_column( """ Keyword to remove the given column from the currently opened table (see 'Open Table'). - | =`Arguments`= | =`Description`= | - | ``column_index`` | Define the index of the column to remove. It can be either an integer (index) or a string.| - - == Return Value == - Returns the dataframe of the changed table. - - == Example == - | VAR ${csv_path} = test_writer.csv - - - | Tables.Open Table table 1 ${csv_path} - | Tables.Remove Column 0 # remove the very first column - | Tables.Remove Column temp # remove the column with a header (or first row) called 'temp' + Args: + column_index: Define the index of the column to remove. It can be an integer or a string. + + Returns: + Returns the dataframe of the changed table. + + ## Example + ```robotframework + *** Test Cases *** + Remove Columns + VAR ${csv_path} = test_writer.csv + Tables.Open Table table 1 ${csv_path} + Tables.Remove Column 0 + Tables.Remove Column temp + ``` """ return self.file_writer.modify_table( diff --git a/src/Tables/keywords/writer.py b/src/Tables/keywords/writer.py index bb7c1d31..67dda087 100644 --- a/src/Tables/keywords/writer.py +++ b/src/Tables/keywords/writer.py @@ -23,21 +23,24 @@ def write_table(self, data: list[list] | str, file_path: Path | str | None = Non """ Keyword to write the given data to a new file or overwrite an existing file. - | =`Arguments`= | =`Description`= | - | ``data`` | Data object to store in a new file | - | ``file_path`` | The full path of the table file to save the content in. If alias from 'Open Table' is used, it will write the data in the aliases file path. If no file path is selected, then it will use current alias. | + Args: + data: Data object to store in a new file. + file_path: Full path of the table file to save the content in. If an alias from `Open Table` is used, the data is written to the alias file path. If no file path is selected, the current alias is used. - == Data Object == + ## Data Object The given data object with the argument ``data`` needs to be a list of lists to replicate the table structure - == Return Value == - Returns the path of written table as a string. - - == Example == - | Write Table ${data} statistics.csv # write into file location - | - | Tables.Open Table table 1 new_statistics.csv - | Tables.Write Table ${data} table 1 # write into new_statistics.csv + Returns: + Returns the path of written table as a string. + + ## Example + ```robotframework + *** Test Cases *** + Write A Table + Write Table ${data} statistics.csv + Tables.Open Table table 1 new_statistics.csv + Tables.Write Table ${data} table 1 + ``` """ if isinstance(data, str): current_df = self.file_reader.file_sync.table_storage[self.file_reader.file_sync.current_file].data @@ -59,17 +62,20 @@ def set_table_cell( """ Keyword to (over-) write the value of a specific cell of the current table (see Open Table). - | =`Arguments`= | =`Description`= | - | ``data`` | The new value for the given table cell. | - | ``row`` | Define the index of the row to identify the cell. | - | ``column`` | Define the index of the column to identify the cell. Header must be True if column is string. | - | ``header`` | Local override for the ``ignore_header`` logic | - | ``file_path`` | The full path of the existing table file. | - - == Example == - | Tables.Open Table table 1 ${csv_path} - | Set Table Cell New York row=20 column=2 header=False - | Set Table Cell Apple row=1 column=Fruit header=True + Args: + data: The new value for the given table cell. + row: Define the index of the row to identify the cell. + column: Define the index of the column to identify the cell. `header` must be `True` if the column is a string. + header: Local override for the `ignore_header` logic. + + ## Example + ```robotframework + *** Test Cases *** + Set A Table Cell + Tables.Open Table table 1 ${csv_path} + Set Table Cell New York row=20 column=2 header=False + Set Table Cell Apple row=1 column=Fruit header=True + ``` """ table_df: list[list] = self.file_writer.set_dataframe_cells( @@ -91,15 +97,18 @@ def set_table_column( """ Keyword to (over-) write the values of a specific column. - | =`Arguments`= | =`Description`= | - | ``data`` | The new values for the given table column - needs to be list object. | - | ``column`` | Define the index of the column to modify. | - | ``header`` | Set to ``True`` if header should be recognized during file modifications - if ``False`, its ignored. | - | ``file_path`` | The full path of the existing table file. | - - == Example == - | VAR @{column_list} month august march - | Set Table Column ${column_list} 2 ${CURDIR}/output/statistics.csv True + Args: + data: The new values for the given table column. Must be a list. + column: Define the index of the column to modify. + header: Set to `True` if the header should be recognized. If `False`, it is ignored. + + ## Example + ```robotframework + *** Test Cases *** + Set A Table Column + VAR @{column_list} month august march + Set Table Column ${column_list} 2 header=True + ``` """ table: list[list] = self.file_writer.set_dataframe_cells( data=data, column=column, header=header, return_type=TableFormat["List of lists"] @@ -116,14 +125,17 @@ def set_table_row( """ Keyword to (over-) write the values of a specific row. - | =`Arguments`= | =`Description`= | - | ``data`` | The new values for the given table row - needs to be list object. | - | ``row`` | Define the index of the row to modify. | - | ``header`` | Define local override for ignore_header logic. | - | ``file_path`` | The full path of the existing table file. | - - == Example == - | Set Table Row ${list_of_values} 3 ${CURDIR}/output/statistics.csv True + Args: + data: The new values for the given table row. Must be a list. + row: Define the index of the row to modify. + header: Define a local override for the `ignore_header` logic. + + ## Example + ```robotframework + *** Test Cases *** + Set A Table Row + Set Table Row ${list_of_values} 3 header=True + ``` """ table: list[list] = self.file_writer.set_dataframe_cells( data=data, row=row, header=header, return_type=TableFormat["List of lists"] diff --git a/src/Tables/utils/settings.py b/src/Tables/utils/settings.py index 5bfc7bcb..1c49aeae 100644 --- a/src/Tables/utils/settings.py +++ b/src/Tables/utils/settings.py @@ -22,9 +22,11 @@ class Quoting(Enum): ) QuotingCharacter.__doc__ = """ Available quoting characters - default is ``\"``. - | = Delimiter = | = Description = | - | ``\"`` | Using the \" as separator. | - | ``'`` | Using the ' as separator. | + + | Delimiter | Description | + | --- | --- | + | `\"` | Using the \" as separator. | + | `'` | Using the ' as separator. | """ TableFormat = Enum( @@ -38,10 +40,12 @@ class Quoting(Enum): TableFormat.__doc__ = """ Available table formats. Mostly used as return type during reading/getting the table. - | = Delimiter = | = Description = | - | ``List of lists`` | Using the table format as list[list] | - | ``List of dicts`` | Using the table format as list[dict] | - | ``Dataframe`` | Using the table format as pandas.DataFrame | + + | Delimiter | Description | + | --- | --- | + | `List of lists` | Using the table format as [list]. | + | `List of dicts` | Using the table format as [dict]. | + | `Dataframe` | Using the table format as pandas.DataFrame. | """ @@ -72,7 +76,7 @@ class FileEncoding(Enum): """ Available file encodings for working with table files. - see [Python Encoding Names|https://docs.python.org/3/library/codecs.html#standard-encodings] + See [Python Encoding Names](https://docs.python.org/3/library/codecs.html#standard-encodings). """ ASCII = "ascii" @@ -193,11 +197,13 @@ class LineTerminator(Enum): ) Delimiter.__doc__ = """ Available separators for splitting data columns in any table file - default is ``,``. - | = Delimiter = | = Description = | - | ``;`` | Using the semicolon as separator. | - | ``,`` | Using the comma as separator. | - | ``\\t`` | Using the ``tab`` character as separator. | - | ... | In case of any missing separator, feel free to add it... | + + | Delimiter | Description | + | --- | --- | + | `;` | Using the semicolon as separator. | + | `,` | Using the comma as separator. | + | `\\t` | Using the `tab` character as separator. | + | `...` | In case of any missing separator, feel free to add it. | """ DecimalSeperator = Enum("DecimalSeperator", {".": ".", ",": ","})