From 59bf115aa1b6203c51cc1a813d555e0a7c9d99e3 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 21 Feb 2020 11:02:35 +0100 Subject: [PATCH] uses: actions/checkout@v2 (#1779) * uses: actions/checkout@v2 * fixup! Format Python code with psf/black push --- .github/workflows/autoblack.yml | 2 +- linear_algebra/src/rayleigh_quotient.py | 4 ++-- maths/modular_exponential.py | 4 +++- maths/monte_carlo_dice.py | 3 ++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/autoblack.yml b/.github/workflows/autoblack.yml index cf578a14d..95d2d3d64 100644 --- a/.github/workflows/autoblack.yml +++ b/.github/workflows/autoblack.yml @@ -9,7 +9,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - uses: actions/setup-python@v1 - run: pip install black - run: black --check . diff --git a/linear_algebra/src/rayleigh_quotient.py b/linear_algebra/src/rayleigh_quotient.py index 46551749f..d0d5d6396 100644 --- a/linear_algebra/src/rayleigh_quotient.py +++ b/linear_algebra/src/rayleigh_quotient.py @@ -4,7 +4,7 @@ https://en.wikipedia.org/wiki/Rayleigh_quotient import numpy as np -def is_hermitian(matrix:np.matrix) -> bool: +def is_hermitian(matrix: np.matrix) -> bool: """ Checks if a matrix is Hermitian. @@ -25,7 +25,7 @@ def is_hermitian(matrix:np.matrix) -> bool: return np.array_equal(matrix, matrix.H) -def rayleigh_quotient(A:np.matrix, v:np.matrix) -> float: +def rayleigh_quotient(A: np.matrix, v: np.matrix) -> float: """ Returns the Rayleigh quotient of a Hermitian matrix A and vector v. diff --git a/maths/modular_exponential.py b/maths/modular_exponential.py index 91fa0e462..8b7b17575 100644 --- a/maths/modular_exponential.py +++ b/maths/modular_exponential.py @@ -5,7 +5,9 @@ """ """Calculate Modular Exponential.""" -def modular_exponential(base : int, power : int, mod : int): + + +def modular_exponential(base: int, power: int, mod: int): """ >>> modular_exponential(5, 0, 10) 1 diff --git a/maths/monte_carlo_dice.py b/maths/monte_carlo_dice.py index c045cc829..c36c3e83e 100644 --- a/maths/monte_carlo_dice.py +++ b/maths/monte_carlo_dice.py @@ -1,6 +1,7 @@ import random from typing import List + class Dice: NUM_SIDES = 6 @@ -15,7 +16,7 @@ class Dice: return "Fair Dice" -def throw_dice(num_throws: int, num_dice: int=2) -> List[float]: +def throw_dice(num_throws: int, num_dice: int = 2) -> List[float]: """ Return probability list of all possible sums when throwing dice.