Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazy import #63073

Closed
wants to merge 6 commits into from
Closed

Lazy import #63073

wants to merge 6 commits into from

Commits on Dec 19, 2022

  1. Add missing import statement

    The `salt.loader` module is intentially imported late in
    `salt.config.call_id_function()` to avoid a circular import error.
    However, `salt.loader` is also used in `salt.config.mminion_config()`,
    so import it there as well.  This avoids an error if
    `mminion_config()` is called before `call_id_function()`, or if the
    import statement in `call_id_function()` is removed in the future.
    rhansen committed Dec 19, 2022
    Configuration menu
    Copy the full SHA
    692a9bc View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    584b234 View commit details
    Browse the repository at this point in the history
  3. Delete unused and redundant import statements

    The delayed `import` statements match `import` statements at the top
    of the file so they are effectively no-ops.
    rhansen committed Dec 19, 2022
    Configuration menu
    Copy the full SHA
    b8e699e View commit details
    Browse the repository at this point in the history
  4. New lazy_import function

    For rationale, see the documentation for the new function.
    
    Future commits will use this to replace existing delayed `import`
    statements, and to defer some more module loads to avoid circular
    imports.
    rhansen committed Dec 19, 2022
    Configuration menu
    Copy the full SHA
    cca82f5 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    128195a View commit details
    Browse the repository at this point in the history
  6. Convert some top-level import statements to lazy imports

    This makes it possible to import these affected modules from core code
    without introducing a circular import.
    rhansen committed Dec 19, 2022
    Configuration menu
    Copy the full SHA
    9450bc9 View commit details
    Browse the repository at this point in the history