Skip to content

Commit 09230e6

Browse files
authored
Merge pull request python-telegram-bot#649 from python-telegram-bot/fix-docs
Fix some documentation stuff [ci skip]
2 parents 011e321 + 896392d commit 09230e6

File tree

11 files changed

+44
-23
lines changed

11 files changed

+44
-23
lines changed

docs/source/conf.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#
1212
# All configuration values have a default; values that are commented out
1313
# serve to show the default.
14-
1514
import sys
1615
import os
1716
import shlex
@@ -25,7 +24,7 @@
2524
# -- General configuration ------------------------------------------------
2625

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

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

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

290289
# If true, do not generate a @detailmenu in the "Top" node's menu.
291290
#texinfo_no_detailmenu = False
291+
292+
# -- script stuff --------------------------------------------------------
293+
294+
import inspect
295+
296+
297+
def autodoc_skip_member(app, what, name, obj, skip, options):
298+
try:
299+
if inspect.getmodule(obj).__name__.startswith('telegram') and inspect.isfunction(obj):
300+
if name.lower() != name:
301+
return True
302+
except AttributeError:
303+
pass
304+
# Return None so napoleon can handle it
305+
306+
307+
def setup(app):
308+
app.connect('autodoc-skip-member', autodoc_skip_member)

docs/source/ptb-logo-orange.ico

361 KB
Binary file not shown.

telegram/chat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class Chat(TelegramObject):
4141
username(Optional[str]):
4242
first_name(Optional[str]):
4343
last_name(Optional[str]):
44-
bot (Optional[Bot]): The Bot to use for instance methods
44+
bot (Optional[telegram.Bot]): The Bot to use for instance methods
4545
**kwargs (dict): Arbitrary keyword arguments.
4646
4747
"""

telegram/ext/jobqueue.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ def run_once(self, callback, when, context=None, name=None):
166166
name (Optional[str]): The name of the new job. Defaults to ``callback.__name__``
167167
168168
Returns:
169-
Job: The new ``Job`` instance that has been added to the job queue.
169+
telegram.ext.jobqueue.Job: The new ``Job`` instance that has been added to the
170+
job queue.
170171
171172
"""
172173
job = Job(callback, repeat=False, context=context, name=name, job_queue=self)
@@ -201,7 +202,8 @@ def run_repeating(self, callback, interval, first=None, context=None, name=None)
201202
name (Optional[str]): The name of the new job. Defaults to ``callback.__name__``
202203
203204
Returns:
204-
Job: The new ``Job`` instance that has been added to the job queue.
205+
telegram.ext.jobqueue.Job: The new ``Job`` instance that has been added to the
206+
job queue.
205207
206208
"""
207209
job = Job(callback,
@@ -228,7 +230,8 @@ def run_daily(self, callback, time, days=Days.EVERY_DAY, context=None, name=None
228230
name (Optional[str]): The name of the new job. Defaults to ``callback.__name__``
229231
230232
Returns:
231-
Job: The new ``Job`` instance that has been added to the job queue.
233+
telegram.ext.jobqueue.Job: The new ``Job`` instance that has been added to the
234+
job queue.
232235
233236
"""
234237
job = Job(callback,
@@ -366,7 +369,7 @@ class Job(object):
366369
job runs
367370
repeat (bool): If the job runs periodically or only once
368371
name (str): The name of this job
369-
job_queue (JobQueue): The ``JobQueue`` this job belongs to
372+
job_queue (telegram.ext.JobQueue): The ``JobQueue`` this job belongs to
370373
enabled (bool): Boolean property that decides if this job is currently active
371374
372375
Args:

telegram/ext/typehandler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class TypeHandler(Handler):
2727
Handler class to handle updates of custom types.
2828
2929
Args:
30-
type (type): The ``type`` of updates this handler should process, as
30+
type (class): The ``type`` of updates this handler should process, as
3131
determined by ``isinstance``
3232
callback (function): A function that takes ``bot, update`` as
3333
positional arguments. It will be called when the ``check_update``

telegram/ext/updater.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ class Updater(object):
5959
base_url (Optional[str]):
6060
workers (Optional[int]): Amount of threads in the thread pool for
6161
functions decorated with @run_async
62-
bot (Optional[Bot]): A pre-initialized bot instance. If a pre-initizlied bot is used, it is
63-
the user's responsibility to create it using a `Request` instance with a large enough
64-
connection pool.
62+
bot (Optional[telegram.Bot]): A pre-initialized bot instance. If a pre-initizlied bot is
63+
used, it is the user's responsibility to create it using a `Request` instance with
64+
a large enough connection pool.
6565
user_sig_handler (Optional[function]): Takes ``signum, frame`` as positional arguments.
6666
This will be called when a signal is received, defaults are (SIGINT, SIGTERM, SIGABRT)
6767
setable with Updater.idle(stop_signals=(signals))

telegram/inlinequery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class InlineQuery(TelegramObject):
4040
query (str):
4141
offset (str):
4242
location (optional[:class:`telegram.Location`]):
43-
bot (Optional[Bot]): The Bot to use for instance methods
43+
bot (Optional[telegram.Bot]): The Bot to use for instance methods
4444
**kwargs (dict): Arbitrary keyword arguments.
4545
4646
"""

telegram/inputfile.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,22 +79,22 @@ def __init__(self, data):
7979
def headers(self):
8080
"""
8181
Returns:
82-
str:
82+
str
8383
"""
8484
return {'User-agent': USER_AGENT, 'Content-type': self.content_type}
8585

8686
@property
8787
def content_type(self):
8888
"""
8989
Returns:
90-
str:
90+
str
9191
"""
9292
return 'multipart/form-data; boundary=%s' % self.boundary
9393

9494
def to_form(self):
9595
"""
9696
Returns:
97-
str:
97+
str
9898
"""
9999
form = []
100100
form_boundary = '--' + self.boundary
@@ -122,7 +122,7 @@ def to_form(self):
122122
def _parse(form):
123123
"""
124124
Returns:
125-
str:
125+
str
126126
"""
127127
if sys.version_info > (3,):
128128
# on Python 3 form needs to be byte encoded

telegram/message.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,14 @@ class Message(TelegramObject):
9898
about the invoice.
9999
successful_payment (:class:`telegram.SuccessfulPayment`): Message is a service message
100100
about a successful payment, information about the payment.
101-
bot (Optional[Bot]): The Bot to use for instance methods
101+
bot (Optional[telegram.Bot]): The Bot to use for instance methods
102102
103103
Deprecated: 4.0
104104
new_chat_participant (:class:`telegram.User`): Use `new_chat_member`
105105
instead.
106106
107107
left_chat_participant (:class:`telegram.User`): Use `left_chat_member`
108108
instead.
109-
110109
"""
111110

112111
def __init__(self,

telegram/replykeyboardremove.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@ class ReplyKeyboardRemove(ReplyMarkup):
3131
Args:
3232
selective (Optional[bool]): Use this parameter if you want to remove the keyboard for
3333
specific users only. Targets:
34-
1) users that are @mentioned in the text of the Message object;
35-
2) if the bot's message is a reply (has reply_to_message_id), sender of the
36-
original message.
34+
35+
- users that are @mentioned in the text of the Message object
36+
- if the bot's message is a reply (has reply_to_message_id), sender of the
37+
original message.
38+
3739
**kwargs: Arbitrary keyword arguments.
3840
3941
"""

0 commit comments

Comments
 (0)