Skip to content

Commit

Permalink
new black formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
markus-stoll committed May 24, 2024
1 parent 5c00ce3 commit a8d2444
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 10 deletions.
1 change: 1 addition & 0 deletions docs/examples/aggregate_warpage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Aggregate Warpage
===================
"""

# pylint: disable=pointless-statement
from pathlib import Path
import numpy as np
Expand Down
1 change: 1 addition & 0 deletions docs/examples/plot_neighbor_distances.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
========================
This example shows ho to plot the distances of nearby elements to a specific element (d<10)
"""

# pylint: disable=pointless-statement
from pathlib import Path
import numpy as np
Expand Down
1 change: 1 addition & 0 deletions docs/examples/plot_stress.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
====================
"""

# pylint: disable=pointless-statement
from pathlib import Path
import numpy as np
Expand Down
1 change: 1 addition & 0 deletions docs/examples/quickstart.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Quick Start Example
====================
"""

# pylint: disable=pointless-statement
from pathlib import Path
import numpy as np
Expand Down
2 changes: 2 additions & 0 deletions mesh2vec/helpers.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
"""helper functions"""

from typing import OrderedDict, List, Dict
from collections import deque
from abc import ABC, abstractmethod

import numpy as np
from scipy.sparse import csr_array, coo_array, eye


# pylint: disable=invalid-name
class AbstractAdjacencyStrategy(ABC):
# pylint: disable=too-few-public-methods
Expand Down
1 change: 1 addition & 0 deletions mesh2vec/mesh2vec_base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Mesh2VecBase"""

import collections
from pathlib import Path
from typing import List, Optional, Callable, OrderedDict, Dict, Union, Iterable
Expand Down
1 change: 1 addition & 0 deletions mesh2vec/mesh2vec_cae.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Mesh2VecCae"""

import json
import os
import subprocess
Expand Down
1 change: 1 addition & 0 deletions mesh2vec/mesh2vec_exceptions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Exceptions for mesh2vec"""

from typing import Any, Dict, List
from loguru import logger
import numpy as np
Expand Down
28 changes: 18 additions & 10 deletions mesh2vec/mesh_features.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""calculation of mesh based features"""

from typing import Tuple, List, Any, Optional

import numpy as np
Expand Down Expand Up @@ -34,17 +35,21 @@ def _quad_to_tris(element_node_idxs: np.ndarray) -> Tuple[List[bool], np.ndarray
if len(element_node_idxs.shape) == 3: # points
is_quads = [any(element[3] != element[2]) for element in element_node_idxs]
tri_faces_nested = [
[element[:3].tolist(), element[[0, 2, 3]].tolist()]
if is_quad
else [element[:3].tolist()]
(
[element[:3].tolist(), element[[0, 2, 3]].tolist()]
if is_quad
else [element[:3].tolist()]
)
for is_quad, element in zip(is_quads, element_node_idxs)
]
else:
is_quads = [element[3] != element[2] for element in element_node_idxs]
tri_faces_nested = [
[element[:3].tolist(), element[[0, 2, 3]].tolist()]
if is_quad
else [element[:3].tolist()]
(
[element[:3].tolist(), element[[0, 2, 3]].tolist()]
if is_quad
else [element[:3].tolist()]
)
for is_quad, element in zip(is_quads, element_node_idxs)
]
tri_faces = np.array([tri_face for tri_faces in tri_faces_nested for tri_face in tri_faces])
Expand Down Expand Up @@ -125,10 +130,12 @@ def _make_ids_unique(
cumcounts = pd.DataFrame(array, columns=["ids"]).groupby("ids").cumcount().values
return np.array(
[
old_id
if postfix == 0
else f"{old_id}_{point_uid[e[0]]}_{point_uid[e[1]]}_"
f"{point_uid[e[2]]}_{point_uid[e[3]]}"
(
old_id
if postfix == 0
else f"{old_id}_{point_uid[e[0]]}_{point_uid[e[1]]}_"
f"{point_uid[e[2]]}_{point_uid[e[3]]}"
)
for old_id, e, postfix in zip(array, element_node_idxs, cumcounts)
]
)
Expand Down Expand Up @@ -251,6 +258,7 @@ def from_keyfile(keyfile: str, partid: str = "") -> "CaeShellMesh":
>>> print(mesh.point_coordinates.shape)
(6400, 3)
"""

# pylint: disable=too-many-branches, too-many-nested-blocks
def parse_contents(file_contents):
lines = file_contents.split("\n")
Expand Down
1 change: 1 addition & 0 deletions scripts/gemerate_test_data.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""script code to generate test data"""

import math

if __name__ == "__main__":
Expand Down
1 change: 1 addition & 0 deletions tests/test_mesh2vec_base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""tests for mesh2vec_hyper"""

from pathlib import Path
from typing import List, Any

Expand Down
1 change: 1 addition & 0 deletions tests/test_mesh2vec_cae.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""tests for mesh2vec_hyper_cae"""

from pathlib import Path
from functools import partial

Expand Down

0 comments on commit a8d2444

Please sign in to comment.