This repository, uug-ai/utils
, is a collection of utility functions designed to perform various common tasks in software development. These utilities include string manipulation, date and time formatting, encoding/decoding operations, and random key generation. The repository aims to provide developers with a set of reliable and reusable functions to streamline their development workflow.
- String Manipulation:
ToLower
: Convert strings to lowercase.StringToInt
: Convert strings to integers.RemoveOrdinalSuffix
: Remove ordinal suffixes from strings.
- Date and Time Formatting:
GetHour
,GetDate
,GetTime
,GetDateTime
,GetDateTimeLong
,GetDateShort
,GetTimestamp
: Various functions to get and format the current date and time.FormatDuration
: Format a duration in a human-readable way.
- Encoding/Decoding:
Base64Encode
,Base64Decode
: Encode and decode strings using Base64.EncodeURL
,DecodeURL
: Encode and decode URLs.
- Random Key Generation:
GenerateShortLink
,RandStringBytesRmndr
,RandKey
,GenerateKey
: Functions to generate random strings and keys.
- Set Operations:
Contains
,Uniq
,Difference
: Functions to perform operations on sets.
- Testing:
- Comprehensive test functions for each utility function to ensure reliability and correctness.
To run the project, follow these steps:
-
Clone the Repository:
git clone https://github.com/uug-ai/utils.git cd utils
-
Run the Project: Ensure you have Python installed, then run the main script:
python main.py
To run the tests for the project, follow these steps:
-
Navigate to the Tests Directory:
cd tests
-
Run the Tests: Use the following command to run all the tests:
python -m unittest discover
The test functions include:
TestContains
TestUniq
TestDifference
TestGetDate
TestGetHour
TestGetTime
TestGetDateTime
TestGetDateTimeLong
TestGetDateShort
TestGetTimestamp
TestFormatDuration
TestBase64Encode
TestBase64Decode
TestEncodeURL
TestDecodeURL
TestToLower
TestStringToInt
TestRemoveOrdinalSuffix
TestRandStringBytesRmndr
TestRandKey
TestGenerateShortLink
TestRandKeyErrorHandling
TestGenerateKey
We welcome contributions to the uug-ai/utils
project! To contribute, please follow these guidelines:
-
Fork the Repository: Click the "Fork" button on the repository page to create a copy of the repository in your GitHub account.
-
Clone Your Fork:
git clone https://github.com/YOUR_USERNAME/utils.git cd utils
-
Create a New Branch:
git checkout -b feature-branch
-
Make Your Changes: Implement your changes or additions.
-
Commit and Push:
git add . git commit -m "Description of changes" git push origin feature-branch
-
Create a Pull Request: Navigate to the original repository and click "New Pull Request". Provide a detailed description of your changes and submit the pull request.
This project is licensed under the MIT License. See the LICENSE file for more details.