Skip to content

Commit 77fb260

Browse files
author
Tasuku OKUDA
committed
Change docstrings to use imperative mood to go well with pydocstyle v2.0
From pydocstyle v2.0, D401 error raises when flake8 finds non-imperative mood phrase in first line of docstring. Some methods/properties have blacklisted phrase, 'Helper', which leads flake8 test to fail. ref) PyCQA/pydocstyle@da8a3ce
1 parent 928b87a commit 77fb260

File tree

3 files changed

+6
-17
lines changed

3 files changed

+6
-17
lines changed

linebot/models/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def new_from_json_dict(cls, data):
111111

112112
@staticmethod
113113
def get_or_new_from_json_dict(data, cls):
114-
"""Helper function.
114+
"""Get `cls` object w/ deserialization from json if needed.
115115
116116
If data is instance of cls, return data.
117117
Else if data is instance of dict, create instance from dict.
@@ -133,7 +133,7 @@ def get_or_new_from_json_dict(data, cls):
133133
def get_or_new_from_json_dict_with_types(
134134
data, cls_map, type_key='type'
135135
):
136-
"""Helper function.
136+
"""Get `cls` object w/ deserialization from json by using type key hint if needed.
137137
138138
If data is instance of one of cls, return data.
139139
Else if data is instance of dict, create instance from dict.

linebot/models/sources.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def __init__(self, **kwargs):
3636

3737
@abstractproperty
3838
def sender_id(self):
39-
"""Helper method.
39+
"""Abstract property of id to send a message.
4040
4141
If SourceUser, return user_id.
4242
If SourceGroup, return group_id.
@@ -69,9 +69,7 @@ def __init__(self, user_id=None, **kwargs):
6969

7070
@property
7171
def sender_id(self):
72-
"""Helper method.
73-
74-
Alias of user_id.
72+
"""Alias of user_id.
7573
7674
:rtype: str
7775
:return:
@@ -100,9 +98,7 @@ def __init__(self, group_id=None, **kwargs):
10098

10199
@property
102100
def sender_id(self):
103-
"""Helper method.
104-
105-
Alias of group_id.
101+
"""Alias of group_id.
106102
107103
:rtype: str
108104
:return:
@@ -131,13 +127,7 @@ def __init__(self, room_id=None, **kwargs):
131127

132128
@property
133129
def sender_id(self):
134-
"""Helper method.
135-
136-
Alias of room_id.
137-
138-
If SourceUser, return user_id.
139-
If SourceGroup, return group_id.
140-
If SourceRoom, return room_id.
130+
"""Alias of room_id.
141131
142132
:rtype: str
143133
:return:

tox.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ basepython = python3.5
1717
deps =
1818
flake8
1919
flake8-docstrings
20-
pydocstyle==1.1.1
2120
commands = flake8 linebot/
2221

2322
[testenv:py35-flake8-other]

0 commit comments

Comments
 (0)