[pre-commit.ci] pre-commit autoupdate (#11322)

* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.2.2 → v0.3.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.2.2...v0.3.2)
- [github.com/pre-commit/mirrors-mypy: v1.8.0 → v1.9.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.8.0...v1.9.0)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
pre-commit-ci[bot]
2024-03-13 07:52:41 +01:00
committed by GitHub
parent 5f95d6f805
commit bc8df6de31
297 changed files with 488 additions and 285 deletions

View File

@ -5,6 +5,7 @@ For example:
for i in allocation_list:
requests.get(url,headers={'Range':f'bytes={i}'})
"""
from __future__ import annotations

View File

@ -2,6 +2,7 @@
Find the area of various geometric shapes
Wikipedia reference: https://en.wikipedia.org/wiki/Area
"""
from math import pi, sqrt, tan

View File

@ -1,6 +1,7 @@
"""
Approximates the area under the curve using the trapezoidal rule
"""
from __future__ import annotations
from collections.abc import Callable

View File

@ -1,4 +1,5 @@
"""Implementation of Basic Math in Python."""
import math

View File

@ -1,5 +1,6 @@
"""For more information about the Binomial Distribution -
https://en.wikipedia.org/wiki/Binomial_distribution"""
https://en.wikipedia.org/wiki/Binomial_distribution"""
from math import factorial

View File

@ -11,6 +11,7 @@ Algorithm :
1. Use extended euclid algorithm to find x,y such that a*x + b*y = 1
2. Take n = ra*by + rb*ax
"""
from __future__ import annotations

View File

@ -4,7 +4,6 @@ Finding the continuous fraction for a rational number using python
https://en.wikipedia.org/wiki/Continued_fraction
"""
from fractions import Fraction
from math import floor

View File

@ -4,6 +4,7 @@
Implementation of entropy of information
https://en.wikipedia.org/wiki/Entropy_(information_theory)
"""
from __future__ import annotations
import math

View File

@ -8,6 +8,7 @@ The gamma function is defined for all complex numbers except
the non-positive integers
Python's Standard Library math.gamma() function overflows around gamma(171.624).
"""
import math
from numpy import inf

View File

@ -1,6 +1,7 @@
"""
Reference: https://en.wikipedia.org/wiki/Gaussian_function
"""
from numpy import exp, pi, sqrt

View File

@ -7,6 +7,7 @@ The function takes the list of numeric values as input and returns the IQR.
Script inspired by this Wikipedia article:
https://en.wikipedia.org/wiki/Interquartile_range
"""
from __future__ import annotations

View File

@ -3,6 +3,7 @@ References: wikipedia:square free number
psf/black : True
ruff : True
"""
from __future__ import annotations

View File

@ -1,4 +1,4 @@
""" Multiply two numbers using Karatsuba algorithm """
"""Multiply two numbers using Karatsuba algorithm"""
def karatsuba(a: int, b: int) -> int:

View File

@ -1,13 +1,13 @@
"""
In mathematics, the LucasLehmer test (LLT) is a primality test for Mersenne
numbers. https://en.wikipedia.org/wiki/Lucas%E2%80%93Lehmer_primality_test
In mathematics, the LucasLehmer test (LLT) is a primality test for Mersenne
numbers. https://en.wikipedia.org/wiki/Lucas%E2%80%93Lehmer_primality_test
A Mersenne number is a number that is one less than a power of two.
That is M_p = 2^p - 1
https://en.wikipedia.org/wiki/Mersenne_prime
A Mersenne number is a number that is one less than a power of two.
That is M_p = 2^p - 1
https://en.wikipedia.org/wiki/Mersenne_prime
The LucasLehmer test is the primality test used by the
Great Internet Mersenne Prime Search (GIMPS) to locate large primes.
The LucasLehmer test is the primality test used by the
Great Internet Mersenne Prime Search (GIMPS) to locate large primes.
"""

View File

@ -1,6 +1,7 @@
"""
https://en.wikipedia.org/wiki/Taylor_series#Trigonometric_functions
"""
from math import factorial, pi

View File

@ -6,6 +6,7 @@ Instead of using a nested for loop, in a Brute force approach we will use a tech
called 'Window sliding technique' where the nested loops can be converted to a single
loop to reduce time complexity.
"""
from __future__ import annotations

View File

@ -1,8 +1,8 @@
"""
Modular Exponential.
Modular exponentiation is a type of exponentiation performed over a modulus.
For more explanation, please check
https://en.wikipedia.org/wiki/Modular_exponentiation
Modular Exponential.
Modular exponentiation is a type of exponentiation performed over a modulus.
For more explanation, please check
https://en.wikipedia.org/wiki/Modular_exponentiation
"""
"""Calculate Modular Exponential."""

View File

@ -1,6 +1,7 @@
"""
@author: MatteoRaso
"""
from collections.abc import Callable
from math import pi, sqrt
from random import uniform

View File

@ -4,6 +4,7 @@ Use the Adams-Bashforth methods to solve Ordinary Differential Equations.
https://en.wikipedia.org/wiki/Linear_multistep_method
Author : Ravi Kumar
"""
from collections.abc import Callable
from dataclasses import dataclass

View File

@ -1,11 +1,11 @@
"""
Python program to show how to interpolate and evaluate a polynomial
using Neville's method.
Nevilles method evaluates a polynomial that passes through a
given set of x and y points for a particular x value (x0) using the
Newton polynomial form.
Reference:
https://rpubs.com/aaronsc32/nevilles-method-polynomial-interpolation
Python program to show how to interpolate and evaluate a polynomial
using Neville's method.
Nevilles method evaluates a polynomial that passes through a
given set of x and y points for a particular x value (x0) using the
Newton polynomial form.
Reference:
https://rpubs.com/aaronsc32/nevilles-method-polynomial-interpolation
"""

View File

@ -9,6 +9,7 @@ with the precision of the approximation increasing as the number of iterations i
Reference: https://en.wikipedia.org/wiki/Newton%27s_method
"""
from collections.abc import Callable
RealFunc = Callable[[float], float]

View File

@ -1,6 +1,7 @@
"""
Approximates the area under the curve using the trapezoidal rule
"""
from __future__ import annotations
from collections.abc import Callable

View File

@ -4,6 +4,7 @@ Use the Runge-Kutta-Gill's method of order 4 to solve Ordinary Differential Equa
https://www.geeksforgeeks.org/gills-4th-order-method-to-solve-differential-equations/
Author : Ravi Kumar
"""
from collections.abc import Callable
from math import sqrt

View File

@ -2,6 +2,7 @@
Implementing Secant method in Python
Author: dimgrichr
"""
from math import exp

View File

@ -1,6 +1,7 @@
"""
python/black : True
"""
from __future__ import annotations

View File

@ -9,7 +9,6 @@ For manual testing run:
python3 geometric_series.py
"""
from __future__ import annotations

View File

@ -9,7 +9,6 @@ For manual testing run:
python3 p_series.py
"""
from __future__ import annotations

View File

@ -10,6 +10,7 @@ Reference: https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
doctest provider: Bruno Simas Hadlich (https://github.com/brunohadlich)
Also thanks to Dmitry (https://github.com/LizardWizzard) for finding the problem
"""
from __future__ import annotations
import math

View File

@ -9,7 +9,6 @@ More details and concepts about this can be found on:
https://en.wikipedia.org/wiki/Solovay%E2%80%93Strassen_primality_test
"""
import random

View File

@ -8,6 +8,7 @@ Armstrong numbers are also called Narcissistic numbers and Pluperfect numbers.
On-Line Encyclopedia of Integer Sequences entry: https://oeis.org/A005188
"""
PASSING = (1, 153, 370, 371, 1634, 24678051, 115132219018763992565095597973971522401)
FAILING: tuple = (-153, -1, 0, 1.2, 200, "A", [], {}, None)

View File

@ -3,6 +3,7 @@ https://en.wikipedia.org/wiki/Weird_number
Fun fact: The set of weird numbers has positive asymptotic density.
"""
from math import sqrt

View File

@ -9,6 +9,7 @@ element of the vector mostly -1 between 1.
Script inspired from its corresponding Wikipedia article
https://en.wikipedia.org/wiki/Activation_function
"""
import numpy as np

View File

@ -3,6 +3,7 @@ Given an array of integers and another integer target,
we are required to find a triplet from the array such that it's sum is equal to
the target.
"""
from __future__ import annotations
from itertools import permutations

View File

@ -17,6 +17,7 @@ return [0, 1].
[1]: https://github.com/TheAlgorithms/Python/blob/master/other/two_sum.py
"""
from __future__ import annotations

View File

@ -11,6 +11,7 @@ Given nums = [2, 7, 11, 15], target = 9,
Because nums[0] + nums[1] = 2 + 7 = 9,
return [0, 1].
"""
from __future__ import annotations

View File

@ -3,6 +3,7 @@ Find the volume of various shapes.
* https://en.wikipedia.org/wiki/Volume
* https://en.wikipedia.org/wiki/Spherical_cap
"""
from __future__ import annotations
from math import pi, pow