StringF (version 0.1.0) | index StringF.html |
This package implements tools to build python package and tools.
>>> string_lengthformat("azerty")
'azerty ,'
>>> string_lengthformat("azertyazertyazerty")
'azertyazer...,'
>>> print(strings_tableformat([(0, 1), ("a" * 50, "b" * 50)]))
|0 |1 |
|aaaaaaaaaa...|bbbbbbbbbb...|
>>> print(strings_tableformat([(0, 1), ("a" * 50, "b" * 50)], length=[13, 26]))
|0 |1 |
|aaaaaaaaaa...|bbbbbbbbbbbbbbbbbbbbbbb...|
>>> print(strings_tableformat([["a" * 5, "b" * 25]] * 2, length=[5, 25], columns=["1" * 5, "2" * 25]))
|11111|2222222222222222222222222|
|-----|-------------------------|
|aaaaa|bbbbbbbbbbbbbbbbbbbbbbbbb|
|aaaaa|bbbbbbbbbbbbbbbbbbbbbbbbb|
>>> class A:
... def __init__(self):
... self.a = "a"
... self.b = "b"
... self.azerty = 1.1
...
>>> a = A()
>>> print(str(Object_StringF(a)))
A(a='a', b='b', azerty=1.1)
>>> print(str(Object_StringF(a, table_mode=True)))
A
|Attribut |Value |
|-------------|-------------|
|a |a |
|b |b |
|azerty |1.1 |
>>>
Run tests:
~# python -m doctest StringF.py
~# python StringF.py # Verbose mode
3 items passed all tests:
9 tests in __main__
2 tests in __main__.string_lengthformat
3 tests in __main__.strings_tableformat
14 tests in 6 items.
14 passed and 0 failed.
Test passed.
~# coverage run StringF.py
~# coverage report
Name Stmts Miss Cover
--------------------------------
StringF.py 67 0 100%
--------------------------------
TOTAL 67 0 100%
~#
Classes | ||||||||||
|
Functions | ||
|
Data | ||
__all__ = ['string_lengthformat', 'strings_tableformat', 'Object_StringF'] __author_email__ = 'mauricelambert434@gmail.com' __copyright__ = '\nPythonToolsKit Copyright (C) 2022 Maurice Lam...ome to redistribute it\nunder certain conditions.\n' __description__ = '\nThis package implements tools to build python package and tools.\n' __license__ = 'GPL-3.0 License' __maintainer__ = 'Maurice Lambert' __maintainer_email__ = 'mauricelambert434@gmail.com' __url__ = 'https://github.com/mauricelambert/PythonToolsKit' |
Author | ||
Maurice Lambert |