Skip to content

Commit

Permalink
Merge branch 'dev' into dimensioned_surfaces2d
Browse files Browse the repository at this point in the history
  • Loading branch information
masfaraud authored Dec 14, 2022
2 parents cf84b37 + 02e124d commit d47ec63
Show file tree
Hide file tree
Showing 37 changed files with 7,036 additions and 1,271 deletions.
37 changes: 34 additions & 3 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ steps:
- name: merge master on testing
image: alpine/git
when:
event: push
event: push
branch: master
commands:
- git fetch origin testing
Expand All @@ -18,7 +18,7 @@ steps:
- name: merge testing on dev
image: alpine/git
when:
event: push
event: push
branch: testing
commands:
- git fetch origin dev
Expand All @@ -30,9 +30,16 @@ steps:
- name: check code complexity
image: python:3.9
commands:
- pip install radon pylint
- pip install radon pylint pydocstyle
- ./code_quality.sh
- python code_pylint.py
- python code_pydocstyle.py

volumes:
# Mount pip cache from host
- name: pip_cache
path: /root/.cache/pip


- name: check pep8 formatting
image: python:3.9
Expand All @@ -41,6 +48,13 @@ steps:
- pip3 install -U pip autopep8
- bash code_pep8.sh

volumes:
# Mount pip cache from host
- name: pip_cache
path: /root/.cache/pip



- name: install, build doc run scripts
image: python:3.8
commands:
Expand All @@ -59,13 +73,25 @@ steps:
- coverage report
- python coverage_script.py

volumes:
# Mount pip cache from host
- name: pip_cache
path: /root/.cache/pip


- name: generate sdist
image: python:3.8
commands:
- git fetch --tags
- pip install Cython
- python setup.py sdist

volumes:
# Mount pip cache from host
- name: pip_cache
path: /root/.cache/pip


- name: upload to pypi
image: plugins/pypi
when:
Expand Down Expand Up @@ -102,3 +128,8 @@ steps:
password:
from_secret: email_password
from: [email protected]

volumes:
- name: pip_cache
host:
path: /tmp/cache/drone/pip
110 changes: 98 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,28 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unrealeased

### New Features


### Fixed

* Contour2D: bounding_rectangle (specify number_points for discretization_points)
* BSplineCurve2D: bounding_rectangle (specify number_points for discretization_points)


### Performance improvements


### Refactorings


### Unittests

* Contour2D: point_belongs



## Unrealeased

Expand All @@ -16,35 +38,56 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Cylinder: random_point_inside, interference_volume_with_other_cylinder, lhs_points_inside
* CylindricalSurface3D: line_intersections, linesegment_intersections, plane_intersection
* Line2D: point_distance

* Line3D: to_2d
* ArcEllipse2D: straight_line_area
* Line3D: skew_to: Verifies if two Line3D are skew
* LineSegment3D.line_interserctions


* Line3D: skew_to (verifies if two Line3D are skew)
* LineSegment3D: line_interserctions
* ArcEllipse3D: discretization_points
* FullArc3D: linesegment_intersections
* Line: sort_points_along_line
* ArcEllipse2D: length, point_belongs, abscissa, bounding_rectangle, straight_line_area, discretization_points, reverse
* New Class wires.Ellipse2D
* Ellipse2D.point_over_ellipse()
* Ellipse2D.line_intersections()
* Ellipse2D.linesegment_intersections()
* Ellipse2D.discretization_points()
* Ellipse2D.abscissa()
* Ellipse2D.point_angle_with_major_dir()
* Ellipse2D.area()
* Ellipse2D.rotation()
* Ellipse2D.tranlation()
* Ellipse2D.frame_mapping()
* Line2D.frame_mapping()
* Contour3D: linesegment_intersections, line_intersections
* Circle3D: primitives: [Arc3D, Arc3D], get_primitives, abscissa, linesegment_intersections
* Arc3D: line_intersections, linesegment_intersections
* new module utils: intersections -> circle_3d_linesegment_intersections
* CylindricalSurface3D: point_on_surface, is_coincident, arcellipse3d_to_2d

### Fixed

* Contour2D: point_belongs
* BsplineCurve: abscissa (use different start point between 0 and length)
* Arc3D: plot
* Fix some to_step methods from edges.py and faces.py
* Cylinder: point_belongs
* FullArc3D: plot (use discretization_points instead of discretise)
* Face3D.line_intersections: consider borders
* Face3D: line_intersections: consider borders
* STL: from stream (use BinaryFile and StringFile instead of io.BinaryIO and FileIO)
* Step: from stream (use BinaryFile instead of io.BinaryIO)
* Contour: is_overlapping (consider intersecting_points is empty)
* LineSegment2D: to_wire (use discretization_points instead of discretise)


* ArcEllipse2D: to_3d
* Fix boolean operations when faces are 100% coincident
* Fix some to_step methods from edges.py and faces.py
* infinite primitive offset of linesegment

### Performance improvements

* Avoid unneeded bbox computation


### Refactorings
* LineSegment3D.intersections
* LineSegment3D: intersections
* Line2D: sort_points_along_line


### Unittests
Expand All @@ -63,7 +106,36 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* LineSegment3D: linesegment_intersections
* Contour: is_overlapping
* LineSegment2D: to_wire
* ArcEllipse3D: discretization_points
* FullArc3D: linesegment_intersections
* Line2D: sort_points_along_line
* Line3D: sort_points_along_line
* ArcEllipse2D: length, point_belongs, abscissa, bounding_rectangle, straight_line_area, discretization_points, reverse
* Ellipse2D.point_over_ellipse()
* Ellipse2D.line_intersections()
* Ellipse2D.linesegment_intersections()
* Ellipse2D.discretization_points()
* Ellipse2D.abscissa()
* Ellipse2D.point_angle_with_major_dir()
* Ellipse2D.area()
* Ellipse2D.rotation()
* Ellipse2D.tranlation()
* Ellipse2D.frame_mapping()
* Line2D.frame_mapping()
* ArcEllipse3D.to_2d()
* Circle3D: point_belongs
* Circle3D: discretization_points
* Arc3D: line_intersections, linesegment_intersections
* CylindricalSurface3D: point_on_surface, is_coincident

## v0.6.1 [12/13/2022]

### Changes

* Import from dessia_common are now performed from dessia_common.core

### Fixed
* infinite primitive offset of linesegment

## v0.6.0 [11/7/2022]

Expand Down Expand Up @@ -102,11 +174,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Contour2D: point_belongs (bug when contour has only one primitive, like FullArc2D)
* Contour: contours_from_edges
* PlaneFace3D: face_intersections
<<<<<<< HEAD
=======
<<<<<<< HEAD
<<<<<<< HEAD
>>>>>>> testing
* Edge: insert_knots_and_mutiplicity
* BSplineCurve3D: from_step
* Surface2D: cut_by_line
* Circle3D: to_step

<<<<<<< HEAD
=======
* ArcEllipse3D.to_2d()

=======
* infinite primitive offset of linesegment
>>>>>>> master
=======
>>>>>>> master
>>>>>>> testing
### Performance improvements

Expand Down
112 changes: 112 additions & 0 deletions code_pydocstyle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import pydocstyle
import os
from glob import glob
import random
from datetime import date

file_list = filter(lambda z: not z.endswith("__init__.py"),
[y for x in os.walk('./volmdlr')
for y in glob(os.path.join(x[0], '*.py'))])

UNWATCHED_ERRORS = [
# Do not watch these errors
'D100', 'D104', 'D105', 'D107',
'D200', 'D202', 'D203', 'D204', 'D206', 'D210', 'D212',
'D301', 'D302',
'D401', 'D402', 'D407', 'D408', 'D409',
'D412', 'D415', 'D418'
]

MAX_ERROR_BY_TYPE = {
# http://www.pydocstyle.org/en/stable/error_codes.html
'D100': 1,
'D101': 67,
'D102': 713,
'D103': 35,
'D104': 1,
'D105': 1,
'D106': 1,
'D107': 1,

'D200': 1,
'D201': 1,
'D202': 1,
'D203': 1,
'D204': 1,
'D205': 279,
'D206': 1,
'D207': 1,
'D208': 7,
'D209': 1,
'D210': 1,
'D211': 1,
'D212': 1,
'D213': 2,
'D214': 1,
'D215': 1,

'D300': 6,
'D301': 1,
'D302': 1,

'D400': 418,
'D401': 1,
'D402': 1,
'D403': 114,
'D404': 6,
'D405': 1,
'D406': 1,
'D407': 1,
'D408': 1,
'D409': 1,
'D410': 1,
'D411': 1,
'D412': 1,
'D413': 3,
'D414': 1,
'D415': 1,
'D416': 1,
'D417': 8,
'D418': 1,
}

error_detected = False
error_over_ratchet_limit = False
ratchet_limit = 9
effective_date = date(2022, 11, 28)
today = date.today()
weekly_decrease = 5
time_decrease = int((today - effective_date).days/7. * weekly_decrease)


code_to_errors = {}
for error in pydocstyle.check(file_list, ignore=UNWATCHED_ERRORS):
code_to_errors.setdefault(error.code, [])
code_to_errors[error.code].append(error)

code_to_number = {code: len(errors) for code, errors in code_to_errors.items()}

for error_code, number_errors in code_to_number.items():
if error_code not in UNWATCHED_ERRORS:
max_errors = max(MAX_ERROR_BY_TYPE.get(error_code, 0) - time_decrease, 0)

if number_errors > max_errors:
error_detected = True
print(f'\nFix some {error_code} errors: {number_errors}/{max_errors}')

errors = code_to_errors[error_code]
errors_to_show = sorted(random.sample(errors, min(30, len(errors))),
key=lambda m: (m.filename, m.line))
for error in errors_to_show:
print(f'{error.filename} line {error.line}: {error.message}')
elif max_errors - ratchet_limit <= number_errors < max_errors:
print(f'\nYou can lower number of {error_code} to {number_errors + time_decrease} (actual {max_errors + time_decrease})')
elif number_errors < max_errors - ratchet_limit:
error_over_ratchet_limit = True
print(f'\nYou MUST lower number of {error_code} to {number_errors + time_decrease} (actual {max_errors + time_decrease})')

if error_detected:
raise RuntimeError('Too many errors\nRun pydocstyle volmdlr to get the errors')

if error_over_ratchet_limit:
raise RuntimeError('Please lower the error limits in code_pydocstyle.py MAX_ERROR_BY_TYPE according to warnings above')
Loading

0 comments on commit d47ec63

Please sign in to comment.