Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- shared/package-files/0c/0c00bafaf4e827a7eac83842bd6efcff7c52acc4b74808ec32a253bdbdb43bd3/add_if_then_else.h +11 -0
- shared/package-files/0c/0c02ab85a5006c26645efe48e107c8667cbc71cac2e994791233c6833d45b75a/fmax_meta_dispatch.h +25 -0
- shared/package-files/0c/0c04462503d275fff1c68227b8404128de24ba7d08ceef8b197f1cd7e862baf9/distance_regular.py +231 -0
- shared/package-files/0c/0c05cad261bb0815b7eecb9bb3c62e4e48fffe64f7563c7dd18e8a391eb33570/__init__.py +52 -0
- shared/package-files/0c/0c0634e1aaf55e2c7012c725ead69275d922e18feb62742757ccc5eb5fb3d596/test_describe.py +417 -0
- shared/package-files/0c/0c065a2cdd070b66d5d80715cf2c6c2acaf13ad2c85dbfcd9ffe99f8b806a7cc/arima112_css_results.py +1315 -0
- shared/package-files/0c/0c0df17bfece897a1da7765c822453b09866573028cecced13e2efee02bcccc4/gb12345.enc +1414 -0
- shared/package-files/0c/0c11a425195e3e8ba1e86ee002716cda3a0ec653c88187a7946c79402380e793/Conda.psm1 +271 -0
- shared/package-files/0c/0c12ae80850415330fee0ea22f56e4f7ce84ea5742adc35d04258e25b4256bf6/test_function_base.py +0 -0
- shared/package-files/0c/0c15552da76e6541d25a5289e5a0579b181d366fd88cbbd68328934dc42ad387/test_cdft_asymptotic.py +49 -0
- shared/package-files/0c/0c1580ed02b4765ba89278a8b8e8b3675879a0021c5a2e3b37b8ba5224834625/console.pyi +44 -0
- shared/package-files/0c/0c15ad816413e201d7ee66f88998d185f0cc11f728586cc8ca710e050a76719e/random_clustered.py +116 -0
- shared/package-files/0c/0c15dd9c87b6f2fadb7f80be6abed981e1486b49060f8a43049e183fecf84074/nodata.arff +11 -0
- shared/package-files/0c/0c1cd30fcdcc877a1a71f6737d4e9f42e182f3b82fb67186683b9ef2cf4cd16b/uuid.h +63 -0
- shared/package-files/0c/0c2152360d3ce31214f7ff496a3d8e61b6d9b4b85e0af08d02fe49d16d0ecfbe/hann_window_compositeexplicitautograd_dispatch.h +30 -0
- shared/package-files/0c/0c215ffc3b7970db2e4962676100067c9af1d72d99d064224938746a34098630/test_to_timestamp.py +142 -0
- shared/package-files/0c/0c21d293265526a2b3535f6de026771f36d49019c5edb86d4bdeba473f7188f9/ViewFuncs.h +953 -0
- shared/package-files/0c/0c228e0a4cf2e60236e37d2b6b49d892dd86323096d27188a6125edd358d782b/ts_backend_impl.h +52 -0
- shared/package-files/0c/0c22e0d886b5d782dca4f5371425bc1cc3990a49f92bb9217d744c7f667d5b22/dialogs.py +107 -0
- shared/package-files/0c/0c23c1c4d58ff81bdd4ff4448fafdae138d4acd69feac0aafd7a31537a446df7/cython_blas.pxd +169 -0
- shared/package-files/0c/0c26e96fb439c6485b0e2206edf3b80b4a45e0ccdd7c14f298cb22bab5fd1401/digamma.h +39 -0
- shared/package-files/0c/0c2d4669bc3b13d6f7073c1d029c6513aa0433bde7990a18c41b9c2fc8c0a005/test_tracing.py +182 -0
- shared/package-files/0c/0c2f3a0c2146f970dbba975536dd8fb3af0ed8406db6756463c1858f0df8fcb8/vt100-nav +0 -0
- shared/package-files/0c/0c38936b6626aa40a1a4bccaafcd27f9939f2405d66fa618074444474d77747c/msvcrt.pyi +24 -0
- shared/package-files/0c/0c38a332607070a1ab616daa6f0cfc5b7bc3dd4abac295fff70edf60a6275763/textfmts.py +431 -0
- shared/package-files/0c/0c3b8cc2b2263040b0e8c85f9dc9f6c4c3a390570a515d4ed79f7bfdf485480b/chunked_builder.h +68 -0
- shared/package-files/0c/0c3bf5261f951c3c1c6373588b8fbd4a9c7fe7dbba9face51bb58c8b74ad989b/distro.py +1107 -0
- shared/package-files/0c/0c3d6692d733af00fbf4d4770346c07a05d64a577fe3bae941f26d66bd3d31d9/maxcut.py +111 -0
- shared/package-files/0c/0c3e225c027aebf0653a8e3bff13cb34bd0968bf1f084d5f506af347c8440e55/_standard_gamma_grad_ops.h +39 -0
- shared/package-files/0c/0c4aa958f21646900836e9bf94a761f3e16f2acc7ef09f939c672e6ebc7303a9/compat.pyi +39 -0
- shared/package-files/0c/0c51168439117527a818479f180221ffba8cdd9b04ec71a03065582d006b69c7/pipe.py +490 -0
- shared/package-files/0c/0c5230e53eb4f80a1d08664f0b06cccdb111a441774c46c0685242b86cfb90ea/vecm_e6_jmulti_cili.txt +149 -0
- shared/package-files/0c/0c527a38a57a811c38a7d3ae55fcb510d4de2c909b612d86ba9a70a499f04064/test_backend.py +98 -0
- shared/package-files/0c/0c52c03003c5cd7d832358800048d563f9ccf53ba86260a37b79bb435ec0d045/test_formats.py +350 -0
- shared/package-files/0c/0c56d1cc902aa31c536cb523a2357e1eec061df3a70003caa4e7415c54705d2e/adaptive.h +109 -0
- shared/package-files/0c/0c5a3106c098456aa876635a0cd3e742b6534d789a4afc0d664c2bc9b7bb725d/test_tools.py +52 -0
- shared/package-files/0c/0c5bab22964a970533cb61ecf356133c51b3ea5224f1d6a59827dcc64cff74b1/linalg.py +0 -0
- shared/package-files/0c/0c5bdff5e2602627390d41edda5ac992c4aee57e9e5d17eb877d2de720154b36/gdscript.py +188 -0
- shared/package-files/0c/0c5c5c2d1ff01de4c6740e3d565f9dafc934cdd9bb2e592c07a0ea8f7643e588/well_known_types.pyi +94 -0
- shared/package-files/0c/0c5c72165a73591652f7374186c8c82397c550e318f5b5c79f7108ac8be638ca/builder_decimal.h +164 -0
- shared/package-files/0c/0c5c98d884018f7af619992f6d121e64ed84118e3aeb16eec1ce0f4a1025e12c/test_classes.py +600 -0
- shared/package-files/0c/0c5d6ff1c27a7f3c67f28b51143d6b0f55508cab2b554b7fb9ce3ddd1c3188fe/d413-unix-s +0 -0
- shared/package-files/0c/0c5d6ff1c27a7f3c67f28b51143d6b0f55508cab2b554b7fb9ce3ddd1c3188fe/d463-unix-s +0 -0
- shared/package-files/0c/0c5e8c0e2db9f345b7a68e92b90e246437a366cd2f089b02a3027ad847e05c85/upsample_linear1d_cuda_dispatch.h +28 -0
- shared/package-files/0c/0c5f2c66f5f8df9c0b965029eaebe9513826b36e477df135720292741281ab22/max_pool1d_compositeimplicitautograd_dispatch.h +23 -0
- shared/package-files/0c/0c62da0125fd540f733823d1962e19ed355de7b928015a0605e2d67aec185073/multicomp.py +87 -0
- shared/package-files/0c/0c6571e2379b940a9b69816133705f3d25b947ec0496d69fe8abbad37883f11c/libdeflate-targets.cmake +103 -0
- shared/package-files/0c/0c66cae5e8d23befe26d90e878ce51943358edaf19f1e192727ab7713850d49b/test_arrayfuncs.py +40 -0
- shared/package-files/0c/0c698b1a4e136e1906841889be76de352719ccb7679beea72685adf3786bcfeb/ivp.py +755 -0
- shared/package-files/0c/0c6afc23568d55b3e9ac914f9c5361e3033e778aa5b58d3cc82835fc5c638679/difflib.py +2056 -0
shared/package-files/0c/0c00bafaf4e827a7eac83842bd6efcff7c52acc4b74808ec32a253bdbdb43bd3/add_if_then_else.h
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/jit/ir/ir.h>
|
| 4 |
+
|
| 5 |
+
namespace torch {
|
| 6 |
+
namespace jit {
|
| 7 |
+
|
| 8 |
+
TORCH_API bool AddIfThenElseOp(std::shared_ptr<Graph>& graph);
|
| 9 |
+
|
| 10 |
+
} // namespace jit
|
| 11 |
+
} // namespace torch
|
shared/package-files/0c/0c02ab85a5006c26645efe48e107c8667cbc71cac2e994791233c6833d45b75a/fmax_meta_dispatch.h
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 3 |
+
|
| 4 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 5 |
+
|
| 6 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 7 |
+
#include <c10/core/MemoryFormat.h>
|
| 8 |
+
#include <c10/core/Scalar.h>
|
| 9 |
+
#include <ATen/core/Reduction.h>
|
| 10 |
+
|
| 11 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 12 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 13 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 14 |
+
#include <ATen/core/ATen_fwd.h>
|
| 15 |
+
|
| 16 |
+
namespace at {
|
| 17 |
+
|
| 18 |
+
namespace meta {
|
| 19 |
+
|
| 20 |
+
TORCH_API at::Tensor fmax(const at::Tensor & self, const at::Tensor & other);
|
| 21 |
+
TORCH_API at::Tensor & fmax_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & other);
|
| 22 |
+
TORCH_API at::Tensor & fmax_outf(const at::Tensor & self, const at::Tensor & other, at::Tensor & out);
|
| 23 |
+
|
| 24 |
+
} // namespace meta
|
| 25 |
+
} // namespace at
|
shared/package-files/0c/0c04462503d275fff1c68227b8404128de24ba7d08ceef8b197f1cd7e862baf9/distance_regular.py
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
=======================
|
| 3 |
+
Distance-regular graphs
|
| 4 |
+
=======================
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
import networkx as nx
|
| 8 |
+
from networkx.utils import not_implemented_for
|
| 9 |
+
|
| 10 |
+
from .distance_measures import diameter
|
| 11 |
+
|
| 12 |
+
__all__ = [
|
| 13 |
+
"is_distance_regular",
|
| 14 |
+
"is_strongly_regular",
|
| 15 |
+
"intersection_array",
|
| 16 |
+
"global_parameters",
|
| 17 |
+
]
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def is_distance_regular(G):
|
| 21 |
+
"""Returns True if the graph is distance regular, False otherwise.
|
| 22 |
+
|
| 23 |
+
A connected graph G is distance-regular if for any nodes x,y
|
| 24 |
+
and any integers i,j=0,1,...,d (where d is the graph
|
| 25 |
+
diameter), the number of vertices at distance i from x and
|
| 26 |
+
distance j from y depends only on i,j and the graph distance
|
| 27 |
+
between x and y, independently of the choice of x and y.
|
| 28 |
+
|
| 29 |
+
Parameters
|
| 30 |
+
----------
|
| 31 |
+
G: Networkx graph (undirected)
|
| 32 |
+
|
| 33 |
+
Returns
|
| 34 |
+
-------
|
| 35 |
+
bool
|
| 36 |
+
True if the graph is Distance Regular, False otherwise
|
| 37 |
+
|
| 38 |
+
Examples
|
| 39 |
+
--------
|
| 40 |
+
>>> G = nx.hypercube_graph(6)
|
| 41 |
+
>>> nx.is_distance_regular(G)
|
| 42 |
+
True
|
| 43 |
+
|
| 44 |
+
See Also
|
| 45 |
+
--------
|
| 46 |
+
intersection_array, global_parameters
|
| 47 |
+
|
| 48 |
+
Notes
|
| 49 |
+
-----
|
| 50 |
+
For undirected and simple graphs only
|
| 51 |
+
|
| 52 |
+
References
|
| 53 |
+
----------
|
| 54 |
+
.. [1] Brouwer, A. E.; Cohen, A. M.; and Neumaier, A.
|
| 55 |
+
Distance-Regular Graphs. New York: Springer-Verlag, 1989.
|
| 56 |
+
.. [2] Weisstein, Eric W. "Distance-Regular Graph."
|
| 57 |
+
http://mathworld.wolfram.com/Distance-RegularGraph.html
|
| 58 |
+
|
| 59 |
+
"""
|
| 60 |
+
try:
|
| 61 |
+
intersection_array(G)
|
| 62 |
+
return True
|
| 63 |
+
except nx.NetworkXError:
|
| 64 |
+
return False
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
def global_parameters(b, c):
|
| 68 |
+
"""Returns global parameters for a given intersection array.
|
| 69 |
+
|
| 70 |
+
Given a distance-regular graph G with integers b_i, c_i,i = 0,....,d
|
| 71 |
+
such that for any 2 vertices x,y in G at a distance i=d(x,y), there
|
| 72 |
+
are exactly c_i neighbors of y at a distance of i-1 from x and b_i
|
| 73 |
+
neighbors of y at a distance of i+1 from x.
|
| 74 |
+
|
| 75 |
+
Thus, a distance regular graph has the global parameters,
|
| 76 |
+
[[c_0,a_0,b_0],[c_1,a_1,b_1],......,[c_d,a_d,b_d]] for the
|
| 77 |
+
intersection array [b_0,b_1,.....b_{d-1};c_1,c_2,.....c_d]
|
| 78 |
+
where a_i+b_i+c_i=k , k= degree of every vertex.
|
| 79 |
+
|
| 80 |
+
Parameters
|
| 81 |
+
----------
|
| 82 |
+
b : list
|
| 83 |
+
|
| 84 |
+
c : list
|
| 85 |
+
|
| 86 |
+
Returns
|
| 87 |
+
-------
|
| 88 |
+
iterable
|
| 89 |
+
An iterable over three tuples.
|
| 90 |
+
|
| 91 |
+
Examples
|
| 92 |
+
--------
|
| 93 |
+
>>> G = nx.dodecahedral_graph()
|
| 94 |
+
>>> b, c = nx.intersection_array(G)
|
| 95 |
+
>>> list(nx.global_parameters(b, c))
|
| 96 |
+
[(0, 0, 3), (1, 0, 2), (1, 1, 1), (1, 1, 1), (2, 0, 1), (3, 0, 0)]
|
| 97 |
+
|
| 98 |
+
References
|
| 99 |
+
----------
|
| 100 |
+
.. [1] Weisstein, Eric W. "Global Parameters."
|
| 101 |
+
From MathWorld--A Wolfram Web Resource.
|
| 102 |
+
http://mathworld.wolfram.com/GlobalParameters.html
|
| 103 |
+
|
| 104 |
+
See Also
|
| 105 |
+
--------
|
| 106 |
+
intersection_array
|
| 107 |
+
"""
|
| 108 |
+
return ((y, b[0] - x - y, x) for x, y in zip(b + [0], [0] + c))
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
@not_implemented_for("directed", "multigraph")
|
| 112 |
+
def intersection_array(G):
|
| 113 |
+
"""Returns the intersection array of a distance-regular graph.
|
| 114 |
+
|
| 115 |
+
Given a distance-regular graph G with integers b_i, c_i,i = 0,....,d
|
| 116 |
+
such that for any 2 vertices x,y in G at a distance i=d(x,y), there
|
| 117 |
+
are exactly c_i neighbors of y at a distance of i-1 from x and b_i
|
| 118 |
+
neighbors of y at a distance of i+1 from x.
|
| 119 |
+
|
| 120 |
+
A distance regular graph's intersection array is given by,
|
| 121 |
+
[b_0,b_1,.....b_{d-1};c_1,c_2,.....c_d]
|
| 122 |
+
|
| 123 |
+
Parameters
|
| 124 |
+
----------
|
| 125 |
+
G: Networkx graph (undirected)
|
| 126 |
+
|
| 127 |
+
Returns
|
| 128 |
+
-------
|
| 129 |
+
b,c: tuple of lists
|
| 130 |
+
|
| 131 |
+
Examples
|
| 132 |
+
--------
|
| 133 |
+
>>> G = nx.icosahedral_graph()
|
| 134 |
+
>>> nx.intersection_array(G)
|
| 135 |
+
([5, 2, 1], [1, 2, 5])
|
| 136 |
+
|
| 137 |
+
References
|
| 138 |
+
----------
|
| 139 |
+
.. [1] Weisstein, Eric W. "Intersection Array."
|
| 140 |
+
From MathWorld--A Wolfram Web Resource.
|
| 141 |
+
http://mathworld.wolfram.com/IntersectionArray.html
|
| 142 |
+
|
| 143 |
+
See Also
|
| 144 |
+
--------
|
| 145 |
+
global_parameters
|
| 146 |
+
"""
|
| 147 |
+
# test for regular graph (all degrees must be equal)
|
| 148 |
+
degree = iter(G.degree())
|
| 149 |
+
(_, k) = next(degree)
|
| 150 |
+
for _, knext in degree:
|
| 151 |
+
if knext != k:
|
| 152 |
+
raise nx.NetworkXError("Graph is not distance regular.")
|
| 153 |
+
k = knext
|
| 154 |
+
path_length = dict(nx.all_pairs_shortest_path_length(G))
|
| 155 |
+
diameter = max(max(path_length[n].values()) for n in path_length)
|
| 156 |
+
bint = {} # 'b' intersection array
|
| 157 |
+
cint = {} # 'c' intersection array
|
| 158 |
+
for u in G:
|
| 159 |
+
for v in G:
|
| 160 |
+
try:
|
| 161 |
+
i = path_length[u][v]
|
| 162 |
+
except KeyError as err: # graph must be connected
|
| 163 |
+
raise nx.NetworkXError("Graph is not distance regular.") from err
|
| 164 |
+
# number of neighbors of v at a distance of i-1 from u
|
| 165 |
+
c = len([n for n in G[v] if path_length[n][u] == i - 1])
|
| 166 |
+
# number of neighbors of v at a distance of i+1 from u
|
| 167 |
+
b = len([n for n in G[v] if path_length[n][u] == i + 1])
|
| 168 |
+
# b,c are independent of u and v
|
| 169 |
+
if cint.get(i, c) != c or bint.get(i, b) != b:
|
| 170 |
+
raise nx.NetworkXError("Graph is not distance regular")
|
| 171 |
+
bint[i] = b
|
| 172 |
+
cint[i] = c
|
| 173 |
+
return (
|
| 174 |
+
[bint.get(j, 0) for j in range(diameter)],
|
| 175 |
+
[cint.get(j + 1, 0) for j in range(diameter)],
|
| 176 |
+
)
|
| 177 |
+
|
| 178 |
+
|
| 179 |
+
# TODO There is a definition for directed strongly regular graphs.
|
| 180 |
+
@not_implemented_for("directed", "multigraph")
|
| 181 |
+
def is_strongly_regular(G):
|
| 182 |
+
"""Returns True if and only if the given graph is strongly
|
| 183 |
+
regular.
|
| 184 |
+
|
| 185 |
+
An undirected graph is *strongly regular* if
|
| 186 |
+
|
| 187 |
+
* it is regular,
|
| 188 |
+
* each pair of adjacent vertices has the same number of neighbors in
|
| 189 |
+
common,
|
| 190 |
+
* each pair of nonadjacent vertices has the same number of neighbors
|
| 191 |
+
in common.
|
| 192 |
+
|
| 193 |
+
Each strongly regular graph is a distance-regular graph.
|
| 194 |
+
Conversely, if a distance-regular graph has diameter two, then it is
|
| 195 |
+
a strongly regular graph. For more information on distance-regular
|
| 196 |
+
graphs, see :func:`is_distance_regular`.
|
| 197 |
+
|
| 198 |
+
Parameters
|
| 199 |
+
----------
|
| 200 |
+
G : NetworkX graph
|
| 201 |
+
An undirected graph.
|
| 202 |
+
|
| 203 |
+
Returns
|
| 204 |
+
-------
|
| 205 |
+
bool
|
| 206 |
+
Whether `G` is strongly regular.
|
| 207 |
+
|
| 208 |
+
Examples
|
| 209 |
+
--------
|
| 210 |
+
|
| 211 |
+
The cycle graph on five vertices is strongly regular. It is
|
| 212 |
+
two-regular, each pair of adjacent vertices has no shared neighbors,
|
| 213 |
+
and each pair of nonadjacent vertices has one shared neighbor::
|
| 214 |
+
|
| 215 |
+
>>> G = nx.cycle_graph(5)
|
| 216 |
+
>>> nx.is_strongly_regular(G)
|
| 217 |
+
True
|
| 218 |
+
|
| 219 |
+
"""
|
| 220 |
+
# Here is an alternate implementation based directly on the
|
| 221 |
+
# definition of strongly regular graphs:
|
| 222 |
+
#
|
| 223 |
+
# return (all_equal(G.degree().values())
|
| 224 |
+
# and all_equal(len(common_neighbors(G, u, v))
|
| 225 |
+
# for u, v in G.edges())
|
| 226 |
+
# and all_equal(len(common_neighbors(G, u, v))
|
| 227 |
+
# for u, v in non_edges(G)))
|
| 228 |
+
#
|
| 229 |
+
# We instead use the fact that a distance-regular graph of diameter
|
| 230 |
+
# two is strongly regular.
|
| 231 |
+
return is_distance_regular(G) and diameter(G) == 2
|
shared/package-files/0c/0c05cad261bb0815b7eecb9bb3c62e4e48fffe64f7563c7dd18e8a391eb33570/__init__.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import sys
|
| 3 |
+
import torch
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
def is_available():
|
| 7 |
+
return hasattr(torch._C, "_dist_autograd_init")
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
if is_available() and not torch._C._dist_autograd_init():
|
| 11 |
+
raise RuntimeError("Failed to initialize torch.distributed.autograd")
|
| 12 |
+
|
| 13 |
+
if is_available():
|
| 14 |
+
from torch._C._distributed_autograd import (
|
| 15 |
+
get_gradients,
|
| 16 |
+
backward,
|
| 17 |
+
_init,
|
| 18 |
+
_new_context,
|
| 19 |
+
_release_context,
|
| 20 |
+
_get_max_id,
|
| 21 |
+
_is_valid_context,
|
| 22 |
+
_retrieve_context,
|
| 23 |
+
_current_context,
|
| 24 |
+
_get_debug_info,
|
| 25 |
+
DistAutogradContext,
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
class context:
|
| 30 |
+
'''
|
| 31 |
+
Context object to wrap forward and backward passes when using
|
| 32 |
+
distributed autograd. The ``context_id`` generated in the ``with``
|
| 33 |
+
statement is required to uniquely identify a distributed backward pass
|
| 34 |
+
on all workers. Each worker stores metadata associated with this
|
| 35 |
+
``context_id``, which is required to correctly execute a distributed
|
| 36 |
+
autograd pass.
|
| 37 |
+
|
| 38 |
+
Example::
|
| 39 |
+
>>> # xdoctest: +SKIP
|
| 40 |
+
>>> import torch.distributed.autograd as dist_autograd
|
| 41 |
+
>>> with dist_autograd.context() as context_id:
|
| 42 |
+
>>> t1 = torch.rand((3, 3), requires_grad=True)
|
| 43 |
+
>>> t2 = torch.rand((3, 3), requires_grad=True)
|
| 44 |
+
>>> loss = rpc.rpc_sync("worker1", torch.add, args=(t1, t2)).sum()
|
| 45 |
+
>>> dist_autograd.backward(context_id, [loss])
|
| 46 |
+
'''
|
| 47 |
+
def __enter__(self):
|
| 48 |
+
self.autograd_context = _new_context()
|
| 49 |
+
return self.autograd_context._context_id()
|
| 50 |
+
|
| 51 |
+
def __exit__(self, type, value, traceback):
|
| 52 |
+
_release_context(self.autograd_context._context_id())
|
shared/package-files/0c/0c0634e1aaf55e2c7012c725ead69275d922e18feb62742757ccc5eb5fb3d596/test_describe.py
ADDED
|
@@ -0,0 +1,417 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import numpy as np
|
| 2 |
+
import pytest
|
| 3 |
+
|
| 4 |
+
import pandas as pd
|
| 5 |
+
from pandas import (
|
| 6 |
+
Categorical,
|
| 7 |
+
DataFrame,
|
| 8 |
+
Series,
|
| 9 |
+
Timestamp,
|
| 10 |
+
date_range,
|
| 11 |
+
)
|
| 12 |
+
import pandas._testing as tm
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
class TestDataFrameDescribe:
|
| 16 |
+
def test_describe_bool_in_mixed_frame(self):
|
| 17 |
+
df = DataFrame(
|
| 18 |
+
{
|
| 19 |
+
"string_data": ["a", "b", "c", "d", "e"],
|
| 20 |
+
"bool_data": [True, True, False, False, False],
|
| 21 |
+
"int_data": [10, 20, 30, 40, 50],
|
| 22 |
+
}
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
# Integer data are included in .describe() output,
|
| 26 |
+
# Boolean and string data are not.
|
| 27 |
+
result = df.describe()
|
| 28 |
+
expected = DataFrame(
|
| 29 |
+
{"int_data": [5, 30, df.int_data.std(), 10, 20, 30, 40, 50]},
|
| 30 |
+
index=["count", "mean", "std", "min", "25%", "50%", "75%", "max"],
|
| 31 |
+
)
|
| 32 |
+
tm.assert_frame_equal(result, expected)
|
| 33 |
+
|
| 34 |
+
# Top value is a boolean value that is False
|
| 35 |
+
result = df.describe(include=["bool"])
|
| 36 |
+
|
| 37 |
+
expected = DataFrame(
|
| 38 |
+
{"bool_data": [5, 2, False, 3]}, index=["count", "unique", "top", "freq"]
|
| 39 |
+
)
|
| 40 |
+
tm.assert_frame_equal(result, expected)
|
| 41 |
+
|
| 42 |
+
def test_describe_empty_object(self):
|
| 43 |
+
# GH#27183
|
| 44 |
+
df = DataFrame({"A": [None, None]}, dtype=object)
|
| 45 |
+
result = df.describe()
|
| 46 |
+
expected = DataFrame(
|
| 47 |
+
{"A": [0, 0, np.nan, np.nan]},
|
| 48 |
+
dtype=object,
|
| 49 |
+
index=["count", "unique", "top", "freq"],
|
| 50 |
+
)
|
| 51 |
+
tm.assert_frame_equal(result, expected)
|
| 52 |
+
|
| 53 |
+
result = df.iloc[:0].describe()
|
| 54 |
+
tm.assert_frame_equal(result, expected)
|
| 55 |
+
|
| 56 |
+
def test_describe_bool_frame(self):
|
| 57 |
+
# GH#13891
|
| 58 |
+
df = DataFrame(
|
| 59 |
+
{
|
| 60 |
+
"bool_data_1": [False, False, True, True],
|
| 61 |
+
"bool_data_2": [False, True, True, True],
|
| 62 |
+
}
|
| 63 |
+
)
|
| 64 |
+
result = df.describe()
|
| 65 |
+
expected = DataFrame(
|
| 66 |
+
{"bool_data_1": [4, 2, False, 2], "bool_data_2": [4, 2, True, 3]},
|
| 67 |
+
index=["count", "unique", "top", "freq"],
|
| 68 |
+
)
|
| 69 |
+
tm.assert_frame_equal(result, expected)
|
| 70 |
+
|
| 71 |
+
df = DataFrame(
|
| 72 |
+
{
|
| 73 |
+
"bool_data": [False, False, True, True, False],
|
| 74 |
+
"int_data": [0, 1, 2, 3, 4],
|
| 75 |
+
}
|
| 76 |
+
)
|
| 77 |
+
result = df.describe()
|
| 78 |
+
expected = DataFrame(
|
| 79 |
+
{"int_data": [5, 2, df.int_data.std(), 0, 1, 2, 3, 4]},
|
| 80 |
+
index=["count", "mean", "std", "min", "25%", "50%", "75%", "max"],
|
| 81 |
+
)
|
| 82 |
+
tm.assert_frame_equal(result, expected)
|
| 83 |
+
|
| 84 |
+
df = DataFrame(
|
| 85 |
+
{"bool_data": [False, False, True, True], "str_data": ["a", "b", "c", "a"]}
|
| 86 |
+
)
|
| 87 |
+
result = df.describe()
|
| 88 |
+
expected = DataFrame(
|
| 89 |
+
{"bool_data": [4, 2, False, 2], "str_data": [4, 3, "a", 2]},
|
| 90 |
+
index=["count", "unique", "top", "freq"],
|
| 91 |
+
)
|
| 92 |
+
tm.assert_frame_equal(result, expected)
|
| 93 |
+
|
| 94 |
+
def test_describe_categorical(self):
|
| 95 |
+
df = DataFrame({"value": np.random.default_rng(2).integers(0, 10000, 100)})
|
| 96 |
+
labels = [f"{i} - {i + 499}" for i in range(0, 10000, 500)]
|
| 97 |
+
cat_labels = Categorical(labels, labels)
|
| 98 |
+
|
| 99 |
+
df = df.sort_values(by=["value"], ascending=True)
|
| 100 |
+
df["value_group"] = pd.cut(
|
| 101 |
+
df.value, range(0, 10500, 500), right=False, labels=cat_labels
|
| 102 |
+
)
|
| 103 |
+
cat = df
|
| 104 |
+
|
| 105 |
+
# Categoricals should not show up together with numerical columns
|
| 106 |
+
result = cat.describe()
|
| 107 |
+
assert len(result.columns) == 1
|
| 108 |
+
|
| 109 |
+
# In a frame, describe() for the cat should be the same as for string
|
| 110 |
+
# arrays (count, unique, top, freq)
|
| 111 |
+
|
| 112 |
+
cat = Categorical(
|
| 113 |
+
["a", "b", "b", "b"], categories=["a", "b", "c"], ordered=True
|
| 114 |
+
)
|
| 115 |
+
s = Series(cat)
|
| 116 |
+
result = s.describe()
|
| 117 |
+
expected = Series([4, 2, "b", 3], index=["count", "unique", "top", "freq"])
|
| 118 |
+
tm.assert_series_equal(result, expected)
|
| 119 |
+
|
| 120 |
+
cat = Series(Categorical(["a", "b", "c", "c"]))
|
| 121 |
+
df3 = DataFrame({"cat": cat, "s": ["a", "b", "c", "c"]})
|
| 122 |
+
result = df3.describe()
|
| 123 |
+
tm.assert_numpy_array_equal(result["cat"].values, result["s"].values)
|
| 124 |
+
|
| 125 |
+
def test_describe_empty_categorical_column(self):
|
| 126 |
+
# GH#26397
|
| 127 |
+
# Ensure the index of an empty categorical DataFrame column
|
| 128 |
+
# also contains (count, unique, top, freq)
|
| 129 |
+
df = DataFrame({"empty_col": Categorical([])})
|
| 130 |
+
result = df.describe()
|
| 131 |
+
expected = DataFrame(
|
| 132 |
+
{"empty_col": [0, 0, np.nan, np.nan]},
|
| 133 |
+
index=["count", "unique", "top", "freq"],
|
| 134 |
+
dtype="object",
|
| 135 |
+
)
|
| 136 |
+
tm.assert_frame_equal(result, expected)
|
| 137 |
+
# ensure NaN, not None
|
| 138 |
+
assert np.isnan(result.iloc[2, 0])
|
| 139 |
+
assert np.isnan(result.iloc[3, 0])
|
| 140 |
+
|
| 141 |
+
def test_describe_categorical_columns(self):
|
| 142 |
+
# GH#11558
|
| 143 |
+
columns = pd.CategoricalIndex(["int1", "int2", "obj"], ordered=True, name="XXX")
|
| 144 |
+
df = DataFrame(
|
| 145 |
+
{
|
| 146 |
+
"int1": [10, 20, 30, 40, 50],
|
| 147 |
+
"int2": [10, 20, 30, 40, 50],
|
| 148 |
+
"obj": ["A", 0, None, "X", 1],
|
| 149 |
+
},
|
| 150 |
+
columns=columns,
|
| 151 |
+
)
|
| 152 |
+
result = df.describe()
|
| 153 |
+
|
| 154 |
+
exp_columns = pd.CategoricalIndex(
|
| 155 |
+
["int1", "int2"],
|
| 156 |
+
categories=["int1", "int2", "obj"],
|
| 157 |
+
ordered=True,
|
| 158 |
+
name="XXX",
|
| 159 |
+
)
|
| 160 |
+
expected = DataFrame(
|
| 161 |
+
{
|
| 162 |
+
"int1": [5, 30, df.int1.std(), 10, 20, 30, 40, 50],
|
| 163 |
+
"int2": [5, 30, df.int2.std(), 10, 20, 30, 40, 50],
|
| 164 |
+
},
|
| 165 |
+
index=["count", "mean", "std", "min", "25%", "50%", "75%", "max"],
|
| 166 |
+
columns=exp_columns,
|
| 167 |
+
)
|
| 168 |
+
|
| 169 |
+
tm.assert_frame_equal(result, expected)
|
| 170 |
+
tm.assert_categorical_equal(result.columns.values, expected.columns.values)
|
| 171 |
+
|
| 172 |
+
def test_describe_datetime_columns(self):
|
| 173 |
+
columns = pd.DatetimeIndex(
|
| 174 |
+
["2011-01-01", "2011-02-01", "2011-03-01"],
|
| 175 |
+
freq="MS",
|
| 176 |
+
tz="US/Eastern",
|
| 177 |
+
name="XXX",
|
| 178 |
+
)
|
| 179 |
+
df = DataFrame(
|
| 180 |
+
{
|
| 181 |
+
0: [10, 20, 30, 40, 50],
|
| 182 |
+
1: [10, 20, 30, 40, 50],
|
| 183 |
+
2: ["A", 0, None, "X", 1],
|
| 184 |
+
}
|
| 185 |
+
)
|
| 186 |
+
df.columns = columns
|
| 187 |
+
result = df.describe()
|
| 188 |
+
|
| 189 |
+
exp_columns = pd.DatetimeIndex(
|
| 190 |
+
["2011-01-01", "2011-02-01"], freq="MS", tz="US/Eastern", name="XXX"
|
| 191 |
+
)
|
| 192 |
+
expected = DataFrame(
|
| 193 |
+
{
|
| 194 |
+
0: [5, 30, df.iloc[:, 0].std(), 10, 20, 30, 40, 50],
|
| 195 |
+
1: [5, 30, df.iloc[:, 1].std(), 10, 20, 30, 40, 50],
|
| 196 |
+
},
|
| 197 |
+
index=["count", "mean", "std", "min", "25%", "50%", "75%", "max"],
|
| 198 |
+
)
|
| 199 |
+
expected.columns = exp_columns
|
| 200 |
+
tm.assert_frame_equal(result, expected)
|
| 201 |
+
assert result.columns.freq == "MS"
|
| 202 |
+
assert result.columns.tz == expected.columns.tz
|
| 203 |
+
|
| 204 |
+
def test_describe_timedelta_values(self):
|
| 205 |
+
# GH#6145
|
| 206 |
+
t1 = pd.timedelta_range("1 days", freq="D", periods=5)
|
| 207 |
+
t2 = pd.timedelta_range("1 hours", freq="h", periods=5)
|
| 208 |
+
df = DataFrame({"t1": t1, "t2": t2})
|
| 209 |
+
|
| 210 |
+
expected = DataFrame(
|
| 211 |
+
{
|
| 212 |
+
"t1": [
|
| 213 |
+
5,
|
| 214 |
+
pd.Timedelta("3 days"),
|
| 215 |
+
df.iloc[:, 0].std(),
|
| 216 |
+
pd.Timedelta("1 days"),
|
| 217 |
+
pd.Timedelta("2 days"),
|
| 218 |
+
pd.Timedelta("3 days"),
|
| 219 |
+
pd.Timedelta("4 days"),
|
| 220 |
+
pd.Timedelta("5 days"),
|
| 221 |
+
],
|
| 222 |
+
"t2": [
|
| 223 |
+
5,
|
| 224 |
+
pd.Timedelta("3 hours"),
|
| 225 |
+
df.iloc[:, 1].std(),
|
| 226 |
+
pd.Timedelta("1 hours"),
|
| 227 |
+
pd.Timedelta("2 hours"),
|
| 228 |
+
pd.Timedelta("3 hours"),
|
| 229 |
+
pd.Timedelta("4 hours"),
|
| 230 |
+
pd.Timedelta("5 hours"),
|
| 231 |
+
],
|
| 232 |
+
},
|
| 233 |
+
index=["count", "mean", "std", "min", "25%", "50%", "75%", "max"],
|
| 234 |
+
)
|
| 235 |
+
|
| 236 |
+
result = df.describe()
|
| 237 |
+
tm.assert_frame_equal(result, expected)
|
| 238 |
+
|
| 239 |
+
exp_repr = (
|
| 240 |
+
" t1 t2\n"
|
| 241 |
+
"count 5 5\n"
|
| 242 |
+
"mean 3 days 00:00:00 0 days 03:00:00\n"
|
| 243 |
+
"std 1 days 13:56:50.394919273 0 days 01:34:52.099788303\n"
|
| 244 |
+
"min 1 days 00:00:00 0 days 01:00:00\n"
|
| 245 |
+
"25% 2 days 00:00:00 0 days 02:00:00\n"
|
| 246 |
+
"50% 3 days 00:00:00 0 days 03:00:00\n"
|
| 247 |
+
"75% 4 days 00:00:00 0 days 04:00:00\n"
|
| 248 |
+
"max 5 days 00:00:00 0 days 05:00:00"
|
| 249 |
+
)
|
| 250 |
+
assert repr(result) == exp_repr
|
| 251 |
+
|
| 252 |
+
def test_describe_tz_values(self, tz_naive_fixture):
|
| 253 |
+
# GH#21332
|
| 254 |
+
tz = tz_naive_fixture
|
| 255 |
+
s1 = Series(range(5))
|
| 256 |
+
start = Timestamp(2018, 1, 1)
|
| 257 |
+
end = Timestamp(2018, 1, 5)
|
| 258 |
+
s2 = Series(date_range(start, end, tz=tz))
|
| 259 |
+
df = DataFrame({"s1": s1, "s2": s2})
|
| 260 |
+
|
| 261 |
+
expected = DataFrame(
|
| 262 |
+
{
|
| 263 |
+
"s1": [5, 2, 0, 1, 2, 3, 4, 1.581139],
|
| 264 |
+
"s2": [
|
| 265 |
+
5,
|
| 266 |
+
Timestamp(2018, 1, 3).tz_localize(tz),
|
| 267 |
+
start.tz_localize(tz),
|
| 268 |
+
s2[1],
|
| 269 |
+
s2[2],
|
| 270 |
+
s2[3],
|
| 271 |
+
end.tz_localize(tz),
|
| 272 |
+
np.nan,
|
| 273 |
+
],
|
| 274 |
+
},
|
| 275 |
+
index=["count", "mean", "min", "25%", "50%", "75%", "max", "std"],
|
| 276 |
+
)
|
| 277 |
+
result = df.describe(include="all")
|
| 278 |
+
tm.assert_frame_equal(result, expected)
|
| 279 |
+
|
| 280 |
+
def test_datetime_is_numeric_includes_datetime(self):
|
| 281 |
+
df = DataFrame({"a": date_range("2012", periods=3), "b": [1, 2, 3]})
|
| 282 |
+
result = df.describe()
|
| 283 |
+
expected = DataFrame(
|
| 284 |
+
{
|
| 285 |
+
"a": [
|
| 286 |
+
3,
|
| 287 |
+
Timestamp("2012-01-02"),
|
| 288 |
+
Timestamp("2012-01-01"),
|
| 289 |
+
Timestamp("2012-01-01T12:00:00"),
|
| 290 |
+
Timestamp("2012-01-02"),
|
| 291 |
+
Timestamp("2012-01-02T12:00:00"),
|
| 292 |
+
Timestamp("2012-01-03"),
|
| 293 |
+
np.nan,
|
| 294 |
+
],
|
| 295 |
+
"b": [3, 2, 1, 1.5, 2, 2.5, 3, 1],
|
| 296 |
+
},
|
| 297 |
+
index=["count", "mean", "min", "25%", "50%", "75%", "max", "std"],
|
| 298 |
+
)
|
| 299 |
+
tm.assert_frame_equal(result, expected)
|
| 300 |
+
|
| 301 |
+
def test_describe_tz_values2(self):
|
| 302 |
+
tz = "CET"
|
| 303 |
+
s1 = Series(range(5))
|
| 304 |
+
start = Timestamp(2018, 1, 1)
|
| 305 |
+
end = Timestamp(2018, 1, 5)
|
| 306 |
+
s2 = Series(date_range(start, end, tz=tz))
|
| 307 |
+
df = DataFrame({"s1": s1, "s2": s2})
|
| 308 |
+
|
| 309 |
+
s1_ = s1.describe()
|
| 310 |
+
s2_ = s2.describe()
|
| 311 |
+
idx = [
|
| 312 |
+
"count",
|
| 313 |
+
"mean",
|
| 314 |
+
"min",
|
| 315 |
+
"25%",
|
| 316 |
+
"50%",
|
| 317 |
+
"75%",
|
| 318 |
+
"max",
|
| 319 |
+
"std",
|
| 320 |
+
]
|
| 321 |
+
expected = pd.concat([s1_, s2_], axis=1, keys=["s1", "s2"]).reindex(
|
| 322 |
+
idx, copy=False
|
| 323 |
+
)
|
| 324 |
+
|
| 325 |
+
result = df.describe(include="all")
|
| 326 |
+
tm.assert_frame_equal(result, expected)
|
| 327 |
+
|
| 328 |
+
def test_describe_percentiles_integer_idx(self):
|
| 329 |
+
# GH#26660
|
| 330 |
+
df = DataFrame({"x": [1]})
|
| 331 |
+
pct = np.linspace(0, 1, 10 + 1)
|
| 332 |
+
result = df.describe(percentiles=pct)
|
| 333 |
+
|
| 334 |
+
expected = DataFrame(
|
| 335 |
+
{"x": [1.0, 1.0, np.nan, 1.0, *(1.0 for _ in pct), 1.0]},
|
| 336 |
+
index=[
|
| 337 |
+
"count",
|
| 338 |
+
"mean",
|
| 339 |
+
"std",
|
| 340 |
+
"min",
|
| 341 |
+
"0%",
|
| 342 |
+
"10%",
|
| 343 |
+
"20%",
|
| 344 |
+
"30%",
|
| 345 |
+
"40%",
|
| 346 |
+
"50%",
|
| 347 |
+
"60%",
|
| 348 |
+
"70%",
|
| 349 |
+
"80%",
|
| 350 |
+
"90%",
|
| 351 |
+
"100%",
|
| 352 |
+
"max",
|
| 353 |
+
],
|
| 354 |
+
)
|
| 355 |
+
tm.assert_frame_equal(result, expected)
|
| 356 |
+
|
| 357 |
+
def test_describe_does_not_raise_error_for_dictlike_elements(self):
|
| 358 |
+
# GH#32409
|
| 359 |
+
df = DataFrame([{"test": {"a": "1"}}, {"test": {"a": "2"}}])
|
| 360 |
+
expected = DataFrame(
|
| 361 |
+
{"test": [2, 2, {"a": "1"}, 1]}, index=["count", "unique", "top", "freq"]
|
| 362 |
+
)
|
| 363 |
+
result = df.describe()
|
| 364 |
+
tm.assert_frame_equal(result, expected)
|
| 365 |
+
|
| 366 |
+
@pytest.mark.parametrize("exclude", ["x", "y", ["x", "y"], ["x", "z"]])
|
| 367 |
+
def test_describe_when_include_all_exclude_not_allowed(self, exclude):
|
| 368 |
+
"""
|
| 369 |
+
When include is 'all', then setting exclude != None is not allowed.
|
| 370 |
+
"""
|
| 371 |
+
df = DataFrame({"x": [1], "y": [2], "z": [3]})
|
| 372 |
+
msg = "exclude must be None when include is 'all'"
|
| 373 |
+
with pytest.raises(ValueError, match=msg):
|
| 374 |
+
df.describe(include="all", exclude=exclude)
|
| 375 |
+
|
| 376 |
+
def test_describe_with_duplicate_columns(self):
|
| 377 |
+
df = DataFrame(
|
| 378 |
+
[[1, 1, 1], [2, 2, 2], [3, 3, 3]],
|
| 379 |
+
columns=["bar", "a", "a"],
|
| 380 |
+
dtype="float64",
|
| 381 |
+
)
|
| 382 |
+
result = df.describe()
|
| 383 |
+
ser = df.iloc[:, 0].describe()
|
| 384 |
+
expected = pd.concat([ser, ser, ser], keys=df.columns, axis=1)
|
| 385 |
+
tm.assert_frame_equal(result, expected)
|
| 386 |
+
|
| 387 |
+
def test_ea_with_na(self, any_numeric_ea_dtype):
|
| 388 |
+
# GH#48778
|
| 389 |
+
|
| 390 |
+
df = DataFrame({"a": [1, pd.NA, pd.NA], "b": pd.NA}, dtype=any_numeric_ea_dtype)
|
| 391 |
+
result = df.describe()
|
| 392 |
+
expected = DataFrame(
|
| 393 |
+
{"a": [1.0, 1.0, pd.NA] + [1.0] * 5, "b": [0.0] + [pd.NA] * 7},
|
| 394 |
+
index=["count", "mean", "std", "min", "25%", "50%", "75%", "max"],
|
| 395 |
+
dtype="Float64",
|
| 396 |
+
)
|
| 397 |
+
tm.assert_frame_equal(result, expected)
|
| 398 |
+
|
| 399 |
+
def test_describe_exclude_pa_dtype(self):
|
| 400 |
+
# GH#52570
|
| 401 |
+
pa = pytest.importorskip("pyarrow")
|
| 402 |
+
df = DataFrame(
|
| 403 |
+
{
|
| 404 |
+
"a": Series([1, 2, 3], dtype=pd.ArrowDtype(pa.int8())),
|
| 405 |
+
"b": Series([1, 2, 3], dtype=pd.ArrowDtype(pa.int16())),
|
| 406 |
+
"c": Series([1, 2, 3], dtype=pd.ArrowDtype(pa.int32())),
|
| 407 |
+
}
|
| 408 |
+
)
|
| 409 |
+
result = df.describe(
|
| 410 |
+
include=pd.ArrowDtype(pa.int8()), exclude=pd.ArrowDtype(pa.int32())
|
| 411 |
+
)
|
| 412 |
+
expected = DataFrame(
|
| 413 |
+
{"a": [3, 2, 1, 1, 1.5, 2, 2.5, 3]},
|
| 414 |
+
index=["count", "mean", "std", "min", "25%", "50%",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array([202])
|
| 8 |
+
|
| 9 |
+
k = np.array([5])
|
| 10 |
+
|
| 11 |
+
k_exog = np.array([1])
|
| 12 |
+
|
| 13 |
+
sigma = np.array([.81130812929037])
|
| 14 |
+
|
| 15 |
+
chi2 = np.array([73901.783883385])
|
| 16 |
+
|
| 17 |
+
df_model = np.array([3])
|
| 18 |
+
|
| 19 |
+
k_ar = np.array([1])
|
| 20 |
+
|
| 21 |
+
k_ma = np.array([2])
|
| 22 |
+
|
| 23 |
+
params = np.array([
|
| 24 |
+
.91963917600489,
|
| 25 |
+
-.89804855498306,
|
| 26 |
+
1.3032353997768,
|
| 27 |
+
.30230174935463,
|
| 28 |
+
.65822088065264])
|
| 29 |
+
|
| 30 |
+
cov_params = np.array([
|
| 31 |
+
.00622027554245,
|
| 32 |
+
.00026933156699,
|
| 33 |
+
-.00014478009121,
|
| 34 |
+
-.00010527901395,
|
| 35 |
+
.00006880952561,
|
| 36 |
+
.00026933156699,
|
| 37 |
+
.0023661521973,
|
| 38 |
+
-.00263264462948,
|
| 39 |
+
-.00241927046074,
|
| 40 |
+
-.00069258998629,
|
| 41 |
+
-.00014478009121,
|
| 42 |
+
-.00263264462948,
|
| 43 |
+
.003637275855,
|
| 44 |
+
.0033625395431,
|
| 45 |
+
.00072507981262,
|
| 46 |
+
-.00010527901395,
|
| 47 |
+
-.00241927046074,
|
| 48 |
+
.0033625395431,
|
| 49 |
+
.00312013997649,
|
| 50 |
+
.00067166747844,
|
| 51 |
+
.00006880952561,
|
| 52 |
+
-.00069258998629,
|
| 53 |
+
.00072507981262,
|
| 54 |
+
.00067166747844,
|
| 55 |
+
.00108477120916]).reshape(5, 5)
|
| 56 |
+
|
| 57 |
+
xb = np.array([
|
| 58 |
+
.91963917016983,
|
| 59 |
+
.91963917016983,
|
| 60 |
+
.69261693954468,
|
| 61 |
+
.76115423440933,
|
| 62 |
+
.63710719347,
|
| 63 |
+
.77478265762329,
|
| 64 |
+
.61527073383331,
|
| 65 |
+
.80501782894135,
|
| 66 |
+
.62182641029358,
|
| 67 |
+
.72158020734787,
|
| 68 |
+
.66619211435318,
|
| 69 |
+
.72980058193207,
|
| 70 |
+
.64935982227325,
|
| 71 |
+
.77660953998566,
|
| 72 |
+
.6069877743721,
|
| 73 |
+
.79818457365036,
|
| 74 |
+
.60795724391937,
|
| 75 |
+
.7583304643631,
|
| 76 |
+
.68147450685501,
|
| 77 |
+
.72765469551086,
|
| 78 |
+
.69699174165726,
|
| 79 |
+
.69102382659912,
|
| 80 |
+
.67753201723099,
|
| 81 |
+
.72617518901825,
|
| 82 |
+
.69977235794067,
|
| 83 |
+
.713603079319,
|
| 84 |
+
.72478419542313,
|
| 85 |
+
.68503832817078,
|
| 86 |
+
.75677126646042,
|
| 87 |
+
.79034942388535,
|
| 88 |
+
.68609654903412,
|
| 89 |
+
.83208250999451,
|
| 90 |
+
.60605573654175,
|
| 91 |
+
.80849212408066,
|
| 92 |
+
.69862711429596,
|
| 93 |
+
.80978256464005,
|
| 94 |
+
.7383074760437,
|
| 95 |
+
.78789436817169,
|
| 96 |
+
.79390448331833,
|
| 97 |
+
.79169547557831,
|
| 98 |
+
.76283228397369,
|
| 99 |
+
.87939429283142,
|
| 100 |
+
.75783687829971,
|
| 101 |
+
.85010063648224,
|
| 102 |
+
.80657452344894,
|
| 103 |
+
.86508285999298,
|
| 104 |
+
.72368890047073,
|
| 105 |
+
.86846202611923,
|
| 106 |
+
.75351697206497,
|
| 107 |
+
.74047154188156,
|
| 108 |
+
.82022970914841,
|
| 109 |
+
.73184186220169,
|
| 110 |
+
.7623735666275,
|
| 111 |
+
.74929028749466,
|
| 112 |
+
.75702118873596,
|
| 113 |
+
.79036456346512,
|
| 114 |
+
.81429827213287,
|
| 115 |
+
1.0007030963898,
|
| 116 |
+
.70464313030243,
|
| 117 |
+
1.2375881671906,
|
| 118 |
+
.82733017206192,
|
| 119 |
+
1.1780800819397,
|
| 120 |
+
.83767229318619,
|
| 121 |
+
1.3407131433487,
|
| 122 |
+
.7835128903389,
|
| 123 |
+
.99667322635651,
|
| 124 |
+
.82677388191223,
|
| 125 |
+
1.0330017805099,
|
| 126 |
+
.78713357448578,
|
| 127 |
+
.80603551864624,
|
| 128 |
+
.91298097372055,
|
| 129 |
+
.94862020015717,
|
| 130 |
+
.83088356256485,
|
| 131 |
+
1.1405943632126,
|
| 132 |
+
.72683191299438,
|
| 133 |
+
1.0197489261627,
|
| 134 |
+
.88344657421112,
|
| 135 |
+
1.1016070842743,
|
| 136 |
+
1.0485582351685,
|
| 137 |
+
1.1717364788055,
|
| 138 |
+
.94894939661026,
|
| 139 |
+
1.418029665947,
|
| 140 |
+
1.2063212394714,
|
| 141 |
+
1.3504880666733,
|
| 142 |
+
1.4053744077682,
|
| 143 |
+
1.5106836557388,
|
| 144 |
+
.91192328929901,
|
| 145 |
+
1.4546687602997,
|
| 146 |
+
1.2100585699081,
|
| 147 |
+
1.2459771633148,
|
| 148 |
+
1.2914154529572,
|
| 149 |
+
1.1733019351959,
|
| 150 |
+
.80550068616867,
|
| 151 |
+
.88859277963638,
|
| 152 |
+
1.5257360935211,
|
| 153 |
+
.49089628458023,
|
| 154 |
+
.75268715620041,
|
| 155 |
+
.92090040445328,
|
| 156 |
+
.99410575628281,
|
| 157 |
+
.87882828712463,
|
| 158 |
+
1.1253950595856,
|
| 159 |
+
.89082646369934,
|
| 160 |
+
.9317963719368,
|
| 161 |
+
.90858340263367,
|
| 162 |
+
.82737028598785,
|
| 163 |
+
1.0978132486343,
|
| 164 |
+
.74325948953629,
|
| 165 |
+
.98125350475311,
|
| 166 |
+
1.0478370189667,
|
| 167 |
+
.03625157848001,
|
| 168 |
+
1.3422871828079,
|
| 169 |
+
.51377469301224,
|
| 170 |
+
1.3643686771393,
|
| 171 |
+
.70055514574051,
|
| 172 |
+
1.2559896707535,
|
| 173 |
+
.71517109870911,
|
| 174 |
+
1.1997950077057,
|
| 175 |
+
.75360465049744,
|
| 176 |
+
1.2862613201141,
|
| 177 |
+
.79965251684189,
|
| 178 |
+
1.2606881856918,
|
| 179 |
+
1.018030166626,
|
| 180 |
+
1.1752370595932,
|
| 181 |
+
.69517260789871,
|
| 182 |
+
1.597958445549,
|
| 183 |
+
.65335071086884,
|
| 184 |
+
1.4763361215591,
|
| 185 |
+
1.2708671092987,
|
| 186 |
+
1.0432199239731,
|
| 187 |
+
.561203956604,
|
| 188 |
+
1.2630445957184,
|
| 189 |
+
.66821777820587,
|
| 190 |
+
1.2384748458862,
|
| 191 |
+
.70777904987335,
|
| 192 |
+
1.2246036529541,
|
| 193 |
+
.75373476743698,
|
| 194 |
+
1.199233174324,
|
| 195 |
+
.69312900304794,
|
| 196 |
+
1.0659650564194,
|
| 197 |
+
.80386221408844,
|
| 198 |
+
.99243313074112,
|
| 199 |
+
.78622406721115,
|
| 200 |
+
1.1766475439072,
|
| 201 |
+
.74267518520355,
|
| 202 |
+
1.1679803133011,
|
| 203 |
+
.85658311843872,
|
| 204 |
+
.99335825443268,
|
| 205 |
+
.79920876026154,
|
| 206 |
+
1.1595865488052,
|
| 207 |
+
.92043119668961,
|
| 208 |
+
.98299539089203,
|
| 209 |
+
.94316083192825,
|
| 210 |
+
1.0661553144455,
|
| 211 |
+
.6393609046936,
|
| 212 |
+
.9456650018692,
|
| 213 |
+
.91597771644592,
|
| 214 |
+
.80332309007645,
|
| 215 |
+
.65838772058487,
|
| 216 |
+
1.1093089580536,
|
| 217 |
+
.68860310316086,
|
| 218 |
+
1.0485997200012,
|
| 219 |
+
.89771980047226,
|
| 220 |
+
.94581252336502,
|
| 221 |
+
1.0480616092682,
|
| 222 |
+
1.0014315843582,
|
| 223 |
+
1.1307729482651,
|
| 224 |
+
1.1770483255386,
|
| 225 |
+
.89873492717743,
|
| 226 |
+
1.2652103900909,
|
| 227 |
+
.66434383392334,
|
| 228 |
+
1.1431220769882,
|
| 229 |
+
.44322970509529,
|
| 230 |
+
.9269899725914,
|
| 231 |
+
1.0786435604095,
|
| 232 |
+
.82789659500122,
|
| 233 |
+
1.0368362665176,
|
| 234 |
+
1.0712716579437,
|
| 235 |
+
.70438456535339,
|
| 236 |
+
.88966482877731,
|
| 237 |
+
1.009087562561,
|
| 238 |
+
1.0887442827225,
|
| 239 |
+
.88976800441742,
|
| 240 |
+
1.2735350131989,
|
| 241 |
+
1.0157470703125,
|
| 242 |
+
.95522791147232,
|
| 243 |
+
1.3003809452057,
|
| 244 |
+
.73179203271866,
|
| 245 |
+
2.4736785888672,
|
| 246 |
+
-.25176140666008,
|
| 247 |
+
1.9082181453705,
|
| 248 |
+
.53501582145691,
|
| 249 |
+
.7591078877449,
|
| 250 |
+
1.0281100273132,
|
| 251 |
+
1.6240043640137,
|
| 252 |
+
.60095232725143,
|
| 253 |
+
1.6211705207825,
|
| 254 |
+
1.344465970993,
|
| 255 |
+
1.124480009079,
|
| 256 |
+
2.1775946617126,
|
| 257 |
+
-.71973150968552,
|
| 258 |
+
-.37754261493683,
|
| 259 |
+
1.2329530715942,
|
| 260 |
+
1.127131819725])
|
| 261 |
+
|
| 262 |
+
y = np.array([
|
| 263 |
+
np.nan,
|
| 264 |
+
29.899639129639,
|
| 265 |
+
29.842617034912,
|
| 266 |
+
30.111154556274,
|
| 267 |
+
30.007108688354,
|
| 268 |
+
30.314783096313,
|
| 269 |
+
30.165269851685,
|
| 270 |
+
30.555017471313,
|
| 271 |
+
30.461826324463,
|
| 272 |
+
30.531579971313,
|
| 273 |
+
30.586193084717,
|
| 274 |
+
30.709800720215,
|
| 275 |
+
30.689361572266,
|
| 276 |
+
30.986608505249,
|
| 277 |
+
30.826986312866,
|
| 278 |
+
31.178184509277,
|
| 279 |
+
31.047958374023,
|
| 280 |
+
31.238330841064,
|
| 281 |
+
31.371475219727,
|
| 282 |
+
31.477655410767,
|
| 283 |
+
31.636991500854,
|
| 284 |
+
31.641023635864,
|
| 285 |
+
31.697532653809,
|
| 286 |
+
31.846176147461,
|
| 287 |
+
31.979772567749,
|
| 288 |
+
32.093601226807,
|
| 289 |
+
32.304782867432,
|
| 290 |
+
32.335037231445,
|
| 291 |
+
32.636772155762,
|
| 292 |
+
33.070346832275,
|
| 293 |
+
33.136096954346,
|
| 294 |
+
33.682079315186,
|
| 295 |
+
33.506057739258,
|
| 296 |
+
33.908489227295,
|
| 297 |
+
34.098628997803,
|
| 298 |
+
34.509784698486,
|
| 299 |
+
34.838306427002,
|
| 300 |
+
35.187896728516,
|
| 301 |
+
35.693904876709,
|
| 302 |
+
36.091693878174,
|
| 303 |
+
36.462833404541,
|
| 304 |
+
37.179393768311,
|
| 305 |
+
37.557834625244,
|
| 306 |
+
38.150100708008,
|
| 307 |
+
38.706577301025,
|
| 308 |
+
39.365081787109,
|
| 309 |
+
39.623691558838,
|
| 310 |
+
40.268463134766,
|
| 311 |
+
40.653518676758,
|
| 312 |
+
40.840469360352,
|
| 313 |
+
41.420227050781,
|
| 314 |
+
41.631843566895,
|
| 315 |
+
41.962375640869,
|
| 316 |
+
42.249290466309,
|
| 317 |
+
42.557022094727,
|
| 318 |
+
42.990364074707,
|
| 319 |
+
43.514297485352,
|
| 320 |
+
44.700702667236,
|
| 321 |
+
44.904644012451,
|
| 322 |
+
46.837585449219,
|
| 323 |
+
47.627330780029,
|
| 324 |
+
49.278079986572,
|
| 325 |
+
50.137672424316,
|
| 326 |
+
52.340713500977,
|
| 327 |
+
53.083511352539,
|
| 328 |
+
53.996673583984,
|
| 329 |
+
54.826774597168,
|
| 330 |
+
55.933002471924,
|
| 331 |
+
56.587131500244,
|
| 332 |
+
56.906032562256,
|
| 333 |
+
57.912979125977,
|
| 334 |
+
58.848621368408,
|
| 335 |
+
59.530883789063,
|
| 336 |
+
61.140594482422,
|
| 337 |
+
61.526832580566,
|
| 338 |
+
62.619747161865,
|
| 339 |
+
63.583446502686,
|
| 340 |
+
65.001609802246,
|
| 341 |
+
66.548561096191,
|
| 342 |
+
68.27173614502,
|
| 343 |
+
69.448951721191,
|
| 344 |
+
72.018028259277,
|
| 345 |
+
74.206321716309,
|
| 346 |
+
76.550483703613,
|
| 347 |
+
79.405372619629,
|
| 348 |
+
82.410682678223,
|
| 349 |
+
83.511924743652,
|
| 350 |
+
86.154663085938,
|
| 351 |
+
88.410057067871,
|
| 352 |
+
90.345977783203,
|
| 353 |
+
92.791412353516,
|
| 354 |
+
94.573303222656,
|
| 355 |
+
95.205505371094,
|
| 356 |
+
95.888595581055,
|
| 357 |
+
99.025733947754,
|
| 358 |
+
98.590896606445,
|
| 359 |
+
98.652687072754,
|
| 360 |
+
99.720901489258,
|
| 361 |
+
100.79410552979,
|
| 362 |
+
101.67883300781,
|
| 363 |
+
103.22539520264,
|
| 364 |
+
104.19082641602,
|
| 365 |
+
105.03179168701,
|
| 366 |
+
106.00858306885,
|
| 367 |
+
106.52736663818,
|
| 368 |
+
108.09781646729,
|
| 369 |
+
108.44326019287,
|
| 370 |
+
109.48125457764,
|
| 371 |
+
110.94783782959,
|
| 372 |
+
108.73625183105,
|
| 373 |
+
110.84228515625,
|
| 374 |
+
110.71376800537,
|
| 375 |
+
112.7643737793,
|
| 376 |
+
113.40055084229,
|
| 377 |
+
115.05599212646,
|
| 378 |
+
115.71517181396,
|
| 379 |
+
117.19979858398,
|
| 380 |
+
117.95359802246,
|
| 381 |
+
119.78626251221,
|
| 382 |
+
120.69965362549,
|
| 383 |
+
122.46068572998,
|
| 384 |
+
124.1180267334,
|
| 385 |
+
125.67523956299,
|
| 386 |
+
126.09517669678,
|
| 387 |
+
129.09796142578,
|
| 388 |
+
129.55334472656,
|
| 389 |
+
131.97633361816,
|
| 390 |
+
134.67086791992,
|
| 391 |
+
135.74320983887,
|
| 392 |
+
135.66120910645,
|
| 393 |
+
137.46304321289,
|
| 394 |
+
137.86820983887,
|
| 395 |
+
139.53848266602,
|
| 396 |
+
140.10777282715,
|
| 397 |
+
141.724609375,
|
| 398 |
+
142.45373535156,
|
| 399 |
+
143.99923706055,
|
| 400 |
+
144.49313354492,
|
| 401 |
+
145.56596374512,
|
| 402 |
+
146.40386962891,
|
| 403 |
+
147.29243469238,
|
| 404 |
+
147.98622131348,
|
| 405 |
+
149.57664489746,
|
| 406 |
+
150.14266967773,
|
| 407 |
+
151.66798400879,
|
| 408 |
+
152.65658569336,
|
| 409 |
+
153.59336853027,
|
| 410 |
+
154.29920959473,
|
| 411 |
+
155.85958862305,
|
| 412 |
+
157.02043151855,
|
| 413 |
+
157.98300170898,
|
| 414 |
+
159.14315795898,
|
| 415 |
+
160.46615600586,
|
| 416 |
+
160.53935241699,
|
| 417 |
+
161.34565734863,
|
| 418 |
+
162.41598510742,
|
| 419 |
+
162.80332946777,
|
| 420 |
+
162.85838317871,
|
| 421 |
+
164.30931091309,
|
| 422 |
+
164.5885925293,
|
| 423 |
+
165.74859619141,
|
| 424 |
+
166.7977142334,
|
| 425 |
+
167.64581298828,
|
| 426 |
+
169.14807128906,
|
| 427 |
+
170.30143737793,
|
| 428 |
+
172.03076171875,
|
| 429 |
+
173.87704467773,
|
| 430 |
+
174.79872131348,
|
| 431 |
+
176.86521911621,
|
| 432 |
+
177.06433105469,
|
| 433 |
+
178.54312133789,
|
| 434 |
+
178.0432434082,
|
| 435 |
+
178.62698364258,
|
| 436 |
+
180.37864685059,
|
| 437 |
+
180.82789611816,
|
| 438 |
+
182.23683166504,
|
| 439 |
+
183.67127990723,
|
| 440 |
+
183.90438842773,
|
| 441 |
+
184.58966064453,
|
| 442 |
+
185.90908813477,
|
| 443 |
+
187.38874816895,
|
| 444 |
+
188.2897644043,
|
| 445 |
+
190.37353515625,
|
| 446 |
+
191.81575012207,
|
| 447 |
+
192.75523376465,
|
| 448 |
+
195.10038757324,
|
| 449 |
+
195.43179321289,
|
| 450 |
+
201.67367553711,
|
| 451 |
+
199.14823913574,
|
| 452 |
+
202.60821533203,
|
| 453 |
+
203.23501586914,
|
| 454 |
+
202.65910339355,
|
| 455 |
+
204.60211181641,
|
| 456 |
+
207.54400634766,
|
| 457 |
+
207.93894958496,
|
| 458 |
+
210.75416564941,
|
| 459 |
+
213.83946228027,
|
| 460 |
+
215.12147521973,
|
| 461 |
+
220.78759765625,
|
| 462 |
+
216.16928100586,
|
| 463 |
+
211.79644775391,
|
| 464 |
+
213.90396118164,
|
| 465 |
+
215.59613037109])
|
| 466 |
+
|
| 467 |
+
resid = np.array([
|
| 468 |
+
np.nan,
|
| 469 |
+
-.74963909387589,
|
| 470 |
+
-.49261617660522,
|
| 471 |
+
-.74115377664566,
|
| 472 |
+
-.46710711717606,
|
| 473 |
+
-.76478433609009,
|
| 474 |
+
-.41527000069618,
|
| 475 |
+
-.71501767635345,
|
| 476 |
+
-.65182709693909,
|
| 477 |
+
-.61157959699631,
|
| 478 |
+
-.6061926484108,
|
| 479 |
+
-.66979920864105,
|
| 480 |
+
-.47936165332794,
|
| 481 |
+
-.76660931110382,
|
| 482 |
+
-.44698792695999,
|
| 483 |
+
-.73818320035934,
|
| 484 |
+
-.56795823574066,
|
| 485 |
+
-.54832947254181,
|
| 486 |
+
-.62147504091263,
|
| 487 |
+
-.53765416145325,
|
| 488 |
+
-.68699151277542,
|
| 489 |
+
-.6210241317749,
|
| 490 |
+
-.57753163576126,
|
| 491 |
+
-.56617534160614,
|
| 492 |
+
-.59977388381958,
|
| 493 |
+
-.51360231637955,
|
| 494 |
+
-.65478450059891,
|
| 495 |
+
-.45503878593445,
|
| 496 |
+
-.35677161812782,
|
| 497 |
+
-.62034744024277,
|
| 498 |
+
-.2860988676548,
|
| 499 |
+
-.78207945823669,
|
| 500 |
+
-.40605875849724,
|
| 501 |
+
-.50848907232285,
|
| 502 |
+
-.39862787723541,
|
| 503 |
+
-.40978488326073,
|
| 504 |
+
-.43830442428589,
|
| 505 |
+
-.28789436817169,
|
| 506 |
+
-.39390674233437,
|
| 507 |
+
-.3916939496994,
|
| 508 |
+
-.16283383965492,
|
| 509 |
+
-.37939432263374,
|
| 510 |
+
-.25783684849739,
|
| 511 |
+
-.25009834766388,
|
| 512 |
+
-.20657606422901,
|
| 513 |
+
-.46508130431175,
|
| 514 |
+
-.22368888556957,
|
| 515 |
+
-.36846202611923,
|
| 516 |
+
-.55352002382278,
|
| 517 |
+
-.24047155678272,
|
| 518 |
+
-.52022665739059,
|
| 519 |
+
-.43184259533882,
|
| 520 |
+
-.46237435936928,
|
| 521 |
+
-.44929105043411,
|
| 522 |
+
-.35701966285706,
|
| 523 |
+
-.29036456346512,
|
| 524 |
+
.1857016980648,
|
| 525 |
+
-.50070303678513,
|
| 526 |
+
.69535458087921,
|
| 527 |
+
-.03758737072349,
|
| 528 |
+
.47266906499863,
|
| 529 |
+
.02192067168653,
|
| 530 |
+
.86232846975327,
|
| 531 |
+
-.04071394726634,
|
| 532 |
+
-.08351214230061,
|
| 533 |
+
.0033267585095,
|
| 534 |
+
.07322765141726,
|
| 535 |
+
-.13300403952599,
|
| 536 |
+
-.48713436722755,
|
| 537 |
+
.09396601468325,
|
| 538 |
+
-.01297946088016,
|
| 539 |
+
-.14862097799778,
|
| 540 |
+
.4691156744957,
|
| 541 |
+
-.34059509634972,
|
| 542 |
+
.073167309165,
|
| 543 |
+
.08025334775448,
|
| 544 |
+
.31655418872833,
|
| 545 |
+
.49839133024216,
|
| 546 |
+
.55144023895264,
|
| 547 |
+
.22826506197453,
|
| 548 |
+
1.1510490179062,
|
| 549 |
+
.9819718003273,
|
| 550 |
+
.9936757683754,
|
| 551 |
+
1.4495149850845,
|
| 552 |
+
1.4946271181107,
|
| 553 |
+
.18931329250336,
|
| 554 |
+
1.1880751848221,
|
| 555 |
+
1.0453312397003,
|
| 556 |
+
.68994289636612,
|
| 557 |
+
1.1540243625641,
|
| 558 |
+
.60858601331711,
|
| 559 |
+
-.17330189049244,
|
| 560 |
+
-.20550219714642,
|
| 561 |
+
1.611407160759,
|
| 562 |
+
-.92573761940002,
|
| 563 |
+
-.69089323282242,
|
| 564 |
+
.14731439948082,
|
| 565 |
+
.07909959554672,
|
| 566 |
+
.00589422974735,
|
| 567 |
+
.42116710543633,
|
| 568 |
+
.07460948079824,
|
| 569 |
+
-.09083105623722,
|
| 570 |
+
.06820363551378,
|
| 571 |
+
-.30858492851257,
|
| 572 |
+
.47263273596764,
|
| 573 |
+
-.39781630039215,
|
| 574 |
+
.05674355849624,
|
| 575 |
+
.41874802112579,
|
| 576 |
+
-2.2478415966034,
|
| 577 |
+
.76375144720078,
|
| 578 |
+
-.64229023456573,
|
| 579 |
+
.68622988462448,
|
| 580 |
+
-.06437320262194,
|
| 581 |
+
.39945095777512,
|
| 582 |
+
-.0559926815331,
|
| 583 |
+
.28482890129089,
|
| 584 |
+
.00020190737268,
|
| 585 |
+
.54639840126038,
|
| 586 |
+
.11374024301767,
|
| 587 |
+
.50034290552139,
|
| 588 |
+
.63931334018707,
|
| 589 |
+
.38197138905525,
|
| 590 |
+
-.27523550391197,
|
| 591 |
+
1.404825925827,
|
| 592 |
+
-.1979645639658,
|
| 593 |
+
.94665539264679,
|
| 594 |
+
1.4236577749252,
|
| 595 |
+
.02913599461317,
|
| 596 |
+
-.643210709095,
|
| 597 |
+
.53878688812256,
|
| 598 |
+
-.26304465532303,
|
| 599 |
+
.43178829550743,
|
| 600 |
+
-.13848400115967,
|
| 601 |
+
.39222705364227,
|
| 602 |
+
-.02460673451424,
|
| 603 |
+
.34627133607864,
|
| 604 |
+
-.19923311471939,
|
| 605 |
+
.00686796056107,
|
| 606 |
+
.03404098749161,
|
| 607 |
+
-.10386525094509,
|
| 608 |
+
-.09243924915791,
|
| 609 |
+
.41377285122871,
|
| 610 |
+
-.17664749920368,
|
| 611 |
+
.35733091831207,
|
| 612 |
+
.13202276825905,
|
| 613 |
+
-.05658006668091,
|
| 614 |
+
-.09336434304714,
|
| 615 |
+
.40078815817833,
|
| 616 |
+
.24042254686356,
|
| 617 |
+
-.02043732441962,
|
| 618 |
+
.217001542449,
|
| 619 |
+
.25683608651161,
|
| 620 |
+
-.56615537405014,
|
| 621 |
+
-.13936093449593,
|
| 622 |
+
.15434110164642,
|
| 623 |
+
-.41597774624825,
|
| 624 |
+
-.60332614183426,
|
| 625 |
+
.34161224961281,
|
| 626 |
+
-.40931203961372,
|
| 627 |
+
.11139994114637,
|
| 628 |
+
.15139718353748,
|
| 629 |
+
-.09771674126387,
|
| 630 |
+
.45419663190842,
|
| 631 |
+
.15193535387516,
|
| 632 |
+
.5985592007637,
|
| 633 |
+
.66923010349274,
|
| 634 |
+
.02294866926968,
|
| 635 |
+
.80127727985382,
|
| 636 |
+
-.46522265672684,
|
| 637 |
+
.33565619587898,
|
| 638 |
+
-.94310986995697,
|
| 639 |
+
-.34323886036873,
|
| 640 |
+
.67301613092422,
|
| 641 |
+
-.37864658236504,
|
| 642 |
+
.37210035324097,
|
| 643 |
+
.3631728887558,
|
| 644 |
+
-.47128081321716,
|
| 645 |
+
-.20438456535339,
|
| 646 |
+
.3103321492672,
|
| 647 |
+
.3909215927124,
|
| 648 |
+
.01124659087509,
|
| 649 |
+
.81024420261383,
|
| 650 |
+
.42646199464798,
|
| 651 |
+
-.01574708521366,
|
| 652 |
+
1.044772028923,
|
| 653 |
+
-.40038701891899,
|
| 654 |
+
3.768208026886,
|
| 655 |
+
-2.273681640625,
|
| 656 |
+
1.5517644882202,
|
| 657 |
+
.09178187698126,
|
| 658 |
+
-1.3350188732147,
|
| 659 |
+
.91490334272385,
|
| 660 |
+
1.317883014679,
|
| 661 |
+
-.20600511133671,
|
| 662 |
+
1.1940457820892,
|
| 663 |
+
1.7408289909363,
|
| 664 |
+
.15753293037415,
|
| 665 |
+
3.4885265827179,
|
| 666 |
+
-3.8985877037048,
|
| 667 |
+
-3.9952800273895,
|
| 668 |
+
.87455189228058,
|
| 669 |
+
.56503582000732,
|
| 670 |
+
.78886848688126])
|
| 671 |
+
|
| 672 |
+
yr = np.array([
|
| 673 |
+
np.nan,
|
| 674 |
+
-.74963909387589,
|
| 675 |
+
-.49261617660522,
|
| 676 |
+
-.74115377664566,
|
| 677 |
+
-.46710711717606,
|
| 678 |
+
-.76478433609009,
|
| 679 |
+
-.41527000069618,
|
| 680 |
+
-.71501767635345,
|
| 681 |
+
-.65182709693909,
|
| 682 |
+
-.61157959699631,
|
| 683 |
+
-.6061926484108,
|
| 684 |
+
-.66979920864105,
|
| 685 |
+
-.47936165332794,
|
| 686 |
+
-.76660931110382,
|
| 687 |
+
-.44698792695999,
|
| 688 |
+
-.73818320035934,
|
| 689 |
+
-.56795823574066,
|
| 690 |
+
-.54832947254181,
|
| 691 |
+
-.62147504091263,
|
| 692 |
+
-.53765416145325,
|
| 693 |
+
-.68699151277542,
|
| 694 |
+
-.6210241317749,
|
| 695 |
+
-.57753163576126,
|
| 696 |
+
-.56617534160614,
|
| 697 |
+
-.59977388381958,
|
| 698 |
+
-.51360231637955,
|
| 699 |
+
-.65478450059891,
|
| 700 |
+
-.45503878593445,
|
| 701 |
+
-.35677161812782,
|
| 702 |
+
-.62034744024277,
|
| 703 |
+
-.2860988676548,
|
| 704 |
+
-.78207945823669,
|
| 705 |
+
-.40605875849724,
|
| 706 |
+
-.50848907232285,
|
| 707 |
+
-.39862787723541,
|
| 708 |
+
-.40978488326073,
|
| 709 |
+
-.43830442428589,
|
| 710 |
+
-.28789436817169,
|
| 711 |
+
-.39390674233437,
|
| 712 |
+
-.3916939496994,
|
| 713 |
+
-.16283383965492,
|
| 714 |
+
-.37939432263374,
|
| 715 |
+
-.25783684849739,
|
| 716 |
+
-.25009834766388,
|
| 717 |
+
-.20657606422901,
|
| 718 |
+
-.46508130431175,
|
| 719 |
+
-.22368888556957,
|
| 720 |
+
-.36846202611923,
|
| 721 |
+
-.55352002382278,
|
| 722 |
+
-.24047155678272,
|
| 723 |
+
-.52022665739059,
|
| 724 |
+
-.43184259533882,
|
| 725 |
+
-.46237435936928,
|
| 726 |
+
-.44929105043411,
|
| 727 |
+
-.35701966285706,
|
| 728 |
+
-.29036456346512,
|
| 729 |
+
.1857016980648,
|
| 730 |
+
-.50070303678513,
|
| 731 |
+
.69535458087921,
|
| 732 |
+
-.03758737072349,
|
| 733 |
+
.47266906499863,
|
| 734 |
+
.02192067168653,
|
| 735 |
+
.86232846975327,
|
| 736 |
+
-.04071394726634,
|
| 737 |
+
-.08351214230061,
|
| 738 |
+
.0033267585095,
|
| 739 |
+
.07322765141726,
|
| 740 |
+
-.13300403952599,
|
| 741 |
+
-.48713436722755,
|
| 742 |
+
.09396601468325,
|
| 743 |
+
-.01297946088016,
|
| 744 |
+
-.14862097799778,
|
| 745 |
+
.4691156744957,
|
| 746 |
+
-.34059509634972,
|
| 747 |
+
.073167309165,
|
| 748 |
+
.08025334775448,
|
| 749 |
+
.31655418872833,
|
| 750 |
+
.49839133024216,
|
| 751 |
+
.55144023895264,
|
| 752 |
+
.22826506197453,
|
| 753 |
+
1.1510490179062,
|
| 754 |
+
.9819718003273,
|
| 755 |
+
.9936757683754,
|
| 756 |
+
1.4495149850845,
|
| 757 |
+
1.4946271181107,
|
| 758 |
+
.18931329250336,
|
| 759 |
+
1.1880751848221,
|
| 760 |
+
1.0453312397003,
|
| 761 |
+
.68994289636612,
|
| 762 |
+
1.1540243625641,
|
| 763 |
+
.60858601331711,
|
| 764 |
+
-.17330189049244,
|
| 765 |
+
-.20550219714642,
|
| 766 |
+
1.611407160759,
|
| 767 |
+
-.92573761940002,
|
| 768 |
+
-.69089323282242,
|
| 769 |
+
.14731439948082,
|
| 770 |
+
.07909959554672,
|
| 771 |
+
.00589422974735,
|
| 772 |
+
.42116710543633,
|
| 773 |
+
.07460948079824,
|
| 774 |
+
-.09083105623722,
|
| 775 |
+
.06820363551378,
|
| 776 |
+
-.30858492851257,
|
| 777 |
+
.47263273596764,
|
| 778 |
+
-.39781630039215,
|
| 779 |
+
.05674355849624,
|
| 780 |
+
.41874802112579,
|
| 781 |
+
-2.2478415966034,
|
| 782 |
+
.76375144720078,
|
| 783 |
+
-.64229023456573,
|
| 784 |
+
.68622988462448,
|
| 785 |
+
-.06437320262194,
|
| 786 |
+
.39945095777512,
|
| 787 |
+
-.0559926815331,
|
| 788 |
+
.28482890129089,
|
| 789 |
+
.00020190737268,
|
| 790 |
+
.54639840126038,
|
| 791 |
+
.11374024301767,
|
| 792 |
+
.50034290552139,
|
| 793 |
+
.63931334018707,
|
| 794 |
+
.38197138905525,
|
| 795 |
+
-.27523550391197,
|
| 796 |
+
1.404825925827,
|
| 797 |
+
-.1979645639658,
|
| 798 |
+
.94665539264679,
|
| 799 |
+
1.4236577749252,
|
| 800 |
+
.02913599461317,
|
| 801 |
+
-.643210709095,
|
| 802 |
+
.53878688812256,
|
| 803 |
+
-.26304465532303,
|
| 804 |
+
.43178829550743,
|
| 805 |
+
-.13848400115967,
|
| 806 |
+
.39222705364227,
|
| 807 |
+
-.02460673451424,
|
| 808 |
+
.34627133607864,
|
| 809 |
+
-.19923311471939,
|
| 810 |
+
.00686796056107,
|
| 811 |
+
.03404098749161,
|
| 812 |
+
-.10386525094509,
|
| 813 |
+
-.09243924915791,
|
| 814 |
+
.41377285122871,
|
| 815 |
+
-.17664749920368,
|
| 816 |
+
.35733091831207,
|
| 817 |
+
.13202276825905,
|
| 818 |
+
-.05658006668091,
|
| 819 |
+
-.09336434304714,
|
| 820 |
+
.40078815817833,
|
| 821 |
+
.24042254686356,
|
| 822 |
+
-.02043732441962,
|
| 823 |
+
.217001542449,
|
| 824 |
+
.25683608651161,
|
| 825 |
+
-.56615537405014,
|
| 826 |
+
-.13936093449593,
|
| 827 |
+
.15434110164642,
|
| 828 |
+
-.41597774624825,
|
| 829 |
+
-.60332614183426,
|
| 830 |
+
.34161224961281,
|
| 831 |
+
-.40931203961372,
|
| 832 |
+
.11139994114637,
|
| 833 |
+
.15139718353748,
|
| 834 |
+
-.09771674126387,
|
| 835 |
+
.45419663190842,
|
| 836 |
+
.15193535387516,
|
| 837 |
+
.5985592007637,
|
| 838 |
+
.66923010349274,
|
| 839 |
+
.02294866926968,
|
| 840 |
+
.80127727985382,
|
| 841 |
+
-.46522265672684,
|
| 842 |
+
.33565619587898,
|
| 843 |
+
-.94310986995697,
|
| 844 |
+
-.34323886036873,
|
| 845 |
+
.67301613092422,
|
| 846 |
+
-.37864658236504,
|
| 847 |
+
.37210035324097,
|
| 848 |
+
.3631728887558,
|
| 849 |
+
-.47128081321716,
|
| 850 |
+
-.20438456535339,
|
| 851 |
+
.3103321492672,
|
| 852 |
+
.3909215927124,
|
| 853 |
+
.01124659087509,
|
| 854 |
+
.81024420261383,
|
| 855 |
+
.42646199464798,
|
| 856 |
+
-.01574708521366,
|
| 857 |
+
1.044772028923,
|
| 858 |
+
-.40038701891899,
|
| 859 |
+
3.768208026886,
|
| 860 |
+
-2.273681640625,
|
| 861 |
+
1.5517644882202,
|
| 862 |
+
.09178187698126,
|
| 863 |
+
-1.3350188732147,
|
| 864 |
+
.91490334272385,
|
| 865 |
+
1.317883014679,
|
| 866 |
+
-.20600511133671,
|
| 867 |
+
1.1940457820892,
|
| 868 |
+
1.7408289909363,
|
| 869 |
+
.15753293037415,
|
| 870 |
+
3.4885265827179,
|
| 871 |
+
-3.8985877037048,
|
| 872 |
+
-3.9952800273895,
|
| 873 |
+
.87455189228058,
|
| 874 |
+
.56503582000732,
|
| 875 |
+
.78886848688126])
|
| 876 |
+
|
| 877 |
+
mse = np.array([
|
| 878 |
+
1.8363103866577,
|
| 879 |
+
.82643759250641,
|
| 880 |
+
.69298559427261,
|
| 881 |
+
.67553198337555,
|
| 882 |
+
.67162227630615,
|
| 883 |
+
.67045229673386,
|
| 884 |
+
.66999220848083,
|
| 885 |
+
.66973727941513,
|
| 886 |
+
.66954612731934,
|
| 887 |
+
.66937738656998,
|
| 888 |
+
.66921871900558,
|
| 889 |
+
.66906636953354,
|
| 890 |
+
.66891890764236,
|
| 891 |
+
.66877597570419,
|
| 892 |
+
.66863715648651,
|
| 893 |
+
.66850233078003,
|
| 894 |
+
.66837131977081,
|
| 895 |
+
.66824388504028,
|
| 896 |
+
.6681199669838,
|
| 897 |
+
.66799944639206,
|
| 898 |
+
.6678820848465,
|
| 899 |
+
.66776782274246,
|
| 900 |
+
.66765648126602,
|
| 901 |
+
.66754806041718,
|
| 902 |
+
.66744232177734,
|
| 903 |
+
.66733926534653,
|
| 904 |
+
.66723877191544,
|
| 905 |
+
.66714072227478,
|
| 906 |
+
.66704499721527,
|
| 907 |
+
.66695153713226,
|
| 908 |
+
.66686034202576,
|
| 909 |
+
.66677123308182,
|
| 910 |
+
.66668421030045,
|
| 911 |
+
.66659909486771,
|
| 912 |
+
.66651594638824,
|
| 913 |
+
.66643464565277,
|
| 914 |
+
.66635513305664,
|
| 915 |
+
.66627734899521,
|
| 916 |
+
.66620123386383,
|
| 917 |
+
.66612672805786,
|
| 918 |
+
.6660538315773,
|
| 919 |
+
.66598242521286,
|
| 920 |
+
.66591250896454,
|
| 921 |
+
.66584402322769,
|
| 922 |
+
.66577690839767,
|
| 923 |
+
.66571110486984,
|
| 924 |
+
.66564667224884,
|
| 925 |
+
.66558349132538,
|
| 926 |
+
.66552156209946,
|
| 927 |
+
.66546076536179,
|
| 928 |
+
.66540116071701,
|
| 929 |
+
.66534268856049,
|
| 930 |
+
.66528534889221,
|
| 931 |
+
.6652290225029,
|
| 932 |
+
.66517376899719,
|
| 933 |
+
.6651194691658,
|
| 934 |
+
.66506624221802,
|
| 935 |
+
.6650139093399,
|
| 936 |
+
.66496247053146,
|
| 937 |
+
.66491198539734,
|
| 938 |
+
.66486239433289,
|
| 939 |
+
.66481363773346,
|
| 940 |
+
.6647657752037,
|
| 941 |
+
.66471868753433,
|
| 942 |
+
.66467237472534,
|
| 943 |
+
.66462683677673,
|
| 944 |
+
.66458207368851,
|
| 945 |
+
.66453808546066,
|
| 946 |
+
.66449475288391,
|
| 947 |
+
.6644521355629,
|
| 948 |
+
.66441023349762,
|
| 949 |
+
.66436898708344,
|
| 950 |
+
.66432839632034,
|
| 951 |
+
.66428846120834,
|
| 952 |
+
.66424912214279,
|
| 953 |
+
.66421037912369,
|
| 954 |
+
.66417229175568,
|
| 955 |
+
.66413474082947,
|
| 956 |
+
.66409778594971,
|
| 957 |
+
.66406136751175,
|
| 958 |
+
.66402548551559,
|
| 959 |
+
.66399013996124,
|
| 960 |
+
.66395533084869,
|
| 961 |
+
.6639209985733,
|
| 962 |
+
.66388720273972,
|
| 963 |
+
.66385388374329,
|
| 964 |
+
.66382104158401,
|
| 965 |
+
.66378861665726,
|
| 966 |
+
.6637567281723,
|
| 967 |
+
.66372525691986,
|
| 968 |
+
.66369420289993,
|
| 969 |
+
.66366362571716,
|
| 970 |
+
.66363340616226,
|
| 971 |
+
.66360366344452,
|
| 972 |
+
.66357427835464,
|
| 973 |
+
.66354531049728,
|
| 974 |
+
.66351670026779,
|
| 975 |
+
.66348850727081,
|
| 976 |
+
.6634606719017,
|
| 977 |
+
.66343319416046,
|
| 978 |
+
.66340607404709,
|
| 979 |
+
.66337931156158,
|
| 980 |
+
.66335290670395,
|
| 981 |
+
.66332685947418,
|
| 982 |
+
.66330111026764,
|
| 983 |
+
.66327565908432,
|
| 984 |
+
.66325056552887,
|
| 985 |
+
.66322582960129,
|
| 986 |
+
.66320133209229,
|
| 987 |
+
.66317713260651,
|
| 988 |
+
.6631532907486,
|
| 989 |
+
.66312968730927,
|
| 990 |
+
.66310638189316,
|
| 991 |
+
.66308337450027,
|
| 992 |
+
.66306066513062,
|
| 993 |
+
.66303819417953,
|
| 994 |
+
.66301596164703,
|
| 995 |
+
.66299402713776,
|
| 996 |
+
.6629723906517,
|
| 997 |
+
.66295093297958,
|
| 998 |
+
.66292977333069,
|
| 999 |
+
.66290885210037,
|
| 1000 |
+
.66288816928864,
|
| 1001 |
+
.66286766529083,
|
| 1002 |
+
.66284745931625,
|
| 1003 |
+
.66282749176025,
|
| 1004 |
+
.66280770301819,
|
| 1005 |
+
.6627881526947,
|
| 1006 |
+
.66276878118515,
|
| 1007 |
+
.66274970769882,
|
| 1008 |
+
.66273081302643,
|
| 1009 |
+
.66271209716797,
|
| 1010 |
+
.66269356012344,
|
| 1011 |
+
.6626752614975,
|
| 1012 |
+
.66265720129013,
|
| 1013 |
+
.66263926029205,
|
| 1014 |
+
.66262155771255,
|
| 1015 |
+
.66260403394699,
|
| 1016 |
+
.66258668899536,
|
| 1017 |
+
.66256952285767,
|
| 1018 |
+
.66255259513855,
|
| 1019 |
+
.66253578662872,
|
| 1020 |
+
.66251915693283,
|
| 1021 |
+
.66250270605087,
|
| 1022 |
+
.6624863743782,
|
| 1023 |
+
.66247028112411,
|
| 1024 |
+
.66245430707932,
|
| 1025 |
+
.66243851184845,
|
| 1026 |
+
.66242289543152,
|
| 1027 |
+
.66240739822388,
|
| 1028 |
+
.66239207983017,
|
| 1029 |
+
.6623769402504,
|
| 1030 |
+
.66236186027527,
|
| 1031 |
+
.66234701871872,
|
| 1032 |
+
.66233229637146,
|
| 1033 |
+
.66231769323349,
|
| 1034 |
+
.66230326890945,
|
| 1035 |
+
.66228896379471,
|
| 1036 |
+
.66227477788925,
|
| 1037 |
+
.66226077079773,
|
| 1038 |
+
.6622468829155,
|
| 1039 |
+
.66223311424255,
|
| 1040 |
+
.6622194647789,
|
| 1041 |
+
.66220593452454,
|
| 1042 |
+
.66219258308411,
|
| 1043 |
+
.66217935085297,
|
| 1044 |
+
.66216617822647,
|
| 1045 |
+
.66215318441391,
|
| 1046 |
+
.66214030981064,
|
| 1047 |
+
.66212749481201,
|
| 1048 |
+
.66211485862732,
|
| 1049 |
+
.66210234165192,
|
| 1050 |
+
.66208988428116,
|
| 1051 |
+
.66207760572433,
|
| 1052 |
+
.66206538677216,
|
| 1053 |
+
.66205328702927,
|
| 1054 |
+
.66204130649567,
|
| 1055 |
+
.66202944517136,
|
| 1056 |
+
.66201764345169,
|
| 1057 |
+
.66200596094131,
|
| 1058 |
+
.66199439764023,
|
| 1059 |
+
.66198295354843,
|
| 1060 |
+
.66197156906128,
|
| 1061 |
+
.66196030378342,
|
| 1062 |
+
.66194915771484,
|
| 1063 |
+
.66193807125092,
|
| 1064 |
+
.66192710399628,
|
| 1065 |
+
.66191619634628,
|
| 1066 |
+
.66190540790558,
|
| 1067 |
+
.66189467906952,
|
| 1068 |
+
.66188406944275,
|
| 1069 |
+
.66187357902527,
|
| 1070 |
+
.66186314821243,
|
| 1071 |
+
.66185277700424,
|
| 1072 |
+
.66184252500534,
|
| 1073 |
+
.66183233261108,
|
| 1074 |
+
.66182225942612,
|
| 1075 |
+
.66181224584579,
|
| 1076 |
+
.66180229187012,
|
| 1077 |
+
.66179245710373,
|
| 1078 |
+
.66178268194199,
|
| 1079 |
+
.66177302598953,
|
| 1080 |
+
.66176337003708])
|
| 1081 |
+
|
| 1082 |
+
stdp = np.array([
|
| 1083 |
+
.91963917016983,
|
| 1084 |
+
.91963917016983,
|
| 1085 |
+
.69261693954468,
|
| 1086 |
+
.76115423440933,
|
| 1087 |
+
.63710719347,
|
| 1088 |
+
.77478265762329,
|
| 1089 |
+
.61527073383331,
|
| 1090 |
+
.80501782894135,
|
| 1091 |
+
.62182641029358,
|
| 1092 |
+
.72158020734787,
|
| 1093 |
+
.66619211435318,
|
| 1094 |
+
.72980058193207,
|
| 1095 |
+
.64935982227325,
|
| 1096 |
+
.77660953998566,
|
| 1097 |
+
.6069877743721,
|
| 1098 |
+
.79818457365036,
|
| 1099 |
+
.60795724391937,
|
| 1100 |
+
.7583304643631,
|
| 1101 |
+
.68147450685501,
|
| 1102 |
+
.72765469551086,
|
| 1103 |
+
.69699174165726,
|
| 1104 |
+
.69102382659912,
|
| 1105 |
+
.67753201723099,
|
| 1106 |
+
.72617518901825,
|
| 1107 |
+
.69977235794067,
|
| 1108 |
+
.713603079319,
|
| 1109 |
+
.72478419542313,
|
| 1110 |
+
.68503832817078,
|
| 1111 |
+
.75677126646042,
|
| 1112 |
+
.79034942388535,
|
| 1113 |
+
.68609654903412,
|
| 1114 |
+
.83208250999451,
|
| 1115 |
+
.60605573654175,
|
| 1116 |
+
.80849212408066,
|
| 1117 |
+
.69862711429596,
|
| 1118 |
+
.80978256464005,
|
| 1119 |
+
.7383074760437,
|
| 1120 |
+
.78789436817169,
|
| 1121 |
+
.79390448331833,
|
| 1122 |
+
.79169547557831,
|
| 1123 |
+
.76283228397369,
|
| 1124 |
+
.87939429283142,
|
| 1125 |
+
.75783687829971,
|
| 1126 |
+
.85010063648224,
|
| 1127 |
+
.80657452344894,
|
| 1128 |
+
.86508285999298,
|
| 1129 |
+
.72368890047073,
|
| 1130 |
+
.86846202611923,
|
| 1131 |
+
.75351697206497,
|
| 1132 |
+
.74047154188156,
|
| 1133 |
+
.82022970914841,
|
| 1134 |
+
.73184186220169,
|
| 1135 |
+
.7623735666275,
|
| 1136 |
+
.74929028749466,
|
| 1137 |
+
.75702118873596,
|
| 1138 |
+
.79036456346512,
|
| 1139 |
+
.81429827213287,
|
| 1140 |
+
1.0007030963898,
|
| 1141 |
+
.70464313030243,
|
| 1142 |
+
1.2375881671906,
|
| 1143 |
+
.82733017206192,
|
| 1144 |
+
1.1780800819397,
|
| 1145 |
+
.83767229318619,
|
| 1146 |
+
1.3407131433487,
|
| 1147 |
+
.7835128903389,
|
| 1148 |
+
.99667322635651,
|
| 1149 |
+
.82677388191223,
|
| 1150 |
+
1.0330017805099,
|
| 1151 |
+
.78713357448578,
|
| 1152 |
+
.80603551864624,
|
| 1153 |
+
.91298097372055,
|
| 1154 |
+
.94862020015717,
|
| 1155 |
+
.83088356256485,
|
| 1156 |
+
1.1405943632126,
|
| 1157 |
+
.72683191299438,
|
| 1158 |
+
1.0197489261627,
|
| 1159 |
+
.88344657421112,
|
| 1160 |
+
1.1016070842743,
|
| 1161 |
+
1.0485582351685,
|
| 1162 |
+
1.1717364788055,
|
| 1163 |
+
.94894939661026,
|
| 1164 |
+
1.418029665947,
|
| 1165 |
+
1.2063212394714,
|
| 1166 |
+
1.3504880666733,
|
| 1167 |
+
1.4053744077682,
|
| 1168 |
+
1.5106836557388,
|
| 1169 |
+
.91192328929901,
|
| 1170 |
+
1.4546687602997,
|
| 1171 |
+
1.2100585699081,
|
| 1172 |
+
1.2459771633148,
|
| 1173 |
+
1.2914154529572,
|
| 1174 |
+
1.1733019351959,
|
| 1175 |
+
.80550068616867,
|
| 1176 |
+
.88859277963638,
|
| 1177 |
+
1.5257360935211,
|
| 1178 |
+
.49089628458023,
|
| 1179 |
+
.75268715620041,
|
| 1180 |
+
.92090040445328,
|
| 1181 |
+
.99410575628281,
|
| 1182 |
+
.87882828712463,
|
| 1183 |
+
1.1253950595856,
|
| 1184 |
+
.89082646369934,
|
| 1185 |
+
.9317963719368,
|
| 1186 |
+
.90858340263367,
|
| 1187 |
+
.82737028598785,
|
| 1188 |
+
1.0978132486343,
|
| 1189 |
+
.74325948953629,
|
| 1190 |
+
.98125350475311,
|
| 1191 |
+
1.0478370189667,
|
| 1192 |
+
.03625157848001,
|
| 1193 |
+
1.3422871828079,
|
| 1194 |
+
.51377469301224,
|
| 1195 |
+
1.3643686771393,
|
| 1196 |
+
.70055514574051,
|
| 1197 |
+
1.2559896707535,
|
| 1198 |
+
.71517109870911,
|
| 1199 |
+
1.1997950077057,
|
| 1200 |
+
.75360465049744,
|
| 1201 |
+
1.2862613201141,
|
| 1202 |
+
.79965251684189,
|
| 1203 |
+
1.2606881856918,
|
| 1204 |
+
1.018030166626,
|
| 1205 |
+
1.1752370595932,
|
| 1206 |
+
.69517260789871,
|
| 1207 |
+
1.597958445549,
|
| 1208 |
+
.65335071086884,
|
| 1209 |
+
1.4763361215591,
|
| 1210 |
+
1.2708671092987,
|
| 1211 |
+
1.0432199239731,
|
| 1212 |
+
.561203956604,
|
| 1213 |
+
1.2630445957184,
|
| 1214 |
+
.66821777820587,
|
| 1215 |
+
1.2384748458862,
|
| 1216 |
+
.70777904987335,
|
| 1217 |
+
1.2246036529541,
|
| 1218 |
+
.75373476743698,
|
| 1219 |
+
1.199233174324,
|
| 1220 |
+
.69312900304794,
|
| 1221 |
+
1.0659650564194,
|
| 1222 |
+
.80386221408844,
|
| 1223 |
+
.99243313074112,
|
| 1224 |
+
.78622406721115,
|
| 1225 |
+
1.1766475439072,
|
| 1226 |
+
.74267518520355,
|
| 1227 |
+
1.1679803133011,
|
| 1228 |
+
.85658311843872,
|
| 1229 |
+
.99335825443268,
|
| 1230 |
+
.79920876026154,
|
| 1231 |
+
1.1595865488052,
|
| 1232 |
+
.92043119668961,
|
| 1233 |
+
.98299539089203,
|
| 1234 |
+
.94316083192825,
|
| 1235 |
+
1.0661553144455,
|
| 1236 |
+
.6393609046936,
|
| 1237 |
+
.9456650018692,
|
| 1238 |
+
.91597771644592,
|
| 1239 |
+
.80332309007645,
|
| 1240 |
+
.65838772058487,
|
| 1241 |
+
1.1093089580536,
|
| 1242 |
+
.68860310316086,
|
| 1243 |
+
1.0485997200012,
|
| 1244 |
+
.89771980047226,
|
| 1245 |
+
.94581252336502,
|
| 1246 |
+
1.0480616092682,
|
| 1247 |
+
1.0014315843582,
|
| 1248 |
+
1.1307729482651,
|
| 1249 |
+
1.1770483255386,
|
| 1250 |
+
.89873492717743,
|
| 1251 |
+
1.2652103900909,
|
| 1252 |
+
.66434383392334,
|
| 1253 |
+
1.1431220769882,
|
| 1254 |
+
.44322970509529,
|
| 1255 |
+
.9269899725914,
|
| 1256 |
+
1.0786435604095,
|
| 1257 |
+
.82789659500122,
|
| 1258 |
+
1.0368362665176,
|
| 1259 |
+
1.0712716579437,
|
| 1260 |
+
.70438456535339,
|
| 1261 |
+
.88966482877731,
|
| 1262 |
+
1.009087562561,
|
| 1263 |
+
1.0887442827225,
|
| 1264 |
+
.88976800441742,
|
| 1265 |
+
1.2735350131989,
|
| 1266 |
+
1.0157470703125,
|
| 1267 |
+
.95522791147232,
|
| 1268 |
+
1.3003809452057,
|
| 1269 |
+
.73179203271866,
|
| 1270 |
+
2.4736785888672,
|
| 1271 |
+
-.25176140666008,
|
| 1272 |
+
1.9082181453705,
|
| 1273 |
+
.53501582145691,
|
| 1274 |
+
.7591078877449,
|
| 1275 |
+
1.0281100273132,
|
| 1276 |
+
1.6240043640137,
|
| 1277 |
+
.60095232725143,
|
| 1278 |
+
1.6211705207825,
|
| 1279 |
+
1.344465970993,
|
| 1280 |
+
1.124480009079,
|
| 1281 |
+
2.1775946617126,
|
| 1282 |
+
-.71973150968552,
|
| 1283 |
+
-.37754261493683,
|
| 1284 |
+
1.2329530715942,
|
| 1285 |
+
1.127131819725])
|
| 1286 |
+
|
| 1287 |
+
icstats = np.array([
|
| 1288 |
+
202,
|
| 1289 |
+
np.nan,
|
| 1290 |
+
-244.3852892951,
|
| 1291 |
+
5,
|
| 1292 |
+
498.7705785902,
|
| 1293 |
+
515.31191707721])
|
| 1294 |
+
|
| 1295 |
+
|
| 1296 |
+
results = Bunch(
|
| 1297 |
+
llf=llf,
|
| 1298 |
+
nobs=nobs,
|
| 1299 |
+
k=k,
|
| 1300 |
+
k_exog=k_exog,
|
| 1301 |
+
sigma=sigma,
|
| 1302 |
+
chi2=chi2,
|
| 1303 |
+
df_model=df_model,
|
| 1304 |
+
k_ar=k_ar,
|
| 1305 |
+
k_ma=k_ma,
|
| 1306 |
+
params=params,
|
| 1307 |
+
cov_params=cov_params,
|
| 1308 |
+
xb=xb,
|
| 1309 |
+
y=y,
|
| 1310 |
+
resid=resid,
|
| 1311 |
+
yr=yr,
|
| 1312 |
+
mse=mse,
|
| 1313 |
+
stdp=stdp,
|
| 1314 |
+
icstats=icstats
|
| 1315 |
+
)
|
shared/package-files/0c/0c0df17bfece897a1da7765c822453b09866573028cecced13e2efee02bcccc4/gb12345.enc
ADDED
|
@@ -0,0 +1,1414 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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+
0000000000000000000000000000000000000000000000000000000000000000
|
| 6 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 7 |
+
000030003001300230FB02C902C700A8300330052015FF5E2225202620182019
|
| 8 |
+
201C201D3014301530083009300A300B300C300D300E300F3016301730103011
|
| 9 |
+
00B100D700F72236222722282211220F222A222922082237221A22A522252220
|
| 10 |
+
23122299222B222E2261224C2248223D221D2260226E226F22642265221E2235
|
| 11 |
+
22342642264000B0203220332103FF0400A4FFE0FFE1203000A7211626062605
|
| 12 |
+
25CB25CF25CE25C725C625A125A025B325B2203B219221902191219330130000
|
| 13 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 14 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 15 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 16 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 17 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 18 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 19 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 20 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 21 |
+
22
|
| 22 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 23 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 24 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 25 |
+
000024882489248A248B248C248D248E248F2490249124922493249424952496
|
| 26 |
+
249724982499249A249B247424752476247724782479247A247B247C247D247E
|
| 27 |
+
247F248024812482248324842485248624872460246124622463246424652466
|
| 28 |
+
2467246824690000000032203221322232233224322532263227322832290000
|
| 29 |
+
00002160216121622163216421652166216721682169216A216B000000000000
|
| 30 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 31 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 32 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 33 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 34 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 35 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 36 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 37 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 38 |
+
23
|
| 39 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 40 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 41 |
+
0000FF01FF02FF03FFE5FF05FF06FF07FF08FF09FF0AFF0BFF0CFF0DFF0EFF0F
|
| 42 |
+
FF10FF11FF12FF13FF14FF15FF16FF17FF18FF19FF1AFF1BFF1CFF1DFF1EFF1F
|
| 43 |
+
FF20FF21FF22FF23FF24FF25FF26FF27FF28FF29FF2AFF2BFF2CFF2DFF2EFF2F
|
| 44 |
+
FF30FF31FF32FF33FF34FF35FF36FF37FF38FF39FF3AFF3BFF3CFF3DFF3EFF3F
|
| 45 |
+
FF40FF41FF42FF43FF44FF45FF46FF47FF48FF49FF4AFF4BFF4CFF4DFF4EFF4F
|
| 46 |
+
FF50FF51FF52FF53FF54FF55FF56FF57FF58FF59FF5AFF5BFF5CFF5DFFE30000
|
| 47 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 48 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 49 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 50 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 51 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 52 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 53 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 54 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 55 |
+
24
|
| 56 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 57 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 58 |
+
0000304130423043304430453046304730483049304A304B304C304D304E304F
|
| 59 |
+
3050305130523053305430553056305730583059305A305B305C305D305E305F
|
| 60 |
+
3060306130623063306430653066306730683069306A306B306C306D306E306F
|
| 61 |
+
3070307130723073307430753076307730783079307A307B307C307D307E307F
|
| 62 |
+
3080308130823083308430853086308730883089308A308B308C308D308E308F
|
| 63 |
+
3090309130923093000000000000000000000000000000000000000000000000
|
| 64 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 65 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 66 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 67 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 68 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 69 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 70 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 71 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 72 |
+
25
|
| 73 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 74 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 75 |
+
000030A130A230A330A430A530A630A730A830A930AA30AB30AC30AD30AE30AF
|
| 76 |
+
30B030B130B230B330B430B530B630B730B830B930BA30BB30BC30BD30BE30BF
|
| 77 |
+
30C030C130C230C330C430C530C630C730C830C930CA30CB30CC30CD30CE30CF
|
| 78 |
+
30D030D130D230D330D430D530D630D730D830D930DA30DB30DC30DD30DE30DF
|
| 79 |
+
30E030E130E230E330E430E530E630E730E830E930EA30EB30EC30ED30EE30EF
|
| 80 |
+
30F030F130F230F330F430F530F6000000000000000000000000000000000000
|
| 81 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 82 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 83 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 84 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 85 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 86 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 87 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 88 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 89 |
+
26
|
| 90 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 91 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 92 |
+
0000039103920393039403950396039703980399039A039B039C039D039E039F
|
| 93 |
+
03A003A103A303A403A503A603A703A803A90000000000000000000000000000
|
| 94 |
+
000003B103B203B303B403B503B603B703B803B903BA03BB03BC03BD03BE03BF
|
| 95 |
+
03C003C103C303C403C503C603C703C803C90000000000000000000000000000
|
| 96 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 97 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 98 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 99 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 100 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 101 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 102 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 103 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 104 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 105 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 106 |
+
27
|
| 107 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 108 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 109 |
+
000004100411041204130414041504010416041704180419041A041B041C041D
|
| 110 |
+
041E041F0420042104220423042404250426042704280429042A042B042C042D
|
| 111 |
+
042E042F00000000000000000000000000000000000000000000000000000000
|
| 112 |
+
000004300431043204330434043504510436043704380439043A043B043C043D
|
| 113 |
+
043E043F0440044104420443044404450446044704480449044A044B044C044D
|
| 114 |
+
044E044F00000000000000000000000000000000000000000000000000000000
|
| 115 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 116 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 117 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 118 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 119 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 120 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 121 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 122 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 123 |
+
28
|
| 124 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 125 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 126 |
+
0000010100E101CE00E0011300E9011B00E8012B00ED01D000EC014D00F301D2
|
| 127 |
+
00F2016B00FA01D400F901D601D801DA01DC00FC00EA00000000000000000000
|
| 128 |
+
0000000000000000000031053106310731083109310A310B310C310D310E310F
|
| 129 |
+
3110311131123113311431153116311731183119311A311B311C311D311E311F
|
| 130 |
+
3120312131223123312431253126312731283129000000000000000000000000
|
| 131 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 132 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 133 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 134 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 135 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 136 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 137 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 138 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 139 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 140 |
+
29
|
| 141 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 142 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 143 |
+
00000000000000002500250125022503250425052506250725082509250A250B
|
| 144 |
+
250C250D250E250F2510251125122513251425152516251725182519251A251B
|
| 145 |
+
251C251D251E251F2520252125222523252425252526252725282529252A252B
|
| 146 |
+
252C252D252E252F2530253125322533253425352536253725382539253A253B
|
| 147 |
+
253C253D253E253F2540254125422543254425452546254725482549254A254B
|
| 148 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 149 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 150 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 151 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 152 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 153 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 154 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 155 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 156 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 157 |
+
30
|
| 158 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 159 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 160 |
+
0000554A963F57C3632854CE550954C0769A764C85F977EE827E7919611B9698
|
| 161 |
+
978D6C285B894FFA630966975CB880FA68489AAF660276CE51F9655671AC7FF1
|
| 162 |
+
895650B2596561CA6FB382AD634C625253ED54277B06516B75A45DF462D48DCB
|
| 163 |
+
9776628A801958E997387F777238767D67CF767E64FA4F70655762DC7A176591
|
| 164 |
+
73ED642C6273822C9812677F7248626E62CC4F3474E3534A8FA67D4690A65E6B
|
| 165 |
+
6886699C81807D8168D278C5868C938A508D8B1782DE80DE5305891252650000
|
| 166 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 167 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 168 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 169 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 170 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 171 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 172 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 173 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 174 |
+
31
|
| 175 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 176 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 177 |
+
0000858496F94FDD582198FD5BF662B1583166B48C799B917206676F789160B2
|
| 178 |
+
535153178F2980CC8C9D92C7500D72FD5099618A711988AB595482EF672C7B28
|
| 179 |
+
5D297DB3752D6CF58E668FF8903C9F3B6BD491197B465F7C78A784D6853D7562
|
| 180 |
+
65836BD65E635E8775F99589655D5F0A5FC58F9F58C181C2907F965B97AD908A
|
| 181 |
+
7DE88CB662414FBF8B8A535E8FA88FAF8FAE904D6A195F6A819888689C49618B
|
| 182 |
+
522B765F5F6C658C70156FF18CD364EF517551B067C44E1979C9990570B30000
|
| 183 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 184 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 185 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 186 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 187 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 188 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 189 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 190 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 191 |
+
32
|
| 192 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 193 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 194 |
+
000075C55E7673BB83E064AD64A592626CE2535A52C3640F92517B944F2F5E1B
|
| 195 |
+
82368116818A6E246CCA99C16355535C54FA88DC57E04E0D5E036B657C3F90E8
|
| 196 |
+
601664E6731C88C16750624D8CA1776C8E2991C75F6983DC8521991053C38836
|
| 197 |
+
6B98615A615871E684BC825950096EC485CF64CD7CD969FD66F9834953A07B56
|
| 198 |
+
5074518C6E2C5C648E6D63D253C9832C833667E578B4643D5BDF5C945DEE8A6B
|
| 199 |
+
62C667F48C7A6519647B87EC995E8B927E8F93DF752395E1986B660C73160000
|
| 200 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 201 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 202 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 203 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 204 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 205 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 206 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 207 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 208 |
+
33
|
| 209 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 210 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 211 |
+
0000583456175E389577511F81785EE0655E66A2553150218D8562849214671D
|
| 212 |
+
56326F6E5DE2543570928ECA626F64A463A35FB96F8890F481E38FB058756668
|
| 213 |
+
5FF16C8996738D81896F64917A3157CE6A59621054484E587A0B61F26F848AA0
|
| 214 |
+
627F901E9A0179E4540375F4630153196C6090725F1B99B3803B9F524F885C3A
|
| 215 |
+
8D647FC565A571BE5145885D87F25D075BF562BD916C75878E8A7A2061017C4C
|
| 216 |
+
4EC77DA27785919C81ED521D51FA6A7153A88E8792E496DB6EC19664695A0000
|
| 217 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 218 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 219 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 220 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 221 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 222 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 223 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 224 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 225 |
+
34
|
| 226 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 227 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 228 |
+
0000790E513277D7641089F8865563E35DDD7A7F693D50B3823955984E327621
|
| 229 |
+
7A975E625E8A95D652755439708A6376931857826625693F918755076DF37D14
|
| 230 |
+
882262337DBD75B5832878C196CC8FAD614874F78A5E6B64523A8CDC6B218070
|
| 231 |
+
847156F153065F9E53E251D17C97918B7C074FC38EA57BE17AC464675D1450AC
|
| 232 |
+
810676017CB96DEC7FE067515B585BF878CB64AE641363AA632B932F642D9054
|
| 233 |
+
7B5476296253592754466B7950A362345E366B864EE38CB8888B5F85902E0000
|
| 234 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 235 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 236 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 237 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 238 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 239 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 240 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 241 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 242 |
+
35
|
| 243 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 244 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 245 |
+
00006020803D64D44E3955AE913264A381BD65E66C2E4F46619A6DE18A955F48
|
| 246 |
+
86CB757664CB9EE885696A94520064178E4850125CF679B15C0E52307A3B60BC
|
| 247 |
+
905376D75FB75F9776848E6C71C8767B7B4977AA51F3912758244F4E6EF48FEA
|
| 248 |
+
65757B1B72C46ECC7FDF5AE162B55E95573084827B2C5E1D5F1F905E7DE0985B
|
| 249 |
+
63826EC778989EDE5178975B588A96FB4F4375385E9760E659606FB16BBF7889
|
| 250 |
+
53FC96D551CB52016389540A91E38ABF8DCC7239789F87768FED8ADC758A0000
|
| 251 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 252 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 253 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 254 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 255 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 256 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 257 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 258 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 259 |
+
36
|
| 260 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 261 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 262 |
+
00004E0176EF53EE91D898029F0E93205B9A8A024E22677151AC846361C252D5
|
| 263 |
+
68DF4F97606B51CD6D1E515C62969B2596618C46901775D890FD77636BD272A2
|
| 264 |
+
73688B80583577798CED675C934D809A5EA66E2159927AEF77ED935B6BB565B7
|
| 265 |
+
7DDE58065151968A5C0D58A956788E726566981356E4920D76FE9041638754C6
|
| 266 |
+
591A596A579B8EB267358DFA8235524160F058AE86FE5CE89D5D4FC4984D8A1B
|
| 267 |
+
5A2560E15384627C904F910299136069800C51528033723E990C6D314E8C0000
|
| 268 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 269 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 270 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 271 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 272 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 273 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 274 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 275 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 276 |
+
37
|
| 277 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 278 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 279 |
+
00008CB3767C7F707B4F4F104E4F95A56CD573D085E95E06756A7FFB6A0A792C
|
| 280 |
+
91E97E4151E1716953CD8FD47BC48CA972AF98EF6CDB574A82B365B980AA623F
|
| 281 |
+
963259A84EFF8A2A7D21653E83F2975E556198DB80A5532A8AB9542080BA5EE2
|
| 282 |
+
6CB88CBB82AC915A54296C1B52067D1B58B3711A6C7E7C89596E4EFD5FFF61A4
|
| 283 |
+
7CDE8C505C01695387025CF092D298A8760B70FD902299AE7E2B8AF759499CF3
|
| 284 |
+
4F5B5426592B6577819A5B75627662C28F3B5E456C1F7B264F0F4FD8670D0000
|
| 285 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 286 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 287 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 288 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 289 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 290 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 291 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 292 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 293 |
+
38
|
| 294 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 295 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 296 |
+
00006D6E6DAA798F88B15F17752B64AB8F144FEF91DC65A7812F81515E9C8150
|
| 297 |
+
8D74526F89868CE65FA950854ED8961C723681798CA05BCC8A0396445A667E1B
|
| 298 |
+
54905676560E8A7265396982922384CB6E895E797518674667D17AFF809D8D95
|
| 299 |
+
611F79C665628D1B5CA1525B92FC7F38809B7DB15D176E2F67607BD9768B9AD8
|
| 300 |
+
818F7F947CD5641E93AC7A3F544A54E56B4C64F162089D3F80F3759952729769
|
| 301 |
+
845B683C86E495A39694927B500B54047D6668398DDF801566F45E9A7FB90000
|
| 302 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 303 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 304 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 305 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 306 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 307 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 308 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 309 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 310 |
+
39
|
| 311 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 312 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 313 |
+
000057C2803F68975DE5653B529F606D9F944F9B8EAC516C5BAB5F13978F6C5E
|
| 314 |
+
62F18CA25171920E52FE6E9D82DF72D757A269CB8CFC591F8F9C83C754957B8D
|
| 315 |
+
4F306CBD5B6459D19F1353E488319AA88C3780A16545986756FA96C7522E74DC
|
| 316 |
+
526E5BE1630289024E5662D0602A68FA95DC5B9851A089C07BA199287F506163
|
| 317 |
+
704C8CAB51495EE3901B7470898F572D78456B789F9C95A88ECC9B3C8A6D7678
|
| 318 |
+
68426AC38DEA8CB4528A8F256EDA68CD934B90ED570B679C88F9904E54C80000
|
| 319 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 320 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 321 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 322 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 323 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 324 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 325 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 326 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 327 |
+
3A
|
| 328 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 329 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 330 |
+
00009AB85B696D776C264EA55BB399ED916361A890AF97D3542B6DB55BD251FD
|
| 331 |
+
558A7F557FF064BC634D65F161BE608D710A6C576F22592F676D822A58D5568E
|
| 332 |
+
8C6A6BEB90DD597D8017865F6D695475559D837783CF683879BE548C4F555408
|
| 333 |
+
76D28C8995A16CB36DB88D6B89109DB48CC0563F9ED175D55F8872E0606854FC
|
| 334 |
+
4EA86A2A886160528F5F54C470D886799D3B6D2A5B8F5F187D0555894FAF7334
|
| 335 |
+
543C539A50195F8C547C4E4E5FFD745A58FA846B80E1877472D07CCA6E560000
|
| 336 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 337 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 338 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 339 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 340 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 341 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 342 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 343 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 344 |
+
3B
|
| 345 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 346 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 347 |
+
00005F27864E552C8B774E926EEC623782B1562983EF733E6ED1756B52835316
|
| 348 |
+
8A7169D05F8A61F76DEE58DE6B6174B0685390847DE963DB60A3559A76138C62
|
| 349 |
+
71656E195BA65E7B8352614C9EC478FA87577C27768751F060F6714C66435E4C
|
| 350 |
+
604D8B0A707063EE8F1D5FBD606286D456DE6BC160946167534960E066668CC4
|
| 351 |
+
7A62670371F4532F8AF18AA87E6A8477660F5A5A9B426E3E6DF78C416D3B4F19
|
| 352 |
+
706B7372621660D1970D8CA8798D64CA573E57FA6A5F75787A3D7A4D7B950000
|
| 353 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 354 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 355 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 356 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 357 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 358 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 359 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 360 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 361 |
+
3C
|
| 362 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 363 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 364 |
+
0000808C99518FF96FC08B4F9DC459EC7E3E7DDD5409697568D88F2F7C4D96C6
|
| 365 |
+
53CA602575BE6C7253735AC97D1A64E05E7E810A5DF1858A628051805B634F0E
|
| 366 |
+
796D529160B86FDF5BC45BC28A088A1865E25FCC969B59937E7C7D00560967B7
|
| 367 |
+
593E4F735BB652A083A298308CC87532924050477A3C50F967B699D55AC16BB2
|
| 368 |
+
76E358055C167B8B9593714E517C80A9827159787DD87E6D6AA267EC78B19E7C
|
| 369 |
+
63C064BF7C215109526A51CF85A66ABB94528E108CE4898B93757BAD4EF60000
|
| 370 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 371 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 372 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 373 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 374 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 375 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 376 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 377 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 378 |
+
3D
|
| 379 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 380 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 381 |
+
000050658266528D991E6F386FFA6F975EFA50F559DC5C076F3F6C5F75868523
|
| 382 |
+
69F3596C8B1B532091AC964D854969127901712681A04EA490CA6F869A555B0C
|
| 383 |
+
56BC652A927877EF50E5811A72E189D299037E737D5E527F655991758F4E8F03
|
| 384 |
+
53EB7A9663ED63A5768679F88857968E622A52AB7BC0685467706377776B7AED
|
| 385 |
+
6F547D5089E359D0621285C982A5754C501F4ECB75A58AA15C4A5DFE7B4B65A4
|
| 386 |
+
91D14ECA6D25895F7DCA932650C58B3990329773664979818FD171FC6D780000
|
| 387 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 388 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 389 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 390 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 391 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 392 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 393 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 394 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 395 |
+
3E
|
| 396 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 397 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 398 |
+
000076E152C1834651628396775B66769BE84EAC9A5A7CBE7CB37D934E958B66
|
| 399 |
+
666F9838975C5883656C93E15F9175D997567ADF7AF651C870AF7A9863EA7A76
|
| 400 |
+
7CFE739697ED4E4570784E5D915253A96551820A81FC8205548E5C31759A97A0
|
| 401 |
+
62D872D975BD5C4599D283CA5C40548077E982096CAE805A62D264DA5DE85177
|
| 402 |
+
8DDD8E1E92F84FF153E561FC70AC528763509D515A1F5026773753777D796485
|
| 403 |
+
652B628963985014723589BA51B38A237D76574783CC921E8ECD541B5CFB0000
|
| 404 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 405 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 406 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 407 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 408 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 409 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 410 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 411 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 412 |
+
3F
|
| 413 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 414 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 415 |
+
00004FCA7AE36D5A90E199FF55805496536154AF958B63E9697751F16168520A
|
| 416 |
+
582A52D8574E780D770B5EB761777CE0625B62974EA27095800362F770E49760
|
| 417 |
+
577782DB67EF68F578D5984679D16BBB54B353EF6E34514B523B5BA28AB280AF
|
| 418 |
+
554358BE61C75751542D7A7A60505B5463A7647353E362635BC767AF54ED7A9F
|
| 419 |
+
82E691775EAB89328A8757AE630E8DE880EF584A7B7751085FEB5BEC6B3E5321
|
| 420 |
+
7B5072C268467926773666E051B5866776D45DCB7ABA8475594E9B4150800000
|
| 421 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 422 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 423 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 424 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 425 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 426 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 427 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 428 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 429 |
+
40
|
| 430 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 431 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 432 |
+
0000994B61276F7057646606634656F062EC64F45ED395CA578362C95587881F
|
| 433 |
+
81D88FA35566840A4F868CF485CD5A6A6B0465147C4395CC862D703E8B95652C
|
| 434 |
+
89BD61F67E9C721B6FEB7405699472FC5ECA90CE67176D6A648852DE72628001
|
| 435 |
+
4F6C59E5916A70D96F8752D26A0296F79433857E78CA7D2F512158D864C2808B
|
| 436 |
+
985E6CEA68F1695E51B7539868A872819ECE7C6C72F896E270557406674E88CF
|
| 437 |
+
9BC979AE83898354540F68179E9753B252F5792B6B77522950884F8B4FD00000
|
| 438 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 439 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 440 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 441 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 442 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 443 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 444 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 445 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 446 |
+
41
|
| 447 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 448 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 449 |
+
000075E27ACB7C92701D96B8529B748354E95006806F84EE9023942E5EC96190
|
| 450 |
+
6F237C3E658281C993C8620071497DF47CE751C968817CB1826F51698F1B91CF
|
| 451 |
+
667E4EAE8AD264A9804A50DA764271CE5BE5907C6F664E86648294105ED66599
|
| 452 |
+
521788C270C852A373757433679778F7971681E891309C576DCB51DB8CC3541D
|
| 453 |
+
62CE73B283F196F69F6192344F367F9A51CC974896755DBA981853E64EE46E9C
|
| 454 |
+
740969B4786B993E7559528976246D4167F3516D9F8D807E56A87C607ABF0000
|
| 455 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 456 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 457 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 458 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 459 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 460 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 461 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 462 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 463 |
+
42
|
| 464 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 465 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 466 |
+
0000968658DF650F96B46A135A41645F7C0D6F0F964B860676E798715EEC7210
|
| 467 |
+
64C46EF7865C9B6F9E93788C97328DEF8CC29E7F6F5E798493329678622E9A62
|
| 468 |
+
541592C14FA365C55C655C627E37616E6C2F5F8B73876FFE7DD15DD265235B7F
|
| 469 |
+
706453754E8263A0756563848F2A502B4F966DEA7DB88AD6863F87BA7F85908F
|
| 470 |
+
947C7C6E9A3E88F8843D6D1B99F17D615ABD9EBB746A78BC879E99AC99E1561B
|
| 471 |
+
55CE57CB8CB79EA58CE390818109779E9945883B6EFF851366FC61626F2B0000
|
| 472 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 473 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 474 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 475 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 476 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 477 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 478 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 479 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 480 |
+
43
|
| 481 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 482 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 483 |
+
00008B3E8292832B76F26C135FD983BD732B830593286BDB77DB925A536F8302
|
| 484 |
+
51925E3D8C8C8CBF9EBD73AB679A68859176970971646CA177095A9293826BCF
|
| 485 |
+
7F8E66275BD059B95A9A958060B65011840C84996AAC76DF9333731B59225B5F
|
| 486 |
+
772F919A97617CDC8FF78B0E5F4C7C7379D889936CCC871C5BC65E4268C97720
|
| 487 |
+
7DBF5195514D52C95A297DEC976282D763CF778485D079D26E3A5EDF59998511
|
| 488 |
+
6EC56C1162BF76BF654F61AB95A9660E879F9CF49298540D547D8B2C64780000
|
| 489 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 490 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 491 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 492 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 493 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 494 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 495 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 496 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 497 |
+
44
|
| 498 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 499 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 500 |
+
0000647986116A21819C78E864699B5462B9672B83AB58A89ED86CAB6F205BDE
|
| 501 |
+
964C8B00725F67D062C77261755D59C66BCD589366AE5E5552DF6155672876EE
|
| 502 |
+
776672677A4662FF54EA5450920990A35A1C7D0D6C164E435976801059485357
|
| 503 |
+
753796E356CA6493816660F19B276DD65462991251855AE980FD59AE9713502A
|
| 504 |
+
6CE55C3C64EC4F60533F81A990066EBA852B62C85E7478BE6506637B5FF55A18
|
| 505 |
+
91C09CE55C3F634F80765B7D5699947793B36D8560A86AB8737051DD5BE70000
|
| 506 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 507 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 508 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 509 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 510 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 511 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 512 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 513 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 514 |
+
45
|
| 515 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 516 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 517 |
+
000064F06FD8725B626D92157D1081BF6FC38FB25F04597452AA601259736696
|
| 518 |
+
86507627632A61E67CEF8AFE54E66B509DD76BC685D5561450766F1A556A8DB4
|
| 519 |
+
722C5E156015743662CD6392724C5F986E436D3E65006F5876E478D076FC7554
|
| 520 |
+
522453DB4E539F9065C1802A80D6629B5486522870AE888D8DD16CE1547880DA
|
| 521 |
+
57F988F48CE0966A914D4F696C9B567476C6783062A870F96F8E5F6D84EC68DA
|
| 522 |
+
787C7BF781A8670B9D6C636778B0576F78129739627962AB528874356BD70000
|
| 523 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 524 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 525 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 526 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 527 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 528 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 529 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 530 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 531 |
+
46
|
| 532 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 533 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 534 |
+
00005564813E75B276AE533975DE50FB5C418B6C7BC7504F72479A1998C46F02
|
| 535 |
+
74E27968648777A562FC983B8CA754C180584E52576A860B840D5E73619174F6
|
| 536 |
+
8A555C4F57616F5198175A4678349B448FEB7C95525664B292EA50D583868461
|
| 537 |
+
83E984B257D46A385703666E6D668B5C66DD7011671F6B3A68F2621A59BB4E03
|
| 538 |
+
51C46F0667D26C8F517668CB59476B6775665D0E81CD9F4A65D7794879419A0E
|
| 539 |
+
8D778C484E5E4F0155535951780C56686C238FC468C46C7D6CE38A1663900000
|
| 540 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 541 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 542 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 543 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 544 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 545 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 546 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 547 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 548 |
+
47
|
| 549 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 550 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 551 |
+
000060706D3D727D626691FA925B534390777C3D4EDF8B194E7E9ED493229257
|
| 552 |
+
524D6F5B90636DFA8B7458795D4C6B206B4969CD55C681547F8C58BB85945F3A
|
| 553 |
+
64366A47936C657260846A4B77A755AC50D15DE7979864AC7FF95CED4FCF7AC5
|
| 554 |
+
520783044E14602F7ACA6B3D4FB589AA79E6743452E482B964D279BD5BE26C81
|
| 555 |
+
97528F156C2B50BE537F6E0564CE66746C3060C598038ACB617674CA7AAE79CB
|
| 556 |
+
4E1890B174036C4256DA914B6CC58DA8534086C666F28EC05C489A456E200000
|
| 557 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 558 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 559 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 560 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 561 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 562 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 563 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 564 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 565 |
+
48
|
| 566 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 567 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 568 |
+
000053D65A369F728DA353BB570898746B0A919B6CC9516875CA62F372AC5238
|
| 569 |
+
52F87F3A7094763853749D7269B778BA96C088D97FA4713671C3518967D374E4
|
| 570 |
+
58E4651856B78B93995264FE7E5E60F971B158EC4EC14EBA5FCD97CC4EFB8A8D
|
| 571 |
+
5203598A7D0962544ECD65E5620E833884C969AE878D71946EB65BB97D685197
|
| 572 |
+
63C967D480898339881551125B7A59828FB14E736C5D516589258EDF962E854A
|
| 573 |
+
745E92ED958F6F6482E55F316492705185A9816E9C13585E8CFD4E0953C10000
|
| 574 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 575 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 576 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 577 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 578 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 579 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 580 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 581 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 582 |
+
49
|
| 583 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 584 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 585 |
+
000050986563685155D355AA64149A3763835AC2745F82726F8068EE50E7838E
|
| 586 |
+
78026BBA52396C997D1750BB5565715E7BE966EC73CA82EB67495C715220717D
|
| 587 |
+
886B9583965D64C58D0D81B355846C5562477E55589250B755468CDE664C4E0A
|
| 588 |
+
5C1A88F368A2634E7A0D71D2828D52FA97F65C1154E890B57D3959628CD286C7
|
| 589 |
+
820C63688D66651D5C0461FE6D89793E8A2D78377533547B4F388EAB6DF15A20
|
| 590 |
+
7D33795E6C885BE95B38751A814E614E6EF28072751F7525727253477E690000
|
| 591 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 592 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 593 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 594 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 595 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 596 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 597 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 598 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 599 |
+
4A
|
| 600 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 601 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 602 |
+
0000770176DB526952DD80565E2B5931734565BD6FD58A695C388671534177F3
|
| 603 |
+
62FE66424EC098DF87555BE68B5853F277E24F7F5C4E99DB59CB5F0F793A58EB
|
| 604 |
+
4E1667FF4E8B62ED8A93901D52E2662F55DC566C90694ED54F8D91CB98FE6C0F
|
| 605 |
+
5E0260435BA489968A666536624B99965B8858FD6388552E53D776267378852C
|
| 606 |
+
6A1E68B36B8A62928F3853D482126DD1758F66F88D165B70719F85AF669166D9
|
| 607 |
+
7F7287009ECD9F205C6C88538FF06A39675F620D7AEA58855EB665786F310000
|
| 608 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 609 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 610 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 611 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 612 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 613 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 614 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 615 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 616 |
+
4B
|
| 617 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 618 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 619 |
+
000060555237800D6454887075295E25681362F4971C96D9723D8AB06C347761
|
| 620 |
+
7A0E542E77AC9806821C8AAC78A96714720D65AF64955636601D79C153F87D72
|
| 621 |
+
6B7B80865BFA55E356DB4F3A4F3C98FC5DF39B068073616B980C90015B8B8A1F
|
| 622 |
+
8AA6641C825864FB55FD860791654FD77D20901F7C9F50F358516EAF5BBF8A34
|
| 623 |
+
80859178849C7B9796D6968B96A87D8F9AD3788E6B727A57904296A7795F5B6B
|
| 624 |
+
640D7B0B84D168AD55067E2E74637D2293966240584C4ED65B83597958540000
|
| 625 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 626 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 627 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 628 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 629 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 630 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 631 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 632 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 633 |
+
4C
|
| 634 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 635 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 636 |
+
0000737A64BB8E4B8E0F80CE82D462AC81FA6CF0915E592A614B6C70574D6524
|
| 637 |
+
8CAA7671705858C76A8075F06F6D8B5A8AC757666BEF889278B363A2560670AD
|
| 638 |
+
6E6F5858642A580268E0819B55107CD650188EBA6DCC8D9F71D9638F6FE46ED4
|
| 639 |
+
7E278404684390036DD896768A0E5957727985E49A3075BC8B0468AF52548E22
|
| 640 |
+
92BB63D0984C8E44557C9AD466FF568F60D56D9552435C4959296DFB586B7530
|
| 641 |
+
751C606C821481466311689D8FE2773A8DF38CBC94355E165EF3807D70F40000
|
| 642 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 643 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 644 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 645 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 646 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 647 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 648 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 649 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 650 |
+
4D
|
| 651 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 652 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 653 |
+
00006C405EF7505C4EAD5EAD633A8247901A6850916E77B3540C92855F647AE5
|
| 654 |
+
687663457B527D7175DB50776295982D900F51F879C37A8157165F9290145857
|
| 655 |
+
5C60571F541051546E4D571863A8983D817F8715892A9000541E5C6F81C062D6
|
| 656 |
+
625881319D15964099B199DD6A6259A562D3553E631654C786D97AAA5A0374E6
|
| 657 |
+
896A6B6A59168C4C5F4E706373A998114E3870F75B8C7897633D665A769660CB
|
| 658 |
+
5B9B5A49842C81556C6A738B4EA167897DB25F8065FA671B5FD859845A010000
|
| 659 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 660 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 661 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 662 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 663 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 664 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 665 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 666 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 667 |
+
4E
|
| 668 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 669 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 670 |
+
00005DCD5FAE537197CB90556845570D552F60DF72326FF07DAD8466840E59D4
|
| 671 |
+
504950DE5C3E7DEF672A851A5473754F80C355829B4F4F4D6E2D8B025C096170
|
| 672 |
+
885B761F6E29868A6587805E7D0B543B7A697D0A554F55E17FC174EE64BE8778
|
| 673 |
+
6E267AA9621165A1536763E16C835DEB55DA93A270CF6C618AA35C4B7121856A
|
| 674 |
+
68A7543E54346BCB6B664E9463425348821E4F0D4FAE5862620A972766647269
|
| 675 |
+
52FF52D9609F8AA4661471996790897F785277FD6670563B5438932B72A70000
|
| 676 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 677 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 678 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 679 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 680 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 681 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 682 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 683 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 684 |
+
4F
|
| 685 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 686 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 687 |
+
00007A00606F5E0C6089819D591560DC718470EF6EAA6C5072806A8489725E2D
|
| 688 |
+
7FD25AB3559C92916D177CFB969962327D30778E87665323971E8F4466875CFD
|
| 689 |
+
4FE072F94E0B53A6590F56876380934151484ED99BAE7E9654B88CE2929C8237
|
| 690 |
+
95916D8E5F265ACC986F96AA73FE737B7E23817A99217FA161B2967796507DAB
|
| 691 |
+
76F853A2947299997BB189446E5891097FD479658A7360F397FF4EAB98055DF7
|
| 692 |
+
6A6150CF54118C61856D785D9704524A54EE56C292B76D885BB56DC666C90000
|
| 693 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 694 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 695 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 696 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 697 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 698 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 699 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 700 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 701 |
+
50
|
| 702 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 703 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 704 |
+
00005C0F5B5D68218096562F7B11654869544E9B6B47874E978B5354633E643A
|
| 705 |
+
90AA659C81058AE75BEB68B0537887F961C86CC470098B1D5C5185AA82AF92C5
|
| 706 |
+
6B238F9B65B05FFB5FC34FE191C1661F8165732960FA82085211578B5F6290A2
|
| 707 |
+
884C91925E78674F602759D3514451F680F853086C7996C4718A4F114FEE7F9E
|
| 708 |
+
673D55C592B979C088967D89589F620C9700865A561898085F908A3184C49157
|
| 709 |
+
53D965ED5E8F755C60647D6E5A7F7DD27E8C8ED255A75BA361F865CB73840000
|
| 710 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 711 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 712 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 713 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 714 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 715 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 716 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 717 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 718 |
+
51
|
| 719 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 720 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 721 |
+
00009078766C77297D629774859B5B787A7496EA884052DB718F5FAA65EC8A62
|
| 722 |
+
5C0B99B45DE16B896C5B8A138A0A905C8FC558D362BC9D099D2854404E2B82BD
|
| 723 |
+
7259869C5D1688596DAF96C5555E4E9E8A1D710954BD95B970DF6DF99E7D56B4
|
| 724 |
+
781487125CA95EF68A00985495BB708E6CBF594463A9773C884D6F1482775830
|
| 725 |
+
71D553AD786F96C155015F6671305BB48AFA9A576B83592E9D2679E7694A63DA
|
| 726 |
+
4F6F760D7F8A6D0B967D6C274EF07662990A6A236F3E90808170599674760000
|
| 727 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 728 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 729 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 730 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 731 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 732 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 733 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 734 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 735 |
+
52
|
| 736 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 737 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 738 |
+
00006447582F90657A918B2159DA54AC820085E5898180006930564E8036723A
|
| 739 |
+
91CE51B64E5F98016396696D844966F3814B591C6DB24E0058F991AB63D692A5
|
| 740 |
+
4F9D4F0A886398245937907A79FB510080F075916C825B9C59E85F5D690587FB
|
| 741 |
+
501A5DF24E5977E34EE585DD6291661390915C7951045F7981C69038808475AB
|
| 742 |
+
4EA688D4610F6BC561B67FA976CA6EA28A638B708ABC8B6F5F027FFC7FCC7E79
|
| 743 |
+
8335852D56E06BB797F3967059FB541F92806DEB5BC598F25C395F1596B10000
|
| 744 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 745 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 746 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 747 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 748 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 749 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 750 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 751 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 752 |
+
53
|
| 753 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 754 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 755 |
+
0000537082F16AFB5B309DF961C97E93746987A271DF719288058FCE8D0F76C8
|
| 756 |
+
5F717A4E786C662055B264C150AD81C376705EB896CD8E3486F9548F6CF36D8C
|
| 757 |
+
6C38607F52C775285E7D512A60A061825C24753190F5923E73366CB96E389149
|
| 758 |
+
670953CB53F34F5191C98A9853C85E7C8FC26DE44E8E76C26986865E611A8F3F
|
| 759 |
+
99184FDE903E9B5A61096E1D6F0196854E885A3196E882075DBC79B95B878A9E
|
| 760 |
+
7FBD738957DF828B9B315401904755BB5CEA5FA161086B32734480B28B7D0000
|
| 761 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 762 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 763 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 764 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 765 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 766 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 767 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 768 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 769 |
+
54
|
| 770 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 771 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 772 |
+
00006D745BD388D598108C6B99AD9D1B6DF551A4514357A38881539F63F48F45
|
| 773 |
+
571254E15713733F6E907DE3906082D198586028966266F07D048D8A8E8D9470
|
| 774 |
+
5CB37CA4670860A695B2801896F29116530096955141904B85F49196668897F5
|
| 775 |
+
5B55531D783896DC683D54C9707E5BB08F09518D572854B1652266AB8D0A8D1C
|
| 776 |
+
81DF846C906D7CDF947F85FB68D765E96FA186A48E81566A902076827AC871E5
|
| 777 |
+
8CAC64C752476FA48CCA600E589E618E66FE8D08624E55B36E23672D8ECB0000
|
| 778 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 779 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 780 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 781 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 782 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 783 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 784 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 785 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 786 |
+
55
|
| 787 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 788 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 789 |
+
0000935895987728680569A8548B4E4D70B88A5064589F4B5B857A8450B55BE8
|
| 790 |
+
77BB6C088A797C986CBE76DE65AC8F3E5D845C55863868E7536062307AD96E5B
|
| 791 |
+
7DBB6A1F7AE05F706F335F35638C6F3267564E085E338CEC4ED781397634969C
|
| 792 |
+
62DB662D627E6CBC8D9971677F695146808753EC906E629854F287C48F4D8005
|
| 793 |
+
937A851790196D5973CD659F771F7504782781FB8C9E91DD5075679575B98A3A
|
| 794 |
+
9707632F93AE966384B86399775C5F817319722D6014657462EF6B63653F0000
|
| 795 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 796 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 797 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 798 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 799 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 800 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 801 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 802 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 803 |
+
56
|
| 804 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 805 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 806 |
+
00005E407665912D8B49829D679D652F5431871877E580A281026C414E4B7E54
|
| 807 |
+
807776F4690D6B9657F7503C4F84574063076B628DBE887965E87D195FD7646F
|
| 808 |
+
64F281F381F47F6E5E5F5CD95236667A79E97A1A8CEA709975D46EEF6CBB7A92
|
| 809 |
+
4E2D76C55FE0941888777D427A2E816B91CD4EF28846821F54685DDE6D328B05
|
| 810 |
+
7CA58EF880985E1A549276BA5B99665D9A5F73E0682A86DB6731732A8AF88A85
|
| 811 |
+
90107AF971ED716E62C477DA56D14E3B845767F152A986C08CAF94447BC90000
|
| 812 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 813 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 814 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 815 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 816 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 817 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 818 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 819 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 820 |
+
57
|
| 821 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 822 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 823 |
+
00004F4F6CE8795D99D06293722A62FD5C0878DA8F4964B08CFA7BC66A01838A
|
| 824 |
+
88DD599D649E58EF72C0690E93108FFD8D05589C7DB48AC46E96634962D95353
|
| 825 |
+
684C74228301914C55447740707C6FC1517954A88CC759FF6ECB6DC45B5C7D2B
|
| 826 |
+
4ED47C7D6ED35B5081EA6F2C5B579B0368D58E2A5B977D9C7E3D7E3191128D70
|
| 827 |
+
594F63CD79DF8DB3535265CF79568A5B963B7D44947D7E825634918967007F6A
|
| 828 |
+
5C0A907566285DE64F5067DE505A4F5C57505EA7000000000000000000000000
|
| 829 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 830 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 831 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 832 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 833 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 834 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 835 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 836 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 837 |
+
58
|
| 838 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 839 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 840 |
+
00004E8D4E0C51404E105EFF53454E154E984E1E9B325B6C56694E2879BA4E3F
|
| 841 |
+
53154E47592D723B536E6C1056DF80E499976BD3777E9F174E364E9F9F104E5C
|
| 842 |
+
4E694E9382885B5B55C7560F4EC45399539D53B453A553AE97688D0B531A53F5
|
| 843 |
+
532D5331533E8CFE5366536352025208520E52445233528C5274524C525E5261
|
| 844 |
+
525C84AF527D528252815290529351827F544EBB4EC34EC94EC24EE84EE14EEB
|
| 845 |
+
4EDE50B44EF34F224F644EF5500050964F094F474F5E4F6765384F5A4F5D0000
|
| 846 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 847 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 848 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 849 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 850 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 851 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 852 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 853 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 854 |
+
59
|
| 855 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 856 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 857 |
+
00004F5F4F574F324F3D4F764F744F914F894F834F8F4F7E4F7B51154F7C5102
|
| 858 |
+
4F945114513C51374FC54FDA4FE34FDC4FD14FDF4FF85029504C4FF3502C500F
|
| 859 |
+
502E502D4FFE501C500C5025502850E8504350555048504E506C50C2513B5110
|
| 860 |
+
513A50BA50D6510650ED50EC50E650EE5107510B4EDD6C3D4F5850C94FCE9FA0
|
| 861 |
+
6C467CF4516E5DFD9ECC999856C5591452F9530D8A0753109CEC591951554EA0
|
| 862 |
+
51564EB3886E88A4893B81E088D279805B3488037FB851AB51B151BD51BC0000
|
| 863 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 864 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 865 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 866 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 867 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 868 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 869 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 870 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 871 |
+
5A
|
| 872 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 873 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 874 |
+
000051C7519651A251A58A018A108A0C8A158B338A4E8A258A418A368A468A54
|
| 875 |
+
8A588A528A868A848A7F8A708A7C8A758A6C8A6E8ACD8AE28A618A9A8AA58A91
|
| 876 |
+
8A928ACF8AD18AC98ADB8AD78AC28AB68AF68AEB8B148B018AE48AED8AFC8AF3
|
| 877 |
+
8AE68AEE8ADE8B288B9C8B168B1A8B108B2B8B2D8B568B598B4E8B9E8B6B8B96
|
| 878 |
+
5369537A961D962296219631962A963D963C964296589654965F9689966C9672
|
| 879 |
+
96749688968D969796B09097909B913A9099911490A190B490B390B691340000
|
| 880 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 881 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 882 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 883 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 884 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 885 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 886 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 887 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 888 |
+
5B
|
| 889 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 890 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 891 |
+
000090B890B090DF90C590BE913690C490C79106914890E290DC90D790DB90EB
|
| 892 |
+
90EF90FE91049122911E91239131912F91399143914682BB595052F152AC52AD
|
| 893 |
+
52BE54FF52D052D652F053DF71EE77CD5EF451F551FC9B2F53B65F01755A5DF0
|
| 894 |
+
574C580A57A1587E58BC58C558D15729572C572A573358D9572E572F58E2573B
|
| 895 |
+
5742576958E0576B58DA577C577B5768576D5776577357E157A4578C584F57CF
|
| 896 |
+
57A75816579357A057D55852581D586457D257B857F457EF57F857E457DD0000
|
| 897 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 898 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 899 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 900 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 901 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 902 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 903 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 904 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 905 |
+
5C
|
| 906 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 907 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 908 |
+
0000580B580D57FD57ED5800581E5819584458205865586C58815889589A5880
|
| 909 |
+
99A89F1961FF8279827D827F828F828A82A88284828E8291858C829982AB8553
|
| 910 |
+
82BE82B085F682CA82E3829882B782AE83A7840784EF82A982B482A182AA829F
|
| 911 |
+
82C482E782A482E1830982F782E48622830782DC82F482D282D8830C82FB82D3
|
| 912 |
+
8526831A8306584B716282E082D5831C8351855884FD83088392833C83348331
|
| 913 |
+
839B854E832F834F8347834385888340831785BA832D833A833372966ECE0000
|
| 914 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 915 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 916 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 917 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 918 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 919 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 920 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 921 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 922 |
+
5D
|
| 923 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 924 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 925 |
+
00008541831B85CE855284C08452846483B083788494843583A083AA8393839C
|
| 926 |
+
8385837C859F83A9837D8555837B8398839E83A89DAF849383C1840183E583D8
|
| 927 |
+
58078418840B83DD83FD83D6841C84388411840683D483DF840F840383F883F9
|
| 928 |
+
83EA83C583C07E0883F083E1845C8451845A8459847385468488847A85628478
|
| 929 |
+
843C844684698476851E848E8431846D84C184CD84D09A4084BD84D384CA84BF
|
| 930 |
+
84BA863A84A184B984B4849793A38577850C750D853884F0861E851F85FA0000
|
| 931 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 932 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 933 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 934 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 935 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 936 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 937 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 938 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 939 |
+
5E
|
| 940 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 941 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 942 |
+
00008556853B84FF84FC8559854885688564855E857A77A285438604857B85A4
|
| 943 |
+
85A88587858F857985EA859C858585B985B785B0861A85C185DC85FF86278605
|
| 944 |
+
86298616863C5EFE5F08593C596980375955595A5958530F5C225C255C2C5C37
|
| 945 |
+
624C636B647662BB62CA62DA62D762EE649F62F66339634B634363AD63F66371
|
| 946 |
+
637A638E6451636D63AC638A636963AE645C63F263F863E064B363C463DE63CE
|
| 947 |
+
645263C663BE65046441640B641B6420640C64266421645E6516646D64960000
|
| 948 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 949 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 950 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 951 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 952 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 953 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 954 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 955 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 956 |
+
5F
|
| 957 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 958 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 959 |
+
0000647A64F764FC6499651B64C064D064D764E464E265096525652E5F0B5FD2
|
| 960 |
+
75195F11535F53F1563053E953E853FB541254165406544B563856C8545456A6
|
| 961 |
+
54435421550454BC5423543254825494547754715464549A5680548454765466
|
| 962 |
+
565D54D054AD54C254B4566054A754A6563555F6547254A3566654BB54BF54CC
|
| 963 |
+
567254DA568C54A954AA54A4566554CF54DE561C54E7562E54FD551454F355E9
|
| 964 |
+
5523550F55115527552A5616558F55B5554956C055415555553F5550553C0000
|
| 965 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 966 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 967 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 968 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 969 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 970 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 971 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 972 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 973 |
+
60
|
| 974 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 975 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 976 |
+
00005537555655755576557755335530555C558B55D2558355B155B955885581
|
| 977 |
+
559F557E55D65591557B55DF560D56B35594559955EA55F755C9561F55D156C1
|
| 978 |
+
55EC55D455E655DD55C455EF55E555F2566F55CC55CD55E855F555E48F61561E
|
| 979 |
+
5608560C560156B6562355FE56005627562D565856395657562C564D56625659
|
| 980 |
+
5695564C5654568656645671566B567B567C5685569356AF56D456D756DD56E1
|
| 981 |
+
570756EB56F956FF5704570A5709571C5E435E195E145E115E6C5E585E570000
|
| 982 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 983 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 984 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 985 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 986 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 987 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 988 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 989 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 990 |
+
61
|
| 991 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 992 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 993 |
+
00005E375E445E545E5B5E5E5E615C8C5C7A5C8D5C905D875C885CF45C995C91
|
| 994 |
+
5D505C9C5CB55CA25D2C5CAC5CAB5CB15CA35CC15CB75DA75CD25DA05CCB5D22
|
| 995 |
+
5D975D0D5D275D265D2E5D245D1E5D065D1B5DB85D3E5D345D3D5D6C5D5B5D6F
|
| 996 |
+
5D815D6B5D4B5D4A5D695D745D825D995D9D8C735DB75DD45F735F775F825F87
|
| 997 |
+
5F89540E5FA05F995F9C5FA85FAD5FB55FBC88625F6172AD72B072B473777341
|
| 998 |
+
72C372C172CE72CD72D272E8736A72E9733B72F472F7730172F3736B72FA0000
|
| 999 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1000 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1001 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1002 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1003 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1004 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1005 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1006 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1007 |
+
62
|
| 1008 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1009 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1010 |
+
000072FB731773137380730A731E731D737C732273397325732C733873317350
|
| 1011 |
+
734D73577360736C736F737E821B592598E75924590298E0993398E9993C98EA
|
| 1012 |
+
98EB98ED98F4990999114F59991B9937993F994399489949994A994C99625E80
|
| 1013 |
+
5EE15E8B5E965EA55EA05EB95EB55EBE5EB38CE15ED25ED15EDB5EE85EEA81BA
|
| 1014 |
+
5FC45FC95FD661FA61AE5FEE616A5FE15FE4613E60B561345FEA5FED5FF86019
|
| 1015 |
+
60356026601B600F600D6029602B600A61CC6021615F61E860FB613760420000
|
| 1016 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1017 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1018 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1019 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1020 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1021 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1022 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1023 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1024 |
+
63
|
| 1025 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1026 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1027 |
+
0000606A60F26096609A6173609D60836092608C609B611C60BB60B160DD60D8
|
| 1028 |
+
60C660DA60B4612061926115612360F46100610E612B614A617561AC619461A7
|
| 1029 |
+
61B761D461F55FDD96B39582958695C8958E9594958C95E595AD95AB9B2E95AC
|
| 1030 |
+
95BE95B69B2995BF95BD95BC95C395CB95D495D095D595DE4E2C723F62156C35
|
| 1031 |
+
6C546C5C6C4A70436C856C906C946C8C6C686C696C746C766C866F596CD06CD4
|
| 1032 |
+
6CAD702770186CF16CD76CB26CE06CD66FFC6CEB6CEE6CB16CD36CEF6D870000
|
| 1033 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1034 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1035 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1036 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1037 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1038 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1039 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1040 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1041 |
+
64
|
| 1042 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1043 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1044 |
+
00006D396D276D0C6D796E5E6D076D046D196D0E6D2B6FAE6D2E6D356D1A700F
|
| 1045 |
+
6EF86F6F6D336D916D6F6DF66F7F6D5E6D936D946D5C6D606D7C6D636E1A6DC7
|
| 1046 |
+
6DC56DDE70066DBF6DE06FA06DE66DDD6DD9700B6DAB6E0C6DAE6E2B6E6E6E4E
|
| 1047 |
+
6E6B6EB26E5F6E866E536E546E326E256E4470676EB16E9870446F2D70056EA5
|
| 1048 |
+
6EA76EBD6EBB6EB76F776EB46ECF6E8F6EC26E9F6F627020701F6F246F156EF9
|
| 1049 |
+
6F2F6F3670326F746F2A6F096F296F896F8D6F8C6F786F726F7C6F7A70280000
|
| 1050 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1051 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1052 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1053 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1054 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1055 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1056 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1057 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1058 |
+
65
|
| 1059 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1060 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1061 |
+
00006FC96FA76FB96FB66FC26FE16FEE6FDE6FE06FEF701A7023701B70397035
|
| 1062 |
+
705D705E5B805B845B955B935BA55BB8752F9A2B64345BE45BEE89305BF08E47
|
| 1063 |
+
8B078FB68FD38FD58FE58FEE8FE490878FE690158FE890059004900B90909011
|
| 1064 |
+
900D9016902190359036902D902F9044905190529050906890589062905B66B9
|
| 1065 |
+
9074907D908290889083908B5F505F575F565F585C3B54AB5C505C595B715C63
|
| 1066 |
+
5C687FBC5F335F295F2D82745F3C9B3B5C6E59815983598D5AF55AD759A30000
|
| 1067 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1068 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1069 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1070 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1071 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1072 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1073 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1074 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1075 |
+
66
|
| 1076 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1077 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1078 |
+
0000599759CA5B00599E59A459D259B259AF59D759BE5A6D5B0859DD5B4C59E3
|
| 1079 |
+
59D859F95A0C5A095AA75AFB5A115A235A135A405A675A4A5A555A3C5A625B0B
|
| 1080 |
+
80EC5AAA5A9B5A775A7A5ABE5AEB5AB25B215B2A5AB85AE05AE35B195AD65AE6
|
| 1081 |
+
5AD85ADC5B095B175B165B325B375B405C155C1C5B5A5B655B735B515B535B62
|
| 1082 |
+
99D499DF99D99A369A5B99D199D89A4D9A4A99E29A6A9A0F9A0D9A059A429A2D
|
| 1083 |
+
9A169A419A2E9A389A439A449A4F9A659A647CF97D067D027D077D087E8A0000
|
| 1084 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1085 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1086 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1087 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1088 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1089 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1090 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1091 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1092 |
+
67
|
| 1093 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1094 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1095 |
+
00007D1C7D157D137D3A7D327D317E107D3C7D407D3F7D5D7D4E7D737D867D83
|
| 1096 |
+
7D887DBE7DBA7DCB7DD47DC47D9E7DAC7DB97DA37DB07DC77DD97DD77DF97DF2
|
| 1097 |
+
7E627DE67DF67DF17E0B7DE17E097E1D7E1F7E1E7E2D7E0A7E117E7D7E397E35
|
| 1098 |
+
7E327E467E457E887E5A7E527E6E7E7E7E707E6F7E985E7A757F5DDB753E9095
|
| 1099 |
+
738E74A3744B73A2739F73CF73C274CF73B773B373C073C973C873E573D9980A
|
| 1100 |
+
740A73E973E773DE74BD743F7489742A745B7426742574287430742E742C0000
|
| 1101 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1102 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1103 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1104 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1105 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1106 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1107 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1108 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1109 |
+
68
|
| 1110 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1111 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1112 |
+
0000741B741A7441745C74577455745974A6746D747E749C74D4748074817487
|
| 1113 |
+
748B749E74A874A9749074A774DA74BA97D997DE97DC674C6753675E674869AA
|
| 1114 |
+
6AEA6787676A677367986898677568D66A05689F678B6777677C67F06ADB67D8
|
| 1115 |
+
6AF367E967B06AE867D967B567DA67B367DD680067C367B867E26ADF67C16A89
|
| 1116 |
+
68326833690F6A48684E6968684469BF6883681D68556A3A68416A9C68406B12
|
| 1117 |
+
684A6849682968B5688F687468776893686B6B1E696E68FC6ADD69E768F90000
|
| 1118 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1119 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1120 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1121 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1122 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1123 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1124 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1125 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1126 |
+
69
|
| 1127 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1128 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1129 |
+
00006B0F68F0690B6901695768E369106971693969606942695D6B16696B6980
|
| 1130 |
+
69986978693469CC6AEC6ADA69CE6AF8696669636979699B69A769BB69AB69AD
|
| 1131 |
+
69D469B169C169CA6AB369956AE7698D69FF6AA369ED6A176A186A6569F26A44
|
| 1132 |
+
6A3E6AA06A506A5B6A356A8E6AD36A3D6A286A586ADE6A916A906AA96A976AAB
|
| 1133 |
+
733773526B816B826BA46B846B9E6BAE6B8D6BAB6B9B6BAF6BAA8ED48EDB8EF2
|
| 1134 |
+
8EFB8F648EF98EFC8EEB8EE48F628EFA8EFE8F0A8F078F058F128F268F1E0000
|
| 1135 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1136 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1137 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1138 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1139 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1140 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1141 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1142 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1143 |
+
6A
|
| 1144 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1145 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1146 |
+
00008F1F8F1C8F338F468F548ECE62146227621B621F62226221622562246229
|
| 1147 |
+
81E7750C74F474FF750F75117513653465EE65EF65F0660A66C7677266036615
|
| 1148 |
+
6600708566F7661D66346631663666358006665F66C46641664F668966616657
|
| 1149 |
+
66776684668C66D6669D66BE66DB66DC66E666E98CC18CB08CBA8CBD8D048CB2
|
| 1150 |
+
8CC58D108CD18CDA8CD58CEB8CE78CFB899889AC89A189BF89A689AF89B289B7
|
| 1151 |
+
726E729F725D7266726F727E727F7284728B728D728F72926308633263B00000
|
| 1152 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1153 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1154 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1155 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1156 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1157 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1158 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1159 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1160 |
+
6B
|
| 1161 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1162 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1163 |
+
0000643F64D880046BEA6BF36BFD6BFF6BF96C056C0C6C066C0D6C156C186C19
|
| 1164 |
+
6C1A6C216C2C6C246C2A6C3265356555656B725872527256723086625216809F
|
| 1165 |
+
809C809380BC670A80BD80B180AB80AD80B480B76727815680E981DA80DB80C2
|
| 1166 |
+
80C480D980CD80D7671080DD811B80F180F480ED81BE810E80F280FC67158112
|
| 1167 |
+
8C5A8161811E812C811881328148814C815381748159815A817181608169817C
|
| 1168 |
+
817D816D8167584D5AB58188818281CF6ED581A381AA81CC672681CA81BB0000
|
| 1169 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1170 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1171 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1172 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1173 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1174 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1175 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1176 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1177 |
+
6C
|
| 1178 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1179 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1180 |
+
000081C181A66B5F6B376B396B436B466B5998AE98AF98B698BC98C698C86BB3
|
| 1181 |
+
5F408F4289F365909F4F659565BC65C665C465C365CC65CE65D265D6716C7152
|
| 1182 |
+
7096719770BB70C070B770AB70B171C170CA7110711371DC712F71317173715C
|
| 1183 |
+
716871457172714A7178717A719871B371B571A871A071E071D471E771F9721D
|
| 1184 |
+
7228706C71FE716671B9623E623D624362486249793B794079467949795B795C
|
| 1185 |
+
7953795A79B079577960798E7967797A79AA798A799A79A779B35FD15FD00000
|
| 1186 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1187 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1188 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1189 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1190 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1191 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1192 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1193 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1194 |
+
6D
|
| 1195 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1196 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1197 |
+
000061DF605D605A606760416059606361646106610D615D61A9619D61CB61E3
|
| 1198 |
+
62078080807F6C936FA96DFC78EF77F878AD780978687818781165AB782D78B8
|
| 1199 |
+
781D7839792A7931781F783C7825782C78237829784E786D786478FD78267850
|
| 1200 |
+
7847784C786A78E77893789A788778E378A178A378B278B978A578D478D978C9
|
| 1201 |
+
78EC78F2790578F479137924791E79349F959EF99EFB9EFC76F17704779876F9
|
| 1202 |
+
77077708771A77227719772D772677357738775E77BC77477743775A77680000
|
| 1203 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1204 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1205 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1206 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1207 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1208 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1209 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1210 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1211 |
+
6E
|
| 1212 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1213 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1214 |
+
000077627765777F778D777D7780778C7791779F77A077B077B577BD753A7540
|
| 1215 |
+
754E754B7548755B7572757975837F587F617F5F8A487F687F867F717F797F88
|
| 1216 |
+
7F7E76CD76E5883291D291D391D491D991D791D591F791E791E4934691F591F9
|
| 1217 |
+
9208922692459211921092019227920492259200923A9266923792339255923D
|
| 1218 |
+
9238925E926C926D923F9460923092499248924D922E9239943892AC92A0927A
|
| 1219 |
+
92AA92EE92CF940392E3943A92B192A693A7929692CC92A993F59293927F0000
|
| 1220 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1221 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1222 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1223 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1224 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1225 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1226 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1227 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1228 |
+
6F
|
| 1229 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1230 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1231 |
+
000093A9929A931A92AB9283940B92A892A39412933892F193D792E592F092EF
|
| 1232 |
+
92E892BC92DD92F69426942792C392DF92E6931293069369931B934093019315
|
| 1233 |
+
932E934393079308931F93199365934793769354936493AA9370938493E493D8
|
| 1234 |
+
9428938793CC939893B893BF93A693B093B5944C93E293DC93DD93CD93DE93C3
|
| 1235 |
+
93C793D19414941D93F794659413946D9420947993F99419944A9432943F9454
|
| 1236 |
+
9463937E77E777EC96C979D579ED79E379EB7A065D477A037A027A1E7A140000
|
| 1237 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1238 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1239 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1240 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1241 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1242 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1243 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1244 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1245 |
+
70
|
| 1246 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1247 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1248 |
+
00007A397A377A619ECF99A57A707688768E7693769976A474DE74E0752C9CE9
|
| 1249 |
+
9CF69D079D069D239D879E159D1D9D1F9DE59D2F9DD99D309D429E1E9D539E1D
|
| 1250 |
+
9D609D529DF39D5C9D619D939D6A9D6F9D899D989D9A9DC09DA59DA99DC29DBC
|
| 1251 |
+
9E1A9DD39DDA9DEF9DE69DF29DF89E0C9DFA9E1B7592759476647658759D7667
|
| 1252 |
+
75A375B375B475B875C475B175B075C375C2760275CD75E3764675E675E47647
|
| 1253 |
+
75E7760375F175FC75FF761076007649760C761E760A7625763B761576190000
|
| 1254 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1255 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1256 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1257 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1258 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1259 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1260 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1261 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1262 |
+
71
|
| 1263 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1264 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1265 |
+
0000761B763C762276207640762D7630766D76357643766E7633764D76697654
|
| 1266 |
+
765C76567672766F7FCA7AE67A787A797A807A867A887A957AC77AA07AAC7AA8
|
| 1267 |
+
7AB67AB3886488698872887D887F888288A2896088B788BC88C9893388CE895D
|
| 1268 |
+
894788F1891A88FC88E888FE88F08921891989138938890A8964892B89368941
|
| 1269 |
+
8966897B758B80E576B876B477DC801280148016801C8020802E80258026802C
|
| 1270 |
+
802980288031800B803580438046807980528075807189839807980E980F0000
|
| 1271 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1272 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1273 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1274 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1275 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1276 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1277 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1278 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1279 |
+
72
|
| 1280 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1281 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1282 |
+
00009821981C6F4198269837984E98539873986298599865986C9870864D8654
|
| 1283 |
+
866C87E38806867A867C867B86A8868D868B8706869D86A786A386AA869386A9
|
| 1284 |
+
86B686C486B5882386B086BA86B186AF86C987F686B486E986FA87EF86ED8784
|
| 1285 |
+
86D0871386DE881086DF86D886D18703870786F88708870A870D87098723873B
|
| 1286 |
+
871E8725872E871A873E87C88734873187298737873F87828722877D8811877B
|
| 1287 |
+
87608770874C876E878B8753876387BB876487598765879387AF87CE87D20000
|
| 1288 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1289 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1290 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1291 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1292 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1293 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1294 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1295 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1296 |
+
73
|
| 1297 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1298 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1299 |
+
000087C68788878587AD8797878387AB87E587AC87B587B387CB87D387BD87D1
|
| 1300 |
+
87C087CA87DB87EA87E087EE8816881387FE880A881B88218839883C7F367F4C
|
| 1301 |
+
7F447F4582107AFA7AFD7B087BE47B047B677B0A7B2B7B0F7B477B387B2A7B19
|
| 1302 |
+
7B2E7B317B207B257B247B337C697B1E7B587BF37B457B757B4C7B8F7B607B6E
|
| 1303 |
+
7B7B7B627B727B717B907C007BCB7BB87BAC7B9D7C5C7B857C1E7B9C7BA27C2B
|
| 1304 |
+
7BB47C237BC17BCC7BDD7BDA7BE57BE67BEA7C0C7BFE7BFC7C0F7C6A7C0B0000
|
| 1305 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1306 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1307 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1308 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1309 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1310 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1311 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1312 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1313 |
+
74
|
| 1314 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1315 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1316 |
+
00007C1F7C2A7C267C387C5F7C4081FE82018202820481EC8844822182228264
|
| 1317 |
+
822D822F8228822B8238826B82338234823E82448249824B824F825A825F8268
|
| 1318 |
+
887E88CA888888D888DF895E7F9D7FA57FA77FAF7FB07FB27C7C65497C917CF2
|
| 1319 |
+
7CF67C9E7CA27CB27CBC7CBD7CDD7CC77CCC7CCD7CC87CC57CD77CE8826E66A8
|
| 1320 |
+
7FBF7FCE7FD57FE57FE17FE67FE97FEE7FF37CF87E367DA67DAE7E477E9B9EA9
|
| 1321 |
+
9EB48D738D848D948D918DB28D678D6D8C478C49914A9150914E914F91640000
|
| 1322 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1323 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1324 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1325 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1326 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1327 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1328 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1329 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1330 |
+
75
|
| 1331 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1332 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1333 |
+
00009162916191709169916F91C591C3917291749179918C91859190918D9191
|
| 1334 |
+
91A291A391AA91AD91AE91AF91B591B491BA8C559E7A8E898DEB8E058E598E69
|
| 1335 |
+
8DB58DBF8DBC8DBA8E4C8DD68DD78DDA8E928DCE8DCF8DDB8DC68DEC8E7A8E55
|
| 1336 |
+
8DE38E9A8E8B8DE48E098DFD8E148E1D8E1F8E938E2E8E238E918E3A8E408E39
|
| 1337 |
+
8E358E3D8E318E498E418E428EA18E638E4A8E708E768E7C8E6F8E748E858EAA
|
| 1338 |
+
8E948E908EA68E9E8C788C828C8A8C858C988C94659B89D689F489DA89DC0000
|
| 1339 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1340 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1341 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1342 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1343 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1344 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1345 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1346 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1347 |
+
76
|
| 1348 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1349 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1350 |
+
000089E589EB89F68A3E8B26975A96E9974296EF9706973D9708970F970E972A
|
| 1351 |
+
97449730973E9F549F5F9F599F609F5C9F669F6C9F6A9F779EFD9EFF9F0996B9
|
| 1352 |
+
96BC96BD96CE96D277BF8B8E928E947E92C893E8936A93CA938F943E946B9B77
|
| 1353 |
+
9B749B819B839B8E9C787A4C9B929C5F9B909BAD9B9A9BAA9B9E9C6D9BAB9B9D
|
| 1354 |
+
9C589BC19C7A9C319C399C239C379BC09BCA9BC79BFD9BD69BEA9BEB9BE19BE4
|
| 1355 |
+
9BE79BDD9BE29BF09BDB9BF49BD49C5D9C089C109C0D9C129C099BFF9C200000
|
| 1356 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1357 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1358 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1359 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1360 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1361 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1362 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1363 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1364 |
+
77
|
| 1365 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1366 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1367 |
+
00009C329C2D9C289C259C299C339C3E9C489C3B9C359C459C569C549C529C67
|
| 1368 |
+
977C978597C397BD979497C997AB97A397B297B49AB19AB09AB79DBB9AB69ABA
|
| 1369 |
+
9ABC9AC19AC09ACF9AC29AD69AD59AD19B459B439B589B4E9B489B4D9B519957
|
| 1370 |
+
995C992E995599549ADF9AE19AE69AEF9AEB9AFB9AED9AF99B089B0F9B229B1F
|
| 1371 |
+
9B234E489EBE7E3B9E829E879E889E8B9E9293D69E9D9E9F9EDB9EDC9EDD9EE0
|
| 1372 |
+
9EDF9EE29EF79EE79EE59EF29EEF9F229F2C9F2F9F399F379F3D9F3E9F440000
|
| 1373 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1374 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1375 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1376 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1377 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1378 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1379 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1380 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1381 |
+
78
|
| 1382 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1383 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1384 |
+
0000896C95C693365F4685147E94538251B24E119F635679515A6DC09F156597
|
| 1385 |
+
56419AEE83034E3089075E727A4098B35E7F95A49B0D52128FF45F597A6B98E2
|
| 1386 |
+
51E050A24EF7835085915118636E6372524B5938774F8721814A7E8D91CC66C6
|
| 1387 |
+
5E1877AD9E7556C99EF46FDB61DE77C770309EB5884A95E282F951ED62514EC6
|
| 1388 |
+
673497C67C647E3497A69EAF786E820D672F677E56CC53F098B16AAF7F4E6D82
|
| 1389 |
+
7CF04E074FC27E6B9E7956AE9B1A846F53F690C179A67C72613F4E919AD20000
|
| 1390 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1391 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1392 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1393 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1394 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1395 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1396 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1397 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1398 |
+
79
|
| 1399 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1400 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1401 |
+
000075C796BB53EA7DFB88FD79CD78437B5151C6000000000000000000000000
|
| 1402 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1403 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1404 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1405 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1406 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1407 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1408 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1409 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1410 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1411 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1412 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1413 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
| 1414 |
+
0000000000000000000000000000000000000000000000000000000000000000
|
shared/package-files/0c/0c11a425195e3e8ba1e86ee002716cda3a0ec653c88187a7946c79402380e793/Conda.psm1
ADDED
|
@@ -0,0 +1,271 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
param([parameter(Position=0,Mandatory=$false)] [Hashtable] $CondaModuleArgs=@{})
|
| 2 |
+
|
| 3 |
+
# Defaults from before we had arguments.
|
| 4 |
+
if (-not $CondaModuleArgs.ContainsKey('ChangePs1')) {
|
| 5 |
+
$CondaModuleArgs.ChangePs1 = $True
|
| 6 |
+
}
|
| 7 |
+
|
| 8 |
+
## ENVIRONMENT MANAGEMENT ######################################################
|
| 9 |
+
|
| 10 |
+
<#
|
| 11 |
+
.SYNOPSIS
|
| 12 |
+
Obtains a list of valid conda environments.
|
| 13 |
+
|
| 14 |
+
.EXAMPLE
|
| 15 |
+
Get-CondaEnvironment
|
| 16 |
+
|
| 17 |
+
.EXAMPLE
|
| 18 |
+
genv
|
| 19 |
+
#>
|
| 20 |
+
function Get-CondaEnvironment {
|
| 21 |
+
[CmdletBinding()]
|
| 22 |
+
param();
|
| 23 |
+
|
| 24 |
+
begin {}
|
| 25 |
+
|
| 26 |
+
process {
|
| 27 |
+
# NB: the JSON output of conda env list does not include the names
|
| 28 |
+
# of each env, so we need to parse the fragile output instead.
|
| 29 |
+
& $Env:CONDA_EXE $Env:_CE_M $Env:_CE_CONDA env list | `
|
| 30 |
+
Where-Object { -not $_.StartsWith("#") } | `
|
| 31 |
+
Where-Object { -not $_.Trim().Length -eq 0 } | `
|
| 32 |
+
ForEach-Object {
|
| 33 |
+
$envLine = $_ -split "\s+";
|
| 34 |
+
$Active = $envLine[1] -eq "*";
|
| 35 |
+
[PSCustomObject] @{
|
| 36 |
+
Name = $envLine[0];
|
| 37 |
+
Active = $Active;
|
| 38 |
+
Path = if ($Active) {$envLine[2]} else {$envLine[1]};
|
| 39 |
+
} | Write-Output;
|
| 40 |
+
}
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
end {}
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
<#
|
| 47 |
+
.SYNOPSIS
|
| 48 |
+
Activates a conda environment, placing its commands and packages at
|
| 49 |
+
the head of $Env:PATH.
|
| 50 |
+
|
| 51 |
+
.EXAMPLE
|
| 52 |
+
Enter-CondaEnvironment base
|
| 53 |
+
|
| 54 |
+
.EXAMPLE
|
| 55 |
+
etenv base
|
| 56 |
+
|
| 57 |
+
.NOTES
|
| 58 |
+
This command does not currently support activating environments stored
|
| 59 |
+
in a non-standard location.
|
| 60 |
+
#>
|
| 61 |
+
function Enter-CondaEnvironment {
|
| 62 |
+
[CmdletBinding()]
|
| 63 |
+
param(
|
| 64 |
+
[Parameter(Mandatory=$false)][switch]$Stack,
|
| 65 |
+
[Parameter(Position=0)][string]$Name
|
| 66 |
+
);
|
| 67 |
+
|
| 68 |
+
begin {
|
| 69 |
+
If ($Stack) {
|
| 70 |
+
$activateCommand = (& $Env:CONDA_EXE $Env:_CE_M $Env:_CE_CONDA shell.powershell activate --stack $Name | Out-String);
|
| 71 |
+
} Else {
|
| 72 |
+
$activateCommand = (& $Env:CONDA_EXE $Env:_CE_M $Env:_CE_CONDA shell.powershell activate $Name | Out-String);
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
Write-Verbose "[conda shell.powershell activate $Name]`n$activateCommand";
|
| 76 |
+
Invoke-Expression -Command $activateCommand;
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
process {}
|
| 80 |
+
|
| 81 |
+
end {}
|
| 82 |
+
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
<#
|
| 86 |
+
.SYNOPSIS
|
| 87 |
+
Deactivates the current conda environment, if any.
|
| 88 |
+
|
| 89 |
+
.EXAMPLE
|
| 90 |
+
Exit-CondaEnvironment
|
| 91 |
+
|
| 92 |
+
.EXAMPLE
|
| 93 |
+
exenv
|
| 94 |
+
#>
|
| 95 |
+
function Exit-CondaEnvironment {
|
| 96 |
+
[CmdletBinding()]
|
| 97 |
+
param();
|
| 98 |
+
|
| 99 |
+
begin {
|
| 100 |
+
$deactivateCommand = (& $Env:CONDA_EXE $Env:_CE_M $Env:_CE_CONDA shell.powershell deactivate | Out-String);
|
| 101 |
+
|
| 102 |
+
# If deactivate returns an empty string, we have nothing more to do,
|
| 103 |
+
# so return early.
|
| 104 |
+
if ($deactivateCommand.Trim().Length -eq 0) {
|
| 105 |
+
return;
|
| 106 |
+
}
|
| 107 |
+
Write-Verbose "[conda shell.powershell deactivate]`n$deactivateCommand";
|
| 108 |
+
Invoke-Expression -Command $deactivateCommand;
|
| 109 |
+
}
|
| 110 |
+
process {}
|
| 111 |
+
end {}
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
## CONDA WRAPPER ###############################################################
|
| 115 |
+
|
| 116 |
+
<#
|
| 117 |
+
.SYNOPSIS
|
| 118 |
+
conda is a tool for managing and deploying applications, environments
|
| 119 |
+
and packages.
|
| 120 |
+
|
| 121 |
+
.PARAMETER Command
|
| 122 |
+
Subcommand to invoke.
|
| 123 |
+
|
| 124 |
+
.EXAMPLE
|
| 125 |
+
conda install toolz
|
| 126 |
+
#>
|
| 127 |
+
function Invoke-Conda() {
|
| 128 |
+
# Don't use any explicit args here, we'll use $args and tab completion
|
| 129 |
+
# so that we can capture everything, INCLUDING short options (e.g. -n).
|
| 130 |
+
if ($Args.Count -eq 0) {
|
| 131 |
+
# No args, just call the underlying conda executable.
|
| 132 |
+
& $Env:CONDA_EXE $Env:_CE_M $Env:_CE_CONDA;
|
| 133 |
+
}
|
| 134 |
+
else {
|
| 135 |
+
$Command = $Args[0];
|
| 136 |
+
if ($Args.Count -ge 2) {
|
| 137 |
+
$OtherArgs = $Args[1..($Args.Count - 1)];
|
| 138 |
+
} else {
|
| 139 |
+
$OtherArgs = @();
|
| 140 |
+
}
|
| 141 |
+
switch ($Command) {
|
| 142 |
+
"activate" {
|
| 143 |
+
Enter-CondaEnvironment @OtherArgs;
|
| 144 |
+
}
|
| 145 |
+
"deactivate" {
|
| 146 |
+
Exit-CondaEnvironment;
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
default {
|
| 150 |
+
# There may be a command we don't know want to handle
|
| 151 |
+
# differently in the shell wrapper, pass it through
|
| 152 |
+
# verbatim.
|
| 153 |
+
& $Env:CONDA_EXE $Env:_CE_M $Env:_CE_CONDA $Command @OtherArgs;
|
| 154 |
+
}
|
| 155 |
+
}
|
| 156 |
+
}
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
## TAB COMPLETION ##############################################################
|
| 160 |
+
# We borrow the approach used by posh-git, in which we override any existing
|
| 161 |
+
# functions named TabExpansion, look for commands we can complete on, and then
|
| 162 |
+
# default to the previously defined TabExpansion function for everything else.
|
| 163 |
+
|
| 164 |
+
if (Test-Path Function:\TabExpansion) {
|
| 165 |
+
# Since this technique is common, we encounter an infinite loop if it's
|
| 166 |
+
# used more than once unless we give our backup a unique name.
|
| 167 |
+
Rename-Item Function:\TabExpansion CondaTabExpansionBackup
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
function Expand-CondaEnv() {
|
| 171 |
+
param(
|
| 172 |
+
[string]
|
| 173 |
+
$Filter
|
| 174 |
+
);
|
| 175 |
+
|
| 176 |
+
$ValidEnvs = Get-CondaEnvironment;
|
| 177 |
+
$ValidEnvs `
|
| 178 |
+
| Where-Object { $_.Name -like "$filter*" } `
|
| 179 |
+
| ForEach-Object { $_.Name } `
|
| 180 |
+
| Write-Output;
|
| 181 |
+
$ValidEnvs `
|
| 182 |
+
| Where-Object { $_.Path -like "$filter*" } `
|
| 183 |
+
| ForEach-Object { $_.Path } `
|
| 184 |
+
| Write-Output;
|
| 185 |
+
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
function Expand-CondaSubcommands() {
|
| 189 |
+
param(
|
| 190 |
+
[string]
|
| 191 |
+
$Filter
|
| 192 |
+
);
|
| 193 |
+
|
| 194 |
+
$ValidCommands = Invoke-Conda shell.powershell commands;
|
| 195 |
+
|
| 196 |
+
# Add in the commands defined within this wrapper, filter, sort, and return.
|
| 197 |
+
$ValidCommands + @('activate', 'deactivate') `
|
| 198 |
+
| Where-Object { $_ -like "$Filter*" } `
|
| 199 |
+
| Sort-Object `
|
| 200 |
+
| Write-Output;
|
| 201 |
+
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
function TabExpansion($line, $lastWord) {
|
| 205 |
+
$lastBlock = [regex]::Split($line, '[|;]')[-1].TrimStart()
|
| 206 |
+
|
| 207 |
+
switch -regex ($lastBlock) {
|
| 208 |
+
# Pull out conda commands we recognize first before falling through
|
| 209 |
+
# to the general patterns for conda itself.
|
| 210 |
+
"^conda activate (.*)" { Expand-CondaEnv $lastWord; break; }
|
| 211 |
+
"^etenv (.*)" { Expand-CondaEnv $lastWord; break; }
|
| 212 |
+
|
| 213 |
+
# If we got down to here, check arguments to conda itself.
|
| 214 |
+
"^conda (.*)" { Expand-CondaSubcommands $lastWord; break; }
|
| 215 |
+
|
| 216 |
+
# Finally, fall back on existing tab expansion.
|
| 217 |
+
default {
|
| 218 |
+
if (Test-Path Function:\CondaTabExpansionBackup) {
|
| 219 |
+
CondaTabExpansionBackup $line $lastWord
|
| 220 |
+
}
|
| 221 |
+
}
|
| 222 |
+
}
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
## PROMPT MANAGEMENT ###########################################################
|
| 226 |
+
|
| 227 |
+
<#
|
| 228 |
+
.SYNOPSIS
|
| 229 |
+
Modifies the current prompt to show the currently activated conda
|
| 230 |
+
environment, if any.
|
| 231 |
+
.EXAMPLE
|
| 232 |
+
Add-CondaEnvironmentToPrompt
|
| 233 |
+
|
| 234 |
+
Causes the current session's prompt to display the currently activated
|
| 235 |
+
conda environment.
|
| 236 |
+
#>
|
| 237 |
+
if ($CondaModuleArgs.ChangePs1) {
|
| 238 |
+
# We use the same procedure to nest prompts as we did for nested tab completion.
|
| 239 |
+
if (Test-Path Function:\prompt) {
|
| 240 |
+
Rename-Item Function:\prompt CondaPromptBackup
|
| 241 |
+
} else {
|
| 242 |
+
function CondaPromptBackup() {
|
| 243 |
+
# Restore a basic prompt if the definition is missing.
|
| 244 |
+
"PS $($executionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) ";
|
| 245 |
+
}
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
function global:prompt() {
|
| 249 |
+
if ($Env:CONDA_PROMPT_MODIFIER) {
|
| 250 |
+
$Env:CONDA_PROMPT_MODIFIER | Write-Host -NoNewline
|
| 251 |
+
}
|
| 252 |
+
CondaPromptBackup;
|
| 253 |
+
}
|
| 254 |
+
}
|
| 255 |
+
|
| 256 |
+
## ALIASES #####################################################################
|
| 257 |
+
|
| 258 |
+
New-Alias conda Invoke-Conda -Force
|
| 259 |
+
New-Alias genv Get-CondaEnvironment -Force
|
| 260 |
+
New-Alias etenv Enter-CondaEnvironment -Force
|
| 261 |
+
New-Alias exenv Exit-CondaEnvironment -Force
|
| 262 |
+
|
| 263 |
+
## EXPORTS ###################################################################
|
| 264 |
+
|
| 265 |
+
Export-ModuleMember `
|
| 266 |
+
-Alias * `
|
| 267 |
+
-Function `
|
| 268 |
+
Invoke-Conda, `
|
| 269 |
+
Get-CondaEnvironment, `
|
| 270 |
+
Enter-CondaEnvironment, Exit-CondaEnvironment, `
|
| 271 |
+
TabExpansion, prompt
|
shared/package-files/0c/0c12ae80850415330fee0ea22f56e4f7ce84ea5742adc35d04258e25b4256bf6/test_function_base.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
shared/package-files/0c/0c15552da76e6541d25a5289e5a0579b181d366fd88cbbd68328934dc42ad387/test_cdft_asymptotic.py
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# gh-14777 regression tests
|
| 2 |
+
# Test stdtr and stdtrit with infinite df and large values of df
|
| 3 |
+
|
| 4 |
+
import numpy as np
|
| 5 |
+
from numpy.testing import assert_allclose, assert_equal
|
| 6 |
+
from scipy.special import stdtr, stdtrit, ndtr, ndtri
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
def test_stdtr_vs_R_large_df():
|
| 10 |
+
df = [1e10, 1e12, 1e120, np.inf]
|
| 11 |
+
t = 1.
|
| 12 |
+
res = stdtr(df, t)
|
| 13 |
+
# R Code:
|
| 14 |
+
# options(digits=20)
|
| 15 |
+
# pt(1., c(1e10, 1e12, 1e120, Inf))
|
| 16 |
+
res_R = [0.84134474605644460343,
|
| 17 |
+
0.84134474606842180044,
|
| 18 |
+
0.84134474606854281475,
|
| 19 |
+
0.84134474606854292578]
|
| 20 |
+
assert_allclose(res, res_R, rtol=2e-15)
|
| 21 |
+
# last value should also agree with ndtr
|
| 22 |
+
assert_equal(res[3], ndtr(1.))
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def test_stdtrit_vs_R_large_df():
|
| 26 |
+
df = [1e10, 1e12, 1e120, np.inf]
|
| 27 |
+
p = 0.1
|
| 28 |
+
res = stdtrit(df, p)
|
| 29 |
+
# R Code:
|
| 30 |
+
# options(digits=20)
|
| 31 |
+
# qt(0.1, c(1e10, 1e12, 1e120, Inf))
|
| 32 |
+
res_R = [-1.2815515656292593150,
|
| 33 |
+
-1.2815515655454472466,
|
| 34 |
+
-1.2815515655446008125,
|
| 35 |
+
-1.2815515655446008125]
|
| 36 |
+
assert_allclose(res, res_R, rtol=1e-14, atol=1e-15)
|
| 37 |
+
# last value should also agree with ndtri
|
| 38 |
+
assert_equal(res[3], ndtri(0.1))
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
def test_stdtr_stdtri_invalid():
|
| 42 |
+
# a mix of large and inf df with t/p equal to nan
|
| 43 |
+
df = [1e10, 1e12, 1e120, np.inf]
|
| 44 |
+
x = np.nan
|
| 45 |
+
res1 = stdtr(df, x)
|
| 46 |
+
res2 = stdtrit(df, x)
|
| 47 |
+
res_ex = 4*[np.nan]
|
| 48 |
+
assert_equal(res1, res_ex)
|
| 49 |
+
assert_equal(res2, res_ex)
|
shared/package-files/0c/0c1580ed02b4765ba89278a8b8e8b3675879a0021c5a2e3b37b8ba5224834625/console.pyi
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import code
|
| 2 |
+
from typing import Any, Optional
|
| 3 |
+
|
| 4 |
+
class HTMLStringO:
|
| 5 |
+
def __init__(self): ...
|
| 6 |
+
def isatty(self): ...
|
| 7 |
+
def close(self): ...
|
| 8 |
+
def flush(self): ...
|
| 9 |
+
def seek(self, n, mode: int = ...): ...
|
| 10 |
+
def readline(self): ...
|
| 11 |
+
def reset(self): ...
|
| 12 |
+
def write(self, x): ...
|
| 13 |
+
def writelines(self, x): ...
|
| 14 |
+
|
| 15 |
+
class ThreadedStream:
|
| 16 |
+
@staticmethod
|
| 17 |
+
def push(): ...
|
| 18 |
+
@staticmethod
|
| 19 |
+
def fetch(): ...
|
| 20 |
+
@staticmethod
|
| 21 |
+
def displayhook(obj): ...
|
| 22 |
+
def __setattr__(self, name, value): ...
|
| 23 |
+
def __dir__(self): ...
|
| 24 |
+
def __getattribute__(self, name): ...
|
| 25 |
+
|
| 26 |
+
class _ConsoleLoader:
|
| 27 |
+
def __init__(self): ...
|
| 28 |
+
def register(self, code, source): ...
|
| 29 |
+
def get_source_by_code(self, code): ...
|
| 30 |
+
|
| 31 |
+
class _InteractiveConsole(code.InteractiveInterpreter):
|
| 32 |
+
globals: Any
|
| 33 |
+
more: Any
|
| 34 |
+
buffer: Any
|
| 35 |
+
def __init__(self, globals, locals): ...
|
| 36 |
+
def runsource(self, source): ...
|
| 37 |
+
def runcode(self, code): ...
|
| 38 |
+
def showtraceback(self): ...
|
| 39 |
+
def showsyntaxerror(self, filename: Optional[Any] = ...): ...
|
| 40 |
+
def write(self, data): ...
|
| 41 |
+
|
| 42 |
+
class Console:
|
| 43 |
+
def __init__(self, globals: Optional[Any] = ..., locals: Optional[Any] = ...): ...
|
| 44 |
+
def eval(self, code): ...
|
shared/package-files/0c/0c15ad816413e201d7ee66f88998d185f0cc11f728586cc8ca710e050a76719e/random_clustered.py
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Generate graphs with given degree and triangle sequence.
|
| 2 |
+
"""
|
| 3 |
+
import networkx as nx
|
| 4 |
+
from networkx.utils import py_random_state
|
| 5 |
+
|
| 6 |
+
__all__ = ["random_clustered_graph"]
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
@py_random_state(2)
|
| 10 |
+
def random_clustered_graph(joint_degree_sequence, create_using=None, seed=None):
|
| 11 |
+
r"""Generate a random graph with the given joint independent edge degree and
|
| 12 |
+
triangle degree sequence.
|
| 13 |
+
|
| 14 |
+
This uses a configuration model-like approach to generate a random graph
|
| 15 |
+
(with parallel edges and self-loops) by randomly assigning edges to match
|
| 16 |
+
the given joint degree sequence.
|
| 17 |
+
|
| 18 |
+
The joint degree sequence is a list of pairs of integers of the form
|
| 19 |
+
$[(d_{1,i}, d_{1,t}), \dotsc, (d_{n,i}, d_{n,t})]$. According to this list,
|
| 20 |
+
vertex $u$ is a member of $d_{u,t}$ triangles and has $d_{u, i}$ other
|
| 21 |
+
edges. The number $d_{u,t}$ is the *triangle degree* of $u$ and the number
|
| 22 |
+
$d_{u,i}$ is the *independent edge degree*.
|
| 23 |
+
|
| 24 |
+
Parameters
|
| 25 |
+
----------
|
| 26 |
+
joint_degree_sequence : list of integer pairs
|
| 27 |
+
Each list entry corresponds to the independent edge degree and
|
| 28 |
+
triangle degree of a node.
|
| 29 |
+
create_using : NetworkX graph constructor, optional (default MultiGraph)
|
| 30 |
+
Graph type to create. If graph instance, then cleared before populated.
|
| 31 |
+
seed : integer, random_state, or None (default)
|
| 32 |
+
Indicator of random number generation state.
|
| 33 |
+
See :ref:`Randomness<randomness>`.
|
| 34 |
+
|
| 35 |
+
Returns
|
| 36 |
+
-------
|
| 37 |
+
G : MultiGraph
|
| 38 |
+
A graph with the specified degree sequence. Nodes are labeled
|
| 39 |
+
starting at 0 with an index corresponding to the position in
|
| 40 |
+
deg_sequence.
|
| 41 |
+
|
| 42 |
+
Raises
|
| 43 |
+
------
|
| 44 |
+
NetworkXError
|
| 45 |
+
If the independent edge degree sequence sum is not even
|
| 46 |
+
or the triangle degree sequence sum is not divisible by 3.
|
| 47 |
+
|
| 48 |
+
Notes
|
| 49 |
+
-----
|
| 50 |
+
As described by Miller [1]_ (see also Newman [2]_ for an equivalent
|
| 51 |
+
description).
|
| 52 |
+
|
| 53 |
+
A non-graphical degree sequence (not realizable by some simple
|
| 54 |
+
graph) is allowed since this function returns graphs with self
|
| 55 |
+
loops and parallel edges. An exception is raised if the
|
| 56 |
+
independent degree sequence does not have an even sum or the
|
| 57 |
+
triangle degree sequence sum is not divisible by 3.
|
| 58 |
+
|
| 59 |
+
This configuration model-like construction process can lead to
|
| 60 |
+
duplicate edges and loops. You can remove the self-loops and
|
| 61 |
+
parallel edges (see below) which will likely result in a graph
|
| 62 |
+
that doesn't have the exact degree sequence specified. This
|
| 63 |
+
"finite-size effect" decreases as the size of the graph increases.
|
| 64 |
+
|
| 65 |
+
References
|
| 66 |
+
----------
|
| 67 |
+
.. [1] Joel C. Miller. "Percolation and epidemics in random clustered
|
| 68 |
+
networks". In: Physical review. E, Statistical, nonlinear, and soft
|
| 69 |
+
matter physics 80 (2 Part 1 August 2009).
|
| 70 |
+
.. [2] M. E. J. Newman. "Random Graphs with Clustering".
|
| 71 |
+
In: Physical Review Letters 103 (5 July 2009)
|
| 72 |
+
|
| 73 |
+
Examples
|
| 74 |
+
--------
|
| 75 |
+
>>> deg = [(1, 0), (1, 0), (1, 0), (2, 0), (1, 0), (2, 1), (0, 1), (0, 1)]
|
| 76 |
+
>>> G = nx.random_clustered_graph(deg)
|
| 77 |
+
|
| 78 |
+
To remove parallel edges:
|
| 79 |
+
|
| 80 |
+
>>> G = nx.Graph(G)
|
| 81 |
+
|
| 82 |
+
To remove self loops:
|
| 83 |
+
|
| 84 |
+
>>> G.remove_edges_from(nx.selfloop_edges(G))
|
| 85 |
+
|
| 86 |
+
"""
|
| 87 |
+
# In Python 3, zip() returns an iterator. Make this into a list.
|
| 88 |
+
joint_degree_sequence = list(joint_degree_sequence)
|
| 89 |
+
|
| 90 |
+
N = len(joint_degree_sequence)
|
| 91 |
+
G = nx.empty_graph(N, create_using, default=nx.MultiGraph)
|
| 92 |
+
if G.is_directed():
|
| 93 |
+
raise nx.NetworkXError("Directed Graph not supported")
|
| 94 |
+
|
| 95 |
+
ilist = []
|
| 96 |
+
tlist = []
|
| 97 |
+
for n in G:
|
| 98 |
+
degrees = joint_degree_sequence[n]
|
| 99 |
+
for icount in range(degrees[0]):
|
| 100 |
+
ilist.append(n)
|
| 101 |
+
for tcount in range(degrees[1]):
|
| 102 |
+
tlist.append(n)
|
| 103 |
+
|
| 104 |
+
if len(ilist) % 2 != 0 or len(tlist) % 3 != 0:
|
| 105 |
+
raise nx.NetworkXError("Invalid degree sequence")
|
| 106 |
+
|
| 107 |
+
seed.shuffle(ilist)
|
| 108 |
+
seed.shuffle(tlist)
|
| 109 |
+
while ilist:
|
| 110 |
+
G.add_edge(ilist.pop(), ilist.pop())
|
| 111 |
+
while tlist:
|
| 112 |
+
n1 = tlist.pop()
|
| 113 |
+
n2 = tlist.pop()
|
| 114 |
+
n3 = tlist.pop()
|
| 115 |
+
G.add_edges_from([(n1, n2), (n1, n3), (n2, n3)])
|
| 116 |
+
return G
|
shared/package-files/0c/0c15dd9c87b6f2fadb7f80be6abed981e1486b49060f8a43049e183fecf84074/nodata.arff
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@RELATION iris
|
| 2 |
+
|
| 3 |
+
@ATTRIBUTE sepallength REAL
|
| 4 |
+
@ATTRIBUTE sepalwidth REAL
|
| 5 |
+
@ATTRIBUTE petallength REAL
|
| 6 |
+
@ATTRIBUTE petalwidth REAL
|
| 7 |
+
@ATTRIBUTE class {Iris-setosa,Iris-versicolor,Iris-virginica}
|
| 8 |
+
|
| 9 |
+
@DATA
|
| 10 |
+
|
| 11 |
+
% This file has no data
|
shared/package-files/0c/0c1cd30fcdcc877a1a71f6737d4e9f42e182f3b82fb67186683b9ef2cf4cd16b/uuid.h
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include "arrow/extension_type.h"
|
| 21 |
+
|
| 22 |
+
namespace arrow::extension {
|
| 23 |
+
|
| 24 |
+
/// \brief UuidArray stores array of UUIDs. Underlying storage type is
|
| 25 |
+
/// FixedSizeBinary(16).
|
| 26 |
+
class ARROW_EXPORT UuidArray : public ExtensionArray {
|
| 27 |
+
public:
|
| 28 |
+
using ExtensionArray::ExtensionArray;
|
| 29 |
+
};
|
| 30 |
+
|
| 31 |
+
/// \brief UuidType is a canonical arrow extension type for UUIDs.
|
| 32 |
+
/// UUIDs are stored as FixedSizeBinary(16) with big-endian notation and this
|
| 33 |
+
/// does not interpret the bytes in any way. Specific UUID version is not
|
| 34 |
+
/// required or guaranteed.
|
| 35 |
+
class ARROW_EXPORT UuidType : public ExtensionType {
|
| 36 |
+
public:
|
| 37 |
+
/// \brief Construct a UuidType.
|
| 38 |
+
UuidType() : ExtensionType(fixed_size_binary(16)) {}
|
| 39 |
+
|
| 40 |
+
std::string extension_name() const override { return "arrow.uuid"; }
|
| 41 |
+
std::string ToString(bool show_metadata = false) const override;
|
| 42 |
+
|
| 43 |
+
bool ExtensionEquals(const ExtensionType& other) const override;
|
| 44 |
+
|
| 45 |
+
/// Create a UuidArray from ArrayData
|
| 46 |
+
std::shared_ptr<Array> MakeArray(std::shared_ptr<ArrayData> data) const override;
|
| 47 |
+
|
| 48 |
+
Result<std::shared_ptr<DataType>> Deserialize(
|
| 49 |
+
std::shared_ptr<DataType> storage_type,
|
| 50 |
+
const std::string& serialized) const override;
|
| 51 |
+
|
| 52 |
+
std::string Serialize() const override { return ""; }
|
| 53 |
+
|
| 54 |
+
/// \brief Create a UuidType instance
|
| 55 |
+
static Result<std::shared_ptr<DataType>> Make() { return std::make_shared<UuidType>(); }
|
| 56 |
+
|
| 57 |
+
static bool IsSupportedStorageType(const std::shared_ptr<DataType>& storage_type);
|
| 58 |
+
};
|
| 59 |
+
|
| 60 |
+
/// \brief Return a UuidType instance.
|
| 61 |
+
ARROW_EXPORT std::shared_ptr<DataType> uuid();
|
| 62 |
+
|
| 63 |
+
} // namespace arrow::extension
|
shared/package-files/0c/0c2152360d3ce31214f7ff496a3d8e61b6d9b4b85e0af08d02fe49d16d0ecfbe/hann_window_compositeexplicitautograd_dispatch.h
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 3 |
+
|
| 4 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 5 |
+
|
| 6 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 7 |
+
#include <c10/core/MemoryFormat.h>
|
| 8 |
+
#include <c10/core/Scalar.h>
|
| 9 |
+
#include <ATen/core/Reduction.h>
|
| 10 |
+
|
| 11 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 12 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 13 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 14 |
+
#include <ATen/core/ATen_fwd.h>
|
| 15 |
+
|
| 16 |
+
namespace at {
|
| 17 |
+
|
| 18 |
+
namespace compositeexplicitautograd {
|
| 19 |
+
|
| 20 |
+
TORCH_API at::Tensor hann_window(int64_t window_length, at::TensorOptions options={});
|
| 21 |
+
TORCH_API at::Tensor hann_window(int64_t window_length, c10::optional<at::ScalarType> dtype, c10::optional<at::Layout> layout, c10::optional<at::Device> device, c10::optional<bool> pin_memory);
|
| 22 |
+
TORCH_API at::Tensor & hann_window_out(at::Tensor & out, int64_t window_length);
|
| 23 |
+
TORCH_API at::Tensor & hann_window_outf(int64_t window_length, at::Tensor & out);
|
| 24 |
+
TORCH_API at::Tensor hann_window(int64_t window_length, bool periodic, at::TensorOptions options={});
|
| 25 |
+
TORCH_API at::Tensor hann_window(int64_t window_length, bool periodic, c10::optional<at::ScalarType> dtype, c10::optional<at::Layout> layout, c10::optional<at::Device> device, c10::optional<bool> pin_memory);
|
| 26 |
+
TORCH_API at::Tensor & hann_window_out(at::Tensor & out, int64_t window_length, bool periodic);
|
| 27 |
+
TORCH_API at::Tensor & hann_window_outf(int64_t window_length, bool periodic, at::Tensor & out);
|
| 28 |
+
|
| 29 |
+
} // namespace compositeexplicitautograd
|
| 30 |
+
} // namespace at
|
shared/package-files/0c/0c215ffc3b7970db2e4962676100067c9af1d72d99d064224938746a34098630/test_to_timestamp.py
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from datetime import datetime
|
| 2 |
+
|
| 3 |
+
import numpy as np
|
| 4 |
+
import pytest
|
| 5 |
+
|
| 6 |
+
from pandas import (
|
| 7 |
+
DatetimeIndex,
|
| 8 |
+
NaT,
|
| 9 |
+
PeriodIndex,
|
| 10 |
+
Timedelta,
|
| 11 |
+
Timestamp,
|
| 12 |
+
date_range,
|
| 13 |
+
period_range,
|
| 14 |
+
)
|
| 15 |
+
import pandas._testing as tm
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
class TestToTimestamp:
|
| 19 |
+
def test_to_timestamp_non_contiguous(self):
|
| 20 |
+
# GH#44100
|
| 21 |
+
dti = date_range("2021-10-18", periods=9, freq="D")
|
| 22 |
+
pi = dti.to_period()
|
| 23 |
+
|
| 24 |
+
result = pi[::2].to_timestamp()
|
| 25 |
+
expected = dti[::2]
|
| 26 |
+
tm.assert_index_equal(result, expected)
|
| 27 |
+
|
| 28 |
+
result = pi._data[::2].to_timestamp()
|
| 29 |
+
expected = dti._data[::2]
|
| 30 |
+
# TODO: can we get the freq to round-trip?
|
| 31 |
+
tm.assert_datetime_array_equal(result, expected, check_freq=False)
|
| 32 |
+
|
| 33 |
+
result = pi[::-1].to_timestamp()
|
| 34 |
+
expected = dti[::-1]
|
| 35 |
+
tm.assert_index_equal(result, expected)
|
| 36 |
+
|
| 37 |
+
result = pi._data[::-1].to_timestamp()
|
| 38 |
+
expected = dti._data[::-1]
|
| 39 |
+
tm.assert_datetime_array_equal(result, expected, check_freq=False)
|
| 40 |
+
|
| 41 |
+
result = pi[::2][::-1].to_timestamp()
|
| 42 |
+
expected = dti[::2][::-1]
|
| 43 |
+
tm.assert_index_equal(result, expected)
|
| 44 |
+
|
| 45 |
+
result = pi._data[::2][::-1].to_timestamp()
|
| 46 |
+
expected = dti._data[::2][::-1]
|
| 47 |
+
tm.assert_datetime_array_equal(result, expected, check_freq=False)
|
| 48 |
+
|
| 49 |
+
def test_to_timestamp_freq(self):
|
| 50 |
+
idx = period_range("2017", periods=12, freq="Y-DEC")
|
| 51 |
+
result = idx.to_timestamp()
|
| 52 |
+
expected = date_range("2017", periods=12, freq="YS-JAN")
|
| 53 |
+
tm.assert_index_equal(result, expected)
|
| 54 |
+
|
| 55 |
+
def test_to_timestamp_pi_nat(self):
|
| 56 |
+
# GH#7228
|
| 57 |
+
index = PeriodIndex(["NaT", "2011-01", "2011-02"], freq="M", name="idx")
|
| 58 |
+
|
| 59 |
+
result = index.to_timestamp("D")
|
| 60 |
+
expected = DatetimeIndex(
|
| 61 |
+
[NaT, datetime(2011, 1, 1), datetime(2011, 2, 1)],
|
| 62 |
+
dtype="M8[ns]",
|
| 63 |
+
name="idx",
|
| 64 |
+
)
|
| 65 |
+
tm.assert_index_equal(result, expected)
|
| 66 |
+
assert result.name == "idx"
|
| 67 |
+
|
| 68 |
+
result2 = result.to_period(freq="M")
|
| 69 |
+
tm.assert_index_equal(result2, index)
|
| 70 |
+
assert result2.name == "idx"
|
| 71 |
+
|
| 72 |
+
result3 = result.to_period(freq="3M")
|
| 73 |
+
exp = PeriodIndex(["NaT", "2011-01", "2011-02"], freq="3M", name="idx")
|
| 74 |
+
tm.assert_index_equal(result3, exp)
|
| 75 |
+
assert result3.freqstr == "3M"
|
| 76 |
+
|
| 77 |
+
msg = "Frequency must be positive, because it represents span: -2Y"
|
| 78 |
+
with pytest.raises(ValueError, match=msg):
|
| 79 |
+
result.to_period(freq="-2Y")
|
| 80 |
+
|
| 81 |
+
def test_to_timestamp_preserve_name(self):
|
| 82 |
+
index = period_range(freq="Y", start="1/1/2001", end="12/1/2009", name="foo")
|
| 83 |
+
assert index.name == "foo"
|
| 84 |
+
|
| 85 |
+
conv = index.to_timestamp("D")
|
| 86 |
+
assert conv.name == "foo"
|
| 87 |
+
|
| 88 |
+
def test_to_timestamp_quarterly_bug(self):
|
| 89 |
+
years = np.arange(1960, 2000).repeat(4)
|
| 90 |
+
quarters = np.tile(list(range(1, 5)), 40)
|
| 91 |
+
|
| 92 |
+
pindex = PeriodIndex.from_fields(year=years, quarter=quarters)
|
| 93 |
+
|
| 94 |
+
stamps = pindex.to_timestamp("D", "end")
|
| 95 |
+
expected = DatetimeIndex([x.to_timestamp("D", "end") for x in pindex])
|
| 96 |
+
tm.assert_index_equal(stamps, expected)
|
| 97 |
+
assert stamps.freq == expected.freq
|
| 98 |
+
|
| 99 |
+
def test_to_timestamp_pi_mult(self):
|
| 100 |
+
idx = PeriodIndex(["2011-01", "NaT", "2011-02"], freq="2M", name="idx")
|
| 101 |
+
|
| 102 |
+
result = idx.to_timestamp()
|
| 103 |
+
expected = DatetimeIndex(
|
| 104 |
+
["2011-01-01", "NaT", "2011-02-01"], dtype="M8[ns]", name="idx"
|
| 105 |
+
)
|
| 106 |
+
tm.assert_index_equal(result, expected)
|
| 107 |
+
|
| 108 |
+
result = idx.to_timestamp(how="E")
|
| 109 |
+
expected = DatetimeIndex(
|
| 110 |
+
["2011-02-28", "NaT", "2011-03-31"], dtype="M8[ns]", name="idx"
|
| 111 |
+
)
|
| 112 |
+
expected = expected + Timedelta(1, "D") - Timedelta(1, "ns")
|
| 113 |
+
tm.assert_index_equal(result, expected)
|
| 114 |
+
|
| 115 |
+
def test_to_timestamp_pi_combined(self):
|
| 116 |
+
idx = period_range(start="2011", periods=2, freq="1D1h", name="idx")
|
| 117 |
+
|
| 118 |
+
result = idx.to_timestamp()
|
| 119 |
+
expected = DatetimeIndex(
|
| 120 |
+
["2011-01-01 00:00", "2011-01-02 01:00"], dtype="M8[ns]", name="idx"
|
| 121 |
+
)
|
| 122 |
+
tm.assert_index_equal(result, expected)
|
| 123 |
+
|
| 124 |
+
result = idx.to_timestamp(how="E")
|
| 125 |
+
expected = DatetimeIndex(
|
| 126 |
+
["2011-01-02 00:59:59", "2011-01-03 01:59:59"], name="idx", dtype="M8[ns]"
|
| 127 |
+
)
|
| 128 |
+
expected = expected + Timedelta(1, "s") - Timedelta(1, "ns")
|
| 129 |
+
tm.assert_index_equal(result, expected)
|
| 130 |
+
|
| 131 |
+
result = idx.to_timestamp(how="E", freq="h")
|
| 132 |
+
expected = DatetimeIndex(
|
| 133 |
+
["2011-01-02 00:00", "2011-01-03 01:00"], dtype="M8[ns]", name="idx"
|
| 134 |
+
)
|
| 135 |
+
expected = expected + Timedelta(1, "h") - Timedelta(1, "ns")
|
| 136 |
+
tm.assert_index_equal(result, expected)
|
| 137 |
+
|
| 138 |
+
def test_to_timestamp_1703(self):
|
| 139 |
+
index = period_range("1/1/2012", periods=4, freq="D")
|
| 140 |
+
|
| 141 |
+
result = index.to_timestamp()
|
| 142 |
+
assert result[0] == Timestamp("1/1/2012")
|
shared/package-files/0c/0c21d293265526a2b3535f6de026771f36d49019c5edb86d4bdeba473f7188f9/ViewFuncs.h
ADDED
|
@@ -0,0 +1,953 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
// @generated from ../tools/autograd/templates/ViewFuncs.h
|
| 4 |
+
|
| 5 |
+
#include <torch/library.h>
|
| 6 |
+
#include <torch/csrc/autograd/variable.h>
|
| 7 |
+
#include <c10/core/SymIntArrayRef.h>
|
| 8 |
+
|
| 9 |
+
#ifndef AT_PER_OPERATOR_HEADERS
|
| 10 |
+
#include <ATen/Operators.h>
|
| 11 |
+
#else
|
| 12 |
+
#include <ATen/ops/_conj_ops.h>
|
| 13 |
+
#include <ATen/ops/_indices_ops.h>
|
| 14 |
+
#include <ATen/ops/_neg_view_ops.h>
|
| 15 |
+
#include <ATen/ops/_nested_get_values_ops.h>
|
| 16 |
+
#include <ATen/ops/_nested_view_from_buffer_ops.h>
|
| 17 |
+
#include <ATen/ops/_nested_view_from_jagged_ops.h>
|
| 18 |
+
#include <ATen/ops/_reshape_alias_ops.h>
|
| 19 |
+
#include <ATen/ops/_test_autograd_multiple_dispatch_view_ops.h>
|
| 20 |
+
#include <ATen/ops/_values_ops.h>
|
| 21 |
+
#include <ATen/ops/alias_ops.h>
|
| 22 |
+
#include <ATen/ops/as_strided_ops.h>
|
| 23 |
+
#include <ATen/ops/ccol_indices_ops.h>
|
| 24 |
+
#include <ATen/ops/chunk_ops.h>
|
| 25 |
+
#include <ATen/ops/col_indices_ops.h>
|
| 26 |
+
#include <ATen/ops/crow_indices_ops.h>
|
| 27 |
+
#include <ATen/ops/diagonal_ops.h>
|
| 28 |
+
#include <ATen/ops/expand_ops.h>
|
| 29 |
+
#include <ATen/ops/indices_ops.h>
|
| 30 |
+
#include <ATen/ops/narrow_ops.h>
|
| 31 |
+
#include <ATen/ops/permute_ops.h>
|
| 32 |
+
#include <ATen/ops/row_indices_ops.h>
|
| 33 |
+
#include <ATen/ops/select_ops.h>
|
| 34 |
+
#include <ATen/ops/slice_ops.h>
|
| 35 |
+
#include <ATen/ops/slice_inverse_ops.h>
|
| 36 |
+
#include <ATen/ops/split_ops.h>
|
| 37 |
+
#include <ATen/ops/split_with_sizes_ops.h>
|
| 38 |
+
#include <ATen/ops/squeeze_ops.h>
|
| 39 |
+
#include <ATen/ops/squeeze_ops.h>
|
| 40 |
+
#include <ATen/ops/squeeze_ops.h>
|
| 41 |
+
#include <ATen/ops/t_ops.h>
|
| 42 |
+
#include <ATen/ops/transpose_ops.h>
|
| 43 |
+
#include <ATen/ops/unbind_ops.h>
|
| 44 |
+
#include <ATen/ops/unfold_ops.h>
|
| 45 |
+
#include <ATen/ops/unsqueeze_ops.h>
|
| 46 |
+
#include <ATen/ops/values_ops.h>
|
| 47 |
+
#include <ATen/ops/view_ops.h>
|
| 48 |
+
#include <ATen/ops/view_ops.h>
|
| 49 |
+
#include <ATen/ops/view_as_complex_ops.h>
|
| 50 |
+
#include <ATen/ops/view_as_real_ops.h>
|
| 51 |
+
#endif
|
| 52 |
+
|
| 53 |
+
namespace torch::autograd::generated {
|
| 54 |
+
|
| 55 |
+
using at::Scalar;
|
| 56 |
+
using at::Tensor;
|
| 57 |
+
using at::IntArrayRef;
|
| 58 |
+
using at::ArrayRef;
|
| 59 |
+
using at::Type;
|
| 60 |
+
using at::ScalarType;
|
| 61 |
+
using c10::optional;
|
| 62 |
+
using c10::fmap;
|
| 63 |
+
|
| 64 |
+
#define _CONJ_VIEW_FUNC_AVAILABLE
|
| 65 |
+
struct _ConjViewFunc : public torch::autograd::ViewFunc {
|
| 66 |
+
_ConjViewFunc()
|
| 67 |
+
{};
|
| 68 |
+
virtual ~_ConjViewFunc() override {};
|
| 69 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 70 |
+
virtual size_t num_symints() const override;
|
| 71 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 72 |
+
virtual size_t num_tensors() const override;
|
| 73 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 74 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 75 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 76 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 77 |
+
|
| 78 |
+
protected:
|
| 79 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 80 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 81 |
+
|
| 82 |
+
private:
|
| 83 |
+
|
| 84 |
+
};
|
| 85 |
+
|
| 86 |
+
#define _INDICES_VIEW_FUNC_AVAILABLE
|
| 87 |
+
struct _IndicesViewFunc : public torch::autograd::ViewFunc {
|
| 88 |
+
_IndicesViewFunc()
|
| 89 |
+
{};
|
| 90 |
+
virtual ~_IndicesViewFunc() override {};
|
| 91 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 92 |
+
virtual size_t num_symints() const override;
|
| 93 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 94 |
+
virtual size_t num_tensors() const override;
|
| 95 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 96 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 97 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 98 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 99 |
+
|
| 100 |
+
protected:
|
| 101 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 102 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 103 |
+
|
| 104 |
+
private:
|
| 105 |
+
|
| 106 |
+
};
|
| 107 |
+
|
| 108 |
+
#define _NEG_VIEW_VIEW_FUNC_AVAILABLE
|
| 109 |
+
struct _NegViewViewFunc : public torch::autograd::ViewFunc {
|
| 110 |
+
_NegViewViewFunc()
|
| 111 |
+
{};
|
| 112 |
+
virtual ~_NegViewViewFunc() override {};
|
| 113 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 114 |
+
virtual size_t num_symints() const override;
|
| 115 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 116 |
+
virtual size_t num_tensors() const override;
|
| 117 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 118 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 119 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 120 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 121 |
+
|
| 122 |
+
protected:
|
| 123 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 124 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 125 |
+
|
| 126 |
+
private:
|
| 127 |
+
|
| 128 |
+
};
|
| 129 |
+
|
| 130 |
+
#define _NESTED_GET_VALUES_VIEW_FUNC_AVAILABLE
|
| 131 |
+
struct _NestedGetValuesViewFunc : public torch::autograd::ViewFunc {
|
| 132 |
+
_NestedGetValuesViewFunc()
|
| 133 |
+
{};
|
| 134 |
+
virtual ~_NestedGetValuesViewFunc() override {};
|
| 135 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 136 |
+
virtual size_t num_symints() const override;
|
| 137 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 138 |
+
virtual size_t num_tensors() const override;
|
| 139 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 140 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 141 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 142 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 143 |
+
|
| 144 |
+
protected:
|
| 145 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 146 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 147 |
+
|
| 148 |
+
private:
|
| 149 |
+
|
| 150 |
+
};
|
| 151 |
+
|
| 152 |
+
#define _NESTED_VIEW_FROM_BUFFER_VIEW_FUNC_AVAILABLE
|
| 153 |
+
struct _NestedViewFromBufferViewFunc : public torch::autograd::ViewFunc {
|
| 154 |
+
_NestedViewFromBufferViewFunc(const at::Tensor & nested_size, const at::Tensor & nested_strides, const at::Tensor & offsets) : nested_size(nested_size), nested_strides(nested_strides), offsets(offsets)
|
| 155 |
+
{};
|
| 156 |
+
virtual ~_NestedViewFromBufferViewFunc() override {};
|
| 157 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 158 |
+
virtual size_t num_symints() const override;
|
| 159 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 160 |
+
virtual size_t num_tensors() const override;
|
| 161 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 162 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 163 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 164 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 165 |
+
|
| 166 |
+
protected:
|
| 167 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 168 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 169 |
+
|
| 170 |
+
private:
|
| 171 |
+
at::Tensor nested_size;
|
| 172 |
+
at::Tensor nested_strides;
|
| 173 |
+
at::Tensor offsets;
|
| 174 |
+
};
|
| 175 |
+
|
| 176 |
+
#define _NESTED_VIEW_FROM_JAGGED_VIEW_FUNC_AVAILABLE
|
| 177 |
+
struct _NestedViewFromJaggedViewFunc : public torch::autograd::ViewFunc {
|
| 178 |
+
_NestedViewFromJaggedViewFunc(const at::Tensor & offsets, const at::Tensor & dummy, const c10::optional<at::Tensor> & lengths, int64_t ragged_idx) : offsets(offsets), dummy(dummy), lengths(lengths), ragged_idx(ragged_idx)
|
| 179 |
+
{};
|
| 180 |
+
virtual ~_NestedViewFromJaggedViewFunc() override {};
|
| 181 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 182 |
+
virtual size_t num_symints() const override;
|
| 183 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 184 |
+
virtual size_t num_tensors() const override;
|
| 185 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 186 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 187 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 188 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 189 |
+
|
| 190 |
+
protected:
|
| 191 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 192 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 193 |
+
|
| 194 |
+
private:
|
| 195 |
+
at::Tensor offsets;
|
| 196 |
+
at::Tensor dummy;
|
| 197 |
+
c10::optional<at::Tensor> lengths;
|
| 198 |
+
int64_t ragged_idx;
|
| 199 |
+
};
|
| 200 |
+
|
| 201 |
+
#define _RESHAPE_ALIAS_VIEW_FUNC_AVAILABLE
|
| 202 |
+
struct _ReshapeAliasViewFunc : public torch::autograd::ViewFunc {
|
| 203 |
+
_ReshapeAliasViewFunc(c10::SymIntArrayRef size, c10::SymIntArrayRef stride) : size(size.vec()), stride(stride.vec())
|
| 204 |
+
{};
|
| 205 |
+
virtual ~_ReshapeAliasViewFunc() override {};
|
| 206 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 207 |
+
virtual size_t num_symints() const override;
|
| 208 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 209 |
+
virtual size_t num_tensors() const override;
|
| 210 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 211 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 212 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 213 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 214 |
+
|
| 215 |
+
protected:
|
| 216 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 217 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 218 |
+
|
| 219 |
+
private:
|
| 220 |
+
::std::vector<c10::SymInt> size;
|
| 221 |
+
::std::vector<c10::SymInt> stride;
|
| 222 |
+
};
|
| 223 |
+
|
| 224 |
+
#define _TEST_AUTOGRAD_MULTIPLE_DISPATCH_VIEW_VIEW_FUNC_AVAILABLE
|
| 225 |
+
struct _TestAutogradMultipleDispatchViewViewFunc : public torch::autograd::ViewFunc {
|
| 226 |
+
_TestAutogradMultipleDispatchViewViewFunc()
|
| 227 |
+
{};
|
| 228 |
+
virtual ~_TestAutogradMultipleDispatchViewViewFunc() override {};
|
| 229 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 230 |
+
virtual size_t num_symints() const override;
|
| 231 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 232 |
+
virtual size_t num_tensors() const override;
|
| 233 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 234 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 235 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 236 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 237 |
+
|
| 238 |
+
protected:
|
| 239 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 240 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 241 |
+
|
| 242 |
+
private:
|
| 243 |
+
|
| 244 |
+
};
|
| 245 |
+
|
| 246 |
+
#define _VALUES_VIEW_FUNC_AVAILABLE
|
| 247 |
+
struct _ValuesViewFunc : public torch::autograd::ViewFunc {
|
| 248 |
+
_ValuesViewFunc()
|
| 249 |
+
{};
|
| 250 |
+
virtual ~_ValuesViewFunc() override {};
|
| 251 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 252 |
+
virtual size_t num_symints() const override;
|
| 253 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 254 |
+
virtual size_t num_tensors() const override;
|
| 255 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 256 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 257 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 258 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 259 |
+
|
| 260 |
+
protected:
|
| 261 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 262 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 263 |
+
|
| 264 |
+
private:
|
| 265 |
+
|
| 266 |
+
};
|
| 267 |
+
|
| 268 |
+
#define ALIAS_VIEW_FUNC_AVAILABLE
|
| 269 |
+
struct AliasViewFunc : public torch::autograd::ViewFunc {
|
| 270 |
+
AliasViewFunc()
|
| 271 |
+
{};
|
| 272 |
+
virtual ~AliasViewFunc() override {};
|
| 273 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 274 |
+
virtual size_t num_symints() const override;
|
| 275 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 276 |
+
virtual size_t num_tensors() const override;
|
| 277 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 278 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 279 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 280 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 281 |
+
|
| 282 |
+
protected:
|
| 283 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 284 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 285 |
+
|
| 286 |
+
private:
|
| 287 |
+
|
| 288 |
+
};
|
| 289 |
+
|
| 290 |
+
#define AS_STRIDED_VIEW_FUNC_AVAILABLE
|
| 291 |
+
struct AsStridedViewFunc : public torch::autograd::ViewFunc {
|
| 292 |
+
AsStridedViewFunc(c10::SymIntArrayRef size, c10::SymIntArrayRef stride, c10::optional<c10::SymInt> storage_offset) : size(size.vec()), stride(stride.vec()), storage_offset(storage_offset)
|
| 293 |
+
{};
|
| 294 |
+
virtual ~AsStridedViewFunc() override {};
|
| 295 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 296 |
+
virtual size_t num_symints() const override;
|
| 297 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 298 |
+
virtual size_t num_tensors() const override;
|
| 299 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 300 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 301 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 302 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 303 |
+
|
| 304 |
+
protected:
|
| 305 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 306 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 307 |
+
|
| 308 |
+
private:
|
| 309 |
+
::std::vector<c10::SymInt> size;
|
| 310 |
+
::std::vector<c10::SymInt> stride;
|
| 311 |
+
c10::optional<c10::SymInt> storage_offset;
|
| 312 |
+
};
|
| 313 |
+
|
| 314 |
+
#define CCOL_INDICES_VIEW_FUNC_AVAILABLE
|
| 315 |
+
struct CcolIndicesViewFunc : public torch::autograd::ViewFunc {
|
| 316 |
+
CcolIndicesViewFunc()
|
| 317 |
+
{};
|
| 318 |
+
virtual ~CcolIndicesViewFunc() override {};
|
| 319 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 320 |
+
virtual size_t num_symints() const override;
|
| 321 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 322 |
+
virtual size_t num_tensors() const override;
|
| 323 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 324 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 325 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 326 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 327 |
+
|
| 328 |
+
protected:
|
| 329 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 330 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 331 |
+
|
| 332 |
+
private:
|
| 333 |
+
|
| 334 |
+
};
|
| 335 |
+
|
| 336 |
+
#define CHUNK_VIEW_FUNC_AVAILABLE
|
| 337 |
+
struct ChunkViewFunc : public torch::autograd::ViewFunc {
|
| 338 |
+
ChunkViewFunc(int64_t chunks, int64_t dim, int64_t view_idx) : chunks(chunks), dim(dim), view_idx(view_idx)
|
| 339 |
+
{};
|
| 340 |
+
virtual ~ChunkViewFunc() override {};
|
| 341 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 342 |
+
virtual size_t num_symints() const override;
|
| 343 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 344 |
+
virtual size_t num_tensors() const override;
|
| 345 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 346 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 347 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 348 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 349 |
+
|
| 350 |
+
protected:
|
| 351 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 352 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 353 |
+
|
| 354 |
+
private:
|
| 355 |
+
int64_t chunks;
|
| 356 |
+
int64_t dim;
|
| 357 |
+
int64_t view_idx;
|
| 358 |
+
};
|
| 359 |
+
|
| 360 |
+
#define COL_INDICES_VIEW_FUNC_AVAILABLE
|
| 361 |
+
struct ColIndicesViewFunc : public torch::autograd::ViewFunc {
|
| 362 |
+
ColIndicesViewFunc()
|
| 363 |
+
{};
|
| 364 |
+
virtual ~ColIndicesViewFunc() override {};
|
| 365 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 366 |
+
virtual size_t num_symints() const override;
|
| 367 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 368 |
+
virtual size_t num_tensors() const override;
|
| 369 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 370 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 371 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 372 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 373 |
+
|
| 374 |
+
protected:
|
| 375 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 376 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 377 |
+
|
| 378 |
+
private:
|
| 379 |
+
|
| 380 |
+
};
|
| 381 |
+
|
| 382 |
+
#define CROW_INDICES_VIEW_FUNC_AVAILABLE
|
| 383 |
+
struct CrowIndicesViewFunc : public torch::autograd::ViewFunc {
|
| 384 |
+
CrowIndicesViewFunc()
|
| 385 |
+
{};
|
| 386 |
+
virtual ~CrowIndicesViewFunc() override {};
|
| 387 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 388 |
+
virtual size_t num_symints() const override;
|
| 389 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 390 |
+
virtual size_t num_tensors() const override;
|
| 391 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 392 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 393 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 394 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 395 |
+
|
| 396 |
+
protected:
|
| 397 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 398 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 399 |
+
|
| 400 |
+
private:
|
| 401 |
+
|
| 402 |
+
};
|
| 403 |
+
|
| 404 |
+
#define DIAGONAL_VIEW_FUNC_AVAILABLE
|
| 405 |
+
struct DiagonalViewFunc : public torch::autograd::ViewFunc {
|
| 406 |
+
DiagonalViewFunc(int64_t offset, int64_t dim1, int64_t dim2) : offset(offset), dim1(dim1), dim2(dim2)
|
| 407 |
+
{};
|
| 408 |
+
virtual ~DiagonalViewFunc() override {};
|
| 409 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 410 |
+
virtual size_t num_symints() const override;
|
| 411 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 412 |
+
virtual size_t num_tensors() const override;
|
| 413 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 414 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 415 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 416 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 417 |
+
|
| 418 |
+
protected:
|
| 419 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 420 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 421 |
+
|
| 422 |
+
private:
|
| 423 |
+
int64_t offset;
|
| 424 |
+
int64_t dim1;
|
| 425 |
+
int64_t dim2;
|
| 426 |
+
};
|
| 427 |
+
|
| 428 |
+
#define EXPAND_VIEW_FUNC_AVAILABLE
|
| 429 |
+
struct ExpandViewFunc : public torch::autograd::ViewFunc {
|
| 430 |
+
ExpandViewFunc(c10::SymIntArrayRef size, bool implicit) : size(size.vec()), implicit(implicit)
|
| 431 |
+
{};
|
| 432 |
+
virtual ~ExpandViewFunc() override {};
|
| 433 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 434 |
+
virtual size_t num_symints() const override;
|
| 435 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 436 |
+
virtual size_t num_tensors() const override;
|
| 437 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 438 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 439 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 440 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 441 |
+
|
| 442 |
+
protected:
|
| 443 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 444 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 445 |
+
|
| 446 |
+
private:
|
| 447 |
+
::std::vector<c10::SymInt> size;
|
| 448 |
+
bool implicit;
|
| 449 |
+
};
|
| 450 |
+
|
| 451 |
+
#define INDICES_VIEW_FUNC_AVAILABLE
|
| 452 |
+
struct IndicesViewFunc : public torch::autograd::ViewFunc {
|
| 453 |
+
IndicesViewFunc()
|
| 454 |
+
{};
|
| 455 |
+
virtual ~IndicesViewFunc() override {};
|
| 456 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 457 |
+
virtual size_t num_symints() const override;
|
| 458 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 459 |
+
virtual size_t num_tensors() const override;
|
| 460 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 461 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 462 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 463 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 464 |
+
|
| 465 |
+
protected:
|
| 466 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 467 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 468 |
+
|
| 469 |
+
private:
|
| 470 |
+
|
| 471 |
+
};
|
| 472 |
+
|
| 473 |
+
#define NARROW_VIEW_FUNC_AVAILABLE
|
| 474 |
+
struct NarrowViewFunc : public torch::autograd::ViewFunc {
|
| 475 |
+
NarrowViewFunc(int64_t dim, c10::SymInt start, c10::SymInt length) : dim(dim), start(start), length(length)
|
| 476 |
+
{};
|
| 477 |
+
virtual ~NarrowViewFunc() override {};
|
| 478 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 479 |
+
virtual size_t num_symints() const override;
|
| 480 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 481 |
+
virtual size_t num_tensors() const override;
|
| 482 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 483 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 484 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 485 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 486 |
+
|
| 487 |
+
protected:
|
| 488 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 489 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 490 |
+
|
| 491 |
+
private:
|
| 492 |
+
int64_t dim;
|
| 493 |
+
c10::SymInt start;
|
| 494 |
+
c10::SymInt length;
|
| 495 |
+
};
|
| 496 |
+
|
| 497 |
+
#define PERMUTE_VIEW_FUNC_AVAILABLE
|
| 498 |
+
struct PermuteViewFunc : public torch::autograd::ViewFunc {
|
| 499 |
+
PermuteViewFunc(at::IntArrayRef dims) : dims(dims.vec())
|
| 500 |
+
{};
|
| 501 |
+
virtual ~PermuteViewFunc() override {};
|
| 502 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 503 |
+
virtual size_t num_symints() const override;
|
| 504 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 505 |
+
virtual size_t num_tensors() const override;
|
| 506 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 507 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 508 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 509 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 510 |
+
|
| 511 |
+
protected:
|
| 512 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 513 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 514 |
+
|
| 515 |
+
private:
|
| 516 |
+
::std::vector<int64_t> dims;
|
| 517 |
+
};
|
| 518 |
+
|
| 519 |
+
#define ROW_INDICES_VIEW_FUNC_AVAILABLE
|
| 520 |
+
struct RowIndicesViewFunc : public torch::autograd::ViewFunc {
|
| 521 |
+
RowIndicesViewFunc()
|
| 522 |
+
{};
|
| 523 |
+
virtual ~RowIndicesViewFunc() override {};
|
| 524 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 525 |
+
virtual size_t num_symints() const override;
|
| 526 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 527 |
+
virtual size_t num_tensors() const override;
|
| 528 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 529 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 530 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 531 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 532 |
+
|
| 533 |
+
protected:
|
| 534 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 535 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 536 |
+
|
| 537 |
+
private:
|
| 538 |
+
|
| 539 |
+
};
|
| 540 |
+
|
| 541 |
+
#define SELECT_INT_VIEW_FUNC_AVAILABLE
|
| 542 |
+
struct SelectIntViewFunc : public torch::autograd::ViewFunc {
|
| 543 |
+
SelectIntViewFunc(int64_t dim, c10::SymInt index) : dim(dim), index(index)
|
| 544 |
+
{};
|
| 545 |
+
virtual ~SelectIntViewFunc() override {};
|
| 546 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 547 |
+
virtual size_t num_symints() const override;
|
| 548 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 549 |
+
virtual size_t num_tensors() const override;
|
| 550 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 551 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 552 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 553 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 554 |
+
|
| 555 |
+
protected:
|
| 556 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 557 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 558 |
+
|
| 559 |
+
private:
|
| 560 |
+
int64_t dim;
|
| 561 |
+
c10::SymInt index;
|
| 562 |
+
};
|
| 563 |
+
|
| 564 |
+
#define SLICE_TENSOR_VIEW_FUNC_AVAILABLE
|
| 565 |
+
struct SliceTensorViewFunc : public torch::autograd::ViewFunc {
|
| 566 |
+
SliceTensorViewFunc(int64_t dim, c10::optional<c10::SymInt> start, c10::optional<c10::SymInt> end, c10::SymInt step) : dim(dim), start(start), end(end), step(step)
|
| 567 |
+
{};
|
| 568 |
+
virtual ~SliceTensorViewFunc() override {};
|
| 569 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 570 |
+
virtual size_t num_symints() const override;
|
| 571 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 572 |
+
virtual size_t num_tensors() const override;
|
| 573 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 574 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 575 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 576 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 577 |
+
|
| 578 |
+
protected:
|
| 579 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 580 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 581 |
+
|
| 582 |
+
private:
|
| 583 |
+
int64_t dim;
|
| 584 |
+
c10::optional<c10::SymInt> start;
|
| 585 |
+
c10::optional<c10::SymInt> end;
|
| 586 |
+
c10::SymInt step;
|
| 587 |
+
};
|
| 588 |
+
|
| 589 |
+
#define SLICE_INVERSE_VIEW_FUNC_AVAILABLE
|
| 590 |
+
struct SliceInverseViewFunc : public torch::autograd::ViewFunc {
|
| 591 |
+
SliceInverseViewFunc(const at::Tensor & src, int64_t dim, c10::optional<c10::SymInt> start, c10::optional<c10::SymInt> end, c10::SymInt step) : src(src), dim(dim), start(start), end(end), step(step)
|
| 592 |
+
{};
|
| 593 |
+
virtual ~SliceInverseViewFunc() override {};
|
| 594 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 595 |
+
virtual size_t num_symints() const override;
|
| 596 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 597 |
+
virtual size_t num_tensors() const override;
|
| 598 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 599 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 600 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 601 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 602 |
+
|
| 603 |
+
protected:
|
| 604 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 605 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 606 |
+
|
| 607 |
+
private:
|
| 608 |
+
at::Tensor src;
|
| 609 |
+
int64_t dim;
|
| 610 |
+
c10::optional<c10::SymInt> start;
|
| 611 |
+
c10::optional<c10::SymInt> end;
|
| 612 |
+
c10::SymInt step;
|
| 613 |
+
};
|
| 614 |
+
|
| 615 |
+
#define SPLIT_TENSOR_VIEW_FUNC_AVAILABLE
|
| 616 |
+
struct SplitTensorViewFunc : public torch::autograd::ViewFunc {
|
| 617 |
+
SplitTensorViewFunc(c10::SymInt split_size, int64_t dim, int64_t view_idx) : split_size(split_size), dim(dim), view_idx(view_idx)
|
| 618 |
+
{};
|
| 619 |
+
virtual ~SplitTensorViewFunc() override {};
|
| 620 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 621 |
+
virtual size_t num_symints() const override;
|
| 622 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 623 |
+
virtual size_t num_tensors() const override;
|
| 624 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 625 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 626 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 627 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 628 |
+
|
| 629 |
+
protected:
|
| 630 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 631 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 632 |
+
|
| 633 |
+
private:
|
| 634 |
+
c10::SymInt split_size;
|
| 635 |
+
int64_t dim;
|
| 636 |
+
int64_t view_idx;
|
| 637 |
+
};
|
| 638 |
+
|
| 639 |
+
#define SPLIT_WITH_SIZES_VIEW_FUNC_AVAILABLE
|
| 640 |
+
struct SplitWithSizesViewFunc : public torch::autograd::ViewFunc {
|
| 641 |
+
SplitWithSizesViewFunc(c10::SymIntArrayRef split_sizes, int64_t dim, int64_t view_idx) : split_sizes(split_sizes.vec()), dim(dim), view_idx(view_idx)
|
| 642 |
+
{};
|
| 643 |
+
virtual ~SplitWithSizesViewFunc() override {};
|
| 644 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 645 |
+
virtual size_t num_symints() const override;
|
| 646 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 647 |
+
virtual size_t num_tensors() const override;
|
| 648 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 649 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 650 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 651 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 652 |
+
|
| 653 |
+
protected:
|
| 654 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 655 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 656 |
+
|
| 657 |
+
private:
|
| 658 |
+
::std::vector<c10::SymInt> split_sizes;
|
| 659 |
+
int64_t dim;
|
| 660 |
+
int64_t view_idx;
|
| 661 |
+
};
|
| 662 |
+
|
| 663 |
+
#define SQUEEZE_VIEW_FUNC_AVAILABLE
|
| 664 |
+
struct SqueezeViewFunc : public torch::autograd::ViewFunc {
|
| 665 |
+
SqueezeViewFunc()
|
| 666 |
+
{};
|
| 667 |
+
virtual ~SqueezeViewFunc() override {};
|
| 668 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 669 |
+
virtual size_t num_symints() const override;
|
| 670 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 671 |
+
virtual size_t num_tensors() const override;
|
| 672 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 673 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 674 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 675 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 676 |
+
|
| 677 |
+
protected:
|
| 678 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 679 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 680 |
+
|
| 681 |
+
private:
|
| 682 |
+
|
| 683 |
+
};
|
| 684 |
+
|
| 685 |
+
#define SQUEEZE_DIM_VIEW_FUNC_AVAILABLE
|
| 686 |
+
struct SqueezeDimViewFunc : public torch::autograd::ViewFunc {
|
| 687 |
+
SqueezeDimViewFunc(int64_t dim) : dim(dim)
|
| 688 |
+
{};
|
| 689 |
+
virtual ~SqueezeDimViewFunc() override {};
|
| 690 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 691 |
+
virtual size_t num_symints() const override;
|
| 692 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 693 |
+
virtual size_t num_tensors() const override;
|
| 694 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 695 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 696 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 697 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 698 |
+
|
| 699 |
+
protected:
|
| 700 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 701 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 702 |
+
|
| 703 |
+
private:
|
| 704 |
+
int64_t dim;
|
| 705 |
+
};
|
| 706 |
+
|
| 707 |
+
#define SQUEEZE_DIMS_VIEW_FUNC_AVAILABLE
|
| 708 |
+
struct SqueezeDimsViewFunc : public torch::autograd::ViewFunc {
|
| 709 |
+
SqueezeDimsViewFunc(at::IntArrayRef dim) : dim(dim.vec())
|
| 710 |
+
{};
|
| 711 |
+
virtual ~SqueezeDimsViewFunc() override {};
|
| 712 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 713 |
+
virtual size_t num_symints() const override;
|
| 714 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 715 |
+
virtual size_t num_tensors() const override;
|
| 716 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 717 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 718 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 719 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 720 |
+
|
| 721 |
+
protected:
|
| 722 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 723 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 724 |
+
|
| 725 |
+
private:
|
| 726 |
+
::std::vector<int64_t> dim;
|
| 727 |
+
};
|
| 728 |
+
|
| 729 |
+
#define T_VIEW_FUNC_AVAILABLE
|
| 730 |
+
struct TViewFunc : public torch::autograd::ViewFunc {
|
| 731 |
+
TViewFunc()
|
| 732 |
+
{};
|
| 733 |
+
virtual ~TViewFunc() override {};
|
| 734 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 735 |
+
virtual size_t num_symints() const override;
|
| 736 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 737 |
+
virtual size_t num_tensors() const override;
|
| 738 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 739 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 740 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 741 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 742 |
+
|
| 743 |
+
protected:
|
| 744 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 745 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 746 |
+
|
| 747 |
+
private:
|
| 748 |
+
|
| 749 |
+
};
|
| 750 |
+
|
| 751 |
+
#define TRANSPOSE_INT_VIEW_FUNC_AVAILABLE
|
| 752 |
+
struct TransposeIntViewFunc : public torch::autograd::ViewFunc {
|
| 753 |
+
TransposeIntViewFunc(int64_t dim0, int64_t dim1) : dim0(dim0), dim1(dim1)
|
| 754 |
+
{};
|
| 755 |
+
virtual ~TransposeIntViewFunc() override {};
|
| 756 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 757 |
+
virtual size_t num_symints() const override;
|
| 758 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 759 |
+
virtual size_t num_tensors() const override;
|
| 760 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 761 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 762 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 763 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 764 |
+
|
| 765 |
+
protected:
|
| 766 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 767 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 768 |
+
|
| 769 |
+
private:
|
| 770 |
+
int64_t dim0;
|
| 771 |
+
int64_t dim1;
|
| 772 |
+
};
|
| 773 |
+
|
| 774 |
+
#define UNBIND_INT_VIEW_FUNC_AVAILABLE
|
| 775 |
+
struct UnbindIntViewFunc : public torch::autograd::ViewFunc {
|
| 776 |
+
UnbindIntViewFunc(int64_t dim, int64_t view_idx) : dim(dim), view_idx(view_idx)
|
| 777 |
+
{};
|
| 778 |
+
virtual ~UnbindIntViewFunc() override {};
|
| 779 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 780 |
+
virtual size_t num_symints() const override;
|
| 781 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 782 |
+
virtual size_t num_tensors() const override;
|
| 783 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 784 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 785 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 786 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 787 |
+
|
| 788 |
+
protected:
|
| 789 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 790 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 791 |
+
|
| 792 |
+
private:
|
| 793 |
+
int64_t dim;
|
| 794 |
+
int64_t view_idx;
|
| 795 |
+
};
|
| 796 |
+
|
| 797 |
+
#define UNFOLD_VIEW_FUNC_AVAILABLE
|
| 798 |
+
struct UnfoldViewFunc : public torch::autograd::ViewFunc {
|
| 799 |
+
UnfoldViewFunc(int64_t dimension, int64_t size, int64_t step) : dimension(dimension), size(size), step(step)
|
| 800 |
+
{};
|
| 801 |
+
virtual ~UnfoldViewFunc() override {};
|
| 802 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 803 |
+
virtual size_t num_symints() const override;
|
| 804 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 805 |
+
virtual size_t num_tensors() const override;
|
| 806 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 807 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 808 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 809 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 810 |
+
|
| 811 |
+
protected:
|
| 812 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 813 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 814 |
+
|
| 815 |
+
private:
|
| 816 |
+
int64_t dimension;
|
| 817 |
+
int64_t size;
|
| 818 |
+
int64_t step;
|
| 819 |
+
};
|
| 820 |
+
|
| 821 |
+
#define UNSQUEEZE_VIEW_FUNC_AVAILABLE
|
| 822 |
+
struct UnsqueezeViewFunc : public torch::autograd::ViewFunc {
|
| 823 |
+
UnsqueezeViewFunc(int64_t dim) : dim(dim)
|
| 824 |
+
{};
|
| 825 |
+
virtual ~UnsqueezeViewFunc() override {};
|
| 826 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 827 |
+
virtual size_t num_symints() const override;
|
| 828 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 829 |
+
virtual size_t num_tensors() const override;
|
| 830 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 831 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 832 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 833 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 834 |
+
|
| 835 |
+
protected:
|
| 836 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 837 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 838 |
+
|
| 839 |
+
private:
|
| 840 |
+
int64_t dim;
|
| 841 |
+
};
|
| 842 |
+
|
| 843 |
+
#define VALUES_VIEW_FUNC_AVAILABLE
|
| 844 |
+
struct ValuesViewFunc : public torch::autograd::ViewFunc {
|
| 845 |
+
ValuesViewFunc()
|
| 846 |
+
{};
|
| 847 |
+
virtual ~ValuesViewFunc() override {};
|
| 848 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 849 |
+
virtual size_t num_symints() const override;
|
| 850 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 851 |
+
virtual size_t num_tensors() const override;
|
| 852 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 853 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 854 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 855 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 856 |
+
|
| 857 |
+
protected:
|
| 858 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 859 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 860 |
+
|
| 861 |
+
private:
|
| 862 |
+
|
| 863 |
+
};
|
| 864 |
+
|
| 865 |
+
#define VIEW_VIEW_FUNC_AVAILABLE
|
| 866 |
+
struct ViewViewFunc : public torch::autograd::ViewFunc {
|
| 867 |
+
ViewViewFunc(c10::SymIntArrayRef size) : size(size.vec())
|
| 868 |
+
{};
|
| 869 |
+
virtual ~ViewViewFunc() override {};
|
| 870 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 871 |
+
virtual size_t num_symints() const override;
|
| 872 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 873 |
+
virtual size_t num_tensors() const override;
|
| 874 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 875 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 876 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 877 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 878 |
+
|
| 879 |
+
protected:
|
| 880 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 881 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 882 |
+
|
| 883 |
+
private:
|
| 884 |
+
::std::vector<c10::SymInt> size;
|
| 885 |
+
};
|
| 886 |
+
|
| 887 |
+
#define VIEW_DTYPE_VIEW_FUNC_AVAILABLE
|
| 888 |
+
struct ViewDtypeViewFunc : public torch::autograd::ViewFunc {
|
| 889 |
+
ViewDtypeViewFunc(at::ScalarType dtype) : dtype(dtype)
|
| 890 |
+
{};
|
| 891 |
+
virtual ~ViewDtypeViewFunc() override {};
|
| 892 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 893 |
+
virtual size_t num_symints() const override;
|
| 894 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 895 |
+
virtual size_t num_tensors() const override;
|
| 896 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 897 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 898 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 899 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 900 |
+
|
| 901 |
+
protected:
|
| 902 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 903 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 904 |
+
|
| 905 |
+
private:
|
| 906 |
+
at::ScalarType dtype;
|
| 907 |
+
};
|
| 908 |
+
|
| 909 |
+
#define VIEW_AS_COMPLEX_VIEW_FUNC_AVAILABLE
|
| 910 |
+
struct ViewAsComplexViewFunc : public torch::autograd::ViewFunc {
|
| 911 |
+
ViewAsComplexViewFunc()
|
| 912 |
+
{};
|
| 913 |
+
virtual ~ViewAsComplexViewFunc() override {};
|
| 914 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 915 |
+
virtual size_t num_symints() const override;
|
| 916 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 917 |
+
virtual size_t num_tensors() const override;
|
| 918 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 919 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 920 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 921 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 922 |
+
|
| 923 |
+
protected:
|
| 924 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 925 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 926 |
+
|
| 927 |
+
private:
|
| 928 |
+
|
| 929 |
+
};
|
| 930 |
+
|
| 931 |
+
#define VIEW_AS_REAL_VIEW_FUNC_AVAILABLE
|
| 932 |
+
struct ViewAsRealViewFunc : public torch::autograd::ViewFunc {
|
| 933 |
+
ViewAsRealViewFunc()
|
| 934 |
+
{};
|
| 935 |
+
virtual ~ViewAsRealViewFunc() override {};
|
| 936 |
+
virtual std::vector<c10::SymInt> get_symints() const override;
|
| 937 |
+
virtual size_t num_symints() const override;
|
| 938 |
+
virtual std::vector<at::Tensor> get_tensors() const override;
|
| 939 |
+
virtual size_t num_tensors() const override;
|
| 940 |
+
virtual at::Tensor operator()(const at::Tensor&) const override;
|
| 941 |
+
virtual std::unique_ptr<ViewFunc> clone_and_set(
|
| 942 |
+
std::optional<std::vector<c10::SymInt>> = c10::nullopt,
|
| 943 |
+
std::optional<std::vector<at::Tensor>> = c10::nullopt) const override;
|
| 944 |
+
|
| 945 |
+
protected:
|
| 946 |
+
virtual void set_symints(std::vector<c10::SymInt>) override;
|
| 947 |
+
virtual void set_tensors(std::vector<at::Tensor>) override;
|
| 948 |
+
|
| 949 |
+
private:
|
| 950 |
+
|
| 951 |
+
};
|
| 952 |
+
|
| 953 |
+
} // namespace torch::autograd::generated
|
shared/package-files/0c/0c228e0a4cf2e60236e37d2b6b49d892dd86323096d27188a6125edd358d782b/ts_backend_impl.h
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/csrc/lazy/backend/backend_interface.h>
|
| 4 |
+
|
| 5 |
+
namespace torch {
|
| 6 |
+
namespace lazy {
|
| 7 |
+
|
| 8 |
+
class TORCH_API TSData : public torch::lazy::BackendData {
|
| 9 |
+
public:
|
| 10 |
+
TSData(const at::Scalar& scalar, const torch::lazy::BackendDevice& device)
|
| 11 |
+
: torch::lazy::BackendData(device, torch::lazy::Shape(scalar.type(), {})),
|
| 12 |
+
scalar(scalar) {}
|
| 13 |
+
|
| 14 |
+
TSData(
|
| 15 |
+
const at::Tensor& data,
|
| 16 |
+
const torch::lazy::Shape& shape,
|
| 17 |
+
const torch::lazy::BackendDevice& device)
|
| 18 |
+
: torch::lazy::BackendData(device, shape), data_(data) {}
|
| 19 |
+
|
| 20 |
+
TSData(
|
| 21 |
+
const torch::lazy::Shape& shape,
|
| 22 |
+
const torch::lazy::BackendDevice& device)
|
| 23 |
+
: torch::lazy::BackendData(device, shape) {}
|
| 24 |
+
|
| 25 |
+
Handle GetHandle() override {
|
| 26 |
+
return reinterpret_cast<int64_t>(this);
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
void Assign(const torch::lazy::BackendData& data) override {
|
| 30 |
+
data_ = static_cast<const TSData&>(data).data_;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
bool HasValue() const override {
|
| 34 |
+
return data_.defined();
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
at::Tensor data() {
|
| 38 |
+
return data_;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
c10::optional<at::Scalar> scalar;
|
| 42 |
+
|
| 43 |
+
private:
|
| 44 |
+
at::Tensor data_;
|
| 45 |
+
};
|
| 46 |
+
|
| 47 |
+
TORCH_API torch::lazy::BackendImplInterface* GetTSBackendImpl();
|
| 48 |
+
|
| 49 |
+
TORCH_API void InitTorchScriptBackend();
|
| 50 |
+
|
| 51 |
+
} // namespace lazy
|
| 52 |
+
} // namespace torch
|
shared/package-files/0c/0c22e0d886b5d782dca4f5371425bc1cc3990a49f92bb9217d744c7f667d5b22/dialogs.py
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Collection of reusable components for building full screen applications.
|
| 3 |
+
"""
|
| 4 |
+
from __future__ import annotations
|
| 5 |
+
|
| 6 |
+
from typing import Sequence
|
| 7 |
+
|
| 8 |
+
from prompt_toolkit.filters import has_completions, has_focus
|
| 9 |
+
from prompt_toolkit.formatted_text import AnyFormattedText
|
| 10 |
+
from prompt_toolkit.key_binding.bindings.focus import focus_next, focus_previous
|
| 11 |
+
from prompt_toolkit.key_binding.key_bindings import KeyBindings
|
| 12 |
+
from prompt_toolkit.layout.containers import (
|
| 13 |
+
AnyContainer,
|
| 14 |
+
DynamicContainer,
|
| 15 |
+
HSplit,
|
| 16 |
+
VSplit,
|
| 17 |
+
)
|
| 18 |
+
from prompt_toolkit.layout.dimension import AnyDimension
|
| 19 |
+
from prompt_toolkit.layout.dimension import Dimension as D
|
| 20 |
+
|
| 21 |
+
from .base import Box, Button, Frame, Shadow
|
| 22 |
+
|
| 23 |
+
__all__ = [
|
| 24 |
+
"Dialog",
|
| 25 |
+
]
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
class Dialog:
|
| 29 |
+
"""
|
| 30 |
+
Simple dialog window. This is the base for input dialogs, message dialogs
|
| 31 |
+
and confirmation dialogs.
|
| 32 |
+
|
| 33 |
+
Changing the title and body of the dialog is possible at runtime by
|
| 34 |
+
assigning to the `body` and `title` attributes of this class.
|
| 35 |
+
|
| 36 |
+
:param body: Child container object.
|
| 37 |
+
:param title: Text to be displayed in the heading of the dialog.
|
| 38 |
+
:param buttons: A list of `Button` widgets, displayed at the bottom.
|
| 39 |
+
"""
|
| 40 |
+
|
| 41 |
+
def __init__(
|
| 42 |
+
self,
|
| 43 |
+
body: AnyContainer,
|
| 44 |
+
title: AnyFormattedText = "",
|
| 45 |
+
buttons: Sequence[Button] | None = None,
|
| 46 |
+
modal: bool = True,
|
| 47 |
+
width: AnyDimension = None,
|
| 48 |
+
with_background: bool = False,
|
| 49 |
+
) -> None:
|
| 50 |
+
self.body = body
|
| 51 |
+
self.title = title
|
| 52 |
+
|
| 53 |
+
buttons = buttons or []
|
| 54 |
+
|
| 55 |
+
# When a button is selected, handle left/right key bindings.
|
| 56 |
+
buttons_kb = KeyBindings()
|
| 57 |
+
if len(buttons) > 1:
|
| 58 |
+
first_selected = has_focus(buttons[0])
|
| 59 |
+
last_selected = has_focus(buttons[-1])
|
| 60 |
+
|
| 61 |
+
buttons_kb.add("left", filter=~first_selected)(focus_previous)
|
| 62 |
+
buttons_kb.add("right", filter=~last_selected)(focus_next)
|
| 63 |
+
|
| 64 |
+
frame_body: AnyContainer
|
| 65 |
+
if buttons:
|
| 66 |
+
frame_body = HSplit(
|
| 67 |
+
[
|
| 68 |
+
# Add optional padding around the body.
|
| 69 |
+
Box(
|
| 70 |
+
body=DynamicContainer(lambda: self.body),
|
| 71 |
+
padding=D(preferred=1, max=1),
|
| 72 |
+
padding_bottom=0,
|
| 73 |
+
),
|
| 74 |
+
# The buttons.
|
| 75 |
+
Box(
|
| 76 |
+
body=VSplit(buttons, padding=1, key_bindings=buttons_kb),
|
| 77 |
+
height=D(min=1, max=3, preferred=3),
|
| 78 |
+
),
|
| 79 |
+
]
|
| 80 |
+
)
|
| 81 |
+
else:
|
| 82 |
+
frame_body = body
|
| 83 |
+
|
| 84 |
+
# Key bindings for whole dialog.
|
| 85 |
+
kb = KeyBindings()
|
| 86 |
+
kb.add("tab", filter=~has_completions)(focus_next)
|
| 87 |
+
kb.add("s-tab", filter=~has_completions)(focus_previous)
|
| 88 |
+
|
| 89 |
+
frame = Shadow(
|
| 90 |
+
body=Frame(
|
| 91 |
+
title=lambda: self.title,
|
| 92 |
+
body=frame_body,
|
| 93 |
+
style="class:dialog.body",
|
| 94 |
+
width=(None if with_background is None else width),
|
| 95 |
+
key_bindings=kb,
|
| 96 |
+
modal=modal,
|
| 97 |
+
)
|
| 98 |
+
)
|
| 99 |
+
|
| 100 |
+
self.container: Box | Shadow
|
| 101 |
+
if with_background:
|
| 102 |
+
self.container = Box(body=frame, style="class:dialog", width=width)
|
| 103 |
+
else:
|
| 104 |
+
self.container = frame
|
| 105 |
+
|
| 106 |
+
def __pt_container__(self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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
This file was generated by _generate_pyx.py.
|
| 3 |
+
Do not edit this file directly.
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
# Within scipy, these wrappers can be used via relative or absolute cimport.
|
| 7 |
+
# Examples:
|
| 8 |
+
# from ..linalg cimport cython_blas
|
| 9 |
+
# from scipy.linalg cimport cython_blas
|
| 10 |
+
# cimport scipy.linalg.cython_blas as cython_blas
|
| 11 |
+
# cimport ..linalg.cython_blas as cython_blas
|
| 12 |
+
|
| 13 |
+
# Within SciPy, if BLAS functions are needed in C/C++/Fortran,
|
| 14 |
+
# these wrappers should not be used.
|
| 15 |
+
# The original libraries should be linked directly.
|
| 16 |
+
|
| 17 |
+
ctypedef float s
|
| 18 |
+
ctypedef double d
|
| 19 |
+
ctypedef float complex c
|
| 20 |
+
ctypedef double complex z
|
| 21 |
+
|
| 22 |
+
cdef void caxpy(int *n, c *ca, c *cx, int *incx, c *cy, int *incy) noexcept nogil
|
| 23 |
+
cdef void ccopy(int *n, c *cx, int *incx, c *cy, int *incy) noexcept nogil
|
| 24 |
+
cdef c cdotc(int *n, c *cx, int *incx, c *cy, int *incy) noexcept nogil
|
| 25 |
+
cdef c cdotu(int *n, c *cx, int *incx, c *cy, int *incy) noexcept nogil
|
| 26 |
+
cdef void cgbmv(char *trans, int *m, int *n, int *kl, int *ku, c *alpha, c *a, int *lda, c *x, int *incx, c *beta, c *y, int *incy) noexcept nogil
|
| 27 |
+
cdef void cgemm(char *transa, char *transb, int *m, int *n, int *k, c *alpha, c *a, int *lda, c *b, int *ldb, c *beta, c *c, int *ldc) noexcept nogil
|
| 28 |
+
cdef void cgemv(char *trans, int *m, int *n, c *alpha, c *a, int *lda, c *x, int *incx, c *beta, c *y, int *incy) noexcept nogil
|
| 29 |
+
cdef void cgerc(int *m, int *n, c *alpha, c *x, int *incx, c *y, int *incy, c *a, int *lda) noexcept nogil
|
| 30 |
+
cdef void cgeru(int *m, int *n, c *alpha, c *x, int *incx, c *y, int *incy, c *a, int *lda) noexcept nogil
|
| 31 |
+
cdef void chbmv(char *uplo, int *n, int *k, c *alpha, c *a, int *lda, c *x, int *incx, c *beta, c *y, int *incy) noexcept nogil
|
| 32 |
+
cdef void chemm(char *side, char *uplo, int *m, int *n, c *alpha, c *a, int *lda, c *b, int *ldb, c *beta, c *c, int *ldc) noexcept nogil
|
| 33 |
+
cdef void chemv(char *uplo, int *n, c *alpha, c *a, int *lda, c *x, int *incx, c *beta, c *y, int *incy) noexcept nogil
|
| 34 |
+
cdef void cher(char *uplo, int *n, s *alpha, c *x, int *incx, c *a, int *lda) noexcept nogil
|
| 35 |
+
cdef void cher2(char *uplo, int *n, c *alpha, c *x, int *incx, c *y, int *incy, c *a, int *lda) noexcept nogil
|
| 36 |
+
cdef void cher2k(char *uplo, char *trans, int *n, int *k, c *alpha, c *a, int *lda, c *b, int *ldb, s *beta, c *c, int *ldc) noexcept nogil
|
| 37 |
+
cdef void cherk(char *uplo, char *trans, int *n, int *k, s *alpha, c *a, int *lda, s *beta, c *c, int *ldc) noexcept nogil
|
| 38 |
+
cdef void chpmv(char *uplo, int *n, c *alpha, c *ap, c *x, int *incx, c *beta, c *y, int *incy) noexcept nogil
|
| 39 |
+
cdef void chpr(char *uplo, int *n, s *alpha, c *x, int *incx, c *ap) noexcept nogil
|
| 40 |
+
cdef void chpr2(char *uplo, int *n, c *alpha, c *x, int *incx, c *y, int *incy, c *ap) noexcept nogil
|
| 41 |
+
cdef void crotg(c *ca, c *cb, s *c, c *s) noexcept nogil
|
| 42 |
+
cdef void cscal(int *n, c *ca, c *cx, int *incx) noexcept nogil
|
| 43 |
+
cdef void csrot(int *n, c *cx, int *incx, c *cy, int *incy, s *c, s *s) noexcept nogil
|
| 44 |
+
cdef void csscal(int *n, s *sa, c *cx, int *incx) noexcept nogil
|
| 45 |
+
cdef void cswap(int *n, c *cx, int *incx, c *cy, int *incy) noexcept nogil
|
| 46 |
+
cdef void csymm(char *side, char *uplo, int *m, int *n, c *alpha, c *a, int *lda, c *b, int *ldb, c *beta, c *c, int *ldc) noexcept nogil
|
| 47 |
+
cdef void csyr2k(char *uplo, char *trans, int *n, int *k, c *alpha, c *a, int *lda, c *b, int *ldb, c *beta, c *c, int *ldc) noexcept nogil
|
| 48 |
+
cdef void csyrk(char *uplo, char *trans, int *n, int *k, c *alpha, c *a, int *lda, c *beta, c *c, int *ldc) noexcept nogil
|
| 49 |
+
cdef void ctbmv(char *uplo, char *trans, char *diag, int *n, int *k, c *a, int *lda, c *x, int *incx) noexcept nogil
|
| 50 |
+
cdef void ctbsv(char *uplo, char *trans, char *diag, int *n, int *k, c *a, int *lda, c *x, int *incx) noexcept nogil
|
| 51 |
+
cdef void ctpmv(char *uplo, char *trans, char *diag, int *n, c *ap, c *x, int *incx) noexcept nogil
|
| 52 |
+
cdef void ctpsv(char *uplo, char *trans, char *diag, int *n, c *ap, c *x, int *incx) noexcept nogil
|
| 53 |
+
cdef void ctrmm(char *side, char *uplo, char *transa, char *diag, int *m, int *n, c *alpha, c *a, int *lda, c *b, int *ldb) noexcept nogil
|
| 54 |
+
cdef void ctrmv(char *uplo, char *trans, char *diag, int *n, c *a, int *lda, c *x, int *incx) noexcept nogil
|
| 55 |
+
cdef void ctrsm(char *side, char *uplo, char *transa, char *diag, int *m, int *n, c *alpha, c *a, int *lda, c *b, int *ldb) noexcept nogil
|
| 56 |
+
cdef void ctrsv(char *uplo, char *trans, char *diag, int *n, c *a, int *lda, c *x, int *incx) noexcept nogil
|
| 57 |
+
cdef d dasum(int *n, d *dx, int *incx) noexcept nogil
|
| 58 |
+
cdef void daxpy(int *n, d *da, d *dx, int *incx, d *dy, int *incy) noexcept nogil
|
| 59 |
+
cdef d dcabs1(z *z) noexcept nogil
|
| 60 |
+
cdef void dcopy(int *n, d *dx, int *incx, d *dy, int *incy) noexcept nogil
|
| 61 |
+
cdef d ddot(int *n, d *dx, int *incx, d *dy, int *incy) noexcept nogil
|
| 62 |
+
cdef void dgbmv(char *trans, int *m, int *n, int *kl, int *ku, d *alpha, d *a, int *lda, d *x, int *incx, d *beta, d *y, int *incy) noexcept nogil
|
| 63 |
+
cdef void dgemm(char *transa, char *transb, int *m, int *n, int *k, d *alpha, d *a, int *lda, d *b, int *ldb, d *beta, d *c, int *ldc) noexcept nogil
|
| 64 |
+
cdef void dgemv(char *trans, int *m, int *n, d *alpha, d *a, int *lda, d *x, int *incx, d *beta, d *y, int *incy) noexcept nogil
|
| 65 |
+
cdef void dger(int *m, int *n, d *alpha, d *x, int *incx, d *y, int *incy, d *a, int *lda) noexcept nogil
|
| 66 |
+
cdef d dnrm2(int *n, d *x, int *incx) noexcept nogil
|
| 67 |
+
cdef void drot(int *n, d *dx, int *incx, d *dy, int *incy, d *c, d *s) noexcept nogil
|
| 68 |
+
cdef void drotg(d *da, d *db, d *c, d *s) noexcept nogil
|
| 69 |
+
cdef void drotm(int *n, d *dx, int *incx, d *dy, int *incy, d *dparam) noexcept nogil
|
| 70 |
+
cdef void drotmg(d *dd1, d *dd2, d *dx1, d *dy1, d *dparam) noexcept nogil
|
| 71 |
+
cdef void dsbmv(char *uplo, int *n, int *k, d *alpha, d *a, int *lda, d *x, int *incx, d *beta, d *y, int *incy) noexcept nogil
|
| 72 |
+
cdef void dscal(int *n, d *da, d *dx, int *incx) noexcept nogil
|
| 73 |
+
cdef d dsdot(int *n, s *sx, int *incx, s *sy, int *incy) noexcept nogil
|
| 74 |
+
cdef void dspmv(char *uplo, int *n, d *alpha, d *ap, d *x, int *incx, d *beta, d *y, int *incy) noexcept nogil
|
| 75 |
+
cdef void dspr(char *uplo, int *n, d *alpha, d *x, int *incx, d *ap) noexcept nogil
|
| 76 |
+
cdef void dspr2(char *uplo, int *n, d *alpha, d *x, int *incx, d *y, int *incy, d *ap) noexcept nogil
|
| 77 |
+
cdef void dswap(int *n, d *dx, int *incx, d *dy, int *incy) noexcept nogil
|
| 78 |
+
cdef void dsymm(char *side, char *uplo, int *m, int *n, d *alpha, d *a, int *lda, d *b, int *ldb, d *beta, d *c, int *ldc) noexcept nogil
|
| 79 |
+
cdef void dsymv(char *uplo, int *n, d *alpha, d *a, int *lda, d *x, int *incx, d *beta, d *y, int *incy) noexcept nogil
|
| 80 |
+
cdef void dsyr(char *uplo, int *n, d *alpha, d *x, int *incx, d *a, int *lda) noexcept nogil
|
| 81 |
+
cdef void dsyr2(char *uplo, int *n, d *alpha, d *x, int *incx, d *y, int *incy, d *a, int *lda) noexcept nogil
|
| 82 |
+
cdef void dsyr2k(char *uplo, char *trans, int *n, int *k, d *alpha, d *a, int *lda, d *b, int *ldb, d *beta, d *c, int *ldc) noexcept nogil
|
| 83 |
+
cdef void dsyrk(char *uplo, char *trans, int *n, int *k, d *alpha, d *a, int *lda, d *beta, d *c, int *ldc) noexcept nogil
|
| 84 |
+
cdef void dtbmv(char *uplo, char *trans, char *diag, int *n, int *k, d *a, int *lda, d *x, int *incx) noexcept nogil
|
| 85 |
+
cdef void dtbsv(char *uplo, char *trans, char *diag, int *n, int *k, d *a, int *lda, d *x, int *incx) noexcept nogil
|
| 86 |
+
cdef void dtpmv(char *uplo, char *trans, char *diag, int *n, d *ap, d *x, int *incx) noexcept nogil
|
| 87 |
+
cdef void dtpsv(char *uplo, char *trans, char *diag, int *n, d *ap, d *x, int *incx) noexcept nogil
|
| 88 |
+
cdef void dtrmm(char *side, char *uplo, char *transa, char *diag, int *m, int *n, d *alpha, d *a, int *lda, d *b, int *ldb) noexcept nogil
|
| 89 |
+
cdef void dtrmv(char *uplo, char *trans, char *diag, int *n, d *a, int *lda, d *x, int *incx) noexcept nogil
|
| 90 |
+
cdef void dtrsm(char *side, char *uplo, char *transa, char *diag, int *m, int *n, d *alpha, d *a, int *lda, d *b, int *ldb) noexcept nogil
|
| 91 |
+
cdef void dtrsv(char *uplo, char *trans, char *diag, int *n, d *a, int *lda, d *x, int *incx) noexcept nogil
|
| 92 |
+
cdef d dzasum(int *n, z *zx, int *incx) noexcept nogil
|
| 93 |
+
cdef d dznrm2(int *n, z *x, int *incx) noexcept nogil
|
| 94 |
+
cdef int icamax(int *n, c *cx, int *incx) noexcept nogil
|
| 95 |
+
cdef int idamax(int *n, d *dx, int *incx) noexcept nogil
|
| 96 |
+
cdef int isamax(int *n, s *sx, int *incx) noexcept nogil
|
| 97 |
+
cdef int izamax(int *n, z *zx, int *incx) noexcept nogil
|
| 98 |
+
cdef bint lsame(char *ca, char *cb) noexcept nogil
|
| 99 |
+
cdef s sasum(int *n, s *sx, int *incx) noexcept nogil
|
| 100 |
+
cdef void saxpy(int *n, s *sa, s *sx, int *incx, s *sy, int *incy) noexcept nogil
|
| 101 |
+
cdef s scasum(int *n, c *cx, int *incx) noexcept nogil
|
| 102 |
+
cdef s scnrm2(int *n, c *x, int *incx) noexcept nogil
|
| 103 |
+
cdef void scopy(int *n, s *sx, int *incx, s *sy, int *incy) noexcept nogil
|
| 104 |
+
cdef s sdot(int *n, s *sx, int *incx, s *sy, int *incy) noexcept nogil
|
| 105 |
+
cdef s sdsdot(int *n, s *sb, s *sx, int *incx, s *sy, int *incy) noexcept nogil
|
| 106 |
+
cdef void sgbmv(char *trans, int *m, int *n, int *kl, int *ku, s *alpha, s *a, int *lda, s *x, int *incx, s *beta, s *y, int *incy) noexcept nogil
|
| 107 |
+
cdef void sgemm(char *transa, char *transb, int *m, int *n, int *k, s *alpha, s *a, int *lda, s *b, int *ldb, s *beta, s *c, int *ldc) noexcept nogil
|
| 108 |
+
cdef void sgemv(char *trans, int *m, int *n, s *alpha, s *a, int *lda, s *x, int *incx, s *beta, s *y, int *incy) noexcept nogil
|
| 109 |
+
cdef void sger(int *m, int *n, s *alpha, s *x, int *incx, s *y, int *incy, s *a, int *lda) noexcept nogil
|
| 110 |
+
cdef s snrm2(int *n, s *x, int *incx) noexcept nogil
|
| 111 |
+
cdef void srot(int *n, s *sx, int *incx, s *sy, int *incy, s *c, s *s) noexcept nogil
|
| 112 |
+
cdef void srotg(s *sa, s *sb, s *c, s *s) noexcept nogil
|
| 113 |
+
cdef void srotm(int *n, s *sx, int *incx, s *sy, int *incy, s *sparam) noexcept nogil
|
| 114 |
+
cdef void srotmg(s *sd1, s *sd2, s *sx1, s *sy1, s *sparam) noexcept nogil
|
| 115 |
+
cdef void ssbmv(char *uplo, int *n, int *k, s *alpha, s *a, int *lda, s *x, int *incx, s *beta, s *y, int *incy) noexcept nogil
|
| 116 |
+
cdef void sscal(int *n, s *sa, s *sx, int *incx) noexcept nogil
|
| 117 |
+
cdef void sspmv(char *uplo, int *n, s *alpha, s *ap, s *x, int *incx, s *beta, s *y, int *incy) noexcept nogil
|
| 118 |
+
cdef void sspr(char *uplo, int *n, s *alpha, s *x, int *incx, s *ap) noexcept nogil
|
| 119 |
+
cdef void sspr2(char *uplo, int *n, s *alpha, s *x, int *incx, s *y, int *incy, s *ap) noexcept nogil
|
| 120 |
+
cdef void sswap(int *n, s *sx, int *incx, s *sy, int *incy) noexcept nogil
|
| 121 |
+
cdef void ssymm(char *side, char *uplo, int *m, int *n, s *alpha, s *a, int *lda, s *b, int *ldb, s *beta, s *c, int *ldc) noexcept nogil
|
| 122 |
+
cdef void ssymv(char *uplo, int *n, s *alpha, s *a, int *lda, s *x, int *incx, s *beta, s *y, int *incy) noexcept nogil
|
| 123 |
+
cdef void ssyr(char *uplo, int *n, s *alpha, s *x, int *incx, s *a, int *lda) noexcept nogil
|
| 124 |
+
cdef void ssyr2(char *uplo, int *n, s *alpha, s *x, int *incx, s *y, int *incy, s *a, int *lda) noexcept nogil
|
| 125 |
+
cdef void ssyr2k(char *uplo, char *trans, int *n, int *k, s *alpha, s *a, int *lda, s *b, int *ldb, s *beta, s *c, int *ldc) noexcept nogil
|
| 126 |
+
cdef void ssyrk(char *uplo, char *trans, int *n, int *k, s *alpha, s *a, int *lda, s *beta, s *c, int *ldc) noexcept nogil
|
| 127 |
+
cdef void stbmv(char *uplo, char *trans, char *diag, int *n, int *k, s *a, int *lda, s *x, int *incx) noexcept nogil
|
| 128 |
+
cdef void stbsv(char *uplo, char *trans, char *diag, int *n, int *k, s *a, int *lda, s *x, int *incx) noexcept nogil
|
| 129 |
+
cdef void stpmv(char *uplo, char *trans, char *diag, int *n, s *ap, s *x, int *incx) noexcept nogil
|
| 130 |
+
cdef void stpsv(char *uplo, char *trans, char *diag, int *n, s *ap, s *x, int *incx) noexcept nogil
|
| 131 |
+
cdef void strmm(char *side, char *uplo, char *transa, char *diag, int *m, int *n, s *alpha, s *a, int *lda, s *b, int *ldb) noexcept nogil
|
| 132 |
+
cdef void strmv(char *uplo, char *trans, char *diag, int *n, s *a, int *lda, s *x, int *incx) noexcept nogil
|
| 133 |
+
cdef void strsm(char *side, char *uplo, char *transa, char *diag, int *m, int *n, s *alpha, s *a, int *lda, s *b, int *ldb) noexcept nogil
|
| 134 |
+
cdef void strsv(char *uplo, char *trans, char *diag, int *n, s *a, int *lda, s *x, int *incx) noexcept nogil
|
| 135 |
+
cdef void zaxpy(int *n, z *za, z *zx, int *incx, z *zy, int *incy) noexcept nogil
|
| 136 |
+
cdef void zcopy(int *n, z *zx, int *incx, z *zy, int *incy) noexcept nogil
|
| 137 |
+
cdef z zdotc(int *n, z *zx, int *incx, z *zy, int *incy) noexcept nogil
|
| 138 |
+
cdef z zdotu(int *n, z *zx, int *incx, z *zy, int *incy) noexcept nogil
|
| 139 |
+
cdef void zdrot(int *n, z *cx, int *incx, z *cy, int *incy, d *c, d *s) noexcept nogil
|
| 140 |
+
cdef void zdscal(int *n, d *da, z *zx, int *incx) noexcept nogil
|
| 141 |
+
cdef void zgbmv(char *trans, int *m, int *n, int *kl, int *ku, z *alpha, z *a, int *lda, z *x, int *incx, z *beta, z *y, int *incy) noexcept nogil
|
| 142 |
+
cdef void zgemm(char *transa, char *transb, int *m, int *n, int *k, z *alpha, z *a, int *lda, z *b, int *ldb, z *beta, z *c, int *ldc) noexcept nogil
|
| 143 |
+
cdef void zgemv(char *trans, int *m, int *n, z *alpha, z *a, int *lda, z *x, int *incx, z *beta, z *y, int *incy) noexcept nogil
|
| 144 |
+
cdef void zgerc(int *m, int *n, z *alpha, z *x, int *incx, z *y, int *incy, z *a, int *lda) noexcept nogil
|
| 145 |
+
cdef void zgeru(int *m, int *n, z *alpha, z *x, int *incx, z *y, int *incy, z *a, int *lda) noexcept nogil
|
| 146 |
+
cdef void zhbmv(char *uplo, int *n, int *k, z *alpha, z *a, int *lda, z *x, int *incx, z *beta, z *y, int *incy) noexcept nogil
|
| 147 |
+
cdef void zhemm(char *side, char *uplo, int *m, int *n, z *alpha, z *a, int *lda, z *b, int *ldb, z *beta, z *c, int *ldc) noexcept nogil
|
| 148 |
+
cdef void zhemv(char *uplo, int *n, z *alpha, z *a, int *lda, z *x, int *incx, z *beta, z *y, int *incy) noexcept nogil
|
| 149 |
+
cdef void zher(char *uplo, int *n, d *alpha, z *x, int *incx, z *a, int *lda) noexcept nogil
|
| 150 |
+
cdef void zher2(char *uplo, int *n, z *alpha, z *x, int *incx, z *y, int *incy, z *a, int *lda) noexcept nogil
|
| 151 |
+
cdef void zher2k(char *uplo, char *trans, int *n, int *k, z *alpha, z *a, int *lda, z *b, int *ldb, d *beta, z *c, int *ldc) noexcept nogil
|
| 152 |
+
cdef void zherk(char *uplo, char *trans, int *n, int *k, d *alpha, z *a, int *lda, d *beta, z *c, int *ldc) noexcept nogil
|
| 153 |
+
cdef void zhpmv(char *uplo, int *n, z *alpha, z *ap, z *x, int *incx, z *beta, z *y, int *incy) noexcept nogil
|
| 154 |
+
cdef void zhpr(char *uplo, int *n, d *alpha, z *x, int *incx, z *ap) noexcept nogil
|
| 155 |
+
cdef void zhpr2(char *uplo, int *n, z *alpha, z *x, int *incx, z *y, int *incy, z *ap) noexcept nogil
|
| 156 |
+
cdef void zrotg(z *ca, z *cb, d *c, z *s) noexcept nogil
|
| 157 |
+
cdef void zscal(int *n, z *za, z *zx, int *incx) noexcept nogil
|
| 158 |
+
cdef void zswap(int *n, z *zx, int *incx, z *zy, int *incy) noexcept nogil
|
| 159 |
+
cdef void zsymm(char *side, char *uplo, int *m, int *n, z *alpha, z *a, int *lda, z *b, int *ldb, z *beta, z *c, int *ldc) noexcept nogil
|
| 160 |
+
cdef void zsyr2k(char *uplo, char *trans, int *n, int *k, z *alpha, z *a, int *lda, z *b, int *ldb, z *beta, z *c, int *ldc) noexcept nogil
|
| 161 |
+
cdef void zsyrk(char *uplo, char *trans, int *n, int *k, z *alpha, z *a, int *lda, z *beta, z *c, int *ldc) noexcept nogil
|
| 162 |
+
cdef void ztbmv(char *uplo, char *trans, char *diag, int *n, int *k, z *a, int *lda, z *x, int *incx) noexcept nogil
|
| 163 |
+
cdef void ztbsv(char *uplo, char *trans, char *diag, int *n, int *k, z *a, int *lda, z *x, int *incx) noexcept nogil
|
| 164 |
+
cdef void ztpmv(char *uplo, char *trans, char *diag, int *n, z *ap, z *x, int *incx) noexcept nogil
|
| 165 |
+
cdef void ztpsv(char *uplo, char *trans, char *diag, int *n, z *ap, z *x, int *incx) noexcept nogil
|
| 166 |
+
cdef void ztrmm(char *side, char *uplo, char *transa, char *diag, int *m, int *n, z *alpha, z *a, int *lda, z *b, int *ldb) noexcept nogil
|
| 167 |
+
cdef void ztrmv(char *uplo, char *trans, char *diag, int *n, z *a, int *lda, z *x, int *incx) noexcept nogil
|
| 168 |
+
cdef void ztrsm(char *side, char *uplo, char *transa, char *diag, int *m, int *n, z *alpha, z *a, int *lda, z *b, int *ldb) noexcept nogil
|
| 169 |
+
cdef void ztrsv(char *uplo, char *trans, char *diag, int *n, z *a, int *lda, z *x, int *incx) noexcept nogil
|
shared/package-files/0c/0c26e96fb439c6485b0e2206edf3b80b4a45e0ccdd7c14f298cb22bab5fd1401/digamma.h
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
// @generated by torchgen/gen.py from Function.h
|
| 4 |
+
|
| 5 |
+
#include <ATen/Context.h>
|
| 6 |
+
#include <ATen/DeviceGuard.h>
|
| 7 |
+
#include <ATen/TensorUtils.h>
|
| 8 |
+
#include <ATen/TracerMode.h>
|
| 9 |
+
#include <ATen/core/Generator.h>
|
| 10 |
+
#include <ATen/core/Reduction.h>
|
| 11 |
+
#include <ATen/core/Tensor.h>
|
| 12 |
+
#include <c10/core/Scalar.h>
|
| 13 |
+
#include <c10/core/Storage.h>
|
| 14 |
+
#include <c10/core/TensorOptions.h>
|
| 15 |
+
#include <c10/util/Deprecated.h>
|
| 16 |
+
#include <c10/util/Optional.h>
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
#include <ATen/ops/digamma_ops.h>
|
| 21 |
+
|
| 22 |
+
namespace at {
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
// aten::digamma.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)
|
| 26 |
+
inline at::Tensor & digamma_out(at::Tensor & out, const at::Tensor & self) {
|
| 27 |
+
return at::_ops::digamma_out::call(self, out);
|
| 28 |
+
}
|
| 29 |
+
// aten::digamma.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)
|
| 30 |
+
inline at::Tensor & digamma_outf(const at::Tensor & self, at::Tensor & out) {
|
| 31 |
+
return at::_ops::digamma_out::call(self, out);
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
// aten::digamma(Tensor self) -> Tensor
|
| 35 |
+
inline at::Tensor digamma(const at::Tensor & self)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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from io import StringIO
|
| 2 |
+
import logging
|
| 3 |
+
|
| 4 |
+
import unittest
|
| 5 |
+
from numba.core import tracing
|
| 6 |
+
|
| 7 |
+
logger = logging.getLogger('trace')
|
| 8 |
+
logger.setLevel(logging.INFO)
|
| 9 |
+
|
| 10 |
+
# Make sure tracing is enabled
|
| 11 |
+
orig_trace = tracing.trace
|
| 12 |
+
tracing.trace = tracing.dotrace
|
| 13 |
+
|
| 14 |
+
class CapturedTrace:
|
| 15 |
+
"""Capture the trace temporarily for validation."""
|
| 16 |
+
|
| 17 |
+
def __init__(self):
|
| 18 |
+
self.buffer = StringIO()
|
| 19 |
+
self.handler = logging.StreamHandler(self.buffer)
|
| 20 |
+
def __enter__(self):
|
| 21 |
+
self._handlers = logger.handlers
|
| 22 |
+
self.buffer = StringIO()
|
| 23 |
+
logger.handlers = [logging.StreamHandler(self.buffer)]
|
| 24 |
+
def __exit__(self, type, value, traceback):
|
| 25 |
+
logger.handlers = self._handlers
|
| 26 |
+
def getvalue(self):
|
| 27 |
+
|
| 28 |
+
# Depending on how the tests are run, object names may be
|
| 29 |
+
# qualified by their containing module.
|
| 30 |
+
# Remove that to make the trace output independent from the testing mode.
|
| 31 |
+
log = self.buffer.getvalue()
|
| 32 |
+
log = log.replace(__name__ + '.','')
|
| 33 |
+
return log
|
| 34 |
+
|
| 35 |
+
class Class(object):
|
| 36 |
+
|
| 37 |
+
@tracing.trace
|
| 38 |
+
@classmethod
|
| 39 |
+
def class_method(cls):
|
| 40 |
+
pass
|
| 41 |
+
|
| 42 |
+
@tracing.trace
|
| 43 |
+
@staticmethod
|
| 44 |
+
def static_method():
|
| 45 |
+
pass
|
| 46 |
+
|
| 47 |
+
__test = None
|
| 48 |
+
|
| 49 |
+
def _test_get(self):
|
| 50 |
+
return self.__test
|
| 51 |
+
|
| 52 |
+
def _test_set(self, value):
|
| 53 |
+
self.__test = value
|
| 54 |
+
|
| 55 |
+
test = tracing.trace(property(_test_get, _test_set))
|
| 56 |
+
|
| 57 |
+
@tracing.trace
|
| 58 |
+
def method(self, some, other='value', *args, **kwds):
|
| 59 |
+
pass
|
| 60 |
+
|
| 61 |
+
def __repr__(self):
|
| 62 |
+
"""Generate a deterministic string for testing."""
|
| 63 |
+
return '<Class instance>'
|
| 64 |
+
|
| 65 |
+
class Class2(object):
|
| 66 |
+
@classmethod
|
| 67 |
+
def class_method(cls):
|
| 68 |
+
pass
|
| 69 |
+
|
| 70 |
+
@staticmethod
|
| 71 |
+
def static_method():
|
| 72 |
+
pass
|
| 73 |
+
|
| 74 |
+
__test = None
|
| 75 |
+
@property
|
| 76 |
+
def test(self):
|
| 77 |
+
return self.__test
|
| 78 |
+
@test.setter
|
| 79 |
+
def test(self, value):
|
| 80 |
+
self.__test = value
|
| 81 |
+
|
| 82 |
+
def method(self):
|
| 83 |
+
pass
|
| 84 |
+
|
| 85 |
+
def __str__(self):
|
| 86 |
+
return 'Test(' + str(self.test) + ')'
|
| 87 |
+
|
| 88 |
+
def __repr__(self):
|
| 89 |
+
"""Generate a deterministic string for testing."""
|
| 90 |
+
return '<Class2 instance>'
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
@tracing.trace
|
| 94 |
+
def test(x, y, z = True):
|
| 95 |
+
a = x + y
|
| 96 |
+
b = x * y
|
| 97 |
+
if z: return a
|
| 98 |
+
else: return b
|
| 99 |
+
|
| 100 |
+
class TestTracing(unittest.TestCase):
|
| 101 |
+
|
| 102 |
+
def __init__(self, *args):
|
| 103 |
+
super(TestTracing, self).__init__(*args)
|
| 104 |
+
|
| 105 |
+
def setUp(self):
|
| 106 |
+
self.capture = CapturedTrace()
|
| 107 |
+
|
| 108 |
+
def tearDown(self):
|
| 109 |
+
del self.capture
|
| 110 |
+
|
| 111 |
+
def test_method(self):
|
| 112 |
+
|
| 113 |
+
with self.capture:
|
| 114 |
+
Class().method('foo', bar='baz')
|
| 115 |
+
self.assertEqual(self.capture.getvalue(),
|
| 116 |
+
">> Class.method(self=<Class instance>, some='foo', other='value', bar='baz')\n" +
|
| 117 |
+
"<< Class.method\n")
|
| 118 |
+
|
| 119 |
+
def test_class_method(self):
|
| 120 |
+
|
| 121 |
+
with self.capture:
|
| 122 |
+
Class.class_method()
|
| 123 |
+
self.assertEqual(self.capture.getvalue(),
|
| 124 |
+
">> Class.class_method(cls=<class 'Class'>)\n" +
|
| 125 |
+
"<< Class.class_method\n")
|
| 126 |
+
|
| 127 |
+
def test_static_method(self):
|
| 128 |
+
|
| 129 |
+
with self.capture:
|
| 130 |
+
Class.static_method()
|
| 131 |
+
self.assertEqual(self.capture.getvalue(),
|
| 132 |
+
">> static_method()\n" +
|
| 133 |
+
"<< static_method\n")
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
def test_property(self):
|
| 137 |
+
|
| 138 |
+
with self.capture:
|
| 139 |
+
test = Class()
|
| 140 |
+
test.test = 1
|
| 141 |
+
assert 1 == test.test
|
| 142 |
+
self.assertEqual(self.capture.getvalue(),
|
| 143 |
+
">> Class._test_set(self=<Class instance>, value=1)\n" +
|
| 144 |
+
"<< Class._test_set\n" +
|
| 145 |
+
">> Class._test_get(self=<Class instance>)\n" +
|
| 146 |
+
"<< Class._test_get -> 1\n")
|
| 147 |
+
|
| 148 |
+
def test_function(self):
|
| 149 |
+
|
| 150 |
+
with self.capture:
|
| 151 |
+
test(5, 5)
|
| 152 |
+
test(5, 5, False)
|
| 153 |
+
self.assertEqual(self.capture.getvalue(),
|
| 154 |
+
">> test(x=5, y=5, z=True)\n" +
|
| 155 |
+
"<< test -> 10\n" +
|
| 156 |
+
">> test(x=5, y=5, z=False)\n" +
|
| 157 |
+
"<< test -> 25\n")
|
| 158 |
+
|
| 159 |
+
@unittest.skip("recursive decoration not yet implemented")
|
| 160 |
+
def test_injected(self):
|
| 161 |
+
|
| 162 |
+
with self.capture:
|
| 163 |
+
tracing.trace(Class2, recursive=True)
|
| 164 |
+
Class2.class_method()
|
| 165 |
+
Class2.static_method()
|
| 166 |
+
test = Class2()
|
| 167 |
+
test.test = 1
|
| 168 |
+
assert 1 == test.test
|
| 169 |
+
test.method()
|
| 170 |
+
|
| 171 |
+
self.assertEqual(self.capture.getvalue(),
|
| 172 |
+
">> Class2.class_method(cls=<type 'Class2'>)\n" +
|
| 173 |
+
"<< Class2.class_method\n"
|
| 174 |
+
">> static_method()\n"
|
| 175 |
+
"<< static_method\n")
|
| 176 |
+
|
| 177 |
+
|
| 178 |
+
# Reset tracing to its original value
|
| 179 |
+
tracing.trace = orig_trace
|
| 180 |
+
|
| 181 |
+
if __name__ == '__main__':
|
| 182 |
+
unittest.main()
|
shared/package-files/0c/0c2f3a0c2146f970dbba975536dd8fb3af0ed8406db6756463c1858f0df8fcb8/vt100-nav
ADDED
|
Binary file (1.15 kB). View file
|
|
|
shared/package-files/0c/0c38936b6626aa40a1a4bccaafcd27f9939f2405d66fa618074444474d77747c/msvcrt.pyi
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
from typing import Text
|
| 3 |
+
|
| 4 |
+
# This module is only available on Windows
|
| 5 |
+
if sys.platform == "win32":
|
| 6 |
+
LK_LOCK: int
|
| 7 |
+
LK_NBLCK: int
|
| 8 |
+
LK_NBRLCK: int
|
| 9 |
+
LK_RLCK: int
|
| 10 |
+
LK_UNLCK: int
|
| 11 |
+
def locking(__fd: int, __mode: int, __nbytes: int) -> None: ...
|
| 12 |
+
def setmode(__fd: int, __mode: int) -> int: ...
|
| 13 |
+
def open_osfhandle(__handle: int, __flags: int) -> int: ...
|
| 14 |
+
def get_osfhandle(__fd: int) -> int: ...
|
| 15 |
+
def kbhit() -> bool: ...
|
| 16 |
+
def getch() -> bytes: ...
|
| 17 |
+
def getwch() -> Text: ...
|
| 18 |
+
def getche() -> bytes: ...
|
| 19 |
+
def getwche() -> Text: ...
|
| 20 |
+
def putch(__char: bytes) -> None: ...
|
| 21 |
+
def putwch(__unicode_char: Text) -> None: ...
|
| 22 |
+
def ungetch(__char: bytes) -> None: ...
|
| 23 |
+
def ungetwch(__unicode_char: Text) -> None: ...
|
| 24 |
+
def heapmin() -> None: ...
|
shared/package-files/0c/0c38a332607070a1ab616daa6f0cfc5b7bc3dd4abac295fff70edf60a6275763/textfmts.py
ADDED
|
@@ -0,0 +1,431 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.textfmts
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexers for various text formats.
|
| 6 |
+
|
| 7 |
+
:copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
|
| 8 |
+
:license: BSD, see LICENSE for details.
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
import re
|
| 12 |
+
|
| 13 |
+
from pygments.lexers import guess_lexer, get_lexer_by_name
|
| 14 |
+
from pygments.lexer import RegexLexer, bygroups, default, include
|
| 15 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 16 |
+
Number, Generic, Literal, Punctuation
|
| 17 |
+
from pygments.util import ClassNotFound
|
| 18 |
+
|
| 19 |
+
__all__ = ['IrcLogsLexer', 'TodotxtLexer', 'HttpLexer', 'GettextLexer',
|
| 20 |
+
'NotmuchLexer', 'KernelLogLexer']
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
class IrcLogsLexer(RegexLexer):
|
| 24 |
+
"""
|
| 25 |
+
Lexer for IRC logs in *irssi*, *xchat* or *weechat* style.
|
| 26 |
+
"""
|
| 27 |
+
|
| 28 |
+
name = 'IRC logs'
|
| 29 |
+
aliases = ['irc']
|
| 30 |
+
filenames = ['*.weechatlog']
|
| 31 |
+
mimetypes = ['text/x-irclog']
|
| 32 |
+
|
| 33 |
+
flags = re.VERBOSE | re.MULTILINE
|
| 34 |
+
timestamp = r"""
|
| 35 |
+
(
|
| 36 |
+
# irssi / xchat and others
|
| 37 |
+
(?: \[|\()? # Opening bracket or paren for the timestamp
|
| 38 |
+
(?: # Timestamp
|
| 39 |
+
(?: (?:\d{1,4} [-/])* # Date as - or /-separated groups of digits
|
| 40 |
+
(?:\d{1,4})
|
| 41 |
+
[T ])? # Date/time separator: T or space
|
| 42 |
+
(?: \d?\d [:.])* # Time as :/.-separated groups of 1 or 2 digits
|
| 43 |
+
(?: \d?\d)
|
| 44 |
+
)
|
| 45 |
+
(?: \]|\))?\s+ # Closing bracket or paren for the timestamp
|
| 46 |
+
|
|
| 47 |
+
# weechat
|
| 48 |
+
\d{4}\s\w{3}\s\d{2}\s # Date
|
| 49 |
+
\d{2}:\d{2}:\d{2}\s+ # Time + Whitespace
|
| 50 |
+
|
|
| 51 |
+
# xchat
|
| 52 |
+
\w{3}\s\d{2}\s # Date
|
| 53 |
+
\d{2}:\d{2}:\d{2}\s+ # Time + Whitespace
|
| 54 |
+
)?
|
| 55 |
+
"""
|
| 56 |
+
tokens = {
|
| 57 |
+
'root': [
|
| 58 |
+
# log start/end
|
| 59 |
+
(r'^\*\*\*\*(.*)\*\*\*\*$', Comment),
|
| 60 |
+
# hack
|
| 61 |
+
("^" + timestamp + r'(\s*<[^>]*>\s*)$', bygroups(Comment.Preproc, Name.Tag)),
|
| 62 |
+
# normal msgs
|
| 63 |
+
("^" + timestamp + r"""
|
| 64 |
+
(\s*<.*?>\s*) # Nick """,
|
| 65 |
+
bygroups(Comment.Preproc, Name.Tag), 'msg'),
|
| 66 |
+
# /me msgs
|
| 67 |
+
("^" + timestamp + r"""
|
| 68 |
+
(\s*[*]\s+) # Star
|
| 69 |
+
(\S+\s+.*?\n) # Nick + rest of message """,
|
| 70 |
+
bygroups(Comment.Preproc, Keyword, Generic.Inserted)),
|
| 71 |
+
# join/part msgs
|
| 72 |
+
("^" + timestamp + r"""
|
| 73 |
+
(\s*(?:\*{3}|<?-[!@=P]?->?)\s*) # Star(s) or symbols
|
| 74 |
+
(\S+\s+) # Nick + Space
|
| 75 |
+
(.*?\n) # Rest of message """,
|
| 76 |
+
bygroups(Comment.Preproc, Keyword, String, Comment)),
|
| 77 |
+
(r"^.*?\n", Text),
|
| 78 |
+
],
|
| 79 |
+
'msg': [
|
| 80 |
+
(r"\S+:(?!//)", Name.Attribute), # Prefix
|
| 81 |
+
(r".*\n", Text, '#pop'),
|
| 82 |
+
],
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
class GettextLexer(RegexLexer):
|
| 87 |
+
"""
|
| 88 |
+
Lexer for Gettext catalog files.
|
| 89 |
+
|
| 90 |
+
.. versionadded:: 0.9
|
| 91 |
+
"""
|
| 92 |
+
name = 'Gettext Catalog'
|
| 93 |
+
aliases = ['pot', 'po']
|
| 94 |
+
filenames = ['*.pot', '*.po']
|
| 95 |
+
mimetypes = ['application/x-gettext', 'text/x-gettext', 'text/gettext']
|
| 96 |
+
|
| 97 |
+
tokens = {
|
| 98 |
+
'root': [
|
| 99 |
+
(r'^#,\s.*?$', Keyword.Type),
|
| 100 |
+
(r'^#:\s.*?$', Keyword.Declaration),
|
| 101 |
+
# (r'^#$', Comment),
|
| 102 |
+
(r'^(#|#\.\s|#\|\s|#~\s|#\s).*$', Comment.Single),
|
| 103 |
+
(r'^(")([A-Za-z-]+:)(.*")$',
|
| 104 |
+
bygroups(String, Name.Property, String)),
|
| 105 |
+
(r'^".*"$', String),
|
| 106 |
+
(r'^(msgid|msgid_plural|msgstr|msgctxt)(\s+)(".*")$',
|
| 107 |
+
bygroups(Name.Variable, Text, String)),
|
| 108 |
+
(r'^(msgstr\[)(\d)(\])(\s+)(".*")$',
|
| 109 |
+
bygroups(Name.Variable, Number.Integer, Name.Variable, Text, String)),
|
| 110 |
+
]
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
class HttpLexer(RegexLexer):
|
| 115 |
+
"""
|
| 116 |
+
Lexer for HTTP sessions.
|
| 117 |
+
|
| 118 |
+
.. versionadded:: 1.5
|
| 119 |
+
"""
|
| 120 |
+
|
| 121 |
+
name = 'HTTP'
|
| 122 |
+
aliases = ['http']
|
| 123 |
+
|
| 124 |
+
flags = re.DOTALL
|
| 125 |
+
|
| 126 |
+
def get_tokens_unprocessed(self, text, stack=('root',)):
|
| 127 |
+
"""Reset the content-type state."""
|
| 128 |
+
self.content_type = None
|
| 129 |
+
return RegexLexer.get_tokens_unprocessed(self, text, stack)
|
| 130 |
+
|
| 131 |
+
def header_callback(self, match):
|
| 132 |
+
if match.group(1).lower() == 'content-type':
|
| 133 |
+
content_type = match.group(5).strip()
|
| 134 |
+
if ';' in content_type:
|
| 135 |
+
content_type = content_type[:content_type.find(';')].strip()
|
| 136 |
+
self.content_type = content_type
|
| 137 |
+
yield match.start(1), Name.Attribute, match.group(1)
|
| 138 |
+
yield match.start(2), Text, match.group(2)
|
| 139 |
+
yield match.start(3), Operator, match.group(3)
|
| 140 |
+
yield match.start(4), Text, match.group(4)
|
| 141 |
+
yield match.start(5), Literal, match.group(5)
|
| 142 |
+
yield match.start(6), Text, match.group(6)
|
| 143 |
+
|
| 144 |
+
def continuous_header_callback(self, match):
|
| 145 |
+
yield match.start(1), Text, match.group(1)
|
| 146 |
+
yield match.start(2), Literal, match.group(2)
|
| 147 |
+
yield match.start(3), Text, match.group(3)
|
| 148 |
+
|
| 149 |
+
def content_callback(self, match):
|
| 150 |
+
content_type = getattr(self, 'content_type', None)
|
| 151 |
+
content = match.group()
|
| 152 |
+
offset = match.start()
|
| 153 |
+
if content_type:
|
| 154 |
+
from pygments.lexers import get_lexer_for_mimetype
|
| 155 |
+
possible_lexer_mimetypes = [content_type]
|
| 156 |
+
if '+' in content_type:
|
| 157 |
+
# application/calendar+xml can be treated as application/xml
|
| 158 |
+
# if there's not a better match.
|
| 159 |
+
general_type = re.sub(r'^(.*)/.*\+(.*)$', r'\1/\2',
|
| 160 |
+
content_type)
|
| 161 |
+
possible_lexer_mimetypes.append(general_type)
|
| 162 |
+
|
| 163 |
+
for i in possible_lexer_mimetypes:
|
| 164 |
+
try:
|
| 165 |
+
lexer = get_lexer_for_mimetype(i)
|
| 166 |
+
except ClassNotFound:
|
| 167 |
+
pass
|
| 168 |
+
else:
|
| 169 |
+
for idx, token, value in lexer.get_tokens_unprocessed(content):
|
| 170 |
+
yield offset + idx, token, value
|
| 171 |
+
return
|
| 172 |
+
yield offset, Text, content
|
| 173 |
+
|
| 174 |
+
tokens = {
|
| 175 |
+
'root': [
|
| 176 |
+
(r'(GET|POST|PUT|DELETE|HEAD|OPTIONS|TRACE|PATCH|CONNECT)( +)([^ ]+)( +)'
|
| 177 |
+
r'(HTTP)(/)(1\.[01]|2(?:\.0)?|3)(\r?\n|\Z)',
|
| 178 |
+
bygroups(Name.Function, Text, Name.Namespace, Text,
|
| 179 |
+
Keyword.Reserved, Operator, Number, Text),
|
| 180 |
+
'headers'),
|
| 181 |
+
(r'(HTTP)(/)(1\.[01]|2(?:\.0)?|3)( +)(\d{3})(?:( +)([^\r\n]*))?(\r?\n|\Z)',
|
| 182 |
+
bygroups(Keyword.Reserved, Operator, Number, Text, Number, Text,
|
| 183 |
+
Name.Exception, Text),
|
| 184 |
+
'headers'),
|
| 185 |
+
],
|
| 186 |
+
'headers': [
|
| 187 |
+
(r'([^\s:]+)( *)(:)( *)([^\r\n]+)(\r?\n|\Z)', header_callback),
|
| 188 |
+
(r'([\t ]+)([^\r\n]+)(\r?\n|\Z)', continuous_header_callback),
|
| 189 |
+
(r'\r?\n', Text, 'content')
|
| 190 |
+
],
|
| 191 |
+
'content': [
|
| 192 |
+
(r'.+', content_callback)
|
| 193 |
+
]
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
def analyse_text(text):
|
| 197 |
+
return text.startswith(('GET /', 'POST /', 'PUT /', 'DELETE /', 'HEAD /',
|
| 198 |
+
'OPTIONS /', 'TRACE /', 'PATCH /', 'CONNECT '))
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
class TodotxtLexer(RegexLexer):
|
| 202 |
+
"""
|
| 203 |
+
Lexer for Todo.txt todo list format.
|
| 204 |
+
|
| 205 |
+
.. versionadded:: 2.0
|
| 206 |
+
"""
|
| 207 |
+
|
| 208 |
+
name = 'Todotxt'
|
| 209 |
+
url = 'http://todotxt.com/'
|
| 210 |
+
aliases = ['todotxt']
|
| 211 |
+
# *.todotxt is not a standard extension for Todo.txt files; including it
|
| 212 |
+
# makes testing easier, and also makes autodetecting file type easier.
|
| 213 |
+
filenames = ['todo.txt', '*.todotxt']
|
| 214 |
+
mimetypes = ['text/x-todo']
|
| 215 |
+
|
| 216 |
+
# Aliases mapping standard token types of Todo.txt format concepts
|
| 217 |
+
CompleteTaskText = Operator # Chosen to de-emphasize complete tasks
|
| 218 |
+
IncompleteTaskText = Text # Incomplete tasks should look like plain text
|
| 219 |
+
|
| 220 |
+
# Priority should have most emphasis to indicate importance of tasks
|
| 221 |
+
Priority = Generic.Heading
|
| 222 |
+
# Dates should have next most emphasis because time is important
|
| 223 |
+
Date = Generic.Subheading
|
| 224 |
+
|
| 225 |
+
# Project and context should have equal weight, and be in different colors
|
| 226 |
+
Project = Generic.Error
|
| 227 |
+
Context = String
|
| 228 |
+
|
| 229 |
+
# If tag functionality is added, it should have the same weight as Project
|
| 230 |
+
# and Context, and a different color. Generic.Traceback would work well.
|
| 231 |
+
|
| 232 |
+
# Regex patterns for building up rules; dates, priorities, projects, and
|
| 233 |
+
# contexts are all atomic
|
| 234 |
+
# TODO: Make date regex more ISO 8601 compliant
|
| 235 |
+
date_regex = r'\d{4,}-\d{2}-\d{2}'
|
| 236 |
+
priority_regex = r'\([A-Z]\)'
|
| 237 |
+
project_regex = r'\+\S+'
|
| 238 |
+
context_regex = r'@\S+'
|
| 239 |
+
|
| 240 |
+
# Compound regex expressions
|
| 241 |
+
complete_one_date_regex = r'(x )(' + date_regex + r')'
|
| 242 |
+
complete_two_date_regex = (complete_one_date_regex + r'( )(' +
|
| 243 |
+
date_regex + r')')
|
| 244 |
+
priority_date_regex = r'(' + priority_regex + r')( )(' + date_regex + r')'
|
| 245 |
+
|
| 246 |
+
tokens = {
|
| 247 |
+
# Should parse starting at beginning of line; each line is a task
|
| 248 |
+
'root': [
|
| 249 |
+
# Complete task entry points: two total:
|
| 250 |
+
# 1. Complete task with two dates
|
| 251 |
+
(complete_two_date_regex, bygroups(CompleteTaskText, Date,
|
| 252 |
+
CompleteTaskText, Date),
|
| 253 |
+
'complete'),
|
| 254 |
+
# 2. Complete task with one date
|
| 255 |
+
(complete_one_date_regex, bygroups(CompleteTaskText, Date),
|
| 256 |
+
'complete'),
|
| 257 |
+
|
| 258 |
+
# Incomplete task entry points: six total:
|
| 259 |
+
# 1. Priority plus date
|
| 260 |
+
(priority_date_regex, bygroups(Priority, IncompleteTaskText, Date),
|
| 261 |
+
'incomplete'),
|
| 262 |
+
# 2. Priority only
|
| 263 |
+
(priority_regex, Priority, 'incomplete'),
|
| 264 |
+
# 3. Leading date
|
| 265 |
+
(date_regex, Date, 'incomplete'),
|
| 266 |
+
# 4. Leading context
|
| 267 |
+
(context_regex, Context, 'incomplete'),
|
| 268 |
+
# 5. Leading project
|
| 269 |
+
(project_regex, Project, 'incomplete'),
|
| 270 |
+
# 6. Non-whitespace catch-all
|
| 271 |
+
(r'\S+', IncompleteTaskText, 'incomplete'),
|
| 272 |
+
],
|
| 273 |
+
|
| 274 |
+
# Parse a complete task
|
| 275 |
+
'complete': [
|
| 276 |
+
# Newline indicates end of task, should return to root
|
| 277 |
+
(r'\s*\n', CompleteTaskText, '#pop'),
|
| 278 |
+
# Tokenize contexts and projects
|
| 279 |
+
(context_regex, Context),
|
| 280 |
+
(project_regex, Project),
|
| 281 |
+
# Tokenize non-whitespace text
|
| 282 |
+
(r'\S+', CompleteTaskText),
|
| 283 |
+
# Tokenize whitespace not containing a newline
|
| 284 |
+
(r'\s+', CompleteTaskText),
|
| 285 |
+
],
|
| 286 |
+
|
| 287 |
+
# Parse an incomplete task
|
| 288 |
+
'incomplete': [
|
| 289 |
+
# Newline indicates end of task, should return to root
|
| 290 |
+
(r'\s*\n', IncompleteTaskText, '#pop'),
|
| 291 |
+
# Tokenize contexts and projects
|
| 292 |
+
(context_regex, Context),
|
| 293 |
+
(project_regex, Project),
|
| 294 |
+
# Tokenize non-whitespace text
|
| 295 |
+
(r'\S+', IncompleteTaskText),
|
| 296 |
+
# Tokenize whitespace not containing a newline
|
| 297 |
+
(r'\s+', IncompleteTaskText),
|
| 298 |
+
],
|
| 299 |
+
}
|
| 300 |
+
|
| 301 |
+
|
| 302 |
+
class NotmuchLexer(RegexLexer):
|
| 303 |
+
"""
|
| 304 |
+
For Notmuch email text format.
|
| 305 |
+
|
| 306 |
+
.. versionadded:: 2.5
|
| 307 |
+
|
| 308 |
+
Additional options accepted:
|
| 309 |
+
|
| 310 |
+
`body_lexer`
|
| 311 |
+
If given, highlight the contents of the message body with the specified
|
| 312 |
+
lexer, else guess it according to the body content (default: ``None``).
|
| 313 |
+
"""
|
| 314 |
+
|
| 315 |
+
name = 'Notmuch'
|
| 316 |
+
url = 'https://notmuchmail.org/'
|
| 317 |
+
aliases = ['notmuch']
|
| 318 |
+
|
| 319 |
+
def _highlight_code(self, match):
|
| 320 |
+
code = match.group(1)
|
| 321 |
+
|
| 322 |
+
try:
|
| 323 |
+
if self.body_lexer:
|
| 324 |
+
lexer = get_lexer_by_name(self.body_lexer)
|
| 325 |
+
else:
|
| 326 |
+
lexer = guess_lexer(code.strip())
|
| 327 |
+
except ClassNotFound:
|
| 328 |
+
lexer = get_lexer_by_name('text')
|
| 329 |
+
|
| 330 |
+
yield from lexer.get_tokens_unprocessed(code)
|
| 331 |
+
|
| 332 |
+
tokens = {
|
| 333 |
+
'root': [
|
| 334 |
+
(r'\fmessage\{\s*', Keyword, ('message', 'message-attr')),
|
| 335 |
+
],
|
| 336 |
+
'message-attr': [
|
| 337 |
+
(r'(\s*id:\s*)(\S+)', bygroups(Name.Attribute, String)),
|
| 338 |
+
(r'(\s*(?:depth|match|excluded):\s*)(\d+)',
|
| 339 |
+
bygroups(Name.Attribute, Number.Integer)),
|
| 340 |
+
(r'(\s*filename:\s*)(.+\n)',
|
| 341 |
+
bygroups(Name.Attribute, String)),
|
| 342 |
+
default('#pop'),
|
| 343 |
+
],
|
| 344 |
+
'message': [
|
| 345 |
+
(r'\fmessage\}\n', Keyword, '#pop'),
|
| 346 |
+
(r'\fheader\{\n', Keyword, 'header'),
|
| 347 |
+
(r'\fbody\{\n', Keyword, 'body'),
|
| 348 |
+
],
|
| 349 |
+
'header': [
|
| 350 |
+
(r'\fheader\}\n', Keyword, '#pop'),
|
| 351 |
+
(r'((?:Subject|From|To|Cc|Date):\s*)(.*\n)',
|
| 352 |
+
bygroups(Name.Attribute, String)),
|
| 353 |
+
(r'(.*)(\s*\(.*\))(\s*\(.*\)\n)',
|
| 354 |
+
bygroups(Generic.Strong, Literal, Name.Tag)),
|
| 355 |
+
],
|
| 356 |
+
'body': [
|
| 357 |
+
(r'\fpart\{\n', Keyword, 'part'),
|
| 358 |
+
(r'\f(part|attachment)\{\s*', Keyword, ('part', 'part-attr')),
|
| 359 |
+
(r'\fbody\}\n', Keyword, '#pop'),
|
| 360 |
+
],
|
| 361 |
+
'part-attr': [
|
| 362 |
+
(r'(ID:\s*)(\d+)', bygroups(Name.Attribute, Number.Integer)),
|
| 363 |
+
(r'(,\s*)((?:Filename|Content-id):\s*)([^,]+)',
|
| 364 |
+
bygroups(Punctuation, Name.Attribute, String)),
|
| 365 |
+
(r'(,\s*)(Content-type:\s*)(.+\n)',
|
| 366 |
+
bygroups(Punctuation, Name.Attribute, String)),
|
| 367 |
+
default('#pop'),
|
| 368 |
+
],
|
| 369 |
+
'part': [
|
| 370 |
+
(r'\f(?:part|attachment)\}\n', Keyword, '#pop'),
|
| 371 |
+
(r'\f(?:part|attachment)\{\s*', Keyword, ('#push', 'part-attr')),
|
| 372 |
+
(r'^Non-text part: .*\n', Comment),
|
| 373 |
+
(r'(?s)(.*?(?=\f(?:part|attachment)\}\n))', _highlight_code),
|
| 374 |
+
],
|
| 375 |
+
}
|
| 376 |
+
|
| 377 |
+
def analyse_text(text):
|
| 378 |
+
return 1.0 if text.startswith('\fmessage{') else 0.0
|
| 379 |
+
|
| 380 |
+
def __init__(self, **options):
|
| 381 |
+
self.body_lexer = options.get('body_lexer', None)
|
| 382 |
+
RegexLexer.__init__(self, **options)
|
| 383 |
+
|
| 384 |
+
|
| 385 |
+
class KernelLogLexer(RegexLexer):
|
| 386 |
+
"""
|
| 387 |
+
For Linux Kernel log ("dmesg") output.
|
| 388 |
+
|
| 389 |
+
.. versionadded:: 2.6
|
| 390 |
+
"""
|
| 391 |
+
name = 'Kernel log'
|
| 392 |
+
aliases = ['kmsg', 'dmesg']
|
| 393 |
+
filenames = ['*.kmsg', '*.dmesg']
|
| 394 |
+
|
| 395 |
+
tokens = {
|
| 396 |
+
'root': [
|
| 397 |
+
(r'^[^:]+:debug : (?=\[)', Text, 'debug'),
|
| 398 |
+
(r'^[^:]+:info : (?=\[)', Text, 'info'),
|
| 399 |
+
(r'^[^:]+:warn : (?=\[)', Text, 'warn'),
|
| 400 |
+
(r'^[^:]+:notice: (?=\[)', Text, 'warn'),
|
| 401 |
+
(r'^[^:]+:err : (?=\[)', Text, 'error'),
|
| 402 |
+
(r'^[^:]+:crit : (?=\[)', Text, 'error'),
|
| 403 |
+
(r'^(?=\[)', Text, 'unknown'),
|
| 404 |
+
],
|
| 405 |
+
'unknown': [
|
| 406 |
+
(r'^(?=.+(warning|notice|audit|deprecated))', Text, 'warn'),
|
| 407 |
+
(r'^(?=.+(error|critical|fail|Bug))', Text, 'error'),
|
| 408 |
+
default('info'),
|
| 409 |
+
],
|
| 410 |
+
'base': [
|
| 411 |
+
(r'\[[0-9. ]+\] ', Number),
|
| 412 |
+
(r'(?<=\] ).+?:', Keyword),
|
| 413 |
+
(r'\n', Text, '#pop'),
|
| 414 |
+
],
|
| 415 |
+
'debug': [
|
| 416 |
+
include('base'),
|
| 417 |
+
(r'.+\n', Comment, '#pop')
|
| 418 |
+
],
|
| 419 |
+
'info': [
|
| 420 |
+
include('base'),
|
| 421 |
+
(r'.+\n', Text, '#pop')
|
| 422 |
+
],
|
| 423 |
+
'warn': [
|
| 424 |
+
include('base'),
|
| 425 |
+
(r'.+\n', Generic.Strong, '#pop')
|
| 426 |
+
],
|
| 427 |
+
'error': [
|
| 428 |
+
include('base'),
|
| 429 |
+
(r'.+\n', Generic.Error, '#pop')
|
| 430 |
+
]
|
| 431 |
+
}
|
shared/package-files/0c/0c3b8cc2b2263040b0e8c85f9dc9f6c4c3a390570a515d4ed79f7bfdf485480b/chunked_builder.h
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <memory>
|
| 21 |
+
#include <vector>
|
| 22 |
+
|
| 23 |
+
#include "arrow/status.h"
|
| 24 |
+
#include "arrow/type_fwd.h"
|
| 25 |
+
#include "arrow/util/type_fwd.h"
|
| 26 |
+
#include "arrow/util/visibility.h"
|
| 27 |
+
|
| 28 |
+
namespace arrow {
|
| 29 |
+
namespace json {
|
| 30 |
+
|
| 31 |
+
class PromotionGraph;
|
| 32 |
+
|
| 33 |
+
class ARROW_EXPORT ChunkedArrayBuilder {
|
| 34 |
+
public:
|
| 35 |
+
virtual ~ChunkedArrayBuilder() = default;
|
| 36 |
+
|
| 37 |
+
/// Spawn a task that will try to convert and insert the given JSON block
|
| 38 |
+
virtual void Insert(int64_t block_index,
|
| 39 |
+
const std::shared_ptr<Field>& unconverted_field,
|
| 40 |
+
const std::shared_ptr<Array>& unconverted) = 0;
|
| 41 |
+
|
| 42 |
+
/// Return the final chunked array.
|
| 43 |
+
/// Every chunk must be inserted before this is called!
|
| 44 |
+
virtual Status Finish(std::shared_ptr<ChunkedArray>* out) = 0;
|
| 45 |
+
|
| 46 |
+
/// Finish current task group and substitute a new one
|
| 47 |
+
virtual Status ReplaceTaskGroup(
|
| 48 |
+
const std::shared_ptr<arrow::internal::TaskGroup>& task_group) = 0;
|
| 49 |
+
|
| 50 |
+
protected:
|
| 51 |
+
explicit ChunkedArrayBuilder(
|
| 52 |
+
const std::shared_ptr<arrow::internal::TaskGroup>& task_group)
|
| 53 |
+
: task_group_(task_group) {}
|
| 54 |
+
|
| 55 |
+
std::shared_ptr<arrow::internal::TaskGroup> task_group_;
|
| 56 |
+
};
|
| 57 |
+
|
| 58 |
+
/// create a chunked builder
|
| 59 |
+
///
|
| 60 |
+
/// if unexpected fields and promotion need to be handled, promotion_graph must be
|
| 61 |
+
/// non-null
|
| 62 |
+
ARROW_EXPORT Status MakeChunkedArrayBuilder(
|
| 63 |
+
const std::shared_ptr<arrow::internal::TaskGroup>& task_group, MemoryPool* pool,
|
| 64 |
+
const PromotionGraph* promotion_graph, const std::shared_ptr<DataType>& type,
|
| 65 |
+
std::shared_ptr<ChunkedArrayBuilder>* out);
|
| 66 |
+
|
| 67 |
+
} // namespace json
|
| 68 |
+
} // namespace arrow
|
shared/package-files/0c/0c3bf5261f951c3c1c6373588b8fbd4a9c7fe7dbba9face51bb58c8b74ad989b/distro.py
ADDED
|
@@ -0,0 +1,1107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2015,2016 Nir Cohen
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
|
| 15 |
+
"""
|
| 16 |
+
The ``distro`` package (``distro`` stands for Linux Distribution) provides
|
| 17 |
+
information about the Linux distribution it runs on, such as a reliable
|
| 18 |
+
machine-readable distro ID, or version information.
|
| 19 |
+
|
| 20 |
+
It is a renewed alternative implementation for Python's original
|
| 21 |
+
:py:func:`platform.linux_distribution` function, but it provides much more
|
| 22 |
+
functionality. An alternative implementation became necessary because Python
|
| 23 |
+
3.5 deprecated this function, and Python 3.7 is expected to remove it
|
| 24 |
+
altogether. Its predecessor function :py:func:`platform.dist` was already
|
| 25 |
+
deprecated since Python 2.6 and is also expected to be removed in Python 3.7.
|
| 26 |
+
Still, there are many cases in which access to Linux distribution information
|
| 27 |
+
is needed. See `Python issue 1322 <https://bugs.python.org/issue1322>`_ for
|
| 28 |
+
more information.
|
| 29 |
+
"""
|
| 30 |
+
|
| 31 |
+
import os
|
| 32 |
+
import re
|
| 33 |
+
import sys
|
| 34 |
+
import json
|
| 35 |
+
import shlex
|
| 36 |
+
import logging
|
| 37 |
+
import argparse
|
| 38 |
+
import subprocess
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
if not sys.platform.startswith('linux'):
|
| 42 |
+
raise ImportError('Unsupported platform: {0}'.format(sys.platform))
|
| 43 |
+
|
| 44 |
+
_UNIXCONFDIR = os.environ.get('UNIXCONFDIR', '/etc')
|
| 45 |
+
_OS_RELEASE_BASENAME = 'os-release'
|
| 46 |
+
|
| 47 |
+
#: Translation table for normalizing the "ID" attribute defined in os-release
|
| 48 |
+
#: files, for use by the :func:`distro.id` method.
|
| 49 |
+
#:
|
| 50 |
+
#: * Key: Value as defined in the os-release file, translated to lower case,
|
| 51 |
+
#: with blanks translated to underscores.
|
| 52 |
+
#:
|
| 53 |
+
#: * Value: Normalized value.
|
| 54 |
+
NORMALIZED_OS_ID = {}
|
| 55 |
+
|
| 56 |
+
#: Translation table for normalizing the "Distributor ID" attribute returned by
|
| 57 |
+
#: the lsb_release command, for use by the :func:`distro.id` method.
|
| 58 |
+
#:
|
| 59 |
+
#: * Key: Value as returned by the lsb_release command, translated to lower
|
| 60 |
+
#: case, with blanks translated to underscores.
|
| 61 |
+
#:
|
| 62 |
+
#: * Value: Normalized value.
|
| 63 |
+
NORMALIZED_LSB_ID = {
|
| 64 |
+
'enterpriseenterprise': 'oracle', # Oracle Enterprise Linux
|
| 65 |
+
'redhatenterpriseworkstation': 'rhel', # RHEL 6, 7 Workstation
|
| 66 |
+
'redhatenterpriseserver': 'rhel', # RHEL 6, 7 Server
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
#: Translation table for normalizing the distro ID derived from the file name
|
| 70 |
+
#: of distro release files, for use by the :func:`distro.id` method.
|
| 71 |
+
#:
|
| 72 |
+
#: * Key: Value as derived from the file name of a distro release file,
|
| 73 |
+
#: translated to lower case, with blanks translated to underscores.
|
| 74 |
+
#:
|
| 75 |
+
#: * Value: Normalized value.
|
| 76 |
+
NORMALIZED_DISTRO_ID = {
|
| 77 |
+
'redhat': 'rhel', # RHEL 6.x, 7.x
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
# Pattern for content of distro release file (reversed)
|
| 81 |
+
_DISTRO_RELEASE_CONTENT_REVERSED_PATTERN = re.compile(
|
| 82 |
+
r'(?:[^)]*\)(.*)\()? *(?:STL )?([\d.+\-a-z]*\d) *(?:esaeler *)?(.+)')
|
| 83 |
+
|
| 84 |
+
# Pattern for base file name of distro release file
|
| 85 |
+
_DISTRO_RELEASE_BASENAME_PATTERN = re.compile(
|
| 86 |
+
r'(\w+)[-_](release|version)$')
|
| 87 |
+
|
| 88 |
+
# Base file names to be ignored when searching for distro release file
|
| 89 |
+
_DISTRO_RELEASE_IGNORE_BASENAMES = (
|
| 90 |
+
'debian_version',
|
| 91 |
+
'lsb-release',
|
| 92 |
+
'oem-release',
|
| 93 |
+
_OS_RELEASE_BASENAME,
|
| 94 |
+
'system-release'
|
| 95 |
+
)
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
def linux_distribution(full_distribution_name=True):
|
| 99 |
+
"""
|
| 100 |
+
Return information about the current Linux distribution as a tuple
|
| 101 |
+
``(id_name, version, codename)`` with items as follows:
|
| 102 |
+
|
| 103 |
+
* ``id_name``: If *full_distribution_name* is false, the result of
|
| 104 |
+
:func:`distro.id`. Otherwise, the result of :func:`distro.name`.
|
| 105 |
+
|
| 106 |
+
* ``version``: The result of :func:`distro.version`.
|
| 107 |
+
|
| 108 |
+
* ``codename``: The result of :func:`distro.codename`.
|
| 109 |
+
|
| 110 |
+
The interface of this function is compatible with the original
|
| 111 |
+
:py:func:`platform.linux_distribution` function, supporting a subset of
|
| 112 |
+
its parameters.
|
| 113 |
+
|
| 114 |
+
The data it returns may not exactly be the same, because it uses more data
|
| 115 |
+
sources than the original function, and that may lead to different data if
|
| 116 |
+
the Linux distribution is not consistent across multiple data sources it
|
| 117 |
+
provides (there are indeed such distributions ...).
|
| 118 |
+
|
| 119 |
+
Another reason for differences is the fact that the :func:`distro.id`
|
| 120 |
+
method normalizes the distro ID string to a reliable machine-readable value
|
| 121 |
+
for a number of popular Linux distributions.
|
| 122 |
+
"""
|
| 123 |
+
return _distro.linux_distribution(full_distribution_name)
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
def id():
|
| 127 |
+
"""
|
| 128 |
+
Return the distro ID of the current Linux distribution, as a
|
| 129 |
+
machine-readable string.
|
| 130 |
+
|
| 131 |
+
For a number of Linux distributions, the returned distro ID value is
|
| 132 |
+
*reliable*, in the sense that it is documented and that it does not change
|
| 133 |
+
across releases of the distribution.
|
| 134 |
+
|
| 135 |
+
This package maintains the following reliable distro ID values:
|
| 136 |
+
|
| 137 |
+
============== =========================================
|
| 138 |
+
Distro ID Distribution
|
| 139 |
+
============== =========================================
|
| 140 |
+
"ubuntu" Ubuntu
|
| 141 |
+
"debian" Debian
|
| 142 |
+
"rhel" RedHat Enterprise Linux
|
| 143 |
+
"centos" CentOS
|
| 144 |
+
"fedora" Fedora
|
| 145 |
+
"sles" SUSE Linux Enterprise Server
|
| 146 |
+
"opensuse" openSUSE
|
| 147 |
+
"amazon" Amazon Linux
|
| 148 |
+
"arch" Arch Linux
|
| 149 |
+
"cloudlinux" CloudLinux OS
|
| 150 |
+
"exherbo" Exherbo Linux
|
| 151 |
+
"gentoo" GenToo Linux
|
| 152 |
+
"ibm_powerkvm" IBM PowerKVM
|
| 153 |
+
"kvmibm" KVM for IBM z Systems
|
| 154 |
+
"linuxmint" Linux Mint
|
| 155 |
+
"mageia" Mageia
|
| 156 |
+
"mandriva" Mandriva Linux
|
| 157 |
+
"parallels" Parallels
|
| 158 |
+
"pidora" Pidora
|
| 159 |
+
"raspbian" Raspbian
|
| 160 |
+
"oracle" Oracle Linux (and Oracle Enterprise Linux)
|
| 161 |
+
"scientific" Scientific Linux
|
| 162 |
+
"slackware" Slackware
|
| 163 |
+
"xenserver" XenServer
|
| 164 |
+
============== =========================================
|
| 165 |
+
|
| 166 |
+
If you have a need to get distros for reliable IDs added into this set,
|
| 167 |
+
or if you find that the :func:`distro.id` function returns a different
|
| 168 |
+
distro ID for one of the listed distros, please create an issue in the
|
| 169 |
+
`distro issue tracker`_.
|
| 170 |
+
|
| 171 |
+
**Lookup hierarchy and transformations:**
|
| 172 |
+
|
| 173 |
+
First, the ID is obtained from the following sources, in the specified
|
| 174 |
+
order. The first available and non-empty value is used:
|
| 175 |
+
|
| 176 |
+
* the value of the "ID" attribute of the os-release file,
|
| 177 |
+
|
| 178 |
+
* the value of the "Distributor ID" attribute returned by the lsb_release
|
| 179 |
+
command,
|
| 180 |
+
|
| 181 |
+
* the first part of the file name of the distro release file,
|
| 182 |
+
|
| 183 |
+
The so determined ID value then passes the following transformations,
|
| 184 |
+
before it is returned by this method:
|
| 185 |
+
|
| 186 |
+
* it is translated to lower case,
|
| 187 |
+
|
| 188 |
+
* blanks (which should not be there anyway) are translated to underscores,
|
| 189 |
+
|
| 190 |
+
* a normalization of the ID is performed, based upon
|
| 191 |
+
`normalization tables`_. The purpose of this normalization is to ensure
|
| 192 |
+
that the ID is as reliable as possible, even across incompatible changes
|
| 193 |
+
in the Linux distributions. A common reason for an incompatible change is
|
| 194 |
+
the addition of an os-release file, or the addition of the lsb_release
|
| 195 |
+
command, with ID values that differ from what was previously determined
|
| 196 |
+
from the distro release file name.
|
| 197 |
+
"""
|
| 198 |
+
return _distro.id()
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
def name(pretty=False):
|
| 202 |
+
"""
|
| 203 |
+
Return the name of the current Linux distribution, as a human-readable
|
| 204 |
+
string.
|
| 205 |
+
|
| 206 |
+
If *pretty* is false, the name is returned without version or codename.
|
| 207 |
+
(e.g. "CentOS Linux")
|
| 208 |
+
|
| 209 |
+
If *pretty* is true, the version and codename are appended.
|
| 210 |
+
(e.g. "CentOS Linux 7.1.1503 (Core)")
|
| 211 |
+
|
| 212 |
+
**Lookup hierarchy:**
|
| 213 |
+
|
| 214 |
+
The name is obtained from the following sources, in the specified order.
|
| 215 |
+
The first available and non-empty value is used:
|
| 216 |
+
|
| 217 |
+
* If *pretty* is false:
|
| 218 |
+
|
| 219 |
+
- the value of the "NAME" attribute of the os-release file,
|
| 220 |
+
|
| 221 |
+
- the value of the "Distributor ID" attribute returned by the lsb_release
|
| 222 |
+
command,
|
| 223 |
+
|
| 224 |
+
- the value of the "<name>" field of the distro release file.
|
| 225 |
+
|
| 226 |
+
* If *pretty* is true:
|
| 227 |
+
|
| 228 |
+
- the value of the "PRETTY_NAME" attribute of the os-release file,
|
| 229 |
+
|
| 230 |
+
- the value of the "Description" attribute returned by the lsb_release
|
| 231 |
+
command,
|
| 232 |
+
|
| 233 |
+
- the value of the "<name>" field of the distro release file, appended
|
| 234 |
+
with the value of the pretty version ("<version_id>" and "<codename>"
|
| 235 |
+
fields) of the distro release file, if available.
|
| 236 |
+
"""
|
| 237 |
+
return _distro.name(pretty)
|
| 238 |
+
|
| 239 |
+
|
| 240 |
+
def version(pretty=False, best=False):
|
| 241 |
+
"""
|
| 242 |
+
Return the version of the current Linux distribution, as a human-readable
|
| 243 |
+
string.
|
| 244 |
+
|
| 245 |
+
If *pretty* is false, the version is returned without codename (e.g.
|
| 246 |
+
"7.0").
|
| 247 |
+
|
| 248 |
+
If *pretty* is true, the codename in parenthesis is appended, if the
|
| 249 |
+
codename is non-empty (e.g. "7.0 (Maipo)").
|
| 250 |
+
|
| 251 |
+
Some distributions provide version numbers with different precisions in
|
| 252 |
+
the different sources of distribution information. Examining the different
|
| 253 |
+
sources in a fixed priority order does not always yield the most precise
|
| 254 |
+
version (e.g. for Debian 8.2, or CentOS 7.1).
|
| 255 |
+
|
| 256 |
+
The *best* parameter can be used to control the approach for the returned
|
| 257 |
+
version:
|
| 258 |
+
|
| 259 |
+
If *best* is false, the first non-empty version number in priority order of
|
| 260 |
+
the examined sources is returned.
|
| 261 |
+
|
| 262 |
+
If *best* is true, the most precise version number out of all examined
|
| 263 |
+
sources is returned.
|
| 264 |
+
|
| 265 |
+
**Lookup hierarchy:**
|
| 266 |
+
|
| 267 |
+
In all cases, the version number is obtained from the following sources.
|
| 268 |
+
If *best* is false, this order represents the priority order:
|
| 269 |
+
|
| 270 |
+
* the value of the "VERSION_ID" attribute of the os-release file,
|
| 271 |
+
* the value of the "Release" attribute returned by the lsb_release
|
| 272 |
+
command,
|
| 273 |
+
* the version number parsed from the "<version_id>" field of the first line
|
| 274 |
+
of the distro release file,
|
| 275 |
+
* the version number parsed from the "PRETTY_NAME" attribute of the
|
| 276 |
+
os-release file, if it follows the format of the distro release files.
|
| 277 |
+
* the version number parsed from the "Description" attribute returned by
|
| 278 |
+
the lsb_release command, if it follows the format of the distro release
|
| 279 |
+
files.
|
| 280 |
+
"""
|
| 281 |
+
return _distro.version(pretty, best)
|
| 282 |
+
|
| 283 |
+
|
| 284 |
+
def version_parts(best=False):
|
| 285 |
+
"""
|
| 286 |
+
Return the version of the current Linux distribution as a tuple
|
| 287 |
+
``(major, minor, build_number)`` with items as follows:
|
| 288 |
+
|
| 289 |
+
* ``major``: The result of :func:`distro.major_version`.
|
| 290 |
+
|
| 291 |
+
* ``minor``: The result of :func:`distro.minor_version`.
|
| 292 |
+
|
| 293 |
+
* ``build_number``: The result of :func:`distro.build_number`.
|
| 294 |
+
|
| 295 |
+
For a description of the *best* parameter, see the :func:`distro.version`
|
| 296 |
+
method.
|
| 297 |
+
"""
|
| 298 |
+
return _distro.version_parts(best)
|
| 299 |
+
|
| 300 |
+
|
| 301 |
+
def major_version(best=False):
|
| 302 |
+
"""
|
| 303 |
+
Return the major version of the current Linux distribution, as a string,
|
| 304 |
+
if provided.
|
| 305 |
+
Otherwise, the empty string is returned. The major version is the first
|
| 306 |
+
part of the dot-separated version string.
|
| 307 |
+
|
| 308 |
+
For a description of the *best* parameter, see the :func:`distro.version`
|
| 309 |
+
method.
|
| 310 |
+
"""
|
| 311 |
+
return _distro.major_version(best)
|
| 312 |
+
|
| 313 |
+
|
| 314 |
+
def minor_version(best=False):
|
| 315 |
+
"""
|
| 316 |
+
Return the minor version of the current Linux distribution, as a string,
|
| 317 |
+
if provided.
|
| 318 |
+
Otherwise, the empty string is returned. The minor version is the second
|
| 319 |
+
part of the dot-separated version string.
|
| 320 |
+
|
| 321 |
+
For a description of the *best* parameter, see the :func:`distro.version`
|
| 322 |
+
method.
|
| 323 |
+
"""
|
| 324 |
+
return _distro.minor_version(best)
|
| 325 |
+
|
| 326 |
+
|
| 327 |
+
def build_number(best=False):
|
| 328 |
+
"""
|
| 329 |
+
Return the build number of the current Linux distribution, as a string,
|
| 330 |
+
if provided.
|
| 331 |
+
Otherwise, the empty string is returned. The build number is the third part
|
| 332 |
+
of the dot-separated version string.
|
| 333 |
+
|
| 334 |
+
For a description of the *best* parameter, see the :func:`distro.version`
|
| 335 |
+
method.
|
| 336 |
+
"""
|
| 337 |
+
return _distro.build_number(best)
|
| 338 |
+
|
| 339 |
+
|
| 340 |
+
def like():
|
| 341 |
+
"""
|
| 342 |
+
Return a space-separated list of distro IDs of distributions that are
|
| 343 |
+
closely related to the current Linux distribution in regards to packaging
|
| 344 |
+
and programming interfaces, for example distributions the current
|
| 345 |
+
distribution is a derivative from.
|
| 346 |
+
|
| 347 |
+
**Lookup hierarchy:**
|
| 348 |
+
|
| 349 |
+
This information item is only provided by the os-release file.
|
| 350 |
+
For details, see the description of the "ID_LIKE" attribute in the
|
| 351 |
+
`os-release man page
|
| 352 |
+
<http://www.freedesktop.org/software/systemd/man/os-release.html>`_.
|
| 353 |
+
"""
|
| 354 |
+
return _distro.like()
|
| 355 |
+
|
| 356 |
+
|
| 357 |
+
def codename():
|
| 358 |
+
"""
|
| 359 |
+
Return the codename for the release of the current Linux distribution,
|
| 360 |
+
as a string.
|
| 361 |
+
|
| 362 |
+
If the distribution does not have a codename, an empty string is returned.
|
| 363 |
+
|
| 364 |
+
Note that the returned codename is not always really a codename. For
|
| 365 |
+
example, openSUSE returns "x86_64". This function does not handle such
|
| 366 |
+
cases in any special way and just returns the string it finds, if any.
|
| 367 |
+
|
| 368 |
+
**Lookup hierarchy:**
|
| 369 |
+
|
| 370 |
+
* the codename within the "VERSION" attribute of the os-release file, if
|
| 371 |
+
provided,
|
| 372 |
+
|
| 373 |
+
* the value of the "Codename" attribute returned by the lsb_release
|
| 374 |
+
command,
|
| 375 |
+
|
| 376 |
+
* the value of the "<codename>" field of the distro release file.
|
| 377 |
+
"""
|
| 378 |
+
return _distro.codename()
|
| 379 |
+
|
| 380 |
+
|
| 381 |
+
def info(pretty=False, best=False):
|
| 382 |
+
"""
|
| 383 |
+
Return certain machine-readable information items about the current Linux
|
| 384 |
+
distribution in a dictionary, as shown in the following example:
|
| 385 |
+
|
| 386 |
+
.. sourcecode:: python
|
| 387 |
+
|
| 388 |
+
{
|
| 389 |
+
'id': 'rhel',
|
| 390 |
+
'version': '7.0',
|
| 391 |
+
'version_parts': {
|
| 392 |
+
'major': '7',
|
| 393 |
+
'minor': '0',
|
| 394 |
+
'build_number': ''
|
| 395 |
+
},
|
| 396 |
+
'like': 'fedora',
|
| 397 |
+
'codename': 'Maipo'
|
| 398 |
+
}
|
| 399 |
+
|
| 400 |
+
The dictionary structure and keys are always the same, regardless of which
|
| 401 |
+
information items are available in the underlying data sources. The values
|
| 402 |
+
for the various keys are as follows:
|
| 403 |
+
|
| 404 |
+
* ``id``: The result of :func:`distro.id`.
|
| 405 |
+
|
| 406 |
+
* ``version``: The result of :func:`distro.version`.
|
| 407 |
+
|
| 408 |
+
* ``version_parts -> major``: The result of :func:`distro.major_version`.
|
| 409 |
+
|
| 410 |
+
* ``version_parts -> minor``: The result of :func:`distro.minor_version`.
|
| 411 |
+
|
| 412 |
+
* ``version_parts -> build_number``: The result of
|
| 413 |
+
:func:`distro.build_number`.
|
| 414 |
+
|
| 415 |
+
* ``like``: The result of :func:`distro.like`.
|
| 416 |
+
|
| 417 |
+
* ``codename``: The result of :func:`distro.codename`.
|
| 418 |
+
|
| 419 |
+
For a description of the *pretty* and *best* parameters, see the
|
| 420 |
+
:func:`distro.version` method.
|
| 421 |
+
"""
|
| 422 |
+
return _distro.info(pretty, best)
|
| 423 |
+
|
| 424 |
+
|
| 425 |
+
def os_release_info():
|
| 426 |
+
"""
|
| 427 |
+
Return a dictionary containing key-value pairs for the information items
|
| 428 |
+
from the os-release file data source of the current Linux distribution.
|
| 429 |
+
|
| 430 |
+
See `os-release file`_ for details about these information items.
|
| 431 |
+
"""
|
| 432 |
+
return _distro.os_release_info()
|
| 433 |
+
|
| 434 |
+
|
| 435 |
+
def lsb_release_info():
|
| 436 |
+
"""
|
| 437 |
+
Return a dictionary containing key-value pairs for the information items
|
| 438 |
+
from the lsb_release command data source of the current Linux distribution.
|
| 439 |
+
|
| 440 |
+
See `lsb_release command output`_ for details about these information
|
| 441 |
+
items.
|
| 442 |
+
"""
|
| 443 |
+
return _distro.lsb_release_info()
|
| 444 |
+
|
| 445 |
+
|
| 446 |
+
def distro_release_info():
|
| 447 |
+
"""
|
| 448 |
+
Return a dictionary containing key-value pairs for the information items
|
| 449 |
+
from the distro release file data source of the current Linux distribution.
|
| 450 |
+
|
| 451 |
+
See `distro release file`_ for details about these information items.
|
| 452 |
+
"""
|
| 453 |
+
return _distro.distro_release_info()
|
| 454 |
+
|
| 455 |
+
|
| 456 |
+
def os_release_attr(attribute):
|
| 457 |
+
"""
|
| 458 |
+
Return a single named information item from the os-release file data source
|
| 459 |
+
of the current Linux distribution.
|
| 460 |
+
|
| 461 |
+
Parameters:
|
| 462 |
+
|
| 463 |
+
* ``attribute`` (string): Key of the information item.
|
| 464 |
+
|
| 465 |
+
Returns:
|
| 466 |
+
|
| 467 |
+
* (string): Value of the information item, if the item exists.
|
| 468 |
+
The empty string, if the item does not exist.
|
| 469 |
+
|
| 470 |
+
See `os-release file`_ for details about these information items.
|
| 471 |
+
"""
|
| 472 |
+
return _distro.os_release_attr(attribute)
|
| 473 |
+
|
| 474 |
+
|
| 475 |
+
def lsb_release_attr(attribute):
|
| 476 |
+
"""
|
| 477 |
+
Return a single named information item from the lsb_release command output
|
| 478 |
+
data source of the current Linux distribution.
|
| 479 |
+
|
| 480 |
+
Parameters:
|
| 481 |
+
|
| 482 |
+
* ``attribute`` (string): Key of the information item.
|
| 483 |
+
|
| 484 |
+
Returns:
|
| 485 |
+
|
| 486 |
+
* (string): Value of the information item, if the item exists.
|
| 487 |
+
The empty string, if the item does not exist.
|
| 488 |
+
|
| 489 |
+
See `lsb_release command output`_ for details about these information
|
| 490 |
+
items.
|
| 491 |
+
"""
|
| 492 |
+
return _distro.lsb_release_attr(attribute)
|
| 493 |
+
|
| 494 |
+
|
| 495 |
+
def distro_release_attr(attribute):
|
| 496 |
+
"""
|
| 497 |
+
Return a single named information item from the distro release file
|
| 498 |
+
data source of the current Linux distribution.
|
| 499 |
+
|
| 500 |
+
Parameters:
|
| 501 |
+
|
| 502 |
+
* ``attribute`` (string): Key of the information item.
|
| 503 |
+
|
| 504 |
+
Returns:
|
| 505 |
+
|
| 506 |
+
* (string): Value of the information item, if the item exists.
|
| 507 |
+
The empty string, if the item does not exist.
|
| 508 |
+
|
| 509 |
+
See `distro release file`_ for details about these information items.
|
| 510 |
+
"""
|
| 511 |
+
return _distro.distro_release_attr(attribute)
|
| 512 |
+
|
| 513 |
+
|
| 514 |
+
class LinuxDistribution(object):
|
| 515 |
+
"""
|
| 516 |
+
Provides information about a Linux distribution.
|
| 517 |
+
|
| 518 |
+
This package creates a private module-global instance of this class with
|
| 519 |
+
default initialization arguments, that is used by the
|
| 520 |
+
`consolidated accessor functions`_ and `single source accessor functions`_.
|
| 521 |
+
By using default initialization arguments, that module-global instance
|
| 522 |
+
returns data about the current Linux distribution (i.e. the distro this
|
| 523 |
+
package runs on).
|
| 524 |
+
|
| 525 |
+
Normally, it is not necessary to create additional instances of this class.
|
| 526 |
+
However, in situations where control is needed over the exact data sources
|
| 527 |
+
that are used, instances of this class can be created with a specific
|
| 528 |
+
distro release file, or a specific os-release file, or without invoking the
|
| 529 |
+
lsb_release command.
|
| 530 |
+
"""
|
| 531 |
+
|
| 532 |
+
def __init__(self,
|
| 533 |
+
include_lsb=True,
|
| 534 |
+
os_release_file='',
|
| 535 |
+
distro_release_file=''):
|
| 536 |
+
"""
|
| 537 |
+
The initialization method of this class gathers information from the
|
| 538 |
+
available data sources, and stores that in private instance attributes.
|
| 539 |
+
Subsequent access to the information items uses these private instance
|
| 540 |
+
attributes, so that the data sources are read only once.
|
| 541 |
+
|
| 542 |
+
Parameters:
|
| 543 |
+
|
| 544 |
+
* ``include_lsb`` (bool): Controls whether the
|
| 545 |
+
`lsb_release command output`_ is included as a data source.
|
| 546 |
+
|
| 547 |
+
If the lsb_release command is not available in the program execution
|
| 548 |
+
path, the data source for the lsb_release command will be empty.
|
| 549 |
+
|
| 550 |
+
* ``os_release_file`` (string): The path name of the
|
| 551 |
+
`os-release file`_ that is to be used as a data source.
|
| 552 |
+
|
| 553 |
+
An empty string (the default) will cause the default path name to
|
| 554 |
+
be used (see `os-release file`_ for details).
|
| 555 |
+
|
| 556 |
+
If the specified or defaulted os-release file does not exist, the
|
| 557 |
+
data source for the os-release file will be empty.
|
| 558 |
+
|
| 559 |
+
* ``distro_release_file`` (string): The path name of the
|
| 560 |
+
`distro release file`_ that is to be used as a data source.
|
| 561 |
+
|
| 562 |
+
An empty string (the default) will cause a default search algorithm
|
| 563 |
+
to be used (see `distro release file`_ for details).
|
| 564 |
+
|
| 565 |
+
If the specified distro release file does not exist, or if no default
|
| 566 |
+
distro release file can be found, the data source for the distro
|
| 567 |
+
release file will be empty.
|
| 568 |
+
|
| 569 |
+
Public instance attributes:
|
| 570 |
+
|
| 571 |
+
* ``os_release_file`` (string): The path name of the
|
| 572 |
+
`os-release file`_ that is actually used as a data source. The
|
| 573 |
+
empty string if no distro release file is used as a data source.
|
| 574 |
+
|
| 575 |
+
* ``distro_release_file`` (string): The path name of the
|
| 576 |
+
`distro release file`_ that is actually used as a data source. The
|
| 577 |
+
empty string if no distro release file is used as a data source.
|
| 578 |
+
|
| 579 |
+
Raises:
|
| 580 |
+
|
| 581 |
+
* :py:exc:`IOError`: Some I/O issue with an os-release file or distro
|
| 582 |
+
release file.
|
| 583 |
+
|
| 584 |
+
* :py:exc:`subprocess.CalledProcessError`: The lsb_release command had
|
| 585 |
+
some issue (other than not being available in the program execution
|
| 586 |
+
path).
|
| 587 |
+
|
| 588 |
+
* :py:exc:`UnicodeError`: A data source has unexpected characters or
|
| 589 |
+
uses an unexpected encoding.
|
| 590 |
+
"""
|
| 591 |
+
self.os_release_file = os_release_file or \
|
| 592 |
+
os.path.join(_UNIXCONFDIR, _OS_RELEASE_BASENAME)
|
| 593 |
+
self.distro_release_file = distro_release_file or '' # updated later
|
| 594 |
+
self._os_release_info = self._get_os_release_info()
|
| 595 |
+
self._lsb_release_info = self._get_lsb_release_info() \
|
| 596 |
+
if include_lsb else {}
|
| 597 |
+
self._distro_release_info = self._get_distro_release_info()
|
| 598 |
+
|
| 599 |
+
def __repr__(self):
|
| 600 |
+
"""Return repr of all info
|
| 601 |
+
"""
|
| 602 |
+
return \
|
| 603 |
+
"LinuxDistribution(" \
|
| 604 |
+
"os_release_file={0!r}, " \
|
| 605 |
+
"distro_release_file={1!r}, " \
|
| 606 |
+
"_os_release_info={2!r}, " \
|
| 607 |
+
"_lsb_release_info={3!r}, " \
|
| 608 |
+
"_distro_release_info={4!r})".format(
|
| 609 |
+
self.os_release_file,
|
| 610 |
+
self.distro_release_file,
|
| 611 |
+
self._os_release_info,
|
| 612 |
+
self._lsb_release_info,
|
| 613 |
+
self._distro_release_info)
|
| 614 |
+
|
| 615 |
+
def linux_distribution(self, full_distribution_name=True):
|
| 616 |
+
"""
|
| 617 |
+
Return information about the Linux distribution that is compatible
|
| 618 |
+
with Python's :func:`platform.linux_distribution`, supporting a subset
|
| 619 |
+
of its parameters.
|
| 620 |
+
|
| 621 |
+
For details, see :func:`distro.linux_distribution`.
|
| 622 |
+
"""
|
| 623 |
+
return (
|
| 624 |
+
self.name() if full_distribution_name else self.id(),
|
| 625 |
+
self.version(),
|
| 626 |
+
self.codename()
|
| 627 |
+
)
|
| 628 |
+
|
| 629 |
+
def id(self):
|
| 630 |
+
"""Return the distro ID of the Linux distribution, as a string.
|
| 631 |
+
|
| 632 |
+
For details, see :func:`distro.id`.
|
| 633 |
+
"""
|
| 634 |
+
def normalize(distro_id, table):
|
| 635 |
+
distro_id = distro_id.lower().replace(' ', '_')
|
| 636 |
+
return table.get(distro_id, distro_id)
|
| 637 |
+
|
| 638 |
+
distro_id = self.os_release_attr('id')
|
| 639 |
+
if distro_id:
|
| 640 |
+
return normalize(distro_id, NORMALIZED_OS_ID)
|
| 641 |
+
|
| 642 |
+
distro_id = self.lsb_release_attr('distributor_id')
|
| 643 |
+
if distro_id:
|
| 644 |
+
return normalize(distro_id, NORMALIZED_LSB_ID)
|
| 645 |
+
|
| 646 |
+
distro_id = self.distro_release_attr('id')
|
| 647 |
+
if distro_id:
|
| 648 |
+
return normalize(distro_id, NORMALIZED_DISTRO_ID)
|
| 649 |
+
|
| 650 |
+
return ''
|
| 651 |
+
|
| 652 |
+
def name(self, pretty=False):
|
| 653 |
+
"""
|
| 654 |
+
Return the name of the Linux distribution, as a string.
|
| 655 |
+
|
| 656 |
+
For details, see :func:`distro.name`.
|
| 657 |
+
"""
|
| 658 |
+
name = self.os_release_attr('name') \
|
| 659 |
+
or self.lsb_release_attr('distributor_id') \
|
| 660 |
+
or self.distro_release_attr('name')
|
| 661 |
+
if pretty:
|
| 662 |
+
name = self.os_release_attr('pretty_name') \
|
| 663 |
+
or self.lsb_release_attr('description')
|
| 664 |
+
if not name:
|
| 665 |
+
name = self.distro_release_attr('name')
|
| 666 |
+
version = self.version(pretty=True)
|
| 667 |
+
if version:
|
| 668 |
+
name = name + ' ' + version
|
| 669 |
+
return name or ''
|
| 670 |
+
|
| 671 |
+
def version(self, pretty=False, best=False):
|
| 672 |
+
"""
|
| 673 |
+
Return the version of the Linux distribution, as a string.
|
| 674 |
+
|
| 675 |
+
For details, see :func:`distro.version`.
|
| 676 |
+
"""
|
| 677 |
+
versions = [
|
| 678 |
+
self.os_release_attr('version_id'),
|
| 679 |
+
self.lsb_release_attr('release'),
|
| 680 |
+
self.distro_release_attr('version_id'),
|
| 681 |
+
self._parse_distro_release_content(
|
| 682 |
+
self.os_release_attr('pretty_name')).get('version_id', ''),
|
| 683 |
+
self._parse_distro_release_content(
|
| 684 |
+
self.lsb_release_attr('description')).get('version_id', '')
|
| 685 |
+
]
|
| 686 |
+
version = ''
|
| 687 |
+
if best:
|
| 688 |
+
# This algorithm uses the last version in priority order that has
|
| 689 |
+
# the best precision. If the versions are not in conflict, that
|
| 690 |
+
# does not matter; otherwise, using the last one instead of the
|
| 691 |
+
# first one might be considered a surprise.
|
| 692 |
+
for v in versions:
|
| 693 |
+
if v.count(".") > version.count(".") or version == '':
|
| 694 |
+
version = v
|
| 695 |
+
else:
|
| 696 |
+
for v in versions:
|
| 697 |
+
if v != '':
|
| 698 |
+
version = v
|
| 699 |
+
break
|
| 700 |
+
if pretty and version and self.codename():
|
| 701 |
+
version = u'{0} ({1})'.format(version, self.codename())
|
| 702 |
+
return version
|
| 703 |
+
|
| 704 |
+
def version_parts(self, best=False):
|
| 705 |
+
"""
|
| 706 |
+
Return the version of the Linux distribution, as a tuple of version
|
| 707 |
+
numbers.
|
| 708 |
+
|
| 709 |
+
For details, see :func:`distro.version_parts`.
|
| 710 |
+
"""
|
| 711 |
+
version_str = self.version(best=best)
|
| 712 |
+
if version_str:
|
| 713 |
+
version_regex = re.compile(r'(\d+)\.?(\d+)?\.?(\d+)?')
|
| 714 |
+
matches = version_regex.match(version_str)
|
| 715 |
+
if matches:
|
| 716 |
+
major, minor, build_number = matches.groups()
|
| 717 |
+
return major, minor or '', build_number or ''
|
| 718 |
+
return '', '', ''
|
| 719 |
+
|
| 720 |
+
def major_version(self, best=False):
|
| 721 |
+
"""
|
| 722 |
+
Return the major version number of the current distribution.
|
| 723 |
+
|
| 724 |
+
For details, see :func:`distro.major_version`.
|
| 725 |
+
"""
|
| 726 |
+
return self.version_parts(best)[0]
|
| 727 |
+
|
| 728 |
+
def minor_version(self, best=False):
|
| 729 |
+
"""
|
| 730 |
+
Return the minor version number of the Linux distribution.
|
| 731 |
+
|
| 732 |
+
For details, see :func:`distro.minor_version`.
|
| 733 |
+
"""
|
| 734 |
+
return self.version_parts(best)[1]
|
| 735 |
+
|
| 736 |
+
def build_number(self, best=False):
|
| 737 |
+
"""
|
| 738 |
+
Return the build number of the Linux distribution.
|
| 739 |
+
|
| 740 |
+
For details, see :func:`distro.build_number`.
|
| 741 |
+
"""
|
| 742 |
+
return self.version_parts(best)[2]
|
| 743 |
+
|
| 744 |
+
def like(self):
|
| 745 |
+
"""
|
| 746 |
+
Return the IDs of distributions that are like the Linux distribution.
|
| 747 |
+
|
| 748 |
+
For details, see :func:`distro.like`.
|
| 749 |
+
"""
|
| 750 |
+
return self.os_release_attr('id_like') or ''
|
| 751 |
+
|
| 752 |
+
def codename(self):
|
| 753 |
+
"""
|
| 754 |
+
Return the codename of the Linux distribution.
|
| 755 |
+
|
| 756 |
+
For details, see :func:`distro.codename`.
|
| 757 |
+
"""
|
| 758 |
+
return self.os_release_attr('codename') \
|
| 759 |
+
or self.lsb_release_attr('codename') \
|
| 760 |
+
or self.distro_release_attr('codename') \
|
| 761 |
+
or ''
|
| 762 |
+
|
| 763 |
+
def info(self, pretty=False, best=False):
|
| 764 |
+
"""
|
| 765 |
+
Return certain machine-readable information about the Linux
|
| 766 |
+
distribution.
|
| 767 |
+
|
| 768 |
+
For details, see :func:`distro.info`.
|
| 769 |
+
"""
|
| 770 |
+
return dict(
|
| 771 |
+
id=self.id(),
|
| 772 |
+
version=self.version(pretty, best),
|
| 773 |
+
version_parts=dict(
|
| 774 |
+
major=self.major_version(best),
|
| 775 |
+
minor=self.minor_version(best),
|
| 776 |
+
build_number=self.build_number(best)
|
| 777 |
+
),
|
| 778 |
+
like=self.like(),
|
| 779 |
+
codename=self.codename(),
|
| 780 |
+
)
|
| 781 |
+
|
| 782 |
+
def os_release_info(self):
|
| 783 |
+
"""
|
| 784 |
+
Return a dictionary containing key-value pairs for the information
|
| 785 |
+
items from the os-release file data source of the Linux distribution.
|
| 786 |
+
|
| 787 |
+
For details, see :func:`distro.os_release_info`.
|
| 788 |
+
"""
|
| 789 |
+
return self._os_release_info
|
| 790 |
+
|
| 791 |
+
def lsb_release_info(self):
|
| 792 |
+
"""
|
| 793 |
+
Return a dictionary containing key-value pairs for the information
|
| 794 |
+
items from the lsb_release command data source of the Linux
|
| 795 |
+
distribution.
|
| 796 |
+
|
| 797 |
+
For details, see :func:`distro.lsb_release_info`.
|
| 798 |
+
"""
|
| 799 |
+
return self._lsb_release_info
|
| 800 |
+
|
| 801 |
+
def distro_release_info(self):
|
| 802 |
+
"""
|
| 803 |
+
Return a dictionary containing key-value pairs for the information
|
| 804 |
+
items from the distro release file data source of the Linux
|
| 805 |
+
distribution.
|
| 806 |
+
|
| 807 |
+
For details, see :func:`distro.distro_release_info`.
|
| 808 |
+
"""
|
| 809 |
+
return self._distro_release_info
|
| 810 |
+
|
| 811 |
+
def os_release_attr(self, attribute):
|
| 812 |
+
"""
|
| 813 |
+
Return a single named information item from the os-release file data
|
| 814 |
+
source of the Linux distribution.
|
| 815 |
+
|
| 816 |
+
For details, see :func:`distro.os_release_attr`.
|
| 817 |
+
"""
|
| 818 |
+
return self._os_release_info.get(attribute, '')
|
| 819 |
+
|
| 820 |
+
def lsb_release_attr(self, attribute):
|
| 821 |
+
"""
|
| 822 |
+
Return a single named information item from the lsb_release command
|
| 823 |
+
output data source of the Linux distribution.
|
| 824 |
+
|
| 825 |
+
For details, see :func:`distro.lsb_release_attr`.
|
| 826 |
+
"""
|
| 827 |
+
return self._lsb_release_info.get(attribute, '')
|
| 828 |
+
|
| 829 |
+
def distro_release_attr(self, attribute):
|
| 830 |
+
"""
|
| 831 |
+
Return a single named information item from the distro release file
|
| 832 |
+
data source of the Linux distribution.
|
| 833 |
+
|
| 834 |
+
For details, see :func:`distro.distro_release_attr`.
|
| 835 |
+
"""
|
| 836 |
+
return self._distro_release_info.get(attribute, '')
|
| 837 |
+
|
| 838 |
+
def _get_os_release_info(self):
|
| 839 |
+
"""
|
| 840 |
+
Get the information items from the specified os-release file.
|
| 841 |
+
|
| 842 |
+
Returns:
|
| 843 |
+
A dictionary containing all information items.
|
| 844 |
+
"""
|
| 845 |
+
if os.path.isfile(self.os_release_file):
|
| 846 |
+
with open(self.os_release_file) as release_file:
|
| 847 |
+
return self._parse_os_release_content(release_file)
|
| 848 |
+
return {}
|
| 849 |
+
|
| 850 |
+
@staticmethod
|
| 851 |
+
def _parse_os_release_content(lines):
|
| 852 |
+
"""
|
| 853 |
+
Parse the lines of an os-release file.
|
| 854 |
+
|
| 855 |
+
Parameters:
|
| 856 |
+
|
| 857 |
+
* lines: Iterable through the lines in the os-release file.
|
| 858 |
+
Each line must be a unicode string or a UTF-8 encoded byte
|
| 859 |
+
string.
|
| 860 |
+
|
| 861 |
+
Returns:
|
| 862 |
+
A dictionary containing all information items.
|
| 863 |
+
"""
|
| 864 |
+
props = {}
|
| 865 |
+
lexer = shlex.shlex(lines, posix=True)
|
| 866 |
+
lexer.whitespace_split = True
|
| 867 |
+
|
| 868 |
+
# The shlex module defines its `wordchars` variable using literals,
|
| 869 |
+
# making it dependent on the encoding of the Python source file.
|
| 870 |
+
# In Python 2.6 and 2.7, the shlex source file is encoded in
|
| 871 |
+
# 'iso-8859-1', and the `wordchars` variable is defined as a byte
|
| 872 |
+
# string. This causes a UnicodeDecodeError to be raised when the
|
| 873 |
+
# parsed content is a unicode object. The following fix resolves that
|
| 874 |
+
# (... but it should be fixed in shlex...):
|
| 875 |
+
if sys.version_info[0] == 2 and isinstance(lexer.wordchars, bytes):
|
| 876 |
+
lexer.wordchars = lexer.wordchars.decode('iso-8859-1')
|
| 877 |
+
|
| 878 |
+
tokens = list(lexer)
|
| 879 |
+
for token in tokens:
|
| 880 |
+
# At this point, all shell-like parsing has been done (i.e.
|
| 881 |
+
# comments processed, quotes and backslash escape sequences
|
| 882 |
+
# processed, multi-line values assembled, trailing newlines
|
| 883 |
+
# stripped, etc.), so the tokens are now either:
|
| 884 |
+
# * variable assignments: var=value
|
| 885 |
+
# * commands or their arguments (not allowed in os-release)
|
| 886 |
+
if '=' in token:
|
| 887 |
+
k, v = token.split('=', 1)
|
| 888 |
+
if isinstance(v, bytes):
|
| 889 |
+
v = v.decode('utf-8')
|
| 890 |
+
props[k.lower()] = v
|
| 891 |
+
if k == 'VERSION':
|
| 892 |
+
# this handles cases in which the codename is in
|
| 893 |
+
# the `(CODENAME)` (rhel, centos, fedora) format
|
| 894 |
+
# or in the `, CODENAME` format (Ubuntu).
|
| 895 |
+
codename = re.search(r'(\(\D+\))|,(\s+)?\D+', v)
|
| 896 |
+
if codename:
|
| 897 |
+
codename = codename.group()
|
| 898 |
+
codename = codename.strip('()')
|
| 899 |
+
codename = codename.strip(',')
|
| 900 |
+
codename = codename.strip()
|
| 901 |
+
# codename appears within paranthese.
|
| 902 |
+
props['codename'] = codename
|
| 903 |
+
else:
|
| 904 |
+
props['codename'] = ''
|
| 905 |
+
else:
|
| 906 |
+
# Ignore any tokens that are not variable assignments
|
| 907 |
+
pass
|
| 908 |
+
return props
|
| 909 |
+
|
| 910 |
+
def _get_lsb_release_info(self):
|
| 911 |
+
"""
|
| 912 |
+
Get the information items from the lsb_release command output.
|
| 913 |
+
|
| 914 |
+
Returns:
|
| 915 |
+
A dictionary containing all information items.
|
| 916 |
+
"""
|
| 917 |
+
cmd = 'lsb_release -a'
|
| 918 |
+
# conda customization: On Ubuntu 17.10, lsb_release calls the
|
| 919 |
+
# system Python and it will not find our custom sysconfigdata
|
| 920 |
+
env = os.environ.copy()
|
| 921 |
+
if '_PYTHON_SYSCONFIGDATA_NAME' in env:
|
| 922 |
+
del env['_PYTHON_SYSCONFIGDATA_NAME']
|
| 923 |
+
process = subprocess.Popen(
|
| 924 |
+
cmd,
|
| 925 |
+
shell=True,
|
| 926 |
+
stdout=subprocess.PIPE,
|
| 927 |
+
stderr=subprocess.PIPE,
|
| 928 |
+
env=env)
|
| 929 |
+
stdout, stderr = process.communicate()
|
| 930 |
+
stdout, stderr = stdout.decode('utf-8'), stderr.decode('utf-8')
|
| 931 |
+
code = process.returncode
|
| 932 |
+
if code == 0:
|
| 933 |
+
content = stdout.splitlines()
|
| 934 |
+
return self._parse_lsb_release_content(content)
|
| 935 |
+
elif code == 127: # Command not found
|
| 936 |
+
return {}
|
| 937 |
+
else:
|
| 938 |
+
if sys.version_info[:2] >= (3, 5):
|
| 939 |
+
raise subprocess.CalledProcessError(code, cmd, stdout, stderr)
|
| 940 |
+
elif sys.version_info[:2] >= (2, 7):
|
| 941 |
+
raise subprocess.CalledProcessError(code, cmd, stdout)
|
| 942 |
+
elif sys.version_info[:2] == (2, 6):
|
| 943 |
+
raise subprocess.CalledProcessError(code, cmd)
|
| 944 |
+
|
| 945 |
+
@staticmethod
|
| 946 |
+
def _parse_lsb_release_content(lines):
|
| 947 |
+
"""
|
| 948 |
+
Parse the output of the lsb_release command.
|
| 949 |
+
|
| 950 |
+
Parameters:
|
| 951 |
+
|
| 952 |
+
* lines: Iterable through the lines of the lsb_release output.
|
| 953 |
+
Each line must be a unicode string or a UTF-8 encoded byte
|
| 954 |
+
string.
|
| 955 |
+
|
| 956 |
+
Returns:
|
| 957 |
+
A dictionary containing all information items.
|
| 958 |
+
"""
|
| 959 |
+
props = {}
|
| 960 |
+
for line in lines:
|
| 961 |
+
line = line.decode('utf-8') if isinstance(line, bytes) else line
|
| 962 |
+
kv = line.strip('\n').split(':', 1)
|
| 963 |
+
if len(kv) != 2:
|
| 964 |
+
# Ignore lines without colon.
|
| 965 |
+
continue
|
| 966 |
+
k, v = kv
|
| 967 |
+
props.update({k.replace(' ', '_').lower(): v.strip()})
|
| 968 |
+
return props
|
| 969 |
+
|
| 970 |
+
def _get_distro_release_info(self):
|
| 971 |
+
"""
|
| 972 |
+
Get the information items from the specified distro release file.
|
| 973 |
+
|
| 974 |
+
Returns:
|
| 975 |
+
A dictionary containing all information items.
|
| 976 |
+
"""
|
| 977 |
+
if self.distro_release_file:
|
| 978 |
+
# If it was specified, we use it and parse what we can, even if
|
| 979 |
+
# its file name or content does not match the expected pattern.
|
| 980 |
+
distro_info = self._parse_distro_release_file(
|
| 981 |
+
self.distro_release_file)
|
| 982 |
+
basename = os.path.basename(self.distro_release_file)
|
| 983 |
+
# The file name pattern for user-specified distro release files
|
| 984 |
+
# is somewhat more tolerant (compared to when searching for the
|
| 985 |
+
# file), because we want to use what was specified as best as
|
| 986 |
+
# possible.
|
| 987 |
+
match = _DISTRO_RELEASE_BASENAME_PATTERN.match(basename)
|
| 988 |
+
if match:
|
| 989 |
+
distro_info['id'] = match.group(1)
|
| 990 |
+
return distro_info
|
| 991 |
+
else:
|
| 992 |
+
try:
|
| 993 |
+
basenames = os.listdir(_UNIXCONFDIR)
|
| 994 |
+
# We sort for repeatability in cases where there are multiple
|
| 995 |
+
# distro specific files; e.g. CentOS, Oracle, Enterprise all
|
| 996 |
+
# containing `redhat-release` on top of their own.
|
| 997 |
+
basenames.sort()
|
| 998 |
+
except OSError:
|
| 999 |
+
# This may occur when /etc is not readable but we can't be
|
| 1000 |
+
# sure about the *-release files. Check common entries of
|
| 1001 |
+
# /etc for information. If they turn out to not be there the
|
| 1002 |
+
# error is handled in `_parse_distro_release_file()`.
|
| 1003 |
+
basenames = ['SuSE-release',
|
| 1004 |
+
'arch-release',
|
| 1005 |
+
'base-release',
|
| 1006 |
+
'centos-release',
|
| 1007 |
+
'fedora-release',
|
| 1008 |
+
'gentoo-release',
|
| 1009 |
+
'mageia-release',
|
| 1010 |
+
'manjaro-release',
|
| 1011 |
+
'oracle-release',
|
| 1012 |
+
'redhat-release',
|
| 1013 |
+
'sl-release',
|
| 1014 |
+
'slackware-version']
|
| 1015 |
+
for basename in basenames:
|
| 1016 |
+
if basename in _DISTRO_RELEASE_IGNORE_BASENAMES:
|
| 1017 |
+
continue
|
| 1018 |
+
match = _DISTRO_RELEASE_BASENAME_PATTERN.match(basename)
|
| 1019 |
+
if match:
|
| 1020 |
+
filepath = os.path.join(_UNIXCONFDIR, basename)
|
| 1021 |
+
distro_info = self._parse_distro_release_file(filepath)
|
| 1022 |
+
if 'name' in distro_info:
|
| 1023 |
+
# The name is always present if the pattern matches
|
| 1024 |
+
self.distro_release_file = filepath
|
| 1025 |
+
distro_info['id'] = match.group(1)
|
| 1026 |
+
return distro_info
|
| 1027 |
+
return {}
|
| 1028 |
+
|
| 1029 |
+
def _parse_distro_release_file(self, filepath):
|
| 1030 |
+
"""
|
| 1031 |
+
Parse a distro release file.
|
| 1032 |
+
|
| 1033 |
+
Parameters:
|
| 1034 |
+
|
| 1035 |
+
* filepath: Path name of the distro release file.
|
| 1036 |
+
|
| 1037 |
+
Returns:
|
| 1038 |
+
A dictionary containing all information items.
|
| 1039 |
+
"""
|
| 1040 |
+
try:
|
| 1041 |
+
with open(filepath) as fp:
|
| 1042 |
+
# Only parse the first line. For instance, on SLES there
|
| 1043 |
+
# are multiple lines. We don't want them...
|
| 1044 |
+
return self._parse_distro_release_content(fp.readline())
|
| 1045 |
+
except (OSError, IOError):
|
| 1046 |
+
# Ignore not being able to read a specific, seemingly version
|
| 1047 |
+
# related file.
|
| 1048 |
+
# See https://github.com/nir0s/distro/issues/162
|
| 1049 |
+
return {}
|
| 1050 |
+
|
| 1051 |
+
@staticmethod
|
| 1052 |
+
def _parse_distro_release_content(line):
|
| 1053 |
+
"""
|
| 1054 |
+
Parse a line from a distro release file.
|
| 1055 |
+
|
| 1056 |
+
Parameters:
|
| 1057 |
+
* line: Line from the distro release file. Must be a unicode string
|
| 1058 |
+
or a UTF-8 encoded byte string.
|
| 1059 |
+
|
| 1060 |
+
Returns:
|
| 1061 |
+
A dictionary containing all information items.
|
| 1062 |
+
"""
|
| 1063 |
+
if isinstance(line, bytes):
|
| 1064 |
+
line = line.decode('utf-8')
|
| 1065 |
+
matches = _DISTRO_RELEASE_CONTENT_REVERSED_PATTERN.match(
|
| 1066 |
+
line.strip()[::-1])
|
| 1067 |
+
distro_info = {}
|
| 1068 |
+
if matches:
|
| 1069 |
+
# regexp ensures non-None
|
| 1070 |
+
distro_info['name'] = matches.group(3)[::-1]
|
| 1071 |
+
if matches.group(2):
|
| 1072 |
+
distro_info['version_id'] = matches.group(2)[::-1]
|
| 1073 |
+
if matches.group(1):
|
| 1074 |
+
distro_info['codename'] = matches.group(1)[::-1]
|
| 1075 |
+
elif line:
|
| 1076 |
+
distro_info['name'] = line.strip()
|
| 1077 |
+
return distro_info
|
| 1078 |
+
|
| 1079 |
+
|
| 1080 |
+
_distro = LinuxDistribution()
|
| 1081 |
+
|
| 1082 |
+
|
| 1083 |
+
def main():
|
| 1084 |
+
logger = logging.getLogger(__name__)
|
| 1085 |
+
logger.setLevel(logging.DEBUG)
|
| 1086 |
+
logger.addHandler(logging.StreamHandler(sys.stdout))
|
| 1087 |
+
|
| 1088 |
+
parser = argparse.ArgumentParser(description="Linux distro info tool")
|
| 1089 |
+
parser.add_argument(
|
| 1090 |
+
'--json',
|
| 1091 |
+
'-j',
|
| 1092 |
+
help="Output in machine readable format",
|
| 1093 |
+
action="store_true")
|
| 1094 |
+
args = parser.parse_args()
|
| 1095 |
+
|
| 1096 |
+
if args.json:
|
| 1097 |
+
logger.info(json.dumps(info(), indent=4, sort_keys=True))
|
| 1098 |
+
else:
|
| 1099 |
+
logger.info('Name: %s', name(pretty=True))
|
| 1100 |
+
distribution_version = version(pretty=True)
|
| 1101 |
+
logger.info('Version: %s', distribution_version)
|
| 1102 |
+
distribution_codename = codename()
|
| 1103 |
+
logger.info('Codename: %s', distribution_codename)
|
| 1104 |
+
|
| 1105 |
+
|
| 1106 |
+
if __name__ == '__main__':
|
| 1107 |
+
main()
|
shared/package-files/0c/0c3d6692d733af00fbf4d4770346c07a05d64a577fe3bae941f26d66bd3d31d9/maxcut.py
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import networkx as nx
|
| 2 |
+
from networkx.utils.decorators import not_implemented_for, py_random_state
|
| 3 |
+
|
| 4 |
+
__all__ = ["randomized_partitioning", "one_exchange"]
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
@not_implemented_for("directed", "multigraph")
|
| 8 |
+
@py_random_state(1)
|
| 9 |
+
def randomized_partitioning(G, seed=None, p=0.5, weight=None):
|
| 10 |
+
"""Compute a random partitioning of the graph nodes and its cut value.
|
| 11 |
+
|
| 12 |
+
A partitioning is calculated by observing each node
|
| 13 |
+
and deciding to add it to the partition with probability `p`,
|
| 14 |
+
returning a random cut and its corresponding value (the
|
| 15 |
+
sum of weights of edges connecting different partitions).
|
| 16 |
+
|
| 17 |
+
Parameters
|
| 18 |
+
----------
|
| 19 |
+
G : NetworkX graph
|
| 20 |
+
|
| 21 |
+
seed : integer, random_state, or None (default)
|
| 22 |
+
Indicator of random number generation state.
|
| 23 |
+
See :ref:`Randomness<randomness>`.
|
| 24 |
+
|
| 25 |
+
p : scalar
|
| 26 |
+
Probability for each node to be part of the first partition.
|
| 27 |
+
Should be in [0,1]
|
| 28 |
+
|
| 29 |
+
weight : object
|
| 30 |
+
Edge attribute key to use as weight. If not specified, edges
|
| 31 |
+
have weight one.
|
| 32 |
+
|
| 33 |
+
Returns
|
| 34 |
+
-------
|
| 35 |
+
cut_size : scalar
|
| 36 |
+
Value of the minimum cut.
|
| 37 |
+
|
| 38 |
+
partition : pair of node sets
|
| 39 |
+
A partitioning of the nodes that defines a minimum cut.
|
| 40 |
+
"""
|
| 41 |
+
cut = {node for node in G.nodes() if seed.random() < p}
|
| 42 |
+
cut_size = nx.algorithms.cut_size(G, cut, weight=weight)
|
| 43 |
+
partition = (cut, G.nodes - cut)
|
| 44 |
+
return cut_size, partition
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
def _swap_node_partition(cut, node):
|
| 48 |
+
return cut - {node} if node in cut else cut.union({node})
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
@not_implemented_for("directed", "multigraph")
|
| 52 |
+
@py_random_state(2)
|
| 53 |
+
def one_exchange(G, initial_cut=None, seed=None, weight=None):
|
| 54 |
+
"""Compute a partitioning of the graphs nodes and the corresponding cut value.
|
| 55 |
+
|
| 56 |
+
Use a greedy one exchange strategy to find a locally maximal cut
|
| 57 |
+
and its value, it works by finding the best node (one that gives
|
| 58 |
+
the highest gain to the cut value) to add to the current cut
|
| 59 |
+
and repeats this process until no improvement can be made.
|
| 60 |
+
|
| 61 |
+
Parameters
|
| 62 |
+
----------
|
| 63 |
+
G : networkx Graph
|
| 64 |
+
Graph to find a maximum cut for.
|
| 65 |
+
|
| 66 |
+
initial_cut : set
|
| 67 |
+
Cut to use as a starting point. If not supplied the algorithm
|
| 68 |
+
starts with an empty cut.
|
| 69 |
+
|
| 70 |
+
seed : integer, random_state, or None (default)
|
| 71 |
+
Indicator of random number generation state.
|
| 72 |
+
See :ref:`Randomness<randomness>`.
|
| 73 |
+
|
| 74 |
+
weight : object
|
| 75 |
+
Edge attribute key to use as weight. If not specified, edges
|
| 76 |
+
have weight one.
|
| 77 |
+
|
| 78 |
+
Returns
|
| 79 |
+
-------
|
| 80 |
+
cut_value : scalar
|
| 81 |
+
Value of the maximum cut.
|
| 82 |
+
|
| 83 |
+
partition : pair of node sets
|
| 84 |
+
A partitioning of the nodes that defines a maximum cut.
|
| 85 |
+
"""
|
| 86 |
+
if initial_cut is None:
|
| 87 |
+
initial_cut = set()
|
| 88 |
+
cut = set(initial_cut)
|
| 89 |
+
current_cut_size = nx.algorithms.cut_size(G, cut, weight=weight)
|
| 90 |
+
while True:
|
| 91 |
+
nodes = list(G.nodes())
|
| 92 |
+
# Shuffling the nodes ensures random tie-breaks in the following call to max
|
| 93 |
+
seed.shuffle(nodes)
|
| 94 |
+
best_node_to_swap = max(
|
| 95 |
+
nodes,
|
| 96 |
+
key=lambda v: nx.algorithms.cut_size(
|
| 97 |
+
G, _swap_node_partition(cut, v), weight=weight
|
| 98 |
+
),
|
| 99 |
+
default=None,
|
| 100 |
+
)
|
| 101 |
+
potential_cut = _swap_node_partition(cut, best_node_to_swap)
|
| 102 |
+
potential_cut_size = nx.algorithms.cut_size(G, potential_cut, weight=weight)
|
| 103 |
+
|
| 104 |
+
if potential_cut_size > current_cut_size:
|
| 105 |
+
cut = potential_cut
|
| 106 |
+
current_cut_size = potential_cut_size
|
| 107 |
+
else:
|
| 108 |
+
break
|
| 109 |
+
|
| 110 |
+
partition = (cut, G.nodes - cut)
|
| 111 |
+
return current_cut_size, partition
|
shared/package-files/0c/0c3e225c027aebf0653a8e3bff13cb34bd0968bf1f084d5f506af347c8440e55/_standard_gamma_grad_ops.h
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
// @generated by torchgen/gen.py from Operator.h
|
| 4 |
+
|
| 5 |
+
#include <tuple>
|
| 6 |
+
#include <vector>
|
| 7 |
+
|
| 8 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 9 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 10 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 11 |
+
#include <ATen/core/ATen_fwd.h>
|
| 12 |
+
|
| 13 |
+
namespace at {
|
| 14 |
+
namespace _ops {
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
struct TORCH_API _standard_gamma_grad {
|
| 18 |
+
using schema = at::Tensor (const at::Tensor &, const at::Tensor &);
|
| 19 |
+
using ptr_schema = schema*;
|
| 20 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 21 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::_standard_gamma_grad")
|
| 22 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
|
| 23 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "_standard_gamma_grad(Tensor self, Tensor output) -> Tensor")
|
| 24 |
+
static at::Tensor call(const at::Tensor & self, const at::Tensor & output);
|
| 25 |
+
static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, const at::Tensor & output);
|
| 26 |
+
};
|
| 27 |
+
|
| 28 |
+
struct TORCH_API _standard_gamma_grad_out {
|
| 29 |
+
using schema = at::Tensor & (const at::Tensor &, const at::Tensor &, at::Tensor &);
|
| 30 |
+
using ptr_schema = schema*;
|
| 31 |
+
// See Note [static constexpr char* members for windows NVCC]
|
| 32 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(name, "aten::_standard_gamma_grad")
|
| 33 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out")
|
| 34 |
+
STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "_standard_gamma_grad.out(Tensor self, Tensor output, *, Tensor(a!) out) -> Tensor(a!)")
|
| 35 |
+
static at::Tensor & call(const at::Tensor & self, const at::Tensor & output, at::Tensor & out);
|
| 36 |
+
static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, const at::Tensor & output, at::Tensor & out);
|
| 37 |
+
};
|
| 38 |
+
|
| 39 |
+
}} // namespace at::_ops
|
shared/package-files/0c/0c4aa958f21646900836e9bf94a761f3e16f2acc7ef09f939c672e6ebc7303a9/compat.pyi
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
from io import TextIOWrapper
|
| 3 |
+
from typing import Any, Optional, Tuple
|
| 4 |
+
|
| 5 |
+
PY2: bool
|
| 6 |
+
PY3: bool
|
| 7 |
+
WIN: bool
|
| 8 |
+
string_types: Tuple[
|
| 9 |
+
str,
|
| 10 |
+
]
|
| 11 |
+
integer_types: Tuple[
|
| 12 |
+
int,
|
| 13 |
+
]
|
| 14 |
+
class_types: Tuple[
|
| 15 |
+
type,
|
| 16 |
+
]
|
| 17 |
+
text_type = str
|
| 18 |
+
binary_type = bytes
|
| 19 |
+
long = int
|
| 20 |
+
|
| 21 |
+
def unquote_bytes_to_wsgi(bytestring: bytes) -> str: ...
|
| 22 |
+
def text_(s: str, encoding: str = ..., errors: str = ...) -> str: ...
|
| 23 |
+
def tostr(s: str) -> str: ...
|
| 24 |
+
def tobytes(s: str) -> bytes: ...
|
| 25 |
+
|
| 26 |
+
exec_: Any
|
| 27 |
+
|
| 28 |
+
def reraise(tp: Any, value: BaseException, tb: Optional[str] = ...) -> None: ...
|
| 29 |
+
|
| 30 |
+
MAXINT: int
|
| 31 |
+
HAS_IPV6: bool
|
| 32 |
+
IPPROTO_IPV6: int
|
| 33 |
+
IPV6_V6ONLY: int
|
| 34 |
+
|
| 35 |
+
def set_nonblocking(fd: TextIOWrapper) -> None: ...
|
| 36 |
+
|
| 37 |
+
ResourceWarning: Warning
|
| 38 |
+
|
| 39 |
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
| 2 |
+
#
|
| 3 |
+
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
|
| 4 |
+
#
|
| 5 |
+
# This source code is licensed under the BSD license found in the
|
| 6 |
+
# LICENSE file in the root directory of this source tree.
|
| 7 |
+
"""The Pipe interface."""
|
| 8 |
+
from collections import OrderedDict
|
| 9 |
+
from typing import TYPE_CHECKING, Any, Iterable, Iterator, List, Optional, Union, Sequence, Tuple, cast
|
| 10 |
+
|
| 11 |
+
import torch
|
| 12 |
+
from torch import Tensor, nn
|
| 13 |
+
from torch.distributed.rpc import RRef
|
| 14 |
+
import torch.autograd
|
| 15 |
+
import torch.cuda
|
| 16 |
+
|
| 17 |
+
from . import microbatch
|
| 18 |
+
from .batchnorm import DeferredBatchNorm
|
| 19 |
+
from .pipeline import Pipeline
|
| 20 |
+
from .skip.layout import inspect_skip_layout
|
| 21 |
+
from .skip.skippable import verify_skippables
|
| 22 |
+
from .stream import AbstractStream, new_stream
|
| 23 |
+
|
| 24 |
+
__all__ = ["Pipe", "BalanceError", "PipeSequential", "WithDevice"]
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
Device = Union[torch.device, int, str]
|
| 28 |
+
Devices = Union[Iterable[Device], List[Device]]
|
| 29 |
+
|
| 30 |
+
Tensors = Sequence[Tensor]
|
| 31 |
+
TensorOrTensors = Union[Tensor, Tensors]
|
| 32 |
+
|
| 33 |
+
if TYPE_CHECKING:
|
| 34 |
+
# Typechecking: nn.Module is not a Generic
|
| 35 |
+
Module = nn.Module[TensorOrTensors] # type: ignore[type-arg]
|
| 36 |
+
NamedModules = OrderedDict[str, Module]
|
| 37 |
+
else:
|
| 38 |
+
Module = nn.Module
|
| 39 |
+
NamedModules = OrderedDict
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def _recommend_auto_balance(message: str) -> str:
|
| 43 |
+
"""Expands a message with recommendation to :mod:`torchpipe.balance`."""
|
| 44 |
+
return f"""{message}
|
| 45 |
+
|
| 46 |
+
If your model is still under development, its optimal balance would change
|
| 47 |
+
frequently. In this case, we highly recommend 'torch.distributed.pipeline.sync.balance' for
|
| 48 |
+
naive automatic balancing:
|
| 49 |
+
|
| 50 |
+
from torch.distributed.pipeline.sync import Pipe
|
| 51 |
+
from torch.distributed.pipeline.sync.balance import balance_by_time
|
| 52 |
+
|
| 53 |
+
partitions = torch.cuda.device_count()
|
| 54 |
+
sample = torch.empty(...)
|
| 55 |
+
balance = balance_by_time(partitions, model, sample)
|
| 56 |
+
|
| 57 |
+
model = Pipe(model, balance, ...)
|
| 58 |
+
"""
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
def _verify_module(module: nn.Sequential) -> None:
|
| 62 |
+
if not isinstance(module, nn.Sequential):
|
| 63 |
+
raise TypeError("module must be nn.Sequential to be partitioned")
|
| 64 |
+
|
| 65 |
+
named_children = list(module.named_children())
|
| 66 |
+
if len(named_children) != len(module):
|
| 67 |
+
raise ValueError("module with duplicate children is not supported")
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
def _verify_splitting(
|
| 71 |
+
module: nn.Sequential, partitions: List[nn.Sequential], devices: List[torch.device]
|
| 72 |
+
) -> None:
|
| 73 |
+
num_parameters = len(list(module.parameters()))
|
| 74 |
+
num_child_parameters = sum(len(list(child.parameters())) for child in module.children())
|
| 75 |
+
if num_parameters == num_child_parameters:
|
| 76 |
+
return
|
| 77 |
+
|
| 78 |
+
for i in range(len(partitions)):
|
| 79 |
+
for j in range(i + 1, len(partitions)):
|
| 80 |
+
parti = partitions[i]
|
| 81 |
+
partj = partitions[j]
|
| 82 |
+
if devices[i] == devices[j]:
|
| 83 |
+
continue
|
| 84 |
+
for p in parti.parameters():
|
| 85 |
+
for q in partj.parameters():
|
| 86 |
+
if p is q:
|
| 87 |
+
raise ValueError("module with duplicate parameters on distinct devices is not supported")
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
class BalanceError(ValueError):
|
| 91 |
+
pass
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
def _retrieve_device(module: nn.Module) -> torch.device:
|
| 95 |
+
"""Validates all parameters in the Module have the same device and returns
|
| 96 |
+
the appropriate device.
|
| 97 |
+
|
| 98 |
+
Args:
|
| 99 |
+
An ``nn.Module`` to process.
|
| 100 |
+
|
| 101 |
+
Returns:
|
| 102 |
+
``torch.Device`` for the entire module.
|
| 103 |
+
|
| 104 |
+
Raises:
|
| 105 |
+
ValueError:
|
| 106 |
+
If devices for ``nn.Module`` parameters are not all same.
|
| 107 |
+
"""
|
| 108 |
+
|
| 109 |
+
device = None
|
| 110 |
+
for parameter in module.parameters():
|
| 111 |
+
if device is None:
|
| 112 |
+
device = parameter.device
|
| 113 |
+
elif device != parameter.device:
|
| 114 |
+
raise ValueError(
|
| 115 |
+
f'nn.Module: {module}, should have all parameters on a single device,'
|
| 116 |
+
' please use .to() to place the module on a single device')
|
| 117 |
+
|
| 118 |
+
return device if device is not None else torch.device("cpu")
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
class PipeSequential(nn.Sequential):
|
| 122 |
+
"""
|
| 123 |
+
Pipe variant of ``nn.Sequential`` which supports multiple inputs.
|
| 124 |
+
"""
|
| 125 |
+
|
| 126 |
+
def forward(self, *inputs):
|
| 127 |
+
for module in self:
|
| 128 |
+
if isinstance(inputs, Tuple): # type: ignore[arg-type]
|
| 129 |
+
inputs = module(*inputs)
|
| 130 |
+
else:
|
| 131 |
+
# Don't expand single variables (ex: lists/Tensor)
|
| 132 |
+
inputs = module(inputs)
|
| 133 |
+
return inputs
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
class WithDevice(nn.Module):
|
| 137 |
+
"""
|
| 138 |
+
Wraps an ``nn.Module`` which is part of ``nn.Sequential`` passed into :class:`Pipe`
|
| 139 |
+
that overrides the device for that module. In cases where :class:`Pipe`
|
| 140 |
+
can't implicitly determine the device for the module and places it on CPU,
|
| 141 |
+
this wrapper can be used to override the implicit behavior and explicitly
|
| 142 |
+
specify which device a module should run on.
|
| 143 |
+
|
| 144 |
+
The provided module is also moved to the given device via ``.to(device)``
|
| 145 |
+
by :class:`Pipe`
|
| 146 |
+
|
| 147 |
+
Args:
|
| 148 |
+
module(:class:`torch.nn.Module`): The module to be wrapped.
|
| 149 |
+
device(:class:`torch.device`): The device to run the module on.
|
| 150 |
+
|
| 151 |
+
Example::
|
| 152 |
+
>>> # xdoctest: +SKIP("distributed")
|
| 153 |
+
>>> fc1 = nn.Linear(16, 8).cuda(0)
|
| 154 |
+
>>> fc2 = nn.Linear(8, 4).cuda(1)
|
| 155 |
+
>>> dropout = nn.Dropout()
|
| 156 |
+
>>>
|
| 157 |
+
>>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_CUDA1)
|
| 158 |
+
>>> # Dropout does not have any parameters/buffers, but we want to
|
| 159 |
+
>>> # run it on cuda:1 to avoid any GPU to CPU transfers.
|
| 160 |
+
>>> model = nn.Sequential(fc1, fc2, WithDevice(dropout, 'cuda:1'))
|
| 161 |
+
>>> # xdoctest: +SKIP("Needs RPC framework init")
|
| 162 |
+
>>> model = Pipe(model, chunks=8)
|
| 163 |
+
"""
|
| 164 |
+
def __init__(self, module: nn.Module, device: torch.device):
|
| 165 |
+
super().__init__()
|
| 166 |
+
self._module = module
|
| 167 |
+
self._device = torch.device(device)
|
| 168 |
+
|
| 169 |
+
def forward(self, *args, **kwargs):
|
| 170 |
+
return self._module(*args, **kwargs)
|
| 171 |
+
|
| 172 |
+
@property
|
| 173 |
+
def module(self):
|
| 174 |
+
return self._module
|
| 175 |
+
|
| 176 |
+
@property
|
| 177 |
+
def device(self):
|
| 178 |
+
return self._device
|
| 179 |
+
|
| 180 |
+
|
| 181 |
+
def _assemble_partition(modules: List[nn.Module]):
|
| 182 |
+
modules_list: List[nn.Module] = []
|
| 183 |
+
for module in modules:
|
| 184 |
+
if isinstance(module, nn.Sequential):
|
| 185 |
+
modules_list.extend(module.children())
|
| 186 |
+
else:
|
| 187 |
+
modules_list.append(module)
|
| 188 |
+
return PipeSequential(*modules_list)
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
def _split_module(modules: nn.Sequential) -> Tuple[List[nn.Sequential], List[torch.device]]:
|
| 192 |
+
partitions = []
|
| 193 |
+
devices = []
|
| 194 |
+
|
| 195 |
+
current_partition = []
|
| 196 |
+
current_device = None
|
| 197 |
+
for name, module in modules.named_children():
|
| 198 |
+
if isinstance(module, WithDevice):
|
| 199 |
+
# Process device override and move module to appropriate device.
|
| 200 |
+
device = module.device
|
| 201 |
+
module = module.module
|
| 202 |
+
module.to(device)
|
| 203 |
+
else:
|
| 204 |
+
device = _retrieve_device(module)
|
| 205 |
+
if current_device is not None and (current_device != device or device.type == 'cpu'):
|
| 206 |
+
partitions.append(_assemble_partition(current_partition))
|
| 207 |
+
devices.append(current_device)
|
| 208 |
+
current_partition = []
|
| 209 |
+
current_device = device
|
| 210 |
+
current_partition.append(module)
|
| 211 |
+
|
| 212 |
+
if current_device is not None:
|
| 213 |
+
partitions.append(_assemble_partition(current_partition))
|
| 214 |
+
devices.append(current_device)
|
| 215 |
+
|
| 216 |
+
partitions = cast(List[nn.Sequential], nn.ModuleList(partitions))
|
| 217 |
+
|
| 218 |
+
return partitions, devices
|
| 219 |
+
|
| 220 |
+
|
| 221 |
+
MOVING_DENIED = TypeError("denied to move parameters and buffers, because Pipe should manage device placement")
|
| 222 |
+
|
| 223 |
+
|
| 224 |
+
class Pipe(Module):
|
| 225 |
+
"""Wraps an arbitrary :class:`nn.Sequential <torch.nn.Sequential>` module
|
| 226 |
+
to train on using synchronous pipeline parallelism. If the module requires
|
| 227 |
+
lots of memory and doesn't fit on a single GPU, pipeline parallelism is a
|
| 228 |
+
useful technique to employ for training.
|
| 229 |
+
|
| 230 |
+
The implementation is based on the torchgpipe_ paper.
|
| 231 |
+
|
| 232 |
+
.. _torchgpipe: https://arxiv.org/abs/2004.09910
|
| 233 |
+
|
| 234 |
+
Pipe combines pipeline parallelism with checkpointing to reduce peak
|
| 235 |
+
memory required to train while minimizing device under-utilization.
|
| 236 |
+
|
| 237 |
+
You should place all the modules on the appropriate devices and wrap them
|
| 238 |
+
into an :class:`nn.Sequential <torch.nn.Sequential>` module defining the
|
| 239 |
+
desired order of execution. If a module does not contain any
|
| 240 |
+
parameters/buffers, it is assumed this module should be executed on CPU
|
| 241 |
+
and appropriate input tensors to the module are moved to CPU before
|
| 242 |
+
execution. This behavior can be overridden by the :class:`WithDevice`
|
| 243 |
+
wrapper which can be used to explicitly specify which device a module
|
| 244 |
+
should run on.
|
| 245 |
+
|
| 246 |
+
Args:
|
| 247 |
+
module (:class:`nn.Sequential <torch.nn.Sequential>`):
|
| 248 |
+
sequential module to be parallelized using pipelining. Each module
|
| 249 |
+
in the sequence has to have all of its parameters on a single
|
| 250 |
+
device. Each module in the sequence has to either be an nn.Module
|
| 251 |
+
or :class:`nn.Sequential <torch.nn.Sequential>` (to combine multiple
|
| 252 |
+
sequential modules on a single device)
|
| 253 |
+
chunks (int):
|
| 254 |
+
number of micro-batches (default: ``1``)
|
| 255 |
+
checkpoint (str):
|
| 256 |
+
when to enable checkpointing, one of ``'always'``,
|
| 257 |
+
``'except_last'``, or ``'never'`` (default: ``'except_last'``).
|
| 258 |
+
``'never'`` disables checkpointing completely, ``'except_last'``
|
| 259 |
+
enables checkpointing for all micro-batches except the last one
|
| 260 |
+
and ``'always'`` enables checkpointing for all micro-batches.
|
| 261 |
+
deferred_batch_norm (bool):
|
| 262 |
+
whether to use deferred ``BatchNorm`` moving statistics (default:
|
| 263 |
+
:data:`False`). If set to :data:`True`, we track statistics across
|
| 264 |
+
multiple micro-batches to update the running statistics per
|
| 265 |
+
mini-batch.
|
| 266 |
+
|
| 267 |
+
Raises:
|
| 268 |
+
TypeError:
|
| 269 |
+
the module is not a :class:`nn.Sequential <torch.nn.Sequential>`.
|
| 270 |
+
ValueError:
|
| 271 |
+
invalid arguments
|
| 272 |
+
|
| 273 |
+
Example::
|
| 274 |
+
Pipeline of two FC layers across GPUs 0 and 1.
|
| 275 |
+
|
| 276 |
+
>>> # Need to initialize RPC framework first.
|
| 277 |
+
>>> # xdoctest: +SKIP
|
| 278 |
+
>>> os.environ['MASTER_ADDR'] = 'localhost'
|
| 279 |
+
>>> os.environ['MASTER_PORT'] = '29500'
|
| 280 |
+
>>> torch.distributed.rpc.init_rpc('worker', rank=0, world_size=1)
|
| 281 |
+
>>>
|
| 282 |
+
>>> # Build pipe.
|
| 283 |
+
>>> fc1 = nn.Linear(16, 8).cuda(0)
|
| 284 |
+
>>> fc2 = nn.Linear(8, 4).cuda(1)
|
| 285 |
+
>>> model = nn.Sequential(fc1, fc2)
|
| 286 |
+
>>> model = Pipe(model, chunks=8)
|
| 287 |
+
>>> input = torch.rand(16, 16).cuda(0)
|
| 288 |
+
>>> output_rref = model(input)
|
| 289 |
+
|
| 290 |
+
.. note::
|
| 291 |
+
You can wrap a :class:`Pipe` model with
|
| 292 |
+
:class:`torch.nn.parallel.DistributedDataParallel` only when the
|
| 293 |
+
checkpoint parameter of :class:`Pipe` is ``'never'``.
|
| 294 |
+
|
| 295 |
+
.. note::
|
| 296 |
+
:class:`Pipe` only supports intra-node pipelining currently, but
|
| 297 |
+
will be expanded to support inter-node pipelining in the future.
|
| 298 |
+
The forward function returns an :class:`~torch.distributed.rpc.RRef`
|
| 299 |
+
to allow for inter-node pipelining in the future, where the output
|
| 300 |
+
might be on a remote host. For intra-node pipelining you can use
|
| 301 |
+
:meth:`~torch.distributed.rpc.RRef.local_value` to retrieve the
|
| 302 |
+
output locally.
|
| 303 |
+
|
| 304 |
+
.. warning::
|
| 305 |
+
:class:`Pipe` is experimental and subject to change.
|
| 306 |
+
"""
|
| 307 |
+
|
| 308 |
+
def __init__(
|
| 309 |
+
self,
|
| 310 |
+
module: nn.Sequential,
|
| 311 |
+
chunks: int = 1,
|
| 312 |
+
checkpoint: str = "except_last",
|
| 313 |
+
deferred_batch_norm: bool = False,
|
| 314 |
+
) -> None:
|
| 315 |
+
super().__init__()
|
| 316 |
+
|
| 317 |
+
# Check if RPC framework is initialized.
|
| 318 |
+
if not torch.distributed.rpc._is_current_rpc_agent_set():
|
| 319 |
+
raise RuntimeError(
|
| 320 |
+
'Please initialize RPC framework for Pipe using '
|
| 321 |
+
'torch.distributed.rpc.init_rpc')
|
| 322 |
+
|
| 323 |
+
chunks = int(chunks)
|
| 324 |
+
checkpoint = str(checkpoint)
|
| 325 |
+
|
| 326 |
+
if chunks <= 0:
|
| 327 |
+
raise ValueError("number of chunks must be positive integer")
|
| 328 |
+
if checkpoint not in ["always", "except_last", "never"]:
|
| 329 |
+
raise ValueError("checkpoint is not one of 'always', 'except_last', or 'never'")
|
| 330 |
+
|
| 331 |
+
_verify_module(module)
|
| 332 |
+
|
| 333 |
+
# Verify if the underlying skippable modules satisfy integrity. The
|
| 334 |
+
# integrity can be verified before forward() because it is static.
|
| 335 |
+
verify_skippables(module)
|
| 336 |
+
|
| 337 |
+
self.chunks = chunks
|
| 338 |
+
self.checkpoint = checkpoint
|
| 339 |
+
|
| 340 |
+
if deferred_batch_norm:
|
| 341 |
+
module = DeferredBatchNorm.convert_deferred_batch_norm(module, chunks)
|
| 342 |
+
|
| 343 |
+
self.partitions, self.devices = _split_module(module)
|
| 344 |
+
_verify_splitting(module, self.partitions, self.devices)
|
| 345 |
+
|
| 346 |
+
self._copy_streams: List[List[AbstractStream]] = []
|
| 347 |
+
self._skip_layout = inspect_skip_layout(self.partitions)
|
| 348 |
+
|
| 349 |
+
# Separate CUDA streams for copy.
|
| 350 |
+
copy_streams = self._ensure_copy_streams()
|
| 351 |
+
|
| 352 |
+
# The micro-batch index where the checkpointing stops.
|
| 353 |
+
checkpoint_stop = {"always": self.chunks, "except_last": self.chunks - 1, "never": 0}[self.checkpoint]
|
| 354 |
+
|
| 355 |
+
self.pipeline = Pipeline(self.partitions, self.devices, copy_streams, self._skip_layout, checkpoint_stop)
|
| 356 |
+
|
| 357 |
+
def __len__(self) -> int:
|
| 358 |
+
"""Counts the length of the underlying sequential module."""
|
| 359 |
+
return sum(len(p) for p in self.partitions)
|
| 360 |
+
|
| 361 |
+
def __getitem__(self, index: int) -> nn.Module:
|
| 362 |
+
"""Gets a layer in the underlying sequential module."""
|
| 363 |
+
partitions = self.partitions
|
| 364 |
+
if index < 0:
|
| 365 |
+
partitions = partitions[::-1]
|
| 366 |
+
|
| 367 |
+
for partition in partitions:
|
| 368 |
+
try:
|
| 369 |
+
return partition[index]
|
| 370 |
+
except IndexError:
|
| 371 |
+
pass
|
| 372 |
+
|
| 373 |
+
shift = len(partition)
|
| 374 |
+
|
| 375 |
+
if index < 0:
|
| 376 |
+
index += shift
|
| 377 |
+
else:
|
| 378 |
+
index -= shift
|
| 379 |
+
|
| 380 |
+
raise IndexError
|
| 381 |
+
|
| 382 |
+
def __iter__(self) -> Iterator[nn.Module]:
|
| 383 |
+
"""Iterates over children of the underlying sequential module."""
|
| 384 |
+
for partition in self.partitions:
|
| 385 |
+
yield from partition
|
| 386 |
+
|
| 387 |
+
# Pipe should manage the device of each partition.
|
| 388 |
+
# Deny cuda(), cpu(), and to() with device, by TypeError.
|
| 389 |
+
def cuda(self, device: Optional[Device] = None) -> "Pipe":
|
| 390 |
+
raise MOVING_DENIED
|
| 391 |
+
|
| 392 |
+
def cpu(self) -> "Pipe":
|
| 393 |
+
raise MOVING_DENIED
|
| 394 |
+
|
| 395 |
+
def to(self, *args: Any, **kwargs: Any) -> "Pipe":
|
| 396 |
+
# Deny these usages:
|
| 397 |
+
#
|
| 398 |
+
# - to(device[, dtype, non_blocking])
|
| 399 |
+
# - to(tensor[, non_blocking])
|
| 400 |
+
#
|
| 401 |
+
# But allow this:
|
| 402 |
+
#
|
| 403 |
+
# - to(dtype[, non_blocking])
|
| 404 |
+
#
|
| 405 |
+
if "device" in kwargs or "tensor" in kwargs:
|
| 406 |
+
raise MOVING_DENIED
|
| 407 |
+
|
| 408 |
+
if args:
|
| 409 |
+
if isinstance(args[0], (torch.device, int, str)):
|
| 410 |
+
raise MOVING_DENIED
|
| 411 |
+
if torch.is_tensor(args[0]):
|
| 412 |
+
raise MOVING_DENIED
|
| 413 |
+
|
| 414 |
+
return super().to(*args, **kwargs)
|
| 415 |
+
|
| 416 |
+
def _ensure_copy_streams(self) -> List[List[AbstractStream]]:
|
| 417 |
+
"""Ensures that :class:`Pipe` caches CUDA streams for copy.
|
| 418 |
+
|
| 419 |
+
It's worth to cache CUDA streams although PyTorch already manages a
|
| 420 |
+
pool of pre-allocated CUDA streams, because it may reduce GPU memory
|
| 421 |
+
fragmentation when the number of micro-batches is small.
|
| 422 |
+
|
| 423 |
+
"""
|
| 424 |
+
if not self._copy_streams:
|
| 425 |
+
for device in self.devices:
|
| 426 |
+
self._copy_streams.append([new_stream(device) for _ in range(self.chunks)])
|
| 427 |
+
|
| 428 |
+
return self._copy_streams
|
| 429 |
+
|
| 430 |
+
def forward(self, *inputs) -> RRef:
|
| 431 |
+
"""
|
| 432 |
+
Processes a single input mini-batch through the pipe and returns an
|
| 433 |
+
:class:`~torch.distributed.rpc.RRef` pointing to the output.
|
| 434 |
+
:class:`Pipe` is a fairly transparent module wrapper. It doesn't
|
| 435 |
+
modify the input and output signature of the underlying module. But
|
| 436 |
+
there's type restriction. Input and output have to contain at least one
|
| 437 |
+
tensor. This restriction is applied at partition boundaries too.
|
| 438 |
+
|
| 439 |
+
The sequence of inputs are fed into the first stage of the pipeline as
|
| 440 |
+
``*inputs``. As a result the positional args for this function should
|
| 441 |
+
match the positional args for the first stage of the pipeline. The same
|
| 442 |
+
condition applies for output of one stage of the pipeline which is the
|
| 443 |
+
input for the next stage.
|
| 444 |
+
|
| 445 |
+
The input tensor is split into multiple micro-batches based on the
|
| 446 |
+
``chunks`` parameter used to initialize :class:`Pipe`. The batch size
|
| 447 |
+
is assumed to be the first dimension of the tensor and if the batch
|
| 448 |
+
size is less than ``chunks``, the number of micro-batches is equal to
|
| 449 |
+
the batch size.
|
| 450 |
+
|
| 451 |
+
Only tensors are split into multiple micro-batches, non-Tensor inputs
|
| 452 |
+
are just replicated as-is in each micro-batch. For non-Tensor outputs
|
| 453 |
+
in the last stage of the pipeline, they are aggregated as a ``List``
|
| 454 |
+
and returned the user. For example, if you have 2 micro-batches
|
| 455 |
+
returning the integer 5, the user would receive the consolidated
|
| 456 |
+
output of `[5, 5]`
|
| 457 |
+
|
| 458 |
+
All the input tensors need to be on the same device as the first
|
| 459 |
+
partition of the pipeline.
|
| 460 |
+
|
| 461 |
+
If a tensor is wrapped with the :class:`NoChunk` wrapper, the tensor
|
| 462 |
+
is not split across micro-batches and is replicated as-is similar to
|
| 463 |
+
non-tensors.
|
| 464 |
+
|
| 465 |
+
Args:
|
| 466 |
+
inputs: input mini-batch
|
| 467 |
+
|
| 468 |
+
Returns:
|
| 469 |
+
:class:`~torch.distributed.rpc.RRef` to the output of the mini-batch
|
| 470 |
+
|
| 471 |
+
Raises:
|
| 472 |
+
TypeError: input doesn't contain at least one tensor
|
| 473 |
+
|
| 474 |
+
"""
|
| 475 |
+
first_partition_device = self.devices[0] if len(self.devices) != 0 else torch.device("cpu")
|
| 476 |
+
microbatch.check(first_partition_device, *inputs)
|
| 477 |
+
|
| 478 |
+
if not self.devices:
|
| 479 |
+
# Empty sequential module is not illegal.
|
| 480 |
+
return RRef(*inputs)
|
| 481 |
+
|
| 482 |
+
# Divide a mini-batch into micro-batches.
|
| 483 |
+
batches = microbatch.scatter(*inputs, chunks=self.chunks)
|
| 484 |
+
|
| 485 |
+
# Run pipeline parallelism.
|
| 486 |
+
self.pipeline.run(batches)
|
| 487 |
+
|
| 488 |
+
# Merge the micro-batches into one mini-batch.
|
| 489 |
+
output = microbatch.gather(batches)
|
| 490 |
+
return RRef(output)
|
shared/package-files/0c/0c5230e53eb4f80a1d08664f0b06cccdb111a441774c46c0685242b86cfb90ea/vecm_e6_jmulti_cili.txt
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*** Mon, 25 Jul 2016 21:32:41 ***
|
| 2 |
+
VEC REPRESENTATION
|
| 3 |
+
endogenous variables: Dp R
|
| 4 |
+
exogenous variables:
|
| 5 |
+
deterministic variables: CONST TREND
|
| 6 |
+
endogenous lags (diffs): 3
|
| 7 |
+
exogenous lags: 0
|
| 8 |
+
sample range: [1973 Q2, 1998 Q4], T = 103
|
| 9 |
+
estimation procedure: One stage. Johansen approach
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
Lagged endogenous term:
|
| 13 |
+
=======================
|
| 14 |
+
d(Dp) d(R)
|
| 15 |
+
------------------------------
|
| 16 |
+
d(Dp)(t-1)| -0.531 -0.324
|
| 17 |
+
| (0.151) (0.131)
|
| 18 |
+
| {0.000} {0.013}
|
| 19 |
+
| [-3.514] [-2.479]
|
| 20 |
+
d(R) (t-1)| 0.051 0.260
|
| 21 |
+
| (0.117) (0.101)
|
| 22 |
+
| {0.660} {0.010}
|
| 23 |
+
| [0.440] [2.581]
|
| 24 |
+
d(Dp)(t-2)| -0.665 -0.202
|
| 25 |
+
| (0.103) (0.089)
|
| 26 |
+
| {0.000} {0.024}
|
| 27 |
+
| [-6.427] [-2.254]
|
| 28 |
+
d(R) (t-2)| 0.122 0.017
|
| 29 |
+
| (0.116) (0.101)
|
| 30 |
+
| {0.295} {0.863}
|
| 31 |
+
| [1.047] [0.172]
|
| 32 |
+
d(Dp)(t-3)| -0.808 -0.071
|
| 33 |
+
| (0.055) (0.047)
|
| 34 |
+
| {0.000} {0.137}
|
| 35 |
+
| [-14.712] [-1.487]
|
| 36 |
+
d(R) (t-3)| -0.050 0.226
|
| 37 |
+
| (0.114) (0.098)
|
| 38 |
+
| {0.659} {0.022}
|
| 39 |
+
| [-0.441] [2.295]
|
| 40 |
+
------------------------------
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
Loading coefficients:
|
| 46 |
+
=====================
|
| 47 |
+
d(Dp) d(R)
|
| 48 |
+
-----------------------------
|
| 49 |
+
ec1(t-1)| -0.619 0.426
|
| 50 |
+
| (0.198) (0.171)
|
| 51 |
+
| {0.002} {0.013}
|
| 52 |
+
| [-3.127] [2.490]
|
| 53 |
+
-----------------------------
|
| 54 |
+
|
| 55 |
+
Estimated cointegration relation(s):
|
| 56 |
+
====================================
|
| 57 |
+
ec1(t-1)
|
| 58 |
+
--------------------
|
| 59 |
+
Dp(t-1) | 1.000
|
| 60 |
+
| (0.000)
|
| 61 |
+
| {0.000}
|
| 62 |
+
| [0.000]
|
| 63 |
+
R (t-1) | -0.281
|
| 64 |
+
| (0.063)
|
| 65 |
+
| {0.000}
|
| 66 |
+
| [-4.429]
|
| 67 |
+
CONST | 0.013
|
| 68 |
+
| (0.006)
|
| 69 |
+
| {0.032}
|
| 70 |
+
| [2.150]
|
| 71 |
+
TREND(t-1)| 0.000
|
| 72 |
+
| (0.000)
|
| 73 |
+
| {0.901}
|
| 74 |
+
| [-0.124]
|
| 75 |
+
--------------------
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
VAR REPRESENTATION
|
| 80 |
+
|
| 81 |
+
modulus of the eigenvalues of the reverse characteristic polynomial:
|
| 82 |
+
|z| = ( 1.0095 1.0117 1.0117 1.0000 1.3224 1.3224 1.7259 1.7259 )
|
| 83 |
+
|
| 84 |
+
Legend:
|
| 85 |
+
=======
|
| 86 |
+
Equation 1 Equation 2 ...
|
| 87 |
+
------------------------------------------
|
| 88 |
+
Variable 1 | Coefficient ...
|
| 89 |
+
| (Std. Dev.)
|
| 90 |
+
| {p - Value}
|
| 91 |
+
| [t - Value]
|
| 92 |
+
Variable 2 | ...
|
| 93 |
+
...
|
| 94 |
+
------------------------------------------
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
Lagged endogenous term:
|
| 98 |
+
=======================
|
| 99 |
+
Dp R
|
| 100 |
+
-----------------------------
|
| 101 |
+
Dp(t-1)| -0.150 0.102
|
| 102 |
+
| (0.249) (0.215)
|
| 103 |
+
| {0.547} {0.634}
|
| 104 |
+
| [-0.603] [0.475]
|
| 105 |
+
R (t-1)| 0.225 1.140
|
| 106 |
+
| (0.129) (0.112)
|
| 107 |
+
| {0.081} {0.000}
|
| 108 |
+
| [1.745] [10.216]
|
| 109 |
+
Dp(t-2)| -0.134 0.122
|
| 110 |
+
| (0.055) (0.048)
|
| 111 |
+
| {0.016} {0.011}
|
| 112 |
+
| [-2.415] [2.552]
|
| 113 |
+
R (t-2)| 0.071 -0.243
|
| 114 |
+
| (0.170) (0.147)
|
| 115 |
+
| {0.678} {0.099}
|
| 116 |
+
| [0.415] [-1.649]
|
| 117 |
+
Dp(t-3)| -0.143 0.131
|
| 118 |
+
| (0.056) (0.048)
|
| 119 |
+
| {0.010} {0.007}
|
| 120 |
+
| [-2.561] [2.716]
|
| 121 |
+
R (t-3)| -0.172 0.208
|
| 122 |
+
| (0.170) (0.147)
|
| 123 |
+
| {0.312} {0.157}
|
| 124 |
+
| [-1.011] [1.415]
|
| 125 |
+
Dp(t-4)| 0.808 0.071
|
| 126 |
+
| (0.055) (0.047)
|
| 127 |
+
| {0.000} {0.137}
|
| 128 |
+
| [14.712] [1.487]
|
| 129 |
+
R (t-4)| 0.050 -0.226
|
| 130 |
+
| (0.114) (0.098)
|
| 131 |
+
| {0.659} {0.022}
|
| 132 |
+
| [0.441] [-2.295]
|
| 133 |
+
-----------------------------
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
Deterministic term:
|
| 137 |
+
===================
|
| 138 |
+
Dp R
|
| 139 |
+
---------------------------------
|
| 140 |
+
CONST (t)| -0.008 0.006
|
| 141 |
+
| (0.000) (0.000)
|
| 142 |
+
| {0.000} {0.000}
|
| 143 |
+
| [0.000] [0.000]
|
| 144 |
+
TREND(t-1)(t)| 0.000 0.000
|
| 145 |
+
| (0.000) (0.000)
|
| 146 |
+
| {0.000} {0.000}
|
| 147 |
+
| [0.000] [0.000]
|
| 148 |
+
---------------------------------
|
| 149 |
+
|
shared/package-files/0c/0c527a38a57a811c38a7d3ae55fcb510d4de2c909b612d86ba9a70a499f04064/test_backend.py
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from functools import partial
|
| 2 |
+
|
| 3 |
+
import numpy as np
|
| 4 |
+
import scipy.fft
|
| 5 |
+
from scipy.fft import _fftlog, _pocketfft, set_backend
|
| 6 |
+
from scipy.fft.tests import mock_backend
|
| 7 |
+
|
| 8 |
+
from numpy.testing import assert_allclose, assert_equal
|
| 9 |
+
import pytest
|
| 10 |
+
|
| 11 |
+
fnames = ('fft', 'fft2', 'fftn',
|
| 12 |
+
'ifft', 'ifft2', 'ifftn',
|
| 13 |
+
'rfft', 'rfft2', 'rfftn',
|
| 14 |
+
'irfft', 'irfft2', 'irfftn',
|
| 15 |
+
'dct', 'idct', 'dctn', 'idctn',
|
| 16 |
+
'dst', 'idst', 'dstn', 'idstn',
|
| 17 |
+
'fht', 'ifht')
|
| 18 |
+
|
| 19 |
+
np_funcs = (np.fft.fft, np.fft.fft2, np.fft.fftn,
|
| 20 |
+
np.fft.ifft, np.fft.ifft2, np.fft.ifftn,
|
| 21 |
+
np.fft.rfft, np.fft.rfft2, np.fft.rfftn,
|
| 22 |
+
np.fft.irfft, np.fft.irfft2, np.fft.irfftn,
|
| 23 |
+
np.fft.hfft, _pocketfft.hfft2, _pocketfft.hfftn, # np has no hfftn
|
| 24 |
+
np.fft.ihfft, _pocketfft.ihfft2, _pocketfft.ihfftn,
|
| 25 |
+
_pocketfft.dct, _pocketfft.idct, _pocketfft.dctn, _pocketfft.idctn,
|
| 26 |
+
_pocketfft.dst, _pocketfft.idst, _pocketfft.dstn, _pocketfft.idstn,
|
| 27 |
+
# must provide required kwargs for fht, ifht
|
| 28 |
+
partial(_fftlog.fht, dln=2, mu=0.5),
|
| 29 |
+
partial(_fftlog.ifht, dln=2, mu=0.5))
|
| 30 |
+
|
| 31 |
+
funcs = (scipy.fft.fft, scipy.fft.fft2, scipy.fft.fftn,
|
| 32 |
+
scipy.fft.ifft, scipy.fft.ifft2, scipy.fft.ifftn,
|
| 33 |
+
scipy.fft.rfft, scipy.fft.rfft2, scipy.fft.rfftn,
|
| 34 |
+
scipy.fft.irfft, scipy.fft.irfft2, scipy.fft.irfftn,
|
| 35 |
+
scipy.fft.hfft, scipy.fft.hfft2, scipy.fft.hfftn,
|
| 36 |
+
scipy.fft.ihfft, scipy.fft.ihfft2, scipy.fft.ihfftn,
|
| 37 |
+
scipy.fft.dct, scipy.fft.idct, scipy.fft.dctn, scipy.fft.idctn,
|
| 38 |
+
scipy.fft.dst, scipy.fft.idst, scipy.fft.dstn, scipy.fft.idstn,
|
| 39 |
+
# must provide required kwargs for fht, ifht
|
| 40 |
+
partial(scipy.fft.fht, dln=2, mu=0.5),
|
| 41 |
+
partial(scipy.fft.ifht, dln=2, mu=0.5))
|
| 42 |
+
|
| 43 |
+
mocks = (mock_backend.fft, mock_backend.fft2, mock_backend.fftn,
|
| 44 |
+
mock_backend.ifft, mock_backend.ifft2, mock_backend.ifftn,
|
| 45 |
+
mock_backend.rfft, mock_backend.rfft2, mock_backend.rfftn,
|
| 46 |
+
mock_backend.irfft, mock_backend.irfft2, mock_backend.irfftn,
|
| 47 |
+
mock_backend.hfft, mock_backend.hfft2, mock_backend.hfftn,
|
| 48 |
+
mock_backend.ihfft, mock_backend.ihfft2, mock_backend.ihfftn,
|
| 49 |
+
mock_backend.dct, mock_backend.idct,
|
| 50 |
+
mock_backend.dctn, mock_backend.idctn,
|
| 51 |
+
mock_backend.dst, mock_backend.idst,
|
| 52 |
+
mock_backend.dstn, mock_backend.idstn,
|
| 53 |
+
mock_backend.fht, mock_backend.ifht)
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
@pytest.mark.parametrize("func, np_func, mock", zip(funcs, np_funcs, mocks))
|
| 57 |
+
def test_backend_call(func, np_func, mock):
|
| 58 |
+
x = np.arange(20).reshape((10,2))
|
| 59 |
+
answer = np_func(x.astype(np.float64))
|
| 60 |
+
assert_allclose(func(x), answer, atol=1e-10)
|
| 61 |
+
|
| 62 |
+
with set_backend(mock_backend, only=True):
|
| 63 |
+
mock.number_calls.c = 0
|
| 64 |
+
y = func(x)
|
| 65 |
+
assert_equal(y, mock.return_value)
|
| 66 |
+
assert_equal(mock.number_calls.c, 1)
|
| 67 |
+
|
| 68 |
+
assert_allclose(func(x), answer, atol=1e-10)
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
plan_funcs = (scipy.fft.fft, scipy.fft.fft2, scipy.fft.fftn,
|
| 72 |
+
scipy.fft.ifft, scipy.fft.ifft2, scipy.fft.ifftn,
|
| 73 |
+
scipy.fft.rfft, scipy.fft.rfft2, scipy.fft.rfftn,
|
| 74 |
+
scipy.fft.irfft, scipy.fft.irfft2, scipy.fft.irfftn,
|
| 75 |
+
scipy.fft.hfft, scipy.fft.hfft2, scipy.fft.hfftn,
|
| 76 |
+
scipy.fft.ihfft, scipy.fft.ihfft2, scipy.fft.ihfftn)
|
| 77 |
+
|
| 78 |
+
plan_mocks = (mock_backend.fft, mock_backend.fft2, mock_backend.fftn,
|
| 79 |
+
mock_backend.ifft, mock_backend.ifft2, mock_backend.ifftn,
|
| 80 |
+
mock_backend.rfft, mock_backend.rfft2, mock_backend.rfftn,
|
| 81 |
+
mock_backend.irfft, mock_backend.irfft2, mock_backend.irfftn,
|
| 82 |
+
mock_backend.hfft, mock_backend.hfft2, mock_backend.hfftn,
|
| 83 |
+
mock_backend.ihfft, mock_backend.ihfft2, mock_backend.ihfftn)
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
@pytest.mark.parametrize("func, mock", zip(plan_funcs, plan_mocks))
|
| 87 |
+
def test_backend_plan(func, mock):
|
| 88 |
+
x = np.arange(20).reshape((10, 2))
|
| 89 |
+
|
| 90 |
+
with pytest.raises(NotImplementedError, match='precomputed plan'):
|
| 91 |
+
func(x, plan='foo')
|
| 92 |
+
|
| 93 |
+
with set_backend(mock_backend, only=True):
|
| 94 |
+
mock.number_calls.c = 0
|
| 95 |
+
y = func(x, plan='foo')
|
| 96 |
+
assert_equal(y, mock.return_value)
|
| 97 |
+
assert_equal(mock.number_calls.c, 1)
|
| 98 |
+
assert_equal(mock.last_args.l[1]['plan'], 'foo')
|
shared/package-files/0c/0c52c03003c5cd7d832358800048d563f9ccf53ba86260a37b79bb435ec0d045/test_formats.py
ADDED
|
@@ -0,0 +1,350 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from contextlib import nullcontext
|
| 2 |
+
from datetime import (
|
| 3 |
+
datetime,
|
| 4 |
+
time,
|
| 5 |
+
)
|
| 6 |
+
import locale
|
| 7 |
+
|
| 8 |
+
import numpy as np
|
| 9 |
+
import pytest
|
| 10 |
+
|
| 11 |
+
import pandas as pd
|
| 12 |
+
from pandas import (
|
| 13 |
+
PeriodIndex,
|
| 14 |
+
Series,
|
| 15 |
+
)
|
| 16 |
+
import pandas._testing as tm
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
def get_local_am_pm():
|
| 20 |
+
"""Return the AM and PM strings returned by strftime in current locale."""
|
| 21 |
+
am_local = time(1).strftime("%p")
|
| 22 |
+
pm_local = time(13).strftime("%p")
|
| 23 |
+
return am_local, pm_local
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def test_get_values_for_csv():
|
| 27 |
+
index = PeriodIndex(["2017-01-01", "2017-01-02", "2017-01-03"], freq="D")
|
| 28 |
+
|
| 29 |
+
# First, with no arguments.
|
| 30 |
+
expected = np.array(["2017-01-01", "2017-01-02", "2017-01-03"], dtype=object)
|
| 31 |
+
|
| 32 |
+
result = index._get_values_for_csv()
|
| 33 |
+
tm.assert_numpy_array_equal(result, expected)
|
| 34 |
+
|
| 35 |
+
# No NaN values, so na_rep has no effect
|
| 36 |
+
result = index._get_values_for_csv(na_rep="pandas")
|
| 37 |
+
tm.assert_numpy_array_equal(result, expected)
|
| 38 |
+
|
| 39 |
+
# Make sure date formatting works
|
| 40 |
+
expected = np.array(["01-2017-01", "01-2017-02", "01-2017-03"], dtype=object)
|
| 41 |
+
|
| 42 |
+
result = index._get_values_for_csv(date_format="%m-%Y-%d")
|
| 43 |
+
tm.assert_numpy_array_equal(result, expected)
|
| 44 |
+
|
| 45 |
+
# NULL object handling should work
|
| 46 |
+
index = PeriodIndex(["2017-01-01", pd.NaT, "2017-01-03"], freq="D")
|
| 47 |
+
expected = np.array(["2017-01-01", "NaT", "2017-01-03"], dtype=object)
|
| 48 |
+
|
| 49 |
+
result = index._get_values_for_csv(na_rep="NaT")
|
| 50 |
+
tm.assert_numpy_array_equal(result, expected)
|
| 51 |
+
|
| 52 |
+
expected = np.array(["2017-01-01", "pandas", "2017-01-03"], dtype=object)
|
| 53 |
+
|
| 54 |
+
result = index._get_values_for_csv(na_rep="pandas")
|
| 55 |
+
tm.assert_numpy_array_equal(result, expected)
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
class TestPeriodIndexRendering:
|
| 59 |
+
def test_format_empty(self):
|
| 60 |
+
# GH#35712
|
| 61 |
+
empty_idx = PeriodIndex([], freq="Y")
|
| 62 |
+
msg = r"PeriodIndex\.format is deprecated"
|
| 63 |
+
with tm.assert_produces_warning(FutureWarning, match=msg):
|
| 64 |
+
assert empty_idx.format() == []
|
| 65 |
+
with tm.assert_produces_warning(FutureWarning, match=msg):
|
| 66 |
+
assert empty_idx.format(name=True) == [""]
|
| 67 |
+
|
| 68 |
+
@pytest.mark.parametrize("method", ["__repr__", "__str__"])
|
| 69 |
+
def test_representation(self, method):
|
| 70 |
+
# GH#7601
|
| 71 |
+
idx1 = PeriodIndex([], freq="D")
|
| 72 |
+
idx2 = PeriodIndex(["2011-01-01"], freq="D")
|
| 73 |
+
idx3 = PeriodIndex(["2011-01-01", "2011-01-02"], freq="D")
|
| 74 |
+
idx4 = PeriodIndex(["2011-01-01", "2011-01-02", "2011-01-03"], freq="D")
|
| 75 |
+
idx5 = PeriodIndex(["2011", "2012", "2013"], freq="Y")
|
| 76 |
+
idx6 = PeriodIndex(["2011-01-01 09:00", "2012-02-01 10:00", "NaT"], freq="h")
|
| 77 |
+
idx7 = pd.period_range("2013Q1", periods=1, freq="Q")
|
| 78 |
+
idx8 = pd.period_range("2013Q1", periods=2, freq="Q")
|
| 79 |
+
idx9 = pd.period_range("2013Q1", periods=3, freq="Q")
|
| 80 |
+
idx10 = PeriodIndex(["2011-01-01", "2011-02-01"], freq="3D")
|
| 81 |
+
|
| 82 |
+
exp1 = "PeriodIndex([], dtype='period[D]')"
|
| 83 |
+
|
| 84 |
+
exp2 = "PeriodIndex(['2011-01-01'], dtype='period[D]')"
|
| 85 |
+
|
| 86 |
+
exp3 = "PeriodIndex(['2011-01-01', '2011-01-02'], dtype='period[D]')"
|
| 87 |
+
|
| 88 |
+
exp4 = (
|
| 89 |
+
"PeriodIndex(['2011-01-01', '2011-01-02', '2011-01-03'], "
|
| 90 |
+
"dtype='period[D]')"
|
| 91 |
+
)
|
| 92 |
+
|
| 93 |
+
exp5 = "PeriodIndex(['2011', '2012', '2013'], dtype='period[Y-DEC]')"
|
| 94 |
+
|
| 95 |
+
exp6 = (
|
| 96 |
+
"PeriodIndex(['2011-01-01 09:00', '2012-02-01 10:00', 'NaT'], "
|
| 97 |
+
"dtype='period[h]')"
|
| 98 |
+
)
|
| 99 |
+
|
| 100 |
+
exp7 = "PeriodIndex(['2013Q1'], dtype='period[Q-DEC]')"
|
| 101 |
+
|
| 102 |
+
exp8 = "PeriodIndex(['2013Q1', '2013Q2'], dtype='period[Q-DEC]')"
|
| 103 |
+
|
| 104 |
+
exp9 = "PeriodIndex(['2013Q1', '2013Q2', '2013Q3'], dtype='period[Q-DEC]')"
|
| 105 |
+
|
| 106 |
+
exp10 = "PeriodIndex(['2011-01-01', '2011-02-01'], dtype='period[3D]')"
|
| 107 |
+
|
| 108 |
+
for idx, expected in zip(
|
| 109 |
+
[idx1, idx2, idx3, idx4, idx5, idx6, idx7, idx8, idx9, idx10],
|
| 110 |
+
[exp1, exp2, exp3, exp4, exp5, exp6, exp7, exp8, exp9, exp10],
|
| 111 |
+
):
|
| 112 |
+
result = getattr(idx, method)()
|
| 113 |
+
assert result == expected
|
| 114 |
+
|
| 115 |
+
# TODO: These are Series.__repr__ tests
|
| 116 |
+
def test_representation_to_series(self):
|
| 117 |
+
# GH#10971
|
| 118 |
+
idx1 = PeriodIndex([], freq="D")
|
| 119 |
+
idx2 = PeriodIndex(["2011-01-01"], freq="D")
|
| 120 |
+
idx3 = PeriodIndex(["2011-01-01", "2011-01-02"], freq="D")
|
| 121 |
+
idx4 = PeriodIndex(["2011-01-01", "2011-01-02", "2011-01-03"], freq="D")
|
| 122 |
+
idx5 = PeriodIndex(["2011", "2012", "2013"], freq="Y")
|
| 123 |
+
idx6 = PeriodIndex(["2011-01-01 09:00", "2012-02-01 10:00", "NaT"], freq="h")
|
| 124 |
+
|
| 125 |
+
idx7 = pd.period_range("2013Q1", periods=1, freq="Q")
|
| 126 |
+
idx8 = pd.period_range("2013Q1", periods=2, freq="Q")
|
| 127 |
+
idx9 = pd.period_range("2013Q1", periods=3, freq="Q")
|
| 128 |
+
|
| 129 |
+
exp1 = """Series([], dtype: period[D])"""
|
| 130 |
+
|
| 131 |
+
exp2 = """0 2011-01-01
|
| 132 |
+
dtype: period[D]"""
|
| 133 |
+
|
| 134 |
+
exp3 = """0 2011-01-01
|
| 135 |
+
1 2011-01-02
|
| 136 |
+
dtype: period[D]"""
|
| 137 |
+
|
| 138 |
+
exp4 = """0 2011-01-01
|
| 139 |
+
1 2011-01-02
|
| 140 |
+
2 2011-01-03
|
| 141 |
+
dtype: period[D]"""
|
| 142 |
+
|
| 143 |
+
exp5 = """0 2011
|
| 144 |
+
1 2012
|
| 145 |
+
2 2013
|
| 146 |
+
dtype: period[Y-DEC]"""
|
| 147 |
+
|
| 148 |
+
exp6 = """0 2011-01-01 09:00
|
| 149 |
+
1 2012-02-01 10:00
|
| 150 |
+
2 NaT
|
| 151 |
+
dtype: period[h]"""
|
| 152 |
+
|
| 153 |
+
exp7 = """0 2013Q1
|
| 154 |
+
dtype: period[Q-DEC]"""
|
| 155 |
+
|
| 156 |
+
exp8 = """0 2013Q1
|
| 157 |
+
1 2013Q2
|
| 158 |
+
dtype: period[Q-DEC]"""
|
| 159 |
+
|
| 160 |
+
exp9 = """0 2013Q1
|
| 161 |
+
1 2013Q2
|
| 162 |
+
2 2013Q3
|
| 163 |
+
dtype: period[Q-DEC]"""
|
| 164 |
+
|
| 165 |
+
for idx, expected in zip(
|
| 166 |
+
[idx1, idx2, idx3, idx4, idx5, idx6, idx7, idx8, idx9],
|
| 167 |
+
[exp1, exp2, exp3, exp4, exp5, exp6, exp7, exp8, exp9],
|
| 168 |
+
):
|
| 169 |
+
result = repr(Series(idx))
|
| 170 |
+
assert result == expected
|
| 171 |
+
|
| 172 |
+
def test_summary(self):
|
| 173 |
+
# GH#9116
|
| 174 |
+
idx1 = PeriodIndex([], freq="D")
|
| 175 |
+
idx2 = PeriodIndex(["2011-01-01"], freq="D")
|
| 176 |
+
idx3 = PeriodIndex(["2011-01-01", "2011-01-02"], freq="D")
|
| 177 |
+
idx4 = PeriodIndex(["2011-01-01", "2011-01-02", "2011-01-03"], freq="D")
|
| 178 |
+
idx5 = PeriodIndex(["2011", "2012", "2013"], freq="Y")
|
| 179 |
+
idx6 = PeriodIndex(["2011-01-01 09:00", "2012-02-01 10:00", "NaT"], freq="h")
|
| 180 |
+
|
| 181 |
+
idx7 = pd.period_range("2013Q1", periods=1, freq="Q")
|
| 182 |
+
idx8 = pd.period_range("2013Q1", periods=2, freq="Q")
|
| 183 |
+
idx9 = pd.period_range("2013Q1", periods=3, freq="Q")
|
| 184 |
+
|
| 185 |
+
exp1 = """PeriodIndex: 0 entries
|
| 186 |
+
Freq: D"""
|
| 187 |
+
|
| 188 |
+
exp2 = """PeriodIndex: 1 entries, 2011-01-01 to 2011-01-01
|
| 189 |
+
Freq: D"""
|
| 190 |
+
|
| 191 |
+
exp3 = """PeriodIndex: 2 entries, 2011-01-01 to 2011-01-02
|
| 192 |
+
Freq: D"""
|
| 193 |
+
|
| 194 |
+
exp4 = """PeriodIndex: 3 entries, 2011-01-01 to 2011-01-03
|
| 195 |
+
Freq: D"""
|
| 196 |
+
|
| 197 |
+
exp5 = """PeriodIndex: 3 entries, 2011 to 2013
|
| 198 |
+
Freq: Y-DEC"""
|
| 199 |
+
|
| 200 |
+
exp6 = """PeriodIndex: 3 entries, 2011-01-01 09:00 to NaT
|
| 201 |
+
Freq: h"""
|
| 202 |
+
|
| 203 |
+
exp7 = """PeriodIndex: 1 entries, 2013Q1 to 2013Q1
|
| 204 |
+
Freq: Q-DEC"""
|
| 205 |
+
|
| 206 |
+
exp8 = """PeriodIndex: 2 entries, 2013Q1 to 2013Q2
|
| 207 |
+
Freq: Q-DEC"""
|
| 208 |
+
|
| 209 |
+
exp9 = """PeriodIndex: 3 entries, 2013Q1 to 2013Q3
|
| 210 |
+
Freq: Q-DEC"""
|
| 211 |
+
|
| 212 |
+
for idx, expected in zip(
|
| 213 |
+
[idx1, idx2, idx3, idx4, idx5, idx6, idx7, idx8, idx9],
|
| 214 |
+
[exp1, exp2, exp3, exp4, exp5, exp6, exp7, exp8, exp9],
|
| 215 |
+
):
|
| 216 |
+
result = idx._summary()
|
| 217 |
+
assert result == expected
|
| 218 |
+
|
| 219 |
+
|
| 220 |
+
class TestPeriodIndexFormat:
|
| 221 |
+
def test_period_format_and_strftime_default(self):
|
| 222 |
+
per = PeriodIndex([datetime(2003, 1, 1, 12), None], freq="h")
|
| 223 |
+
|
| 224 |
+
# Default formatting
|
| 225 |
+
msg = "PeriodIndex.format is deprecated"
|
| 226 |
+
with tm.assert_produces_warning(FutureWarning, match=msg):
|
| 227 |
+
formatted = per.format()
|
| 228 |
+
assert formatted[0] == "2003-01-01 12:00" # default: minutes not shown
|
| 229 |
+
assert formatted[1] == "NaT"
|
| 230 |
+
# format is equivalent to strftime(None)...
|
| 231 |
+
assert formatted[0] == per.strftime(None)[0]
|
| 232 |
+
assert per.strftime(None)[1] is np.nan # ...except for NaTs
|
| 233 |
+
|
| 234 |
+
# Same test with nanoseconds freq
|
| 235 |
+
per = pd.period_range("2003-01-01 12:01:01.123456789", periods=2, freq="ns")
|
| 236 |
+
with tm.assert_produces_warning(FutureWarning, match=msg):
|
| 237 |
+
formatted = per.format()
|
| 238 |
+
assert (formatted == per.strftime(None)).all()
|
| 239 |
+
assert formatted[0] == "2003-01-01 12:01:01.123456789"
|
| 240 |
+
assert formatted[1] == "2003-01-01 12:01:01.123456790"
|
| 241 |
+
|
| 242 |
+
def test_period_custom(self):
|
| 243 |
+
# GH#46252 custom formatting directives %l (ms) and %u (us)
|
| 244 |
+
msg = "PeriodIndex.format is deprecated"
|
| 245 |
+
|
| 246 |
+
# 3 digits
|
| 247 |
+
per = pd.period_range("2003-01-01 12:01:01.123", periods=2, freq="ms")
|
| 248 |
+
with tm.assert_produces_warning(FutureWarning, match=msg):
|
| 249 |
+
formatted = per.format(date_format="%y %I:%M:%S (ms=%l us=%u ns=%n)")
|
| 250 |
+
assert formatted[0] == "03 12:01:01 (ms=123 us=123000 ns=123000000)"
|
| 251 |
+
assert formatted[1] == "03 12:01:01 (ms=124 us=124000 ns=124000000)"
|
| 252 |
+
|
| 253 |
+
# 6 digits
|
| 254 |
+
per = pd.period_range("2003-01-01 12:01:01.123456", periods=2, freq="us")
|
| 255 |
+
with tm.assert_produces_warning(FutureWarning, match=msg):
|
| 256 |
+
formatted = per.format(date_format="%y %I:%M:%S (ms=%l us=%u ns=%n)")
|
| 257 |
+
assert formatted[0] == "03 12:01:01 (ms=123 us=123456 ns=123456000)"
|
| 258 |
+
assert formatted[1] == "03 12:01:01 (ms=123 us=123457 ns=123457000)"
|
| 259 |
+
|
| 260 |
+
# 9 digits
|
| 261 |
+
per = pd.period_range("2003-01-01 12:01:01.123456789", periods=2, freq="ns")
|
| 262 |
+
with tm.assert_produces_warning(FutureWarning, match=msg):
|
| 263 |
+
formatted = per.format(date_format="%y %I:%M:%S (ms=%l us=%u ns=%n)")
|
| 264 |
+
assert formatted[0] == "03 12:01:01 (ms=123 us=123456 ns=123456789)"
|
| 265 |
+
assert formatted[1] == "03 12:01:01 (ms=123 us=123456 ns=123456790)"
|
| 266 |
+
|
| 267 |
+
def test_period_tz(self):
|
| 268 |
+
# Formatting periods created from a datetime with timezone.
|
| 269 |
+
msg = r"PeriodIndex\.format is deprecated"
|
| 270 |
+
# This timestamp is in 2013 in Europe/Paris but is 2012 in UTC
|
| 271 |
+
dt = pd.to_datetime(["2013-01-01 00:00:00+01:00"], utc=True)
|
| 272 |
+
|
| 273 |
+
# Converting to a period looses the timezone information
|
| 274 |
+
# Since tz is currently set as utc, we'll see 2012
|
| 275 |
+
with tm.assert_produces_warning(UserWarning, match="will drop timezone"):
|
| 276 |
+
per = dt.to_period(freq="h")
|
| 277 |
+
with tm.assert_produces_warning(FutureWarning, match=msg):
|
| 278 |
+
assert per.format()[0] == "2012-12-31 23:00"
|
| 279 |
+
|
| 280 |
+
# If tz is currently set as paris before conversion, we'll see 2013
|
| 281 |
+
dt = dt.tz_convert("Europe/Paris")
|
| 282 |
+
with tm.assert_produces_warning(UserWarning, match="will drop timezone"):
|
| 283 |
+
per = dt.to_period(freq="h")
|
| 284 |
+
with tm.assert_produces_warning(FutureWarning, match=msg):
|
| 285 |
+
assert per.format()[0] == "2013-01-01 00:00"
|
| 286 |
+
|
| 287 |
+
@pytest.mark.parametrize(
|
| 288 |
+
"locale_str",
|
| 289 |
+
[
|
| 290 |
+
pytest.param(None, id=str(locale.getlocale())),
|
| 291 |
+
"it_IT.utf8",
|
| 292 |
+
"it_IT", # Note: encoding will be 'ISO8859-1'
|
| 293 |
+
"zh_CN.utf8",
|
| 294 |
+
"zh_CN", # Note: encoding will be 'gb2312'
|
| 295 |
+
],
|
| 296 |
+
)
|
| 297 |
+
def test_period_non_ascii_fmt(self, locale_str):
|
| 298 |
+
# GH#46468 non-ascii char in input format string leads to wrong output
|
| 299 |
+
|
| 300 |
+
# Skip if locale cannot be set
|
| 301 |
+
if locale_str is not None and not tm.can_set_locale(locale_str, locale.LC_ALL):
|
| 302 |
+
pytest.skip(f"Skipping as locale '{locale_str}' cannot be set on host.")
|
| 303 |
+
|
| 304 |
+
# Change locale temporarily for this test.
|
| 305 |
+
with tm.set_locale(locale_str, locale.LC_ALL) if locale_str else nullcontext():
|
| 306 |
+
# Scalar
|
| 307 |
+
per = pd.Period("2018-03-11 13:00", freq="h")
|
| 308 |
+
assert per.strftime("%y é") == "18 é"
|
| 309 |
+
|
| 310 |
+
# Index
|
| 311 |
+
per = pd.period_range("2003-01-01 01:00:00", periods=2, freq="12h")
|
| 312 |
+
msg = "PeriodIndex.format is deprecated"
|
| 313 |
+
with tm.assert_produces_warning(FutureWarning, match=msg):
|
| 314 |
+
formatted = per.format(date_format="%y é")
|
| 315 |
+
assert formatted[0] == "03 é"
|
| 316 |
+
assert formatted[1] == "03 é"
|
| 317 |
+
|
| 318 |
+
@pytest.mark.parametrize(
|
| 319 |
+
"locale_str",
|
| 320 |
+
[
|
| 321 |
+
pytest.param(None, id=str(locale.getlocale())),
|
| 322 |
+
"it_IT.utf8",
|
| 323 |
+
"it_IT", # Note: encoding will be 'ISO8859-1'
|
| 324 |
+
"zh_CN.utf8",
|
| 325 |
+
"zh_CN", # Note: encoding will be 'gb2312'
|
| 326 |
+
],
|
| 327 |
+
)
|
| 328 |
+
def test_period_custom_locale_directive(self, locale_str):
|
| 329 |
+
# GH#46319 locale-specific directive leads to non-utf8 c strftime char* result
|
| 330 |
+
|
| 331 |
+
# Skip if locale cannot be set
|
| 332 |
+
if locale_str is not None and not tm.can_set_locale(locale_str, locale.LC_ALL):
|
| 333 |
+
pytest.skip(f"Skipping as locale '{locale_str}' cannot be set on host.")
|
| 334 |
+
|
| 335 |
+
# Change locale temporarily for this test.
|
| 336 |
+
with tm.set_locale(locale_str, locale.LC_ALL) if locale_str else nullcontext():
|
| 337 |
+
# Get locale-specific reference
|
| 338 |
+
am_local, pm_local = get_local_am_pm()
|
| 339 |
+
|
| 340 |
+
# Scalar
|
| 341 |
+
per = pd.Period("2018-03-11 13:00", freq="h")
|
| 342 |
+
assert per.strftime("%p") == pm_local
|
| 343 |
+
|
| 344 |
+
# Index
|
| 345 |
+
per = pd.period_range("2003-01-01 01:00:00", periods=2, freq="12h")
|
| 346 |
+
msg = "PeriodIndex.format is deprecated"
|
| 347 |
+
with tm.assert_produces_warning(FutureWarning, match=msg):
|
| 348 |
+
formatted = per.format(date_format="%y %I:%M:%S%p")
|
| 349 |
+
assert formatted[0] == f"03 01:00:00{am_local}"
|
| 350 |
+
assert formatted[1] == f"03 01:00:00{pm_local}"
|
shared/package-files/0c/0c56d1cc902aa31c536cb523a2357e1eec061df3a70003caa4e7415c54705d2e/adaptive.h
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
|
| 3 |
+
#include <torch/nn/cloneable.h>
|
| 4 |
+
#include <torch/nn/functional/activation.h>
|
| 5 |
+
#include <torch/nn/module.h>
|
| 6 |
+
#include <torch/nn/modules/container/modulelist.h>
|
| 7 |
+
#include <torch/nn/modules/container/sequential.h>
|
| 8 |
+
#include <torch/nn/modules/linear.h>
|
| 9 |
+
#include <torch/nn/options/adaptive.h>
|
| 10 |
+
|
| 11 |
+
namespace torch {
|
| 12 |
+
namespace nn {
|
| 13 |
+
|
| 14 |
+
/// The output of a single invocation of an AdaptiveLogSoftmaxWithLoss
|
| 15 |
+
/// module's `forward()` method.
|
| 16 |
+
struct TORCH_API ASMoutput {
|
| 17 |
+
ASMoutput(Tensor output_, double loss_);
|
| 18 |
+
|
| 19 |
+
/// Tensor containing computed target log probabilities for each example
|
| 20 |
+
Tensor output;
|
| 21 |
+
|
| 22 |
+
/// Scalar representing the computed negative log likelihood loss
|
| 23 |
+
double loss;
|
| 24 |
+
};
|
| 25 |
+
|
| 26 |
+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ AdaptiveLogSoftmaxWithLoss
|
| 27 |
+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| 28 |
+
|
| 29 |
+
/// Efficient softmax approximation as described in
|
| 30 |
+
/// `Efficient softmax approximation for GPUs`_ by Edouard Grave, Armand Joulin,
|
| 31 |
+
/// Moustapha Cissé, David Grangier, and Hervé Jégou.
|
| 32 |
+
/// See
|
| 33 |
+
/// https://pytorch.org/docs/master/nn.html#torch.nn.AdaptiveLogSoftmaxWithLoss
|
| 34 |
+
/// to learn about the exact behavior of this module.
|
| 35 |
+
///
|
| 36 |
+
/// See the documentation for `torch::nn::AdaptiveLogSoftmaxWithLossOptions`
|
| 37 |
+
/// class to learn what constructor arguments are supported for this module.
|
| 38 |
+
///
|
| 39 |
+
/// Example:
|
| 40 |
+
/// ```
|
| 41 |
+
/// AdaptiveLogSoftmaxWithLoss model(AdaptiveLogSoftmaxWithLossOptions(8, 10,
|
| 42 |
+
/// {4, 8}).div_value(2.).head_bias(true));
|
| 43 |
+
/// ```
|
| 44 |
+
class TORCH_API AdaptiveLogSoftmaxWithLossImpl
|
| 45 |
+
: public Cloneable<AdaptiveLogSoftmaxWithLossImpl> {
|
| 46 |
+
public:
|
| 47 |
+
AdaptiveLogSoftmaxWithLossImpl(
|
| 48 |
+
int64_t in_features,
|
| 49 |
+
int64_t n_classes,
|
| 50 |
+
std::vector<int64_t> cutoffs)
|
| 51 |
+
: AdaptiveLogSoftmaxWithLossImpl(AdaptiveLogSoftmaxWithLossOptions(
|
| 52 |
+
in_features,
|
| 53 |
+
n_classes,
|
| 54 |
+
cutoffs)) {}
|
| 55 |
+
|
| 56 |
+
explicit AdaptiveLogSoftmaxWithLossImpl(
|
| 57 |
+
AdaptiveLogSoftmaxWithLossOptions options_);
|
| 58 |
+
|
| 59 |
+
ASMoutput forward(const Tensor& input, const Tensor& target);
|
| 60 |
+
|
| 61 |
+
void reset() override;
|
| 62 |
+
|
| 63 |
+
void reset_parameters();
|
| 64 |
+
|
| 65 |
+
/// Pretty prints the `AdaptiveLogSoftmaxWithLoss` module into the given
|
| 66 |
+
/// `stream`.
|
| 67 |
+
void pretty_print(std::ostream& stream) const override;
|
| 68 |
+
|
| 69 |
+
/// Given input tensor, and output of `head`, computes the log of the full
|
| 70 |
+
/// distribution
|
| 71 |
+
Tensor _get_full_log_prob(const Tensor& input, const Tensor& head_output);
|
| 72 |
+
|
| 73 |
+
/// Computes log probabilities for all n_classes
|
| 74 |
+
Tensor log_prob(const Tensor& input);
|
| 75 |
+
|
| 76 |
+
/// This is equivalent to `log_pob(input).argmax(1)` but is more efficient in
|
| 77 |
+
/// some cases
|
| 78 |
+
Tensor predict(const Tensor& input);
|
| 79 |
+
|
| 80 |
+
/// The options with which this `Module` was constructed
|
| 81 |
+
AdaptiveLogSoftmaxWithLossOptions options;
|
| 82 |
+
|
| 83 |
+
/// Cutoffs used to assign targets to their buckets. It should be an ordered
|
| 84 |
+
/// Sequence of integers sorted in the increasing order
|
| 85 |
+
std::vector<int64_t> cutoffs;
|
| 86 |
+
|
| 87 |
+
int64_t shortlist_size;
|
| 88 |
+
|
| 89 |
+
/// Number of clusters
|
| 90 |
+
int64_t n_clusters;
|
| 91 |
+
|
| 92 |
+
/// Output size of head classifier
|
| 93 |
+
int64_t head_size;
|
| 94 |
+
|
| 95 |
+
Linear head = nullptr;
|
| 96 |
+
|
| 97 |
+
ModuleList tail;
|
| 98 |
+
};
|
| 99 |
+
|
| 100 |
+
/// A `ModuleHolder` subclass for `AdaptiveLogSoftmaxWithLossImpl`.
|
| 101 |
+
/// See the documentation for `AdaptiveLogSoftmaxWithLossImpl` class to learn
|
| 102 |
+
/// what methods it provides, and examples of how to use
|
| 103 |
+
/// `AdaptiveLogSoftmaxWithLoss` with
|
| 104 |
+
/// `torch::nn::AdaptiveLogSoftmaxWithLossOptions`. See the documentation for
|
| 105 |
+
/// `ModuleHolder` to learn about PyTorch's module storage semantics.
|
| 106 |
+
TORCH_MODULE(AdaptiveLogSoftmaxWithLoss);
|
| 107 |
+
|
| 108 |
+
} // namespace nn
|
| 109 |
+
} // namespace torch
|
shared/package-files/0c/0c5a3106c098456aa876635a0cd3e742b6534d789a4afc0d664c2bc9b7bb725d/test_tools.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import numpy as np
|
| 2 |
+
import pytest
|
| 3 |
+
|
| 4 |
+
from pandas import (
|
| 5 |
+
Period,
|
| 6 |
+
PeriodIndex,
|
| 7 |
+
period_range,
|
| 8 |
+
)
|
| 9 |
+
import pandas._testing as tm
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
class TestPeriodRepresentation:
|
| 13 |
+
"""
|
| 14 |
+
Wish to match NumPy units
|
| 15 |
+
"""
|
| 16 |
+
|
| 17 |
+
@pytest.mark.parametrize(
|
| 18 |
+
"freq, base_date",
|
| 19 |
+
[
|
| 20 |
+
("W-THU", "1970-01-01"),
|
| 21 |
+
("D", "1970-01-01"),
|
| 22 |
+
("B", "1970-01-01"),
|
| 23 |
+
("h", "1970-01-01"),
|
| 24 |
+
("min", "1970-01-01"),
|
| 25 |
+
("s", "1970-01-01"),
|
| 26 |
+
("ms", "1970-01-01"),
|
| 27 |
+
("us", "1970-01-01"),
|
| 28 |
+
("ns", "1970-01-01"),
|
| 29 |
+
("M", "1970-01"),
|
| 30 |
+
("Y", 1970),
|
| 31 |
+
],
|
| 32 |
+
)
|
| 33 |
+
@pytest.mark.filterwarnings(r"ignore:PeriodDtype\[B\] is deprecated:FutureWarning")
|
| 34 |
+
@pytest.mark.filterwarnings(
|
| 35 |
+
"ignore:Period with BDay freq is deprecated:FutureWarning"
|
| 36 |
+
)
|
| 37 |
+
def test_freq(self, freq, base_date):
|
| 38 |
+
rng = period_range(start=base_date, periods=10, freq=freq)
|
| 39 |
+
exp = np.arange(10, dtype=np.int64)
|
| 40 |
+
|
| 41 |
+
tm.assert_numpy_array_equal(rng.asi8, exp)
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
class TestPeriodIndexConversion:
|
| 45 |
+
def test_tolist(self):
|
| 46 |
+
index = period_range(freq="Y", start="1/1/2001", end="12/1/2009")
|
| 47 |
+
rs = index.tolist()
|
| 48 |
+
for x in rs:
|
| 49 |
+
assert isinstance(x, Period)
|
| 50 |
+
|
| 51 |
+
recon = PeriodIndex(rs)
|
| 52 |
+
tm.assert_index_equal(index, recon)
|
shared/package-files/0c/0c5bab22964a970533cb61ecf356133c51b3ea5224f1d6a59827dcc64cff74b1/linalg.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
shared/package-files/0c/0c5bdff5e2602627390d41edda5ac992c4aee57e9e5d17eb877d2de720154b36/gdscript.py
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.gdscript
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexer for GDScript.
|
| 6 |
+
|
| 7 |
+
Modified by Daniel J. Ramirez <djrmuv@gmail.com> based on the original
|
| 8 |
+
python.py.
|
| 9 |
+
|
| 10 |
+
:copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
|
| 11 |
+
:license: BSD, see LICENSE for details.
|
| 12 |
+
"""
|
| 13 |
+
|
| 14 |
+
import re
|
| 15 |
+
|
| 16 |
+
from pygments.lexer import RegexLexer, include, bygroups, default, words, \
|
| 17 |
+
combined
|
| 18 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 19 |
+
Number, Punctuation, Whitespace
|
| 20 |
+
|
| 21 |
+
__all__ = ["GDScriptLexer"]
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class GDScriptLexer(RegexLexer):
|
| 25 |
+
"""
|
| 26 |
+
For GDScript source code.
|
| 27 |
+
"""
|
| 28 |
+
|
| 29 |
+
name = "GDScript"
|
| 30 |
+
url = 'https://www.godotengine.org'
|
| 31 |
+
aliases = ["gdscript", "gd"]
|
| 32 |
+
filenames = ["*.gd"]
|
| 33 |
+
mimetypes = ["text/x-gdscript", "application/x-gdscript"]
|
| 34 |
+
|
| 35 |
+
def innerstring_rules(ttype):
|
| 36 |
+
return [
|
| 37 |
+
# the old style '%s' % (...) string formatting
|
| 38 |
+
(r"%(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?"
|
| 39 |
+
"[hlL]?[E-GXc-giorsux%]",
|
| 40 |
+
String.Interpol),
|
| 41 |
+
# backslashes, quotes and formatting signs must be parsed one at a time
|
| 42 |
+
(r'[^\\\'"%\n]+', ttype),
|
| 43 |
+
(r'[\'"\\]', ttype),
|
| 44 |
+
# unhandled string formatting sign
|
| 45 |
+
(r"%", ttype),
|
| 46 |
+
# newlines are an error (use "nl" state)
|
| 47 |
+
]
|
| 48 |
+
|
| 49 |
+
tokens = {
|
| 50 |
+
"root": [
|
| 51 |
+
(r"\n", Whitespace),
|
| 52 |
+
(r'^(\s*)([rRuUbB]{,2})("""(?:.|\n)*?""")',
|
| 53 |
+
bygroups(Whitespace, String.Affix, String.Doc)),
|
| 54 |
+
(r"^(\s*)([rRuUbB]{,2})('''(?:.|\n)*?''')",
|
| 55 |
+
bygroups(Whitespace, String.Affix, String.Doc)),
|
| 56 |
+
(r"[^\S\n]+", Whitespace),
|
| 57 |
+
(r"#.*$", Comment.Single),
|
| 58 |
+
(r"[]{}:(),;[]", Punctuation),
|
| 59 |
+
(r"(\\)(\n)", bygroups(Text, Whitespace)),
|
| 60 |
+
(r"\\", Text),
|
| 61 |
+
(r"(in|and|or|not)\b", Operator.Word),
|
| 62 |
+
(r"!=|==|<<|>>|&&|\+=|-=|\*=|/=|%=|&=|\|=|\|\||[-~+/*%=<>&^.!|$]",
|
| 63 |
+
Operator),
|
| 64 |
+
include("keywords"),
|
| 65 |
+
(r"(func)(\s+)", bygroups(Keyword, Whitespace), "funcname"),
|
| 66 |
+
(r"(class)(\s+)", bygroups(Keyword, Whitespace), "classname"),
|
| 67 |
+
include("builtins"),
|
| 68 |
+
('([rR]|[uUbB][rR]|[rR][uUbB])(""")',
|
| 69 |
+
bygroups(String.Affix, String.Double),
|
| 70 |
+
"tdqs"),
|
| 71 |
+
("([rR]|[uUbB][rR]|[rR][uUbB])(''')",
|
| 72 |
+
bygroups(String.Affix, String.Single),
|
| 73 |
+
"tsqs"),
|
| 74 |
+
('([rR]|[uUbB][rR]|[rR][uUbB])(")',
|
| 75 |
+
bygroups(String.Affix, String.Double),
|
| 76 |
+
"dqs"),
|
| 77 |
+
("([rR]|[uUbB][rR]|[rR][uUbB])(')",
|
| 78 |
+
bygroups(String.Affix, String.Single),
|
| 79 |
+
"sqs"),
|
| 80 |
+
('([uUbB]?)(""")',
|
| 81 |
+
bygroups(String.Affix, String.Double),
|
| 82 |
+
combined("stringescape", "tdqs")),
|
| 83 |
+
("([uUbB]?)(''')",
|
| 84 |
+
bygroups(String.Affix, String.Single),
|
| 85 |
+
combined("stringescape", "tsqs")),
|
| 86 |
+
('([uUbB]?)(")',
|
| 87 |
+
bygroups(String.Affix, String.Double),
|
| 88 |
+
combined("stringescape", "dqs")),
|
| 89 |
+
("([uUbB]?)(')",
|
| 90 |
+
bygroups(String.Affix, String.Single),
|
| 91 |
+
combined("stringescape", "sqs")),
|
| 92 |
+
include("name"),
|
| 93 |
+
include("numbers"),
|
| 94 |
+
],
|
| 95 |
+
"keywords": [
|
| 96 |
+
(words(("and", "in", "not", "or", "as", "breakpoint", "class",
|
| 97 |
+
"class_name", "extends", "is", "func", "setget", "signal",
|
| 98 |
+
"tool", "const", "enum", "export", "onready", "static",
|
| 99 |
+
"var", "break", "continue", "if", "elif", "else", "for",
|
| 100 |
+
"pass", "return", "match", "while", "remote", "master",
|
| 101 |
+
"puppet", "remotesync", "mastersync", "puppetsync"),
|
| 102 |
+
suffix=r"\b"), Keyword),
|
| 103 |
+
],
|
| 104 |
+
"builtins": [
|
| 105 |
+
(words(("Color8", "ColorN", "abs", "acos", "asin", "assert", "atan",
|
| 106 |
+
"atan2", "bytes2var", "ceil", "char", "clamp", "convert",
|
| 107 |
+
"cos", "cosh", "db2linear", "decimals", "dectime", "deg2rad",
|
| 108 |
+
"dict2inst", "ease", "exp", "floor", "fmod", "fposmod",
|
| 109 |
+
"funcref", "hash", "inst2dict", "instance_from_id", "is_inf",
|
| 110 |
+
"is_nan", "lerp", "linear2db", "load", "log", "max", "min",
|
| 111 |
+
"nearest_po2", "pow", "preload", "print", "print_stack",
|
| 112 |
+
"printerr", "printraw", "prints", "printt", "rad2deg",
|
| 113 |
+
"rand_range", "rand_seed", "randf", "randi", "randomize",
|
| 114 |
+
"range", "round", "seed", "sign", "sin", "sinh", "sqrt",
|
| 115 |
+
"stepify", "str", "str2var", "tan", "tan", "tanh",
|
| 116 |
+
"type_exist", "typeof", "var2bytes", "var2str", "weakref",
|
| 117 |
+
"yield"), prefix=r"(?<!\.)", suffix=r"\b"),
|
| 118 |
+
Name.Builtin),
|
| 119 |
+
(r"((?<!\.)(self|false|true)|(PI|TAU|NAN|INF)" r")\b",
|
| 120 |
+
Name.Builtin.Pseudo),
|
| 121 |
+
(words(("bool", "int", "float", "String", "NodePath", "Vector2",
|
| 122 |
+
"Rect2", "Transform2D", "Vector3", "Rect3", "Plane", "Quat",
|
| 123 |
+
"Basis", "Transform", "Color", "RID", "Object", "NodePath",
|
| 124 |
+
"Dictionary", "Array", "PackedByteArray", "PackedInt32Array",
|
| 125 |
+
"PackedInt64Array", "PackedFloat32Array", "PackedFloat64Array",
|
| 126 |
+
"PackedStringArray", "PackedVector2Array", "PackedVector3Array",
|
| 127 |
+
"PackedColorArray", "null", "void"),
|
| 128 |
+
prefix=r"(?<!\.)", suffix=r"\b"),
|
| 129 |
+
Name.Builtin.Type),
|
| 130 |
+
],
|
| 131 |
+
"numbers": [
|
| 132 |
+
(r"(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?j?", Number.Float),
|
| 133 |
+
(r"\d+[eE][+-]?[0-9]+j?", Number.Float),
|
| 134 |
+
(r"0[xX][a-fA-F0-9]+", Number.Hex),
|
| 135 |
+
(r"\d+j?", Number.Integer),
|
| 136 |
+
],
|
| 137 |
+
"name": [(r"[a-zA-Z_]\w*", Name)],
|
| 138 |
+
"funcname": [(r"[a-zA-Z_]\w*", Name.Function, "#pop"), default("#pop")],
|
| 139 |
+
"classname": [(r"[a-zA-Z_]\w*", Name.Class, "#pop")],
|
| 140 |
+
"stringescape": [
|
| 141 |
+
(
|
| 142 |
+
r'\\([\\abfnrtv"\']|\n|N\{.*?\}|u[a-fA-F0-9]{4}|'
|
| 143 |
+
r"U[a-fA-F0-9]{8}|x[a-fA-F0-9]{2}|[0-7]{1,3})",
|
| 144 |
+
String.Escape,
|
| 145 |
+
)
|
| 146 |
+
],
|
| 147 |
+
"strings-single": innerstring_rules(String.Single),
|
| 148 |
+
"strings-double": innerstring_rules(String.Double),
|
| 149 |
+
"dqs": [
|
| 150 |
+
(r'"', String.Double, "#pop"),
|
| 151 |
+
(r'\\\\|\\"|\\\n', String.Escape), # included here for raw strings
|
| 152 |
+
include("strings-double"),
|
| 153 |
+
],
|
| 154 |
+
"sqs": [
|
| 155 |
+
(r"'", String.Single, "#pop"),
|
| 156 |
+
(r"\\\\|\\'|\\\n", String.Escape), # included here for raw strings
|
| 157 |
+
include("strings-single"),
|
| 158 |
+
],
|
| 159 |
+
"tdqs": [
|
| 160 |
+
(r'"""', String.Double, "#pop"),
|
| 161 |
+
include("strings-double"),
|
| 162 |
+
(r"\n", Whitespace),
|
| 163 |
+
],
|
| 164 |
+
"tsqs": [
|
| 165 |
+
(r"'''", String.Single, "#pop"),
|
| 166 |
+
include("strings-single"),
|
| 167 |
+
(r"\n", Whitespace),
|
| 168 |
+
],
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
def analyse_text(text):
|
| 172 |
+
score = 0.0
|
| 173 |
+
|
| 174 |
+
if re.search(
|
| 175 |
+
r"func (_ready|_init|_input|_process|_unhandled_input)", text
|
| 176 |
+
):
|
| 177 |
+
score += 0.8
|
| 178 |
+
|
| 179 |
+
if re.search(
|
| 180 |
+
r"(extends |class_name |onready |preload|load|setget|func [^_])",
|
| 181 |
+
text
|
| 182 |
+
):
|
| 183 |
+
score += 0.4
|
| 184 |
+
|
| 185 |
+
if re.search(r"(var|const|enum|export|signal|tool)", text):
|
| 186 |
+
score += 0.2
|
| 187 |
+
|
| 188 |
+
return min(score, 1.0)
|
shared/package-files/0c/0c5c5c2d1ff01de4c6740e3d565f9dafc934cdd9bb2e592c07a0ea8f7643e588/well_known_types.pyi
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from datetime import datetime, timedelta
|
| 2 |
+
from typing import Any as tAny, Dict, Optional, Text, Type
|
| 3 |
+
|
| 4 |
+
class Error(Exception): ...
|
| 5 |
+
class ParseError(Error): ...
|
| 6 |
+
|
| 7 |
+
class Any:
|
| 8 |
+
type_url: tAny = ...
|
| 9 |
+
value: tAny = ...
|
| 10 |
+
def Pack(self, msg: tAny, type_url_prefix: bytes = ..., deterministic: Optional[tAny] = ...) -> None: ...
|
| 11 |
+
def Unpack(self, msg: tAny): ...
|
| 12 |
+
def TypeName(self): ...
|
| 13 |
+
def Is(self, descriptor: tAny): ...
|
| 14 |
+
|
| 15 |
+
class Timestamp:
|
| 16 |
+
def ToJsonString(self) -> str: ...
|
| 17 |
+
seconds: int = ...
|
| 18 |
+
nanos: int = ...
|
| 19 |
+
def FromJsonString(self, value: str) -> None: ...
|
| 20 |
+
def GetCurrentTime(self) -> None: ...
|
| 21 |
+
def ToNanoseconds(self) -> int: ...
|
| 22 |
+
def ToMicroseconds(self) -> int: ...
|
| 23 |
+
def ToMilliseconds(self) -> int: ...
|
| 24 |
+
def ToSeconds(self) -> int: ...
|
| 25 |
+
def FromNanoseconds(self, nanos: int) -> None: ...
|
| 26 |
+
def FromMicroseconds(self, micros: int) -> None: ...
|
| 27 |
+
def FromMilliseconds(self, millis: int) -> None: ...
|
| 28 |
+
def FromSeconds(self, seconds: int) -> None: ...
|
| 29 |
+
def ToDatetime(self) -> datetime: ...
|
| 30 |
+
def FromDatetime(self, dt: datetime) -> None: ...
|
| 31 |
+
|
| 32 |
+
class Duration:
|
| 33 |
+
def ToJsonString(self) -> str: ...
|
| 34 |
+
seconds: int = ...
|
| 35 |
+
nanos: int = ...
|
| 36 |
+
def FromJsonString(self, value: tAny) -> None: ...
|
| 37 |
+
def ToNanoseconds(self) -> int: ...
|
| 38 |
+
def ToMicroseconds(self) -> int: ...
|
| 39 |
+
def ToMilliseconds(self) -> int: ...
|
| 40 |
+
def ToSeconds(self) -> int: ...
|
| 41 |
+
def FromNanoseconds(self, nanos: int) -> None: ...
|
| 42 |
+
def FromMicroseconds(self, micros: int) -> None: ...
|
| 43 |
+
def FromMilliseconds(self, millis: int) -> None: ...
|
| 44 |
+
def FromSeconds(self, seconds: int) -> None: ...
|
| 45 |
+
def ToTimedelta(self) -> timedelta: ...
|
| 46 |
+
def FromTimedelta(self, td: timedelta) -> None: ...
|
| 47 |
+
|
| 48 |
+
class FieldMask:
|
| 49 |
+
def ToJsonString(self) -> str: ...
|
| 50 |
+
def FromJsonString(self, value: tAny) -> None: ...
|
| 51 |
+
def IsValidForDescriptor(self, message_descriptor: tAny): ...
|
| 52 |
+
def AllFieldsFromDescriptor(self, message_descriptor: tAny) -> None: ...
|
| 53 |
+
def CanonicalFormFromMask(self, mask: tAny) -> None: ...
|
| 54 |
+
def Union(self, mask1: tAny, mask2: tAny) -> None: ...
|
| 55 |
+
def Intersect(self, mask1: tAny, mask2: tAny) -> None: ...
|
| 56 |
+
def MergeMessage(
|
| 57 |
+
self, source: tAny, destination: tAny, replace_message_field: bool = ..., replace_repeated_field: bool = ...
|
| 58 |
+
) -> None: ...
|
| 59 |
+
|
| 60 |
+
class _FieldMaskTree:
|
| 61 |
+
def __init__(self, field_mask: Optional[tAny] = ...) -> None: ...
|
| 62 |
+
def MergeFromFieldMask(self, field_mask: tAny) -> None: ...
|
| 63 |
+
def AddPath(self, path: tAny): ...
|
| 64 |
+
def ToFieldMask(self, field_mask: tAny) -> None: ...
|
| 65 |
+
def IntersectPath(self, path: tAny, intersection: tAny): ...
|
| 66 |
+
def AddLeafNodes(self, prefix: tAny, node: tAny) -> None: ...
|
| 67 |
+
def MergeMessage(self, source: tAny, destination: tAny, replace_message: tAny, replace_repeated: tAny) -> None: ...
|
| 68 |
+
|
| 69 |
+
class Struct:
|
| 70 |
+
def __getitem__(self, key: tAny): ...
|
| 71 |
+
def __contains__(self, item: tAny): ...
|
| 72 |
+
def __setitem__(self, key: tAny, value: tAny) -> None: ...
|
| 73 |
+
def __delitem__(self, key: tAny) -> None: ...
|
| 74 |
+
def __len__(self): ...
|
| 75 |
+
def __iter__(self): ...
|
| 76 |
+
def keys(self): ...
|
| 77 |
+
def values(self): ...
|
| 78 |
+
def items(self): ...
|
| 79 |
+
def get_or_create_list(self, key: tAny): ...
|
| 80 |
+
def get_or_create_struct(self, key: tAny): ...
|
| 81 |
+
def update(self, dictionary: tAny) -> None: ...
|
| 82 |
+
|
| 83 |
+
class ListValue:
|
| 84 |
+
def __len__(self): ...
|
| 85 |
+
def append(self, value: tAny) -> None: ...
|
| 86 |
+
def extend(self, elem_seq: tAny) -> None: ...
|
| 87 |
+
def __getitem__(self, index: tAny): ...
|
| 88 |
+
def __setitem__(self, index: tAny, value: tAny) -> None: ...
|
| 89 |
+
def __delitem__(self, key: tAny) -> None: ...
|
| 90 |
+
def items(self) -> None: ...
|
| 91 |
+
def add_struct(self): ...
|
| 92 |
+
def add_list(self): ...
|
| 93 |
+
|
| 94 |
+
WKTBASES: Dict[Text, Type]
|
shared/package-files/0c/0c5c72165a73591652f7374186c8c82397c550e318f5b5c79f7108ac8be638ca/builder_decimal.h
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed to the Apache Software Foundation (ASF) under one
|
| 2 |
+
// or more contributor license agreements. See the NOTICE file
|
| 3 |
+
// distributed with this work for additional information
|
| 4 |
+
// regarding copyright ownership. The ASF licenses this file
|
| 5 |
+
// to you under the Apache License, Version 2.0 (the
|
| 6 |
+
// "License"); you may not use this file except in compliance
|
| 7 |
+
// with the License. You may obtain a copy of the License at
|
| 8 |
+
//
|
| 9 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 10 |
+
//
|
| 11 |
+
// Unless required by applicable law or agreed to in writing,
|
| 12 |
+
// software distributed under the License is distributed on an
|
| 13 |
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
| 14 |
+
// KIND, either express or implied. See the License for the
|
| 15 |
+
// specific language governing permissions and limitations
|
| 16 |
+
// under the License.
|
| 17 |
+
|
| 18 |
+
#pragma once
|
| 19 |
+
|
| 20 |
+
#include <memory>
|
| 21 |
+
|
| 22 |
+
#include "arrow/array/array_decimal.h"
|
| 23 |
+
#include "arrow/array/builder_base.h"
|
| 24 |
+
#include "arrow/array/builder_binary.h"
|
| 25 |
+
#include "arrow/array/data.h"
|
| 26 |
+
#include "arrow/status.h"
|
| 27 |
+
#include "arrow/type.h"
|
| 28 |
+
#include "arrow/util/visibility.h"
|
| 29 |
+
|
| 30 |
+
namespace arrow {
|
| 31 |
+
|
| 32 |
+
/// \addtogroup numeric-builders
|
| 33 |
+
///
|
| 34 |
+
/// @{
|
| 35 |
+
|
| 36 |
+
class ARROW_EXPORT Decimal32Builder : public FixedSizeBinaryBuilder {
|
| 37 |
+
public:
|
| 38 |
+
using TypeClass = Decimal32Type;
|
| 39 |
+
using ValueType = Decimal32;
|
| 40 |
+
|
| 41 |
+
explicit Decimal32Builder(const std::shared_ptr<DataType>& type,
|
| 42 |
+
MemoryPool* pool = default_memory_pool(),
|
| 43 |
+
int64_t alignment = kDefaultBufferAlignment);
|
| 44 |
+
|
| 45 |
+
using FixedSizeBinaryBuilder::Append;
|
| 46 |
+
using FixedSizeBinaryBuilder::AppendValues;
|
| 47 |
+
using FixedSizeBinaryBuilder::Reset;
|
| 48 |
+
|
| 49 |
+
Status Append(Decimal32 val);
|
| 50 |
+
void UnsafeAppend(Decimal32 val);
|
| 51 |
+
void UnsafeAppend(std::string_view val);
|
| 52 |
+
|
| 53 |
+
Status FinishInternal(std::shared_ptr<ArrayData>* out) override;
|
| 54 |
+
|
| 55 |
+
/// \cond FALSE
|
| 56 |
+
using ArrayBuilder::Finish;
|
| 57 |
+
/// \endcond
|
| 58 |
+
|
| 59 |
+
Status Finish(std::shared_ptr<Decimal32Array>* out) { return FinishTyped(out); }
|
| 60 |
+
|
| 61 |
+
std::shared_ptr<DataType> type() const override { return decimal_type_; }
|
| 62 |
+
|
| 63 |
+
protected:
|
| 64 |
+
std::shared_ptr<Decimal32Type> decimal_type_;
|
| 65 |
+
};
|
| 66 |
+
|
| 67 |
+
class ARROW_EXPORT Decimal64Builder : public FixedSizeBinaryBuilder {
|
| 68 |
+
public:
|
| 69 |
+
using TypeClass = Decimal64Type;
|
| 70 |
+
using ValueType = Decimal64;
|
| 71 |
+
|
| 72 |
+
explicit Decimal64Builder(const std::shared_ptr<DataType>& type,
|
| 73 |
+
MemoryPool* pool = default_memory_pool(),
|
| 74 |
+
int64_t alignment = kDefaultBufferAlignment);
|
| 75 |
+
|
| 76 |
+
using FixedSizeBinaryBuilder::Append;
|
| 77 |
+
using FixedSizeBinaryBuilder::AppendValues;
|
| 78 |
+
using FixedSizeBinaryBuilder::Reset;
|
| 79 |
+
|
| 80 |
+
Status Append(Decimal64 val);
|
| 81 |
+
void UnsafeAppend(Decimal64 val);
|
| 82 |
+
void UnsafeAppend(std::string_view val);
|
| 83 |
+
|
| 84 |
+
Status FinishInternal(std::shared_ptr<ArrayData>* out) override;
|
| 85 |
+
|
| 86 |
+
/// \cond FALSE
|
| 87 |
+
using ArrayBuilder::Finish;
|
| 88 |
+
/// \endcond
|
| 89 |
+
|
| 90 |
+
Status Finish(std::shared_ptr<Decimal64Array>* out) { return FinishTyped(out); }
|
| 91 |
+
|
| 92 |
+
std::shared_ptr<DataType> type() const override { return decimal_type_; }
|
| 93 |
+
|
| 94 |
+
protected:
|
| 95 |
+
std::shared_ptr<Decimal64Type> decimal_type_;
|
| 96 |
+
};
|
| 97 |
+
|
| 98 |
+
class ARROW_EXPORT Decimal128Builder : public FixedSizeBinaryBuilder {
|
| 99 |
+
public:
|
| 100 |
+
using TypeClass = Decimal128Type;
|
| 101 |
+
using ValueType = Decimal128;
|
| 102 |
+
|
| 103 |
+
explicit Decimal128Builder(const std::shared_ptr<DataType>& type,
|
| 104 |
+
MemoryPool* pool = default_memory_pool(),
|
| 105 |
+
int64_t alignment = kDefaultBufferAlignment);
|
| 106 |
+
|
| 107 |
+
using FixedSizeBinaryBuilder::Append;
|
| 108 |
+
using FixedSizeBinaryBuilder::AppendValues;
|
| 109 |
+
using FixedSizeBinaryBuilder::Reset;
|
| 110 |
+
|
| 111 |
+
Status Append(Decimal128 val);
|
| 112 |
+
void UnsafeAppend(Decimal128 val);
|
| 113 |
+
void UnsafeAppend(std::string_view val);
|
| 114 |
+
|
| 115 |
+
Status FinishInternal(std::shared_ptr<ArrayData>* out) override;
|
| 116 |
+
|
| 117 |
+
/// \cond FALSE
|
| 118 |
+
using ArrayBuilder::Finish;
|
| 119 |
+
/// \endcond
|
| 120 |
+
|
| 121 |
+
Status Finish(std::shared_ptr<Decimal128Array>* out) { return FinishTyped(out); }
|
| 122 |
+
|
| 123 |
+
std::shared_ptr<DataType> type() const override { return decimal_type_; }
|
| 124 |
+
|
| 125 |
+
protected:
|
| 126 |
+
std::shared_ptr<Decimal128Type> decimal_type_;
|
| 127 |
+
};
|
| 128 |
+
|
| 129 |
+
class ARROW_EXPORT Decimal256Builder : public FixedSizeBinaryBuilder {
|
| 130 |
+
public:
|
| 131 |
+
using TypeClass = Decimal256Type;
|
| 132 |
+
using ValueType = Decimal256;
|
| 133 |
+
|
| 134 |
+
explicit Decimal256Builder(const std::shared_ptr<DataType>& type,
|
| 135 |
+
MemoryPool* pool = default_memory_pool(),
|
| 136 |
+
int64_t alignment = kDefaultBufferAlignment);
|
| 137 |
+
|
| 138 |
+
using FixedSizeBinaryBuilder::Append;
|
| 139 |
+
using FixedSizeBinaryBuilder::AppendValues;
|
| 140 |
+
using FixedSizeBinaryBuilder::Reset;
|
| 141 |
+
|
| 142 |
+
Status Append(const Decimal256& val);
|
| 143 |
+
void UnsafeAppend(const Decimal256& val);
|
| 144 |
+
void UnsafeAppend(std::string_view val);
|
| 145 |
+
|
| 146 |
+
Status FinishInternal(std::shared_ptr<ArrayData>* out) override;
|
| 147 |
+
|
| 148 |
+
/// \cond FALSE
|
| 149 |
+
using ArrayBuilder::Finish;
|
| 150 |
+
/// \endcond
|
| 151 |
+
|
| 152 |
+
Status Finish(std::shared_ptr<Decimal256Array>* out) { return FinishTyped(out); }
|
| 153 |
+
|
| 154 |
+
std::shared_ptr<DataType> type() const override { return decimal_type_; }
|
| 155 |
+
|
| 156 |
+
protected:
|
| 157 |
+
std::shared_ptr<Decimal256Type> decimal_type_;
|
| 158 |
+
};
|
| 159 |
+
|
| 160 |
+
using DecimalBuilder = Decimal128Builder;
|
| 161 |
+
|
| 162 |
+
/// @}
|
| 163 |
+
|
| 164 |
+
} // namespace arrow
|
shared/package-files/0c/0c5c98d884018f7af619992f6d121e64ed84118e3aeb16eec1ce0f4a1025e12c/test_classes.py
ADDED
|
@@ -0,0 +1,600 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Test inter-conversion of different polynomial classes.
|
| 2 |
+
|
| 3 |
+
This tests the convert and cast methods of all the polynomial classes.
|
| 4 |
+
|
| 5 |
+
"""
|
| 6 |
+
import operator as op
|
| 7 |
+
from numbers import Number
|
| 8 |
+
|
| 9 |
+
import pytest
|
| 10 |
+
import numpy as np
|
| 11 |
+
from numpy.polynomial import (
|
| 12 |
+
Polynomial, Legendre, Chebyshev, Laguerre, Hermite, HermiteE)
|
| 13 |
+
from numpy.testing import (
|
| 14 |
+
assert_almost_equal, assert_raises, assert_equal, assert_,
|
| 15 |
+
)
|
| 16 |
+
from numpy.polynomial.polyutils import RankWarning
|
| 17 |
+
|
| 18 |
+
#
|
| 19 |
+
# fixtures
|
| 20 |
+
#
|
| 21 |
+
|
| 22 |
+
classes = (
|
| 23 |
+
Polynomial, Legendre, Chebyshev, Laguerre,
|
| 24 |
+
Hermite, HermiteE
|
| 25 |
+
)
|
| 26 |
+
classids = tuple(cls.__name__ for cls in classes)
|
| 27 |
+
|
| 28 |
+
@pytest.fixture(params=classes, ids=classids)
|
| 29 |
+
def Poly(request):
|
| 30 |
+
return request.param
|
| 31 |
+
|
| 32 |
+
#
|
| 33 |
+
# helper functions
|
| 34 |
+
#
|
| 35 |
+
random = np.random.random
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
def assert_poly_almost_equal(p1, p2, msg=""):
|
| 39 |
+
try:
|
| 40 |
+
assert_(np.all(p1.domain == p2.domain))
|
| 41 |
+
assert_(np.all(p1.window == p2.window))
|
| 42 |
+
assert_almost_equal(p1.coef, p2.coef)
|
| 43 |
+
except AssertionError:
|
| 44 |
+
msg = f"Result: {p1}\nTarget: {p2}"
|
| 45 |
+
raise AssertionError(msg)
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
#
|
| 49 |
+
# Test conversion methods that depend on combinations of two classes.
|
| 50 |
+
#
|
| 51 |
+
|
| 52 |
+
Poly1 = Poly
|
| 53 |
+
Poly2 = Poly
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
def test_conversion(Poly1, Poly2):
|
| 57 |
+
x = np.linspace(0, 1, 10)
|
| 58 |
+
coef = random((3,))
|
| 59 |
+
|
| 60 |
+
d1 = Poly1.domain + random((2,))*.25
|
| 61 |
+
w1 = Poly1.window + random((2,))*.25
|
| 62 |
+
p1 = Poly1(coef, domain=d1, window=w1)
|
| 63 |
+
|
| 64 |
+
d2 = Poly2.domain + random((2,))*.25
|
| 65 |
+
w2 = Poly2.window + random((2,))*.25
|
| 66 |
+
p2 = p1.convert(kind=Poly2, domain=d2, window=w2)
|
| 67 |
+
|
| 68 |
+
assert_almost_equal(p2.domain, d2)
|
| 69 |
+
assert_almost_equal(p2.window, w2)
|
| 70 |
+
assert_almost_equal(p2(x), p1(x))
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
def test_cast(Poly1, Poly2):
|
| 74 |
+
x = np.linspace(0, 1, 10)
|
| 75 |
+
coef = random((3,))
|
| 76 |
+
|
| 77 |
+
d1 = Poly1.domain + random((2,))*.25
|
| 78 |
+
w1 = Poly1.window + random((2,))*.25
|
| 79 |
+
p1 = Poly1(coef, domain=d1, window=w1)
|
| 80 |
+
|
| 81 |
+
d2 = Poly2.domain + random((2,))*.25
|
| 82 |
+
w2 = Poly2.window + random((2,))*.25
|
| 83 |
+
p2 = Poly2.cast(p1, domain=d2, window=w2)
|
| 84 |
+
|
| 85 |
+
assert_almost_equal(p2.domain, d2)
|
| 86 |
+
assert_almost_equal(p2.window, w2)
|
| 87 |
+
assert_almost_equal(p2(x), p1(x))
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
#
|
| 91 |
+
# test methods that depend on one class
|
| 92 |
+
#
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
def test_identity(Poly):
|
| 96 |
+
d = Poly.domain + random((2,))*.25
|
| 97 |
+
w = Poly.window + random((2,))*.25
|
| 98 |
+
x = np.linspace(d[0], d[1], 11)
|
| 99 |
+
p = Poly.identity(domain=d, window=w)
|
| 100 |
+
assert_equal(p.domain, d)
|
| 101 |
+
assert_equal(p.window, w)
|
| 102 |
+
assert_almost_equal(p(x), x)
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
def test_basis(Poly):
|
| 106 |
+
d = Poly.domain + random((2,))*.25
|
| 107 |
+
w = Poly.window + random((2,))*.25
|
| 108 |
+
p = Poly.basis(5, domain=d, window=w)
|
| 109 |
+
assert_equal(p.domain, d)
|
| 110 |
+
assert_equal(p.window, w)
|
| 111 |
+
assert_equal(p.coef, [0]*5 + [1])
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
def test_fromroots(Poly):
|
| 115 |
+
# check that requested roots are zeros of a polynomial
|
| 116 |
+
# of correct degree, domain, and window.
|
| 117 |
+
d = Poly.domain + random((2,))*.25
|
| 118 |
+
w = Poly.window + random((2,))*.25
|
| 119 |
+
r = random((5,))
|
| 120 |
+
p1 = Poly.fromroots(r, domain=d, window=w)
|
| 121 |
+
assert_equal(p1.degree(), len(r))
|
| 122 |
+
assert_equal(p1.domain, d)
|
| 123 |
+
assert_equal(p1.window, w)
|
| 124 |
+
assert_almost_equal(p1(r), 0)
|
| 125 |
+
|
| 126 |
+
# check that polynomial is monic
|
| 127 |
+
pdom = Polynomial.domain
|
| 128 |
+
pwin = Polynomial.window
|
| 129 |
+
p2 = Polynomial.cast(p1, domain=pdom, window=pwin)
|
| 130 |
+
assert_almost_equal(p2.coef[-1], 1)
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
def test_bad_conditioned_fit(Poly):
|
| 134 |
+
|
| 135 |
+
x = [0., 0., 1.]
|
| 136 |
+
y = [1., 2., 3.]
|
| 137 |
+
|
| 138 |
+
# check RankWarning is raised
|
| 139 |
+
with pytest.warns(RankWarning) as record:
|
| 140 |
+
Poly.fit(x, y, 2)
|
| 141 |
+
assert record[0].message.args[0] == "The fit may be poorly conditioned"
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
def test_fit(Poly):
|
| 145 |
+
|
| 146 |
+
def f(x):
|
| 147 |
+
return x*(x - 1)*(x - 2)
|
| 148 |
+
x = np.linspace(0, 3)
|
| 149 |
+
y = f(x)
|
| 150 |
+
|
| 151 |
+
# check default value of domain and window
|
| 152 |
+
p = Poly.fit(x, y, 3)
|
| 153 |
+
assert_almost_equal(p.domain, [0, 3])
|
| 154 |
+
assert_almost_equal(p(x), y)
|
| 155 |
+
assert_equal(p.degree(), 3)
|
| 156 |
+
|
| 157 |
+
# check with given domains and window
|
| 158 |
+
d = Poly.domain + random((2,))*.25
|
| 159 |
+
w = Poly.window + random((2,))*.25
|
| 160 |
+
p = Poly.fit(x, y, 3, domain=d, window=w)
|
| 161 |
+
assert_almost_equal(p(x), y)
|
| 162 |
+
assert_almost_equal(p.domain, d)
|
| 163 |
+
assert_almost_equal(p.window, w)
|
| 164 |
+
p = Poly.fit(x, y, [0, 1, 2, 3], domain=d, window=w)
|
| 165 |
+
assert_almost_equal(p(x), y)
|
| 166 |
+
assert_almost_equal(p.domain, d)
|
| 167 |
+
assert_almost_equal(p.window, w)
|
| 168 |
+
|
| 169 |
+
# check with class domain default
|
| 170 |
+
p = Poly.fit(x, y, 3, [])
|
| 171 |
+
assert_equal(p.domain, Poly.domain)
|
| 172 |
+
assert_equal(p.window, Poly.window)
|
| 173 |
+
p = Poly.fit(x, y, [0, 1, 2, 3], [])
|
| 174 |
+
assert_equal(p.domain, Poly.domain)
|
| 175 |
+
assert_equal(p.window, Poly.window)
|
| 176 |
+
|
| 177 |
+
# check that fit accepts weights.
|
| 178 |
+
w = np.zeros_like(x)
|
| 179 |
+
z = y + random(y.shape)*.25
|
| 180 |
+
w[::2] = 1
|
| 181 |
+
p1 = Poly.fit(x[::2], z[::2], 3)
|
| 182 |
+
p2 = Poly.fit(x, z, 3, w=w)
|
| 183 |
+
p3 = Poly.fit(x, z, [0, 1, 2, 3], w=w)
|
| 184 |
+
assert_almost_equal(p1(x), p2(x))
|
| 185 |
+
assert_almost_equal(p2(x), p3(x))
|
| 186 |
+
|
| 187 |
+
|
| 188 |
+
def test_equal(Poly):
|
| 189 |
+
p1 = Poly([1, 2, 3], domain=[0, 1], window=[2, 3])
|
| 190 |
+
p2 = Poly([1, 1, 1], domain=[0, 1], window=[2, 3])
|
| 191 |
+
p3 = Poly([1, 2, 3], domain=[1, 2], window=[2, 3])
|
| 192 |
+
p4 = Poly([1, 2, 3], domain=[0, 1], window=[1, 2])
|
| 193 |
+
assert_(p1 == p1)
|
| 194 |
+
assert_(not p1 == p2)
|
| 195 |
+
assert_(not p1 == p3)
|
| 196 |
+
assert_(not p1 == p4)
|
| 197 |
+
|
| 198 |
+
|
| 199 |
+
def test_not_equal(Poly):
|
| 200 |
+
p1 = Poly([1, 2, 3], domain=[0, 1], window=[2, 3])
|
| 201 |
+
p2 = Poly([1, 1, 1], domain=[0, 1], window=[2, 3])
|
| 202 |
+
p3 = Poly([1, 2, 3], domain=[1, 2], window=[2, 3])
|
| 203 |
+
p4 = Poly([1, 2, 3], domain=[0, 1], window=[1, 2])
|
| 204 |
+
assert_(not p1 != p1)
|
| 205 |
+
assert_(p1 != p2)
|
| 206 |
+
assert_(p1 != p3)
|
| 207 |
+
assert_(p1 != p4)
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
def test_add(Poly):
|
| 211 |
+
# This checks commutation, not numerical correctness
|
| 212 |
+
c1 = list(random((4,)) + .5)
|
| 213 |
+
c2 = list(random((3,)) + .5)
|
| 214 |
+
p1 = Poly(c1)
|
| 215 |
+
p2 = Poly(c2)
|
| 216 |
+
p3 = p1 + p2
|
| 217 |
+
assert_poly_almost_equal(p2 + p1, p3)
|
| 218 |
+
assert_poly_almost_equal(p1 + c2, p3)
|
| 219 |
+
assert_poly_almost_equal(c2 + p1, p3)
|
| 220 |
+
assert_poly_almost_equal(p1 + tuple(c2), p3)
|
| 221 |
+
assert_poly_almost_equal(tuple(c2) + p1, p3)
|
| 222 |
+
assert_poly_almost_equal(p1 + np.array(c2), p3)
|
| 223 |
+
assert_poly_almost_equal(np.array(c2) + p1, p3)
|
| 224 |
+
assert_raises(TypeError, op.add, p1, Poly([0], domain=Poly.domain + 1))
|
| 225 |
+
assert_raises(TypeError, op.add, p1, Poly([0], window=Poly.window + 1))
|
| 226 |
+
if Poly is Polynomial:
|
| 227 |
+
assert_raises(TypeError, op.add, p1, Chebyshev([0]))
|
| 228 |
+
else:
|
| 229 |
+
assert_raises(TypeError, op.add, p1, Polynomial([0]))
|
| 230 |
+
|
| 231 |
+
|
| 232 |
+
def test_sub(Poly):
|
| 233 |
+
# This checks commutation, not numerical correctness
|
| 234 |
+
c1 = list(random((4,)) + .5)
|
| 235 |
+
c2 = list(random((3,)) + .5)
|
| 236 |
+
p1 = Poly(c1)
|
| 237 |
+
p2 = Poly(c2)
|
| 238 |
+
p3 = p1 - p2
|
| 239 |
+
assert_poly_almost_equal(p2 - p1, -p3)
|
| 240 |
+
assert_poly_almost_equal(p1 - c2, p3)
|
| 241 |
+
assert_poly_almost_equal(c2 - p1, -p3)
|
| 242 |
+
assert_poly_almost_equal(p1 - tuple(c2), p3)
|
| 243 |
+
assert_poly_almost_equal(tuple(c2) - p1, -p3)
|
| 244 |
+
assert_poly_almost_equal(p1 - np.array(c2), p3)
|
| 245 |
+
assert_poly_almost_equal(np.array(c2) - p1, -p3)
|
| 246 |
+
assert_raises(TypeError, op.sub, p1, Poly([0], domain=Poly.domain + 1))
|
| 247 |
+
assert_raises(TypeError, op.sub, p1, Poly([0], window=Poly.window + 1))
|
| 248 |
+
if Poly is Polynomial:
|
| 249 |
+
assert_raises(TypeError, op.sub, p1, Chebyshev([0]))
|
| 250 |
+
else:
|
| 251 |
+
assert_raises(TypeError, op.sub, p1, Polynomial([0]))
|
| 252 |
+
|
| 253 |
+
|
| 254 |
+
def test_mul(Poly):
|
| 255 |
+
c1 = list(random((4,)) + .5)
|
| 256 |
+
c2 = list(random((3,)) + .5)
|
| 257 |
+
p1 = Poly(c1)
|
| 258 |
+
p2 = Poly(c2)
|
| 259 |
+
p3 = p1 * p2
|
| 260 |
+
assert_poly_almost_equal(p2 * p1, p3)
|
| 261 |
+
assert_poly_almost_equal(p1 * c2, p3)
|
| 262 |
+
assert_poly_almost_equal(c2 * p1, p3)
|
| 263 |
+
assert_poly_almost_equal(p1 * tuple(c2), p3)
|
| 264 |
+
assert_poly_almost_equal(tuple(c2) * p1, p3)
|
| 265 |
+
assert_poly_almost_equal(p1 * np.array(c2), p3)
|
| 266 |
+
assert_poly_almost_equal(np.array(c2) * p1, p3)
|
| 267 |
+
assert_poly_almost_equal(p1 * 2, p1 * Poly([2]))
|
| 268 |
+
assert_poly_almost_equal(2 * p1, p1 * Poly([2]))
|
| 269 |
+
assert_raises(TypeError, op.mul, p1, Poly([0], domain=Poly.domain + 1))
|
| 270 |
+
assert_raises(TypeError, op.mul, p1, Poly([0], window=Poly.window + 1))
|
| 271 |
+
if Poly is Polynomial:
|
| 272 |
+
assert_raises(TypeError, op.mul, p1, Chebyshev([0]))
|
| 273 |
+
else:
|
| 274 |
+
assert_raises(TypeError, op.mul, p1, Polynomial([0]))
|
| 275 |
+
|
| 276 |
+
|
| 277 |
+
def test_floordiv(Poly):
|
| 278 |
+
c1 = list(random((4,)) + .5)
|
| 279 |
+
c2 = list(random((3,)) + .5)
|
| 280 |
+
c3 = list(random((2,)) + .5)
|
| 281 |
+
p1 = Poly(c1)
|
| 282 |
+
p2 = Poly(c2)
|
| 283 |
+
p3 = Poly(c3)
|
| 284 |
+
p4 = p1 * p2 + p3
|
| 285 |
+
c4 = list(p4.coef)
|
| 286 |
+
assert_poly_almost_equal(p4 // p2, p1)
|
| 287 |
+
assert_poly_almost_equal(p4 // c2, p1)
|
| 288 |
+
assert_poly_almost_equal(c4 // p2, p1)
|
| 289 |
+
assert_poly_almost_equal(p4 // tuple(c2), p1)
|
| 290 |
+
assert_poly_almost_equal(tuple(c4) // p2, p1)
|
| 291 |
+
assert_poly_almost_equal(p4 // np.array(c2), p1)
|
| 292 |
+
assert_poly_almost_equal(np.array(c4) // p2, p1)
|
| 293 |
+
assert_poly_almost_equal(2 // p2, Poly([0]))
|
| 294 |
+
assert_poly_almost_equal(p2 // 2, 0.5*p2)
|
| 295 |
+
assert_raises(
|
| 296 |
+
TypeError, op.floordiv, p1, Poly([0], domain=Poly.domain + 1))
|
| 297 |
+
assert_raises(
|
| 298 |
+
TypeError, op.floordiv, p1, Poly([0], window=Poly.window + 1))
|
| 299 |
+
if Poly is Polynomial:
|
| 300 |
+
assert_raises(TypeError, op.floordiv, p1, Chebyshev([0]))
|
| 301 |
+
else:
|
| 302 |
+
assert_raises(TypeError, op.floordiv, p1, Polynomial([0]))
|
| 303 |
+
|
| 304 |
+
|
| 305 |
+
def test_truediv(Poly):
|
| 306 |
+
# true division is valid only if the denominator is a Number and
|
| 307 |
+
# not a python bool.
|
| 308 |
+
p1 = Poly([1,2,3])
|
| 309 |
+
p2 = p1 * 5
|
| 310 |
+
|
| 311 |
+
for stype in np.ScalarType:
|
| 312 |
+
if not issubclass(stype, Number) or issubclass(stype, bool):
|
| 313 |
+
continue
|
| 314 |
+
s = stype(5)
|
| 315 |
+
assert_poly_almost_equal(op.truediv(p2, s), p1)
|
| 316 |
+
assert_raises(TypeError, op.truediv, s, p2)
|
| 317 |
+
for stype in (int, float):
|
| 318 |
+
s = stype(5)
|
| 319 |
+
assert_poly_almost_equal(op.truediv(p2, s), p1)
|
| 320 |
+
assert_raises(TypeError, op.truediv, s, p2)
|
| 321 |
+
for stype in [complex]:
|
| 322 |
+
s = stype(5, 0)
|
| 323 |
+
assert_poly_almost_equal(op.truediv(p2, s), p1)
|
| 324 |
+
assert_raises(TypeError, op.truediv, s, p2)
|
| 325 |
+
for s in [tuple(), list(), dict(), bool(), np.array([1])]:
|
| 326 |
+
assert_raises(TypeError, op.truediv, p2, s)
|
| 327 |
+
assert_raises(TypeError, op.truediv, s, p2)
|
| 328 |
+
for ptype in classes:
|
| 329 |
+
assert_raises(TypeError, op.truediv, p2, ptype(1))
|
| 330 |
+
|
| 331 |
+
|
| 332 |
+
def test_mod(Poly):
|
| 333 |
+
# This checks commutation, not numerical correctness
|
| 334 |
+
c1 = list(random((4,)) + .5)
|
| 335 |
+
c2 = list(random((3,)) + .5)
|
| 336 |
+
c3 = list(random((2,)) + .5)
|
| 337 |
+
p1 = Poly(c1)
|
| 338 |
+
p2 = Poly(c2)
|
| 339 |
+
p3 = Poly(c3)
|
| 340 |
+
p4 = p1 * p2 + p3
|
| 341 |
+
c4 = list(p4.coef)
|
| 342 |
+
assert_poly_almost_equal(p4 % p2, p3)
|
| 343 |
+
assert_poly_almost_equal(p4 % c2, p3)
|
| 344 |
+
assert_poly_almost_equal(c4 % p2, p3)
|
| 345 |
+
assert_poly_almost_equal(p4 % tuple(c2), p3)
|
| 346 |
+
assert_poly_almost_equal(tuple(c4) % p2, p3)
|
| 347 |
+
assert_poly_almost_equal(p4 % np.array(c2), p3)
|
| 348 |
+
assert_poly_almost_equal(np.array(c4) % p2, p3)
|
| 349 |
+
assert_poly_almost_equal(2 % p2, Poly([2]))
|
| 350 |
+
assert_poly_almost_equal(p2 % 2, Poly([0]))
|
| 351 |
+
assert_raises(TypeError, op.mod, p1, Poly([0], domain=Poly.domain + 1))
|
| 352 |
+
assert_raises(TypeError, op.mod, p1, Poly([0], window=Poly.window + 1))
|
| 353 |
+
if Poly is Polynomial:
|
| 354 |
+
assert_raises(TypeError, op.mod, p1, Chebyshev([0]))
|
| 355 |
+
else:
|
| 356 |
+
assert_raises(TypeError, op.mod, p1, Polynomial([0]))
|
| 357 |
+
|
| 358 |
+
|
| 359 |
+
def test_divmod(Poly):
|
| 360 |
+
# This checks commutation, not numerical correctness
|
| 361 |
+
c1 = list(random((4,)) + .5)
|
| 362 |
+
c2 = list(random((3,)) + .5)
|
| 363 |
+
c3 = list(random((2,)) + .5)
|
| 364 |
+
p1 = Poly(c1)
|
| 365 |
+
p2 = Poly(c2)
|
| 366 |
+
p3 = Poly(c3)
|
| 367 |
+
p4 = p1 * p2 + p3
|
| 368 |
+
c4 = list(p4.coef)
|
| 369 |
+
quo, rem = divmod(p4, p2)
|
| 370 |
+
assert_poly_almost_equal(quo, p1)
|
| 371 |
+
assert_poly_almost_equal(rem, p3)
|
| 372 |
+
quo, rem = divmod(p4, c2)
|
| 373 |
+
assert_poly_almost_equal(quo, p1)
|
| 374 |
+
assert_poly_almost_equal(rem, p3)
|
| 375 |
+
quo, rem = divmod(c4, p2)
|
| 376 |
+
assert_poly_almost_equal(quo, p1)
|
| 377 |
+
assert_poly_almost_equal(rem, p3)
|
| 378 |
+
quo, rem = divmod(p4, tuple(c2))
|
| 379 |
+
assert_poly_almost_equal(quo, p1)
|
| 380 |
+
assert_poly_almost_equal(rem, p3)
|
| 381 |
+
quo, rem = divmod(tuple(c4), p2)
|
| 382 |
+
assert_poly_almost_equal(quo, p1)
|
| 383 |
+
assert_poly_almost_equal(rem, p3)
|
| 384 |
+
quo, rem = divmod(p4, np.array(c2))
|
| 385 |
+
assert_poly_almost_equal(quo, p1)
|
| 386 |
+
assert_poly_almost_equal(rem, p3)
|
| 387 |
+
quo, rem = divmod(np.array(c4), p2)
|
| 388 |
+
assert_poly_almost_equal(quo, p1)
|
| 389 |
+
assert_poly_almost_equal(rem, p3)
|
| 390 |
+
quo, rem = divmod(p2, 2)
|
| 391 |
+
assert_poly_almost_equal(quo, 0.5*p2)
|
| 392 |
+
assert_poly_almost_equal(rem, Poly([0]))
|
| 393 |
+
quo, rem = divmod(2, p2)
|
| 394 |
+
assert_poly_almost_equal(quo, Poly([0]))
|
| 395 |
+
assert_poly_almost_equal(rem, Poly([2]))
|
| 396 |
+
assert_raises(TypeError, divmod, p1, Poly([0], domain=Poly.domain + 1))
|
| 397 |
+
assert_raises(TypeError, divmod, p1, Poly([0], window=Poly.window + 1))
|
| 398 |
+
if Poly is Polynomial:
|
| 399 |
+
assert_raises(TypeError, divmod, p1, Chebyshev([0]))
|
| 400 |
+
else:
|
| 401 |
+
assert_raises(TypeError, divmod, p1, Polynomial([0]))
|
| 402 |
+
|
| 403 |
+
|
| 404 |
+
def test_roots(Poly):
|
| 405 |
+
d = Poly.domain * 1.25 + .25
|
| 406 |
+
w = Poly.window
|
| 407 |
+
tgt = np.linspace(d[0], d[1], 5)
|
| 408 |
+
res = np.sort(Poly.fromroots(tgt, domain=d, window=w).roots())
|
| 409 |
+
assert_almost_equal(res, tgt)
|
| 410 |
+
# default domain and window
|
| 411 |
+
res = np.sort(Poly.fromroots(tgt).roots())
|
| 412 |
+
assert_almost_equal(res, tgt)
|
| 413 |
+
|
| 414 |
+
|
| 415 |
+
def test_degree(Poly):
|
| 416 |
+
p = Poly.basis(5)
|
| 417 |
+
assert_equal(p.degree(), 5)
|
| 418 |
+
|
| 419 |
+
|
| 420 |
+
def test_copy(Poly):
|
| 421 |
+
p1 = Poly.basis(5)
|
| 422 |
+
p2 = p1.copy()
|
| 423 |
+
assert_(p1 == p2)
|
| 424 |
+
assert_(p1 is not p2)
|
| 425 |
+
assert_(p1.coef is not p2.coef)
|
| 426 |
+
assert_(p1.domain is not p2.domain)
|
| 427 |
+
assert_(p1.window is not p2.window)
|
| 428 |
+
|
| 429 |
+
|
| 430 |
+
def test_integ(Poly):
|
| 431 |
+
P = Polynomial
|
| 432 |
+
# Check defaults
|
| 433 |
+
p0 = Poly.cast(P([1*2, 2*3, 3*4]))
|
| 434 |
+
p1 = P.cast(p0.integ())
|
| 435 |
+
p2 = P.cast(p0.integ(2))
|
| 436 |
+
assert_poly_almost_equal(p1, P([0, 2, 3, 4]))
|
| 437 |
+
assert_poly_almost_equal(p2, P([0, 0, 1, 1, 1]))
|
| 438 |
+
# Check with k
|
| 439 |
+
p0 = Poly.cast(P([1*2, 2*3, 3*4]))
|
| 440 |
+
p1 = P.cast(p0.integ(k=1))
|
| 441 |
+
p2 = P.cast(p0.integ(2, k=[1, 1]))
|
| 442 |
+
assert_poly_almost_equal(p1, P([1, 2, 3, 4]))
|
| 443 |
+
assert_poly_almost_equal(p2, P([1, 1, 1, 1, 1]))
|
| 444 |
+
# Check with lbnd
|
| 445 |
+
p0 = Poly.cast(P([1*2, 2*3, 3*4]))
|
| 446 |
+
p1 = P.cast(p0.integ(lbnd=1))
|
| 447 |
+
p2 = P.cast(p0.integ(2, lbnd=1))
|
| 448 |
+
assert_poly_almost_equal(p1, P([-9, 2, 3, 4]))
|
| 449 |
+
assert_poly_almost_equal(p2, P([6, -9, 1, 1, 1]))
|
| 450 |
+
# Check scaling
|
| 451 |
+
d = 2*Poly.domain
|
| 452 |
+
p0 = Poly.cast(P([1*2, 2*3, 3*4]), domain=d)
|
| 453 |
+
p1 = P.cast(p0.integ())
|
| 454 |
+
p2 = P.cast(p0.integ(2))
|
| 455 |
+
assert_poly_almost_equal(p1, P([0, 2, 3, 4]))
|
| 456 |
+
assert_poly_almost_equal(p2, P([0, 0, 1, 1, 1]))
|
| 457 |
+
|
| 458 |
+
|
| 459 |
+
def test_deriv(Poly):
|
| 460 |
+
# Check that the derivative is the inverse of integration. It is
|
| 461 |
+
# assumes that the integration has been checked elsewhere.
|
| 462 |
+
d = Poly.domain + random((2,))*.25
|
| 463 |
+
w = Poly.window + random((2,))*.25
|
| 464 |
+
p1 = Poly([1, 2, 3], domain=d, window=w)
|
| 465 |
+
p2 = p1.integ(2, k=[1, 2])
|
| 466 |
+
p3 = p1.integ(1, k=[1])
|
| 467 |
+
assert_almost_equal(p2.deriv(1).coef, p3.coef)
|
| 468 |
+
assert_almost_equal(p2.deriv(2).coef, p1.coef)
|
| 469 |
+
# default domain and window
|
| 470 |
+
p1 = Poly([1, 2, 3])
|
| 471 |
+
p2 = p1.integ(2, k=[1, 2])
|
| 472 |
+
p3 = p1.integ(1, k=[1])
|
| 473 |
+
assert_almost_equal(p2.deriv(1).coef, p3.coef)
|
| 474 |
+
assert_almost_equal(p2.deriv(2).coef, p1.coef)
|
| 475 |
+
|
| 476 |
+
|
| 477 |
+
def test_linspace(Poly):
|
| 478 |
+
d = Poly.domain + random((2,))*.25
|
| 479 |
+
w = Poly.window + random((2,))*.25
|
| 480 |
+
p = Poly([1, 2, 3], domain=d, window=w)
|
| 481 |
+
# check default domain
|
| 482 |
+
xtgt = np.linspace(d[0], d[1], 20)
|
| 483 |
+
ytgt = p(xtgt)
|
| 484 |
+
xres, yres = p.linspace(20)
|
| 485 |
+
assert_almost_equal(xres, xtgt)
|
| 486 |
+
assert_almost_equal(yres, ytgt)
|
| 487 |
+
# check specified domain
|
| 488 |
+
xtgt = np.linspace(0, 2, 20)
|
| 489 |
+
ytgt = p(xtgt)
|
| 490 |
+
xres, yres = p.linspace(20, domain=[0, 2])
|
| 491 |
+
assert_almost_equal(xres, xtgt)
|
| 492 |
+
assert_almost_equal(yres, ytgt)
|
| 493 |
+
|
| 494 |
+
|
| 495 |
+
def test_pow(Poly):
|
| 496 |
+
d = Poly.domain + random((2,))*.25
|
| 497 |
+
w = Poly.window + random((2,))*.25
|
| 498 |
+
tgt = Poly([1], domain=d, window=w)
|
| 499 |
+
tst = Poly([1, 2, 3], domain=d, window=w)
|
| 500 |
+
for i in range(5):
|
| 501 |
+
assert_poly_almost_equal(tst**i, tgt)
|
| 502 |
+
tgt = tgt * tst
|
| 503 |
+
# default domain and window
|
| 504 |
+
tgt = Poly([1])
|
| 505 |
+
tst = Poly([1, 2, 3])
|
| 506 |
+
for i in range(5):
|
| 507 |
+
assert_poly_almost_equal(tst**i, tgt)
|
| 508 |
+
tgt = tgt * tst
|
| 509 |
+
# check error for invalid powers
|
| 510 |
+
assert_raises(ValueError, op.pow, tgt, 1.5)
|
| 511 |
+
assert_raises(ValueError, op.pow, tgt, -1)
|
| 512 |
+
|
| 513 |
+
|
| 514 |
+
def test_call(Poly):
|
| 515 |
+
P = Polynomial
|
| 516 |
+
d = Poly.domain
|
| 517 |
+
x = np.linspace(d[0], d[1], 11)
|
| 518 |
+
|
| 519 |
+
# Check defaults
|
| 520 |
+
p = Poly.cast(P([1, 2, 3]))
|
| 521 |
+
tgt = 1 + x*(2 + 3*x)
|
| 522 |
+
res = p(x)
|
| 523 |
+
assert_almost_equal(res, tgt)
|
| 524 |
+
|
| 525 |
+
|
| 526 |
+
def test_cutdeg(Poly):
|
| 527 |
+
p = Poly([1, 2, 3])
|
| 528 |
+
assert_raises(ValueError, p.cutdeg, .5)
|
| 529 |
+
assert_raises(ValueError, p.cutdeg, -1)
|
| 530 |
+
assert_equal(len(p.cutdeg(3)), 3)
|
| 531 |
+
assert_equal(len(p.cutdeg(2)), 3)
|
| 532 |
+
assert_equal(len(p.cutdeg(1)), 2)
|
| 533 |
+
assert_equal(len(p.cutdeg(0)), 1)
|
| 534 |
+
|
| 535 |
+
|
| 536 |
+
def test_truncate(Poly):
|
| 537 |
+
p = Poly([1, 2, 3])
|
| 538 |
+
assert_raises(ValueError, p.truncate, .5)
|
| 539 |
+
assert_raises(ValueError, p.truncate, 0)
|
| 540 |
+
assert_equal(len(p.truncate(4)), 3)
|
| 541 |
+
assert_equal(len(p.truncate(3)), 3)
|
| 542 |
+
assert_equal(len(p.truncate(2)), 2)
|
| 543 |
+
assert_equal(len(p.truncate(1)), 1)
|
| 544 |
+
|
| 545 |
+
|
| 546 |
+
def test_trim(Poly):
|
| 547 |
+
c = [1, 1e-6, 1e-12, 0]
|
| 548 |
+
p = Poly(c)
|
| 549 |
+
assert_equal(p.trim().coef, c[:3])
|
| 550 |
+
assert_equal(p.trim(1e-10).coef, c[:2])
|
| 551 |
+
assert_equal(p.trim(1e-5).coef, c[:1])
|
| 552 |
+
|
| 553 |
+
|
| 554 |
+
def test_mapparms(Poly):
|
| 555 |
+
# check with defaults. Should be identity.
|
| 556 |
+
d = Poly.domain
|
| 557 |
+
w = Poly.window
|
| 558 |
+
p = Poly([1], domain=d, window=w)
|
| 559 |
+
assert_almost_equal([0, 1], p.mapparms())
|
| 560 |
+
#
|
| 561 |
+
w = 2*d + 1
|
| 562 |
+
p = Poly([1], domain=d, window=w)
|
| 563 |
+
assert_almost_equal([1, 2], p.mapparms())
|
| 564 |
+
|
| 565 |
+
|
| 566 |
+
def test_ufunc_override(Poly):
|
| 567 |
+
p = Poly([1, 2, 3])
|
| 568 |
+
x = np.ones(3)
|
| 569 |
+
assert_raises(TypeError, np.add, p, x)
|
| 570 |
+
assert_raises(TypeError, np.add, x, p)
|
| 571 |
+
|
| 572 |
+
|
| 573 |
+
#
|
| 574 |
+
# Test class method that only exists for some classes
|
| 575 |
+
#
|
| 576 |
+
|
| 577 |
+
|
| 578 |
+
class TestInterpolate:
|
| 579 |
+
|
| 580 |
+
def f(self, x):
|
| 581 |
+
return x * (x - 1) * (x - 2)
|
| 582 |
+
|
| 583 |
+
def test_raises(self):
|
| 584 |
+
assert_raises(ValueError, Chebyshev.interpolate, self.f, -1)
|
| 585 |
+
assert_raises(TypeError, Chebyshev.interpolate, self.f, 10.)
|
| 586 |
+
|
| 587 |
+
def test_dimensions(self):
|
| 588 |
+
for deg in range(1, 5):
|
| 589 |
+
assert_(Chebyshev.interpolate(self.f, deg).degree() == deg)
|
| 590 |
+
|
| 591 |
+
def test_approximation(self):
|
| 592 |
+
|
| 593 |
+
def powx(x, p):
|
| 594 |
+
return x**p
|
| 595 |
+
|
| 596 |
+
x = np.linspace(0, 2, 10)
|
| 597 |
+
for deg in range(0, 10):
|
| 598 |
+
for t in range(0, deg + 1):
|
| 599 |
+
p = Chebyshev.interpolate(powx, deg, domain=[0, 2], args=(t,))
|
| 600 |
+
assert_almost_equal(p(x), powx(x, t), decimal=11)
|
shared/package-files/0c/0c5d6ff1c27a7f3c67f28b51143d6b0f55508cab2b554b7fb9ce3ddd1c3188fe/d413-unix-s
ADDED
|
Binary file (1.41 kB). View file
|
|
|
shared/package-files/0c/0c5d6ff1c27a7f3c67f28b51143d6b0f55508cab2b554b7fb9ce3ddd1c3188fe/d463-unix-s
ADDED
|
Binary file (1.41 kB). View file
|
|
|
shared/package-files/0c/0c5e8c0e2db9f345b7a68e92b90e246437a366cd2f089b02a3027ad847e05c85/upsample_linear1d_cuda_dispatch.h
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 3 |
+
|
| 4 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 5 |
+
|
| 6 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 7 |
+
#include <c10/core/MemoryFormat.h>
|
| 8 |
+
#include <c10/core/Scalar.h>
|
| 9 |
+
#include <ATen/core/Reduction.h>
|
| 10 |
+
|
| 11 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 12 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 13 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 14 |
+
#include <ATen/core/ATen_fwd.h>
|
| 15 |
+
|
| 16 |
+
namespace at {
|
| 17 |
+
|
| 18 |
+
namespace cuda {
|
| 19 |
+
|
| 20 |
+
TORCH_API at::Tensor upsample_linear1d(const at::Tensor & self, at::IntArrayRef output_size, bool align_corners, c10::optional<double> scales=c10::nullopt);
|
| 21 |
+
TORCH_API at::Tensor upsample_linear1d_symint(const at::Tensor & self, c10::SymIntArrayRef output_size, bool align_corners, c10::optional<double> scales=c10::nullopt);
|
| 22 |
+
TORCH_API at::Tensor & upsample_linear1d_out(at::Tensor & out, const at::Tensor & self, at::IntArrayRef output_size, bool align_corners, c10::optional<double> scales=c10::nullopt);
|
| 23 |
+
TORCH_API at::Tensor & upsample_linear1d_outf(const at::Tensor & self, at::IntArrayRef output_size, bool align_corners, c10::optional<double> scales, at::Tensor & out);
|
| 24 |
+
TORCH_API at::Tensor & upsample_linear1d_symint_out(at::Tensor & out, const at::Tensor & self, c10::SymIntArrayRef output_size, bool align_corners, c10::optional<double> scales=c10::nullopt);
|
| 25 |
+
TORCH_API at::Tensor & upsample_linear1d_symint_outf(const at::Tensor & self, c10::SymIntArrayRef output_size, bool align_corners, c10::optional<double> scales, at::Tensor & out);
|
| 26 |
+
|
| 27 |
+
} // namespace cuda
|
| 28 |
+
} // namespace at
|
shared/package-files/0c/0c5f2c66f5f8df9c0b965029eaebe9513826b36e477df135720292741281ab22/max_pool1d_compositeimplicitautograd_dispatch.h
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#pragma once
|
| 2 |
+
// @generated by torchgen/gen.py from DispatchKeyFunction.h
|
| 3 |
+
|
| 4 |
+
// NB: The implementing C++ file is RegisterDispatchKey.cpp
|
| 5 |
+
|
| 6 |
+
// The only #includes we need are for custom classes that have defaults in the C++ API
|
| 7 |
+
#include <c10/core/MemoryFormat.h>
|
| 8 |
+
#include <c10/core/Scalar.h>
|
| 9 |
+
#include <ATen/core/Reduction.h>
|
| 10 |
+
|
| 11 |
+
// Forward declarations of any types needed in the operator signatures.
|
| 12 |
+
// We can't directly include these classes because it will cause circular include dependencies.
|
| 13 |
+
// This file is included by TensorBody.h, which defines the Tensor class.
|
| 14 |
+
#include <ATen/core/ATen_fwd.h>
|
| 15 |
+
|
| 16 |
+
namespace at {
|
| 17 |
+
|
| 18 |
+
namespace compositeimplicitautograd {
|
| 19 |
+
|
| 20 |
+
TORCH_API at::Tensor max_pool1d(const at::Tensor & self, at::IntArrayRef kernel_size, at::IntArrayRef stride={}, at::IntArrayRef padding=0, at::IntArrayRef dilation=1, bool ceil_mode=false);
|
| 21 |
+
|
| 22 |
+
} // namespace compositeimplicitautograd
|
| 23 |
+
} // namespace at
|
shared/package-files/0c/0c62da0125fd540f733823d1962e19ed355de7b928015a0605e2d67aec185073/multicomp.py
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
|
| 3 |
+
Created on Fri Mar 30 18:27:25 2012
|
| 4 |
+
Author: Josef Perktold
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
from statsmodels.sandbox.stats.multicomp import MultiComparison, tukeyhsd
|
| 8 |
+
|
| 9 |
+
__all__ = ["MultiComparison", "tukeyhsd"]
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def pairwise_tukeyhsd(endog, groups, alpha=0.05, use_var="equal"):
|
| 13 |
+
"""
|
| 14 |
+
Calculate all pairwise comparisons with TukeyHSD or Games-Howell
|
| 15 |
+
|
| 16 |
+
Parameters
|
| 17 |
+
----------
|
| 18 |
+
endog : array_like, 1d
|
| 19 |
+
response variable
|
| 20 |
+
groups : array_like, 1d
|
| 21 |
+
array with groups, can be string or integers
|
| 22 |
+
alpha : float, optional
|
| 23 |
+
significance level for the test
|
| 24 |
+
use_var : {"unequal", "equal"}, optional
|
| 25 |
+
If ``use_var`` is "equal", then the Tukey-hsd pvalues are returned.
|
| 26 |
+
Tukey-hsd assumes that (within) variances are the same across groups.
|
| 27 |
+
If ``use_var`` is "unequal", then the Games-Howell pvalues are
|
| 28 |
+
returned. This uses Welch's t-test for unequal variances with
|
| 29 |
+
Satterthwaite's corrected degrees of freedom for each pairwise
|
| 30 |
+
comparison.
|
| 31 |
+
|
| 32 |
+
Returns
|
| 33 |
+
-------
|
| 34 |
+
results : TukeyHSDResults instance
|
| 35 |
+
A results class containing relevant data and some post-hoc
|
| 36 |
+
calculations, including adjusted p-value.
|
| 37 |
+
|
| 38 |
+
See Also
|
| 39 |
+
--------
|
| 40 |
+
MultiComparison
|
| 41 |
+
Class for pairwise comparisons of multiple groups.
|
| 42 |
+
tukeyhsd
|
| 43 |
+
Compute simultaneous Tukey HSD comparisons from summary data.
|
| 44 |
+
statsmodels.sandbox.stats.multicomp.TukeyHSDResults
|
| 45 |
+
Results from a Tukey HSD comparison.
|
| 46 |
+
|
| 47 |
+
Notes
|
| 48 |
+
-----
|
| 49 |
+
The results include the following attributes and methods:
|
| 50 |
+
|
| 51 |
+
* ``reject`` is a boolean array indicating whether each comparison is
|
| 52 |
+
statistically significant.
|
| 53 |
+
* ``pvalues`` contains the adjusted p-values for each comparison.
|
| 54 |
+
* ``summary()`` returns a printable table that includes the reject column.
|
| 55 |
+
* ``summary_frame()`` returns a DataFrame with the comparison results.
|
| 56 |
+
|
| 57 |
+
This is just a wrapper around tukeyhsd method of MultiComparison.
|
| 58 |
+
Tukey-hsd is not robust to heteroscedasticity, i.e., variance differ across
|
| 59 |
+
groups, especially if group sizes also vary. In those cases, the actual
|
| 60 |
+
size (rejection rate under the Null hypothesis) might be far from the
|
| 61 |
+
nominal size of the test.
|
| 62 |
+
The Games-Howell method uses pairwise t-tests that are robust to differences
|
| 63 |
+
in variances and approximately maintains size unless samples are very
|
| 64 |
+
small.
|
| 65 |
+
|
| 66 |
+
.. versionadded:: 0.15
|
| 67 |
+
|
| 68 |
+
The `use_var` keyword and option for Games-Howell test.
|
| 69 |
+
|
| 70 |
+
Examples
|
| 71 |
+
--------
|
| 72 |
+
The reject decisions and adjusted p-values can be accessed directly from
|
| 73 |
+
the results instance.
|
| 74 |
+
|
| 75 |
+
>>> import numpy as np
|
| 76 |
+
>>> endog = np.array([1, 2, 3, 4, 5, 6])
|
| 77 |
+
>>> groups = np.array(["a", "a", "b", "b", "c", "c"])
|
| 78 |
+
>>> res = pairwise_tukeyhsd(endog, groups)
|
| 79 |
+
>>> res.reject
|
| 80 |
+
array([False, True, False])
|
| 81 |
+
>>> res.pvalues.round(3)
|
| 82 |
+
array([0.129, 0.022, 0.129])
|
| 83 |
+
|
| 84 |
+
"""
|
| 85 |
+
|
| 86 |
+
return MultiComparison(endog, groups).tukeyhsd(alpha=alpha,
|
| 87 |
+
use_var=use_var)
|
shared/package-files/0c/0c6571e2379b940a9b69816133705f3d25b947ec0496d69fe8abbad37883f11c/libdeflate-targets.cmake
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Generated by CMake
|
| 2 |
+
|
| 3 |
+
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8)
|
| 4 |
+
message(FATAL_ERROR "CMake >= 2.8.0 required")
|
| 5 |
+
endif()
|
| 6 |
+
if(CMAKE_VERSION VERSION_LESS "2.8.3")
|
| 7 |
+
message(FATAL_ERROR "CMake >= 2.8.3 required")
|
| 8 |
+
endif()
|
| 9 |
+
cmake_policy(PUSH)
|
| 10 |
+
cmake_policy(VERSION 2.8.3...3.24)
|
| 11 |
+
#----------------------------------------------------------------
|
| 12 |
+
# Generated CMake target import file.
|
| 13 |
+
#----------------------------------------------------------------
|
| 14 |
+
|
| 15 |
+
# Commands may need to know the format version.
|
| 16 |
+
set(CMAKE_IMPORT_FILE_VERSION 1)
|
| 17 |
+
|
| 18 |
+
# Protect against multiple inclusion, which would fail when already imported targets are added once more.
|
| 19 |
+
set(_cmake_targets_defined "")
|
| 20 |
+
set(_cmake_targets_not_defined "")
|
| 21 |
+
set(_cmake_expected_targets "")
|
| 22 |
+
foreach(_cmake_expected_target IN ITEMS libdeflate::libdeflate_shared)
|
| 23 |
+
list(APPEND _cmake_expected_targets "${_cmake_expected_target}")
|
| 24 |
+
if(TARGET "${_cmake_expected_target}")
|
| 25 |
+
list(APPEND _cmake_targets_defined "${_cmake_expected_target}")
|
| 26 |
+
else()
|
| 27 |
+
list(APPEND _cmake_targets_not_defined "${_cmake_expected_target}")
|
| 28 |
+
endif()
|
| 29 |
+
endforeach()
|
| 30 |
+
unset(_cmake_expected_target)
|
| 31 |
+
if(_cmake_targets_defined STREQUAL _cmake_expected_targets)
|
| 32 |
+
unset(_cmake_targets_defined)
|
| 33 |
+
unset(_cmake_targets_not_defined)
|
| 34 |
+
unset(_cmake_expected_targets)
|
| 35 |
+
unset(CMAKE_IMPORT_FILE_VERSION)
|
| 36 |
+
cmake_policy(POP)
|
| 37 |
+
return()
|
| 38 |
+
endif()
|
| 39 |
+
if(NOT _cmake_targets_defined STREQUAL "")
|
| 40 |
+
string(REPLACE ";" ", " _cmake_targets_defined_text "${_cmake_targets_defined}")
|
| 41 |
+
string(REPLACE ";" ", " _cmake_targets_not_defined_text "${_cmake_targets_not_defined}")
|
| 42 |
+
message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_cmake_targets_defined_text}\nTargets not yet defined: ${_cmake_targets_not_defined_text}\n")
|
| 43 |
+
endif()
|
| 44 |
+
unset(_cmake_targets_defined)
|
| 45 |
+
unset(_cmake_targets_not_defined)
|
| 46 |
+
unset(_cmake_expected_targets)
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
# Compute the installation prefix relative to this file.
|
| 50 |
+
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
| 51 |
+
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
| 52 |
+
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
| 53 |
+
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
| 54 |
+
if(_IMPORT_PREFIX STREQUAL "/")
|
| 55 |
+
set(_IMPORT_PREFIX "")
|
| 56 |
+
endif()
|
| 57 |
+
|
| 58 |
+
# Create imported target libdeflate::libdeflate_shared
|
| 59 |
+
add_library(libdeflate::libdeflate_shared SHARED IMPORTED)
|
| 60 |
+
|
| 61 |
+
set_target_properties(libdeflate::libdeflate_shared PROPERTIES
|
| 62 |
+
INTERFACE_COMPILE_DEFINITIONS "LIBDEFLATE_DLL"
|
| 63 |
+
INTERFACE_INCLUDE_DIRECTORIES "/opt/conda/include"
|
| 64 |
+
)
|
| 65 |
+
|
| 66 |
+
# Load information for each installed configuration.
|
| 67 |
+
file(GLOB _cmake_config_files "${CMAKE_CURRENT_LIST_DIR}/libdeflate-targets-*.cmake")
|
| 68 |
+
foreach(_cmake_config_file IN LISTS _cmake_config_files)
|
| 69 |
+
include("${_cmake_config_file}")
|
| 70 |
+
endforeach()
|
| 71 |
+
unset(_cmake_config_file)
|
| 72 |
+
unset(_cmake_config_files)
|
| 73 |
+
|
| 74 |
+
# Cleanup temporary variables.
|
| 75 |
+
set(_IMPORT_PREFIX)
|
| 76 |
+
|
| 77 |
+
# Loop over all imported files and verify that they actually exist
|
| 78 |
+
foreach(_cmake_target IN LISTS _cmake_import_check_targets)
|
| 79 |
+
foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}")
|
| 80 |
+
if(NOT EXISTS "${_cmake_file}")
|
| 81 |
+
message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file
|
| 82 |
+
\"${_cmake_file}\"
|
| 83 |
+
but this file does not exist. Possible reasons include:
|
| 84 |
+
* The file was deleted, renamed, or moved to another location.
|
| 85 |
+
* An install or uninstall procedure did not complete successfully.
|
| 86 |
+
* The installation package was faulty and contained
|
| 87 |
+
\"${CMAKE_CURRENT_LIST_FILE}\"
|
| 88 |
+
but not all the files it references.
|
| 89 |
+
")
|
| 90 |
+
endif()
|
| 91 |
+
endforeach()
|
| 92 |
+
unset(_cmake_file)
|
| 93 |
+
unset("_cmake_import_check_files_for_${_cmake_target}")
|
| 94 |
+
endforeach()
|
| 95 |
+
unset(_cmake_target)
|
| 96 |
+
unset(_cmake_import_check_targets)
|
| 97 |
+
|
| 98 |
+
# This file does not depend on other imported targets which have
|
| 99 |
+
# been exported from the same project but in a separate export set.
|
| 100 |
+
|
| 101 |
+
# Commands beyond this point should not need to know the version.
|
| 102 |
+
set(CMAKE_IMPORT_FILE_VERSION)
|
| 103 |
+
cmake_policy(POP)
|
shared/package-files/0c/0c66cae5e8d23befe26d90e878ce51943358edaf19f1e192727ab7713850d49b/test_arrayfuncs.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import numpy as np
|
| 2 |
+
import pytest
|
| 3 |
+
|
| 4 |
+
from sklearn.utils._testing import assert_allclose
|
| 5 |
+
from sklearn.utils.arrayfuncs import _all_with_any_reduction_axis_1, min_pos
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
def test_min_pos():
|
| 9 |
+
# Check that min_pos returns a positive value and that it's consistent
|
| 10 |
+
# between float and double
|
| 11 |
+
X = np.random.RandomState(0).randn(100)
|
| 12 |
+
|
| 13 |
+
min_double = min_pos(X)
|
| 14 |
+
min_float = min_pos(X.astype(np.float32))
|
| 15 |
+
|
| 16 |
+
assert_allclose(min_double, min_float)
|
| 17 |
+
assert min_double >= 0
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
@pytest.mark.parametrize("dtype", [np.float32, np.float64])
|
| 21 |
+
def test_min_pos_no_positive(dtype):
|
| 22 |
+
# Check that the return value of min_pos is the maximum representable
|
| 23 |
+
# value of the input dtype when all input elements are <= 0 (#19328)
|
| 24 |
+
X = np.full(100, -1.0).astype(dtype, copy=False)
|
| 25 |
+
|
| 26 |
+
assert min_pos(X) == np.finfo(dtype).max
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
@pytest.mark.parametrize(
|
| 30 |
+
"dtype", [np.int16, np.int32, np.int64, np.float32, np.float64]
|
| 31 |
+
)
|
| 32 |
+
@pytest.mark.parametrize("value", [0, 1.5, -1])
|
| 33 |
+
def test_all_with_any_reduction_axis_1(dtype, value):
|
| 34 |
+
# Check that return value is False when there is no row equal to `value`
|
| 35 |
+
X = np.arange(12, dtype=dtype).reshape(3, 4)
|
| 36 |
+
assert not _all_with_any_reduction_axis_1(X, value=value)
|
| 37 |
+
|
| 38 |
+
# Make a row equal to `value`
|
| 39 |
+
X[1, :] = value
|
| 40 |
+
assert _all_with_any_reduction_axis_1(X, value=value)
|
shared/package-files/0c/0c698b1a4e136e1906841889be76de352719ccb7679beea72685adf3786bcfeb/ivp.py
ADDED
|
@@ -0,0 +1,755 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import inspect
|
| 2 |
+
import numpy as np
|
| 3 |
+
from .bdf import BDF
|
| 4 |
+
from .radau import Radau
|
| 5 |
+
from .rk import RK23, RK45, DOP853
|
| 6 |
+
from .lsoda import LSODA
|
| 7 |
+
from scipy.optimize import OptimizeResult
|
| 8 |
+
from .common import EPS, OdeSolution
|
| 9 |
+
from .base import OdeSolver
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
METHODS = {'RK23': RK23,
|
| 13 |
+
'RK45': RK45,
|
| 14 |
+
'DOP853': DOP853,
|
| 15 |
+
'Radau': Radau,
|
| 16 |
+
'BDF': BDF,
|
| 17 |
+
'LSODA': LSODA}
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
MESSAGES = {0: "The solver successfully reached the end of the integration interval.",
|
| 21 |
+
1: "A termination event occurred."}
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class OdeResult(OptimizeResult):
|
| 25 |
+
pass
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def prepare_events(events):
|
| 29 |
+
"""Standardize event functions and extract attributes."""
|
| 30 |
+
if callable(events):
|
| 31 |
+
events = (events,)
|
| 32 |
+
|
| 33 |
+
max_events = np.empty(len(events))
|
| 34 |
+
direction = np.empty(len(events))
|
| 35 |
+
for i, event in enumerate(events):
|
| 36 |
+
terminal = getattr(event, 'terminal', None)
|
| 37 |
+
direction[i] = getattr(event, 'direction', 0)
|
| 38 |
+
|
| 39 |
+
message = ('The `terminal` attribute of each event '
|
| 40 |
+
'must be a boolean or positive integer.')
|
| 41 |
+
if terminal is None or terminal == 0:
|
| 42 |
+
max_events[i] = np.inf
|
| 43 |
+
elif int(terminal) == terminal and terminal > 0:
|
| 44 |
+
max_events[i] = terminal
|
| 45 |
+
else:
|
| 46 |
+
raise ValueError(message)
|
| 47 |
+
|
| 48 |
+
return events, max_events, direction
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def solve_event_equation(event, sol, t_old, t):
|
| 52 |
+
"""Solve an equation corresponding to an ODE event.
|
| 53 |
+
|
| 54 |
+
The equation is ``event(t, y(t)) = 0``, here ``y(t)`` is known from an
|
| 55 |
+
ODE solver using some sort of interpolation. It is solved by
|
| 56 |
+
`scipy.optimize.brentq` with xtol=atol=4*EPS.
|
| 57 |
+
|
| 58 |
+
Parameters
|
| 59 |
+
----------
|
| 60 |
+
event : callable
|
| 61 |
+
Function ``event(t, y)``.
|
| 62 |
+
sol : callable
|
| 63 |
+
Function ``sol(t)`` which evaluates an ODE solution between `t_old`
|
| 64 |
+
and `t`.
|
| 65 |
+
t_old, t : float
|
| 66 |
+
Previous and new values of time. They will be used as a bracketing
|
| 67 |
+
interval.
|
| 68 |
+
|
| 69 |
+
Returns
|
| 70 |
+
-------
|
| 71 |
+
root : float
|
| 72 |
+
Found solution.
|
| 73 |
+
"""
|
| 74 |
+
from scipy.optimize import brentq
|
| 75 |
+
return brentq(lambda t: event(t, sol(t)), t_old, t,
|
| 76 |
+
xtol=4 * EPS, rtol=4 * EPS)
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
def handle_events(sol, events, active_events, event_count, max_events,
|
| 80 |
+
t_old, t):
|
| 81 |
+
"""Helper function to handle events.
|
| 82 |
+
|
| 83 |
+
Parameters
|
| 84 |
+
----------
|
| 85 |
+
sol : DenseOutput
|
| 86 |
+
Function ``sol(t)`` which evaluates an ODE solution between `t_old`
|
| 87 |
+
and `t`.
|
| 88 |
+
events : list of callables, length n_events
|
| 89 |
+
Event functions with signatures ``event(t, y)``.
|
| 90 |
+
active_events : ndarray
|
| 91 |
+
Indices of events which occurred.
|
| 92 |
+
event_count : ndarray
|
| 93 |
+
Current number of occurrences for each event.
|
| 94 |
+
max_events : ndarray, shape (n_events,)
|
| 95 |
+
Number of occurrences allowed for each event before integration
|
| 96 |
+
termination is issued.
|
| 97 |
+
t_old, t : float
|
| 98 |
+
Previous and new values of time.
|
| 99 |
+
|
| 100 |
+
Returns
|
| 101 |
+
-------
|
| 102 |
+
root_indices : ndarray
|
| 103 |
+
Indices of events which take zero between `t_old` and `t` and before
|
| 104 |
+
a possible termination.
|
| 105 |
+
roots : ndarray
|
| 106 |
+
Values of t at which events occurred.
|
| 107 |
+
terminate : bool
|
| 108 |
+
Whether a terminal event occurred.
|
| 109 |
+
"""
|
| 110 |
+
roots = [solve_event_equation(events[event_index], sol, t_old, t)
|
| 111 |
+
for event_index in active_events]
|
| 112 |
+
|
| 113 |
+
roots = np.asarray(roots)
|
| 114 |
+
|
| 115 |
+
if np.any(event_count[active_events] >= max_events[active_events]):
|
| 116 |
+
if t > t_old:
|
| 117 |
+
order = np.argsort(roots)
|
| 118 |
+
else:
|
| 119 |
+
order = np.argsort(-roots)
|
| 120 |
+
active_events = active_events[order]
|
| 121 |
+
roots = roots[order]
|
| 122 |
+
t = np.nonzero(event_count[active_events]
|
| 123 |
+
>= max_events[active_events])[0][0]
|
| 124 |
+
active_events = active_events[:t + 1]
|
| 125 |
+
roots = roots[:t + 1]
|
| 126 |
+
terminate = True
|
| 127 |
+
else:
|
| 128 |
+
terminate = False
|
| 129 |
+
|
| 130 |
+
return active_events, roots, terminate
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
def find_active_events(g, g_new, direction):
|
| 134 |
+
"""Find which event occurred during an integration step.
|
| 135 |
+
|
| 136 |
+
Parameters
|
| 137 |
+
----------
|
| 138 |
+
g, g_new : array_like, shape (n_events,)
|
| 139 |
+
Values of event functions at a current and next points.
|
| 140 |
+
direction : ndarray, shape (n_events,)
|
| 141 |
+
Event "direction" according to the definition in `solve_ivp`.
|
| 142 |
+
|
| 143 |
+
Returns
|
| 144 |
+
-------
|
| 145 |
+
active_events : ndarray
|
| 146 |
+
Indices of events which occurred during the step.
|
| 147 |
+
"""
|
| 148 |
+
g, g_new = np.asarray(g), np.asarray(g_new)
|
| 149 |
+
up = (g <= 0) & (g_new >= 0)
|
| 150 |
+
down = (g >= 0) & (g_new <= 0)
|
| 151 |
+
either = up | down
|
| 152 |
+
mask = (up & (direction > 0) |
|
| 153 |
+
down & (direction < 0) |
|
| 154 |
+
either & (direction == 0))
|
| 155 |
+
|
| 156 |
+
return np.nonzero(mask)[0]
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
def solve_ivp(fun, t_span, y0, method='RK45', t_eval=None, dense_output=False,
|
| 160 |
+
events=None, vectorized=False, args=None, **options):
|
| 161 |
+
"""Solve an initial value problem for a system of ODEs.
|
| 162 |
+
|
| 163 |
+
This function numerically integrates a system of ordinary differential
|
| 164 |
+
equations given an initial value::
|
| 165 |
+
|
| 166 |
+
dy / dt = f(t, y)
|
| 167 |
+
y(t0) = y0
|
| 168 |
+
|
| 169 |
+
Here t is a 1-D independent variable (time), y(t) is an
|
| 170 |
+
N-D vector-valued function (state), and an N-D
|
| 171 |
+
vector-valued function f(t, y) determines the differential equations.
|
| 172 |
+
The goal is to find y(t) approximately satisfying the differential
|
| 173 |
+
equations, given an initial value y(t0)=y0.
|
| 174 |
+
|
| 175 |
+
Some of the solvers support integration in the complex domain, but note
|
| 176 |
+
that for stiff ODE solvers, the right-hand side must be
|
| 177 |
+
complex-differentiable (satisfy Cauchy-Riemann equations [11]_).
|
| 178 |
+
To solve a problem in the complex domain, pass y0 with a complex data type.
|
| 179 |
+
Another option always available is to rewrite your problem for real and
|
| 180 |
+
imaginary parts separately.
|
| 181 |
+
|
| 182 |
+
Parameters
|
| 183 |
+
----------
|
| 184 |
+
fun : callable
|
| 185 |
+
Right-hand side of the system: the time derivative of the state ``y``
|
| 186 |
+
at time ``t``. The calling signature is ``fun(t, y)``, where ``t`` is a
|
| 187 |
+
scalar and ``y`` is an ndarray with ``len(y) = len(y0)``. Additional
|
| 188 |
+
arguments need to be passed if ``args`` is used (see documentation of
|
| 189 |
+
``args`` argument). ``fun`` must return an array of the same shape as
|
| 190 |
+
``y``. See `vectorized` for more information.
|
| 191 |
+
t_span : 2-member sequence
|
| 192 |
+
Interval of integration (t0, tf). The solver starts with t=t0 and
|
| 193 |
+
integrates until it reaches t=tf. Both t0 and tf must be floats
|
| 194 |
+
or values interpretable by the float conversion function.
|
| 195 |
+
y0 : array_like, shape (n,)
|
| 196 |
+
Initial state. For problems in the complex domain, pass `y0` with a
|
| 197 |
+
complex data type (even if the initial value is purely real).
|
| 198 |
+
method : string or `OdeSolver`, optional
|
| 199 |
+
Integration method to use:
|
| 200 |
+
|
| 201 |
+
* 'RK45' (default): Explicit Runge-Kutta method of order 5(4) [1]_.
|
| 202 |
+
The error is controlled assuming accuracy of the fourth-order
|
| 203 |
+
method, but steps are taken using the fifth-order accurate
|
| 204 |
+
formula (local extrapolation is done). A quartic interpolation
|
| 205 |
+
polynomial is used for the dense output [2]_. Can be applied in
|
| 206 |
+
the complex domain.
|
| 207 |
+
* 'RK23': Explicit Runge-Kutta method of order 3(2) [3]_. The error
|
| 208 |
+
is controlled assuming accuracy of the second-order method, but
|
| 209 |
+
steps are taken using the third-order accurate formula (local
|
| 210 |
+
extrapolation is done). A cubic Hermite polynomial is used for the
|
| 211 |
+
dense output. Can be applied in the complex domain.
|
| 212 |
+
* 'DOP853': Explicit Runge-Kutta method of order 8 [13]_.
|
| 213 |
+
Python implementation of the "DOP853" algorithm originally
|
| 214 |
+
written in Fortran [14]_. A 7-th order interpolation polynomial
|
| 215 |
+
accurate to 7-th order is used for the dense output.
|
| 216 |
+
Can be applied in the complex domain.
|
| 217 |
+
* 'Radau': Implicit Runge-Kutta method of the Radau IIA family of
|
| 218 |
+
order 5 [4]_. The error is controlled with a third-order accurate
|
| 219 |
+
embedded formula. A cubic polynomial which satisfies the
|
| 220 |
+
collocation conditions is used for the dense output.
|
| 221 |
+
* 'BDF': Implicit multi-step variable-order (1 to 5) method based
|
| 222 |
+
on a backward differentiation formula for the derivative
|
| 223 |
+
approximation [5]_. The implementation follows the one described
|
| 224 |
+
in [6]_. A quasi-constant step scheme is used and accuracy is
|
| 225 |
+
enhanced using the NDF modification. Can be applied in the
|
| 226 |
+
complex domain.
|
| 227 |
+
* 'LSODA': Adams/BDF method with automatic stiffness detection and
|
| 228 |
+
switching [7]_, [8]_. This is a wrapper of the Fortran solver
|
| 229 |
+
from ODEPACK.
|
| 230 |
+
|
| 231 |
+
Explicit Runge-Kutta methods ('RK23', 'RK45', 'DOP853') should be used
|
| 232 |
+
for non-stiff problems and implicit methods ('Radau', 'BDF') for
|
| 233 |
+
stiff problems [9]_. Among Runge-Kutta methods, 'DOP853' is recommended
|
| 234 |
+
for solving with high precision (low values of `rtol` and `atol`).
|
| 235 |
+
|
| 236 |
+
If not sure, first try to run 'RK45'. If it makes unusually many
|
| 237 |
+
iterations, diverges, or fails, your problem is likely to be stiff and
|
| 238 |
+
you should use 'Radau' or 'BDF'. 'LSODA' can also be a good universal
|
| 239 |
+
choice, but it might be somewhat less convenient to work with as it
|
| 240 |
+
wraps old Fortran code.
|
| 241 |
+
|
| 242 |
+
You can also pass an arbitrary class derived from `OdeSolver` which
|
| 243 |
+
implements the solver.
|
| 244 |
+
t_eval : array_like or None, optional
|
| 245 |
+
Times at which to store the computed solution, must be sorted and lie
|
| 246 |
+
within `t_span`. If None (default), use points selected by the solver.
|
| 247 |
+
dense_output : bool, optional
|
| 248 |
+
Whether to compute a continuous solution. Default is False.
|
| 249 |
+
events : callable, or list of callables, optional
|
| 250 |
+
Events to track. If None (default), no events will be tracked.
|
| 251 |
+
Each event occurs at the zeros of a continuous function of time and
|
| 252 |
+
state. Each function must have the signature ``event(t, y)`` where
|
| 253 |
+
additional argument have to be passed if ``args`` is used (see
|
| 254 |
+
documentation of ``args`` argument). Each function must return a
|
| 255 |
+
float. The solver will find an accurate value of `t` at which
|
| 256 |
+
``event(t, y(t)) = 0`` using a root-finding algorithm. By default,
|
| 257 |
+
all zeros will be found. The solver looks for a sign change over
|
| 258 |
+
each step, so if multiple zero crossings occur within one step,
|
| 259 |
+
events may be missed. Additionally each `event` function might
|
| 260 |
+
have the following attributes:
|
| 261 |
+
|
| 262 |
+
terminal: bool or int, optional
|
| 263 |
+
When boolean, whether to terminate integration if this event occurs.
|
| 264 |
+
When integral, termination occurs after the specified the number of
|
| 265 |
+
occurrences of this event.
|
| 266 |
+
Implicitly False if not assigned.
|
| 267 |
+
direction: float, optional
|
| 268 |
+
Direction of a zero crossing. If `direction` is positive,
|
| 269 |
+
`event` will only trigger when going from negative to positive,
|
| 270 |
+
and vice versa if `direction` is negative. If 0, then either
|
| 271 |
+
direction will trigger event. Implicitly 0 if not assigned.
|
| 272 |
+
|
| 273 |
+
You can assign attributes like ``event.terminal = True`` to any
|
| 274 |
+
function in Python.
|
| 275 |
+
vectorized : bool, optional
|
| 276 |
+
Whether `fun` can be called in a vectorized fashion. Default is False.
|
| 277 |
+
|
| 278 |
+
If ``vectorized`` is False, `fun` will always be called with ``y`` of
|
| 279 |
+
shape ``(n,)``, where ``n = len(y0)``.
|
| 280 |
+
|
| 281 |
+
If ``vectorized`` is True, `fun` may be called with ``y`` of shape
|
| 282 |
+
``(n, k)``, where ``k`` is an integer. In this case, `fun` must behave
|
| 283 |
+
such that ``fun(t, y)[:, i] == fun(t, y[:, i])`` (i.e. each column of
|
| 284 |
+
the returned array is the time derivative of the state corresponding
|
| 285 |
+
with a column of ``y``).
|
| 286 |
+
|
| 287 |
+
Setting ``vectorized=True`` allows for faster finite difference
|
| 288 |
+
approximation of the Jacobian by methods 'Radau' and 'BDF', but
|
| 289 |
+
will result in slower execution for other methods and for 'Radau' and
|
| 290 |
+
'BDF' in some circumstances (e.g. small ``len(y0)``).
|
| 291 |
+
args : tuple, optional
|
| 292 |
+
Additional arguments to pass to the user-defined functions. If given,
|
| 293 |
+
the additional arguments are passed to all user-defined functions.
|
| 294 |
+
So if, for example, `fun` has the signature ``fun(t, y, a, b, c)``,
|
| 295 |
+
then `jac` (if given) and any event functions must have the same
|
| 296 |
+
signature, and `args` must be a tuple of length 3.
|
| 297 |
+
**options
|
| 298 |
+
Options passed to a chosen solver. All options available for already
|
| 299 |
+
implemented solvers are listed below.
|
| 300 |
+
first_step : float or None, optional
|
| 301 |
+
Initial step size. Default is `None` which means that the algorithm
|
| 302 |
+
should choose.
|
| 303 |
+
max_step : float, optional
|
| 304 |
+
Maximum allowed step size. Default is np.inf, i.e., the step size is not
|
| 305 |
+
bounded and determined solely by the solver.
|
| 306 |
+
rtol, atol : float or array_like, optional
|
| 307 |
+
Relative and absolute tolerances. The solver keeps the local error
|
| 308 |
+
estimates less than ``atol + rtol * abs(y)``. Here `rtol` controls a
|
| 309 |
+
relative accuracy (number of correct digits), while `atol` controls
|
| 310 |
+
absolute accuracy (number of correct decimal places). To achieve the
|
| 311 |
+
desired `rtol`, set `atol` to be smaller than the smallest value that
|
| 312 |
+
can be expected from ``rtol * abs(y)`` so that `rtol` dominates the
|
| 313 |
+
allowable error. If `atol` is larger than ``rtol * abs(y)`` the
|
| 314 |
+
number of correct digits is not guaranteed. Conversely, to achieve the
|
| 315 |
+
desired `atol` set `rtol` such that ``rtol * abs(y)`` is always smaller
|
| 316 |
+
than `atol`. If components of y have different scales, it might be
|
| 317 |
+
beneficial to set different `atol` values for different components by
|
| 318 |
+
passing array_like with shape (n,) for `atol`. Default values are
|
| 319 |
+
1e-3 for `rtol` and 1e-6 for `atol`.
|
| 320 |
+
jac : array_like, sparse_matrix, callable or None, optional
|
| 321 |
+
Jacobian matrix of the right-hand side of the system with respect
|
| 322 |
+
to y, required by the 'Radau', 'BDF' and 'LSODA' method. The
|
| 323 |
+
Jacobian matrix has shape (n, n) and its element (i, j) is equal to
|
| 324 |
+
``d f_i / d y_j``. There are three ways to define the Jacobian:
|
| 325 |
+
|
| 326 |
+
* If array_like or sparse_matrix, the Jacobian is assumed to
|
| 327 |
+
be constant. Not supported by 'LSODA'.
|
| 328 |
+
* If callable, the Jacobian is assumed to depend on both
|
| 329 |
+
t and y; it will be called as ``jac(t, y)``, as necessary.
|
| 330 |
+
Additional arguments have to be passed if ``args`` is
|
| 331 |
+
used (see documentation of ``args`` argument).
|
| 332 |
+
For 'Radau' and 'BDF' methods, the return value might be a
|
| 333 |
+
sparse matrix.
|
| 334 |
+
* If None (default), the Jacobian will be approximated by
|
| 335 |
+
finite differences.
|
| 336 |
+
|
| 337 |
+
It is generally recommended to provide the Jacobian rather than
|
| 338 |
+
relying on a finite-difference approximation.
|
| 339 |
+
jac_sparsity : array_like, sparse matrix or None, optional
|
| 340 |
+
Defines a sparsity structure of the Jacobian matrix for a finite-
|
| 341 |
+
difference approximation. Its shape must be (n, n). This argument
|
| 342 |
+
is ignored if `jac` is not `None`. If the Jacobian has only few
|
| 343 |
+
non-zero elements in *each* row, providing the sparsity structure
|
| 344 |
+
will greatly speed up the computations [10]_. A zero entry means that
|
| 345 |
+
a corresponding element in the Jacobian is always zero. If None
|
| 346 |
+
(default), the Jacobian is assumed to be dense.
|
| 347 |
+
Not supported by 'LSODA', see `lband` and `uband` instead.
|
| 348 |
+
lband, uband : int or None, optional
|
| 349 |
+
Parameters defining the bandwidth of the Jacobian for the 'LSODA'
|
| 350 |
+
method, i.e., ``jac[i, j] != 0 only for i - lband <= j <= i + uband``.
|
| 351 |
+
Default is None. Setting these requires your jac routine to return the
|
| 352 |
+
Jacobian in the packed format: the returned array must have ``n``
|
| 353 |
+
columns and ``uband + lband + 1`` rows in which Jacobian diagonals are
|
| 354 |
+
written. Specifically ``jac_packed[uband + i - j , j] = jac[i, j]``.
|
| 355 |
+
The same format is used in `scipy.linalg.solve_banded` (check for an
|
| 356 |
+
illustration). These parameters can be also used with ``jac=None`` to
|
| 357 |
+
reduce the number of Jacobian elements estimated by finite differences.
|
| 358 |
+
min_step : float, optional
|
| 359 |
+
The minimum allowed step size for 'LSODA' method.
|
| 360 |
+
By default `min_step` is zero.
|
| 361 |
+
|
| 362 |
+
Returns
|
| 363 |
+
-------
|
| 364 |
+
Bunch object with the following fields defined:
|
| 365 |
+
t : ndarray, shape (n_points,)
|
| 366 |
+
Time points.
|
| 367 |
+
y : ndarray, shape (n, n_points)
|
| 368 |
+
Values of the solution at `t`.
|
| 369 |
+
sol : `OdeSolution` or None
|
| 370 |
+
Found solution as `OdeSolution` instance; None if `dense_output` was
|
| 371 |
+
set to False.
|
| 372 |
+
t_events : list of ndarray or None
|
| 373 |
+
Contains for each event type a list of arrays at which an event of
|
| 374 |
+
that type event was detected. None if `events` was None.
|
| 375 |
+
y_events : list of ndarray or None
|
| 376 |
+
For each value of `t_events`, the corresponding value of the solution.
|
| 377 |
+
None if `events` was None.
|
| 378 |
+
nfev : int
|
| 379 |
+
Number of evaluations of the right-hand side.
|
| 380 |
+
njev : int
|
| 381 |
+
Number of evaluations of the Jacobian.
|
| 382 |
+
nlu : int
|
| 383 |
+
Number of LU decompositions.
|
| 384 |
+
status : int
|
| 385 |
+
Reason for algorithm termination:
|
| 386 |
+
|
| 387 |
+
* -1: Integration step failed.
|
| 388 |
+
* 0: The solver successfully reached the end of `tspan`.
|
| 389 |
+
* 1: A termination event occurred.
|
| 390 |
+
|
| 391 |
+
message : string
|
| 392 |
+
Human-readable description of the termination reason.
|
| 393 |
+
success : bool
|
| 394 |
+
True if the solver reached the interval end or a termination event
|
| 395 |
+
occurred (``status >= 0``).
|
| 396 |
+
|
| 397 |
+
References
|
| 398 |
+
----------
|
| 399 |
+
.. [1] J. R. Dormand, P. J. Prince, "A family of embedded Runge-Kutta
|
| 400 |
+
formulae", Journal of Computational and Applied Mathematics, Vol. 6,
|
| 401 |
+
No. 1, pp. 19-26, 1980.
|
| 402 |
+
.. [2] L. W. Shampine, "Some Practical Runge-Kutta Formulas", Mathematics
|
| 403 |
+
of Computation,, Vol. 46, No. 173, pp. 135-150, 1986.
|
| 404 |
+
.. [3] P. Bogacki, L.F. Shampine, "A 3(2) Pair of Runge-Kutta Formulas",
|
| 405 |
+
Appl. Math. Lett. Vol. 2, No. 4. pp. 321-325, 1989.
|
| 406 |
+
.. [4] E. Hairer, G. Wanner, "Solving Ordinary Differential Equations II:
|
| 407 |
+
Stiff and Differential-Algebraic Problems", Sec. IV.8.
|
| 408 |
+
.. [5] `Backward Differentiation Formula
|
| 409 |
+
<https://en.wikipedia.org/wiki/Backward_differentiation_formula>`_
|
| 410 |
+
on Wikipedia.
|
| 411 |
+
.. [6] L. F. Shampine, M. W. Reichelt, "THE MATLAB ODE SUITE", SIAM J. SCI.
|
| 412 |
+
COMPUTE., Vol. 18, No. 1, pp. 1-22, January 1997.
|
| 413 |
+
.. [7] A. C. Hindmarsh, "ODEPACK, A Systematized Collection of ODE
|
| 414 |
+
Solvers," IMACS Transactions on Scientific Computation, Vol 1.,
|
| 415 |
+
pp. 55-64, 1983.
|
| 416 |
+
.. [8] L. Petzold, "Automatic selection of methods for solving stiff and
|
| 417 |
+
nonstiff systems of ordinary differential equations", SIAM Journal
|
| 418 |
+
on Scientific and Statistical Computing, Vol. 4, No. 1, pp. 136-148,
|
| 419 |
+
1983.
|
| 420 |
+
.. [9] `Stiff equation <https://en.wikipedia.org/wiki/Stiff_equation>`_ on
|
| 421 |
+
Wikipedia.
|
| 422 |
+
.. [10] A. Curtis, M. J. D. Powell, and J. Reid, "On the estimation of
|
| 423 |
+
sparse Jacobian matrices", Journal of the Institute of Mathematics
|
| 424 |
+
and its Applications, 13, pp. 117-120, 1974.
|
| 425 |
+
.. [11] `Cauchy-Riemann equations
|
| 426 |
+
<https://en.wikipedia.org/wiki/Cauchy-Riemann_equations>`_ on
|
| 427 |
+
Wikipedia.
|
| 428 |
+
.. [12] `Lotka-Volterra equations
|
| 429 |
+
<https://en.wikipedia.org/wiki/Lotka%E2%80%93Volterra_equations>`_
|
| 430 |
+
on Wikipedia.
|
| 431 |
+
.. [13] E. Hairer, S. P. Norsett G. Wanner, "Solving Ordinary Differential
|
| 432 |
+
Equations I: Nonstiff Problems", Sec. II.
|
| 433 |
+
.. [14] `Page with original Fortran code of DOP853
|
| 434 |
+
<http://www.unige.ch/~hairer/software.html>`_.
|
| 435 |
+
|
| 436 |
+
Examples
|
| 437 |
+
--------
|
| 438 |
+
Basic exponential decay showing automatically chosen time points.
|
| 439 |
+
|
| 440 |
+
>>> import numpy as np
|
| 441 |
+
>>> from scipy.integrate import solve_ivp
|
| 442 |
+
>>> def exponential_decay(t, y): return -0.5 * y
|
| 443 |
+
>>> sol = solve_ivp(exponential_decay, [0, 10], [2, 4, 8])
|
| 444 |
+
>>> print(sol.t)
|
| 445 |
+
[ 0. 0.11487653 1.26364188 3.06061781 4.81611105 6.57445806
|
| 446 |
+
8.33328988 10. ]
|
| 447 |
+
>>> print(sol.y)
|
| 448 |
+
[[2. 1.88836035 1.06327177 0.43319312 0.18017253 0.07483045
|
| 449 |
+
0.03107158 0.01350781]
|
| 450 |
+
[4. 3.7767207 2.12654355 0.86638624 0.36034507 0.14966091
|
| 451 |
+
0.06214316 0.02701561]
|
| 452 |
+
[8. 7.5534414 4.25308709 1.73277247 0.72069014 0.29932181
|
| 453 |
+
0.12428631 0.05403123]]
|
| 454 |
+
|
| 455 |
+
Specifying points where the solution is desired.
|
| 456 |
+
|
| 457 |
+
>>> sol = solve_ivp(exponential_decay, [0, 10], [2, 4, 8],
|
| 458 |
+
... t_eval=[0, 1, 2, 4, 10])
|
| 459 |
+
>>> print(sol.t)
|
| 460 |
+
[ 0 1 2 4 10]
|
| 461 |
+
>>> print(sol.y)
|
| 462 |
+
[[2. 1.21305369 0.73534021 0.27066736 0.01350938]
|
| 463 |
+
[4. 2.42610739 1.47068043 0.54133472 0.02701876]
|
| 464 |
+
[8. 4.85221478 2.94136085 1.08266944 0.05403753]]
|
| 465 |
+
|
| 466 |
+
Cannon fired upward with terminal event upon impact. The ``terminal`` and
|
| 467 |
+
``direction`` fields of an event are applied by monkey patching a function.
|
| 468 |
+
Here ``y[0]`` is position and ``y[1]`` is velocity. The projectile starts
|
| 469 |
+
at position 0 with velocity +10. Note that the integration never reaches
|
| 470 |
+
t=100 because the event is terminal.
|
| 471 |
+
|
| 472 |
+
>>> def upward_cannon(t, y): return [y[1], -0.5]
|
| 473 |
+
>>> def hit_ground(t, y): return y[0]
|
| 474 |
+
>>> hit_ground.terminal = True
|
| 475 |
+
>>> hit_ground.direction = -1
|
| 476 |
+
>>> sol = solve_ivp(upward_cannon, [0, 100], [0, 10], events=hit_ground)
|
| 477 |
+
>>> print(sol.t_events)
|
| 478 |
+
[array([40.])]
|
| 479 |
+
>>> print(sol.t)
|
| 480 |
+
[0.00000000e+00 9.99900010e-05 1.09989001e-03 1.10988901e-02
|
| 481 |
+
1.11088891e-01 1.11098890e+00 1.11099890e+01 4.00000000e+01]
|
| 482 |
+
|
| 483 |
+
Use `dense_output` and `events` to find position, which is 100, at the apex
|
| 484 |
+
of the cannonball's trajectory. Apex is not defined as terminal, so both
|
| 485 |
+
apex and hit_ground are found. There is no information at t=20, so the sol
|
| 486 |
+
attribute is used to evaluate the solution. The sol attribute is returned
|
| 487 |
+
by setting ``dense_output=True``. Alternatively, the `y_events` attribute
|
| 488 |
+
can be used to access the solution at the time of the event.
|
| 489 |
+
|
| 490 |
+
>>> def apex(t, y): return y[1]
|
| 491 |
+
>>> sol = solve_ivp(upward_cannon, [0, 100], [0, 10],
|
| 492 |
+
... events=(hit_ground, apex), dense_output=True)
|
| 493 |
+
>>> print(sol.t_events)
|
| 494 |
+
[array([40.]), array([20.])]
|
| 495 |
+
>>> print(sol.t)
|
| 496 |
+
[0.00000000e+00 9.99900010e-05 1.09989001e-03 1.10988901e-02
|
| 497 |
+
1.11088891e-01 1.11098890e+00 1.11099890e+01 4.00000000e+01]
|
| 498 |
+
>>> print(sol.sol(sol.t_events[1][0]))
|
| 499 |
+
[100. 0.]
|
| 500 |
+
>>> print(sol.y_events)
|
| 501 |
+
[array([[-5.68434189e-14, -1.00000000e+01]]),
|
| 502 |
+
array([[1.00000000e+02, 1.77635684e-15]])]
|
| 503 |
+
|
| 504 |
+
As an example of a system with additional parameters, we'll implement
|
| 505 |
+
the Lotka-Volterra equations [12]_.
|
| 506 |
+
|
| 507 |
+
>>> def lotkavolterra(t, z, a, b, c, d):
|
| 508 |
+
... x, y = z
|
| 509 |
+
... return [a*x - b*x*y, -c*y + d*x*y]
|
| 510 |
+
...
|
| 511 |
+
|
| 512 |
+
We pass in the parameter values a=1.5, b=1, c=3 and d=1 with the `args`
|
| 513 |
+
argument.
|
| 514 |
+
|
| 515 |
+
>>> sol = solve_ivp(lotkavolterra, [0, 15], [10, 5], args=(1.5, 1, 3, 1),
|
| 516 |
+
... dense_output=True)
|
| 517 |
+
|
| 518 |
+
Compute a dense solution and plot it.
|
| 519 |
+
|
| 520 |
+
>>> t = np.linspace(0, 15, 300)
|
| 521 |
+
>>> z = sol.sol(t)
|
| 522 |
+
>>> import matplotlib.pyplot as plt
|
| 523 |
+
>>> plt.plot(t, z.T)
|
| 524 |
+
>>> plt.xlabel('t')
|
| 525 |
+
>>> plt.legend(['x', 'y'], shadow=True)
|
| 526 |
+
>>> plt.title('Lotka-Volterra System')
|
| 527 |
+
>>> plt.show()
|
| 528 |
+
|
| 529 |
+
A couple examples of using solve_ivp to solve the differential
|
| 530 |
+
equation ``y' = Ay`` with complex matrix ``A``.
|
| 531 |
+
|
| 532 |
+
>>> A = np.array([[-0.25 + 0.14j, 0, 0.33 + 0.44j],
|
| 533 |
+
... [0.25 + 0.58j, -0.2 + 0.14j, 0],
|
| 534 |
+
... [0, 0.2 + 0.4j, -0.1 + 0.97j]])
|
| 535 |
+
|
| 536 |
+
Solving an IVP with ``A`` from above and ``y`` as 3x1 vector:
|
| 537 |
+
|
| 538 |
+
>>> def deriv_vec(t, y):
|
| 539 |
+
... return A @ y
|
| 540 |
+
>>> result = solve_ivp(deriv_vec, [0, 25],
|
| 541 |
+
... np.array([10 + 0j, 20 + 0j, 30 + 0j]),
|
| 542 |
+
... t_eval=np.linspace(0, 25, 101))
|
| 543 |
+
>>> print(result.y[:, 0])
|
| 544 |
+
[10.+0.j 20.+0.j 30.+0.j]
|
| 545 |
+
>>> print(result.y[:, -1])
|
| 546 |
+
[18.46291039+45.25653651j 10.01569306+36.23293216j
|
| 547 |
+
-4.98662741+80.07360388j]
|
| 548 |
+
|
| 549 |
+
Solving an IVP with ``A`` from above with ``y`` as 3x3 matrix :
|
| 550 |
+
|
| 551 |
+
>>> def deriv_mat(t, y):
|
| 552 |
+
... return (A @ y.reshape(3, 3)).flatten()
|
| 553 |
+
>>> y0 = np.array([[2 + 0j, 3 + 0j, 4 + 0j],
|
| 554 |
+
... [5 + 0j, 6 + 0j, 7 + 0j],
|
| 555 |
+
... [9 + 0j, 34 + 0j, 78 + 0j]])
|
| 556 |
+
|
| 557 |
+
>>> result = solve_ivp(deriv_mat, [0, 25], y0.flatten(),
|
| 558 |
+
... t_eval=np.linspace(0, 25, 101))
|
| 559 |
+
>>> print(result.y[:, 0].reshape(3, 3))
|
| 560 |
+
[[ 2.+0.j 3.+0.j 4.+0.j]
|
| 561 |
+
[ 5.+0.j 6.+0.j 7.+0.j]
|
| 562 |
+
[ 9.+0.j 34.+0.j 78.+0.j]]
|
| 563 |
+
>>> print(result.y[:, -1].reshape(3, 3))
|
| 564 |
+
[[ 5.67451179 +12.07938445j 17.2888073 +31.03278837j
|
| 565 |
+
37.83405768 +63.25138759j]
|
| 566 |
+
[ 3.39949503 +11.82123994j 21.32530996 +44.88668871j
|
| 567 |
+
53.17531184+103.80400411j]
|
| 568 |
+
[ -2.26105874 +22.19277664j -15.1255713 +70.19616341j
|
| 569 |
+
-38.34616845+153.29039931j]]
|
| 570 |
+
|
| 571 |
+
|
| 572 |
+
"""
|
| 573 |
+
if method not in METHODS and not (
|
| 574 |
+
inspect.isclass(method) and issubclass(method, OdeSolver)):
|
| 575 |
+
raise ValueError(f"`method` must be one of {METHODS} or OdeSolver class.")
|
| 576 |
+
|
| 577 |
+
t0, tf = map(float, t_span)
|
| 578 |
+
|
| 579 |
+
if args is not None:
|
| 580 |
+
# Wrap the user's fun (and jac, if given) in lambdas to hide the
|
| 581 |
+
# additional parameters. Pass in the original fun as a keyword
|
| 582 |
+
# argument to keep it in the scope of the lambda.
|
| 583 |
+
try:
|
| 584 |
+
_ = [*(args)]
|
| 585 |
+
except TypeError as exp:
|
| 586 |
+
suggestion_tuple = (
|
| 587 |
+
"Supplied 'args' cannot be unpacked. Please supply `args`"
|
| 588 |
+
f" as a tuple (e.g. `args=({args},)`)"
|
| 589 |
+
)
|
| 590 |
+
raise TypeError(suggestion_tuple) from exp
|
| 591 |
+
|
| 592 |
+
def fun(t, x, fun=fun):
|
| 593 |
+
return fun(t, x, *args)
|
| 594 |
+
jac = options.get('jac')
|
| 595 |
+
if callable(jac):
|
| 596 |
+
options['jac'] = lambda t, x: jac(t, x, *args)
|
| 597 |
+
|
| 598 |
+
if t_eval is not None:
|
| 599 |
+
t_eval = np.asarray(t_eval)
|
| 600 |
+
if t_eval.ndim != 1:
|
| 601 |
+
raise ValueError("`t_eval` must be 1-dimensional.")
|
| 602 |
+
|
| 603 |
+
if np.any(t_eval < min(t0, tf)) or np.any(t_eval > max(t0, tf)):
|
| 604 |
+
raise ValueError("Values in `t_eval` are not within `t_span`.")
|
| 605 |
+
|
| 606 |
+
d = np.diff(t_eval)
|
| 607 |
+
if tf > t0 and np.any(d <= 0) or tf < t0 and np.any(d >= 0):
|
| 608 |
+
raise ValueError("Values in `t_eval` are not properly sorted.")
|
| 609 |
+
|
| 610 |
+
if tf > t0:
|
| 611 |
+
t_eval_i = 0
|
| 612 |
+
else:
|
| 613 |
+
# Make order of t_eval decreasing to use np.searchsorted.
|
| 614 |
+
t_eval = t_eval[::-1]
|
| 615 |
+
# This will be an upper bound for slices.
|
| 616 |
+
t_eval_i = t_eval.shape[0]
|
| 617 |
+
|
| 618 |
+
if method in METHODS:
|
| 619 |
+
method = METHODS[method]
|
| 620 |
+
|
| 621 |
+
solver = method(fun, t0, y0, tf, vectorized=vectorized, **options)
|
| 622 |
+
|
| 623 |
+
if t_eval is None:
|
| 624 |
+
ts = [t0]
|
| 625 |
+
ys = [y0]
|
| 626 |
+
elif t_eval is not None and dense_output:
|
| 627 |
+
ts = []
|
| 628 |
+
ti = [t0]
|
| 629 |
+
ys = []
|
| 630 |
+
else:
|
| 631 |
+
ts = []
|
| 632 |
+
ys = []
|
| 633 |
+
|
| 634 |
+
interpolants = []
|
| 635 |
+
|
| 636 |
+
if events is not None:
|
| 637 |
+
events, max_events, event_dir = prepare_events(events)
|
| 638 |
+
event_count = np.zeros(len(events))
|
| 639 |
+
if args is not None:
|
| 640 |
+
# Wrap user functions in lambdas to hide the additional parameters.
|
| 641 |
+
# The original event function is passed as a keyword argument to the
|
| 642 |
+
# lambda to keep the original function in scope (i.e., avoid the
|
| 643 |
+
# late binding closure "gotcha").
|
| 644 |
+
events = [lambda t, x, event=event: event(t, x, *args)
|
| 645 |
+
for event in events]
|
| 646 |
+
g = [event(t0, y0) for event in events]
|
| 647 |
+
t_events = [[] for _ in range(len(events))]
|
| 648 |
+
y_events = [[] for _ in range(len(events))]
|
| 649 |
+
else:
|
| 650 |
+
t_events = None
|
| 651 |
+
y_events = None
|
| 652 |
+
|
| 653 |
+
status = None
|
| 654 |
+
while status is None:
|
| 655 |
+
message = solver.step()
|
| 656 |
+
|
| 657 |
+
if solver.status == 'finished':
|
| 658 |
+
status = 0
|
| 659 |
+
elif solver.status == 'failed':
|
| 660 |
+
status = -1
|
| 661 |
+
break
|
| 662 |
+
|
| 663 |
+
t_old = solver.t_old
|
| 664 |
+
t = solver.t
|
| 665 |
+
y = solver.y
|
| 666 |
+
|
| 667 |
+
if dense_output:
|
| 668 |
+
sol = solver.dense_output()
|
| 669 |
+
interpolants.append(sol)
|
| 670 |
+
else:
|
| 671 |
+
sol = None
|
| 672 |
+
|
| 673 |
+
if events is not None:
|
| 674 |
+
g_new = [event(t, y) for event in events]
|
| 675 |
+
active_events = find_active_events(g, g_new, event_dir)
|
| 676 |
+
if active_events.size > 0:
|
| 677 |
+
if sol is None:
|
| 678 |
+
sol = solver.dense_output()
|
| 679 |
+
|
| 680 |
+
event_count[active_events] += 1
|
| 681 |
+
root_indices, roots, terminate = handle_events(
|
| 682 |
+
sol, events, active_events, event_count, max_events,
|
| 683 |
+
t_old, t)
|
| 684 |
+
|
| 685 |
+
for e, te in zip(root_indices, roots):
|
| 686 |
+
t_events[e].append(te)
|
| 687 |
+
y_events[e].append(sol(te))
|
| 688 |
+
|
| 689 |
+
if terminate:
|
| 690 |
+
status = 1
|
| 691 |
+
t = roots[-1]
|
| 692 |
+
y = sol(t)
|
| 693 |
+
|
| 694 |
+
g = g_new
|
| 695 |
+
|
| 696 |
+
if t_eval is None:
|
| 697 |
+
donot_append = (len(ts) > 1 and
|
| 698 |
+
ts[-1] == t and
|
| 699 |
+
dense_output)
|
| 700 |
+
if not donot_append:
|
| 701 |
+
ts.append(t)
|
| 702 |
+
ys.append(y)
|
| 703 |
+
else:
|
| 704 |
+
if len(interpolants) > 0:
|
| 705 |
+
interpolants.pop()
|
| 706 |
+
else:
|
| 707 |
+
# The value in t_eval equal to t will be included.
|
| 708 |
+
if solver.direction > 0:
|
| 709 |
+
t_eval_i_new = np.searchsorted(t_eval, t, side='right')
|
| 710 |
+
t_eval_step = t_eval[t_eval_i:t_eval_i_new]
|
| 711 |
+
else:
|
| 712 |
+
t_eval_i_new = np.searchsorted(t_eval, t, side='left')
|
| 713 |
+
# It has to be done with two slice operations, because
|
| 714 |
+
# you can't slice to 0th element inclusive using backward
|
| 715 |
+
# slicing.
|
| 716 |
+
t_eval_step = t_eval[t_eval_i_new:t_eval_i][::-1]
|
| 717 |
+
|
| 718 |
+
if t_eval_step.size > 0:
|
| 719 |
+
if sol is None:
|
| 720 |
+
sol = solver.dense_output()
|
| 721 |
+
ts.append(t_eval_step)
|
| 722 |
+
ys.append(sol(t_eval_step))
|
| 723 |
+
t_eval_i = t_eval_i_new
|
| 724 |
+
|
| 725 |
+
if t_eval is not None and dense_output:
|
| 726 |
+
ti.append(t)
|
| 727 |
+
|
| 728 |
+
message = MESSAGES.get(status, message)
|
| 729 |
+
|
| 730 |
+
if t_events is not None:
|
| 731 |
+
t_events = [np.asarray(te) for te in t_events]
|
| 732 |
+
y_events = [np.asarray(ye) for ye in y_events]
|
| 733 |
+
|
| 734 |
+
if t_eval is None:
|
| 735 |
+
ts = np.array(ts)
|
| 736 |
+
ys = np.vstack(ys).T
|
| 737 |
+
elif ts:
|
| 738 |
+
ts = np.hstack(ts)
|
| 739 |
+
ys = np.hstack(ys)
|
| 740 |
+
|
| 741 |
+
if dense_output:
|
| 742 |
+
if t_eval is None:
|
| 743 |
+
sol = OdeSolution(
|
| 744 |
+
ts, interpolants, alt_segment=True if method in [BDF, LSODA] else False
|
| 745 |
+
)
|
| 746 |
+
else:
|
| 747 |
+
sol = OdeSolution(
|
| 748 |
+
ti, interpolants, alt_segment=True if method in [BDF, LSODA] else False
|
| 749 |
+
)
|
| 750 |
+
else:
|
| 751 |
+
sol = None
|
| 752 |
+
|
| 753 |
+
return OdeResult(t=ts, y=ys, sol=sol, t_events=t_events, y_events=y_events,
|
| 754 |
+
nfev=solver.nfev, njev=solver.njev, nlu=solver.nlu,
|
| 755 |
+
status=status, message=message, success=status >= 0)
|
shared/package-files/0c/0c6afc23568d55b3e9ac914f9c5361e3033e778aa5b58d3cc82835fc5c638679/difflib.py
ADDED
|
@@ -0,0 +1,2056 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Module difflib -- helpers for computing deltas between objects.
|
| 3 |
+
|
| 4 |
+
Function get_close_matches(word, possibilities, n=3, cutoff=0.6):
|
| 5 |
+
Use SequenceMatcher to return list of the best "good enough" matches.
|
| 6 |
+
|
| 7 |
+
Function context_diff(a, b):
|
| 8 |
+
For two lists of strings, return a delta in context diff format.
|
| 9 |
+
|
| 10 |
+
Function ndiff(a, b):
|
| 11 |
+
Return a delta: the difference between `a` and `b` (lists of strings).
|
| 12 |
+
|
| 13 |
+
Function restore(delta, which):
|
| 14 |
+
Return one of the two sequences that generated an ndiff delta.
|
| 15 |
+
|
| 16 |
+
Function unified_diff(a, b):
|
| 17 |
+
For two lists of strings, return a delta in unified diff format.
|
| 18 |
+
|
| 19 |
+
Class SequenceMatcher:
|
| 20 |
+
A flexible class for comparing pairs of sequences of any type.
|
| 21 |
+
|
| 22 |
+
Class Differ:
|
| 23 |
+
For producing human-readable deltas from sequences of lines of text.
|
| 24 |
+
|
| 25 |
+
Class HtmlDiff:
|
| 26 |
+
For producing HTML side by side comparison with change highlights.
|
| 27 |
+
"""
|
| 28 |
+
|
| 29 |
+
__all__ = ['get_close_matches', 'ndiff', 'restore', 'SequenceMatcher',
|
| 30 |
+
'Differ','IS_CHARACTER_JUNK', 'IS_LINE_JUNK', 'context_diff',
|
| 31 |
+
'unified_diff', 'diff_bytes', 'HtmlDiff', 'Match']
|
| 32 |
+
|
| 33 |
+
from heapq import nlargest as _nlargest
|
| 34 |
+
from collections import namedtuple as _namedtuple
|
| 35 |
+
from types import GenericAlias
|
| 36 |
+
|
| 37 |
+
Match = _namedtuple('Match', 'a b size')
|
| 38 |
+
|
| 39 |
+
def _calculate_ratio(matches, length):
|
| 40 |
+
if length:
|
| 41 |
+
return 2.0 * matches / length
|
| 42 |
+
return 1.0
|
| 43 |
+
|
| 44 |
+
class SequenceMatcher:
|
| 45 |
+
|
| 46 |
+
"""
|
| 47 |
+
SequenceMatcher is a flexible class for comparing pairs of sequences of
|
| 48 |
+
any type, so long as the sequence elements are hashable. The basic
|
| 49 |
+
algorithm predates, and is a little fancier than, an algorithm
|
| 50 |
+
published in the late 1980's by Ratcliff and Obershelp under the
|
| 51 |
+
hyperbolic name "gestalt pattern matching". The basic idea is to find
|
| 52 |
+
the longest contiguous matching subsequence that contains no "junk"
|
| 53 |
+
elements (R-O doesn't address junk). The same idea is then applied
|
| 54 |
+
recursively to the pieces of the sequences to the left and to the right
|
| 55 |
+
of the matching subsequence. This does not yield minimal edit
|
| 56 |
+
sequences, but does tend to yield matches that "look right" to people.
|
| 57 |
+
|
| 58 |
+
SequenceMatcher tries to compute a "human-friendly diff" between two
|
| 59 |
+
sequences. Unlike e.g. UNIX(tm) diff, the fundamental notion is the
|
| 60 |
+
longest *contiguous* & junk-free matching subsequence. That's what
|
| 61 |
+
catches peoples' eyes. The Windows(tm) windiff has another interesting
|
| 62 |
+
notion, pairing up elements that appear uniquely in each sequence.
|
| 63 |
+
That, and the method here, appear to yield more intuitive difference
|
| 64 |
+
reports than does diff. This method appears to be the least vulnerable
|
| 65 |
+
to syncing up on blocks of "junk lines", though (like blank lines in
|
| 66 |
+
ordinary text files, or maybe "<P>" lines in HTML files). That may be
|
| 67 |
+
because this is the only method of the 3 that has a *concept* of
|
| 68 |
+
"junk" <wink>.
|
| 69 |
+
|
| 70 |
+
Example, comparing two strings, and considering blanks to be "junk":
|
| 71 |
+
|
| 72 |
+
>>> s = SequenceMatcher(lambda x: x == " ",
|
| 73 |
+
... "private Thread currentThread;",
|
| 74 |
+
... "private volatile Thread currentThread;")
|
| 75 |
+
>>>
|
| 76 |
+
|
| 77 |
+
.ratio() returns a float in [0, 1], measuring the "similarity" of the
|
| 78 |
+
sequences. As a rule of thumb, a .ratio() value over 0.6 means the
|
| 79 |
+
sequences are close matches:
|
| 80 |
+
|
| 81 |
+
>>> print(round(s.ratio(), 3))
|
| 82 |
+
0.866
|
| 83 |
+
>>>
|
| 84 |
+
|
| 85 |
+
If you're only interested in where the sequences match,
|
| 86 |
+
.get_matching_blocks() is handy:
|
| 87 |
+
|
| 88 |
+
>>> for block in s.get_matching_blocks():
|
| 89 |
+
... print("a[%d] and b[%d] match for %d elements" % block)
|
| 90 |
+
a[0] and b[0] match for 8 elements
|
| 91 |
+
a[8] and b[17] match for 21 elements
|
| 92 |
+
a[29] and b[38] match for 0 elements
|
| 93 |
+
|
| 94 |
+
Note that the last tuple returned by .get_matching_blocks() is always a
|
| 95 |
+
dummy, (len(a), len(b), 0), and this is the only case in which the last
|
| 96 |
+
tuple element (number of elements matched) is 0.
|
| 97 |
+
|
| 98 |
+
If you want to know how to change the first sequence into the second,
|
| 99 |
+
use .get_opcodes():
|
| 100 |
+
|
| 101 |
+
>>> for opcode in s.get_opcodes():
|
| 102 |
+
... print("%6s a[%d:%d] b[%d:%d]" % opcode)
|
| 103 |
+
equal a[0:8] b[0:8]
|
| 104 |
+
insert a[8:8] b[8:17]
|
| 105 |
+
equal a[8:29] b[17:38]
|
| 106 |
+
|
| 107 |
+
See the Differ class for a fancy human-friendly file differencer, which
|
| 108 |
+
uses SequenceMatcher both to compare sequences of lines, and to compare
|
| 109 |
+
sequences of characters within similar (near-matching) lines.
|
| 110 |
+
|
| 111 |
+
See also function get_close_matches() in this module, which shows how
|
| 112 |
+
simple code building on SequenceMatcher can be used to do useful work.
|
| 113 |
+
|
| 114 |
+
Timing: Basic R-O is cubic time worst case and quadratic time expected
|
| 115 |
+
case. SequenceMatcher is quadratic time for the worst case and has
|
| 116 |
+
expected-case behavior dependent in a complicated way on how many
|
| 117 |
+
elements the sequences have in common; best case time is linear.
|
| 118 |
+
"""
|
| 119 |
+
|
| 120 |
+
def __init__(self, isjunk=None, a='', b='', autojunk=True):
|
| 121 |
+
"""Construct a SequenceMatcher.
|
| 122 |
+
|
| 123 |
+
Optional arg isjunk is None (the default), or a one-argument
|
| 124 |
+
function that takes a sequence element and returns true iff the
|
| 125 |
+
element is junk. None is equivalent to passing "lambda x: 0", i.e.
|
| 126 |
+
no elements are considered to be junk. For example, pass
|
| 127 |
+
lambda x: x in " \\t"
|
| 128 |
+
if you're comparing lines as sequences of characters, and don't
|
| 129 |
+
want to synch up on blanks or hard tabs.
|
| 130 |
+
|
| 131 |
+
Optional arg a is the first of two sequences to be compared. By
|
| 132 |
+
default, an empty string. The elements of a must be hashable. See
|
| 133 |
+
also .set_seqs() and .set_seq1().
|
| 134 |
+
|
| 135 |
+
Optional arg b is the second of two sequences to be compared. By
|
| 136 |
+
default, an empty string. The elements of b must be hashable. See
|
| 137 |
+
also .set_seqs() and .set_seq2().
|
| 138 |
+
|
| 139 |
+
Optional arg autojunk should be set to False to disable the
|
| 140 |
+
"automatic junk heuristic" that treats popular elements as junk
|
| 141 |
+
(see module documentation for more information).
|
| 142 |
+
"""
|
| 143 |
+
|
| 144 |
+
# Members:
|
| 145 |
+
# a
|
| 146 |
+
# first sequence
|
| 147 |
+
# b
|
| 148 |
+
# second sequence; differences are computed as "what do
|
| 149 |
+
# we need to do to 'a' to change it into 'b'?"
|
| 150 |
+
# b2j
|
| 151 |
+
# for x in b, b2j[x] is a list of the indices (into b)
|
| 152 |
+
# at which x appears; junk and popular elements do not appear
|
| 153 |
+
# fullbcount
|
| 154 |
+
# for x in b, fullbcount[x] == the number of times x
|
| 155 |
+
# appears in b; only materialized if really needed (used
|
| 156 |
+
# only for computing quick_ratio())
|
| 157 |
+
# matching_blocks
|
| 158 |
+
# a list of (i, j, k) triples, where a[i:i+k] == b[j:j+k];
|
| 159 |
+
# ascending & non-overlapping in i and in j; terminated by
|
| 160 |
+
# a dummy (len(a), len(b), 0) sentinel
|
| 161 |
+
# opcodes
|
| 162 |
+
# a list of (tag, i1, i2, j1, j2) tuples, where tag is
|
| 163 |
+
# one of
|
| 164 |
+
# 'replace' a[i1:i2] should be replaced by b[j1:j2]
|
| 165 |
+
# 'delete' a[i1:i2] should be deleted
|
| 166 |
+
# 'insert' b[j1:j2] should be inserted
|
| 167 |
+
# 'equal' a[i1:i2] == b[j1:j2]
|
| 168 |
+
# isjunk
|
| 169 |
+
# a user-supplied function taking a sequence element and
|
| 170 |
+
# returning true iff the element is "junk" -- this has
|
| 171 |
+
# subtle but helpful effects on the algorithm, which I'll
|
| 172 |
+
# get around to writing up someday <0.9 wink>.
|
| 173 |
+
# DON'T USE! Only __chain_b uses this. Use "in self.bjunk".
|
| 174 |
+
# bjunk
|
| 175 |
+
# the items in b for which isjunk is True.
|
| 176 |
+
# bpopular
|
| 177 |
+
# nonjunk items in b treated as junk by the heuristic (if used).
|
| 178 |
+
|
| 179 |
+
self.isjunk = isjunk
|
| 180 |
+
self.a = self.b = None
|
| 181 |
+
self.autojunk = autojunk
|
| 182 |
+
self.set_seqs(a, b)
|
| 183 |
+
|
| 184 |
+
def set_seqs(self, a, b):
|
| 185 |
+
"""Set the two sequences to be compared.
|
| 186 |
+
|
| 187 |
+
>>> s = SequenceMatcher()
|
| 188 |
+
>>> s.set_seqs("abcd", "bcde")
|
| 189 |
+
>>> s.ratio()
|
| 190 |
+
0.75
|
| 191 |
+
"""
|
| 192 |
+
|
| 193 |
+
self.set_seq1(a)
|
| 194 |
+
self.set_seq2(b)
|
| 195 |
+
|
| 196 |
+
def set_seq1(self, a):
|
| 197 |
+
"""Set the first sequence to be compared.
|
| 198 |
+
|
| 199 |
+
The second sequence to be compared is not changed.
|
| 200 |
+
|
| 201 |
+
>>> s = SequenceMatcher(None, "abcd", "bcde")
|
| 202 |
+
>>> s.ratio()
|
| 203 |
+
0.75
|
| 204 |
+
>>> s.set_seq1("bcde")
|
| 205 |
+
>>> s.ratio()
|
| 206 |
+
1.0
|
| 207 |
+
>>>
|
| 208 |
+
|
| 209 |
+
SequenceMatcher computes and caches detailed information about the
|
| 210 |
+
second sequence, so if you want to compare one sequence S against
|
| 211 |
+
many sequences, use .set_seq2(S) once and call .set_seq1(x)
|
| 212 |
+
repeatedly for each of the other sequences.
|
| 213 |
+
|
| 214 |
+
See also set_seqs() and set_seq2().
|
| 215 |
+
"""
|
| 216 |
+
|
| 217 |
+
if a is self.a:
|
| 218 |
+
return
|
| 219 |
+
self.a = a
|
| 220 |
+
self.matching_blocks = self.opcodes = None
|
| 221 |
+
|
| 222 |
+
def set_seq2(self, b):
|
| 223 |
+
"""Set the second sequence to be compared.
|
| 224 |
+
|
| 225 |
+
The first sequence to be compared is not changed.
|
| 226 |
+
|
| 227 |
+
>>> s = SequenceMatcher(None, "abcd", "bcde")
|
| 228 |
+
>>> s.ratio()
|
| 229 |
+
0.75
|
| 230 |
+
>>> s.set_seq2("abcd")
|
| 231 |
+
>>> s.ratio()
|
| 232 |
+
1.0
|
| 233 |
+
>>>
|
| 234 |
+
|
| 235 |
+
SequenceMatcher computes and caches detailed information about the
|
| 236 |
+
second sequence, so if you want to compare one sequence S against
|
| 237 |
+
many sequences, use .set_seq2(S) once and call .set_seq1(x)
|
| 238 |
+
repeatedly for each of the other sequences.
|
| 239 |
+
|
| 240 |
+
See also set_seqs() and set_seq1().
|
| 241 |
+
"""
|
| 242 |
+
|
| 243 |
+
if b is self.b:
|
| 244 |
+
return
|
| 245 |
+
self.b = b
|
| 246 |
+
self.matching_blocks = self.opcodes = None
|
| 247 |
+
self.fullbcount = None
|
| 248 |
+
self.__chain_b()
|
| 249 |
+
|
| 250 |
+
# For each element x in b, set b2j[x] to a list of the indices in
|
| 251 |
+
# b where x appears; the indices are in increasing order; note that
|
| 252 |
+
# the number of times x appears in b is len(b2j[x]) ...
|
| 253 |
+
# when self.isjunk is defined, junk elements don't show up in this
|
| 254 |
+
# map at all, which stops the central find_longest_match method
|
| 255 |
+
# from starting any matching block at a junk element ...
|
| 256 |
+
# b2j also does not contain entries for "popular" elements, meaning
|
| 257 |
+
# elements that account for more than 1 + 1% of the total elements, and
|
| 258 |
+
# when the sequence is reasonably large (>= 200 elements); this can
|
| 259 |
+
# be viewed as an adaptive notion of semi-junk, and yields an enormous
|
| 260 |
+
# speedup when, e.g., comparing program files with hundreds of
|
| 261 |
+
# instances of "return NULL;" ...
|
| 262 |
+
# note that this is only called when b changes; so for cross-product
|
| 263 |
+
# kinds of matches, it's best to call set_seq2 once, then set_seq1
|
| 264 |
+
# repeatedly
|
| 265 |
+
|
| 266 |
+
def __chain_b(self):
|
| 267 |
+
# Because isjunk is a user-defined (not C) function, and we test
|
| 268 |
+
# for junk a LOT, it's important to minimize the number of calls.
|
| 269 |
+
# Before the tricks described here, __chain_b was by far the most
|
| 270 |
+
# time-consuming routine in the whole module! If anyone sees
|
| 271 |
+
# Jim Roskind, thank him again for profile.py -- I never would
|
| 272 |
+
# have guessed that.
|
| 273 |
+
# The first trick is to build b2j ignoring the possibility
|
| 274 |
+
# of junk. I.e., we don't call isjunk at all yet. Throwing
|
| 275 |
+
# out the junk later is much cheaper than building b2j "right"
|
| 276 |
+
# from the start.
|
| 277 |
+
b = self.b
|
| 278 |
+
self.b2j = b2j = {}
|
| 279 |
+
|
| 280 |
+
for i, elt in enumerate(b):
|
| 281 |
+
indices = b2j.setdefault(elt, [])
|
| 282 |
+
indices.append(i)
|
| 283 |
+
|
| 284 |
+
# Purge junk elements
|
| 285 |
+
self.bjunk = junk = set()
|
| 286 |
+
isjunk = self.isjunk
|
| 287 |
+
if isjunk:
|
| 288 |
+
for elt in b2j.keys():
|
| 289 |
+
if isjunk(elt):
|
| 290 |
+
junk.add(elt)
|
| 291 |
+
for elt in junk: # separate loop avoids separate list of keys
|
| 292 |
+
del b2j[elt]
|
| 293 |
+
|
| 294 |
+
# Purge popular elements that are not junk
|
| 295 |
+
self.bpopular = popular = set()
|
| 296 |
+
n = len(b)
|
| 297 |
+
if self.autojunk and n >= 200:
|
| 298 |
+
ntest = n // 100 + 1
|
| 299 |
+
for elt, idxs in b2j.items():
|
| 300 |
+
if len(idxs) > ntest:
|
| 301 |
+
popular.add(elt)
|
| 302 |
+
for elt in popular: # ditto; as fast for 1% deletion
|
| 303 |
+
del b2j[elt]
|
| 304 |
+
|
| 305 |
+
def find_longest_match(self, alo=0, ahi=None, blo=0, bhi=None):
|
| 306 |
+
"""Find longest matching block in a[alo:ahi] and b[blo:bhi].
|
| 307 |
+
|
| 308 |
+
By default it will find the longest match in the entirety of a and b.
|
| 309 |
+
|
| 310 |
+
If isjunk is not defined:
|
| 311 |
+
|
| 312 |
+
Return (i,j,k) such that a[i:i+k] is equal to b[j:j+k], where
|
| 313 |
+
alo <= i <= i+k <= ahi
|
| 314 |
+
blo <= j <= j+k <= bhi
|
| 315 |
+
and for all (i',j',k') meeting those conditions,
|
| 316 |
+
k >= k'
|
| 317 |
+
i <= i'
|
| 318 |
+
and if i == i', j <= j'
|
| 319 |
+
|
| 320 |
+
In other words, of all maximal matching blocks, return one that
|
| 321 |
+
starts earliest in a, and of all those maximal matching blocks that
|
| 322 |
+
start earliest in a, return the one that starts earliest in b.
|
| 323 |
+
|
| 324 |
+
>>> s = SequenceMatcher(None, " abcd", "abcd abcd")
|
| 325 |
+
>>> s.find_longest_match(0, 5, 0, 9)
|
| 326 |
+
Match(a=0, b=4, size=5)
|
| 327 |
+
|
| 328 |
+
If isjunk is defined, first the longest matching block is
|
| 329 |
+
determined as above, but with the additional restriction that no
|
| 330 |
+
junk element appears in the block. Then that block is extended as
|
| 331 |
+
far as possible by matching (only) junk elements on both sides. So
|
| 332 |
+
the resulting block never matches on junk except as identical junk
|
| 333 |
+
happens to be adjacent to an "interesting" match.
|
| 334 |
+
|
| 335 |
+
Here's the same example as before, but considering blanks to be
|
| 336 |
+
junk. That prevents " abcd" from matching the " abcd" at the tail
|
| 337 |
+
end of the second sequence directly. Instead only the "abcd" can
|
| 338 |
+
match, and matches the leftmost "abcd" in the second sequence:
|
| 339 |
+
|
| 340 |
+
>>> s = SequenceMatcher(lambda x: x==" ", " abcd", "abcd abcd")
|
| 341 |
+
>>> s.find_longest_match(0, 5, 0, 9)
|
| 342 |
+
Match(a=1, b=0, size=4)
|
| 343 |
+
|
| 344 |
+
If no blocks match, return (alo, blo, 0).
|
| 345 |
+
|
| 346 |
+
>>> s = SequenceMatcher(None, "ab", "c")
|
| 347 |
+
>>> s.find_longest_match(0, 2, 0, 1)
|
| 348 |
+
Match(a=0, b=0, size=0)
|
| 349 |
+
"""
|
| 350 |
+
|
| 351 |
+
# CAUTION: stripping common prefix or suffix would be incorrect.
|
| 352 |
+
# E.g.,
|
| 353 |
+
# ab
|
| 354 |
+
# acab
|
| 355 |
+
# Longest matching block is "ab", but if common prefix is
|
| 356 |
+
# stripped, it's "a" (tied with "b"). UNIX(tm) diff does so
|
| 357 |
+
# strip, so ends up claiming that ab is changed to acab by
|
| 358 |
+
# inserting "ca" in the middle. That's minimal but unintuitive:
|
| 359 |
+
# "it's obvious" that someone inserted "ac" at the front.
|
| 360 |
+
# Windiff ends up at the same place as diff, but by pairing up
|
| 361 |
+
# the unique 'b's and then matching the first two 'a's.
|
| 362 |
+
|
| 363 |
+
a, b, b2j, isbjunk = self.a, self.b, self.b2j, self.bjunk.__contains__
|
| 364 |
+
if ahi is None:
|
| 365 |
+
ahi = len(a)
|
| 366 |
+
if bhi is None:
|
| 367 |
+
bhi = len(b)
|
| 368 |
+
besti, bestj, bestsize = alo, blo, 0
|
| 369 |
+
# find longest junk-free match
|
| 370 |
+
# during an iteration of the loop, j2len[j] = length of longest
|
| 371 |
+
# junk-free match ending with a[i-1] and b[j]
|
| 372 |
+
j2len = {}
|
| 373 |
+
nothing = []
|
| 374 |
+
for i in range(alo, ahi):
|
| 375 |
+
# look at all instances of a[i] in b; note that because
|
| 376 |
+
# b2j has no junk keys, the loop is skipped if a[i] is junk
|
| 377 |
+
j2lenget = j2len.get
|
| 378 |
+
newj2len = {}
|
| 379 |
+
for j in b2j.get(a[i], nothing):
|
| 380 |
+
# a[i] matches b[j]
|
| 381 |
+
if j < blo:
|
| 382 |
+
continue
|
| 383 |
+
if j >= bhi:
|
| 384 |
+
break
|
| 385 |
+
k = newj2len[j] = j2lenget(j-1, 0) + 1
|
| 386 |
+
if k > bestsize:
|
| 387 |
+
besti, bestj, bestsize = i-k+1, j-k+1, k
|
| 388 |
+
j2len = newj2len
|
| 389 |
+
|
| 390 |
+
# Extend the best by non-junk elements on each end. In particular,
|
| 391 |
+
# "popular" non-junk elements aren't in b2j, which greatly speeds
|
| 392 |
+
# the inner loop above, but also means "the best" match so far
|
| 393 |
+
# doesn't contain any junk *or* popular non-junk elements.
|
| 394 |
+
while besti > alo and bestj > blo and \
|
| 395 |
+
not isbjunk(b[bestj-1]) and \
|
| 396 |
+
a[besti-1] == b[bestj-1]:
|
| 397 |
+
besti, bestj, bestsize = besti-1, bestj-1, bestsize+1
|
| 398 |
+
while besti+bestsize < ahi and bestj+bestsize < bhi and \
|
| 399 |
+
not isbjunk(b[bestj+bestsize]) and \
|
| 400 |
+
a[besti+bestsize] == b[bestj+bestsize]:
|
| 401 |
+
bestsize += 1
|
| 402 |
+
|
| 403 |
+
# Now that we have a wholly interesting match (albeit possibly
|
| 404 |
+
# empty!), we may as well suck up the matching junk on each
|
| 405 |
+
# side of it too. Can't think of a good reason not to, and it
|
| 406 |
+
# saves post-processing the (possibly considerable) expense of
|
| 407 |
+
# figuring out what to do with it. In the case of an empty
|
| 408 |
+
# interesting match, this is clearly the right thing to do,
|
| 409 |
+
# because no other kind of match is possible in the regions.
|
| 410 |
+
while besti > alo and bestj > blo and \
|
| 411 |
+
isbjunk(b[bestj-1]) and \
|
| 412 |
+
a[besti-1] == b[bestj-1]:
|
| 413 |
+
besti, bestj, bestsize = besti-1, bestj-1, bestsize+1
|
| 414 |
+
while besti+bestsize < ahi and bestj+bestsize < bhi and \
|
| 415 |
+
isbjunk(b[bestj+bestsize]) and \
|
| 416 |
+
a[besti+bestsize] == b[bestj+bestsize]:
|
| 417 |
+
bestsize = bestsize + 1
|
| 418 |
+
|
| 419 |
+
return Match(besti, bestj, bestsize)
|
| 420 |
+
|
| 421 |
+
def get_matching_blocks(self):
|
| 422 |
+
"""Return list of triples describing matching subsequences.
|
| 423 |
+
|
| 424 |
+
Each triple is of the form (i, j, n), and means that
|
| 425 |
+
a[i:i+n] == b[j:j+n]. The triples are monotonically increasing in
|
| 426 |
+
i and in j. New in Python 2.5, it's also guaranteed that if
|
| 427 |
+
(i, j, n) and (i', j', n') are adjacent triples in the list, and
|
| 428 |
+
the second is not the last triple in the list, then i+n != i' or
|
| 429 |
+
j+n != j'. IOW, adjacent triples never describe adjacent equal
|
| 430 |
+
blocks.
|
| 431 |
+
|
| 432 |
+
The last triple is a dummy, (len(a), len(b), 0), and is the only
|
| 433 |
+
triple with n==0.
|
| 434 |
+
|
| 435 |
+
>>> s = SequenceMatcher(None, "abxcd", "abcd")
|
| 436 |
+
>>> list(s.get_matching_blocks())
|
| 437 |
+
[Match(a=0, b=0, size=2), Match(a=3, b=2, size=2), Match(a=5, b=4, size=0)]
|
| 438 |
+
"""
|
| 439 |
+
|
| 440 |
+
if self.matching_blocks is not None:
|
| 441 |
+
return self.matching_blocks
|
| 442 |
+
la, lb = len(self.a), len(self.b)
|
| 443 |
+
|
| 444 |
+
# This is most naturally expressed as a recursive algorithm, but
|
| 445 |
+
# at least one user bumped into extreme use cases that exceeded
|
| 446 |
+
# the recursion limit on their box. So, now we maintain a list
|
| 447 |
+
# ('queue`) of blocks we still need to look at, and append partial
|
| 448 |
+
# results to `matching_blocks` in a loop; the matches are sorted
|
| 449 |
+
# at the end.
|
| 450 |
+
queue = [(0, la, 0, lb)]
|
| 451 |
+
matching_blocks = []
|
| 452 |
+
while queue:
|
| 453 |
+
alo, ahi, blo, bhi = queue.pop()
|
| 454 |
+
i, j, k = x = self.find_longest_match(alo, ahi, blo, bhi)
|
| 455 |
+
# a[alo:i] vs b[blo:j] unknown
|
| 456 |
+
# a[i:i+k] same as b[j:j+k]
|
| 457 |
+
# a[i+k:ahi] vs b[j+k:bhi] unknown
|
| 458 |
+
if k: # if k is 0, there was no matching block
|
| 459 |
+
matching_blocks.append(x)
|
| 460 |
+
if alo < i and blo < j:
|
| 461 |
+
queue.append((alo, i, blo, j))
|
| 462 |
+
if i+k < ahi and j+k < bhi:
|
| 463 |
+
queue.append((i+k, ahi, j+k, bhi))
|
| 464 |
+
matching_blocks.sort()
|
| 465 |
+
|
| 466 |
+
# It's possible that we have adjacent equal blocks in the
|
| 467 |
+
# matching_blocks list now. Starting with 2.5, this code was added
|
| 468 |
+
# to collapse them.
|
| 469 |
+
i1 = j1 = k1 = 0
|
| 470 |
+
non_adjacent = []
|
| 471 |
+
for i2, j2, k2 in matching_blocks:
|
| 472 |
+
# Is this block adjacent to i1, j1, k1?
|
| 473 |
+
if i1 + k1 == i2 and j1 + k1 == j2:
|
| 474 |
+
# Yes, so collapse them -- this just increases the length of
|
| 475 |
+
# the first block by the length of the second, and the first
|
| 476 |
+
# block so lengthened remains the block to compare against.
|
| 477 |
+
k1 += k2
|
| 478 |
+
else:
|
| 479 |
+
# Not adjacent. Remember the first block (k1==0 means it's
|
| 480 |
+
# the dummy we started with), and make the second block the
|
| 481 |
+
# new block to compare against.
|
| 482 |
+
if k1:
|
| 483 |
+
non_adjacent.append((i1, j1, k1))
|
| 484 |
+
i1, j1, k1 = i2, j2, k2
|
| 485 |
+
if k1:
|
| 486 |
+
non_adjacent.append((i1, j1, k1))
|
| 487 |
+
|
| 488 |
+
non_adjacent.append( (la, lb, 0) )
|
| 489 |
+
self.matching_blocks = list(map(Match._make, non_adjacent))
|
| 490 |
+
return self.matching_blocks
|
| 491 |
+
|
| 492 |
+
def get_opcodes(self):
|
| 493 |
+
"""Return list of 5-tuples describing how to turn a into b.
|
| 494 |
+
|
| 495 |
+
Each tuple is of the form (tag, i1, i2, j1, j2). The first tuple
|
| 496 |
+
has i1 == j1 == 0, and remaining tuples have i1 == the i2 from the
|
| 497 |
+
tuple preceding it, and likewise for j1 == the previous j2.
|
| 498 |
+
|
| 499 |
+
The tags are strings, with these meanings:
|
| 500 |
+
|
| 501 |
+
'replace': a[i1:i2] should be replaced by b[j1:j2]
|
| 502 |
+
'delete': a[i1:i2] should be deleted.
|
| 503 |
+
Note that j1==j2 in this case.
|
| 504 |
+
'insert': b[j1:j2] should be inserted at a[i1:i1].
|
| 505 |
+
Note that i1==i2 in this case.
|
| 506 |
+
'equal': a[i1:i2] == b[j1:j2]
|
| 507 |
+
|
| 508 |
+
>>> a = "qabxcd"
|
| 509 |
+
>>> b = "abycdf"
|
| 510 |
+
>>> s = SequenceMatcher(None, a, b)
|
| 511 |
+
>>> for tag, i1, i2, j1, j2 in s.get_opcodes():
|
| 512 |
+
... print(("%7s a[%d:%d] (%s) b[%d:%d] (%s)" %
|
| 513 |
+
... (tag, i1, i2, a[i1:i2], j1, j2, b[j1:j2])))
|
| 514 |
+
delete a[0:1] (q) b[0:0] ()
|
| 515 |
+
equal a[1:3] (ab) b[0:2] (ab)
|
| 516 |
+
replace a[3:4] (x) b[2:3] (y)
|
| 517 |
+
equal a[4:6] (cd) b[3:5] (cd)
|
| 518 |
+
insert a[6:6] () b[5:6] (f)
|
| 519 |
+
"""
|
| 520 |
+
|
| 521 |
+
if self.opcodes is not None:
|
| 522 |
+
return self.opcodes
|
| 523 |
+
i = j = 0
|
| 524 |
+
self.opcodes = answer = []
|
| 525 |
+
for ai, bj, size in self.get_matching_blocks():
|
| 526 |
+
# invariant: we've pumped out correct diffs to change
|
| 527 |
+
# a[:i] into b[:j], and the next matching block is
|
| 528 |
+
# a[ai:ai+size] == b[bj:bj+size]. So we need to pump
|
| 529 |
+
# out a diff to change a[i:ai] into b[j:bj], pump out
|
| 530 |
+
# the matching block, and move (i,j) beyond the match
|
| 531 |
+
tag = ''
|
| 532 |
+
if i < ai and j < bj:
|
| 533 |
+
tag = 'replace'
|
| 534 |
+
elif i < ai:
|
| 535 |
+
tag = 'delete'
|
| 536 |
+
elif j < bj:
|
| 537 |
+
tag = 'insert'
|
| 538 |
+
if tag:
|
| 539 |
+
answer.append( (tag, i, ai, j, bj) )
|
| 540 |
+
i, j = ai+size, bj+size
|
| 541 |
+
# the list of matching blocks is terminated by a
|
| 542 |
+
# sentinel with size 0
|
| 543 |
+
if size:
|
| 544 |
+
answer.append( ('equal', ai, i, bj, j) )
|
| 545 |
+
return answer
|
| 546 |
+
|
| 547 |
+
def get_grouped_opcodes(self, n=3):
|
| 548 |
+
""" Isolate change clusters by eliminating ranges with no changes.
|
| 549 |
+
|
| 550 |
+
Return a generator of groups with up to n lines of context.
|
| 551 |
+
Each group is in the same format as returned by get_opcodes().
|
| 552 |
+
|
| 553 |
+
>>> from pprint import pprint
|
| 554 |
+
>>> a = list(map(str, range(1,40)))
|
| 555 |
+
>>> b = a[:]
|
| 556 |
+
>>> b[8:8] = ['i'] # Make an insertion
|
| 557 |
+
>>> b[20] += 'x' # Make a replacement
|
| 558 |
+
>>> b[23:28] = [] # Make a deletion
|
| 559 |
+
>>> b[30] += 'y' # Make another replacement
|
| 560 |
+
>>> pprint(list(SequenceMatcher(None,a,b).get_grouped_opcodes()))
|
| 561 |
+
[[('equal', 5, 8, 5, 8), ('insert', 8, 8, 8, 9), ('equal', 8, 11, 9, 12)],
|
| 562 |
+
[('equal', 16, 19, 17, 20),
|
| 563 |
+
('replace', 19, 20, 20, 21),
|
| 564 |
+
('equal', 20, 22, 21, 23),
|
| 565 |
+
('delete', 22, 27, 23, 23),
|
| 566 |
+
('equal', 27, 30, 23, 26)],
|
| 567 |
+
[('equal', 31, 34, 27, 30),
|
| 568 |
+
('replace', 34, 35, 30, 31),
|
| 569 |
+
('equal', 35, 38, 31, 34)]]
|
| 570 |
+
"""
|
| 571 |
+
|
| 572 |
+
codes = self.get_opcodes()
|
| 573 |
+
if not codes:
|
| 574 |
+
codes = [("equal", 0, 1, 0, 1)]
|
| 575 |
+
# Fixup leading and trailing groups if they show no changes.
|
| 576 |
+
if codes[0][0] == 'equal':
|
| 577 |
+
tag, i1, i2, j1, j2 = codes[0]
|
| 578 |
+
codes[0] = tag, max(i1, i2-n), i2, max(j1, j2-n), j2
|
| 579 |
+
if codes[-1][0] == 'equal':
|
| 580 |
+
tag, i1, i2, j1, j2 = codes[-1]
|
| 581 |
+
codes[-1] = tag, i1, min(i2, i1+n), j1, min(j2, j1+n)
|
| 582 |
+
|
| 583 |
+
nn = n + n
|
| 584 |
+
group = []
|
| 585 |
+
for tag, i1, i2, j1, j2 in codes:
|
| 586 |
+
# End the current group and start a new one whenever
|
| 587 |
+
# there is a large range with no changes.
|
| 588 |
+
if tag == 'equal' and i2-i1 > nn:
|
| 589 |
+
group.append((tag, i1, min(i2, i1+n), j1, min(j2, j1+n)))
|
| 590 |
+
yield group
|
| 591 |
+
group = []
|
| 592 |
+
i1, j1 = max(i1, i2-n), max(j1, j2-n)
|
| 593 |
+
group.append((tag, i1, i2, j1 ,j2))
|
| 594 |
+
if group and not (len(group)==1 and group[0][0] == 'equal'):
|
| 595 |
+
yield group
|
| 596 |
+
|
| 597 |
+
def ratio(self):
|
| 598 |
+
"""Return a measure of the sequences' similarity (float in [0,1]).
|
| 599 |
+
|
| 600 |
+
Where T is the total number of elements in both sequences, and
|
| 601 |
+
M is the number of matches, this is 2.0*M / T.
|
| 602 |
+
Note that this is 1 if the sequences are identical, and 0 if
|
| 603 |
+
they have nothing in common.
|
| 604 |
+
|
| 605 |
+
.ratio() is expensive to compute if you haven't already computed
|
| 606 |
+
.get_matching_blocks() or .get_opcodes(), in which case you may
|
| 607 |
+
want to try .quick_ratio() or .real_quick_ratio() first to get an
|
| 608 |
+
upper bound.
|
| 609 |
+
|
| 610 |
+
>>> s = SequenceMatcher(None, "abcd", "bcde")
|
| 611 |
+
>>> s.ratio()
|
| 612 |
+
0.75
|
| 613 |
+
>>> s.quick_ratio()
|
| 614 |
+
0.75
|
| 615 |
+
>>> s.real_quick_ratio()
|
| 616 |
+
1.0
|
| 617 |
+
"""
|
| 618 |
+
|
| 619 |
+
matches = sum(triple[-1] for triple in self.get_matching_blocks())
|
| 620 |
+
return _calculate_ratio(matches, len(self.a) + len(self.b))
|
| 621 |
+
|
| 622 |
+
def quick_ratio(self):
|
| 623 |
+
"""Return an upper bound on ratio() relatively quickly.
|
| 624 |
+
|
| 625 |
+
This isn't defined beyond that it is an upper bound on .ratio(), and
|
| 626 |
+
is faster to compute.
|
| 627 |
+
"""
|
| 628 |
+
|
| 629 |
+
# viewing a and b as multisets, set matches to the cardinality
|
| 630 |
+
# of their intersection; this counts the number of matches
|
| 631 |
+
# without regard to order, so is clearly an upper bound
|
| 632 |
+
if self.fullbcount is None:
|
| 633 |
+
self.fullbcount = fullbcount = {}
|
| 634 |
+
for elt in self.b:
|
| 635 |
+
fullbcount[elt] = fullbcount.get(elt, 0) + 1
|
| 636 |
+
fullbcount = self.fullbcount
|
| 637 |
+
# avail[x] is the number of times x appears in 'b' less the
|
| 638 |
+
# number of times we've seen it in 'a' so far ... kinda
|
| 639 |
+
avail = {}
|
| 640 |
+
availhas, matches = avail.__contains__, 0
|
| 641 |
+
for elt in self.a:
|
| 642 |
+
if availhas(elt):
|
| 643 |
+
numb = avail[elt]
|
| 644 |
+
else:
|
| 645 |
+
numb = fullbcount.get(elt, 0)
|
| 646 |
+
avail[elt] = numb - 1
|
| 647 |
+
if numb > 0:
|
| 648 |
+
matches = matches + 1
|
| 649 |
+
return _calculate_ratio(matches, len(self.a) + len(self.b))
|
| 650 |
+
|
| 651 |
+
def real_quick_ratio(self):
|
| 652 |
+
"""Return an upper bound on ratio() very quickly.
|
| 653 |
+
|
| 654 |
+
This isn't defined beyond that it is an upper bound on .ratio(), and
|
| 655 |
+
is faster to compute than either .ratio() or .quick_ratio().
|
| 656 |
+
"""
|
| 657 |
+
|
| 658 |
+
la, lb = len(self.a), len(self.b)
|
| 659 |
+
# can't have more matches than the number of elements in the
|
| 660 |
+
# shorter sequence
|
| 661 |
+
return _calculate_ratio(min(la, lb), la + lb)
|
| 662 |
+
|
| 663 |
+
__class_getitem__ = classmethod(GenericAlias)
|
| 664 |
+
|
| 665 |
+
|
| 666 |
+
def get_close_matches(word, possibilities, n=3, cutoff=0.6):
|
| 667 |
+
"""Use SequenceMatcher to return list of the best "good enough" matches.
|
| 668 |
+
|
| 669 |
+
word is a sequence for which close matches are desired (typically a
|
| 670 |
+
string).
|
| 671 |
+
|
| 672 |
+
possibilities is a list of sequences against which to match word
|
| 673 |
+
(typically a list of strings).
|
| 674 |
+
|
| 675 |
+
Optional arg n (default 3) is the maximum number of close matches to
|
| 676 |
+
return. n must be > 0.
|
| 677 |
+
|
| 678 |
+
Optional arg cutoff (default 0.6) is a float in [0, 1]. Possibilities
|
| 679 |
+
that don't score at least that similar to word are ignored.
|
| 680 |
+
|
| 681 |
+
The best (no more than n) matches among the possibilities are returned
|
| 682 |
+
in a list, sorted by similarity score, most similar first.
|
| 683 |
+
|
| 684 |
+
>>> get_close_matches("appel", ["ape", "apple", "peach", "puppy"])
|
| 685 |
+
['apple', 'ape']
|
| 686 |
+
>>> import keyword as _keyword
|
| 687 |
+
>>> get_close_matches("wheel", _keyword.kwlist)
|
| 688 |
+
['while']
|
| 689 |
+
>>> get_close_matches("Apple", _keyword.kwlist)
|
| 690 |
+
[]
|
| 691 |
+
>>> get_close_matches("accept", _keyword.kwlist)
|
| 692 |
+
['except']
|
| 693 |
+
"""
|
| 694 |
+
|
| 695 |
+
if not n > 0:
|
| 696 |
+
raise ValueError("n must be > 0: %r" % (n,))
|
| 697 |
+
if not 0.0 <= cutoff <= 1.0:
|
| 698 |
+
raise ValueError("cutoff must be in [0.0, 1.0]: %r" % (cutoff,))
|
| 699 |
+
result = []
|
| 700 |
+
s = SequenceMatcher()
|
| 701 |
+
s.set_seq2(word)
|
| 702 |
+
for x in possibilities:
|
| 703 |
+
s.set_seq1(x)
|
| 704 |
+
if s.real_quick_ratio() >= cutoff and \
|
| 705 |
+
s.quick_ratio() >= cutoff and \
|
| 706 |
+
s.ratio() >= cutoff:
|
| 707 |
+
result.append((s.ratio(), x))
|
| 708 |
+
|
| 709 |
+
# Move the best scorers to head of list
|
| 710 |
+
result = _nlargest(n, result)
|
| 711 |
+
# Strip scores for the best n matches
|
| 712 |
+
return [x for score, x in result]
|
| 713 |
+
|
| 714 |
+
|
| 715 |
+
def _keep_original_ws(s, tag_s):
|
| 716 |
+
"""Replace whitespace with the original whitespace characters in `s`"""
|
| 717 |
+
return ''.join(
|
| 718 |
+
c if tag_c == " " and c.isspace() else tag_c
|
| 719 |
+
for c, tag_c in zip(s, tag_s)
|
| 720 |
+
)
|
| 721 |
+
|
| 722 |
+
|
| 723 |
+
|
| 724 |
+
class Differ:
|
| 725 |
+
r"""
|
| 726 |
+
Differ is a class for comparing sequences of lines of text, and
|
| 727 |
+
producing human-readable differences or deltas. Differ uses
|
| 728 |
+
SequenceMatcher both to compare sequences of lines, and to compare
|
| 729 |
+
sequences of characters within similar (near-matching) lines.
|
| 730 |
+
|
| 731 |
+
Each line of a Differ delta begins with a two-letter code:
|
| 732 |
+
|
| 733 |
+
'- ' line unique to sequence 1
|
| 734 |
+
'+ ' line unique to sequence 2
|
| 735 |
+
' ' line common to both sequences
|
| 736 |
+
'? ' line not present in either input sequence
|
| 737 |
+
|
| 738 |
+
Lines beginning with '? ' attempt to guide the eye to intraline
|
| 739 |
+
differences, and were not present in either input sequence. These lines
|
| 740 |
+
can be confusing if the sequences contain tab characters.
|
| 741 |
+
|
| 742 |
+
Note that Differ makes no claim to produce a *minimal* diff. To the
|
| 743 |
+
contrary, minimal diffs are often counter-intuitive, because they synch
|
| 744 |
+
up anywhere possible, sometimes accidental matches 100 pages apart.
|
| 745 |
+
Restricting synch points to contiguous matches preserves some notion of
|
| 746 |
+
locality, at the occasional cost of producing a longer diff.
|
| 747 |
+
|
| 748 |
+
Example: Comparing two texts.
|
| 749 |
+
|
| 750 |
+
First we set up the texts, sequences of individual single-line strings
|
| 751 |
+
ending with newlines (such sequences can also be obtained from the
|
| 752 |
+
`readlines()` method of file-like objects):
|
| 753 |
+
|
| 754 |
+
>>> text1 = ''' 1. Beautiful is better than ugly.
|
| 755 |
+
... 2. Explicit is better than implicit.
|
| 756 |
+
... 3. Simple is better than complex.
|
| 757 |
+
... 4. Complex is better than complicated.
|
| 758 |
+
... '''.splitlines(keepends=True)
|
| 759 |
+
>>> len(text1)
|
| 760 |
+
4
|
| 761 |
+
>>> text1[0][-1]
|
| 762 |
+
'\n'
|
| 763 |
+
>>> text2 = ''' 1. Beautiful is better than ugly.
|
| 764 |
+
... 3. Simple is better than complex.
|
| 765 |
+
... 4. Complicated is better than complex.
|
| 766 |
+
... 5. Flat is better than nested.
|
| 767 |
+
... '''.splitlines(keepends=True)
|
| 768 |
+
|
| 769 |
+
Next we instantiate a Differ object:
|
| 770 |
+
|
| 771 |
+
>>> d = Differ()
|
| 772 |
+
|
| 773 |
+
Note that when instantiating a Differ object we may pass functions to
|
| 774 |
+
filter out line and character 'junk'. See Differ.__init__ for details.
|
| 775 |
+
|
| 776 |
+
Finally, we compare the two:
|
| 777 |
+
|
| 778 |
+
>>> result = list(d.compare(text1, text2))
|
| 779 |
+
|
| 780 |
+
'result' is a list of strings, so let's pretty-print it:
|
| 781 |
+
|
| 782 |
+
>>> from pprint import pprint as _pprint
|
| 783 |
+
>>> _pprint(result)
|
| 784 |
+
[' 1. Beautiful is better than ugly.\n',
|
| 785 |
+
'- 2. Explicit is better than implicit.\n',
|
| 786 |
+
'- 3. Simple is better than complex.\n',
|
| 787 |
+
'+ 3. Simple is better than complex.\n',
|
| 788 |
+
'? ++\n',
|
| 789 |
+
'- 4. Complex is better than complicated.\n',
|
| 790 |
+
'? ^ ---- ^\n',
|
| 791 |
+
'+ 4. Complicated is better than complex.\n',
|
| 792 |
+
'? ++++ ^ ^\n',
|
| 793 |
+
'+ 5. Flat is better than nested.\n']
|
| 794 |
+
|
| 795 |
+
As a single multi-line string it looks like this:
|
| 796 |
+
|
| 797 |
+
>>> print(''.join(result), end="")
|
| 798 |
+
1. Beautiful is better than ugly.
|
| 799 |
+
- 2. Explicit is better than implicit.
|
| 800 |
+
- 3. Simple is better than complex.
|
| 801 |
+
+ 3. Simple is better than complex.
|
| 802 |
+
? ++
|
| 803 |
+
- 4. Complex is better than complicated.
|
| 804 |
+
? ^ ---- ^
|
| 805 |
+
+ 4. Complicated is better than complex.
|
| 806 |
+
? ++++ ^ ^
|
| 807 |
+
+ 5. Flat is better than nested.
|
| 808 |
+
"""
|
| 809 |
+
|
| 810 |
+
def __init__(self, linejunk=None, charjunk=None):
|
| 811 |
+
"""
|
| 812 |
+
Construct a text differencer, with optional filters.
|
| 813 |
+
|
| 814 |
+
The two optional keyword parameters are for filter functions:
|
| 815 |
+
|
| 816 |
+
- `linejunk`: A function that should accept a single string argument,
|
| 817 |
+
and return true iff the string is junk. The module-level function
|
| 818 |
+
`IS_LINE_JUNK` may be used to filter out lines without visible
|
| 819 |
+
characters, except for at most one splat ('#'). It is recommended
|
| 820 |
+
to leave linejunk None; the underlying SequenceMatcher class has
|
| 821 |
+
an adaptive notion of "noise" lines that's better than any static
|
| 822 |
+
definition the author has ever been able to craft.
|
| 823 |
+
|
| 824 |
+
- `charjunk`: A function that should accept a string of length 1. The
|
| 825 |
+
module-level function `IS_CHARACTER_JUNK` may be used to filter out
|
| 826 |
+
whitespace characters (a blank or tab; **note**: bad idea to include
|
| 827 |
+
newline in this!). Use of IS_CHARACTER_JUNK is recommended.
|
| 828 |
+
"""
|
| 829 |
+
|
| 830 |
+
self.linejunk = linejunk
|
| 831 |
+
self.charjunk = charjunk
|
| 832 |
+
|
| 833 |
+
def compare(self, a, b):
|
| 834 |
+
r"""
|
| 835 |
+
Compare two sequences of lines; generate the resulting delta.
|
| 836 |
+
|
| 837 |
+
Each sequence must contain individual single-line strings ending with
|
| 838 |
+
newlines. Such sequences can be obtained from the `readlines()` method
|
| 839 |
+
of file-like objects. The delta generated also consists of newline-
|
| 840 |
+
terminated strings, ready to be printed as-is via the writelines()
|
| 841 |
+
method of a file-like object.
|
| 842 |
+
|
| 843 |
+
Example:
|
| 844 |
+
|
| 845 |
+
>>> print(''.join(Differ().compare('one\ntwo\nthree\n'.splitlines(True),
|
| 846 |
+
... 'ore\ntree\nemu\n'.splitlines(True))),
|
| 847 |
+
... end="")
|
| 848 |
+
- one
|
| 849 |
+
? ^
|
| 850 |
+
+ ore
|
| 851 |
+
? ^
|
| 852 |
+
- two
|
| 853 |
+
- three
|
| 854 |
+
? -
|
| 855 |
+
+ tree
|
| 856 |
+
+ emu
|
| 857 |
+
"""
|
| 858 |
+
|
| 859 |
+
cruncher = SequenceMatcher(self.linejunk, a, b)
|
| 860 |
+
for tag, alo, ahi, blo, bhi in cruncher.get_opcodes():
|
| 861 |
+
if tag == 'replace':
|
| 862 |
+
g = self._fancy_replace(a, alo, ahi, b, blo, bhi)
|
| 863 |
+
elif tag == 'delete':
|
| 864 |
+
g = self._dump('-', a, alo, ahi)
|
| 865 |
+
elif tag == 'insert':
|
| 866 |
+
g = self._dump('+', b, blo, bhi)
|
| 867 |
+
elif tag == 'equal':
|
| 868 |
+
g = self._dump(' ', a, alo, ahi)
|
| 869 |
+
else:
|
| 870 |
+
raise ValueError('unknown tag %r' % (tag,))
|
| 871 |
+
|
| 872 |
+
yield from g
|
| 873 |
+
|
| 874 |
+
def _dump(self, tag, x, lo, hi):
|
| 875 |
+
"""Generate comparison results for a same-tagged range."""
|
| 876 |
+
for i in range(lo, hi):
|
| 877 |
+
yield '%s %s' % (tag, x[i])
|
| 878 |
+
|
| 879 |
+
def _plain_replace(self, a, alo, ahi, b, blo, bhi):
|
| 880 |
+
assert alo < ahi and blo < bhi
|
| 881 |
+
# dump the shorter block first -- reduces the burden on short-term
|
| 882 |
+
# memory if the blocks are of very different sizes
|
| 883 |
+
if bhi - blo < ahi - alo:
|
| 884 |
+
first = self._dump('+', b, blo, bhi)
|
| 885 |
+
second = self._dump('-', a, alo, ahi)
|
| 886 |
+
else:
|
| 887 |
+
first = self._dump('-', a, alo, ahi)
|
| 888 |
+
second = self._dump('+', b, blo, bhi)
|
| 889 |
+
|
| 890 |
+
for g in first, second:
|
| 891 |
+
yield from g
|
| 892 |
+
|
| 893 |
+
def _fancy_replace(self, a, alo, ahi, b, blo, bhi):
|
| 894 |
+
r"""
|
| 895 |
+
When replacing one block of lines with another, search the blocks
|
| 896 |
+
for *similar* lines; the best-matching pair (if any) is used as a
|
| 897 |
+
synch point, and intraline difference marking is done on the
|
| 898 |
+
similar pair. Lots of work, but often worth it.
|
| 899 |
+
|
| 900 |
+
Example:
|
| 901 |
+
|
| 902 |
+
>>> d = Differ()
|
| 903 |
+
>>> results = d._fancy_replace(['abcDefghiJkl\n'], 0, 1,
|
| 904 |
+
... ['abcdefGhijkl\n'], 0, 1)
|
| 905 |
+
>>> print(''.join(results), end="")
|
| 906 |
+
- abcDefghiJkl
|
| 907 |
+
? ^ ^ ^
|
| 908 |
+
+ abcdefGhijkl
|
| 909 |
+
? ^ ^ ^
|
| 910 |
+
"""
|
| 911 |
+
|
| 912 |
+
# don't synch up unless the lines have a similarity score of at
|
| 913 |
+
# least cutoff; best_ratio tracks the best score seen so far
|
| 914 |
+
best_ratio, cutoff = 0.74, 0.75
|
| 915 |
+
cruncher = SequenceMatcher(self.charjunk)
|
| 916 |
+
eqi, eqj = None, None # 1st indices of equal lines (if any)
|
| 917 |
+
|
| 918 |
+
# search for the pair that matches best without being identical
|
| 919 |
+
# (identical lines must be junk lines, & we don't want to synch up
|
| 920 |
+
# on junk -- unless we have to)
|
| 921 |
+
for j in range(blo, bhi):
|
| 922 |
+
bj = b[j]
|
| 923 |
+
cruncher.set_seq2(bj)
|
| 924 |
+
for i in range(alo, ahi):
|
| 925 |
+
ai = a[i]
|
| 926 |
+
if ai == bj:
|
| 927 |
+
if eqi is None:
|
| 928 |
+
eqi, eqj = i, j
|
| 929 |
+
continue
|
| 930 |
+
cruncher.set_seq1(ai)
|
| 931 |
+
# computing similarity is expensive, so use the quick
|
| 932 |
+
# upper bounds first -- have seen this speed up messy
|
| 933 |
+
# compares by a factor of 3.
|
| 934 |
+
# note that ratio() is only expensive to compute the first
|
| 935 |
+
# time it's called on a sequence pair; the expensive part
|
| 936 |
+
# of the computation is cached by cruncher
|
| 937 |
+
if cruncher.real_quick_ratio() > best_ratio and \
|
| 938 |
+
cruncher.quick_ratio() > best_ratio and \
|
| 939 |
+
cruncher.ratio() > best_ratio:
|
| 940 |
+
best_ratio, best_i, best_j = cruncher.ratio(), i, j
|
| 941 |
+
if best_ratio < cutoff:
|
| 942 |
+
# no non-identical "pretty close" pair
|
| 943 |
+
if eqi is None:
|
| 944 |
+
# no identical pair either -- treat it as a straight replace
|
| 945 |
+
yield from self._plain_replace(a, alo, ahi, b, blo, bhi)
|
| 946 |
+
return
|
| 947 |
+
# no close pair, but an identical pair -- synch up on that
|
| 948 |
+
best_i, best_j, best_ratio = eqi, eqj, 1.0
|
| 949 |
+
else:
|
| 950 |
+
# there's a close pair, so forget the identical pair (if any)
|
| 951 |
+
eqi = None
|
| 952 |
+
|
| 953 |
+
# a[best_i] very similar to b[best_j]; eqi is None iff they're not
|
| 954 |
+
# identical
|
| 955 |
+
|
| 956 |
+
# pump out diffs from before the synch point
|
| 957 |
+
yield from self._fancy_helper(a, alo, best_i, b, blo, best_j)
|
| 958 |
+
|
| 959 |
+
# do intraline marking on the synch pair
|
| 960 |
+
aelt, belt = a[best_i], b[best_j]
|
| 961 |
+
if eqi is None:
|
| 962 |
+
# pump out a '-', '?', '+', '?' quad for the synched lines
|
| 963 |
+
atags = btags = ""
|
| 964 |
+
cruncher.set_seqs(aelt, belt)
|
| 965 |
+
for tag, ai1, ai2, bj1, bj2 in cruncher.get_opcodes():
|
| 966 |
+
la, lb = ai2 - ai1, bj2 - bj1
|
| 967 |
+
if tag == 'replace':
|
| 968 |
+
atags += '^' * la
|
| 969 |
+
btags += '^' * lb
|
| 970 |
+
elif tag == 'delete':
|
| 971 |
+
atags += '-' * la
|
| 972 |
+
elif tag == 'insert':
|
| 973 |
+
btags += '+' * lb
|
| 974 |
+
elif tag == 'equal':
|
| 975 |
+
atags += ' ' * la
|
| 976 |
+
btags += ' ' * lb
|
| 977 |
+
else:
|
| 978 |
+
raise ValueError('unknown tag %r' % (tag,))
|
| 979 |
+
yield from self._qformat(aelt, belt, atags, btags)
|
| 980 |
+
else:
|
| 981 |
+
# the synch pair is identical
|
| 982 |
+
yield ' ' + aelt
|
| 983 |
+
|
| 984 |
+
# pump out diffs from after the synch point
|
| 985 |
+
yield from self._fancy_helper(a, best_i+1, ahi, b, best_j+1, bhi)
|
| 986 |
+
|
| 987 |
+
def _fancy_helper(self, a, alo, ahi, b, blo, bhi):
|
| 988 |
+
g = []
|
| 989 |
+
if alo < ahi:
|
| 990 |
+
if blo < bhi:
|
| 991 |
+
g = self._fancy_replace(a, alo, ahi, b, blo, bhi)
|
| 992 |
+
else:
|
| 993 |
+
g = self._dump('-', a, alo, ahi)
|
| 994 |
+
elif blo < bhi:
|
| 995 |
+
g = self._dump('+', b, blo, bhi)
|
| 996 |
+
|
| 997 |
+
yield from g
|
| 998 |
+
|
| 999 |
+
def _qformat(self, aline, bline, atags, btags):
|
| 1000 |
+
r"""
|
| 1001 |
+
Format "?" output and deal with tabs.
|
| 1002 |
+
|
| 1003 |
+
Example:
|
| 1004 |
+
|
| 1005 |
+
>>> d = Differ()
|
| 1006 |
+
>>> results = d._qformat('\tabcDefghiJkl\n', '\tabcdefGhijkl\n',
|
| 1007 |
+
... ' ^ ^ ^ ', ' ^ ^ ^ ')
|
| 1008 |
+
>>> for line in results: print(repr(line))
|
| 1009 |
+
...
|
| 1010 |
+
'- \tabcDefghiJkl\n'
|
| 1011 |
+
'? \t ^ ^ ^\n'
|
| 1012 |
+
'+ \tabcdefGhijkl\n'
|
| 1013 |
+
'? \t ^ ^ ^\n'
|
| 1014 |
+
"""
|
| 1015 |
+
atags = _keep_original_ws(aline, atags).rstrip()
|
| 1016 |
+
btags = _keep_original_ws(bline, btags).rstrip()
|
| 1017 |
+
|
| 1018 |
+
yield "- " + aline
|
| 1019 |
+
if atags:
|
| 1020 |
+
yield f"? {atags}\n"
|
| 1021 |
+
|
| 1022 |
+
yield "+ " + bline
|
| 1023 |
+
if btags:
|
| 1024 |
+
yield f"? {btags}\n"
|
| 1025 |
+
|
| 1026 |
+
# With respect to junk, an earlier version of ndiff simply refused to
|
| 1027 |
+
# *start* a match with a junk element. The result was cases like this:
|
| 1028 |
+
# before: private Thread currentThread;
|
| 1029 |
+
# after: private volatile Thread currentThread;
|
| 1030 |
+
# If you consider whitespace to be junk, the longest contiguous match
|
| 1031 |
+
# not starting with junk is "e Thread currentThread". So ndiff reported
|
| 1032 |
+
# that "e volatil" was inserted between the 't' and the 'e' in "private".
|
| 1033 |
+
# While an accurate view, to people that's absurd. The current version
|
| 1034 |
+
# looks for matching blocks that are entirely junk-free, then extends the
|
| 1035 |
+
# longest one of those as far as possible but only with matching junk.
|
| 1036 |
+
# So now "currentThread" is matched, then extended to suck up the
|
| 1037 |
+
# preceding blank; then "private" is matched, and extended to suck up the
|
| 1038 |
+
# following blank; then "Thread" is matched; and finally ndiff reports
|
| 1039 |
+
# that "volatile " was inserted before "Thread". The only quibble
|
| 1040 |
+
# remaining is that perhaps it was really the case that " volatile"
|
| 1041 |
+
# was inserted after "private". I can live with that <wink>.
|
| 1042 |
+
|
| 1043 |
+
import re
|
| 1044 |
+
|
| 1045 |
+
def IS_LINE_JUNK(line, pat=re.compile(r"\s*(?:#\s*)?$").match):
|
| 1046 |
+
r"""
|
| 1047 |
+
Return True for ignorable line: iff `line` is blank or contains a single '#'.
|
| 1048 |
+
|
| 1049 |
+
Examples:
|
| 1050 |
+
|
| 1051 |
+
>>> IS_LINE_JUNK('\n')
|
| 1052 |
+
True
|
| 1053 |
+
>>> IS_LINE_JUNK(' # \n')
|
| 1054 |
+
True
|
| 1055 |
+
>>> IS_LINE_JUNK('hello\n')
|
| 1056 |
+
False
|
| 1057 |
+
"""
|
| 1058 |
+
|
| 1059 |
+
return pat(line) is not None
|
| 1060 |
+
|
| 1061 |
+
def IS_CHARACTER_JUNK(ch, ws=" \t"):
|
| 1062 |
+
r"""
|
| 1063 |
+
Return True for ignorable character: iff `ch` is a space or tab.
|
| 1064 |
+
|
| 1065 |
+
Examples:
|
| 1066 |
+
|
| 1067 |
+
>>> IS_CHARACTER_JUNK(' ')
|
| 1068 |
+
True
|
| 1069 |
+
>>> IS_CHARACTER_JUNK('\t')
|
| 1070 |
+
True
|
| 1071 |
+
>>> IS_CHARACTER_JUNK('\n')
|
| 1072 |
+
False
|
| 1073 |
+
>>> IS_CHARACTER_JUNK('x')
|
| 1074 |
+
False
|
| 1075 |
+
"""
|
| 1076 |
+
|
| 1077 |
+
return ch in ws
|
| 1078 |
+
|
| 1079 |
+
|
| 1080 |
+
########################################################################
|
| 1081 |
+
### Unified Diff
|
| 1082 |
+
########################################################################
|
| 1083 |
+
|
| 1084 |
+
def _format_range_unified(start, stop):
|
| 1085 |
+
'Convert range to the "ed" format'
|
| 1086 |
+
# Per the diff spec at http://www.unix.org/single_unix_specification/
|
| 1087 |
+
beginning = start + 1 # lines start numbering with one
|
| 1088 |
+
length = stop - start
|
| 1089 |
+
if length == 1:
|
| 1090 |
+
return '{}'.format(beginning)
|
| 1091 |
+
if not length:
|
| 1092 |
+
beginning -= 1 # empty ranges begin at line just before the range
|
| 1093 |
+
return '{},{}'.format(beginning, length)
|
| 1094 |
+
|
| 1095 |
+
def unified_diff(a, b, fromfile='', tofile='', fromfiledate='',
|
| 1096 |
+
tofiledate='', n=3, lineterm='\n'):
|
| 1097 |
+
r"""
|
| 1098 |
+
Compare two sequences of lines; generate the delta as a unified diff.
|
| 1099 |
+
|
| 1100 |
+
Unified diffs are a compact way of showing line changes and a few
|
| 1101 |
+
lines of context. The number of context lines is set by 'n' which
|
| 1102 |
+
defaults to three.
|
| 1103 |
+
|
| 1104 |
+
By default, the diff control lines (those with ---, +++, or @@) are
|
| 1105 |
+
created with a trailing newline. This is helpful so that inputs
|
| 1106 |
+
created from file.readlines() result in diffs that are suitable for
|
| 1107 |
+
file.writelines() since both the inputs and outputs have trailing
|
| 1108 |
+
newlines.
|
| 1109 |
+
|
| 1110 |
+
For inputs that do not have trailing newlines, set the lineterm
|
| 1111 |
+
argument to "" so that the output will be uniformly newline free.
|
| 1112 |
+
|
| 1113 |
+
The unidiff format normally has a header for filenames and modification
|
| 1114 |
+
times. Any or all of these may be specified using strings for
|
| 1115 |
+
'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'.
|
| 1116 |
+
The modification times are normally expressed in the ISO 8601 format.
|
| 1117 |
+
|
| 1118 |
+
Example:
|
| 1119 |
+
|
| 1120 |
+
>>> for line in unified_diff('one two three four'.split(),
|
| 1121 |
+
... 'zero one tree four'.split(), 'Original', 'Current',
|
| 1122 |
+
... '2005-01-26 23:30:50', '2010-04-02 10:20:52',
|
| 1123 |
+
... lineterm=''):
|
| 1124 |
+
... print(line) # doctest: +NORMALIZE_WHITESPACE
|
| 1125 |
+
--- Original 2005-01-26 23:30:50
|
| 1126 |
+
+++ Current 2010-04-02 10:20:52
|
| 1127 |
+
@@ -1,4 +1,4 @@
|
| 1128 |
+
+zero
|
| 1129 |
+
one
|
| 1130 |
+
-two
|
| 1131 |
+
-three
|
| 1132 |
+
+tree
|
| 1133 |
+
four
|
| 1134 |
+
"""
|
| 1135 |
+
|
| 1136 |
+
_check_types(a, b, fromfile, tofile, fromfiledate, tofiledate, lineterm)
|
| 1137 |
+
started = False
|
| 1138 |
+
for group in SequenceMatcher(None,a,b).get_grouped_opcodes(n):
|
| 1139 |
+
if not started:
|
| 1140 |
+
started = True
|
| 1141 |
+
fromdate = '\t{}'.format(fromfiledate) if fromfiledate else ''
|
| 1142 |
+
todate = '\t{}'.format(tofiledate) if tofiledate else ''
|
| 1143 |
+
yield '--- {}{}{}'.format(fromfile, fromdate, lineterm)
|
| 1144 |
+
yield '+++ {}{}{}'.format(tofile, todate, lineterm)
|
| 1145 |
+
|
| 1146 |
+
first, last = group[0], group[-1]
|
| 1147 |
+
file1_range = _format_range_unified(first[1], last[2])
|
| 1148 |
+
file2_range = _format_range_unified(first[3], last[4])
|
| 1149 |
+
yield '@@ -{} +{} @@{}'.format(file1_range, file2_range, lineterm)
|
| 1150 |
+
|
| 1151 |
+
for tag, i1, i2, j1, j2 in group:
|
| 1152 |
+
if tag == 'equal':
|
| 1153 |
+
for line in a[i1:i2]:
|
| 1154 |
+
yield ' ' + line
|
| 1155 |
+
continue
|
| 1156 |
+
if tag in {'replace', 'delete'}:
|
| 1157 |
+
for line in a[i1:i2]:
|
| 1158 |
+
yield '-' + line
|
| 1159 |
+
if tag in {'replace', 'insert'}:
|
| 1160 |
+
for line in b[j1:j2]:
|
| 1161 |
+
yield '+' + line
|
| 1162 |
+
|
| 1163 |
+
|
| 1164 |
+
########################################################################
|
| 1165 |
+
### Context Diff
|
| 1166 |
+
########################################################################
|
| 1167 |
+
|
| 1168 |
+
def _format_range_context(start, stop):
|
| 1169 |
+
'Convert range to the "ed" format'
|
| 1170 |
+
# Per the diff spec at http://www.unix.org/single_unix_specification/
|
| 1171 |
+
beginning = start + 1 # lines start numbering with one
|
| 1172 |
+
length = stop - start
|
| 1173 |
+
if not length:
|
| 1174 |
+
beginning -= 1 # empty ranges begin at line just before the range
|
| 1175 |
+
if length <= 1:
|
| 1176 |
+
return '{}'.format(beginning)
|
| 1177 |
+
return '{},{}'.format(beginning, beginning + length - 1)
|
| 1178 |
+
|
| 1179 |
+
# See http://www.unix.org/single_unix_specification/
|
| 1180 |
+
def context_diff(a, b, fromfile='', tofile='',
|
| 1181 |
+
fromfiledate='', tofiledate='', n=3, lineterm='\n'):
|
| 1182 |
+
r"""
|
| 1183 |
+
Compare two sequences of lines; generate the delta as a context diff.
|
| 1184 |
+
|
| 1185 |
+
Context diffs are a compact way of showing line changes and a few
|
| 1186 |
+
lines of context. The number of context lines is set by 'n' which
|
| 1187 |
+
defaults to three.
|
| 1188 |
+
|
| 1189 |
+
By default, the diff control lines (those with *** or ---) are
|
| 1190 |
+
created with a trailing newline. This is helpful so that inputs
|
| 1191 |
+
created from file.readlines() result in diffs that are suitable for
|
| 1192 |
+
file.writelines() since both the inputs and outputs have trailing
|
| 1193 |
+
newlines.
|
| 1194 |
+
|
| 1195 |
+
For inputs that do not have trailing newlines, set the lineterm
|
| 1196 |
+
argument to "" so that the output will be uniformly newline free.
|
| 1197 |
+
|
| 1198 |
+
The context diff format normally has a header for filenames and
|
| 1199 |
+
modification times. Any or all of these may be specified using
|
| 1200 |
+
strings for 'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'.
|
| 1201 |
+
The modification times are normally expressed in the ISO 8601 format.
|
| 1202 |
+
If not specified, the strings default to blanks.
|
| 1203 |
+
|
| 1204 |
+
Example:
|
| 1205 |
+
|
| 1206 |
+
>>> print(''.join(context_diff('one\ntwo\nthree\nfour\n'.splitlines(True),
|
| 1207 |
+
... 'zero\none\ntree\nfour\n'.splitlines(True), 'Original', 'Current')),
|
| 1208 |
+
... end="")
|
| 1209 |
+
*** Original
|
| 1210 |
+
--- Current
|
| 1211 |
+
***************
|
| 1212 |
+
*** 1,4 ****
|
| 1213 |
+
one
|
| 1214 |
+
! two
|
| 1215 |
+
! three
|
| 1216 |
+
four
|
| 1217 |
+
--- 1,4 ----
|
| 1218 |
+
+ zero
|
| 1219 |
+
one
|
| 1220 |
+
! tree
|
| 1221 |
+
four
|
| 1222 |
+
"""
|
| 1223 |
+
|
| 1224 |
+
_check_types(a, b, fromfile, tofile, fromfiledate, tofiledate, lineterm)
|
| 1225 |
+
prefix = dict(insert='+ ', delete='- ', replace='! ', equal=' ')
|
| 1226 |
+
started = False
|
| 1227 |
+
for group in SequenceMatcher(None,a,b).get_grouped_opcodes(n):
|
| 1228 |
+
if not started:
|
| 1229 |
+
started = True
|
| 1230 |
+
fromdate = '\t{}'.format(fromfiledate) if fromfiledate else ''
|
| 1231 |
+
todate = '\t{}'.format(tofiledate) if tofiledate else ''
|
| 1232 |
+
yield '*** {}{}{}'.format(fromfile, fromdate, lineterm)
|
| 1233 |
+
yield '--- {}{}{}'.format(tofile, todate, lineterm)
|
| 1234 |
+
|
| 1235 |
+
first, last = group[0], group[-1]
|
| 1236 |
+
yield '***************' + lineterm
|
| 1237 |
+
|
| 1238 |
+
file1_range = _format_range_context(first[1], last[2])
|
| 1239 |
+
yield '*** {} ****{}'.format(file1_range, lineterm)
|
| 1240 |
+
|
| 1241 |
+
if any(tag in {'replace', 'delete'} for tag, _, _, _, _ in group):
|
| 1242 |
+
for tag, i1, i2, _, _ in group:
|
| 1243 |
+
if tag != 'insert':
|
| 1244 |
+
for line in a[i1:i2]:
|
| 1245 |
+
yield prefix[tag] + line
|
| 1246 |
+
|
| 1247 |
+
file2_range = _format_range_context(first[3], last[4])
|
| 1248 |
+
yield '--- {} ----{}'.format(file2_range, lineterm)
|
| 1249 |
+
|
| 1250 |
+
if any(tag in {'replace', 'insert'} for tag, _, _, _, _ in group):
|
| 1251 |
+
for tag, _, _, j1, j2 in group:
|
| 1252 |
+
if tag != 'delete':
|
| 1253 |
+
for line in b[j1:j2]:
|
| 1254 |
+
yield prefix[tag] + line
|
| 1255 |
+
|
| 1256 |
+
def _check_types(a, b, *args):
|
| 1257 |
+
# Checking types is weird, but the alternative is garbled output when
|
| 1258 |
+
# someone passes mixed bytes and str to {unified,context}_diff(). E.g.
|
| 1259 |
+
# without this check, passing filenames as bytes results in output like
|
| 1260 |
+
# --- b'oldfile.txt'
|
| 1261 |
+
# +++ b'newfile.txt'
|
| 1262 |
+
# because of how str.format() incorporates bytes objects.
|
| 1263 |
+
if a and not isinstance(a[0], str):
|
| 1264 |
+
raise TypeError('lines to compare must be str, not %s (%r)' %
|
| 1265 |
+
(type(a[0]).__name__, a[0]))
|
| 1266 |
+
if b and not isinstance(b[0], str):
|
| 1267 |
+
raise TypeError('lines to compare must be str, not %s (%r)' %
|
| 1268 |
+
(type(b[0]).__name__, b[0]))
|
| 1269 |
+
for arg in args:
|
| 1270 |
+
if not isinstance(arg, str):
|
| 1271 |
+
raise TypeError('all arguments must be str, not: %r' % (arg,))
|
| 1272 |
+
|
| 1273 |
+
def diff_bytes(dfunc, a, b, fromfile=b'', tofile=b'',
|
| 1274 |
+
fromfiledate=b'', tofiledate=b'', n=3, lineterm=b'\n'):
|
| 1275 |
+
r"""
|
| 1276 |
+
Compare `a` and `b`, two sequences of lines represented as bytes rather
|
| 1277 |
+
than str. This is a wrapper for `dfunc`, which is typically either
|
| 1278 |
+
unified_diff() or context_diff(). Inputs are losslessly converted to
|
| 1279 |
+
strings so that `dfunc` only has to worry about strings, and encoded
|
| 1280 |
+
back to bytes on return. This is necessary to compare files with
|
| 1281 |
+
unknown or inconsistent encoding. All other inputs (except `n`) must be
|
| 1282 |
+
bytes rather than str.
|
| 1283 |
+
"""
|
| 1284 |
+
def decode(s):
|
| 1285 |
+
try:
|
| 1286 |
+
return s.decode('ascii', 'surrogateescape')
|
| 1287 |
+
except AttributeError as err:
|
| 1288 |
+
msg = ('all arguments must be bytes, not %s (%r)' %
|
| 1289 |
+
(type(s).__name__, s))
|
| 1290 |
+
raise TypeError(msg) from err
|
| 1291 |
+
a = list(map(decode, a))
|
| 1292 |
+
b = list(map(decode, b))
|
| 1293 |
+
fromfile = decode(fromfile)
|
| 1294 |
+
tofile = decode(tofile)
|
| 1295 |
+
fromfiledate = decode(fromfiledate)
|
| 1296 |
+
tofiledate = decode(tofiledate)
|
| 1297 |
+
lineterm = decode(lineterm)
|
| 1298 |
+
|
| 1299 |
+
lines = dfunc(a, b, fromfile, tofile, fromfiledate, tofiledate, n, lineterm)
|
| 1300 |
+
for line in lines:
|
| 1301 |
+
yield line.encode('ascii', 'surrogateescape')
|
| 1302 |
+
|
| 1303 |
+
def ndiff(a, b, linejunk=None, charjunk=IS_CHARACTER_JUNK):
|
| 1304 |
+
r"""
|
| 1305 |
+
Compare `a` and `b` (lists of strings); return a `Differ`-style delta.
|
| 1306 |
+
|
| 1307 |
+
Optional keyword parameters `linejunk` and `charjunk` are for filter
|
| 1308 |
+
functions, or can be None:
|
| 1309 |
+
|
| 1310 |
+
- linejunk: A function that should accept a single string argument and
|
| 1311 |
+
return true iff the string is junk. The default is None, and is
|
| 1312 |
+
recommended; the underlying SequenceMatcher class has an adaptive
|
| 1313 |
+
notion of "noise" lines.
|
| 1314 |
+
|
| 1315 |
+
- charjunk: A function that accepts a character (string of length
|
| 1316 |
+
1), and returns true iff the character is junk. The default is
|
| 1317 |
+
the module-level function IS_CHARACTER_JUNK, which filters out
|
| 1318 |
+
whitespace characters (a blank or tab; note: it's a bad idea to
|
| 1319 |
+
include newline in this!).
|
| 1320 |
+
|
| 1321 |
+
Tools/scripts/ndiff.py is a command-line front-end to this function.
|
| 1322 |
+
|
| 1323 |
+
Example:
|
| 1324 |
+
|
| 1325 |
+
>>> diff = ndiff('one\ntwo\nthree\n'.splitlines(keepends=True),
|
| 1326 |
+
... 'ore\ntree\nemu\n'.splitlines(keepends=True))
|
| 1327 |
+
>>> print(''.join(diff), end="")
|
| 1328 |
+
- one
|
| 1329 |
+
? ^
|
| 1330 |
+
+ ore
|
| 1331 |
+
? ^
|
| 1332 |
+
- two
|
| 1333 |
+
- three
|
| 1334 |
+
? -
|
| 1335 |
+
+ tree
|
| 1336 |
+
+ emu
|
| 1337 |
+
"""
|
| 1338 |
+
return Differ(linejunk, charjunk).compare(a, b)
|
| 1339 |
+
|
| 1340 |
+
def _mdiff(fromlines, tolines, context=None, linejunk=None,
|
| 1341 |
+
charjunk=IS_CHARACTER_JUNK):
|
| 1342 |
+
r"""Returns generator yielding marked up from/to side by side differences.
|
| 1343 |
+
|
| 1344 |
+
Arguments:
|
| 1345 |
+
fromlines -- list of text lines to compared to tolines
|
| 1346 |
+
tolines -- list of text lines to be compared to fromlines
|
| 1347 |
+
context -- number of context lines to display on each side of difference,
|
| 1348 |
+
if None, all from/to text lines will be generated.
|
| 1349 |
+
linejunk -- passed on to ndiff (see ndiff documentation)
|
| 1350 |
+
charjunk -- passed on to ndiff (see ndiff documentation)
|
| 1351 |
+
|
| 1352 |
+
This function returns an iterator which returns a tuple:
|
| 1353 |
+
(from line tuple, to line tuple, boolean flag)
|
| 1354 |
+
|
| 1355 |
+
from/to line tuple -- (line num, line text)
|
| 1356 |
+
line num -- integer or None (to indicate a context separation)
|
| 1357 |
+
line text -- original line text with following markers inserted:
|
| 1358 |
+
'\0+' -- marks start of added text
|
| 1359 |
+
'\0-' -- marks start of deleted text
|
| 1360 |
+
'\0^' -- marks start of changed text
|
| 1361 |
+
'\1' -- marks end of added/deleted/changed text
|
| 1362 |
+
|
| 1363 |
+
boolean flag -- None indicates context separation, True indicates
|
| 1364 |
+
either "from" or "to" line contains a change, otherwise False.
|
| 1365 |
+
|
| 1366 |
+
This function/iterator was originally developed to generate side by side
|
| 1367 |
+
file difference for making HTML pages (see HtmlDiff class for example
|
| 1368 |
+
usage).
|
| 1369 |
+
|
| 1370 |
+
Note, this function utilizes the ndiff function to generate the side by
|
| 1371 |
+
side difference markup. Optional ndiff arguments may be passed to this
|
| 1372 |
+
function and they in turn will be passed to ndiff.
|
| 1373 |
+
"""
|
| 1374 |
+
import re
|
| 1375 |
+
|
| 1376 |
+
# regular expression for finding intraline change indices
|
| 1377 |
+
change_re = re.compile(r'(\++|\-+|\^+)')
|
| 1378 |
+
|
| 1379 |
+
# create the difference iterator to generate the differences
|
| 1380 |
+
diff_lines_iterator = ndiff(fromlines,tolines,linejunk,charjunk)
|
| 1381 |
+
|
| 1382 |
+
def _make_line(lines, format_key, side, num_lines=[0,0]):
|
| 1383 |
+
"""Returns line of text with user's change markup and line formatting.
|
| 1384 |
+
|
| 1385 |
+
lines -- list of lines from the ndiff generator to produce a line of
|
| 1386 |
+
text from. When producing the line of text to return, the
|
| 1387 |
+
lines used are removed from this list.
|
| 1388 |
+
format_key -- '+' return first line in list with "add" markup around
|
| 1389 |
+
the entire line.
|
| 1390 |
+
'-' return first line in list with "delete" markup around
|
| 1391 |
+
the entire line.
|
| 1392 |
+
'?' return first line in list with add/delete/change
|
| 1393 |
+
intraline markup (indices obtained from second line)
|
| 1394 |
+
None return first line in list with no markup
|
| 1395 |
+
side -- indice into the num_lines list (0=from,1=to)
|
| 1396 |
+
num_lines -- from/to current line number. This is NOT intended to be a
|
| 1397 |
+
passed parameter. It is present as a keyword argument to
|
| 1398 |
+
maintain memory of the current line numbers between calls
|
| 1399 |
+
of this function.
|
| 1400 |
+
|
| 1401 |
+
Note, this function is purposefully not defined at the module scope so
|
| 1402 |
+
that data it needs from its parent function (within whose context it
|
| 1403 |
+
is defined) does not need to be of module scope.
|
| 1404 |
+
"""
|
| 1405 |
+
num_lines[side] += 1
|
| 1406 |
+
# Handle case where no user markup is to be added, just return line of
|
| 1407 |
+
# text with user's line format to allow for usage of the line number.
|
| 1408 |
+
if format_key is None:
|
| 1409 |
+
return (num_lines[side],lines.pop(0)[2:])
|
| 1410 |
+
# Handle case of intraline changes
|
| 1411 |
+
if format_key == '?':
|
| 1412 |
+
text, markers = lines.pop(0), lines.pop(0)
|
| 1413 |
+
# find intraline changes (store change type and indices in tuples)
|
| 1414 |
+
sub_info = []
|
| 1415 |
+
def record_sub_info(match_object,sub_info=sub_info):
|
| 1416 |
+
sub_info.append([match_object.group(1)[0],match_object.span()])
|
| 1417 |
+
return match_object.group(1)
|
| 1418 |
+
change_re.sub(record_sub_info,markers)
|
| 1419 |
+
# process each tuple inserting our special marks that won't be
|
| 1420 |
+
# noticed by an xml/html escaper.
|
| 1421 |
+
for key,(begin,end) in reversed(sub_info):
|
| 1422 |
+
text = text[0:begin]+'\0'+key+text[begin:end]+'\1'+text[end:]
|
| 1423 |
+
text = text[2:]
|
| 1424 |
+
# Handle case of add/delete entire line
|
| 1425 |
+
else:
|
| 1426 |
+
text = lines.pop(0)[2:]
|
| 1427 |
+
# if line of text is just a newline, insert a space so there is
|
| 1428 |
+
# something for the user to highlight and see.
|
| 1429 |
+
if not text:
|
| 1430 |
+
text = ' '
|
| 1431 |
+
# insert marks that won't be noticed by an xml/html escaper.
|
| 1432 |
+
text = '\0' + format_key + text + '\1'
|
| 1433 |
+
# Return line of text, first allow user's line formatter to do its
|
| 1434 |
+
# thing (such as adding the line number) then replace the special
|
| 1435 |
+
# marks with what the user's change markup.
|
| 1436 |
+
return (num_lines[side],text)
|
| 1437 |
+
|
| 1438 |
+
def _line_iterator():
|
| 1439 |
+
"""Yields from/to lines of text with a change indication.
|
| 1440 |
+
|
| 1441 |
+
This function is an iterator. It itself pulls lines from a
|
| 1442 |
+
differencing iterator, processes them and yields them. When it can
|
| 1443 |
+
it yields both a "from" and a "to" line, otherwise it will yield one
|
| 1444 |
+
or the other. In addition to yielding the lines of from/to text, a
|
| 1445 |
+
boolean flag is yielded to indicate if the text line(s) have
|
| 1446 |
+
differences in them.
|
| 1447 |
+
|
| 1448 |
+
Note, this function is purposefully not defined at the module scope so
|
| 1449 |
+
that data it needs from its parent function (within whose context it
|
| 1450 |
+
is defined) does not need to be of module scope.
|
| 1451 |
+
"""
|
| 1452 |
+
lines = []
|
| 1453 |
+
num_blanks_pending, num_blanks_to_yield = 0, 0
|
| 1454 |
+
while True:
|
| 1455 |
+
# Load up next 4 lines so we can look ahead, create strings which
|
| 1456 |
+
# are a concatenation of the first character of each of the 4 lines
|
| 1457 |
+
# so we can do some very readable comparisons.
|
| 1458 |
+
while len(lines) < 4:
|
| 1459 |
+
lines.append(next(diff_lines_iterator, 'X'))
|
| 1460 |
+
s = ''.join([line[0] for line in lines])
|
| 1461 |
+
if s.startswith('X'):
|
| 1462 |
+
# When no more lines, pump out any remaining blank lines so the
|
| 1463 |
+
# corresponding add/delete lines get a matching blank line so
|
| 1464 |
+
# all line pairs get yielded at the next level.
|
| 1465 |
+
num_blanks_to_yield = num_blanks_pending
|
| 1466 |
+
elif s.startswith('-?+?'):
|
| 1467 |
+
# simple intraline change
|
| 1468 |
+
yield _make_line(lines,'?',0), _make_line(lines,'?',1), True
|
| 1469 |
+
continue
|
| 1470 |
+
elif s.startswith('--++'):
|
| 1471 |
+
# in delete block, add block coming: we do NOT want to get
|
| 1472 |
+
# caught up on blank lines yet, just process the delete line
|
| 1473 |
+
num_blanks_pending -= 1
|
| 1474 |
+
yield _make_line(lines,'-',0), None, True
|
| 1475 |
+
continue
|
| 1476 |
+
elif s.startswith(('--?+', '--+', '- ')):
|
| 1477 |
+
# in delete block and see an intraline change or unchanged line
|
| 1478 |
+
# coming: yield the delete line and then blanks
|
| 1479 |
+
from_line,to_line = _make_line(lines,'-',0), None
|
| 1480 |
+
num_blanks_to_yield,num_blanks_pending = num_blanks_pending-1,0
|
| 1481 |
+
elif s.startswith('-+?'):
|
| 1482 |
+
# intraline change
|
| 1483 |
+
yield _make_line(lines,None,0), _make_line(lines,'?',1), True
|
| 1484 |
+
continue
|
| 1485 |
+
elif s.startswith('-?+'):
|
| 1486 |
+
# intraline change
|
| 1487 |
+
yield _make_line(lines,'?',0), _make_line(lines,None,1), True
|
| 1488 |
+
continue
|
| 1489 |
+
elif s.startswith('-'):
|
| 1490 |
+
# delete FROM line
|
| 1491 |
+
num_blanks_pending -= 1
|
| 1492 |
+
yield _make_line(lines,'-',0), None, True
|
| 1493 |
+
continue
|
| 1494 |
+
elif s.startswith('+--'):
|
| 1495 |
+
# in add block, delete block coming: we do NOT want to get
|
| 1496 |
+
# caught up on blank lines yet, just process the add line
|
| 1497 |
+
num_blanks_pending += 1
|
| 1498 |
+
yield None, _make_line(lines,'+',1), True
|
| 1499 |
+
continue
|
| 1500 |
+
elif s.startswith(('+ ', '+-')):
|
| 1501 |
+
# will be leaving an add block: yield blanks then add line
|
| 1502 |
+
from_line, to_line = None, _make_line(lines,'+',1)
|
| 1503 |
+
num_blanks_to_yield,num_blanks_pending = num_blanks_pending+1,0
|
| 1504 |
+
elif s.startswith('+'):
|
| 1505 |
+
# inside an add block, yield the add line
|
| 1506 |
+
num_blanks_pending += 1
|
| 1507 |
+
yield None, _make_line(lines,'+',1), True
|
| 1508 |
+
continue
|
| 1509 |
+
elif s.startswith(' '):
|
| 1510 |
+
# unchanged text, yield it to both sides
|
| 1511 |
+
yield _make_line(lines[:],None,0),_make_line(lines,None,1),False
|
| 1512 |
+
continue
|
| 1513 |
+
# Catch up on the blank lines so when we yield the next from/to
|
| 1514 |
+
# pair, they are lined up.
|
| 1515 |
+
while(num_blanks_to_yield < 0):
|
| 1516 |
+
num_blanks_to_yield += 1
|
| 1517 |
+
yield None,('','\n'),True
|
| 1518 |
+
while(num_blanks_to_yield > 0):
|
| 1519 |
+
num_blanks_to_yield -= 1
|
| 1520 |
+
yield ('','\n'),None,True
|
| 1521 |
+
if s.startswith('X'):
|
| 1522 |
+
return
|
| 1523 |
+
else:
|
| 1524 |
+
yield from_line,to_line,True
|
| 1525 |
+
|
| 1526 |
+
def _line_pair_iterator():
|
| 1527 |
+
"""Yields from/to lines of text with a change indication.
|
| 1528 |
+
|
| 1529 |
+
This function is an iterator. It itself pulls lines from the line
|
| 1530 |
+
iterator. Its difference from that iterator is that this function
|
| 1531 |
+
always yields a pair of from/to text lines (with the change
|
| 1532 |
+
indication). If necessary it will collect single from/to lines
|
| 1533 |
+
until it has a matching pair from/to pair to yield.
|
| 1534 |
+
|
| 1535 |
+
Note, this function is purposefully not defined at the module scope so
|
| 1536 |
+
that data it needs from its parent function (within whose context it
|
| 1537 |
+
is defined) does not need to be of module scope.
|
| 1538 |
+
"""
|
| 1539 |
+
line_iterator = _line_iterator()
|
| 1540 |
+
fromlines,tolines=[],[]
|
| 1541 |
+
while True:
|
| 1542 |
+
# Collecting lines of text until we have a from/to pair
|
| 1543 |
+
while (len(fromlines)==0 or len(tolines)==0):
|
| 1544 |
+
try:
|
| 1545 |
+
from_line, to_line, found_diff = next(line_iterator)
|
| 1546 |
+
except StopIteration:
|
| 1547 |
+
return
|
| 1548 |
+
if from_line is not None:
|
| 1549 |
+
fromlines.append((from_line,found_diff))
|
| 1550 |
+
if to_line is not None:
|
| 1551 |
+
tolines.append((to_line,found_diff))
|
| 1552 |
+
# Once we have a pair, remove them from the collection and yield it
|
| 1553 |
+
from_line, fromDiff = fromlines.pop(0)
|
| 1554 |
+
to_line, to_diff = tolines.pop(0)
|
| 1555 |
+
yield (from_line,to_line,fromDiff or to_diff)
|
| 1556 |
+
|
| 1557 |
+
# Handle case where user does not want context differencing, just yield
|
| 1558 |
+
# them up without doing anything else with them.
|
| 1559 |
+
line_pair_iterator = _line_pair_iterator()
|
| 1560 |
+
if context is None:
|
| 1561 |
+
yield from line_pair_iterator
|
| 1562 |
+
# Handle case where user wants context differencing. We must do some
|
| 1563 |
+
# storage of lines until we know for sure that they are to be yielded.
|
| 1564 |
+
else:
|
| 1565 |
+
context += 1
|
| 1566 |
+
lines_to_write = 0
|
| 1567 |
+
while True:
|
| 1568 |
+
# Store lines up until we find a difference, note use of a
|
| 1569 |
+
# circular queue because we only need to keep around what
|
| 1570 |
+
# we need for context.
|
| 1571 |
+
index, contextLines = 0, [None]*(context)
|
| 1572 |
+
found_diff = False
|
| 1573 |
+
while(found_diff is False):
|
| 1574 |
+
try:
|
| 1575 |
+
from_line, to_line, found_diff = next(line_pair_iterator)
|
| 1576 |
+
except StopIteration:
|
| 1577 |
+
return
|
| 1578 |
+
i = index % context
|
| 1579 |
+
contextLines[i] = (from_line, to_line, found_diff)
|
| 1580 |
+
index += 1
|
| 1581 |
+
# Yield lines that we have collected so far, but first yield
|
| 1582 |
+
# the user's separator.
|
| 1583 |
+
if index > context:
|
| 1584 |
+
yield None, None, None
|
| 1585 |
+
lines_to_write = context
|
| 1586 |
+
else:
|
| 1587 |
+
lines_to_write = index
|
| 1588 |
+
index = 0
|
| 1589 |
+
while(lines_to_write):
|
| 1590 |
+
i = index % context
|
| 1591 |
+
index += 1
|
| 1592 |
+
yield contextLines[i]
|
| 1593 |
+
lines_to_write -= 1
|
| 1594 |
+
# Now yield the context lines after the change
|
| 1595 |
+
lines_to_write = context-1
|
| 1596 |
+
try:
|
| 1597 |
+
while(lines_to_write):
|
| 1598 |
+
from_line, to_line, found_diff = next(line_pair_iterator)
|
| 1599 |
+
# If another change within the context, extend the context
|
| 1600 |
+
if found_diff:
|
| 1601 |
+
lines_to_write = context-1
|
| 1602 |
+
else:
|
| 1603 |
+
lines_to_write -= 1
|
| 1604 |
+
yield from_line, to_line, found_diff
|
| 1605 |
+
except StopIteration:
|
| 1606 |
+
# Catch exception from next() and return normally
|
| 1607 |
+
return
|
| 1608 |
+
|
| 1609 |
+
|
| 1610 |
+
_file_template = """
|
| 1611 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
| 1612 |
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
| 1613 |
+
|
| 1614 |
+
<html>
|
| 1615 |
+
|
| 1616 |
+
<head>
|
| 1617 |
+
<meta http-equiv="Content-Type"
|
| 1618 |
+
content="text/html; charset=%(charset)s" />
|
| 1619 |
+
<title></title>
|
| 1620 |
+
<style type="text/css">%(styles)s
|
| 1621 |
+
</style>
|
| 1622 |
+
</head>
|
| 1623 |
+
|
| 1624 |
+
<body>
|
| 1625 |
+
%(table)s%(legend)s
|
| 1626 |
+
</body>
|
| 1627 |
+
|
| 1628 |
+
</html>"""
|
| 1629 |
+
|
| 1630 |
+
_styles = """
|
| 1631 |
+
table.diff {font-family:Courier; border:medium;}
|
| 1632 |
+
.diff_header {background-color:#e0e0e0}
|
| 1633 |
+
td.diff_header {text-align:right}
|
| 1634 |
+
.diff_next {background-color:#c0c0c0}
|
| 1635 |
+
.diff_add {background-color:#aaffaa}
|
| 1636 |
+
.diff_chg {background-color:#ffff77}
|
| 1637 |
+
.diff_sub {background-color:#ffaaaa}"""
|
| 1638 |
+
|
| 1639 |
+
_table_template = """
|
| 1640 |
+
<table class="diff" id="difflib_chg_%(prefix)s_top"
|
| 1641 |
+
cellspacing="0" cellpadding="0" rules="groups" >
|
| 1642 |
+
<colgroup></colgroup> <colgroup></colgroup> <colgroup></colgroup>
|
| 1643 |
+
<colgroup></colgroup> <colgroup></colgroup> <colgroup></colgroup>
|
| 1644 |
+
%(header_row)s
|
| 1645 |
+
<tbody>
|
| 1646 |
+
%(data_rows)s </tbody>
|
| 1647 |
+
</table>"""
|
| 1648 |
+
|
| 1649 |
+
_legend = """
|
| 1650 |
+
<table class="diff" summary="Legends">
|
| 1651 |
+
<tr> <th colspan="2"> Legends </th> </tr>
|
| 1652 |
+
<tr> <td> <table border="" summary="Colors">
|
| 1653 |
+
<tr><th> Colors </th> </tr>
|
| 1654 |
+
<tr><td class="diff_add"> Added </td></tr>
|
| 1655 |
+
<tr><td class="diff_chg">Changed</td> </tr>
|
| 1656 |
+
<tr><td class="diff_sub">Deleted</td> </tr>
|
| 1657 |
+
</table></td>
|
| 1658 |
+
<td> <table border="" summary="Links">
|
| 1659 |
+
<tr><th colspan="2"> Links </th> </tr>
|
| 1660 |
+
<tr><td>(f)irst change</td> </tr>
|
| 1661 |
+
<tr><td>(n)ext change</td> </tr>
|
| 1662 |
+
<tr><td>(t)op</td> </tr>
|
| 1663 |
+
</table></td> </tr>
|
| 1664 |
+
</table>"""
|
| 1665 |
+
|
| 1666 |
+
class HtmlDiff(object):
|
| 1667 |
+
"""For producing HTML side by side comparison with change highlights.
|
| 1668 |
+
|
| 1669 |
+
This class can be used to create an HTML table (or a complete HTML file
|
| 1670 |
+
containing the table) showing a side by side, line by line comparison
|
| 1671 |
+
of text with inter-line and intra-line change highlights. The table can
|
| 1672 |
+
be generated in either full or contextual difference mode.
|
| 1673 |
+
|
| 1674 |
+
The following methods are provided for HTML generation:
|
| 1675 |
+
|
| 1676 |
+
make_table -- generates HTML for a single side by side table
|
| 1677 |
+
make_file -- generates complete HTML file with a single side by side table
|
| 1678 |
+
|
| 1679 |
+
See tools/scripts/diff.py for an example usage of this class.
|
| 1680 |
+
"""
|
| 1681 |
+
|
| 1682 |
+
_file_template = _file_template
|
| 1683 |
+
_styles = _styles
|
| 1684 |
+
_table_template = _table_template
|
| 1685 |
+
_legend = _legend
|
| 1686 |
+
_default_prefix = 0
|
| 1687 |
+
|
| 1688 |
+
def __init__(self,tabsize=8,wrapcolumn=None,linejunk=None,
|
| 1689 |
+
charjunk=IS_CHARACTER_JUNK):
|
| 1690 |
+
"""HtmlDiff instance initializer
|
| 1691 |
+
|
| 1692 |
+
Arguments:
|
| 1693 |
+
tabsize -- tab stop spacing, defaults to 8.
|
| 1694 |
+
wrapcolumn -- column number where lines are broken and wrapped,
|
| 1695 |
+
defaults to None where lines are not wrapped.
|
| 1696 |
+
linejunk,charjunk -- keyword arguments passed into ndiff() (used by
|
| 1697 |
+
HtmlDiff() to generate the side by side HTML differences). See
|
| 1698 |
+
ndiff() documentation for argument default values and descriptions.
|
| 1699 |
+
"""
|
| 1700 |
+
self._tabsize = tabsize
|
| 1701 |
+
self._wrapcolumn = wrapcolumn
|
| 1702 |
+
self._linejunk = linejunk
|
| 1703 |
+
self._charjunk = charjunk
|
| 1704 |
+
|
| 1705 |
+
def make_file(self, fromlines, tolines, fromdesc='', todesc='',
|
| 1706 |
+
context=False, numlines=5, *, charset='utf-8'):
|
| 1707 |
+
"""Returns HTML file of side by side comparison with change highlights
|
| 1708 |
+
|
| 1709 |
+
Arguments:
|
| 1710 |
+
fromlines -- list of "from" lines
|
| 1711 |
+
tolines -- list of "to" lines
|
| 1712 |
+
fromdesc -- "from" file column header string
|
| 1713 |
+
todesc -- "to" file column header string
|
| 1714 |
+
context -- set to True for contextual differences (defaults to False
|
| 1715 |
+
which shows full differences).
|
| 1716 |
+
numlines -- number of context lines. When context is set True,
|
| 1717 |
+
controls number of lines displayed before and after the change.
|
| 1718 |
+
When context is False, controls the number of lines to place
|
| 1719 |
+
the "next" link anchors before the next change (so click of
|
| 1720 |
+
"next" link jumps to just before the change).
|
| 1721 |
+
charset -- charset of the HTML document
|
| 1722 |
+
"""
|
| 1723 |
+
|
| 1724 |
+
return (self._file_template % dict(
|
| 1725 |
+
styles=self._styles,
|
| 1726 |
+
legend=self._legend,
|
| 1727 |
+
table=self.make_table(fromlines, tolines, fromdesc, todesc,
|
| 1728 |
+
context=context, numlines=numlines),
|
| 1729 |
+
charset=charset
|
| 1730 |
+
)).encode(charset, 'xmlcharrefreplace').decode(charset)
|
| 1731 |
+
|
| 1732 |
+
def _tab_newline_replace(self,fromlines,tolines):
|
| 1733 |
+
"""Returns from/to line lists with tabs expanded and newlines removed.
|
| 1734 |
+
|
| 1735 |
+
Instead of tab characters being replaced by the number of spaces
|
| 1736 |
+
needed to fill in to the next tab stop, this function will fill
|
| 1737 |
+
the space with tab characters. This is done so that the difference
|
| 1738 |
+
algorithms can identify changes in a file when tabs are replaced by
|
| 1739 |
+
spaces and vice versa. At the end of the HTML generation, the tab
|
| 1740 |
+
characters will be replaced with a nonbreakable space.
|
| 1741 |
+
"""
|
| 1742 |
+
def expand_tabs(line):
|
| 1743 |
+
# hide real spaces
|
| 1744 |
+
line = line.replace(' ','\0')
|
| 1745 |
+
# expand tabs into spaces
|
| 1746 |
+
line = line.expandtabs(self._tabsize)
|
| 1747 |
+
# replace spaces from expanded tabs back into tab characters
|
| 1748 |
+
# (we'll replace them with markup after we do differencing)
|
| 1749 |
+
line = line.replace(' ','\t')
|
| 1750 |
+
return line.replace('\0',' ').rstrip('\n')
|
| 1751 |
+
fromlines = [expand_tabs(line) for line in fromlines]
|
| 1752 |
+
tolines = [expand_tabs(line) for line in tolines]
|
| 1753 |
+
return fromlines,tolines
|
| 1754 |
+
|
| 1755 |
+
def _split_line(self,data_list,line_num,text):
|
| 1756 |
+
"""Builds list of text lines by splitting text lines at wrap point
|
| 1757 |
+
|
| 1758 |
+
This function will determine if the input text line needs to be
|
| 1759 |
+
wrapped (split) into separate lines. If so, the first wrap point
|
| 1760 |
+
will be determined and the first line appended to the output
|
| 1761 |
+
text line list. This function is used recursively to handle
|
| 1762 |
+
the second part of the split line to further split it.
|
| 1763 |
+
"""
|
| 1764 |
+
# if blank line or context separator, just add it to the output list
|
| 1765 |
+
if not line_num:
|
| 1766 |
+
data_list.append((line_num,text))
|
| 1767 |
+
return
|
| 1768 |
+
|
| 1769 |
+
# if line text doesn't need wrapping, just add it to the output list
|
| 1770 |
+
size = len(text)
|
| 1771 |
+
max = self._wrapcolumn
|
| 1772 |
+
if (size <= max) or ((size -(text.count('\0')*3)) <= max):
|
| 1773 |
+
data_list.append((line_num,text))
|
| 1774 |
+
return
|
| 1775 |
+
|
| 1776 |
+
# scan text looking for the wrap point, keeping track if the wrap
|
| 1777 |
+
# point is inside markers
|
| 1778 |
+
i = 0
|
| 1779 |
+
n = 0
|
| 1780 |
+
mark = ''
|
| 1781 |
+
while n < max and i < size:
|
| 1782 |
+
if text[i] == '\0':
|
| 1783 |
+
i += 1
|
| 1784 |
+
mark = text[i]
|
| 1785 |
+
i += 1
|
| 1786 |
+
elif text[i] == '\1':
|
| 1787 |
+
i += 1
|
| 1788 |
+
mark = ''
|
| 1789 |
+
else:
|
| 1790 |
+
i += 1
|
| 1791 |
+
n += 1
|
| 1792 |
+
|
| 1793 |
+
# wrap point is inside text, break it up into separate lines
|
| 1794 |
+
line1 = text[:i]
|
| 1795 |
+
line2 = text[i:]
|
| 1796 |
+
|
| 1797 |
+
# if wrap point is inside markers, place end marker at end of first
|
| 1798 |
+
# line and start marker at beginning of second line because each
|
| 1799 |
+
# line will have its own table tag markup around it.
|
| 1800 |
+
if mark:
|
| 1801 |
+
line1 = line1 + '\1'
|
| 1802 |
+
line2 = '\0' + mark + line2
|
| 1803 |
+
|
| 1804 |
+
# tack on first line onto the output list
|
| 1805 |
+
data_list.append((line_num,line1))
|
| 1806 |
+
|
| 1807 |
+
# use this routine again to wrap the remaining text
|
| 1808 |
+
self._split_line(data_list,'>',line2)
|
| 1809 |
+
|
| 1810 |
+
def _line_wrapper(self,diffs):
|
| 1811 |
+
"""Returns iterator that splits (wraps) mdiff text lines"""
|
| 1812 |
+
|
| 1813 |
+
# pull from/to data and flags from mdiff iterator
|
| 1814 |
+
for fromdata,todata,flag in diffs:
|
| 1815 |
+
# check for context separators and pass them through
|
| 1816 |
+
if flag is None:
|
| 1817 |
+
yield fromdata,todata,flag
|
| 1818 |
+
continue
|
| 1819 |
+
(fromline,fromtext),(toline,totext) = fromdata,todata
|
| 1820 |
+
# for each from/to line split it at the wrap column to form
|
| 1821 |
+
# list of text lines.
|
| 1822 |
+
fromlist,tolist = [],[]
|
| 1823 |
+
self._split_line(fromlist,fromline,fromtext)
|
| 1824 |
+
self._split_line(tolist,toline,totext)
|
| 1825 |
+
# yield from/to line in pairs inserting blank lines as
|
| 1826 |
+
# necessary when one side has more wrapped lines
|
| 1827 |
+
while fromlist or tolist:
|
| 1828 |
+
if fromlist:
|
| 1829 |
+
fromdata = fromlist.pop(0)
|
| 1830 |
+
else:
|
| 1831 |
+
fromdata = ('',' ')
|
| 1832 |
+
if tolist:
|
| 1833 |
+
todata = tolist.pop(0)
|
| 1834 |
+
else:
|
| 1835 |
+
todata = ('',' ')
|
| 1836 |
+
yield fromdata,todata,flag
|
| 1837 |
+
|
| 1838 |
+
def _collect_lines(self,diffs):
|
| 1839 |
+
"""Collects mdiff output into separate lists
|
| 1840 |
+
|
| 1841 |
+
Before storing the mdiff from/to data into a list, it is converted
|
| 1842 |
+
into a single line of text with HTML markup.
|
| 1843 |
+
"""
|
| 1844 |
+
|
| 1845 |
+
fromlist,tolist,flaglist = [],[],[]
|
| 1846 |
+
# pull from/to data and flags from mdiff style iterator
|
| 1847 |
+
for fromdata,todata,flag in diffs:
|
| 1848 |
+
try:
|
| 1849 |
+
# store HTML markup of the lines into the lists
|
| 1850 |
+
fromlist.append(self._format_line(0,flag,*fromdata))
|
| 1851 |
+
tolist.append(self._format_line(1,flag,*todata))
|
| 1852 |
+
except TypeError:
|
| 1853 |
+
# exceptions occur for lines where context separators go
|
| 1854 |
+
fromlist.append(None)
|
| 1855 |
+
tolist.append(None)
|
| 1856 |
+
flaglist.append(flag)
|
| 1857 |
+
return fromlist,tolist,flaglist
|
| 1858 |
+
|
| 1859 |
+
def _format_line(self,side,flag,linenum,text):
|
| 1860 |
+
"""Returns HTML markup of "from" / "to" text lines
|
| 1861 |
+
|
| 1862 |
+
side -- 0 or 1 indicating "from" or "to" text
|
| 1863 |
+
flag -- indicates if difference on line
|
| 1864 |
+
linenum -- line number (used for line number column)
|
| 1865 |
+
text -- line text to be marked up
|
| 1866 |
+
"""
|
| 1867 |
+
try:
|
| 1868 |
+
linenum = '%d' % linenum
|
| 1869 |
+
id = ' id="%s%s"' % (self._prefix[side],linenum)
|
| 1870 |
+
except TypeError:
|
| 1871 |
+
# handle blank lines where linenum is '>' or ''
|
| 1872 |
+
id = ''
|
| 1873 |
+
# replace those things that would get confused with HTML symbols
|
| 1874 |
+
text=text.replace("&","&").replace(">",">").replace("<","<")
|
| 1875 |
+
|
| 1876 |
+
# make space non-breakable so they don't get compressed or line wrapped
|
| 1877 |
+
text = text.replace(' ',' ').rstrip()
|
| 1878 |
+
|
| 1879 |
+
return '<td class="diff_header"%s>%s</td><td nowrap="nowrap">%s</td>' \
|
| 1880 |
+
% (id,linenum,text)
|
| 1881 |
+
|
| 1882 |
+
def _make_prefix(self):
|
| 1883 |
+
"""Create unique anchor prefixes"""
|
| 1884 |
+
|
| 1885 |
+
# Generate a unique anchor prefix so multiple tables
|
| 1886 |
+
# can exist on the same HTML page without conflicts.
|
| 1887 |
+
fromprefix = "from%d_" % HtmlDiff._default_prefix
|
| 1888 |
+
toprefix = "to%d_" % HtmlDiff._default_prefix
|
| 1889 |
+
HtmlDiff._default_prefix += 1
|
| 1890 |
+
# store prefixes so line format method has access
|
| 1891 |
+
self._prefix = [fromprefix,toprefix]
|
| 1892 |
+
|
| 1893 |
+
def _convert_flags(self,fromlist,tolist,flaglist,context,numlines):
|
| 1894 |
+
"""Makes list of "next" links"""
|
| 1895 |
+
|
| 1896 |
+
# all anchor names will be generated using the unique "to" prefix
|
| 1897 |
+
toprefix = self._prefix[1]
|
| 1898 |
+
|
| 1899 |
+
# process change flags, generating middle column of next anchors/links
|
| 1900 |
+
next_id = ['']*len(flaglist)
|
| 1901 |
+
next_href = ['']*len(flaglist)
|
| 1902 |
+
num_chg, in_change = 0, False
|
| 1903 |
+
last = 0
|
| 1904 |
+
for i,flag in enumerate(flaglist):
|
| 1905 |
+
if flag:
|
| 1906 |
+
if not in_change:
|
| 1907 |
+
in_change = True
|
| 1908 |
+
last = i
|
| 1909 |
+
# at the beginning of a change, drop an anchor a few lines
|
| 1910 |
+
# (the context lines) before the change for the previous
|
| 1911 |
+
# link
|
| 1912 |
+
i = max([0,i-numlines])
|
| 1913 |
+
next_id[i] = ' id="difflib_chg_%s_%d"' % (toprefix,num_chg)
|
| 1914 |
+
# at the beginning of a change, drop a link to the next
|
| 1915 |
+
# change
|
| 1916 |
+
num_chg += 1
|
| 1917 |
+
next_href[last] = '<a href="#difflib_chg_%s_%d">n</a>' % (
|
| 1918 |
+
toprefix,num_chg)
|
| 1919 |
+
else:
|
| 1920 |
+
in_change = False
|
| 1921 |
+
# check for cases where there is no content to avoid exceptions
|
| 1922 |
+
if not flaglist:
|
| 1923 |
+
flaglist = [False]
|
| 1924 |
+
next_id = ['']
|
| 1925 |
+
next_href = ['']
|
| 1926 |
+
last = 0
|
| 1927 |
+
if context:
|
| 1928 |
+
fromlist = ['<td></td><td> No Differences Found </td>']
|
| 1929 |
+
tolist = fromlist
|
| 1930 |
+
else:
|
| 1931 |
+
fromlist = tolist = ['<td></td><td> Empty File </td>']
|
| 1932 |
+
# if not a change on first line, drop a link
|
| 1933 |
+
if not flaglist[0]:
|
| 1934 |
+
next_href[0] = '<a href="#difflib_chg_%s_0">f</a>' % toprefix
|
| 1935 |
+
# redo the last link to link to the top
|
| 1936 |
+
next_href[last] = '<a href="#difflib_chg_%s_top">t</a>' % (toprefix)
|
| 1937 |
+
|
| 1938 |
+
return fromlist,tolist,flaglist,next_href,next_id
|
| 1939 |
+
|
| 1940 |
+
def make_table(self,fromlines,tolines,fromdesc='',todesc='',context=False,
|
| 1941 |
+
numlines=5):
|
| 1942 |
+
"""Returns HTML table of side by side comparison with change highlights
|
| 1943 |
+
|
| 1944 |
+
Arguments:
|
| 1945 |
+
fromlines -- list of "from" lines
|
| 1946 |
+
tolines -- list of "to" lines
|
| 1947 |
+
fromdesc -- "from" file column header string
|
| 1948 |
+
todesc -- "to" file column header string
|
| 1949 |
+
context -- set to True for contextual differences (defaults to False
|
| 1950 |
+
which shows full differences).
|
| 1951 |
+
numlines -- number of context lines. When context is set True,
|
| 1952 |
+
controls number of lines displayed before and after the change.
|
| 1953 |
+
When context is False, controls the number of lines to place
|
| 1954 |
+
the "next" link anchors before the next change (so click of
|
| 1955 |
+
"next" link jumps to just before the change).
|
| 1956 |
+
"""
|
| 1957 |
+
|
| 1958 |
+
# make unique anchor prefixes so that multiple tables may exist
|
| 1959 |
+
# on the same page without conflict.
|
| 1960 |
+
self._make_prefix()
|
| 1961 |
+
|
| 1962 |
+
# change tabs to spaces before it gets more difficult after we insert
|
| 1963 |
+
# markup
|
| 1964 |
+
fromlines,tolines = self._tab_newline_replace(fromlines,tolines)
|
| 1965 |
+
|
| 1966 |
+
# create diffs iterator which generates side by side from/to data
|
| 1967 |
+
if context:
|
| 1968 |
+
context_lines = numlines
|
| 1969 |
+
else:
|
| 1970 |
+
context_lines = None
|
| 1971 |
+
diffs = _mdiff(fromlines,tolines,context_lines,linejunk=self._linejunk,
|
| 1972 |
+
charjunk=self._charjunk)
|
| 1973 |
+
|
| 1974 |
+
# set up iterator to wrap lines that exceed desired width
|
| 1975 |
+
if self._wrapcolumn:
|
| 1976 |
+
diffs = self._line_wrapper(diffs)
|
| 1977 |
+
|
| 1978 |
+
# collect up from/to lines and flags into lists (also format the lines)
|
| 1979 |
+
fromlist,tolist,flaglist = self._collect_lines(diffs)
|
| 1980 |
+
|
| 1981 |
+
# process change flags, generating middle column of next anchors/links
|
| 1982 |
+
fromlist,tolist,flaglist,next_href,next_id = self._convert_flags(
|
| 1983 |
+
fromlist,tolist,flaglist,context,numlines)
|
| 1984 |
+
|
| 1985 |
+
s = []
|
| 1986 |
+
fmt = ' <tr><td class="diff_next"%s>%s</td>%s' + \
|
| 1987 |
+
'<td class="diff_next">%s</td>%s</tr>\n'
|
| 1988 |
+
for i in range(len(flaglist)):
|
| 1989 |
+
if flaglist[i] is None:
|
| 1990 |
+
# mdiff yields None on separator lines skip the bogus ones
|
| 1991 |
+
# generated for the first line
|
| 1992 |
+
if i > 0:
|
| 1993 |
+
s.append(' </tbody> \n <tbody>\n')
|
| 1994 |
+
else:
|
| 1995 |
+
s.append( fmt % (next_id[i],next_href[i],fromlist[i],
|
| 1996 |
+
next_href[i],tolist[i]))
|
| 1997 |
+
if fromdesc or todesc:
|
| 1998 |
+
header_row = '<thead><tr>%s%s%s%s</tr></thead>' % (
|
| 1999 |
+
'<th class="diff_next"><br /></th>',
|
| 2000 |
+
'<th colspan="2" class="diff_header">%s</th>' % fromdesc,
|
| 2001 |
+
'<th class="diff_next"><br /></th>',
|
| 2002 |
+
'<th colspan="2" class="diff_header">%s</th>' % todesc)
|
| 2003 |
+
else:
|
| 2004 |
+
header_row = ''
|
| 2005 |
+
|
| 2006 |
+
table = self._table_template % dict(
|
| 2007 |
+
data_rows=''.join(s),
|
| 2008 |
+
header_row=header_row,
|
| 2009 |
+
prefix=self._prefix[1])
|
| 2010 |
+
|
| 2011 |
+
return table.replace('\0+','<span class="diff_add">'). \
|
| 2012 |
+
replace('\0-','<span class="diff_sub">'). \
|
| 2013 |
+
replace('\0^','<span class="diff_chg">'). \
|
| 2014 |
+
replace('\1','</span>'). \
|
| 2015 |
+
replace('\t',' ')
|
| 2016 |
+
|
| 2017 |
+
del re
|
| 2018 |
+
|
| 2019 |
+
def restore(delta, which):
|
| 2020 |
+
r"""
|
| 2021 |
+
Generate one of the two sequences that generated a delta.
|
| 2022 |
+
|
| 2023 |
+
Given a `delta` produced by `Differ.compare()` or `ndiff()`, extract
|
| 2024 |
+
lines originating from file 1 or 2 (parameter `which`), stripping off line
|
| 2025 |
+
prefixes.
|
| 2026 |
+
|
| 2027 |
+
Examples:
|
| 2028 |
+
|
| 2029 |
+
>>> diff = ndiff('one\ntwo\nthree\n'.splitlines(keepends=True),
|
| 2030 |
+
... 'ore\ntree\nemu\n'.splitlines(keepends=True))
|
| 2031 |
+
>>> diff = list(diff)
|
| 2032 |
+
>>> print(''.join(restore(diff, 1)), end="")
|
| 2033 |
+
one
|
| 2034 |
+
two
|
| 2035 |
+
three
|
| 2036 |
+
>>> print(''.join(restore(diff, 2)), end="")
|
| 2037 |
+
ore
|
| 2038 |
+
tree
|
| 2039 |
+
emu
|
| 2040 |
+
"""
|
| 2041 |
+
try:
|
| 2042 |
+
tag = {1: "- ", 2: "+ "}[int(which)]
|
| 2043 |
+
except KeyError:
|
| 2044 |
+
raise ValueError('unknown delta choice (must be 1 or 2): %r'
|
| 2045 |
+
% which) from None
|
| 2046 |
+
prefixes = (" ", tag)
|
| 2047 |
+
for line in delta:
|
| 2048 |
+
if line[:2] in prefixes:
|
| 2049 |
+
yield line[2:]
|
| 2050 |
+
|
| 2051 |
+
def _test():
|
| 2052 |
+
import doctest, difflib
|
| 2053 |
+
return doctest.testmod(difflib)
|
| 2054 |
+
|
| 2055 |
+
if __name__ == "__main__":
|
| 2056 |
+
_test()
|