diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index dc73a2b..11337c2 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -10,9 +10,9 @@ jobs: python-version: [3.9] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} - name: Install dependencies diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 0f01569..fe87df1 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -10,9 +10,9 @@ jobs: python-version: [3.9] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -21,7 +21,7 @@ jobs: run: | pytest --cov=./ --cov-report=xml - name: Upload coverage to Codecov - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v3 with: file: ./coverage.xml directory: ./coverage/reports/ diff --git a/examples/multithreading_not_safe.py b/examples/multithreading_not_safe.py index 30b6021..83fde50 100644 --- a/examples/multithreading_not_safe.py +++ b/examples/multithreading_not_safe.py @@ -2,7 +2,7 @@ import threading import sys -from typing import List, Union +from typing import Union from forest.binary_trees import avl_tree from forest.binary_trees import binary_search_tree @@ -23,7 +23,7 @@ sys.setswitchinterval(0.0000001) -def insert_data(tree: TreeType, data: List) -> None: +def insert_data(tree: TreeType, data: list) -> None: """Insert data into a tree.""" for key in data: tree.insert(key=key, data=str(key)) diff --git a/examples/multithreading_not_safe_read_write.py b/examples/multithreading_not_safe_read_write.py index e2cf7d5..861cb17 100644 --- a/examples/multithreading_not_safe_read_write.py +++ b/examples/multithreading_not_safe_read_write.py @@ -2,7 +2,7 @@ import threading import sys -from typing import Any, List +from typing import Any from forest.binary_trees import avl_tree @@ -15,7 +15,7 @@ flag = False # Flag to determine if the read thread stops or continues. -def delete_data(tree: avl_tree.AVLTree, data: List) -> None: +def delete_data(tree: avl_tree.AVLTree, data: list) -> None: """Delete data from a tree.""" for key in data: tree.delete(key=key) diff --git a/examples/multithreading_performance.py b/examples/multithreading_performance.py index b0d3bc2..c3f60f0 100644 --- a/examples/multithreading_performance.py +++ b/examples/multithreading_performance.py @@ -2,12 +2,12 @@ import threading import time -from typing import List, Union +from typing import Union from forest.binary_trees import avl_tree from forest.binary_trees import atomic_trees -def query_data(tree: Union[atomic_trees.AVLTree, avl_tree.AVLTree], data: List) -> None: +def query_data(tree: Union[atomic_trees.AVLTree, avl_tree.AVLTree], data: list) -> None: """Query nodes from a tree.""" for key in data: tree.search(key=key) diff --git a/examples/multithreading_safe.py b/examples/multithreading_safe.py index a76b91d..16add33 100644 --- a/examples/multithreading_safe.py +++ b/examples/multithreading_safe.py @@ -2,7 +2,7 @@ import threading import sys -from typing import List, Union +from typing import Union from forest.binary_trees import atomic_trees from forest.binary_trees import traversal @@ -18,7 +18,7 @@ sys.setswitchinterval(0.0000001) -def insert_data(tree: TreeType, data: List) -> None: +def insert_data(tree: TreeType, data: list) -> None: """Insert data into a tree.""" for key in data: tree.insert(key=key, data=str(key)) diff --git a/examples/multithreading_safe_read_write.py b/examples/multithreading_safe_read_write.py index 847688d..8bd3d85 100644 --- a/examples/multithreading_safe_read_write.py +++ b/examples/multithreading_safe_read_write.py @@ -2,7 +2,7 @@ import threading import sys -from typing import Any, List +from typing import Any from forest.binary_trees import atomic_trees @@ -15,7 +15,7 @@ flag = False -def delete_data(tree: atomic_trees.AVLTree, data: List) -> None: +def delete_data(tree: atomic_trees.AVLTree, data: list) -> None: """Delete data from a tree.""" for key in data: tree.delete(key=key) diff --git a/forest/metrics.py b/forest/metrics.py index b2d8ba5..7aeaff9 100644 --- a/forest/metrics.py +++ b/forest/metrics.py @@ -6,7 +6,7 @@ import numpy as np -from typing import Dict, List, Union +from typing import Union class Counter: @@ -45,7 +45,7 @@ class Histogram: """A metric which calculates the distribution of a value.""" def __init__(self) -> None: - self._values: List[int] = list() + self._values: list[int] = list() def update(self, value: int) -> None: """Add a recorded value. @@ -57,7 +57,7 @@ def update(self, value: int) -> None: """ self._values.append(value) - def report(self) -> Dict: + def report(self) -> dict: """Return the histogram report.""" array = np.array(self._values) return { @@ -82,7 +82,7 @@ class MetricRegistry: """A registry for metric instances.""" def __init__(self) -> None: - self._registry: Dict[str, MetricType] = dict() + self._registry: dict[str, MetricType] = dict() def register(self, name: str, metric: MetricType) -> None: """Given a metric, register it under the given name. diff --git a/setup.py b/setup.py index a3df3c1..22d020d 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ # This call to setup() does all the work setuptools.setup( name="forest-python", - version="0.6.1", + version="0.6.2", description="The Forest Project in Python", long_description=README, long_description_content_type="text/x-rst", diff --git a/tests/test_atomic_trees.py b/tests/test_atomic_trees.py index 67df586..495362b 100644 --- a/tests/test_atomic_trees.py +++ b/tests/test_atomic_trees.py @@ -2,7 +2,7 @@ import sys import threading -from typing import Any, List, Union +from typing import Any, Union from forest.binary_trees import atomic_trees from forest.binary_trees import traversal @@ -21,13 +21,13 @@ ] -def insert_data(tree: TreeType, data: List) -> None: +def insert_data(tree: TreeType, data: list) -> None: """Insert data into a tree.""" for key in data: tree.insert(key=key, data=str(key)) -def delete_data(tree: TreeType, data: List) -> None: +def delete_data(tree: TreeType, data: list) -> None: """Delete data from a tree.""" for key in data: tree.delete(key=key)