Skip to content
This repository has been archived by the owner on Jul 19, 2021. It is now read-only.

Commit

Permalink
Add filtering on module to prevent warnings from other modules
Browse files Browse the repository at this point in the history
  • Loading branch information
oysteoh committed Jan 28, 2020
1 parent 354faf5 commit e6afd5f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
10 changes: 8 additions & 2 deletions python/ert/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import warnings

warnings.simplefilter('always', DeprecationWarning) # see #1437
warnings.filterwarnings(
action='always',
category=DeprecationWarning,
module=r'ecl|ert|res'
)

warnings.warn(
"Importing from ert is deprecated and will be removed in a future release, use: \'from res import\' instead",
"Importing from ert.ecl, ecl.ecl or ert is deprecated and will not be available in python3." \
" For eclipse functionality use \'from ecl import\', for ert workflow tooling use \'from res import\'.",
DeprecationWarning
)

Expand Down
6 changes: 5 additions & 1 deletion python/res/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@
import sys

import warnings
warnings.simplefilter('always', DeprecationWarning) # see #1437
warnings.filterwarnings(
action='always',
category=DeprecationWarning,
module=r'res|ert'
)

from cwrap import load as cwrapload
from cwrap import Prototype
Expand Down

0 comments on commit e6afd5f

Please sign in to comment.