utils

Module Contents

Functions

clean_version(version: str, build: bool = False)

omit the commit hash from the git tag

stubfolder(path: str) → str

return path in the stub folder

flat_version(version: str)

Turn version from 'v1.2.3' into '1_2_3' to be used in filename

cleanup(modules_folder: pathlib.Path)

Q&D cleanup

generate_pyi_from_file(file: pathlib.Path) → bool

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

generate_pyi_files(modules_folder: pathlib.Path) → bool

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

manifest(family=None, machine=None, port=None, platform=None, sysname=None, nodename=None, version=None, release=None, firmware=None) → dict

create a new empty manifest dict

make_manifest(folder: pathlib.Path, family: str, port: str, version: str) → bool

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

generate_all_stubs()

just create typeshed stubs

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

utils.log
utils.STUB_FOLDER = ./all-stubs
utils.clean_version(version: str, build: bool = False)

omit the commit hash from the git tag

Parameters
  • version (str) –

  • build (bool) –

utils.stubfolder(path: str) str

return path in the stub folder

Parameters

path (str) –

Return type

str

utils.flat_version(version: str)

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

Parameters

version (str) –

utils.cleanup(modules_folder: pathlib.Path)

Q&D cleanup

Parameters

modules_folder (pathlib.Path) –

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

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

utils.manifest(family=None, machine=None, port=None, platform=None, sysname=None, nodename=None, version=None, release=None, firmware=None) dict

create a new empty manifest dict

Return type

dict

utils.make_manifest(folder: pathlib.Path, family: str, port: str, version: str) bool

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

Parameters
  • folder (pathlib.Path) –

  • family (str) –

  • port (str) –

  • version (str) –

Return type

bool

utils.generate_all_stubs()

just create typeshed stubs

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]

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