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[source]

Bases: object

General utility functions wrapper class.

static get_desktop() str[source]

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[source]

Return the current platform.

static get_python_version() str[source]

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[source]

Get the username.

Returns:

The username for the current user.

Return type:

str

static normalise_name(name: str) str | None[source]

Normalise the package name per PyPA.

Parameters:

name (str) – Package name.

Reference:
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