Skip to content

apply PEP-8 throughout the codebase #96

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

Merged
merged 3 commits into from
Nov 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[flake8]
ignore = E20,E22,E501,E701,F401,W

[pep8]
select = E12,E231,E241,E251,E26,E30
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ repos:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/pycqa/flake8
rev: 4.0.1
hooks:
- id: flake8
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
html_title = 'Visualization with Python'
project = "Matplotlib cheatsheets"
copyright = (
f"2012 - {datetime.datetime.now().year} The Matplotlib development team"
)
f"2012 - {datetime.datetime.now().year} The Matplotlib development team"
)
author = "Matplotlib Developers"

# -- General configuration ---------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions logos/mpl-logos2.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ def make_logo(height_px, lw_bars, lw_grid, lw_border, rgrid, with_text=False):

return fig, ax


##############################################################################
# A large logo:

Expand Down
4 changes: 3 additions & 1 deletion requirements/requirements.in
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
autopep8
bump2version
cartopy==0.19.0.post1
flake8
matplotlib==3.4.2
mpl-sphinx-theme
pdfx
pip-tools
pre-commit
scipy
sphinx
mpl-sphinx-theme

--no-binary shapely
27 changes: 26 additions & 1 deletion requirements/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with python 3.9
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile requirements.in
Expand All @@ -10,6 +10,8 @@ alabaster==0.7.12
# via sphinx
appdirs==1.4.4
# via virtualenv
autopep8==1.6.0
# via -r requirements.in
babel==2.9.1
# via sphinx
beautifulsoup4==4.9.3
Expand Down Expand Up @@ -44,12 +46,20 @@ docutils==0.17.1
# sphinx
filelock==3.0.12
# via virtualenv
flake8==4.0.1
# via -r requirements.in
identify==2.2.2
# via pre-commit
idna==3.3
# via requests
imagesize==1.2.0
# via sphinx
importlib-metadata==4.2.0
# via
# flake8
# pep517
# pre-commit
# virtualenv
jinja2==3.0.2
# via sphinx
kiwisolver==1.3.1
Expand All @@ -58,6 +68,8 @@ markupsafe==2.0.1
# via jinja2
matplotlib==3.4.2
# via -r requirements.in
mccabe==0.6.1
# via flake8
mpl-sphinx-theme==0.0.6
# via -r requirements.in
nodeenv==1.5.0
Expand All @@ -81,10 +93,16 @@ pip-tools==6.1.0
# via -r requirements.in
pre-commit==2.11.1
# via -r requirements.in
pycodestyle==2.8.0
# via
# autopep8
# flake8
pycparser==2.20
# via cffi
pydata-sphinx-theme==0.7.1
# via mpl-sphinx-theme
pyflakes==2.4.0
# via flake8
pygments==2.10.0
# via sphinx
pyparsing==2.4.7
Expand Down Expand Up @@ -134,12 +152,19 @@ sphinxcontrib-serializinghtml==1.1.5
# via sphinx
toml==0.10.2
# via
# autopep8
# pep517
# pre-commit
typing-extensions==4.0.0
# via importlib-metadata
urllib3==1.26.7
# via requests
virtualenv==20.4.3
# via pre-commit
zipp==3.6.0
# via
# importlib-metadata
# pep517

# The following packages are considered to be unsafe in a requirements file:
# pip
Expand Down
50 changes: 25 additions & 25 deletions scripts/adjustements.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,39 @@


fig = plt.figure(figsize=(4.25, 4.25 * 95/115))
ax = fig.add_axes([0,0,1,1], frameon=False, aspect=1,
xlim=(0-5,100+10), ylim=(-10,80+5), xticks=[], yticks=[])
ax = fig.add_axes([0, 0, 1, 1], frameon=False, aspect=1,
xlim=(0-5, 100+10), ylim=(-10, 80+5), xticks=[], yticks=[])


box = mpatches.FancyBboxPatch(
(0,0), 100, 83, mpatches.BoxStyle("Round", pad=0, rounding_size=2),
(0, 0), 100, 83, mpatches.BoxStyle("Round", pad=0, rounding_size=2),
linewidth=1., facecolor="0.9", edgecolor="black")
ax.add_artist(box)

box = mpatches.FancyBboxPatch(
(0,0), 100, 75, mpatches.BoxStyle("Round", pad=0, rounding_size=0),
(0, 0), 100, 75, mpatches.BoxStyle("Round", pad=0, rounding_size=0),
linewidth=1., facecolor="white", edgecolor="black")
ax.add_artist(box)


box = mpatches.Rectangle(
(5,5), 45, 30, zorder=10,
(5, 5), 45, 30, zorder=10,
linewidth=1.0, facecolor="white", edgecolor="black")
ax.add_artist(box)

box = mpatches.Rectangle(
(5,40), 45, 30, zorder=10,
(5, 40), 45, 30, zorder=10,
linewidth=1.0, facecolor="white", edgecolor="black")
ax.add_artist(box)

box = mpatches.Rectangle(
(55,5), 40, 65, zorder=10,
(55, 5), 40, 65, zorder=10,
linewidth=1.0, facecolor="white", edgecolor="black")
ax.add_artist(box)

# Window button
X, Y = [5,10,15], [79,79,79]
plt.scatter(X, Y, s=75, zorder=10,
X, Y = [5, 10, 15], [79, 79, 79]
plt.scatter(X, Y, s=75, zorder=10,
edgecolor="black", facecolor="white", linewidth=1)


Expand All @@ -60,7 +60,7 @@
plt.plot(X, Y, color="black", linestyle=":", linewidth=1, clip_on=False)


def ext_arrow(p0,p1,p2,p3):
def ext_arrow(p0, p1, p2, p3):
p0, p1 = np.asarray(p0), np.asarray(p1)
p2, p3 = np.asarray(p2), np.asarray(p3)
ax.arrow(*p0, *(p1-p0), zorder=20, linewidth=0,
Expand All @@ -69,9 +69,10 @@ def ext_arrow(p0,p1,p2,p3):
ax.arrow(*p3, *(p2-p3), zorder=20, linewidth=0,
length_includes_head=True, width=.4,
head_width=2, head_length=2, color="black")
plt.plot([p1[0],p2[0]], [p1[1],p2[1]], linewidth=.9, color="black")
plt.plot([p1[0], p2[0]], [p1[1], p2[1]], linewidth=.9, color="black")

def int_arrow(p0,p1):

def int_arrow(p0, p1):
p0, p1 = np.asarray(p0), np.asarray(p1)
ax.arrow(*((p0+p1)/2), *((p1-p0)/2), zorder=20, linewidth=0,
length_includes_head=True, width=.4,
Expand All @@ -81,48 +82,47 @@ def int_arrow(p0,p1):
head_width=2, head_length=2, color="black")



x = 0
y = 10
ext_arrow( (x-4,y), (x,y), (x+5,y), (x+9,y) )
ext_arrow( (x-4, y), (x, y), (x+5, y), (x+9, y) )
ax.text(x+9.5, y, "left", ha="left", va="center", size="x-small", zorder=20)

x += 50
ext_arrow( (x-4,y), (x,y), (x+5,y), (x+9,y) )
ext_arrow( (x-4, y), (x, y), (x+5, y), (x+9, y) )
ax.text(x-4.5, y, "wspace", ha="right", va="center", size="x-small", zorder=20)

x += 45
ext_arrow( (x-4,y), (x,y), (x+5,y), (x+9,y) )
ext_arrow( (x-4, y), (x, y), (x+5, y), (x+9, y) )
ax.text(x-4.5, y, "right", ha="right", va="center", size="x-small", zorder=20)

y = 0
x = 25
ext_arrow( (x,y-4), (x,y), (x,y+5), (x,y+9) )
ext_arrow( (x, y-4), (x, y), (x, y+5), (x, y+9) )
ax.text(x, y+9.5, "bottom", ha="center", va="bottom", size="x-small", zorder=20)

y += 35
ext_arrow( (x,y-4), (x,y), (x,y+5), (x,y+9) )
ext_arrow( (x, y-4), (x, y), (x, y+5), (x, y+9) )
ax.text(x, y-4.5, "hspace", ha="center", va="top", size="x-small", zorder=20)

y += 35
ext_arrow( (x,y-4), (x,y), (x,y+5), (x,y+9) )
ext_arrow( (x, y-4), (x, y), (x, y+5), (x, y+9) )
ax.text(x, y-4.5, "top", ha="center", va="top", size="x-small", zorder=20)

int_arrow((0,-5), (100,-5))
int_arrow((0, -5), (100, -5))
ax.text(50, -5, "figure width", backgroundcolor="white", zorder=30,
ha="center", va="center", size="x-small")

int_arrow((105,0), (105,75))
int_arrow((105, 0), (105, 75))
ax.text(105, 75/2, "figure height", backgroundcolor="white", zorder=30,
rotation = "vertical", ha="center", va="center", size="x-small")
rotation="vertical", ha="center", va="center", size="x-small")

int_arrow((55,62.5), (95,62.5))
int_arrow((55, 62.5), (95, 62.5))
ax.text(75, 62.5, "axes width", backgroundcolor="white", zorder=30,
ha="center", va="center", size="x-small")

int_arrow((62.5,5), (62.5,70))
int_arrow((62.5, 5), (62.5, 70))
ax.text(62.5, 35, "axes height", backgroundcolor="white", zorder=30,
rotation = "vertical", ha="center", va="center", size="x-small")
rotation="vertical", ha="center", va="center", size="x-small")


plt.savefig("../figures/adjustments.pdf")
Expand Down
Loading