Add docstring style checker and fixing some

This commit is contained in:
leandrotoledo 2016-01-13 14:09:35 -02:00
parent a539a0c3a5
commit dfc75cc64e
32 changed files with 41 additions and 41 deletions

View file

@ -7,11 +7,14 @@ clean:
find . -name '*.pyo' -exec rm -f {} \;
find . -name '*~' -exec rm -f {} \;
pep257:
pep257 telegram
pep8:
flake8 telegram
lint:
pylint -E telegram
pylint -E telegram --disable=no-name-in-module,import-error
test:
nosetests
@ -22,6 +25,7 @@ install:
help:
@echo "Available targets:"
@echo "- clean Clean up the source directory"
@echo "- pep257 Check docstring style with pep257"
@echo "- pep8 Check style with flake8"
@echo "- lint Check style with pylint"
@echo "- test Run tests"

View file

@ -1,4 +1,5 @@
flake8
nose
pep257
pylint
unittest2
unittest2

View file

@ -52,9 +52,9 @@ from .dispatcher import Dispatcher
from .jobqueue import JobQueue
from .updater import Updater
__all__ = ['Bot', 'Updater', 'Dispatcher', 'Emoji', 'TelegramError',
__all__ = ('Bot', 'Updater', 'Dispatcher', 'Emoji', 'TelegramError',
'InputFile', 'ReplyMarkup', 'ForceReply', 'ReplyKeyboardHide',
'ReplyKeyboardMarkup', 'UserProfilePhotos', 'ChatAction',
'Location', 'Contact', 'Video', 'Sticker', 'Document', 'File',
'Audio', 'PhotoSize', 'Chat', 'Update', 'ParseMode', 'Message',
'User', 'TelegramObject', 'NullHandler', 'Voice', 'JobQueue']
'User', 'TelegramObject', 'NullHandler', 'Voice', 'JobQueue')

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains a object that represents a Telegram Audio"""
"""This module contains a object that represents a Telegram Audio."""
from telegram import TelegramObject

View file

@ -17,14 +17,14 @@
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""Base class for Telegram Objects"""
"""Base class for Telegram Objects."""
import json
from abc import ABCMeta
class TelegramObject(object):
"""Base class for most telegram objects"""
"""Base class for most telegram objects."""
__metaclass__ = ABCMeta

View file

@ -18,7 +18,7 @@
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains a object that represents a Telegram Bot"""
"""This module contains a object that represents a Telegram Bot."""
import functools
import logging

View file

@ -18,7 +18,7 @@
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains a object that represents a Telegram Chat"""
"""This module contains a object that represents a Telegram Chat."""
from telegram import TelegramObject

View file

@ -18,7 +18,7 @@
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains a object that represents a Telegram ChatAction"""
"""This module contains a object that represents a Telegram ChatAction."""
class ChatAction(object):

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains a object that represents a Telegram Contact"""
"""This module contains a object that represents a Telegram Contact."""
from telegram import TelegramObject

View file

@ -17,10 +17,8 @@
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains the Dispatcher class."""
"""
This module contains the Dispatcher class.
"""
import logging
from functools import wraps
from inspect import getargspec

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains a object that represents a Telegram Document"""
"""This module contains a object that represents a Telegram Document."""
from telegram import PhotoSize, TelegramObject

View file

@ -19,7 +19,7 @@
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains a object that represents an Emoji"""
"""This module contains a object that represents an Emoji."""
from future.utils import bytes_to_native_str as n

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains a object that represents a Telegram Error"""
"""This module contains a object that represents a Telegram Error."""
def _lstrip_str(in_s, lstr):

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains a object that represents a Telegram File"""
"""This module contains a object that represents a Telegram File."""
from os.path import basename

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains a object that represents a Telegram ForceReply"""
"""This module contains a object that represents a Telegram ForceReply."""
from telegram import ReplyMarkup

View file

@ -18,7 +18,7 @@
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains a object that represents a Telegram InputFile"""
"""This module contains a object that represents a Telegram InputFile."""
try:
from email.generator import _make_boundary as choose_boundary

View file

@ -17,9 +17,7 @@
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""
This module contains the class JobQueue
"""
"""This module contains the class JobQueue."""
import logging
import time

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains a object that represents a Telegram Location"""
"""This module contains a object that represents a Telegram Location."""
from telegram import TelegramObject

View file

@ -18,7 +18,7 @@
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains a object that represents a Telegram Message"""
"""This module contains a object that represents a Telegram Message."""
from datetime import datetime
from time import mktime

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains a object that represents a logging NullHandler"""
"""This module contains a object that represents a logging NullHandler."""
import logging

View file

@ -19,7 +19,7 @@
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains a object that represents a Telegram
Message Parse Modes"""
Message Parse Modes."""
class ParseMode(object):

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains a object that represents a Telegram PhotoSize"""
"""This module contains a object that represents a Telegram PhotoSize."""
from telegram import TelegramObject

View file

@ -18,7 +18,7 @@
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains a object that represents a Telegram
ReplyKeyboardHide"""
ReplyKeyboardHide."""
from telegram import ReplyMarkup

View file

@ -18,7 +18,7 @@
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains a object that represents a Telegram
ReplyKeyboardMarkup"""
ReplyKeyboardMarkup."""
from telegram import ReplyMarkup

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""Base class for Telegram ReplyMarkup Objects"""
"""Base class for Telegram ReplyMarkup Objects."""
from telegram import TelegramObject

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains a object that represents a Telegram Sticker"""
"""This module contains a object that represents a Telegram Sticker."""
from telegram import PhotoSize, TelegramObject

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains a object that represents a Telegram Update"""
"""This module contains a object that represents a Telegram Update."""
from telegram import Message, TelegramObject

View file

@ -18,10 +18,9 @@
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""
This module contains the class Updater, which tries to make creating Telegram
Bots intuitive!
"""
"""This module contains the class Updater, which tries to make creating
Telegram bots intuitive."""
import logging
import os
import ssl

View file

@ -18,7 +18,7 @@
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains a object that represents a Telegram User"""
"""This module contains a object that represents a Telegram User."""
from telegram import TelegramObject

View file

@ -18,7 +18,7 @@
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains a object that represents a Telegram
UserProfilePhotos"""
UserProfilePhotos."""
from telegram import PhotoSize, TelegramObject

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains a object that represents a Telegram Video"""
"""This module contains a object that represents a Telegram Video."""
from telegram import PhotoSize, TelegramObject

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains a object that represents a Telegram Voice"""
"""This module contains a object that represents a Telegram Voice."""
from telegram import TelegramObject