mirror of
https://github.com/TheAlgorithms/Python.git
synced 2026-03-13 09:50:19 +08:00
Pyupgrade to python3.8 (#3616)
* Upgrade to Python 3.8 syntax
* updating DIRECTORY.md
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
@@ -7,7 +7,7 @@ from collections.abc import Sequence
|
||||
from queue import Queue
|
||||
|
||||
|
||||
class SegmentTreeNode(object):
|
||||
class SegmentTreeNode:
|
||||
def __init__(self, start, end, val, left=None, right=None):
|
||||
self.start = start
|
||||
self.end = end
|
||||
@@ -17,10 +17,10 @@ class SegmentTreeNode(object):
|
||||
self.right = right
|
||||
|
||||
def __str__(self):
|
||||
return "val: %s, start: %s, end: %s" % (self.val, self.start, self.end)
|
||||
return f"val: {self.val}, start: {self.start}, end: {self.end}"
|
||||
|
||||
|
||||
class SegmentTree(object):
|
||||
class SegmentTree:
|
||||
"""
|
||||
>>> import operator
|
||||
>>> num_arr = SegmentTree([2, 1, 5, 3, 4], operator.add)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
|
||||
class Heap(object):
|
||||
class Heap:
|
||||
"""
|
||||
>>> unsorted = [103, 9, 1, 7, 11, 15, 25, 201, 209, 107, 5]
|
||||
>>> h = Heap()
|
||||
|
||||
@@ -20,7 +20,7 @@ class _DoublyLinkedBase:
|
||||
self._next = link_n
|
||||
|
||||
def has_next_and_prev(self):
|
||||
return " Prev -> {0}, Next -> {1}".format(
|
||||
return " Prev -> {}, Next -> {}".format(
|
||||
self._prev is not None, self._next is not None
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user