Skip to content

Commit

Permalink
Address new pylint 3.2.0 warnings (#733)
Browse files Browse the repository at this point in the history
Also use the new GitHub output formatting, so we can see the annotations in context in the "Files changed" tab (for example, bd42732 (#733)).
  • Loading branch information
yut23 committed May 16, 2024
1 parent 6b82659 commit 6b3fbe1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pylint
pip install 'pylint>=3.2.0'
- name: Install pynucastro
run: pip install .

- name: Validate
run: pylint pynucastro pynucastro/**/tests
run: pylint --output-format=github pynucastro pynucastro/**/tests
5 changes: 2 additions & 3 deletions pynucastro/networks/rate_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,7 @@ def evaluate_screening(self, rho, T, composition, screen_func):
# if we are doing symmetric screening
for r in scr.rates:
# use scor from the previous loop iteration
# pylint: disable-next=possibly-used-before-assignment
factors[r] = scor * scor2
else:
# there might be several rates that have the same
Expand Down Expand Up @@ -1668,7 +1669,6 @@ def plot_jacobian(self, rho, T, comp, *,

valid_max = np.abs(jac).max()

# pylint: disable-next=redundant-keyword-arg
norm = SymLogNorm(valid_max/rate_scaling, vmin=-valid_max, vmax=valid_max)

fig, ax = plt.subplots()
Expand Down Expand Up @@ -1714,7 +1714,6 @@ def plot_network_chart(self, rho=None, T=None, comp=None, *,
_ydot = np.asarray(_ydot)
valid_max = np.abs(_ydot[_ydot != 0]).max()

# pylint: disable-next=redundant-keyword-arg
norm = SymLogNorm(valid_max/1.e15, vmin=-valid_max, vmax=valid_max)

# if there are a lot of rates, we split the network chart into
Expand Down Expand Up @@ -1893,7 +1892,7 @@ def gridplot(self, comp=None, color_field="X", rho=None, T=None, **kwargs):

# Get figure, colormap
fig, ax = plt.subplots()
cmap = mpl.cm.get_cmap(cmap)
cmap = mpl.colormaps.get_cmap(cmap) # pylint: disable=no-member

# Get nuclei and all 3 numbers
nuclei = self.unique_nuclei
Expand Down
2 changes: 2 additions & 0 deletions pynucastro/neutrino_cooling/sneut5.py
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,7 @@ def sneut5(rho, T, comp=None, *, abar=None, zbar=None,

zeta = 1.579e5 * zbar * zbar * tempi

# pylint: disable-next=possibly-used-before-assignment
c00 = 1.0 / (1.0 + f1 * nu + f2 * nu2 + f3 * nu3)
dum = zeta * c00

Expand All @@ -743,6 +744,7 @@ def sneut5(rho, T, comp=None, *, abar=None, zbar=None,
c00 = a1 * z + a2 * dd00 + a3 * dd01

z = np.exp(c * nu)
# pylint: disable-next=possibly-used-before-assignment
dd00 = b * z * (1.0 + d * dum)
gum = 1.0 + dd00

Expand Down

0 comments on commit 6b3fbe1

Please sign in to comment.