Completed
Push — master ( 592bf7...9c419b )
by Francisco Manzano
12:48 queued 04:00
created

econopy.loans.PrestamoFrances.pinta_cuadro()   A

Complexity

Conditions 2

Size

Total Lines 10
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 9
nop 1
dl 0
loc 10
rs 9.95
c 0
b 0
f 0
1
"""Prestamos module."""
2
3
from .. import ANUAL
4
5
class PrestamoFrances:
0 ignored issues
show
Coding Style introduced by
This class should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
Unused Code introduced by
The variable __class__ seems to be unused.
Loading history...
6
7
    cuota = 0
8
    principal = 10
9
    interes_anual = 0.1
10
    interes = 0.01
11
    periodos = 1
12
    tipo_periodo = ANUAL
13
    cuotas_interes = []
14
    cuotas_amortizacion = []
15
    capital_vivo = []
16
    total_amortizado = []
17
18
    def calcula_interes(self):
0 ignored issues
show
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
19
        self.interes = self.interes_anual / self.tipo_periodo
20
21
    def calcula_cuota(self):
0 ignored issues
show
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
22
        self.calcula_interes()
23
        cuota = self.principal * \
24
            ((self.interes*(1+self.interes)**self.periodos) /
25
             (-1+(1+self.interes)**self.periodos))
26
        self.cuota = cuota
27
28
    def calcula_tabla_amortizacion(self):
0 ignored issues
show
Coding Style introduced by
This method should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
29
        self.capital_vivo.append(self.principal)
30
        self.cuotas_interes.append(0)
31
        self.cuotas_amortizacion.append(0)
32
        self.total_amortizado.append(0)
33
        for periodo in range(1, self.periodos+1):
34
            interes = self.capital_vivo[periodo-1]*self.interes
35
            amortizado = self.cuota - interes
36
            self.cuotas_interes.append(interes)
37
            self.cuotas_amortizacion.append(amortizado)
38
            self.capital_vivo.append(
39
                self.capital_vivo[periodo-1]-amortizado)
40
            self.total_amortizado.append(
41
                self.total_amortizado[periodo-1]+amortizado)
42