Skip to content

Commit

Permalink
refact: clean up imports
Browse files Browse the repository at this point in the history
  • Loading branch information
asmfstatoil committed Nov 16, 2023
1 parent 87389fb commit dc95790
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions neqsim/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
It uses the Jpype module for bridging python and Java.
"""

from .neqsimpython import *
from neqsim.neqsimpython import jNeqSim, jpype

def methods(checkClass):
methods = checkClass.getClass().getMethods()
Expand All @@ -23,22 +23,20 @@ def has_tabulate():


def setDatabase(connectionString):
from neqsim.neqsimpython import jNeqSim
jNeqSim.util.database.NeqSimDataBase.setConnectionString(connectionString)
jNeqSim.util.database.NeqSimDataBase.setCreateTemporaryTables(True)

def save_xml(javaobject, filename):
xstream = jpype.JPackage('com.thoughtworks.xstream')
streamer = xstream.XStream()
xml = streamer.toXML(javaobject)
print(xml, file=open(filename, 'w'))
print(xml, file=open(filename, 'w'))
return xml

def open_xml(filename):
xstream = jpype.JPackage('com.thoughtworks.xstream')
security = jpype.JPackage('com.thoughtworks.xstream.security')
streamer = xstream.XStream()
streamer.addPermission(security.AnyTypePermission.ANY)
streamer.addPermission(xstream.security.AnyTypePermission.ANY)
str = open(filename, 'r').read()
neqsimobj = streamer.fromXML(str)
return neqsimobj

0 comments on commit dc95790

Please sign in to comment.