Merge pull request #19394 from FreeCAD/pre-commit-ci-update-config

Update Black to 25.1.0 so that it is in sync with the CI. Updates code to correspond to new Black standards, mostly changing the Addon Manager to eliminate spaces around docstrings.
This commit is contained in:
Chris Hennes
2025-02-07 08:52:20 -06:00
committed by GitHub
52 changed files with 76 additions and 77 deletions

View File

@@ -62,7 +62,7 @@ repos:
- id: check-added-large-files
- id: mixed-line-ending
- repo: https://github.com/psf/black
rev: 1b2427a2b785cc4aac97c19bb4b9a0de063f9547 # frozen: 24.10.0
rev: 8a737e727ac5ab2f1d4cf5876720ed276dc8dc4b # frozen: 25.1.0
hooks:
- id: black
args: ['--line-length', '100']

View File

@@ -21,7 +21,7 @@
# * *
# ***************************************************************************
""" Defines the Addon class to encapsulate information about FreeCAD Addons """
"""Defines the Addon class to encapsulate information about FreeCAD Addons"""
import os
import re

View File

@@ -21,7 +21,7 @@
# * *
# ***************************************************************************
""" Contains a the Addon Manager's preferences dialog management class """
"""Contains a the Addon Manager's preferences dialog management class"""
import os

View File

@@ -21,7 +21,7 @@
# * *
# ***************************************************************************
""" Classes and structures related to Addon sidecar information """
"""Classes and structures related to Addon sidecar information"""
from __future__ import annotations
from dataclasses import dataclass

View File

@@ -21,7 +21,7 @@
# * *
# ***************************************************************************
""" Defines a QWidget-derived class for displaying the single-addon buttons. """
"""Defines a QWidget-derived class for displaying the single-addon buttons."""
from enum import Enum, auto

View File

@@ -21,7 +21,7 @@
# * *
# ***************************************************************************
""" Defines a QWidget-derived class for displaying the view selection buttons. """
"""Defines a QWidget-derived class for displaying the view selection buttons."""
from enum import IntEnum

View File

@@ -21,9 +21,9 @@
# * *
# ***************************************************************************
""" Defines a QWidget-derived class for displaying a set of buttons that affect the Addon
"""Defines a QWidget-derived class for displaying a set of buttons that affect the Addon
Manager as a whole (rather than a specific Addon). Typically inserted at the bottom of the Addon
Manager main window. """
Manager main window."""
try:
import FreeCAD

View File

@@ -21,7 +21,7 @@
# * *
# ***************************************************************************
""" Defines a QWidget-derived class for displaying the cache load status. """
"""Defines a QWidget-derived class for displaying the cache load status."""
try:
import FreeCAD

View File

@@ -21,7 +21,7 @@
# * *
# ***************************************************************************
""" Defines a QWidget-derived class for displaying the view selection buttons. """
"""Defines a QWidget-derived class for displaying the view selection buttons."""
try:
import FreeCAD

View File

@@ -21,7 +21,7 @@
# * *
# ***************************************************************************
""" Defines a class derived from QWidget for displaying the bar at the top of the addons list. """
"""Defines a class derived from QWidget for displaying the bar at the top of the addons list."""
from enum import IntEnum, auto

View File

@@ -21,7 +21,7 @@
# * *
# ***************************************************************************
""" Defines a QWidget-derived class for displaying the view selection buttons. """
"""Defines a QWidget-derived class for displaying the view selection buttons."""
from enum import IntEnum

View File

@@ -21,7 +21,7 @@
# * *
# ***************************************************************************
""" System for checking the network connection status asynchronously. """
"""System for checking the network connection status asynchronously."""
import FreeCAD

View File

@@ -21,7 +21,7 @@
# * *
# ***************************************************************************
""" Classes to manage "Developer Mode" """
"""Classes to manage "Developer Mode" """
import os
import datetime

View File

@@ -21,8 +21,8 @@
# * *
# ***************************************************************************
""" Contains a class for adding a single content item, as well as auxiliary classes for
its dependent dialog boxes. """
"""Contains a class for adding a single content item, as well as auxiliary classes for
its dependent dialog boxes."""
import os
from typing import Optional, Tuple, List

View File

@@ -21,7 +21,7 @@
# * *
# ***************************************************************************
""" Contains a class to manage selection of a license for an Addon. """
"""Contains a class to manage selection of a license for an Addon."""
import os
from datetime import date

View File

@@ -21,7 +21,7 @@
# * *
# ***************************************************************************
""" Contains a wrapper class for a table listing authors and maintainers """
"""Contains a wrapper class for a table listing authors and maintainers"""
import os

View File

@@ -21,7 +21,7 @@
# * *
# ***************************************************************************
""" Metadata validation functions """
"""Metadata validation functions"""
from typing import List

View File

@@ -21,7 +21,7 @@
# * *
# ***************************************************************************
""" Contains a wrapper class for a table listing authors and maintainers """
"""Contains a wrapper class for a table listing authors and maintainers"""
import os

View File

@@ -21,7 +21,7 @@
# * *
# ***************************************************************************
""" Contains a class to handle editing a person (from a Metadata standpoint). """
"""Contains a class to handle editing a person (from a Metadata standpoint)."""
import os
from typing import Tuple # Needed until Py 3.9, when tuple supports this directly

View File

@@ -21,7 +21,7 @@
# * *
# ***************************************************************************
""" Class to guess metadata based on folder contents. Note that one of the functions
"""Class to guess metadata based on folder contents. Note that one of the functions
of this file is to guess the license being applied to the new software package based
in its contents. It is up to the user to make the final determination about whether
the selected license is the correct one, and inclusion here shouldn't be construed as

View File

@@ -21,7 +21,7 @@
# * *
# ***************************************************************************
""" Validators used for various line edits """
"""Validators used for various line edits"""
import keyword

View File

@@ -21,7 +21,7 @@
# * *
# ***************************************************************************
""" Class to display a first-run dialog for the Addon Manager """
"""Class to display a first-run dialog for the Addon Manager"""
import os

View File

@@ -21,7 +21,7 @@
# * *
# ***************************************************************************
""" Contains the classes to manage Addon installation: intended as a stable API, safe for external
"""Contains the classes to manage Addon installation: intended as a stable API, safe for external
code to call and to rely upon existing. See classes AddonInstaller and MacroInstaller for details.
"""
import json

View File

@@ -21,9 +21,9 @@
# * *
# ***************************************************************************
""" Utilities for working with licenses. Based on SPDX info downloaded from
"""Utilities for working with licenses. Based on SPDX info downloaded from
https://github.com/spdx/license-list-data and stored as part of the FreeCAD repo, loaded into a Qt
resource. """
resource."""
import json

View File

@@ -22,7 +22,7 @@
# * *
# ***************************************************************************
""" Unified handler for FreeCAD macros that can be obtained from different sources. """
"""Unified handler for FreeCAD macros that can be obtained from different sources."""
import os
import re

View File

@@ -21,9 +21,9 @@
# * *
# ***************************************************************************
""" Provides classes and support functions for managing the automatically-installed
"""Provides classes and support functions for managing the automatically-installed
Python library dependencies. No support is provided for uninstalling those dependencies
because pip's uninstall function does not support the target directory argument. """
because pip's uninstall function does not support the target directory argument."""
import json
import os

View File

@@ -21,7 +21,7 @@
# * *
# ***************************************************************************
""" A Qt Widget for displaying Addon README information """
"""A Qt Widget for displaying Addon README information"""
import FreeCAD
from Addon import Addon

View File

@@ -21,7 +21,7 @@
# * *
# ***************************************************************************
""" Contains the classes to manage Addon removal: intended as a stable API, safe for
"""Contains the classes to manage Addon removal: intended as a stable API, safe for
external code to call and to rely upon existing. See classes AddonUninstaller and
MacroUninstaller for details."""
import json

View File

@@ -22,7 +22,7 @@
# * *
# ***************************************************************************
""" Utilities to work across different platforms, providers and python versions """
"""Utilities to work across different platforms, providers and python versions"""
from datetime import datetime
from typing import Optional, Any, List

View File

@@ -22,7 +22,7 @@
# * *
# ***************************************************************************
""" Worker thread classes for Addon Manager installation and removal """
"""Worker thread classes for Addon Manager installation and removal"""
# pylint: disable=c-extension-no-member,too-few-public-methods,too-many-instance-attributes

View File

@@ -22,7 +22,7 @@
# * *
# ***************************************************************************
""" Worker thread classes for Addon Manager startup """
"""Worker thread classes for Addon Manager startup"""
import hashlib
import json
import os

View File

@@ -21,7 +21,7 @@
# * *
# ***************************************************************************
""" Misc. worker thread classes for the FreeCAD Addon Manager. """
"""Misc. worker thread classes for the FreeCAD Addon Manager."""
from typing import Optional

View File

@@ -21,7 +21,7 @@
# * *
# ***************************************************************************
""" Provides a class for showing the list view and detail view at the same time. """
"""Provides a class for showing the list view and detail view at the same time."""
import base64

View File

@@ -21,7 +21,7 @@
# * *
# ***************************************************************************
""" A collection of functions to handle installing a macro icon to the toolbar. """
"""A collection of functions to handle installing a macro icon to the toolbar."""
import os

View File

@@ -21,7 +21,7 @@
# * *
# ***************************************************************************
""" Defines the PackageList QWidget for displaying a list of Addons. """
"""Defines the PackageList QWidget for displaying a list of Addons."""
import datetime
import threading

View File

@@ -20,7 +20,7 @@
# * *
# ***************************************************************************
""" Used to create CNC machine fixture offsets such as G54,G55, etc..."""
"""Used to create CNC machine fixture offsets such as G54,G55, etc..."""
import FreeCAD
import FreeCADGui

View File

@@ -21,7 +21,7 @@
# * *
# ***************************************************************************
"""Selection gates and observers to control selectability while building Path operations """
"""Selection gates and observers to control selectability while building Path operations"""
import FreeCAD
import FreeCADGui

View File

@@ -21,7 +21,7 @@
# ***************************************************************************
"""Post Process command that will make use of the Output File and Post
Processor entries in PathJob """
Processor entries in PathJob"""
import FreeCAD

View File

@@ -19,7 +19,7 @@
# * USA *
# * *
# ***************************************************************************
"""PathUtils -common functions used in PathScripts for filtering, sorting, and generating gcode toolpath data """
"""PathUtils -common functions used in PathScripts for filtering, sorting, and generating gcode toolpath data"""
import FreeCAD
from FreeCAD import Vector

View File

@@ -20,7 +20,7 @@
# * USA *
# * *
# ***************************************************************************
""" Class and methods to migrate old FEM Gui objects
"""Class and methods to migrate old FEM Gui objects
see module end as well as forum topic
https://forum.freecad.org/viewtopic.php?&t=46218

View File

@@ -21,7 +21,7 @@
# * USA *
# * *
# ***************************************************************************
""" Execute Solver and obtain Reports and Results.
"""Execute Solver and obtain Reports and Results.
Integral part of the Solver Framework which contains components responsible for
executing the solver in the background. Also provides an asynchronous

View File

@@ -21,7 +21,7 @@
# * USA *
# * *
# ***************************************************************************
""" Query FEM specific settings including solver settings.
"""Query FEM specific settings including solver settings.
Query settings from the hierarchically organized settings/parameter system of
FreeCAD related to the FEM module. The collection of independent functions use

View File

@@ -20,7 +20,7 @@
# * USA *
# * *
# ***************************************************************************
""" Collection of natural constants for the Fem module.
"""Collection of natural constants for the Fem module.
This module contains natural constants for the Fem module.
All constants are in SI units.

View File

@@ -22,7 +22,7 @@
# * USA *
# * *
# ***************************************************************************
""" Collection of functions for the Fem module.
"""Collection of functions for the Fem module.
This module contains function for extracting relevant parts of geometry and
a few unrelated function useful at various places in the Fem module.

View File

@@ -21,7 +21,7 @@
# * USA *
# * *
# ***************************************************************************
""" Collection of functions for the Fem module.
"""Collection of functions for the Fem module.
This module contains function for managing a analysis and all the different
types of objects it contains, helper for executing a simulation.

View File

@@ -20,7 +20,7 @@
# * USA *
# * *
# ***************************************************************************
""" Class and methods to migrate old FEM App objects
"""Class and methods to migrate old FEM App objects
see module end as well as forum topic
https://forum.freecad.org/viewtopic.php?&t=46218

View File

@@ -7,9 +7,9 @@
Return value are list of vectors, 3 vectors define a facet.
Sample code for creating a mesh:
facets = Cube(3.0, 4.0, 5.0)
m = Mesh.newMesh()
m.addFacets(facets)
facets = Cube(3.0, 4.0, 5.0)
m = Mesh.newMesh()
m.addFacets(facets)
"""

View File

@@ -31,6 +31,7 @@
class MeshPartWorkbench(Workbench):
"MeshPart workbench object"
Icon = """
/* XPM */
static const char *MeshPart_Box[]={

View File

@@ -1,25 +1,25 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
"""**************************************************************************
* *
* Copyright (c) 2024 Ondsel <development@ondsel.com> *
* *
* This file is part of FreeCAD. *
* *
* FreeCAD is free software: you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 2.1 of the *
* License, or (at your option) any later version. *
* *
* FreeCAD is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with FreeCAD. If not, see *
* <https://www.gnu.org/licenses/>. *
* *
***************************************************************************/"""
* *
* Copyright (c) 2024 Ondsel <development@ondsel.com> *
* *
* This file is part of FreeCAD. *
* *
* FreeCAD is free software: you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 2.1 of the *
* License, or (at your option) any later version. *
* *
* FreeCAD is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with FreeCAD. If not, see *
* <https://www.gnu.org/licenses/>. *
* *
***************************************************************************/"""
import FreeCAD, FreeCADGui, unittest

View File

@@ -6,6 +6,7 @@
class _TEMPLATEPY_Workbench(Workbench):
"_TEMPLATEPY_ workbench object"
Icon = FreeCAD.getResourceDir() + "Mod/_TEMPLATEPY_/Resources/icons/_TEMPLATEPY_Workbench.svg"
MenuText = "_TEMPLATEPY_"
ToolTip = "_TEMPLATEPY_ workbench"

View File

@@ -4,6 +4,7 @@
class _TEMPLATE_Workbench(Workbench):
"_TEMPLATE_ workbench object"
MenuText = "_TEMPLATE_"
ToolTip = "_TEMPLATE_ workbench"

View File

@@ -341,7 +341,6 @@ def load_token():
def updateqrc(qrcpath, lncode):
"updates a qrc file with the given translation entry"
# print("opening " + qrcpath + "...")
@@ -398,7 +397,6 @@ def updateqrc(qrcpath, lncode):
def updateTranslatorCpp(lncode):
"updates the Translator.cpp file with the given translation entry"
cppfile = os.path.join(os.path.dirname(__file__), "..", "Gui", "Language", "Translator.cpp")
@@ -440,7 +438,6 @@ def updateTranslatorCpp(lncode):
def doFile(tsfilepath, targetpath, lncode, qrcpath):
"updates a single ts file, and creates a corresponding qm file"
basename = os.path.basename(tsfilepath)[:-3]
@@ -475,7 +472,6 @@ def doFile(tsfilepath, targetpath, lncode, qrcpath):
def doLanguage(lncode):
"treats a single language"
if lncode == "en":