Merge pull request #152 from python-telegram-bot/docstring_pep257_checker

Add docstring style checker and fixing some
This commit is contained in:
Jannes Höke 2016-01-14 15:24:44 +01:00
commit 6166e7f07a
32 changed files with 43 additions and 44 deletions

View file

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

View file

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

View file

@ -19,9 +19,6 @@
"""A library that provides a Python interface to the Telegram Bot API""" """A library that provides a Python interface to the Telegram Bot API"""
__author__ = 'devs@python-telegram-bot.org'
__version__ = '3.2.0'
from .base import TelegramObject from .base import TelegramObject
from .user import User from .user import User
from .chat import Chat from .chat import Chat
@ -52,9 +49,11 @@ from .dispatcher import Dispatcher
from .jobqueue import JobQueue from .jobqueue import JobQueue
from .updater import Updater from .updater import Updater
__all__ = ['Bot', 'Updater', 'Dispatcher', 'Emoji', 'TelegramError', __author__ = 'devs@python-telegram-bot.org'
__version__ = '3.2.0'
__all__ = ('Bot', 'Updater', 'Dispatcher', 'Emoji', 'TelegramError',
'InputFile', 'ReplyMarkup', 'ForceReply', 'ReplyKeyboardHide', 'InputFile', 'ReplyMarkup', 'ForceReply', 'ReplyKeyboardHide',
'ReplyKeyboardMarkup', 'UserProfilePhotos', 'ChatAction', 'ReplyKeyboardMarkup', 'UserProfilePhotos', 'ChatAction',
'Location', 'Contact', 'Video', 'Sticker', 'Document', 'File', 'Location', 'Contact', 'Video', 'Sticker', 'Document', 'File',
'Audio', 'PhotoSize', 'Chat', 'Update', 'ParseMode', 'Message', '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 # You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/]. # 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 from telegram import TelegramObject

View file

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

View file

@ -18,7 +18,7 @@
# You should have received a copy of the GNU Lesser Public License # You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/]. # 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 functools
import logging import logging

View file

@ -18,7 +18,7 @@
# You should have received a copy of the GNU Lesser Public License # You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/]. # 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 from telegram import TelegramObject

View file

@ -18,7 +18,7 @@
# You should have received a copy of the GNU Lesser Public License # You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/]. # 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): class ChatAction(object):

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU Lesser Public License # You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/]. # 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 from telegram import TelegramObject

View file

@ -17,10 +17,8 @@
# You should have received a copy of the GNU Lesser Public License # You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/]. # 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 import logging
from functools import wraps from functools import wraps
from inspect import getargspec from inspect import getargspec

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU Lesser Public License # You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/]. # 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 from telegram import PhotoSize, TelegramObject

View file

@ -19,7 +19,7 @@
# You should have received a copy of the GNU Lesser Public License # You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/]. # 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 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 # You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/]. # 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): def _lstrip_str(in_s, lstr):

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU Lesser Public License # You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/]. # 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 from os.path import basename

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU Lesser Public License # You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/]. # 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 from telegram import ReplyMarkup

View file

@ -18,7 +18,7 @@
# You should have received a copy of the GNU Lesser Public License # You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/]. # 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: try:
from email.generator import _make_boundary as choose_boundary 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 # You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/]. # 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 logging
import time import time

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU Lesser Public License # You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/]. # 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 from telegram import TelegramObject

View file

@ -18,7 +18,7 @@
# You should have received a copy of the GNU Lesser Public License # You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/]. # 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 datetime import datetime
from time import mktime from time import mktime

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU Lesser Public License # You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/]. # 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 import logging

View file

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

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU Lesser Public License # You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/]. # 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 from telegram import TelegramObject

View file

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

View file

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

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU Lesser Public License # You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/]. # 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 from telegram import TelegramObject

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU Lesser Public License # You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/]. # 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 from telegram import PhotoSize, TelegramObject

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU Lesser Public License # You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/]. # 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 from telegram import Message, TelegramObject

View file

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

View file

@ -18,7 +18,7 @@
# You should have received a copy of the GNU Lesser Public License # You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/]. # 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 from telegram import TelegramObject

View file

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

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU Lesser Public License # You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/]. # 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 from telegram import PhotoSize, TelegramObject

View file

@ -17,7 +17,7 @@
# You should have received a copy of the GNU Lesser Public License # You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/]. # 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 from telegram import TelegramObject