Skip to content

Commit

Permalink
Dropping black and use ruff as formatter (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
tkoyama010 authored Dec 29, 2023
1 parent ce0e0fa commit 71b7087
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 23 deletions.
16 changes: 7 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@ ci:
autofix_prs: true
autoupdate_schedule: weekly
repos:
- repo: https://github.com/psf/black
rev: 23.12.1
hooks:
- id: black
- repo: https://github.com/keewis/blackdoc
rev: v0.3.9
hooks:
- id: blackdoc
files: '\.py$'

- repo: https://github.com/DanielNoord/pydocstringformatter
rev: v0.7.3
Expand All @@ -27,3 +18,10 @@ repos:
hooks:
- id: numpydoc-validation
files: ^src/pvgmsh/

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.9
hooks:
- id: ruff
args: [ --fix ]
- id: ruff-format
6 changes: 6 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
.. |Ruff| image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
:target: https://github.com/astral-sh/ruff
:alt: Ruff

|Ruff|

Motivation
==========

Expand Down
22 changes: 8 additions & 14 deletions src/pvgmsh/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,15 @@ def frontal_delaunay_2d(edge_source, target_size=None):
gmsh.initialize()
gmsh.option.set_number("Mesh.Algorithm", 6)

if target_size is None:
target_size = np.max(
np.abs(edge_source.bounds[1] - edge_source.bounds[0]),
np.abs(edge_source.bounds[3] - edge_source.bounds[2]),
np.abs(edge_source.bounds[5] - edge_source.bounds[4]),
)

for i, point in enumerate(edge_source.points):
if target_size is None:
gmsh.model.geo.add_point(
point[0],
point[1],
point[2],
np.max(
np.abs(geometry.bounds[1] - geometry.bounds[0]),
np.abs(geometry.bounds[3] - geometry.bounds[2]),
np.abs(geometry.bounds[5] - geometry.bounds[4]),
),
i + 1,
)
else:
gmsh.model.geo.add_point(point[0], point[1], point[2], target_size, i + 1)
gmsh.model.geo.add_point(point[0], point[1], point[2], target_size, i + 1)

lines = edge_source.lines
for i in range(lines[0] - 1):
Expand Down

0 comments on commit 71b7087

Please sign in to comment.