createstubs

Create stubs for (all) modules on a MicroPython board

Module Contents

Classes

Stubber

Generate stubs for modules in firmware

Functions

ensure_folder(path)

Create nested folders if needed

_info()

collect base information on this runtime

get_root(→ str)

Determine the root folder of the device

file_exists(filename)

show_help()

read_path(→ str)

get --path from cmdline. [unix/win]

isMicroPython(→ bool)

runtime test to determine full or micropython

main()

Attributes

__version__

ENOENT

_MAX_CLASS_LEVEL

_log

createstubs.__version__ = 1.9.11
createstubs.ENOENT = 2
createstubs._MAX_CLASS_LEVEL = 2
class createstubs.Stubber(path: str = None, firmware_id: str = None)

Generate stubs for modules in firmware

Parameters
  • path (str) –

  • firmware_id (str) –

get_obj_attributes(item_instance: object)

extract information of the objects members and attributes

Parameters

item_instance (object) –

add_modules(modules)

Add additional modules to be exported

create_all_stubs()

Create stubs for all configured modules

create_one_stub(module_name: str)
Parameters

module_name (str) –

create_module_stub(module_name: str, file_name: str = None) bool

Create a Stub of a single python module

Args: - module_name (str): name of the module to document. This module will be imported. - file_name (Optional[str]): the ‘path/filename.py’ to write to. If omitted will be created based on the module name.

Parameters
  • module_name (str) –

  • file_name (str) –

Return type

bool

write_object_stub(fp, object_expr: object, obj_name: str, indent: str, in_class: int = 0)

Write a module/object stub to an open file. Can be called recursive.

Parameters
  • object_expr (object) –

  • obj_name (str) –

  • indent (str) –

  • in_class (int) –

property flat_fwid

Turn _fwid from ‘v1.2.3’ into ‘1_2_3’ to be used in filename

clean(path: str = None)

Remove all files from the stub folder

Parameters

path (str) –

report(filename: str = 'modules.json')

create json with list of exported modules

Parameters

filename (str) –

createstubs.ensure_folder(path: str)

Create nested folders if needed

Parameters

path (str) –

createstubs._info()

collect base information on this runtime

createstubs.get_root() str

Determine the root folder of the device

Return type

str

createstubs.file_exists(filename: str)
Parameters

filename (str) –

createstubs.show_help()
createstubs.read_path() str

get –path from cmdline. [unix/win]

Return type

str

createstubs.isMicroPython() bool

runtime test to determine full or micropython

Return type

bool

createstubs.main()
createstubs._log