Skip to content

Commit 1cc9d10

Browse files
committed
chore(lint): format files
1 parent c928032 commit 1cc9d10

File tree

13 files changed

+177
-32
lines changed

13 files changed

+177
-32
lines changed

datascience/numeric_python/statistics/TestChecker.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ def __init__(self, n):
88
@staticmethod
99
def test_function(actual, expected):
1010
print
11-
"Test for " + str(
12-
actual
13-
) + " passed " if actual == expected else "Test for " + str(
14-
actual
15-
) + " failed, expected " + str(expected)
11+
(
12+
"Test for " + str(actual) + " passed "
13+
if actual == expected
14+
else "Test for " + str(actual) + " failed, expected " + str(expected)
15+
)

datastructures/trees/binary/test_utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import unittest
2-
from datastructures.trees.binary.utils import lowest_common_ancestor, lowest_common_ancestor_ptr
2+
from datastructures.trees.binary.utils import (
3+
lowest_common_ancestor,
4+
lowest_common_ancestor_ptr,
5+
)
36
from datastructures.trees.binary.node import BinaryTreeNode
47

58

poetry.lock

Lines changed: 116 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

puzzles/graphs/evaluate_division/test_evaluate_division.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
class EvaluateDivisionTestCase(unittest.TestCase):
77
def test_1(self):
88
"""should return [6.00000,0.50000,-1.00000,1.00000,-1.00000] from equations = [["a","b"],["b","c"]],
9-
values = [2.0,3.0], queries = [["a","c"],["b","a"],["a","e"],["a","a"],["x","x"]]"""
9+
values = [2.0,3.0], queries = [["a","c"],["b","a"],["a","e"],["a","a"],["x","x"]]
10+
"""
1011
expected = [6.00000, 0.50000, -1.00000, 1.00000, -1.00000]
1112
equations = [["a", "b"], ["b", "c"]]
1213
values = [2.0, 3.0]
@@ -16,7 +17,8 @@ def test_1(self):
1617

1718
def test_2(self):
1819
"""should return [3.75000,0.40000,5.00000,0.20000] from equations = [["a","b"],["b","c"],["bc","cd"]],
19-
values = [1.5,2.5,5.0], queries = [["a","c"],["c","b"],["bc","cd"],["cd","bc"]]"""
20+
values = [1.5,2.5,5.0], queries = [["a","c"],["c","b"],["bc","cd"],["cd","bc"]]
21+
"""
2022
expected = [3.75000, 0.40000, 5.00000, 0.20000]
2123
equations = [["a", "b"], ["b", "c"], ["bc", "cd"]]
2224
values = [1.5, 2.5, 5.0]

puzzles/poker/__init__.py

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,40 @@ def hand_rank(hand):
2424
straight = (len(counts) == 5) and (max(ranks) - min(ranks) == 4)
2525
flush = len(set([s for r, s in hand])) == 1
2626
return (
27-
9
28-
if counts == (5,)
29-
else 8
30-
if straight and flush
31-
else 7
32-
if counts == (4, 1)
33-
else 6
34-
if counts == (3, 2)
35-
else 5
36-
if flush
37-
else 4
38-
if straight
39-
else 3
40-
if counts == (3, 1, 1)
41-
else 2
42-
if counts == (2, 2, 1)
43-
else 1
44-
if counts == (2, 1, 1, 1)
45-
else 0,
27+
(
28+
9
29+
if counts == (5,)
30+
else (
31+
8
32+
if straight and flush
33+
else (
34+
7
35+
if counts == (4, 1)
36+
else (
37+
6
38+
if counts == (3, 2)
39+
else (
40+
5
41+
if flush
42+
else (
43+
4
44+
if straight
45+
else (
46+
3
47+
if counts == (3, 1, 1)
48+
else (
49+
2
50+
if counts == (2, 2, 1)
51+
else 1
52+
if counts == (2, 1, 1, 1)
53+
else 0
54+
)
55+
)
56+
)
57+
)
58+
)
59+
)
60+
)
61+
),
4662
ranks,
4763
)

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[tool.poetry]
22
name = "pythonsnips"
33
version = "0.1.0"
4-
description = ""
4+
description = "Algorithms, data structures and code snippets written in Python"
55
authors = ["BrianLusina <[email protected]>"]
66
license = "MIT"
77
readme = "README.md"
@@ -12,6 +12,7 @@ parameterized = "^0.9.0"
1212

1313
[tool.poetry.group.dev.dependencies]
1414
ruff = "^0.3.5"
15+
black = "^25.11.0"
1516

1617
[tool.poetry.group.test.dependencies]
1718
pytest-benchmark = "^5.1.0"

pystrings/hexadecimal/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ def hexa_first_principles(hexadecimal):
2828
# if c in hexdigits[10: len(hexdigits) - 6] is equivalent to abcdef
2929
# converts each character in hexa to digit
3030
hex_list = [
31-
ord(c) - ord("a") + 10
32-
if c in hexdigits[10 : len(hexdigits) - 6]
33-
else ord(c) - ord("0")
31+
(
32+
ord(c) - ord("a") + 10
33+
if c in hexdigits[10 : len(hexdigits) - 6]
34+
else ord(c) - ord("0")
35+
)
3436
for c in hexa
3537
]
3638

utils/basic/list1.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# It's ok if you do not complete all the functions, and there
1616
# are some additional functions to try in list2.py.
1717

18+
1819
# A. match_ends
1920
# Given a list of strings, return the count of the number of
2021
# strings where the string length is 2 or more and the first

utils/basic/list2.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
# Additional basic list exercises
1010

11+
1112
# D. Given a list of numbers, return a list where
1213
# all adjacent == elements have been reduced to a single element,
1314
# so [1, 2, 2, 3] returns [1, 2, 3]. You may create a new list or

utils/basic/solution/list1.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# It's ok if you do not complete all the functions, and there
1616
# are some additional functions to try in list2.py.
1717

18+
1819
# A. match_ends
1920
# Given a list of strings, return the count of the number of
2021
# strings where the string length is 2 or more and the first

0 commit comments

Comments
 (0)