X Tutup
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
import os
import shlex
Expand All @@ -25,7 +24,7 @@
# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
needs_sphinx = '1.5.4' # fixes issues with autodoc-skip-member and napoleon

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
Expand Down Expand Up @@ -136,7 +135,7 @@
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
html_favicon = 'ptb-logo-orange.ico'

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
Expand Down Expand Up @@ -289,3 +288,21 @@

# If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False

# -- script stuff --------------------------------------------------------

import inspect


def autodoc_skip_member(app, what, name, obj, skip, options):
try:
if inspect.getmodule(obj).__name__.startswith('telegram') and inspect.isfunction(obj):
if name.lower() != name:
return True
except AttributeError:
pass
# Return None so napoleon can handle it


def setup(app):
app.connect('autodoc-skip-member', autodoc_skip_member)
Binary file added docs/source/ptb-logo-orange.ico
Binary file not shown.
2 changes: 1 addition & 1 deletion telegram/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Chat(TelegramObject):
username(Optional[str]):
first_name(Optional[str]):
last_name(Optional[str]):
bot (Optional[Bot]): The Bot to use for instance methods
bot (Optional[telegram.Bot]): The Bot to use for instance methods
**kwargs (dict): Arbitrary keyword arguments.

"""
Expand Down
11 changes: 7 additions & 4 deletions telegram/ext/jobqueue.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ def run_once(self, callback, when, context=None, name=None):
name (Optional[str]): The name of the new job. Defaults to ``callback.__name__``

Returns:
Job: The new ``Job`` instance that has been added to the job queue.
telegram.ext.jobqueue.Job: The new ``Job`` instance that has been added to the
job queue.

"""
job = Job(callback, repeat=False, context=context, name=name, job_queue=self)
Expand Down Expand Up @@ -201,7 +202,8 @@ def run_repeating(self, callback, interval, first=None, context=None, name=None)
name (Optional[str]): The name of the new job. Defaults to ``callback.__name__``

Returns:
Job: The new ``Job`` instance that has been added to the job queue.
telegram.ext.jobqueue.Job: The new ``Job`` instance that has been added to the
job queue.

"""
job = Job(callback,
Expand All @@ -228,7 +230,8 @@ def run_daily(self, callback, time, days=Days.EVERY_DAY, context=None, name=None
name (Optional[str]): The name of the new job. Defaults to ``callback.__name__``

Returns:
Job: The new ``Job`` instance that has been added to the job queue.
telegram.ext.jobqueue.Job: The new ``Job`` instance that has been added to the
job queue.

"""
job = Job(callback,
Expand Down Expand Up @@ -366,7 +369,7 @@ class Job(object):
job runs
repeat (bool): If the job runs periodically or only once
name (str): The name of this job
job_queue (JobQueue): The ``JobQueue`` this job belongs to
job_queue (telegram.ext.JobQueue): The ``JobQueue`` this job belongs to
enabled (bool): Boolean property that decides if this job is currently active

Args:
Expand Down
2 changes: 1 addition & 1 deletion telegram/ext/typehandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class TypeHandler(Handler):
Handler class to handle updates of custom types.

Args:
type (type): The ``type`` of updates this handler should process, as
type (class): The ``type`` of updates this handler should process, as
determined by ``isinstance``
callback (function): A function that takes ``bot, update`` as
positional arguments. It will be called when the ``check_update``
Expand Down
6 changes: 3 additions & 3 deletions telegram/ext/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ class Updater(object):
base_url (Optional[str]):
workers (Optional[int]): Amount of threads in the thread pool for
functions decorated with @run_async
bot (Optional[Bot]): A pre-initialized bot instance. If a pre-initizlied bot is used, it is
the user's responsibility to create it using a `Request` instance with a large enough
connection pool.
bot (Optional[telegram.Bot]): A pre-initialized bot instance. If a pre-initizlied bot is
used, it is the user's responsibility to create it using a `Request` instance with
a large enough connection pool.
user_sig_handler (Optional[function]): Takes ``signum, frame`` as positional arguments.
This will be called when a signal is received, defaults are (SIGINT, SIGTERM, SIGABRT)
setable with Updater.idle(stop_signals=(signals))
Expand Down
2 changes: 1 addition & 1 deletion telegram/inlinequery.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class InlineQuery(TelegramObject):
query (str):
offset (str):
location (optional[:class:`telegram.Location`]):
bot (Optional[Bot]): The Bot to use for instance methods
bot (Optional[telegram.Bot]): The Bot to use for instance methods
**kwargs (dict): Arbitrary keyword arguments.

"""
Expand Down
8 changes: 4 additions & 4 deletions telegram/inputfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,22 +79,22 @@ def __init__(self, data):
def headers(self):
"""
Returns:
str:
str
"""
return {'User-agent': USER_AGENT, 'Content-type': self.content_type}

@property
def content_type(self):
"""
Returns:
str:
str
"""
return 'multipart/form-data; boundary=%s' % self.boundary

def to_form(self):
"""
Returns:
str:
str
"""
form = []
form_boundary = '--' + self.boundary
Expand Down Expand Up @@ -122,7 +122,7 @@ def to_form(self):
def _parse(form):
"""
Returns:
str:
str
"""
if sys.version_info > (3,):
# on Python 3 form needs to be byte encoded
Expand Down
3 changes: 1 addition & 2 deletions telegram/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,14 @@ class Message(TelegramObject):
about the invoice.
successful_payment (:class:`telegram.SuccessfulPayment`): Message is a service message
about a successful payment, information about the payment.
bot (Optional[Bot]): The Bot to use for instance methods
bot (Optional[telegram.Bot]): The Bot to use for instance methods

Deprecated: 4.0
new_chat_participant (:class:`telegram.User`): Use `new_chat_member`
instead.

left_chat_participant (:class:`telegram.User`): Use `left_chat_member`
instead.

"""

def __init__(self,
Expand Down
8 changes: 5 additions & 3 deletions telegram/replykeyboardremove.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ class ReplyKeyboardRemove(ReplyMarkup):
Args:
selective (Optional[bool]): Use this parameter if you want to remove the keyboard for
specific users only. Targets:
1) users that are @mentioned in the text of the Message object;
2) if the bot's message is a reply (has reply_to_message_id), sender of the
original message.

- users that are @mentioned in the text of the Message object
- if the bot's message is a reply (has reply_to_message_id), sender of the
original message.

**kwargs: Arbitrary keyword arguments.

"""
Expand Down
2 changes: 1 addition & 1 deletion telegram/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class User(TelegramObject):
last_name (Optional[str]): User's or bot's last name
username (Optional[str]): User's or bot's username
language_code (Optional[str]): IETF language tag of the user's language
bot (Optional[Bot]): The Bot to use for instance methods
bot (Optional[telegram.Bot]): The Bot to use for instance methods
"""

def __init__(self,
Expand Down
X Tutup