mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-06 18:49:26 +08:00
pyupgrade --py37-plus **/*.py (#1654)
* pyupgrade --py37-plus **/*.py * fixup! Format Python code with psf/black push
This commit is contained in:

committed by
John Law

parent
34c808b375
commit
28419cf839
@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
An auto-balanced binary tree!
|
||||
"""
|
||||
|
@ -467,7 +467,7 @@ class RedBlackTree:
|
||||
from pprint import pformat
|
||||
|
||||
if self.left is None and self.right is None:
|
||||
return "'%s %s'" % (self.label, (self.color and "red") or "blk")
|
||||
return "'{} {}'".format(self.label, (self.color and "red") or "blk")
|
||||
return pformat(
|
||||
{
|
||||
"%s %s"
|
||||
|
@ -2,7 +2,7 @@ from random import random
|
||||
from typing import Tuple
|
||||
|
||||
|
||||
class Node(object):
|
||||
class Node:
|
||||
"""
|
||||
Treap's node
|
||||
Treap is a binary tree by value and heap by priority
|
||||
@ -18,11 +18,10 @@ class Node(object):
|
||||
from pprint import pformat
|
||||
|
||||
if self.left is None and self.right is None:
|
||||
return "'%s: %.5s'" % (self.value, self.prior)
|
||||
return f"'{self.value}: {self.prior:.5}'"
|
||||
else:
|
||||
return pformat(
|
||||
{"%s: %.5s" % (self.value, self.prior): (self.left, self.right)},
|
||||
indent=1,
|
||||
{f"{self.value}: {self.prior:.5}": (self.left, self.right)}, indent=1,
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
|
@ -1,4 +1,4 @@
|
||||
class Heap(object):
|
||||
class Heap:
|
||||
"""A generic Heap class, can be used as min or max by passing the key function accordingly.
|
||||
"""
|
||||
|
||||
|
@ -28,7 +28,7 @@ class HashTable:
|
||||
|
||||
def _step_by_step(self, step_ord):
|
||||
|
||||
print("step {0}".format(step_ord))
|
||||
print(f"step {step_ord}")
|
||||
print([i for i in range(len(self.values))])
|
||||
print(self.values)
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
__author__ = "Omkar Pathak"
|
||||
|
||||
|
||||
class Stack(object):
|
||||
class Stack:
|
||||
""" A stack is an abstract data type that serves as a collection of
|
||||
elements with two principal operations: push() and pop(). push() adds an
|
||||
element to the top of the stack, and pop() removes an element from the top
|
||||
|
Reference in New Issue
Block a user