+L ilddlZddlZddlmZddlmZmZddlmZ ddl m Z ddl Z ddl Z ddlmZmZddlmZdZdZd Zd ed Zd ed ZdedZdadadZdZdefdZdefdZ ere dkrddl!Z!ddl"m#Z#Gdde#Z$GddejJZ&e$Z'e&e'ZejPjSejPjUe jVZ,ejPj[e,dZ.ejPj[e.de'_/e'j`Le jb5e jddde3d e'_0dddnddl!Z!Gd!d"Z4e4Z'd#ee6efdeedffd$Z7d%eedfd&ee6dfdee6dffd'Z8 d7d(ee9e jtjvfd&ee6dfd)eedfd*eedfd+eee d8d(ee9e jtjvfd#ee6efd&ee6dfd+eee=1.0.0'` or `pip install 'plotly[kaleido]'`). zE Support for the Orca engine is deprecated and will be removed after zx. Please install Kaleido (`pip install 'kaleido>=1.0.0'` or `pip install 'plotly[kaleido]'`) to use the Kaleido engine. zK Support for the 'engine' argument is deprecated and will be removed after z:. Kaleido will be the only supported engine at that time. c"d|dtd|dS)Nz Use of plotly.io.kaleido.scope.z1 is deprecated and support will be removed after z . Please use plotly.io.defaults.z instead. ENGINE_SUPPORT_TIMELINExs X/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/plotly/io/_kaleido.py"kaleido_scope_default_warning_funcr,s/ !s"STkSlm c" cd|dtdS)Nz Attribute plotly.io.defaults.zf is not valid. Also, use of plotly.io.kaleido.scope.* is deprecated and support will be removed after z+. Please use plotly.io.defaults.* instead. r r s rbad_attribute_error_msg_funcr3s(S!XXoWpq rreturnc`ttS ddl}datS#t$r daYtSwxYw)zO Returns True if any version of Kaleido is installed, otherwise False. NrTF)_KALEIDO_AVAILABLEkaleido ImportError)rs rkaleido_availabler;sC %!!#!  #" #s  --cttSts tdtt j dj atS)zl Returns the major version number of Kaleido if it is installed, otherwise raises a ValueError. zKaleido is not installed.r)_KALEIDO_MAJORr ValueErrorrimportlib_metadataversionmajorrr kaleido_majorr!LsD !  455 !3!;!;I!FGMM r) PlotlyScopec(eZdZfdZfdZxZS)PlotlyScopeWrapperc|tjvr+tr%tjt |t dt|!||yN stacklevel) r __dict__&ENABLE_KALEIDO_V0_DEPRECATION_WARNINGSwarningswarnrDeprecationWarningsuper __setattr__selfnamevalue __class__s rr1zPlotlyScopeWrapper.__setattr__cs?8,,,= >tD.'( #D%0rctt|r+tr%tjt |t dt|!|Sr') hasattrr r,r-r.rr/r0 __getattr__)r3r4r6s rr9zPlotlyScopeWrapper.__getattr__ms<8T*= >tD.'( w*400r)__name__ __module__ __qualname__r1r9 __classcell__r6s@rr%r%bs 1 1 1rr%c(eZdZfdZfdZxZS)DefaultsBackwardsCompatiblec0||_t| yN)_scoper0__init__)r3scoper6s rrDz$DefaultsBackwardsCompatible.__init__{s#  "rc|dk(sFt|j|r0t|j||k7rt|j||t|||y)NrC)r8rCgetattrsetattrr0r1r2s rr1z'DefaultsBackwardsCompatible.__setattr__sKx' T2#DKK6%? T59#D%0r)r:r;r<rDr1r=r>s@rr@r@zs # 1 1rr@ package_dataz plotly.min.jsignorez.*scope\.mathjax.*)messagecategoryz?https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.jsceZdZdZdZy)DefaultsWrapperctt|r;tr%tjt |t dtt|Stt|r') r8r r,r-r.rr/rGAttributeErrorr)r3r4s rr9zDefaultsWrapper.__getattr__sI8T*= >tD.'( #8T22()Ed)KLLrctt|r=tr%tjt |t dtt||ytt|r') r8r r,r-r.rr/rHrPr)r3r4r5s rr1zDefaultsWrapper.__setattr__sH8T*= >tD.'( HdE2()Ed)KLLrN)r:r;r<r9r1r rrrNrNs M MrrNfileclt|tr t|}|St|tr|}|Sd}|S)z Cast the `file` argument, which may be either a string or a Path object, to a Path object. If `file` is neither a string nor a Path object, None will be returned. N) isinstancestrr)rRpaths ras_path_objectrWsB $Dz K D$  K KrrVformatcn|2|0|j}|r|jd}|Std|d|S)N.z+ Cannot infer image type from output path 'z'. Please specify the type using the format parameter, or add a file extension. For example: >>> import plotly.io as pio >>> pio.write_image(fig, file_path, format='png') )suffixlstripr)rVrXexts r infer_formatr^sV FNkk ZZ_F M++/&1   Mrfigwidthheightscalevalidateenginec |'tr#tjttdnd}|dk(rt rd}nddlm} |d}|dk(r:tr tjttdddlm }||||||| S|dk7rtd t|t s td t||} td kDr|d k(rtdtdd dlm}  i} t$j&rt$j&| d<t$j(rt$j(| d<|xsv| j+dij+dxsS| j+dij+dij+dij+dxst$j,}|xsv| j+dij+dxsS| j+dij+dij+dij+dxst$j.}t1j2| t5|xst$j6|||xst$j8t$j:| } | Str tjt@tdtBjE| ||||} | S#t$rd}YwxYw#| $rt=t>wxYw)a Convert a figure to a static image bytes string Parameters ---------- fig: Figure object or dict representing a figure format: str or None The desired image format. One of - 'png' - 'jpg' or 'jpeg' - 'webp' - 'svg' - 'pdf' - 'eps' (deprecated) (Requires the poppler library to be installed and on the PATH) If not specified, will default to: - `plotly.io.defaults.default_format` if engine is "kaleido" - `plotly.io.orca.config.default_format` if engine is "orca" (deprecated) width: int or None The width of the exported image in layout pixels. If the `scale` property is 1.0, this will also be the width of the exported image in physical pixels. If not specified, will default to: - `plotly.io.defaults.default_width` if engine is "kaleido" - `plotly.io.orca.config.default_width` if engine is "orca" (deprecated) height: int or None The height of the exported image in layout pixels. If the `scale` property is 1.0, this will also be the height of the exported image in physical pixels. If not specified, will default to: - `plotly.io.defaults.default_height` if engine is "kaleido" - `plotly.io.orca.config.default_height` if engine is "orca" (deprecated) scale: int or float or None The scale factor to use when exporting the figure. A scale factor larger than 1.0 will increase the image resolution with respect to the figure's layout pixel dimensions. Whereas as scale factor of less than 1.0 will decrease the image resolution. If not specified, will default to: - `plotly.io.defaults.default_scale` if engine is "kaleido" - `plotly.io.orca.config.default_scale` if engine is "orca" (deprecated) validate: bool True if the figure should be validated before being converted to an image, False otherwise. engine (deprecated): str Image export engine to use. This parameter is deprecated and Orca engine support will be dropped in the next major Plotly version. Until then, the following values are supported: - "kaleido": Use Kaleido for image export - "orca": Use Orca for image export - "auto" (default): Use Kaleido if installed, otherwise use Orca Returns ------- bytes The image data r(r)autorr")validate_executableorca)to_image)rXr`rarbrcz'Invalid image export engine specified: z Image export using the "kaleido" engine requires the Kaleido package, which can be installed using pip: $ pip install --upgrade kaleido repsz EPS export is not supported by Kaleido v1. Please use SVG or PDF instead. You can also downgrade to Kaleido v0, but support for Kaleido v0 will be removed after zE. To downgrade to Kaleido v0, run: $ pip install 'kaleido<1.0.0' ChromeNotFoundErrorplotlyjsmathjaxlayoutr`templaterarXr`rarb)optstopojsonkopts)#r,r-r.ENGINE_PARAM_DEPRECATION_MSGr/r_orcarg ExceptionORCA_DEPRECATION_MSGrirreprrr!r kaleido.errorsrlr rmrnget default_widthdefault_heightr calc_fig_syncdictdefault_format default_scalers RuntimeErrorPLOTLY_GET_CHROME_ERROR_MSGKALEIDO_DEPRECATION_MSGrE transform) r_rXr`rarbrcrdrg to_image_orcafig_dictrlrt img_bytess rririsZ 1 MM,.@Q    F 3 ##%  1 MM.0Bq Q4     9 B4<.QRR     +39H U?XXoWpq  7& <E  $,$5$5j!#+#3#3i *<<"-11':*<<"-Z$Xr"W * )) +<<"-11(;+<<"-Z$Xr"X + **  --!Nrfrr"r(r)rh>Nrf)rXrbr`rarcrdNz The 'file' argument 'z<' is not a string, pathlib.Path object, or file descriptor. )r,rr!r-r.rr/rxrurWr^riwriterPr write_bytes) r_rRrXrbr`rarcrdrVimg_datas r write_imagersf. / /!#!# MM13ERS T V  MM.0Bq Q  ' MM,.@Q  $ D$ 'F H |  JJx  "   V   s7C C'&C'c^ts tdtdkr+tdtt j ddt |||||||}|D](}t|d|d|d<t|d |d <*|Dcgc]}t|d|d tt|d |d xstj|d xstj|d xstj|d xstjtj } }ddlm}  i} tj&rtj&| d<tj(rtj(| d<t+j,| | ycc}w#| $rt/t0wxYw)a Write multiple images to files or writeable objects. This is much faster than calling write_image() multiple times. This function can only be used with the Kaleido engine, v1.0.0 or greater. This function accepts the same arguments as write_image() (minus the `engine` argument), except that any of the arguments may be either a single value or an iterable of values. If multiple arguments are iterable, they must all have the same length. Parameters ---------- fig: List of figure objects or dicts representing a figure. Also accepts a single figure or dict representing a figure. file: str, pathlib.Path, or list of (str or pathlib.Path) List of str or pathlib.Path objects representing local file paths to write to. Can also be a single str or pathlib.Path object if fig argument is a single figure or dict representing a figure. format: str, None, or list of (str or None) The image format to use for exported images. Supported formats are: - 'png' - 'jpg' or 'jpeg' - 'webp' - 'svg' - 'pdf' Use a list to specify formats for each figure or dict in the list provided to the `fig` argument. Specify format as a `str` to apply the same format to all exported images. If not specified, and the corresponding `file` argument has a file extension, then `format` will default to the file extension. Otherwise, will default to `plotly.io.defaults.default_format`. width: int, None, or list of (int or None) The width of the exported image in layout pixels. If the `scale` property is 1.0, this will also be the width of the exported image in physical pixels. Use a list to specify widths for each figure or dict in the list provided to the `fig` argument. Specify width as an `int` to apply the same width to all exported images. If not specified, will default to `plotly.io.defaults.default_width`. height: int, None, or list of (int or None) The height of the exported image in layout pixels. If the `scale` property is 1.0, this will also be the height of the exported image in physical pixels. Use a list to specify heights for each figure or dict in the list provided to the `fig` argument. Specify height as an `int` to apply the same height to all exported images. If not specified, will default to `plotly.io.defaults.default_height`. scale: int, float, None, or list of (int, float, or None) The scale factor to use when exporting the figure. A scale factor larger than 1.0 will increase the image resolution with respect to the figure's layout pixel dimensions. Whereas as scale factor of less than 1.0 will decrease the image resolution. Use a list to specify scale for each figure or dict in the list provided to the `fig` argument. Specify scale as an `int` or `float` to apply the same scale to all exported images. If not specified, will default to `plotly.io.defaults.default_scale`. validate: bool or list of bool True if the figure should be validated before being converted to an image, False otherwise. Use a list to specify validation setting for each figure in the list provided to the `fig` argument. Specify validate as a boolean to apply the same validation setting to all figures. Returns ------- None z The `write_images()` function requires the Kaleido package, which can be installed using pip: $ pip install --upgrade kaleido r"z You have Kaleido version rz installed. The `write_images()` function requires the Kaleido package version 1.0.0 or greater, which can be installed using pip: $ pip install 'kaleido>=1.0.0' )r_rRrXrbr`rarcr_rcrRrXr`rarbrq)r_rVrrrsrrkrmrn)rtN)rrr!rrrrrrWrr^r rr|r}rrsrzrlrmrnrwrite_fig_from_object_syncrr) r_rRrXrbr`rarc arg_dictsd kaleido_specsrlrts r write_imagesr.sx      1 !"4"<"=1.0.0'`).NT) skip_invalid)rrr-r.r!rr~rrloadsdecoder,r r/rErplotly.graph_objects graph_objectsFigure)r_r.rbytesgos rfull_figure_for_developmentrs>        7 }2%% V$ jjg./ 2 MMghhAACDhi"  jjV<CCGLM )yy4y00rc~d}tr tdkr tdddl}|j}d|v}|r|j dd}d|vrT|j ddz}|t|kr2||}|j d|j |t|}t|dkDrt||jd|s=td|td }|r|djd k7r td ytd t|}td td|y)a( Install Google Chrome for Kaleido (Required for Plotly image export). This function is a command-line wrapper for `plotly.io.get_chrome()`. When running from the command line, use the command `plotly_get_chrome`; when calling from Python code, use `plotly.io.get_chrome()`. a  Usage: plotly_get_chrome [-y] [--path PATH] Installs Google Chrome for Plotly image export. Options: -y Skip confirmation prompt --path PATH Specify the path to install Chrome. Must be a path to an existing directory. --help Show this message and exit. r" This command requires Kaleido v1.0.0 or greater. Install it using `pip install 'kaleido>=1.0.0'` or `pip install 'plotly[kaleido]'`." rNz-yz--pathz| Plotly will install a copy of Google Chrome to be used for generating static images of plots. Chrome will be installed at: zDo you want to proceed? [y/n] y CancelledzInstalling Chrome for Plotly...zChrome installed successfully.z)The Chrome executable is now located at: )rr!rsysargvremoveindexlenrprintexitinputlower get_chrome)usagercli_argscli_yeschrome_install_path path_indexresponseexe_paths rplotly_get_chromersK E  -/A"5   xxHhG8^^H-1 H %"*:"6  OOH % OO/ 0"&':";  8}q e    12 6 9:8A;,,.#5 +   +,-.H *+ 5hZ @Arc&tr tdkr td|rd}t|}n d}ddlm}|}|r>|j std|d|jstd|d tj| S) aA Get the path to the Chrome executable for Kaleido. This function is used by the `plotly_get_chrome` command line utility. Parameters ---------- path: str or Path or None The path to the directory where Chrome should be installed. If None, the default download path will be used. r"rTFr)default_download_pathz The specified install path 'z' does not exist. Please specify a path to an existing directory using the --path argument, or omit the --path argument to use the default download path. z' already exists but is not a directory. Please specify a path to an existing directory using the --path argument, or omit the --path argument to use the default download path. )rV) rr!rrchoreographer.cli.defaultsrexistsis_dirrget_chrome_sync)rVuser_specified_pathrrs rrras  -/A"5    ""4j#D3"))+012 #))+012   " "(; <rs /% Q(*)-& VVmUnoEE\D]^$KKbJcd  4" s ]}25 1 10 1(*<*< 1#$.u577??277??6??#CDggll8^< k?C == (((* '''&;FXV     M M2 !sDy)eD$J.?&uT4Z(%T 2BuSRVYGW* $"#%)#C tV))000 1C #t) C d C #t)  C eT! " C  C #t) C CR $%)"#%D# tV))000 1D# T D# #t) D# eT! " D# d  D# #t)  D#D# #t) D#Z?CKO=A>B(,b8  U4--444 56 dF((///0 2 b8 U39%&c4i(88 9 b8 $uS$Y'(%T *:: ; b8 eC,-.c5$6F0GG Hb8 eCI&'sDy)99 :b8 $uS$Y'(%T *:: ;b8DJ$%b8 b8NF1 tV))000 1F1 F1F1 6   & & ,- F1RBBJ2=U3d?+2=t2=j NO  NK Es+(C#M0 M#(M0#M-(M00 M=<M=