cpl_core.utils package

Submodules

cpl_core.utils.credential_manager module

class cpl_core.utils.credential_manager.CredentialManager

Bases: object

Handles credential encryption and decryption

static build_string(string: str, credentials: str)

Builds string with credentials in it

Parameter:
string: str

String in which the variable is replaced by credentials

credentials: str

String to encode

Returns:

Decoded string

static decrypt(string: str) str

Decode with base64

Parameter:
string: str

String to decode

Returns:

Decoded string

static encrypt(string: str) str

Encode with base64

Parameter:
string: str

String to encode

Returns:

Encoded string

cpl_core.utils.pip module

class cpl_core.utils.pip.Pip

Bases: object

Executes pip commands

classmethod get_executable() str
classmethod get_outdated() bytes

Gets table of outdated packages

Returns:

Bytes string of the command result

classmethod get_package(package: str) str | None

Gets given package py local pip list

Parameter:

package: str

Returns:

The package name as string

classmethod install(package: str, *args, source: str | None = None, stdout=None, stderr=None)

Installs given package

Parameter:
package: str

The name of the package

args: list

Arguments for the command

source: str

Extra index URL

stdout: str

Stdout of subprocess.run

stderr: str

Stderr of subprocess.run

classmethod reset_executable()

Resets the executable to system standard

classmethod set_executable(executable: str)

Sets the executable

Parameter:
executable: str

The python command

classmethod uninstall(package: str, stdout=None, stderr=None)

Uninstalls given package

Parameter:
package: str

The name of the package

stdout: str

Stdout of subprocess.run

stderr: str

Stderr of subprocess.run

cpl_core.utils.string module

class cpl_core.utils.string.String

Bases: object

Useful functions for strings

static convert_to_camel_case(chars: str) str

Converts string to camel case

Parameter:
chars: str

String to convert

Returns:

String converted to CamelCase

static convert_to_snake_case(chars: str) str

Converts string to snake case

Parameter:
chars: str

String to convert

Returns:

String converted to snake_case

static first_to_lower(chars: str) str

Converts first char to lower

Parameter:
chars: str

String to convert

Returns:

String with first char as lower

static first_to_upper(chars: str) str

Converts first char to upper

Parameter:
chars: str

String to convert

Returns:

String with first char as upper

static random_string(chars: str, length: int) str

Creates random string by given chars and length

Returns:

String of random chars

Module contents

cpl-core CPL core

CPL core package

copyright:
  1. 2020 - 2023 sh-edraft.de

license:

MIT, see LICENSE for more details.

class cpl_core.utils.VersionInfo(major, minor, micro)

Bases: tuple

major

Alias for field number 0

micro

Alias for field number 2

minor

Alias for field number 1