Skip to content

Commit

Permalink
Merge pull request #75 from python-thread/fix/typechecking-error-for-…
Browse files Browse the repository at this point in the history
…valid

Fix: Static typechecking behaving weirdly
  • Loading branch information
caffeine-addictt authored Mar 17, 2024
2 parents e76db77 + 9f36b84 commit 8f1ad08
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 39 deletions.
10 changes: 5 additions & 5 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ identifiers:
value: 10.5281/zenodo.10799219
description: This is the collection of archived snapshots of all versions of thread.
- type: url
value: https://github.com/python-thread/thread/releases/tag/v1.1.0
description: The GitHub release URL of tag v1.1.0.
value: https://github.com/python-thread/thread/releases/tag/v1.1.1
description: The GitHub release URL of tag v1.1.1.
- type: url
value: https://pypi.org/project/thread/1.1.0
description: The PyPI release URL of tag v1.1.0.
value: https://pypi.org/project/thread/1.1.1
description: The PyPI release URL of tag v1.1.1.
cff-version: 1.2.0
date-released: 2024-03-07
keywords:
Expand All @@ -32,6 +32,6 @@ repository-code: https://github.com/python-thread/thread
repository-artifact: https://pypi.org/project/thread
title: thread
type: software
version: 1.1.0
version: 1.1.1
url: https://thread.ngjx.org

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Our docs are [here!](https://thread.ngjx.org)
<!-- ROADMAP -->
## Roadmap

- [x] v1.1.0 Release
- [x] v1.1.1 Release
- [ ] Bug fixes
- [ ] New features
- [ ] Testing
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "thread"
version = "1.1.0"
version = "1.1.1"
description = "Threading module extension"
authors = ["Alex <[email protected]>"]
license = "BSD-3-Clause"
Expand Down Expand Up @@ -30,7 +30,7 @@ classifiers = [

[tool.poetry.urls]
Homepage = "https://thread.ngjx.org"
Documentation = "https://thread.ngjx.org/docs/v1.1.0"
Documentation = "https://thread.ngjx.org/docs/v1.1.1"
Source = "https://github.com/python-thread/thread"
Download = "https://pypi.org/project/thread/#files"
"Release Notes" = "https://github.com/python-thread/thread/releases"
Expand Down
4 changes: 2 additions & 2 deletions src/thread/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
## Thread Library
Documentation at https://thread.ngjx.org/docs/v1.1.0
Documentation at https://thread.ngjx.org/docs/v1.1.1
---
Expand All @@ -18,7 +18,7 @@
"""


__version__ = '1.1.0'
__version__ = '1.1.1'


# Export Core
Expand Down
7 changes: 6 additions & 1 deletion src/thread/_types.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
## Types
Documentation: https://thread.ngjx.org/docs/v1.1.0
Documentation: https://thread.ngjx.org/docs/v1.1.1
"""

from typing import Any, Literal, Callable, Union, Sized
Expand Down Expand Up @@ -62,3 +62,8 @@ class SupportsGetItem(Protocol[_SupportsGetItem_T]):
@runtime_checkable
class SupportsLengthGetItem(Sized, Protocol[_SupportsGetItem_T]):
__getitem__: Callable[..., _SupportsGetItem_T]


LengthLike_T = TypeVar('LengthLike_T', bound=SupportsLength)
GetLike_T = TypeVar('GetLike_T', bound=SupportsGetItem)
LengthandGetLike_T = TypeVar('LengthandGetLike_T', bound=SupportsLengthGetItem)
2 changes: 1 addition & 1 deletion src/thread/decorators/_processor.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
## Processor
Documentation: https://thread.ngjx.org/docs/v1.1.0
Documentation: https://thread.ngjx.org/docs/v1.1.1
"""

from functools import wraps
Expand Down
2 changes: 1 addition & 1 deletion src/thread/decorators/_threaded.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
## Threaded
Documentation: https://thread.ngjx.org/docs/v1.1.0
Documentation: https://thread.ngjx.org/docs/v1.1.1
"""

from functools import wraps
Expand Down
2 changes: 1 addition & 1 deletion src/thread/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
## Thread Exceptions
Documentation: https://thread.ngjx.org/docs/v1.1.0
Documentation: https://thread.ngjx.org/docs/v1.1.1
"""

import traceback
Expand Down
42 changes: 17 additions & 25 deletions src/thread/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Thread: ...
class ParallelProcessing: ...
```
Documentation: https://thread.ngjx.org/docs/v1.1.0
Documentation: https://thread.ngjx.org/docs/v1.1.1
"""

import sys
Expand Down Expand Up @@ -36,6 +36,9 @@ class ParallelProcessing: ...
SupportsLength,
SupportsGetItem,
SupportsLengthGetItem,
LengthLike_T,
GetLike_T,
LengthandGetLike_T,
)
from typing_extensions import Generic
from typing import (
Expand Down Expand Up @@ -369,15 +372,11 @@ class ParallelProcessing(Generic[_Target_P, _Target_T, _Dataset_T]):
def __init__(
self,
function: DatasetFunction[_Dataset_T, _Target_P, _Target_T],
dataset: SupportsLengthGetItem[_Dataset_T],
dataset: LengthandGetLike_T,
max_threads: int = 8,
*overflow_args: Overflow_In,
_get_value: Optional[
Callable[[SupportsLengthGetItem[_Dataset_T], int], _Dataset_T]
] = None,
_length: Optional[
Union[int, Callable[[SupportsLengthGetItem[_Dataset_T]], int]]
] = None,
_get_value: Optional[Callable[[LengthandGetLike_T, int], _Dataset_T]] = None,
_length: Optional[Union[int, Callable[[Any], int]]] = None,
**overflow_kwargs: Overflow_In,
) -> None: ...

Expand All @@ -386,11 +385,11 @@ def __init__(
def __init__(
self,
function: DatasetFunction[_Dataset_T, _Target_P, _Target_T],
dataset: SupportsLength,
dataset: LengthLike_T,
max_threads: int = 8,
*overflow_args: Overflow_In,
_get_value: Callable[[SupportsLength, int], _Dataset_T],
_length: Optional[Union[int, Callable[[SupportsLength], int]]] = None,
_get_value: Callable[[LengthLike_T, int], _Dataset_T],
_length: Optional[Union[int, Callable[[Any], int]]] = None,
**overflow_kwargs: Overflow_In,
) -> None: ...

Expand All @@ -399,13 +398,11 @@ def __init__(
def __init__(
self,
function: DatasetFunction[_Dataset_T, _Target_P, _Target_T],
dataset: SupportsGetItem[_Dataset_T],
dataset: GetLike_T,
max_threads: int = 8,
*overflow_args: Overflow_In,
_get_value: Optional[
Callable[[SupportsGetItem[_Dataset_T], int], _Dataset_T]
] = None,
_length: Union[int, Callable[[SupportsGetItem[_Dataset_T]], int]],
_get_value: Optional[Callable[[GetLike_T, int], _Dataset_T]] = None,
_length: Union[int, Callable[[GetLike_T], int]],
**overflow_kwargs: Overflow_In,
) -> None: ...

Expand Down Expand Up @@ -435,18 +432,13 @@ def __init__(
*overflow_args: Overflow_In,
_get_value: Optional[
Union[
Callable[[SupportsLengthGetItem[_Dataset_T], int], _Dataset_T],
Callable[[SupportsGetItem[_Dataset_T], int], _Dataset_T],
Callable[[SupportsLength, int], _Dataset_T],
Callable[[LengthLike_T, int], _Dataset_T],
Callable[[GetLike_T, int], _Dataset_T],
Callable[[LengthLike_T, int], _Dataset_T],
Callable[[Any, int], _Dataset_T],
]
] = None,
_length: Optional[
Union[
int,
Callable[[Any], int],
]
] = None,
_length: Optional[Union[int, Callable[[Any], int]]] = None,
**overflow_kwargs: Overflow_In,
) -> None:
"""
Expand Down

0 comments on commit 8f1ad08

Please sign in to comment.