Skip to content

Commit

Permalink
Merge pull request #34 from shunsvineyard/update
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
Shun Huang committed Nov 13, 2022
2 parents e418051 + 89ad862 commit 5645434
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/linting.yml
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/testing.yml
Expand Up @@ -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
Expand All @@ -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/
Expand Down
4 changes: 2 additions & 2 deletions examples/multithreading_not_safe.py
Expand Up @@ -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
Expand All @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions examples/multithreading_not_safe_read_write.py
Expand Up @@ -2,7 +2,7 @@
import threading
import sys

from typing import Any, List
from typing import Any

from forest.binary_trees import avl_tree

Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions examples/multithreading_performance.py
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions examples/multithreading_safe.py
Expand Up @@ -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
Expand All @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions examples/multithreading_safe_read_write.py
Expand Up @@ -2,7 +2,7 @@
import threading
import sys

from typing import Any, List
from typing import Any

from forest.binary_trees import atomic_trees

Expand All @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions forest/metrics.py
Expand Up @@ -6,7 +6,7 @@

import numpy as np

from typing import Dict, List, Union
from typing import Union


class Counter:
Expand Down Expand Up @@ -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.
Expand All @@ -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 {
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions tests/test_atomic_trees.py
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 5645434

Please sign in to comment.