Skip to content

Commit d1b2576

Browse files
cclaussgithub-actions
and
github-actions
authored
Fix psf/black issues than fail the build (#1935)
* Fix psf/black issues than fail the build * fixup! Format Python code with psf/black push Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
1 parent 9b2d65b commit d1b2576

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Read our [Contribution Guidelines](CONTRIBUTING.md) before you contribute.
1818

1919
## Community Channel
2020

21-
We're on [Gitter](https://gitter.im/TheAlgorithms)! Please join us.
21+
We're on [Gitter](https://gitter.im/TheAlgorithms)! Please join us.
2222

2323
## List of Algorithms
2424

data_structures/binary_tree/segment_tree_other.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def __init__(self, start, end, val, left=None, right=None):
1818
self.right = right
1919

2020
def __str__(self):
21-
return 'val: %s, start: %s, end: %s' % (self.val, self.start, self.end)
21+
return "val: %s, start: %s, end: %s" % (self.val, self.start, self.end)
2222

2323

2424
class SegmentTree(object):
@@ -131,6 +131,7 @@ class SegmentTree(object):
131131
>>>
132132
133133
"""
134+
134135
def __init__(self, collection: Sequence, function):
135136
self.collection = collection
136137
self.fn = function
@@ -197,7 +198,10 @@ def _query_range(self, node, i, j):
197198
return self._query_range(node.left, i, j)
198199
else:
199200
# range in left child tree and right child tree
200-
return self.fn(self._query_range(node.left, i, node.mid), self._query_range(node.right, node.mid + 1, j))
201+
return self.fn(
202+
self._query_range(node.left, i, node.mid),
203+
self._query_range(node.right, node.mid + 1, j),
204+
)
201205
else:
202206
# range in right child tree
203207
return self._query_range(node.right, i, j)
@@ -217,10 +221,11 @@ def traverse(self):
217221
queue.put(node.right)
218222

219223

220-
if __name__ == '__main__':
224+
if __name__ == "__main__":
221225
import operator
226+
222227
for fn in [operator.add, max, min]:
223-
print('*' * 50)
228+
print("*" * 50)
224229
arr = SegmentTree([2, 1, 5, 3, 4], fn)
225230
for node in arr.traverse():
226231
print(node)

data_structures/stacks/stack.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ def is_empty(self):
4646
def size(self):
4747
""" Return the size of the stack."""
4848
return len(self.stack)
49-
49+
5050
def __contains__(self, item) -> bool:
5151
"""Check if item is in stack"""
5252
return item in self.stack
53-
53+
5454

5555
class StackOverflowError(BaseException):
5656
pass
@@ -73,4 +73,3 @@ class StackOverflowError(BaseException):
7373
num = 5
7474
if num in stack:
7575
print(f"{num} is in stack")
76-

0 commit comments

Comments
 (0)