Arch: linting multiple imports on one line (#9281)

This commit is contained in:
luzpaz
2023-04-18 16:23:44 +02:00
committed by GitHub
parent 8a762a8637
commit bc1f217664
33 changed files with 200 additions and 64 deletions
+2 -2
View File
@@ -35,8 +35,8 @@ __url__ = "https://www.freecadweb.org"
import FreeCAD
if FreeCAD.GuiUp:
import FreeCADGui
FreeCADGui.updateLocale()
import FreeCADGui
FreeCADGui.updateLocale()
from ArchWall import *
from ArchFloor import *
+5 -1
View File
@@ -19,8 +19,12 @@
#* *
#***************************************************************************
import math
import FreeCAD, Part, Draft, math, ArchCommands
import FreeCAD
import ArchCommands
import Draft
import Part
from FreeCAD import Vector
if FreeCAD.GuiUp:
import FreeCADGui, re
+4 -2
View File
@@ -19,9 +19,11 @@
#* *
#***************************************************************************
import FreeCAD, DraftGeomUtils
import FreeCAD
import DraftGeomUtils
if FreeCAD.GuiUp:
import FreeCADGui, Draft
import FreeCADGui
import Draft
from PySide import QtCore, QtGui
from draftutils.translate import translate
from pivy import coin
+4 -1
View File
@@ -20,7 +20,10 @@
#* *
#***************************************************************************
import FreeCAD,Draft,ArchCommands,ArchFloor
import FreeCAD
import ArchCommands
import ArchFloor
import Draft
if FreeCAD.GuiUp:
import FreeCADGui
from PySide import QtCore
+2 -1
View File
@@ -398,7 +398,8 @@ class BuildingPart(ArchIFC.IfcProduct):
if deltar:
#child.Placement.Rotation = child.Placement.Rotation.multiply(deltar) - not enough, child must also move
# use shape methods to obtain a correct placement
import Part,math
import Part
import math
shape = Part.Shape()
shape.Placement = child.Placement
#print("angle before rotation:",shape.Placement.Rotation.Angle)
+15 -6
View File
@@ -20,7 +20,10 @@
#* *
#***************************************************************************
import FreeCAD,Draft,ArchComponent,DraftVecUtils
import FreeCAD
import ArchComponent
import Draft
import DraftVecUtils
from FreeCAD import Vector
if FreeCAD.GuiUp:
import FreeCADGui
@@ -354,7 +357,8 @@ def makeFace(wires,method=2,cleanup=False):
def closeHole(shape):
'''closeHole(shape): closes a hole in an open shape'''
import DraftGeomUtils, Part
import DraftGeomUtils
import Part
# creating an edges lookup table
lut = {}
for face in shape.Faces:
@@ -461,7 +465,9 @@ def getCutVolume(cutplane,shapes,clip=False,depth=None):
return cutface,cutvolume,invcutvolume
def getShapeFromMesh(mesh,fast=True,tolerance=0.001,flat=False,cut=True):
import Part, MeshPart, DraftGeomUtils
import Part
import MeshPart
import DraftGeomUtils
if mesh.isSolid() and (mesh.countComponents() == 1) and fast:
# use the best method
faces = []
@@ -1153,7 +1159,8 @@ def toggleIfcBrepFlag(obj):
def makeCompoundFromSelected(objects=None):
"""makeCompoundFromSelected([objects]): Creates a new compound object from the given
subobjects (faces, edges) or from the selection if objects is None"""
import FreeCADGui,Part
import FreeCADGui
import Part
so = []
if not objects:
objects = FreeCADGui.Selection.getSelectionEx()
@@ -1169,7 +1176,8 @@ def makeCompoundFromSelected(objects=None):
def cleanArchSplitter(objects=None):
"""cleanArchSplitter([objects]): removes the splitters from the base shapes
of the given Arch objects or selected Arch objects if objects is None"""
import FreeCAD,FreeCADGui
import FreeCAD
import FreeCADGui
if not objects:
objects = FreeCADGui.Selection.getSelection()
if not isinstance(objects,list):
@@ -1189,7 +1197,8 @@ def cleanArchSplitter(objects=None):
def rebuildArchShape(objects=None):
"""rebuildArchShape([objects]): takes the faces from the base shape of the given (or selected
if objects is None) Arch objects, and tries to rebuild a valid solid from them."""
import FreeCAD,Part
import FreeCAD
import Part
if not objects and FreeCAD.GuiUp:
objects = FreeCADGui.Selection.getSelection()
if not isinstance(objects,list):
+12 -4
View File
@@ -31,7 +31,10 @@ __title__ = "FreeCAD Arch Component"
__author__ = "Yorik van Havre"
__url__ = "https://www.freecadweb.org"
import FreeCAD,Draft,ArchCommands,ArchIFC
import FreeCAD
import ArchCommands
import ArchIFC
import Draft
if FreeCAD.GuiUp:
import FreeCADGui
from PySide import QtGui,QtCore
@@ -713,7 +716,8 @@ class Component(ArchIFC.IfcProduct):
The base shape, with the additions and subtractions performed.
"""
import Draft,Part
import Draft
import Part
#print("Processing subshapes of ",obj.Label, " : ",obj.Additions)
if placement:
@@ -986,7 +990,8 @@ class Component(ArchIFC.IfcProduct):
obj.PerimeterLength = 0
return
import TechDraw, Part
import Part
import TechDraw
fmax = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch").GetInt("MaxComputeAreas",20)
if len(obj.Shape.Faces) > fmax:
obj.VerticalArea = 0
@@ -1972,7 +1977,10 @@ class ComponentTaskPanel:
return
if not isinstance(self.obj.IfcProperties,dict):
return
import Arch_rc, csv, os, ArchIFCSchema
import Arch_rc
import csv
import os
import ArchIFCSchema
# get presets
self.ptypes = list(ArchIFCSchema.IfcTypes.keys())
+3 -1
View File
@@ -20,7 +20,9 @@
#* *
#*****************************************************************************
import FreeCAD, Draft, ArchCommands
import FreeCAD
import Draft
import ArchCommands
if FreeCAD.GuiUp:
import FreeCADGui
from PySide import QtCore, QtGui
+7 -2
View File
@@ -24,7 +24,9 @@ __title__ = "FreeCAD Equipment"
__author__ = "Yorik van Havre"
__url__ = "https://www.freecadweb.org"
import FreeCAD,ArchComponent,DraftVecUtils
import FreeCAD
import ArchComponent
import DraftVecUtils
if FreeCAD.GuiUp:
import FreeCADGui
from PySide import QtGui
@@ -76,7 +78,10 @@ def createMeshView(obj,direction=FreeCAD.Vector(0,0,-1),outeronly=False,largesto
outeronly is True, only the outer contour is taken into consideration, discarding the inner
holes. If largestonly is True, only the largest segment of the given mesh will be used."""
import Mesh, math, Part, DraftGeomUtils
import math
import DraftGeomUtils
import Mesh
import Part
if not obj.isDerivedFrom("Mesh::Feature"):
return
mesh = obj.Mesh
+5 -1
View File
@@ -28,7 +28,11 @@ superseded by the use of the BuildingPart class, set to the "Building Storey"
IfcType.
"""
import FreeCAD,Draft,ArchCommands, DraftVecUtils, ArchIFC
import FreeCAD
import ArchCommands
import ArchIFC
import Draft
import DraftVecUtils
if FreeCAD.GuiUp:
import FreeCADGui
from draftutils.translate import translate
+7 -2
View File
@@ -19,7 +19,10 @@
#* *
#***************************************************************************
import FreeCAD,Draft,ArchComponent,DraftVecUtils
import FreeCAD
import ArchComponent
import Draft
import DraftVecUtils
if FreeCAD.GuiUp:
import FreeCADGui
from draftutils.translate import translate
@@ -162,7 +165,9 @@ class _Frame(ArchComponent.Component):
for w in obj.Profile.Shape.Wires:
if not w.isClosed():
return
import DraftGeomUtils, Part, math
import math
import DraftGeomUtils
import Part
baseprofile = obj.Profile.Shape.copy()
if hasattr(obj,"ProfilePlacement"):
if not obj.ProfilePlacement.isNull():
+4 -1
View File
@@ -19,7 +19,10 @@
#* *
#***************************************************************************
import FreeCAD, Part, math
import math
import FreeCAD
import Part
if FreeCAD.GuiUp:
import FreeCADGui
from PySide import QtCore, QtGui
+4 -3
View File
@@ -25,7 +25,10 @@
and attributes of Arch/BIM objects.
"""
import FreeCAD,json
import json
import FreeCAD
import ArchIFCSchema
if FreeCAD.GuiUp:
from PySide.QtCore import QT_TRANSLATE_NOOP
@@ -33,8 +36,6 @@ else:
def QT_TRANSLATE_NOOP(ctx,txt):
return txt
import ArchIFCSchema
def uncamel(t):
return ''.join(map(lambda x: x if x.islower() else " "+x, t[3:]))[1:]
+4 -1
View File
@@ -26,7 +26,10 @@
Provides the data as IfcContexts, IfcProducts and IfcTypes.
"""
import FreeCAD, os, json
import os
import json
import FreeCAD
ifcVersions = ["IFC4", "IFC2X3"]
IfcVersion = ifcVersions[FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch").GetInt("IfcVersion",0)]
+2 -1
View File
@@ -21,7 +21,8 @@
"""View providers and UI elements for the Ifc classes."""
import FreeCAD, ArchIFC
import FreeCAD
import ArchIFC
if FreeCAD.GuiUp:
import FreeCADGui
+7 -3
View File
@@ -20,11 +20,15 @@
#* *
#***************************************************************************
import FreeCAD, Part, DraftGeomUtils, WorkingPlane, DraftVecUtils, math
import math
from datetime import datetime
import FreeCAD
import DraftGeomUtils
import DraftVecUtils
import Part
import WorkingPlane
# This is roughly based on the no-fit polygon algorithm, used in
# SvgNest: https://github.com/Jack000/SVGnest
# Wikihouse plugin: https://github.com/tav/wikihouse-plugin/blob/master/wikihouse.rb
+10 -2
View File
@@ -19,7 +19,14 @@
#* *
#***************************************************************************
import FreeCAD,Draft,ArchComponent,DraftVecUtils,ArchCommands,math, Part
import math
import FreeCAD
import ArchCommands
import ArchComponent
import Draft
import DraftVecUtils
import Part
from FreeCAD import Vector
if FreeCAD.GuiUp:
import FreeCADGui
@@ -846,7 +853,8 @@ class PanelCut(Draft.DraftObject):
base = None
n = None
if Draft.getType(obj.Source) == "Panel":
import Part,DraftGeomUtils
import DraftGeomUtils
import Part
baseobj = None
if obj.Source.CloneOf:
baseobj = obj.Source.CloneOf.Base
+11 -4
View File
@@ -20,9 +20,11 @@
#* *
#***************************************************************************
import FreeCAD, ArchComponent
import FreeCAD
import ArchComponent
if FreeCAD.GuiUp:
import FreeCADGui, Arch_rc
import FreeCADGui
import Arch_rc
from draftutils.translate import translate
from PySide.QtCore import QT_TRANSLATE_NOOP
else:
@@ -214,7 +216,9 @@ class _ArchPipe(ArchComponent.Component):
def execute(self,obj):
import Part,DraftGeomUtils,math
import math
import Part
import DraftGeomUtils
pl = obj.Placement
w = self.getWire(obj)
if not w:
@@ -372,7 +376,10 @@ class _ArchPipeConnector(ArchComponent.Component):
tol = 1 # tolerance for alignment. This is only visual, we can keep it low...
ptol = 0.001 # tolerance for coincident points
import math,Part,DraftGeomUtils,ArchCommands
import math
import Part
import DraftGeomUtils
import ArchCommands
if len(obj.Pipes) < 2:
return
if len(obj.Pipes) > 3:
+5 -3
View File
@@ -30,10 +30,12 @@ __url__ = "https://www.freecadweb.org"
# This module provides tools to build base profiles
# for Arch Structure elements
import FreeCAD, Draft, os
from FreeCAD import Vector
import csv
import os
import FreeCAD
import Draft
from FreeCAD import Vector
if FreeCAD.GuiUp:
import FreeCADGui
+3 -1
View File
@@ -25,7 +25,9 @@ objects specifically for better IFC compatibility, allowing the user to tweak
certain IFC relevant values.
"""
import FreeCAD,ArchIFC,ArchIFCView
import FreeCAD
import ArchIFC
import ArchIFCView
if FreeCAD.GuiUp:
import FreeCADGui
from draftutils.translate import translate
+7 -2
View File
@@ -20,7 +20,11 @@
#***************************************************************************
# Modified Amritpal Singh <[email protected]> on 07-07-2017
import FreeCAD,Draft,ArchComponent,DraftVecUtils,ArchCommands
import FreeCAD
import Draft
import ArchComponent
import DraftVecUtils
import ArchCommands
if FreeCAD.GuiUp:
import FreeCADGui
from draftutils.translate import translate
@@ -548,7 +552,8 @@ class _ViewProviderRebar(ArchComponent.ViewProviderComponent):
if hasattr(obj.Proxy,"wires"):
if obj.Proxy.wires:
from pivy import coin
import re,Part
import Part
import re
self.centerline = coin.SoSeparator()
comp = Part.makeCompound(obj.Proxy.wires)
pts = re.findall("point \[(.*?)\]",comp.writeInventor().replace("\n",""))
+11 -2
View File
@@ -24,7 +24,15 @@
containers for Arch objects, and also define a terrain surface.
"""
import FreeCAD,Draft,ArchCommands,ArchComponent,math,re,datetime,ArchIFC
import datetime
import math
import re
import FreeCAD
import ArchCommands
import ArchComponent
import ArchIFC
import Draft
if FreeCAD.GuiUp:
import FreeCADGui
@@ -758,7 +766,8 @@ class _Site(ArchIFC.IfcProduct):
obj.SubtractionVolume = 0
return
import TechDraw, Part
import TechDraw
import Part
area = 0
perim = 0
addvol = 0
+7 -2
View File
@@ -145,7 +145,11 @@ ConditioningTypes = [
"NaturallyVentedOnly"
]
import FreeCAD,ArchComponent,ArchCommands,Draft
import FreeCAD
import ArchComponent
import ArchCommands
import Draft
if FreeCAD.GuiUp:
import FreeCADGui
from PySide import QtCore, QtGui
@@ -465,7 +469,8 @@ class _Space(ArchComponent.Component):
"returns a face that represents the footprint of this space"
import Part,DraftGeomUtils
import Part
import DraftGeomUtils
if not hasattr(obj.Shape,"CenterOfMass"):
return None
try:
+7 -1
View File
@@ -21,7 +21,13 @@
"The FreeCAD Arch Vector Rendering Module"
import FreeCAD,math,Part,ArchCommands,DraftVecUtils,DraftGeomUtils
import math
import FreeCAD
import ArchCommands
import DraftVecUtils
import DraftGeomUtils
import Part
## @package ArchVRM
# \ingroup ARCH
+4 -2
View File
@@ -802,7 +802,8 @@ class _Wall(ArchComponent.Component):
if self.clone(obj):
return
import Part, DraftGeomUtils
import Part
import DraftGeomUtils
base = None
pl = obj.Placement
extdata = self.getExtrusionData(obj)
@@ -1098,7 +1099,8 @@ class _Wall(ArchComponent.Component):
placement needed to move the face back from the (0,0,0) origin.
"""
import Part,DraftGeomUtils
import Part
import DraftGeomUtils
# If ArchComponent.Component.getExtrusionData() can successfully get
# extrusion data, just use that.
+13 -4
View File
@@ -21,7 +21,11 @@
import os
import FreeCAD, Draft, ArchComponent, DraftVecUtils, ArchCommands
import FreeCAD
import ArchCommands
import ArchComponent
import Draft
import DraftVecUtils
import ArchWindowPresets
from FreeCAD import Units
from FreeCAD import Vector
@@ -524,7 +528,8 @@ class _CommandWindow:
path = self.librarypresets[i-len(WindowPresets)][1]
if path.lower().endswith(".fcstd"):
try:
import zipfile,tempfile
import tempfile
import zipfile
except Exception:
pass
else:
@@ -667,7 +672,9 @@ class _Window(ArchComponent.Component):
def buildShapes(self,obj):
import Part,DraftGeomUtils,math
import Part
import DraftGeomUtils
import math
self.sshapes = []
self.vshapes = []
shapes = []
@@ -877,7 +884,9 @@ class _Window(ArchComponent.Component):
self.boxes = clonedProxy.boxes
return
import Part,DraftGeomUtils,math
import Part
import DraftGeomUtils
import math
pl = obj.Placement
base = None
self.sshapes = []
+2 -1
View File
@@ -40,7 +40,8 @@ def makeWindowPreset(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2,placement=None
def makeSketch(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2):
import Part,Sketcher
import Part
import Sketcher
width = float(width)
height = float(height)
h1 = float(h1)
+2 -1
View File
@@ -16,7 +16,8 @@ data of the second object like this:
"""
import sys, struct
import sys
import struct
import numpy
+1 -3
View File
@@ -20,13 +20,11 @@
# ***************************************************************************
import json
import ifcopenshell
import math
import FreeCAD
# import Draft
import ifcopenshell
def getObjectsOfIfcType(objects, ifcType):
results = []
+2 -1
View File
@@ -23,7 +23,8 @@ __title__ = "FreeCAD GbXml exporter"
__author__ = "Yorik van Havre"
__url__ = "https://www.freecadweb.org"
import FreeCAD,Draft
import FreeCAD
import Draft
if FreeCAD.GuiUp:
from draftutils.translate import translate
+5 -1
View File
@@ -21,9 +21,13 @@
"""FreeCAD JSON exporter"""
import FreeCAD, Mesh, Draft, Part
import json
import FreeCAD
import Draft
import Mesh
import Part
if FreeCAD.GuiUp:
import FreeCADGui
from draftutils.translate import translate
+12 -1
View File
@@ -19,8 +19,19 @@
#* *
#***************************************************************************
import FreeCAD, DraftGeomUtils, Part, Draft, Arch, Mesh, MeshPart, os, codecs, ntpath
import os
import codecs
import ntpath
# import numpy as np
import FreeCAD
import Arch
import Draft
import DraftGeomUtils
import Mesh
import MeshPart
import Part
if FreeCAD.GuiUp:
from draftutils.translate import translate
else:
+11 -1
View File
@@ -23,7 +23,17 @@ __title__ = "FreeCAD SweetHome3D Importer"
__author__ = "Yorik van Havre"
__url__ = "https://www.freecadweb.org"
import os,zipfile,xml.sax,FreeCAD,Part,Draft,Arch,Mesh,tempfile,math
import math
import os
import tempfile
import xml.sax
import zipfile
import FreeCAD
import Arch
import Draft
import Mesh
import Part
## @package importSH3D
# \ingroup ARCH