Skip to content

vanducdev/ducvannguyen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ducvannguyen v7.0.0

Advanced Python utilities and tools by Duc Van Nguyen.

Installation

pip install ducvannguyen

Multiple Import Options

# 1. Import the main class
from ducvannguyen import DucVanNguyen
toolkit = DucVanNguyen("MyToolkit")

# 2. Import default instance
from ducvannguyen import ducvannguyen

# 3. Import from core module
from ducvannguyen.core import DucVanNguyen

# 4. Import module
import ducvannguyen

# 5. Import all utilities
from ducvannguyen import *

Features

Professional Toolkit

Ducvannguyen v7.0.0 provides comprehensive utilities with 52 professional methods:

String Utilities

from ducvannguyen import DucVanNguyen

toolkit = DucVanNguyen()
print(toolkit.reverse_string("hello"))  # "olleh"
print(toolkit.is_palindrome("racecar"))  # True
print(toolkit.capitalize_words("hello world"))  # "Hello World"
print(toolkit.word_count("Hello world from Python"))  # 4

Math Utilities

print(toolkit.factorial(5))  # 120
print(toolkit.fibonacci(10))  # 55
print(toolkit.is_prime(17))  # True
print(toolkit.gcd(48, 18))  # 6
print(toolkit.lcm(12, 15))  # 60

List Utilities

nested = [1, [2, [3, 4], 5], 6]
print(toolkit.flatten_list(nested))  # [1, 2, 3, 4, 5, 6]
print(toolkit.unique_list([1, 2, 2, 3, 3, 4]))  # [1, 2, 3, 4]
print(toolkit.chunk_list([1, 2, 3, 4, 5], 2))  # [[1, 2], [3, 4], [5]]

Encryption & Security

print(toolkit.md5_hash("hello"))  # "5d41402abc4b2a76b9719d911017c592"
print(toolkit.sha256_hash("hello"))  # SHA256 hash
print(toolkit.base64_encode("hello world"))  # "aGVsbG8gd29ybGQ="
print(toolkit.generate_token(32))  # Secure random token

Web Utilities

url = "https://example.com/path?param1=value1&param2=value2"
print(toolkit.parse_url(url))  # Parsed URL components
print(toolkit.get_domain(url))  # "example.com"
print(toolkit.is_valid_url(url))  # True
print(toolkit.extract_query_params(url))  # Query parameters

Validation Utilities

print(toolkit.is_email("user@example.com"))  # True
print(toolkit.is_phone("+1234567890"))  # True
print(toolkit.is_strong_password("Passw0rd!"))  # True
print(toolkit.is_username("john_doe"))  # True

API Utilities

response = toolkit.create_response(
    data={"message": "success"}, 
    status="success", 
    message="Operation completed"
)
# Standardized API response with timestamp

Performance Tools

def my_function():
    return sum(range(1000))

# Time function execution
result = toolkit.timer(my_function)
print(result["execution_time"])

# Benchmark performance
benchmark = toolkit.benchmark(my_function, iterations=1000)
print(benchmark["average_time"])

Random Generation

print(toolkit.random_string(12, include_symbols=True))  # Random string
print(toolkit.generate_uuid())  # UUID4
print(toolkit.random_number(1, 100))  # Random number

DateTime Utilities

print(toolkit.now())  # Current timestamp
print(toolkit.today())  # Today's date
print(toolkit.add_days(7))  # Date after 7 days
print(toolkit.days_between("2024-01-01", "2024-01-15"))  # 14

File Utilities

print(toolkit.get_file_size("test.txt"))  # File size in bytes
print(toolkit.get_file_extension("test.txt"))  # ".txt"
print(toolkit.is_file("test.txt"))  # True/False
print(toolkit.join_paths("folder", "file.txt"))  # "folder/file.txt"

All-in-One Access

# Get all available methods
methods = toolkit.get_all_methods()
print(f"Total methods: {len(methods)}")  # 52 methods

# Get help for any method
help_text = toolkit.help("is_prime")
print(help_text)

# Get help for all methods
all_help = toolkit.help()

Advanced Features

Functional Programming

# Chain operations
chain_func = toolkit.chain(
    lambda x: x * 2,
    lambda x: x + 10,
    lambda x: x ** 2
)
result = chain_func(5)  # ((5 * 2) + 10) ** 2 = 400

# Pipe operations
result = toolkit.pipe(
    [1, 2, 3, 4, 5],
    lambda x: [i * 2 for i in x],  # Double each number
    lambda x: sum(x)               # Sum them
)  # 30

Memoization

@toolkit.memoize
def expensive_function(n):
    return sum(range(n))

# Results are cached for same inputs

Requirements

  • Python 3.7+
  • No external dependencies (uses only Python standard library)

Quick Start

from ducvannguyen import DucVanNguyen

# Create your toolkit instance
toolkit = DucVanNguyen("MyApp")

# Use any of the 52 available methods
email_valid = toolkit.is_email("user@example.com")
secure_token = toolkit.generate_token(32)
api_response = toolkit.create_response({"data": "success"})

print(f"Email valid: {email_valid}")
print(f"Token: {secure_token}")
print(f"Response: {api_response}")

License

This project is licensed under the MIT License - see the LICENSE file for details.

Links

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Package Information

import ducvannguyen

print(ducvannguyen.hello())  # "DucVanNguyen v7.0.0 - Professional Python Toolkit"
print(ducvannguyen.get_info())  # Package details

Made with ❤️ by Duc Van Nguyen

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages