stubber.utils

Module Contents

Functions

clean_version(version: str, *, build: bool = False, patch: bool = False, commit: bool = False, drop_v: bool = False, flat: bool = False)

Clean up and transform the many flavours of versions

stubfolder(path: str) → str

return path in the stub folder

cleanup(modules_folder: pathlib.Path, all_pyi: bool = False)

Q&D cleanup

generate_pyi_from_file(file: pathlib.Path) → bool

Generate a .pyi stubfile from a single .py module using mypy/stubgen

fix_umqtt_init(modules_path: pathlib.Path)

generate_pyi_files(modules_folder: pathlib.Path) → bool

generate typeshed files for all scripts in a folder using mypy/stubgen

manifest(family: str = 'micropython', stubtype: str = 'frozen', machine: Optional[str] = None, port: Optional[str] = None, platform: Optional[str] = None, sysname: Optional[str] = None, nodename: Optional[str] = None, version: Optional[str] = None, release: Optional[str] = None, firmware: Optional[str] = None) → dict

create a new empty manifest dict

make_manifest(folder: pathlib.Path, family: str, port: str, version: str, release: str = '', stubtype: str = '', board: str = '') → bool

Create a module.json manifest listing all files/stubs in this folder and subfolders.

read_exclusion_file(path: pathlib.Path = None) → List[str]

Read a .exclusion file to determine which files should not be automatically re-generated

should_ignore(file: str, exclusions: List[str]) → bool

Check if a file matches a line in the exclusion list.

Attributes

log

STUB_FOLDER

STUBGEN_OPT

stubber.utils.log
stubber.utils.STUB_FOLDER = ./all-stubs
stubber.utils.STUBGEN_OPT
stubber.utils.clean_version(version: str, *, build: bool = False, patch: bool = False, commit: bool = False, drop_v: bool = False, flat: bool = False)

Clean up and transform the many flavours of versions

Parameters
stubber.utils.stubfolder(path: str) str

return path in the stub folder

Parameters

path (str) –

Return type

str

stubber.utils.cleanup(modules_folder: pathlib.Path, all_pyi: bool = False)

Q&D cleanup

Parameters
stubber.utils.generate_pyi_from_file(file: pathlib.Path) bool

Generate a .pyi stubfile from a single .py module using mypy/stubgen

Parameters

file (pathlib.Path) –

Return type

bool

stubber.utils.fix_umqtt_init(modules_path: pathlib.Path)
Parameters

modules_path (pathlib.Path) –

stubber.utils.generate_pyi_files(modules_folder: pathlib.Path) bool

generate typeshed files for all scripts in a folder using mypy/stubgen

Parameters

modules_folder (pathlib.Path) –

Return type

bool

stubber.utils.manifest(family: str = 'micropython', stubtype: str = 'frozen', machine: Optional[str] = None, port: Optional[str] = None, platform: Optional[str] = None, sysname: Optional[str] = None, nodename: Optional[str] = None, version: Optional[str] = None, release: Optional[str] = None, firmware: Optional[str] = None) dict

create a new empty manifest dict

Parameters
  • family (str) –

  • stubtype (str) –

  • machine (Optional[str]) –

  • port (Optional[str]) –

  • platform (Optional[str]) –

  • sysname (Optional[str]) –

  • nodename (Optional[str]) –

  • version (Optional[str]) –

  • release (Optional[str]) –

  • firmware (Optional[str]) –

Return type

dict

stubber.utils.make_manifest(folder: pathlib.Path, family: str, port: str, version: str, release: str = '', stubtype: str = '', board: str = '') bool

Create a module.json manifest listing all files/stubs in this folder and subfolders.

Parameters
Return type

bool

stubber.utils.read_exclusion_file(path: pathlib.Path = None) List[str]

Read a .exclusion file to determine which files should not be automatically re-generated in .GitIgnore format

Parameters

path (pathlib.Path) –

Return type

List[str]

stubber.utils.should_ignore(file: str, exclusions: List[str]) bool

Check if a file matches a line in the exclusion list.

Parameters
  • file (str) –

  • exclusions (List[str]) –

Return type

bool