Data Utility Packages: Core
Table of Contents::
The Core Utility package implements the utility functions and objects
that was created on sub-package namespace, ddeutil
, design for independent
installation. I make this package able to extend with any sub-extension with this
namespace. This namespace able to scale out the coding with folder
structure design. You can add any extension features and import by
import ddeutil.{extension}
.
This package provide the Base Utility functions and objects for any data package or data application.
Install from PyPI:
pip install ddeutil
Features
Base Utility Functions
core.base
- cache
- checker
- convert
- elements
- hash
- merge
- sorting
- splitter
Hash
from ddeutil.core import random_str, hash_str
assert hash_str('hello world') == '05751529'
assert len(random_str()) == 8 # Random str with default length, 8
Checker
from ddeutil.core import can_int, is_int
assert is_int('-3')
assert not is_int('0.0')
assert not is_int('-3.1')
assert can_int('-1.0')
assert not can_int('1.1')
Convert
from ddeutil.core import str2bool
assert str2bool('yes')
assert not str2bool('no')
assert not str2bool('0')
Utility Functions
core
- decorator
- dtutils
DT-Utils
import datetime
from ddeutil.core.dtutils import next_date
assert (
next_date(datetime.datetime(2023, 1, 31, 0, 0, 0), mode='day')
== datetime.datetime(2023, 2, 1, 0, 0)
)
License
This project was licensed under the terms of the MIT license.