Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4f24854

Browse files
committed
shrink file
1 parent 40fb98b commit 4f24854

File tree

1 file changed

+16
-222
lines changed

1 file changed

+16
-222
lines changed

tools/refactor.ipynb

Lines changed: 16 additions & 222 deletions
Original file line numberDiff line numberDiff line change
@@ -2,251 +2,45 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 13,
5+
"execution_count": 1,
66
"metadata": {
77
"collapsed": false
88
},
9-
"outputs": [],
9+
"outputs": [
10+
{
11+
"name": "stdout",
12+
"output_type": "stream",
13+
"text": [
14+
"Using existing version of: github.rmorshea.misc\n"
15+
]
16+
}
17+
],
1018
"source": [
1119
"from refactor_tool import MatplotlibReplace\n",
1220
"mrt = MatplotlibReplace('get_figure',context=3)"
1321
]
1422
},
1523
{
1624
"cell_type": "code",
17-
"execution_count": 14,
25+
"execution_count": 2,
1826
"metadata": {
1927
"collapsed": false,
2028
"scrolled": false
2129
},
22-
"outputs": [
23-
{
24-
"name": "stdout",
25-
"output_type": "stream",
26-
"text": [
27-
"L:805 @ /Users/RyanMorshead/Coding/GitHub/matplotlib/lib/mpl_toolkits/axes_grid/colorbar.py\n",
28-
"\n",
29-
".... panchor = (0.5, 0.0)\n",
30-
".... parent.set_position(pb1)\n",
31-
".... parent.set_anchor(panchor)\n",
32-
">>>> fig = parent.get_figure()\n",
33-
".... cax = fig.add_axes(pbcb)\n",
34-
".... cax.set_aspect(aspect, anchor=anchor, adjustable='box')\n",
35-
".... return cax, kw\n",
36-
"\n",
37-
"NEW fig = parent.figure\n",
38-
"\n",
39-
"command: o\n",
40-
"y\n",
41-
"\n",
42-
"L:500 @ /Users/RyanMorshead/Coding/GitHub/matplotlib/lib/mpl_toolkits/axes_grid1/axes_divider.py\n",
43-
"\n",
44-
".... else:\n",
45-
".... self._yref = yref\n",
46-
"....\n",
47-
">>>> Divider.__init__(self, fig=axes.get_figure(), pos=None,\n",
48-
".... horizontal=[self._xref], vertical=[self._yref],\n",
49-
".... aspect=None, anchor=\"C\")\n",
50-
"....\n",
51-
"\n",
52-
"NEW Divider.__init__(self, fig=axes.figure, pos=None,\n",
53-
"\n",
54-
"command: y\n",
55-
"\n",
56-
"L:515 @ /Users/RyanMorshead/Coding/GitHub/matplotlib/lib/mpl_toolkits/axes_grid1/axes_divider.py\n",
57-
"\n",
58-
".... else:\n",
59-
".... axes_class = type(axes)\n",
60-
"....\n",
61-
">>>> ax = axes_class(axes.get_figure(),\n",
62-
".... axes.get_position(original=True), **kwargs)\n",
63-
"....\n",
64-
".... return ax\n",
65-
"\n",
66-
"NEW ax = axes_class(axes.figure,\n",
67-
"\n",
68-
"command: y\n",
69-
"\n",
70-
"L:37 @ /Users/RyanMorshead/Coding/GitHub/matplotlib/lib/mpl_toolkits/axes_grid1/axes_rgb.py\n",
71-
"\n",
72-
".... axes_class = locatable_axes_factory(type(ax))\n",
73-
"....\n",
74-
".... for ny in [4, 2, 0]:\n",
75-
">>>> ax1 = axes_class(ax.get_figure(),\n",
76-
".... ax.get_position(original=True),\n",
77-
".... sharex=ax, sharey=ax)\n",
78-
".... locator = divider.new_locator(nx=2, ny=ny)\n",
79-
"\n",
80-
"NEW ax1 = axes_class(ax.figure,\n",
81-
"\n",
82-
"command: y\n",
83-
"\n",
84-
"L:53 @ /Users/RyanMorshead/Coding/GitHub/matplotlib/lib/mpl_toolkits/axes_grid1/axes_rgb.py\n",
85-
"\n",
86-
".... ax_rgb.append(ax1)\n",
87-
"....\n",
88-
".... if add_all:\n",
89-
">>>> fig = ax.get_figure()\n",
90-
".... for ax1 in ax_rgb:\n",
91-
".... fig.add_axes(ax1)\n",
92-
"....\n",
93-
"\n",
94-
"NEW fig = ax.figure\n",
95-
"\n",
96-
"command: y\n",
97-
"\n",
98-
"L:147 @ /Users/RyanMorshead/Coding/GitHub/matplotlib/lib/mpl_toolkits/axes_grid1/axes_rgb.py\n",
99-
"\n",
100-
"....\n",
101-
".... ax_rgb = []\n",
102-
".... for ny in [4, 2, 0]:\n",
103-
">>>> ax1 = axes_class(ax.get_figure(),\n",
104-
".... ax.get_position(original=True),\n",
105-
".... sharex=ax, sharey=ax, **kwargs)\n",
106-
".... locator = divider.new_locator(nx=2, ny=ny)\n",
107-
"\n",
108-
"NEW ax1 = axes_class(ax.figure,\n",
109-
"\n",
110-
"command: y\n",
111-
"\n",
112-
"L:159 @ /Users/RyanMorshead/Coding/GitHub/matplotlib/lib/mpl_toolkits/axes_grid1/axes_rgb.py\n",
113-
"\n",
114-
".... self.R, self.G, self.B = ax_rgb\n",
115-
"....\n",
116-
".... if add_all:\n",
117-
">>>> fig = ax.get_figure()\n",
118-
".... fig.add_axes(ax)\n",
119-
".... self.add_RGB_to_figure()\n",
120-
"....\n",
121-
"\n",
122-
"NEW fig = ax.figure\n",
123-
"\n",
124-
"command: y\n",
125-
"\n",
126-
"L:180 @ /Users/RyanMorshead/Coding/GitHub/matplotlib/lib/mpl_toolkits/axes_grid1/axes_rgb.py\n",
127-
"\n",
128-
".... def add_RGB_to_figure(self):\n",
129-
".... \"\"\"Add the red, green and blue axes to the RGB composite's axes figure\n",
130-
".... \"\"\"\n",
131-
">>>> self.RGB.get_figure().add_axes(self.R)\n",
132-
".... self.RGB.get_figure().add_axes(self.G)\n",
133-
".... self.RGB.get_figure().add_axes(self.B)\n",
134-
"....\n",
135-
"\n",
136-
"NEW self.RGB.figure.add_axes(self.R)\n",
137-
"\n",
138-
"command: o\n",
139-
"y\n",
140-
"\n",
141-
"L:181 @ /Users/RyanMorshead/Coding/GitHub/matplotlib/lib/mpl_toolkits/axes_grid1/axes_rgb.py\n",
142-
"\n",
143-
".... \"\"\"Add the red, green and blue axes to the RGB composite's axes figure\n",
144-
".... \"\"\"\n",
145-
".... self.RGB.get_figure().add_axes(self.R)\n",
146-
">>>> self.RGB.get_figure().add_axes(self.G)\n",
147-
".... self.RGB.get_figure().add_axes(self.B)\n",
148-
"....\n",
149-
".... def imshow_rgb(self, r, g, b, **kwargs):\n",
150-
"\n",
151-
"NEW self.RGB.figure.add_axes(self.G)\n",
152-
"\n",
153-
"command: y\n",
154-
"\n",
155-
"L:182 @ /Users/RyanMorshead/Coding/GitHub/matplotlib/lib/mpl_toolkits/axes_grid1/axes_rgb.py\n",
156-
"\n",
157-
".... \"\"\"\n",
158-
".... self.RGB.get_figure().add_axes(self.R)\n",
159-
".... self.RGB.get_figure().add_axes(self.G)\n",
160-
">>>> self.RGB.get_figure().add_axes(self.B)\n",
161-
"....\n",
162-
".... def imshow_rgb(self, r, g, b, **kwargs):\n",
163-
".... \"\"\"Create the four images {rgb, r, g, b}\n",
164-
"\n",
165-
"NEW self.RGB.figure.add_axes(self.B)\n",
166-
"\n",
167-
"command: y\n",
168-
"\n",
169-
"L:165 @ /Users/RyanMorshead/Coding/GitHub/matplotlib/lib/mpl_toolkits/axes_grid1/axes_size.py\n",
170-
"\n",
171-
".... bb = a.get_window_extent(renderer)\n",
172-
".... w_list.append(bb.width)\n",
173-
".... h_list.append(bb.height)\n",
174-
">>>> dpi = a.get_figure().get_dpi()\n",
175-
".... if self._w_or_h == \"width\":\n",
176-
".... abs_size = max(w_list)/dpi\n",
177-
".... elif self._w_or_h == \"height\":\n",
178-
"\n",
179-
"NEW dpi = a.figure.get_dpi()\n",
180-
"\n",
181-
"command: y\n",
182-
"\n",
183-
"L:191 @ /Users/RyanMorshead/Coding/GitHub/matplotlib/lib/mpl_toolkits/axes_grid1/axes_size.py\n",
184-
"\n",
185-
".... for a in self._artist_list:\n",
186-
".... bb = a.get_window_extent(renderer)\n",
187-
".... w_list.append(bb.width)\n",
188-
">>>> dpi = a.get_figure().get_dpi()\n",
189-
".... abs_size = max(w_list)/dpi\n",
190-
"....\n",
191-
".... return rel_size, abs_size\n",
192-
"\n",
193-
"NEW dpi = a.figure.get_dpi()\n",
194-
"\n",
195-
"command: y\n",
196-
"\n",
197-
"L:215 @ /Users/RyanMorshead/Coding/GitHub/matplotlib/lib/mpl_toolkits/axes_grid1/axes_size.py\n",
198-
"\n",
199-
".... for a in self._artist_list:\n",
200-
".... bb = a.get_window_extent(renderer)\n",
201-
".... h_list.append(bb.height)\n",
202-
">>>> dpi = a.get_figure().get_dpi()\n",
203-
".... abs_size = max(h_list)/dpi\n",
204-
"....\n",
205-
".... return rel_size, abs_size\n",
206-
"\n",
207-
"NEW dpi = a.figure.get_dpi()\n",
208-
"\n",
209-
"command: y\n",
210-
"\n",
211-
"L:806 @ /Users/RyanMorshead/Coding/GitHub/matplotlib/lib/mpl_toolkits/axes_grid1/colorbar.py\n",
212-
"\n",
213-
".... panchor = (0.5, 0.0)\n",
214-
".... parent.set_position(pb1)\n",
215-
".... parent.set_anchor(panchor)\n",
216-
">>>> fig = parent.get_figure()\n",
217-
".... cax = fig.add_axes(pbcb)\n",
218-
".... cax.set_aspect(aspect, anchor=anchor, adjustable='box')\n",
219-
".... return cax, kw\n",
220-
"\n",
221-
"NEW fig = parent.figure\n",
222-
"\n",
223-
"command: o\n",
224-
"y\n",
225-
"\n"
226-
]
227-
}
228-
],
30+
"outputs": [],
22931
"source": [
230-
"mrt.find_replacements()"
32+
"#mrt.find_replacements()"
23133
]
23234
},
23335
{
23436
"cell_type": "code",
235-
"execution_count": 15,
37+
"execution_count": 3,
23638
"metadata": {
23739
"collapsed": false
23840
},
239-
"outputs": [
240-
{
241-
"name": "stdout",
242-
"output_type": "stream",
243-
"text": [
244-
"execute all marked replacements (yes/no): yes\n"
245-
]
246-
}
247-
],
41+
"outputs": [],
24842
"source": [
249-
"mrt.perform_replacements()"
43+
"#mrt.perform_replacements()"
25044
]
25145
},
25246
{

0 commit comments

Comments
 (0)