Skip to content

Commit

Permalink
From absolute to local import (py3)
Browse files Browse the repository at this point in the history
  • Loading branch information
pradal committed Jul 1, 2024
1 parent 5c2f972 commit 92132d2
Show file tree
Hide file tree
Showing 15 changed files with 106 additions and 85 deletions.
32 changes: 16 additions & 16 deletions stat_tool/src/openalea/stat_tool/__init__.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
from distribution import *
from histogram import *
from mixture import *
from compound import *
from convolution import *
from vectors import *
from estimate import *
from simulate import *
from comparison import *
from regression import *
from output import *
from data_transform import *
from cluster import *
from enums import *
from plot import *
from error import *
from .distribution import *
from .histogram import *
from .mixture import *
from .compound import *
from .convolution import *
from .vectors import *
from .estimate import *
from .simulate import *
from .comparison import *
from .regression import *
from .output import *
from .data_transform import *
from .cluster import *
from .enums import *
from .plot import *
from .error import *

from openalea.deploy.shared_data import get_shared_data_path
from os.path import join as pj
Expand Down
14 changes: 7 additions & 7 deletions stat_tool/src/openalea/stat_tool/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@
"""
__version__ = "$Id$"

import error
import interface
from . import error
from . import interface

from openalea.stat_tool._stat_tool import _DistanceMatrix
from openalea.stat_tool._stat_tool import _Cluster
from openalea.stat_tool._stat_tool import _Dendrogram

from enums import format_type
from enums import criterion_type
from enums import algorithm_type
from enums import cluster_type
from enums import round_type
from .enums import format_type
from .enums import criterion_type
from .enums import algorithm_type
from .enums import cluster_type
from .enums import round_type
mode_type = round_type

__all__ = [
Expand Down
6 changes: 3 additions & 3 deletions stat_tool/src/openalea/stat_tool/comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
"""
__version__ = "$Id$"

import error
from . import error

from enums import variable_type
from enums import format_type
from .enums import variable_type
from .enums import format_type


from openalea.stat_tool._stat_tool import \
Expand Down
4 changes: 2 additions & 2 deletions stat_tool/src/openalea/stat_tool/compound.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"""
__version__ = "$Id$"

import interface
import error
from . import interface
from . import error

from openalea.stat_tool._stat_tool import _Compound
from openalea.stat_tool._stat_tool import _Convolution
Expand Down
4 changes: 2 additions & 2 deletions stat_tool/src/openalea/stat_tool/convolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
__version__ = "$Id$"


import interface
import error
from . import interface
from . import error


from openalea.stat_tool._stat_tool import _Convolution
Expand Down
19 changes: 10 additions & 9 deletions stat_tool/src/openalea/stat_tool/data_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,18 @@
"""
__revision__ = "$Id$"

import error
from openalea.stat_tool._stat_tool import \
_DiscreteMixture, \
_DiscreteMixtureData, \
_Compound, \
_CompoundData, \
_Convolution, \
_ConvolutionData,\
from . import error
from openalea.stat_tool._stat_tool import (
_DiscreteMixture,
_DiscreteMixtureData,
_Compound,
_CompoundData,
_Convolution,
_ConvolutionData,
_Vectors
)

from enums import keep_type
from .enums import keep_type



Expand Down
28 changes: 15 additions & 13 deletions stat_tool/src/openalea/stat_tool/distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,24 @@
"""
__version__ = "$Id$"

import interface
import error
from . import interface
from . import error

from openalea.stat_tool._stat_tool import *

from openalea.stat_tool._stat_tool import _DiscreteParametricModel
from openalea.stat_tool._stat_tool import _DiscreteDistributionData
from openalea.stat_tool._stat_tool import _Distribution
from openalea.stat_tool._stat_tool import I_DEFAULT
from openalea.stat_tool._stat_tool import D_DEFAULT
from openalea.stat_tool._stat_tool import D_INF
from openalea.stat_tool._stat_tool import MAX_DIFF_BOUND
from openalea.stat_tool._stat_tool import MAX_MEAN
from openalea.stat_tool._stat_tool import VariableType
from openalea.stat_tool._stat_tool import VariableTypeBis
from openalea.stat_tool._stat_tool import RestorationAlgorithm
from openalea.stat_tool._stat_tool import (
_DiscreteParametricModel,
_DiscreteDistributionData,
_Distribution,
I_DEFAULT,
D_DEFAULT,
D_INF,
MAX_DIFF_BOUND,
MAX_MEAN,
VariableType,
VariableTypeBis,
RestorationAlgorithm,
)


from enums import distribution_identifier_type
Expand Down
21 changes: 17 additions & 4 deletions stat_tool/src/openalea/stat_tool/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,23 @@

from openalea.stat_tool._stat_tool import *

from openalea.stat_tool._stat_tool import (_FrequencyDistribution, _DiscreteMixtureData,
_CompoundData,_ConvolutionData, _DiscreteDistributionData, _DiscreteMixture,
_Compound, _Convolution, _DiscreteParametricModel, _Distribution,
_Vectors, _Cluster, _DistanceMatrix, _VectorDistance, _Regression)
from openalea.stat_tool._stat_tool import (
_FrequencyDistribution,
_DiscreteMixtureData,
_CompoundData,
_ConvolutionData,
_DiscreteDistributionData,
_DiscreteMixture,
_Compound,
_Convolution,
_DiscreteParametricModel,
_Distribution,
_Vectors,
_Cluster,
_DistanceMatrix,
_VectorDistance,
_Regression
)

# map to enumerate in boost python
criterion_type = {
Expand Down
2 changes: 1 addition & 1 deletion stat_tool/src/openalea/stat_tool/histogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#import os
#sys.path.append(os.path.abspath("."))

import interface
from . import interface

from openalea.stat_tool._stat_tool import _DiscreteDistributionData

Expand Down
2 changes: 1 addition & 1 deletion stat_tool/src/openalea/stat_tool/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"""
__version__ = "$Id$"

from output import StatInterface
from .output import StatInterface



Expand Down
4 changes: 2 additions & 2 deletions stat_tool/src/openalea/stat_tool/mixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
__version__ = "$Id$"


import interface
import error
from . import interface
from . import error

from openalea.stat_tool._stat_tool import _DiscreteMixture
from openalea.stat_tool._stat_tool import _DiscreteMixtureData
Expand Down
17 changes: 9 additions & 8 deletions stat_tool/src/openalea/stat_tool/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
"""
__version__ = "$Id$"

import plot
import os
import glob
import sys
import error
from . import plot
from . import error

# Output functions
from openalea.stat_tool._stat_tool import FORWARD_DYNAMIC_PROGRAMMING, \
FORWARD_BACKWARD_SAMPLING, GENERALIZED_VITERBI, \
Expand Down Expand Up @@ -430,7 +431,7 @@ def old_plot(self, *args, **kargs):
f = open(plot_file, "w")
f.write(ctrp)
f.close()
print plot_file, "\n"
print(plot_file, "\n")

try:
import Gnuplot
Expand Down Expand Up @@ -482,7 +483,7 @@ def plot_print(self, *args, **kargs):
self.plot_write(prefix, title)

plot_file = prefix + suffix + ".print"
print "Graph printed into file:", prefix + suffix + ".ps"
print("Graph printed into file:", prefix + suffix + ".ps")
f = open(plot_file, "r")
f.readline()
contents = f.read()
Expand All @@ -504,7 +505,7 @@ def plot_print(self, *args, **kargs):
f = open(plot_file, "w")
f.write(ctrp)
f.close()
print plot_file, "\n"
print(plot_file, "\n")

try:
import Gnuplot
Expand Down Expand Up @@ -631,7 +632,7 @@ def plot(self, *args, **kargs):
Output = None
Output = error.ParseKargs(kargs, "Output", 'Segment', output_display)
except:
print 'warning could not import output_display from sequence_analysis'
print('warning could not import output_display from sequence_analysis')
else:
try:
from openalea.sequence_analysis.enums import output_display
Expand Down Expand Up @@ -872,7 +873,7 @@ def display(self, *args, **kargs):
Output = None
Output = error.ParseKargs(kargs, "Output", 'Segment', output_display)
except:
print 'warning could not import output_display from sequence_analysis'
print('warning could not import output_display from sequence_analysis')
else:
try:
from openalea.sequence_analysis.enums import output_display
Expand Down Expand Up @@ -960,7 +961,7 @@ def display(self, *args, **kargs):
# or Nonhomogenous_Markov_data
output = self.ascii_data_write(exhaustive, Format)

except Exception, e:
except Exception as e:
#for vectors only
#todo checkType
try:
Expand Down
6 changes: 3 additions & 3 deletions stat_tool/src/openalea/stat_tool/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def plot(self, plotable, title, groups=None, *args, **kargs):


g.plot(*plot_list)
raw_input("Press Enter to continue")
input("Press Enter to continue")


class mplotlib(plotter):
Expand Down Expand Up @@ -276,7 +276,7 @@ def plot(self, plotable, title, groups=None, *args, **kargs):
pylab.hold(True)
# break # nothing else to be done in principle
else:
print "Warning. Empty data."
print("Warning. Empty data.")
return
else:
pass
Expand Down Expand Up @@ -331,7 +331,7 @@ def plot(self, plotable, title, groups=None, *args, **kargs):
new_legends.insert(index_begin_line_collection, current_legend)
index_begin_line_collection += 1
pylab.legend(new_legends, **kwds)
except Exception, e:
except Exception as e:
import warnings
warnings.warn('legend failed:'+str(e))

Expand Down
8 changes: 4 additions & 4 deletions stat_tool/src/openalea/stat_tool/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"""
__version__ = "$Id$"

import error
import interface
from . import error
from . import interface


from openalea.stat_tool._stat_tool import _Regression
Expand All @@ -26,8 +26,8 @@
from openalea.stat_tool._stat_tool import _DiscreteMixture


from enums import algo_map
from enums import bool_type
from .enums import algo_map
from .enums import bool_type


__all__ = ['_Regression',
Expand Down
24 changes: 14 additions & 10 deletions stat_tool/src/openalea/stat_tool/vectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,21 @@
"""
__version__ = "$Id$"

import interface
import error

from openalea.stat_tool._stat_tool import _Vectors
from openalea.stat_tool._stat_tool import _VectorDistance
from openalea.stat_tool._stat_tool import I_DEFAULT
from . import interface
from . import error

from openalea.stat_tool._stat_tool import (
_Vectors,
_VectorDistance,
I_DEFAULT
)
# from openalea.stat_tool.enums import format_type
from openalea.stat_tool.enums import variable_type
from openalea.stat_tool.enums import variance_type
from openalea.stat_tool.enums import distance_type
from openalea.stat_tool.enums import OutputFormat
from .enums import (
variable_type,
variance_type,
distance_type,
OutputFormat
)


__all__ = ['Vectors',
Expand Down

0 comments on commit 92132d2

Please sign in to comment.