cognitedata / cognitedata/cognite-sdk-python

Using `mypy` with Python >= 3.9 reports errors

Open
#1,168 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
92
Forks
38
Avg merge
2d 9h
Merged PRs (30d)
42

Description

cognite/client/utils/_concurrency.py:229: error: Incompatible types in
assignment (expression has type "ThreadPoolExecutor", variable has type
"TaskExecutor")  [assignment]
                executor: TaskExecutor = _THREAD_POOL_EXECUTOR_SINGLETON
                                         ^
cognite/client/utils/_concurrency.py:229: note: Following member(s) of "ThreadPoolExecutor" have conflicts:
cognite/client/utils/_concurrency.py:229: note:     Expected:
cognite/client/utils/_concurrency.py:229: note:         def [T_Result] submit(self, fn: Callable[..., T_Result], *args: Any, **kwargs: Any) -> TaskFuture[T_Result]
cognite/client/utils/_concurrency.py:229: note:     Got:
cognite/client/utils/_concurrency.py:229: note:         def [_P`-1, _T] submit(self, Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs) -> Future[_T]
cognite/client/utils/_concurrency.py:232: error: Incompatible types in
assignment (expression has type "ThreadPoolExecutor", variable has type
"TaskExecutor")  [assignment]
                executor = _THREAD_POOL_EXECUTOR_SINGLETON = ThreadPoolExe...
                ^
cognite/client/utils/_concurrency.py:232: note: Following member(s) of "ThreadPoolExecutor" have conflicts:
cognite/client/utils/_concurrency.py:232: note:     Expected:
cognite/client/utils/_concurrency.py:232: note:         def [T_Result] submit(self, fn: Callable[..., T_Result], *args: Any, **kwargs: Any) -> TaskFuture[T_Result]
cognite/client/utils/_concurrency.py:232: note:     Got:
cognite/client/utils/_concurrency.py:232: note:         def [_P`-1, _T] submit(self, Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs) -> Future[_T]
Found 2 errors in 1 file (checked 80 source files)
image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in cognite/client/utils/_concurrency.py around lines 229 and 232, where mypy reports incompatible ThreadPoolExecutor and TaskExecutor assignments. Run mypy against the repository to reproduce the two errors, then verify that the check completes without these errors for Python 3.9 and later.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.