Skip to content

Commit

Permalink
__repr__(), __str()__, import
Browse files Browse the repository at this point in the history
  • Loading branch information
mezantrop committed Oct 16, 2024
1 parent cd954fc commit c1de913
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CHANGELOG

* **2024.10.15 Current**
* `Table.__repr__()` returns object representation to be unambiguous
* `Table.__str__()` returns string representation of data to be readable
* module import simplified: `from tsqlike import tsqlike` can be replaced by just `import tsqlike`

* **2024.10.15 tSQLike-1.1.6**
* Make `Table` object `iterable`, `iterate_header` boolean controls whether header to be included or not

Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

<a href="https://www.buymeacoffee.com/mezantrop" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>


## Description

**tSQLike** is a `Python3` module that is written with a hope to make tabular data process easier using SQL-like primitives.
Expand All @@ -19,7 +18,7 @@
## Usage

```Python3
from tsqlike import tsqlike
import tsqlike

t1 = tsqlike.Table(data=[['h1', 'h2', 'h3', 'h4'],
['a', 'b', 'c', 'd'],
Expand Down
2 changes: 1 addition & 1 deletion tsqlike/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""SQL-like interface to tabular structured data"""

from tsqlike import tsqlike
from tsqlike.__about__ import __version__
from tsqlike.tsqlike import *
11 changes: 10 additions & 1 deletion tsqlike/tsqlike.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,16 @@ def __iter__(self):

# -------------------------------------------------------------------------------------------- #
def __repr__(self):
return str(self.table)
me = self.__class__.__module__ + '.' + self.__class__.__qualname__
return str(f"{me}(data={self.export_list_lists()}, name='{self.name}', "
f"timestamp={self.timestamp}, convert_bool={self.convert_bool}, "
f"convert_numbers={self.convert_numbers}, use_none={self.use_none}, "
f"globals={self.globals}, use_shortnames={self.use_shortnames}, "
f"iterate_header={self.iterate_header})")

# -------------------------------------------------------------------------------------------- #
def __str__(self):
return str(self.export_list_lists())

# -------------------------------------------------------------------------------------------- #
def _redimension(self):
Expand Down

0 comments on commit c1de913

Please sign in to comment.