Skip to content

Commit

Permalink
Updated CI to use pyproject.toml, ruff linter
Browse files Browse the repository at this point in the history
  • Loading branch information
sveinbjornt committed Sep 18, 2023
1 parent 345ad12 commit e845601
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@ name: tests

on:
push:
branches: [ master ]
branches:
- '*'
pull_request:
branches: [ master ]
branches:
- '*'

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8"]

steps:
- uses: actions/checkout@v2
Expand All @@ -22,13 +24,13 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip wheel setuptools pytest types-setuptools mypy
python -m pip install ".[dev]"
- name: Run mypy
run: |
mypy iceaddr/*.py
ruff src/iceaddr
- name: Test with pytest
run: |
python -m pytest
python -m pytest -vvv
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ dev = [
"pre-commit>=3.3.3",
"black>=23.7.0",
"mypy>=1.5.1",
"types-setuptools>=68.2.0",
"ruff>=0.0.285",
"coverage[toml]>=7.3.1",
]
Expand Down Expand Up @@ -135,7 +136,7 @@ section-order = [

[tool.ruff.isort.sections]
# Have typing libraries above other imports
typehints = ["typing", "typing_extensions", "types"]
typehints = ["typing", "typing_extensions", "types", "types-setuptools"]

# *** Build system configuration ***

Expand Down
6 changes: 3 additions & 3 deletions src/iceaddr/postcodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1428,9 +1428,9 @@ def _filter_postcodes(key: str, searchstr: str, partial: bool = False) -> List[i
for k, v in POSTCODES.items():
nf = v[k1].lower()
tgf = v[k2].lower()
if partial and (nf.startswith(p) or tgf.startswith(p)):
matches.append(k)
elif nf == p or tgf == p:
if (partial and (nf.startswith(p) or tgf.startswith(p))) or (
nf == p or tgf == p
):
matches.append(k)

return matches

0 comments on commit e845601

Please sign in to comment.