diff --git a/nix/build-all.py b/nix/build-all.py index 139e1dda2a..46b7b5c30c 100644 --- a/nix/build-all.py +++ b/nix/build-all.py @@ -315,24 +315,18 @@ cecho(f"* Build Directory = {BUILD_DIR}", MAGENTA) cecho(f"* Dependency Directory = {DEPS_DIR}", MAGENTA) cecho(f" - The directory where {PROJECT_NAME} dependencies are installed.") cecho(f"* Build Config Type = {BUILD_CFG}", MAGENTA) -cecho( - """ - The used build configuration type for the dependencies. - Defaults to RelWithDebInfo if not specified.""" -) +cecho(""" - The used build configuration type for the dependencies. + Defaults to RelWithDebInfo if not specified.""") if BUILD_CFG == "MinSizeRel": cecho(" WARNING: MinSizeRel build can suffer from a significant performance loss.", RED) cecho(f"* IFCOS_NUM_BUILD_PROCS = {IFCOS_NUM_BUILD_PROCS}", MAGENTA) -cecho( - """ - How many compiler processes may be run in parallel. -""" -) +cecho(""" - How many compiler processes may be run in parallel. +""") cecho(f" * IFCOS_SCHEMAS = '{os.environ.get('IFCOS_SCHEMAS')}'", MAGENTA) -cecho( - """ - IFC Schemas to compile. If not provided, fallback to default provided in cmake. -""" -) +cecho(""" - IFC Schemas to compile. If not provided, fallback to default provided in cmake. +""") dependency_tree: "dict[str, tuple[str, ...]]" = { "IfcParse": ("boost", "libxml2", "hdf5", "rocksdb"), diff --git a/src/bcf/bcf/v3/bcfapi.py b/src/bcf/bcf/v3/bcfapi.py index 127d9e3732..3ac85b9685 100644 --- a/src/bcf/bcf/v3/bcfapi.py +++ b/src/bcf/bcf/v3/bcfapi.py @@ -34,8 +34,8 @@ client_id, client_secret = "", "" class OAuthReceiver(http.server.BaseHTTPRequestHandler): def do_GET(self) -> None: query = urllib.parse.parse_qs(urllib.parse.urlparse(self.path).query) - self.server.auth_code = query.get("code", [""])[0] # type:ignore - self.server.auth_state = query.get("state", [""])[0] # type:ignore + self.server.auth_code = query.get("code", [""])[0] # type: ignore + self.server.auth_state = query.get("state", [""])[0] # type: ignore self.send_response(200) self.send_header("Content-type", "text/plain") self.end_headers() diff --git a/src/bonsai/bonsai/bim/module/brick/data.py b/src/bonsai/bonsai/bim/module/brick/data.py index bae294d713..e414723594 100644 --- a/src/bonsai/bonsai/bim/module/brick/data.py +++ b/src/bonsai/bonsai/bim/module/brick/data.py @@ -63,8 +63,7 @@ class BrickschemaData: if namespace == "https://brickschema.org/schema/Brick": return [] results = [] - query = BrickStore.graph.query( - """ + query = BrickStore.graph.query(""" PREFIX brick: PREFIX rdfs: PREFIX rdf: @@ -81,10 +80,7 @@ class BrickschemaData: } } GROUP BY ?object - """.replace( - "{uri}", uri - ) - ) + """.replace("{uri}", uri)) for row in query: predicate_uri = row.get("predicate") predicate_name = predicate_uri.toPython().split("#")[-1] diff --git a/src/bonsai/bonsai/bim/module/drawing/shaders.py b/src/bonsai/bonsai/bim/module/drawing/shaders.py index 2efd6ea285..774002fea3 100644 --- a/src/bonsai/bonsai/bim/module/drawing/shaders.py +++ b/src/bonsai/bonsai/bim/module/drawing/shaders.py @@ -335,12 +335,9 @@ class BaseLinesShader(BaseShader): TYPE = "LINES" - DEF_GLSL = ( - BaseShader.DEF_GLSL - + """ + DEF_GLSL = BaseShader.DEF_GLSL + """ #define GAP_SIZE {gap_size} """ - ) GEOM_GLSL = """ layout(lines) in; @@ -401,13 +398,10 @@ class DotsGizmoShader(GizmoShader): TYPE = "POINTS" - DEF_GLSL = ( - BaseShader.DEF_GLSL - + """ + DEF_GLSL = BaseShader.DEF_GLSL + """ #define CIRCLE_SEGMENTS 12 #define CIRCLE_RADIUS 8 """ - ) GEOM_GLSL = """ layout(points) in; diff --git a/src/bonsai/bonsai/bim/module/structural/shader.py b/src/bonsai/bonsai/bim/module/structural/shader.py index d6f92028d6..b9b5a5c7bc 100644 --- a/src/bonsai/bonsai/bim/module/structural/shader.py +++ b/src/bonsai/bonsai/bim/module/structural/shader.py @@ -58,15 +58,13 @@ class DecorationShader: "PLANAR LOAD", } if pattern not in valid_patterns: - raise ValueError( - """pattern must be one of: + raise ValueError("""pattern must be one of: PERPENDICULAR DISTRIBUTED FORCE PARALLEL DISTRIBUTED FORCE, DISTRIBUTED MOMENT, SINGLE FORCE, SINGLE MOMENT, - PLANAR LOAD""" - ) + PLANAR LOAD""") if "DISTRIBUTED" in pattern.upper(): shader = self.get_linear_shader(pattern) return shader diff --git a/src/bonsai/bonsai/bim/ui.py b/src/bonsai/bonsai/bim/ui.py index 4cacd49e42..7bc27a20e0 100644 --- a/src/bonsai/bonsai/bim/ui.py +++ b/src/bonsai/bonsai/bim/ui.py @@ -55,7 +55,6 @@ from bonsai.bim.module.model.ui import ( from bonsai.bim.module.pset.prop import IfcProperty from bonsai.bim.prop import Attribute - if TYPE_CHECKING: from bonsai.bim.module.project.prop import BIMProjectProperties from bonsai.bim.prop import ObjProperty diff --git a/src/bonsai/bonsai/tool/brick.py b/src/bonsai/bonsai/tool/brick.py index d585353745..7ef2c30444 100644 --- a/src/bonsai/bonsai/tool/brick.py +++ b/src/bonsai/bonsai/tool/brick.py @@ -164,17 +164,13 @@ class Brick(bonsai.core.tool.Brick): @classmethod def export_brick_attributes(cls, brick_uri: str) -> dict[str, Any]: - query = BrickStore.graph.query( - """ + query = BrickStore.graph.query(""" PREFIX rdfs: SELECT ?label { <{brick_uri}> rdfs:label ?label . } LIMIT 1 - """.replace( - "{brick_uri}", brick_uri - ) - ) + """.replace("{brick_uri}", brick_uri)) name = None for row in query: name = str(row.get("label")) @@ -218,18 +214,14 @@ class Brick(bonsai.core.tool.Brick): @classmethod def get_brickifc_project(cls) -> Union[str, None]: project = tool.Ifc.get().by_type("IfcProject")[0] - query = BrickStore.graph.query( - """ + query = BrickStore.graph.query(""" PREFIX ref: SELECT ?proj WHERE { ?proj a ref:ifcProject . ?proj ref:ifcProjectID "{project_globalid}" . } LIMIT 1 - """.replace( - "{project_globalid}", project.GlobalId - ) - ) + """.replace("{project_globalid}", project.GlobalId)) results = list(query) if results: return results[0][0].toPython() @@ -275,17 +267,13 @@ class Brick(bonsai.core.tool.Brick): @classmethod def get_item_class(cls, item: str) -> Union[str, None]: - query = BrickStore.graph.query( - """ + query = BrickStore.graph.query(""" PREFIX brick: SELECT ?class WHERE { <{item}> a ?class . } LIMIT 1 - """.replace( - "{item}", item - ) - ) + """.replace("{item}", item)) for row in query: return row.get("class").toPython().split("#")[-1] @@ -308,8 +296,7 @@ class Brick(bonsai.core.tool.Brick): @classmethod def import_brick_classes(cls, brick_class: str, split_screen: bool = False) -> None: - query = BrickStore.graph.query( - """ + query = BrickStore.graph.query(""" PREFIX brick: PREFIX rdfs: PREFIX rdf: @@ -322,10 +309,7 @@ class Brick(bonsai.core.tool.Brick): } GROUP BY ?group ORDER BY asc(?group) - """.replace( - "{brick_class}", brick_class - ) - ) + """.replace("{brick_class}", brick_class)) props = tool.Brick.get_brick_props() if split_screen: bricks = props.split_screen_bricks @@ -342,8 +326,7 @@ class Brick(bonsai.core.tool.Brick): @classmethod def import_brick_items(cls, brick_class: str, split_screen: bool = False) -> None: - query = BrickStore.graph.query( - """ + query = BrickStore.graph.query(""" PREFIX brick: PREFIX rdfs: PREFIX rdf: @@ -354,10 +337,7 @@ class Brick(bonsai.core.tool.Brick): } } ORDER BY asc(?item) - """.replace( - "{brick_class}", brick_class - ) - ) + """.replace("{brick_class}", brick_class)) props = tool.Brick.get_brick_props() if split_screen: bricks = props.split_screen_bricks @@ -507,8 +487,7 @@ class BrickStore: @classmethod def load_sub_roots(cls) -> None: - query = BrickStore.graph.query( - """ + query = BrickStore.graph.query(""" PREFIX brick: PREFIX rdfs: SELECT ?subRoot ?subClasses WHERE { @@ -525,8 +504,7 @@ class BrickStore: } FILTER(?subClasses > 3) } - """ - ) + """) for row in query: sub_root = row.get("subRoot").toPython().split("#")[-1] BrickStore.root_classes.append(sub_root) @@ -558,8 +536,7 @@ class BrickStore: @classmethod def load_entity_classes(cls) -> None: for root_class in BrickStore.root_classes: - query = BrickStore.graph.query( - """ + query = BrickStore.graph.query(""" PREFIX brick: PREFIX rdfs: PREFIX owl: @@ -569,25 +546,20 @@ class BrickStore: ?class owl:deprecated true . } } - """.replace( - "{root_class}", root_class - ) - ) + """.replace("{root_class}", root_class)) BrickStore.entity_classes[root_class] = [] for uri in sorted([x[0].toPython() for x in query]): BrickStore.entity_classes[root_class].append(uri) @classmethod def load_relationships(cls) -> None: - query = BrickStore.graph.query( - """ + query = BrickStore.graph.query(""" PREFIX brick: PREFIX rdfs: SELECT DISTINCT ?relation WHERE { ?relation rdfs:subPropertyOf brick:Relationship . } - """ - ) + """) for uri in sorted([x[0].toPython() for x in query]): BrickStore.relationships.append(uri) diff --git a/src/bonsai/bonsai/tool/drawing.py b/src/bonsai/bonsai/tool/drawing.py index ca13168942..b8ec26fd37 100644 --- a/src/bonsai/bonsai/tool/drawing.py +++ b/src/bonsai/bonsai/tool/drawing.py @@ -2710,16 +2710,14 @@ class Drawing(bonsai.core.tool.Drawing): return float(value) except: pass # Perhaps it's imperial? - l = lark.Lark( - """start: feet? "-"? inches? + l = lark.Lark("""start: feet? "-"? inches? feet: NUMBER? "-"? fraction? "'" inches: NUMBER? "-"? fraction? "\\"" fraction: NUMBER "/" NUMBER %import common.NUMBER %import common.WS %ignore WS // Disregard spaces in text - """ - ) + """) try: start = l.parse(value) diff --git a/src/bonsai/scripts/classifications/brick_classifiction.py b/src/bonsai/scripts/classifications/brick_classifiction.py index 9a9d42353e..17246940c7 100644 --- a/src/bonsai/scripts/classifications/brick_classifiction.py +++ b/src/bonsai/scripts/classifications/brick_classifiction.py @@ -22,8 +22,7 @@ class Generator: } ) - query = self.schema.query( - """ + query = self.schema.query(""" PREFIX brick: PREFIX rdfs: PREFIX skos: @@ -49,8 +48,7 @@ class Generator: } } GROUP BY ?entity - """ - ) + """) # create references dictionary references = {} @@ -76,17 +74,13 @@ class Generator: ) # get all parents of the entity - query = self.schema.query( - """ + query = self.schema.query(""" PREFIX brick: PREFIX rdfs: SELECT ?parent WHERE { brick:{entity} rdfs:subClassOf ?parent . } - """.replace( - "{entity}", location.split("#")[-1] - ) - ) + """.replace("{entity}", location.split("#")[-1])) # filter parents for the brick entity for row in query: parent = row.get("parent").toPython() diff --git a/src/bonsai/scripts/reregister_bonsai.py b/src/bonsai/scripts/reregister_bonsai.py index ba9ab2ba2a..4eb3764708 100644 --- a/src/bonsai/scripts/reregister_bonsai.py +++ b/src/bonsai/scripts/reregister_bonsai.py @@ -23,7 +23,6 @@ Use operators instead of `blender --command extension remove` to ensure disable and enable occur in the same Blender session. """ - import bpy import bonsai.tool as tool diff --git a/src/ifc2ca/_deprecated/scriptCodeAsterBonded.py b/src/ifc2ca/_deprecated/scriptCodeAsterBonded.py index 0b1184453b..e5bfd03aed 100644 --- a/src/ifc2ca/_deprecated/scriptCodeAsterBonded.py +++ b/src/ifc2ca/_deprecated/scriptCodeAsterBonded.py @@ -89,27 +89,22 @@ class COMMANDFILE: f.write("# Linear Static Analysis With Self-Weight\n") - f.write( - """ + f.write(""" # STEP: INITIALIZE STUDY DEBUT( PAR_LOT = 'NON' ) -""" - ) +""") - f.write( - """ + f.write(""" # STEP: READ MED FILE mesh = LIRE_MAILLAGE( FORMAT = 'MED', UNITE = 20 ) -""" - ) +""") - f.write( - """ + f.write(""" # STEP: DEFINE MODEL model = AFFE_MODELE( MAILLAGE = mesh, @@ -118,8 +113,7 @@ model = AFFE_MODELE( TOUT = 'OUI', PHENOMENE = 'MECANIQUE', MODELISATION = '3D' - ),""" - ) + ),""") if faceGroupNames: template = """ @@ -157,12 +151,10 @@ model = AFFE_MODELE( f.write(template.format(**context)) - f.write( - """ + f.write(""" ) )\n -""" - ) +""") f.write("# STEP: DEFINE MATERIALS") @@ -195,12 +187,10 @@ model = AFFE_MODELE( f.write(template.format(**context)) - f.write( - """ + f.write(""" material = AFFE_MATERIAU( MAILLAGE = mesh, - AFFE = (""" - ) + AFFE = (""") for i, material in enumerate(materials): template = """ @@ -227,20 +217,16 @@ material = AFFE_MATERIAU( f.write(template.format(**context)) - f.write( - """ + f.write(""" ) ) -""" - ) +""") - f.write( - """ + f.write(""" # STEP: DEFINE ELEMENTS element = AFFE_CARA_ELEM( MODELE = model, - POUTRE = (""" - ) + POUTRE = (""") for profile in profiles: if profile["profileShape"] == "rectangular" and profile["profileType"] == "AREA": @@ -296,11 +282,9 @@ element = AFFE_CARA_ELEM( f.write(template.format(**context)) - f.write( - """ + f.write(""" ), - COQUE = (""" - ) + COQUE = (""") for el in [el for el in elements if el["geometryType"] == "surface"]: @@ -319,15 +303,11 @@ element = AFFE_CARA_ELEM( f.write(template.format(**context)) - f.write( - """ - ),""" - ) + f.write(""" + ),""") - f.write( - """ - ORIENTATION = (""" - ) + f.write(""" + ORIENTATION = (""") for el in [el for el in elements if el["geometryType"] == "line"]: @@ -345,21 +325,16 @@ element = AFFE_CARA_ELEM( f.write(template.format(**context)) - f.write( - """ - ),""" - ) + f.write(""" + ),""") - f.write( - """ + f.write(""" )\n -""" - ) +""") f.write("# STEP: DEFINE SUPPORTS AND CONSTRAINTS") - f.write( - """ + f.write(""" liaisons = AFFE_CHAR_MECA( MODELE = model, DDL_IMPO = ( @@ -372,14 +347,11 @@ liaisons = AFFE_CHAR_MECA( DRY = 0.0, DRZ = 0.0 ) - ),""" - ) + ),""") if rigidLinkGroupNames: - f.write( - """ - LIAISON_SOLIDE = (""" - ) + f.write(""" + LIAISON_SOLIDE = (""") for groupName in rigidLinkGroupNames: template = """ @@ -391,16 +363,12 @@ liaisons = AFFE_CHAR_MECA( f.write(template.format(**context)) - f.write( - """ - ),""" - ) + f.write(""" + ),""") - f.write( - """ + f.write(""" ) -""" - ) +""") template = """ # STEP: DEFINE LOAD @@ -418,8 +386,7 @@ gravLoad = AFFE_CHAR_MECA( f.write(template.format(**context)) - f.write( - """ + f.write(""" # STEP: RUN ANALYSIS res_Bld = MECA_STATIQUE( MODELE = model, @@ -434,8 +401,7 @@ res_Bld = MECA_STATIQUE( ) ) ) -""" - ) +""") # f.write( # ''' @@ -515,8 +481,7 @@ res_Bld = MECA_STATIQUE( # ''' # ) # - f.write( - """ + f.write(""" # STEP: DEFORMED SHAPE EXTRACTION IMPR_RESU( FORMAT = 'MED', @@ -527,15 +492,12 @@ IMPR_RESU( NOM_CHAM_MED = ('Bld_DISP',), # 'Bld_REAC', 'Bld_FORC' ) ) -""" - ) +""") - f.write( - """ + f.write(""" # STEP: CONCLUDE STUDY FIN() -""" - ) +""") f.close() diff --git a/src/ifc2ca/_deprecated/scriptSalomeBonded.py b/src/ifc2ca/_deprecated/scriptSalomeBonded.py index fb2bd575f9..d3b6d506c8 100644 --- a/src/ifc2ca/_deprecated/scriptSalomeBonded.py +++ b/src/ifc2ca/_deprecated/scriptSalomeBonded.py @@ -53,16 +53,16 @@ class MODEL: """Function to define a Point from a polyline (list of 1 point)""" - (x, y, z) = pl + x, y, z = pl return self.geompy.MakeVertex(x, y, z) def makeLine(self, pl): """Function to define a Line from a polyline (list of 2 points)""" - (x, y, z) = pl[0] + x, y, z = pl[0] P1 = self.geompy.MakeVertex(x, y, z) - (x, y, z) = pl[1] + x, y, z = pl[1] P2 = self.geompy.MakeVertex(x, y, z) return self.geompy.MakeLineTwoPnt(P1, P2) diff --git a/src/ifcbimtester/bimtester/features/steps/aggregation/en.py b/src/ifcbimtester/bimtester/features/steps/aggregation/en.py index a2bbe621a1..f0c4af8f15 100644 --- a/src/ifcbimtester/bimtester/features/steps/aggregation/en.py +++ b/src/ifcbimtester/bimtester/features/steps/aggregation/en.py @@ -28,12 +28,8 @@ use_step_matcher("parse") @step('There must be exactly {number} "{ifc_class}" elements') def step_impl(context, number, ifc_class): num = len(IfcStore.file.by_type(ifc_class)) - assert num == int( - number - ), "Could not find {} elements of {}. \ - Found {} element(s).".format( - number, ifc_class, num - ) + assert num == int(number), "Could not find {} elements of {}. \ + Found {} element(s).".format(number, ifc_class, num) @given('a set of (key,value) called ("{key_name}","{value_name}")') @@ -95,13 +91,9 @@ def step_impl(context, attribute_name): @then('there must be exactly a number of "{ifc_class}" equals to the number of distinct value') def step_impl(context, ifc_class): try: - context.execute_steps( - """ + context.execute_steps(""" then There must be exactly {number} "{ifc_class}" elements - """.format( - ifc_class=ifc_class, number=context.model.get_count_distinct_values() - ) - ) + """.format(ifc_class=ifc_class, number=context.model.get_count_distinct_values())) except AssertionError as error: str_error = str(error) assert False, str_error[: str_error.find("Traceback")] diff --git a/src/ifcbimtester/examples/steps/aggregation.py b/src/ifcbimtester/examples/steps/aggregation.py index ccf46b5e0d..96e0375b43 100644 --- a/src/ifcbimtester/examples/steps/aggregation.py +++ b/src/ifcbimtester/examples/steps/aggregation.py @@ -51,13 +51,9 @@ def step_impl(context, path_file): @then("there must be exactly a number of {ifc_class} equals to the number of distinct row value") def step_impl(context, ifc_class): try: - context.execute_steps( - """ + context.execute_steps(""" then There must be exactly {number} {ifc_class} elements - """.format( - ifc_class=ifc_class, number=context.model.get_count_distinct_values() - ) - ) + """.format(ifc_class=ifc_class, number=context.model.get_count_distinct_values())) except AssertionError as error: str_error = str(error) assert False, str_error[: str_error.find("Traceback")] diff --git a/src/ifcopenshell-python/ifcopenshell/__init__.py b/src/ifcopenshell-python/ifcopenshell/__init__.py index fb38426aff..998eb6e5de 100644 --- a/src/ifcopenshell-python/ifcopenshell/__init__.py +++ b/src/ifcopenshell-python/ifcopenshell/__init__.py @@ -53,6 +53,7 @@ Example: for wall in walls: print(wall.Name) """ + from __future__ import annotations import os diff --git a/src/ifcopenshell-python/ifcopenshell/express/bootstrap.py b/src/ifcopenshell-python/ifcopenshell/express/bootstrap.py index 578e561e79..ef3c3c3ef0 100644 --- a/src/ifcopenshell-python/ifcopenshell/express/bootstrap.py +++ b/src/ifcopenshell-python/ifcopenshell/express/bootstrap.py @@ -217,8 +217,7 @@ for id in to_emit: statements.append("%s << %s" % (id, stmt)) if __name__ == "__main__": - print( - r""" + print(r""" # This file is generated by IfcOpenShell ifcexpressparser bootstrap.py from __future__ import annotations @@ -257,6 +256,4 @@ if __name__ == "__main__": mdl = importlib.import_module(output) mdl.Generator(m).emit() sys.stdout.write(m.schema.name) -""" - % ("\n ".join(statements)) - ) +""" % ("\n ".join(statements))) diff --git a/src/ifcopenshell-python/ifcopenshell/express/schema_class.py b/src/ifcopenshell-python/ifcopenshell/express/schema_class.py index e017c03d7a..d7595ad6cb 100644 --- a/src/ifcopenshell-python/ifcopenshell/express/schema_class.py +++ b/src/ifcopenshell-python/ifcopenshell/express/schema_class.py @@ -363,24 +363,18 @@ class EarlyBoundCodeWriter: ) ) - self.statements[self.statements.index("{factory_placeholder}")] = ( - """ + self.statements[self.statements.index("{factory_placeholder}")] = """ class %(schema_name)s_instance_factory : public IfcParse::instance_factory { virtual IfcUtil::IfcBaseClass* operator()(const IfcParse::declaration* decl, IfcEntityInstanceData&& data) const { %(instance_mapping)s } }; -""" - % locals() - ) +""" % locals() "" - self.statements[self.statements.index("{string_pool_placeholder}")] = ( - """ + self.statements[self.statements.index("{string_pool_placeholder}")] = """ const std::string strings[] = {%s}; -""" - % ",".join(map(lambda s: '"%s"s' % s, self.strings)) - ) +""" % ",".join(map(lambda s: '"%s"s' % s, self.strings)) def __str__(self): return "\n".join(self.statements) diff --git a/src/ifcopenshell-python/ifcopenshell/geom/app.py b/src/ifcopenshell-python/ifcopenshell/geom/app.py index fa07f3f2b8..d6bab207f1 100644 --- a/src/ifcopenshell-python/ifcopenshell/geom/app.py +++ b/src/ifcopenshell-python/ifcopenshell/geom/app.py @@ -145,8 +145,7 @@ class configuration: config.set( "snippets", "print all wall ids", - self.config_encode( - """ + self.config_encode(""" ########################################################################### # A simple script that iterates over all walls in the current model # # and prints their Globally unique IDs (GUIDS) to the console window # @@ -154,15 +153,13 @@ class configuration: for wall in model.by_type("IfcWall"): print ("wall with global id: "+str(wall.GlobalId)) -""".lstrip() - ), +""".lstrip()), ) config.set( "snippets", "print properties of current selection", - self.config_encode( - """ + self.config_encode(""" ########################################################################### # A simple script that iterates over all IfcPropertySets of the currently # # selected object and prints them to the console # @@ -180,8 +177,7 @@ if selection: for prop in relDefinesByProperties.RelatingPropertyDefinition.HasProperties: print ("{:<20} :{}".format(prop.Name,prop.NominalValue.wrappedValue)) print ("\\n") -""".lstrip() - ), +""".lstrip()), ) with open(conf_file, "w") as configfile: config.write(configfile) diff --git a/src/ifcopenshell-python/ifcopenshell/util/cost.py b/src/ifcopenshell-python/ifcopenshell/util/cost.py index 19172c4710..875594f1a5 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/cost.py +++ b/src/ifcopenshell-python/ifcopenshell/util/cost.py @@ -352,8 +352,7 @@ def get_cost_rate( class CostValueUnserialiser: def parse(self, formula: str): - l = lark.Lark( - """start: formula + l = lark.Lark("""start: formula formula: operand (operator operand)* operand: value | category "(" formula ")" value: NUMBER? @@ -390,8 +389,7 @@ class CostValueUnserialiser: NEWLINE: (CR? LF)+ %ignore WS // Disregard spaces in text - """ - ) + """) start = l.parse(formula) return self.get_formula(start.children[0]) diff --git a/src/ifcopenshell-python/ifcopenshell/util/scripts/validate_stub.py b/src/ifcopenshell-python/ifcopenshell/util/scripts/validate_stub.py index 2ddf444704..5ba2466f29 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/scripts/validate_stub.py +++ b/src/ifcopenshell-python/ifcopenshell/util/scripts/validate_stub.py @@ -25,7 +25,6 @@ Things we do check: - class hierarchy """ - import ast import difflib from pathlib import Path diff --git a/src/ifcopenshell-python/ifcopenshell/util/selector.py b/src/ifcopenshell-python/ifcopenshell/util/selector.py index d3bef9758f..c6ee820ab8 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/selector.py +++ b/src/ifcopenshell-python/ifcopenshell/util/selector.py @@ -39,8 +39,7 @@ import ifcopenshell.util.shape import ifcopenshell.util.system import ifcopenshell.util.unit -filter_elements_grammar = lark.Lark( - """start: filter_group +filter_elements_grammar = lark.Lark("""start: filter_group filter_group: facet_list ("+" facet_list)* facet_list: facet ("," facet)* @@ -111,11 +110,9 @@ filter_elements_grammar = lark.Lark( NEWLINE: (CR? LF)+ %ignore WS // Disregard spaces in text -""" -) +""") -get_element_grammar = lark.Lark( - """start: keys +get_element_grammar = lark.Lark("""start: keys keys: key ("." key)* key: quoted_string | regex_string | unquoted_string @@ -130,11 +127,9 @@ get_element_grammar = lark.Lark( WS: /[ \\t\\f\\r\\n]/+ %ignore WS // Disregard spaces in text - """ -) + """) -format_grammar = lark.Lark( - """start: expression +format_grammar = lark.Lark("""start: expression ?expression: add_sub ?add_sub: mul_div @@ -193,8 +188,7 @@ format_grammar = lark.Lark( NEWLINE: (CR? LF)+ %ignore WS // Disregard spaces in text -""" -) +""") class FormatTransformer(lark.Transformer): diff --git a/src/ifcopenshell-python/test/typing_tests.py b/src/ifcopenshell-python/test/typing_tests.py index 5b2d789613..ccf007fa62 100644 --- a/src/ifcopenshell-python/test/typing_tests.py +++ b/src/ifcopenshell-python/test/typing_tests.py @@ -21,7 +21,6 @@ This file should produce no warnings from type checker (currently pyright). Those tests are not automatically checked and just there to make sure overloads are making sense. """ - from typing import Union from typing_extensions import assert_type diff --git a/src/ifcopenshell-python/test/util/test_pset.py b/src/ifcopenshell-python/test/util/test_pset.py index 3b44951ec4..bec1a10ba0 100644 --- a/src/ifcopenshell-python/test/util/test_pset.py +++ b/src/ifcopenshell-python/test/util/test_pset.py @@ -17,6 +17,7 @@ # along with IfcOpenShell. If not, see . """Run this test from src/ifcopenshell-python folder: pytest --durations=0 ifcopenshell/util/test_pset.py""" + from ifcopenshell.util import pset from ifcopenshell.util.pset import ApplicableEntity diff --git a/src/ifcpatch/ifcpatch/recipes/ExtractPropertiesToSQLite.py b/src/ifcpatch/ifcpatch/recipes/ExtractPropertiesToSQLite.py index 634a8fb796..0f9dc8544d 100644 --- a/src/ifcpatch/ifcpatch/recipes/ExtractPropertiesToSQLite.py +++ b/src/ifcpatch/ifcpatch/recipes/ExtractPropertiesToSQLite.py @@ -55,8 +55,7 @@ class Patcher: self.c = self.db.cursor() self.file_patched = db_file - self.c.execute( - """ + self.c.execute(""" CREATE TABLE IF NOT EXISTS elements ( id integer PRIMARY KEY NOT NULL UNIQUE, global_id text, @@ -65,33 +64,28 @@ class Patcher: name text, description text ); - """ - ) + """) self.c.execute("CREATE INDEX IF NOT EXISTS idx_global_id ON elements (global_id);") self.c.execute("CREATE INDEX IF NOT EXISTS idx_ifc_class ON elements (ifc_class);") self.c.execute("CREATE INDEX IF NOT EXISTS idx_predefined_type ON elements (predefined_type);") - self.c.execute( - """ + self.c.execute(""" CREATE TABLE IF NOT EXISTS relationships ( from_id integer NOT NULL, type text, to_id integer NOT NULL ); - """ - ) + """) self.c.execute("CREATE INDEX IF NOT EXISTS idx_from_id ON relationships (from_id);") - self.c.execute( - """ + self.c.execute(""" CREATE TABLE IF NOT EXISTS properties ( element_id integer NOT NULL, set_name text, name text, value text ); - """ - ) + """) self.c.execute("CREATE INDEX IF NOT EXISTS idx_element_id ON properties (element_id);") elements = self.file.by_type("IfcObjectDefinition") diff --git a/src/ifcpatch/ifcpatch/recipes/Ifc2Sql.py b/src/ifcpatch/ifcpatch/recipes/Ifc2Sql.py index f7e294898a..256ffa99ce 100644 --- a/src/ifcpatch/ifcpatch/recipes/Ifc2Sql.py +++ b/src/ifcpatch/ifcpatch/recipes/Ifc2Sql.py @@ -349,13 +349,11 @@ class Patcher(ifcpatch.BasePatcher): assert cursor is not None row = cursor.fetchone() elif self.sql_type == "mysql": - cursor = self.c.execute( - f""" + cursor = self.c.execute(f""" SELECT 1 FROM information_schema.tables WHERE table_schema = '{self.database}' AND table_name = 'id_map' LIMIT 1; - """ - ) + """) row = self.c.fetchone() else: assert_never(self.sql_type) diff --git a/src/opencdeserver/api/app/repository/bcf.py b/src/opencdeserver/api/app/repository/bcf.py index a65c43d115..3812334e41 100644 --- a/src/opencdeserver/api/app/repository/bcf.py +++ b/src/opencdeserver/api/app/repository/bcf.py @@ -694,8 +694,7 @@ class BCFDB(MyDB): snapshot_type = "" snapshot = False set_snapshot = "" - cypher_viewpoint = ( - """ + cypher_viewpoint = """ MATCH (u:User)-[r1:HAS_ACTIONS_ON]->(p:Project)-[r2:HAS]->(t:Topic) WHERE u.username = $username AND r1.createViewpoint = True @@ -713,9 +712,7 @@ class BCFDB(MyDB): v.spaces_visible = $spaces_visible, v.space_boundaries_visible = $space_boundaries_visible, v.openings_visible = $openings_visible - """ - % set_snapshot - ) + """ % set_snapshot if viewpoint.guid is None: viewpoint.guid = uuid4() if viewpoint.orthogonal_camera is None: @@ -1450,8 +1447,7 @@ class BCFDB(MyDB): else: document_url = "" document_reference.url = "" - cypher = ( - """ + cypher = """ MATCH (u:User)-[r1:HAS_ACTIONS_ON]->(p:Project)-[r2:HAS]->(t:Topic) WHERE u.username = $username AND r1.updateDocumentReferences = True @@ -1461,9 +1457,7 @@ class BCFDB(MyDB): SET r3.guid: $document_reference_id, %s d.description = $description - """ - % document_url - ) + """ % document_url result = tx.run( cypher, username=current_user.username, diff --git a/src/opencdeserver/api/app/repository/documents.py b/src/opencdeserver/api/app/repository/documents.py index 95c669a7bc..d03512c8e3 100644 --- a/src/opencdeserver/api/app/repository/documents.py +++ b/src/opencdeserver/api/app/repository/documents.py @@ -36,17 +36,14 @@ class DOCDB(MyDB): else: version_index_criteria = "AND d.version_index = $version_index" - cypher = ( - """ + cypher = """ MATCH (d:Document) WHERE d.document_id = $document_id %s RETURN d AS document ORDER by d.version_index DESC LIMIT 1 - """ - % version_index_criteria - ) + """ % version_index_criteria result = tx.run(cypher, document_id=document_id, version_index=version_index) @@ -891,8 +888,7 @@ class DOCDB(MyDB): else: version_index_criteria = "" - cypher = ( - """ + cypher = """ MATCH (u:User)-[r3:HAS_ACTIONS_ON]->(p:Project)-[r4:CONTAINS]->(d:Document) WHERE u.username = $username AND d.document_id = $document_id @@ -900,9 +896,7 @@ class DOCDB(MyDB): RETURN d AS document ORDER by d.version_index DESC LIMIT 1 - """ - % version_index_criteria - ) + """ % version_index_criteria result = tx.run( cypher, username=current_user.username, document_id=document_id, version_index=version_index @@ -927,8 +921,7 @@ class DOCDB(MyDB): else: version_index_criteria = "" - cypher = ( - """ + cypher = """ MATCH (u:User)-[r3:HAS_ACTIONS_ON]->(p:Project)-[r4:CONTAINS]->(d:Document) WHERE u.username = $username AND d.document_id = $document_id @@ -936,9 +929,7 @@ class DOCDB(MyDB): RETURN d AS document ORDER by d.version_index DESC LIMIT 1 - """ - % version_index_criteria - ) + """ % version_index_criteria result = tx.run( cypher, username=current_user.username, document_id=document_id, version_index=version_index