Skip to content

A Python library containing a collection of small, reusable functions for general-purpose tasks.

License

Notifications You must be signed in to change notification settings

Talhamehar007/pyutils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

pyutils - A Collection of General-Purpose Utilities

pyutils is a Python library that contains a collection of small, reusable functions to help perform various general-purpose tasks. The library was designed to provide an efficient and convenient solution for developers who need to perform simple, common tasks without having to write long, complex code.

Contents

  • network.py
    • is_connected(): Returns a boolean indicating if the internet is connected.
    • get_local_ip(): Returns the local IP address.
    • get_public_ip(): Returns the public IP address.
  • validators.py
    • is_valid_email(email: str): Returns a boolean indicating if the email is valid.
    • is_valid_phone_number(phone_number: str): Returns a boolean indicating if the phone number is valid.
    • is_valid_url(url: str): Returns a boolean indicating if the URL is valid.
  • utils.py
    • clear(): clears the screen

Usage

network.py

import pyutils.network as network

if network.is_connected():
    print("The internet is connected")
else:
    print("The internet is not connected")

local_ip = network.get_local_ip()
print(f"Local IP address: {local_ip}")

public_ip = network.get_public_ip()
print(f"Public IP address: {public_ip}")

validators.py

import pyutils.validators as validators

email = "[email protected]"
if validators.is_valid_email(email):
    print(f"{email} is a valid email.")
else:
    print(f"{email} is not a valid email.")

phone_number = "+1-555-555-5555"
if validators.is_valid_phone_number(phone_number):
    print(f"{phone_number} is a valid phone number.")
else:
    print(f"{phone_number} is not a valid phone number.")

url = "https://www.example.com"
if validators.is_valid_url(url):
    print(f"{url} is a valid URL.")
else:
    print(f"{url} is not a valid URL.")

About

A Python library containing a collection of small, reusable functions for general-purpose tasks.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages