Skip to content

Commit 7aec6c3

Browse files
dario-cosciaFilippoOlivo
authored andcommitted
Back compatibility 0.1
1 parent d32db81 commit 7aec6c3

File tree

9 files changed

+114
-8
lines changed

9 files changed

+114
-8
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import warnings
2+
3+
from ..adaptive_function import *
4+
from ..utils import custom_warning_format
5+
6+
# back-compatibility 0.1
7+
# Set the custom format for warnings
8+
warnings.formatwarning = custom_warning_format
9+
warnings.filterwarnings("always", category=DeprecationWarning)
10+
warnings.warn(
11+
f"'pina.adaptive_functions' is deprecated and will be removed "
12+
f"in future versions. Please use 'pina.adaptive_function' instead.",
13+
DeprecationWarning)

pina/callbacks/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import warnings
2+
3+
from ..callback import *
4+
from ..utils import custom_warning_format
5+
6+
# back-compatibility 0.1
7+
# Set the custom format for warnings
8+
warnings.formatwarning = custom_warning_format
9+
warnings.filterwarnings("always", category=DeprecationWarning)
10+
warnings.warn(
11+
f"'pina.callbacks' is deprecated and will be removed "
12+
f"in future versions. Please use 'pina.callback' instead.",
13+
DeprecationWarning)

pina/condition/condition.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
from .input_equation_condition import InputPointsEquationCondition
55
from .input_output_condition import InputOutputPointsCondition
66
from .data_condition import DataConditionInterface
7+
import warnings
8+
from ..utils import custom_warning_format
79

10+
# Set the custom format for warnings
11+
warnings.formatwarning = custom_warning_format
12+
warnings.filterwarnings("always", category=DeprecationWarning)
813

914
class Condition:
1015
"""
@@ -50,7 +55,16 @@ def __new__(cls, *args, **kwargs):
5055
raise ValueError("Condition takes only the following keyword "
5156
f"arguments: {Condition.__slots__}.")
5257

58+
# back-compatibility 0.1
59+
if 'location' in kwargs.keys():
60+
kwargs['domain'] = kwargs.pop('location')
61+
warnings.warn(
62+
f"'location' is deprecated and will be removed "
63+
f"in future versions. Please use 'domain' instead.",
64+
DeprecationWarning)
65+
5366
sorted_keys = sorted(kwargs.keys())
67+
5468
if sorted_keys == sorted(InputOutputPointsCondition.__slots__):
5569
return InputOutputPointsCondition(**kwargs)
5670
elif sorted_keys == sorted(InputPointsEquationCondition.__slots__):

pina/geometry/__init__.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import warnings
2+
3+
from ..domain import *
4+
from ..utils import custom_warning_format
5+
6+
# back-compatibility 0.1
7+
# creating alias
8+
Location = DomainInterface
9+
10+
# Set the custom format for warnings
11+
warnings.formatwarning = custom_warning_format
12+
warnings.filterwarnings("always", category=DeprecationWarning)
13+
warnings.warn(
14+
"'pina.geometry' is deprecated and will be removed "
15+
"in future versions. Please use 'pina.domain' instead. "
16+
"Location moved to DomainInferface object.",
17+
DeprecationWarning)

pina/model/layers/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import warnings
2+
3+
from ..block import *
4+
from ...utils import custom_warning_format
5+
6+
# back-compatibility 0.1
7+
# Set the custom format for warnings
8+
warnings.formatwarning = custom_warning_format
9+
warnings.filterwarnings("always", category=DeprecationWarning)
10+
warnings.warn(
11+
f"'pina.model.layers' is deprecated and will be removed "
12+
f"in future versions. Please use 'pina.model.block' instead.",
13+
DeprecationWarning)

pina/operators.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import warnings
2+
3+
from .operator import *
4+
from .utils import custom_warning_format
5+
6+
# back-compatibility 0.1
7+
# Set the custom format for warnings
8+
warnings.formatwarning = custom_warning_format
9+
warnings.filterwarnings("always", category=DeprecationWarning)
10+
warnings.warn(
11+
f"'pina.operators' is deprecated and will be removed "
12+
f"in future versions. Please use 'pina.operator' instead.",
13+
DeprecationWarning)

pina/problem/abstract_problem.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ def __init__(self):
4141
self.domains[cond_name] = cond.domain
4242
cond.domain = cond_name
4343

44-
# @property
45-
# def collector(self):
46-
# return self._collector
47-
4844
@property
4945
def batching_dimension(self):
5046
return self._batching_dimension
@@ -53,10 +49,6 @@ def batching_dimension(self):
5349
def batching_dimension(self, value):
5450
self._batching_dimension = value
5551

56-
@property
57-
def discretised_domains(self):
58-
return self._discretised_domains
59-
6052
# TODO this should be erase when dataloading will interface collector,
6153
# kept only for back compatibility
6254
@property
@@ -68,6 +60,10 @@ def input_pts(self):
6860
elif hasattr(cond, "domain"):
6961
to_return[cond_name] = self._discretised_domains[cond.domain]
7062
return to_return
63+
64+
@property
65+
def discretised_domains(self):
66+
return self._discretised_domains
7167

7268
def __deepcopy__(self, memo):
7369
"""

pina/solvers/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import warnings
2+
3+
from ..solver import *
4+
from ..utils import custom_warning_format
5+
6+
# back-compatibility 0.1
7+
# Set the custom format for warnings
8+
warnings.formatwarning = custom_warning_format
9+
warnings.filterwarnings("always", category=DeprecationWarning)
10+
warnings.warn(
11+
f"'pina.solvers' is deprecated and will be removed "
12+
f"in future versions. Please use 'pina.solver' instead.",
13+
DeprecationWarning)

pina/solvers/pinns/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import warnings
2+
3+
from ...solver.physic_informed_solver import *
4+
from ...utils import custom_warning_format
5+
6+
# back-compatibility 0.1
7+
# Set the custom format for warnings
8+
warnings.formatwarning = custom_warning_format
9+
warnings.filterwarnings("always", category=DeprecationWarning)
10+
warnings.warn(
11+
"'pina.solvers.pinns' is deprecated and will be removed "
12+
"in future versions. Please use "
13+
"'pina.solver.physic_informed_solver' instead.",
14+
DeprecationWarning)

0 commit comments

Comments
 (0)