Skip to main content

pysupp

The bombaysoftwares-pysupp package provides a comprehensive set of utility functions for various operations in Python. These functions simplify common tasks such as date formatting, timestamp conversion, manipulating strings. This package is designed to enhance the functionality of various operations in your Python projects.

Installation

To use the Date Utils package, you can install it via pip:

pip install bombaysoftwares_pysupp

Usage

Import the desired functions from the package:

from bombaysoftwares_pysupp import str_to_bool, format_email

str_to_bool

This Function converts a string to a boolean value. It checks if the stripped and lowercase version of the string is 'true' or 'false'. If it matches 'true', the function returns boolean True. If it matches 'false', the function returns boolean False. Otherwise, it returns None.

str_to_bool('True')
// Output: True
str_to_bool('False')
// Output: False
str_to_bool('invalid')
// Output: None

format_email

This Function formats an email address. This function removes leading and trailing whitespace, converts the email to lowercase, and returns the formatted email address.

format_email("  john@example.com ")
// Output: 'john@example.com'
format_email("MARY@example.com")
// Output: 'mary@example.com'
format_email("")
// Output: ''
format_email(None)
// Output: None

get_body_mass_index

This function calculates the Body Mass Index (BMI) based on weight and height.

get_body_mass_index(70, 170)
// Output: 24.22
get_body_mass_index(80, 180)
// Output: 24.69

Other Functions

The package also includes other useful functions:

  • is_number(string) : Checks if a string can be converted to an integer.
  • file_name_to_readable_name(file_name) : Converts a file name to a readable name. It removes file extensions, replaces hyphens with spaces, removes non-alphabetic characters except spaces, capitalizes the first letter, and removes leading/trailing spaces.
  • convert_date_of_birth_to_datetime(date_string) : Converts a date string in the format '%m/%d/%Y' to a datetime object.
  • get_current_year() : Retrieves the current year.
  • is_invalid(value) : Checks if a value is considered invalid. It checks if the string representation of the value matches any of the predefined invalid values: "", None, "None", "null", or "undefined". If a match is found, it returns True; otherwise, it returns False.

For detailed usage and examples, refer to the inline documentation and code samples within each function.

Author

Bombay Softwares

License

This project is licensed under the MIT license. See the LICENSE file for more info.

Release files for bombaysoftwares-pysupp 1.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bombaysoftwares-pysupp 1.0.5
File Size Uploaded
bombaysoftwares-pysupp-1.0.5.tar.gz 13.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bombaysoftwares-pysupp 1.0.5
File Interpreter ABI Platform
bombaysoftwares_pysupp-1.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 25.9 kB

Release files / bombaysoftwares-pysupp-1.0.5.tar.gz

Download URL bombaysoftwares-pysupp-1.0.5.tar.gz
Size 13.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a3dd98475f4dc740f4f8a592fc6c651fdaea2a1bac614b31f66dfe163da0cfd8
BLAKE2b-256 checksum
How to use checksums
0f0158cc07ba1da9849980b28815064047f79e8d7bde64d0efcd5137bff21a86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / bombaysoftwares_pysupp-1.0.5-py3-none-any.whl

Download URL bombaysoftwares_pysupp-1.0.5-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e502691c74c5b5e2df1bbfe64fe741b724433bb69c58e32946a18d1500d80281
BLAKE2b-256 checksum
How to use checksums
634a0d5a7ae71afbd2bd126d4f779e99d879cd0123a95c745087cb977a9c939c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

1.0.5 This release

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page