GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Customer   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 60
Duplicated Lines 100 %

Importance

Changes 4
Bugs 0 Features 1
Metric Value
c 4
b 0
f 1
dl 60
loc 60
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A list() 11 11 1
A get() 11 11 1
A create() 15 15 1
A update() 17 17 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
"""Script used to define the paystack Customer class."""
2
3
from paystackapi.base import PayStackBase
4
5
6 View Code Duplication
class Customer(PayStackBase):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
7
    """docstring for Customer."""
8
9
    @classmethod
10
    def create(cls, **kwargs):
11
        """
12
        Function defined to create customer.
13
14
        Args:
15
            first_name: customer's first name.
16
            last_name: customer's last name.
17
            email: customer's email address.
18
            phone:customer's phone number.
19
20
        Returns:
21
            Json data from paystack API.
22
        """
23
        return cls().requests.post('customer', data=kwargs,)
24
25
    @classmethod
26
    def get(cls, customer_id):
27
        """
28
        Static method defined to get customers by id.
29
30
        Args:
31
            customer_id: paystack customer id.
32
        Returns:
33
            Json data from paystack API.
34
        """
35
        return cls().requests.get('customer/{customer_id}'.format(**locals()))
36
37
    @classmethod
38
    def list(cls):
39
        """
40
        Static method defined to list paystack customers.
41
42
        Args:
43
            No argument required.
44
        Returns:
45
            Json data from paystack API.
46
        """
47
        return cls().requests.get('customer')
48
49
    @classmethod
50
    def update(cls, customer_id, **kwargs):
51
        """
52
        Static method defined to update paystack customer data by id.
53
54
        Args:
55
            customer_id: paystack customer id.
56
            first_name: customer's first name(optional).
57
            last_name: customer's last name(optional).
58
            email: customer's email address(optional).
59
            phone:customer's phone number(optional).
60
61
        Returns:
62
            Json data from paystack API.
63
        """
64
        return cls().requests.put('customer/{customer_id}'.format(**locals()),
65
                                  data=kwargs)
66