





from __future__ import annotations

import os
from typing import Any

import requests

__UpperCamelCase:	Optional[Any] = """https://api.github.com"""

# https://docs.github.com/en/free-pro-team@latest/rest/reference/users#get-the-authenticated-user
__UpperCamelCase:	List[Any] = BASE_URL + """/user"""

# https://github.com/settings/tokens
__UpperCamelCase:	str = os.environ.get("""USER_TOKEN""", """""")


def       SCREAMING_SNAKE_CASE__  (       _lowercase     : str			)   ->							dict[Any, Any]:




		'''simple docstring'''
		lowercase__					:      List[Any]      =		{
		    'Authorization': f"""token {auth_token}""",
		    'Accept': 'application/vnd.github.v3+json',
		}
		return requests.get(_lowercase   ,    headers=_lowercase			).json()


if __name__ == "__main__":  # pragma: no cover
			if USER_TOKEN:
						for key, value in fetch_github_info(USER_TOKEN).items():
									print(F'{key}: {value}')
			else:
						raise ValueError("""'USER_TOKEN' field cannot be empty.""")









import numpy as np
from sklearn.datasets import fetch_california_housing
from sklearn.metrics import mean_absolute_error, mean_squared_error
from sklearn.model_selection import train_test_split
from xgboost import XGBRegressor


def       SCREAMING_SNAKE_CASE__  (       _lowercase     : dict			)   ->							tuple:




		'''simple docstring'''
		return (data["data"], data["target"])


def       SCREAMING_SNAKE_CASE__  (       _lowercase     : np.ndarray   ,    _lowercase     : np.ndarray   ,    _lowercase     : np.ndarray			)   ->							np.ndarray:




		'''simple docstring'''
		lowercase__					:      List[str]      =		XGBRegressor(verbosity=0   ,    random_state=42			)
		xgb.fit(_lowercase   ,    _lowercase			)
		# Predict target for test data
		lowercase__					:      Union[str, Any]      =		xgb.predict(_lowercase			)
		lowercase__					:      Tuple      =		predictions.reshape(len(_lowercase			)   ,    1			)
		return predictions


def       SCREAMING_SNAKE_CASE__  (       )   ->							None:




		'''simple docstring'''
		lowercase__					:      List[str]      =		fetch_california_housing()
		lowercase__   ,				lowercase__					:      Optional[int]      =		data_handling(_lowercase			)
		lowercase__   ,				lowercase__   ,				lowercase__   ,				lowercase__					:      Optional[Any]      =		train_test_split(
		    _lowercase   ,    _lowercase   ,    test_size=0.25   ,    random_state=1			)
		lowercase__					:      Any      =		xgboost(_lowercase   ,    _lowercase   ,    _lowercase			)
		# Error printing
		print(f"""Mean Absolute Error : {mean_absolute_error(_lowercase   ,    _lowercase			)}"""			)
		print(f"""Mean Square Error  : {mean_squared_error(_lowercase   ,    _lowercase			)}"""			)


if __name__ == "__main__":
			import doctest

			doctest.testmod(verbose=True)
			main()


