




"""simple docstring"""




import time
from contextlib import contextmanager
from pathlib import Path

import pytest
import requests
from huggingface_hub.hf_api import HfApi, HfFolder


lowerCAmelCase__							=				'__DUMMY_TRANSFORMERS_USER__'
lowerCAmelCase__							=				'Dummy User'
lowerCAmelCase__							=				'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'

lowerCAmelCase__							=				'https://hub-ci.huggingface.co'
lowerCAmelCase__							=				CI_HUB_ENDPOINT + '/datasets/{repo_id}/resolve/{revision}/{path}'
lowerCAmelCase__							=				CI_HUB_ENDPOINT + '/{repo_id}/resolve/{revision}/{filename}'
lowerCAmelCase__							=				Path('~/.huggingface/hub_ci_token').expanduser()



@pytest.fixture
def        _lowerCamelCase ( __a    ):
		monkeypatch.setattr(
		    '''huggingface_hub.file_download.HUGGINGFACE_CO_URL_TEMPLATE''',							__a    )



@pytest.fixture
def        _lowerCamelCase ( __a    ):
		monkeypatch.setattr('''datasets.config.HF_ENDPOINT''',							__a    )
		monkeypatch.setattr('''datasets.config.HUB_DATASETS_URL''',							__a    )



@pytest.fixture
def        _lowerCamelCase ( __a    ):
		monkeypatch.setattr('''huggingface_hub.hf_api.HfFolder.path_token''',							__a    )



@pytest.fixture
def        _lowerCamelCase ( __a,							__a    ):
		HfFolder.save_token(__a    )
		yield
		HfFolder.delete_token()



@pytest.fixture(scope='''session'''    )
def        _lowerCamelCase ( ):
		return HfApi(endpoint=__a    )



@pytest.fixture(scope='''session'''    )
def        _lowerCamelCase ( __a    ):
		SCREAMING_SNAKE_CASE_						 = HfFolder.get_token()
		HfFolder.save_token(__a    )
		yield CI_HUB_USER_TOKEN
		if previous_token is not None:
				HfFolder.save_token(__a    )



@pytest.fixture
def        _lowerCamelCase ( __a    ):
		def _cleanup_repo(__a    ):
				hf_api.delete_repo(__a,							token=__a,							repo_type='''dataset'''    )

		return _cleanup_repo



@pytest.fixture
def        _lowerCamelCase ( __a    ):
		@contextmanager
		def _temporary_repo(__a    ):
				try:
						yield repo_id
				finally:
						cleanup_repo(__a    )

		return _temporary_repo



@pytest.fixture(scope='''session'''    )
def        _lowerCamelCase ( __a,							__a,							__a    ):
		SCREAMING_SNAKE_CASE_						 = F'repo_txt_data-{int(time.time() * 10E3    )}'
		SCREAMING_SNAKE_CASE_						 = F'{CI_HUB_USER}/{repo_name}'
		hf_api.create_repo(__a,							token=__a,							repo_type='''dataset''',							private=__a    )
		hf_api.upload_file(
		    token=__a,							path_or_fileobj=str(__a    ),							path_in_repo='''data/text_data.txt''',							repo_id=__a,							repo_type='''dataset''',							)
		yield repo_id
		try:
				hf_api.delete_repo(__a,							token=__a,							repo_type='''dataset'''    )
		except (requests.exceptions.HTTPError, ValueError):  # catch http error and token invalid error
				pass



@pytest.fixture()
def        _lowerCamelCase ( __a,							__a,							__a    ):
		return hf_private_dataset_repo_txt_data_



@pytest.fixture(scope='''session'''    )
def        _lowerCamelCase ( __a,							__a,							__a    ):
		SCREAMING_SNAKE_CASE_						 = F'repo_zipped_txt_data-{int(time.time() * 10E3    )}'
		SCREAMING_SNAKE_CASE_						 = F'{CI_HUB_USER}/{repo_name}'
		hf_api.create_repo(__a,							token=__a,							repo_type='''dataset''',							private=__a    )
		hf_api.upload_file(
		    token=__a,							path_or_fileobj=str(__a    ),							path_in_repo='''data.zip''',							repo_id=__a,							repo_type='''dataset''',							)
		yield repo_id
		try:
				hf_api.delete_repo(__a,							token=__a,							repo_type='''dataset'''    )
		except (requests.exceptions.HTTPError, ValueError):  # catch http error and token invalid error
				pass



@pytest.fixture()
def        _lowerCamelCase ( __a,							__a,							__a    ):
		return hf_private_dataset_repo_zipped_txt_data_



@pytest.fixture(scope='''session'''    )
def        _lowerCamelCase ( __a,							__a,							__a    ):
		SCREAMING_SNAKE_CASE_						 = F'repo_zipped_img_data-{int(time.time() * 10E3    )}'
		SCREAMING_SNAKE_CASE_						 = F'{CI_HUB_USER}/{repo_name}'
		hf_api.create_repo(__a,							token=__a,							repo_type='''dataset''',							private=__a    )
		hf_api.upload_file(
		    token=__a,							path_or_fileobj=str(__a    ),							path_in_repo='''data.zip''',							repo_id=__a,							repo_type='''dataset''',							)
		yield repo_id
		try:
				hf_api.delete_repo(__a,							token=__a,							repo_type='''dataset'''    )
		except (requests.exceptions.HTTPError, ValueError):  # catch http error and token invalid error
				pass



@pytest.fixture()
def        _lowerCamelCase ( __a,							__a,							__a    ):
		return hf_private_dataset_repo_zipped_img_data_

"""simple docstring"""




from __future__ import annotations

import typing
from collections import Counter



def        _lowerCamelCase ( __a    ):
		SCREAMING_SNAKE_CASE_						 = Counter()
		for base in range(1,							max_perimeter + 1    ):
				for perpendicular in range(__a,							max_perimeter + 1    ):
						SCREAMING_SNAKE_CASE_						 = (base * base + perpendicular * perpendicular) ** 0.5
						if hypotenuse == int(__a    ):
								SCREAMING_SNAKE_CASE_						 = int(base + perpendicular + hypotenuse    )
								if perimeter > max_perimeter:
										continue
								triplets[perimeter] += 1
		return triplets



def        _lowerCamelCase ( __a = 1_000    ):
		SCREAMING_SNAKE_CASE_						 = pythagorean_triple(__a    )
		return triplets.most_common(1    )[0][0]


if __name__ == "__main__":
						print(f'''Perimeter {solution()} has maximum solutions''')