Skip to content

Commit 36d4924

Browse files
committed
Fix codacy
1 parent 360943e commit 36d4924

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

pina/callback/refinement/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
"""
2+
Module for Pina Refinement callbacks.
3+
"""
4+
15
__all__ = [
26
"RefinementInterface",
37
"R3Refinement",

pina/callback/refinement/r3_refinement.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Module for the R3Refinement callback."""
22

33
import torch
4-
import torch.nn as nn
4+
from torch import nn
55
from torch.nn.modules.loss import _Loss
66
from .refinement_interface import RefinementInterface
77
from ...label_tensor import LabelTensor
@@ -66,5 +66,4 @@ def sample(self, current_points, condition_name, solver):
6666
retain_pts = len(pts)
6767
samples = domain.sample(num_old_points - retain_pts, "random")
6868
return LabelTensor.cat([pts, samples])
69-
else:
70-
return domain.sample(num_old_points, "random")
69+
return domain.sample(num_old_points, "random")

pina/callback/refinement/refinement_interface.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from lightning.pytorch import Callback
88
from ...utils import check_consistency
99
from ...solver.physics_informed_solver import PINNInterface
10-
from ...condition import DomainEquationCondition
1110

1211

1312
class RefinementInterface(Callback, metaclass=ABCMeta):
@@ -46,7 +45,8 @@ def on_train_start(self, trainer, solver):
4645
# check we have valid conditions names
4746
if self._condition_to_update is None:
4847
self._condition_to_update = [
49-
name for name, cond in solver.problem.conditions.items()
48+
name
49+
for name, cond in solver.problem.conditions.items()
5050
if hasattr(cond, "domain")
5151
]
5252

@@ -64,7 +64,7 @@ def on_train_start(self, trainer, solver):
6464
# check solver
6565
if not isinstance(solver, PINNInterface):
6666
raise RuntimeError(
67-
f"Refinment strategies are currently implemented only "
67+
"Refinment strategies are currently implemented only "
6868
"for physics informed based solvers. Please use a Solver "
6969
"inheriting from 'PINNInterface'."
7070
)
@@ -92,7 +92,6 @@ def sample(self, current_points, condition_name, solver):
9292
"""
9393
Samples new points based on the condition.
9494
"""
95-
pass
9695

9796
@property
9897
def dataset(self):

0 commit comments

Comments
 (0)