Skip to main content

importext

Project description

这是什么?

这是一个导入一次解耦方案, 封装了importlib并进行了底层的修改.

这能干什么?

from entrancebar.Import import Import
from entrancebar.sources import FromSitePackage, FromFileLocation

os, Path, getframe, join, thisfile = Import(
    os="os::$this",
    Path="pathlib::Path",
    getframe="sys::_getframe",
    join="os::path/join",
    thisfile="testfile::$this"
)(
    os=FromSitePackage("os"),
    pathlib=FromSitePackage("pathlib"),
    sys=FromSitePackage("sys"),
    testfile=FromFileLocation("./test.py")
) # 实际上, 导入不需要解构运算符, Import会直接把传入的具名实参导入到当前的globals()内.

所以这么没用的玩意发出来干啥?

给我自己用.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

entrancebar-0.0.27.tar.gz (5.7 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page