Passed
Push — master ( ca67bc...5eab93 )
by dai
02:57
created

school_api.exceptions.PermissionException.__init__()   A

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 2
rs 10
c 0
b 0
f 0
cc 1
nop 3
1
# -*- coding: utf-8 -*-
0 ignored issues
show
Coding Style introduced by
This module 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...
2
from __future__ import absolute_import, unicode_literals
3
import six
4
5
from school_api.utils import to_text, to_binary
6
7
8
class SchoolException(Exception):
0 ignored issues
show
Unused Code introduced by
The variable __class__ seems to be unused.
Loading history...
9
    """Base exception for school-api"""
10
11
    def __init__(self, name, school_code, errmsg):
0 ignored issues
show
Bug introduced by
The __init__ method of the super-class Exception is not called.

It is generally advisable to initialize the super-class by calling its __init__ method:

class SomeParent:
    def __init__(self):
        self.x = 1

class SomeChild(SomeParent):
    def __init__(self):
        # Initialize the super class
        SomeParent.__init__(self)
Loading history...
12
        self.name = name
13
        self.errmsg = errmsg
14
        self.school_code = school_code
15
16
    def __repr__(self):
17
        _repr = 'school_code:{school_code}, Error msage: {name},{msg}'.format(
18
            school_code=self.school_code,
19
            name=self.name,
20
            msg=self.errmsg
21
        )
22
        msg = to_binary(_repr) if six.PY2 else to_text(_repr)
23
        return msg
24
25
    def __str__(self):
26
        _repr = '{msg}'.format(
27
            msg=self.errmsg
28
        )
29
        msg = to_binary(_repr) if six.PY2 else to_text(_repr)
30
        return msg
31
32
33
class LoginException(SchoolException):
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...
34
35
    def __init__(self, school_code, errmsg):
36
        super(LoginException, self).__init__('登录接口', school_code, errmsg)
37
38
39
class IdentityException(LoginException):
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...
40
    pass
41
42
43
class CheckCodeException(LoginException):
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...
44
    pass
45
46
47
class ScheduleException(SchoolException):
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...
48
49
    def __init__(self, school_code, errmsg):
50
        super(ScheduleException, self).__init__('课表接口', school_code, errmsg)
51
52
53
class ScoreException(SchoolException):
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...
54
55
    def __init__(self, school_code, errmsg):
56
        super(ScoreException, self).__init__('成绩接口', school_code, errmsg)
57
58
59
class UserInfoException(SchoolException):
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...
60
61
    def __init__(self, school_code, errmsg):
62
        super(UserInfoException, self).__init__('用户信息接口', school_code, errmsg)
63
64
65
class PermissionException(SchoolException):
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...
66
67
    def __init__(self, school_code, errmsg):
68
        super(PermissionException, self).__init__('接口权限', school_code, errmsg)
69