Skip to content

Commit

Permalink
Single, squashed asyncio commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Bibo-Joshi committed Dec 18, 2021
1 parent 65f3599 commit 074756b
Show file tree
Hide file tree
Showing 132 changed files with 7,755 additions and 16,135 deletions.
1 change: 0 additions & 1 deletion .deepsource.toml
Expand Up @@ -5,7 +5,6 @@ test_patterns = ["tests/**"]
exclude_patterns = [
"tests/**",
"docs/**",
"telegram/vendor/**",
"setup.py",
"setup-raw.py"
]
Expand Down
6 changes: 0 additions & 6 deletions .github/CONTRIBUTING.rst
Expand Up @@ -153,12 +153,6 @@ Here's how to make a one-off code change.
$ git commit -a
$ git push origin your-branch-name
- If after merging you see local modified files in ``telegram/vendor/`` directory, that you didn't actually touch, that means you need to update submodules with this command:

.. code-block:: bash
$ git submodule update --init --recursive
- At the end, the reviewer will merge the pull request.

6. **Tidy up!** Delete the feature branch from both your local clone and the GitHub repository:
Expand Down
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Expand Up @@ -8,7 +8,7 @@ Hey! You're PRing? Cool! Please have a look at the below checklist. It's here to
- [ ] Created new or adapted existing unit tests
- [ ] Documented code changes according to the [CSI standard](https://standards.mousepawmedia.com/en/stable/csi.html)
- [ ] Added myself alphabetically to `AUTHORS.rst` (optional)
- [ ] Added new classes & modules to the docs
- [ ] Added new classes & modules to the docs and all suitable `__all__` s


### If the PR contains API changes (otherwise, you can delete this passage)
Expand Down
9 changes: 0 additions & 9 deletions .github/workflows/test.yml
Expand Up @@ -20,9 +20,6 @@ jobs:
fail-fast: False
steps:
- uses: actions/checkout@v2
- name: Initialize vendored libs
run:
git submodule update --init --recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
Expand Down Expand Up @@ -77,9 +74,6 @@ jobs:
fail-fast: False
steps:
- uses: actions/checkout@v2
- name: Initialize vendored libs
run:
git submodule update --init --recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
Expand All @@ -106,9 +100,6 @@ jobs:
fail-fast: False
steps:
- uses: actions/checkout@v2
- name: Initialize vendored libs
run:
git submodule update --init --recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
Expand Down
4 changes: 0 additions & 4 deletions .gitmodules

This file was deleted.

19 changes: 3 additions & 16 deletions .pre-commit-config.yaml
Expand Up @@ -23,7 +23,7 @@ repos:
# run pylint across multiple cpu cores to speed it up-
- --jobs=0 # See https://pylint.pycqa.org/en/latest/user_guide/run.html?#parallel-execution to know more
additional_dependencies:
- certifi
- httpx >= 0.20.0,<1.0
- tornado>=6.1
- APScheduler==3.6.3
- cachetools==4.2.2
Expand All @@ -38,25 +38,12 @@ repos:
- types-ujson
- types-pytz
- types-cryptography
- types-certifi
- types-cachetools
- certifi
- httpx >= 0.20.0,<1.0
- tornado>=6.1
- APScheduler==3.6.3
- cachetools==4.2.2
- . # this basically does `pip install -e .`
- id: mypy
name: mypy-examples
files: ^examples/.*\.py$
args:
- --no-strict-optional
- --follow-imports=silent
additional_dependencies:
- certifi
- tornado>=6.1
- APScheduler==3.6.3
- cachetools==4.2.2
- . # this basically does `pip install -e .`
- . # this basically does `pip install -e .`n
- repo: https://github.com/asottile/pyupgrade
rev: v2.29.0
hooks:
Expand Down
7 changes: 0 additions & 7 deletions AUTHORS.rst
Expand Up @@ -14,13 +14,6 @@ Emeritus maintainers include
`Jannes Höke <https://github.com/jh0ker>`_ (`@jh0ker <https://t.me/jh0ker>`_ on Telegram),
`Noam Meltzer <https://github.com/tsnoam>`_, `Pieter Schutz <https://github.com/eldinnie>`_ and `Jasmin Bom <https://github.com/jsmnbom>`_.

Vendored packages
-----------------

We're vendoring urllib3 as part of ``python-telegram-bot`` which is distributed under the MIT
license. For more info, full credits & license terms, the sources can be found here:
`https://github.com/python-telegram-bot/urllib3`.

Contributors
------------

Expand Down
6 changes: 0 additions & 6 deletions README.rst
Expand Up @@ -130,12 +130,6 @@ Or you can install from source with:
$ git clone https://github.com/python-telegram-bot/python-telegram-bot --recursive
$ cd python-telegram-bot
$ python setup.py install
In case you have a previously cloned local repository already, you should initialize the added urllib3 submodule before installing with:

.. code:: shell
$ git submodule update --init --recursive
---------------------
Optional Dependencies
Expand Down
6 changes: 0 additions & 6 deletions README_RAW.rst
Expand Up @@ -125,12 +125,6 @@ Or you can install from source with:
$ cd python-telegram-bot
$ python setup-raw.py install
In case you have a previously cloned local repository already, you should initialize the added urllib3 submodule before installing with:

.. code:: shell
$ git submodule update --init --recursive
----
Note
----
Expand Down
8 changes: 8 additions & 0 deletions docs/source/telegram.request.baserequest.rst
@@ -0,0 +1,8 @@
:github_url: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/request/_baserequest.py

telegram.request.BaseRequest
============================

.. autoclass:: telegram.request.BaseRequest
:members:
:show-inheritance:
8 changes: 8 additions & 0 deletions docs/source/telegram.request.requestdata.rst
@@ -0,0 +1,8 @@
:github_url: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/request/_requestdata.py

telegram.request.RequestData
============================

.. autoclass:: telegram.request.RequestData
:members:
:show-inheritance:
8 changes: 4 additions & 4 deletions docs/source/telegram.request.rst
@@ -1,8 +1,8 @@
:github_url: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/request.py
:github_url: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/request

telegram.request Module
=======================

.. automodule:: telegram.request
:members:
:show-inheritance:
.. toctree::
telegram.request.baserequest
telegram.request.requestdata
2 changes: 1 addition & 1 deletion examples/persistentconversationbot.py
Expand Up @@ -123,7 +123,7 @@ def done(update: Update, context: CallbackContext.DEFAULT_TYPE) -> int:
del context.user_data['choice']

update.message.reply_text(
f"I learned these facts about you: {facts_to_str(context.user_data)}Until next time!",
f"I learned these facts about you: {facts_to_str(context.user_data)} Until next time!",
reply_markup=ReplyKeyboardRemove(),
)
return ConversationHandler.END
Expand Down
6 changes: 3 additions & 3 deletions examples/rawapibot.py
Expand Up @@ -11,7 +11,7 @@
from time import sleep

import telegram
from telegram.error import NetworkError, Unauthorized
from telegram.error import NetworkError, Forbidden


UPDATE_ID = None
Expand All @@ -24,7 +24,7 @@ def main() -> NoReturn:
bot = telegram.Bot('TOKEN')

# get the first pending update_id, this is so we can skip over it in case
# we get an "Unauthorized" exception.
# we get an "Forbidden" exception.
try:
UPDATE_ID = bot.get_updates()[0].update_id
except IndexError:
Expand All @@ -37,7 +37,7 @@ def main() -> NoReturn:
echo(bot)
except NetworkError:
sleep(1)
except Unauthorized:
except Forbidden:
# The user has removed or blocked the bot.
UPDATE_ID += 1

Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Expand Up @@ -7,5 +7,4 @@ skip-string-normalization = true
# so that pre-commit run --all-files does the correct thing
# see https://github.com/psf/black/issues/1778
force-exclude = '^(?!/(telegram|examples|tests)/).*\.py$'
include = '(telegram|examples|tests)/.*\.py$'
exclude = 'telegram/vendor'
include = '(telegram|examples|tests)/.*\.py$'
1 change: 1 addition & 0 deletions requirements-dev.txt
Expand Up @@ -10,6 +10,7 @@ mypy==0.910
pyupgrade==2.29.0

pytest==6.2.5
pytest-asyncio==0.16.0

flaky
beautifulsoup4
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
@@ -1,6 +1,6 @@
# Make sure to install those as additional_dependencies in the
# pre-commit hooks for pylint & mypy
certifi
httpx >= 0.20.0,<1.0
# only telegram.ext: # Keep this line here; used in setup(-raw).py
tornado>=6.1
APScheduler==3.6.3
Expand Down
11 changes: 3 additions & 8 deletions setup.cfg
Expand Up @@ -13,10 +13,9 @@ upload-dir = docs/build/html
max-line-length = 99
ignore = W503, W605
extend-ignore = E203
exclude = setup.py, setup-raw.py docs/source/conf.py, telegram/vendor

[pylint]
ignore=vendor
exclude = setup.py, setup-raw.py docs/source/conf.py
per-file-ignores =
telegram/ext/_jobqueue.py:E402

[pylint.message-control]
disable = C0330,R0801,R0913,R0904,R0903,R0902,W0511,C0116,C0115,W0703,R0914,R0914,C0302,R0912,R0915,R0401
Expand All @@ -40,7 +39,6 @@ concurrency = thread, multiprocessing
omit =
tests/
telegram/__main__.py
telegram/vendor/*

[coverage:report]
exclude_lines =
Expand Down Expand Up @@ -69,8 +67,5 @@ strict_optional = False
[mypy-telegram.ext._utils.webhookhandler]
warn_unused_ignores = False

[mypy-urllib3.*]
ignore_missing_imports = True

[mypy-apscheduler.*]
ignore_missing_imports = True
9 changes: 1 addition & 8 deletions setup.py
@@ -1,13 +1,11 @@
#!/usr/bin/env python
"""The setup and build script for the python-telegram-bot library."""
import subprocess
import sys
from pathlib import Path
import sys

from setuptools import setup, find_packages

UPSTREAM_URLLIB3_FLAG = '--with-upstream-urllib3'


def get_requirements(raw=False):
"""Build the requirements list for this project"""
Expand All @@ -33,11 +31,6 @@ def get_packages_requirements(raw=False):
exclude.append('telegram.ext*')

packs = find_packages(exclude=exclude)
# Allow for a package install to not use the vendored urllib3
if UPSTREAM_URLLIB3_FLAG in sys.argv:
sys.argv.remove(UPSTREAM_URLLIB3_FLAG)
reqs.append('urllib3 >= 1.19.1')
packs = [x for x in packs if not x.startswith('telegram.vendor.ptb_urllib3')]

return packs, reqs

Expand Down
3 changes: 0 additions & 3 deletions telegram/__main__.py
Expand Up @@ -21,8 +21,6 @@
import sys
from typing import Optional

import certifi

from . import __version__ as telegram_ver
from .constants import BOT_API_VERSION

Expand All @@ -41,7 +39,6 @@ def print_ver_info() -> None: # skipcq: PY-D0003
git_revision = _git_revision()
print(f'python-telegram-bot {telegram_ver}' + (f' ({git_revision})' if git_revision else ''))
print(f'Bot API {BOT_API_VERSION}')
print(f'certifi {certifi.__version__}') # type: ignore[attr-defined]
sys_version = sys.version.replace('\n', ' ')
print(f'Python {sys_version}')

Expand Down

0 comments on commit 074756b

Please sign in to comment.