Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Python >= 3.8 #33

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/formatting-and-pyright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4
Expand Down
21 changes: 10 additions & 11 deletions filecheck/matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,15 +370,14 @@ def _approximate_uop_length(self, uops: Sequence[UOp]) -> int:
"""
count = 0
for op in uops:
match op:
case Subst(variable):
count += len(str(self.ctx.live_variables.get(variable, "")))
case Literal(content):
count += len(content)
case RE(content):
count += len(content)
case Capture(pattern):
count += len(pattern)
case _:
continue
if isinstance(op, Subst):
count += len(str(self.ctx.live_variables.get(op.variable, "")))
elif isinstance(op, Literal):
count += len(op.content)
elif isinstance(op, RE):
count += len(op.content)
elif isinstance(op, Capture):
count += len(op.pattern)
else:
continue
return count
4 changes: 2 additions & 2 deletions filecheck/ops.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from __future__ import annotations

from dataclasses import dataclass, field
from typing import Callable, TypeAlias
from typing import Callable

from filecheck.options import Options

OP_KINDS = ("DAG", "COUNT", "NOT", "EMPTY", "NEXT", "SAME", "LABEL", "CHECK")

VALUE_MAPPER_T: TypeAlias = Callable[[str], int] | Callable[[str], str]
VALUE_MAPPER_T = Callable[[str], int] | Callable[[str], str]


@dataclass(slots=True)
Expand Down
11 changes: 6 additions & 5 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ packages = [
]

[tool.poetry.dependencies]
python = "^3.10"
python = "^3.8"

[tool.poetry.group.dev.dependencies]
black = "^24.4.2"
lit = "^18.1.8"
pre-commit = "^3.7.1"
pre-commit = { version = "^3.7.1", python = "^3.9" }
pyright = "^1.1.370"
pytest = "^8.2.2"

Expand Down
Loading