Skip to content

Make lazy_import more friendly to pyflakes and other static checkers #30647

@mkoeppe

Description

@mkoeppe

pyflakes does not know about lazy_import and may therefore emit distracting warnings - as noted in #30616 comment:8

We introduce a new method PythonModule.lazy_import, which enables the following new idiom for creating lazy imports that are visible to static checkers:

LibBraiding = PythonModule('sage.libs.braiding', spkg='libbraiding')
rightnormalform = LibBraiding.lazy_import(
  'rightnormalform', namespace=None)
centralizer,  supersummitset = LibBraiding.lazy_import(
  ('centralizer', 'supersummitset'), namespace=None)

See also:

Depends on #30616

CC: @dcoudert @tobiasdiez @fchapoton @jhpalmieri @tscrim

Component: refactoring

Author: Matthias Koeppe

Branch/Commit: u/mkoeppe/make_lazy_import_more_friendly_to_pyflakes_and_other_static_checkers @ 9b19c7a

Issue created by migration from https://trac.sagemath.org/ticket/30647

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions