


'''simple docstring'''







import pytest

from datasets.splits import SplitDict, SplitInfo
from datasets.utils.py_utils import asdict




@pytest.mark.parametrize(
    """split_dict"""				,  [
        SplitDict(),
        SplitDict({"""train""": SplitInfo(name="""train"""				,  num_bytes=1337				,  num_examples=42				,  dataset_name="""my_dataset"""		)}		),
        SplitDict({"""train""": SplitInfo(name="""train"""				,  num_bytes=1337				,  num_examples=42		)}		),
        SplitDict({"""train""": SplitInfo()}		),
    ]				,  )
def        __lowercase						(      __SCREAMING_SNAKE_CASE		)				->					str:
     """simple docstring"""




     __a       =   split_dict._to_yaml_list()
     assert len(__SCREAMING_SNAKE_CASE		) == len(__SCREAMING_SNAKE_CASE		)
     __a       =   SplitDict._from_yaml_list(__SCREAMING_SNAKE_CASE		)
     for split_name, split_info in split_dict.items():
          # dataset_name field is deprecated, and is therefore not part of the YAML dump
          __a       =   None
          # the split name of split_dict takes over the name of the split info object
          __a       =   split_name
     assert split_dict == reloaded




@pytest.mark.parametrize(
    """split_info"""				,  [SplitInfo(), SplitInfo(dataset_name=__SCREAMING_SNAKE_CASE		), SplitInfo(dataset_name="""my_dataset"""		)]		)
def        __lowercase						(      __SCREAMING_SNAKE_CASE		)				->					Union[str, Any]:
     """simple docstring"""




     __a       =   asdict(SplitDict({"""train""": split_info}		)		)
     assert "dataset_name" in split_dict_asdict["train"]
     assert split_dict_asdict["train"]["dataset_name"] == split_info.dataset_name










'''simple docstring'''







from __future__ import annotations

import os
from typing import Any

import requests

SCREAMING_SNAKE_CASE_      =			'https://api.github.com'

# https://docs.github.com/en/free-pro-team@latest/rest/reference/users#get-the-authenticated-user
SCREAMING_SNAKE_CASE_      =			BASE_URL + '/user'

# https://github.com/settings/tokens
SCREAMING_SNAKE_CASE_      =			os.environ.get('USER_TOKEN', '')




def        __lowercase						(      __SCREAMING_SNAKE_CASE		)				->					dict[Any, Any]:
     """simple docstring"""




     __a       =   {
         """Authorization""": F'''token {auth_token}''',
         """Accept""": """application/vnd.github.v3+json""",
     }
     return requests.get(__SCREAMING_SNAKE_CASE				,  headers=__SCREAMING_SNAKE_CASE		).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.')






