Skip to content

Commit

Permalink
python_requires >=3.7, test 3.11
Browse files Browse the repository at this point in the history
add pyupgrade to pre-commit
  • Loading branch information
dhimmel committed Nov 10, 2022
1 parent b53128c commit 6a06395
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ jobs:
- windows-latest
- macOS-latest
python-version:
- "3.6"
- "3.8"
- "3.7"
- "3.11"
networkx-version:
- "1.*"
- "2.*"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -30,6 +30,6 @@ jobs:
python -m pip install --upgrade pip
pip install ".[dev]"
- name: Run pre-commit
uses: pre-commit/action@v2.0.0
uses: pre-commit/action@v3.0.0
- name: Test with pytest
run: pytest --color=yes
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ repos:
- id: mixed-line-ending
- id: check-case-conflict
- id: check-yaml
- repo: https://github.com/asottile/pyupgrade
rev: v3.2.1
hooks:
- id: pyupgrade
args: [--py37-plus]
- repo: https://github.com/timothycrosley/isort
rev: 5.10.1
hooks:
Expand Down
3 changes: 0 additions & 3 deletions obonet/io.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import importlib
import io
import mimetypes
import pathlib
import re
from urllib.request import urlopen

Expand All @@ -16,8 +15,6 @@ def open_read_file(path):
# Convert pathlike objects to string paths
if hasattr(path, "__fspath__"):
path = path.__fspath__()
elif isinstance(path, pathlib.Path):
path = str(path) # For Python 3.4 and 3.5

if not isinstance(path, str):
# Passthrough open file buffers without modification
Expand Down
2 changes: 1 addition & 1 deletion obonet/read.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def parse_tag_line(line):
"""
match = re.match(tag_line_pattern, line)
if match is None:
message = "Tag-value pair parsing failed for:\n{}".format(line)
message = f"Tag-value pair parsing failed for:\n{line}"
raise ValueError(message)
tag = match.group("tag")
value = match.group("value")
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ keywords =
packages = obonet
zip_safe = False
include_package_data = True
python_requires = >=3.5
python_requires = >=3.7
install_requires =
networkx

Expand Down
4 changes: 2 additions & 2 deletions tests/test_obo_reading.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_read_taxrank_file():
"""
pytest.importorskip("networkx", minversion="2.0")
path = os.path.join(directory, "data", "taxrank.obo")
with open(path, "rt") as read_file:
with open(path) as read_file:
taxrank = obonet.read_obo(read_file)
assert len(taxrank) == 61
assert taxrank.nodes["TAXRANK:0000001"]["name"] == "phylum"
Expand Down Expand Up @@ -65,7 +65,7 @@ def test_read_obo(ontology):
"""
Test that reading ontology does not error.
"""
url = "http://purl.obolibrary.org/obo/{}.obo".format(ontology)
url = f"http://purl.obolibrary.org/obo/{ontology}.obo"
graph = obonet.read_obo(url)
assert graph

Expand Down

0 comments on commit 6a06395

Please sign in to comment.