提交 2d76984f 编辑于 作者: Timothy Crosley's avatar Timothy Crosley
浏览文件

Implemented #970: Support for custom sharable isort profiles.

显示 7 个添加0 个删除
+7 -0
......@@ -9,6 +9,7 @@ NOTE: isort follows the [semver](https://semver.org/) versioning standard.
- Implemented #1261: By popular demand, `filter_files` can now be set in the config option.
- Implemented #960: Support for respecting git ignore via "--gitignore" or "skip_gitignore=True".
- Implemented #727: Ability to only add imports if existing imports exist.
- Implemented #970: Support for custom sharable isort profiles.
- `# isort: split` can now be used at the end of an import line.
- Fixed #1339: Extra indent is not preserved when isort:skip is used in nested imports.
......
......@@ -261,6 +261,12 @@ class Config(_Config):
profile_name = config_overrides.get("profile", config_settings.get("profile", ""))
profile: Dict[str, Any] = {}
if profile_name:
if profile_name not in profiles:
import pkg_resources
for plugin in pkg_resources.iter_entry_points("isort.profiles"):
profiles.setdefault(plugin.name, plugin.load().PROFILE) # pragma: no cover
if profile_name not in profiles:
raise ProfileDoesNotExist(profile_name)
......
支持 Markdown
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册