Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
This package is for performing tablular operations and for making making tabular data.
This module requires 'pyperclip', for using the copy-paste feature You can still use this module without pyperclip, but it is strongly recommended to install pyperclip
Import using:
import tabulux
Create a table object using the table
class
syntax:
table_obj = tabulux.table(
{
'Head-A':['Content-A1','Content-A2',],
'Head-B':['Content-B1','Content-B2',],
}
)
Now the table object have been saved to 'table_obj'
A Virtul table of the above object can be imagined like this:
| Head-A | Head-B |
|-------------+-------------|
| Content-A1 | Content-B1 |
| Content-A2 | Content-B2 |
Use this method when you need the column length of the table
Syntax:
table_obj.column_length(copy={True/False})
where:
table_obj
= a table objectcopy
= This boolean attribute copies the result as text to your clipboard (False by default)returns integer representing the number of column in table_obj
Use this method when you need the number of rows of the table
Syntax:
table_obj.row_length(copy={True/False})
where:
table_obj
= a table objectcopy
= This boolean attribute copies the result as text to your clipboard (False by default)returns integer representing the number of rows in table_obj
You could use the column() method to get a list containing all the elements in the specified column as a list
Syntax:
table_obj.column(column_number)
where:
table_obj
= a table objectcolumn_number
= an integer which represents column number (starting from 0) or, the heading of the column (as a string)returns all the elements from the specified column as list of strings. The column headings are not returned
A CellOutOfBoundsException
is raised if the specified column exceeds the number of columns in the table
You can use the row() method to get all the elements in a specified row in the table as a list
Syntax:
table_obj.row(row_number)
where:
table_obj
= a table objectrow_number
= an integer representing the row number (starts from 0)returns all the elements from the specified row as list of strings.
A CellOutOfBoundsException
is raised if the specified row exceeds the number of rows in the table
Use heads() when you want all the headings of the table
Syntax :
table_obj.heads()
where:
table_obj
= a table objectreturns a list of string representing the each heading of the table
Use head() when you want a heading of a specific column from the table
Syntax:
table_obj.head(column_number, copy={True/False})
where:
table_obj
= A table objectcolumn_number
= An integer representing the column number, whose heading you wantcopy
= A boolean- if True, copies the heading to your clipboard(False by default)returns the heading of the specified column of the table as a string.
Syntax:
Use this method when you need the cell content of a cell
table_obj.cell(row_ID, column_ID, copy={True/False})
where,
table_obj
= table objectrow
= integer representing the row number (starting from 0), or, the heading of the column as a stringcolumn
= integer representing the column number (starting from 0)copy
= a boolean, if true- copies the result to your clipboard(False,by default)returns the Cell Content of the specified location as String.
If the cell is not defined in the table or the rows or column given is out of bounds, a CellOutOfBoundsException
is raised
Use this method when you need to print the table in the console
Syntax :
table_obj.display()
where:
table_obj
= a table objectOutput:
prints data in table_obj
in a tabular form
Here is how the table would be printed:
|Head-A | Head-B |
-------------------
|content-A1 | Content-B1 |
|content-A2 | Content-B2 |
This method does not return anything
Use change() method to change the content of a cell
Syntax:
table_obj.change(row_ID, column_ID, new_content)
where,
table_obj
= a table objectrow_ID
= an integer representing the column number(starts from 0)column_ID
= an integer representing the column number(starts from 0), or the heading of the column as a stringnew_content
= a string containg the new contentchanges the of the specified column to the content in new_content
you can also set a cell content to whatever text copied to your clipboard, by setting the 'paste' argument to True
Syntax:
table_obj.change(row_ID, column_ID, new_content, paste=True)
the 'new_content' is ignored if paste is set to True, so you can leave the new content as ""
.
This changes the cell in the specified location to the text in the clipboard.
Aditionaly, this method also returns the old content of the specified cell
The add method can be used to add two cells, if the cells are integers or can be converted to integers,
Syntax:
table_obj.add(row1, column1, row2, column2, copy={True/False})
where:
table_obj
= a table objectrow1
= cell row of the first cell as an integercolumn1
= cell column of the first cell as an integer, or the heading of the column as a stringrow2
= cell row of the second cell as an integercolumn2
= cell column of the second cell as an integer, or the heading of the column as a stringcopy
= If this boolean attribute is set to True, the result will be copied to your clipboard(False by default)returns the sum of the two cells
The add_all() method can be used to add all the cells from a cell to another cell, if all their values are integers
Syntax:
table_obj.add_all(from_row, from_column, to_row, to_column, copy={True/False})
where:
table_obj
= a table objectfrom_row
= row number of the first cellfrom_column
= column number of the first cellto_row
= row number of the last cellto_column
= column number of the last cellcopy
= a boolean, if True- the result will be copied to your clipboard (False by default)returns the sum of all the content of cells between the specified cells.
If any cell content cannot be converted to an integer, 'TypeError' is raised
NOTE: The the ending cell address(to_row, to_column) is not included in the sum.
The 'html()' method is used to get the html snippet of a table.
Syntax:
table_obj.html(display={True/False}, copy={True/False}, indent={int})
where:
table_obj
= a table objectdisplay
= if set to True, this boolean attribute will display the html snippet in the console\terminal, (False by default)copy
= this boolean attribute, if set to True, copies the html snippet to you clipboard, and can by pasted to your html file(False by default)indent
= indentation spaces that sould be applied, as integer (4 by default)returns the html snippet of the table as a string, from and including <table> to </table>
FAQs
A package to form and retrieve tabular data
We found that tabulux demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.