Skip to content

Commit

Permalink
Install stubs for python-requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Felixoid committed Mar 5, 2024
1 parent 770d710 commit 34bb405
Show file tree
Hide file tree
Showing 16 changed files with 23 additions and 27 deletions.
1 change: 1 addition & 0 deletions docker/test/style/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ RUN apt-get update && env DEBIAN_FRONTEND=noninteractive apt-get install --yes \
yamllint \
locales \
&& pip3 install black==23.12.0 boto3 codespell==2.2.1 mypy==1.8.0 PyGithub unidiff pylint==3.1.0 \
requests types-requests \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /var/cache/debconf /tmp/* \
&& rm -rf /root/.cache/pip
Expand Down
2 changes: 1 addition & 1 deletion tests/ci/.mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ warn_unused_ignores = False
warn_return_any = True
no_implicit_reexport = True
strict_equality = True
strict_concatenate = True
extra_checks = True
5 changes: 3 additions & 2 deletions tests/ci/build_download_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from typing import Any, Callable, List, Union

# isort: off
import requests # type: ignore
import requests

# isort: on

Expand Down Expand Up @@ -90,7 +90,8 @@ def set_auth_header():
ratelimit_exceeded = (
e.response.status_code == 403
and b"rate limit exceeded"
in e.response._content # pylint:disable=protected-access
# pylint:disable-next=protected-access
in (e.response._content or b"")
)
try_auth = e.response.status_code == 404
if (ratelimit_exceeded or try_auth) and not token_is_set:
Expand Down
2 changes: 1 addition & 1 deletion tests/ci/cancel_and_rerun_workflow_lambda/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from threading import Thread
from typing import Any, Dict, List, Optional, Tuple

import requests # type: ignore
import requests
from lambda_shared.pr import CATEGORY_TO_LABEL, check_pr_description
from lambda_shared.token import get_cached_access_token

Expand Down
2 changes: 1 addition & 1 deletion tests/ci/ci_runners_metrics_lambda/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from datetime import datetime
from typing import Dict, List

import requests # type: ignore
import requests
import boto3 # type: ignore
from botocore.exceptions import ClientError # type: ignore

Expand Down
2 changes: 1 addition & 1 deletion tests/ci/clean_lost_instances_lambda/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from dataclasses import dataclass
from typing import Dict, List

import requests # type: ignore
import requests
import boto3 # type: ignore
from botocore.exceptions import ClientError # type: ignore

Expand Down
2 changes: 1 addition & 1 deletion tests/ci/clickhouse_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from pathlib import Path
from typing import Dict, List, Optional

import requests # type: ignore
import requests
from get_robot_token import get_parameter_from_ssm
from pr_info import PRInfo
from report import TestResults
Expand Down
2 changes: 1 addition & 1 deletion tests/ci/download_release_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os
import logging

import requests # type: ignore
import requests

from requests.adapters import HTTPAdapter # type: ignore
from urllib3.util.retry import Retry # type: ignore
Expand Down
2 changes: 1 addition & 1 deletion tests/ci/get_previous_release_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import re
from typing import List, Optional, Tuple

import requests # type: ignore
import requests

CLICKHOUSE_TAGS_URL = "https://api.github.com/repos/ClickHouse/ClickHouse/tags"
CLICKHOUSE_PACKAGE_URL = (
Expand Down
2 changes: 1 addition & 1 deletion tests/ci/jepsen_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from typing import Any, List

import boto3 # type: ignore
import requests # type: ignore
import requests
from build_download_helper import (
download_build_with_progress,
get_build_name_for_check,
Expand Down
2 changes: 1 addition & 1 deletion tests/ci/lambda_shared_package/lambda_shared/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from typing import Any, Dict, Iterable, List, Optional

import boto3 # type: ignore
import requests # type: ignore
import requests

RUNNER_TYPE_LABELS = [
"builder",
Expand Down
2 changes: 1 addition & 1 deletion tests/ci/lambda_shared_package/lambda_shared/token.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import boto3 # type: ignore
import jwt
import requests # type: ignore
import requests

from . import cached_value_is_valid

Expand Down
2 changes: 1 addition & 1 deletion tests/ci/runner_token_rotation_lambda/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import sys

import boto3 # type: ignore
import requests # type: ignore
import requests

from lambda_shared.token import get_cached_access_token, get_access_token_by_key_app

Expand Down
18 changes: 6 additions & 12 deletions tests/ci/slack_bot_ci_lambda/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
See also: https://aretestsgreenyet.com/
"""

import os
import json
import base64
import json
import os
import random

import requests # type: ignore
import requests

DRY_RUN_MARK = "<no url, dry run>"

Expand Down Expand Up @@ -139,13 +139,11 @@ def get_play_url(query):


def run_clickhouse_query(query):
url = "https://play.clickhouse.com/?user=play&query=" + requests.utils.quote(query)
url = "https://play.clickhouse.com/?user=play&query=" + requests.compat.quote(query)
res = requests.get(url)
if res.status_code != 200:
print("Failed to execute query: ", res.status_code, res.content)
raise Exception(
"Failed to execute query: {}: {}".format(res.status_code, res.content)
)
res.raise_for_status()

lines = res.text.strip().splitlines()
return [x.split("\t") for x in lines]
Expand Down Expand Up @@ -283,11 +281,7 @@ def send_to_slack_impl(message):
res = requests.post(SLACK_URL, json.dumps(payload))
if res.status_code != 200:
print("Failed to send a message to Slack: ", res.status_code, res.content)
raise Exception(
"Failed to send a message to Slack: {}: {}".format(
res.status_code, res.content
)
)
res.raise_for_status()


def send_to_slack(message):
Expand Down
2 changes: 1 addition & 1 deletion tests/ci/team_keys_lambda/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from queue import Queue
from threading import Thread

import requests # type: ignore
import requests
import boto3 # type: ignore


Expand Down
2 changes: 1 addition & 1 deletion tests/ci/workflow_approve_rerun_lambda/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from collections import namedtuple
from urllib.parse import quote

import requests # type: ignore
import requests
from lambda_shared.pr import TRUSTED_CONTRIBUTORS
from lambda_shared.token import get_cached_access_token

Expand Down

0 comments on commit 34bb405

Please sign in to comment.