Skip to content

Commit

Permalink
Remove pin on Pylint to support Python 3.11
Browse files Browse the repository at this point in the history
* pylintrc and tests/pylintrc generated with Pylint 3.1.0 by running
  "pylint --generate-rcfile" in a Python 3.11 virtual environment.
* Tweaked code and "pylintrc" files so that Pylint checks all pass.
* Add Python 3.11 and ROOT 6.30 to matrix in tests.yml.
* ROOT binary built with Python 3.12 not yet supported by Micromamba.
* Closes #234.
  • Loading branch information
GraemeWatt committed Mar 28, 2024
1 parent eb392fe commit fdb6b5e
Show file tree
Hide file tree
Showing 11 changed files with 1,046 additions and 856 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,31 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
root-version: ["6.24", "6.26", "6.28"]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
root-version: ["6.24", "6.26", "6.28", "6.30"]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
exclude:
- root-version: "6.24"
python-version: "3.10"
- root-version: "6.24"
python-version: "3.11"
- root-version: "6.26"
python-version: "3.6"
- root-version: "6.26"
python-version: "3.7"
- root-version: "6.26"
python-version: "3.11"
- root-version: "6.28"
python-version: "3.6"
- root-version: "6.28"
python-version: "3.7"
- root-version: "6.30"
python-version: "3.6"
- root-version: "6.30"
python-version: "3.7"
include:
- os: macos-latest
root-version: "6.28"
python-version: "3.10"
root-version: "6.30"
python-version: "3.11"

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -70,7 +78,7 @@ jobs:
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade \
'pylint==2.9.6' \
'pylint' \
pytest_pylint \
configparser \
astroid \
Expand Down
5 changes: 0 additions & 5 deletions hepdata_lib/c_file_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ def get_graphs(self):

def create_tgraph_dict(self, graph_list, list_of_tgraphs):
"""Function to create pyroot TGraph dict"""
# pylint: disable=no-self-use

# Adding tgraphs into a dictionary
y_values = []
Expand All @@ -100,7 +99,6 @@ def create_tgraph_dict(self, graph_list, list_of_tgraphs):

def create_tgrapherrors_dict(self, graph_list):
"""Function to create pyroot TGraphErrors dict"""
# pylint: disable=no-self-use

# Adding TGraphErrors into a dictionary
y_values = []
Expand Down Expand Up @@ -135,7 +133,6 @@ def create_tgrapherrors_dict(self, graph_list):

def create_tgrapherrors(self, x_value, y_value, dx_value, dy_value):
"""Function to create pyroot TGraphErrors object"""
# pylint: disable=no-self-use

# Creating pyroot TGraphErrors object
x_values = array('i')
Expand Down Expand Up @@ -171,7 +168,6 @@ def create_tgrapherrors(self, x_value, y_value, dx_value, dy_value):

def create_tgraph(self, x_value, y_value):
"""Function to create pyroot TGraph object"""
# pylint: disable=no-self-use

# Creating pyroot TGraph object
x_values = array('i')
Expand All @@ -197,7 +193,6 @@ def create_tgraph(self, x_value, y_value):

def check_for_comments(self, line):
"""Check line for comment"""
# pylint: disable=no-self-use

_line = line
ignoreline = 0
Expand Down
16 changes: 8 additions & 8 deletions hepdata_lib/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ def execute_command(command):
:type command: string
"""

subprocess_args = dict(
args=command,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=True,
universal_newlines=True
)
subprocess_args = {
"args": command,
"stdin": subprocess.PIPE,
"stdout": subprocess.PIPE,
"stderr": subprocess.PIPE,
"shell": True,
"universal_newlines": True
}
with subprocess.Popen(**subprocess_args) as proc:
exit_code = proc.wait()
if exit_code == 127:
Expand Down
4 changes: 2 additions & 2 deletions hepdata_lib/root_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ def get_hist_2d_points(hist, **kwargs):
ixmax = hist.GetXaxis().FindBin(xlim[1]) if xlim[1] is not None else hist.GetNbinsX() + 1
iymin = hist.GetYaxis().FindBin(ylim[0]) if ylim[0] is not None else 1
iymax = hist.GetYaxis().FindBin(ylim[1]) if ylim[1] is not None else hist.GetNbinsY() + 1
symmetric = (hist.GetBinErrorOption() == r.TH1.kNormal)
symmetric = hist.GetBinErrorOption() == r.TH1.kNormal
if force_symmetric_errors:
symmetric = True
for x_bin in range(ixmin, ixmax):
Expand Down Expand Up @@ -388,7 +388,7 @@ def get_hist_1d_points(hist, **kwargs):
for key in ["x", "y", "x_edges", "x_labels", "dy"]:
points[key] = []

symmetric = (hist.GetBinErrorOption() == r.TH1.kNormal)
symmetric = hist.GetBinErrorOption() == r.TH1.kNormal
if force_symmetric_errors:
symmetric = True
ixmin = hist.GetXaxis().FindBin(xlim[0]) if xlim[0] is not None else 1
Expand Down
Loading

0 comments on commit fdb6b5e

Please sign in to comment.