Skip to main content

Utility functions by Peter Cullen Burbery, including date_time_stamp, compare_images, and convert_blob_to_raw_github_url

Project description

peter_cullen_burbery_python_functions

A utility package by Peter Cullen Burbery offering high-precision date/time formatting, image comparison tools, and system management helpers.

✨ Features

📅 date_time_functions

  • date_time_stamp()
    Returns a precise timestamp string including:
    • Gregorian calendar date
    • Time with nanosecond precision
    • IANA time zone
    • ISO week format (e.g., 2025-W030-005)
    • Ordinal day of the year

Example:

2025-007-025 015.005.004.990819700 America/New_York 2025-W030-005 2025-206

🖼️ image_functions

  • compare_images(image_path_1, image_path_2)

    Compares two images using:

    • 🔐 SHA-256 hash
    • 🧮 Pixel-wise difference via ImageChops
    • 📏 Structural Similarity Index (SSIM)
    • 📊 ImageMagick absolute error metric (if available)

Outputs:

  • Matching/difference status
  • SSIM score
  • Optional diff image (if images differ)

🛠️ system_management_functions

  • convert_blob_to_raw_github_url(blob_url: str)

    Converts a GitHub blob URL to a raw content URL.

    Example:

    from peter_cullen_burbery_python_functions.system_management_functions import convert_blob_to_raw_github_url
    
    raw_url = convert_blob_to_raw_github_url("https://github.com/user/repo/blob/main/script.ps1")
    print(raw_url)
    # Output: https://github.com/user/repo/raw/main/script.ps1
    
  • validate_Windows_filename_with_reasons(name: str)

    Validates a Windows filename against Microsoft’s rules for illegal characters and reserved names.
    Returns detailed reasons for each violation.

    Example:

    from peter_cullen_burbery_python_functions.system_management_functions import validate_Windows_filename_with_reasons
    
    result = validate_Windows_filename_with_reasons("CON.txt")
    print(result)
    # Output: {'valid': False, 'problems': [{'character': 'CON', 'reason': 'Reserved device name (console)'}]}
    

📦 Installation

pip install peter-cullen-burbery-python-functions

🧪 Example Usage

from peter_cullen_burbery_python_functions.date_time_functions import date_time_stamp
from peter_cullen_burbery_python_functions.image_functions import compare_images
from peter_cullen_burbery_python_functions.system_management_functions import (
    convert_blob_to_raw_github_url,
    validate_Windows_filename_with_reasons
)

print("🕒 Timestamp:", date_time_stamp())
compare_images("image1.png", "image2.png")

url = "https://github.com/user/repo/blob/main/example.txt"
print("🔗 Raw URL:", convert_blob_to_raw_github_url(url))

filename = "COM1.txt"
print("📁 Validity:", validate_Windows_filename_with_reasons(filename))

🧑‍💻 Author

Peter Cullen Burbery

This utility library is part of a broader collection of tools for automation, data processing, and system utility scripting.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file peter_cullen_burbery_python_functions-0.5.0.tar.gz.

File metadata

File hashes

Hashes for peter_cullen_burbery_python_functions-0.5.0.tar.gz
Algorithm Hash digest
SHA256 5b657c27d17a88784cfbbaeaca87c8d3c4d84a467bf1edd1ed8bd20a61c535c7
MD5 0c747dcec8acc051460b1f891e316e80
BLAKE2b-256 26f21e4f8a386982ccc756fa378f49fd0ac262e9f9914808a57fae876f2c3b1d

See more details on using hashes here.

File details

Details for the file peter_cullen_burbery_python_functions-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for peter_cullen_burbery_python_functions-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7efdbb59624971fe9c5e5f26d5c5f6c0bc3f8bd74db3db28a8a948c2058a43b1
MD5 79bad2e069fdef8c9e46da2f25b5987c
BLAKE2b-256 855f3ac3ae88db371edf5b65a41e8b46f61f2926eecec9ab3124c4ae09c89591

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page