add python 3 support and travis test

This commit is contained in:
Kristian Reed
2018-02-15 13:25:31 +01:00
parent 4f26da6e20
commit 491c1461f2
9 changed files with 43 additions and 26 deletions

View File

@@ -1,11 +1,10 @@
"""
"""
from __future__ import absolute_import
from .schedule import Well, Completion
from .libsunbeam import action
from .config import EclipseConfig
from .parser import parse_deck, parse
__version__ = '0.0.4'
__license__ = 'GNU General Public License version 3'

View File

@@ -1,5 +1,6 @@
from os.path import isfile
import libsunbeam as lib
from __future__ import absolute_import
from sunbeam import libsunbeam as lib
from .sunbeam import delegate
@delegate(lib.SummaryConfig)

View File

@@ -1,6 +1,8 @@
from __future__ import absolute_import
from os.path import isfile
import json
import libsunbeam as lib
from sunbeam import libsunbeam as lib
from .properties import EclipseState
@@ -108,7 +110,7 @@ def parse_deck(deck, keywords=[], recovery=[]):
# carry on
if isinstance(keywords, dict):
keywords = [keywords]
keywords = map(json.dumps, keywords)
keywords = list(map(json.dumps, keywords))
is_file = isfile(deck) # If the deck is a file, the deck is read from
# that file. Otherwise it is assumed to be a
# string representation of the the deck.

View File

@@ -1,5 +1,7 @@
from __future__ import absolute_import
from os.path import isfile
import libsunbeam as lib
from sunbeam import libsunbeam as lib
from .sunbeam import delegate
from .schedule import Schedule
from .config import EclipseConfig

View File

@@ -1,4 +1,6 @@
import libsunbeam as lib
from __future__ import absolute_import
from sunbeam import libsunbeam as lib
from .sunbeam import delegate
@delegate(lib.Schedule)
@@ -11,7 +13,7 @@ class Schedule(object):
@property
def wells(self):
return map(Well, self._wells)
return list(map(Well, self._wells))
def group(self, timestep=0):
return {grp.name: grp for grp in self.groups(timestep)}
@@ -35,7 +37,7 @@ class Well(object):
return 'Well(name = "%s")' % self.name
def completions(self, timestep):
return map(Completion, self._completions(timestep))
return list(map(Completion, self._completions(timestep)))
def __eq__(self,other):
return self._sun.__equal__(other._sun)

View File

@@ -1,4 +1,5 @@
import libsunbeam as lib
from __future__ import absolute_import
class _delegate(object):
def __init__(self, name, attr):
@@ -26,13 +27,13 @@ def delegate(delegate_cls, to = '_sun'):
pass
setattr(cls, to, _property())
for attr in attributes - set(cls.__dict__.keys() + ['__init__']):
for attr in attributes - set(list(cls.__dict__.keys()) + ['__init__']):
setattr(cls, attr, _delegate(to, attr))
src, dst = getattr(delegate_cls, attr), getattr(cls, attr)
setattr(dst, '__doc__', src.__doc__)
def new__new__(_cls, this, *args, **kwargs):
new = super(cls, _cls).__new__(_cls, *args, **kwargs)
new = super(cls, _cls).__new__(_cls)
setattr(new, to, this) # self._sun = this
return new