Skip to content

refactor: migrate all type annotations to PEP 585#654

Merged
jansegre merged 1 commit intomasterfrom
refactor/pep-585
Jun 9, 2023
Merged

refactor: migrate all type annotations to PEP 585#654
jansegre merged 1 commit intomasterfrom
refactor/pep-585

Conversation

@jansegre
Copy link
Copy Markdown
Member

@jansegre jansegre commented Jun 7, 2023

Refactor all List/Dict/... annotations to use list/dict/... (which don't have to be imported from typing). The complete list of types which now allow for such use of [] is on the PEP 585. This is possible because we dropped support for Python 3.8, we had already started to use it in some new annotations but this PR aims to update all the remaining annotations.

With the changes of this PR following grep should be empty:

rg -w 'typing.* (List|Dict|Tuple|FrozenSet|Type|AbstractSet|Deque|DefaultDict|OrderedDict)' -t py hathor tests

Acceptance Criteria

  • Replace all annotations from typing that now can be done on the original class (instead of the typing class) as described by PEP 585;
  • Remove all the now unneeded imports;
  • Update comments/docstrings that also reference the old patterns;
  • Don't change/refactor/improve anything else.

@jansegre jansegre requested a review from glevco June 7, 2023 16:37
@jansegre jansegre self-assigned this Jun 7, 2023
@jansegre jansegre marked this pull request as ready for review June 7, 2023 17:00
@jansegre jansegre requested a review from msbrogli as a code owner June 7, 2023 17:00
msbrogli
msbrogli previously approved these changes Jun 7, 2023
@codecov
Copy link
Copy Markdown

codecov bot commented Jun 7, 2023

Codecov Report

Merging #654 (dd56e0a) into master (3ced4db) will decrease coverage by 0.05%.
The diff coverage is 96.66%.

@@            Coverage Diff             @@
##           master     #654      +/-   ##
==========================================
- Coverage   84.08%   84.04%   -0.05%     
==========================================
  Files         245      245              
  Lines       20286    20279       -7     
  Branches     2757     2757              
==========================================
- Hits        17057    17043      -14     
- Misses       2634     2639       +5     
- Partials      595      597       +2     
Impacted Files Coverage Δ
hathor/conf/settings.py 97.05% <0.00%> (ø)
hathor/wallet/resources/lock.py 100.00% <ø> (ø)
hathor/merged_mining/bitcoin_rpc.py 32.05% <50.00%> (ø)
hathor/mining/ws.py 35.21% <71.42%> (ø)
hathor/merged_mining/coordinator.py 42.85% <77.77%> (ø)
hathor/client.py 43.52% <81.25%> (ø)
hathor/profiler/cpu.py 50.00% <85.71%> (ø)
hathor/manager.py 69.78% <88.23%> (ø)
hathor/stratum/stratum.py 69.13% <96.55%> (ø)
hathor/api_util.py 91.13% <100.00%> (ø)
... and 106 more

msbrogli
msbrogli previously approved these changes Jun 9, 2023
glevco
glevco previously approved these changes Jun 9, 2023
@jansegre jansegre dismissed stale reviews from glevco and msbrogli via dd56e0a June 9, 2023 19:14
@jansegre jansegre force-pushed the refactor/pep-585 branch from 9c9af26 to dd56e0a Compare June 9, 2023 19:14
@jansegre jansegre merged commit 74a5ac6 into master Jun 9, 2023
@jansegre jansegre deleted the refactor/pep-585 branch June 9, 2023 19:53
@jansegre jansegre mentioned this pull request Jul 12, 2023
2 tasks
This was referenced Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants