





"""simple docstring"""





import importlib
import os
import platform
from pathlib import Path

from packaging import version

from .utils.logging import get_logger


SCREAMING_SNAKE_CASE__ =       get_logger(__name__)

# Datasets
SCREAMING_SNAKE_CASE__ =       "https://s3.amazonaws.com/datasets.huggingface.co/datasets/datasets"
SCREAMING_SNAKE_CASE__ =       "https://cdn-datasets.huggingface.co/datasets/datasets"
SCREAMING_SNAKE_CASE__ =       "https://raw.githubusercontent.com/huggingface/datasets/{revision}/datasets/{path}/{name}"

# Metrics
SCREAMING_SNAKE_CASE__ =       "https://s3.amazonaws.com/datasets.huggingface.co/datasets/metrics"
SCREAMING_SNAKE_CASE__ =       "https://cdn-datasets.huggingface.co/datasets/metric"
SCREAMING_SNAKE_CASE__ =       "https://raw.githubusercontent.com/huggingface/datasets/{revision}/metrics/{path}/{name}"

# Hub
SCREAMING_SNAKE_CASE__ =       os.environ.get("HF_ENDPOINT", "https://huggingface.co")
SCREAMING_SNAKE_CASE__ =       HF_ENDPOINT + "/datasets/{repo_id}/resolve/{revision}/{path}"
SCREAMING_SNAKE_CASE__ =       "main"

SCREAMING_SNAKE_CASE__ =       version.parse(platform.python_version())

if PY_VERSION < version.parse("3.8"):
       import importlib_metadata
else:
       import importlib.metadata as importlib_metadata

# General environment variables accepted values for booleans
SCREAMING_SNAKE_CASE__ =       {"1", "ON", "YES", "TRUE"}
SCREAMING_SNAKE_CASE__ =       ENV_VARS_TRUE_VALUES.union({"AUTO"})


# Imports
SCREAMING_SNAKE_CASE__ =       version.parse(importlib_metadata.version("dill"))
SCREAMING_SNAKE_CASE__ =       version.parse(importlib_metadata.version("pandas"))
SCREAMING_SNAKE_CASE__ =       version.parse(importlib_metadata.version("pyarrow"))

SCREAMING_SNAKE_CASE__ =       os.environ.get("USE_TF", "AUTO").upper()
SCREAMING_SNAKE_CASE__ =       os.environ.get("USE_TORCH", "AUTO").upper()
SCREAMING_SNAKE_CASE__ =       os.environ.get("USE_JAX", "AUTO").upper()

SCREAMING_SNAKE_CASE__ =       "N/A"
SCREAMING_SNAKE_CASE__ =       False

if USE_TORCH in ENV_VARS_TRUE_AND_AUTO_VALUES and USE_TF not in ENV_VARS_TRUE_VALUES:
       SCREAMING_SNAKE_CASE__ =       importlib.util.find_spec("torch") is not None
       if TORCH_AVAILABLE:
              try:
                     SCREAMING_SNAKE_CASE__ =       version.parse(importlib_metadata.version("torch"))
                     logger.info(f'PyTorch version {TORCH_VERSION} available.')
              except importlib_metadata.PackageNotFoundError:
                     pass
else:
       logger.info("Disabling PyTorch because USE_TF is set")

SCREAMING_SNAKE_CASE__ =       "N/A"
SCREAMING_SNAKE_CASE__ =       False

if USE_TF in ENV_VARS_TRUE_AND_AUTO_VALUES and USE_TORCH not in ENV_VARS_TRUE_VALUES:
       SCREAMING_SNAKE_CASE__ =       importlib.util.find_spec("tensorflow") is not None
       if TF_AVAILABLE:
              # For the metadata, we have to look for both tensorflow and tensorflow-cpu
              for package in [
                  "tensorflow",
                  "tensorflow-cpu",
                  "tensorflow-gpu",
                  "tf-nightly",
                  "tf-nightly-cpu",
                  "tf-nightly-gpu",
                  "intel-tensorflow",
                  "tensorflow-rocm",
                  "tensorflow-macos",
              ]:
                     try:
                            SCREAMING_SNAKE_CASE__ =       version.parse(importlib_metadata.version(package))
                     except importlib_metadata.PackageNotFoundError:
                            continue
                     else:
                            break
              else:
                     SCREAMING_SNAKE_CASE__ =       False
       if TF_AVAILABLE:
              if TF_VERSION.major < 2:
                     logger.info(f'TensorFlow found but with version {TF_VERSION}. `datasets` requires version 2 minimum.')
                     SCREAMING_SNAKE_CASE__ =       False
              else:
                     logger.info(f'TensorFlow version {TF_VERSION} available.')
else:
       logger.info("Disabling Tensorflow because USE_TORCH is set")


SCREAMING_SNAKE_CASE__ =       "N/A"
SCREAMING_SNAKE_CASE__ =       False

if USE_JAX in ENV_VARS_TRUE_AND_AUTO_VALUES:
       SCREAMING_SNAKE_CASE__ =       importlib.util.find_spec("jax") is not None and importlib.util.find_spec("jaxlib") is not None
       if JAX_AVAILABLE:
              try:
                     SCREAMING_SNAKE_CASE__ =       version.parse(importlib_metadata.version("jax"))
                     logger.info(f'JAX version {JAX_VERSION} available.')
              except importlib_metadata.PackageNotFoundError:
                     pass
else:
       logger.info("Disabling JAX because USE_JAX is set to False")


SCREAMING_SNAKE_CASE__ =       os.environ.get("USE_BEAM", "AUTO").upper()
SCREAMING_SNAKE_CASE__ =       "N/A"
SCREAMING_SNAKE_CASE__ =       False
if USE_BEAM in ENV_VARS_TRUE_AND_AUTO_VALUES:
       try:
              SCREAMING_SNAKE_CASE__ =       version.parse(importlib_metadata.version("apache_beam"))
              SCREAMING_SNAKE_CASE__ =       True
              logger.info(f'Apache Beam version {BEAM_VERSION} available.')
       except importlib_metadata.PackageNotFoundError:
              pass
else:
       logger.info("Disabling Apache Beam because USE_BEAM is set to False")


# Optional tools for data loading
SCREAMING_SNAKE_CASE__ =       importlib.util.find_spec("sqlalchemy") is not None

# Optional tools for feature decoding
SCREAMING_SNAKE_CASE__ =       importlib.util.find_spec("PIL") is not None
SCREAMING_SNAKE_CASE__ =       importlib.util.find_spec("soundfile") is not None and version.parse(
    importlib.import_module("soundfile").__libsndfile_version__
) >= version.parse("1.0.31")
SCREAMING_SNAKE_CASE__ =       importlib.util.find_spec("soundfile") is not None and version.parse(
    importlib.import_module("soundfile").__libsndfile_version__
) >= version.parse("1.1.0")

# Optional compression tools
SCREAMING_SNAKE_CASE__ =       importlib.util.find_spec("rarfile") is not None
SCREAMING_SNAKE_CASE__ =       importlib.util.find_spec("zstandard") is not None
SCREAMING_SNAKE_CASE__ =       importlib.util.find_spec("lz4") is not None
SCREAMING_SNAKE_CASE__ =       importlib.util.find_spec("py7zr") is not None


# Cache location
SCREAMING_SNAKE_CASE__ =       "~/.cache"
SCREAMING_SNAKE_CASE__ =       os.getenv("XDG_CACHE_HOME", DEFAULT_XDG_CACHE_HOME)
SCREAMING_SNAKE_CASE__ =       os.path.join(XDG_CACHE_HOME, "huggingface")
SCREAMING_SNAKE_CASE__ =       os.path.expanduser(os.getenv("HF_HOME", DEFAULT_HF_CACHE_HOME))

SCREAMING_SNAKE_CASE__ =       os.path.join(HF_CACHE_HOME, "datasets")
SCREAMING_SNAKE_CASE__ =       Path(os.getenv("HF_DATASETS_CACHE", DEFAULT_HF_DATASETS_CACHE))

SCREAMING_SNAKE_CASE__ =       os.path.join(HF_CACHE_HOME, "metrics")
SCREAMING_SNAKE_CASE__ =       Path(os.getenv("HF_METRICS_CACHE", DEFAULT_HF_METRICS_CACHE))

SCREAMING_SNAKE_CASE__ =       os.path.join(HF_CACHE_HOME, "modules")
SCREAMING_SNAKE_CASE__ =       Path(os.getenv("HF_MODULES_CACHE", DEFAULT_HF_MODULES_CACHE))

SCREAMING_SNAKE_CASE__ =       "downloads"
SCREAMING_SNAKE_CASE__ =       os.path.join(HF_DATASETS_CACHE, DOWNLOADED_DATASETS_DIR)
SCREAMING_SNAKE_CASE__ =       Path(os.getenv("HF_DATASETS_DOWNLOADED_DATASETS_PATH", DEFAULT_DOWNLOADED_DATASETS_PATH))

SCREAMING_SNAKE_CASE__ =       "extracted"
SCREAMING_SNAKE_CASE__ =       os.path.join(DEFAULT_DOWNLOADED_DATASETS_PATH, EXTRACTED_DATASETS_DIR)
SCREAMING_SNAKE_CASE__ =       Path(os.getenv("HF_DATASETS_EXTRACTED_DATASETS_PATH", DEFAULT_EXTRACTED_DATASETS_PATH))

# Download count for the website
SCREAMING_SNAKE_CASE__ =       (
    os.environ.get("HF_UPDATE_DOWNLOAD_COUNTS", "AUTO").upper() in ENV_VARS_TRUE_AND_AUTO_VALUES
)

# Batch size constants. For more info, see:
# https://github.com/apache/arrow/blob/master/docs/source/cpp/arrays.rst#size-limitations-and-recommendations)
SCREAMING_SNAKE_CASE__ =       1_000

# Size of the preloaded record batch in `Dataset.__iter__`
SCREAMING_SNAKE_CASE__ =       10

# Pickling tables works only for small tables (<4GiB)
# For big tables, we write them on disk instead
SCREAMING_SNAKE_CASE__ =       4 << 30

# Max shard size in bytes (e.g. to shard parquet datasets in push_to_hub or download_and_prepare)
SCREAMING_SNAKE_CASE__ =       "500MB"

# Parquet configuration
SCREAMING_SNAKE_CASE__ =       100
SCREAMING_SNAKE_CASE__ =       100
SCREAMING_SNAKE_CASE__ =       100

# Offline mode
SCREAMING_SNAKE_CASE__ =       os.environ.get("HF_DATASETS_OFFLINE", "AUTO").upper() in ENV_VARS_TRUE_VALUES

# In-memory
SCREAMING_SNAKE_CASE__ =       0  # Disabled
SCREAMING_SNAKE_CASE__ =       float(os.environ.get("HF_DATASETS_IN_MEMORY_MAX_SIZE", DEFAULT_IN_MEMORY_MAX_SIZE))

# File names
SCREAMING_SNAKE_CASE__ =       "dataset.arrow"
SCREAMING_SNAKE_CASE__ =       "indices.arrow"
SCREAMING_SNAKE_CASE__ =       "state.json"
SCREAMING_SNAKE_CASE__ =       "dataset_info.json"
SCREAMING_SNAKE_CASE__ =       "dataset_infos.json"
SCREAMING_SNAKE_CASE__ =       "LICENSE"
SCREAMING_SNAKE_CASE__ =       "metric_info.json"
SCREAMING_SNAKE_CASE__ =       "dataset_dict.json"

SCREAMING_SNAKE_CASE__ =       "datasets_modules"

SCREAMING_SNAKE_CASE__ =       255

# Streaming
SCREAMING_SNAKE_CASE__ =       20
SCREAMING_SNAKE_CASE__ =       5

# Datasets without script
SCREAMING_SNAKE_CASE__ =       200
SCREAMING_SNAKE_CASE__ =       10
SCREAMING_SNAKE_CASE__ =       200

# Progress bars
SCREAMING_SNAKE_CASE__ =       0.05  # 20 progress updates per sec













"""simple docstring"""





from scipy.constants import g


def       UpperCAmelCase__							(  SCREAMING_SNAKE_CASE					:						float							,						SCREAMING_SNAKE_CASE					:						float      ):







      '''simple docstring'''




      if mass < 0:
            # handling of negative values of mass
            raise ValueError("""The mass of a body cannot be negative"""      )
      if height < 0:
            # handling of negative values of height
            raise ValueError("""The height above the ground cannot be negative"""      )
      return mass * g * height


if __name__ == "__main__":
       from doctest import testmod

       testmod(name="potential_energy")






