





'''simple docstring'''

import copy
import fnmatch
import json
import os
import pickle as pkl
import shutil
import sys
import tarfile
import tempfile
from collections import OrderedDict
from contextlib import contextmanager
from functools import partial
from hashlib import shaaaa
from io import BytesIO
from pathlib import Path
from urllib.parse import urlparse
from zipfile import ZipFile, is_zipfile

import cva
import numpy as np
import requests
import wget
from filelock import FileLock
from PIL import Image
from tqdm.auto import tqdm
from yaml import Loader, dump, load


try:
      import torch

      lowercase_			       =				True
except ImportError:
      lowercase_			       =				False


try:
      from torch.hub import _get_torch_home

      lowercase_			       =				_get_torch_home()
except ImportError:
      lowercase_			       =				os.path.expanduser(
          os.getenv("""TORCH_HOME""", os.path.join(os.getenv("""XDG_CACHE_HOME""", """~/.cache"""), """torch"""))
      )

lowercase_			       =				os.path.join(torch_cache_home, """transformers""")

lowercase_			       =				"""https://cdn.huggingface.co"""
lowercase_			       =				"""https://s3.amazonaws.com/models.huggingface.co/bert"""
lowercase_			       =				"""/""".join(str(Path(__file__).resolve()).split("""/""")[:-1])
lowercase_			       =				os.path.join(PATH, """config.yaml""")
lowercase_			       =				os.path.join(PATH, """attributes.txt""")
lowercase_			       =				os.path.join(PATH, """objects.txt""")
lowercase_			       =				os.getenv("""PYTORCH_PRETRAINED_BERT_CACHE""", default_cache_path)
lowercase_			       =				os.getenv("""PYTORCH_TRANSFORMERS_CACHE""", PYTORCH_PRETRAINED_BERT_CACHE)
lowercase_			       =				os.getenv("""TRANSFORMERS_CACHE""", PYTORCH_TRANSFORMERS_CACHE)
lowercase_			       =				"""pytorch_model.bin"""
lowercase_			       =				"""config.yaml"""





def lowerCamelCase		(  __lowerCamelCase				:					str=OBJECTS      , __lowerCamelCase				:					Dict=ATTRIBUTES					)		->str:
    _SCREAMING_SNAKE_CASE             =    []
    with open(__lowerCamelCase					) as f:
        for object in f.readlines():
            vg_classes.append(object.split(""","""					)[0].lower().strip()					)

    _SCREAMING_SNAKE_CASE             =    []
    with open(__lowerCamelCase					) as f:
        for object in f.readlines():
            vg_attrs.append(object.split(""","""					)[0].lower().strip()					)
    return vg_classes, vg_attrs





def lowerCamelCase		(  __lowerCamelCase				:					Optional[int]					)		->Optional[Any]:
    _SCREAMING_SNAKE_CASE             =    OrderedDict()
    with open(__lowerCamelCase      , """rb"""					) as f:
        _SCREAMING_SNAKE_CASE             =    pkl.load(__lowerCamelCase					)["""model"""]
    for k in copy.deepcopy(list(ckp.keys()					)					):
        _SCREAMING_SNAKE_CASE             =    ckp.pop(__lowerCamelCase					)
        if isinstance(__lowerCamelCase      , np.ndarray					):
            _SCREAMING_SNAKE_CASE             =    torch.tensor(__lowerCamelCase					)
        else:
            assert isinstance(__lowerCamelCase      , torch.tensor					), type(__lowerCamelCase					)
        _SCREAMING_SNAKE_CASE             =    v
    return r


class       a_  :

    '''simple docstring'''
    UpperCamelCase									=				{}


    def __init__(	self				,	A				,	A = "root"				,	A=0 )	->     int:
        _SCREAMING_SNAKE_CASE             =    name
        _SCREAMING_SNAKE_CASE             =    level
        _SCREAMING_SNAKE_CASE             =    {}
        for k, v in dictionary.items():
            if v is None:
                raise ValueError()
            _SCREAMING_SNAKE_CASE             =    copy.deepcopy(A )
            _SCREAMING_SNAKE_CASE             =    copy.deepcopy(A )
            if isinstance(A				,	A ):
                _SCREAMING_SNAKE_CASE             =    Config(A				,	name=A				,	level=level + 1 )
            _SCREAMING_SNAKE_CASE             =    v
            setattr(self				,	A				,	A )

        _SCREAMING_SNAKE_CASE             =    d


    def __repr__(	self )	->     int:
        return str(list((self._pointer.keys()) ) )


    def __setattr__(	self				,	A				,	A )	->     int:
        _SCREAMING_SNAKE_CASE             =    val
        _SCREAMING_SNAKE_CASE             =    val
        _SCREAMING_SNAKE_CASE             =    key.split(""".""" )
        _SCREAMING_SNAKE_CASE             =    len(A ) - 1
        _SCREAMING_SNAKE_CASE             =    self._pointer
        if len(A ) > 1:
            for i, l in enumerate(A ):
                if hasattr(self				,	A ) and isinstance(getattr(self				,	A )				,	A ):
                    setattr(getattr(self				,	A )				,	""".""".join(levels[i:] )				,	A )
                if l == last_level:
                    _SCREAMING_SNAKE_CASE             =    val
                else:
                    _SCREAMING_SNAKE_CASE             =    pointer[l]


    def     snake_case_(	self )	->     str:
        return self._pointer


    def     snake_case_(	self				,	A				,	A )	->     Any:
        with open(f'{file_name}'				,	"""w""" ) as stream:
            dump(A				,	A )


    def     snake_case_(	self				,	A				,	A )	->     str:
        with open(f'{file_name}'				,	"""w""" ) as stream:
            json.dump(A				,	A )


    @staticmethod
    def     snake_case_(	A )	->     List[str]:
        with open(A ) as stream:
            _SCREAMING_SNAKE_CASE             =    load(A				,	Loader=A )
        return data


    def __str__(	self )	->     List[str]:
        _SCREAMING_SNAKE_CASE             =    """    """
        if self._name != "root":
            _SCREAMING_SNAKE_CASE             =    f'{t * (self._level-1)}{self._name}:\n'
        else:
            _SCREAMING_SNAKE_CASE             =    """"""
        _SCREAMING_SNAKE_CASE             =    self._level
        for i, (k, v) in enumerate(self._pointer.items() ):
            if isinstance(A				,	A ):
                r += f'{t * (self._level)}{v}\n'
                self._level += 1
            else:
                r += f'{t * (self._level)}{k}: {v} ({type(A ).__name__})\n'
            _SCREAMING_SNAKE_CASE             =    level
        return r[:-1]


    @classmethod
    def     snake_case_(	cls				,	A				,	**A )	->     str:
        _SCREAMING_SNAKE_CASE       , _SCREAMING_SNAKE_CASE             =    cls.get_config_dict(A				,	**A )
        return cls(A )





    @classmethod
    def     snake_case_(	cls				,	A				,	**A )	->     Any:
        _SCREAMING_SNAKE_CASE             =    kwargs.pop("""cache_dir"""				,	A )
        _SCREAMING_SNAKE_CASE             =    kwargs.pop("""force_download"""				,	A )
        _SCREAMING_SNAKE_CASE             =    kwargs.pop("""resume_download"""				,	A )
        _SCREAMING_SNAKE_CASE             =    kwargs.pop("""proxies"""				,	A )
        _SCREAMING_SNAKE_CASE             =    kwargs.pop("""local_files_only"""				,	A )

        if os.path.isdir(A ):
            _SCREAMING_SNAKE_CASE             =    os.path.join(A				,	A )
        elif os.path.isfile(A ) or is_remote_url(A ):
            _SCREAMING_SNAKE_CASE             =    pretrained_model_name_or_path
        else:
            _SCREAMING_SNAKE_CASE             =    hf_bucket_url(A				,	filename=A				,	use_cdn=A )

        try:
            # Load from URL or cache if already cached
            _SCREAMING_SNAKE_CASE             =    cached_path(
                A				,	cache_dir=A				,	force_download=A				,	proxies=A				,	resume_download=A				,	local_files_only=A				,	)
            # Load config dict
            if resolved_config_file is None:
                raise EnvironmentError

            _SCREAMING_SNAKE_CASE             =    Config.load_yaml(A )

        except EnvironmentError:
            _SCREAMING_SNAKE_CASE             =    """Can't load config for"""
            raise EnvironmentError(A )

        if resolved_config_file == config_file:
            print("""loading configuration file from path""" )
        else:
            print("""loading configuration file cache""" )

        return Config.load_yaml(A ), kwargs





def lowerCamelCase		(  __lowerCamelCase				:					Any					)		->List[str]:
    _SCREAMING_SNAKE_CASE             =    torch.load("""dump.pt"""      , map_location=in_tensor.device					)
    _SCREAMING_SNAKE_CASE             =    in_tensor.numpy()
    _SCREAMING_SNAKE_CASE             =    out_tensor.numpy()[0]
    print(na.shape      , na[0, 0, :5]					)
    print(na.shape      , na[0, 0, :5]					)
    assert np.allclose(__lowerCamelCase      , __lowerCamelCase      , rtol=0.01      , atol=0.1					), (
        F'{sum([1 for x in np.isclose(__lowerCamelCase      , __lowerCamelCase      , rtol=0.01      , atol=0.1					).flatten() if x is False]					)/len(na.flatten()					)*100:.4f} %'
        " element-wise mismatch"
    )
    raise Exception("""tensors are all good"""					)

    # Hugging face functions below





def lowerCamelCase		(  __lowerCamelCase				:					Optional[Any]					)		->List[str]:
    _SCREAMING_SNAKE_CASE             =    urlparse(__lowerCamelCase					)
    return parsed.scheme in ("http", "https")





def lowerCamelCase		(  __lowerCamelCase				:					str      , __lowerCamelCase				:					str      , __lowerCamelCase				:					Dict=True					)		->str:
    _SCREAMING_SNAKE_CASE             =    CLOUDFRONT_DISTRIB_PREFIX if use_cdn else S3_BUCKET_PREFIX
    _SCREAMING_SNAKE_CASE             =    """/""" not in model_id
    if legacy_format:
        return F'{endpoint}/{model_id}-{filename}'
    else:
        return F'{endpoint}/{model_id}/{filename}'





def lowerCamelCase		(  __lowerCamelCase				:					str      , __lowerCamelCase				:					List[str]      , __lowerCamelCase				:					Any=None      , __lowerCamelCase				:					List[str]=0      , __lowerCamelCase				:					List[str]=None      , )		->Any:
    _SCREAMING_SNAKE_CASE             =    """python/{}""".format(sys.version.split()[0]					)
    if _torch_available:
        ua += "; torch/{}".format(torch.__version__					)
    if isinstance(__lowerCamelCase      , __lowerCamelCase					):
        ua += "; " + "; ".join("""{}/{}""".format(__lowerCamelCase      , __lowerCamelCase					) for k, v in user_agent.items()					)
    elif isinstance(__lowerCamelCase      , __lowerCamelCase					):
        ua += "; " + user_agent
    _SCREAMING_SNAKE_CASE             =    {"""user-agent""": ua}
    if resume_size > 0:
        _SCREAMING_SNAKE_CASE             =    """bytes=%d-""" % (resume_size,)
    _SCREAMING_SNAKE_CASE             =    requests.get(__lowerCamelCase      , stream=__lowerCamelCase      , proxies=__lowerCamelCase      , headers=__lowerCamelCase					)
    if response.status_code == 416:  # Range not satisfiable
        return
    _SCREAMING_SNAKE_CASE             =    response.headers.get("""Content-Length"""					)
    _SCREAMING_SNAKE_CASE             =    resume_size + int(__lowerCamelCase					) if content_length is not None else None
    _SCREAMING_SNAKE_CASE             =    tqdm(
        unit="""B"""      , unit_scale=__lowerCamelCase      , total=__lowerCamelCase      , initial=__lowerCamelCase      , desc="""Downloading"""      , )
    for chunk in response.iter_content(chunk_size=1024					):
        if chunk:  # filter out keep-alive new chunks
            progress.update(len(__lowerCamelCase					)					)
            temp_file.write(__lowerCamelCase					)
    progress.close()





def lowerCamelCase		(  __lowerCamelCase				:					int      , __lowerCamelCase				:					Any=None      , __lowerCamelCase				:					List[str]=False      , __lowerCamelCase				:					Tuple=None      , __lowerCamelCase				:					Dict=10      , __lowerCamelCase				:					List[Any]=False      , __lowerCamelCase				:					str=None      , __lowerCamelCase				:					List[Any]=False      , )		->List[str]:
    if cache_dir is None:
        _SCREAMING_SNAKE_CASE             =    TRANSFORMERS_CACHE
    if isinstance(__lowerCamelCase      , __lowerCamelCase					):
        _SCREAMING_SNAKE_CASE             =    str(__lowerCamelCase					)

    os.makedirs(__lowerCamelCase      , exist_ok=__lowerCamelCase					)

    _SCREAMING_SNAKE_CASE             =    None
    if not local_files_only:
        try:
            _SCREAMING_SNAKE_CASE             =    requests.head(__lowerCamelCase      , allow_redirects=__lowerCamelCase      , proxies=__lowerCamelCase      , timeout=__lowerCamelCase					)
            if response.status_code == 200:
                _SCREAMING_SNAKE_CASE             =    response.headers.get("""ETag"""					)
        except (EnvironmentError, requests.exceptions.Timeout):
            # etag is already None
            pass

    _SCREAMING_SNAKE_CASE             =    url_to_filename(__lowerCamelCase      , __lowerCamelCase					)

    # get cache path to put the file
    _SCREAMING_SNAKE_CASE             =    os.path.join(__lowerCamelCase      , __lowerCamelCase					)

    # etag is None = we don't have a connection, or url doesn't exist, or is otherwise inaccessible.
    # try to get the last downloaded one
    if etag is None:
        if os.path.exists(__lowerCamelCase					):
            return cache_path
        else:
            _SCREAMING_SNAKE_CASE             =    [
                file
                for file in fnmatch.filter(os.listdir(__lowerCamelCase					)      , filename + """.*"""					)
                if not file.endswith(""".json"""					) and not file.endswith(""".lock"""					)
            ]
            if len(__lowerCamelCase					) > 0:
                return os.path.join(__lowerCamelCase      , matching_files[-1]					)
            else:
                # If files cannot be found and local_files_only=True,
                # the models might've been found if local_files_only=False
                # Notify the user about that
                if local_files_only:
                    raise ValueError(
                        """Cannot find the requested files in the cached path and outgoing traffic has been"""
                        """ disabled. To enable model look-ups and downloads online, set 'local_files_only'"""
                        """ to False."""					)
                return None

    # From now on, etag is not None.
    if os.path.exists(__lowerCamelCase					) and not force_download:
        return cache_path

    # Prevent parallel downloads of the same file with a lock.
    _SCREAMING_SNAKE_CASE             =    cache_path + """.lock"""
    with FileLock(__lowerCamelCase					):
        # If the download just completed while the lock was activated.
        if os.path.exists(__lowerCamelCase					) and not force_download:
            # Even if returning early like here, the lock will be released.
            return cache_path

        if resume_download:
            _SCREAMING_SNAKE_CASE             =    cache_path + """.incomplete"""

            @contextmanager
            def _resumable_file_manager():
                with open(__lowerCamelCase      , """a+b"""					) as f:
                    yield f

            _SCREAMING_SNAKE_CASE             =    _resumable_file_manager
            if os.path.exists(__lowerCamelCase					):
                _SCREAMING_SNAKE_CASE             =    os.stat(__lowerCamelCase					).st_size
            else:
                _SCREAMING_SNAKE_CASE             =    0
        else:
            _SCREAMING_SNAKE_CASE             =    partial(tempfile.NamedTemporaryFile      , dir=__lowerCamelCase      , delete=__lowerCamelCase					)
            _SCREAMING_SNAKE_CASE             =    0

        # Download to temporary file, then copy to cache dir once finished.
        # Otherwise you get corrupt cache entries if the download gets interrupted.
        with temp_file_manager() as temp_file:
            print(
                """%s not found in cache or force_download set to True, downloading to %s"""      , __lowerCamelCase      , temp_file.name      , )

            http_get(
                __lowerCamelCase      , __lowerCamelCase      , proxies=__lowerCamelCase      , resume_size=__lowerCamelCase      , user_agent=__lowerCamelCase      , )

        os.replace(temp_file.name      , __lowerCamelCase					)

        _SCREAMING_SNAKE_CASE             =    {"""url""": url, """etag""": etag}
        _SCREAMING_SNAKE_CASE             =    cache_path + """.json"""
        with open(__lowerCamelCase      , """w"""					) as meta_file:
            json.dump(__lowerCamelCase      , __lowerCamelCase					)

    return cache_path





def lowerCamelCase		(  __lowerCamelCase				:					str      , __lowerCamelCase				:					Optional[int]=None					)		->Union[str, Any]:
    _SCREAMING_SNAKE_CASE             =    url.encode("""utf-8"""					)
    _SCREAMING_SNAKE_CASE             =    shaaaa(__lowerCamelCase					)
    _SCREAMING_SNAKE_CASE             =    url_hash.hexdigest()

    if etag:
        _SCREAMING_SNAKE_CASE             =    etag.encode("""utf-8"""					)
        _SCREAMING_SNAKE_CASE             =    shaaaa(__lowerCamelCase					)
        filename += "." + etag_hash.hexdigest()

    if url.endswith(""".h5"""					):
        filename += ".h5"

    return filename





def lowerCamelCase		(  __lowerCamelCase				:					Union[str, Any]      , __lowerCamelCase				:					List[str]=None      , __lowerCamelCase				:					Dict=False      , __lowerCamelCase				:					Any=None      , __lowerCamelCase				:					List[str]=False      , __lowerCamelCase				:					Any=None      , __lowerCamelCase				:					Dict=False      , __lowerCamelCase				:					Optional[int]=False      , __lowerCamelCase				:					List[Any]=False      , )		->Any:
    if cache_dir is None:
        _SCREAMING_SNAKE_CASE             =    TRANSFORMERS_CACHE
    if isinstance(__lowerCamelCase      , __lowerCamelCase					):
        _SCREAMING_SNAKE_CASE             =    str(__lowerCamelCase					)
    if isinstance(__lowerCamelCase      , __lowerCamelCase					):
        _SCREAMING_SNAKE_CASE             =    str(__lowerCamelCase					)

    if is_remote_url(__lowerCamelCase					):
        # URL, so get it from the cache (downloading if necessary)
        _SCREAMING_SNAKE_CASE             =    get_from_cache(
            __lowerCamelCase      , cache_dir=__lowerCamelCase      , force_download=__lowerCamelCase      , proxies=__lowerCamelCase      , resume_download=__lowerCamelCase      , user_agent=__lowerCamelCase      , local_files_only=__lowerCamelCase      , )
    elif os.path.exists(__lowerCamelCase					):
        # File, and it exists.
        _SCREAMING_SNAKE_CASE             =    url_or_filename
    elif urlparse(__lowerCamelCase					).scheme == "":
        # File, but it doesn't exist.
        raise EnvironmentError("""file {} not found""".format(__lowerCamelCase					)					)
    else:
        # Something unknown
        raise ValueError("""unable to parse {} as a URL or as a local path""".format(__lowerCamelCase					)					)

    if extract_compressed_file:
        if not is_zipfile(__lowerCamelCase					) and not tarfile.is_tarfile(__lowerCamelCase					):
            return output_path

        # Path where we extract compressed archives
        # We avoid '.' in dir name and add "-extracted" at the end: "./model.zip" => "./model-zip-extracted/"
        _SCREAMING_SNAKE_CASE       , _SCREAMING_SNAKE_CASE             =    os.path.split(__lowerCamelCase					)
        _SCREAMING_SNAKE_CASE             =    output_file.replace("""."""      , """-"""					) + """-extracted"""
        _SCREAMING_SNAKE_CASE             =    os.path.join(__lowerCamelCase      , __lowerCamelCase					)

        if os.path.isdir(__lowerCamelCase					) and os.listdir(__lowerCamelCase					) and not force_extract:
            return output_path_extracted

        # Prevent parallel extractions
        _SCREAMING_SNAKE_CASE             =    output_path + """.lock"""
        with FileLock(__lowerCamelCase					):
            shutil.rmtree(__lowerCamelCase      , ignore_errors=__lowerCamelCase					)
            os.makedirs(__lowerCamelCase					)
            if is_zipfile(__lowerCamelCase					):
                with ZipFile(__lowerCamelCase      , """r"""					) as zip_file:
                    zip_file.extractall(__lowerCamelCase					)
                    zip_file.close()
            elif tarfile.is_tarfile(__lowerCamelCase					):
                _SCREAMING_SNAKE_CASE             =    tarfile.open(__lowerCamelCase					)
                tar_file.extractall(__lowerCamelCase					)
                tar_file.close()
            else:
                raise EnvironmentError("""Archive format of {} could not be identified""".format(__lowerCamelCase					)					)

        return output_path_extracted

    return output_path





def lowerCamelCase		(  __lowerCamelCase				:					Optional[int]      , __lowerCamelCase				:					List[str]=","					)		->Optional[int]:
    assert isinstance(__lowerCamelCase      , __lowerCamelCase					)
    if os.path.isfile(__lowerCamelCase					):
        with open(__lowerCamelCase					) as f:
            _SCREAMING_SNAKE_CASE             =    eval(f.read()					)
    else:
        _SCREAMING_SNAKE_CASE             =    requests.get(__lowerCamelCase					)
        try:
            _SCREAMING_SNAKE_CASE             =    requests.json()
        except Exception:
            _SCREAMING_SNAKE_CASE             =    req.content.decode()
            assert data is not None, "could not connect"
            try:
                _SCREAMING_SNAKE_CASE             =    eval(__lowerCamelCase					)
            except Exception:
                _SCREAMING_SNAKE_CASE             =    data.split("""\n"""					)
        req.close()
    return data





def lowerCamelCase		(  __lowerCamelCase				:					int					)		->Any:
    _SCREAMING_SNAKE_CASE             =    requests.get(__lowerCamelCase					)
    _SCREAMING_SNAKE_CASE             =    np.array(Image.open(BytesIO(response.content					)					)					)
    return img





def lowerCamelCase		(  __lowerCamelCase				:					Tuple					)		->int:
    _SCREAMING_SNAKE_CASE             =    url.split("""/"""					)[-1]
    if fn not in os.listdir(os.getcwd()					):
        wget.download(__lowerCamelCase					)
    with open(__lowerCamelCase      , """rb"""					) as stream:
        _SCREAMING_SNAKE_CASE             =    pkl.load(__lowerCamelCase					)
    _SCREAMING_SNAKE_CASE             =    weights.pop("""model"""					)
    _SCREAMING_SNAKE_CASE             =    {}
    for k, v in model.items():
        _SCREAMING_SNAKE_CASE             =    torch.from_numpy(__lowerCamelCase					)
        if "running_var" in k:
            _SCREAMING_SNAKE_CASE             =    torch.tensor([0]					)
            _SCREAMING_SNAKE_CASE             =    k.replace("""running_var"""      , """num_batches_tracked"""					)
            _SCREAMING_SNAKE_CASE             =    zero
    return new





def lowerCamelCase		(  )		->Dict:
    print(F'{os.path.abspath(os.path.join(__lowerCamelCase      , os.pardir					)					)}/demo.ipynb'					)





def lowerCamelCase		(  __lowerCamelCase				:					Any      , __lowerCamelCase				:					Optional[int]="RGB"					)		->Optional[Any]:
    assert isinstance(__lowerCamelCase      , __lowerCamelCase					)
    if os.path.isfile(__lowerCamelCase					):
        _SCREAMING_SNAKE_CASE             =    cva.imread(__lowerCamelCase					)
    else:
        _SCREAMING_SNAKE_CASE             =    get_image_from_url(__lowerCamelCase					)
        assert img is not None, F'could not connect to: {im}'
    _SCREAMING_SNAKE_CASE             =    cva.cvtColor(__lowerCamelCase      , cva.COLOR_BGR2RGB					)
    if input_format == "RGB":
        _SCREAMING_SNAKE_CASE             =    img[:, :, ::-1]
    return img






def lowerCamelCase		(  __lowerCamelCase				:					str      , __lowerCamelCase				:					int=1					)		->int:
    return (images[i : i + batch] for i in range(0      , len(__lowerCamelCase					)      , __lowerCamelCase					))










'''simple docstring'''

import math
from timeit import timeit





def lowerCamelCase		(  __lowerCamelCase				:					int					)		->int:
    _SCREAMING_SNAKE_CASE             =    0
    _SCREAMING_SNAKE_CASE             =    abs(__lowerCamelCase					)
    while True:
        _SCREAMING_SNAKE_CASE             =    n // 10
        digits += 1
        if n == 0:
            break
    return digits





def lowerCamelCase		(  __lowerCamelCase				:					int					)		->int:
    return 1 if n == 0 else math.floor(math.log(abs(__lowerCamelCase					)      , 10					) + 1					)





def lowerCamelCase		(  __lowerCamelCase				:					int					)		->int:
    return len(str(abs(__lowerCamelCase					)					)					)





def lowerCamelCase		(  )		->None:
    from collections.abc import Callable

    def benchmark_a_function(__lowerCamelCase				:					Callable      , __lowerCamelCase				:					int					) -> None:
        _SCREAMING_SNAKE_CASE             =    F'{func.__name__}({value})'
        _SCREAMING_SNAKE_CASE             =    timeit(F'__main__.{call}'      , setup="""import __main__"""					)
        print(F'{call}: {func(__lowerCamelCase					)} -- {timing} seconds'					)

    for value in (26_2144, 1125_8999_0684_2624, 126_7650_6002_2822_9401_4967_0320_5376):
        for func in (num_digits, num_digits_fast, num_digits_faster):
            benchmark_a_function(__lowerCamelCase      , __lowerCamelCase					)
        print()


if __name__ == "__main__":
      import doctest

      doctest.testmod()
      benchmark()



