Skip to content

Commit

Permalink
style: format code with Autopep8, Black, ClangFormat, dotnet-format, …
Browse files Browse the repository at this point in the history
…Go fmt, Gofumpt, Google Java Format, isort, Ktlint, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt, Scalafmt, StandardJS, StandardRB, swift-format and Yapf

This commit fixes the style issues introduced in d0a8368 according to the output
from Autopep8, Black, ClangFormat, dotnet-format, Go fmt, Gofumpt, Google Java
Format, isort, Ktlint, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt,
Scalafmt, StandardJS, StandardRB, swift-format and Yapf.

Details: None
  • Loading branch information
deepsource-autofix[bot] authored May 11, 2024
1 parent d0a8368 commit caf1255
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions core/credit_card/management.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import datetime


class CreditCard:
def __init__(self, card_number, limit):
self.card_number = card_number
Expand All @@ -8,6 +9,7 @@ def __init__(self, card_number, limit):
self.interest_rate = 0.05
self.closed = False


def process_payments():
for card in all_cards:
amount_due = card.balance * (1 + card.interest_rate)
Expand All @@ -16,33 +18,42 @@ def process_payments():
else:
card.balance = 0


def process_purchases():
for card in all_cards:
if card.closed:
continue
purchase_amount = float(input(f"Enter purchase amount for card {card.card_number}: "))
purchase_amount = float(
input(f"Enter purchase amount for card {card.card_number}: ")
)
if purchase_amount > card.limit - card.balance:
print(f"PURCHASE DENIED: Insufficient credit for card {card.card_number}")
else:
card.balance += purchase_amount
if card.balance > card.limit:
print(f"WARNING: Credit limit exceeded for card {card.card_number}")


def set_credit_limit(card, limit):
card.limit = limit


def get_credit_limit(card):
return card.limit


def get_balance(card):
return card.balance


def apply_interest(card):
card.balance *= (1 + card.interest_rate)
card.balance *= 1 + card.interest_rate


def deny_credit(card):
card.limit = 0
card.closed = True


# Initialize list of all credit cards
all_cards = []

0 comments on commit caf1255

Please sign in to comment.