Lib: utilities.py - Private internal utilities — ppklib - v0.2.0rc3 Documentation

# Lib: utilities.py - Private internal utilities

Purpose:

  This module contains generalised utility-based functions, used throughout the project.

Platform:

  Linux/Windows | Python 3.6+

Developer:

  J Berendt

Email:

  development@s3dev.uk

Comments:

  n/a

class Utilities

  Bases: `object`

  General utility functions wrapper class.

  static get_desktop() → str

    Get the path to the user’s Desktop.

    Returns:

      The full path to the current user’s Desktop.

    Return type:

      str

  static get_platform() → str

    Return the current platform.

  static get_python_version() → str

    Return the no-dot major minor python version.

    This will be the version of the Python executable used to import this library, e.g. the `python.exe` for this environment.

    For example:

      - Python 3.11.x is returned as: `'311'`

      - Python 3.12.x is returned as: `'312'`

      - etc.

  static get_username() → str

    Get the username.

    Returns:

      The username for the current user.

    Return type:

      str

  static normalise_name(name: str) → str | None

    Normalise the package name per PyPA.

    Parameters:

      name (str) – Package name.

    Reference:

      - https://packaging.python.org/en/latest/specifications/name-normalization/#name-normalization

    Deviation:

      This method deviates slightly from the specification in that the listed characters are replaced with an underscore (rather than a hyphen) in efforts to match the name of the downloaded wheel file.

    Returns:

      Normalised package name.

    Return type:

      str