Commit 88f2ae0f authored by olivier R-D's avatar olivier R-D

try another hack for Node circular import issue

parent 04d1e6a7
......@@ -2,12 +2,28 @@
Pure Python OPC-UA library
"""
#from opcua.common.manage_nodes import create_folder
#from opcua.common.manage_nodes import create_object
#from opcua.common.manage_nodes import create_variable
#from opcua.common.manage_nodes import create_property
#from opcua.common.methods import call_method
from opcua.common.node import Node
from opcua.common.manage_nodes import create_folder
from opcua.common.manage_nodes import create_object
from opcua.common.manage_nodes import create_variable
from opcua.common.manage_nodes import create_object_type
from opcua.common.manage_nodes import create_variable_type
from opcua.common.manage_nodes import create_reference_type
from opcua.common.manage_nodes import create_data_type
from opcua.common.manage_nodes import create_property
from opcua.common.manage_nodes import create_method
from opcua.common.methods import call_method
# FIXME: ugly hack to avoid circular import issue and still split file
Node.add_folder = create_folder
Node.add_object = create_object
Node.add_variable = create_variable
Node.add_property = create_property
Node.add_method = create_method
Node.call_method = call_method
Node.add_data_type = create_data_type
Node.add_object_type = create_object_type
Node.add_variable_type = create_variable_type
Node.add_reference_type = create_reference_type
from opcua.common.methods import uamethod
from opcua.common.subscription import Subscription
......
......@@ -486,43 +486,3 @@ class Node(object):
result = self.server.history_read(params)[0]
return result
# Hack for convenience methods
# local import is ugly but necessary for python2 support
# feel fri to propose something better but I want to split all those
# create methods from Node
def add_folder(*args, **kwargs):
from opcua.common import manage_nodes
return manage_nodes.create_folder(*args, **kwargs)
def add_object(*args, **kwargs):
from opcua.common import manage_nodes
return manage_nodes.create_object(*args, **kwargs)
def add_variable(*args, **kwargs):
from opcua.common import manage_nodes
return manage_nodes.create_variable(*args, **kwargs)
def add_object_type(*args, **kwargs):
from opcua.common import manage_nodes
return manage_nodes.create_object_type(*args, **kwargs)
def add_variable_type(*args, **kwargs):
from opcua.common import manage_nodes
return manage_nodes.create_variable_type(*args, **kwargs)
def add_data_type(*args, **kwargs):
from opcua.common import manage_nodes
return manage_nodes.create_data_type(*args, **kwargs)
def add_property(*args, **kwargs):
from opcua.common import manage_nodes
return manage_nodes.create_property(*args, **kwargs)
def add_method(*args, **kwargs):
from opcua.common import manage_nodes
return manage_nodes.create_method(*args, **kwargs)
def call_method(*args, **kwargs):
from opcua.common import methods
return methods.call_method(*args, **kwargs)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment