Skip to content
Snippets Groups Projects
Commit 04aba823 authored by Martin Nolte's avatar Martin Nolte
Browse files

deprecate imported dune-grid enums

parent 8e0c6f4a
No related branches found
No related tags found
1 merge request!790Feature/add python bindings
add_python_targets(common
__init__
compatibility
deprecated
module
checkconfiguration
hashit
......
......@@ -22,7 +22,16 @@ except ImportError:
logger.info('mpi4py not found, MPI not initialized')
from ._common import *
from .deprecated import DeprecatedObject
from ..grid._grid import CommunicationDirection, DataType, InterfaceType, Marker, OutputType, PartitionType, reader
CommunicationDirection = DeprecatedObject(CommunicationDirection, "dune.common.CommunicationDirection is deprecated, use dune.grid.CommunicationDirection instead")
DataType = DeprecatedObject(DataType, "dune.common.DataType is deprecated, use dune.grid.DataType instead")
InterfaceType = DeprecatedObject(InterfaceType, "dune.common.Interface is deprecated, use dune.grid.InterfaceType instead")
Marker = DeprecatedObject(Marker, "dune.common.Marker is deprecated, use dune.grid.Marker instead")
OutputType = DeprecatedObject(OutputType, "dune.common.OutputType is deprecated, use dune.grid.OutputType instead")
PartitionType = DeprecatedObject(PartitionType, "dune.common.PartitionType is deprecated, use dune.grid.PartitionType instead")
reader = DeprecatedObject(reader, "dune.common.reader is deprecated, use dune.grid.reader instead")
import numpy
def fvgetitem(self,index):
......
import logging
class DeprecatedObject(object):
def __init__(self, real, message):
self.real = real
self.logger = logging.getLogger(real.__module__)
self.message = message
def __call__(self, *args, **kwargs):
object.__getattribute__(self, "logger").warning(object.__getattribute__(self, "message"))
return object.__getattribute__(self, "real")(*args, **kwargs)
def __getattribute__(self, name):
object.__getattribute__(self, "logger").warning(object.__getattribute__(self, "message"))
return getattr(object.__getattribute__(self, "real"), name)
def __repr__(self):
object.__getattribute__(self, "logger").warning(object.__getattribute__(self, "message"))
return repr(object.__getattribute__(self, "real"))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment