src/eric7/CodeFormatting/BlackFormattingDialog.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9220
e9e7eca7efee
child 9281
76caf27cb8a8
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
17 from PyQt6.QtWidgets import ( 17 from PyQt6.QtWidgets import (
18 QAbstractButton, 18 QAbstractButton,
19 QDialog, 19 QDialog,
20 QDialogButtonBox, 20 QDialogButtonBox,
21 QHeaderView, 21 QHeaderView,
22 QTreeWidgetItem 22 QTreeWidgetItem,
23 ) 23 )
24 24
25 from EricWidgets import EricMessageBox 25 from EricWidgets import EricMessageBox
26 26
27 from .Ui_BlackFormattingDialog import Ui_BlackFormattingDialog 27 from .Ui_BlackFormattingDialog import Ui_BlackFormattingDialog
35 35
36 class BlackFormattingDialog(QDialog, Ui_BlackFormattingDialog): 36 class BlackFormattingDialog(QDialog, Ui_BlackFormattingDialog):
37 """ 37 """
38 Class implementing a dialog showing the code formatting progress and the result. 38 Class implementing a dialog showing the code formatting progress and the result.
39 """ 39 """
40
40 DataTypeRole = Qt.ItemDataRole.UserRole 41 DataTypeRole = Qt.ItemDataRole.UserRole
41 DataRole = Qt.ItemDataRole.UserRole + 1 42 DataRole = Qt.ItemDataRole.UserRole + 1
42 43
43 StatusColumn = 0 44 StatusColumn = 0
44 FileNameColumn = 1 45 FileNameColumn = 1
45 46
46 def __init__(self, configuration, filesList, project=None, 47 def __init__(
47 action=BlackFormattingAction.Format, parent=None): 48 self,
49 configuration,
50 filesList,
51 project=None,
52 action=BlackFormattingAction.Format,
53 parent=None,
54 ):
48 """ 55 """
49 Constructor 56 Constructor
50 57
51 @param configuration dictionary containing the configuration parameters 58 @param configuration dictionary containing the configuration parameters
52 @type dict 59 @type dict
53 @param filesList list of absolute file paths to be processed 60 @param filesList list of absolute file paths to be processed
54 @type list of str 61 @type list of str
55 @param project reference to the project object (defaults to None) 62 @param project reference to the project object (defaults to None)
59 @param parent reference to the parent widget (defaults to None) 66 @param parent reference to the parent widget (defaults to None)
60 @type QWidget (optional) 67 @type QWidget (optional)
61 """ 68 """
62 super().__init__(parent) 69 super().__init__(parent)
63 self.setupUi(self) 70 self.setupUi(self)
64 71
65 self.progressBar.setMaximum(len(filesList)) 72 self.progressBar.setMaximum(len(filesList))
66 self.progressBar.setValue(0) 73 self.progressBar.setValue(0)
67 74
68 self.resultsList.header().setSortIndicator(1, Qt.SortOrder.AscendingOrder) 75 self.resultsList.header().setSortIndicator(1, Qt.SortOrder.AscendingOrder)
69 76
70 self.statisticsGroup.setVisible(False) 77 self.statisticsGroup.setVisible(False)
71 78
72 self.__report = BlackReport(self) 79 self.__report = BlackReport(self)
73 self.__report.check = action is BlackFormattingAction.Check 80 self.__report.check = action is BlackFormattingAction.Check
74 self.__report.diff = action is BlackFormattingAction.Diff 81 self.__report.diff = action is BlackFormattingAction.Diff
75 82
76 self.__config = copy.deepcopy(configuration) 83 self.__config = copy.deepcopy(configuration)
77 self.__project = project 84 self.__project = project
78 self.__action = action 85 self.__action = action
79 86
80 self.__cancelled = False 87 self.__cancelled = False
81 self.__diffDialog = None 88 self.__diffDialog = None
82 89
83 self.__allFilter = self.tr("<all>") 90 self.__allFilter = self.tr("<all>")
84 91
85 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setEnabled(True) 92 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setEnabled(True)
86 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(False) 93 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(False)
87 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setDefault(True) 94 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setDefault(True)
88 95
89 self.show() 96 self.show()
90 QCoreApplication.processEvents() 97 QCoreApplication.processEvents()
91 98
92 self.__files = self.__filterFiles(filesList) 99 self.__files = self.__filterFiles(filesList)
93 self.__formatFiles() 100 self.__formatFiles()
94 101
95 def __filterFiles(self, filesList): 102 def __filterFiles(self, filesList):
96 """ 103 """
97 Private method to filter the given list of files according the 104 Private method to filter the given list of files according the
98 configuration parameters. 105 configuration parameters.
99 106
100 @param filesList list of files 107 @param filesList list of files
101 @type list of str 108 @type list of str
102 @return list of filtered files 109 @return list of filtered files
103 @rtype list of str 110 @rtype list of str
104 """ 111 """
105 filterRegExps = [ 112 filterRegExps = [
106 BlackUtilities.compileRegExp(self.__config[k]) 113 BlackUtilities.compileRegExp(self.__config[k])
107 for k in ["force-exclude", "extend-exclude", "exclude"] 114 for k in ["force-exclude", "extend-exclude", "exclude"]
108 if k in self.__config and bool(self.__config[k]) 115 if k in self.__config
116 and bool(self.__config[k])
109 and BlackUtilities.validateRegExp(self.__config[k])[0] 117 and BlackUtilities.validateRegExp(self.__config[k])[0]
110 ] 118 ]
111 119
112 files = [] 120 files = []
113 for file in filesList: 121 for file in filesList:
114 file = Utilities.fromNativeSeparators(file) 122 file = Utilities.fromNativeSeparators(file)
115 for filterRegExp in filterRegExps: 123 for filterRegExp in filterRegExps:
116 filterMatch = filterRegExp.search(file) 124 filterMatch = filterRegExp.search(file)
117 if filterMatch and filterMatch.group(0): 125 if filterMatch and filterMatch.group(0):
118 self.__report.path_ignored(file) 126 self.__report.path_ignored(file)
119 break 127 break
120 else: 128 else:
121 files.append(file) 129 files.append(file)
122 130
123 return files 131 return files
124 132
125 def __resort(self): 133 def __resort(self):
126 """ 134 """
127 Private method to resort the result list. 135 Private method to resort the result list.
128 """ 136 """
129 self.resultsList.sortItems( 137 self.resultsList.sortItems(
130 self.resultsList.sortColumn(), 138 self.resultsList.sortColumn(),
131 self.resultsList.header().sortIndicatorOrder()) 139 self.resultsList.header().sortIndicatorOrder(),
132 140 )
141
133 def __resizeColumns(self): 142 def __resizeColumns(self):
134 """ 143 """
135 Private method to resize the columns of the result list. 144 Private method to resize the columns of the result list.
136 """ 145 """
137 self.resultsList.header().resizeSections( 146 self.resultsList.header().resizeSections(
138 QHeaderView.ResizeMode.ResizeToContents) 147 QHeaderView.ResizeMode.ResizeToContents
148 )
139 self.resultsList.header().setStretchLastSection(True) 149 self.resultsList.header().setStretchLastSection(True)
140 150
141 def __populateStatusFilterCombo(self): 151 def __populateStatusFilterCombo(self):
142 """ 152 """
143 Private method to populate the status filter combo box with allowed selections. 153 Private method to populate the status filter combo box with allowed selections.
144 """ 154 """
145 allowedSelections = set() 155 allowedSelections = set()
147 allowedSelections.add( 157 allowedSelections.add(
148 self.resultsList.topLevelItem(row).text( 158 self.resultsList.topLevelItem(row).text(
149 BlackFormattingDialog.StatusColumn 159 BlackFormattingDialog.StatusColumn
150 ) 160 )
151 ) 161 )
152 162
153 self.statusFilterComboBox.addItem(self.__allFilter) 163 self.statusFilterComboBox.addItem(self.__allFilter)
154 self.statusFilterComboBox.addItems(sorted(allowedSelections)) 164 self.statusFilterComboBox.addItems(sorted(allowedSelections))
155 165
156 def __finish(self): 166 def __finish(self):
157 """ 167 """
158 Private method to perform some actions after the run was performed or canceled. 168 Private method to perform some actions after the run was performed or canceled.
159 """ 169 """
160 self.__resort() 170 self.__resort()
161 self.__resizeColumns() 171 self.__resizeColumns()
162 172
163 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setEnabled(False) 173 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setEnabled(False)
164 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(True) 174 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(True)
165 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setDefault(True) 175 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setDefault(True)
166 176
167 self.progressBar.setVisible(False) 177 self.progressBar.setVisible(False)
168 178
169 self.__updateStatistics() 179 self.__updateStatistics()
170 self.__populateStatusFilterCombo() 180 self.__populateStatusFilterCombo()
171 181
172 def __updateStatistics(self): 182 def __updateStatistics(self):
173 """ 183 """
174 Private method to update the statistics about the recent formatting run and 184 Private method to update the statistics about the recent formatting run and
175 make them visible. 185 make them visible.
176 """ 186 """
177 self.reformattedLabel.setText( 187 self.reformattedLabel.setText(
178 self.tr("reformatted") 188 self.tr("reformatted")
179 if self.__action is BlackFormattingAction.Format else 189 if self.__action is BlackFormattingAction.Format
180 self.tr("would reformat") 190 else self.tr("would reformat")
181 ) 191 )
182 192
183 total = self.progressBar.maximum() 193 total = self.progressBar.maximum()
184 processed = total - self.__report.ignored_count 194 processed = total - self.__report.ignored_count
185 195
186 self.totalCountLabel.setText("{0:n}".format(total)) 196 self.totalCountLabel.setText("{0:n}".format(total))
187 self.excludedCountLabel.setText("{0:n}".format(self.__report.ignored_count)) 197 self.excludedCountLabel.setText("{0:n}".format(self.__report.ignored_count))
188 self.failuresCountLabel.setText("{0:n}".format(self.__report.failure_count)) 198 self.failuresCountLabel.setText("{0:n}".format(self.__report.failure_count))
189 self.processedCountLabel.setText("{0:n}".format(processed)) 199 self.processedCountLabel.setText("{0:n}".format(processed))
190 self.reformattedCountLabel.setText("{0:n}".format(self.__report.change_count)) 200 self.reformattedCountLabel.setText("{0:n}".format(self.__report.change_count))
191 self.unchangedCountLabel.setText("{0:n}".format(self.__report.same_count)) 201 self.unchangedCountLabel.setText("{0:n}".format(self.__report.same_count))
192 202
193 self.statisticsGroup.setVisible(True) 203 self.statisticsGroup.setVisible(True)
194 204
195 @pyqtSlot(QAbstractButton) 205 @pyqtSlot(QAbstractButton)
196 def on_buttonBox_clicked(self, button): 206 def on_buttonBox_clicked(self, button):
197 """ 207 """
198 Private slot to handle button presses of the dialog buttons. 208 Private slot to handle button presses of the dialog buttons.
199 209
200 @param button reference to the pressed button 210 @param button reference to the pressed button
201 @type QAbstractButton 211 @type QAbstractButton
202 """ 212 """
203 if button == self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel): 213 if button == self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel):
204 self.__cancelled = True 214 self.__cancelled = True
205 elif button == self.buttonBox.button(QDialogButtonBox.StandardButton.Close): 215 elif button == self.buttonBox.button(QDialogButtonBox.StandardButton.Close):
206 self.accept() 216 self.accept()
207 217
208 @pyqtSlot(QTreeWidgetItem, int) 218 @pyqtSlot(QTreeWidgetItem, int)
209 def on_resultsList_itemDoubleClicked(self, item, column): 219 def on_resultsList_itemDoubleClicked(self, item, column):
210 """ 220 """
211 Private slot handling a double click of a result item. 221 Private slot handling a double click of a result item.
212 222
213 @param item reference to the double clicked item 223 @param item reference to the double clicked item
214 @type QTreeWidgetItem 224 @type QTreeWidgetItem
215 @param column column number that was double clicked 225 @param column column number that was double clicked
216 @type int 226 @type int
217 """ 227 """
218 dataType = item.data(0, BlackFormattingDialog.DataTypeRole) 228 dataType = item.data(0, BlackFormattingDialog.DataTypeRole)
219 if dataType == "error": 229 if dataType == "error":
220 EricMessageBox.critical( 230 EricMessageBox.critical(
221 self, 231 self,
222 self.tr("Formatting Failure"), 232 self.tr("Formatting Failure"),
223 self.tr( 233 self.tr("<p>Formatting failed due to this error.</p><p>{0}</p>").format(
224 "<p>Formatting failed due to this error.</p><p>{0}</p>" 234 item.data(0, BlackFormattingDialog.DataRole)
225 ).format(item.data(0, BlackFormattingDialog.DataRole)) 235 ),
226 ) 236 )
227 elif dataType == "diff": 237 elif dataType == "diff":
228 if self.__diffDialog is None: 238 if self.__diffDialog is None:
229 self.__diffDialog = BlackDiffWidget() 239 self.__diffDialog = BlackDiffWidget()
230 self.__diffDialog.showDiff(item.data(0, BlackFormattingDialog.DataRole)) 240 self.__diffDialog.showDiff(item.data(0, BlackFormattingDialog.DataRole))
231 241
232 def addResultEntry(self, status, fileName, isError=False, data=None): 242 def addResultEntry(self, status, fileName, isError=False, data=None):
233 """ 243 """
234 Public method to add an entry to the result list. 244 Public method to add an entry to the result list.
235 245
236 @param status status of the operation 246 @param status status of the operation
237 @type str 247 @type str
238 @param fileName name of the processed file 248 @param fileName name of the processed file
239 @type str 249 @type str
240 @param isError flag indicating that data contains an error message (defaults to 250 @param isError flag indicating that data contains an error message (defaults to
243 @param data associated data (diff or error message) (defaults to None) 253 @param data associated data (diff or error message) (defaults to None)
244 @type str (optional) 254 @type str (optional)
245 """ 255 """
246 if self.__project: 256 if self.__project:
247 fileName = self.__project.getRelativePath(fileName) 257 fileName = self.__project.getRelativePath(fileName)
248 258
249 itm = QTreeWidgetItem(self.resultsList, [status, fileName]) 259 itm = QTreeWidgetItem(self.resultsList, [status, fileName])
250 if data: 260 if data:
251 itm.setData( 261 itm.setData(
252 0, 262 0, BlackFormattingDialog.DataTypeRole, "error" if isError else "diff"
253 BlackFormattingDialog.DataTypeRole,
254 "error" if isError else "diff"
255 ) 263 )
256 itm.setData(0, BlackFormattingDialog.DataRole, data) 264 itm.setData(0, BlackFormattingDialog.DataRole, data)
257 265
258 self.progressBar.setValue(self.progressBar.value() + 1) 266 self.progressBar.setValue(self.progressBar.value() + 1)
259 267
260 QCoreApplication.processEvents() 268 QCoreApplication.processEvents()
261 269
262 def __formatFiles(self): 270 def __formatFiles(self):
263 """ 271 """
264 Private method to format the list of files according the configuration. 272 Private method to format the list of files according the configuration.
265 """ 273 """
266 writeBack = black.WriteBack.from_configuration( 274 writeBack = black.WriteBack.from_configuration(
267 check=self.__action is BlackFormattingAction.Check, 275 check=self.__action is BlackFormattingAction.Check,
268 diff=self.__action is BlackFormattingAction.Diff 276 diff=self.__action is BlackFormattingAction.Diff,
269 ) 277 )
270 278
271 versions = ( 279 versions = (
272 { 280 {
273 black.TargetVersion[target.upper()] 281 black.TargetVersion[target.upper()]
274 for target in self.__config["target-version"] 282 for target in self.__config["target-version"]
275 } 283 }
276 if self.__config["target-version"] else 284 if self.__config["target-version"]
277 set() 285 else set()
278 ) 286 )
279 287
280 mode = black.Mode( 288 mode = black.Mode(
281 target_versions=versions, 289 target_versions=versions,
282 line_length=int(self.__config["line-length"]), 290 line_length=int(self.__config["line-length"]),
283 string_normalization=not self.__config["skip-string-normalization"], 291 string_normalization=not self.__config["skip-string-normalization"],
284 magic_trailing_comma=not self.__config["skip-magic-trailing-comma"] 292 magic_trailing_comma=not self.__config["skip-magic-trailing-comma"],
285 ) 293 )
286 294
287 for file in self.__files: 295 for file in self.__files:
288 if self.__action is BlackFormattingAction.Diff: 296 if self.__action is BlackFormattingAction.Diff:
289 self.__diffFormatFile( 297 self.__diffFormatFile(
290 pathlib.Path(file), 298 pathlib.Path(file), fast=False, mode=mode, report=self.__report
291 fast=False,
292 mode=mode,
293 report=self.__report
294 ) 299 )
295 else: 300 else:
296 black.reformat_one( 301 black.reformat_one(
297 pathlib.Path(file), 302 pathlib.Path(file),
298 fast=False, 303 fast=False,
299 write_back=writeBack, 304 write_back=writeBack,
300 mode=mode, 305 mode=mode,
301 report=self.__report 306 report=self.__report,
302 ) 307 )
303 308
304 if self.__cancelled: 309 if self.__cancelled:
305 break 310 break
306 311
307 self.__finish() 312 self.__finish()
308 313
309 def __diffFormatFile(self, src, fast, mode, report): 314 def __diffFormatFile(self, src, fast, mode, report):
310 """ 315 """
311 Private method to check, if the given files need to be reformatted, and generate 316 Private method to check, if the given files need to be reformatted, and generate
312 a unified diff. 317 a unified diff.
313 318
314 @param src path of file to be checked 319 @param src path of file to be checked
315 @type pathlib.Path 320 @type pathlib.Path
316 @param fast flag indicating fast operation 321 @param fast flag indicating fast operation
317 @type bool 322 @type bool
318 @param mode code formatting options 323 @param mode code formatting options
326 try: 331 try:
327 dstContents = black.format_file_contents(srcContents, fast=fast, mode=mode) 332 dstContents = black.format_file_contents(srcContents, fast=fast, mode=mode)
328 except black.NothingChanged: 333 except black.NothingChanged:
329 report.done(src, black.Changed.NO) 334 report.done(src, black.Changed.NO)
330 return 335 return
331 336
332 fileName = str(src) 337 fileName = str(src)
333 if self.__project: 338 if self.__project:
334 fileName = self.__project.getRelativePath(fileName) 339 fileName = self.__project.getRelativePath(fileName)
335 340
336 now = datetime.datetime.utcnow() 341 now = datetime.datetime.utcnow()
337 srcName = f"{fileName}\t{then} +0000" 342 srcName = f"{fileName}\t{then} +0000"
338 dstName = f"{fileName}\t{now} +0000" 343 dstName = f"{fileName}\t{now} +0000"
339 diffContents = black.diff(srcContents, dstContents, srcName, dstName) 344 diffContents = black.diff(srcContents, dstContents, srcName, dstName)
340 report.done(src, black.Changed.YES, diff=diffContents) 345 report.done(src, black.Changed.YES, diff=diffContents)
341 346
342 def closeEvent(self, evt): 347 def closeEvent(self, evt):
343 """ 348 """
344 Protected slot implementing a close event handler. 349 Protected slot implementing a close event handler.
345 350
346 @param evt reference to the close event 351 @param evt reference to the close event
347 @type QCloseEvent 352 @type QCloseEvent
348 """ 353 """
349 if self.__diffDialog is not None: 354 if self.__diffDialog is not None:
350 self.__diffDialog.close() 355 self.__diffDialog.close()
351 evt.accept() 356 evt.accept()
352 357
353 @pyqtSlot(str) 358 @pyqtSlot(str)
354 def on_statusFilterComboBox_currentTextChanged(self, status): 359 def on_statusFilterComboBox_currentTextChanged(self, status):
355 """ 360 """
356 Private slot handling the selection of a status for items to be shown. 361 Private slot handling the selection of a status for items to be shown.
357 362
358 @param status selected status 363 @param status selected status
359 @type str 364 @type str
360 """ 365 """
361 for row in range(self.resultsList.topLevelItemCount()): 366 for row in range(self.resultsList.topLevelItemCount()):
362 itm = self.resultsList.topLevelItem(row) 367 itm = self.resultsList.topLevelItem(row)
368 373
369 class BlackReport(black.Report): 374 class BlackReport(black.Report):
370 """ 375 """
371 Class extending the black Report to work with our dialog. 376 Class extending the black Report to work with our dialog.
372 """ 377 """
378
373 def __init__(self, dialog): 379 def __init__(self, dialog):
374 """ 380 """
375 Constructor 381 Constructor
376 382
377 @param dialog reference to the result dialog 383 @param dialog reference to the result dialog
378 @type QDialog 384 @type QDialog
379 """ 385 """
380 super().__init__() 386 super().__init__()
381 387
382 self.ignored_count = 0 388 self.ignored_count = 0
383 389
384 self.__dialog = dialog 390 self.__dialog = dialog
385 391
386 def done(self, src, changed, diff=""): 392 def done(self, src, changed, diff=""):
387 """ 393 """
388 Public method to handle the end of a reformat. 394 Public method to handle the end of a reformat.
389 395
390 @param src name of the processed file 396 @param src name of the processed file
391 @type pathlib.Path 397 @type pathlib.Path
392 @param changed change status 398 @param changed change status
393 @type black.Changed 399 @type black.Changed
394 @param diff unified diff of potential changes (defaults to "") 400 @param diff unified diff of potential changes (defaults to "")
395 @type str 401 @type str
396 """ 402 """
397 if changed is black.Changed.YES: 403 if changed is black.Changed.YES:
398 status = ( 404 status = (
399 QCoreApplication.translate("BlackFormattingDialog", "would reformat") 405 QCoreApplication.translate("BlackFormattingDialog", "would reformat")
400 if self.check or self.diff else 406 if self.check or self.diff
401 QCoreApplication.translate("BlackFormattingDialog", "reformatted") 407 else QCoreApplication.translate("BlackFormattingDialog", "reformatted")
402 ) 408 )
403 self.change_count += 1 409 self.change_count += 1
404 410
405 elif changed is black.Changed.NO: 411 elif changed is black.Changed.NO:
406 status = QCoreApplication.translate("BlackFormattingDialog", "unchanged") 412 status = QCoreApplication.translate("BlackFormattingDialog", "unchanged")
407 self.same_count += 1 413 self.same_count += 1
408 414
409 elif changed is black.Changed.CACHED: 415 elif changed is black.Changed.CACHED:
410 status = QCoreApplication.translate("BlackFormattingDialog", "unmodified") 416 status = QCoreApplication.translate("BlackFormattingDialog", "unmodified")
411 self.same_count += 1 417 self.same_count += 1
412 418
413 if self.diff: 419 if self.diff:
414 self.__dialog.addResultEntry(status, str(src), data=diff) 420 self.__dialog.addResultEntry(status, str(src), data=diff)
415 else: 421 else:
416 self.__dialog.addResultEntry(status, str(src)) 422 self.__dialog.addResultEntry(status, str(src))
417 423
418 def failed(self, src, message): 424 def failed(self, src, message):
419 """ 425 """
420 Public method to handle a reformat failure. 426 Public method to handle a reformat failure.
421 427
422 @param src name of the processed file 428 @param src name of the processed file
423 @type pathlib.Path 429 @type pathlib.Path
424 @param message error message 430 @param message error message
425 @type str 431 @type str
426 """ 432 """
427 status = QCoreApplication.translate("BlackFormattingDialog", "failed") 433 status = QCoreApplication.translate("BlackFormattingDialog", "failed")
428 self.failure_count += 1 434 self.failure_count += 1
429 435
430 self.__dialog.addResultEntry(status, str(src), isError=True, data=message) 436 self.__dialog.addResultEntry(status, str(src), isError=True, data=message)
431 437
432 def path_ignored(self, src, message=""): 438 def path_ignored(self, src, message=""):
433 """ 439 """
434 Public method handling an ignored path. 440 Public method handling an ignored path.
435 441
436 @param src name of the processed file 442 @param src name of the processed file
437 @type pathlib.Path or str 443 @type pathlib.Path or str
438 @param message ignore message (default to "") 444 @param message ignore message (default to "")
439 @type str (optional) 445 @type str (optional)
440 """ 446 """
441 status = QCoreApplication.translate("BlackFormattingDialog", "ignored") 447 status = QCoreApplication.translate("BlackFormattingDialog", "ignored")
442 self.ignored_count += 1 448 self.ignored_count += 1
443 449
444 self.__dialog.addResultEntry(status, str(src)) 450 self.__dialog.addResultEntry(status, str(src))

eric ide

mercurial