Skip to content

Commit

Permalink
Merge pull request #1 from Ethan13310/py3
Browse files Browse the repository at this point in the history
Upgrade to Python 3
  • Loading branch information
fredboudon authored Aug 7, 2019
2 parents f18415a + d27fcec commit 8a2af99
Show file tree
Hide file tree
Showing 41 changed files with 300 additions and 321 deletions.
2 changes: 1 addition & 1 deletion conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ requirements:
run:
- python
- openalea.deploy
- openalea.core
# - openalea.core
- numpy
- matplotlib
- pandas
Expand Down
24 changes: 0 additions & 24 deletions setup.cfg

This file was deleted.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
# #}
# change setup_kwds below before the next pkglts tag

setup_kwds['share_dirs'] = {'share': 'share'}
# setup_kwds['share_dirs'] = {'share': 'share'}

setup_kwds['entry_points']["wralea"] = ["mtg = openalea.mtg_wralea"]
setup_kwds['setup_requires'] = ['openalea.deploy']
Expand Down
4 changes: 2 additions & 2 deletions src/openalea/mtg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
__version__ = version.__version__

# #}
from mtg import *
from .mtg import *

try:
from plantframe import turtle, frame, plantframe, dresser
from .plantframe import turtle, frame, plantframe, dresser

DressingData = dresser.DressingData
PlantFrame = plantframe.PlantFrame
Expand Down
14 changes: 7 additions & 7 deletions src/openalea/mtg/algo.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@

__docformat__ = "restructuredtext"

import traversal
from . import traversal

try:
from tree import InvalidVertex
from .tree import InvalidVertex
except ImportError:
from openalea.container.tree import InvalidVertex

Expand Down Expand Up @@ -146,7 +146,7 @@ def father(g, vid, scale=-1, **kwds):
vid = g.complex_at_scale(vid)
p = g.parent(vid)
else:
vid = g.component_roots_at_scale_iter(vid, scale=scale).next()
vid = next(g.component_roots_at_scale_iter(vid, scale=scale))
p = g.parent(vid)

if et != '*':
Expand Down Expand Up @@ -248,7 +248,7 @@ def sons(g, vid, **kwds):
if scale < current_scale:
vid = g.complex_at_scale(vid, scale = scale)
elif scale > current_scale:
vid = g.component_roots_at_scale_iter(vid, scale=scale).next()
vid = next(g.component_roots_at_scale_iter(vid, scale=scale))
children = g.children_iter(vid)

if et != '*':
Expand Down Expand Up @@ -399,7 +399,7 @@ def vertex_at_scale(g, vtx_id, scale):
if scale < current_scale:
vtx_id = g.complex_at_scale(vtx_id, scale=scale)
elif scale > current_scale:
vtx_id = g.component_roots_at_scale_iter(vtx_id, scale=scale).next()
vtx_id = next(g.component_roots_at_scale_iter(vtx_id, scale=scale))
return vtx_id

def trunk(g, vtx_id, scale=-1, **kwds):
Expand Down Expand Up @@ -441,9 +441,9 @@ def union(g1, g2, vid1=None, vid2=None, edge_type='<'):
subtree = traversal.iter_mtg2(g2, v2)
if v1 is g1.root and v2 is g2.root:
treeid_id[v2] = v1
subtree.next()
next(subtree)
else:
v2 = subtree.next()
v2 = next(subtree)
v = g.add_child(v1)
treeid_id[v2] = v
g._add_vertex_properties(v,g2.get_vertex_property(v2))
Expand Down
6 changes: 3 additions & 3 deletions src/openalea/mtg/color.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ def colormap(g, property_name, cmap='jet',lognorm=True):
"""
prop = g.property(property_name)

keys = prop.keys()
v = np.array(prop.values())
keys = list(prop.keys())
v = np.array(list(prop.values()))

_cmap = cm.get_cmap(cmap)
norm = Normalize() if not lognorm else LogNorm()
Expand All @@ -22,6 +22,6 @@ def colormap(g, property_name, cmap='jet',lognorm=True):
colors = (_cmap(values)[:,0:3])*255
colors = np.array(colors,dtype=np.int).tolist()

g.properties()['color'] = dict(zip(keys,colors))
g.properties()['color'] = dict(list(zip(keys,colors)))
return g

4 changes: 2 additions & 2 deletions src/openalea/mtg/draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ def draw_mtg_labels(G, pos,
verticalalignment=kwds.get('verticalalignment','center')

text_items={} # there is no text collection so we'll fake one
for n, label in labels.items():
for n, label in list(labels.items()):
(x,y)=pos[n]
if not cb.is_string_like(label):
label=str(label) # this will cause "1" and 1 to be labeled the same
Expand Down Expand Up @@ -834,7 +834,7 @@ def draw_mtg_edge_labels(G, pos,
else:
labels = edge_labels
text_items={}
for (n1,n2), label in labels.items():
for (n1,n2), label in list(labels.items()):
(x1,y1)=pos[n1]
(x2,y2)=pos[n2]
(x,y) = (x1 * label_pos + x2 * (1.0 - label_pos),
Expand Down
4 changes: 2 additions & 2 deletions src/openalea/mtg/gui/mtg_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def notify_position(self, pos):
self.notify_listeners(("metadata_changed", "position", pos))

def notify_update(self, **kwargs):
for item in kwargs.iteritems():
for item in kwargs.items():
self.notify_listeners(item)

pos = self.g().node(self.vid).position
Expand Down Expand Up @@ -375,7 +375,7 @@ def initialise_graph_view_from_model(graphView, graphModel):
"""
g = graphModel.graph
gm = graphModel
print g, gm
print(g, gm)
for v in g:
if v is not g.root:
gm.notify_listeners(("vertex_added", ("vertex", gm.vid2obj(v))))
Expand Down
Loading

0 comments on commit 8a2af99

Please sign in to comment.