/usr/local/lib/python3.6/site-packages/click/__pycache__
NameSizeModeActions
core.cpython-36.pyc879320644editdlrm
decorators.cpython-36.pyc143500644editdlrm
exceptions.cpython-36.pyc100380644editdlrm
formatting.cpython-36.pyc92390644editdlrm
globals.cpython-36.pyc23600644editdlrm
parser.cpython-36.pyc134390644editdlrm
shell_completion.cpython-36.pyc166130644editdlrm
termui.cpython-36.pyc262610644editdlrm
testing.cpython-36.pyc146710644editdlrm
types.cpython-36.pyc329570644editdlrm
utils.cpython-36.pyc177250644editdlrm
_compat.cpython-36.pyc156730644editdlrm
_termui_impl.cpython-36.pyc156500644editdlrm
_textwrap.cpython-36.pyc14650644editdlrm
_unicodefun.cpython-36.pyc22950644editdlrm
_winconsole.cpython-36.pyc76780644editdlrm
__init__.cpython-36.pyc26480644editdlrm
Edit: /usr/local/lib/python3.6/site-packages/click/__pycache__/utils.cpython-36.pyc (17725B)
3 _TBgI @sddlZddlZddlZddlmZddlmZddlm Z ddlm Z ddlm Z ddlm Z dd lm Z dd lmZdd lmZdd lmZdd lmZddlmZddlmZddlmZejrddlZejdejdejfdZeedddZeedddZejedddZ dHee!eddd Z"Gd!d"d"Z#Gd#d$d$Z$dIej%ejej%ej&eje'e'ej%e'dd'd(d)Z(d*ej)dd+d,Z*dJd*ej%eej%eej+d.d/d0Z,dKeeej%eej%ee'e'ej&d2d3d4Z-ej.ed5d6d7Z/dLej0ee1ej2fe'ed8d9d:Z3dMee'e'ed;dd?d?Z5dej6d@fej%eeedAdBdCZ7d%d%d%dDej8ee'e'e'ej9edEdFdGZ:dS)NN)update_wrapper) ModuleType)_default_text_stderr)_default_text_stdout)_find_binary_writer)auto_wrap_for_ansi)binary_streams)get_filesystem_encoding) open_stream)should_strip_ansi) strip_ansi) text_streams)WIN)resolve_color_defaultF.)Zbound)namereturncCsdj|jjS)N-)joinsplitlower)rr,/tmp/pip-build-0s3hx122/click/click/utils.py _posixifysr)funcrcsfdd}ttjt|S)z0Wraps a function so that it swallows exceptions.c s$y ||Stk rYnXdS)N) Exception)argskwargs)rrrwrapper!s zsafecall..wrapper)rtcastr)rrr)rrsafecalls r")valuerc Cs<t|tr4y |jtStk r2|jddSXt|S)z%Converts a value into a valid string.zutf-8replace) isinstancebytesdecoder UnicodeErrorstr)r#rrrmake_str*s   r*-)help max_lengthrcCs&|jd}|d kr|d|}|j}|s.dS|ddkrF|dd}d}t|d}xpt|D]Z\}}|t||dk7}||krP|d dkrdj|d|dS||kr`||kr`Pq`Wdj|S|td 7}x:|dkr|t|||dk8}||krP|d8}qWdj|d|d S) z+Returns a condensed version of help string.z rNr. z...r2)findrlen enumerater)r,r-Z paragraph_endwords total_length last_indexiwordrrrmake_default_short_help4s4           r;c@seZdZdZdeeejeejeedddZeej d d d Z ed d dZ ej d ddZ dd ddZdd ddZdd ddZddZejejd ddZdS)LazyFilezA lazy file works like a regular file but it does not fully open the file but it does perform some basic checks early to see if the filename parameter does make sense. This is useful for safely opening files for writing. rNstrictF)filenamemodeencodingerrorsatomiccCsh||_||_||_||_||_||dkrBt||||\|_|_n"d|krXt||j d|_d|_dS)Nrr=T) rr@rArBrCr _f should_closeopenclose)selfr?r@rArBrCrrr__init__mszLazyFile.__init__)rrcCst|j|S)N)getattrrF)rHrrrr __getattr__szLazyFile.__getattr__)rcCs*|jdk rt|jSd|jd|jdS)Nz)rDreprrr@)rHrrr__repr__s  zLazyFile.__repr__cCs|jdk r|jSy&t|j|j|j|j|jd\}|_Wn@tk rv}z$ddl m }||j|j d|WYdd}~XnX||_|S)zOpens the file if it's not yet open. This call might fail with a :exc:`FileError`. Not handling this error will produce an error that Click shows. N)rCr) FileError)Zhint) rDr rr@rArBrCrEOSError exceptionsrOstrerror)rHrverOrrrrFs $ $z LazyFile.opencCs|jdk r|jjdS)z+Closes the underlying file, no matter what.N)rDrG)rHrrrrGs zLazyFile.closecCs|jr|jdS)zThis function only closes the file if it was opened by the lazy file wrapper. For instance this will never close stdin. N)rErG)rHrrrclose_intelligentlyszLazyFile.close_intelligentlycCs|S)Nr)rHrrr __enter__szLazyFile.__enter__cCs |jdS)N)rU)rHexc_type exc_valuetbrrr__exit__szLazyFile.__exit__cCs|jt|jS)N)rFiterrD)rHrrr__iter__szLazyFile.__iter__)r=Nr>F)__name__ __module__ __qualname____doc__r)r OptionalboolrIAnyrKrNIOrFrGrUrVrZIteratorAnyStrr\rrrrr<fs$r<c@sjeZdZejddddZeejdddZddd d Z d d Z edd dZ ej ej dddZdS) KeepOpenFileN)filercCs ||_dS)N)_file)rHrhrrrrIszKeepOpenFile.__init__)rrcCs t|j|S)N)rJri)rHrrrrrKszKeepOpenFile.__getattr__)rcCs|S)Nr)rHrrrrVszKeepOpenFile.__enter__cCsdS)Nr)rHrWrXrYrrrrZszKeepOpenFile.__exit__cCs t|jS)N)rMri)rHrrrrNszKeepOpenFile.__repr__cCs t|jS)N)r[ri)rHrrrr\szKeepOpenFile.__iter__)r]r^r_r rdrIr)rcrKrVrZrNrerfr\rrrrrgs rgTF)messagerhnlerrcolorrcCs |dkr|rt}nt}|dk r>t|tttf r>t|}n|}|rj|pLd}t|trb|d7}n|d7}|sz|jdSt|ttfrt|}|dk r|j|j||jdSn>t |}t ||rt |}n"t rt dk rt |}n |st |}|j||jdS)aPrint a message and newline to stdout or a file. This should be used instead of :func:`print` because it provides better support for different data, files, and environments. Compared to :func:`print`, this does the following: - Ensures that the output encoding is not misconfigured on Linux. - Supports Unicode in the Windows console. - Supports writing to binary outputs, and supports writing bytes to text outputs. - Supports colors and styles on Windows. - Removes ANSI color and style codes if the output does not look like an interactive terminal. - Always flushes the output. :param message: The string or bytes to output. Other objects are converted to strings. :param file: The file to write to. Defaults to ``stdout``. :param err: Write to ``stderr`` instead of ``stdout``. :param nl: Print a newline after the message. Enabled by default. :param color: Force showing or hiding colors and other styles. By default Click will remove color if the output does not look like an interactive terminal. .. versionchanged:: 6.0 Support Unicode output on the Windows console. Click does not modify ``sys.stdout``, so ``sys.stdout.write()`` and ``print()`` will still not support Unicode. .. versionchanged:: 4.0 Added the ``color`` parameter. .. versionadded:: 3.0 Added the ``err`` parameter. .. versionchanged:: 2.0 Support colors on Windows if colorama is installed. Nr.  )rrr%r)r& bytearrayflushrwriterr r rr)rjrhrkrlrmout binary_filerrrechos@-        ruz'te.Literal['stdin', 'stdout', 'stderr']cCs(tj|}|dkr"td|d|S)zReturns a system stream for byte processing. :param name: the name of the stream to open. Valid names are ``'stdin'``, ``'stdout'`` and ``'stderr'`` NzUnknown standard stream '')r get TypeError)ropenerrrrget_binary_stream.s rzr>)rrArBrcCs,tj|}|dkr"td|d|||S)aReturns a system stream for text processing. This usually returns a wrapped stream around a binary stream returned from :func:`get_binary_stream` but it also can take shortcuts for already correctly configured streams. :param name: the name of the stream to open. Valid names are ``'stdin'``, ``'stdout'`` and ``'stderr'`` :param encoding: overrides the detected default encoding. :param errors: overrides the default error mode. NzUnknown standard stream 'rv)rrwrx)rrArBryrrrget_text_stream:s r{r=)r?r@rArBlazyrCrc CsP|r tjtjt|||||dSt|||||d\}}|sLtjtjt|}|S)aVOpen a file, with extra behavior to handle ``'-'`` to indicate a standard stream, lazy open on write, and atomic write. Similar to the behavior of the :class:`~click.File` param type. If ``'-'`` is given to open ``stdout`` or ``stdin``, the stream is wrapped so that using it in a context manager will not close it. This makes it possible to use the function without accidentally closing a standard stream: .. code-block:: python with open_file(filename) as f: ... :param filename: The name of the file to open, or ``'-'`` for ``stdin``/``stdout``. :param mode: The mode in which to open the file. :param encoding: The encoding to decode or encode a file opened in text mode. :param errors: The error handling mode. :param lazy: Wait to open the file until it is accessed. For read mode, the file is temporarily opened to raise access errors early, then closed until it is read again. :param atomic: Write to a temporary file and replace the given file on close. .. versionadded:: 3.0 )rC)r r!rdr<r rg)r?r@rArBr|rCfrErrr open_fileOs $r~)rcCs&ddl}|jdtddtjddS)zReturns the argument part of ``sys.argv``, removing the first value which is the name of the script. .. deprecated:: 8.0 Will be removed in Click 8.1. Access ``sys.argv[1:]`` directly instead. rNze'get_os_args' is deprecated and will be removed in Click 8.1. Access 'sys.argv[1:]' directly instead.) stacklevelr)warningswarnDeprecationWarningsysargv)rrrr get_os_args~s r)r?shortenrcCs|rtjj|}tj|S)aKFormats a filename for user display. The main purpose of this function is to ensure that the filename can be displayed at all. This will decode the filename to unicode if necessary in a way that it will not fail. Optionally, it can shorten the filename to not include the full path to the filename. :param filename: formats a filename for UI display. This will also convert the filename into unicode without failing. :param shorten: this optionally shortens the filename to strip of the path that leads up to it. )ospathbasenamefsdecode)r?rrrrformat_filenames r)app_nameroaming force_posixrcCstr>|r dnd}tjj|}|dkr0tjjd}tjj||S|r`tjjtjjdt|Stj dkrtjjtjjd|Stjjtjjdtjjd t|S) aReturns the config folder for the application. The default behavior is to return whatever is most appropriate for the operating system. To give you an idea, for an app called ``"Foo Bar"``, something like the following folders could be returned: Mac OS X: ``~/Library/Application Support/Foo Bar`` Mac OS X (POSIX): ``~/.foo-bar`` Unix: ``~/.config/foo-bar`` Unix (POSIX): ``~/.foo-bar`` Windows (roaming): ``C:\Users\\AppData\Roaming\Foo Bar`` Windows (not roaming): ``C:\Users\\AppData\Local\Foo Bar`` .. versionadded:: 2.0 :param app_name: the application name. This should be properly capitalized and can contain whitespace. :param roaming: controls if the folder should be roaming or not on Windows. Has no affect otherwise. :param force_posix: if this is set to `True` then on any POSIX system the folder will be stored in the home folder with a leading dot instead of the XDG config home or darwin's application support folder. APPDATA LOCALAPPDATAN~z~/.darwinz~/Library/Application SupportXDG_CONFIG_HOMEz ~/.config) rrenvironrwr expanduserrrrplatform)rrrkeyZfolderrrr get_app_dirs    rc@sBeZdZdZejddddZddddZeej d d d Z dS) PacifyFlushWrapperaThis wrapper is used to catch and suppress BrokenPipeErrors resulting from ``.flush()`` being called on broken pipe during the shutdown/final-GC of the Python interpreter. Notably ``.flush()`` is always called on ``sys.stdout`` and ``sys.stderr``. So as to have minimal impact on any other cleanup code, and the case where the underlying file is not a broken pipe, all calls and attributes are proxied. N)wrappedrcCs ||_dS)N)r)rHrrrrrIszPacifyFlushWrapper.__init__)rcCsLy|jjWn8tk rF}zddl}|j|jkr6WYdd}~XnXdS)Nr)rrqrPerrnoEPIPE)rHrTrrrrrqs  zPacifyFlushWrapper.flush)attrrcCs t|j|S)N)rJr)rHrrrrrKszPacifyFlushWrapper.__getattr__) r]r^r_r`r rdrIrqr)rcrKrrrrrs r__main__)r_mainrcCs|stjd}t|dddksRtjdkr^|jdkr^tjj| r^tjj|dr^tjj|St j t |j}tjj tjj|d}|dkr|d|}d |j dS) a:Determine the command used to run the program, for use in help text. If a file or entry point was executed, the file name is returned. If ``python -m`` was used to execute a module or package, ``python -m name`` is returned. This doesn't try to be too precise, the goal is to give a concise name for help text. Files are only shown as their name without the path. ``python`` is only shown for modules, and the full path to ``sys.executable`` is not shown. :param path: The Python file being executed. Python puts this in ``sys.argv[0]``, which is used by default. :param _main: The ``__main__`` module. This should only be passed during internal testing. .. versionadded:: 8.0 Based on command args detection in the Werkzeug reloader. :meta private: r __package__Nntr.z.exerr0z python -m )rrrJrrrrexistsrr r!r)splitextlstrip)rrZ py_modulerrrr_detect_program_names    r)userenvglob_recursive)rrrrrcCshddlm}g}xR|D]J}|r*tjj|}|r:tjj|}|||d}|sV|j|q|j|qW|S)a)Simulate Unix shell expansion with Python functions. See :func:`glob.glob`, :func:`os.path.expanduser`, and :func:`os.path.expandvars`. This intended for use on Windows, where the shell does not do any expansion. It may not exactly match what a Unix shell would do. :param args: List of command line arguments to expand. :param user: Expand user home directory. :param env: Expand environment variables. :param glob_recursive: ``**`` matches directories recursively. .. versionadded:: 8.0 :meta private: r)glob) recursive)rrrr expandvarsappendextend)rrrrrrsargmatchesrrr _expand_args"s      r)r+)NNTFN)Nr>)r=Nr>FF)F)TF);rrZtypingr functoolsrtypesr_compatrrrrr r r r r rrglobalsrZ TYPE_CHECKINGZtyping_extensionsteZTypeVarCallablercrr)rr"r*intr;r<rgrardrbruZBinaryIOrzZTextIOr{r~SequencerUnionr&PathLikerrrmodulesrIterableZListrrrrrsh                2R(\(14