GeezerVison is showing github.com — Merge pull request #12 from tpaviot/review/codacy-fixes · hovedguy/pythonocc-demos@7fd7a5e
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: README.md +1Lines changed: 1 addition & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | [](https://lgtm.com/projects/g/tpaviot/pythonocc-demos/context:python) | | 2 | +[](https://www.codacy.com/app/tpaviot/pythonocc-demos?utm_source=github.com&utm_medium=referral&utm_content=tpaviot/pythonocc-demos&utm_campaign=Badge_Grade) | 2 | 3 |
| 3 | 4 | Some pythonocc related code snippets, examples, jupter notebooks etc. | 4 | 5 |
| |
Collapse file Copy file name to clipboardExpand all lines: examples/core_boolean_fuzzy_cut_emmenthaler.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 21 | 21 | import time | 22 | 22 | import sys | 23 | 23 |
| 24 | | -from OCC.Core.BRepPrimAPI import BRepPrimAPI_MakeBox, BRepPrimAPI_MakeCylinder, BRepPrimAPI_MakeCone | | 24 | +from OCC.Core.BRepPrimAPI import BRepPrimAPI_MakeBox, BRepPrimAPI_MakeCylinder | 25 | 25 | from OCC.Core.gp import gp_Pnt, gp_Vec, gp_Ax2, gp_Dir | 26 | 26 | from OCC.Core.BRepAlgoAPI import BRepAlgoAPI_Cut | 27 | 27 | from OCC.Core.TopTools import TopTools_ListOfShape | |
Collapse file Copy file name to clipboardExpand all lines: examples/core_classic_occ_bottle.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 22 | 22 | from OCC.Core.gp import gp_Pnt, gp_OX, gp_Vec, gp_Trsf, gp_DZ, gp_Ax2, gp_Ax3, gp_Pnt2d, gp_Dir2d, gp_Ax2d | 23 | 23 | from OCC.Core.GC import GC_MakeArcOfCircle, GC_MakeSegment | 24 | 24 | from OCC.Core.GCE2d import GCE2d_MakeSegment | 25 | | -from OCC.Core.Geom import Geom_Plane, Geom_CylindricalSurface, Geom_Plane | | 25 | +from OCC.Core.Geom import Geom_Plane, Geom_CylindricalSurface | 26 | 26 | from OCC.Core.Geom2d import Geom2d_Ellipse, Geom2d_TrimmedCurve | 27 | 27 | from OCC.Core.BRepBuilderAPI import (BRepBuilderAPI_MakeEdge, BRepBuilderAPI_MakeWire, | 28 | 28 | BRepBuilderAPI_MakeFace, BRepBuilderAPI_Transform) | |
Collapse file Copy file name to clipboardExpand all lines: examples/core_display_line_properties.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -54,7 +54,7 @@ def line(): | 54 | 54 | line2 = Geom_Line(p2, d2) | 55 | 55 |
| 56 | 56 | ais_line2 = AIS_Line(line2) | 57 | | - | | 57 | + | 58 | 58 | width = float(i) | 59 | 59 | drawer = ais_line2.Attributes() | 60 | 60 | # asp : first parameter color, second type, last width | |
Collapse file Copy file name to clipboardExpand all lines: examples/core_display_overlayered_text.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 19 | 19 | from math import pi | 20 | 20 |
| 21 | 21 | from OCC.Core.BRepPrimAPI import BRepPrimAPI_MakeBox | 22 | | -from OCC.Core.Aspect import Aspect_TODT_NORMAL, Aspect_TODT_DEKALE | | 22 | +from OCC.Core.Aspect import Aspect_TODT_NORMAL, Aspect_TODT_DEKALE | 23 | 23 | from OCC.Core.Quantity import Quantity_Color, Quantity_NOC_BLACK, Quantity_NOC_ORANGE | 24 | 24 | from OCC.Core.TCollection import TCollection_AsciiString | 25 | 25 | from OCC.Core.gp import gp_Ax1, gp_Pnt, gp_Dir, gp_Trsf | |
Collapse file Copy file name to clipboardExpand all lines: examples/core_display_raytracing.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -58,7 +58,7 @@ def raytracing_default_depth(event=None): | 58 | 58 |
| 59 | 59 | def raytracing_depth_8(event=None): | 60 | 60 | display.SetRaytracingMode(depth=8) | 61 | | - | | 61 | + | 62 | 62 | def rasterization(event=None): | 63 | 63 | display.SetRasterizationMode() | 64 | 64 |
| |
Collapse file Copy file name to clipboardExpand all lines: examples/core_export_step_ap203.py +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 36 | 36 | step_writer.Transfer(box_s, STEPControl_AsIs) | 37 | 37 | status = step_writer.Write("box.stp") | 38 | 38 |
| 39 | | -assert status == IFSelect_RetDone | | 39 | +if status != IFSelect_RetDone: | | 40 | + raise AssertionError("load failed") |
Collapse file Copy file name to clipboardExpand all lines: examples/core_export_stl.py +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 27 | 27 | stl_output_dir = os.path.abspath(os.path.join("..", "assets", "models")) | 28 | 28 |
| 29 | 29 | # make sure the path exists otherwise OCE get confused | 30 | | -assert os.path.isdir(stl_output_dir) | | 30 | +if not os.path.isdir(stl_output_dir): | | 31 | + raise AssertionError("wrong path provided") | 31 | 32 | stl_low_resolution_file = os.path.join(stl_output_dir, "torus_default_resolution.stl") | 32 | 33 | write_stl_file(my_torus, stl_low_resolution_file) | 33 | 34 |
| |
Collapse file Copy file name to clipboardExpand all lines: examples/core_geometry_airfoil.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 33 | 33 | from OCC.Core.gp import gp_Pnt, gp_Vec, gp_Pnt2d, gp_Pln, gp_Dir | 34 | 34 | from OCC.Core.TColgp import TColgp_Array1OfPnt2d | 35 | 35 | from OCC.Display.SimpleGui import init_display | 36 | | - | | 36 | + | 37 | 37 | from OCC.Extend.ShapeFactory import make_wire, make_edge | 38 | 38 |
| 39 | 39 |
| |
Collapse file Copy file name to clipboardExpand all lines: examples/core_geometry_bisector.py +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -48,7 +48,8 @@ def bisect_linecircle(event=None): | 48 | 48 | ci1 = gp_Circ2d(gp_Ax22d(), 10000) | 49 | 49 | li1 = gp_Lin2d(gp_Pnt2d(2000000, 20), gp_Dir2d(0, 1)) | 50 | 50 | bi = GccAna_CircLin2dBisec(ci1, li1) | 51 | | - assert bi.IsDone() | | 51 | + if not bi.IsDone(): | | 52 | + raise AssertionError("Bisec is not Done") | 52 | 53 | bisec = bi.ThisSolution(1) | 53 | 54 | pb = bisec.Parabola() | 54 | 55 | display.DisplayShape([make_edge2d(ci1), make_edge2d(li1)]) | |
|