Skip to content

Commit b439b9c

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 6d242b2 commit b439b9c

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

financial/depreciation.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,12 @@ def straight_line_depreciation(
8989

9090
return list_of_depreciation_expenses
9191

92-
def declining_balance_depreciation(useful_years: int,
92+
93+
def declining_balance_depreciation(
94+
useful_years: int,
9395
purchase_value: float,
94-
residual_value: float = 0.0,):
96+
residual_value: float = 0.0,
97+
):
9598
"""
9699
Calculate the depreciation expenses over the given period using the declining balance method
97100
:param useful_years: Number of years the asset will be used
@@ -123,16 +126,19 @@ def declining_balance_depreciation(useful_years: int,
123126

124127
list_of_depreciation_expenses = []
125128

126-
for i in range(1, useful_years+1):
129+
for i in range(1, useful_years + 1):
127130
new_book_value = purchase_value * ((1 - depreciation_rate) ** i)
128131
list_of_depreciation_expenses.append(book_value - new_book_value)
129132
book_value = new_book_value
130-
133+
131134
return list_of_depreciation_expenses
132135

133-
def sum_of_years_digits_depreciation(useful_years: int,
136+
137+
def sum_of_years_digits_depreciation(
138+
useful_years: int,
134139
purchase_value: float,
135-
residual_value: float = 0.0,):
140+
residual_value: float = 0.0,
141+
):
136142
"""
137143
Calculate the depreciation expenses over the given period using the sum of years' digits method
138144
:param useful_years: Number of years the asset will be used
@@ -163,17 +169,15 @@ def sum_of_years_digits_depreciation(useful_years: int,
163169

164170
list_of_depreciation_expenses = []
165171

166-
for i in range(1, useful_years+1):
167-
depreciation_value = (useful_years - (i - 1)) / digits_sum * (purchase_value - residual_value)
172+
for i in range(1, useful_years + 1):
173+
depreciation_value = (
174+
(useful_years - (i - 1)) / digits_sum * (purchase_value - residual_value)
175+
)
168176
list_of_depreciation_expenses.append(depreciation_value)
169177

170-
171178
return list_of_depreciation_expenses
172179

173180

174-
175-
176-
177181
if __name__ == "__main__":
178182
import doctest
179183

0 commit comments

Comments
 (0)