Skip to content

Commit

Permalink
Remove pin on Pylint to support Python 3.11/3.12
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.12 virtual environment.
* Tweaked code and "pylintrc" files so that Pylint checks all pass.
* Add Python 3.11 and Python 3.12 to matrix in tests.yml.
* Publish using Python 3.12 in publish.yml.
* Closes #234.
  • Loading branch information
GraemeWatt committed Mar 28, 2024
1 parent eb392fe commit 10d5cd4
Show file tree
Hide file tree
Showing 12 changed files with 1,041 additions and 854 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: '3.12'
cache: pip
cache-dependency-path: '**/pyproject.toml'
- name: Install dependencies
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@ jobs:
matrix:
os: [ubuntu-latest]
root-version: ["6.24", "6.26", "6.28"]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
exclude:
- root-version: "6.24"
python-version: "3.10"
- root-version: "6.24"
python-version: "3.11"
- root-version: "6.24"
python-version: "3.12"
- root-version: "6.26"
python-version: "3.6"
- root-version: "6.26"
Expand Down Expand Up @@ -70,7 +74,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 10d5cd4

Please sign in to comment.