Skip to content

Commit

Permalink
Merge branch 'master' into invoice-payload-filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
Bibo-Joshi committed Jan 2, 2024
2 parents 8b677e1 + 7fcfad4 commit 07492ea
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 24 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/type_completeness.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ jobs:
json.load(open("pr.json", "rb"))["typeCompleteness"]["completenessScore"]
)
base_text = f"This PR changes type completeness from {round(base, 3)} to {round(pr, 3)}."
if base == 0:
text = f"Something is broken in the workflow. Reported type completeness is 0. 💥"
set_summary(text)
print(Path("pr.readable").read_text(encoding="utf-8"))
error(text)
exit(1)
if pr < (base - 0.001):
text = f"{base_text} ❌"
set_summary(text)
Expand Down
18 changes: 9 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Make sure that the additional_dependencies here match requirements.txt
# Make sure that the additional_dependencies here match requirements(-opts).txt

ci:
autofix_prs: false
autoupdate_schedule: monthly

repos:
- repo: https://github.com/psf/black
rev: 23.11.0
rev: 23.12.1
hooks:
- id: black
args:
Expand All @@ -17,7 +17,7 @@ repos:
hooks:
- id: flake8
- repo: https://github.com/PyCQA/pylint
rev: v3.0.1
rev: v3.0.3
hooks:
- id: pylint
files: ^(telegram|examples)/.*\.py$
Expand All @@ -28,14 +28,14 @@ repos:
- --jobs=0

additional_dependencies:
- httpx~=0.25.2
- httpx~=0.26.0
- tornado~=6.4
- APScheduler~=3.10.4
- cachetools~=5.3.2
- aiolimiter~=1.1.0
- . # this basically does `pip install -e .`
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.7.1
rev: v1.8.0
hooks:
- id: mypy
name: mypy-ptb
Expand All @@ -44,7 +44,7 @@ repos:
- types-pytz
- types-cryptography
- types-cachetools
- httpx~=0.25.2
- httpx~=0.26.0
- tornado~=6.4
- APScheduler~=3.10.4
- cachetools~=5.3.2
Expand All @@ -69,21 +69,21 @@ repos:
args:
- --py38-plus
- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
name: isort
args:
- --diff
- --check
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.1.6'
rev: 'v0.1.9'
hooks:
- id: ruff
name: ruff
files: ^(telegram|examples|tests)/.*\.py$
additional_dependencies:
- httpx~=0.25.2
- httpx~=0.26.0
- tornado~=6.4
- APScheduler~=3.10.4
- cachetools~=5.3.2
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ As these features are *optional*, the corresponding 3rd party dependencies are n
Instead, they are listed as optional dependencies.
This allows to avoid unnecessary dependency conflicts for users who don't need the optional features.

The only required dependency is `httpx ~= 0.25.2 <https://www.python-httpx.org>`_ for
The only required dependency is `httpx ~= 0.26.0 <https://www.python-httpx.org>`_ for
``telegram.request.HTTPXRequest``, the default networking backend.

``python-telegram-bot`` is most useful when used along with additional libraries.
Expand Down
2 changes: 1 addition & 1 deletion README_RAW.rst
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ As these features are *optional*, the corresponding 3rd party dependencies are n
Instead, they are listed as optional dependencies.
This allows to avoid unnecessary dependency conflicts for users who don't need the optional features.

The only required dependency is `httpx ~= 0.25.2 <https://www.python-httpx.org>`_ for
The only required dependency is `httpx ~= 0.26.0 <https://www.python-httpx.org>`_ for
``telegram.request.HTTPXRequest``, the default networking backend.

``python-telegram-bot`` is most useful when used along with additional libraries.
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# versions and only increase the lower bound if necessary

# httpx has no stable release yet, so let's be cautious for now
httpx ~= 0.25.2
httpx ~= 0.26.0
2 changes: 1 addition & 1 deletion telegram/ext/_jobqueue.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def __init__(self) -> None:

self._application: Optional[weakref.ReferenceType[Application]] = None
self._executor = AsyncIOExecutor()
self.scheduler: AsyncIOScheduler = AsyncIOScheduler(**self.scheduler_configuration)
self.scheduler: "AsyncIOScheduler" = AsyncIOScheduler(**self.scheduler_configuration)

def __repr__(self) -> str:
"""Give a string representation of the JobQueue in the form ``JobQueue[application=...]``.
Expand Down
2 changes: 1 addition & 1 deletion telegram/ext/_messagehandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ async def callback(update: Update, context: CallbackContext)

def __init__(
self,
filters: filters_module.BaseFilter,
filters: Optional[filters_module.BaseFilter],
callback: HandlerCallback[Update, CCT, RT],
block: DVType[bool] = DEFAULT_TRUE,
):
Expand Down
2 changes: 1 addition & 1 deletion telegram/request/_httpxrequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def __init__(
)
self._client_kwargs = {
"timeout": timeout,
"proxies": proxy,
"proxy": proxy,
"limits": limits,
"transport": transport,
**http_kwargs,
Expand Down
12 changes: 6 additions & 6 deletions tests/ext/test_applicationbuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def test_default_values(self, bot, monkeypatch, builder):
@dataclass
class Client:
timeout: object
proxies: object
proxy: object
limits: object
http1: object
http2: object
Expand Down Expand Up @@ -150,7 +150,7 @@ class Client:
assert get_updates_client.limits == httpx.Limits(
max_connections=1, max_keepalive_connections=1
)
assert get_updates_client.proxies is None
assert get_updates_client.proxy is None
assert get_updates_client.timeout == httpx.Timeout(
connect=5.0, read=5.0, write=5.0, pool=1.0
)
Expand All @@ -159,7 +159,7 @@ class Client:

client = app.bot.request._client
assert client.limits == httpx.Limits(max_connections=256, max_keepalive_connections=256)
assert client.proxies is None
assert client.proxy is None
assert client.timeout == httpx.Timeout(connect=5.0, read=5.0, write=5.0, pool=1.0)
assert client.http1 is True
assert not client.http2
Expand Down Expand Up @@ -378,7 +378,7 @@ def test_all_bot_args_custom(
@dataclass
class Client:
timeout: object
proxies: object
proxy: object
limits: object
http1: object
http2: object
Expand All @@ -396,7 +396,7 @@ class Client:

assert client.timeout == httpx.Timeout(pool=3, connect=2, read=4, write=5)
assert client.limits == httpx.Limits(max_connections=1, max_keepalive_connections=1)
assert client.proxies == "proxy"
assert client.proxy == "proxy"
assert client.http1 is True
assert client.http2 is False

Expand All @@ -414,7 +414,7 @@ class Client:

assert client.timeout == httpx.Timeout(pool=3, connect=2, read=4, write=5)
assert client.limits == httpx.Limits(max_connections=1, max_keepalive_connections=1)
assert client.proxies == "get_updates_proxy"
assert client.proxy == "get_updates_proxy"
assert client.http1 is True
assert client.http2 is False

Expand Down
9 changes: 6 additions & 3 deletions tests/request/test_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,9 @@ async def do_request(self_, *args, **kwargs) -> Tuple[int, bytes]:
DEFAULT_NONE,
)

print("warnings")
for entry in recwarn:
print(entry.message)
if media:
assert len(recwarn) == 1
assert "will default to `BaseRequest.DEFAULT_NONE` instead of 20" in str(
Expand All @@ -435,7 +438,7 @@ def test_init(self, monkeypatch, proxy_argument):
@dataclass
class Client:
timeout: object
proxies: object
proxy: object
limits: object
http1: object
http2: object
Expand All @@ -445,7 +448,7 @@ class Client:

request = HTTPXRequest()
assert request._client.timeout == httpx.Timeout(connect=5.0, read=5.0, write=5.0, pool=1.0)
assert request._client.proxies is None
assert request._client.proxy is None
assert request._client.limits == httpx.Limits(
max_connections=1, max_keepalive_connections=1
)
Expand All @@ -461,7 +464,7 @@ class Client:
"pool_timeout": 46,
}
request = HTTPXRequest(**kwargs)
assert request._client.proxies == "proxy"
assert request._client.proxy == "proxy"
assert request._client.limits == httpx.Limits(
max_connections=42, max_keepalive_connections=42
)
Expand Down

0 comments on commit 07492ea

Please sign in to comment.