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

Skip to content

Commit 9b3b675

Browse files
committed
Cleanup script avoids duplicating its own banner. (Still removes stale .py, .pdf.)
1 parent cfc8dd5 commit 9b3b675

File tree

9 files changed

+19
-167
lines changed

9 files changed

+19
-167
lines changed

cleanout.ipynb

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 3,
5+
"execution_count": 1,
66
"metadata": {},
77
"outputs": [],
88
"source": [
@@ -14,7 +14,7 @@
1414
},
1515
{
1616
"cell_type": "code",
17-
"execution_count": 12,
17+
"execution_count": 34,
1818
"metadata": {},
1919
"outputs": [],
2020
"source": [
@@ -57,41 +57,39 @@
5757
" # if os.path.exists(p / ):\n",
5858
" # child['src'] = tempname(child['src'])\n",
5959
"\n",
60-
" if child.name == 'body':\n",
61-
" # id=\"legacy-docs-banner\" class=\"warning\"\n",
60+
" if child.name == 'body': \n",
61+
" # expect to share stylesheet with class=\"warning\"\n",
6262
" banner = BS('''<div id=\"unreleased-message\"> \n",
6363
" You are reading documentation that no longer exists in the\n",
6464
" current release of Matplotlib! <a href=\"{}\">Try searching for\n",
6565
" an updated version?</a>\n",
6666
" </div>'''.format(search), 'html.parser')\n",
67-
" child.insert(0, banner)\n",
67+
" \n",
68+
" inject = True\n",
69+
" for div in child.children:\n",
70+
" if div.name == 'div' and div.attrs.get('id', 'none') \\\n",
71+
" == 'unreleased-message': \n",
72+
" div.replaceWith(banner)\n",
73+
" inject = False; break\n",
74+
" if inject:\n",
75+
" child.insert(0, banner)\n",
6876
"\n",
6977
" if not dry:\n",
7078
" with open(p/file, \"wt\") as g:\n",
7179
" g.write(str(parse))\n",
7280
" else:\n",
73-
" print( query )"
81+
" print( '' if inject else '(rerun)', query )"
7482
]
7583
},
7684
{
7785
"cell_type": "code",
78-
"execution_count": 13,
86+
"execution_count": 36,
7987
"metadata": {},
80-
"outputs": [
81-
{
82-
"name": "stdout",
83-
"output_type": "stream",
84-
"text": [
85-
"contourf log\n",
86-
"The Matplotlib Developers’ Guide\n",
87-
"matplotlib animation Animation save\n"
88-
]
89-
}
90-
],
88+
"outputs": [],
9189
"source": [
92-
"adjust('examples/images_contours_and_fields', 'contourf_log.html', dry=True)\n",
93-
"adjust('devel', 'index.html', True)\n",
94-
"adjust('api/_as_gen', 'matplotlib.animation.Animation.save.html', True)"
90+
"adjust('examples/images_contours_and_fields', 'contourf_log.html', dry=False)\n",
91+
"# adjust('devel', 'index.html', True)\n",
92+
"# adjust('api/_as_gen', 'matplotlib.animation.Animation.save.html', True)"
9593
]
9694
},
9795
{

mpl_examples/color/colormaps_reference.py

Lines changed: 0 additions & 93 deletions
This file was deleted.
-22.1 KB
Binary file not shown.

users/path_tutorial-1.pdf

-5.03 KB
Binary file not shown.

users/path_tutorial-1.py

Lines changed: 0 additions & 28 deletions
This file was deleted.

users/recipes-2.py

Lines changed: 0 additions & 14 deletions
This file was deleted.

users/recipes-4.pdf

-35.6 KB
Binary file not shown.

users/tight_layout_guide-11.py

Lines changed: 0 additions & 11 deletions
This file was deleted.

users/whats_new-3.pdf

-7.19 KB
Binary file not shown.

0 commit comments

Comments
 (0)