From 599fffffa5694ce8127ba27189bfe3adcc02b722 Mon Sep 17 00:00:00 2001 From: Marcello Perathoner Date: Sun, 24 Sep 2023 17:17:41 +0200 Subject: [PATCH] fix github test action --- .github/workflows/python-package.yml | 4 ++-- .gitignore | 1 + Makefile | 5 +---- pyproject.toml | 2 +- src/suffix_tree/builder.py | 4 ++-- src/suffix_tree/tree.py | 8 ++++---- 6 files changed, 11 insertions(+), 13 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index cf8d692..30f9f8d 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -25,6 +25,6 @@ jobs: - name: Install dependencies run: | make install - - name: Run tox + - name: Run tests run: | - make tox-e + make test diff --git a/.gitignore b/.gitignore index b6b39ae..7b4238f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ pylintgraph.dot .mypy_cache/ .pytest_cache/ +.venv/ .vscode/ # Byte-compiled / optimized / DLL files diff --git a/Makefile b/Makefile index 017eb43..d4e6be6 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ .PHONY: lint test dist upload docs -ENV=env +ENV=.venv BIN=$(ENV)/bin/ DIRS=src/ tests/unit/ tests/performance/ scripts/ docs/ BROWSER=firefox @@ -54,9 +54,6 @@ badges: test coverage tox: $(BIN)tox -tox-e: - $(BIN)tox -e py - dist: clean test coverage badges $(BIN)python -m build $(BIN)twine check dist/* diff --git a/pyproject.toml b/pyproject.toml index e32035c..f062d5c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -88,5 +88,5 @@ skip_missing_interpreters = True [testenv] allowlist_externals = make deps = pytest -commands = make test +commands = make BIN= test """ diff --git a/src/suffix_tree/builder.py b/src/suffix_tree/builder.py index c22e368..9da9b65 100644 --- a/src/suffix_tree/builder.py +++ b/src/suffix_tree/builder.py @@ -14,7 +14,7 @@ class Builder: def __init__(self): self.root: Internal self.id: Id - self.progress: Optional[Callable[[int], None]] | None = None + self.progress: Optional[Callable[[int], None]] = None self.progress_tick = 1 def build(self, root: Internal, id_: Id, S: IterSymbols) -> None: @@ -22,7 +22,7 @@ def build(self, root: Internal, id_: Id, S: IterSymbols) -> None: raise NotImplementedError() def set_progress_function( - self, tick: int, callback: Callable[[int], None] | None = None + self, tick: int, callback: Optional[Callable[[int], None]] = None ): """Set a progress indicator callback function. diff --git a/src/suffix_tree/tree.py b/src/suffix_tree/tree.py index e8dd305..563ee31 100644 --- a/src/suffix_tree/tree.py +++ b/src/suffix_tree/tree.py @@ -2,13 +2,13 @@ import collections import itertools -from typing import Optional, Union, Tuple, List, Dict +from typing import Dict, List, Optional, Tuple, Union from . import lca_mixin from .builder import Builder from .builder_factory import builder_factory -from .node import Node, Internal -from .util import Path, UniqueEndChar, Id, Symbols +from .node import Internal, Node +from .util import Id, Path, Symbols, UniqueEndChar # builder_type: TypeAlias = Union[Builder, type, str, None] builder_type = Union[Builder, type, str, None] @@ -51,7 +51,7 @@ class Tree(lca_mixin.Tree): def __init__( self, - data: Dict[Id, Symbols] | None = None, + data: Optional[Dict[Id, Symbols]] = None, *, builder: builder_type = None, ):