Skip to content
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

Travis: Enforce PEP8 #2145

Merged
merged 3 commits into from
Jul 25, 2017
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
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
language: cpp
sudo: false

addons:
apt:
packages:
- python-flake8

script:
#############################################################################
# Disallow PRs to `ComputationalRadiationPhysics/picongpu` branch `master` #
Expand Down Expand Up @@ -35,3 +40,8 @@ script:
# Disallow spaces before pre-compiler macros #
#############################################################################
- test/hasSpaceBeforePrecompiler

#############################################################################
# Test Python Files for PEP8 conformance #
#############################################################################
- flake8 --exclude=thirdParty .
51 changes: 27 additions & 24 deletions docs/propose_changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,38 +27,40 @@
print(m_list[m_sel], milestones[m_sel].number)

# get pulls (all pulls are also issues but not vice versa)
issues = repo.get_issues(state="closed", sort="updated", direction="asc", milestone=milestones[m_sel])
issues = repo.get_issues(state="closed", sort="updated", direction="asc",
milestone=milestones[m_sel])
# Use this in the future, but pagination seems broken in it:
#search_string = 'repo:ComputationalRadiationPhysics/picongpu type:pr is:merged milestone:"'+milestones[m_sel].title+'"'
#print(search_string)
#issues = g.search_issues(search_string)
# search_string = 'repo:ComputationalRadiationPhysics/picongpu ' +
# 'type:pr is:merged milestone:"'+milestones[m_sel].title+'"'
# print(search_string)
# issues = g.search_issues(search_string)


# categories
bugs = {
"core": [],
"pmacc": [],
"plugin": [],
"tools": [],
"other": []
"core": [],
"pmacc": [],
"plugin": [],
"tools": [],
"other": []
}
features = {
"core": [],
"pmacc": [],
"plugin": [],
"tools": [],
"other": []
"core": [],
"pmacc": [],
"plugin": [],
"tools": [],
"other": []
}
refactoring = {
"core": [],
"pmacc": [],
"plugin": [],
"tools": [],
"other": []
"core": [],
"pmacc": [],
"plugin": [],
"tools": [],
"other": []
}
misc = {
"docs": [],
"other": []
"docs": [],
"other": []
}

for i in issues:
Expand All @@ -70,19 +72,20 @@
pr_nr = i.number
pr_labels = i.labels
pr_labels_names = map(lambda l: l.name, pr_labels)
pr_url = "https://github.com/ComputationalRadiationPhysics/picongpu/pull/"
if "bug" in pr_labels_names:
if not "affects latest release" in pr_labels_names:
if "affects latest release" not in pr_labels_names:
print("Filtering out development-only bug:")
print(" #" + str(pr_nr) + " " + i.title)
print(" https://github.com/ComputationalRadiationPhysics/picongpu/pull/" + str(pr_nr))
print(" " + pr_url + str(pr_nr))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: str is not neccesary.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

python2:

$ print(" aaa" + 3)
TypeError
----> 1 print(" aaa" + 3)

TypeError: cannot concatenate 'str' and 'int' objects

python3:

$ print(" aaa" + 3)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-1-cd690000aed7> in <module>()
----> 1 print(" aaa" + 3)

TypeError: Can't convert 'int' object to str implicitly

continue

# filter out closed (unmerged) PRs
pr = repo.get_pull(pr_nr)
if not pr.merged:
print("Filtering out unmerged PR:")
print(" #" + str(pr_nr) + " " + i.title)
print(" https://github.com/ComputationalRadiationPhysics/picongpu/pull/" + str(pr_nr))
print(" " + pr_url + str(pr_nr))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: str is not neccesary.

continue

# sort by categories
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import matplotlib as mpl
from matplotlib import pyplot as plt
from scipy.misc import factorial as mfac
from scipy.special import gamma as gam
import numpy as np


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
License: GPLv3+
"""
import matplotlib as mpl
import numpy as np
from energy_histogram import EnergyHistogram


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
License: GPLv3+
"""
import matplotlib as mpl
import numpy as np
from particle_calorimeter import ParticleCalorimeter


Expand Down
26 changes: 13 additions & 13 deletions share/picongpu/examples/ThermalTest/tools/dispersion.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@

# _________________________________________

from numpy import *
import numpy as np
from matplotlib import pyplot as plt
from matplotlib.ticker import FormatStrFormatter

data_trans = loadtxt("eField_zt_trans.dat")
data_long = loadtxt("eField_zt_long.dat")
data_trans = np.loadtxt("eField_zt_trans.dat")
data_long = np.loadtxt("eField_zt_long.dat")

N_z = len(data_trans[:, 0])
N_t = len(data_trans[0, :])

omega_max = pi*(N_t-1)/(N_t*delta_t)/omega_plasma
k_max = pi * (N_z-1)/(N_z*delta_z)
omega_max = np.pi*(N_t-1)/(N_t*delta_t)/omega_plasma
k_max = np.pi * (N_z-1)/(N_z*delta_z)

# __________________transversal plot______________________

Expand All @@ -51,15 +51,15 @@
plt.xlabel(r"$k [1/m]$")
plt.ylabel(r"$\omega / \omega_{pe} $")

data_trans = fft.fftshift(fft.fft2(data_trans))
data_trans = np.fft.fftshift(np.fft.fft2(data_trans))

plt.imshow(abs(data_trans), extent=(-k_max, k_max, -omega_max, omega_max),
plt.imshow(np.abs(data_trans), extent=(-k_max, k_max, -omega_max, omega_max),
aspect='auto', interpolation='nearest')
plt.colorbar()

# plot analytical dispersion relation
x = linspace(-k_max, k_max, 200)
y = sqrt(c**2 * x**2 + omega_plasma**2)/omega_plasma
x = np.linspace(-k_max, k_max, 200)
y = np.sqrt(c**2 * x**2 + omega_plasma**2)/omega_plasma
plt.plot(x, y, 'r--', linewidth=1)

# ___________________longitudinal plot_____________________
Expand All @@ -71,15 +71,15 @@
plt.xlabel(r"$k [1/m]$")
plt.ylabel(r"$\omega / \omega_{pe} $")

data_long = fft.fftshift(fft.fft2(data_long))
data_long = np.fft.fftshift(np.fft.fft2(data_long))

plt.imshow(abs(data_long), extent=(-k_max, k_max, -omega_max, omega_max),
plt.imshow(np.abs(data_long), extent=(-k_max, k_max, -omega_max, omega_max),
aspect='auto', interpolation='nearest')
plt.colorbar()

# plot analytical dispersion relation
x = linspace(-k_max, k_max, 200)
y = sqrt(3 * v_th**2 * x**2 + omega_plasma**2)/omega_plasma
x = np.linspace(-k_max, k_max, 200)
y = np.sqrt(3 * v_th**2 * x**2 + omega_plasma**2)/omega_plasma
plt.plot(x, y, 'r--', linewidth=1)

plt.show()
Loading