MECO™ API Reference
Functions
mCore.pythonUtilsLib Namespace Reference

[ MODULE ] - Utilities. More...

Functions

def createPythonPackage (path, name, createUnitTestPackage=True)
 Create a Python package. More...
 
def createPythonModule (path, name='__init__.py', content=None)
 Create a Python module with given name in given path. More...
 
def removePythonObjects (path=None, verbose=False)
 Remove all files with .pyc and .pyo extension recursively. More...
 

Detailed Description

[ MODULE ] - Utilities.

Function Documentation

◆ createPythonPackage()

def mCore.pythonUtilsLib.createPythonPackage (   path,
  name,
  createUnitTestPackage = True 
)

Create a Python package.

This function does nothing if a Python package with given name exists

Parameters
path[ str | None | in ] - Path, where the Python package will be created.
name[ str | None | in ] - Name of the Python package.
createUnitTestPackage[ bool | None | in ] - Whether to create unit test Python package under Python package.
Exceptions
N/A
Returns
str - Root path of the Python package.

◆ createPythonModule()

def mCore.pythonUtilsLib.createPythonModule (   path,
  name = '__init__.py',
  content = None 
)

Create a Python module with given name in given path.

Parameters
path[ str | None | in ] - Absolute path where the Python module will be created in.
name[ str | None | in ] - Name of the Python module, which will be created.
content[ str | None | in ] - Content, which will be written into the file.
Exceptions
N/A
Returns
str - Absolute path of the created Python module.

◆ removePythonObjects()

def mCore.pythonUtilsLib.removePythonObjects (   path = None,
  verbose = False 
)

Remove all files with .pyc and .pyo extension recursively.

If path is not provided sys.path will be used. Function suspends PermissionError if raised.

Warning
THIS METHOD HAS BEEN PROVIDED FOR INTERNAL USE ONLY.
Parameters
path[ str, list of str | None | in ] - Path.
verbose[ bool | False | in ] - Display deleted files.
Exceptions
N/A
Returns
None - None.