src/eric7/CodeFormatting/IsortFormattingDialog.py

branch
eric7
changeset 9468
a4d8091cd8f7
parent 9465
8a020c34dce2
child 9472
5798ee4a8807
equal deleted inserted replaced
9467:1798115ba35c 9468:a4d8091cd8f7
12 import multiprocessing 12 import multiprocessing
13 import pathlib 13 import pathlib
14 14
15 from dataclasses import dataclass 15 from dataclasses import dataclass
16 16
17 from isort.settings import Config 17 from isort import settings
18 from isort.api import check_file, sort_file 18 from isort.api import check_file, sort_file
19 19
20 from PyQt6.QtCore import pyqtSlot, Qt, QCoreApplication 20 from PyQt6.QtCore import pyqtSlot, Qt, QCoreApplication
21 from PyQt6.QtWidgets import ( 21 from PyQt6.QtWidgets import (
22 QAbstractButton, 22 QAbstractButton,
90 # Create an isort Config object and pre-load it with parameters contained in 90 # Create an isort Config object and pre-load it with parameters contained in
91 # project specific configuration files (like pyproject.toml). The configuration 91 # project specific configuration files (like pyproject.toml). The configuration
92 # given as a dictionary (i.e. data entered in the configuration dialog) 92 # given as a dictionary (i.e. data entered in the configuration dialog)
93 # overwrites these. If the project is not passed, the isort config is based on 93 # overwrites these. If the project is not passed, the isort config is based on
94 # the isort defaults. 94 # the isort defaults.
95 self.__isortConfig = ( 95 if project:
96 Config(settings_path=project.getProjectPath(), **self.__config) 96 # clear the caches in order to force a re-read of config files
97 if project 97 settings._get_config_data.cache_clear()
98 else Config(**self.__config) 98 settings._find_config.cache_clear()
99 ) 99 try:
100 self.__isortConfig = (
101 settings.Config(settings_path=project.getProjectPath(), **self.__config)
102 if project
103 else settings.Config(**self.__config)
104 )
105 except KeyError:
106 # invalid configuration entry found in some config file; use just the dialog
107 # parameters
108 self.__isortConfig = settings.Config(**self.__config)
100 109
101 self.__config["__action__"] = action # needed by the workers 110 self.__config["__action__"] = action # needed by the workers
102 111
103 self.__filesList = filesList[:] 112 self.__filesList = filesList[:]
104 113

eric ide

mercurial