diff --git a/Makefile b/Makefile index 147ce77c3..dd0eee05a 100644 --- a/Makefile +++ b/Makefile @@ -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" diff --git a/requirements-dev.txt b/requirements-dev.txt index 5e82bf20b..99bad0940 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,4 +1,5 @@ flake8 nose +pep257 pylint -unittest2 \ No newline at end of file +unittest2 diff --git a/telegram/__init__.py b/telegram/__init__.py index d35258811..2b2a39704 100644 --- a/telegram/__init__.py +++ b/telegram/__init__.py @@ -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') diff --git a/telegram/audio.py b/telegram/audio.py index 7ecf162c3..ae12687df 100644 --- a/telegram/audio.py +++ b/telegram/audio.py @@ -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 diff --git a/telegram/base.py b/telegram/base.py index 09c5b763c..960776c1e 100644 --- a/telegram/base.py +++ b/telegram/base.py @@ -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 diff --git a/telegram/bot.py b/telegram/bot.py index d7080798b..f9555fd0d 100644 --- a/telegram/bot.py +++ b/telegram/bot.py @@ -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 diff --git a/telegram/chat.py b/telegram/chat.py index 00e2d4142..24143dcf6 100644 --- a/telegram/chat.py +++ b/telegram/chat.py @@ -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 diff --git a/telegram/chataction.py b/telegram/chataction.py index f30a89ba7..52ca3462a 100644 --- a/telegram/chataction.py +++ b/telegram/chataction.py @@ -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): diff --git a/telegram/contact.py b/telegram/contact.py index 8ffa8028b..d9ee7e33f 100644 --- a/telegram/contact.py +++ b/telegram/contact.py @@ -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 diff --git a/telegram/dispatcher.py b/telegram/dispatcher.py index 07ea8ecbc..9ad8966a2 100644 --- a/telegram/dispatcher.py +++ b/telegram/dispatcher.py @@ -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 diff --git a/telegram/document.py b/telegram/document.py index 8c05d570c..42949b236 100644 --- a/telegram/document.py +++ b/telegram/document.py @@ -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 diff --git a/telegram/emoji.py b/telegram/emoji.py index 636f0d38f..74ac58370 100644 --- a/telegram/emoji.py +++ b/telegram/emoji.py @@ -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 diff --git a/telegram/error.py b/telegram/error.py index 885c8a33f..329f15000 100644 --- a/telegram/error.py +++ b/telegram/error.py @@ -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): diff --git a/telegram/file.py b/telegram/file.py index b625353e9..9a29e00fc 100644 --- a/telegram/file.py +++ b/telegram/file.py @@ -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 diff --git a/telegram/forcereply.py b/telegram/forcereply.py index 83fc8ae76..39486a3f4 100644 --- a/telegram/forcereply.py +++ b/telegram/forcereply.py @@ -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 diff --git a/telegram/inputfile.py b/telegram/inputfile.py index 7c43bfd72..211a24c4d 100644 --- a/telegram/inputfile.py +++ b/telegram/inputfile.py @@ -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 diff --git a/telegram/jobqueue.py b/telegram/jobqueue.py index e5c63c82f..03e3b4c25 100644 --- a/telegram/jobqueue.py +++ b/telegram/jobqueue.py @@ -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 diff --git a/telegram/location.py b/telegram/location.py index c1ef1b10a..213d26741 100644 --- a/telegram/location.py +++ b/telegram/location.py @@ -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 diff --git a/telegram/message.py b/telegram/message.py index 3cabcad51..bea037b1e 100644 --- a/telegram/message.py +++ b/telegram/message.py @@ -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 diff --git a/telegram/nullhandler.py b/telegram/nullhandler.py index 12aefebac..129c2ac5c 100644 --- a/telegram/nullhandler.py +++ b/telegram/nullhandler.py @@ -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 diff --git a/telegram/parsemode.py b/telegram/parsemode.py index 7e86fb695..a86912dd6 100644 --- a/telegram/parsemode.py +++ b/telegram/parsemode.py @@ -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): diff --git a/telegram/photosize.py b/telegram/photosize.py index 8ea55b8c7..39b39342c 100644 --- a/telegram/photosize.py +++ b/telegram/photosize.py @@ -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 diff --git a/telegram/replykeyboardhide.py b/telegram/replykeyboardhide.py index f24fdcf95..eb76cc778 100644 --- a/telegram/replykeyboardhide.py +++ b/telegram/replykeyboardhide.py @@ -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 diff --git a/telegram/replykeyboardmarkup.py b/telegram/replykeyboardmarkup.py index 0b9530994..9179dbafd 100644 --- a/telegram/replykeyboardmarkup.py +++ b/telegram/replykeyboardmarkup.py @@ -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 diff --git a/telegram/replymarkup.py b/telegram/replymarkup.py index bbf474555..ed0bcfb1f 100644 --- a/telegram/replymarkup.py +++ b/telegram/replymarkup.py @@ -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 diff --git a/telegram/sticker.py b/telegram/sticker.py index 0af7e9701..1774721f4 100644 --- a/telegram/sticker.py +++ b/telegram/sticker.py @@ -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 diff --git a/telegram/update.py b/telegram/update.py index 4df1076d3..6186e0f88 100644 --- a/telegram/update.py +++ b/telegram/update.py @@ -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 diff --git a/telegram/updater.py b/telegram/updater.py index 94c15fafe..5903b63ec 100644 --- a/telegram/updater.py +++ b/telegram/updater.py @@ -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 diff --git a/telegram/user.py b/telegram/user.py index 2562e1151..6ce1cde26 100644 --- a/telegram/user.py +++ b/telegram/user.py @@ -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 diff --git a/telegram/userprofilephotos.py b/telegram/userprofilephotos.py index 85c0875a9..20614b1ee 100644 --- a/telegram/userprofilephotos.py +++ b/telegram/userprofilephotos.py @@ -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 diff --git a/telegram/video.py b/telegram/video.py index e5eb7b6a6..110e234cb 100644 --- a/telegram/video.py +++ b/telegram/video.py @@ -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 diff --git a/telegram/voice.py b/telegram/voice.py index 7f84fbb99..de5950761 100644 --- a/telegram/voice.py +++ b/telegram/voice.py @@ -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