Skip to content

pre-commit autoupdate: pyupgrade v2.34.0 -> v2.37.0 #6245

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ repos:
- --profile=black

- repo: https://github.com/asottile/pyupgrade
rev: v2.34.0
rev: v2.37.0
hooks:
- id: pyupgrade
args:
Expand Down
2 changes: 1 addition & 1 deletion arithmetic_analysis/bisection.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Callable
from collections.abc import Callable


def bisection(function: Callable[[float], float], a: float, b: float) -> float:
Expand Down
2 changes: 1 addition & 1 deletion arithmetic_analysis/intersection.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import math
from typing import Callable
from collections.abc import Callable


def intersection(function: Callable[[float], float], x0: float, x1: float) -> float:
Expand Down
2 changes: 1 addition & 1 deletion arithmetic_analysis/newton_method.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Newton's Method."""

# Newton's Method - https://en.wikipedia.org/wiki/Newton%27s_method
from typing import Callable
from collections.abc import Callable

RealFunc = Callable[[float], float] # type alias for a real -> real function

Expand Down
2 changes: 1 addition & 1 deletion boolean_algebra/quine_mc_cluskey.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from typing import Sequence
from collections.abc import Sequence


def compare_string(string1: str, string2: str) -> str:
Expand Down
2 changes: 1 addition & 1 deletion ciphers/playfair_cipher.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import itertools
import string
from typing import Generator, Iterable
from collections.abc import Generator, Iterable


def chunker(seq: Iterable[str], size: int) -> Generator[tuple[str, ...], None, None]:
Expand Down
3 changes: 2 additions & 1 deletion computer_vision/horn_schunck.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
Paper: http://image.diku.dk/imagecanon/material/HornSchunckOptical_Flow.pdf
"""

from typing import SupportsIndex

import numpy as np
from scipy.ndimage.filters import convolve
from typing_extensions import SupportsIndex


def warp(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from __future__ import annotations

import unittest
from typing import Iterator
from collections.abc import Iterator


class Node:
Expand Down
3 changes: 2 additions & 1 deletion data_structures/binary_tree/binary_tree_traversals.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
from __future__ import annotations

from collections import deque
from collections.abc import Sequence
from dataclasses import dataclass
from typing import Any, Sequence
from typing import Any


@dataclass
Expand Down
3 changes: 2 additions & 1 deletion data_structures/binary_tree/non_recursive_segment_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"""
from __future__ import annotations

from typing import Any, Callable, Generic, TypeVar
from collections.abc import Callable
from typing import Any, Generic, TypeVar

T = TypeVar("T")

Expand Down
2 changes: 1 addition & 1 deletion data_structures/binary_tree/red_black_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"""
from __future__ import annotations

from typing import Iterator
from collections.abc import Iterator


class RedBlackTree:
Expand Down
2 changes: 1 addition & 1 deletion data_structures/heap/heap.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from typing import Iterable
from collections.abc import Iterable


class Heap:
Expand Down
3 changes: 2 additions & 1 deletion data_structures/heap/randomized_heap.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
from __future__ import annotations

import random
from typing import Any, Generic, Iterable, TypeVar
from collections.abc import Iterable
from typing import Any, Generic, TypeVar

T = TypeVar("T", bound=bool)

Expand Down
3 changes: 2 additions & 1 deletion data_structures/heap/skew_heap.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

from __future__ import annotations

from typing import Any, Generic, Iterable, Iterator, TypeVar
from collections.abc import Iterable, Iterator
from typing import Any, Generic, TypeVar

T = TypeVar("T", bound=bool)

Expand Down
3 changes: 2 additions & 1 deletion data_structures/linked_list/circular_linked_list.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

from typing import Any, Iterator
from collections.abc import Iterator
from typing import Any


class Node:
Expand Down
3 changes: 2 additions & 1 deletion data_structures/queue/double_ended_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
"""
from __future__ import annotations

from collections.abc import Iterable
from dataclasses import dataclass
from typing import Any, Iterable
from typing import Any


class Deque:
Expand Down
3 changes: 2 additions & 1 deletion data_structures/queue/linked_queue.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
""" A Queue using a linked list like structure """
from __future__ import annotations

from typing import Any, Iterator
from collections.abc import Iterator
from typing import Any


class Node:
Expand Down
2 changes: 1 addition & 1 deletion divide_and_conquer/convex_hull.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"""
from __future__ import annotations

from typing import Iterable
from collections.abc import Iterable


class Point:
Expand Down
3 changes: 2 additions & 1 deletion fractals/julia_sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"""

import warnings
from typing import Any, Callable
from collections.abc import Callable
from typing import Any

import numpy
from matplotlib import pyplot
Expand Down
2 changes: 1 addition & 1 deletion graphs/prim.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import heapq as hq
import math
from typing import Iterator
from collections.abc import Iterator


class Vertex:
Expand Down
3 changes: 2 additions & 1 deletion linear_algebra/src/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@

import math
import random
from typing import Collection, overload
from collections.abc import Collection
from typing import overload


class Vector:
Expand Down
3 changes: 2 additions & 1 deletion machine_learning/linear_discriminant_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@

Author: @EverLookNeverSee
"""
from collections.abc import Callable
from math import log
from os import name, system
from random import gauss, seed
from typing import Callable, TypeVar
from typing import TypeVar


# Make a training dataset drawn from a gaussian distribution
Expand Down
2 changes: 1 addition & 1 deletion maths/area_under_curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
from __future__ import annotations

from typing import Callable
from collections.abc import Callable


def trapezoidal_area(
Expand Down
3 changes: 2 additions & 1 deletion maths/euclidean_distance.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

from typing import Iterable, Union
from collections.abc import Iterable
from typing import Union

import numpy as np

Expand Down
2 changes: 1 addition & 1 deletion maths/euler_method.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Callable
from collections.abc import Callable

import numpy as np

Expand Down
2 changes: 1 addition & 1 deletion maths/euler_modified.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Callable
from collections.abc import Callable

import numpy as np

Expand Down
2 changes: 1 addition & 1 deletion maths/line_length.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import math
from typing import Callable
from collections.abc import Callable


def line_length(
Expand Down
2 changes: 1 addition & 1 deletion maths/monte_carlo.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""
@author: MatteoRaso
"""
from collections.abc import Callable
from math import pi, sqrt
from random import uniform
from statistics import mean
from typing import Callable


def pi_estimator(iterations: int):
Expand Down
2 changes: 1 addition & 1 deletion maths/numerical_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
from __future__ import annotations

from typing import Callable
from collections.abc import Callable


def trapezoidal_area(
Expand Down
2 changes: 1 addition & 1 deletion maths/polynomial_evaluation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Sequence
from collections.abc import Sequence


def evaluate_poly(poly: Sequence[float], x: float) -> float:
Expand Down
2 changes: 1 addition & 1 deletion maths/prime_numbers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import math
from typing import Generator
from collections.abc import Generator


def slow_primes(max: int) -> Generator[int, None, None]:
Expand Down
2 changes: 1 addition & 1 deletion other/davisb_putnamb_logemannb_loveland.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from __future__ import annotations

import random
from typing import Iterable
from collections.abc import Iterable


class Clause:
Expand Down
3 changes: 2 additions & 1 deletion other/lfu_cache.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

from typing import Callable, Generic, TypeVar
from collections.abc import Callable
from typing import Generic, TypeVar

T = TypeVar("T")
U = TypeVar("U")
Expand Down
3 changes: 2 additions & 1 deletion other/lru_cache.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

from typing import Callable, Generic, TypeVar
from collections.abc import Callable
from typing import Generic, TypeVar

T = TypeVar("T")
U = TypeVar("U")
Expand Down
2 changes: 1 addition & 1 deletion project_euler/problem_010/sol2.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
- https://en.wikipedia.org/wiki/Prime_number
"""
import math
from collections.abc import Iterator
from itertools import takewhile
from typing import Iterator


def is_prime(number: int) -> bool:
Expand Down
2 changes: 1 addition & 1 deletion project_euler/problem_025/sol2.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
What is the index of the first term in the Fibonacci sequence to contain 1000
digits?
"""
from typing import Generator
from collections.abc import Generator


def fibonacci_generator() -> Generator[int, None, None]:
Expand Down
3 changes: 2 additions & 1 deletion project_euler/problem_101/sol1.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"""
from __future__ import annotations

from typing import Callable, Union
from collections.abc import Callable
from typing import Union

Matrix = list[list[Union[float, int]]]

Expand Down
2 changes: 1 addition & 1 deletion project_euler/problem_107/sol1.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from __future__ import annotations

import os
from typing import Mapping
from collections.abc import Mapping

EdgeT = tuple[int, int]

Expand Down
2 changes: 1 addition & 1 deletion project_euler/problem_123/sol1.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"""
from __future__ import annotations

from typing import Generator
from collections.abc import Generator


def sieve() -> Generator[int, None, None]:
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_directory_md.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3

import os
from typing import Iterator
from collections.abc import Iterator


def good_file_paths(top_dir: str = ".") -> Iterator[str]:
Expand Down
2 changes: 1 addition & 1 deletion web_programming/fetch_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
from __future__ import annotations

from typing import Generator
from collections.abc import Generator

import requests
from bs4 import BeautifulSoup
Expand Down