mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-06 02:13:15 +08:00
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>
This commit is contained in:
@ -22,6 +22,12 @@ repos:
|
|||||||
- id: isort
|
- id: isort
|
||||||
args:
|
args:
|
||||||
- --profile=black
|
- --profile=black
|
||||||
|
- repo: https://github.com/asottile/pyupgrade
|
||||||
|
rev: v2.29.0
|
||||||
|
hooks:
|
||||||
|
- id: pyupgrade
|
||||||
|
args:
|
||||||
|
- --py39-plus
|
||||||
- repo: https://gitlab.com/pycqa/flake8
|
- repo: https://gitlab.com/pycqa/flake8
|
||||||
rev: 3.9.1
|
rev: 3.9.1
|
||||||
hooks:
|
hooks:
|
||||||
|
@ -126,6 +126,7 @@
|
|||||||
* [Molecular Chemistry](https://github.com/TheAlgorithms/Python/blob/master/conversions/molecular_chemistry.py)
|
* [Molecular Chemistry](https://github.com/TheAlgorithms/Python/blob/master/conversions/molecular_chemistry.py)
|
||||||
* [Octal To Decimal](https://github.com/TheAlgorithms/Python/blob/master/conversions/octal_to_decimal.py)
|
* [Octal To Decimal](https://github.com/TheAlgorithms/Python/blob/master/conversions/octal_to_decimal.py)
|
||||||
* [Prefix Conversions](https://github.com/TheAlgorithms/Python/blob/master/conversions/prefix_conversions.py)
|
* [Prefix Conversions](https://github.com/TheAlgorithms/Python/blob/master/conversions/prefix_conversions.py)
|
||||||
|
* [Pressure Conversions](https://github.com/TheAlgorithms/Python/blob/master/conversions/pressure_conversions.py)
|
||||||
* [Rgb Hsv Conversion](https://github.com/TheAlgorithms/Python/blob/master/conversions/rgb_hsv_conversion.py)
|
* [Rgb Hsv Conversion](https://github.com/TheAlgorithms/Python/blob/master/conversions/rgb_hsv_conversion.py)
|
||||||
* [Roman Numerals](https://github.com/TheAlgorithms/Python/blob/master/conversions/roman_numerals.py)
|
* [Roman Numerals](https://github.com/TheAlgorithms/Python/blob/master/conversions/roman_numerals.py)
|
||||||
* [Temperature Conversions](https://github.com/TheAlgorithms/Python/blob/master/conversions/temperature_conversions.py)
|
* [Temperature Conversions](https://github.com/TheAlgorithms/Python/blob/master/conversions/temperature_conversions.py)
|
||||||
@ -860,6 +861,8 @@
|
|||||||
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_301/sol1.py)
|
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_301/sol1.py)
|
||||||
* Problem 551
|
* Problem 551
|
||||||
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_551/sol1.py)
|
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_551/sol1.py)
|
||||||
|
* Problem 686
|
||||||
|
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_686/sol1.py)
|
||||||
|
|
||||||
## Quantum
|
## Quantum
|
||||||
* [Deutsch Jozsa](https://github.com/TheAlgorithms/Python/blob/master/quantum/deutsch_jozsa.py)
|
* [Deutsch Jozsa](https://github.com/TheAlgorithms/Python/blob/master/quantum/deutsch_jozsa.py)
|
||||||
|
@ -7,8 +7,6 @@ will be used as the node of new tree.
|
|||||||
"""
|
"""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
|
|
||||||
class Node:
|
class Node:
|
||||||
"""
|
"""
|
||||||
@ -21,7 +19,7 @@ class Node:
|
|||||||
self.right: Node | None = None
|
self.right: Node | None = None
|
||||||
|
|
||||||
|
|
||||||
def merge_two_binary_trees(tree1: Node | None, tree2: Node | None) -> Optional[Node]:
|
def merge_two_binary_trees(tree1: Node | None, tree2: Node | None) -> Node | None:
|
||||||
"""
|
"""
|
||||||
Returns root node of the merged tree.
|
Returns root node of the merged tree.
|
||||||
|
|
||||||
|
@ -5,14 +5,14 @@ https://epaperpress.com/sortsearch/download/skiplist.pdf
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from random import random
|
from random import random
|
||||||
from typing import Generic, Optional, TypeVar, Union
|
from typing import Generic, TypeVar
|
||||||
|
|
||||||
KT = TypeVar("KT")
|
KT = TypeVar("KT")
|
||||||
VT = TypeVar("VT")
|
VT = TypeVar("VT")
|
||||||
|
|
||||||
|
|
||||||
class Node(Generic[KT, VT]):
|
class Node(Generic[KT, VT]):
|
||||||
def __init__(self, key: Union[KT, str] = "root", value: Optional[VT] = None):
|
def __init__(self, key: KT | str = "root", value: VT | None = None):
|
||||||
self.key = key
|
self.key = key
|
||||||
self.value = value
|
self.value = value
|
||||||
self.forward: list[Node[KT, VT]] = []
|
self.forward: list[Node[KT, VT]] = []
|
||||||
|
Reference in New Issue
Block a user