Skip to content

Traitlets #4762

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 73 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
c202812
supress ipynb files
rmorshea Aug 6, 2015
9d4092e
todo list
rmorshea Jul 20, 2015
0edf017
refactoring with new workflow
rmorshea Jul 21, 2015
f73f7b6
transform refactoring : see TODO
rmorshea Jul 23, 2015
8b91ade
transform refactoring : see TODO
rmorshea Jul 23, 2015
ff69573
revert .gitignore
rmorshea Jul 23, 2015
602ce41
remove ipynb_checkpoints
rmorshea Jul 23, 2015
97167ac
see TODO
rmorshea Jul 23, 2015
52fdc79
see TODO
rmorshea Jul 23, 2015
de152bc
see TODO
rmorshea Jul 23, 2015
ae5b5ba
transform implamented
rmorshea Jul 30, 2015
5f58d90
progress update
rmorshea Jul 30, 2015
a8a1f18
see TODO
rmorshea Aug 1, 2015
664c02a
last update of refactor
rmorshea Aug 1, 2015
0275157
ignore refactor
rmorshea Aug 1, 2015
e258cd2
last update to refactor
rmorshea Aug 1, 2015
a14f83b
comment change
rmorshea Aug 2, 2015
e238441
rebase with origin/master (up to date with upstream/master)
rmorshea Aug 2, 2015
97f0532
add figure traitlet
rmorshea Aug 5, 2015
e1d976d
shrink file
rmorshea Aug 5, 2015
d85e2c1
progress towards full test suite pass
rmorshea Aug 14, 2015
b6d3e45
errors reduced to pickling and ref counts
rmorshea Aug 14, 2015
be7f591
update rebase
rmorshea Aug 14, 2015
5609b44
fix memory leak in Artist
rmorshea Aug 14, 2015
871388d
fix memory leaks in test_quiver.py
rmorshea Aug 14, 2015
4030397
fix exdict inheritance
rmorshea Aug 15, 2015
5a2160f
fix pickling
rmorshea Aug 15, 2015
b436bee
update traitlets
rmorshea Aug 15, 2015
593e34c
remove print statement
rmorshea Aug 15, 2015
4b6195c
resolve pickling
rmorshea Aug 16, 2015
d11236c
update exdict
rmorshea Aug 16, 2015
1debbd0
simple performance test
rmorshea Aug 16, 2015
bbf1c89
update TODO progress report
rmorshea Aug 16, 2015
709bdac
refactor visible and animated
rmorshea Aug 17, 2015
867899c
shrink file
rmorshea Aug 17, 2015
cfb0713
refactor alpha, but failed alpha blending in agg
rmorshea Aug 17, 2015
e9c8489
refactor rasterize, pickable, evenston
rmorshea Aug 18, 2015
a2e6676
update rebase
rmorshea Aug 18, 2015
299ceb2
FIX: revert changes to gc calls
tacaswell Aug 18, 2015
93945ab
fix memory leak
rmorshea Aug 18, 2015
9934482
see TODO
rmorshea Aug 21, 2015
22e4b0c
change property updates via name
rmorshea Aug 23, 2015
9b65ee0
see TODO
rmorshea Aug 25, 2015
9528a83
base artist refactor complete: see TODO
rmorshea Aug 25, 2015
f69490b
fix sketch_params/path_effects default
rmorshea Aug 25, 2015
afddefe
fix setp/getp, change forced callbacks
rmorshea Aug 25, 2015
cd1d60a
reintroduce traitlets test
rmorshea Aug 26, 2015
89caa0f
fix typo
rmorshea Sep 8, 2015
7717e07
update rebased commits
rmorshea Sep 8, 2015
57131b2
add traitlets as test dep
rmorshea Sep 8, 2015
6aacb91
simplify old value store for forced callbacks
rmorshea Sep 9, 2015
4cf88ff
use new traitlets api (has quiver memory leaks)
rmorshea Sep 16, 2015
bb02b38
add @retrieve decorator
rmorshea Sep 18, 2015
a43cdf9
correct private get
rmorshea Oct 2, 2015
be3de2f
now requires most revent version of traitlets
rmorshea Oct 5, 2015
340df20
reintroduce mute context manager, and begin uncommenting legacy sette…
rmorshea Oct 6, 2015
84ac0ff
edit traitlets as test dep
rmorshea Oct 6, 2015
7dc256a
finish uncommenting setters/getters
rmorshea Oct 8, 2015
d895089
MNT: minor fixes
tacaswell Oct 8, 2015
6ba2c89
TST: use bleeding edge branch for traitlets
tacaswell Oct 8, 2015
0064153
pep8 fixes
rmorshea Oct 9, 2015
ffe9d09
final pep8 fixes
rmorshea Oct 9, 2015
bdf6622
traitlet warning supression
rmorshea Oct 9, 2015
08a6db7
fix pylab example
rmorshea Oct 12, 2015
0d936ed
supress more warnings
rmorshea Oct 14, 2015
9d76e5a
supress more warnings
rmorshea Oct 14, 2015
3826b49
correct impropper validate usage
rmorshea Nov 2, 2015
abba50b
correct after rebase
rmorshea Nov 20, 2015
d8f65db
setattr in SimpleChainedObjects
rmorshea Nov 22, 2015
1917a2d
fix travis.yml after rebase
rmorshea Nov 22, 2015
86a9b69
misc edits, mark as changed only if setter is used
rmorshea Nov 23, 2015
40d5b49
change traitlets warn message
rmorshea Dec 2, 2015
0d1eb25
COMPRESS
rmorshea Mar 9, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
*.ipynb
*.ipynb_checkpoints/

#########################################
# OS-specific temporary and backup files
.DS_Store

.ipynb_checkpoints*
*.ipynb

#########################################
# Editor temporary/working/backup files #
.#*
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ install:
# Always install from pypi
- pip install $PRE pep8 cycler coveralls coverage
- 'pip install git+https://github.com/jenshnielsen/nose.git@matplotlibnose'

- pip install git+https://github.com/ipython/traitlets.git#egg=traitlets
# We manually install humor sans using the package from Ubuntu 14.10. Unfortunatly humor sans is not
# availible in the Ubuntu version used by Travis but we can manually install the deb from a later
# version since is it basically just a .ttf file
Expand Down
70 changes: 70 additions & 0 deletions TODO.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
-- INFILE --

#!DEPRECATED = dead method or code block
#!NOTE = see the commment

-- GENERAL --

# NEWTYPE = make traittype
# TRAITLET = make traitlet
# REFACTOR = change api

-- WORKFLOW --

0.0) not started

0.1) if relevant make new traittype
0.2) create class attr for traittype
0.3) implament new change handlers

# in Sublime Text
1.0) check for redefinition
1.1) identify class as of Artist
1.2) write relevant imports
1.3) make the method changes

# using tool/refactor_tool.py
2.0) locate method references
2.1) changed the method references

3.0) locate underscored attr references
3.1) change the underscored attrs

4.0) run partial test suite
4.1) rework for passing

5.0) run full test suite
5.1) rework for passing

6.0) complete

-- STATUS --

6.0 : transform
6.0 : transform_set
6.0 : stale
6.0 : axes
6.0 : figure
6.0 : visible
6.0 : animated
6.0 : alpha
6.0 : rasterized
6.0 : pickable
6.0 : clipbox
6.0 : clippath
6.0 : clipon
6.0 : url
6.0 : gid
6.0 : label
6.0 : contains
6.0 : picker
6.0 : mouseover
6.0 : agg_filter
6.0 : snap
6.0 : sketch_scale (new)
6.0 : sketch_length (new)
6.0 : sketch_randomness (new)
6.0 : sketch_params
6.0 : patheffects
...
...
4 changes: 2 additions & 2 deletions examples/api/demo_affine_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def imshow_affine(ax, z, *kl, **kwargs):
Z = get_image()
im1 = imshow_affine(ax1, Z, interpolation='none', cmap=cm.jet,
origin='lower',
extent=[-2, 4, -3, 2], clip_on=True)
extent=[-2, 4, -3, 2], clipon=True)

trans_data2 = mtransforms.Affine2D().rotate_deg(30) + ax1.transData
im1.set_transform(trans_data2)
Expand All @@ -58,7 +58,7 @@ def imshow_affine(ax, z, *kl, **kwargs):

im2 = ax2.imshow(Z, interpolation='none', cmap=cm.jet,
origin='lower',
extent=[-2, 4, -3, 2], clip_on=True)
extent=[-2, 4, -3, 2], clipon=True)
im2._image_skew_coordinate = (3, -2)

plt.show()
Expand Down
2 changes: 1 addition & 1 deletion examples/axes_grid/demo_axes_grid2.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def add_inner_title(ax, title, loc, size=None, **kwargs):
pad=0., borderpad=0.5,
frameon=False, **kwargs)
ax.add_artist(at)
at.txt._text.set_path_effects([withStroke(foreground="w", linewidth=3)])
at.txt._text.path_effects = [withStroke(foreground="w", linewidth=3)]
return at

if 1:
Expand Down
2 changes: 1 addition & 1 deletion examples/pylab_examples/annotation_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
arrowprops=dict(facecolor='black', shrink=0.05),
horizontalalignment='left',
verticalalignment='bottom',
clip_on=True, # clip to the axes bounding box
clipon=True, # clip to the axes bounding box
)

ax.set_xlim(-20, 20)
Expand Down
2 changes: 1 addition & 1 deletion examples/pylab_examples/broken_axis.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

d = .015 # how big to make the diagonal lines in axes coordinates
# arguments to pass plot, just so we don't keep repeating them
kwargs = dict(transform=ax.transAxes, color='k', clip_on=False)
kwargs = dict(transform=ax.transAxes, color='k', clipon=False)
ax.plot((-d, +d), (-d, +d), **kwargs) # top-left diagonal
ax.plot((1 - d, 1 + d), (-d, +d), **kwargs) # top-right diagonal

Expand Down
6 changes: 3 additions & 3 deletions examples/pylab_examples/demo_agg_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def filtered_text(ax):
for t in cl:
t.set_color("k")
# to force TextPath (i.e., same font in all backends)
t.set_path_effects([Normal()])
t.path_effects = [Normal()]

# Add white glows to improve visibility of labels.
white_glows = FilteredArtistList(cl, GrowFilter(3))
Expand Down Expand Up @@ -254,7 +254,7 @@ def drop_shadow_line(ax):
# adjust zorder of the shadow lines so that it is drawn below the
# original lines
shadow.set_zorder(l.get_zorder() - 0.5)
shadow.set_agg_filter(gauss)
shadow.agg_filter = gauss
shadow.set_rasterized(True) # to support mixed-mode renderers

ax.set_xlim(0., 1.)
Expand Down Expand Up @@ -298,7 +298,7 @@ def light_filter_pie(ax):

light_filter = LightFilter(9)
for p in pies[0]:
p.set_agg_filter(light_filter)
p.agg_filter = light_filter
p.set_rasterized(True) # to support mixed-mode renderers
p.set(ec="none",
lw=2)
Expand Down
2 changes: 1 addition & 1 deletion examples/pylab_examples/demo_bboximage.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
bbox_image = BboxImage(txt.get_window_extent,
norm=None,
origin=None,
clip_on=False,
clipon=False,
**kwargs
)
a = np.arange(256).reshape(1, 256)/256.
Expand Down
2 changes: 1 addition & 1 deletion examples/pylab_examples/image_clip_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

im = plt.imshow(Z, interpolation='bilinear', cmap=cm.gray,
origin='lower', extent=[-3, 3, -3, 3],
clip_path=patch, clip_on=True)
clip_path=patch, clipon=True)
im.set_clip_path(patch)

plt.show()
13 changes: 7 additions & 6 deletions examples/pylab_examples/patheffect_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,19 @@
txt = ax1.annotate("test", (1., 1.), (0., 0),
arrowprops=dict(arrowstyle="->",
connectionstyle="angle3", lw=2),
size=20, ha="center", path_effects=[PathEffects.withStroke(linewidth=3,
foreground="w")])
txt.arrow_patch.set_path_effects([
size=20, ha="center",
path_effects=[PathEffects.withStroke(linewidth=3,
foreground="w")])
txt.arrow_patch.path_effects = [
PathEffects.Stroke(linewidth=5, foreground="w"),
PathEffects.Normal()])
PathEffects.Normal()]

ax1.grid(True, linestyle="-")

pe = [PathEffects.withStroke(linewidth=3,
foreground="w")]
for l in ax1.get_xgridlines() + ax1.get_ygridlines():
l.set_path_effects(pe)
l.path_effects = pe

ax2 = plt.subplot(132)
arr = np.arange(25).reshape((5, 5))
Expand All @@ -38,6 +39,6 @@
ax3 = plt.subplot(133)
p1, = ax3.plot([0, 1], [0, 1])
leg = ax3.legend([p1], ["Line 1"], fancybox=True, loc=2)
leg.legendPatch.set_path_effects([PathEffects.withSimplePatchShadow()])
leg.legendPatch.path_effects = [PathEffects.withSimplePatchShadow()]

plt.show()
2 changes: 1 addition & 1 deletion examples/pylab_examples/set_and_get.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
alpha = 1.0
antialiased = True
c = b
clip_on = True
clipon = True
color = b
... long listing skipped ...

Expand Down
8 changes: 4 additions & 4 deletions examples/pylab_examples/spine_placement_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,19 @@ def adjust_spines(ax, spines):
y = 2*np.sin(x)

ax = fig.add_subplot(2, 2, 1)
ax.plot(x, y, clip_on=False)
ax.plot(x, y, clipon=False)
adjust_spines(ax, ['left'])

ax = fig.add_subplot(2, 2, 2)
ax.plot(x, y, clip_on=False)
ax.plot(x, y, clipon=False)
adjust_spines(ax, [])

ax = fig.add_subplot(2, 2, 3)
ax.plot(x, y, clip_on=False)
ax.plot(x, y, clipon=False)
adjust_spines(ax, ['left', 'bottom'])

ax = fig.add_subplot(2, 2, 4)
ax.plot(x, y, clip_on=False)
ax.plot(x, y, clipon=False)
adjust_spines(ax, ['bottom'])

plt.show()
2 changes: 1 addition & 1 deletion examples/pylab_examples/usetex_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
horizontalalignment='left',
verticalalignment='center',
rotation=90,
clip_on=False)
clipon=False)
plt.text(1.01, -0.02, "-1", {'color': 'k', 'fontsize': 20})
plt.text(1.01, 0.98, "1", {'color': 'k', 'fontsize': 20})
plt.text(1.01, 0.48, "0", {'color': 'k', 'fontsize': 20})
Expand Down
4 changes: 2 additions & 2 deletions examples/text_labels_and_annotations/rainbow_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ def rainbow_text(x, y, strings, colors, ax=None, **kw):
text = ax.text(x, y, " " + s + " ", color=c, transform=t, **kw)
text.draw(canvas.get_renderer())
ex = text.get_window_extent()
t = transforms.offset_copy(text._transform, x=ex.width, units='dots')
t = transforms.offset_copy(text.private('transform'), x=ex.width, units='dots')

# vertical version
for s, c in zip(strings, colors):
text = ax.text(x, y, " " + s + " ", color=c, transform=t,
rotation=90, va='bottom', ha='center', **kw)
text.draw(canvas.get_renderer())
ex = text.get_window_extent()
t = transforms.offset_copy(text._transform, y=ex.height, units='dots')
t = transforms.offset_copy(text.private('transform'), y=ex.height, units='dots')


rainbow_text(0, 0, "all unicorns poop rainbows ! ! !".split(),
Expand Down
12 changes: 6 additions & 6 deletions lib/matplotlib/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1041,8 +1041,8 @@ def _init_draw(self):
figs = set()
for f in self.new_frame_seq():
for artist in f:
artist.set_visible(False)
artist.set_animated(self._blit)
artist.visible = False
artist.animated = self._blit
# Assemble a list of unique axes that need flushing
if artist.axes.figure not in figs:
figs.add(artist.axes.figure)
Expand All @@ -1061,7 +1061,7 @@ def _pre_draw(self, framedata, blit):
else:
# Otherwise, make all the artists from the previous frame invisible
for artist in self._drawn_artists:
artist.set_visible(False)
artist.visible = False

def _draw_frame(self, artists):
# Save the artists that were passed in as framedata for the other
Expand All @@ -1070,7 +1070,7 @@ def _draw_frame(self, artists):

# Make all the artists from the current frame visible
for artist in artists:
artist.set_visible(True)
artist.visible = True


class FuncAnimation(TimedAnimation):
Expand Down Expand Up @@ -1166,7 +1166,7 @@ def _init_draw(self):
self._drawn_artists = self._init_func()
if self._blit:
for a in self._drawn_artists:
a.set_animated(self._blit)
a.animated = self._blit

def _draw_frame(self, framedata):
# Save the data for potential saving of movies.
Expand All @@ -1181,4 +1181,4 @@ def _draw_frame(self, framedata):
self._drawn_artists = self._func(framedata, *self._args)
if self._blit:
for a in self._drawn_artists:
a.set_animated(self._blit)
a.animated = self._blit
Loading