Test Failed
Push — master ( 63ff63...fafd44 )
by Francisco Manzano
08:52
created

econopy.loans   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 44
dl 0
loc 54
rs 10
c 0
b 0
f 0
wmc 6

4 Methods

Rating   Name   Duplication   Size   Complexity  
A PrestamoFrances.pinta_cuadro() 0 10 2
A PrestamoFrances.calcula_interes() 0 2 1
A PrestamoFrances.calcula_cuota() 0 6 1
A PrestamoFrances.calcula_tabla_amortizacion() 0 14 2
1
"""Prestamos module."""
2
3
from econopy import rentas
0 ignored issues
show
Bug introduced by
The name rentas does not seem to exist in module econopy.
Loading history...
4
5
6
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...
7
8
    cuota = 0
9
    principal = 10
10
    interes_anual = 0.1
11
    interes = 0.01
12
    periodos = 1
13
    tipo_periodo = rentas.ANUAL
14
    cuotas_interes = []
15
    cuotas_amortizacion = []
16
    capital_vivo = []
17
    total_amortizado = []
18
19
    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...
20
        self.interes = self.interes_anual / self.tipo_periodo
21
22
    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...
23
        self.calcula_interes()
24
        cuota = self.principal * \
25
            ((self.interes*(1+self.interes)**self.periodos) /
26
             (-1+(1+self.interes)**self.periodos))
27
        self.cuota = cuota
28
29
    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...
30
        self.capital_vivo.append(self.principal)
31
        self.cuotas_interes.append(0)
32
        self.cuotas_amortizacion.append(0)
33
        self.total_amortizado.append(0)
34
        for periodo in range(1, self.periodos+1):
35
            interes = self.capital_vivo[periodo-1]*self.interes
36
            amortizado = self.cuota - interes
37
            self.cuotas_interes.append(interes)
38
            self.cuotas_amortizacion.append(amortizado)
39
            self.capital_vivo.append(
40
                self.capital_vivo[periodo-1]-amortizado)
41
            self.total_amortizado.append(
42
                self.total_amortizado[periodo-1]+amortizado)
43
44
    def pinta_cuadro(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...
45
        self.calcula_cuota()
46
        self.calcula_tabla_amortizacion()
47
48
        for i in range(1, self.periodos+1):
49
            print("| {} | {} | {} | {} | {} |").format(
50
                i, round(self.cuota, 2), round(
51
                    self.capital_vivo[i], 2), round(
52
                        self.cuotas_interes[i], 2), round(
53
                            self.cuotas_amortizacion[i], 2))
54