Skip to content

Commit

Permalink
Fix pylint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
moshthepitt committed Sep 2, 2020
1 parent 1d04acd commit 27cc5d1
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 44 deletions.
2 changes: 1 addition & 1 deletion small_small_hr/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from django import forms
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.auth.models import User # pylint: disable = imported-auth-user
from django.db.models import Q
from django.utils.translation import ugettext as _

Expand Down
2 changes: 1 addition & 1 deletion small_small_hr/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ def get_days(start: object, end: object):
yield local_start.date() + timedelta(days=i)


def get_taken_leave_days( # pylint: disable=bad-continuation
def get_taken_leave_days(
staffprofile: object, status: str, leave_type: str, start_year: int, end_year: int
):
"""
Expand Down
2 changes: 1 addition & 1 deletion small_small_hr/reviews.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Review module for small-small-hr."""
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.auth.models import User # pylint: disable = imported-auth-user
from django.db import models

from model_reviews.models import Reviewer
Expand Down
85 changes: 44 additions & 41 deletions small_small_hr/serializers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Serializers for users app
"""
from django.contrib.auth.models import User
from django.contrib.auth.models import User # pylint: disable = imported-auth-user

from rest_framework import serializers

Expand All @@ -18,16 +18,18 @@ class Meta: # pylint: disable=too-few-public-methods
"""
meta options
"""

model = User
fields = ('username', 'first_name', 'last_name', 'email')
fields = ("username", "first_name", "last_name", "email")


class StaffProfileSerializer(serializers.ModelSerializer):
"""
Serializer class for StaffProfile model
"""
first_name = serializers.CharField(source='user.first_name')
last_name = serializers.CharField(source='user.last_name')

first_name = serializers.CharField(source="user.first_name")
last_name = serializers.CharField(source="user.last_name")
id_number = serializers.SerializerMethodField()
phone = serializers.SerializerMethodField()
sex = serializers.SerializerMethodField()
Expand All @@ -49,123 +51,124 @@ class Meta: # pylint: disable=too-few-public-methods
"""
class meta options
"""

model = StaffProfile
fields = [
'id',
'first_name',
'last_name',
'created',
'id_number',
'phone',
'sex',
'modified',
'role',
'nhif',
'emergency_contact_name',
'nssf',
'address',
'birthday',
'overtime_allowed',
'leave_days',
'start_date',
'sick_days',
'pin_number',
'end_date',
'emergency_contact_number',
"id",
"first_name",
"last_name",
"created",
"id_number",
"phone",
"sex",
"modified",
"role",
"nhif",
"emergency_contact_name",
"nssf",
"address",
"birthday",
"overtime_allowed",
"leave_days",
"start_date",
"sick_days",
"pin_number",
"end_date",
"emergency_contact_number",
]

def get_id_number(self, obj): # pylint: disable=no-self-use
"""
Get id_number
"""
return obj.data.get('id_number')
return obj.data.get("id_number")

def get_phone(self, obj): # pylint: disable=no-self-use
"""
Get phone
"""
return obj.data.get('phone')
return obj.data.get("phone")

def get_sex(self, obj): # pylint: disable=no-self-use
"""
Get sex
"""
return obj.data.get('sex')
return obj.data.get("sex")

def get_role(self, obj): # pylint: disable=no-self-use
"""
Get role
"""
return obj.data.get('role')
return obj.data.get("role")

def get_nhif(self, obj): # pylint: disable=no-self-use
"""
Get nhhf
"""
return obj.data.get('nhif')
return obj.data.get("nhif")

def get_nssf(self, obj): # pylint: disable=no-self-use
"""
Get nssf
"""
return obj.data.get('nssf')
return obj.data.get("nssf")

def get_pin_number(self, obj): # pylint: disable=no-self-use
"""
Get pin_number
"""
return obj.data.get('pin_number')
return obj.data.get("pin_number")

def get_address(self, obj): # pylint: disable=no-self-use
"""
Get address
"""
return obj.data.get('address')
return obj.data.get("address")

def get_birthday(self, obj): # pylint: disable=no-self-use
"""
Get birthday
"""
return obj.data.get('birthday')
return obj.data.get("birthday")

def get_leave_days(self, obj): # pylint: disable=no-self-use
"""
Get leave_days
"""
return obj.data.get('leave_days')
return obj.data.get("leave_days")

def get_sick_days(self, obj): # pylint: disable=no-self-use
"""
Get sick_days
"""
return obj.data.get('sick_days')
return obj.data.get("sick_days")

def get_overtime_allowed(self, obj): # pylint: disable=no-self-use
"""
Get overtime_allowed
"""
return obj.data.get('overtime_allowed')
return obj.data.get("overtime_allowed")

def get_start_date(self, obj): # pylint: disable=no-self-use
"""
Get start_date
"""
return obj.data.get('start_date')
return obj.data.get("start_date")

def get_end_date(self, obj): # pylint: disable=no-self-use
"""
Get end_date
"""
return obj.data.get('end_date')
return obj.data.get("end_date")

def get_emergency_contact_name(self, obj): # pylint: disable=no-self-use
"""
Get emergency_contact_name
"""
return obj.data.get('emergency_contact_name')
return obj.data.get("emergency_contact_name")

def get_emergency_contact_number(self, obj): # pylint: disable=no-self-use
"""
Get emergency_contact_number
"""
return obj.data.get('emergency_contact_number')
return obj.data.get("emergency_contact_number")

0 comments on commit 27cc5d1

Please sign in to comment.