zmc
2023-12-22 9fdbf60165db0400c2e8e6be2dc6e88138ac719a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
U
W±d$ã@s~ddlmZddlmZmZddlmZejdd„ƒZejdd„ƒZ    ejdd    „ƒZ
d
d „Z d d „Z dd„Z dd„Zdd„ZdS)é)Ú    is_darwin)ÚloggerÚget_hook_config)ÚisolatedcCs(ddl}t |jd¡}t|tƒr$|SdS)a
    Return the configured default matplotlib backend name, if available as matplotlib.rcParams['backend'] (or overridden
    by MPLBACKEND environment variable. If the value of matplotlib.rcParams['backend'] corresponds to the auto-sentinel
    object, returns None
    rNÚbackend)Ú
matplotlibÚdictÚ __getitem__ZrcParamsÚ
isinstanceÚstr)rÚval©r úad:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\PyInstaller/hooks/hook-matplotlib.backends.pyÚ_get_configured_default_backends
 
rcCsddl}|jjS)zA
    Returns the names of all available matplotlib backends.
    rN)rZrcsetupZ all_backends)rr r rÚ_list_available_mpl_backends!srcCs t|ƒdS)zy
    Attempts to import the given module name (matplotlib backend module).
 
    Exceptions are propagated to caller.
    N)Ú
__import__)Ú module_namer r rÚ_check_mpl_backend_importable*srcCszddlm}m}|dƒ|dƒ™}g}||ƒ ¡D]D}|D]:\}}t|ƒdks8t|dtƒs\q8||kr8| |d¡q8q0|S)zÀ
    Recursively scan the bytecode for occurrences of matplotlib.use() or mpl.use() calls with const arguments, and
    collect those arguments into list of used matplotlib backend names.
    r)Ú    any_aliasÚrecursive_function_callszmatplotlib.usezmpl.use>éé)ZPyInstaller.depend.bytecoderrÚvaluesÚlenr
r Úappend)ÚcorrZ mpl_use_namesÚbackendsZcallsÚnameÚargsr r rÚ(_recursive_scan_code_objects_for_mpl_use5sþ rcCs$| d¡r|dd…Sd| ¡›S)zˆ
    Converts matplotlib backend name to its corresponding module name.
 
    Equivalent to matplotlib.cbook._backend_module_name().
    z    module://é    Nzmatplotlib.backends.backend_)Ú
startswithÚlower)rr r rÚ_backend_module_namePs
 r#c     Csö|jj}| d¡}g}| ¡D]*\}}t|ƒ}|rt d||¡||7}q|rdd}t d||¡|Stƒ}|r€t d|¡|gSdddd    g}    tršd
g|    }    t d |    ¡|    D]:}
zt    |
ƒ} t
| ƒWnt k
rÚYqªYnX|
gSt d ¡d gS)z³
    Returns a list of automatically-discovered matplotlib backends in use, or the name of the default matplotlib
    backend. Implements the 'auto' backend selection method.
    rzMDiscovered Matplotlib backend(s) via `matplotlib.use()` call in module %r: %rzDhttps://pyinstaller.org/en/stable/hooks-config.html#matplotlib-hooksaThe following Matplotlib backends were discovered by scanning for `matplotlib.use()` calls: %r. If your backend of choice is not in this list, either add a `matplotlib.use()` call to your code, or configure the backend collection via hook options (see: %s).z/Found configured default matplotlib backend: %sZQt5AggZGtk3AggZTkAggZWxAggÚMacOSXzTTrying determine the default backend as first importable candidate from the list: %rzONone of the backend candidates could be imported; falling back to headless Agg!ZAgg) ZanalysisÚgraphZget_code_usingÚitemsrrÚinforrr#rÚ    Exception) Úhook_apiZ modulegraphZ mpl_code_objsZ used_backendsrrZ co_backendsZHOOK_CONFIG_DOCSZdefault_backendÚ
candidatesÚ    candidaterr r rÚ_autodetect_used_backends[sJ
ÿ
ý  
 
 
 
r,c    Cs¢tƒ}t d|¡g}ddh}ts.|ddhO}|D]j}||krLt d|¡q2zt|ƒ}t|ƒWn$tk
r„t d|¡Yq2YnXt d|¡| |¡q2|S)    zn
    Returns a list of all importable matplotlib backends. Implements the 'all' backend selection method.
    z%All available matplotlib backends: %rZQt4AggZQt4CairoZCocoaAggr$z!  Matplotlib backend %r: excludedz4  Matplotlib backend %r: ignored due to import errorz  Matplotlib backend %r: added)rrr'rr#rr(r)r)Ú backend_namesZimportable_backendsZexclude_backendsÚ backend_namerr r rÚ _collect_all_importable_backends™s&     
  r/cCsªt|ddƒ}|dkrd}|dkr4t d¡t|ƒ}nN|dkrPt d¡t|ƒ}n2t d¡t|tƒrl|g}nt|tƒs~tdƒ‚|}t d    |¡d
d „|Dƒ}|j    |ŽdS) NrrÚautozIMatplotlib backend selection method: automatic discovery of used backendsÚallzJMatplotlib backend selection method: collection of all importable backendsz:Matplotlib backend selection method: user-provided name(s)z@User-provided backend name(s) must be either a string or a list!z Selected matplotlib backends: %rcSsg|] }t|ƒ‘qSr )r#)Ú.0rr r rÚ
<listcomp>Ùszhook.<locals>.<listcomp>)
rrr'r,r/r
r ÚlistÚAssertionErrorZ add_imports)r)Zbackends_methodr-Z module_namesr r rÚhookÁs" 
 
 
 
 
 
 r6N)ZPyInstaller.compatrZPyInstaller.utils.hooksrrZ PyInstallerrZdecoraterrrrr#r,r/r6r r r rÚ<module> s  
 
 
 
 >(