<commit_before>#!/usr/bin/env python3
# pylint: disable=too-many-arguments
import sys
import os
import argparse
import yaml
import requests

PACKAGE_LICENSES = ['GPL-2.0']
PACKAGE_VCS_URL = 'https://github.com/performancecopilot/pcp'


class TimeoutHTTPAdapter(requests.adapters.HTTPAdapter):
    """
    https://findwork.dev/blog/advanced-usage-python-requests-timeouts-retries-hooks/
    """

    def __init__(self, *args, **kwargs):
        if "timeout" in kwargs:
            self.timeout = kwargs["timeout"]
            del kwargs["timeout"]
        else:
            raise Exception('Please specify a timeout.')
        super().__init__(*args, **kwargs)

    def send(self, request, **kwargs):
        timeout = kwargs.get("timeout")
        if timeout is None:
            kwargs["timeout"] = self.timeout
        return super().send(request, **kwargs)


class BintrayApi:

    def __init__(self, subject: str, user: str, apikey: str, gpg_passphrase: str, endpoint='https://api.bintray.com',
                 timeout=10*60):
        self.subject = subject
        self.user = user
        self.apikey = apikey
        self.gpg_passphrase = gpg_passphrase
        self.endpoint = endpoint

        self.session = requests.Session()
        retries = requests.packages.urllib3.util.retry.Retry(<commit_msg>ci: increase bintray timeout to 20 minutes<commit_after>#!/usr/bin/env python3
# pylint: disable=too-many-arguments
import sys
import os
import argparse
import yaml
import requests

PACKAGE_LICENSES = ['GPL-2.0']
PACKAGE_VCS_URL = 'https://github.com/performancecopilot/pcp'


class TimeoutHTTPAdapter(requests.adapters.HTTPAdapter):
    """
    https://findwork.dev/blog/advanced-usage-python-requests-timeouts-retries-hooks/
    """

    def __init__(self, *args, **kwargs):
        if "timeout" in kwargs:
            self.timeout = kwargs["timeout"]
            del kwargs["timeout"]
        else:
            raise Exception('Please specify a timeout.')
        super().__init__(*args, **kwargs)

    def send(self, request, **kwargs):
        timeout = kwargs.get("timeout")
        if timeout is None:
            kwargs["timeout"] = self.timeout
        return super().send(request, **kwargs)


class BintrayApi:

    def __init__(self, subject: str, user: str, apikey: str, gpg_passphrase: str, endpoint='https://api.bintray.com',
                 timeout=20*60):
        self.subject = subject
        self.user = user
        self.apikey = apikey
        self.gpg_passphrase = gpg_passphrase
        self.endpoint = endpoint

        self.session = requests.Session()
        retries = requests.packages.urllib3.util.retry.Retry(
{'fraction_non_alphanumeric': 0.12334967936627687, 'fraction_numerical': 0.0067898906073179935, 'mean_word_length': 2.7724039829302987, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1331828', 'n_tokens_mistral': 808, 'n_tokens_neox': 792, 'n_words': 173}