Skip to content

Commit 477cc3f

Browse files
cclaussgithub-actions
and
github-actions
authored
Add pyupgrade to pre-commit (#5638)
* Add pyupgrade to pre-commit * Remove unused imports * updating DIRECTORY.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
1 parent 70368a7 commit 477cc3f

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

.pre-commit-config.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ repos:
2222
- id: isort
2323
args:
2424
- --profile=black
25+
- repo: https://github.com/asottile/pyupgrade
26+
rev: v2.29.0
27+
hooks:
28+
- id: pyupgrade
29+
args:
30+
- --py39-plus
2531
- repo: https://gitlab.com/pycqa/flake8
2632
rev: 3.9.1
2733
hooks:

DIRECTORY.md

+3
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@
126126
* [Molecular Chemistry](https://github.com/TheAlgorithms/Python/blob/master/conversions/molecular_chemistry.py)
127127
* [Octal To Decimal](https://github.com/TheAlgorithms/Python/blob/master/conversions/octal_to_decimal.py)
128128
* [Prefix Conversions](https://github.com/TheAlgorithms/Python/blob/master/conversions/prefix_conversions.py)
129+
* [Pressure Conversions](https://github.com/TheAlgorithms/Python/blob/master/conversions/pressure_conversions.py)
129130
* [Rgb Hsv Conversion](https://github.com/TheAlgorithms/Python/blob/master/conversions/rgb_hsv_conversion.py)
130131
* [Roman Numerals](https://github.com/TheAlgorithms/Python/blob/master/conversions/roman_numerals.py)
131132
* [Temperature Conversions](https://github.com/TheAlgorithms/Python/blob/master/conversions/temperature_conversions.py)
@@ -860,6 +861,8 @@
860861
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_301/sol1.py)
861862
* Problem 551
862863
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_551/sol1.py)
864+
* Problem 686
865+
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_686/sol1.py)
863866

864867
## Quantum
865868
* [Deutsch Jozsa](https://github.com/TheAlgorithms/Python/blob/master/quantum/deutsch_jozsa.py)

data_structures/binary_tree/merge_two_binary_trees.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
"""
88
from __future__ import annotations
99

10-
from typing import Optional
11-
1210

1311
class Node:
1412
"""
@@ -21,7 +19,7 @@ def __init__(self, value: int = 0) -> None:
2119
self.right: Node | None = None
2220

2321

24-
def merge_two_binary_trees(tree1: Node | None, tree2: Node | None) -> Optional[Node]:
22+
def merge_two_binary_trees(tree1: Node | None, tree2: Node | None) -> Node | None:
2523
"""
2624
Returns root node of the merged tree.
2725

data_structures/linked_list/skip_list.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
from __future__ import annotations
66

77
from random import random
8-
from typing import Generic, Optional, TypeVar, Union
8+
from typing import Generic, TypeVar
99

1010
KT = TypeVar("KT")
1111
VT = TypeVar("VT")
1212

1313

1414
class Node(Generic[KT, VT]):
15-
def __init__(self, key: Union[KT, str] = "root", value: Optional[VT] = None):
15+
def __init__(self, key: KT | str = "root", value: VT | None = None):
1616
self.key = key
1717
self.value = value
1818
self.forward: list[Node[KT, VT]] = []

0 commit comments

Comments
 (0)