Skip to content

Commit

Permalink
isort on all imports
Browse files Browse the repository at this point in the history
  • Loading branch information
shimwell committed Apr 22, 2024
1 parent 583916f commit a53e630
Show file tree
Hide file tree
Showing 36 changed files with 160 additions and 87 deletions.
7 changes: 5 additions & 2 deletions src/GEOReverse/Modules/MCNPinput.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import math
import os
import re

import FreeCAD
import numpy as np
from numpy import linalg as LA
from .Parser import parser as mp
from .remh import cell_card_string, remove_hash

from .Objects import *
from .Parser import parser as mp
from .remh import cell_card_string, remove_hash


class MCNPinput:
def __init__(self,name):
Expand Down
8 changes: 6 additions & 2 deletions src/GEOReverse/Modules/Objects.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import math

import FreeCAD
import numpy as np
import FreeCAD, Part
import Part

from .buildSolidCell import BuildSolid
from .remh import cline
from .Utils.booleanFunction import outterTerms,BoolSequence
from .Utils.booleanFunction import BoolSequence, outterTerms


class CADCell:
def __init__(self,stringCell=None):
Expand Down
1 change: 1 addition & 0 deletions src/GEOReverse/Modules/Parser/PartialFormatter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import string

version = '3.6'

def make_label(item):
Expand Down
3 changes: 2 additions & 1 deletion src/GEOReverse/Modules/Parser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
Functions for parsing MCNP input files.
"""

import os
import re
import warnings
import os

from .PartialFormatter import PartialFormatter

version = '3.6'
Expand Down
4 changes: 3 additions & 1 deletion src/GEOReverse/Modules/Utils/BooleanSolids.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
# Only one solid and planar surfaces
#
import math
import FreeCAD

import BOPTools.SplitAPI
import FreeCAD

from .booleanFunction import BoolSequence

BoolVals = (None,True,False)
Expand Down
1 change: 1 addition & 0 deletions src/GEOReverse/Modules/Utils/booleanFunction.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import re

mostinner=re.compile(r"\([^\(^\)]*\)") # identify most inner parentheses
number =re.compile(r"(?P<value>[-+]?\d+)")
mix =re.compile(r"(?P<value>([-+]?\d+|\[0+\]))")
Expand Down
1 change: 1 addition & 0 deletions src/GEOReverse/Modules/XMLParser.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from .remh import cline


class cellCARD:

def __init__(self,data):
Expand Down
11 changes: 7 additions & 4 deletions src/GEOReverse/Modules/XMLinput.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import math
import os
import re
import xml.etree.ElementTree as ET

import FreeCAD
from .Objects import *
from .XMLParser import get_cards
import math
import numpy as np
from numpy import linalg as LA
import xml.etree.ElementTree as ET

from .Objects import *
from .XMLParser import get_cards


class XMLinput:
def __init__(self,name):
Expand Down
2 changes: 1 addition & 1 deletion src/GEOReverse/Modules/buildCAD.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import BOPTools.SplitAPI

from .buildSolidCell import FuseSolid
from .Utils.booleanFunction import BoolSequence



def buildCAD(UnivCell,data,config):

UniverseCut = True
Expand Down
6 changes: 4 additions & 2 deletions src/GEOReverse/Modules/buildSolidCell.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import Part
from .Utils.booleanFunction import BoolSequence
from .splitFunction import SplitSolid,splitBase,joinBase

from .options import Options
from .splitFunction import SplitSolid, joinBase, splitBase
from .Utils.booleanFunction import BoolSequence


def getPart(slist):
sol = []
Expand Down
1 change: 1 addition & 0 deletions src/GEOReverse/Modules/processInp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import configparser

from .options import Options


Expand Down
4 changes: 1 addition & 3 deletions src/GEOReverse/Modules/remh.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import re
import math


import re

#########################################
# define patterns to be found in string #
Expand Down
5 changes: 4 additions & 1 deletion src/GEOReverse/Modules/splitFunction.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import math
import FreeCAD,Part

import BOPTools.SplitAPI
import FreeCAD
import Part


class splitBase:
def __init__(self,base,knownSurf={}):
Expand Down
12 changes: 7 additions & 5 deletions src/GEOReverse/reverse.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import FreeCAD, Import
import FreeCAD
import Import

from .CodeVersion import *
from .Modules.buildCAD import buildCAD, makeTree
from .Modules.MCNPinput import MCNPinput
from .Modules.XMLinput import XMLinput
from .Modules.buildCAD import buildCAD,makeTree
from .Modules.Objects import CADCell
from .Modules.processInp import setOptions
from .CodeVersion import *
from .Modules.processInp import setOptions
from .Modules.XMLinput import XMLinput


def reverse(optFile='configRevese.ini') :
Expand Down
18 changes: 11 additions & 7 deletions src/GEOUNED/Conversion/CellDefinition.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@
# Module for Cell definiton #
#############################
import math
import FreeCAD, Part
from ..Utils.Functions import GEOUNED_Surface
from ..Utils.BasicFunctions_part1 import isParallel, isOposite, isInLine, signPlane, isSameValue
from ..Utils.booleanFunction import BoolSequence, insertInSequence
from ..Utils import BasicFunctions_part2 as BF

import FreeCAD
import Part

from ..Utils import BasicFunctions_part2 as BF
from ..Utils import Functions as UF
from ..Utils import Geometry_GU as GU
from ..Utils.Options.Classes import Tolerances as tol
from ..Utils.BasicFunctions_part1 import (isInLine, isOposite, isParallel,
isSameValue, signPlane)
from ..Utils.booleanFunction import BoolSequence, insertInSequence
from ..Utils.BooleanSolids import buildCTableFromSolids, removeExtraSurfaces
from ..Utils.Functions import GEOUNED_Surface
from ..Utils.Options.Classes import Options as opt
from ..Utils.BooleanSolids import buildCTableFromSolids,removeExtraSurfaces
from ..Utils.Options.Classes import Tolerances as tol


def getId(facein, Surfaces):
Expand Down
14 changes: 8 additions & 6 deletions src/GEOUNED/Cuboid/translate.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import FreeCAD,Part
from ..Utils.booleanFunction import BoolSequence
from ..Utils import Geometry_GU as GU
from ..Utils.BasicFunctions_part1 import isParallel, isOposite
from ..Utils import BasicFunctions_part2 as BF
import FreeCAD
import Part

from ..Decompose import Decom_one as Decom
from ..Utils.Options.Classes import Tolerances as tol
from ..Utils import BasicFunctions_part2 as BF
from ..Utils import Geometry_GU as GU
from ..Utils.BasicFunctions_part1 import isOposite, isParallel
from ..Utils.booleanFunction import BoolSequence
from ..Utils.Options.Classes import Options as opt
from ..Utils.Options.Classes import Tolerances as tol


def commonEdge(face1,face2):
Expand Down
12 changes: 8 additions & 4 deletions src/GEOUNED/Decompose/Decom_one.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@

import math
from collections import OrderedDict
import FreeCAD, Part

import FreeCAD
import Part

from ..Conversion import CellDefinition as CD
from ..Utils import Functions as UF
from ..Utils import Geometry_GU as GU
from ..Conversion import CellDefinition as CD
from ..Utils.BasicFunctions_part1 import isParallel, isSameValue, isInLine, isInPlane
from ..Utils.BasicFunctions_part1 import (isInLine, isInPlane, isParallel,
isSameValue)
from ..Utils.BasicFunctions_part2 import isDuplicateInList
from ..Utils.Options.Classes import Tolerances as tol
from ..Utils.Options.Classes import Options as opt
from ..Utils.Options.Classes import Tolerances as tol

twoPi = math.pi*2

Expand Down
2 changes: 2 additions & 0 deletions src/GEOUNED/LoadFile/LoadFunctions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import re

import FreeCAD

from ..Utils.Functions import GEOUNED_Solid
from ..Utils.Options.Classes import Options as opt

Expand Down
6 changes: 5 additions & 1 deletion src/GEOUNED/LoadFile/LoadSTEP.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
#
import os
import re
import FreeCAD, Part

import FreeCAD
import Part
from FreeCAD import Import

from ..Utils import Functions as UF
from . import LoadFunctions as LF


# Paco mod
def extractMaterials(filename):
rhoreal = []
Expand Down
2 changes: 2 additions & 0 deletions src/GEOUNED/Utils/BasicFunctions_part1.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
# Set of useful functions used in different parts of the code
#
import math

import FreeCAD


def isSameValue(v1,v2,tolerance=1e-6):
return abs(v1-v2) < tolerance

Expand Down
6 changes: 4 additions & 2 deletions src/GEOUNED/Utils/BasicFunctions_part2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
# Set of useful functions used in different parts of the code
#
import math

import FreeCAD
from ..Utils.BasicFunctions_part1 import isParallel, isOposite,isSameValue, isInTolerance, isInLine, isInPlane
from ..Write.Functions import MCNPSurface

from ..Utils.BasicFunctions_part1 import (isInLine, isInPlane, isInTolerance,
isOposite, isParallel, isSameValue)
from ..Write.Functions import MCNPSurface

sameSurfFic = open('fuzzySurfaces','w')
def Fuzzy(index,dtype,surf1,surf2,val,tol):
Expand Down
7 changes: 4 additions & 3 deletions src/GEOUNED/Utils/BooleanSolids.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
# Only one solid and planar surfaces
#
import math

import FreeCAD
from ..Utils.Functions import GEOUNED_Surface, splitBOP
from ..Utils.booleanFunction import BoolSequence
from ..Utils.Options.Classes import Options as opt

from ..Utils.booleanFunction import BoolSequence
from ..Utils.Functions import GEOUNED_Surface, splitBOP
from ..Utils.Options.Classes import Options as opt

BoolVals = (None,True,False)

Expand Down
17 changes: 11 additions & 6 deletions src/GEOUNED/Utils/Functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@
# Set of useful functions used in different parts of the code
#
import math
import numpy as np

import BOPTools.SplitAPI
import FreeCAD, Part
from . import BasicFunctions_part2 as BF
from ..Utils.BasicFunctions_part1 import isParallel,\
Plane3PtsParams, PlaneParams, CylinderParams, ConeParams, SphereParams, TorusParams
from ..Utils.Options.Classes import Tolerances as tol
import FreeCAD
import numpy as np
import Part

from ..Utils.BasicFunctions_part1 import (ConeParams, CylinderParams,
Plane3PtsParams, PlaneParams,
SphereParams, TorusParams,
isParallel)
from ..Utils.Options.Classes import Options
from ..Utils.Options.Classes import Tolerances as tol
from . import BasicFunctions_part2 as BF


def getBox(comp):
Expand Down
5 changes: 4 additions & 1 deletion src/GEOUNED/Utils/Geometry_GU.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
# definition of GEOUNED objects to release memory
#
import math

import Part

from ..Utils.Options.Classes import Tolerances as tol
from .BasicFunctions_part1 import isSameValue
from .BasicFunctions_part2 import isSameTorus
from ..Utils.Options.Classes import Tolerances as tol


# SURFACES
class Surfaces_GU(object):
Expand Down
2 changes: 1 addition & 1 deletion src/GEOUNED/Utils/Options/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .Classes import Options, Tolerances, MCNP_numeric_format
from .Classes import MCNP_numeric_format, Options, Tolerances

#default options values
forceCylinder = True # Force using cylinders instead cones for auxillary surfaces of torus surface definition
Expand Down
5 changes: 4 additions & 1 deletion src/GEOUNED/Utils/Qform.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
#
#

import FreeCAD, Part
import math

import FreeCAD
import Part


def RotationMatrix(u,v):

""" Definition of the rotation matrix for two vectors"""
Expand Down
11 changes: 7 additions & 4 deletions src/GEOUNED/Void/Void.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import FreeCAD, Part
from .VoidBoxClass import VoidBox
import FreeCAD
import Part

from ..LoadFile import LoadFunctions as LF
from ..Utils.BasicFunctions_part1 import isOposite
from ..Utils.Functions import GEOUNED_Solid, GEOUNED_Surface
from ..Utils.booleanFunction import BoolSequence
from ..Utils.Functions import GEOUNED_Solid, GEOUNED_Surface
from ..Utils.Options.Classes import Options as opt
from ..LoadFile import LoadFunctions as LF
from ..Void import voidFunctions as VF
from .VoidBoxClass import VoidBox


def voidGeneration(MetaList,EnclosureList,Surfaces,UniverseBox,setting,init):
voidList = []
Expand Down
7 changes: 4 additions & 3 deletions src/GEOUNED/Void/VoidBoxClass.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
"""File with the VoidBox class"""
import FreeCAD
import Part
from ..Decompose import Decom_one as Decom

from ..Conversion import CellDefinition as Conv
from ..Utils.Options.Classes import Options as opt
from ..Decompose import Decom_one as Decom
from ..Utils.BasicFunctions_part1 import isOposite
from ..Utils.Functions import GEOUNED_Solid, GEOUNED_Surface
from ..Utils.booleanFunction import BoolSequence
from ..Utils.BooleanSolids import buildCTableFromSolids, removeExtraSurfaces
from ..Utils.Functions import GEOUNED_Solid, GEOUNED_Surface
from ..Utils.Options.Classes import Options as opt


class VoidBox ():
Expand Down
Loading

0 comments on commit a53e630

Please sign in to comment.