s42chen commited on
Commit
cf8bbcd
·
verified ·
1 Parent(s): 28a048a

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. shared/package-files/0d/0d42d2b355c4b47ac2c8b84dfe0f89f0f8af557b6f4b128dd97cf98116ca9122/__init__.py +42 -0
  2. shared/package-files/0d/0d85ddbbe8cc487ed7713a216dcf31f0d88a44bb695fd2142df636d288647df0/benchmark.pxi +20 -0
  3. shared/package-files/33/3300593114fb9286af9360cc9d871a40e5dcbea4aedc24b832607d1dd71c7b96/two_canvases.py +54 -0
  4. shared/package-files/33/33005b05ab9a5233626a36b6e6864ab7bbc8f5b4465df17994ad69fbc010ebb5/ciphers.py +282 -0
  5. shared/package-files/33/33085245aa389b0dcda728610cc30321790a8f619b3eeda03e24f17cccf8fccc/linalg_vander.h +47 -0
  6. shared/package-files/33/330fa9d3b183cadb415ca68d0794aee61c34d434176608c465ee4cd5eecf9611/ed448.pyi +25 -0
  7. shared/package-files/33/3311dac7a97de32aa54d5665780a86efb20b11b5bac14e68b0f707cf127ce67b/multiarray.py +76 -0
  8. shared/package-files/33/331296a1aed4a094512e29b9dc7e8ea3261fcfcecfdfff585171983d39271954/histograms.pyi +27 -0
  9. shared/package-files/33/3313b8d0e4e0ff9cff1273326fac1e4078e1b732f55a04b07e3097734ce5f366/parasail.py +79 -0
  10. shared/package-files/33/3318448046c83c176f95a97c33b5cd82e0076bee038d72810bef3dac1085e590/tree.py +62 -0
  11. shared/package-files/33/331c770f5e07eb18d510cfe34f14da5b2f5620d82b4662d65c9a47e5281797e7/test_base.py +69 -0
  12. shared/package-files/33/331ca6c70946040dcfc76145cb321212d027915a317aaf9b24cd5f9368e412db/mpelements.py +172 -0
  13. shared/package-files/33/331f3a5c201fc345c41baedd53bdc68d96598b7f0464c244af0be0ae6efe4e15/test_constrainedlayout.py +743 -0
  14. shared/package-files/33/331ff95d94552759b94ad3b6a79ad52bd0ffcf2a6b3dbd8e0bc9b6aa5afae36f/fractional_max_pool2d_backward_meta_dispatch.h +25 -0
  15. shared/package-files/33/332288615a542442c1306223657cfe72a25c1a86204933385049efc483bd6b70/abstract.py +516 -0
  16. shared/package-files/33/3328083ba04a22cc3e487194398ac0684af6f903c1c40ef827e71e91b324c224/scatter_reduce_cuda_dispatch.h +26 -0
  17. shared/package-files/33/3328cb027cca61175005fa1fd56de4fe17f7d0cbea3a4a8bfff1b6da6439c70c/pzdr.afm +222 -0
  18. shared/package-files/33/33293b3dd4ae5a2346be22cdad57f7f288da5dd40d34f36ababe8c84cf320264/NativeMetaFunctions.h +1303 -0
  19. shared/package-files/33/332cbd2657d64c9dbd27c3b28aafaea6a6a0f957ec3c78378ecbaaec71d4f621/baseconv.pyi +24 -0
  20. shared/package-files/33/332cea5d4b963f5f8181b6c207327220b892fe389c64ed8b3543148efeef861d/scope.py +91 -0
  21. shared/package-files/33/332e5db8799453cbb47dadc745a0693bfb78cb9b190bc01ec503b8981ea82623/slow_conv_transpose2d_meta.h +27 -0
  22. shared/package-files/33/333231626133ad5f4d3f3559893f5fcd756b564fbd83564997ad3757ee28159f/_make_per_tensor_quantized_tensor_ops.h +39 -0
  23. shared/package-files/33/3333f5c213bd28025dfac3d303ed03990166e2773bc2e7615787c4ae2826e114/digamma_cpu_dispatch.h +26 -0
  24. shared/package-files/33/33347744575c5b047abf7344e1ae392834abd33659ea190eba92109525d32de4/_monitoring.py +81 -0
  25. shared/package-files/33/3334dd5e9e21c3a272819e5db1b49137efc74076d129087d390b8941855b1ec7/compat.py +43 -0
  26. shared/package-files/33/3334fb3983c45171d834f06b564c8a11a1b909ab3668e034c6faceee5e184eb4/testdouble_4.2c_SOL2.mat +0 -0
  27. shared/package-files/33/333555ba99cb1c4beec255429fa991ecb43da4b78d896336956c0d948c28a3df/test_shift.py +76 -0
  28. shared/package-files/33/3339f39dd38edd0a1c71c20cc9d74eeefd7211c0804be1cb6cb42a026adfcd67/_kalman_filter.pxd +690 -0
  29. shared/package-files/33/333dd019f806e7c875bae091f9bf6bfcfbfc2febc0f281f823834de8bea17c2d/user.pyi +6 -0
  30. shared/package-files/33/3341413075b40e3eae33a4254813f8c79a78b7c5261c11ef09667a1e846e2cd5/smooth_l1_loss.h +39 -0
  31. shared/package-files/33/3342d477dc64280b8dc7afc68ee13945b8b72927a8c79ba88b25e11fc72adb85/plotting.py +494 -0
  32. shared/package-files/33/3343d3b7c20e21c557a903d67b6379d2c9b812ad9ba1d457578564774f1cad79/mutable_ndim_array.py +13 -0
  33. shared/package-files/33/3344af465d1c008f91cb7852e15960800d16bacb2f764ad8e12e5327aceddb5a/css_parser.py +1280 -0
  34. shared/package-files/33/33451c69e142a8b3e01ac17c379987c3bb376ecae56c37c9636ba12e8cc9f7b2/_compat.pyi +40 -0
  35. shared/package-files/33/3348b29618eeaad3dc6ceda901574383d9fd7b5113df9f6743db7138412b98ca/__init__.py +1 -0
  36. shared/package-files/33/3348cd5dcc3c57790e839d3009ea86e17335a401228dc8666b1bb0cd3672d511/conv3d_native.h +22 -0
  37. shared/package-files/33/334b52745a1434c677fadeed0991dc8144b7ee2058cd9af335a0ee8b8696a11e/elnino.dat +733 -0
  38. shared/package-files/33/334bd92019e33c11d5e2f1549cf0482daaa247f7204ae539d24141fafee5d600/test_numbers.py +202 -0
  39. shared/package-files/33/334f71e0cc7a85c040c24b6fc2fd7a62f3d19acb838d9103c074f452691c832a/Center +0 -0
  40. shared/package-files/33/3352c161f9ce47e35e01d8cdd20fb76753cfd89e71cbc402c338099e1f13c26d/_neg_view_compositeexplicitautograd_dispatch.h +23 -0
  41. shared/package-files/33/3353358982c168f4c099f0d278b065bc3af648d7a61dc7708c70c56b2d3fa1a3/regression.py +940 -0
  42. shared/package-files/33/335449ddfb59e317ccded7a8fd45adfa06bb827e3bc9f24d9b80569a6a8da815/_rgi.py +759 -0
  43. shared/package-files/33/335515c7106005c298d2bee9bfc0ef384ebf0896afc3439dddf8bc887f803c49/__init__.pyi +3 -0
  44. shared/package-files/33/3357196f3fa52433326a6626880e34964e00c5570aee50e9a0a0a7c6d86f6e4f/utf_16_be.py +42 -0
  45. shared/package-files/33/3359968d2ef4a582c525abb9df836d82c95ca58ffc362638751991813ef74d5a/dataframe.py +113 -0
  46. shared/package-files/33/335d111c3ea2342e83a5b02c3eb2e423783fad1fdfb3424854a6988135c720d2/apple80p +0 -0
  47. shared/package-files/33/335fb9da0445995a7f6748e7c997d3503a9bc8c4db9a1693711b7e3fb1fd276f/missing.py +269 -0
  48. shared/package-files/33/335fe549be2e3479766a466442580e7f6d529dfbeb590cfaaf26ed0885407584/types.pxi +0 -0
  49. shared/package-files/33/33604784129b509f04d81d901317d57fc35b00ae1916126d98a45e9416590e1e/registry.py +414 -0
  50. shared/package-files/33/33608e94a85d3ddb541c831a396b65188564e4d1b36a0d4e1047172f4bed4e8e/__init__.pyi +27 -0
shared/package-files/0d/0d42d2b355c4b47ac2c8b84dfe0f89f0f8af557b6f4b128dd97cf98116ca9122/__init__.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # --------------------------------------------------------------------------------------
2
+ # Copyright (c) 2013-2026, Nucleic Development Team.
3
+ #
4
+ # Distributed under the terms of the Modified BSD License.
5
+ #
6
+ # The full license is in the file LICENSE, distributed with this software.
7
+ # --------------------------------------------------------------------------------------
8
+ from ._cext import (
9
+ Constraint,
10
+ Expression,
11
+ Solver,
12
+ Term,
13
+ Variable,
14
+ __kiwi_version__,
15
+ __version__,
16
+ strength,
17
+ )
18
+ from .exceptions import (
19
+ BadRequiredStrength,
20
+ DuplicateConstraint,
21
+ DuplicateEditVariable,
22
+ UnknownConstraint,
23
+ UnknownEditVariable,
24
+ UnsatisfiableConstraint,
25
+ )
26
+
27
+ __all__ = [
28
+ "BadRequiredStrength",
29
+ "Constraint",
30
+ "DuplicateConstraint",
31
+ "DuplicateEditVariable",
32
+ "Expression",
33
+ "Solver",
34
+ "Term",
35
+ "UnknownConstraint",
36
+ "UnknownEditVariable",
37
+ "UnsatisfiableConstraint",
38
+ "Variable",
39
+ "__kiwi_version__",
40
+ "__version__",
41
+ "strength",
42
+ ]
shared/package-files/0d/0d85ddbbe8cc487ed7713a216dcf31f0d88a44bb695fd2142df636d288647df0/benchmark.pxi ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
19
+ def benchmark_PandasObjectIsNull(list obj):
20
+ Benchmark_PandasObjectIsNull(obj)
shared/package-files/33/3300593114fb9286af9360cc9d871a40e5dcbea4aedc24b832607d1dd71c7b96/two_canvases.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """turtledemo.two_canvases
2
+
3
+ Use TurtleScreen and RawTurtle to draw on two
4
+ distinct canvases in a separate window. The
5
+ new window must be separately closed in
6
+ addition to pressing the STOP button.
7
+ """
8
+
9
+ from turtle import TurtleScreen, RawTurtle, TK
10
+
11
+ def main():
12
+ root = TK.Tk()
13
+ cv1 = TK.Canvas(root, width=300, height=200, bg="#ddffff")
14
+ cv2 = TK.Canvas(root, width=300, height=200, bg="#ffeeee")
15
+ cv1.pack()
16
+ cv2.pack()
17
+
18
+ s1 = TurtleScreen(cv1)
19
+ s1.bgcolor(0.85, 0.85, 1)
20
+ s2 = TurtleScreen(cv2)
21
+ s2.bgcolor(1, 0.85, 0.85)
22
+
23
+ p = RawTurtle(s1)
24
+ q = RawTurtle(s2)
25
+
26
+ p.color("red", (1, 0.85, 0.85))
27
+ p.width(3)
28
+ q.color("blue", (0.85, 0.85, 1))
29
+ q.width(3)
30
+
31
+ for t in p,q:
32
+ t.shape("turtle")
33
+ t.lt(36)
34
+
35
+ q.lt(180)
36
+
37
+ for t in p, q:
38
+ t.begin_fill()
39
+ for i in range(5):
40
+ for t in p, q:
41
+ t.fd(50)
42
+ t.lt(72)
43
+ for t in p,q:
44
+ t.end_fill()
45
+ t.lt(54)
46
+ t.pu()
47
+ t.bk(50)
48
+
49
+ return "EVENTLOOP"
50
+
51
+
52
+ if __name__ == '__main__':
53
+ main()
54
+ TK.mainloop() # keep window open until user closes it
shared/package-files/33/33005b05ab9a5233626a36b6e6864ab7bbc8f5b4465df17994ad69fbc010ebb5/ciphers.py ADDED
@@ -0,0 +1,282 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file is dual licensed under the terms of the Apache License, Version
2
+ # 2.0, and the BSD License. See the LICENSE file in the root of this repository
3
+ # for complete details.
4
+
5
+ from __future__ import annotations
6
+
7
+ import typing
8
+
9
+ from cryptography.exceptions import InvalidTag, UnsupportedAlgorithm, _Reasons
10
+ from cryptography.hazmat.primitives import ciphers
11
+ from cryptography.hazmat.primitives.ciphers import algorithms, modes
12
+
13
+ if typing.TYPE_CHECKING:
14
+ from cryptography.hazmat.backends.openssl.backend import Backend
15
+
16
+
17
+ class _CipherContext:
18
+ _ENCRYPT = 1
19
+ _DECRYPT = 0
20
+ _MAX_CHUNK_SIZE = 2**29
21
+
22
+ def __init__(self, backend: Backend, cipher, mode, operation: int) -> None:
23
+ self._backend = backend
24
+ self._cipher = cipher
25
+ self._mode = mode
26
+ self._operation = operation
27
+ self._tag: bytes | None = None
28
+
29
+ if isinstance(self._cipher, ciphers.BlockCipherAlgorithm):
30
+ self._block_size_bytes = self._cipher.block_size // 8
31
+ else:
32
+ self._block_size_bytes = 1
33
+
34
+ ctx = self._backend._lib.EVP_CIPHER_CTX_new()
35
+ ctx = self._backend._ffi.gc(
36
+ ctx, self._backend._lib.EVP_CIPHER_CTX_free
37
+ )
38
+
39
+ registry = self._backend._cipher_registry
40
+ try:
41
+ adapter = registry[type(cipher), type(mode)]
42
+ except KeyError:
43
+ raise UnsupportedAlgorithm(
44
+ "cipher {} in {} mode is not supported "
45
+ "by this backend.".format(
46
+ cipher.name, mode.name if mode else mode
47
+ ),
48
+ _Reasons.UNSUPPORTED_CIPHER,
49
+ )
50
+
51
+ evp_cipher = adapter(self._backend, cipher, mode)
52
+ if evp_cipher == self._backend._ffi.NULL:
53
+ msg = f"cipher {cipher.name} "
54
+ if mode is not None:
55
+ msg += f"in {mode.name} mode "
56
+ msg += (
57
+ "is not supported by this backend (Your version of OpenSSL "
58
+ "may be too old. Current version: {}.)"
59
+ ).format(self._backend.openssl_version_text())
60
+ raise UnsupportedAlgorithm(msg, _Reasons.UNSUPPORTED_CIPHER)
61
+
62
+ if isinstance(mode, modes.ModeWithInitializationVector):
63
+ iv_nonce = self._backend._ffi.from_buffer(
64
+ mode.initialization_vector
65
+ )
66
+ elif isinstance(mode, modes.ModeWithTweak):
67
+ iv_nonce = self._backend._ffi.from_buffer(mode.tweak)
68
+ elif isinstance(mode, modes.ModeWithNonce):
69
+ iv_nonce = self._backend._ffi.from_buffer(mode.nonce)
70
+ elif isinstance(cipher, algorithms.ChaCha20):
71
+ iv_nonce = self._backend._ffi.from_buffer(cipher.nonce)
72
+ else:
73
+ iv_nonce = self._backend._ffi.NULL
74
+ # begin init with cipher and operation type
75
+ res = self._backend._lib.EVP_CipherInit_ex(
76
+ ctx,
77
+ evp_cipher,
78
+ self._backend._ffi.NULL,
79
+ self._backend._ffi.NULL,
80
+ self._backend._ffi.NULL,
81
+ operation,
82
+ )
83
+ self._backend.openssl_assert(res != 0)
84
+ # set the key length to handle variable key ciphers
85
+ res = self._backend._lib.EVP_CIPHER_CTX_set_key_length(
86
+ ctx, len(cipher.key)
87
+ )
88
+ self._backend.openssl_assert(res != 0)
89
+ if isinstance(mode, modes.GCM):
90
+ res = self._backend._lib.EVP_CIPHER_CTX_ctrl(
91
+ ctx,
92
+ self._backend._lib.EVP_CTRL_AEAD_SET_IVLEN,
93
+ len(iv_nonce),
94
+ self._backend._ffi.NULL,
95
+ )
96
+ self._backend.openssl_assert(res != 0)
97
+ if mode.tag is not None:
98
+ res = self._backend._lib.EVP_CIPHER_CTX_ctrl(
99
+ ctx,
100
+ self._backend._lib.EVP_CTRL_AEAD_SET_TAG,
101
+ len(mode.tag),
102
+ mode.tag,
103
+ )
104
+ self._backend.openssl_assert(res != 0)
105
+ self._tag = mode.tag
106
+
107
+ # pass key/iv
108
+ res = self._backend._lib.EVP_CipherInit_ex(
109
+ ctx,
110
+ self._backend._ffi.NULL,
111
+ self._backend._ffi.NULL,
112
+ self._backend._ffi.from_buffer(cipher.key),
113
+ iv_nonce,
114
+ operation,
115
+ )
116
+
117
+ # Check for XTS mode duplicate keys error
118
+ errors = self._backend._consume_errors()
119
+ lib = self._backend._lib
120
+ if res == 0 and (
121
+ (
122
+ not lib.CRYPTOGRAPHY_IS_LIBRESSL
123
+ and errors[0]._lib_reason_match(
124
+ lib.ERR_LIB_EVP, lib.EVP_R_XTS_DUPLICATED_KEYS
125
+ )
126
+ )
127
+ or (
128
+ lib.Cryptography_HAS_PROVIDERS
129
+ and errors[0]._lib_reason_match(
130
+ lib.ERR_LIB_PROV, lib.PROV_R_XTS_DUPLICATED_KEYS
131
+ )
132
+ )
133
+ ):
134
+ raise ValueError("In XTS mode duplicated keys are not allowed")
135
+
136
+ self._backend.openssl_assert(res != 0, errors=errors)
137
+
138
+ # We purposely disable padding here as it's handled higher up in the
139
+ # API.
140
+ self._backend._lib.EVP_CIPHER_CTX_set_padding(ctx, 0)
141
+ self._ctx = ctx
142
+
143
+ def update(self, data: bytes) -> bytes:
144
+ buf = bytearray(len(data) + self._block_size_bytes - 1)
145
+ n = self.update_into(data, buf)
146
+ return bytes(buf[:n])
147
+
148
+ def update_into(self, data: bytes, buf: bytes) -> int:
149
+ total_data_len = len(data)
150
+ if len(buf) < (total_data_len + self._block_size_bytes - 1):
151
+ raise ValueError(
152
+ "buffer must be at least {} bytes for this payload".format(
153
+ len(data) + self._block_size_bytes - 1
154
+ )
155
+ )
156
+
157
+ data_processed = 0
158
+ total_out = 0
159
+ outlen = self._backend._ffi.new("int *")
160
+ baseoutbuf = self._backend._ffi.from_buffer(buf, require_writable=True)
161
+ baseinbuf = self._backend._ffi.from_buffer(data)
162
+
163
+ while data_processed != total_data_len:
164
+ outbuf = baseoutbuf + total_out
165
+ inbuf = baseinbuf + data_processed
166
+ inlen = min(self._MAX_CHUNK_SIZE, total_data_len - data_processed)
167
+
168
+ res = self._backend._lib.EVP_CipherUpdate(
169
+ self._ctx, outbuf, outlen, inbuf, inlen
170
+ )
171
+ if res == 0 and isinstance(self._mode, modes.XTS):
172
+ self._backend._consume_errors()
173
+ raise ValueError(
174
+ "In XTS mode you must supply at least a full block in the "
175
+ "first update call. For AES this is 16 bytes."
176
+ )
177
+ else:
178
+ self._backend.openssl_assert(res != 0)
179
+ data_processed += inlen
180
+ total_out += outlen[0]
181
+
182
+ return total_out
183
+
184
+ def finalize(self) -> bytes:
185
+ if (
186
+ self._operation == self._DECRYPT
187
+ and isinstance(self._mode, modes.ModeWithAuthenticationTag)
188
+ and self.tag is None
189
+ ):
190
+ raise ValueError(
191
+ "Authentication tag must be provided when decrypting."
192
+ )
193
+
194
+ buf = self._backend._ffi.new("unsigned char[]", self._block_size_bytes)
195
+ outlen = self._backend._ffi.new("int *")
196
+ res = self._backend._lib.EVP_CipherFinal_ex(self._ctx, buf, outlen)
197
+ if res == 0:
198
+ errors = self._backend._consume_errors()
199
+
200
+ if not errors and isinstance(self._mode, modes.GCM):
201
+ raise InvalidTag
202
+
203
+ lib = self._backend._lib
204
+ self._backend.openssl_assert(
205
+ errors[0]._lib_reason_match(
206
+ lib.ERR_LIB_EVP,
207
+ lib.EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH,
208
+ )
209
+ or (
210
+ lib.Cryptography_HAS_PROVIDERS
211
+ and errors[0]._lib_reason_match(
212
+ lib.ERR_LIB_PROV,
213
+ lib.PROV_R_WRONG_FINAL_BLOCK_LENGTH,
214
+ )
215
+ )
216
+ or (
217
+ lib.CRYPTOGRAPHY_IS_BORINGSSL
218
+ and errors[0].reason
219
+ == lib.CIPHER_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH
220
+ ),
221
+ errors=errors,
222
+ )
223
+ raise ValueError(
224
+ "The length of the provided data is not a multiple of "
225
+ "the block length."
226
+ )
227
+
228
+ if (
229
+ isinstance(self._mode, modes.GCM)
230
+ and self._operation == self._ENCRYPT
231
+ ):
232
+ tag_buf = self._backend._ffi.new(
233
+ "unsigned char[]", self._block_size_bytes
234
+ )
235
+ res = self._backend._lib.EVP_CIPHER_CTX_ctrl(
236
+ self._ctx,
237
+ self._backend._lib.EVP_CTRL_AEAD_GET_TAG,
238
+ self._block_size_bytes,
239
+ tag_buf,
240
+ )
241
+ self._backend.openssl_assert(res != 0)
242
+ self._tag = self._backend._ffi.buffer(tag_buf)[:]
243
+
244
+ res = self._backend._lib.EVP_CIPHER_CTX_reset(self._ctx)
245
+ self._backend.openssl_assert(res == 1)
246
+ return self._backend._ffi.buffer(buf)[: outlen[0]]
247
+
248
+ def finalize_with_tag(self, tag: bytes) -> bytes:
249
+ tag_len = len(tag)
250
+ if tag_len < self._mode._min_tag_length:
251
+ raise ValueError(
252
+ "Authentication tag must be {} bytes or longer.".format(
253
+ self._mode._min_tag_length
254
+ )
255
+ )
256
+ elif tag_len > self._block_size_bytes:
257
+ raise ValueError(
258
+ "Authentication tag cannot be more than {} bytes.".format(
259
+ self._block_size_bytes
260
+ )
261
+ )
262
+ res = self._backend._lib.EVP_CIPHER_CTX_ctrl(
263
+ self._ctx, self._backend._lib.EVP_CTRL_AEAD_SET_TAG, len(tag), tag
264
+ )
265
+ self._backend.openssl_assert(res != 0)
266
+ self._tag = tag
267
+ return self.finalize()
268
+
269
+ def authenticate_additional_data(self, data: bytes) -> None:
270
+ outlen = self._backend._ffi.new("int *")
271
+ res = self._backend._lib.EVP_CipherUpdate(
272
+ self._ctx,
273
+ self._backend._ffi.NULL,
274
+ outlen,
275
+ self._backend._ffi.from_buffer(data),
276
+ len(data),
277
+ )
278
+ self._backend.openssl_assert(res != 0)
279
+
280
+ @property
281
+ def tag(self) -> bytes | None:
282
+ return self._tag
shared/package-files/33/33085245aa389b0dcda728610cc30321790a8f619b3eeda03e24f17cccf8fccc/linalg_vander.h ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/linalg_vander_ops.h>
21
+
22
+ namespace at {
23
+
24
+
25
+ // aten::linalg_vander(Tensor x, *, SymInt? N=None) -> Tensor
26
+ inline at::Tensor linalg_vander(const at::Tensor & x, c10::optional<int64_t> N=c10::nullopt) {
27
+ return at::_ops::linalg_vander::call(x, N.has_value() ? c10::make_optional(c10::SymInt(*N)) : c10::nullopt);
28
+ }
29
+ namespace symint {
30
+ template <typename T, typename = std::enable_if_t<std::is_same<T, int64_t>::value>>
31
+ at::Tensor linalg_vander(const at::Tensor & x, c10::optional<int64_t> N=c10::nullopt) {
32
+ return at::_ops::linalg_vander::call(x, N.has_value() ? c10::make_optional(c10::SymInt(*N)) : c10::nullopt);
33
+ }
34
+ }
35
+
36
+ // aten::linalg_vander(Tensor x, *, SymInt? N=None) -> Tensor
37
+ inline at::Tensor linalg_vander_symint(const at::Tensor & x, c10::optional<c10::SymInt> N=c10::nullopt) {
38
+ return at::_ops::linalg_vander::call(x, N);
39
+ }
40
+ namespace symint {
41
+ template <typename T, typename = std::enable_if_t<std::is_same<T, c10::SymInt>::value>>
42
+ at::Tensor linalg_vander(const at::Tensor & x, c10::optional<c10::SymInt> N=c10::nullopt) {
43
+ return at::_ops::linalg_vander::call(x, N);
44
+ }
45
+ }
46
+
47
+ }
shared/package-files/33/330fa9d3b183cadb415ca68d0794aee61c34d434176608c465ee4cd5eecf9611/ed448.pyi ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from abc import ABCMeta, abstractmethod
2
+
3
+ from cryptography.hazmat.primitives.serialization import Encoding, KeySerializationEncryption, PrivateFormat, PublicFormat
4
+
5
+ class Ed448PrivateKey(metaclass=ABCMeta):
6
+ @classmethod
7
+ def generate(cls) -> Ed448PrivateKey: ...
8
+ @classmethod
9
+ def from_private_bytes(cls, data: bytes) -> Ed448PrivateKey: ...
10
+ @abstractmethod
11
+ def private_bytes(
12
+ self, encoding: Encoding, format: PrivateFormat, encryption_algorithm: KeySerializationEncryption
13
+ ) -> bytes: ...
14
+ @abstractmethod
15
+ def public_key(self) -> Ed448PublicKey: ...
16
+ @abstractmethod
17
+ def sign(self, data: bytes) -> bytes: ...
18
+
19
+ class Ed448PublicKey(metaclass=ABCMeta):
20
+ @classmethod
21
+ def from_public_bytes(cls, data: bytes) -> Ed448PublicKey: ...
22
+ @abstractmethod
23
+ def public_bytes(self, encoding: Encoding, format: PublicFormat) -> bytes: ...
24
+ @abstractmethod
25
+ def verify(self, signature: bytes, data: bytes) -> None: ...
shared/package-files/33/3311dac7a97de32aa54d5665780a86efb20b11b5bac14e68b0f707cf127ce67b/multiarray.py ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import numpy.typing as npt
3
+
4
+ AR_f8: npt.NDArray[np.float64] = np.array([1.0])
5
+ AR_i4 = np.array([1], dtype=np.int32)
6
+ AR_u1 = np.array([1], dtype=np.uint8)
7
+
8
+ AR_LIKE_f = [1.5]
9
+ AR_LIKE_i = [1]
10
+
11
+ b_f8 = np.broadcast(AR_f8)
12
+ b_i4_f8_f8 = np.broadcast(AR_i4, AR_f8, AR_f8)
13
+
14
+ next(b_f8)
15
+ b_f8.reset()
16
+ b_f8.index
17
+ b_f8.iters
18
+ b_f8.nd
19
+ b_f8.ndim
20
+ b_f8.numiter
21
+ b_f8.shape
22
+ b_f8.size
23
+
24
+ next(b_i4_f8_f8)
25
+ b_i4_f8_f8.reset()
26
+ b_i4_f8_f8.ndim
27
+ b_i4_f8_f8.index
28
+ b_i4_f8_f8.iters
29
+ b_i4_f8_f8.nd
30
+ b_i4_f8_f8.numiter
31
+ b_i4_f8_f8.shape
32
+ b_i4_f8_f8.size
33
+
34
+ np.inner(AR_f8, AR_i4)
35
+
36
+ np.where([True, True, False])
37
+ np.where([True, True, False], 1, 0)
38
+
39
+ np.lexsort([0, 1, 2])
40
+
41
+ np.can_cast(np.dtype("i8"), int)
42
+ np.can_cast(AR_f8, "f8")
43
+ np.can_cast(AR_f8, np.complex128, casting="unsafe")
44
+
45
+ np.min_scalar_type([1])
46
+ np.min_scalar_type(AR_f8)
47
+
48
+ np.result_type(int, AR_i4)
49
+ np.result_type(AR_f8, AR_u1)
50
+ np.result_type(AR_f8, np.complex128)
51
+
52
+ np.dot(AR_LIKE_f, AR_i4)
53
+ np.dot(AR_u1, 1)
54
+ np.dot(1.5j, 1)
55
+ np.dot(AR_u1, 1, out=AR_f8)
56
+
57
+ np.vdot(AR_LIKE_f, AR_i4)
58
+ np.vdot(AR_u1, 1)
59
+ np.vdot(1.5j, 1)
60
+
61
+ np.bincount(AR_i4)
62
+
63
+ np.copyto(AR_f8, [1.6])
64
+
65
+ np.putmask(AR_f8, [True], 1.5)
66
+
67
+ np.packbits(AR_i4)
68
+ np.packbits(AR_u1)
69
+
70
+ np.unpackbits(AR_u1)
71
+
72
+ np.shares_memory(1, 2)
73
+ np.shares_memory(AR_f8, AR_f8, max_work=1)
74
+
75
+ np.may_share_memory(1, 2)
76
+ np.may_share_memory(AR_f8, AR_f8, max_work=1)
shared/package-files/33/331296a1aed4a094512e29b9dc7e8ea3261fcfcecfdfff585171983d39271954/histograms.pyi ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+ from typing import Any
3
+
4
+ import numpy as np
5
+ import numpy.typing as npt
6
+
7
+ if sys.version_info >= (3, 11):
8
+ from typing import assert_type
9
+ else:
10
+ from typing_extensions import assert_type
11
+
12
+ AR_i8: npt.NDArray[np.int64]
13
+ AR_f8: npt.NDArray[np.float64]
14
+
15
+ assert_type(np.histogram_bin_edges(AR_i8, bins="auto"), npt.NDArray[Any])
16
+ assert_type(np.histogram_bin_edges(AR_i8, bins="rice", range=(0, 3)), npt.NDArray[Any])
17
+ assert_type(np.histogram_bin_edges(AR_i8, bins="scott", weights=AR_f8), npt.NDArray[Any])
18
+
19
+ assert_type(np.histogram(AR_i8, bins="auto"), tuple[npt.NDArray[Any], npt.NDArray[Any]])
20
+ assert_type(np.histogram(AR_i8, bins="rice", range=(0, 3)), tuple[npt.NDArray[Any], npt.NDArray[Any]])
21
+ assert_type(np.histogram(AR_i8, bins="scott", weights=AR_f8), tuple[npt.NDArray[Any], npt.NDArray[Any]])
22
+ assert_type(np.histogram(AR_f8, bins=1, density=True), tuple[npt.NDArray[Any], npt.NDArray[Any]])
23
+
24
+ assert_type(np.histogramdd(AR_i8, bins=[1]), tuple[npt.NDArray[Any], list[npt.NDArray[Any]]])
25
+ assert_type(np.histogramdd(AR_i8, range=[(0, 3)]), tuple[npt.NDArray[Any], list[npt.NDArray[Any]]])
26
+ assert_type(np.histogramdd(AR_i8, weights=AR_f8), tuple[npt.NDArray[Any], list[npt.NDArray[Any]]])
27
+ assert_type(np.histogramdd(AR_f8, density=True), tuple[npt.NDArray[Any], list[npt.NDArray[Any]]])
shared/package-files/33/3313b8d0e4e0ff9cff1273326fac1e4078e1b732f55a04b07e3097734ce5f366/parasail.py ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.parasail
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for ParaSail.
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.lexer import RegexLexer, include
14
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
15
+ Number, Punctuation, Literal
16
+
17
+ __all__ = ['ParaSailLexer']
18
+
19
+
20
+ class ParaSailLexer(RegexLexer):
21
+ """
22
+ For ParaSail source code.
23
+
24
+ .. versionadded:: 2.1
25
+ """
26
+
27
+ name = 'ParaSail'
28
+ url = 'http://www.parasail-lang.org'
29
+ aliases = ['parasail']
30
+ filenames = ['*.psi', '*.psl']
31
+ mimetypes = ['text/x-parasail']
32
+
33
+ flags = re.MULTILINE
34
+
35
+ tokens = {
36
+ 'root': [
37
+ (r'[^\S\n]+', Text),
38
+ (r'//.*?\n', Comment.Single),
39
+ (r'\b(and|or|xor)=', Operator.Word),
40
+ (r'\b(and(\s+then)?|or(\s+else)?|xor|rem|mod|'
41
+ r'(is|not)\s+null)\b',
42
+ Operator.Word),
43
+ # Keywords
44
+ (r'\b(abs|abstract|all|block|class|concurrent|const|continue|'
45
+ r'each|end|exit|extends|exports|forward|func|global|implements|'
46
+ r'import|in|interface|is|lambda|locked|new|not|null|of|op|'
47
+ r'optional|private|queued|ref|return|reverse|separate|some|'
48
+ r'type|until|var|with|'
49
+ # Control flow
50
+ r'if|then|else|elsif|case|for|while|loop)\b',
51
+ Keyword.Reserved),
52
+ (r'(abstract\s+)?(interface|class|op|func|type)',
53
+ Keyword.Declaration),
54
+ # Literals
55
+ (r'"[^"]*"', String),
56
+ (r'\\[\'ntrf"0]', String.Escape),
57
+ (r'#[a-zA-Z]\w*', Literal), # Enumeration
58
+ include('numbers'),
59
+ (r"'[^']'", String.Char),
60
+ (r'[a-zA-Z]\w*', Name),
61
+ # Operators and Punctuation
62
+ (r'(<==|==>|<=>|\*\*=|<\|=|<<=|>>=|==|!=|=\?|<=|>=|'
63
+ r'\*\*|<<|>>|=>|:=|\+=|-=|\*=|\|=|\||/=|\+|-|\*|/|'
64
+ r'\.\.|<\.\.|\.\.<|<\.\.<)',
65
+ Operator),
66
+ (r'(<|>|\[|\]|\(|\)|\||:|;|,|.|\{|\}|->)',
67
+ Punctuation),
68
+ (r'\n+', Text),
69
+ ],
70
+ 'numbers': [
71
+ (r'\d[0-9_]*#[0-9a-fA-F][0-9a-fA-F_]*#', Number.Hex), # any base
72
+ (r'0[xX][0-9a-fA-F][0-9a-fA-F_]*', Number.Hex), # C-like hex
73
+ (r'0[bB][01][01_]*', Number.Bin), # C-like bin
74
+ (r'\d[0-9_]*\.\d[0-9_]*[eE][+-]\d[0-9_]*', # float exp
75
+ Number.Float),
76
+ (r'\d[0-9_]*\.\d[0-9_]*', Number.Float), # float
77
+ (r'\d[0-9_]*', Number.Integer), # integer
78
+ ],
79
+ }
shared/package-files/33/3318448046c83c176f95a97c33b5cd82e0076bee038d72810bef3dac1085e590/tree.py ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """ turtle-example-suite:
3
+
4
+ tdemo_tree.py
5
+
6
+ Displays a 'breadth-first-tree' - in contrast
7
+ to the classical Logo tree drawing programs,
8
+ which use a depth-first-algorithm.
9
+
10
+ Uses:
11
+ (1) a tree-generator, where the drawing is
12
+ quasi the side-effect, whereas the generator
13
+ always yields None.
14
+ (2) Turtle-cloning: At each branching point
15
+ the current pen is cloned. So in the end
16
+ there are 1024 turtles.
17
+ """
18
+ from turtle import Turtle, mainloop
19
+ from time import perf_counter as clock
20
+
21
+ def tree(plist, l, a, f):
22
+ """ plist is list of pens
23
+ l is length of branch
24
+ a is half of the angle between 2 branches
25
+ f is factor by which branch is shortened
26
+ from level to level."""
27
+ if l > 3:
28
+ lst = []
29
+ for p in plist:
30
+ p.forward(l)
31
+ q = p.clone()
32
+ p.left(a)
33
+ q.right(a)
34
+ lst.append(p)
35
+ lst.append(q)
36
+ for x in tree(lst, l*f, a, f):
37
+ yield None
38
+
39
+ def maketree():
40
+ p = Turtle()
41
+ p.setundobuffer(None)
42
+ p.hideturtle()
43
+ p.speed(0)
44
+ p.getscreen().tracer(30,0)
45
+ p.left(90)
46
+ p.penup()
47
+ p.forward(-210)
48
+ p.pendown()
49
+ t = tree([p], 200, 65, 0.6375)
50
+ for x in t:
51
+ pass
52
+
53
+ def main():
54
+ a=clock()
55
+ maketree()
56
+ b=clock()
57
+ return "done: %.2f sec." % (b-a)
58
+
59
+ if __name__ == "__main__":
60
+ msg = main()
61
+ print(msg)
62
+ mainloop()
shared/package-files/33/331c770f5e07eb18d510cfe34f14da5b2f5620d82b4662d65c9a47e5281797e7/test_base.py ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2012 Anaconda, Inc
2
+ # SPDX-License-Identifier: BSD-3-Clause
3
+ import random
4
+ import types
5
+ import unittest
6
+ from contextlib import contextmanager
7
+ from unittest import mock
8
+
9
+ from conda.exceptions import SpecNotFound
10
+ from conda_env import specs
11
+
12
+ true_func = mock.Mock(return_value=True)
13
+ false_func = mock.Mock(return_value=False)
14
+
15
+
16
+ @contextmanager
17
+ def patched_specs(*new_specs):
18
+ with mock.patch.object(specs, "all_specs") as all_specs:
19
+ all_specs.__iter__.return_value = new_specs
20
+ yield all_specs
21
+
22
+
23
+ def generate_two_specs():
24
+ spec1 = mock.Mock(can_handle=false_func)
25
+ spec1.return_value = spec1
26
+ spec2 = mock.Mock(can_handle=true_func)
27
+ spec2.return_value = spec2
28
+ return spec1, spec2
29
+
30
+
31
+ class DetectTestCase(unittest.TestCase):
32
+ def test_has_detect_function(self):
33
+ self.assertTrue(hasattr(specs, "detect"))
34
+ self.assertIsInstance(specs.detect, types.FunctionType)
35
+
36
+ def test_dispatches_to_registered_specs(self):
37
+ spec1, spec2 = generate_two_specs()
38
+ with patched_specs(spec1, spec2):
39
+ actual = specs.detect(name="foo")
40
+ self.assertEqual(actual, spec2)
41
+
42
+ def test_passes_kwargs_to_all_specs(self):
43
+ random_kwargs = {
44
+ "foo": random.randint(100, 200),
45
+ "bar%d" % random.randint(100, 200): True,
46
+ }
47
+
48
+ spec1, spec2 = generate_two_specs()
49
+ with patched_specs(spec1, spec2):
50
+ specs.detect(**random_kwargs)
51
+ spec1.assert_called_with(**random_kwargs)
52
+ spec2.assert_called_with(**random_kwargs)
53
+
54
+ def test_raises_exception_if_no_detection(self):
55
+ spec1 = generate_two_specs()[0]
56
+ spec1.msg = "msg"
57
+ with patched_specs(spec1):
58
+ with self.assertRaises(SpecNotFound):
59
+ specs.detect(name="foo")
60
+
61
+ def test_has_build_msg_function(self):
62
+ self.assertTrue(hasattr(specs, "build_message"))
63
+ self.assertIsInstance(specs.build_message, types.FunctionType)
64
+
65
+ def test_build_msg(self):
66
+ spec3 = mock.Mock(msg="error 3")
67
+ spec4 = mock.Mock(msg="error 4")
68
+ spec5 = mock.Mock(msg=None)
69
+ self.assertEqual(specs.build_message([spec3, spec4, spec5]), "error 3\nerror 4")
shared/package-files/33/331ca6c70946040dcfc76145cb321212d027915a317aaf9b24cd5f9368e412db/mpelements.py ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Real and complex elements. """
2
+
3
+
4
+ from sympy.polys.domains.domainelement import DomainElement
5
+ from sympy.utilities import public
6
+
7
+ from mpmath.ctx_mp_python import PythonMPContext, _mpf, _mpc, _constant
8
+ from mpmath.libmp import (MPZ_ONE, fzero, fone, finf, fninf, fnan,
9
+ round_nearest, mpf_mul, repr_dps, int_types,
10
+ from_int, from_float, from_str, to_rational)
11
+ from mpmath.rational import mpq
12
+
13
+
14
+ @public
15
+ class RealElement(_mpf, DomainElement):
16
+ """An element of a real domain. """
17
+
18
+ __slots__ = ('__mpf__',)
19
+
20
+ def _set_mpf(self, val):
21
+ self.__mpf__ = val
22
+
23
+ _mpf_ = property(lambda self: self.__mpf__, _set_mpf)
24
+
25
+ def parent(self):
26
+ return self.context._parent
27
+
28
+ @public
29
+ class ComplexElement(_mpc, DomainElement):
30
+ """An element of a complex domain. """
31
+
32
+ __slots__ = ('__mpc__',)
33
+
34
+ def _set_mpc(self, val):
35
+ self.__mpc__ = val
36
+
37
+ _mpc_ = property(lambda self: self.__mpc__, _set_mpc)
38
+
39
+ def parent(self):
40
+ return self.context._parent
41
+
42
+ new = object.__new__
43
+
44
+ @public
45
+ class MPContext(PythonMPContext):
46
+
47
+ def __init__(ctx, prec=53, dps=None, tol=None, real=False):
48
+ ctx._prec_rounding = [prec, round_nearest]
49
+
50
+ if dps is None:
51
+ ctx._set_prec(prec)
52
+ else:
53
+ ctx._set_dps(dps)
54
+
55
+ ctx.mpf = RealElement
56
+ ctx.mpc = ComplexElement
57
+ ctx.mpf._ctxdata = [ctx.mpf, new, ctx._prec_rounding]
58
+ ctx.mpc._ctxdata = [ctx.mpc, new, ctx._prec_rounding]
59
+
60
+ if real:
61
+ ctx.mpf.context = ctx
62
+ else:
63
+ ctx.mpc.context = ctx
64
+
65
+ ctx.constant = _constant
66
+ ctx.constant._ctxdata = [ctx.mpf, new, ctx._prec_rounding]
67
+ ctx.constant.context = ctx
68
+
69
+ ctx.types = [ctx.mpf, ctx.mpc, ctx.constant]
70
+ ctx.trap_complex = True
71
+ ctx.pretty = True
72
+
73
+ if tol is None:
74
+ ctx.tol = ctx._make_tol()
75
+ elif tol is False:
76
+ ctx.tol = fzero
77
+ else:
78
+ ctx.tol = ctx._convert_tol(tol)
79
+
80
+ ctx.tolerance = ctx.make_mpf(ctx.tol)
81
+
82
+ if not ctx.tolerance:
83
+ ctx.max_denom = 1000000
84
+ else:
85
+ ctx.max_denom = int(1/ctx.tolerance)
86
+
87
+ ctx.zero = ctx.make_mpf(fzero)
88
+ ctx.one = ctx.make_mpf(fone)
89
+ ctx.j = ctx.make_mpc((fzero, fone))
90
+ ctx.inf = ctx.make_mpf(finf)
91
+ ctx.ninf = ctx.make_mpf(fninf)
92
+ ctx.nan = ctx.make_mpf(fnan)
93
+
94
+ def _make_tol(ctx):
95
+ hundred = (0, 25, 2, 5)
96
+ eps = (0, MPZ_ONE, 1-ctx.prec, 1)
97
+ return mpf_mul(hundred, eps)
98
+
99
+ def make_tol(ctx):
100
+ return ctx.make_mpf(ctx._make_tol())
101
+
102
+ def _convert_tol(ctx, tol):
103
+ if isinstance(tol, int_types):
104
+ return from_int(tol)
105
+ if isinstance(tol, float):
106
+ return from_float(tol)
107
+ if hasattr(tol, "_mpf_"):
108
+ return tol._mpf_
109
+ prec, rounding = ctx._prec_rounding
110
+ if isinstance(tol, str):
111
+ return from_str(tol, prec, rounding)
112
+ raise ValueError("expected a real number, got %s" % tol)
113
+
114
+ def _convert_fallback(ctx, x, strings):
115
+ raise TypeError("cannot create mpf from " + repr(x))
116
+
117
+ @property
118
+ def _repr_digits(ctx):
119
+ return repr_dps(ctx._prec)
120
+
121
+ @property
122
+ def _str_digits(ctx):
123
+ return ctx._dps
124
+
125
+ def to_rational(ctx, s, limit=True):
126
+ p, q = to_rational(s._mpf_)
127
+
128
+ if not limit or q <= ctx.max_denom:
129
+ return p, q
130
+
131
+ p0, q0, p1, q1 = 0, 1, 1, 0
132
+ n, d = p, q
133
+
134
+ while True:
135
+ a = n//d
136
+ q2 = q0 + a*q1
137
+ if q2 > ctx.max_denom:
138
+ break
139
+ p0, q0, p1, q1 = p1, q1, p0 + a*p1, q2
140
+ n, d = d, n - a*d
141
+
142
+ k = (ctx.max_denom - q0)//q1
143
+
144
+ number = mpq(p, q)
145
+ bound1 = mpq(p0 + k*p1, q0 + k*q1)
146
+ bound2 = mpq(p1, q1)
147
+
148
+ if not bound2 or not bound1:
149
+ return p, q
150
+ elif abs(bound2 - number) <= abs(bound1 - number):
151
+ return bound2._mpq_
152
+ else:
153
+ return bound1._mpq_
154
+
155
+ def almosteq(ctx, s, t, rel_eps=None, abs_eps=None):
156
+ t = ctx.convert(t)
157
+ if abs_eps is None and rel_eps is None:
158
+ rel_eps = abs_eps = ctx.tolerance or ctx.make_tol()
159
+ if abs_eps is None:
160
+ abs_eps = ctx.convert(rel_eps)
161
+ elif rel_eps is None:
162
+ rel_eps = ctx.convert(abs_eps)
163
+ diff = abs(s-t)
164
+ if diff <= abs_eps:
165
+ return True
166
+ abss = abs(s)
167
+ abst = abs(t)
168
+ if abss < abst:
169
+ err = diff/abst
170
+ else:
171
+ err = diff/abss
172
+ return err <= rel_eps
shared/package-files/33/331f3a5c201fc345c41baedd53bdc68d96598b7f0464c244af0be0ae6efe4e15/test_constrainedlayout.py ADDED
@@ -0,0 +1,743 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gc
2
+ import platform
3
+
4
+ import numpy as np
5
+ import pytest
6
+
7
+ import matplotlib as mpl
8
+ from matplotlib.testing.decorators import image_comparison
9
+ import matplotlib.pyplot as plt
10
+ import matplotlib.transforms as mtransforms
11
+ from matplotlib import gridspec, ticker
12
+
13
+
14
+ pytestmark = [
15
+ pytest.mark.usefixtures('text_placeholders')
16
+ ]
17
+
18
+
19
+ def example_plot(ax, fontsize=12, nodec=False):
20
+ ax.plot([1, 2])
21
+ ax.locator_params(nbins=3)
22
+ if not nodec:
23
+ ax.set_xlabel('x-label', fontsize=fontsize)
24
+ ax.set_ylabel('y-label', fontsize=fontsize)
25
+ ax.set_title('Title', fontsize=fontsize)
26
+ else:
27
+ ax.set_xticklabels([])
28
+ ax.set_yticklabels([])
29
+
30
+
31
+ def example_pcolor(ax, fontsize=12):
32
+ dx, dy = 0.6, 0.6
33
+ y, x = np.mgrid[slice(-3, 3 + dy, dy),
34
+ slice(-3, 3 + dx, dx)]
35
+ z = (1 - x / 2. + x ** 5 + y ** 3) * np.exp(-x ** 2 - y ** 2)
36
+ pcm = ax.pcolormesh(x, y, z[:-1, :-1], cmap='RdBu_r', vmin=-1., vmax=1.,
37
+ rasterized=True)
38
+ ax.set_xlabel('x-label', fontsize=fontsize)
39
+ ax.set_ylabel('y-label', fontsize=fontsize)
40
+ ax.set_title('Title', fontsize=fontsize)
41
+ return pcm
42
+
43
+
44
+ @image_comparison(['constrained_layout1.png'], style='mpl20')
45
+ def test_constrained_layout1():
46
+ """Test constrained_layout for a single subplot"""
47
+ fig = plt.figure(layout="constrained")
48
+ ax = fig.add_subplot()
49
+ example_plot(ax, fontsize=24)
50
+
51
+
52
+ @image_comparison(['constrained_layout2.png'], style='mpl20')
53
+ def test_constrained_layout2():
54
+ """Test constrained_layout for 2x2 subplots"""
55
+ fig, axs = plt.subplots(2, 2, layout="constrained")
56
+ for ax in axs.flat:
57
+ example_plot(ax, fontsize=24)
58
+
59
+
60
+ @image_comparison(['constrained_layout3.png'], style='mpl20')
61
+ def test_constrained_layout3():
62
+ """Test constrained_layout for colorbars with subplots"""
63
+
64
+ fig, axs = plt.subplots(2, 2, layout="constrained")
65
+ for nn, ax in enumerate(axs.flat):
66
+ pcm = example_pcolor(ax, fontsize=24)
67
+ if nn == 3:
68
+ pad = 0.08
69
+ else:
70
+ pad = 0.02 # default
71
+ fig.colorbar(pcm, ax=ax, pad=pad)
72
+
73
+
74
+ @image_comparison(['constrained_layout4.png'], style='mpl20')
75
+ def test_constrained_layout4():
76
+ """Test constrained_layout for a single colorbar with subplots"""
77
+
78
+ fig, axs = plt.subplots(2, 2, layout="constrained")
79
+ for ax in axs.flat:
80
+ pcm = example_pcolor(ax, fontsize=24)
81
+ fig.colorbar(pcm, ax=axs, pad=0.01, shrink=0.6)
82
+
83
+
84
+ @image_comparison(['constrained_layout5.png'], style='mpl20')
85
+ def test_constrained_layout5():
86
+ """
87
+ Test constrained_layout for a single colorbar with subplots,
88
+ colorbar bottom
89
+ """
90
+
91
+ fig, axs = plt.subplots(2, 2, layout="constrained")
92
+ for ax in axs.flat:
93
+ pcm = example_pcolor(ax, fontsize=24)
94
+ fig.colorbar(pcm, ax=axs,
95
+ use_gridspec=False, pad=0.01, shrink=0.6,
96
+ location='bottom')
97
+
98
+
99
+ @image_comparison(['constrained_layout6.png'], style='mpl20')
100
+ def test_constrained_layout6():
101
+ """Test constrained_layout for nested gridspecs"""
102
+ fig = plt.figure(layout="constrained")
103
+ gs = fig.add_gridspec(1, 2, figure=fig)
104
+ gsl = gs[0].subgridspec(2, 2)
105
+ gsr = gs[1].subgridspec(1, 2)
106
+ axsl = []
107
+ for gs in gsl:
108
+ ax = fig.add_subplot(gs)
109
+ axsl += [ax]
110
+ example_plot(ax, fontsize=12)
111
+ ax.set_xlabel('x-label\nMultiLine')
112
+ axsr = []
113
+ for gs in gsr:
114
+ ax = fig.add_subplot(gs)
115
+ axsr += [ax]
116
+ pcm = example_pcolor(ax, fontsize=12)
117
+
118
+ fig.colorbar(pcm, ax=axsr,
119
+ pad=0.01, shrink=0.99, location='bottom',
120
+ ticks=ticker.MaxNLocator(nbins=5))
121
+
122
+
123
+ def test_identical_subgridspec():
124
+
125
+ fig = plt.figure(constrained_layout=True)
126
+
127
+ GS = fig.add_gridspec(2, 1)
128
+
129
+ GSA = GS[0].subgridspec(1, 3)
130
+ GSB = GS[1].subgridspec(1, 3)
131
+
132
+ axa = []
133
+ axb = []
134
+ for i in range(3):
135
+ axa += [fig.add_subplot(GSA[i])]
136
+ axb += [fig.add_subplot(GSB[i])]
137
+
138
+ fig.draw_without_rendering()
139
+ # check first row above second
140
+ assert axa[0].get_position().y0 > axb[0].get_position().y1
141
+
142
+
143
+ def test_constrained_layout7():
144
+ """Test for proper warning if fig not set in GridSpec"""
145
+ with pytest.warns(
146
+ UserWarning, match=('There are no gridspecs with layoutgrids. '
147
+ 'Possibly did not call parent GridSpec with '
148
+ 'the "figure" keyword')):
149
+ fig = plt.figure(layout="constrained")
150
+ gs = gridspec.GridSpec(1, 2)
151
+ gsl = gridspec.GridSpecFromSubplotSpec(2, 2, gs[0])
152
+ gsr = gridspec.GridSpecFromSubplotSpec(1, 2, gs[1])
153
+ for gs in gsl:
154
+ fig.add_subplot(gs)
155
+ # need to trigger a draw to get warning
156
+ fig.draw_without_rendering()
157
+
158
+
159
+ @image_comparison(['constrained_layout8.png'], style='mpl20')
160
+ def test_constrained_layout8():
161
+ """Test for gridspecs that are not completely full"""
162
+
163
+ fig = plt.figure(figsize=(10, 5), layout="constrained")
164
+ gs = gridspec.GridSpec(3, 5, figure=fig)
165
+ axs = []
166
+ for j in [0, 1]:
167
+ if j == 0:
168
+ ilist = [1]
169
+ else:
170
+ ilist = [0, 4]
171
+ for i in ilist:
172
+ ax = fig.add_subplot(gs[j, i])
173
+ axs += [ax]
174
+ example_pcolor(ax, fontsize=9)
175
+ if i > 0:
176
+ ax.set_ylabel('')
177
+ if j < 1:
178
+ ax.set_xlabel('')
179
+ ax.set_title('')
180
+ ax = fig.add_subplot(gs[2, :])
181
+ axs += [ax]
182
+ pcm = example_pcolor(ax, fontsize=9)
183
+
184
+ fig.colorbar(pcm, ax=axs, pad=0.01, shrink=0.6)
185
+
186
+
187
+ @image_comparison(['constrained_layout9.png'], style='mpl20')
188
+ def test_constrained_layout9():
189
+ """Test for handling suptitle and for sharex and sharey"""
190
+
191
+ fig, axs = plt.subplots(2, 2, layout="constrained",
192
+ sharex=False, sharey=False)
193
+ for ax in axs.flat:
194
+ pcm = example_pcolor(ax, fontsize=24)
195
+ ax.set_xlabel('')
196
+ ax.set_ylabel('')
197
+ ax.set_aspect(2.)
198
+ fig.colorbar(pcm, ax=axs, pad=0.01, shrink=0.6)
199
+ fig.suptitle('Test Suptitle', fontsize=28)
200
+
201
+
202
+ @image_comparison(['constrained_layout10.png'], style='mpl20',
203
+ tol=0 if platform.machine() == 'x86_64' else 0.032)
204
+ def test_constrained_layout10():
205
+ """Test for handling legend outside axis"""
206
+ fig, axs = plt.subplots(2, 2, layout="constrained")
207
+ for ax in axs.flat:
208
+ ax.plot(np.arange(12), label='This is a label')
209
+ ax.legend(loc='center left', bbox_to_anchor=(0.8, 0.5))
210
+
211
+
212
+ @image_comparison(['constrained_layout11.png'], style='mpl20')
213
+ def test_constrained_layout11():
214
+ """Test for multiple nested gridspecs"""
215
+
216
+ fig = plt.figure(layout="constrained", figsize=(13, 3))
217
+ gs0 = gridspec.GridSpec(1, 2, figure=fig)
218
+ gsl = gridspec.GridSpecFromSubplotSpec(1, 2, gs0[0])
219
+ gsl0 = gridspec.GridSpecFromSubplotSpec(2, 2, gsl[1])
220
+ ax = fig.add_subplot(gs0[1])
221
+ example_plot(ax, fontsize=9)
222
+ axs = []
223
+ for gs in gsl0:
224
+ ax = fig.add_subplot(gs)
225
+ axs += [ax]
226
+ pcm = example_pcolor(ax, fontsize=9)
227
+ fig.colorbar(pcm, ax=axs, shrink=0.6, aspect=70.)
228
+ ax = fig.add_subplot(gsl[0])
229
+ example_plot(ax, fontsize=9)
230
+
231
+
232
+ @image_comparison(['constrained_layout11rat.png'], style='mpl20')
233
+ def test_constrained_layout11rat():
234
+ """Test for multiple nested gridspecs with width_ratios"""
235
+
236
+ fig = plt.figure(layout="constrained", figsize=(10, 3))
237
+ gs0 = gridspec.GridSpec(1, 2, figure=fig, width_ratios=[6, 1])
238
+ gsl = gridspec.GridSpecFromSubplotSpec(1, 2, gs0[0])
239
+ gsl0 = gridspec.GridSpecFromSubplotSpec(2, 2, gsl[1], height_ratios=[2, 1])
240
+ ax = fig.add_subplot(gs0[1])
241
+ example_plot(ax, fontsize=9)
242
+ axs = []
243
+ for gs in gsl0:
244
+ ax = fig.add_subplot(gs)
245
+ axs += [ax]
246
+ pcm = example_pcolor(ax, fontsize=9)
247
+ fig.colorbar(pcm, ax=axs, shrink=0.6, aspect=70.)
248
+ ax = fig.add_subplot(gsl[0])
249
+ example_plot(ax, fontsize=9)
250
+
251
+
252
+ @image_comparison(['constrained_layout12.png'], style='mpl20')
253
+ def test_constrained_layout12():
254
+ """Test that very unbalanced labeling still works."""
255
+ fig = plt.figure(layout="constrained", figsize=(6, 8))
256
+
257
+ gs0 = gridspec.GridSpec(6, 2, figure=fig)
258
+
259
+ ax1 = fig.add_subplot(gs0[:3, 1])
260
+ ax2 = fig.add_subplot(gs0[3:, 1])
261
+
262
+ example_plot(ax1, fontsize=18)
263
+ example_plot(ax2, fontsize=18)
264
+
265
+ ax = fig.add_subplot(gs0[0:2, 0])
266
+ example_plot(ax, nodec=True)
267
+ ax = fig.add_subplot(gs0[2:4, 0])
268
+ example_plot(ax, nodec=True)
269
+ ax = fig.add_subplot(gs0[4:, 0])
270
+ example_plot(ax, nodec=True)
271
+ ax.set_xlabel('x-label')
272
+
273
+
274
+ @image_comparison(['constrained_layout13.png'], style='mpl20')
275
+ def test_constrained_layout13():
276
+ """Test that padding works."""
277
+ fig, axs = plt.subplots(2, 2, layout="constrained")
278
+ for ax in axs.flat:
279
+ pcm = example_pcolor(ax, fontsize=12)
280
+ fig.colorbar(pcm, ax=ax, shrink=0.6, aspect=20., pad=0.02)
281
+ with pytest.raises(TypeError):
282
+ fig.get_layout_engine().set(wpad=1, hpad=2)
283
+ fig.get_layout_engine().set(w_pad=24./72., h_pad=24./72.)
284
+
285
+
286
+ @image_comparison(['constrained_layout14.png'], style='mpl20')
287
+ def test_constrained_layout14():
288
+ """Test that padding works."""
289
+ fig, axs = plt.subplots(2, 2, layout="constrained")
290
+ for ax in axs.flat:
291
+ pcm = example_pcolor(ax, fontsize=12)
292
+ fig.colorbar(pcm, ax=ax, shrink=0.6, aspect=20., pad=0.02)
293
+ fig.get_layout_engine().set(
294
+ w_pad=3./72., h_pad=3./72.,
295
+ hspace=0.2, wspace=0.2)
296
+
297
+
298
+ @image_comparison(['constrained_layout15.png'], style='mpl20')
299
+ def test_constrained_layout15():
300
+ """Test that rcparams work."""
301
+ mpl.rcParams['figure.constrained_layout.use'] = True
302
+ fig, axs = plt.subplots(2, 2)
303
+ for ax in axs.flat:
304
+ example_plot(ax, fontsize=12)
305
+
306
+
307
+ @image_comparison(['constrained_layout16.png'], style='mpl20')
308
+ def test_constrained_layout16():
309
+ """Test ax.set_position."""
310
+ fig, ax = plt.subplots(layout="constrained")
311
+ example_plot(ax, fontsize=12)
312
+ ax2 = fig.add_axes([0.2, 0.2, 0.4, 0.4])
313
+
314
+
315
+ @image_comparison(['constrained_layout17.png'], style='mpl20')
316
+ def test_constrained_layout17():
317
+ """Test uneven gridspecs"""
318
+ fig = plt.figure(layout="constrained")
319
+ gs = gridspec.GridSpec(3, 3, figure=fig)
320
+
321
+ ax1 = fig.add_subplot(gs[0, 0])
322
+ ax2 = fig.add_subplot(gs[0, 1:])
323
+ ax3 = fig.add_subplot(gs[1:, 0:2])
324
+ ax4 = fig.add_subplot(gs[1:, -1])
325
+
326
+ example_plot(ax1)
327
+ example_plot(ax2)
328
+ example_plot(ax3)
329
+ example_plot(ax4)
330
+
331
+
332
+ def test_constrained_layout18():
333
+ """Test twinx"""
334
+ fig, ax = plt.subplots(layout="constrained")
335
+ ax2 = ax.twinx()
336
+ example_plot(ax)
337
+ example_plot(ax2, fontsize=24)
338
+ fig.draw_without_rendering()
339
+ assert all(ax.get_position().extents == ax2.get_position().extents)
340
+
341
+
342
+ def test_constrained_layout19():
343
+ """Test twiny"""
344
+ fig, ax = plt.subplots(layout="constrained")
345
+ ax2 = ax.twiny()
346
+ example_plot(ax)
347
+ example_plot(ax2, fontsize=24)
348
+ ax2.set_title('')
349
+ ax.set_title('')
350
+ fig.draw_without_rendering()
351
+ assert all(ax.get_position().extents == ax2.get_position().extents)
352
+
353
+
354
+ def test_constrained_layout20():
355
+ """Smoke test cl does not mess up added Axes"""
356
+ gx = np.linspace(-5, 5, 4)
357
+ img = np.hypot(gx, gx[:, None])
358
+
359
+ fig = plt.figure()
360
+ ax = fig.add_axes([0, 0, 1, 1])
361
+ mesh = ax.pcolormesh(gx, gx, img[:-1, :-1])
362
+ fig.colorbar(mesh)
363
+
364
+
365
+ def test_constrained_layout21():
366
+ """#11035: repeated calls to suptitle should not alter the layout"""
367
+ fig, ax = plt.subplots(layout="constrained")
368
+
369
+ fig.suptitle("Suptitle0")
370
+ fig.draw_without_rendering()
371
+ extents0 = np.copy(ax.get_position().extents)
372
+
373
+ fig.suptitle("Suptitle1")
374
+ fig.draw_without_rendering()
375
+ extents1 = np.copy(ax.get_position().extents)
376
+
377
+ np.testing.assert_allclose(extents0, extents1)
378
+
379
+
380
+ def test_constrained_layout22():
381
+ """#11035: suptitle should not be include in CL if manually positioned"""
382
+ fig, ax = plt.subplots(layout="constrained")
383
+
384
+ fig.draw_without_rendering()
385
+ extents0 = np.copy(ax.get_position().extents)
386
+
387
+ fig.suptitle("Suptitle", y=0.5)
388
+ fig.draw_without_rendering()
389
+ extents1 = np.copy(ax.get_position().extents)
390
+
391
+ np.testing.assert_allclose(extents0, extents1)
392
+
393
+
394
+ def test_constrained_layout23():
395
+ """
396
+ Comment in #11035: suptitle used to cause an exception when
397
+ reusing a figure w/ CL with ``clear=True``.
398
+ """
399
+
400
+ for i in range(2):
401
+ fig = plt.figure(layout="constrained", clear=True, num="123")
402
+ gs = fig.add_gridspec(1, 2)
403
+ sub = gs[0].subgridspec(2, 2)
404
+ fig.suptitle(f"Suptitle{i}")
405
+
406
+
407
+ @image_comparison(['test_colorbar_location.png'],
408
+ remove_text=True, style='mpl20')
409
+ def test_colorbar_location():
410
+ """
411
+ Test that colorbar handling is as expected for various complicated
412
+ cases...
413
+ """
414
+ # Remove this line when this test image is regenerated.
415
+ plt.rcParams['pcolormesh.snap'] = False
416
+
417
+ fig, axs = plt.subplots(4, 5, layout="constrained")
418
+ for ax in axs.flat:
419
+ pcm = example_pcolor(ax)
420
+ ax.set_xlabel('')
421
+ ax.set_ylabel('')
422
+ fig.colorbar(pcm, ax=axs[:, 1], shrink=0.4)
423
+ fig.colorbar(pcm, ax=axs[-1, :2], shrink=0.5, location='bottom')
424
+ fig.colorbar(pcm, ax=axs[0, 2:], shrink=0.5, location='bottom', pad=0.05)
425
+ fig.colorbar(pcm, ax=axs[-2, 3:], shrink=0.5, location='top')
426
+ fig.colorbar(pcm, ax=axs[0, 0], shrink=0.5, location='left')
427
+ fig.colorbar(pcm, ax=axs[1:3, 2], shrink=0.5, location='right')
428
+
429
+
430
+ def test_hidden_axes():
431
+ # test that if we make an Axes not visible that constrained_layout
432
+ # still works. Note the axes still takes space in the layout
433
+ # (as does a gridspec slot that is empty)
434
+ fig, axs = plt.subplots(2, 2, layout="constrained")
435
+ axs[0, 1].set_visible(False)
436
+ fig.draw_without_rendering()
437
+ extents1 = np.copy(axs[0, 0].get_position().extents)
438
+
439
+ np.testing.assert_allclose(
440
+ extents1, [0.046918, 0.541204, 0.477409, 0.980555], rtol=1e-5)
441
+
442
+
443
+ def test_colorbar_align():
444
+ for location in ['right', 'left', 'top', 'bottom']:
445
+ fig, axs = plt.subplots(2, 2, layout="constrained")
446
+ cbs = []
447
+ for nn, ax in enumerate(axs.flat):
448
+ ax.tick_params(direction='in')
449
+ pc = example_pcolor(ax)
450
+ cb = fig.colorbar(pc, ax=ax, location=location, shrink=0.6,
451
+ pad=0.04)
452
+ cbs += [cb]
453
+ cb.ax.tick_params(direction='in')
454
+ if nn != 1:
455
+ cb.ax.xaxis.set_ticks([])
456
+ cb.ax.yaxis.set_ticks([])
457
+ ax.set_xticklabels([])
458
+ ax.set_yticklabels([])
459
+ fig.get_layout_engine().set(w_pad=4 / 72, h_pad=4 / 72,
460
+ hspace=0.1, wspace=0.1)
461
+
462
+ fig.draw_without_rendering()
463
+ if location in ['left', 'right']:
464
+ np.testing.assert_allclose(cbs[0].ax.get_position().x0,
465
+ cbs[2].ax.get_position().x0)
466
+ np.testing.assert_allclose(cbs[1].ax.get_position().x0,
467
+ cbs[3].ax.get_position().x0)
468
+ else:
469
+ np.testing.assert_allclose(cbs[0].ax.get_position().y0,
470
+ cbs[1].ax.get_position().y0)
471
+ np.testing.assert_allclose(cbs[2].ax.get_position().y0,
472
+ cbs[3].ax.get_position().y0)
473
+
474
+
475
+ @image_comparison(['test_colorbars_no_overlapV.png'], style='mpl20')
476
+ def test_colorbars_no_overlapV():
477
+ fig = plt.figure(figsize=(2, 4), layout="constrained")
478
+ axs = fig.subplots(2, 1, sharex=True, sharey=True)
479
+ for ax in axs:
480
+ ax.yaxis.set_major_formatter(ticker.NullFormatter())
481
+ ax.tick_params(axis='both', direction='in')
482
+ im = ax.imshow([[1, 2], [3, 4]])
483
+ fig.colorbar(im, ax=ax, orientation="vertical")
484
+ fig.suptitle("foo")
485
+
486
+
487
+ @image_comparison(['test_colorbars_no_overlapH.png'], style='mpl20')
488
+ def test_colorbars_no_overlapH():
489
+ fig = plt.figure(figsize=(4, 2), layout="constrained")
490
+ fig.suptitle("foo")
491
+ axs = fig.subplots(1, 2, sharex=True, sharey=True)
492
+ for ax in axs:
493
+ ax.yaxis.set_major_formatter(ticker.NullFormatter())
494
+ ax.tick_params(axis='both', direction='in')
495
+ im = ax.imshow([[1, 2], [3, 4]])
496
+ fig.colorbar(im, ax=ax, orientation="horizontal")
497
+
498
+
499
+ def test_manually_set_position():
500
+ fig, axs = plt.subplots(1, 2, layout="constrained")
501
+ axs[0].set_position([0.2, 0.2, 0.3, 0.3])
502
+ fig.draw_without_rendering()
503
+ pp = axs[0].get_position()
504
+ np.testing.assert_allclose(pp, [[0.2, 0.2], [0.5, 0.5]])
505
+
506
+ fig, axs = plt.subplots(1, 2, layout="constrained")
507
+ axs[0].set_position([0.2, 0.2, 0.3, 0.3])
508
+ pc = axs[0].pcolormesh(np.random.rand(20, 20))
509
+ fig.colorbar(pc, ax=axs[0])
510
+ fig.draw_without_rendering()
511
+ pp = axs[0].get_position()
512
+ np.testing.assert_allclose(pp, [[0.2, 0.2], [0.44, 0.5]])
513
+
514
+
515
+ @image_comparison(['test_bboxtight.png'],
516
+ remove_text=True, style='mpl20',
517
+ savefig_kwarg={'bbox_inches': 'tight'})
518
+ def test_bboxtight():
519
+ fig, ax = plt.subplots(layout="constrained")
520
+ ax.set_aspect(1.)
521
+
522
+
523
+ @image_comparison(['test_bbox.png'],
524
+ remove_text=True, style='mpl20',
525
+ savefig_kwarg={'bbox_inches':
526
+ mtransforms.Bbox([[0.5, 0], [2.5, 2]])})
527
+ def test_bbox():
528
+ fig, ax = plt.subplots(layout="constrained")
529
+ ax.set_aspect(1.)
530
+
531
+
532
+ def test_align_labels():
533
+ """
534
+ Tests for a bug in which constrained layout and align_ylabels on
535
+ three unevenly sized subplots, one of whose y tick labels include
536
+ negative numbers, drives the non-negative subplots' y labels off
537
+ the edge of the plot
538
+ """
539
+ fig, (ax3, ax1, ax2) = plt.subplots(3, 1, layout="constrained",
540
+ figsize=(6.4, 8),
541
+ gridspec_kw={"height_ratios": (1, 1,
542
+ 0.7)})
543
+
544
+ ax1.set_ylim(0, 1)
545
+ ax1.set_ylabel("Label")
546
+
547
+ ax2.set_ylim(-1.5, 1.5)
548
+ ax2.set_ylabel("Label")
549
+
550
+ ax3.set_ylim(0, 1)
551
+ ax3.set_ylabel("Label")
552
+
553
+ fig.align_ylabels(axs=(ax3, ax1, ax2))
554
+
555
+ fig.draw_without_rendering()
556
+ after_align = [ax1.yaxis.label.get_window_extent(),
557
+ ax2.yaxis.label.get_window_extent(),
558
+ ax3.yaxis.label.get_window_extent()]
559
+ # ensure labels are approximately aligned
560
+ np.testing.assert_allclose([after_align[0].x0, after_align[2].x0],
561
+ after_align[1].x0, rtol=0, atol=1e-05)
562
+ # ensure labels do not go off the edge
563
+ assert after_align[0].x0 >= 1
564
+
565
+
566
+ def test_suplabels():
567
+ fig, ax = plt.subplots(layout="constrained")
568
+ fig.draw_without_rendering()
569
+ pos0 = ax.get_tightbbox(fig.canvas.get_renderer())
570
+ fig.supxlabel('Boo')
571
+ fig.supylabel('Booy')
572
+ fig.draw_without_rendering()
573
+ pos = ax.get_tightbbox(fig.canvas.get_renderer())
574
+ assert pos.y0 > pos0.y0 + 10.0
575
+ assert pos.x0 > pos0.x0 + 10.0
576
+
577
+ fig, ax = plt.subplots(layout="constrained")
578
+ fig.draw_without_rendering()
579
+ pos0 = ax.get_tightbbox(fig.canvas.get_renderer())
580
+ # check that specifying x (y) doesn't ruin the layout
581
+ fig.supxlabel('Boo', x=0.5)
582
+ fig.supylabel('Boo', y=0.5)
583
+ fig.draw_without_rendering()
584
+ pos = ax.get_tightbbox(fig.canvas.get_renderer())
585
+ assert pos.y0 > pos0.y0 + 10.0
586
+ assert pos.x0 > pos0.x0 + 10.0
587
+
588
+
589
+ def test_gridspec_addressing():
590
+ fig = plt.figure()
591
+ gs = fig.add_gridspec(3, 3)
592
+ sp = fig.add_subplot(gs[0:, 1:])
593
+ fig.draw_without_rendering()
594
+
595
+
596
+ def test_discouraged_api():
597
+ fig, ax = plt.subplots(constrained_layout=True)
598
+ fig.draw_without_rendering()
599
+
600
+ with pytest.warns(PendingDeprecationWarning,
601
+ match="will be deprecated"):
602
+ fig, ax = plt.subplots()
603
+ fig.set_constrained_layout(True)
604
+ fig.draw_without_rendering()
605
+
606
+ with pytest.warns(PendingDeprecationWarning,
607
+ match="will be deprecated"):
608
+ fig, ax = plt.subplots()
609
+ fig.set_constrained_layout({'w_pad': 0.02, 'h_pad': 0.02})
610
+ fig.draw_without_rendering()
611
+
612
+
613
+ def test_kwargs():
614
+ fig, ax = plt.subplots(constrained_layout={'h_pad': 0.02})
615
+ fig.draw_without_rendering()
616
+
617
+
618
+ def test_rect():
619
+ fig, ax = plt.subplots(layout='constrained')
620
+ fig.get_layout_engine().set(rect=[0, 0, 0.5, 0.5])
621
+ fig.draw_without_rendering()
622
+ ppos = ax.get_position()
623
+ assert ppos.x1 < 0.5
624
+ assert ppos.y1 < 0.5
625
+
626
+ fig, ax = plt.subplots(layout='constrained')
627
+ fig.get_layout_engine().set(rect=[0.2, 0.2, 0.3, 0.3])
628
+ fig.draw_without_rendering()
629
+ ppos = ax.get_position()
630
+ assert ppos.x1 < 0.5
631
+ assert ppos.y1 < 0.5
632
+ assert ppos.x0 > 0.2
633
+ assert ppos.y0 > 0.2
634
+
635
+
636
+ def test_compressed1():
637
+ fig, axs = plt.subplots(3, 2, layout='compressed',
638
+ sharex=True, sharey=True)
639
+ for ax in axs.flat:
640
+ pc = ax.imshow(np.random.randn(20, 20))
641
+
642
+ fig.colorbar(pc, ax=axs)
643
+ fig.draw_without_rendering()
644
+
645
+ pos = axs[0, 0].get_position()
646
+ np.testing.assert_allclose(pos.x0, 0.2381, atol=1e-2)
647
+ pos = axs[0, 1].get_position()
648
+ np.testing.assert_allclose(pos.x1, 0.7024, atol=1e-3)
649
+
650
+ # wider than tall
651
+ fig, axs = plt.subplots(2, 3, layout='compressed',
652
+ sharex=True, sharey=True, figsize=(5, 4))
653
+ for ax in axs.flat:
654
+ pc = ax.imshow(np.random.randn(20, 20))
655
+
656
+ fig.colorbar(pc, ax=axs)
657
+ fig.draw_without_rendering()
658
+
659
+ pos = axs[0, 0].get_position()
660
+ np.testing.assert_allclose(pos.x0, 0.05653, atol=1e-3)
661
+ np.testing.assert_allclose(pos.y1, 0.8603, atol=1e-2)
662
+ pos = axs[1, 2].get_position()
663
+ np.testing.assert_allclose(pos.x1, 0.8728, atol=1e-3)
664
+ np.testing.assert_allclose(pos.y0, 0.1808, atol=1e-2)
665
+
666
+
667
+ def test_compressed_suptitle():
668
+ fig, (ax0, ax1) = plt.subplots(
669
+ nrows=2, figsize=(4, 10), layout="compressed",
670
+ gridspec_kw={"height_ratios": (1 / 4, 3 / 4), "hspace": 0})
671
+
672
+ ax0.axis("equal")
673
+ ax0.set_box_aspect(1/3)
674
+
675
+ ax1.axis("equal")
676
+ ax1.set_box_aspect(1)
677
+
678
+ title = fig.suptitle("Title")
679
+ fig.draw_without_rendering()
680
+ assert title.get_position()[1] == pytest.approx(0.7491, abs=1e-3)
681
+
682
+ title = fig.suptitle("Title", y=0.98)
683
+ fig.draw_without_rendering()
684
+ assert title.get_position()[1] == 0.98
685
+
686
+ title = fig.suptitle("Title", in_layout=False)
687
+ fig.draw_without_rendering()
688
+ assert title.get_position()[1] == 0.98
689
+
690
+
691
+ @pytest.mark.parametrize('arg, state', [
692
+ (True, True),
693
+ (False, False),
694
+ ({}, True),
695
+ ({'rect': None}, True)
696
+ ])
697
+ def test_set_constrained_layout(arg, state):
698
+ fig, ax = plt.subplots(constrained_layout=arg)
699
+ assert fig.get_constrained_layout() is state
700
+
701
+
702
+ def test_constrained_toggle():
703
+ fig, ax = plt.subplots()
704
+ with pytest.warns(PendingDeprecationWarning):
705
+ fig.set_constrained_layout(True)
706
+ assert fig.get_constrained_layout()
707
+ fig.set_constrained_layout(False)
708
+ assert not fig.get_constrained_layout()
709
+ fig.set_constrained_layout(True)
710
+ assert fig.get_constrained_layout()
711
+
712
+
713
+ def test_layout_leak():
714
+ # Make sure there aren't any cyclic references when using LayoutGrid
715
+ # GH #25853
716
+ fig = plt.figure(constrained_layout=True, figsize=(10, 10))
717
+ fig.add_subplot()
718
+ fig.draw_without_rendering()
719
+ plt.close("all")
720
+ del fig
721
+ gc.collect()
722
+ assert not any(isinstance(obj, mpl._layoutgrid.LayoutGrid)
723
+ for obj in gc.get_objects())
724
+
725
+
726
+ def test_submerged_subfig():
727
+ """
728
+ Test that the submerged margin logic does not get called multiple times
729
+ on same axes if it is already in a subfigure
730
+ """
731
+ fig = plt.figure(figsize=(4, 5), layout='constrained')
732
+ figures = fig.subfigures(3, 1)
733
+ axs = []
734
+ for f in figures.flatten():
735
+ gs = f.add_gridspec(2, 2)
736
+ for i in range(2):
737
+ axs += [f.add_subplot(gs[i, 0])]
738
+ axs[-1].plot()
739
+ f.add_subplot(gs[:, 1]).plot()
740
+ fig.draw_without_rendering()
741
+ for ax in axs[1:]:
742
+ assert np.allclose(ax.get_position().bounds[-1],
743
+ axs[0].get_position().bounds[-1], atol=1e-6)
shared/package-files/33/331ff95d94552759b94ad3b6a79ad52bd0ffcf2a6b3dbd8e0bc9b6aa5afae36f/fractional_max_pool2d_backward_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 fractional_max_pool2d_backward(const at::Tensor & grad_output, const at::Tensor & self, at::IntArrayRef kernel_size, at::IntArrayRef output_size, const at::Tensor & indices);
21
+ TORCH_API at::Tensor & fractional_max_pool2d_backward_out(at::Tensor & grad_input, const at::Tensor & grad_output, const at::Tensor & self, at::IntArrayRef kernel_size, at::IntArrayRef output_size, const at::Tensor & indices);
22
+ TORCH_API at::Tensor & fractional_max_pool2d_backward_outf(const at::Tensor & grad_output, const at::Tensor & self, at::IntArrayRef kernel_size, at::IntArrayRef output_size, const at::Tensor & indices, at::Tensor & grad_input);
23
+
24
+ } // namespace meta
25
+ } // namespace at
shared/package-files/33/332288615a542442c1306223657cfe72a25c1a86204933385049efc483bd6b70/abstract.py ADDED
@@ -0,0 +1,516 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from abc import ABCMeta, abstractmethod
2
+ from typing import Dict as ptDict, Type as ptType
3
+ import itertools
4
+ import weakref
5
+ from functools import cached_property
6
+
7
+ import numpy as np
8
+
9
+ from numba.core.utils import get_hashable_key
10
+
11
+ # Types are added to a global registry (_typecache) in order to assign
12
+ # them unique integer codes for fast matching in _dispatcher.c.
13
+ # However, we also want types to be disposable, therefore we ensure
14
+ # each type is interned as a weak reference, so that it lives only as
15
+ # long as necessary to keep a stable type code.
16
+ # NOTE: some types can still be made immortal elsewhere (for example
17
+ # in _dispatcher.c's internal caches).
18
+ _typecodes = itertools.count()
19
+
20
+ def _autoincr():
21
+ n = next(_typecodes)
22
+ # 4 billion types should be enough, right?
23
+ assert n < 2 ** 32, "Limited to 4 billion types"
24
+ return n
25
+
26
+ _typecache: ptDict[weakref.ref, weakref.ref] = {}
27
+
28
+ def _on_type_disposal(wr, _pop=_typecache.pop):
29
+ _pop(wr, None)
30
+
31
+
32
+ class _TypeMetaclass(ABCMeta):
33
+ """
34
+ A metaclass that will intern instances after they are created.
35
+ This is done by first creating a new instance (including calling
36
+ __init__, which sets up the required attributes for equality
37
+ and hashing), then looking it up in the _typecache registry.
38
+ """
39
+
40
+ def __init__(cls, name, bases, orig_vars):
41
+ # __init__ is hooked to mark whether a Type class being defined is a
42
+ # Numba internal type (one which is defined somewhere under the `numba`
43
+ # module) or an external type (one which is defined elsewhere, for
44
+ # example a user defined type).
45
+ super(_TypeMetaclass, cls).__init__(name, bases, orig_vars)
46
+ root = (cls.__module__.split('.'))[0]
47
+ cls._is_internal = root == "numba"
48
+
49
+ def _intern(cls, inst):
50
+ # Try to intern the created instance
51
+ wr = weakref.ref(inst, _on_type_disposal)
52
+ orig = _typecache.get(wr)
53
+ orig = orig and orig()
54
+ if orig is not None:
55
+ return orig
56
+ else:
57
+ inst._code = _autoincr()
58
+ _typecache[wr] = wr
59
+ return inst
60
+
61
+ def __call__(cls, *args, **kwargs):
62
+ """
63
+ Instantiate *cls* (a Type subclass, presumably) and intern it.
64
+ If an interned instance already exists, it is returned, otherwise
65
+ the new instance is returned.
66
+ """
67
+ inst = type.__call__(cls, *args, **kwargs)
68
+ return cls._intern(inst)
69
+
70
+
71
+ def _type_reconstructor(reconstructor, reconstructor_args, state):
72
+ """
73
+ Rebuild function for unpickling types.
74
+ """
75
+ obj = reconstructor(*reconstructor_args)
76
+ if state:
77
+ obj.__dict__.update(state)
78
+ return type(obj)._intern(obj)
79
+
80
+
81
+ class Type(metaclass=_TypeMetaclass):
82
+ """
83
+ The base class for all Numba types.
84
+ It is essential that proper equality comparison is implemented. The
85
+ default implementation uses the "key" property (overridable in subclasses)
86
+ for both comparison and hashing, to ensure sane behaviour.
87
+ """
88
+
89
+ mutable = False
90
+ # Rather the type is reflected at the python<->nopython boundary
91
+ reflected = False
92
+
93
+ def __init__(self, name):
94
+ self.name = name
95
+
96
+ @property
97
+ def key(self):
98
+ """
99
+ A property used for __eq__, __ne__ and __hash__. Can be overridden
100
+ in subclasses.
101
+ """
102
+ return self.name
103
+
104
+ @property
105
+ def mangling_args(self):
106
+ """
107
+ Returns `(basename, args)` where `basename` is the name of the type
108
+ and `args` is a sequence of parameters of the type.
109
+
110
+ Subclass should override to specialize the behavior.
111
+ By default, this returns `(self.name, ())`.
112
+ """
113
+ return self.name, ()
114
+
115
+ def __repr__(self):
116
+ return self.name
117
+
118
+ def __str__(self):
119
+ return self.name
120
+
121
+ def __hash__(self):
122
+ return hash(self.key)
123
+
124
+ def __eq__(self, other):
125
+ return self.__class__ is other.__class__ and self.key == other.key
126
+
127
+ def __ne__(self, other):
128
+ return not (self == other)
129
+
130
+ def __reduce__(self):
131
+ reconstructor, args, state = super(Type, self).__reduce__()
132
+ return (_type_reconstructor, (reconstructor, args, state))
133
+
134
+ def unify(self, typingctx, other):
135
+ """
136
+ Try to unify this type with the *other*. A third type must
137
+ be returned, or None if unification is not possible.
138
+ Only override this if the coercion logic cannot be expressed
139
+ as simple casting rules.
140
+ """
141
+ return None
142
+
143
+ def can_convert_to(self, typingctx, other):
144
+ """
145
+ Check whether this type can be converted to the *other*.
146
+ If successful, must return a string describing the conversion, e.g.
147
+ "exact", "promote", "unsafe", "safe"; otherwise None is returned.
148
+ """
149
+ return None
150
+
151
+ def can_convert_from(self, typingctx, other):
152
+ """
153
+ Similar to *can_convert_to*, but in reverse. Only needed if
154
+ the type provides conversion from other types.
155
+ """
156
+ return None
157
+
158
+ def is_precise(self):
159
+ """
160
+ Whether this type is precise, i.e. can be part of a successful
161
+ type inference. Default implementation returns True.
162
+ """
163
+ return True
164
+
165
+ def augment(self, other):
166
+ """
167
+ Augment this type with the *other*. Return the augmented type,
168
+ or None if not supported.
169
+ """
170
+ return None
171
+
172
+ # User-facing helpers. These are not part of the core Type API but
173
+ # are provided so that users can write e.g. `numba.boolean(1.5)`
174
+ # (returns True) or `types.int32(types.int32[:])` (returns something
175
+ # usable as a function signature).
176
+
177
+ def __call__(self, *args):
178
+ from numba.core.typing import signature
179
+ if len(args) == 1 and not isinstance(args[0], Type):
180
+ return self.cast_python_value(args[0])
181
+ return signature(self, # return_type
182
+ *args)
183
+
184
+ def __getitem__(self, args, /):
185
+ """
186
+ Return an array of this type.
187
+ """
188
+ from numba.core.types import Array
189
+ ndim, layout = self._determine_array_spec(args)
190
+ return Array(dtype=self, ndim=ndim, layout=layout)
191
+
192
+ def _determine_array_spec(self, args):
193
+ # XXX non-contiguous by default, even for 1d arrays,
194
+ # doesn't sound very intuitive
195
+ def validate_slice(s):
196
+ return isinstance(s, slice) and s.start is None and s.stop is None
197
+
198
+ if isinstance(args, (tuple, list)) and all(map(validate_slice, args)):
199
+ ndim = len(args)
200
+ if args[0].step == 1:
201
+ layout = 'F'
202
+ elif args[-1].step == 1:
203
+ layout = 'C'
204
+ else:
205
+ layout = 'A'
206
+ elif validate_slice(args):
207
+ ndim = 1
208
+ if args.step == 1:
209
+ layout = 'C'
210
+ else:
211
+ layout = 'A'
212
+ else:
213
+ # Raise a KeyError to not be handled by collection constructors (e.g. list).
214
+ raise KeyError(f"Can only index numba types with slices with no start or stop, got {args}.")
215
+
216
+ return ndim, layout
217
+
218
+ def cast_python_value(self, args, /):
219
+ raise NotImplementedError
220
+
221
+
222
+ @property
223
+ def is_internal(self):
224
+ """ Returns True if this class is an internally defined Numba type by
225
+ virtue of the module in which it is instantiated, False else."""
226
+ return self._is_internal
227
+
228
+ def dump(self, tab=''):
229
+ print(f'{tab}DUMP {type(self).__name__}[code={self._code}, name={self.name}]')
230
+
231
+ # XXX we should distinguish between Dummy (no meaningful
232
+ # representation, e.g. None or a builtin function) and Opaque (has a
233
+ # meaningful representation, e.g. ExternalFunctionPointer)
234
+
235
+ class Dummy(Type):
236
+ """
237
+ Base class for types that do not really have a representation and are
238
+ compatible with a void*.
239
+ """
240
+
241
+
242
+ class Hashable(Type):
243
+ """
244
+ Base class for hashable types.
245
+ """
246
+
247
+
248
+ class Number(Hashable):
249
+ """
250
+ Base class for number types.
251
+ """
252
+
253
+ def unify(self, typingctx, other):
254
+ """
255
+ Unify the two number types using Numpy's rules.
256
+ """
257
+ from numba.np import numpy_support
258
+ if isinstance(other, Number):
259
+ # XXX: this can produce unsafe conversions,
260
+ # e.g. would unify {int64, uint64} to float64
261
+ a = numpy_support.as_dtype(self)
262
+ b = numpy_support.as_dtype(other)
263
+ sel = np.promote_types(a, b)
264
+ return numpy_support.from_dtype(sel)
265
+
266
+
267
+ class Callable(Type):
268
+ """
269
+ Base class for callables.
270
+ """
271
+
272
+ @abstractmethod
273
+ def get_call_type(self, context, args, kws):
274
+ """
275
+ Using the typing *context*, resolve the callable's signature for
276
+ the given arguments. A signature object is returned, or None.
277
+ """
278
+
279
+ @abstractmethod
280
+ def get_call_signatures(self):
281
+ """
282
+ Returns a tuple of (list of signatures, parameterized)
283
+ """
284
+
285
+ @abstractmethod
286
+ def get_impl_key(self, sig):
287
+ """
288
+ Returns the impl key for the given signature
289
+ """
290
+
291
+
292
+ class DTypeSpec(Type):
293
+ """
294
+ Base class for types usable as "dtype" arguments to various Numpy APIs
295
+ (e.g. np.empty()).
296
+ """
297
+
298
+ @property
299
+ @abstractmethod
300
+ def dtype(self):
301
+ """
302
+ The actual dtype denoted by this dtype spec (a Type instance).
303
+ """
304
+
305
+
306
+ class IterableType(Type):
307
+ """
308
+ Base class for iterable types.
309
+ """
310
+
311
+ @property
312
+ @abstractmethod
313
+ def iterator_type(self):
314
+ """
315
+ The iterator type obtained when calling iter() (explicitly or implicitly).
316
+ """
317
+
318
+
319
+ class Sized(Type):
320
+ """
321
+ Base class for objects that support len()
322
+ """
323
+
324
+
325
+ class ConstSized(Sized):
326
+ """
327
+ For types that have a constant size
328
+ """
329
+ @abstractmethod
330
+ def __len__(self):
331
+ pass
332
+
333
+
334
+ class IteratorType(IterableType):
335
+ """
336
+ Base class for all iterator types.
337
+ Derived classes should implement the *yield_type* attribute.
338
+ """
339
+
340
+ def __init__(self, name, **kwargs):
341
+ super(IteratorType, self).__init__(name, **kwargs)
342
+
343
+ @property
344
+ @abstractmethod
345
+ def yield_type(self):
346
+ """
347
+ The type of values yielded by the iterator.
348
+ """
349
+
350
+ # This is a property to avoid recursivity (for pickling)
351
+
352
+ @property
353
+ def iterator_type(self):
354
+ return self
355
+
356
+
357
+ class Container(Sized, IterableType):
358
+ """
359
+ Base class for container types.
360
+ """
361
+
362
+
363
+ class Sequence(Container):
364
+ """
365
+ Base class for 1d sequence types. Instances should have the *dtype*
366
+ attribute.
367
+ """
368
+
369
+
370
+ class MutableSequence(Sequence):
371
+ """
372
+ Base class for 1d mutable sequence types. Instances should have the
373
+ *dtype* attribute.
374
+ """
375
+
376
+ mutable = True
377
+
378
+ class ArrayCompatible(Type):
379
+ """
380
+ Type class for Numpy array-compatible objects (typically, objects
381
+ exposing an __array__ method).
382
+ Derived classes should implement the *as_array* attribute.
383
+ """
384
+ # If overridden by a subclass, it should also implement typing
385
+ # for '__array_wrap__' with arguments (input, formal result).
386
+ array_priority = 0.0
387
+
388
+ @property
389
+ @abstractmethod
390
+ def as_array(self):
391
+ """
392
+ The equivalent array type, for operations supporting array-compatible
393
+ objects (such as ufuncs).
394
+ """
395
+
396
+ # For compatibility with types.Array
397
+
398
+ @cached_property
399
+ def ndim(self):
400
+ return self.as_array.ndim
401
+
402
+ @cached_property
403
+ def layout(self):
404
+ return self.as_array.layout
405
+
406
+ @cached_property
407
+ def dtype(self):
408
+ return self.as_array.dtype
409
+
410
+
411
+ class Literal(Type):
412
+ """Base class for Literal types.
413
+ Literal types contain the original Python value in the type.
414
+
415
+ A literal type should always be constructed from the `literal(val)`
416
+ function.
417
+ """
418
+
419
+ # *ctor_map* is a dictionary mapping Python types to Literal subclasses
420
+ # for constructing a numba type for a given Python type.
421
+ # It is used in `literal(val)` function.
422
+ # To add new Literal subclass, register a new mapping to this dict.
423
+ ctor_map: ptDict[type, ptType['Literal']] = {}
424
+
425
+ # *_literal_type_cache* is used to cache the numba type of the given value.
426
+ _literal_type_cache = None
427
+
428
+ def __init__(self, value):
429
+ if type(self) is Literal:
430
+ raise TypeError(
431
+ "Cannot be constructed directly. "
432
+ "Use `numba.types.literal(value)` instead",
433
+ )
434
+ self._literal_init(value)
435
+ fmt = "Literal[{}]({})"
436
+ super(Literal, self).__init__(fmt.format(type(value).__name__, value))
437
+
438
+ def _literal_init(self, value):
439
+ self._literal_value = value
440
+ # We want to support constants of non-hashable values, therefore
441
+ # fall back on the value's id() if necessary.
442
+ self._key = get_hashable_key(value)
443
+
444
+ @property
445
+ def literal_value(self):
446
+ return self._literal_value
447
+
448
+ @property
449
+ def literal_type(self):
450
+ if self._literal_type_cache is None:
451
+ from numba.core import typing
452
+ ctx = typing.Context()
453
+ try:
454
+ res = ctx.resolve_value_type(self.literal_value)
455
+ except ValueError as e:
456
+
457
+ if "Int value is too large" in str(e):
458
+ # If a string literal cannot create an IntegerLiteral
459
+ # because of overflow we generate this message.
460
+ msg = f"Cannot create literal type. {str(e)}"
461
+ raise TypeError(msg)
462
+ # Not all literal types have a literal_value that can be
463
+ # resolved to a type, for example, LiteralStrKeyDict has a
464
+ # literal_value that is a python dict for which there's no
465
+ # `typeof` support.
466
+ msg = "{} has no attribute 'literal_type'".format(self)
467
+ raise AttributeError(msg)
468
+ self._literal_type_cache = res
469
+
470
+ return self._literal_type_cache
471
+
472
+
473
+
474
+ class TypeRef(Dummy):
475
+ """Reference to a type.
476
+
477
+ Used when a type is passed as a value.
478
+ """
479
+ def __init__(self, instance_type):
480
+ self.instance_type = instance_type
481
+ super(TypeRef, self).__init__('typeref[{}]'.format(self.instance_type))
482
+
483
+ @property
484
+ def key(self):
485
+ return self.instance_type
486
+
487
+
488
+ class InitialValue(object):
489
+ """
490
+ Used as a mixin for a type will potentially have an initial value that will
491
+ be carried in the .initial_value attribute.
492
+ """
493
+ def __init__(self, initial_value):
494
+ self._initial_value = initial_value
495
+
496
+ @property
497
+ def initial_value(self):
498
+ return self._initial_value
499
+
500
+
501
+ class Poison(Type):
502
+ """
503
+ This is the "bottom" type in the type system. It won't unify and it's
504
+ unliteral version is Poison of itself. It's advisable for debugging purposes
505
+ to call the constructor with the type that's being poisoned (for whatever
506
+ reason) but this isn't strictly required.
507
+ """
508
+ def __init__(self, ty):
509
+ self.ty = ty
510
+ super(Poison, self).__init__(name="Poison<%s>" % ty)
511
+
512
+ def __unliteral__(self):
513
+ return Poison(self)
514
+
515
+ def unify(self, typingctx, other):
516
+ return None
shared/package-files/33/3328083ba04a22cc3e487194398ac0684af6f903c1c40ef827e71e91b324c224/scatter_reduce_cuda_dispatch.h ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 scatter_reduce(const at::Tensor & self, int64_t dim, const at::Tensor & index, const at::Tensor & src, c10::string_view reduce, bool include_self=true);
21
+ TORCH_API at::Tensor & scatter_reduce_out(at::Tensor & out, const at::Tensor & self, int64_t dim, const at::Tensor & index, const at::Tensor & src, c10::string_view reduce, bool include_self=true);
22
+ TORCH_API at::Tensor & scatter_reduce_outf(const at::Tensor & self, int64_t dim, const at::Tensor & index, const at::Tensor & src, c10::string_view reduce, bool include_self, at::Tensor & out);
23
+ TORCH_API at::Tensor & scatter_reduce_(at::Tensor & self, int64_t dim, const at::Tensor & index, const at::Tensor & src, c10::string_view reduce, bool include_self=true);
24
+
25
+ } // namespace cuda
26
+ } // namespace at
shared/package-files/33/3328cb027cca61175005fa1fd56de4fe17f7d0cbea3a4a8bfff1b6da6439c70c/pzdr.afm ADDED
@@ -0,0 +1,222 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ StartFontMetrics 2.0
2
+ Comment Copyright (c) 1985, 1987, 1988, 1989 Adobe Systems Incorporated. All rights reserved.
3
+ Comment Creation Date: Fri Dec 1 12:57:42 1989
4
+ Comment UniqueID 26200
5
+ Comment VMusage 39281 49041
6
+ FontName ZapfDingbats
7
+ FullName ITC Zapf Dingbats
8
+ FamilyName ITC Zapf Dingbats
9
+ Weight Medium
10
+ ItalicAngle 0
11
+ IsFixedPitch false
12
+ FontBBox -1 -143 981 820
13
+ UnderlinePosition -98
14
+ UnderlineThickness 54
15
+ Version 001.004
16
+ Notice Copyright (c) 1985, 1987, 1988, 1989 Adobe Systems Incorporated. All rights reserved.ITC Zapf Dingbats is a registered trademark of International Typeface Corporation.
17
+ EncodingScheme FontSpecific
18
+ StartCharMetrics 202
19
+ C 32 ; WX 278 ; N space ; B 0 0 0 0 ;
20
+ C 33 ; WX 974 ; N a1 ; B 35 72 939 621 ;
21
+ C 34 ; WX 961 ; N a2 ; B 35 81 927 611 ;
22
+ C 35 ; WX 974 ; N a202 ; B 35 72 939 621 ;
23
+ C 36 ; WX 980 ; N a3 ; B 35 0 945 692 ;
24
+ C 37 ; WX 719 ; N a4 ; B 34 139 685 566 ;
25
+ C 38 ; WX 789 ; N a5 ; B 35 -14 755 705 ;
26
+ C 39 ; WX 790 ; N a119 ; B 35 -14 755 705 ;
27
+ C 40 ; WX 791 ; N a118 ; B 35 -13 761 705 ;
28
+ C 41 ; WX 690 ; N a117 ; B 35 138 655 553 ;
29
+ C 42 ; WX 960 ; N a11 ; B 35 123 925 568 ;
30
+ C 43 ; WX 939 ; N a12 ; B 35 134 904 559 ;
31
+ C 44 ; WX 549 ; N a13 ; B 29 -11 516 705 ;
32
+ C 45 ; WX 855 ; N a14 ; B 34 59 820 632 ;
33
+ C 46 ; WX 911 ; N a15 ; B 35 50 876 642 ;
34
+ C 47 ; WX 933 ; N a16 ; B 35 139 899 550 ;
35
+ C 48 ; WX 911 ; N a105 ; B 35 50 876 642 ;
36
+ C 49 ; WX 945 ; N a17 ; B 35 139 909 553 ;
37
+ C 50 ; WX 974 ; N a18 ; B 35 104 938 587 ;
38
+ C 51 ; WX 755 ; N a19 ; B 34 -13 721 705 ;
39
+ C 52 ; WX 846 ; N a20 ; B 36 -14 811 705 ;
40
+ C 53 ; WX 762 ; N a21 ; B 35 0 727 692 ;
41
+ C 54 ; WX 761 ; N a22 ; B 35 0 727 692 ;
42
+ C 55 ; WX 571 ; N a23 ; B -1 -68 571 661 ;
43
+ C 56 ; WX 677 ; N a24 ; B 36 -13 642 705 ;
44
+ C 57 ; WX 763 ; N a25 ; B 35 0 728 692 ;
45
+ C 58 ; WX 760 ; N a26 ; B 35 0 726 692 ;
46
+ C 59 ; WX 759 ; N a27 ; B 35 0 725 692 ;
47
+ C 60 ; WX 754 ; N a28 ; B 35 0 720 692 ;
48
+ C 61 ; WX 494 ; N a6 ; B 35 0 460 692 ;
49
+ C 62 ; WX 552 ; N a7 ; B 35 0 517 692 ;
50
+ C 63 ; WX 537 ; N a8 ; B 35 0 503 692 ;
51
+ C 64 ; WX 577 ; N a9 ; B 35 96 542 596 ;
52
+ C 65 ; WX 692 ; N a10 ; B 35 -14 657 705 ;
53
+ C 66 ; WX 786 ; N a29 ; B 35 -14 751 705 ;
54
+ C 67 ; WX 788 ; N a30 ; B 35 -14 752 705 ;
55
+ C 68 ; WX 788 ; N a31 ; B 35 -14 753 705 ;
56
+ C 69 ; WX 790 ; N a32 ; B 35 -14 756 705 ;
57
+ C 70 ; WX 793 ; N a33 ; B 35 -13 759 705 ;
58
+ C 71 ; WX 794 ; N a34 ; B 35 -13 759 705 ;
59
+ C 72 ; WX 816 ; N a35 ; B 35 -14 782 705 ;
60
+ C 73 ; WX 823 ; N a36 ; B 35 -14 787 705 ;
61
+ C 74 ; WX 789 ; N a37 ; B 35 -14 754 705 ;
62
+ C 75 ; WX 841 ; N a38 ; B 35 -14 807 705 ;
63
+ C 76 ; WX 823 ; N a39 ; B 35 -14 789 705 ;
64
+ C 77 ; WX 833 ; N a40 ; B 35 -14 798 705 ;
65
+ C 78 ; WX 816 ; N a41 ; B 35 -13 782 705 ;
66
+ C 79 ; WX 831 ; N a42 ; B 35 -14 796 705 ;
67
+ C 80 ; WX 923 ; N a43 ; B 35 -14 888 705 ;
68
+ C 81 ; WX 744 ; N a44 ; B 35 0 710 692 ;
69
+ C 82 ; WX 723 ; N a45 ; B 35 0 688 692 ;
70
+ C 83 ; WX 749 ; N a46 ; B 35 0 714 692 ;
71
+ C 84 ; WX 790 ; N a47 ; B 34 -14 756 705 ;
72
+ C 85 ; WX 792 ; N a48 ; B 35 -14 758 705 ;
73
+ C 86 ; WX 695 ; N a49 ; B 35 -14 661 706 ;
74
+ C 87 ; WX 776 ; N a50 ; B 35 -6 741 699 ;
75
+ C 88 ; WX 768 ; N a51 ; B 35 -7 734 699 ;
76
+ C 89 ; WX 792 ; N a52 ; B 35 -14 757 705 ;
77
+ C 90 ; WX 759 ; N a53 ; B 35 0 725 692 ;
78
+ C 91 ; WX 707 ; N a54 ; B 35 -13 672 704 ;
79
+ C 92 ; WX 708 ; N a55 ; B 35 -14 672 705 ;
80
+ C 93 ; WX 682 ; N a56 ; B 35 -14 647 705 ;
81
+ C 94 ; WX 701 ; N a57 ; B 35 -14 666 705 ;
82
+ C 95 ; WX 826 ; N a58 ; B 35 -14 791 705 ;
83
+ C 96 ; WX 815 ; N a59 ; B 35 -14 780 705 ;
84
+ C 97 ; WX 789 ; N a60 ; B 35 -14 754 705 ;
85
+ C 98 ; WX 789 ; N a61 ; B 35 -14 754 705 ;
86
+ C 99 ; WX 707 ; N a62 ; B 34 -14 673 705 ;
87
+ C 100 ; WX 687 ; N a63 ; B 36 0 651 692 ;
88
+ C 101 ; WX 696 ; N a64 ; B 35 0 661 691 ;
89
+ C 102 ; WX 689 ; N a65 ; B 35 0 655 692 ;
90
+ C 103 ; WX 786 ; N a66 ; B 34 -14 751 705 ;
91
+ C 104 ; WX 787 ; N a67 ; B 35 -14 752 705 ;
92
+ C 105 ; WX 713 ; N a68 ; B 35 -14 678 705 ;
93
+ C 106 ; WX 791 ; N a69 ; B 35 -14 756 705 ;
94
+ C 107 ; WX 785 ; N a70 ; B 36 -14 751 705 ;
95
+ C 108 ; WX 791 ; N a71 ; B 35 -14 757 705 ;
96
+ C 109 ; WX 873 ; N a72 ; B 35 -14 838 705 ;
97
+ C 110 ; WX 761 ; N a73 ; B 35 0 726 692 ;
98
+ C 111 ; WX 762 ; N a74 ; B 35 0 727 692 ;
99
+ C 112 ; WX 762 ; N a203 ; B 35 0 727 692 ;
100
+ C 113 ; WX 759 ; N a75 ; B 35 0 725 692 ;
101
+ C 114 ; WX 759 ; N a204 ; B 35 0 725 692 ;
102
+ C 115 ; WX 892 ; N a76 ; B 35 0 858 705 ;
103
+ C 116 ; WX 892 ; N a77 ; B 35 -14 858 692 ;
104
+ C 117 ; WX 788 ; N a78 ; B 35 -14 754 705 ;
105
+ C 118 ; WX 784 ; N a79 ; B 35 -14 749 705 ;
106
+ C 119 ; WX 438 ; N a81 ; B 35 -14 403 705 ;
107
+ C 120 ; WX 138 ; N a82 ; B 35 0 104 692 ;
108
+ C 121 ; WX 277 ; N a83 ; B 35 0 242 692 ;
109
+ C 122 ; WX 415 ; N a84 ; B 35 0 380 692 ;
110
+ C 123 ; WX 392 ; N a97 ; B 35 263 357 705 ;
111
+ C 124 ; WX 392 ; N a98 ; B 34 263 357 705 ;
112
+ C 125 ; WX 668 ; N a99 ; B 35 263 633 705 ;
113
+ C 126 ; WX 668 ; N a100 ; B 36 263 634 705 ;
114
+ C 161 ; WX 732 ; N a101 ; B 35 -143 697 806 ;
115
+ C 162 ; WX 544 ; N a102 ; B 56 -14 488 706 ;
116
+ C 163 ; WX 544 ; N a103 ; B 34 -14 508 705 ;
117
+ C 164 ; WX 910 ; N a104 ; B 35 40 875 651 ;
118
+ C 165 ; WX 667 ; N a106 ; B 35 -14 633 705 ;
119
+ C 166 ; WX 760 ; N a107 ; B 35 -14 726 705 ;
120
+ C 167 ; WX 760 ; N a108 ; B 0 121 758 569 ;
121
+ C 168 ; WX 776 ; N a112 ; B 35 0 741 705 ;
122
+ C 169 ; WX 595 ; N a111 ; B 34 -14 560 705 ;
123
+ C 170 ; WX 694 ; N a110 ; B 35 -14 659 705 ;
124
+ C 171 ; WX 626 ; N a109 ; B 34 0 591 705 ;
125
+ C 172 ; WX 788 ; N a120 ; B 35 -14 754 705 ;
126
+ C 173 ; WX 788 ; N a121 ; B 35 -14 754 705 ;
127
+ C 174 ; WX 788 ; N a122 ; B 35 -14 754 705 ;
128
+ C 175 ; WX 788 ; N a123 ; B 35 -14 754 705 ;
129
+ C 176 ; WX 788 ; N a124 ; B 35 -14 754 705 ;
130
+ C 177 ; WX 788 ; N a125 ; B 35 -14 754 705 ;
131
+ C 178 ; WX 788 ; N a126 ; B 35 -14 754 705 ;
132
+ C 179 ; WX 788 ; N a127 ; B 35 -14 754 705 ;
133
+ C 180 ; WX 788 ; N a128 ; B 35 -14 754 705 ;
134
+ C 181 ; WX 788 ; N a129 ; B 35 -14 754 705 ;
135
+ C 182 ; WX 788 ; N a130 ; B 35 -14 754 705 ;
136
+ C 183 ; WX 788 ; N a131 ; B 35 -14 754 705 ;
137
+ C 184 ; WX 788 ; N a132 ; B 35 -14 754 705 ;
138
+ C 185 ; WX 788 ; N a133 ; B 35 -14 754 705 ;
139
+ C 186 ; WX 788 ; N a134 ; B 35 -14 754 705 ;
140
+ C 187 ; WX 788 ; N a135 ; B 35 -14 754 705 ;
141
+ C 188 ; WX 788 ; N a136 ; B 35 -14 754 705 ;
142
+ C 189 ; WX 788 ; N a137 ; B 35 -14 754 705 ;
143
+ C 190 ; WX 788 ; N a138 ; B 35 -14 754 705 ;
144
+ C 191 ; WX 788 ; N a139 ; B 35 -14 754 705 ;
145
+ C 192 ; WX 788 ; N a140 ; B 35 -14 754 705 ;
146
+ C 193 ; WX 788 ; N a141 ; B 35 -14 754 705 ;
147
+ C 194 ; WX 788 ; N a142 ; B 35 -14 754 705 ;
148
+ C 195 ; WX 788 ; N a143 ; B 35 -14 754 705 ;
149
+ C 196 ; WX 788 ; N a144 ; B 35 -14 754 705 ;
150
+ C 197 ; WX 788 ; N a145 ; B 35 -14 754 705 ;
151
+ C 198 ; WX 788 ; N a146 ; B 35 -14 754 705 ;
152
+ C 199 ; WX 788 ; N a147 ; B 35 -14 754 705 ;
153
+ C 200 ; WX 788 ; N a148 ; B 35 -14 754 705 ;
154
+ C 201 ; WX 788 ; N a149 ; B 35 -14 754 705 ;
155
+ C 202 ; WX 788 ; N a150 ; B 35 -14 754 705 ;
156
+ C 203 ; WX 788 ; N a151 ; B 35 -14 754 705 ;
157
+ C 204 ; WX 788 ; N a152 ; B 35 -14 754 705 ;
158
+ C 205 ; WX 788 ; N a153 ; B 35 -14 754 705 ;
159
+ C 206 ; WX 788 ; N a154 ; B 35 -14 754 705 ;
160
+ C 207 ; WX 788 ; N a155 ; B 35 -14 754 705 ;
161
+ C 208 ; WX 788 ; N a156 ; B 35 -14 754 705 ;
162
+ C 209 ; WX 788 ; N a157 ; B 35 -14 754 705 ;
163
+ C 210 ; WX 788 ; N a158 ; B 35 -14 754 705 ;
164
+ C 211 ; WX 788 ; N a159 ; B 35 -14 754 705 ;
165
+ C 212 ; WX 894 ; N a160 ; B 35 58 860 634 ;
166
+ C 213 ; WX 838 ; N a161 ; B 35 152 803 540 ;
167
+ C 214 ; WX 1016 ; N a163 ; B 34 152 981 540 ;
168
+ C 215 ; WX 458 ; N a164 ; B 35 -127 422 820 ;
169
+ C 216 ; WX 748 ; N a196 ; B 35 94 698 597 ;
170
+ C 217 ; WX 924 ; N a165 ; B 35 140 890 552 ;
171
+ C 218 ; WX 748 ; N a192 ; B 35 94 698 597 ;
172
+ C 219 ; WX 918 ; N a166 ; B 35 166 884 526 ;
173
+ C 220 ; WX 927 ; N a167 ; B 35 32 892 660 ;
174
+ C 221 ; WX 928 ; N a168 ; B 35 129 891 562 ;
175
+ C 222 ; WX 928 ; N a169 ; B 35 128 893 563 ;
176
+ C 223 ; WX 834 ; N a170 ; B 35 155 799 537 ;
177
+ C 224 ; WX 873 ; N a171 ; B 35 93 838 599 ;
178
+ C 225 ; WX 828 ; N a172 ; B 35 104 791 588 ;
179
+ C 226 ; WX 924 ; N a173 ; B 35 98 889 594 ;
180
+ C 227 ; WX 924 ; N a162 ; B 35 98 889 594 ;
181
+ C 228 ; WX 917 ; N a174 ; B 35 0 882 692 ;
182
+ C 229 ; WX 930 ; N a175 ; B 35 84 896 608 ;
183
+ C 230 ; WX 931 ; N a176 ; B 35 84 896 608 ;
184
+ C 231 ; WX 463 ; N a177 ; B 35 -99 429 791 ;
185
+ C 232 ; WX 883 ; N a178 ; B 35 71 848 623 ;
186
+ C 233 ; WX 836 ; N a179 ; B 35 44 802 648 ;
187
+ C 234 ; WX 836 ; N a193 ; B 35 44 802 648 ;
188
+ C 235 ; WX 867 ; N a180 ; B 35 101 832 591 ;
189
+ C 236 ; WX 867 ; N a199 ; B 35 101 832 591 ;
190
+ C 237 ; WX 696 ; N a181 ; B 35 44 661 648 ;
191
+ C 238 ; WX 696 ; N a200 ; B 35 44 661 648 ;
192
+ C 239 ; WX 874 ; N a182 ; B 35 77 840 619 ;
193
+ C 241 ; WX 874 ; N a201 ; B 35 73 840 615 ;
194
+ C 242 ; WX 760 ; N a183 ; B 35 0 725 692 ;
195
+ C 243 ; WX 946 ; N a184 ; B 35 160 911 533 ;
196
+ C 244 ; WX 771 ; N a197 ; B 34 37 736 655 ;
197
+ C 245 ; WX 865 ; N a185 ; B 35 207 830 481 ;
198
+ C 246 ; WX 771 ; N a194 ; B 34 37 736 655 ;
199
+ C 247 ; WX 888 ; N a198 ; B 34 -19 853 712 ;
200
+ C 248 ; WX 967 ; N a186 ; B 35 124 932 568 ;
201
+ C 249 ; WX 888 ; N a195 ; B 34 -19 853 712 ;
202
+ C 250 ; WX 831 ; N a187 ; B 35 113 796 579 ;
203
+ C 251 ; WX 873 ; N a188 ; B 36 118 838 578 ;
204
+ C 252 ; WX 927 ; N a189 ; B 35 150 891 542 ;
205
+ C 253 ; WX 970 ; N a190 ; B 35 76 931 616 ;
206
+ C 254 ; WX 918 ; N a191 ; B 34 99 884 593 ;
207
+ C -1 ; WX 410 ; N a86 ; B 35 0 375 692 ;
208
+ C -1 ; WX 509 ; N a85 ; B 35 0 475 692 ;
209
+ C -1 ; WX 334 ; N a95 ; B 35 0 299 692 ;
210
+ C -1 ; WX 509 ; N a205 ; B 35 0 475 692 ;
211
+ C -1 ; WX 390 ; N a89 ; B 35 -14 356 705 ;
212
+ C -1 ; WX 234 ; N a87 ; B 35 -14 199 705 ;
213
+ C -1 ; WX 276 ; N a91 ; B 35 0 242 692 ;
214
+ C -1 ; WX 390 ; N a90 ; B 35 -14 355 705 ;
215
+ C -1 ; WX 410 ; N a206 ; B 35 0 375 692 ;
216
+ C -1 ; WX 317 ; N a94 ; B 35 0 283 692 ;
217
+ C -1 ; WX 317 ; N a93 ; B 35 0 283 692 ;
218
+ C -1 ; WX 276 ; N a92 ; B 35 0 242 692 ;
219
+ C -1 ; WX 334 ; N a96 ; B 35 0 299 692 ;
220
+ C -1 ; WX 234 ; N a88 ; B 35 -14 199 705 ;
221
+ EndCharMetrics
222
+ EndFontMetrics
shared/package-files/33/33293b3dd4ae5a2346be22cdad57f7f288da5dd40d34f36ababe8c84cf320264/NativeMetaFunctions.h ADDED
@@ -0,0 +1,1303 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from NativeMetaFunctions.h
4
+
5
+ #include <ATen/core/Tensor.h>
6
+ #include <ATen/core/IListRef.h>
7
+ #include <ATen/TensorMeta.h>
8
+ #include <ATen/TensorIterator.h>
9
+
10
+ #include <ATen/ops/_adaptive_avg_pool2d_meta.h>
11
+ #include <ATen/ops/_adaptive_avg_pool2d_backward_meta.h>
12
+ #include <ATen/ops/_adaptive_avg_pool3d_meta.h>
13
+ #include <ATen/ops/_adaptive_avg_pool3d_backward_meta.h>
14
+ #include <ATen/ops/_add_batch_dim_meta.h>
15
+ #include <ATen/ops/_add_relu_meta.h>
16
+ #include <ATen/ops/_addmm_activation_meta.h>
17
+ #include <ATen/ops/_aminmax_meta.h>
18
+ #include <ATen/ops/_amp_foreach_non_finite_check_and_unscale_meta.h>
19
+ #include <ATen/ops/_amp_update_scale_meta.h>
20
+ #include <ATen/ops/_assert_async_meta.h>
21
+ #include <ATen/ops/_assert_scalar_meta.h>
22
+ #include <ATen/ops/_assert_tensor_metadata_meta.h>
23
+ #include <ATen/ops/_autocast_to_full_precision_meta.h>
24
+ #include <ATen/ops/_autocast_to_reduced_precision_meta.h>
25
+ #include <ATen/ops/_backward_meta.h>
26
+ #include <ATen/ops/_batch_norm_impl_index_meta.h>
27
+ #include <ATen/ops/_batch_norm_impl_index_backward_meta.h>
28
+ #include <ATen/ops/_cast_Byte_meta.h>
29
+ #include <ATen/ops/_cast_Char_meta.h>
30
+ #include <ATen/ops/_cast_Double_meta.h>
31
+ #include <ATen/ops/_cast_Float_meta.h>
32
+ #include <ATen/ops/_cast_Half_meta.h>
33
+ #include <ATen/ops/_cast_Int_meta.h>
34
+ #include <ATen/ops/_cast_Long_meta.h>
35
+ #include <ATen/ops/_cast_Short_meta.h>
36
+ #include <ATen/ops/_cdist_backward_meta.h>
37
+ #include <ATen/ops/_cdist_forward_meta.h>
38
+ #include <ATen/ops/_cholesky_solve_helper_meta.h>
39
+ #include <ATen/ops/_choose_qparams_per_tensor_meta.h>
40
+ #include <ATen/ops/_chunk_cat_meta.h>
41
+ #include <ATen/ops/_coalesce_meta.h>
42
+ #include <ATen/ops/_coalesced_meta.h>
43
+ #include <ATen/ops/_compute_linear_combination_meta.h>
44
+ #include <ATen/ops/_conj_meta.h>
45
+ #include <ATen/ops/_conj_copy_meta.h>
46
+ #include <ATen/ops/_conj_physical_meta.h>
47
+ #include <ATen/ops/_conv_depthwise2d_meta.h>
48
+ #include <ATen/ops/_convert_indices_from_coo_to_csr_meta.h>
49
+ #include <ATen/ops/_convert_indices_from_csr_to_coo_meta.h>
50
+ #include <ATen/ops/_convert_weight_to_int4pack_meta.h>
51
+ #include <ATen/ops/_convolution_meta.h>
52
+ #include <ATen/ops/_convolution_double_backward_meta.h>
53
+ #include <ATen/ops/_convolution_mode_meta.h>
54
+ #include <ATen/ops/_copy_from_meta.h>
55
+ #include <ATen/ops/_copy_from_and_resize_meta.h>
56
+ #include <ATen/ops/_cslt_compress_meta.h>
57
+ #include <ATen/ops/_cslt_sparse_mm_meta.h>
58
+ #include <ATen/ops/_cslt_sparse_mm_search_meta.h>
59
+ #include <ATen/ops/_ctc_loss_meta.h>
60
+ #include <ATen/ops/_ctc_loss_backward_meta.h>
61
+ #include <ATen/ops/_cudnn_ctc_loss_meta.h>
62
+ #include <ATen/ops/_cudnn_init_dropout_state_meta.h>
63
+ #include <ATen/ops/_cudnn_rnn_meta.h>
64
+ #include <ATen/ops/_cudnn_rnn_backward_meta.h>
65
+ #include <ATen/ops/_cudnn_rnn_flatten_weight_meta.h>
66
+ #include <ATen/ops/_cufft_clear_plan_cache_meta.h>
67
+ #include <ATen/ops/_cufft_get_plan_cache_max_size_meta.h>
68
+ #include <ATen/ops/_cufft_get_plan_cache_size_meta.h>
69
+ #include <ATen/ops/_cufft_set_plan_cache_max_size_meta.h>
70
+ #include <ATen/ops/_cummax_helper_meta.h>
71
+ #include <ATen/ops/_cummin_helper_meta.h>
72
+ #include <ATen/ops/_debug_has_internal_overlap_meta.h>
73
+ #include <ATen/ops/_dimI_meta.h>
74
+ #include <ATen/ops/_dimV_meta.h>
75
+ #include <ATen/ops/_dim_arange_meta.h>
76
+ #include <ATen/ops/_dirichlet_grad_meta.h>
77
+ #include <ATen/ops/_efficient_attention_backward_meta.h>
78
+ #include <ATen/ops/_efficient_attention_forward_meta.h>
79
+ #include <ATen/ops/_efficientzerotensor_meta.h>
80
+ #include <ATen/ops/_embedding_bag_meta.h>
81
+ #include <ATen/ops/_embedding_bag_backward_meta.h>
82
+ #include <ATen/ops/_embedding_bag_dense_backward_meta.h>
83
+ #include <ATen/ops/_embedding_bag_forward_only_meta.h>
84
+ #include <ATen/ops/_embedding_bag_per_sample_weights_backward_meta.h>
85
+ #include <ATen/ops/_embedding_bag_sparse_backward_meta.h>
86
+ #include <ATen/ops/_empty_affine_quantized_meta.h>
87
+ #include <ATen/ops/_empty_per_channel_affine_quantized_meta.h>
88
+ #include <ATen/ops/_euclidean_dist_meta.h>
89
+ #include <ATen/ops/_fake_quantize_learnable_per_channel_affine_meta.h>
90
+ #include <ATen/ops/_fake_quantize_learnable_per_channel_affine_backward_meta.h>
91
+ #include <ATen/ops/_fake_quantize_learnable_per_tensor_affine_meta.h>
92
+ #include <ATen/ops/_fake_quantize_learnable_per_tensor_affine_backward_meta.h>
93
+ #include <ATen/ops/_fake_quantize_per_tensor_affine_cachemask_tensor_qparams_meta.h>
94
+ #include <ATen/ops/_fft_c2c_meta.h>
95
+ #include <ATen/ops/_fft_c2r_meta.h>
96
+ #include <ATen/ops/_fft_r2c_meta.h>
97
+ #include <ATen/ops/_fill_mem_eff_dropout_mask_meta.h>
98
+ #include <ATen/ops/_flash_attention_backward_meta.h>
99
+ #include <ATen/ops/_flash_attention_forward_meta.h>
100
+ #include <ATen/ops/_foobar_meta.h>
101
+ #include <ATen/ops/_foreach_abs_meta.h>
102
+ #include <ATen/ops/_foreach_acos_meta.h>
103
+ #include <ATen/ops/_foreach_add_meta.h>
104
+ #include <ATen/ops/_foreach_addcdiv_meta.h>
105
+ #include <ATen/ops/_foreach_addcmul_meta.h>
106
+ #include <ATen/ops/_foreach_asin_meta.h>
107
+ #include <ATen/ops/_foreach_atan_meta.h>
108
+ #include <ATen/ops/_foreach_ceil_meta.h>
109
+ #include <ATen/ops/_foreach_clamp_max_meta.h>
110
+ #include <ATen/ops/_foreach_clamp_min_meta.h>
111
+ #include <ATen/ops/_foreach_copy_meta.h>
112
+ #include <ATen/ops/_foreach_cos_meta.h>
113
+ #include <ATen/ops/_foreach_cosh_meta.h>
114
+ #include <ATen/ops/_foreach_div_meta.h>
115
+ #include <ATen/ops/_foreach_erf_meta.h>
116
+ #include <ATen/ops/_foreach_erfc_meta.h>
117
+ #include <ATen/ops/_foreach_exp_meta.h>
118
+ #include <ATen/ops/_foreach_expm1_meta.h>
119
+ #include <ATen/ops/_foreach_floor_meta.h>
120
+ #include <ATen/ops/_foreach_frac_meta.h>
121
+ #include <ATen/ops/_foreach_lerp_meta.h>
122
+ #include <ATen/ops/_foreach_lgamma_meta.h>
123
+ #include <ATen/ops/_foreach_log_meta.h>
124
+ #include <ATen/ops/_foreach_log10_meta.h>
125
+ #include <ATen/ops/_foreach_log1p_meta.h>
126
+ #include <ATen/ops/_foreach_log2_meta.h>
127
+ #include <ATen/ops/_foreach_maximum_meta.h>
128
+ #include <ATen/ops/_foreach_minimum_meta.h>
129
+ #include <ATen/ops/_foreach_mul_meta.h>
130
+ #include <ATen/ops/_foreach_neg_meta.h>
131
+ #include <ATen/ops/_foreach_norm_meta.h>
132
+ #include <ATen/ops/_foreach_pow_meta.h>
133
+ #include <ATen/ops/_foreach_reciprocal_meta.h>
134
+ #include <ATen/ops/_foreach_round_meta.h>
135
+ #include <ATen/ops/_foreach_sigmoid_meta.h>
136
+ #include <ATen/ops/_foreach_sign_meta.h>
137
+ #include <ATen/ops/_foreach_sin_meta.h>
138
+ #include <ATen/ops/_foreach_sinh_meta.h>
139
+ #include <ATen/ops/_foreach_sqrt_meta.h>
140
+ #include <ATen/ops/_foreach_sub_meta.h>
141
+ #include <ATen/ops/_foreach_tan_meta.h>
142
+ #include <ATen/ops/_foreach_tanh_meta.h>
143
+ #include <ATen/ops/_foreach_trunc_meta.h>
144
+ #include <ATen/ops/_foreach_zero_meta.h>
145
+ #include <ATen/ops/_functional_assert_async_meta.h>
146
+ #include <ATen/ops/_functional_assert_scalar_meta.h>
147
+ #include <ATen/ops/_functional_sym_constrain_range_meta.h>
148
+ #include <ATen/ops/_functional_sym_constrain_range_for_size_meta.h>
149
+ #include <ATen/ops/_fused_adam_meta.h>
150
+ #include <ATen/ops/_fused_adamw_meta.h>
151
+ #include <ATen/ops/_fused_dropout_meta.h>
152
+ #include <ATen/ops/_fused_moving_avg_obs_fq_helper_meta.h>
153
+ #include <ATen/ops/_fused_sdp_choice_meta.h>
154
+ #include <ATen/ops/_fused_sgd_meta.h>
155
+ #include <ATen/ops/_fw_primal_meta.h>
156
+ #include <ATen/ops/_fw_primal_copy_meta.h>
157
+ #include <ATen/ops/_gather_sparse_backward_meta.h>
158
+ #include <ATen/ops/_grid_sampler_2d_cpu_fallback_meta.h>
159
+ #include <ATen/ops/_grid_sampler_2d_cpu_fallback_backward_meta.h>
160
+ #include <ATen/ops/_has_compatible_shallow_copy_type_meta.h>
161
+ #include <ATen/ops/_has_same_storage_numel_meta.h>
162
+ #include <ATen/ops/_histogramdd_bin_edges_meta.h>
163
+ #include <ATen/ops/_histogramdd_from_bin_cts_meta.h>
164
+ #include <ATen/ops/_histogramdd_from_bin_tensors_meta.h>
165
+ #include <ATen/ops/_index_put_impl_meta.h>
166
+ #include <ATen/ops/_indices_meta.h>
167
+ #include <ATen/ops/_indices_copy_meta.h>
168
+ #include <ATen/ops/_int_mm_meta.h>
169
+ #include <ATen/ops/_is_all_true_meta.h>
170
+ #include <ATen/ops/_is_any_true_meta.h>
171
+ #include <ATen/ops/_is_zerotensor_meta.h>
172
+ #include <ATen/ops/_lazy_clone_meta.h>
173
+ #include <ATen/ops/_linalg_check_errors_meta.h>
174
+ #include <ATen/ops/_linalg_det_meta.h>
175
+ #include <ATen/ops/_linalg_eigh_meta.h>
176
+ #include <ATen/ops/_linalg_eigvals_meta.h>
177
+ #include <ATen/ops/_linalg_slogdet_meta.h>
178
+ #include <ATen/ops/_linalg_solve_ex_meta.h>
179
+ #include <ATen/ops/_linalg_svd_meta.h>
180
+ #include <ATen/ops/_local_scalar_dense_meta.h>
181
+ #include <ATen/ops/_log_softmax_meta.h>
182
+ #include <ATen/ops/_log_softmax_backward_data_meta.h>
183
+ #include <ATen/ops/_logcumsumexp_meta.h>
184
+ #include <ATen/ops/_lstm_mps_meta.h>
185
+ #include <ATen/ops/_lu_with_info_meta.h>
186
+ #include <ATen/ops/_make_dep_token_meta.h>
187
+ #include <ATen/ops/_make_dual_meta.h>
188
+ #include <ATen/ops/_make_dual_copy_meta.h>
189
+ #include <ATen/ops/_make_per_channel_quantized_tensor_meta.h>
190
+ #include <ATen/ops/_make_per_tensor_quantized_tensor_meta.h>
191
+ #include <ATen/ops/_masked_scale_meta.h>
192
+ #include <ATen/ops/_masked_softmax_meta.h>
193
+ #include <ATen/ops/_masked_softmax_backward_meta.h>
194
+ #include <ATen/ops/_mixed_dtypes_linear_meta.h>
195
+ #include <ATen/ops/_mkldnn_reshape_meta.h>
196
+ #include <ATen/ops/_mkldnn_transpose_meta.h>
197
+ #include <ATen/ops/_mps_convolution_meta.h>
198
+ #include <ATen/ops/_mps_convolution_transpose_meta.h>
199
+ #include <ATen/ops/_native_batch_norm_legit_meta.h>
200
+ #include <ATen/ops/_native_batch_norm_legit_no_training_meta.h>
201
+ #include <ATen/ops/_native_multi_head_attention_meta.h>
202
+ #include <ATen/ops/_neg_view_meta.h>
203
+ #include <ATen/ops/_neg_view_copy_meta.h>
204
+ #include <ATen/ops/_nested_from_padded_meta.h>
205
+ #include <ATen/ops/_nested_from_padded_and_nested_example_meta.h>
206
+ #include <ATen/ops/_nested_get_jagged_dummy_meta.h>
207
+ #include <ATen/ops/_nested_get_lengths_meta.h>
208
+ #include <ATen/ops/_nested_get_offsets_meta.h>
209
+ #include <ATen/ops/_nested_get_ragged_idx_meta.h>
210
+ #include <ATen/ops/_nested_get_values_meta.h>
211
+ #include <ATen/ops/_nested_get_values_copy_meta.h>
212
+ #include <ATen/ops/_nested_select_backward_meta.h>
213
+ #include <ATen/ops/_nested_sum_backward_meta.h>
214
+ #include <ATen/ops/_nested_tensor_from_mask_meta.h>
215
+ #include <ATen/ops/_nested_tensor_from_mask_left_aligned_meta.h>
216
+ #include <ATen/ops/_nested_tensor_from_tensor_list_meta.h>
217
+ #include <ATen/ops/_nested_tensor_size_meta.h>
218
+ #include <ATen/ops/_nested_tensor_softmax_with_shape_meta.h>
219
+ #include <ATen/ops/_nested_tensor_storage_offsets_meta.h>
220
+ #include <ATen/ops/_nested_tensor_strides_meta.h>
221
+ #include <ATen/ops/_nested_view_from_buffer_meta.h>
222
+ #include <ATen/ops/_nested_view_from_buffer_copy_meta.h>
223
+ #include <ATen/ops/_nested_view_from_jagged_meta.h>
224
+ #include <ATen/ops/_nested_view_from_jagged_copy_meta.h>
225
+ #include <ATen/ops/_new_zeros_with_same_feature_meta_meta.h>
226
+ #include <ATen/ops/_nnpack_available_meta.h>
227
+ #include <ATen/ops/_nnpack_spatial_convolution_meta.h>
228
+ #include <ATen/ops/_nnz_meta.h>
229
+ #include <ATen/ops/_pack_padded_sequence_meta.h>
230
+ #include <ATen/ops/_pack_padded_sequence_backward_meta.h>
231
+ #include <ATen/ops/_pad_circular_meta.h>
232
+ #include <ATen/ops/_pad_enum_meta.h>
233
+ #include <ATen/ops/_pad_packed_sequence_meta.h>
234
+ #include <ATen/ops/_pdist_backward_meta.h>
235
+ #include <ATen/ops/_pdist_forward_meta.h>
236
+ #include <ATen/ops/_pin_memory_meta.h>
237
+ #include <ATen/ops/_prelu_kernel_meta.h>
238
+ #include <ATen/ops/_prelu_kernel_backward_meta.h>
239
+ #include <ATen/ops/_print_meta.h>
240
+ #include <ATen/ops/_propagate_xla_data_meta.h>
241
+ #include <ATen/ops/_remove_batch_dim_meta.h>
242
+ #include <ATen/ops/_reshape_alias_meta.h>
243
+ #include <ATen/ops/_reshape_alias_copy_meta.h>
244
+ #include <ATen/ops/_reshape_copy_meta.h>
245
+ #include <ATen/ops/_reshape_from_tensor_meta.h>
246
+ #include <ATen/ops/_resize_output_meta.h>
247
+ #include <ATen/ops/_rowwise_prune_meta.h>
248
+ #include <ATen/ops/_sample_dirichlet_meta.h>
249
+ #include <ATen/ops/_saturate_weight_to_fp16_meta.h>
250
+ #include <ATen/ops/_scaled_dot_product_attention_math_meta.h>
251
+ #include <ATen/ops/_scaled_dot_product_cudnn_attention_meta.h>
252
+ #include <ATen/ops/_scaled_dot_product_efficient_attention_meta.h>
253
+ #include <ATen/ops/_scaled_dot_product_efficient_attention_backward_meta.h>
254
+ #include <ATen/ops/_scaled_dot_product_flash_attention_meta.h>
255
+ #include <ATen/ops/_scaled_dot_product_flash_attention_backward_meta.h>
256
+ #include <ATen/ops/_scaled_dot_product_flash_attention_for_cpu_meta.h>
257
+ #include <ATen/ops/_scaled_dot_product_flash_attention_for_cpu_backward_meta.h>
258
+ #include <ATen/ops/_scaled_mm_meta.h>
259
+ #include <ATen/ops/_segment_reduce_backward_meta.h>
260
+ #include <ATen/ops/_shape_as_tensor_meta.h>
261
+ #include <ATen/ops/_slow_conv2d_backward_meta.h>
262
+ #include <ATen/ops/_slow_conv2d_forward_meta.h>
263
+ #include <ATen/ops/_sobol_engine_draw_meta.h>
264
+ #include <ATen/ops/_sobol_engine_ff_meta.h>
265
+ #include <ATen/ops/_sobol_engine_initialize_state_meta.h>
266
+ #include <ATen/ops/_sobol_engine_scramble_meta.h>
267
+ #include <ATen/ops/_softmax_meta.h>
268
+ #include <ATen/ops/_softmax_backward_data_meta.h>
269
+ #include <ATen/ops/_sparse_addmm_meta.h>
270
+ #include <ATen/ops/_sparse_broadcast_to_meta.h>
271
+ #include <ATen/ops/_sparse_broadcast_to_copy_meta.h>
272
+ #include <ATen/ops/_sparse_bsc_tensor_unsafe_meta.h>
273
+ #include <ATen/ops/_sparse_bsr_tensor_unsafe_meta.h>
274
+ #include <ATen/ops/_sparse_compressed_tensor_unsafe_meta.h>
275
+ #include <ATen/ops/_sparse_coo_tensor_unsafe_meta.h>
276
+ #include <ATen/ops/_sparse_coo_tensor_with_dims_meta.h>
277
+ #include <ATen/ops/_sparse_coo_tensor_with_dims_and_tensors_meta.h>
278
+ #include <ATen/ops/_sparse_csc_tensor_unsafe_meta.h>
279
+ #include <ATen/ops/_sparse_csr_prod_meta.h>
280
+ #include <ATen/ops/_sparse_csr_sum_meta.h>
281
+ #include <ATen/ops/_sparse_csr_tensor_unsafe_meta.h>
282
+ #include <ATen/ops/_sparse_log_softmax_meta.h>
283
+ #include <ATen/ops/_sparse_log_softmax_backward_data_meta.h>
284
+ #include <ATen/ops/_sparse_mask_projection_meta.h>
285
+ #include <ATen/ops/_sparse_mm_meta.h>
286
+ #include <ATen/ops/_sparse_mm_reduce_impl_meta.h>
287
+ #include <ATen/ops/_sparse_mm_reduce_impl_backward_meta.h>
288
+ #include <ATen/ops/_sparse_semi_structured_linear_meta.h>
289
+ #include <ATen/ops/_sparse_softmax_meta.h>
290
+ #include <ATen/ops/_sparse_softmax_backward_data_meta.h>
291
+ #include <ATen/ops/_sparse_sparse_matmul_meta.h>
292
+ #include <ATen/ops/_sparse_sum_meta.h>
293
+ #include <ATen/ops/_sparse_sum_backward_meta.h>
294
+ #include <ATen/ops/_spdiags_meta.h>
295
+ #include <ATen/ops/_stack_meta.h>
296
+ #include <ATen/ops/_standard_gamma_meta.h>
297
+ #include <ATen/ops/_standard_gamma_grad_meta.h>
298
+ #include <ATen/ops/_test_ambiguous_defaults_meta.h>
299
+ #include <ATen/ops/_test_autograd_multiple_dispatch_meta.h>
300
+ #include <ATen/ops/_test_autograd_multiple_dispatch_view_meta.h>
301
+ #include <ATen/ops/_test_autograd_multiple_dispatch_view_copy_meta.h>
302
+ #include <ATen/ops/_test_check_tensor_meta.h>
303
+ #include <ATen/ops/_test_functorch_fallback_meta.h>
304
+ #include <ATen/ops/_test_optional_filled_intlist_meta.h>
305
+ #include <ATen/ops/_test_optional_floatlist_meta.h>
306
+ #include <ATen/ops/_test_optional_intlist_meta.h>
307
+ #include <ATen/ops/_test_parallel_materialize_meta.h>
308
+ #include <ATen/ops/_test_serialization_subcmul_meta.h>
309
+ #include <ATen/ops/_test_string_default_meta.h>
310
+ #include <ATen/ops/_test_warn_in_autograd_meta.h>
311
+ #include <ATen/ops/_thnn_differentiable_gru_cell_backward_meta.h>
312
+ #include <ATen/ops/_thnn_differentiable_lstm_cell_backward_meta.h>
313
+ #include <ATen/ops/_thnn_fused_gru_cell_meta.h>
314
+ #include <ATen/ops/_thnn_fused_gru_cell_backward_meta.h>
315
+ #include <ATen/ops/_thnn_fused_lstm_cell_meta.h>
316
+ #include <ATen/ops/_thnn_fused_lstm_cell_backward_meta.h>
317
+ #include <ATen/ops/_thnn_fused_lstm_cell_backward_impl_meta.h>
318
+ #include <ATen/ops/_to_copy_meta.h>
319
+ #include <ATen/ops/_to_cpu_meta.h>
320
+ #include <ATen/ops/_to_dense_meta.h>
321
+ #include <ATen/ops/_to_sparse_meta.h>
322
+ #include <ATen/ops/_to_sparse_bsc_meta.h>
323
+ #include <ATen/ops/_to_sparse_bsr_meta.h>
324
+ #include <ATen/ops/_to_sparse_csc_meta.h>
325
+ #include <ATen/ops/_to_sparse_csr_meta.h>
326
+ #include <ATen/ops/_to_sparse_semi_structured_meta.h>
327
+ #include <ATen/ops/_transform_bias_rescale_qkv_meta.h>
328
+ #include <ATen/ops/_transformer_encoder_layer_fwd_meta.h>
329
+ #include <ATen/ops/_trilinear_meta.h>
330
+ #include <ATen/ops/_triton_multi_head_attention_meta.h>
331
+ #include <ATen/ops/_triton_scaled_dot_attention_meta.h>
332
+ #include <ATen/ops/_unique_meta.h>
333
+ #include <ATen/ops/_unique2_meta.h>
334
+ #include <ATen/ops/_unpack_dual_meta.h>
335
+ #include <ATen/ops/_unsafe_index_meta.h>
336
+ #include <ATen/ops/_unsafe_index_put_meta.h>
337
+ #include <ATen/ops/_unsafe_view_meta.h>
338
+ #include <ATen/ops/_upsample_bicubic2d_aa_meta.h>
339
+ #include <ATen/ops/_upsample_bicubic2d_aa_backward_meta.h>
340
+ #include <ATen/ops/_upsample_bilinear2d_aa_meta.h>
341
+ #include <ATen/ops/_upsample_bilinear2d_aa_backward_meta.h>
342
+ #include <ATen/ops/_upsample_nearest_exact1d_meta.h>
343
+ #include <ATen/ops/_upsample_nearest_exact1d_backward_meta.h>
344
+ #include <ATen/ops/_upsample_nearest_exact2d_meta.h>
345
+ #include <ATen/ops/_upsample_nearest_exact2d_backward_meta.h>
346
+ #include <ATen/ops/_upsample_nearest_exact3d_meta.h>
347
+ #include <ATen/ops/_upsample_nearest_exact3d_backward_meta.h>
348
+ #include <ATen/ops/_use_cudnn_ctc_loss_meta.h>
349
+ #include <ATen/ops/_use_cudnn_rnn_flatten_weight_meta.h>
350
+ #include <ATen/ops/_validate_compressed_sparse_indices_meta.h>
351
+ #include <ATen/ops/_validate_sparse_bsc_tensor_args_meta.h>
352
+ #include <ATen/ops/_validate_sparse_bsr_tensor_args_meta.h>
353
+ #include <ATen/ops/_validate_sparse_compressed_tensor_args_meta.h>
354
+ #include <ATen/ops/_validate_sparse_coo_tensor_args_meta.h>
355
+ #include <ATen/ops/_validate_sparse_csc_tensor_args_meta.h>
356
+ #include <ATen/ops/_validate_sparse_csr_tensor_args_meta.h>
357
+ #include <ATen/ops/_values_meta.h>
358
+ #include <ATen/ops/_values_copy_meta.h>
359
+ #include <ATen/ops/_version_meta.h>
360
+ #include <ATen/ops/_weight_int4pack_mm_meta.h>
361
+ #include <ATen/ops/_weight_int8pack_mm_meta.h>
362
+ #include <ATen/ops/_weight_norm_meta.h>
363
+ #include <ATen/ops/_weight_norm_differentiable_backward_meta.h>
364
+ #include <ATen/ops/_weight_norm_interface_meta.h>
365
+ #include <ATen/ops/_weight_norm_interface_backward_meta.h>
366
+ #include <ATen/ops/abs_meta.h>
367
+ #include <ATen/ops/absolute_meta.h>
368
+ #include <ATen/ops/acos_meta.h>
369
+ #include <ATen/ops/acosh_meta.h>
370
+ #include <ATen/ops/adaptive_avg_pool1d_meta.h>
371
+ #include <ATen/ops/adaptive_avg_pool2d_meta.h>
372
+ #include <ATen/ops/adaptive_avg_pool3d_meta.h>
373
+ #include <ATen/ops/adaptive_avg_pool3d_backward_meta.h>
374
+ #include <ATen/ops/adaptive_max_pool1d_meta.h>
375
+ #include <ATen/ops/adaptive_max_pool2d_meta.h>
376
+ #include <ATen/ops/adaptive_max_pool2d_backward_meta.h>
377
+ #include <ATen/ops/adaptive_max_pool3d_meta.h>
378
+ #include <ATen/ops/adaptive_max_pool3d_backward_meta.h>
379
+ #include <ATen/ops/add_meta.h>
380
+ #include <ATen/ops/addbmm_meta.h>
381
+ #include <ATen/ops/addcdiv_meta.h>
382
+ #include <ATen/ops/addcmul_meta.h>
383
+ #include <ATen/ops/addmm_meta.h>
384
+ #include <ATen/ops/addmv_meta.h>
385
+ #include <ATen/ops/addr_meta.h>
386
+ #include <ATen/ops/adjoint_meta.h>
387
+ #include <ATen/ops/affine_grid_generator_meta.h>
388
+ #include <ATen/ops/affine_grid_generator_backward_meta.h>
389
+ #include <ATen/ops/alias_meta.h>
390
+ #include <ATen/ops/alias_copy_meta.h>
391
+ #include <ATen/ops/align_as_meta.h>
392
+ #include <ATen/ops/align_tensors_meta.h>
393
+ #include <ATen/ops/align_to_meta.h>
394
+ #include <ATen/ops/all_meta.h>
395
+ #include <ATen/ops/allclose_meta.h>
396
+ #include <ATen/ops/alpha_dropout_meta.h>
397
+ #include <ATen/ops/amax_meta.h>
398
+ #include <ATen/ops/amin_meta.h>
399
+ #include <ATen/ops/aminmax_meta.h>
400
+ #include <ATen/ops/and_meta.h>
401
+ #include <ATen/ops/angle_meta.h>
402
+ #include <ATen/ops/any_meta.h>
403
+ #include <ATen/ops/arange_meta.h>
404
+ #include <ATen/ops/arccos_meta.h>
405
+ #include <ATen/ops/arccosh_meta.h>
406
+ #include <ATen/ops/arcsin_meta.h>
407
+ #include <ATen/ops/arcsinh_meta.h>
408
+ #include <ATen/ops/arctan_meta.h>
409
+ #include <ATen/ops/arctan2_meta.h>
410
+ #include <ATen/ops/arctanh_meta.h>
411
+ #include <ATen/ops/argmax_meta.h>
412
+ #include <ATen/ops/argmin_meta.h>
413
+ #include <ATen/ops/argsort_meta.h>
414
+ #include <ATen/ops/argwhere_meta.h>
415
+ #include <ATen/ops/as_strided_meta.h>
416
+ #include <ATen/ops/as_strided_copy_meta.h>
417
+ #include <ATen/ops/as_strided_scatter_meta.h>
418
+ #include <ATen/ops/asin_meta.h>
419
+ #include <ATen/ops/asinh_meta.h>
420
+ #include <ATen/ops/atan_meta.h>
421
+ #include <ATen/ops/atan2_meta.h>
422
+ #include <ATen/ops/atanh_meta.h>
423
+ #include <ATen/ops/atleast_1d_meta.h>
424
+ #include <ATen/ops/atleast_2d_meta.h>
425
+ #include <ATen/ops/atleast_3d_meta.h>
426
+ #include <ATen/ops/avg_pool1d_meta.h>
427
+ #include <ATen/ops/avg_pool2d_meta.h>
428
+ #include <ATen/ops/avg_pool2d_backward_meta.h>
429
+ #include <ATen/ops/avg_pool3d_meta.h>
430
+ #include <ATen/ops/avg_pool3d_backward_meta.h>
431
+ #include <ATen/ops/baddbmm_meta.h>
432
+ #include <ATen/ops/bartlett_window_meta.h>
433
+ #include <ATen/ops/batch_norm_meta.h>
434
+ #include <ATen/ops/batch_norm_backward_elemt_meta.h>
435
+ #include <ATen/ops/batch_norm_backward_reduce_meta.h>
436
+ #include <ATen/ops/batch_norm_elemt_meta.h>
437
+ #include <ATen/ops/batch_norm_gather_stats_meta.h>
438
+ #include <ATen/ops/batch_norm_gather_stats_with_counts_meta.h>
439
+ #include <ATen/ops/batch_norm_stats_meta.h>
440
+ #include <ATen/ops/batch_norm_update_stats_meta.h>
441
+ #include <ATen/ops/bernoulli_meta.h>
442
+ #include <ATen/ops/bilinear_meta.h>
443
+ #include <ATen/ops/binary_cross_entropy_meta.h>
444
+ #include <ATen/ops/binary_cross_entropy_backward_meta.h>
445
+ #include <ATen/ops/binary_cross_entropy_with_logits_meta.h>
446
+ #include <ATen/ops/bincount_meta.h>
447
+ #include <ATen/ops/binomial_meta.h>
448
+ #include <ATen/ops/bitwise_and_meta.h>
449
+ #include <ATen/ops/bitwise_left_shift_meta.h>
450
+ #include <ATen/ops/bitwise_not_meta.h>
451
+ #include <ATen/ops/bitwise_or_meta.h>
452
+ #include <ATen/ops/bitwise_right_shift_meta.h>
453
+ #include <ATen/ops/bitwise_xor_meta.h>
454
+ #include <ATen/ops/blackman_window_meta.h>
455
+ #include <ATen/ops/block_diag_meta.h>
456
+ #include <ATen/ops/bmm_meta.h>
457
+ #include <ATen/ops/broadcast_tensors_meta.h>
458
+ #include <ATen/ops/broadcast_to_meta.h>
459
+ #include <ATen/ops/bucketize_meta.h>
460
+ #include <ATen/ops/can_cast_meta.h>
461
+ #include <ATen/ops/cartesian_prod_meta.h>
462
+ #include <ATen/ops/cat_meta.h>
463
+ #include <ATen/ops/cauchy_meta.h>
464
+ #include <ATen/ops/ccol_indices_meta.h>
465
+ #include <ATen/ops/ccol_indices_copy_meta.h>
466
+ #include <ATen/ops/cdist_meta.h>
467
+ #include <ATen/ops/ceil_meta.h>
468
+ #include <ATen/ops/celu_meta.h>
469
+ #include <ATen/ops/chain_matmul_meta.h>
470
+ #include <ATen/ops/chalf_meta.h>
471
+ #include <ATen/ops/channel_shuffle_meta.h>
472
+ #include <ATen/ops/cholesky_meta.h>
473
+ #include <ATen/ops/cholesky_inverse_meta.h>
474
+ #include <ATen/ops/cholesky_solve_meta.h>
475
+ #include <ATen/ops/choose_qparams_optimized_meta.h>
476
+ #include <ATen/ops/chunk_meta.h>
477
+ #include <ATen/ops/clamp_meta.h>
478
+ #include <ATen/ops/clamp_max_meta.h>
479
+ #include <ATen/ops/clamp_min_meta.h>
480
+ #include <ATen/ops/clip_meta.h>
481
+ #include <ATen/ops/clone_meta.h>
482
+ #include <ATen/ops/coalesce_meta.h>
483
+ #include <ATen/ops/col2im_meta.h>
484
+ #include <ATen/ops/col_indices_meta.h>
485
+ #include <ATen/ops/col_indices_copy_meta.h>
486
+ #include <ATen/ops/column_stack_meta.h>
487
+ #include <ATen/ops/combinations_meta.h>
488
+ #include <ATen/ops/complex_meta.h>
489
+ #include <ATen/ops/concat_meta.h>
490
+ #include <ATen/ops/concatenate_meta.h>
491
+ #include <ATen/ops/conj_meta.h>
492
+ #include <ATen/ops/conj_physical_meta.h>
493
+ #include <ATen/ops/constant_pad_nd_meta.h>
494
+ #include <ATen/ops/contiguous_meta.h>
495
+ #include <ATen/ops/conv1d_meta.h>
496
+ #include <ATen/ops/conv2d_meta.h>
497
+ #include <ATen/ops/conv3d_meta.h>
498
+ #include <ATen/ops/conv_depthwise3d_meta.h>
499
+ #include <ATen/ops/conv_tbc_meta.h>
500
+ #include <ATen/ops/conv_tbc_backward_meta.h>
501
+ #include <ATen/ops/conv_transpose1d_meta.h>
502
+ #include <ATen/ops/conv_transpose2d_meta.h>
503
+ #include <ATen/ops/conv_transpose3d_meta.h>
504
+ #include <ATen/ops/convolution_meta.h>
505
+ #include <ATen/ops/convolution_backward_meta.h>
506
+ #include <ATen/ops/convolution_backward_overrideable_meta.h>
507
+ #include <ATen/ops/convolution_overrideable_meta.h>
508
+ #include <ATen/ops/copy_meta.h>
509
+ #include <ATen/ops/copy_sparse_to_sparse_meta.h>
510
+ #include <ATen/ops/copysign_meta.h>
511
+ #include <ATen/ops/corrcoef_meta.h>
512
+ #include <ATen/ops/cos_meta.h>
513
+ #include <ATen/ops/cosh_meta.h>
514
+ #include <ATen/ops/cosine_embedding_loss_meta.h>
515
+ #include <ATen/ops/cosine_similarity_meta.h>
516
+ #include <ATen/ops/count_nonzero_meta.h>
517
+ #include <ATen/ops/cov_meta.h>
518
+ #include <ATen/ops/cross_meta.h>
519
+ #include <ATen/ops/cross_entropy_loss_meta.h>
520
+ #include <ATen/ops/crow_indices_meta.h>
521
+ #include <ATen/ops/crow_indices_copy_meta.h>
522
+ #include <ATen/ops/ctc_loss_meta.h>
523
+ #include <ATen/ops/cudnn_affine_grid_generator_meta.h>
524
+ #include <ATen/ops/cudnn_affine_grid_generator_backward_meta.h>
525
+ #include <ATen/ops/cudnn_batch_norm_meta.h>
526
+ #include <ATen/ops/cudnn_batch_norm_backward_meta.h>
527
+ #include <ATen/ops/cudnn_convolution_meta.h>
528
+ #include <ATen/ops/cudnn_convolution_add_relu_meta.h>
529
+ #include <ATen/ops/cudnn_convolution_relu_meta.h>
530
+ #include <ATen/ops/cudnn_convolution_transpose_meta.h>
531
+ #include <ATen/ops/cudnn_grid_sampler_meta.h>
532
+ #include <ATen/ops/cudnn_grid_sampler_backward_meta.h>
533
+ #include <ATen/ops/cudnn_is_acceptable_meta.h>
534
+ #include <ATen/ops/cummax_meta.h>
535
+ #include <ATen/ops/cummaxmin_backward_meta.h>
536
+ #include <ATen/ops/cummin_meta.h>
537
+ #include <ATen/ops/cumprod_meta.h>
538
+ #include <ATen/ops/cumprod_backward_meta.h>
539
+ #include <ATen/ops/cumsum_meta.h>
540
+ #include <ATen/ops/cumulative_trapezoid_meta.h>
541
+ #include <ATen/ops/data_meta.h>
542
+ #include <ATen/ops/deg2rad_meta.h>
543
+ #include <ATen/ops/dense_dim_meta.h>
544
+ #include <ATen/ops/dequantize_meta.h>
545
+ #include <ATen/ops/det_meta.h>
546
+ #include <ATen/ops/detach_meta.h>
547
+ #include <ATen/ops/detach_copy_meta.h>
548
+ #include <ATen/ops/diag_meta.h>
549
+ #include <ATen/ops/diag_embed_meta.h>
550
+ #include <ATen/ops/diagflat_meta.h>
551
+ #include <ATen/ops/diagonal_meta.h>
552
+ #include <ATen/ops/diagonal_backward_meta.h>
553
+ #include <ATen/ops/diagonal_copy_meta.h>
554
+ #include <ATen/ops/diagonal_scatter_meta.h>
555
+ #include <ATen/ops/diff_meta.h>
556
+ #include <ATen/ops/digamma_meta.h>
557
+ #include <ATen/ops/dist_meta.h>
558
+ #include <ATen/ops/div_meta.h>
559
+ #include <ATen/ops/divide_meta.h>
560
+ #include <ATen/ops/dot_meta.h>
561
+ #include <ATen/ops/dropout_meta.h>
562
+ #include <ATen/ops/dsplit_meta.h>
563
+ #include <ATen/ops/dstack_meta.h>
564
+ #include <ATen/ops/einsum_meta.h>
565
+ #include <ATen/ops/elu_meta.h>
566
+ #include <ATen/ops/elu_backward_meta.h>
567
+ #include <ATen/ops/embedding_meta.h>
568
+ #include <ATen/ops/embedding_backward_meta.h>
569
+ #include <ATen/ops/embedding_bag_meta.h>
570
+ #include <ATen/ops/embedding_dense_backward_meta.h>
571
+ #include <ATen/ops/embedding_renorm_meta.h>
572
+ #include <ATen/ops/embedding_sparse_backward_meta.h>
573
+ #include <ATen/ops/empty_meta.h>
574
+ #include <ATen/ops/empty_like_meta.h>
575
+ #include <ATen/ops/empty_permuted_meta.h>
576
+ #include <ATen/ops/empty_quantized_meta.h>
577
+ #include <ATen/ops/empty_strided_meta.h>
578
+ #include <ATen/ops/eq_meta.h>
579
+ #include <ATen/ops/equal_meta.h>
580
+ #include <ATen/ops/erf_meta.h>
581
+ #include <ATen/ops/erfc_meta.h>
582
+ #include <ATen/ops/erfinv_meta.h>
583
+ #include <ATen/ops/exp_meta.h>
584
+ #include <ATen/ops/exp2_meta.h>
585
+ #include <ATen/ops/expand_meta.h>
586
+ #include <ATen/ops/expand_as_meta.h>
587
+ #include <ATen/ops/expand_copy_meta.h>
588
+ #include <ATen/ops/expm1_meta.h>
589
+ #include <ATen/ops/exponential_meta.h>
590
+ #include <ATen/ops/eye_meta.h>
591
+ #include <ATen/ops/fake_quantize_per_channel_affine_meta.h>
592
+ #include <ATen/ops/fake_quantize_per_channel_affine_cachemask_meta.h>
593
+ #include <ATen/ops/fake_quantize_per_channel_affine_cachemask_backward_meta.h>
594
+ #include <ATen/ops/fake_quantize_per_tensor_affine_meta.h>
595
+ #include <ATen/ops/fake_quantize_per_tensor_affine_cachemask_meta.h>
596
+ #include <ATen/ops/fake_quantize_per_tensor_affine_cachemask_backward_meta.h>
597
+ #include <ATen/ops/fbgemm_linear_fp16_weight_meta.h>
598
+ #include <ATen/ops/fbgemm_linear_fp16_weight_fp32_activation_meta.h>
599
+ #include <ATen/ops/fbgemm_linear_int8_weight_meta.h>
600
+ #include <ATen/ops/fbgemm_linear_int8_weight_fp32_activation_meta.h>
601
+ #include <ATen/ops/fbgemm_linear_quantize_weight_meta.h>
602
+ #include <ATen/ops/fbgemm_pack_gemm_matrix_fp16_meta.h>
603
+ #include <ATen/ops/fbgemm_pack_quantized_matrix_meta.h>
604
+ #include <ATen/ops/feature_alpha_dropout_meta.h>
605
+ #include <ATen/ops/feature_dropout_meta.h>
606
+ #include <ATen/ops/fft_fft_meta.h>
607
+ #include <ATen/ops/fft_fft2_meta.h>
608
+ #include <ATen/ops/fft_fftfreq_meta.h>
609
+ #include <ATen/ops/fft_fftn_meta.h>
610
+ #include <ATen/ops/fft_fftshift_meta.h>
611
+ #include <ATen/ops/fft_hfft_meta.h>
612
+ #include <ATen/ops/fft_hfft2_meta.h>
613
+ #include <ATen/ops/fft_hfftn_meta.h>
614
+ #include <ATen/ops/fft_ifft_meta.h>
615
+ #include <ATen/ops/fft_ifft2_meta.h>
616
+ #include <ATen/ops/fft_ifftn_meta.h>
617
+ #include <ATen/ops/fft_ifftshift_meta.h>
618
+ #include <ATen/ops/fft_ihfft_meta.h>
619
+ #include <ATen/ops/fft_ihfft2_meta.h>
620
+ #include <ATen/ops/fft_ihfftn_meta.h>
621
+ #include <ATen/ops/fft_irfft_meta.h>
622
+ #include <ATen/ops/fft_irfft2_meta.h>
623
+ #include <ATen/ops/fft_irfftn_meta.h>
624
+ #include <ATen/ops/fft_rfft_meta.h>
625
+ #include <ATen/ops/fft_rfft2_meta.h>
626
+ #include <ATen/ops/fft_rfftfreq_meta.h>
627
+ #include <ATen/ops/fft_rfftn_meta.h>
628
+ #include <ATen/ops/fill_meta.h>
629
+ #include <ATen/ops/fill_diagonal_meta.h>
630
+ #include <ATen/ops/fix_meta.h>
631
+ #include <ATen/ops/flatten_meta.h>
632
+ #include <ATen/ops/flatten_dense_tensors_meta.h>
633
+ #include <ATen/ops/flip_meta.h>
634
+ #include <ATen/ops/fliplr_meta.h>
635
+ #include <ATen/ops/flipud_meta.h>
636
+ #include <ATen/ops/float_power_meta.h>
637
+ #include <ATen/ops/floor_meta.h>
638
+ #include <ATen/ops/floor_divide_meta.h>
639
+ #include <ATen/ops/fmax_meta.h>
640
+ #include <ATen/ops/fmin_meta.h>
641
+ #include <ATen/ops/fmod_meta.h>
642
+ #include <ATen/ops/frac_meta.h>
643
+ #include <ATen/ops/fractional_max_pool2d_meta.h>
644
+ #include <ATen/ops/fractional_max_pool2d_backward_meta.h>
645
+ #include <ATen/ops/fractional_max_pool3d_meta.h>
646
+ #include <ATen/ops/fractional_max_pool3d_backward_meta.h>
647
+ #include <ATen/ops/frexp_meta.h>
648
+ #include <ATen/ops/frobenius_norm_meta.h>
649
+ #include <ATen/ops/from_file_meta.h>
650
+ #include <ATen/ops/full_meta.h>
651
+ #include <ATen/ops/full_like_meta.h>
652
+ #include <ATen/ops/fused_moving_avg_obs_fake_quant_meta.h>
653
+ #include <ATen/ops/gather_meta.h>
654
+ #include <ATen/ops/gather_backward_meta.h>
655
+ #include <ATen/ops/gcd_meta.h>
656
+ #include <ATen/ops/ge_meta.h>
657
+ #include <ATen/ops/gelu_meta.h>
658
+ #include <ATen/ops/gelu_backward_meta.h>
659
+ #include <ATen/ops/geometric_meta.h>
660
+ #include <ATen/ops/geqrf_meta.h>
661
+ #include <ATen/ops/ger_meta.h>
662
+ #include <ATen/ops/glu_meta.h>
663
+ #include <ATen/ops/glu_backward_meta.h>
664
+ #include <ATen/ops/glu_backward_jvp_meta.h>
665
+ #include <ATen/ops/glu_jvp_meta.h>
666
+ #include <ATen/ops/gradient_meta.h>
667
+ #include <ATen/ops/greater_meta.h>
668
+ #include <ATen/ops/greater_equal_meta.h>
669
+ #include <ATen/ops/grid_sampler_meta.h>
670
+ #include <ATen/ops/grid_sampler_2d_meta.h>
671
+ #include <ATen/ops/grid_sampler_2d_backward_meta.h>
672
+ #include <ATen/ops/grid_sampler_3d_meta.h>
673
+ #include <ATen/ops/grid_sampler_3d_backward_meta.h>
674
+ #include <ATen/ops/group_norm_meta.h>
675
+ #include <ATen/ops/gru_meta.h>
676
+ #include <ATen/ops/gru_cell_meta.h>
677
+ #include <ATen/ops/gt_meta.h>
678
+ #include <ATen/ops/hamming_window_meta.h>
679
+ #include <ATen/ops/hann_window_meta.h>
680
+ #include <ATen/ops/hardshrink_meta.h>
681
+ #include <ATen/ops/hardshrink_backward_meta.h>
682
+ #include <ATen/ops/hardsigmoid_meta.h>
683
+ #include <ATen/ops/hardsigmoid_backward_meta.h>
684
+ #include <ATen/ops/hardswish_meta.h>
685
+ #include <ATen/ops/hardswish_backward_meta.h>
686
+ #include <ATen/ops/hardtanh_meta.h>
687
+ #include <ATen/ops/hardtanh_backward_meta.h>
688
+ #include <ATen/ops/heaviside_meta.h>
689
+ #include <ATen/ops/hinge_embedding_loss_meta.h>
690
+ #include <ATen/ops/histc_meta.h>
691
+ #include <ATen/ops/histogram_meta.h>
692
+ #include <ATen/ops/histogramdd_meta.h>
693
+ #include <ATen/ops/hsplit_meta.h>
694
+ #include <ATen/ops/hspmm_meta.h>
695
+ #include <ATen/ops/hstack_meta.h>
696
+ #include <ATen/ops/huber_loss_meta.h>
697
+ #include <ATen/ops/huber_loss_backward_meta.h>
698
+ #include <ATen/ops/hypot_meta.h>
699
+ #include <ATen/ops/i0_meta.h>
700
+ #include <ATen/ops/igamma_meta.h>
701
+ #include <ATen/ops/igammac_meta.h>
702
+ #include <ATen/ops/im2col_meta.h>
703
+ #include <ATen/ops/imag_meta.h>
704
+ #include <ATen/ops/index_meta.h>
705
+ #include <ATen/ops/index_add_meta.h>
706
+ #include <ATen/ops/index_copy_meta.h>
707
+ #include <ATen/ops/index_fill_meta.h>
708
+ #include <ATen/ops/index_put_meta.h>
709
+ #include <ATen/ops/index_reduce_meta.h>
710
+ #include <ATen/ops/index_select_meta.h>
711
+ #include <ATen/ops/index_select_backward_meta.h>
712
+ #include <ATen/ops/indices_meta.h>
713
+ #include <ATen/ops/indices_copy_meta.h>
714
+ #include <ATen/ops/infinitely_differentiable_gelu_backward_meta.h>
715
+ #include <ATen/ops/inner_meta.h>
716
+ #include <ATen/ops/instance_norm_meta.h>
717
+ #include <ATen/ops/int_repr_meta.h>
718
+ #include <ATen/ops/inverse_meta.h>
719
+ #include <ATen/ops/is_coalesced_meta.h>
720
+ #include <ATen/ops/is_complex_meta.h>
721
+ #include <ATen/ops/is_conj_meta.h>
722
+ #include <ATen/ops/is_distributed_meta.h>
723
+ #include <ATen/ops/is_floating_point_meta.h>
724
+ #include <ATen/ops/is_inference_meta.h>
725
+ #include <ATen/ops/is_leaf_meta.h>
726
+ #include <ATen/ops/is_neg_meta.h>
727
+ #include <ATen/ops/is_nonzero_meta.h>
728
+ #include <ATen/ops/is_pinned_meta.h>
729
+ #include <ATen/ops/is_same_size_meta.h>
730
+ #include <ATen/ops/is_set_to_meta.h>
731
+ #include <ATen/ops/is_signed_meta.h>
732
+ #include <ATen/ops/is_vulkan_available_meta.h>
733
+ #include <ATen/ops/isclose_meta.h>
734
+ #include <ATen/ops/isfinite_meta.h>
735
+ #include <ATen/ops/isin_meta.h>
736
+ #include <ATen/ops/isinf_meta.h>
737
+ #include <ATen/ops/isnan_meta.h>
738
+ #include <ATen/ops/isneginf_meta.h>
739
+ #include <ATen/ops/isposinf_meta.h>
740
+ #include <ATen/ops/isreal_meta.h>
741
+ #include <ATen/ops/istft_meta.h>
742
+ #include <ATen/ops/item_meta.h>
743
+ #include <ATen/ops/kaiser_window_meta.h>
744
+ #include <ATen/ops/kl_div_meta.h>
745
+ #include <ATen/ops/kron_meta.h>
746
+ #include <ATen/ops/kthvalue_meta.h>
747
+ #include <ATen/ops/l1_loss_meta.h>
748
+ #include <ATen/ops/layer_norm_meta.h>
749
+ #include <ATen/ops/lcm_meta.h>
750
+ #include <ATen/ops/ldexp_meta.h>
751
+ #include <ATen/ops/le_meta.h>
752
+ #include <ATen/ops/leaky_relu_meta.h>
753
+ #include <ATen/ops/leaky_relu_backward_meta.h>
754
+ #include <ATen/ops/lerp_meta.h>
755
+ #include <ATen/ops/less_meta.h>
756
+ #include <ATen/ops/less_equal_meta.h>
757
+ #include <ATen/ops/lgamma_meta.h>
758
+ #include <ATen/ops/lift_meta.h>
759
+ #include <ATen/ops/lift_fresh_meta.h>
760
+ #include <ATen/ops/lift_fresh_copy_meta.h>
761
+ #include <ATen/ops/linalg_cholesky_meta.h>
762
+ #include <ATen/ops/linalg_cholesky_ex_meta.h>
763
+ #include <ATen/ops/linalg_cond_meta.h>
764
+ #include <ATen/ops/linalg_cross_meta.h>
765
+ #include <ATen/ops/linalg_det_meta.h>
766
+ #include <ATen/ops/linalg_diagonal_meta.h>
767
+ #include <ATen/ops/linalg_eig_meta.h>
768
+ #include <ATen/ops/linalg_eigh_meta.h>
769
+ #include <ATen/ops/linalg_eigvals_meta.h>
770
+ #include <ATen/ops/linalg_eigvalsh_meta.h>
771
+ #include <ATen/ops/linalg_householder_product_meta.h>
772
+ #include <ATen/ops/linalg_inv_meta.h>
773
+ #include <ATen/ops/linalg_inv_ex_meta.h>
774
+ #include <ATen/ops/linalg_ldl_factor_meta.h>
775
+ #include <ATen/ops/linalg_ldl_factor_ex_meta.h>
776
+ #include <ATen/ops/linalg_ldl_solve_meta.h>
777
+ #include <ATen/ops/linalg_lstsq_meta.h>
778
+ #include <ATen/ops/linalg_lu_meta.h>
779
+ #include <ATen/ops/linalg_lu_factor_meta.h>
780
+ #include <ATen/ops/linalg_lu_factor_ex_meta.h>
781
+ #include <ATen/ops/linalg_lu_solve_meta.h>
782
+ #include <ATen/ops/linalg_matmul_meta.h>
783
+ #include <ATen/ops/linalg_matrix_exp_meta.h>
784
+ #include <ATen/ops/linalg_matrix_norm_meta.h>
785
+ #include <ATen/ops/linalg_matrix_power_meta.h>
786
+ #include <ATen/ops/linalg_matrix_rank_meta.h>
787
+ #include <ATen/ops/linalg_multi_dot_meta.h>
788
+ #include <ATen/ops/linalg_norm_meta.h>
789
+ #include <ATen/ops/linalg_pinv_meta.h>
790
+ #include <ATen/ops/linalg_qr_meta.h>
791
+ #include <ATen/ops/linalg_slogdet_meta.h>
792
+ #include <ATen/ops/linalg_solve_meta.h>
793
+ #include <ATen/ops/linalg_solve_ex_meta.h>
794
+ #include <ATen/ops/linalg_solve_triangular_meta.h>
795
+ #include <ATen/ops/linalg_svd_meta.h>
796
+ #include <ATen/ops/linalg_svdvals_meta.h>
797
+ #include <ATen/ops/linalg_tensorinv_meta.h>
798
+ #include <ATen/ops/linalg_tensorsolve_meta.h>
799
+ #include <ATen/ops/linalg_vander_meta.h>
800
+ #include <ATen/ops/linalg_vecdot_meta.h>
801
+ #include <ATen/ops/linalg_vector_norm_meta.h>
802
+ #include <ATen/ops/linear_meta.h>
803
+ #include <ATen/ops/linear_backward_meta.h>
804
+ #include <ATen/ops/linspace_meta.h>
805
+ #include <ATen/ops/log_meta.h>
806
+ #include <ATen/ops/log10_meta.h>
807
+ #include <ATen/ops/log1p_meta.h>
808
+ #include <ATen/ops/log2_meta.h>
809
+ #include <ATen/ops/log_normal_meta.h>
810
+ #include <ATen/ops/log_sigmoid_meta.h>
811
+ #include <ATen/ops/log_sigmoid_backward_meta.h>
812
+ #include <ATen/ops/log_sigmoid_forward_meta.h>
813
+ #include <ATen/ops/log_softmax_meta.h>
814
+ #include <ATen/ops/logaddexp_meta.h>
815
+ #include <ATen/ops/logaddexp2_meta.h>
816
+ #include <ATen/ops/logcumsumexp_meta.h>
817
+ #include <ATen/ops/logdet_meta.h>
818
+ #include <ATen/ops/logical_and_meta.h>
819
+ #include <ATen/ops/logical_not_meta.h>
820
+ #include <ATen/ops/logical_or_meta.h>
821
+ #include <ATen/ops/logical_xor_meta.h>
822
+ #include <ATen/ops/logit_meta.h>
823
+ #include <ATen/ops/logit_backward_meta.h>
824
+ #include <ATen/ops/logspace_meta.h>
825
+ #include <ATen/ops/logsumexp_meta.h>
826
+ #include <ATen/ops/lshift_meta.h>
827
+ #include <ATen/ops/lstm_meta.h>
828
+ #include <ATen/ops/lstm_cell_meta.h>
829
+ #include <ATen/ops/lstm_mps_backward_meta.h>
830
+ #include <ATen/ops/lt_meta.h>
831
+ #include <ATen/ops/lu_solve_meta.h>
832
+ #include <ATen/ops/lu_unpack_meta.h>
833
+ #include <ATen/ops/mH_meta.h>
834
+ #include <ATen/ops/mT_meta.h>
835
+ #include <ATen/ops/margin_ranking_loss_meta.h>
836
+ #include <ATen/ops/masked_fill_meta.h>
837
+ #include <ATen/ops/masked_scatter_meta.h>
838
+ #include <ATen/ops/masked_scatter_backward_meta.h>
839
+ #include <ATen/ops/masked_select_meta.h>
840
+ #include <ATen/ops/masked_select_backward_meta.h>
841
+ #include <ATen/ops/matmul_meta.h>
842
+ #include <ATen/ops/matmul_backward_meta.h>
843
+ #include <ATen/ops/matrix_H_meta.h>
844
+ #include <ATen/ops/matrix_exp_meta.h>
845
+ #include <ATen/ops/matrix_exp_backward_meta.h>
846
+ #include <ATen/ops/matrix_power_meta.h>
847
+ #include <ATen/ops/max_meta.h>
848
+ #include <ATen/ops/max_pool1d_meta.h>
849
+ #include <ATen/ops/max_pool1d_with_indices_meta.h>
850
+ #include <ATen/ops/max_pool2d_meta.h>
851
+ #include <ATen/ops/max_pool2d_backward_meta.h>
852
+ #include <ATen/ops/max_pool2d_with_indices_meta.h>
853
+ #include <ATen/ops/max_pool2d_with_indices_backward_meta.h>
854
+ #include <ATen/ops/max_pool3d_meta.h>
855
+ #include <ATen/ops/max_pool3d_with_indices_meta.h>
856
+ #include <ATen/ops/max_pool3d_with_indices_backward_meta.h>
857
+ #include <ATen/ops/max_unpool2d_meta.h>
858
+ #include <ATen/ops/max_unpool3d_meta.h>
859
+ #include <ATen/ops/maximum_meta.h>
860
+ #include <ATen/ops/mean_meta.h>
861
+ #include <ATen/ops/median_meta.h>
862
+ #include <ATen/ops/meshgrid_meta.h>
863
+ #include <ATen/ops/min_meta.h>
864
+ #include <ATen/ops/minimum_meta.h>
865
+ #include <ATen/ops/miopen_batch_norm_meta.h>
866
+ #include <ATen/ops/miopen_batch_norm_backward_meta.h>
867
+ #include <ATen/ops/miopen_convolution_meta.h>
868
+ #include <ATen/ops/miopen_convolution_add_relu_meta.h>
869
+ #include <ATen/ops/miopen_convolution_relu_meta.h>
870
+ #include <ATen/ops/miopen_convolution_transpose_meta.h>
871
+ #include <ATen/ops/miopen_depthwise_convolution_meta.h>
872
+ #include <ATen/ops/miopen_rnn_meta.h>
873
+ #include <ATen/ops/miopen_rnn_backward_meta.h>
874
+ #include <ATen/ops/mish_meta.h>
875
+ #include <ATen/ops/mish_backward_meta.h>
876
+ #include <ATen/ops/mkldnn_adaptive_avg_pool2d_meta.h>
877
+ #include <ATen/ops/mkldnn_adaptive_avg_pool2d_backward_meta.h>
878
+ #include <ATen/ops/mkldnn_convolution_meta.h>
879
+ #include <ATen/ops/mkldnn_linear_meta.h>
880
+ #include <ATen/ops/mkldnn_linear_backward_meta.h>
881
+ #include <ATen/ops/mkldnn_linear_backward_input_meta.h>
882
+ #include <ATen/ops/mkldnn_linear_backward_weights_meta.h>
883
+ #include <ATen/ops/mkldnn_max_pool2d_meta.h>
884
+ #include <ATen/ops/mkldnn_max_pool2d_backward_meta.h>
885
+ #include <ATen/ops/mkldnn_max_pool3d_meta.h>
886
+ #include <ATen/ops/mkldnn_max_pool3d_backward_meta.h>
887
+ #include <ATen/ops/mkldnn_reorder_conv2d_weight_meta.h>
888
+ #include <ATen/ops/mkldnn_reorder_conv3d_weight_meta.h>
889
+ #include <ATen/ops/mkldnn_rnn_layer_meta.h>
890
+ #include <ATen/ops/mkldnn_rnn_layer_backward_meta.h>
891
+ #include <ATen/ops/mm_meta.h>
892
+ #include <ATen/ops/mode_meta.h>
893
+ #include <ATen/ops/moveaxis_meta.h>
894
+ #include <ATen/ops/movedim_meta.h>
895
+ #include <ATen/ops/mps_convolution_backward_meta.h>
896
+ #include <ATen/ops/mps_convolution_transpose_backward_meta.h>
897
+ #include <ATen/ops/mse_loss_meta.h>
898
+ #include <ATen/ops/mse_loss_backward_meta.h>
899
+ #include <ATen/ops/msort_meta.h>
900
+ #include <ATen/ops/mul_meta.h>
901
+ #include <ATen/ops/multi_margin_loss_meta.h>
902
+ #include <ATen/ops/multi_margin_loss_backward_meta.h>
903
+ #include <ATen/ops/multilabel_margin_loss_meta.h>
904
+ #include <ATen/ops/multilabel_margin_loss_backward_meta.h>
905
+ #include <ATen/ops/multilabel_margin_loss_forward_meta.h>
906
+ #include <ATen/ops/multinomial_meta.h>
907
+ #include <ATen/ops/multiply_meta.h>
908
+ #include <ATen/ops/mv_meta.h>
909
+ #include <ATen/ops/mvlgamma_meta.h>
910
+ #include <ATen/ops/nan_to_num_meta.h>
911
+ #include <ATen/ops/nanmean_meta.h>
912
+ #include <ATen/ops/nanmedian_meta.h>
913
+ #include <ATen/ops/nanquantile_meta.h>
914
+ #include <ATen/ops/nansum_meta.h>
915
+ #include <ATen/ops/narrow_meta.h>
916
+ #include <ATen/ops/narrow_copy_meta.h>
917
+ #include <ATen/ops/native_batch_norm_meta.h>
918
+ #include <ATen/ops/native_batch_norm_backward_meta.h>
919
+ #include <ATen/ops/native_channel_shuffle_meta.h>
920
+ #include <ATen/ops/native_dropout_meta.h>
921
+ #include <ATen/ops/native_dropout_backward_meta.h>
922
+ #include <ATen/ops/native_group_norm_meta.h>
923
+ #include <ATen/ops/native_group_norm_backward_meta.h>
924
+ #include <ATen/ops/native_layer_norm_meta.h>
925
+ #include <ATen/ops/native_layer_norm_backward_meta.h>
926
+ #include <ATen/ops/native_norm_meta.h>
927
+ #include <ATen/ops/ne_meta.h>
928
+ #include <ATen/ops/neg_meta.h>
929
+ #include <ATen/ops/negative_meta.h>
930
+ #include <ATen/ops/nested_to_padded_tensor_meta.h>
931
+ #include <ATen/ops/new_empty_meta.h>
932
+ #include <ATen/ops/new_empty_strided_meta.h>
933
+ #include <ATen/ops/new_full_meta.h>
934
+ #include <ATen/ops/new_ones_meta.h>
935
+ #include <ATen/ops/new_zeros_meta.h>
936
+ #include <ATen/ops/nextafter_meta.h>
937
+ #include <ATen/ops/nll_loss_meta.h>
938
+ #include <ATen/ops/nll_loss2d_meta.h>
939
+ #include <ATen/ops/nll_loss2d_backward_meta.h>
940
+ #include <ATen/ops/nll_loss2d_forward_meta.h>
941
+ #include <ATen/ops/nll_loss_backward_meta.h>
942
+ #include <ATen/ops/nll_loss_forward_meta.h>
943
+ #include <ATen/ops/nll_loss_nd_meta.h>
944
+ #include <ATen/ops/nonzero_meta.h>
945
+ #include <ATen/ops/nonzero_numpy_meta.h>
946
+ #include <ATen/ops/nonzero_static_meta.h>
947
+ #include <ATen/ops/norm_meta.h>
948
+ #include <ATen/ops/norm_except_dim_meta.h>
949
+ #include <ATen/ops/normal_meta.h>
950
+ #include <ATen/ops/not_equal_meta.h>
951
+ #include <ATen/ops/nuclear_norm_meta.h>
952
+ #include <ATen/ops/numpy_T_meta.h>
953
+ #include <ATen/ops/one_hot_meta.h>
954
+ #include <ATen/ops/ones_meta.h>
955
+ #include <ATen/ops/ones_like_meta.h>
956
+ #include <ATen/ops/or_meta.h>
957
+ #include <ATen/ops/orgqr_meta.h>
958
+ #include <ATen/ops/ormqr_meta.h>
959
+ #include <ATen/ops/outer_meta.h>
960
+ #include <ATen/ops/output_nr_meta.h>
961
+ #include <ATen/ops/pad_meta.h>
962
+ #include <ATen/ops/pad_sequence_meta.h>
963
+ #include <ATen/ops/pairwise_distance_meta.h>
964
+ #include <ATen/ops/pdist_meta.h>
965
+ #include <ATen/ops/permute_meta.h>
966
+ #include <ATen/ops/permute_copy_meta.h>
967
+ #include <ATen/ops/pin_memory_meta.h>
968
+ #include <ATen/ops/pinverse_meta.h>
969
+ #include <ATen/ops/pixel_shuffle_meta.h>
970
+ #include <ATen/ops/pixel_unshuffle_meta.h>
971
+ #include <ATen/ops/poisson_meta.h>
972
+ #include <ATen/ops/poisson_nll_loss_meta.h>
973
+ #include <ATen/ops/polar_meta.h>
974
+ #include <ATen/ops/polygamma_meta.h>
975
+ #include <ATen/ops/positive_meta.h>
976
+ #include <ATen/ops/pow_meta.h>
977
+ #include <ATen/ops/prelu_meta.h>
978
+ #include <ATen/ops/prod_meta.h>
979
+ #include <ATen/ops/promote_types_meta.h>
980
+ #include <ATen/ops/put_meta.h>
981
+ #include <ATen/ops/q_per_channel_axis_meta.h>
982
+ #include <ATen/ops/q_per_channel_scales_meta.h>
983
+ #include <ATen/ops/q_per_channel_zero_points_meta.h>
984
+ #include <ATen/ops/q_scale_meta.h>
985
+ #include <ATen/ops/q_zero_point_meta.h>
986
+ #include <ATen/ops/qr_meta.h>
987
+ #include <ATen/ops/qscheme_meta.h>
988
+ #include <ATen/ops/quantile_meta.h>
989
+ #include <ATen/ops/quantize_per_channel_meta.h>
990
+ #include <ATen/ops/quantize_per_tensor_meta.h>
991
+ #include <ATen/ops/quantize_per_tensor_dynamic_meta.h>
992
+ #include <ATen/ops/quantized_batch_norm_meta.h>
993
+ #include <ATen/ops/quantized_gru_cell_meta.h>
994
+ #include <ATen/ops/quantized_lstm_cell_meta.h>
995
+ #include <ATen/ops/quantized_max_pool1d_meta.h>
996
+ #include <ATen/ops/quantized_max_pool2d_meta.h>
997
+ #include <ATen/ops/quantized_max_pool3d_meta.h>
998
+ #include <ATen/ops/quantized_rnn_relu_cell_meta.h>
999
+ #include <ATen/ops/quantized_rnn_tanh_cell_meta.h>
1000
+ #include <ATen/ops/rad2deg_meta.h>
1001
+ #include <ATen/ops/rand_meta.h>
1002
+ #include <ATen/ops/rand_like_meta.h>
1003
+ #include <ATen/ops/randint_meta.h>
1004
+ #include <ATen/ops/randint_like_meta.h>
1005
+ #include <ATen/ops/randn_meta.h>
1006
+ #include <ATen/ops/randn_like_meta.h>
1007
+ #include <ATen/ops/random_meta.h>
1008
+ #include <ATen/ops/randperm_meta.h>
1009
+ #include <ATen/ops/range_meta.h>
1010
+ #include <ATen/ops/ravel_meta.h>
1011
+ #include <ATen/ops/real_meta.h>
1012
+ #include <ATen/ops/reciprocal_meta.h>
1013
+ #include <ATen/ops/record_stream_meta.h>
1014
+ #include <ATen/ops/refine_names_meta.h>
1015
+ #include <ATen/ops/reflection_pad1d_meta.h>
1016
+ #include <ATen/ops/reflection_pad1d_backward_meta.h>
1017
+ #include <ATen/ops/reflection_pad2d_meta.h>
1018
+ #include <ATen/ops/reflection_pad2d_backward_meta.h>
1019
+ #include <ATen/ops/reflection_pad3d_meta.h>
1020
+ #include <ATen/ops/reflection_pad3d_backward_meta.h>
1021
+ #include <ATen/ops/relu_meta.h>
1022
+ #include <ATen/ops/relu6_meta.h>
1023
+ #include <ATen/ops/remainder_meta.h>
1024
+ #include <ATen/ops/rename_meta.h>
1025
+ #include <ATen/ops/renorm_meta.h>
1026
+ #include <ATen/ops/repeat_meta.h>
1027
+ #include <ATen/ops/repeat_interleave_meta.h>
1028
+ #include <ATen/ops/replication_pad1d_meta.h>
1029
+ #include <ATen/ops/replication_pad1d_backward_meta.h>
1030
+ #include <ATen/ops/replication_pad2d_meta.h>
1031
+ #include <ATen/ops/replication_pad2d_backward_meta.h>
1032
+ #include <ATen/ops/replication_pad3d_meta.h>
1033
+ #include <ATen/ops/replication_pad3d_backward_meta.h>
1034
+ #include <ATen/ops/requires_grad_meta.h>
1035
+ #include <ATen/ops/reshape_meta.h>
1036
+ #include <ATen/ops/reshape_as_meta.h>
1037
+ #include <ATen/ops/resize_meta.h>
1038
+ #include <ATen/ops/resize_as_meta.h>
1039
+ #include <ATen/ops/resize_as_sparse_meta.h>
1040
+ #include <ATen/ops/resolve_conj_meta.h>
1041
+ #include <ATen/ops/resolve_neg_meta.h>
1042
+ #include <ATen/ops/result_type_meta.h>
1043
+ #include <ATen/ops/retain_grad_meta.h>
1044
+ #include <ATen/ops/retains_grad_meta.h>
1045
+ #include <ATen/ops/rnn_relu_meta.h>
1046
+ #include <ATen/ops/rnn_relu_cell_meta.h>
1047
+ #include <ATen/ops/rnn_tanh_meta.h>
1048
+ #include <ATen/ops/rnn_tanh_cell_meta.h>
1049
+ #include <ATen/ops/roll_meta.h>
1050
+ #include <ATen/ops/rot90_meta.h>
1051
+ #include <ATen/ops/round_meta.h>
1052
+ #include <ATen/ops/row_indices_meta.h>
1053
+ #include <ATen/ops/row_indices_copy_meta.h>
1054
+ #include <ATen/ops/row_stack_meta.h>
1055
+ #include <ATen/ops/rrelu_meta.h>
1056
+ #include <ATen/ops/rrelu_with_noise_meta.h>
1057
+ #include <ATen/ops/rrelu_with_noise_backward_meta.h>
1058
+ #include <ATen/ops/rshift_meta.h>
1059
+ #include <ATen/ops/rsqrt_meta.h>
1060
+ #include <ATen/ops/rsub_meta.h>
1061
+ #include <ATen/ops/scalar_tensor_meta.h>
1062
+ #include <ATen/ops/scaled_dot_product_attention_meta.h>
1063
+ #include <ATen/ops/scatter_meta.h>
1064
+ #include <ATen/ops/scatter_add_meta.h>
1065
+ #include <ATen/ops/scatter_reduce_meta.h>
1066
+ #include <ATen/ops/searchsorted_meta.h>
1067
+ #include <ATen/ops/segment_reduce_meta.h>
1068
+ #include <ATen/ops/select_meta.h>
1069
+ #include <ATen/ops/select_backward_meta.h>
1070
+ #include <ATen/ops/select_copy_meta.h>
1071
+ #include <ATen/ops/select_scatter_meta.h>
1072
+ #include <ATen/ops/selu_meta.h>
1073
+ #include <ATen/ops/set_meta.h>
1074
+ #include <ATen/ops/set_data_meta.h>
1075
+ #include <ATen/ops/sgn_meta.h>
1076
+ #include <ATen/ops/sigmoid_meta.h>
1077
+ #include <ATen/ops/sigmoid_backward_meta.h>
1078
+ #include <ATen/ops/sign_meta.h>
1079
+ #include <ATen/ops/signbit_meta.h>
1080
+ #include <ATen/ops/silu_meta.h>
1081
+ #include <ATen/ops/silu_backward_meta.h>
1082
+ #include <ATen/ops/sin_meta.h>
1083
+ #include <ATen/ops/sinc_meta.h>
1084
+ #include <ATen/ops/sinh_meta.h>
1085
+ #include <ATen/ops/size_meta.h>
1086
+ #include <ATen/ops/slice_meta.h>
1087
+ #include <ATen/ops/slice_backward_meta.h>
1088
+ #include <ATen/ops/slice_copy_meta.h>
1089
+ #include <ATen/ops/slice_inverse_meta.h>
1090
+ #include <ATen/ops/slice_scatter_meta.h>
1091
+ #include <ATen/ops/slogdet_meta.h>
1092
+ #include <ATen/ops/slow_conv3d_meta.h>
1093
+ #include <ATen/ops/slow_conv3d_forward_meta.h>
1094
+ #include <ATen/ops/slow_conv_dilated2d_meta.h>
1095
+ #include <ATen/ops/slow_conv_dilated3d_meta.h>
1096
+ #include <ATen/ops/slow_conv_transpose2d_meta.h>
1097
+ #include <ATen/ops/slow_conv_transpose3d_meta.h>
1098
+ #include <ATen/ops/smm_meta.h>
1099
+ #include <ATen/ops/smooth_l1_loss_meta.h>
1100
+ #include <ATen/ops/smooth_l1_loss_backward_meta.h>
1101
+ #include <ATen/ops/soft_margin_loss_meta.h>
1102
+ #include <ATen/ops/soft_margin_loss_backward_meta.h>
1103
+ #include <ATen/ops/softmax_meta.h>
1104
+ #include <ATen/ops/softplus_meta.h>
1105
+ #include <ATen/ops/softplus_backward_meta.h>
1106
+ #include <ATen/ops/softshrink_meta.h>
1107
+ #include <ATen/ops/softshrink_backward_meta.h>
1108
+ #include <ATen/ops/sort_meta.h>
1109
+ #include <ATen/ops/sparse_bsc_tensor_meta.h>
1110
+ #include <ATen/ops/sparse_bsr_tensor_meta.h>
1111
+ #include <ATen/ops/sparse_compressed_tensor_meta.h>
1112
+ #include <ATen/ops/sparse_coo_tensor_meta.h>
1113
+ #include <ATen/ops/sparse_csc_tensor_meta.h>
1114
+ #include <ATen/ops/sparse_csr_tensor_meta.h>
1115
+ #include <ATen/ops/sparse_dim_meta.h>
1116
+ #include <ATen/ops/sparse_mask_meta.h>
1117
+ #include <ATen/ops/sparse_resize_meta.h>
1118
+ #include <ATen/ops/sparse_resize_and_clear_meta.h>
1119
+ #include <ATen/ops/sparse_sampled_addmm_meta.h>
1120
+ #include <ATen/ops/special_airy_ai_meta.h>
1121
+ #include <ATen/ops/special_bessel_j0_meta.h>
1122
+ #include <ATen/ops/special_bessel_j1_meta.h>
1123
+ #include <ATen/ops/special_bessel_y0_meta.h>
1124
+ #include <ATen/ops/special_bessel_y1_meta.h>
1125
+ #include <ATen/ops/special_chebyshev_polynomial_t_meta.h>
1126
+ #include <ATen/ops/special_chebyshev_polynomial_u_meta.h>
1127
+ #include <ATen/ops/special_chebyshev_polynomial_v_meta.h>
1128
+ #include <ATen/ops/special_chebyshev_polynomial_w_meta.h>
1129
+ #include <ATen/ops/special_digamma_meta.h>
1130
+ #include <ATen/ops/special_entr_meta.h>
1131
+ #include <ATen/ops/special_erf_meta.h>
1132
+ #include <ATen/ops/special_erfc_meta.h>
1133
+ #include <ATen/ops/special_erfcx_meta.h>
1134
+ #include <ATen/ops/special_erfinv_meta.h>
1135
+ #include <ATen/ops/special_exp2_meta.h>
1136
+ #include <ATen/ops/special_expit_meta.h>
1137
+ #include <ATen/ops/special_expm1_meta.h>
1138
+ #include <ATen/ops/special_gammainc_meta.h>
1139
+ #include <ATen/ops/special_gammaincc_meta.h>
1140
+ #include <ATen/ops/special_gammaln_meta.h>
1141
+ #include <ATen/ops/special_hermite_polynomial_h_meta.h>
1142
+ #include <ATen/ops/special_hermite_polynomial_he_meta.h>
1143
+ #include <ATen/ops/special_i0_meta.h>
1144
+ #include <ATen/ops/special_i0e_meta.h>
1145
+ #include <ATen/ops/special_i1_meta.h>
1146
+ #include <ATen/ops/special_i1e_meta.h>
1147
+ #include <ATen/ops/special_laguerre_polynomial_l_meta.h>
1148
+ #include <ATen/ops/special_legendre_polynomial_p_meta.h>
1149
+ #include <ATen/ops/special_log1p_meta.h>
1150
+ #include <ATen/ops/special_log_ndtr_meta.h>
1151
+ #include <ATen/ops/special_log_softmax_meta.h>
1152
+ #include <ATen/ops/special_logit_meta.h>
1153
+ #include <ATen/ops/special_logsumexp_meta.h>
1154
+ #include <ATen/ops/special_modified_bessel_i0_meta.h>
1155
+ #include <ATen/ops/special_modified_bessel_i1_meta.h>
1156
+ #include <ATen/ops/special_modified_bessel_k0_meta.h>
1157
+ #include <ATen/ops/special_modified_bessel_k1_meta.h>
1158
+ #include <ATen/ops/special_multigammaln_meta.h>
1159
+ #include <ATen/ops/special_ndtr_meta.h>
1160
+ #include <ATen/ops/special_ndtri_meta.h>
1161
+ #include <ATen/ops/special_polygamma_meta.h>
1162
+ #include <ATen/ops/special_psi_meta.h>
1163
+ #include <ATen/ops/special_round_meta.h>
1164
+ #include <ATen/ops/special_scaled_modified_bessel_k0_meta.h>
1165
+ #include <ATen/ops/special_scaled_modified_bessel_k1_meta.h>
1166
+ #include <ATen/ops/special_shifted_chebyshev_polynomial_t_meta.h>
1167
+ #include <ATen/ops/special_shifted_chebyshev_polynomial_u_meta.h>
1168
+ #include <ATen/ops/special_shifted_chebyshev_polynomial_v_meta.h>
1169
+ #include <ATen/ops/special_shifted_chebyshev_polynomial_w_meta.h>
1170
+ #include <ATen/ops/special_sinc_meta.h>
1171
+ #include <ATen/ops/special_softmax_meta.h>
1172
+ #include <ATen/ops/special_spherical_bessel_j0_meta.h>
1173
+ #include <ATen/ops/special_xlog1py_meta.h>
1174
+ #include <ATen/ops/special_xlogy_meta.h>
1175
+ #include <ATen/ops/special_zeta_meta.h>
1176
+ #include <ATen/ops/split_meta.h>
1177
+ #include <ATen/ops/split_copy_meta.h>
1178
+ #include <ATen/ops/split_with_sizes_meta.h>
1179
+ #include <ATen/ops/split_with_sizes_copy_meta.h>
1180
+ #include <ATen/ops/sqrt_meta.h>
1181
+ #include <ATen/ops/square_meta.h>
1182
+ #include <ATen/ops/squeeze_meta.h>
1183
+ #include <ATen/ops/squeeze_copy_meta.h>
1184
+ #include <ATen/ops/sspaddmm_meta.h>
1185
+ #include <ATen/ops/stack_meta.h>
1186
+ #include <ATen/ops/std_meta.h>
1187
+ #include <ATen/ops/std_mean_meta.h>
1188
+ #include <ATen/ops/stft_meta.h>
1189
+ #include <ATen/ops/stride_meta.h>
1190
+ #include <ATen/ops/sub_meta.h>
1191
+ #include <ATen/ops/subtract_meta.h>
1192
+ #include <ATen/ops/sum_meta.h>
1193
+ #include <ATen/ops/sum_to_size_meta.h>
1194
+ #include <ATen/ops/svd_meta.h>
1195
+ #include <ATen/ops/swapaxes_meta.h>
1196
+ #include <ATen/ops/swapdims_meta.h>
1197
+ #include <ATen/ops/sym_constrain_range_meta.h>
1198
+ #include <ATen/ops/sym_constrain_range_for_size_meta.h>
1199
+ #include <ATen/ops/sym_numel_meta.h>
1200
+ #include <ATen/ops/sym_size_meta.h>
1201
+ #include <ATen/ops/sym_storage_offset_meta.h>
1202
+ #include <ATen/ops/sym_stride_meta.h>
1203
+ #include <ATen/ops/t_meta.h>
1204
+ #include <ATen/ops/t_copy_meta.h>
1205
+ #include <ATen/ops/take_meta.h>
1206
+ #include <ATen/ops/take_along_dim_meta.h>
1207
+ #include <ATen/ops/tan_meta.h>
1208
+ #include <ATen/ops/tanh_meta.h>
1209
+ #include <ATen/ops/tanh_backward_meta.h>
1210
+ #include <ATen/ops/tensor_split_meta.h>
1211
+ #include <ATen/ops/tensordot_meta.h>
1212
+ #include <ATen/ops/thnn_conv2d_meta.h>
1213
+ #include <ATen/ops/threshold_meta.h>
1214
+ #include <ATen/ops/threshold_backward_meta.h>
1215
+ #include <ATen/ops/tile_meta.h>
1216
+ #include <ATen/ops/to_meta.h>
1217
+ #include <ATen/ops/to_dense_meta.h>
1218
+ #include <ATen/ops/to_dense_backward_meta.h>
1219
+ #include <ATen/ops/to_mkldnn_meta.h>
1220
+ #include <ATen/ops/to_mkldnn_backward_meta.h>
1221
+ #include <ATen/ops/to_padded_tensor_meta.h>
1222
+ #include <ATen/ops/to_sparse_meta.h>
1223
+ #include <ATen/ops/to_sparse_bsc_meta.h>
1224
+ #include <ATen/ops/to_sparse_bsr_meta.h>
1225
+ #include <ATen/ops/to_sparse_csc_meta.h>
1226
+ #include <ATen/ops/to_sparse_csr_meta.h>
1227
+ #include <ATen/ops/topk_meta.h>
1228
+ #include <ATen/ops/trace_meta.h>
1229
+ #include <ATen/ops/trace_backward_meta.h>
1230
+ #include <ATen/ops/transpose_meta.h>
1231
+ #include <ATen/ops/transpose_copy_meta.h>
1232
+ #include <ATen/ops/trapezoid_meta.h>
1233
+ #include <ATen/ops/trapz_meta.h>
1234
+ #include <ATen/ops/triangular_solve_meta.h>
1235
+ #include <ATen/ops/tril_meta.h>
1236
+ #include <ATen/ops/tril_indices_meta.h>
1237
+ #include <ATen/ops/triplet_margin_loss_meta.h>
1238
+ #include <ATen/ops/triu_meta.h>
1239
+ #include <ATen/ops/triu_indices_meta.h>
1240
+ #include <ATen/ops/true_divide_meta.h>
1241
+ #include <ATen/ops/trunc_meta.h>
1242
+ #include <ATen/ops/type_as_meta.h>
1243
+ #include <ATen/ops/unbind_meta.h>
1244
+ #include <ATen/ops/unbind_copy_meta.h>
1245
+ #include <ATen/ops/unflatten_meta.h>
1246
+ #include <ATen/ops/unflatten_dense_tensors_meta.h>
1247
+ #include <ATen/ops/unfold_meta.h>
1248
+ #include <ATen/ops/unfold_backward_meta.h>
1249
+ #include <ATen/ops/unfold_copy_meta.h>
1250
+ #include <ATen/ops/uniform_meta.h>
1251
+ #include <ATen/ops/unique_consecutive_meta.h>
1252
+ #include <ATen/ops/unique_dim_meta.h>
1253
+ #include <ATen/ops/unique_dim_consecutive_meta.h>
1254
+ #include <ATen/ops/unsafe_chunk_meta.h>
1255
+ #include <ATen/ops/unsafe_split_meta.h>
1256
+ #include <ATen/ops/unsafe_split_with_sizes_meta.h>
1257
+ #include <ATen/ops/unsqueeze_meta.h>
1258
+ #include <ATen/ops/unsqueeze_copy_meta.h>
1259
+ #include <ATen/ops/upsample_bicubic2d_meta.h>
1260
+ #include <ATen/ops/upsample_bicubic2d_backward_meta.h>
1261
+ #include <ATen/ops/upsample_bilinear2d_meta.h>
1262
+ #include <ATen/ops/upsample_bilinear2d_backward_meta.h>
1263
+ #include <ATen/ops/upsample_linear1d_meta.h>
1264
+ #include <ATen/ops/upsample_linear1d_backward_meta.h>
1265
+ #include <ATen/ops/upsample_nearest1d_meta.h>
1266
+ #include <ATen/ops/upsample_nearest1d_backward_meta.h>
1267
+ #include <ATen/ops/upsample_nearest2d_meta.h>
1268
+ #include <ATen/ops/upsample_nearest2d_backward_meta.h>
1269
+ #include <ATen/ops/upsample_nearest3d_meta.h>
1270
+ #include <ATen/ops/upsample_nearest3d_backward_meta.h>
1271
+ #include <ATen/ops/upsample_trilinear3d_meta.h>
1272
+ #include <ATen/ops/upsample_trilinear3d_backward_meta.h>
1273
+ #include <ATen/ops/value_selecting_reduction_backward_meta.h>
1274
+ #include <ATen/ops/values_meta.h>
1275
+ #include <ATen/ops/values_copy_meta.h>
1276
+ #include <ATen/ops/vander_meta.h>
1277
+ #include <ATen/ops/var_meta.h>
1278
+ #include <ATen/ops/var_mean_meta.h>
1279
+ #include <ATen/ops/vdot_meta.h>
1280
+ #include <ATen/ops/view_meta.h>
1281
+ #include <ATen/ops/view_as_meta.h>
1282
+ #include <ATen/ops/view_as_complex_meta.h>
1283
+ #include <ATen/ops/view_as_complex_copy_meta.h>
1284
+ #include <ATen/ops/view_as_real_meta.h>
1285
+ #include <ATen/ops/view_as_real_copy_meta.h>
1286
+ #include <ATen/ops/view_copy_meta.h>
1287
+ #include <ATen/ops/vsplit_meta.h>
1288
+ #include <ATen/ops/vstack_meta.h>
1289
+ #include <ATen/ops/where_meta.h>
1290
+ #include <ATen/ops/xlogy_meta.h>
1291
+ #include <ATen/ops/xor_meta.h>
1292
+ #include <ATen/ops/zero_meta.h>
1293
+ #include <ATen/ops/zeros_meta.h>
1294
+ #include <ATen/ops/zeros_like_meta.h>
1295
+
1296
+ namespace at {
1297
+
1298
+ namespace meta {
1299
+
1300
+
1301
+
1302
+ } // namespace meta
1303
+ } // namespace at
shared/package-files/33/332cbd2657d64c9dbd27c3b28aafaea6a6a0f957ec3c78378ecbaaec71d4f621/baseconv.pyi ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Any, Tuple, Union
2
+
3
+ BASE2_ALPHABET: str
4
+ BASE16_ALPHABET: str
5
+ BASE56_ALPHABET: str
6
+ BASE36_ALPHABET: str
7
+ BASE62_ALPHABET: str
8
+ BASE64_ALPHABET: Any
9
+
10
+ class BaseConverter:
11
+ decimal_digits: str = ...
12
+ sign: str = ...
13
+ digits: str = ...
14
+ def __init__(self, digits: str, sign: str = ...) -> None: ...
15
+ def encode(self, i: int) -> str: ...
16
+ def decode(self, s: str) -> int: ...
17
+ def convert(self, number: Union[int, str], from_digits: str, to_digits: str, sign: str) -> Tuple[int, str]: ...
18
+
19
+ base2: Any
20
+ base16: Any
21
+ base36: Any
22
+ base56: Any
23
+ base62: Any
24
+ base64: Any
shared/package-files/33/332cea5d4b963f5f8181b6c207327220b892fe389c64ed8b3543148efeef861d/scope.py ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Scope definition and related utilities.
3
+
4
+ Those are defined here, instead of in the 'fixtures' module because
5
+ their use is spread across many other pytest modules, and centralizing it in 'fixtures'
6
+ would cause circular references.
7
+
8
+ Also this makes the module light to import, as it should.
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+ from enum import Enum
14
+ from functools import total_ordering
15
+ from typing import Literal
16
+
17
+
18
+ _ScopeName = Literal["session", "package", "module", "class", "function"]
19
+
20
+
21
+ @total_ordering
22
+ class Scope(Enum):
23
+ """
24
+ Represents one of the possible fixture scopes in pytest.
25
+
26
+ Scopes are ordered from lower to higher, that is:
27
+
28
+ ->>> higher ->>>
29
+
30
+ Function < Class < Module < Package < Session
31
+
32
+ <<<- lower <<<-
33
+ """
34
+
35
+ # Scopes need to be listed from lower to higher.
36
+ Function: _ScopeName = "function"
37
+ Class: _ScopeName = "class"
38
+ Module: _ScopeName = "module"
39
+ Package: _ScopeName = "package"
40
+ Session: _ScopeName = "session"
41
+
42
+ def next_lower(self) -> Scope:
43
+ """Return the next lower scope."""
44
+ index = _SCOPE_INDICES[self]
45
+ if index == 0:
46
+ raise ValueError(f"{self} is the lower-most scope")
47
+ return _ALL_SCOPES[index - 1]
48
+
49
+ def next_higher(self) -> Scope:
50
+ """Return the next higher scope."""
51
+ index = _SCOPE_INDICES[self]
52
+ if index == len(_SCOPE_INDICES) - 1:
53
+ raise ValueError(f"{self} is the upper-most scope")
54
+ return _ALL_SCOPES[index + 1]
55
+
56
+ def __lt__(self, other: Scope) -> bool:
57
+ self_index = _SCOPE_INDICES[self]
58
+ other_index = _SCOPE_INDICES[other]
59
+ return self_index < other_index
60
+
61
+ @classmethod
62
+ def from_user(
63
+ cls, scope_name: _ScopeName, descr: str, where: str | None = None
64
+ ) -> Scope:
65
+ """
66
+ Given a scope name from the user, return the equivalent Scope enum. Should be used
67
+ whenever we want to convert a user provided scope name to its enum object.
68
+
69
+ If the scope name is invalid, construct a user friendly message and call pytest.fail.
70
+ """
71
+ from _pytest.outcomes import fail
72
+
73
+ try:
74
+ # Holding this reference is necessary for mypy at the moment.
75
+ scope = Scope(scope_name)
76
+ except ValueError:
77
+ fail(
78
+ "{} {}got an unexpected scope value '{}'".format(
79
+ descr, f"from {where} " if where else "", scope_name
80
+ ),
81
+ pytrace=False,
82
+ )
83
+ return scope
84
+
85
+
86
+ _ALL_SCOPES = list(Scope)
87
+ _SCOPE_INDICES = {scope: index for index, scope in enumerate(_ALL_SCOPES)}
88
+
89
+
90
+ # Ordered list of scopes which can contain many tests (in practice all except Function).
91
+ HIGH_SCOPES = [x for x in Scope if x is not Scope.Function]
shared/package-files/33/332e5db8799453cbb47dadc745a0693bfb78cb9b190bc01ec503b8981ea82623/slow_conv_transpose2d_meta.h ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from NativeMetaFunction.h
4
+
5
+ #include <c10/core/Scalar.h>
6
+ #include <c10/core/Storage.h>
7
+ #include <c10/core/TensorOptions.h>
8
+ #include <c10/util/Deprecated.h>
9
+ #include <c10/util/Optional.h>
10
+ #include <c10/core/QScheme.h>
11
+ #include <ATen/core/Reduction.h>
12
+ #include <ATen/TensorIterator.h>
13
+ #include <ATen/TensorMeta.h>
14
+ #include <tuple>
15
+ #include <vector>
16
+
17
+ namespace at {
18
+ namespace meta {
19
+
20
+ struct TORCH_API structured_slow_conv_transpose2d : public at::impl::MetaBase {
21
+
22
+
23
+ void meta(const at::Tensor & self, const at::Tensor & weight, at::ArrayRef<int64_t> kernel_size, at::OptionalTensorRef bias, at::ArrayRef<int64_t> stride, at::ArrayRef<int64_t> padding, at::ArrayRef<int64_t> output_padding, at::ArrayRef<int64_t> dilation);
24
+ };
25
+
26
+ } // namespace native
27
+ } // namespace at
shared/package-files/33/333231626133ad5f4d3f3559893f5fcd756b564fbd83564997ad3757ee28159f/_make_per_tensor_quantized_tensor_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 _make_per_tensor_quantized_tensor {
18
+ using schema = at::Tensor (const at::Tensor &, double, int64_t);
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::_make_per_tensor_quantized_tensor")
22
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "")
23
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "_make_per_tensor_quantized_tensor(Tensor self, float scale, int zero_point) -> Tensor")
24
+ static at::Tensor call(const at::Tensor & self, double scale, int64_t zero_point);
25
+ static at::Tensor redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, double scale, int64_t zero_point);
26
+ };
27
+
28
+ struct TORCH_API _make_per_tensor_quantized_tensor_out {
29
+ using schema = at::Tensor & (const at::Tensor &, double, int64_t, 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::_make_per_tensor_quantized_tensor")
33
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(overload_name, "out")
34
+ STATIC_CONSTEXPR_STR_INL_EXCEPT_WIN_CUDA(schema_str, "_make_per_tensor_quantized_tensor.out(Tensor self, float scale, int zero_point, *, Tensor(a!) out) -> Tensor(a!)")
35
+ static at::Tensor & call(const at::Tensor & self, double scale, int64_t zero_point, at::Tensor & out);
36
+ static at::Tensor & redispatch(c10::DispatchKeySet dispatchKeySet, const at::Tensor & self, double scale, int64_t zero_point, at::Tensor & out);
37
+ };
38
+
39
+ }} // namespace at::_ops
shared/package-files/33/3333f5c213bd28025dfac3d303ed03990166e2773bc2e7615787c4ae2826e114/digamma_cpu_dispatch.h ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 cpu {
19
+
20
+ TORCH_API at::Tensor digamma(const at::Tensor & self);
21
+ TORCH_API at::Tensor & digamma_out(at::Tensor & out, const at::Tensor & self);
22
+ TORCH_API at::Tensor & digamma_outf(const at::Tensor & self, at::Tensor & out);
23
+ TORCH_API at::Tensor & digamma_(at::Tensor & self);
24
+
25
+ } // namespace cpu
26
+ } // namespace at
shared/package-files/33/33347744575c5b047abf7344e1ae392834abd33659ea190eba92109525d32de4/_monitoring.py ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import matplotlib.pyplot as plt
2
+ import numpy as np
3
+ import pandas as pd
4
+ import scipy.stats
5
+
6
+ from . import colors
7
+ from ._labels import labels
8
+
9
+
10
+ def truncate_text(text, max_len):
11
+ if len(text) > max_len:
12
+ return text[: int(max_len / 2) - 2] + "..." + text[-int(max_len / 2) + 1 :]
13
+ else:
14
+ return text
15
+
16
+
17
+ def monitoring(ind, shap_values, features, feature_names=None, show=True):
18
+ """Create a SHAP monitoring plot.
19
+
20
+ (Note this function is preliminary and subject to change!!)
21
+ A SHAP monitoring plot is meant to display the behavior of a model
22
+ over time. Often the shap_values given to this plot explain the loss
23
+ of a model, so changes in a feature's impact on the model's loss over
24
+ time can help in monitoring the model's performance.
25
+
26
+ Parameters
27
+ ----------
28
+ ind : int
29
+ Index of the feature to plot.
30
+
31
+ shap_values : numpy.array
32
+ Matrix of SHAP values (# samples x # features)
33
+
34
+ features : numpy.array or pandas.DataFrame
35
+ Matrix of feature values (# samples x # features)
36
+
37
+ feature_names : list
38
+ Names of the features (length # features)
39
+
40
+ """
41
+ if isinstance(features, pd.DataFrame):
42
+ if feature_names is None:
43
+ feature_names = features.columns
44
+ features = features.values
45
+
46
+ num_features = shap_values.shape[1]
47
+
48
+ if feature_names is None:
49
+ feature_names = np.array([labels["FEATURE"] % str(i) for i in range(num_features)])
50
+
51
+ plt.figure(figsize=(10, 3))
52
+ ys = shap_values[:, ind]
53
+ xs = np.arange(len(ys)) # np.linspace(0, 12*2, len(ys))
54
+
55
+ pvals = []
56
+ inc = 50
57
+ for i in range(inc, len(ys) - inc, inc):
58
+ # stat, pval = scipy.stats.mannwhitneyu(v[:i], v[i:], alternative="two-sided")
59
+ _, pval = scipy.stats.ttest_ind(ys[:i], ys[i:])
60
+ pvals.append(pval)
61
+ min_pval = np.min(pvals)
62
+ min_pval_ind = float(np.argmin(pvals) * inc + inc)
63
+
64
+ if min_pval < 0.05 / shap_values.shape[1]:
65
+ plt.axvline(min_pval_ind, linestyle="dashed", color="#666666", alpha=0.2)
66
+
67
+ plt.scatter(xs, ys, s=10, c=features[:, ind], cmap=colors.red_blue)
68
+
69
+ plt.xlabel("Sample index")
70
+ plt.ylabel(truncate_text(feature_names[ind], 30) + "\nSHAP value", size=13)
71
+ plt.gca().xaxis.set_ticks_position("bottom")
72
+ plt.gca().yaxis.set_ticks_position("left")
73
+ plt.gca().spines["right"].set_visible(False)
74
+ plt.gca().spines["top"].set_visible(False)
75
+ cb = plt.colorbar()
76
+ cb.outline.set_visible(False) # type: ignore
77
+ bbox = cb.ax.get_window_extent().transformed(plt.gcf().dpi_scale_trans.inverted())
78
+ cb.ax.set_aspect((bbox.height - 0.7) * 20)
79
+ cb.set_label(truncate_text(feature_names[ind], 30), size=13)
80
+ if show:
81
+ plt.show()
shared/package-files/33/3334dd5e9e21c3a272819e5db1b49137efc74076d129087d390b8941855b1ec7/compat.py ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file is part of Patsy
2
+ # Copyright (C) 2012 Nathaniel Smith <njs@pobox.com>
3
+ # See file LICENSE.txt for license information.
4
+
5
+ # This file contains compatibility code for supporting old versions of Python
6
+ # and numpy. (If we can concentrate it here, hopefully it'll make it easier to
7
+ # get rid of weird hacks once we drop support for old versions).
8
+
9
+ ##### Numpy
10
+
11
+ import os
12
+
13
+ # To force use of the compat code, set this env var to a non-empty value:
14
+ optional_dep_ok = not os.environ.get("PATSY_AVOID_OPTIONAL_DEPENDENCIES")
15
+
16
+ ##### Python standard library
17
+
18
+ # The Python license requires that all derivative works contain a "brief
19
+ # summary of the changes made to Python". Both for license compliance, and for
20
+ # our own sanity, therefore, please add a note at the top of any snippets you
21
+ # add here explaining their provenance, any changes made, and what versions of
22
+ # Python require them:
23
+
24
+ # OrderedDict is only available in Python 2.7+. compat_ordereddict.py has
25
+ # comments at the top.
26
+ import collections
27
+
28
+ if optional_dep_ok and hasattr(collections, "OrderedDict"):
29
+ from collections import OrderedDict
30
+ else:
31
+ from patsy.compat_ordereddict import OrderedDict
32
+
33
+ # 'raise from' available in Python 3+
34
+ import sys
35
+ from patsy import PatsyError
36
+
37
+
38
+ def call_and_wrap_exc(msg, origin, f, *args, **kwargs):
39
+ try:
40
+ return f(*args, **kwargs)
41
+ except Exception as e:
42
+ new_exc = PatsyError("%s: %s: %s" % (msg, e.__class__.__name__, e), origin)
43
+ raise new_exc from e
shared/package-files/33/3334fb3983c45171d834f06b564c8a11a1b909ab3668e034c6faceee5e184eb4/testdouble_4.2c_SOL2.mat ADDED
Binary file (103 Bytes). View file
 
shared/package-files/33/333555ba99cb1c4beec255429fa991ecb43da4b78d896336956c0d948c28a3df/test_shift.py ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pytest
2
+
3
+ from pandas.errors import NullFrequencyError
4
+
5
+ import pandas as pd
6
+ from pandas import TimedeltaIndex
7
+ import pandas._testing as tm
8
+
9
+
10
+ class TestTimedeltaIndexShift:
11
+ # -------------------------------------------------------------
12
+ # TimedeltaIndex.shift is used by __add__/__sub__
13
+
14
+ def test_tdi_shift_empty(self):
15
+ # GH#9903
16
+ idx = TimedeltaIndex([], name="xxx")
17
+ tm.assert_index_equal(idx.shift(0, freq="h"), idx)
18
+ tm.assert_index_equal(idx.shift(3, freq="h"), idx)
19
+
20
+ def test_tdi_shift_hours(self):
21
+ # GH#9903
22
+ idx = TimedeltaIndex(["5 hours", "6 hours", "9 hours"], name="xxx")
23
+ tm.assert_index_equal(idx.shift(0, freq="h"), idx)
24
+ exp = TimedeltaIndex(["8 hours", "9 hours", "12 hours"], name="xxx")
25
+ tm.assert_index_equal(idx.shift(3, freq="h"), exp)
26
+ exp = TimedeltaIndex(["2 hours", "3 hours", "6 hours"], name="xxx")
27
+ tm.assert_index_equal(idx.shift(-3, freq="h"), exp)
28
+
29
+ def test_tdi_shift_minutes(self):
30
+ # GH#9903
31
+ idx = TimedeltaIndex(["5 hours", "6 hours", "9 hours"], name="xxx")
32
+ tm.assert_index_equal(idx.shift(0, freq="min"), idx)
33
+ exp = TimedeltaIndex(["05:03:00", "06:03:00", "9:03:00"], name="xxx")
34
+ tm.assert_index_equal(idx.shift(3, freq="min"), exp)
35
+ exp = TimedeltaIndex(["04:57:00", "05:57:00", "8:57:00"], name="xxx")
36
+ tm.assert_index_equal(idx.shift(-3, freq="min"), exp)
37
+
38
+ def test_tdi_shift_int(self):
39
+ # GH#8083
40
+ tdi = pd.to_timedelta(range(5), unit="d")
41
+ trange = tdi._with_freq("infer") + pd.offsets.Hour(1)
42
+ result = trange.shift(1)
43
+ expected = TimedeltaIndex(
44
+ [
45
+ "1 days 01:00:00",
46
+ "2 days 01:00:00",
47
+ "3 days 01:00:00",
48
+ "4 days 01:00:00",
49
+ "5 days 01:00:00",
50
+ ],
51
+ freq="D",
52
+ )
53
+ tm.assert_index_equal(result, expected)
54
+
55
+ def test_tdi_shift_nonstandard_freq(self):
56
+ # GH#8083
57
+ tdi = pd.to_timedelta(range(5), unit="d")
58
+ trange = tdi._with_freq("infer") + pd.offsets.Hour(1)
59
+ result = trange.shift(3, freq="2D 1s")
60
+ expected = TimedeltaIndex(
61
+ [
62
+ "6 days 01:00:03",
63
+ "7 days 01:00:03",
64
+ "8 days 01:00:03",
65
+ "9 days 01:00:03",
66
+ "10 days 01:00:03",
67
+ ],
68
+ freq="D",
69
+ )
70
+ tm.assert_index_equal(result, expected)
71
+
72
+ def test_shift_no_freq(self):
73
+ # GH#19147
74
+ tdi = TimedeltaIndex(["1 days 01:00:00", "2 days 01:00:00"], freq=None)
75
+ with pytest.raises(NullFrequencyError, match="Cannot shift with no freq"):
76
+ tdi.shift(2)
shared/package-files/33/3339f39dd38edd0a1c71c20cc9d74eeefd7211c0804be1cb6cb42a026adfcd67/_kalman_filter.pxd ADDED
@@ -0,0 +1,690 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #cython: boundscheck=False
2
+ #cython: wraparound=False
3
+ #cython: cdivision=False
4
+ """
5
+ Kalman Filter declarations
6
+
7
+ Author: Chad Fulton
8
+ License: Simplified-BSD
9
+ """
10
+
11
+ include "statsmodels/tsa/statespace/_blas_int.pxi"
12
+
13
+ # ## Constants
14
+
15
+ # ### Filters
16
+ cdef int FILTER_CONVENTIONAL # Durbin and Koopman (2012), Chapter 4
17
+ cdef int FILTER_EXACT_INITIAL # ibid., Chapter 5.6
18
+ cdef int FILTER_AUGMENTED # ibid., Chapter 5.7
19
+ cdef int FILTER_SQUARE_ROOT # ibid., Chapter 6.3
20
+ cdef int FILTER_UNIVARIATE # ibid., Chapter 6.4
21
+ cdef int FILTER_COLLAPSED # ibid., Chapter 6.5
22
+ cdef int FILTER_EXTENDED # ibid., Chapter 10.2
23
+ cdef int FILTER_UNSCENTED # ibid., Chapter 10.3
24
+ cdef int FILTER_CONCENTRATED # Harvey (1989), Chapter 3.4
25
+ cdef int FILTER_CHANDRASEKHAR # Herbst (2015)
26
+
27
+ # ### Inversion methods
28
+ # Methods by which the terms using the inverse of the forecast error
29
+ # covariance matrix are solved.
30
+ cdef int INVERT_UNIVARIATE
31
+ cdef int SOLVE_LU
32
+ cdef int INVERT_LU
33
+ cdef int SOLVE_CHOLESKY
34
+ cdef int INVERT_CHOLESKY
35
+
36
+ # ### Numerical Stability methods
37
+ # Methods to improve numerical stability
38
+ cdef int STABILITY_FORCE_SYMMETRY
39
+
40
+ # ### Memory conservation options
41
+ cdef int MEMORY_STORE_ALL
42
+ cdef int MEMORY_NO_FORECAST_MEAN
43
+ cdef int MEMORY_NO_FORECAST_COV
44
+ cdef int MEMORY_NO_FORECAST
45
+ cdef int MEMORY_NO_PREDICTED_MEAN
46
+ cdef int MEMORY_NO_PREDICTED_COV
47
+ cdef int MEMORY_NO_PREDICTED
48
+ cdef int MEMORY_NO_FILTERED_MEAN
49
+ cdef int MEMORY_NO_FILTERED_COV
50
+ cdef int MEMORY_NO_FILTERED
51
+ cdef int MEMORY_NO_LIKELIHOOD
52
+ cdef int MEMORY_NO_GAIN
53
+ cdef int MEMORY_NO_SMOOTHING
54
+ cdef int MEMORY_NO_STD_FORECAST
55
+ cdef int MEMORY_CONSERVE
56
+
57
+ # ### Timing options
58
+ cdef int TIMING_INIT_FILTERED
59
+ cdef int TIMING_INIT_PREDICTED
60
+
61
+ # Typical imports
62
+
63
+ cimport numpy as np
64
+
65
+ from statsmodels.tsa.statespace._representation cimport (
66
+ cStatespace,
67
+ dStatespace,
68
+ sStatespace,
69
+ zStatespace,
70
+ )
71
+
72
+
73
+ # Single precision
74
+ cdef class sKalmanFilter(object):
75
+ # Statespace object
76
+ cdef readonly sStatespace model
77
+
78
+ # ### Filter parameters
79
+ cdef readonly int t
80
+ cdef public np.float64_t tolerance, tolerance_diffuse
81
+ cdef readonly int nobs_diffuse
82
+ cdef readonly int nobs_kendog_diffuse_nonsingular
83
+ cdef readonly int nobs_kendog_univariate_singular
84
+ cdef readonly int converged
85
+ cdef readonly int period_converged
86
+ cdef readonly int time_invariant
87
+ cdef readonly int filter_method
88
+ cdef public int inversion_method
89
+ cdef public int stability_method
90
+ cdef readonly int conserve_memory
91
+ cdef public int filter_timing
92
+ cdef readonly int loglikelihood_burn
93
+
94
+ cdef public int [:] univariate_filter
95
+
96
+ # ### Kalman filter properties
97
+ cdef readonly np.float32_t [:] loglikelihood, scale
98
+ cdef readonly np.float32_t [::1,:] filtered_state, predicted_state, forecast, forecast_error, standardized_forecast_error
99
+ cdef readonly np.float32_t [::1,:,:] filtered_state_cov, predicted_state_cov, forecast_error_cov, predicted_diffuse_state_cov, forecast_error_diffuse_cov, M, M_inf
100
+ cdef readonly np.float32_t [::1,:,:] kalman_gain
101
+
102
+ # ### Steady State Values
103
+ cdef readonly np.float32_t [::1,:] converged_forecast_error_cov
104
+ cdef readonly np.float32_t [::1,:] converged_filtered_state_cov
105
+ cdef readonly np.float32_t [::1,:] converged_predicted_state_cov
106
+ cdef readonly np.float32_t [::1,:] converged_kalman_gain
107
+ cdef readonly np.float32_t [::1,:] converged_M
108
+ cdef readonly np.float32_t converged_determinant
109
+
110
+ # ### Temporary arrays
111
+ cdef readonly np.float32_t [::1,:] forecast_error_fac
112
+ cdef readonly blas_int [:] forecast_error_ipiv
113
+ cdef readonly np.float32_t [::1,:] forecast_error_work
114
+ cdef readonly np.float32_t [::1,:] tmp0, tmp00
115
+ cdef readonly np.float32_t [::1,:] tmp2
116
+ cdef readonly np.float32_t [::1,:,:] tmp1, tmp3, tmp4
117
+ cdef readonly np.float32_t [:] tmpK0, tmpK1
118
+ cdef readonly np.float32_t [::1,:] tmpL0, tmpL1
119
+
120
+ cdef readonly np.float32_t [::1,:] CW, CtmpW, CMW, CM, CprevFiZ, CtmpM, CMWZ
121
+
122
+
123
+ cdef readonly np.float32_t determinant
124
+
125
+ # ### Pointers to current-iteration arrays
126
+ # cdef np.float32_t * _obs
127
+ # cdef np.float32_t * _design
128
+ # cdef np.float32_t * _obs_intercept
129
+ # cdef np.float32_t * _obs_cov
130
+ # cdef np.float32_t * _transition
131
+ # cdef np.float32_t * _state_intercept
132
+ # cdef np.float32_t * _selection
133
+ # cdef np.float32_t * _state_cov
134
+ # cdef np.float32_t * _selected_state_cov
135
+ # cdef np.float32_t * _initial_state
136
+ # cdef np.float32_t * _initial_state_cov
137
+
138
+ cdef np.float32_t * _input_state
139
+ cdef np.float32_t * _input_state_cov
140
+ cdef np.float32_t * _input_diffuse_state_cov
141
+
142
+ cdef np.float32_t * _forecast
143
+ cdef np.float32_t * _forecast_error
144
+ cdef np.float32_t * _standardized_forecast_error
145
+ cdef np.float32_t * _forecast_error_cov
146
+ cdef np.float32_t * _filtered_state
147
+ cdef np.float32_t * _filtered_state_cov
148
+ cdef np.float32_t * _predicted_state
149
+ cdef np.float32_t * _predicted_state_cov
150
+
151
+ cdef np.float32_t * _forecast_error_diffuse_cov
152
+ cdef np.float32_t * _predicted_diffuse_state_cov
153
+ cdef np.float32_t * _M
154
+ cdef np.float32_t * _M_inf
155
+
156
+ cdef np.float32_t * _kalman_gain
157
+ cdef np.float32_t * _loglikelihood
158
+ cdef np.float32_t * _scale
159
+
160
+ cdef np.float32_t * _converged_forecast_error_cov
161
+ cdef np.float32_t * _converged_filtered_state_cov
162
+ cdef np.float32_t * _converged_predicted_state_cov
163
+ cdef np.float32_t * _converged_kalman_gain
164
+ cdef np.float32_t * _converged_M
165
+
166
+ cdef np.float32_t * _forecast_error_fac
167
+ cdef blas_int * _forecast_error_ipiv
168
+ cdef np.float32_t * _forecast_error_work
169
+
170
+ cdef np.float32_t * _tmp0
171
+ cdef np.float32_t * _tmp00
172
+ cdef np.float32_t * _tmp1
173
+ cdef np.float32_t * _tmp2
174
+ cdef np.float32_t * _tmp3
175
+ cdef np.float32_t * _tmp4
176
+
177
+ cdef np.float32_t * _tmpM_inf
178
+ cdef np.float32_t * _tmpK0
179
+ cdef np.float32_t * _tmpK1
180
+ cdef np.float32_t * _tmpL0
181
+ cdef np.float32_t * _tmpL1
182
+
183
+ # ### Pointers to current-iteration Kalman filtering functions
184
+ cdef int (*forecasting)(
185
+ sKalmanFilter, sStatespace
186
+ )
187
+ cdef np.float32_t (*inversion)(
188
+ sKalmanFilter, sStatespace, np.float32_t
189
+ ) except *
190
+ cdef int (*updating)(
191
+ sKalmanFilter, sStatespace
192
+ )
193
+ cdef np.float32_t (*calculate_loglikelihood)(
194
+ sKalmanFilter, sStatespace, np.float32_t
195
+ )
196
+ cdef np.float32_t (*calculate_scale)(
197
+ sKalmanFilter, sStatespace
198
+ )
199
+ cdef int (*prediction)(
200
+ sKalmanFilter, sStatespace
201
+ )
202
+
203
+ # ### Define some constants
204
+ cdef readonly int k_endog, k_states, k_posdef, k_endog2, k_states2, k_posdef2, k_endogstates, k_statesposdef
205
+ cdef readonly int ldwork
206
+
207
+ cdef allocate_arrays(self)
208
+ cdef void set_dimensions(self)
209
+ cpdef set_filter_method(self, int filter_method, int force_reset=*)
210
+ cpdef seek(self, unsigned int t, int reset=*)
211
+
212
+ cdef void initialize_statespace_object_pointers(self) except *
213
+ cdef void initialize_filter_object_pointers(self)
214
+ cdef void initialize_function_pointers(self) except *
215
+ cdef void post_convergence(self)
216
+ cdef void numerical_stability(self)
217
+ cdef int check_diffuse(self)
218
+ cdef void check_convergence(self)
219
+ cdef void migrate_storage(self)
220
+ cdef void _reinitialize_pointers(self) except *
221
+
222
+ cdef void _forecasting(self)
223
+ cdef np.float32_t _inversion(self)
224
+ cdef void _updating(self)
225
+ cdef np.float32_t _calculate_loglikelihood(self)
226
+ cdef void _prediction(self)
227
+
228
+ # Double precision
229
+ cdef class dKalmanFilter(object):
230
+ # Statespace object
231
+ cdef readonly dStatespace model
232
+
233
+ # ### Filter parameters
234
+ cdef readonly int t
235
+ cdef public np.float64_t tolerance, tolerance_diffuse
236
+ cdef readonly int nobs_diffuse
237
+ cdef readonly int nobs_kendog_diffuse_nonsingular
238
+ cdef readonly int nobs_kendog_univariate_singular
239
+ cdef readonly int converged
240
+ cdef readonly int period_converged
241
+ cdef readonly int time_invariant
242
+ cdef readonly int filter_method
243
+ cdef public int inversion_method
244
+ cdef public int stability_method
245
+ cdef readonly int conserve_memory
246
+ cdef public int filter_timing
247
+ cdef readonly int loglikelihood_burn
248
+
249
+ cdef public int [:] univariate_filter
250
+
251
+ # ### Kalman filter properties
252
+ cdef readonly np.float64_t [:] loglikelihood, scale
253
+ cdef readonly np.float64_t [::1,:] filtered_state, predicted_state, forecast, forecast_error, standardized_forecast_error
254
+ cdef readonly np.float64_t [::1,:,:] filtered_state_cov, predicted_state_cov, forecast_error_cov, predicted_diffuse_state_cov, forecast_error_diffuse_cov, M, M_inf
255
+ cdef readonly np.float64_t [::1,:,:] kalman_gain
256
+
257
+ # ### Steady State Values
258
+ cdef readonly np.float64_t [::1,:] converged_forecast_error_cov
259
+ cdef readonly np.float64_t [::1,:] converged_filtered_state_cov
260
+ cdef readonly np.float64_t [::1,:] converged_predicted_state_cov
261
+ cdef readonly np.float64_t [::1,:] converged_kalman_gain
262
+ cdef readonly np.float64_t [::1,:] converged_M
263
+ cdef readonly np.float64_t converged_determinant
264
+
265
+ # ### Temporary arrays
266
+ cdef readonly np.float64_t [::1,:] forecast_error_fac
267
+ cdef readonly blas_int [:] forecast_error_ipiv
268
+ cdef readonly np.float64_t [::1,:] forecast_error_work
269
+ cdef readonly np.float64_t [::1,:] tmp0, tmp00
270
+ cdef readonly np.float64_t [::1,:] tmp2
271
+ cdef readonly np.float64_t [::1,:,:] tmp1, tmp3, tmp4
272
+ cdef readonly np.float64_t [:] tmpM_inf, tmpK0, tmpK1
273
+ cdef readonly np.float64_t [::1,:] tmpL0, tmpL1
274
+
275
+ cdef readonly np.float64_t [::1,:] CW, CtmpW, CMW, CM, CprevFiZ, CtmpM, CMWZ
276
+
277
+ cdef readonly np.float64_t determinant
278
+
279
+ # ### Pointers to current-iteration arrays
280
+ # cdef np.float64_t * _obs
281
+ # cdef np.float64_t * _design
282
+ # cdef np.float64_t * _obs_intercept
283
+ # cdef np.float64_t * _obs_cov
284
+ # cdef np.float64_t * _transition
285
+ # cdef np.float64_t * _state_intercept
286
+ # cdef np.float64_t * _selection
287
+ # cdef np.float64_t * _state_cov
288
+ # cdef np.float64_t * _selected_state_cov
289
+ # cdef np.float64_t * _initial_state
290
+ # cdef np.float64_t * _initial_state_cov
291
+
292
+ cdef np.float64_t * _input_state
293
+ cdef np.float64_t * _input_state_cov
294
+ cdef np.float64_t * _input_diffuse_state_cov
295
+
296
+ cdef np.float64_t * _forecast
297
+ cdef np.float64_t * _forecast_error
298
+ cdef np.float64_t * _standardized_forecast_error
299
+ cdef np.float64_t * _forecast_error_cov
300
+ cdef np.float64_t * _filtered_state
301
+ cdef np.float64_t * _filtered_state_cov
302
+ cdef np.float64_t * _predicted_state
303
+ cdef np.float64_t * _predicted_state_cov
304
+
305
+ cdef np.float64_t * _forecast_error_diffuse_cov
306
+ cdef np.float64_t * _predicted_diffuse_state_cov
307
+ cdef np.float64_t * _M
308
+ cdef np.float64_t * _M_inf
309
+
310
+ cdef np.float64_t * _kalman_gain
311
+ cdef np.float64_t * _loglikelihood
312
+ cdef np.float64_t * _scale
313
+
314
+ cdef np.float64_t * _converged_forecast_error_cov
315
+ cdef np.float64_t * _converged_filtered_state_cov
316
+ cdef np.float64_t * _converged_predicted_state_cov
317
+ cdef np.float64_t * _converged_kalman_gain
318
+ cdef np.float64_t * _converged_M
319
+
320
+ cdef np.float64_t * _forecast_error_fac
321
+ cdef blas_int * _forecast_error_ipiv
322
+ cdef np.float64_t * _forecast_error_work
323
+
324
+ cdef np.float64_t * _tmp0
325
+ cdef np.float64_t * _tmp00
326
+ cdef np.float64_t * _tmp1
327
+ cdef np.float64_t * _tmp2
328
+ cdef np.float64_t * _tmp3
329
+ cdef np.float64_t * _tmp4
330
+
331
+ cdef np.float64_t * _tmpM_inf
332
+ cdef np.float64_t * _tmpK0
333
+ cdef np.float64_t * _tmpK1
334
+ cdef np.float64_t * _tmpL0
335
+ cdef np.float64_t * _tmpL1
336
+
337
+ # ### Pointers to current-iteration Kalman filtering functions
338
+ cdef int (*forecasting)(
339
+ dKalmanFilter, dStatespace
340
+ )
341
+ cdef np.float64_t (*inversion)(
342
+ dKalmanFilter, dStatespace, np.float64_t
343
+ ) except *
344
+ cdef int (*updating)(
345
+ dKalmanFilter, dStatespace
346
+ )
347
+ cdef np.float64_t (*calculate_loglikelihood)(
348
+ dKalmanFilter, dStatespace, np.float64_t
349
+ )
350
+ cdef np.float64_t (*calculate_scale)(
351
+ dKalmanFilter, dStatespace
352
+ )
353
+ cdef int (*prediction)(
354
+ dKalmanFilter, dStatespace
355
+ )
356
+
357
+ # ### Define some constants
358
+ cdef readonly int k_endog, k_states, k_posdef, k_endog2, k_states2, k_posdef2, k_endogstates, k_statesposdef
359
+ cdef readonly int ldwork
360
+
361
+ cdef allocate_arrays(self)
362
+ cdef void set_dimensions(self)
363
+ cpdef set_filter_method(self, int filter_method, int force_reset=*)
364
+ cpdef seek(self, unsigned int t, int reset=*)
365
+
366
+ cdef void initialize_statespace_object_pointers(self) except *
367
+ cdef void initialize_filter_object_pointers(self)
368
+ cdef void initialize_function_pointers(self) except *
369
+ cdef void post_convergence(self)
370
+ cdef void numerical_stability(self)
371
+ cdef int check_diffuse(self)
372
+ cdef void check_convergence(self)
373
+ cdef void migrate_storage(self)
374
+ cdef void _reinitialize_pointers(self) except *
375
+
376
+ cdef void _forecasting(self)
377
+ cdef np.float64_t _inversion(self)
378
+ cdef void _updating(self)
379
+ cdef np.float64_t _calculate_loglikelihood(self)
380
+ cdef void _prediction(self)
381
+
382
+ # Single precision complex
383
+ cdef class cKalmanFilter(object):
384
+ # Statespace object
385
+ cdef readonly cStatespace model
386
+
387
+ # ### Filter parameters
388
+ cdef readonly int t
389
+ cdef public np.float64_t tolerance, tolerance_diffuse
390
+ cdef readonly int nobs_diffuse
391
+ cdef readonly int nobs_kendog_diffuse_nonsingular
392
+ cdef readonly int nobs_kendog_univariate_singular
393
+ cdef readonly int converged
394
+ cdef readonly int period_converged
395
+ cdef readonly int time_invariant
396
+ cdef readonly int filter_method
397
+ cdef public int inversion_method
398
+ cdef public int stability_method
399
+ cdef readonly int conserve_memory
400
+ cdef public int filter_timing
401
+ cdef readonly int loglikelihood_burn
402
+
403
+ cdef public int [:] univariate_filter
404
+
405
+ # ### Kalman filter properties
406
+ cdef readonly np.complex64_t [:] loglikelihood, scale
407
+ cdef readonly np.complex64_t [::1,:] filtered_state, predicted_state, forecast, forecast_error, standardized_forecast_error
408
+ cdef readonly np.complex64_t [::1,:,:] filtered_state_cov, predicted_state_cov, forecast_error_cov, predicted_diffuse_state_cov, forecast_error_diffuse_cov, M, M_inf
409
+ cdef readonly np.complex64_t [::1,:,:] kalman_gain
410
+
411
+ # ### Steady State Values
412
+ cdef readonly np.complex64_t [::1,:] converged_forecast_error_cov
413
+ cdef readonly np.complex64_t [::1,:] converged_filtered_state_cov
414
+ cdef readonly np.complex64_t [::1,:] converged_predicted_state_cov
415
+ cdef readonly np.complex64_t [::1,:] converged_kalman_gain
416
+ cdef readonly np.complex64_t [::1,:] converged_M
417
+ cdef readonly np.complex64_t converged_determinant
418
+
419
+ # ### Temporary arrays
420
+ cdef readonly np.complex64_t [::1,:] forecast_error_fac
421
+ cdef readonly blas_int [:] forecast_error_ipiv
422
+ cdef readonly np.complex64_t [::1,:] forecast_error_work
423
+ cdef readonly np.complex64_t [::1,:] tmp0, tmp00
424
+ cdef readonly np.complex64_t [::1,:] tmp2
425
+ cdef readonly np.complex64_t [::1,:,:] tmp1, tmp3, tmp4
426
+ cdef readonly np.complex64_t [:] tmpM_inf, tmpK0, tmpK1
427
+ cdef readonly np.complex64_t [::1,:] tmpL0, tmpL1
428
+
429
+ cdef readonly np.complex64_t [::1,:] CW, CtmpW, CMW, CM, CprevFiZ, CtmpM, CMWZ
430
+
431
+
432
+ cdef readonly np.complex64_t determinant
433
+
434
+ # ### Pointers to current-iteration arrays
435
+ # cdef np.complex64_t * _obs
436
+ # cdef np.complex64_t * _design
437
+ # cdef np.complex64_t * _obs_intercept
438
+ # cdef np.complex64_t * _obs_cov
439
+ # cdef np.complex64_t * _transition
440
+ # cdef np.complex64_t * _state_intercept
441
+ # cdef np.complex64_t * _selection
442
+ # cdef np.complex64_t * _state_cov
443
+ # cdef np.complex64_t * _selected_state_cov
444
+ # cdef np.complex64_t * _initial_state
445
+ # cdef np.complex64_t * _initial_state_cov
446
+
447
+ cdef np.complex64_t * _input_state
448
+ cdef np.complex64_t * _input_state_cov
449
+ cdef np.complex64_t * _input_diffuse_state_cov
450
+
451
+ cdef np.complex64_t * _forecast
452
+ cdef np.complex64_t * _forecast_error
453
+ cdef np.complex64_t * _standardized_forecast_error
454
+ cdef np.complex64_t * _forecast_error_cov
455
+ cdef np.complex64_t * _filtered_state
456
+ cdef np.complex64_t * _filtered_state_cov
457
+ cdef np.complex64_t * _predicted_state
458
+ cdef np.complex64_t * _predicted_state_cov
459
+
460
+ cdef np.complex64_t * _forecast_error_diffuse_cov
461
+ cdef np.complex64_t * _predicted_diffuse_state_cov
462
+ cdef np.complex64_t * _M
463
+ cdef np.complex64_t * _M_inf
464
+
465
+ cdef np.complex64_t * _kalman_gain
466
+ cdef np.complex64_t * _loglikelihood
467
+ cdef np.complex64_t * _scale
468
+
469
+ cdef np.complex64_t * _converged_forecast_error_cov
470
+ cdef np.complex64_t * _converged_filtered_state_cov
471
+ cdef np.complex64_t * _converged_predicted_state_cov
472
+ cdef np.complex64_t * _converged_kalman_gain
473
+ cdef np.complex64_t * _converged_M
474
+
475
+ cdef np.complex64_t * _forecast_error_fac
476
+ cdef blas_int * _forecast_error_ipiv
477
+ cdef np.complex64_t * _forecast_error_work
478
+
479
+ cdef np.complex64_t * _tmp0
480
+ cdef np.complex64_t * _tmp00
481
+ cdef np.complex64_t * _tmp1
482
+ cdef np.complex64_t * _tmp2
483
+ cdef np.complex64_t * _tmp3
484
+ cdef np.complex64_t * _tmp4
485
+
486
+ cdef np.complex64_t * _tmpM_inf
487
+ cdef np.complex64_t * _tmpK0
488
+ cdef np.complex64_t * _tmpK1
489
+ cdef np.complex64_t * _tmpL0
490
+ cdef np.complex64_t * _tmpL1
491
+
492
+ # ### Pointers to current-iteration Kalman filtering functions
493
+ cdef int (*forecasting)(
494
+ cKalmanFilter, cStatespace
495
+ )
496
+ cdef np.complex64_t (*inversion)(
497
+ cKalmanFilter, cStatespace, np.complex64_t
498
+ ) except *
499
+ cdef int (*updating)(
500
+ cKalmanFilter, cStatespace
501
+ )
502
+ cdef np.complex64_t (*calculate_loglikelihood)(
503
+ cKalmanFilter, cStatespace, np.complex64_t
504
+ )
505
+ cdef np.complex64_t (*calculate_scale)(
506
+ cKalmanFilter, cStatespace
507
+ )
508
+ cdef int (*prediction)(
509
+ cKalmanFilter, cStatespace
510
+ )
511
+
512
+ # ### Define some constants
513
+ cdef readonly int k_endog, k_states, k_posdef, k_endog2, k_states2, k_posdef2, k_endogstates, k_statesposdef
514
+ cdef readonly int ldwork
515
+
516
+ cdef allocate_arrays(self)
517
+ cdef void set_dimensions(self)
518
+ cpdef set_filter_method(self, int filter_method, int force_reset=*)
519
+ cpdef seek(self, unsigned int t, int reset=*)
520
+
521
+ cdef void initialize_statespace_object_pointers(self) except *
522
+ cdef void initialize_filter_object_pointers(self)
523
+ cdef void initialize_function_pointers(self) except *
524
+ cdef void post_convergence(self)
525
+ cdef void numerical_stability(self)
526
+ cdef int check_diffuse(self)
527
+ cdef void check_convergence(self)
528
+ cdef void migrate_storage(self)
529
+ cdef void _reinitialize_pointers(self) except *
530
+
531
+ cdef void _forecasting(self)
532
+ cdef np.complex64_t _inversion(self)
533
+ cdef void _updating(self)
534
+ cdef np.complex64_t _calculate_loglikelihood(self)
535
+ cdef void _prediction(self)
536
+
537
+ # Double precision complex
538
+ cdef class zKalmanFilter(object):
539
+ # Statespace object
540
+ cdef readonly zStatespace model
541
+
542
+ # ### Filter parameters
543
+ cdef readonly int t
544
+ cdef public np.float64_t tolerance, tolerance_diffuse
545
+ cdef readonly int nobs_diffuse
546
+ cdef readonly int nobs_kendog_diffuse_nonsingular
547
+ cdef readonly int nobs_kendog_univariate_singular
548
+ cdef readonly int converged
549
+ cdef readonly int period_converged
550
+ cdef readonly int time_invariant
551
+ cdef readonly int filter_method
552
+ cdef public int inversion_method
553
+ cdef public int stability_method
554
+ cdef readonly int conserve_memory
555
+ cdef public int filter_timing
556
+ cdef readonly int loglikelihood_burn
557
+
558
+ cdef public int [:] univariate_filter
559
+
560
+ # ### Kalman filter properties
561
+ cdef readonly np.complex128_t [:] loglikelihood, scale
562
+ cdef readonly np.complex128_t [::1,:] filtered_state, predicted_state, forecast, forecast_error, standardized_forecast_error
563
+ cdef readonly np.complex128_t [::1,:,:] filtered_state_cov, predicted_state_cov, forecast_error_cov, predicted_diffuse_state_cov, forecast_error_diffuse_cov, M, M_inf
564
+ cdef readonly np.complex128_t [::1,:,:] kalman_gain
565
+
566
+ # ### Steady State Values
567
+ cdef readonly np.complex128_t [::1,:] converged_forecast_error_cov
568
+ cdef readonly np.complex128_t [::1,:] converged_filtered_state_cov
569
+ cdef readonly np.complex128_t [::1,:] converged_predicted_state_cov
570
+ cdef readonly np.complex128_t [::1,:] converged_kalman_gain
571
+ cdef readonly np.complex128_t [::1,:] converged_M
572
+ cdef readonly np.complex128_t converged_determinant
573
+
574
+ # ### Temporary arrays
575
+ cdef readonly np.complex128_t [::1,:] forecast_error_fac
576
+ cdef readonly blas_int [:] forecast_error_ipiv
577
+ cdef readonly np.complex128_t [::1,:] forecast_error_work
578
+ cdef readonly np.complex128_t [::1,:] tmp0, tmp00
579
+ cdef readonly np.complex128_t [::1,:] tmp2
580
+ cdef readonly np.complex128_t [::1,:,:] tmp1, tmp3, tmp4
581
+ cdef readonly np.complex128_t [:] tmpM_inf, tmpK0, tmpK1
582
+ cdef readonly np.complex128_t [::1,:] tmpL0, tmpL1
583
+
584
+ cdef readonly np.complex128_t [::1,:] CW, CtmpW, CMW, CM, CprevFiZ, CtmpM, CMWZ
585
+
586
+
587
+ cdef readonly np.complex128_t determinant
588
+
589
+ # ### Pointers to current-iteration arrays
590
+ # cdef np.complex128_t * _obs
591
+ # cdef np.complex128_t * _design
592
+ # cdef np.complex128_t * _obs_intercept
593
+ # cdef np.complex128_t * _obs_cov
594
+ # cdef np.complex128_t * _transition
595
+ # cdef np.complex128_t * _state_intercept
596
+ # cdef np.complex128_t * _selection
597
+ # cdef np.complex128_t * _state_cov
598
+ # cdef np.complex128_t * _selected_state_cov
599
+ # cdef np.complex128_t * _initial_state
600
+ # cdef np.complex128_t * _initial_state_cov
601
+
602
+ cdef np.complex128_t * _input_state
603
+ cdef np.complex128_t * _input_state_cov
604
+ cdef np.complex128_t * _input_diffuse_state_cov
605
+
606
+ cdef np.complex128_t * _forecast
607
+ cdef np.complex128_t * _forecast_error
608
+ cdef np.complex128_t * _standardized_forecast_error
609
+ cdef np.complex128_t * _forecast_error_cov
610
+ cdef np.complex128_t * _filtered_state
611
+ cdef np.complex128_t * _filtered_state_cov
612
+ cdef np.complex128_t * _predicted_state
613
+ cdef np.complex128_t * _predicted_state_cov
614
+
615
+ cdef np.complex128_t * _forecast_error_diffuse_cov
616
+ cdef np.complex128_t * _predicted_diffuse_state_cov
617
+ cdef np.complex128_t * _M
618
+ cdef np.complex128_t * _M_inf
619
+
620
+ cdef np.complex128_t * _kalman_gain
621
+ cdef np.complex128_t * _loglikelihood
622
+ cdef np.complex128_t * _scale
623
+
624
+ cdef np.complex128_t * _converged_forecast_error_cov
625
+ cdef np.complex128_t * _converged_filtered_state_cov
626
+ cdef np.complex128_t * _converged_predicted_state_cov
627
+ cdef np.complex128_t * _converged_kalman_gain
628
+ cdef np.complex128_t * _converged_M
629
+
630
+ cdef np.complex128_t * _forecast_error_fac
631
+ cdef blas_int * _forecast_error_ipiv
632
+ cdef np.complex128_t * _forecast_error_work
633
+
634
+ cdef np.complex128_t * _tmp0
635
+ cdef np.complex128_t * _tmp00
636
+ cdef np.complex128_t * _tmp1
637
+ cdef np.complex128_t * _tmp2
638
+ cdef np.complex128_t * _tmp3
639
+ cdef np.complex128_t * _tmp4
640
+
641
+ cdef np.complex128_t * _tmpM_inf
642
+ cdef np.complex128_t * _tmpK0
643
+ cdef np.complex128_t * _tmpK1
644
+ cdef np.complex128_t * _tmpL0
645
+ cdef np.complex128_t * _tmpL1
646
+
647
+ # ### Pointers to current-iteration Kalman filtering functions
648
+ cdef int (*forecasting)(
649
+ zKalmanFilter, zStatespace
650
+ )
651
+ cdef np.complex128_t (*inversion)(
652
+ zKalmanFilter, zStatespace, np.complex128_t
653
+ ) except *
654
+ cdef int (*updating)(
655
+ zKalmanFilter, zStatespace
656
+ )
657
+ cdef np.complex128_t (*calculate_loglikelihood)(
658
+ zKalmanFilter, zStatespace, np.complex128_t
659
+ )
660
+ cdef np.complex128_t (*calculate_scale)(
661
+ zKalmanFilter, zStatespace
662
+ )
663
+ cdef int (*prediction)(
664
+ zKalmanFilter, zStatespace
665
+ )
666
+
667
+ # ### Define some constants
668
+ cdef readonly int k_endog, k_states, k_posdef, k_endog2, k_states2, k_posdef2, k_endogstates, k_statesposdef
669
+ cdef readonly int ldwork
670
+
671
+ cdef allocate_arrays(self)
672
+ cdef void set_dimensions(self)
673
+ cpdef set_filter_method(self, int filter_method, int force_reset=*)
674
+ cpdef seek(self, unsigned int t, int reset=*)
675
+
676
+ cdef void initialize_statespace_object_pointers(self) except *
677
+ cdef void initialize_filter_object_pointers(self)
678
+ cdef void initialize_function_pointers(self) except *
679
+ cdef void post_convergence(self)
680
+ cdef void numerical_stability(self)
681
+ cdef int check_diffuse(self)
682
+ cdef void check_convergence(self)
683
+ cdef void migrate_storage(self)
684
+ cdef void _reinitialize_pointers(self) except *
685
+
686
+ cdef void _forecasting(self)
687
+ cdef np.complex128_t _inversion(self)
688
+ cdef void _updating(self)
689
+ cdef np.complex128_t _calculate_loglikelihood(self)
690
+ cdef void _prediction(self)
shared/package-files/33/333dd019f806e7c875bae091f9bf6bfcfbfc2febc0f281f823834de8bea17c2d/user.pyi ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ from typing import Any
2
+
3
+ def __getattr__(name) -> Any: ...
4
+
5
+ home: str
6
+ pythonrc: str
shared/package-files/33/3341413075b40e3eae33a4254813f8c79a78b7c5261c11ef09667a1e846e2cd5/smooth_l1_loss.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/smooth_l1_loss_ops.h>
21
+
22
+ namespace at {
23
+
24
+
25
+ // aten::smooth_l1_loss.out(Tensor self, Tensor target, int reduction=Mean, float beta=1.0, *, Tensor(a!) out) -> Tensor(a!)
26
+ inline at::Tensor & smooth_l1_loss_out(at::Tensor & out, const at::Tensor & self, const at::Tensor & target, int64_t reduction=at::Reduction::Mean, double beta=1.0) {
27
+ return at::_ops::smooth_l1_loss_out::call(self, target, reduction, beta, out);
28
+ }
29
+ // aten::smooth_l1_loss.out(Tensor self, Tensor target, int reduction=Mean, float beta=1.0, *, Tensor(a!) out) -> Tensor(a!)
30
+ inline at::Tensor & smooth_l1_loss_outf(const at::Tensor & self, const at::Tensor & target, int64_t reduction, double beta, at::Tensor & out) {
31
+ return at::_ops::smooth_l1_loss_out::call(self, target, reduction, beta, out);
32
+ }
33
+
34
+ // aten::smooth_l1_loss(Tensor self, Tensor target, int reduction=Mean, float beta=1.0) -> Tensor
35
+ inline at::Tensor smooth_l1_loss(const at::Tensor & self, const at::Tensor & target, int64_t reduction=at::Reduction::Mean, double beta=1.0) {
36
+ return at::_ops::smooth_l1_loss::call(self, target, reduction, beta);
37
+ }
38
+
39
+ }
shared/package-files/33/3342d477dc64280b8dc7afc68ee13945b8b72927a8c79ba88b25e11fc72adb85/plotting.py ADDED
@@ -0,0 +1,494 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from statsmodels.compat.python import lrange
2
+
3
+ import numpy as np
4
+
5
+ from statsmodels.graphics.utils import _import_mpl
6
+ from statsmodels.tsa.vector_ar import util
7
+
8
+
9
+ class MPLConfigurator:
10
+
11
+ def __init__(self):
12
+ self._inverse_actions = []
13
+
14
+ def revert(self):
15
+ for action in self._inverse_actions:
16
+ action()
17
+
18
+ def set_fontsize(self, size):
19
+ import matplotlib as mpl
20
+
21
+ old_size = mpl.rcParams["font.size"]
22
+ mpl.rcParams["font.size"] = size
23
+
24
+ def revert():
25
+ mpl.rcParams["font.size"] = old_size
26
+
27
+ self._inverse_actions.append(revert)
28
+
29
+
30
+ #
31
+ # Plotting functions
32
+ #
33
+ def plot_mts(Y, names=None, index=None):
34
+ """
35
+ Plot multiple time series
36
+
37
+ Parameters
38
+ ----------
39
+ Y : ndarray
40
+ 2-d array of the time series to plot, of shape (nobs, neqs).
41
+ names : sequence of str, optional
42
+ Titles to use for each subplot. If None, subplots are not
43
+ given a title.
44
+ index : array_like, optional
45
+ Values to use for the x-axis of each subplot. If None, uses
46
+ the default integer index.
47
+
48
+ Returns
49
+ -------
50
+ Figure
51
+ The figure containing the grid of time series plots.
52
+ """
53
+ plt = _import_mpl()
54
+
55
+ k = Y.shape[1]
56
+ rows, cols = k, 1
57
+
58
+ fig = plt.figure(figsize=(10, 10))
59
+
60
+ for j in range(k):
61
+ ts = Y[:, j]
62
+
63
+ ax = fig.add_subplot(rows, cols, j + 1)
64
+ if index is not None:
65
+ ax.plot(index, ts)
66
+ else:
67
+ ax.plot(ts)
68
+
69
+ if names is not None:
70
+ ax.set_title(names[j])
71
+
72
+ return fig
73
+
74
+
75
+ def plot_var_forc(
76
+ prior,
77
+ forc,
78
+ err_upper,
79
+ err_lower,
80
+ index=None,
81
+ names=None,
82
+ plot_stderr=True,
83
+ legend_options=None,
84
+ ):
85
+ """
86
+ Plot a forecast against the observed data, with optional error bands
87
+
88
+ Parameters
89
+ ----------
90
+ prior : ndarray
91
+ 2-d array of the observed data prior to the forecast, of shape
92
+ (nobs, neqs).
93
+ forc : ndarray
94
+ 2-d array of forecast values, of shape (steps, neqs).
95
+ err_upper : ndarray
96
+ 2-d array of upper confidence interval bounds for the forecast,
97
+ of shape (steps, neqs).
98
+ err_lower : ndarray
99
+ 2-d array of lower confidence interval bounds for the forecast,
100
+ of shape (steps, neqs).
101
+ index : array_like, optional
102
+ Currently unused.
103
+ names : sequence of str, optional
104
+ Titles to use for each subplot. If None, subplots are not
105
+ given a title.
106
+ plot_stderr : bool, optional
107
+ If True, plot the confidence interval around the forecast.
108
+ legend_options : dict, optional
109
+ Keyword arguments passed to ``ax.legend``. If None, uses
110
+ ``{"loc": "upper right"}``.
111
+
112
+ Returns
113
+ -------
114
+ Figure
115
+ The figure containing the grid of forecast plots.
116
+ """
117
+ plt = _import_mpl()
118
+
119
+ n, k = prior.shape
120
+ rows, cols = k, 1
121
+
122
+ fig = plt.figure(figsize=(10, 10))
123
+
124
+ prange = np.arange(n)
125
+ rng_f = np.arange(n - 1, n + len(forc))
126
+ rng_err = np.arange(n, n + len(forc))
127
+
128
+ for j in range(k):
129
+ ax = plt.subplot(rows, cols, j + 1)
130
+
131
+ ax.plot(prange, prior[:, j], "k", label="Observed")
132
+ ax.plot(rng_f, np.r_[prior[-1:, j], forc[:, j]], "k--", label="Forecast")
133
+
134
+ if plot_stderr:
135
+ ax.plot(rng_err, err_upper[:, j], "k-.", label="Forc 2 STD err")
136
+ ax.plot(rng_err, err_lower[:, j], "k-.")
137
+
138
+ if names is not None:
139
+ ax.set_title(names[j])
140
+
141
+ if legend_options is None:
142
+ legend_options = {"loc": "upper right"}
143
+ ax.legend(**legend_options)
144
+ return fig
145
+
146
+
147
+ def plot_with_error(
148
+ y,
149
+ error,
150
+ x=None,
151
+ axes=None,
152
+ value_fmt="k",
153
+ error_fmt="k--",
154
+ alpha=0.05,
155
+ stderr_type="asym",
156
+ ):
157
+ """
158
+ Make plot with optional error bars
159
+
160
+ Parameters
161
+ ----------
162
+ y : array_like
163
+ The data to plot.
164
+ error : array_like, tuple of array_like, or None
165
+ The error used to plot error bars around `y`. If `stderr_type`
166
+ is "asym", an array the same shape as `y` combined with `alpha`
167
+ to compute the bands. If `stderr_type` is one of "mc", "sz1",
168
+ "sz2", "sz3", a 2-tuple of arrays giving the lower and upper
169
+ bands directly. If None, no error bars are plotted.
170
+ x : array_like, optional
171
+ The x-axis values to use. If None, uses a range the same length
172
+ as `y`.
173
+ axes : AxesSubplot, optional
174
+ Matplotlib axes to plot on. If None, uses the current axes.
175
+ value_fmt : str, optional
176
+ Matplotlib format string used to plot `y`.
177
+ error_fmt : str, optional
178
+ Matplotlib format string used to plot the error bars.
179
+ alpha : float, optional
180
+ The significance level to use when `stderr_type` is "asym".
181
+ stderr_type : {"asym", "mc", "sz1", "sz2", "sz3"}, optional
182
+ The kind of error bars being plotted.
183
+ """
184
+ plt = _import_mpl()
185
+
186
+ if axes is None:
187
+ axes = plt.gca()
188
+
189
+ x = x if x is not None else lrange(len(y))
190
+
191
+ def plot_action(y, fmt):
192
+ return axes.plot(x, y, fmt)
193
+
194
+ plot_action(y, value_fmt)
195
+
196
+ # changed this
197
+ if error is not None:
198
+ if stderr_type == "asym":
199
+ q = util.norm_signif_level(alpha)
200
+ plot_action(y - q * error, error_fmt)
201
+ plot_action(y + q * error, error_fmt)
202
+ if stderr_type in ("mc", "sz1", "sz2", "sz3"):
203
+ plot_action(error[0], error_fmt)
204
+ plot_action(error[1], error_fmt)
205
+
206
+
207
+ def plot_full_acorr(acorr, fontsize=8, linewidth=8, xlabel=None, err_bound=None):
208
+ """
209
+ Plot the autocorrelations of a multivariate time series in a grid
210
+
211
+ Parameters
212
+ ----------
213
+ acorr : ndarray
214
+ Array of autocorrelations, shape (nlags, k, k).
215
+ fontsize : int, optional
216
+ Font size used for the plot labels.
217
+ linewidth : int, optional
218
+ Width of the lines used in the autocorrelation plots.
219
+ xlabel : array_like, optional
220
+ Labels to use for the x-axis of each subplot. If None, uses a
221
+ range the same length as `acorr`.
222
+ err_bound : float, optional
223
+ If provided, draws horizontal reference lines at +/- `err_bound`.
224
+
225
+ Returns
226
+ -------
227
+ Figure
228
+ The figure containing the grid of autocorrelation plots.
229
+ """
230
+ plt = _import_mpl()
231
+
232
+ config = MPLConfigurator()
233
+ config.set_fontsize(fontsize)
234
+
235
+ k = acorr.shape[1]
236
+ fig, axes = plt.subplots(k, k, figsize=(10, 10), squeeze=False)
237
+
238
+ for i in range(k):
239
+ for j in range(k):
240
+ ax = axes[i][j]
241
+ acorr_plot(acorr[:, i, j], linewidth=linewidth, xlabel=xlabel, ax=ax)
242
+
243
+ if err_bound is not None:
244
+ ax.axhline(err_bound, color="k", linestyle="--")
245
+ ax.axhline(-err_bound, color="k", linestyle="--")
246
+
247
+ adjust_subplots()
248
+ config.revert()
249
+
250
+ return fig
251
+
252
+
253
+ def acorr_plot(acorr, linewidth=8, xlabel=None, ax=None):
254
+ """
255
+ Plot a single autocorrelation function as a stem plot
256
+
257
+ Parameters
258
+ ----------
259
+ acorr : array_like
260
+ 1-d array of autocorrelations to plot.
261
+ linewidth : int, optional
262
+ Width of the vertical lines used in the plot.
263
+ xlabel : array_like, optional
264
+ Positions to use for the x-axis. If None, uses a range the
265
+ same length as `acorr`.
266
+ ax : AxesSubplot, optional
267
+ Matplotlib axes to plot on. If None, uses the current axes.
268
+ """
269
+ plt = _import_mpl()
270
+
271
+ if ax is None:
272
+ ax = plt.gca()
273
+
274
+ if xlabel is None:
275
+ xlabel = np.arange(len(acorr))
276
+
277
+ ax.vlines(xlabel, [0], acorr, lw=linewidth)
278
+
279
+ ax.axhline(0, color="k")
280
+ ax.set_ylim([-1, 1])
281
+
282
+ # hack?
283
+ ax.set_xlim([-1, xlabel[-1] + 1])
284
+
285
+
286
+ def plot_acorr_with_error():
287
+ """Not implemented."""
288
+ raise NotImplementedError
289
+
290
+
291
+ def adjust_subplots(**kwds):
292
+ """
293
+ Adjust subplot spacing using defaults suitable for the grid plots
294
+
295
+ Parameters
296
+ ----------
297
+ **kwds
298
+ Keyword arguments passed to ``matplotlib.pyplot.subplots_adjust``,
299
+ overriding the defaults.
300
+ """
301
+ plt = _import_mpl()
302
+
303
+ passed_kwds = {
304
+ "bottom": 0.05,
305
+ "top": 0.925,
306
+ "left": 0.05,
307
+ "right": 0.95,
308
+ "hspace": 0.2,
309
+ }
310
+ passed_kwds.update(kwds)
311
+ plt.subplots_adjust(**passed_kwds)
312
+
313
+
314
+ #
315
+ # Multiple impulse response (cum_effects, etc.) cplots
316
+ #
317
+
318
+
319
+ def irf_grid_plot(
320
+ values,
321
+ stderr,
322
+ impcol,
323
+ rescol,
324
+ names,
325
+ title,
326
+ signif=0.05,
327
+ hlines=None,
328
+ subplot_params=None,
329
+ plot_params=None,
330
+ figsize=(10, 10),
331
+ stderr_type="asym",
332
+ ):
333
+ """
334
+ Reusable function to make flexible grid plots of impulse responses and
335
+ cumulative effects
336
+
337
+ Parameters
338
+ ----------
339
+ values : ndarray
340
+ Array of values to plot, shape (T, k, k).
341
+ stderr : ndarray, tuple of ndarray, or None
342
+ Used to plot error bands around `values`. If `stderr_type` is
343
+ "asym", an array of shape (T, k ** 2, k ** 2) giving the
344
+ covariance matrix of the vectorized values at each period (as
345
+ returned by :meth:`~statsmodels.tsa.vector_ar.irf.IRAnalysis.cov`).
346
+ If `stderr_type` is one of "mc", "sz1", "sz2", "sz3", a 2-tuple
347
+ of arrays of shape (T, k, k) giving the lower and upper error
348
+ bands directly. If None, no error bands are plotted.
349
+ impcol : int, str, or None
350
+ Column of the impulse variable to plot. If None, plots impulses
351
+ from all variables.
352
+ rescol : int, str, or None
353
+ Column of the response variable to plot. If None, plots responses
354
+ of all variables.
355
+ names : sequence of str
356
+ Names of the variables in the system.
357
+ title : str
358
+ Title to use for the figure.
359
+ signif : float, optional
360
+ Significance level used when plotting error bands.
361
+ hlines : ndarray, optional
362
+ Array of horizontal reference lines to draw on each subplot,
363
+ shape (k, k).
364
+ subplot_params : dict, optional
365
+ May contain a "fontsize" key controlling the subplot title font
366
+ size.
367
+ plot_params : dict, optional
368
+ Additional keyword arguments (currently unused).
369
+ figsize : tuple of float, optional
370
+ The size of the figure to create.
371
+ stderr_type : {"asym", "mc", "sz1", "sz2", "sz3"}, optional
372
+ The kind of error bars being plotted.
373
+
374
+ Returns
375
+ -------
376
+ Figure
377
+ The figure containing the grid of impulse response plots.
378
+ """
379
+ plt = _import_mpl()
380
+
381
+ if subplot_params is None:
382
+ subplot_params = {}
383
+ if plot_params is None:
384
+ plot_params = {}
385
+
386
+ nrows, ncols, to_plot = _get_irf_plot_config(names, impcol, rescol)
387
+
388
+ fig, axes = plt.subplots(
389
+ nrows=nrows, ncols=ncols, sharex=True, squeeze=False, figsize=figsize
390
+ )
391
+
392
+ # fill out space
393
+ adjust_subplots()
394
+
395
+ fig.suptitle(title, fontsize=14)
396
+
397
+ subtitle_temp = r"%s$\rightarrow$%s"
398
+
399
+ k = len(names)
400
+
401
+ rng = lrange(len(values))
402
+ for j, i, ai, aj in to_plot:
403
+ ax = axes[ai][aj]
404
+
405
+ # HACK?
406
+ if stderr is not None:
407
+ if stderr_type == "asym":
408
+ sig = np.sqrt(stderr[:, j * k + i, j * k + i])
409
+ plot_with_error(
410
+ values[:, i, j],
411
+ sig,
412
+ x=rng,
413
+ axes=ax,
414
+ alpha=signif,
415
+ value_fmt="b",
416
+ stderr_type=stderr_type,
417
+ )
418
+ if stderr_type in ("mc", "sz1", "sz2", "sz3"):
419
+ errs = stderr[0][:, i, j], stderr[1][:, i, j]
420
+ plot_with_error(
421
+ values[:, i, j],
422
+ errs,
423
+ x=rng,
424
+ axes=ax,
425
+ alpha=signif,
426
+ value_fmt="b",
427
+ stderr_type=stderr_type,
428
+ )
429
+ else:
430
+ plot_with_error(values[:, i, j], None, x=rng, axes=ax, value_fmt="b")
431
+
432
+ ax.axhline(0, color="k")
433
+
434
+ if hlines is not None:
435
+ ax.axhline(hlines[i, j], color="k")
436
+
437
+ sz = subplot_params.get("fontsize", 12)
438
+ ax.set_title(subtitle_temp % (names[j], names[i]), fontsize=sz)
439
+
440
+ return fig
441
+
442
+
443
+ def _get_irf_plot_config(names, impcol, rescol):
444
+ """
445
+ Determine the subplot grid layout for `irf_grid_plot`
446
+
447
+ Parameters
448
+ ----------
449
+ names : sequence of str
450
+ Names of the variables in the system.
451
+ impcol : int, str, or None
452
+ Column of the impulse variable to plot. If None, plots impulses
453
+ from all variables.
454
+ rescol : int, str, or None
455
+ Column of the response variable to plot. If None, plots responses
456
+ of all variables.
457
+
458
+ Returns
459
+ -------
460
+ nrows : int
461
+ Number of subplot rows.
462
+ ncols : int
463
+ Number of subplot columns.
464
+ to_plot : list of tuple
465
+ Each tuple is ``(j, i, ai, aj)`` giving the impulse index `j`,
466
+ response index `i`, and the subplot grid position (`ai`, `aj`)
467
+ to plot it at.
468
+ """
469
+ nrows = ncols = k = len(names)
470
+ if impcol is not None and rescol is not None:
471
+ # plot one impulse-response pair
472
+ nrows = ncols = 1
473
+ j = util.get_index(names, impcol)
474
+ i = util.get_index(names, rescol)
475
+ to_plot = [(j, i, 0, 0)]
476
+ elif impcol is not None:
477
+ # plot impacts of impulse in one variable
478
+ ncols = 1
479
+ j = util.get_index(names, impcol)
480
+ to_plot = [(j, i, i, 0) for i in range(k)]
481
+ elif rescol is not None:
482
+ # plot only things having impact on particular variable
483
+ ncols = 1
484
+ i = util.get_index(names, rescol)
485
+ to_plot = [(j, i, j, 0) for j in range(k)]
486
+ else:
487
+ # plot everything
488
+ to_plot = [(j, i, i, j) for i in range(k) for j in range(k)]
489
+
490
+ return nrows, ncols, to_plot
491
+
492
+
493
+ #
494
+ # Forecast error variance decomposition
shared/package-files/33/3343d3b7c20e21c557a903d67b6379d2c9b812ad9ba1d457578564774f1cad79/mutable_ndim_array.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from sympy.tensor.array.ndim_array import NDimArray
2
+
3
+
4
+ class MutableNDimArray(NDimArray):
5
+
6
+ def as_immutable(self):
7
+ raise NotImplementedError("abstract method")
8
+
9
+ def as_mutable(self):
10
+ return self
11
+
12
+ def _sympy_(self):
13
+ return self.as_immutable()
shared/package-files/33/3344af465d1c008f91cb7852e15960800d16bacb2f764ad8e12e5327aceddb5a/css_parser.py ADDED
@@ -0,0 +1,1280 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """CSS selector parser."""
2
+ from __future__ import annotations
3
+ import re
4
+ from functools import lru_cache
5
+ from . import util
6
+ from . import css_match as cm
7
+ from . import css_types as ct
8
+ from .util import SelectorSyntaxError
9
+ import warnings
10
+ from typing import Match, Any, Iterator, cast
11
+
12
+ UNICODE_REPLACEMENT_CHAR = 0xFFFD
13
+
14
+ # Simple pseudo classes that take no parameters
15
+ PSEUDO_SIMPLE = {
16
+ ":any-link",
17
+ ":empty",
18
+ ":first-child",
19
+ ":first-of-type",
20
+ ":in-range",
21
+ ":out-of-range",
22
+ ":last-child",
23
+ ":last-of-type",
24
+ ":link",
25
+ ":only-child",
26
+ ":only-of-type",
27
+ ":root",
28
+ ':checked',
29
+ ':default',
30
+ ':disabled',
31
+ ':enabled',
32
+ ':indeterminate',
33
+ ':optional',
34
+ ':placeholder-shown',
35
+ ':read-only',
36
+ ':read-write',
37
+ ':required',
38
+ ':scope',
39
+ ':defined'
40
+ }
41
+
42
+ # Supported, simple pseudo classes that match nothing in the Soup Sieve environment
43
+ PSEUDO_SIMPLE_NO_MATCH = {
44
+ ':active',
45
+ ':current',
46
+ ':focus',
47
+ ':focus-visible',
48
+ ':focus-within',
49
+ ':future',
50
+ ':host',
51
+ ':hover',
52
+ ':local-link',
53
+ ':past',
54
+ ':paused',
55
+ ':playing',
56
+ ':target',
57
+ ':target-within',
58
+ ':user-invalid',
59
+ ':visited'
60
+ }
61
+
62
+ # Complex pseudo classes that take selector lists
63
+ PSEUDO_COMPLEX = {
64
+ ':contains',
65
+ ':-soup-contains',
66
+ ':-soup-contains-own',
67
+ ':has',
68
+ ':is',
69
+ ':matches',
70
+ ':not',
71
+ ':where'
72
+ }
73
+
74
+ PSEUDO_COMPLEX_NO_MATCH = {
75
+ ':current',
76
+ ':host',
77
+ ':host-context'
78
+ }
79
+
80
+ # Complex pseudo classes that take very specific parameters and are handled special
81
+ PSEUDO_SPECIAL = {
82
+ ':dir',
83
+ ':lang',
84
+ ':nth-child',
85
+ ':nth-last-child',
86
+ ':nth-last-of-type',
87
+ ':nth-of-type'
88
+ }
89
+
90
+ PSEUDO_SUPPORTED = PSEUDO_SIMPLE | PSEUDO_SIMPLE_NO_MATCH | PSEUDO_COMPLEX | PSEUDO_COMPLEX_NO_MATCH | PSEUDO_SPECIAL
91
+
92
+ # Sub-patterns parts
93
+ # Whitespace
94
+ NEWLINE = r'(?:\r\n|(?!\r\n)[\n\f\r])'
95
+ WS = fr'(?:[ \t]|{NEWLINE})'
96
+ # Comments
97
+ COMMENTS = r'(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)'
98
+ # Whitespace with comments included
99
+ WSC = fr'(?:{WS}|{COMMENTS})'
100
+ # CSS escapes
101
+ CSS_ESCAPES = fr'(?:\\(?:[a-f0-9]{{1,6}}{WS}?|[^\r\n\f]|$))'
102
+ CSS_STRING_ESCAPES = fr'(?:\\(?:[a-f0-9]{{1,6}}{WS}?|[^\r\n\f]|$|{NEWLINE}))'
103
+ # CSS Identifier
104
+ IDENTIFIER = fr'''
105
+ (?:(?:-?(?:[^\x00-\x2f\x30-\x40\x5B-\x5E\x60\x7B-\x9f]|{CSS_ESCAPES})+|--)
106
+ (?:[^\x00-\x2c\x2e\x2f\x3A-\x40\x5B-\x5E\x60\x7B-\x9f]|{CSS_ESCAPES})*)
107
+ '''
108
+ # `nth` content
109
+ NTH = fr'(?:[-+])?(?:[0-9]+n?|n)(?:(?<=n){WSC}*(?:[-+]){WSC}*(?:[0-9]+))?'
110
+ # Value: quoted string or identifier
111
+ VALUE = fr'''(?:"(?:\\(?:.|{NEWLINE})|[^\\"\r\n\f]+)*?"|'(?:\\(?:.|{NEWLINE})|[^\\'\r\n\f]+)*?'|{IDENTIFIER}+)'''
112
+ # Attribute value comparison. `!=` is handled special as it is non-standard.
113
+ ATTR = fr'(?:{WSC}*(?P<cmp>[!~^|*$]?=){WSC}*(?P<value>{VALUE})(?:{WSC}*(?P<case>[is]))?)?{WSC}*\]'
114
+
115
+ # Selector patterns
116
+ # IDs (`#id`)
117
+ PAT_ID = fr'\#{IDENTIFIER}'
118
+ # Classes (`.class`)
119
+ PAT_CLASS = fr'\.{IDENTIFIER}'
120
+ # Prefix:Tag (`prefix|tag`)
121
+ PAT_TAG = fr'(?P<tag_ns>(?:{IDENTIFIER}|\*)?\|)?(?P<tag_name>{IDENTIFIER}|\*)'
122
+ # Attributes (`[attr]`, `[attr=value]`, etc.)
123
+ PAT_ATTR = fr'\[{WSC}*(?P<attr_ns>(?:{IDENTIFIER}|\*)?\|)?(?P<attr_name>{IDENTIFIER}){ATTR}'
124
+ # Pseudo class (`:pseudo-class`, `:pseudo-class(`)
125
+ PAT_PSEUDO_CLASS = fr'(?P<name>:{IDENTIFIER})(?P<open>\({WSC}*)?'
126
+ # Pseudo class special patterns. Matches `:pseudo-class(` for special case pseudo classes.
127
+ PAT_PSEUDO_CLASS_SPECIAL = fr'(?P<name>:{IDENTIFIER})(?P<open>\({WSC}*)'
128
+ # Custom pseudo class (`:--custom-pseudo`)
129
+ PAT_PSEUDO_CLASS_CUSTOM = fr'(?P<name>:(?=--){IDENTIFIER})'
130
+ # Closing pseudo group (`)`)
131
+ PAT_PSEUDO_CLOSE = fr'{WSC}*\)'
132
+ # Pseudo element (`::pseudo-element`)
133
+ PAT_PSEUDO_ELEMENT = fr':{PAT_PSEUDO_CLASS}'
134
+ # At rule (`@page`, etc.) (not supported)
135
+ PAT_AT_RULE = fr'@P{IDENTIFIER}'
136
+ # Pseudo class `nth-child` (`:nth-child(an+b [of S]?)`, `:first-child`, etc.)
137
+ PAT_PSEUDO_NTH_CHILD = fr'''
138
+ (?P<pseudo_nth_child>{PAT_PSEUDO_CLASS_SPECIAL}
139
+ (?P<nth_child>{NTH}|even|odd))(?:{WSC}*\)|(?P<of>{COMMENTS}*{WS}{WSC}*of{COMMENTS}*{WS}{WSC}*))
140
+ '''
141
+ # Pseudo class `nth-of-type` (`:nth-of-type(an+b)`, `:first-of-type`, etc.)
142
+ PAT_PSEUDO_NTH_TYPE = fr'''
143
+ (?P<pseudo_nth_type>{PAT_PSEUDO_CLASS_SPECIAL}
144
+ (?P<nth_type>{NTH}|even|odd)){WSC}*\)
145
+ '''
146
+ # Pseudo class language (`:lang("*-de", en)`)
147
+ PAT_PSEUDO_LANG = fr'{PAT_PSEUDO_CLASS_SPECIAL}(?P<values>{VALUE}(?:{WSC}*,{WSC}*{VALUE})*){WSC}*\)'
148
+ # Pseudo class direction (`:dir(ltr)`)
149
+ PAT_PSEUDO_DIR = fr'{PAT_PSEUDO_CLASS_SPECIAL}(?P<dir>ltr|rtl){WSC}*\)'
150
+ # Combining characters (`>`, `~`, ` `, `+`, `,`)
151
+ PAT_COMBINE = fr'{WSC}*?(?P<relation>[,+>~]|{WS}(?![,+>~])){WSC}*'
152
+ # Extra: Contains (`:contains(text)`)
153
+ PAT_PSEUDO_CONTAINS = fr'{PAT_PSEUDO_CLASS_SPECIAL}(?P<values>{VALUE}(?:{WSC}*,{WSC}*{VALUE})*){WSC}*\)'
154
+
155
+ # Regular expressions
156
+ # CSS escape pattern
157
+ RE_CSS_ESC = re.compile(fr'(?:(\\[a-f0-9]{{1,6}}{WSC}?)|(\\[^\r\n\f])|(\\$))', re.I)
158
+ RE_CSS_STR_ESC = re.compile(fr'(?:(\\[a-f0-9]{{1,6}}{WS}?)|(\\[^\r\n\f])|(\\$)|(\\{NEWLINE}))', re.I)
159
+ # Pattern to break up `nth` specifiers
160
+ RE_NTH = re.compile(fr'(?P<s1>[-+])?(?P<a>[0-9]+n?|n)(?:(?<=n){WSC}*(?P<s2>[-+]){WSC}*(?P<b>[0-9]+))?', re.I)
161
+ # Pattern to iterate multiple values.
162
+ RE_VALUES = re.compile(fr'(?:(?P<value>{VALUE})|(?P<split>{WSC}*,{WSC}*))', re.X)
163
+ # Whitespace checks
164
+ RE_WS = re.compile(WS)
165
+ RE_WS_BEGIN = re.compile(fr'^{WSC}*')
166
+ RE_WS_END = re.compile(fr'{WSC}*$')
167
+ RE_CUSTOM = re.compile(fr'^{PAT_PSEUDO_CLASS_CUSTOM}$', re.X)
168
+
169
+ # Constants
170
+ # List split token
171
+ COMMA_COMBINATOR = ','
172
+ # Relation token for descendant
173
+ WS_COMBINATOR = " "
174
+
175
+ # Parse flags
176
+ FLG_PSEUDO = 0x01
177
+ FLG_NOT = 0x02
178
+ FLG_RELATIVE = 0x04
179
+ FLG_DEFAULT = 0x08
180
+ FLG_HTML = 0x10
181
+ FLG_INDETERMINATE = 0x20
182
+ FLG_OPEN = 0x40
183
+ FLG_IN_RANGE = 0x80
184
+ FLG_OUT_OF_RANGE = 0x100
185
+ FLG_PLACEHOLDER_SHOWN = 0x200
186
+ FLG_FORGIVE = 0x400
187
+
188
+ # Maximum cached patterns to store
189
+ _MAXCACHE = 500
190
+
191
+
192
+ @lru_cache(maxsize=_MAXCACHE)
193
+ def _cached_css_compile(
194
+ pattern: str,
195
+ namespaces: ct.Namespaces | None,
196
+ custom: ct.CustomSelectors | None,
197
+ flags: int
198
+ ) -> cm.SoupSieve:
199
+ """Cached CSS compile."""
200
+
201
+ custom_selectors = process_custom(custom)
202
+ return cm.SoupSieve(
203
+ pattern,
204
+ CSSParser(
205
+ pattern,
206
+ custom=custom_selectors,
207
+ flags=flags
208
+ ).process_selectors(),
209
+ namespaces,
210
+ custom,
211
+ flags
212
+ )
213
+
214
+
215
+ def _purge_cache() -> None:
216
+ """Purge the cache."""
217
+
218
+ _cached_css_compile.cache_clear()
219
+
220
+
221
+ def process_custom(custom: ct.CustomSelectors | None) -> dict[str, str | ct.SelectorList]:
222
+ """Process custom."""
223
+
224
+ custom_selectors = {}
225
+ if custom is not None:
226
+ for key, value in custom.items():
227
+ name = util.lower(key)
228
+ if RE_CUSTOM.match(name) is None:
229
+ raise SelectorSyntaxError(f"The name '{name}' is not a valid custom pseudo-class name")
230
+ if name in custom_selectors:
231
+ raise KeyError(f"The custom selector '{name}' has already been registered")
232
+ custom_selectors[css_unescape(name)] = value
233
+ return custom_selectors
234
+
235
+
236
+ def css_unescape(content: str, string: bool = False) -> str:
237
+ """
238
+ Unescape CSS value.
239
+
240
+ Strings allow for spanning the value on multiple strings by escaping a new line.
241
+ """
242
+
243
+ def replace(m: Match[str]) -> str:
244
+ """Replace with the appropriate substitute."""
245
+
246
+ if m.group(1):
247
+ codepoint = int(m.group(1)[1:], 16)
248
+ if codepoint == 0:
249
+ codepoint = UNICODE_REPLACEMENT_CHAR
250
+ value = chr(codepoint)
251
+ elif m.group(2):
252
+ value = m.group(2)[1:]
253
+ elif m.group(3):
254
+ value = '\ufffd'
255
+ else:
256
+ value = ''
257
+
258
+ return value
259
+
260
+ return (RE_CSS_ESC if not string else RE_CSS_STR_ESC).sub(replace, content)
261
+
262
+
263
+ def escape(ident: str) -> str:
264
+ """Escape identifier."""
265
+
266
+ string = []
267
+ length = len(ident)
268
+ start_dash = length > 0 and ident[0] == '-'
269
+ if length == 1 and start_dash:
270
+ # Need to escape identifier that is a single `-` with no other characters
271
+ string.append(f'\\{ident}')
272
+ else:
273
+ for index, c in enumerate(ident):
274
+ codepoint = ord(c)
275
+ if codepoint == 0x00:
276
+ string.append('\ufffd')
277
+ elif (0x01 <= codepoint <= 0x1F) or codepoint == 0x7F:
278
+ string.append(f'\\{codepoint:x} ')
279
+ elif (index == 0 or (start_dash and index == 1)) and (0x30 <= codepoint <= 0x39):
280
+ string.append(f'\\{codepoint:x} ')
281
+ elif (
282
+ codepoint in (0x2D, 0x5F) or codepoint >= 0x80 or (0x30 <= codepoint <= 0x39) or
283
+ (0x30 <= codepoint <= 0x39) or (0x41 <= codepoint <= 0x5A) or (0x61 <= codepoint <= 0x7A)
284
+ ):
285
+ string.append(c)
286
+ else:
287
+ string.append(f'\\{c}')
288
+ return ''.join(string)
289
+
290
+
291
+ class SelectorPattern:
292
+ """Selector pattern."""
293
+
294
+ def __init__(self, name: str, pattern: str) -> None:
295
+ """Initialize."""
296
+
297
+ self.name = name
298
+ self.re_pattern = re.compile(pattern, re.I | re.X | re.U)
299
+
300
+ def get_name(self) -> str:
301
+ """Get name."""
302
+
303
+ return self.name
304
+
305
+ def match(self, selector: str, index: int, flags: int) -> Match[str] | None:
306
+ """Match the selector."""
307
+
308
+ return self.re_pattern.match(selector, index)
309
+
310
+
311
+ class SpecialPseudoPattern(SelectorPattern):
312
+ """Selector pattern."""
313
+
314
+ def __init__(self, patterns: tuple[tuple[str, tuple[str, ...], str, type[SelectorPattern]], ...]) -> None:
315
+ """Initialize."""
316
+
317
+ self.patterns = {}
318
+ for p in patterns:
319
+ name = p[0]
320
+ pattern = p[3](name, p[2])
321
+ for pseudo in p[1]:
322
+ self.patterns[pseudo] = pattern
323
+
324
+ self.matched_name = None # type: SelectorPattern | None
325
+ self.re_pseudo_name = re.compile(PAT_PSEUDO_CLASS_SPECIAL, re.I | re.X | re.U)
326
+
327
+ def get_name(self) -> str:
328
+ """Get name."""
329
+
330
+ return '' if self.matched_name is None else self.matched_name.get_name()
331
+
332
+ def match(self, selector: str, index: int, flags: int) -> Match[str] | None:
333
+ """Match the selector."""
334
+
335
+ pseudo = None
336
+ m = self.re_pseudo_name.match(selector, index)
337
+ if m:
338
+ name = util.lower(css_unescape(m.group('name')))
339
+ pattern = self.patterns.get(name)
340
+ if pattern:
341
+ pseudo = pattern.match(selector, index, flags)
342
+ if pseudo:
343
+ self.matched_name = pattern
344
+
345
+ return pseudo
346
+
347
+
348
+ class _Selector:
349
+ """
350
+ Intermediate selector class.
351
+
352
+ This stores selector data for a compound selector as we are acquiring them.
353
+ Once we are done collecting the data for a compound selector, we freeze
354
+ the data in an object that can be pickled and hashed.
355
+ """
356
+
357
+ def __init__(self, **kwargs: Any) -> None:
358
+ """Initialize."""
359
+
360
+ self.tag = kwargs.get('tag', None) # type: ct.SelectorTag | None
361
+ self.ids = kwargs.get('ids', []) # type: list[str]
362
+ self.classes = kwargs.get('classes', []) # type: list[str]
363
+ self.attributes = kwargs.get('attributes', []) # type: list[ct.SelectorAttribute]
364
+ self.nth = kwargs.get('nth', []) # type: list[ct.SelectorNth]
365
+ self.selectors = kwargs.get('selectors', []) # type: list[ct.SelectorList]
366
+ self.relations = kwargs.get('relations', []) # type: list[_Selector]
367
+ self.rel_type = kwargs.get('rel_type', None) # type: str | None
368
+ self.contains = kwargs.get('contains', []) # type: list[ct.SelectorContains]
369
+ self.lang = kwargs.get('lang', []) # type: list[ct.SelectorLang]
370
+ self.flags = kwargs.get('flags', 0) # type: int
371
+ self.no_match = kwargs.get('no_match', False) # type: bool
372
+
373
+ def _freeze_relations(self, relations: list[_Selector]) -> ct.SelectorList:
374
+ """Freeze relation."""
375
+
376
+ if relations:
377
+ sel = relations[0]
378
+ sel.relations.extend(relations[1:])
379
+ return ct.SelectorList([sel.freeze()])
380
+ else:
381
+ return ct.SelectorList()
382
+
383
+ def freeze(self) -> ct.Selector | ct.SelectorNull:
384
+ """Freeze self."""
385
+
386
+ if self.no_match:
387
+ return ct.SelectorNull()
388
+ else:
389
+ return ct.Selector(
390
+ self.tag,
391
+ tuple(self.ids),
392
+ tuple(self.classes),
393
+ tuple(self.attributes),
394
+ tuple(self.nth),
395
+ tuple(self.selectors),
396
+ self._freeze_relations(self.relations),
397
+ self.rel_type,
398
+ tuple(self.contains),
399
+ tuple(self.lang),
400
+ self.flags
401
+ )
402
+
403
+ def __str__(self) -> str: # pragma: no cover
404
+ """String representation."""
405
+
406
+ return (
407
+ f'_Selector(tag={self.tag!r}, ids={self.ids!r}, classes={self.classes!r}, attributes={self.attributes!r}, '
408
+ f'nth={self.nth!r}, selectors={self.selectors!r}, relations={self.relations!r}, '
409
+ f'rel_type={self.rel_type!r}, contains={self.contains!r}, lang={self.lang!r}, flags={self.flags!r}, '
410
+ f'no_match={self.no_match!r})'
411
+ )
412
+
413
+ __repr__ = __str__
414
+
415
+
416
+ class CSSParser:
417
+ """Parse CSS selectors."""
418
+
419
+ css_tokens = (
420
+ SelectorPattern("pseudo_close", PAT_PSEUDO_CLOSE),
421
+ SpecialPseudoPattern(
422
+ (
423
+ (
424
+ "pseudo_contains",
425
+ (':contains', ':-soup-contains', ':-soup-contains-own'),
426
+ PAT_PSEUDO_CONTAINS,
427
+ SelectorPattern
428
+ ),
429
+ ("pseudo_nth_child", (':nth-child', ':nth-last-child'), PAT_PSEUDO_NTH_CHILD, SelectorPattern),
430
+ ("pseudo_nth_type", (':nth-of-type', ':nth-last-of-type'), PAT_PSEUDO_NTH_TYPE, SelectorPattern),
431
+ ("pseudo_lang", (':lang',), PAT_PSEUDO_LANG, SelectorPattern),
432
+ ("pseudo_dir", (':dir',), PAT_PSEUDO_DIR, SelectorPattern)
433
+ )
434
+ ),
435
+ SelectorPattern("pseudo_class_custom", PAT_PSEUDO_CLASS_CUSTOM),
436
+ SelectorPattern("pseudo_class", PAT_PSEUDO_CLASS),
437
+ SelectorPattern("pseudo_element", PAT_PSEUDO_ELEMENT),
438
+ SelectorPattern("at_rule", PAT_AT_RULE),
439
+ SelectorPattern("id", PAT_ID),
440
+ SelectorPattern("class", PAT_CLASS),
441
+ SelectorPattern("tag", PAT_TAG),
442
+ SelectorPattern("attribute", PAT_ATTR),
443
+ SelectorPattern("combine", PAT_COMBINE)
444
+ )
445
+
446
+ def __init__(
447
+ self,
448
+ selector: str,
449
+ custom: dict[str, str | ct.SelectorList] | None = None,
450
+ flags: int = 0
451
+ ) -> None:
452
+ """Initialize."""
453
+
454
+ self.pattern = selector.replace('\x00', '\ufffd')
455
+ self.flags = flags
456
+ self.debug = self.flags & util.DEBUG
457
+ self.custom = {} if custom is None else custom
458
+
459
+ def parse_attribute_selector(self, sel: _Selector, m: Match[str], has_selector: bool) -> bool:
460
+ """Create attribute selector from the returned regex match."""
461
+
462
+ inverse = False
463
+ op = m.group('cmp')
464
+ case = util.lower(m.group('case')) if m.group('case') else None
465
+ ns = css_unescape(m.group('attr_ns')[:-1]) if m.group('attr_ns') else ''
466
+ attr = css_unescape(m.group('attr_name'))
467
+ is_type = False
468
+ pattern2 = None
469
+ value = ''
470
+
471
+ if case:
472
+ flags = (re.I if case == 'i' else 0) | re.DOTALL
473
+ elif util.lower(attr) == 'type':
474
+ flags = re.I | re.DOTALL
475
+ is_type = True
476
+ else:
477
+ flags = re.DOTALL
478
+
479
+ if op:
480
+ if m.group('value').startswith(('"', "'")):
481
+ value = css_unescape(m.group('value')[1:-1], True)
482
+ else:
483
+ value = css_unescape(m.group('value'))
484
+
485
+ if not op:
486
+ # Attribute name
487
+ pattern = None
488
+ elif op.startswith('^'):
489
+ # Value start with
490
+ pattern = re.compile(r'^%s.*' % re.escape(value), flags)
491
+ elif op.startswith('$'):
492
+ # Value ends with
493
+ pattern = re.compile(r'.*?%s$' % re.escape(value), flags)
494
+ elif op.startswith('*'):
495
+ # Value contains
496
+ pattern = re.compile(r'.*?%s.*' % re.escape(value), flags)
497
+ elif op.startswith('~'):
498
+ # Value contains word within space separated list
499
+ # `~=` should match nothing if it is empty or contains whitespace,
500
+ # so if either of these cases is present, use `[^\s\S]` which cannot be matched.
501
+ value = r'[^\s\S]' if not value or RE_WS.search(value) else re.escape(value)
502
+ pattern = re.compile(r'.*?(?:(?<=^)|(?<=[ \t\r\n\f]))%s(?=(?:[ \t\r\n\f]|$)).*' % value, flags)
503
+ elif op.startswith('|'):
504
+ # Value starts with word in dash separated list
505
+ pattern = re.compile(r'^%s(?:-.*)?$' % re.escape(value), flags)
506
+ else:
507
+ # Value matches
508
+ pattern = re.compile(r'^%s$' % re.escape(value), flags)
509
+ if op.startswith('!'):
510
+ # Equivalent to `:not([attr=value])`
511
+ inverse = True
512
+ if is_type and pattern:
513
+ pattern2 = re.compile(pattern.pattern)
514
+
515
+ # Append the attribute selector
516
+ sel_attr = ct.SelectorAttribute(attr, ns, pattern, pattern2)
517
+ if inverse:
518
+ # If we are using `!=`, we need to nest the pattern under a `:not()`.
519
+ sub_sel = _Selector()
520
+ sub_sel.attributes.append(sel_attr)
521
+ not_list = ct.SelectorList([sub_sel.freeze()], True, False)
522
+ sel.selectors.append(not_list)
523
+ else:
524
+ sel.attributes.append(sel_attr)
525
+
526
+ has_selector = True
527
+ return has_selector
528
+
529
+ def parse_tag_pattern(self, sel: _Selector, m: Match[str], has_selector: bool) -> bool:
530
+ """Parse tag pattern from regex match."""
531
+
532
+ prefix = css_unescape(m.group('tag_ns')[:-1]) if m.group('tag_ns') else None
533
+ tag = css_unescape(m.group('tag_name'))
534
+ sel.tag = ct.SelectorTag(tag, prefix)
535
+ has_selector = True
536
+ return has_selector
537
+
538
+ def parse_pseudo_class_custom(self, sel: _Selector, m: Match[str], has_selector: bool) -> bool:
539
+ """
540
+ Parse custom pseudo class alias.
541
+
542
+ Compile custom selectors as we need them. When compiling a custom selector,
543
+ set it to `None` in the dictionary so we can avoid an infinite loop.
544
+ """
545
+
546
+ pseudo = util.lower(css_unescape(m.group('name')))
547
+ selector = self.custom.get(pseudo)
548
+ if selector is None:
549
+ raise SelectorSyntaxError(
550
+ f"Undefined custom selector '{pseudo}' found at position {m.end(0)}",
551
+ self.pattern,
552
+ m.end(0)
553
+ )
554
+
555
+ if not isinstance(selector, ct.SelectorList):
556
+ del self.custom[pseudo]
557
+ selector = CSSParser(
558
+ selector, custom=self.custom, flags=self.flags
559
+ ).process_selectors(flags=FLG_PSEUDO)
560
+ self.custom[pseudo] = selector
561
+
562
+ sel.selectors.append(selector)
563
+ has_selector = True
564
+ return has_selector
565
+
566
+ def parse_pseudo_class(
567
+ self,
568
+ sel: _Selector,
569
+ m: Match[str],
570
+ has_selector: bool,
571
+ iselector: Iterator[tuple[str, Match[str]]],
572
+ is_html: bool
573
+ ) -> tuple[bool, bool]:
574
+ """Parse pseudo class."""
575
+
576
+ complex_pseudo = False
577
+ pseudo = util.lower(css_unescape(m.group('name')))
578
+ if m.group('open'):
579
+ complex_pseudo = True
580
+ if complex_pseudo and pseudo in PSEUDO_COMPLEX:
581
+ has_selector = self.parse_pseudo_open(sel, pseudo, has_selector, iselector, m.end(0))
582
+ elif not complex_pseudo and pseudo in PSEUDO_SIMPLE:
583
+ if pseudo == ':root':
584
+ sel.flags |= ct.SEL_ROOT
585
+ elif pseudo == ':defined':
586
+ sel.flags |= ct.SEL_DEFINED
587
+ is_html = True
588
+ elif pseudo == ':scope':
589
+ sel.flags |= ct.SEL_SCOPE
590
+ elif pseudo == ':empty':
591
+ sel.flags |= ct.SEL_EMPTY
592
+ elif pseudo in (':link', ':any-link'):
593
+ sel.selectors.append(CSS_LINK)
594
+ elif pseudo == ':checked':
595
+ sel.selectors.append(CSS_CHECKED)
596
+ elif pseudo == ':default':
597
+ sel.selectors.append(CSS_DEFAULT)
598
+ elif pseudo == ':indeterminate':
599
+ sel.selectors.append(CSS_INDETERMINATE)
600
+ elif pseudo == ":disabled":
601
+ sel.selectors.append(CSS_DISABLED)
602
+ elif pseudo == ":enabled":
603
+ sel.selectors.append(CSS_ENABLED)
604
+ elif pseudo == ":required":
605
+ sel.selectors.append(CSS_REQUIRED)
606
+ elif pseudo == ":optional":
607
+ sel.selectors.append(CSS_OPTIONAL)
608
+ elif pseudo == ":read-only":
609
+ sel.selectors.append(CSS_READ_ONLY)
610
+ elif pseudo == ":read-write":
611
+ sel.selectors.append(CSS_READ_WRITE)
612
+ elif pseudo == ":in-range":
613
+ sel.selectors.append(CSS_IN_RANGE)
614
+ elif pseudo == ":out-of-range":
615
+ sel.selectors.append(CSS_OUT_OF_RANGE)
616
+ elif pseudo == ":placeholder-shown":
617
+ sel.selectors.append(CSS_PLACEHOLDER_SHOWN)
618
+ elif pseudo == ':first-child':
619
+ sel.nth.append(ct.SelectorNth(1, False, 0, False, False, ct.SelectorList()))
620
+ elif pseudo == ':last-child':
621
+ sel.nth.append(ct.SelectorNth(1, False, 0, False, True, ct.SelectorList()))
622
+ elif pseudo == ':first-of-type':
623
+ sel.nth.append(ct.SelectorNth(1, False, 0, True, False, ct.SelectorList()))
624
+ elif pseudo == ':last-of-type':
625
+ sel.nth.append(ct.SelectorNth(1, False, 0, True, True, ct.SelectorList()))
626
+ elif pseudo == ':only-child':
627
+ sel.nth.extend(
628
+ [
629
+ ct.SelectorNth(1, False, 0, False, False, ct.SelectorList()),
630
+ ct.SelectorNth(1, False, 0, False, True, ct.SelectorList())
631
+ ]
632
+ )
633
+ elif pseudo == ':only-of-type':
634
+ sel.nth.extend(
635
+ [
636
+ ct.SelectorNth(1, False, 0, True, False, ct.SelectorList()),
637
+ ct.SelectorNth(1, False, 0, True, True, ct.SelectorList())
638
+ ]
639
+ )
640
+ has_selector = True
641
+ elif complex_pseudo and pseudo in PSEUDO_COMPLEX_NO_MATCH:
642
+ self.parse_selectors(iselector, m.end(0), FLG_PSEUDO | FLG_OPEN)
643
+ sel.no_match = True
644
+ has_selector = True
645
+ elif not complex_pseudo and pseudo in PSEUDO_SIMPLE_NO_MATCH:
646
+ sel.no_match = True
647
+ has_selector = True
648
+ elif pseudo in PSEUDO_SUPPORTED:
649
+ raise SelectorSyntaxError(
650
+ f"Invalid syntax for pseudo class '{pseudo}'",
651
+ self.pattern,
652
+ m.start(0)
653
+ )
654
+ else:
655
+ raise NotImplementedError(
656
+ f"'{pseudo}' pseudo-class is not implemented at this time"
657
+ )
658
+
659
+ return has_selector, is_html
660
+
661
+ def parse_pseudo_nth(
662
+ self,
663
+ sel: _Selector,
664
+ m: Match[str],
665
+ has_selector: bool,
666
+ iselector: Iterator[tuple[str, Match[str]]]
667
+ ) -> bool:
668
+ """Parse `nth` pseudo."""
669
+
670
+ mdict = m.groupdict()
671
+ if mdict.get('pseudo_nth_child'):
672
+ postfix = '_child'
673
+ else:
674
+ postfix = '_type'
675
+ mdict['name'] = util.lower(css_unescape(mdict['name']))
676
+ content = util.lower(mdict.get('nth' + postfix))
677
+ if content == 'even':
678
+ # 2n
679
+ s1 = 2
680
+ s2 = 0
681
+ var = True
682
+ elif content == 'odd':
683
+ # 2n+1
684
+ s1 = 2
685
+ s2 = 1
686
+ var = True
687
+ else:
688
+ nth_parts = cast(Match[str], RE_NTH.match(content))
689
+ _s1 = '-' if nth_parts.group('s1') and nth_parts.group('s1') == '-' else ''
690
+ a = nth_parts.group('a')
691
+ var = a.endswith('n')
692
+ if a.startswith('n'):
693
+ _s1 += '1'
694
+ elif var:
695
+ _s1 += a[:-1]
696
+ else:
697
+ _s1 += a
698
+ _s2 = '-' if nth_parts.group('s2') and nth_parts.group('s2') == '-' else ''
699
+ if nth_parts.group('b'):
700
+ _s2 += nth_parts.group('b')
701
+ else:
702
+ _s2 = '0'
703
+ s1 = int(_s1, 10)
704
+ s2 = int(_s2, 10)
705
+
706
+ pseudo_sel = mdict['name']
707
+ if postfix == '_child':
708
+ if m.group('of'):
709
+ # Parse the rest of `of S`.
710
+ nth_sel = self.parse_selectors(iselector, m.end(0), FLG_PSEUDO | FLG_OPEN)
711
+ else:
712
+ # Use default `*|*` for `of S`.
713
+ nth_sel = CSS_NTH_OF_S_DEFAULT
714
+ if pseudo_sel == ':nth-child':
715
+ sel.nth.append(ct.SelectorNth(s1, var, s2, False, False, nth_sel))
716
+ elif pseudo_sel == ':nth-last-child':
717
+ sel.nth.append(ct.SelectorNth(s1, var, s2, False, True, nth_sel))
718
+ else:
719
+ if pseudo_sel == ':nth-of-type':
720
+ sel.nth.append(ct.SelectorNth(s1, var, s2, True, False, ct.SelectorList()))
721
+ elif pseudo_sel == ':nth-last-of-type':
722
+ sel.nth.append(ct.SelectorNth(s1, var, s2, True, True, ct.SelectorList()))
723
+ has_selector = True
724
+ return has_selector
725
+
726
+ def parse_pseudo_open(
727
+ self,
728
+ sel: _Selector,
729
+ name: str,
730
+ has_selector: bool,
731
+ iselector: Iterator[tuple[str, Match[str]]],
732
+ index: int
733
+ ) -> bool:
734
+ """Parse pseudo with opening bracket."""
735
+
736
+ flags = FLG_PSEUDO | FLG_OPEN
737
+ if name == ':not':
738
+ flags |= FLG_NOT
739
+ elif name == ':has':
740
+ flags |= FLG_RELATIVE
741
+ elif name in (':where', ':is'):
742
+ flags |= FLG_FORGIVE
743
+
744
+ sel.selectors.append(self.parse_selectors(iselector, index, flags))
745
+ has_selector = True
746
+
747
+ return has_selector
748
+
749
+ def parse_has_combinator(
750
+ self,
751
+ sel: _Selector,
752
+ m: Match[str],
753
+ has_selector: bool,
754
+ selectors: list[_Selector],
755
+ rel_type: str,
756
+ index: int
757
+ ) -> tuple[bool, _Selector, str]:
758
+ """Parse combinator tokens."""
759
+
760
+ combinator = m.group('relation').strip()
761
+ if not combinator:
762
+ combinator = WS_COMBINATOR
763
+ if combinator == COMMA_COMBINATOR:
764
+ sel.rel_type = rel_type
765
+ selectors[-1].relations.append(sel)
766
+ rel_type = ":" + WS_COMBINATOR
767
+ selectors.append(_Selector())
768
+ else:
769
+ if has_selector:
770
+ # End the current selector and associate the leading combinator with this selector.
771
+ sel.rel_type = rel_type
772
+ selectors[-1].relations.append(sel)
773
+ elif rel_type[1:] != WS_COMBINATOR:
774
+ # It's impossible to have two whitespace combinators after each other as the patterns
775
+ # will gobble up trailing whitespace. It is also impossible to have a whitespace
776
+ # combinator after any other kind for the same reason. But we could have
777
+ # multiple non-whitespace combinators. So if the current combinator is not a whitespace,
778
+ # then we've hit the multiple combinator case, so we should fail.
779
+ raise SelectorSyntaxError(
780
+ f'The multiple combinators at position {index}',
781
+ self.pattern,
782
+ index
783
+ )
784
+
785
+ # Set the leading combinator for the next selector.
786
+ rel_type = ':' + combinator
787
+
788
+ sel = _Selector()
789
+ has_selector = False
790
+ return has_selector, sel, rel_type
791
+
792
+ def parse_combinator(
793
+ self,
794
+ sel: _Selector,
795
+ m: Match[str],
796
+ has_selector: bool,
797
+ selectors: list[_Selector],
798
+ relations: list[_Selector],
799
+ is_pseudo: bool,
800
+ is_forgive: bool,
801
+ index: int
802
+ ) -> tuple[bool, _Selector]:
803
+ """Parse combinator tokens."""
804
+
805
+ combinator = m.group('relation').strip()
806
+ if not combinator:
807
+ combinator = WS_COMBINATOR
808
+ if not has_selector:
809
+ if not is_forgive or combinator != COMMA_COMBINATOR:
810
+ raise SelectorSyntaxError(
811
+ f"The combinator '{combinator}' at position {index}, must have a selector before it",
812
+ self.pattern,
813
+ index
814
+ )
815
+
816
+ # If we are in a forgiving pseudo class, just make the selector a "no match"
817
+ if combinator == COMMA_COMBINATOR:
818
+ sel.no_match = True
819
+ del relations[:]
820
+ selectors.append(sel)
821
+ else:
822
+ if combinator == COMMA_COMBINATOR:
823
+ if not sel.tag and not is_pseudo:
824
+ # Implied `*`
825
+ sel.tag = ct.SelectorTag('*', None)
826
+ sel.relations.extend(relations)
827
+ selectors.append(sel)
828
+ del relations[:]
829
+ else:
830
+ sel.relations.extend(relations)
831
+ sel.rel_type = combinator
832
+ del relations[:]
833
+ relations.append(sel)
834
+
835
+ sel = _Selector()
836
+ has_selector = False
837
+
838
+ return has_selector, sel
839
+
840
+ def parse_class_id(self, sel: _Selector, m: Match[str], has_selector: bool) -> bool:
841
+ """Parse HTML classes and ids."""
842
+
843
+ selector = m.group(0)
844
+ if selector.startswith('.'):
845
+ sel.classes.append(css_unescape(selector[1:]))
846
+ else:
847
+ sel.ids.append(css_unescape(selector[1:]))
848
+ has_selector = True
849
+ return has_selector
850
+
851
+ def parse_pseudo_contains(self, sel: _Selector, m: Match[str], has_selector: bool) -> bool:
852
+ """Parse contains."""
853
+
854
+ pseudo = util.lower(css_unescape(m.group('name')))
855
+ if pseudo == ":contains":
856
+ warnings.warn( # noqa: B028
857
+ "The pseudo class ':contains' is deprecated, ':-soup-contains' should be used moving forward.",
858
+ FutureWarning
859
+ )
860
+ contains_own = pseudo == ":-soup-contains-own"
861
+ values = css_unescape(m.group('values'))
862
+ patterns = []
863
+ for token in RE_VALUES.finditer(values):
864
+ if token.group('split'):
865
+ continue
866
+ value = token.group('value')
867
+ if value.startswith(("'", '"')):
868
+ value = css_unescape(value[1:-1], True)
869
+ else:
870
+ value = css_unescape(value)
871
+ patterns.append(value)
872
+ sel.contains.append(ct.SelectorContains(patterns, contains_own))
873
+ has_selector = True
874
+ return has_selector
875
+
876
+ def parse_pseudo_lang(self, sel: _Selector, m: Match[str], has_selector: bool) -> bool:
877
+ """Parse pseudo language."""
878
+
879
+ values = m.group('values')
880
+ patterns = []
881
+ for token in RE_VALUES.finditer(values):
882
+ if token.group('split'):
883
+ continue
884
+ value = token.group('value')
885
+ if value.startswith(('"', "'")):
886
+ value = css_unescape(value[1:-1], True)
887
+ else:
888
+ value = css_unescape(value)
889
+
890
+ patterns.append(value)
891
+
892
+ sel.lang.append(ct.SelectorLang(patterns))
893
+ has_selector = True
894
+
895
+ return has_selector
896
+
897
+ def parse_pseudo_dir(self, sel: _Selector, m: Match[str], has_selector: bool) -> bool:
898
+ """Parse pseudo direction."""
899
+
900
+ value = ct.SEL_DIR_LTR if util.lower(m.group('dir')) == 'ltr' else ct.SEL_DIR_RTL
901
+ sel.flags |= value
902
+ has_selector = True
903
+ return has_selector
904
+
905
+ def parse_selectors(
906
+ self,
907
+ iselector: Iterator[tuple[str, Match[str]]],
908
+ index: int = 0,
909
+ flags: int = 0
910
+ ) -> ct.SelectorList:
911
+ """Parse selectors."""
912
+
913
+ # Initialize important variables
914
+ sel = _Selector()
915
+ selectors = []
916
+ has_selector = False
917
+ closed = False
918
+ relations = [] # type: list[_Selector]
919
+ rel_type = ":" + WS_COMBINATOR
920
+
921
+ # Setup various flags
922
+ is_open = bool(flags & FLG_OPEN)
923
+ is_pseudo = bool(flags & FLG_PSEUDO)
924
+ is_relative = bool(flags & FLG_RELATIVE)
925
+ is_not = bool(flags & FLG_NOT)
926
+ is_html = bool(flags & FLG_HTML)
927
+ is_default = bool(flags & FLG_DEFAULT)
928
+ is_indeterminate = bool(flags & FLG_INDETERMINATE)
929
+ is_in_range = bool(flags & FLG_IN_RANGE)
930
+ is_out_of_range = bool(flags & FLG_OUT_OF_RANGE)
931
+ is_placeholder_shown = bool(flags & FLG_PLACEHOLDER_SHOWN)
932
+ is_forgive = bool(flags & FLG_FORGIVE)
933
+
934
+ # Print out useful debug stuff
935
+ if self.debug: # pragma: no cover
936
+ if is_pseudo:
937
+ print(' is_pseudo: True')
938
+ if is_open:
939
+ print(' is_open: True')
940
+ if is_relative:
941
+ print(' is_relative: True')
942
+ if is_not:
943
+ print(' is_not: True')
944
+ if is_html:
945
+ print(' is_html: True')
946
+ if is_default:
947
+ print(' is_default: True')
948
+ if is_indeterminate:
949
+ print(' is_indeterminate: True')
950
+ if is_in_range:
951
+ print(' is_in_range: True')
952
+ if is_out_of_range:
953
+ print(' is_out_of_range: True')
954
+ if is_placeholder_shown:
955
+ print(' is_placeholder_shown: True')
956
+ if is_forgive:
957
+ print(' is_forgive: True')
958
+
959
+ # The algorithm for relative selectors require an initial selector in the selector list
960
+ if is_relative:
961
+ selectors.append(_Selector())
962
+
963
+ try:
964
+ while True:
965
+ key, m = next(iselector)
966
+
967
+ # Handle parts
968
+ if key == "at_rule":
969
+ raise NotImplementedError(f"At-rules found at position {m.start(0)}")
970
+ elif key == 'pseudo_class_custom':
971
+ has_selector = self.parse_pseudo_class_custom(sel, m, has_selector)
972
+ elif key == 'pseudo_class':
973
+ has_selector, is_html = self.parse_pseudo_class(sel, m, has_selector, iselector, is_html)
974
+ elif key == 'pseudo_element':
975
+ raise NotImplementedError(f"Pseudo-element found at position {m.start(0)}")
976
+ elif key == 'pseudo_contains':
977
+ has_selector = self.parse_pseudo_contains(sel, m, has_selector)
978
+ elif key in ('pseudo_nth_type', 'pseudo_nth_child'):
979
+ has_selector = self.parse_pseudo_nth(sel, m, has_selector, iselector)
980
+ elif key == 'pseudo_lang':
981
+ has_selector = self.parse_pseudo_lang(sel, m, has_selector)
982
+ elif key == 'pseudo_dir':
983
+ has_selector = self.parse_pseudo_dir(sel, m, has_selector)
984
+ # Currently only supports HTML
985
+ is_html = True
986
+ elif key == 'pseudo_close':
987
+ if not has_selector:
988
+ if not is_forgive:
989
+ raise SelectorSyntaxError(
990
+ f"Expected a selector at position {m.start(0)}",
991
+ self.pattern,
992
+ m.start(0)
993
+ )
994
+ sel.no_match = True
995
+ if is_open:
996
+ closed = True
997
+ break
998
+ else:
999
+ raise SelectorSyntaxError(
1000
+ f"Unmatched pseudo-class close at position {m.start(0)}",
1001
+ self.pattern,
1002
+ m.start(0)
1003
+ )
1004
+ elif key == 'combine':
1005
+ if is_relative:
1006
+ has_selector, sel, rel_type = self.parse_has_combinator(
1007
+ sel, m, has_selector, selectors, rel_type, index
1008
+ )
1009
+ else:
1010
+ has_selector, sel = self.parse_combinator(
1011
+ sel, m, has_selector, selectors, relations, is_pseudo, is_forgive, index
1012
+ )
1013
+ elif key == 'attribute':
1014
+ has_selector = self.parse_attribute_selector(sel, m, has_selector)
1015
+ elif key == 'tag':
1016
+ if has_selector:
1017
+ raise SelectorSyntaxError(
1018
+ f"Tag name found at position {m.start(0)} instead of at the start",
1019
+ self.pattern,
1020
+ m.start(0)
1021
+ )
1022
+ has_selector = self.parse_tag_pattern(sel, m, has_selector)
1023
+ elif key in ('class', 'id'):
1024
+ has_selector = self.parse_class_id(sel, m, has_selector)
1025
+
1026
+ index = m.end(0)
1027
+ except StopIteration:
1028
+ pass
1029
+
1030
+ # Handle selectors that are not closed
1031
+ if is_open and not closed:
1032
+ raise SelectorSyntaxError(
1033
+ f"Unclosed pseudo-class at position {index}",
1034
+ self.pattern,
1035
+ index
1036
+ )
1037
+
1038
+ # Cleanup completed selector piece
1039
+ if has_selector:
1040
+ if not sel.tag and not is_pseudo:
1041
+ # Implied `*`
1042
+ sel.tag = ct.SelectorTag('*', None)
1043
+ if is_relative:
1044
+ sel.rel_type = rel_type
1045
+ selectors[-1].relations.append(sel)
1046
+ else:
1047
+ sel.relations.extend(relations)
1048
+ del relations[:]
1049
+ selectors.append(sel)
1050
+
1051
+ # Forgive empty slots in pseudo-classes that have lists (and are forgiving)
1052
+ elif is_forgive and (not selectors or not relations):
1053
+ # Handle normal pseudo-classes with empty slots like `:is()` etc.
1054
+ sel.no_match = True
1055
+ del relations[:]
1056
+ selectors.append(sel)
1057
+ has_selector = True
1058
+
1059
+ if not has_selector:
1060
+ # We will always need to finish a selector when `:has()` is used as it leads with combining.
1061
+ # May apply to others as well.
1062
+ raise SelectorSyntaxError(
1063
+ f'Expected a selector at position {index}',
1064
+ self.pattern,
1065
+ index
1066
+ )
1067
+
1068
+ # Some patterns require additional logic, such as default. We try to make these the
1069
+ # last pattern, and append the appropriate flag to that selector which communicates
1070
+ # to the matcher what additional logic is required.
1071
+ if is_default:
1072
+ selectors[-1].flags = ct.SEL_DEFAULT
1073
+ if is_indeterminate:
1074
+ selectors[-1].flags = ct.SEL_INDETERMINATE
1075
+ if is_in_range:
1076
+ selectors[-1].flags = ct.SEL_IN_RANGE
1077
+ if is_out_of_range:
1078
+ selectors[-1].flags = ct.SEL_OUT_OF_RANGE
1079
+ if is_placeholder_shown:
1080
+ selectors[-1].flags = ct.SEL_PLACEHOLDER_SHOWN
1081
+
1082
+ # Return selector list
1083
+ return ct.SelectorList([s.freeze() for s in selectors], is_not, is_html)
1084
+
1085
+ def selector_iter(self, pattern: str) -> Iterator[tuple[str, Match[str]]]:
1086
+ """Iterate selector tokens."""
1087
+
1088
+ # Ignore whitespace and comments at start and end of pattern
1089
+ m = RE_WS_BEGIN.search(pattern)
1090
+ index = m.end(0) if m else 0
1091
+ m = RE_WS_END.search(pattern)
1092
+ end = (m.start(0) - 1) if m else (len(pattern) - 1)
1093
+
1094
+ if self.debug: # pragma: no cover
1095
+ print(f'## PARSING: {pattern!r}')
1096
+ while index <= end:
1097
+ m = None
1098
+ for v in self.css_tokens:
1099
+ m = v.match(pattern, index, self.flags)
1100
+ if m:
1101
+ name = v.get_name()
1102
+ if self.debug: # pragma: no cover
1103
+ print(f"TOKEN: '{name}' --> {m.group(0)!r} at position {m.start(0)}")
1104
+ index = m.end(0)
1105
+ yield name, m
1106
+ break
1107
+ if m is None:
1108
+ c = pattern[index]
1109
+ # If the character represents the start of one of the known selector types,
1110
+ # throw an exception mentioning that the known selector type is in error;
1111
+ # otherwise, report the invalid character.
1112
+ if c == '[':
1113
+ msg = f"Malformed attribute selector at position {index}"
1114
+ elif c == '.':
1115
+ msg = f"Malformed class selector at position {index}"
1116
+ elif c == '#':
1117
+ msg = f"Malformed id selector at position {index}"
1118
+ elif c == ':':
1119
+ msg = f"Malformed pseudo-class selector at position {index}"
1120
+ else:
1121
+ msg = f"Invalid character {c!r} position {index}"
1122
+ raise SelectorSyntaxError(msg, self.pattern, index)
1123
+ if self.debug: # pragma: no cover
1124
+ print('## END PARSING')
1125
+
1126
+ def process_selectors(self, index: int = 0, flags: int = 0) -> ct.SelectorList:
1127
+ """Process selectors."""
1128
+
1129
+ return self.parse_selectors(self.selector_iter(self.pattern), index, flags)
1130
+
1131
+
1132
+ # Precompile CSS selector lists for pseudo-classes (additional logic may be required beyond the pattern)
1133
+ # A few patterns are order dependent as they use patterns previous compiled.
1134
+
1135
+ # CSS pattern for `:link` and `:any-link`
1136
+ CSS_LINK = CSSParser(
1137
+ 'html|*:is(a, area)[href]'
1138
+ ).process_selectors(flags=FLG_PSEUDO | FLG_HTML)
1139
+ # CSS pattern for `:checked`
1140
+ CSS_CHECKED = CSSParser(
1141
+ '''
1142
+ html|*:is(input[type=checkbox], input[type=radio])[checked], html|option[selected]
1143
+ '''
1144
+ ).process_selectors(flags=FLG_PSEUDO | FLG_HTML)
1145
+ # CSS pattern for `:default` (must compile CSS_CHECKED first)
1146
+ CSS_DEFAULT = CSSParser(
1147
+ '''
1148
+ :checked,
1149
+
1150
+ /*
1151
+ This pattern must be at the end.
1152
+ Special logic is applied to the last selector.
1153
+ */
1154
+ html|form html|*:is(button, input)[type="submit"]
1155
+ '''
1156
+ ).process_selectors(flags=FLG_PSEUDO | FLG_HTML | FLG_DEFAULT)
1157
+ # CSS pattern for `:indeterminate`
1158
+ CSS_INDETERMINATE = CSSParser(
1159
+ '''
1160
+ html|input[type="checkbox"][indeterminate],
1161
+ html|input[type="radio"]:is(:not([name]), [name=""]):not([checked]),
1162
+ html|progress:not([value]),
1163
+
1164
+ /*
1165
+ This pattern must be at the end.
1166
+ Special logic is applied to the last selector.
1167
+ */
1168
+ html|input[type="radio"][name]:not([name='']):not([checked])
1169
+ '''
1170
+ ).process_selectors(flags=FLG_PSEUDO | FLG_HTML | FLG_INDETERMINATE)
1171
+ # CSS pattern for `:disabled`
1172
+ CSS_DISABLED = CSSParser(
1173
+ '''
1174
+ html|*:is(input:not([type=hidden]), button, select, textarea, fieldset, optgroup, option, fieldset)[disabled],
1175
+ html|optgroup[disabled] > html|option,
1176
+ html|fieldset[disabled] > html|*:is(input:not([type=hidden]), button, select, textarea, fieldset),
1177
+ html|fieldset[disabled] >
1178
+ html|*:not(legend:nth-of-type(1)) html|*:is(input:not([type=hidden]), button, select, textarea, fieldset)
1179
+ '''
1180
+ ).process_selectors(flags=FLG_PSEUDO | FLG_HTML)
1181
+ # CSS pattern for `:enabled`
1182
+ CSS_ENABLED = CSSParser(
1183
+ '''
1184
+ html|*:is(input:not([type=hidden]), button, select, textarea, fieldset, optgroup, option, fieldset):not(:disabled)
1185
+ '''
1186
+ ).process_selectors(flags=FLG_PSEUDO | FLG_HTML)
1187
+ # CSS pattern for `:required`
1188
+ CSS_REQUIRED = CSSParser(
1189
+ 'html|*:is(input, textarea, select)[required]'
1190
+ ).process_selectors(flags=FLG_PSEUDO | FLG_HTML)
1191
+ # CSS pattern for `:optional`
1192
+ CSS_OPTIONAL = CSSParser(
1193
+ 'html|*:is(input, textarea, select):not([required])'
1194
+ ).process_selectors(flags=FLG_PSEUDO | FLG_HTML)
1195
+ # CSS pattern for `:placeholder-shown`
1196
+ CSS_PLACEHOLDER_SHOWN = CSSParser(
1197
+ '''
1198
+ html|input:is(
1199
+ :not([type]),
1200
+ [type=""],
1201
+ [type=text],
1202
+ [type=search],
1203
+ [type=url],
1204
+ [type=tel],
1205
+ [type=email],
1206
+ [type=password],
1207
+ [type=number]
1208
+ )[placeholder]:not([placeholder='']):is(:not([value]), [value=""]),
1209
+ html|textarea[placeholder]:not([placeholder=''])
1210
+ '''
1211
+ ).process_selectors(flags=FLG_PSEUDO | FLG_HTML | FLG_PLACEHOLDER_SHOWN)
1212
+ # CSS pattern default for `:nth-child` "of S" feature
1213
+ CSS_NTH_OF_S_DEFAULT = CSSParser(
1214
+ '*|*'
1215
+ ).process_selectors(flags=FLG_PSEUDO)
1216
+ # CSS pattern for `:read-write` (CSS_DISABLED must be compiled first)
1217
+ CSS_READ_WRITE = CSSParser(
1218
+ '''
1219
+ html|*:is(
1220
+ textarea,
1221
+ input:is(
1222
+ :not([type]),
1223
+ [type=""],
1224
+ [type=text],
1225
+ [type=search],
1226
+ [type=url],
1227
+ [type=tel],
1228
+ [type=email],
1229
+ [type=number],
1230
+ [type=password],
1231
+ [type=date],
1232
+ [type=datetime-local],
1233
+ [type=month],
1234
+ [type=time],
1235
+ [type=week]
1236
+ )
1237
+ ):not([readonly], :disabled),
1238
+ html|*:is([contenteditable=""], [contenteditable="true" i])
1239
+ '''
1240
+ ).process_selectors(flags=FLG_PSEUDO | FLG_HTML)
1241
+ # CSS pattern for `:read-only`
1242
+ CSS_READ_ONLY = CSSParser(
1243
+ '''
1244
+ html|*:not(:read-write)
1245
+ '''
1246
+ ).process_selectors(flags=FLG_PSEUDO | FLG_HTML)
1247
+ # CSS pattern for `:in-range`
1248
+ CSS_IN_RANGE = CSSParser(
1249
+ '''
1250
+ html|input:is(
1251
+ [type="date"],
1252
+ [type="month"],
1253
+ [type="week"],
1254
+ [type="time"],
1255
+ [type="datetime-local"],
1256
+ [type="number"],
1257
+ [type="range"]
1258
+ ):is(
1259
+ [min],
1260
+ [max]
1261
+ )
1262
+ '''
1263
+ ).process_selectors(flags=FLG_PSEUDO | FLG_IN_RANGE | FLG_HTML)
1264
+ # CSS pattern for `:out-of-range`
1265
+ CSS_OUT_OF_RANGE = CSSParser(
1266
+ '''
1267
+ html|input:is(
1268
+ [type="date"],
1269
+ [type="month"],
1270
+ [type="week"],
1271
+ [type="time"],
1272
+ [type="datetime-local"],
1273
+ [type="number"],
1274
+ [type="range"]
1275
+ ):is(
1276
+ [min],
1277
+ [max]
1278
+ )
1279
+ '''
1280
+ ).process_selectors(flags=FLG_PSEUDO | FLG_OUT_OF_RANGE | FLG_HTML)
shared/package-files/33/33451c69e142a8b3e01ac17c379987c3bb376ecae56c37c9636ba12e8cc9f7b2/_compat.pyi ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Static type stubs for `_compat.py`."""
2
+
3
+ # https://github.com/scikit-learn/scikit-learn/pull/27910#issuecomment-2568023972
4
+ from __future__ import annotations
5
+
6
+ from types import ModuleType
7
+
8
+ # TODO import from typing (requires Python >=3.13)
9
+ from typing_extensions import TypeIs
10
+
11
+ from ._typing import Array, Device
12
+
13
+ # pylint: disable=missing-class-docstring,unused-argument
14
+
15
+ class Namespace(ModuleType):
16
+ def device(self, x: Array, /) -> Device: ...
17
+
18
+ def array_namespace(
19
+ *xs: Array | complex | None,
20
+ api_version: str | None = None,
21
+ use_compat: bool | None = None,
22
+ ) -> Namespace: ...
23
+ def device(x: Array, /) -> Device: ...
24
+ def is_array_api_obj(x: object, /) -> TypeIs[Array]: ...
25
+ def is_array_api_strict_namespace(xp: ModuleType, /) -> TypeIs[Namespace]: ...
26
+ def is_cupy_namespace(xp: ModuleType, /) -> TypeIs[Namespace]: ...
27
+ def is_dask_namespace(xp: ModuleType, /) -> TypeIs[Namespace]: ...
28
+ def is_jax_namespace(xp: ModuleType, /) -> TypeIs[Namespace]: ...
29
+ def is_numpy_namespace(xp: ModuleType, /) -> TypeIs[Namespace]: ...
30
+ def is_pydata_sparse_namespace(xp: ModuleType, /) -> TypeIs[Namespace]: ...
31
+ def is_torch_namespace(xp: ModuleType, /) -> TypeIs[Namespace]: ...
32
+ def is_cupy_array(x: object, /) -> TypeIs[Array]: ...
33
+ def is_dask_array(x: object, /) -> TypeIs[Array]: ...
34
+ def is_jax_array(x: object, /) -> TypeIs[Array]: ...
35
+ def is_numpy_array(x: object, /) -> TypeIs[Array]: ...
36
+ def is_pydata_sparse_array(x: object, /) -> TypeIs[Array]: ...
37
+ def is_torch_array(x: object, /) -> TypeIs[Array]: ...
38
+ def is_lazy_array(x: object, /) -> TypeIs[Array]: ...
39
+ def is_writeable_array(x: object, /) -> TypeIs[Array]: ...
40
+ def size(x: Array, /) -> int | None: ...
shared/package-files/33/3348b29618eeaad3dc6ceda901574383d9fd7b5113df9f6743db7138412b98ca/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ from .modules import * # noqa: F403
shared/package-files/33/3348cd5dcc3c57790e839d3009ea86e17335a401228dc8666b1bb0cd3672d511/conv3d_native.h ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ // @generated by torchgen/gen.py from NativeFunction.h
4
+
5
+ #include <c10/core/Scalar.h>
6
+ #include <c10/core/Storage.h>
7
+ #include <c10/core/TensorOptions.h>
8
+ #include <c10/util/Deprecated.h>
9
+ #include <c10/util/Optional.h>
10
+ #include <c10/core/QScheme.h>
11
+ #include <ATen/core/Reduction.h>
12
+ #include <ATen/core/Tensor.h>
13
+ #include <tuple>
14
+ #include <vector>
15
+
16
+
17
+ namespace at {
18
+ namespace native {
19
+ TORCH_API at::Tensor conv3d_symint(const at::Tensor & input, const at::Tensor & weight, const c10::optional<at::Tensor> & bias={}, c10::SymIntArrayRef stride=c10::SymInt(1), c10::SymIntArrayRef padding=c10::SymInt(0), c10::SymIntArrayRef dilation=c10::SymInt(1), c10::SymInt groups=1);
20
+ TORCH_API at::Tensor conv3d_padding_symint(const at::Tensor & input, const at::Tensor & weight, const c10::optional<at::Tensor> & bias={}, c10::SymIntArrayRef stride=c10::SymInt(1), c10::string_view padding="valid", c10::SymIntArrayRef dilation=c10::SymInt(1), c10::SymInt groups=1);
21
+ } // namespace native
22
+ } // namespace at
shared/package-files/33/334b52745a1434c677fadeed0991dc8144b7ee2058cd9af335a0ee8b8696a11e/elnino.dat ADDED
@@ -0,0 +1,733 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ YR MON NINO1+2 ANOM NINO3 ANOM NINO4 ANOM NINO3.4 ANOM
2
+ 1950 1 23.11 -1.42 23.74 -1.91 27.03 -1.12 24.83 -1.72
3
+ 1950 2 24.20 -1.71 24.92 -1.45 27.15 -0.92 25.20 -1.53
4
+ 1950 3 25.37 -1.00 26.33 -0.80 27.06 -1.11 26.03 -1.20
5
+ 1950 4 23.86 -1.71 26.46 -0.97 27.29 -1.10 26.36 -1.30
6
+ 1950 5 23.03 -1.39 25.72 -1.38 27.59 -1.10 26.19 -1.58
7
+ 1950 6 21.57 -1.50 25.55 -0.92 27.97 -0.70 26.52 -1.01
8
+ 1950 7 20.63 -1.34 24.97 -0.68 27.83 -0.78 26.42 -0.69
9
+ 1950 8 20.15 -0.86 24.61 -0.45 27.72 -0.78 25.98 -0.77
10
+ 1950 9 19.67 -1.10 24.22 -0.72 27.66 -0.85 25.78 -0.92
11
+ 1950 10 20.03 -1.04 24.39 -0.56 27.44 -1.07 25.96 -0.68
12
+ 1950 11 20.02 -1.72 24.00 -1.05 27.35 -1.11 25.64 -0.96
13
+ 1950 12 21.80 -1.11 24.30 -0.91 27.30 -1.05 25.50 -1.07
14
+ 1951 1 24.19 -0.35 25.00 -0.65 27.36 -0.79 25.46 -1.09
15
+ 1951 2 25.28 -0.64 25.80 -0.57 27.27 -0.80 25.78 -0.96
16
+ 1951 3 25.60 -0.78 26.91 -0.22 27.96 -0.21 26.72 -0.51
17
+ 1951 4 25.37 -0.20 27.31 -0.11 28.49 0.09 27.24 -0.43
18
+ 1951 5 24.79 0.37 27.08 -0.02 29.04 0.35 27.68 -0.09
19
+ 1951 6 24.69 1.62 26.57 0.10 28.74 0.07 27.46 -0.07
20
+ 1951 7 23.86 1.88 26.54 0.89 28.82 0.21 27.72 0.61
21
+ 1951 8 22.32 1.31 25.67 0.62 28.53 0.04 27.36 0.61
22
+ 1951 9 21.44 0.67 25.56 0.62 28.62 0.11 27.51 0.81
23
+ 1951 10 21.77 0.70 25.85 0.90 28.71 0.20 27.43 0.78
24
+ 1951 11 22.33 0.59 26.18 1.13 28.74 0.29 27.48 0.87
25
+ 1951 12 22.89 -0.01 25.98 0.77 28.53 0.19 27.12 0.55
26
+ 1952 1 24.52 -0.02 25.85 0.20 28.35 0.19 26.85 0.30
27
+ 1952 2 26.21 0.29 26.46 0.08 28.08 0.00 26.79 0.06
28
+ 1952 3 26.37 0.00 27.18 0.05 28.10 -0.07 27.32 0.09
29
+ 1952 4 24.73 -0.84 27.41 -0.02 28.52 0.12 27.88 0.21
30
+ 1952 5 23.71 -0.71 26.92 -0.18 28.69 -0.01 27.99 0.21
31
+ 1952 6 22.34 -0.73 25.84 -0.63 28.47 -0.20 27.33 -0.20
32
+ 1952 7 20.89 -1.09 24.92 -0.73 28.24 -0.37 26.72 -0.38
33
+ 1952 8 20.02 -0.99 24.50 -0.56 28.09 -0.40 26.46 -0.29
34
+ 1952 9 19.63 -1.14 24.43 -0.51 28.55 0.04 26.54 -0.17
35
+ 1952 10 20.40 -0.67 24.52 -0.42 28.25 -0.26 26.54 -0.10
36
+ 1952 11 20.77 -0.97 24.36 -0.69 28.28 -0.17 26.36 -0.24
37
+ 1952 12 22.39 -0.52 24.88 -0.33 28.30 -0.04 26.53 -0.04
38
+ 1953 1 24.15 -0.39 25.77 0.11 28.31 0.15 26.85 0.29
39
+ 1953 2 26.34 0.42 26.74 0.36 28.26 0.18 27.19 0.45
40
+ 1953 3 27.36 0.98 27.57 0.44 28.10 -0.07 27.68 0.45
41
+ 1953 4 27.03 1.46 27.91 0.49 28.53 0.14 28.19 0.53
42
+ 1953 5 25.47 1.05 27.39 0.28 28.92 0.23 28.29 0.52
43
+ 1953 6 23.49 0.42 26.77 0.30 29.18 0.51 28.02 0.49
44
+ 1953 7 22.20 0.23 25.81 0.16 29.02 0.41 27.52 0.42
45
+ 1953 8 21.45 0.44 25.20 0.14 28.83 0.34 27.16 0.41
46
+ 1953 9 21.25 0.49 25.17 0.24 28.61 0.09 27.13 0.43
47
+ 1953 10 20.95 -0.12 25.07 0.13 28.91 0.41 27.02 0.38
48
+ 1953 11 21.60 -0.14 25.25 0.19 28.91 0.46 26.96 0.36
49
+ 1953 12 22.44 -0.47 25.55 0.34 28.74 0.40 26.99 0.42
50
+ 1954 1 23.02 -1.52 25.73 0.07 28.30 0.14 27.03 0.47
51
+ 1954 2 25.00 -0.92 26.43 0.05 28.16 0.08 27.22 0.48
52
+ 1954 3 25.33 -1.05 26.85 -0.28 27.89 -0.28 27.21 -0.02
53
+ 1954 4 22.97 -2.60 25.85 -1.57 28.20 -0.19 26.87 -0.80
54
+ 1954 5 21.73 -2.69 25.67 -1.44 28.40 -0.30 27.06 -0.71
55
+ 1954 6 20.77 -2.30 25.20 -1.27 28.32 -0.35 26.93 -0.60
56
+ 1954 7 19.52 -2.46 24.47 -1.17 28.00 -0.61 26.37 -0.74
57
+ 1954 8 19.33 -1.68 23.83 -1.23 27.76 -0.73 25.73 -1.02
58
+ 1954 9 18.95 -1.82 23.51 -1.43 27.61 -0.90 25.38 -1.33
59
+ 1954 10 19.11 -1.96 23.63 -1.31 27.54 -0.97 25.51 -1.13
60
+ 1954 11 20.27 -1.47 23.86 -1.19 27.53 -0.92 25.67 -0.93
61
+ 1954 12 21.30 -1.61 23.79 -1.42 27.61 -0.74 25.37 -1.20
62
+ 1955 1 23.75 -0.79 24.79 -0.86 27.60 -0.56 25.54 -1.02
63
+ 1955 2 24.82 -1.10 25.76 -0.62 27.30 -0.77 25.90 -0.84
64
+ 1955 3 25.14 -1.23 26.35 -0.78 27.37 -0.81 26.37 -0.86
65
+ 1955 4 24.22 -1.35 26.32 -1.11 27.82 -0.57 26.66 -1.01
66
+ 1955 5 22.16 -2.26 25.52 -1.58 28.03 -0.66 26.66 -1.11
67
+ 1955 6 21.20 -1.87 25.08 -1.39 28.08 -0.59 26.56 -0.97
68
+ 1955 7 20.46 -1.52 24.55 -1.10 28.14 -0.47 26.31 -0.80
69
+ 1955 8 19.63 -1.38 23.69 -1.37 27.94 -0.55 25.60 -1.15
70
+ 1955 9 19.24 -1.53 23.36 -1.57 27.71 -0.81 25.63 -1.07
71
+ 1955 10 19.16 -1.91 22.71 -2.24 27.22 -1.29 24.66 -1.98
72
+ 1955 11 19.84 -1.90 22.66 -2.39 26.79 -1.66 24.29 -2.32
73
+ 1955 12 21.19 -1.71 23.08 -2.13 27.20 -1.15 24.58 -1.99
74
+ 1956 1 23.24 -1.30 24.47 -1.18 27.18 -0.97 25.28 -1.27
75
+ 1956 2 24.71 -1.20 25.80 -0.57 27.27 -0.81 26.00 -0.73
76
+ 1956 3 25.90 -0.47 26.84 -0.29 27.49 -0.68 26.62 -0.61
77
+ 1956 4 24.66 -0.91 27.12 -0.30 27.72 -0.68 26.96 -0.70
78
+ 1956 5 23.14 -1.28 26.63 -0.47 28.11 -0.58 27.23 -0.54
79
+ 1956 6 22.04 -1.03 25.87 -0.60 28.22 -0.46 26.99 -0.54
80
+ 1956 7 21.47 -0.51 24.82 -0.82 28.07 -0.54 26.37 -0.73
81
+ 1956 8 20.55 -0.46 24.16 -0.90 27.67 -0.82 25.91 -0.84
82
+ 1956 9 19.89 -0.88 23.97 -0.97 27.71 -0.80 25.91 -0.79
83
+ 1956 10 19.69 -1.39 24.01 -0.94 27.92 -0.59 25.83 -0.81
84
+ 1956 11 20.57 -1.17 23.91 -1.14 28.02 -0.43 25.64 -0.97
85
+ 1956 12 21.58 -1.32 24.06 -1.15 28.09 -0.26 25.71 -0.86
86
+ 1957 1 23.13 -1.40 25.05 -0.60 28.03 -0.12 26.09 -0.47
87
+ 1957 2 26.30 0.38 26.23 -0.15 28.10 0.02 26.58 -0.16
88
+ 1957 3 27.63 1.26 27.55 0.42 28.33 0.16 27.65 0.41
89
+ 1957 4 27.15 1.59 27.94 0.51 28.86 0.47 28.34 0.68
90
+ 1957 5 26.72 2.30 27.81 0.71 29.15 0.46 28.59 0.82
91
+ 1957 6 25.04 1.97 27.30 0.84 28.83 0.16 28.28 0.75
92
+ 1957 7 23.83 1.85 26.95 1.31 28.73 0.12 28.11 1.00
93
+ 1957 8 22.34 1.33 26.14 1.08 28.91 0.41 27.75 1.00
94
+ 1957 9 21.80 1.03 25.71 0.77 28.96 0.45 27.54 0.84
95
+ 1957 10 21.80 0.73 25.68 0.74 29.12 0.61 27.49 0.85
96
+ 1957 11 22.39 0.65 26.23 1.18 29.12 0.67 27.79 1.19
97
+ 1957 12 23.69 0.78 26.64 1.43 29.08 0.74 28.08 1.51
98
+ 1958 1 24.89 0.35 27.04 1.38 29.26 1.10 28.37 1.81
99
+ 1958 2 26.55 0.63 27.57 1.20 29.28 1.21 28.41 1.68
100
+ 1958 3 27.09 0.72 27.85 0.72 29.04 0.86 28.34 1.11
101
+ 1958 4 26.37 0.80 27.86 0.44 29.04 0.65 28.35 0.69
102
+ 1958 5 24.71 0.29 27.39 0.28 29.21 0.52 28.35 0.57
103
+ 1958 6 23.23 0.16 26.70 0.23 29.13 0.46 28.05 0.52
104
+ 1958 7 22.31 0.33 25.73 0.09 28.89 0.28 27.48 0.37
105
+ 1958 8 20.72 -0.29 24.97 -0.08 28.53 0.04 26.90 0.15
106
+ 1958 9 20.62 -0.14 24.45 -0.48 28.50 -0.02 26.50 -0.20
107
+ 1958 10 21.05 -0.02 24.65 -0.30 28.68 0.17 26.61 -0.03
108
+ 1958 11 21.52 -0.22 25.06 0.01 28.79 0.34 26.89 0.29
109
+ 1958 12 22.50 -0.40 25.02 -0.19 28.76 0.41 26.77 0.20
110
+ 1959 1 23.97 -0.57 25.75 0.10 28.63 0.48 27.14 0.58
111
+ 1959 2 25.90 -0.01 26.50 0.13 28.38 0.31 27.25 0.51
112
+ 1959 3 26.94 0.56 27.17 0.04 28.48 0.31 27.55 0.32
113
+ 1959 4 25.84 0.27 27.56 0.14 28.75 0.36 27.93 0.27
114
+ 1959 5 24.23 -0.19 26.94 -0.16 28.85 0.16 27.80 0.03
115
+ 1959 6 22.57 -0.50 26.07 -0.39 28.39 -0.28 27.34 -0.19
116
+ 1959 7 21.50 -0.47 24.94 -0.71 28.30 -0.31 26.56 -0.55
117
+ 1959 8 20.15 -0.86 24.40 -0.66 28.27 -0.22 26.32 -0.43
118
+ 1959 9 20.23 -0.54 24.37 -0.57 28.19 -0.32 26.17 -0.53
119
+ 1959 10 20.86 -0.21 24.67 -0.28 28.21 -0.30 26.42 -0.22
120
+ 1959 11 21.88 0.14 24.74 -0.31 28.12 -0.34 26.32 -0.28
121
+ 1959 12 22.55 -0.36 24.94 -0.27 28.07 -0.27 26.44 -0.13
122
+ 1960 1 24.40 -0.14 25.34 -0.32 27.77 -0.38 26.25 -0.31
123
+ 1960 2 25.59 -0.32 25.87 -0.50 27.49 -0.58 26.27 -0.47
124
+ 1960 3 26.01 -0.36 26.75 -0.38 27.77 -0.40 26.97 -0.26
125
+ 1960 4 24.66 -0.91 27.03 -0.39 28.08 -0.31 27.51 -0.16
126
+ 1960 5 23.53 -0.89 26.66 -0.45 28.52 -0.18 27.62 -0.16
127
+ 1960 6 21.83 -1.24 25.95 -0.52 28.35 -0.32 27.24 -0.29
128
+ 1960 7 20.73 -1.25 25.38 -0.26 28.31 -0.30 27.07 -0.04
129
+ 1960 8 20.10 -0.91 24.95 -0.11 28.19 -0.30 26.85 0.10
130
+ 1960 9 20.56 -0.20 24.70 -0.24 28.32 -0.20 26.60 -0.11
131
+ 1960 10 20.27 -0.80 24.24 -0.71 28.33 -0.17 26.35 -0.29
132
+ 1960 11 20.93 -0.81 24.31 -0.75 28.37 -0.09 26.34 -0.26
133
+ 1960 12 22.74 -0.17 24.73 -0.48 28.36 0.02 26.41 -0.16
134
+ 1961 1 24.58 0.04 25.19 -0.46 27.94 -0.21 26.38 -0.17
135
+ 1961 2 26.66 0.75 26.25 -0.13 27.85 -0.23 26.61 -0.13
136
+ 1961 3 25.95 -0.42 26.83 -0.30 27.92 -0.26 27.00 -0.24
137
+ 1961 4 25.17 -0.40 27.40 -0.02 27.96 -0.43 27.50 -0.16
138
+ 1961 5 23.60 -0.82 27.08 -0.02 28.38 -0.31 27.85 0.08
139
+ 1961 6 22.36 -0.71 26.37 -0.10 28.49 -0.18 27.86 0.33
140
+ 1961 7 20.52 -1.46 24.95 -0.70 28.33 -0.28 27.16 0.05
141
+ 1961 8 19.97 -1.04 24.20 -0.86 28.12 -0.37 26.43 -0.32
142
+ 1961 9 19.70 -1.07 23.65 -1.29 28.19 -0.33 25.97 -0.73
143
+ 1961 10 20.07 -1.01 23.89 -1.06 28.09 -0.42 25.94 -0.71
144
+ 1961 11 21.09 -0.65 24.38 -0.67 28.26 -0.19 26.20 -0.40
145
+ 1961 12 22.11 -0.80 24.75 -0.46 28.06 -0.28 26.20 -0.37
146
+ 1962 1 24.02 -0.52 25.23 -0.42 27.66 -0.49 26.12 -0.43
147
+ 1962 2 25.35 -0.56 26.07 -0.31 27.57 -0.51 26.28 -0.46
148
+ 1962 3 24.47 -1.90 26.49 -0.64 27.83 -0.34 26.80 -0.44
149
+ 1962 4 23.43 -2.14 26.59 -0.83 28.19 -0.20 27.22 -0.44
150
+ 1962 5 23.03 -1.39 26.28 -0.82 28.23 -0.47 27.23 -0.54
151
+ 1962 6 21.81 -1.26 25.83 -0.64 28.30 -0.37 27.18 -0.35
152
+ 1962 7 20.60 -1.37 25.21 -0.44 28.24 -0.37 26.93 -0.17
153
+ 1962 8 20.17 -0.84 24.72 -0.33 28.15 -0.34 26.52 -0.23
154
+ 1962 9 20.02 -0.75 24.20 -0.74 28.11 -0.40 26.07 -0.63
155
+ 1962 10 20.14 -0.93 24.23 -0.72 28.10 -0.41 26.06 -0.58
156
+ 1962 11 20.99 -0.75 24.10 -0.95 28.12 -0.33 25.88 -0.72
157
+ 1962 12 21.82 -1.09 24.12 -1.09 27.96 -0.38 25.75 -0.82
158
+ 1963 1 23.81 -0.73 24.96 -0.69 27.74 -0.41 25.86 -0.69
159
+ 1963 2 25.36 -0.55 25.91 -0.47 27.70 -0.38 26.39 -0.35
160
+ 1963 3 26.02 -0.36 27.06 -0.07 28.01 -0.16 27.31 0.08
161
+ 1963 4 24.67 -0.90 27.66 0.23 28.28 -0.11 27.87 0.20
162
+ 1963 5 23.97 -0.45 27.10 0.00 28.40 -0.30 27.71 -0.06
163
+ 1963 6 22.41 -0.66 26.74 0.27 28.38 -0.29 27.69 0.16
164
+ 1963 7 21.80 -0.18 26.36 0.71 28.72 0.11 27.91 0.80
165
+ 1963 8 21.31 0.30 25.80 0.74 29.01 0.51 27.63 0.88
166
+ 1963 9 21.00 0.23 25.41 0.48 29.03 0.52 27.47 0.76
167
+ 1963 10 21.13 0.06 25.58 0.63 29.07 0.56 27.56 0.92
168
+ 1963 11 21.64 -0.10 25.83 0.78 29.11 0.66 27.61 1.00
169
+ 1963 12 22.55 -0.35 26.08 0.87 28.87 0.52 27.71 1.14
170
+ 1964 1 24.15 -0.39 26.07 0.42 28.70 0.55 27.43 0.87
171
+ 1964 2 25.08 -0.83 26.41 0.04 28.39 0.31 27.27 0.53
172
+ 1964 3 25.30 -1.08 26.76 -0.37 28.08 -0.09 27.10 -0.13
173
+ 1964 4 24.61 -0.96 26.34 -1.09 28.24 -0.15 27.06 -0.60
174
+ 1964 5 21.93 -2.49 25.56 -1.54 28.39 -0.30 26.94 -0.84
175
+ 1964 6 21.44 -1.63 25.10 -1.37 28.06 -0.61 26.66 -0.87
176
+ 1964 7 20.25 -1.72 24.82 -0.82 27.87 -0.74 26.42 -0.69
177
+ 1964 8 19.48 -1.53 23.73 -1.33 27.64 -0.85 25.74 -1.01
178
+ 1964 9 19.67 -1.10 23.89 -1.04 27.38 -1.13 25.49 -1.22
179
+ 1964 10 19.79 -1.28 23.95 -0.99 27.38 -1.13 25.53 -1.11
180
+ 1964 11 20.88 -0.86 24.04 -1.02 27.34 -1.11 25.40 -1.20
181
+ 1964 12 21.83 -1.08 23.86 -1.35 27.25 -1.10 25.42 -1.15
182
+ 1965 1 24.22 -0.32 24.84 -0.81 27.57 -0.59 25.78 -0.77
183
+ 1965 2 26.17 0.26 25.96 -0.41 27.77 -0.31 26.37 -0.37
184
+ 1965 3 26.71 0.33 27.07 -0.06 27.93 -0.24 27.12 -0.11
185
+ 1965 4 27.01 1.45 27.66 0.23 28.06 -0.33 27.62 -0.05
186
+ 1965 5 26.09 1.67 27.68 0.57 28.70 0.01 28.07 0.29
187
+ 1965 6 24.60 1.54 27.24 0.78 29.02 0.35 28.19 0.66
188
+ 1965 7 23.26 1.29 26.64 0.99 29.08 0.47 28.02 0.91
189
+ 1965 8 22.54 1.53 26.25 1.20 29.19 0.70 28.07 1.32
190
+ 1965 9 21.26 0.49 26.07 1.13 29.11 0.60 28.03 1.32
191
+ 1965 10 21.57 0.50 26.15 1.21 29.30 0.80 28.26 1.62
192
+ 1965 11 22.29 0.55 26.50 1.45 29.17 0.72 28.29 1.69
193
+ 1965 12 23.35 0.44 26.59 1.38 29.03 0.68 28.07 1.50
194
+ 1966 1 25.15 0.62 26.70 1.05 28.87 0.71 27.75 1.19
195
+ 1966 2 25.88 -0.03 26.86 0.49 28.85 0.78 27.66 0.92
196
+ 1966 3 25.35 -1.02 27.26 0.13 29.18 1.01 28.22 0.99
197
+ 1966 4 24.26 -1.31 27.40 -0.03 28.99 0.60 28.24 0.58
198
+ 1966 5 22.92 -1.50 26.28 -0.82 29.08 0.39 27.67 -0.10
199
+ 1966 6 21.80 -1.27 26.08 -0.39 29.13 0.46 27.77 0.24
200
+ 1966 7 20.85 -1.13 25.42 -0.22 29.03 0.42 27.42 0.31
201
+ 1966 8 20.17 -0.84 24.51 -0.55 28.76 0.27 26.65 -0.10
202
+ 1966 9 20.04 -0.73 24.17 -0.77 28.71 0.20 26.49 -0.22
203
+ 1966 10 20.51 -0.56 24.42 -0.53 28.57 0.06 26.40 -0.25
204
+ 1966 11 21.03 -0.71 24.26 -0.79 28.65 0.20 26.42 -0.19
205
+ 1966 12 22.25 -0.66 24.30 -0.91 28.27 -0.07 26.21 -0.36
206
+ 1967 1 23.66 -0.88 25.09 -0.56 27.69 -0.46 26.18 -0.38
207
+ 1967 2 25.54 -0.37 26.09 -0.28 27.48 -0.60 26.35 -0.39
208
+ 1967 3 25.55 -0.83 26.46 -0.67 27.78 -0.39 26.67 -0.56
209
+ 1967 4 24.98 -0.59 26.46 -0.96 28.40 0.01 26.91 -0.76
210
+ 1967 5 23.77 -0.65 26.69 -0.41 28.80 0.11 27.49 -0.28
211
+ 1967 6 22.04 -1.03 26.40 -0.07 28.69 0.02 27.62 0.09
212
+ 1967 7 21.10 -0.88 25.32 -0.32 28.62 0.01 27.17 0.06
213
+ 1967 8 19.84 -1.17 24.30 -0.76 28.42 -0.07 26.62 -0.13
214
+ 1967 9 19.08 -1.68 23.69 -1.25 28.19 -0.32 26.10 -0.60
215
+ 1967 10 19.47 -1.60 23.80 -1.14 28.32 -0.19 26.19 -0.45
216
+ 1967 11 20.20 -1.54 24.01 -1.04 28.43 -0.02 26.26 -0.34
217
+ 1967 12 21.28 -1.62 24.14 -1.07 28.27 -0.08 26.10 -0.47
218
+ 1968 1 23.19 -1.35 24.40 -1.25 27.92 -0.24 25.78 -0.78
219
+ 1968 2 24.88 -1.04 25.00 -1.38 27.80 -0.28 25.79 -0.95
220
+ 1968 3 25.11 -1.27 25.86 -1.27 27.87 -0.30 26.38 -0.85
221
+ 1968 4 23.97 -1.60 26.57 -0.85 28.16 -0.24 27.09 -0.58
222
+ 1968 5 22.44 -1.98 26.19 -0.92 28.30 -0.40 27.15 -0.62
223
+ 1968 6 21.70 -1.36 26.22 -0.25 28.90 0.23 27.69 0.16
224
+ 1968 7 21.25 -0.72 26.00 0.35 28.70 0.09 27.61 0.51
225
+ 1968 8 20.97 -0.04 25.28 0.22 28.68 0.19 27.12 0.37
226
+ 1968 9 21.23 0.46 24.96 0.02 28.66 0.15 26.90 0.19
227
+ 1968 10 21.12 0.05 25.17 0.22 28.77 0.26 26.99 0.34
228
+ 1968 11 21.68 -0.06 25.35 0.29 29.17 0.72 27.38 0.78
229
+ 1968 12 23.20 0.29 25.79 0.58 29.17 0.83 27.42 0.85
230
+ 1969 1 24.67 0.13 26.27 0.62 29.11 0.95 27.55 0.99
231
+ 1969 2 25.56 -0.36 26.92 0.54 29.28 1.20 27.95 1.21
232
+ 1969 3 27.09 0.72 27.63 0.50 28.99 0.82 28.02 0.79
233
+ 1969 4 26.66 1.10 27.94 0.52 29.03 0.64 28.39 0.73
234
+ 1969 5 26.07 1.65 27.92 0.81 29.21 0.52 28.50 0.73
235
+ 1969 6 24.39 1.32 27.05 0.58 29.09 0.42 27.99 0.46
236
+ 1969 7 22.47 0.50 25.84 0.19 28.85 0.24 27.30 0.20
237
+ 1969 8 21.06 0.05 25.41 0.35 28.93 0.44 27.16 0.41
238
+ 1969 9 20.88 0.12 25.46 0.52 29.14 0.63 27.34 0.63
239
+ 1969 10 21.74 0.67 25.69 0.75 29.20 0.69 27.50 0.86
240
+ 1969 11 22.47 0.73 25.75 0.70 29.20 0.75 27.35 0.74
241
+ 1969 12 23.60 0.69 26.16 0.95 28.87 0.52 27.30 0.73
242
+ 1970 1 25.02 0.48 26.38 0.73 28.57 0.42 27.05 0.50
243
+ 1970 2 25.76 -0.16 26.52 0.14 28.57 0.50 27.02 0.29
244
+ 1970 3 25.53 -0.85 26.97 -0.16 28.52 0.35 27.35 0.12
245
+ 1970 4 24.76 -0.81 27.20 -0.23 28.73 0.34 27.96 0.29
246
+ 1970 5 22.94 -1.48 26.44 -0.66 28.97 0.28 27.77 0.00
247
+ 1970 6 21.27 -1.80 25.30 -1.17 28.75 0.08 27.14 -0.39
248
+ 1970 7 19.69 -2.28 24.18 -1.47 28.66 0.05 26.48 -0.63
249
+ 1970 8 19.27 -1.74 23.69 -1.37 28.16 -0.34 25.86 -0.89
250
+ 1970 9 19.50 -1.26 23.89 -1.05 27.88 -0.64 25.86 -0.84
251
+ 1970 10 20.16 -0.91 23.80 -1.14 27.86 -0.65 25.79 -0.85
252
+ 1970 11 20.61 -1.13 23.78 -1.28 27.91 -0.54 25.83 -0.77
253
+ 1970 12 21.77 -1.13 24.01 -1.20 27.44 -0.91 25.47 -1.10
254
+ 1971 1 23.33 -1.21 24.19 -1.47 26.94 -1.21 25.09 -1.46
255
+ 1971 2 24.58 -1.34 24.91 -1.47 27.07 -1.00 25.40 -1.34
256
+ 1971 3 25.24 -1.13 26.01 -1.11 27.25 -0.92 26.10 -1.13
257
+ 1971 4 24.95 -0.62 26.61 -0.81 27.63 -0.76 26.78 -0.89
258
+ 1971 5 23.29 -1.13 26.26 -0.85 28.02 -0.67 27.06 -0.71
259
+ 1971 6 21.60 -1.47 25.44 -1.03 28.03 -0.64 26.70 -0.83
260
+ 1971 7 21.01 -0.96 24.78 -0.86 27.93 -0.68 26.29 -0.82
261
+ 1971 8 19.97 -1.04 23.90 -1.16 27.84 -0.66 25.99 -0.76
262
+ 1971 9 19.74 -1.03 23.92 -1.02 27.75 -0.77 25.94 -0.76
263
+ 1971 10 19.88 -1.19 23.73 -1.21 27.80 -0.71 25.65 -0.99
264
+ 1971 11 20.94 -0.80 23.93 -1.12 27.87 -0.58 25.69 -0.91
265
+ 1971 12 21.99 -0.92 23.92 -1.29 27.98 -0.36 25.55 -1.02
266
+ 1972 1 24.51 -0.03 25.02 -0.63 27.97 -0.19 25.84 -0.72
267
+ 1972 2 26.66 0.75 26.04 -0.34 28.15 0.07 26.42 -0.32
268
+ 1972 3 27.09 0.72 27.12 -0.01 28.36 0.19 27.21 -0.02
269
+ 1972 4 26.25 0.68 27.78 0.35 28.82 0.43 27.93 0.26
270
+ 1972 5 25.47 1.05 27.62 0.52 29.21 0.52 28.27 0.49
271
+ 1972 6 25.01 1.95 27.37 0.90 29.19 0.52 28.23 0.70
272
+ 1972 7 24.11 2.13 27.14 1.49 29.09 0.48 28.18 1.07
273
+ 1972 8 23.42 2.41 26.86 1.81 28.92 0.43 28.10 1.35
274
+ 1972 9 22.12 1.35 26.48 1.54 29.10 0.58 28.10 1.40
275
+ 1972 10 22.58 1.51 26.83 1.89 29.44 0.93 28.46 1.82
276
+ 1972 11 23.32 1.58 27.17 2.11 29.48 1.03 28.69 2.09
277
+ 1972 12 24.89 1.99 27.60 2.39 29.35 1.00 28.81 2.24
278
+ 1973 1 26.03 1.49 27.52 1.86 29.03 0.88 28.44 1.88
279
+ 1973 2 26.48 0.56 27.24 0.87 28.77 0.70 28.00 1.26
280
+ 1973 3 26.27 -0.10 27.37 0.24 28.52 0.35 27.71 0.48
281
+ 1973 4 24.87 -0.70 26.87 -0.55 28.39 0.00 27.39 -0.28
282
+ 1973 5 23.44 -0.98 26.06 -1.04 28.51 -0.18 27.13 -0.65
283
+ 1973 6 21.76 -1.31 25.34 -1.12 28.23 -0.44 26.74 -0.79
284
+ 1973 7 20.84 -1.14 24.31 -1.34 28.01 -0.60 25.95 -1.16
285
+ 1973 8 19.47 -1.54 23.69 -1.36 27.65 -0.84 25.46 -1.29
286
+ 1973 9 19.49 -1.28 23.56 -1.38 27.53 -0.98 25.32 -1.39
287
+ 1973 10 19.80 -1.27 23.49 -1.46 27.32 -1.19 25.03 -1.61
288
+ 1973 11 20.71 -1.03 23.35 -1.71 26.97 -1.48 24.50 -2.11
289
+ 1973 12 21.74 -1.17 23.40 -1.81 26.69 -1.65 24.43 -2.14
290
+ 1974 1 23.29 -1.25 23.93 -1.72 26.50 -1.65 24.52 -2.04
291
+ 1974 2 24.87 -1.04 25.11 -1.27 26.87 -1.21 25.12 -1.61
292
+ 1974 3 25.69 -0.68 26.28 -0.85 27.21 -0.96 25.91 -1.32
293
+ 1974 4 25.28 -0.29 26.84 -0.58 27.46 -0.93 26.63 -1.03
294
+ 1974 5 24.35 -0.07 26.56 -0.54 27.94 -0.75 26.84 -0.93
295
+ 1974 6 22.48 -0.58 25.91 -0.55 27.97 -0.70 26.71 -0.82
296
+ 1974 7 21.58 -0.40 25.30 -0.35 27.83 -0.78 26.48 -0.63
297
+ 1974 8 20.73 -0.28 24.82 -0.24 27.97 -0.52 26.37 -0.38
298
+ 1974 9 20.15 -0.62 24.38 -0.56 27.91 -0.61 26.23 -0.47
299
+ 1974 10 19.88 -1.19 24.14 -0.81 27.74 -0.77 25.92 -0.73
300
+ 1974 11 20.68 -1.06 24.07 -0.98 27.72 -0.73 25.63 -0.97
301
+ 1974 12 21.41 -1.50 24.31 -0.90 27.61 -0.74 25.70 -0.87
302
+ 1975 1 23.55 -0.99 25.34 -0.31 27.86 -0.30 26.18 -0.37
303
+ 1975 2 24.95 -0.97 25.74 -0.64 27.96 -0.12 26.22 -0.52
304
+ 1975 3 26.06 -0.32 26.49 -0.64 27.76 -0.41 26.44 -0.79
305
+ 1975 4 25.53 -0.04 27.08 -0.34 27.83 -0.56 26.99 -0.67
306
+ 1975 5 23.71 -0.72 26.27 -0.83 27.95 -0.74 26.97 -0.80
307
+ 1975 6 21.84 -1.22 25.29 -1.18 27.71 -0.96 26.29 -1.24
308
+ 1975 7 21.05 -0.92 24.72 -0.93 27.57 -1.04 25.98 -1.12
309
+ 1975 8 19.97 -1.04 24.15 -0.91 27.29 -1.21 25.47 -1.28
310
+ 1975 9 19.14 -1.63 23.67 -1.27 26.91 -1.60 25.20 -1.50
311
+ 1975 10 19.17 -1.90 23.40 -1.54 26.76 -1.75 24.87 -1.77
312
+ 1975 11 19.44 -2.30 23.73 -1.33 26.80 -1.66 25.10 -1.50
313
+ 1975 12 21.05 -1.85 23.39 -1.82 26.84 -1.50 24.76 -1.81
314
+ 1976 1 23.51 -1.02 23.91 -1.74 26.92 -1.23 24.72 -1.84
315
+ 1976 2 25.36 -0.56 25.31 -1.07 27.19 -0.89 25.58 -1.16
316
+ 1976 3 25.88 -0.49 26.46 -0.66 27.56 -0.61 26.61 -0.62
317
+ 1976 4 25.72 0.15 26.94 -0.49 27.98 -0.42 26.99 -0.67
318
+ 1976 5 25.11 0.69 26.98 -0.12 28.32 -0.37 27.27 -0.50
319
+ 1976 6 24.46 1.39 26.95 0.48 28.32 -0.35 27.34 -0.19
320
+ 1976 7 23.30 1.33 26.29 0.65 28.42 -0.19 27.26 0.16
321
+ 1976 8 21.91 0.90 25.87 0.81 28.34 -0.15 27.09 0.34
322
+ 1976 9 21.56 0.79 25.76 0.83 28.50 -0.01 27.12 0.42
323
+ 1976 10 21.69 0.62 25.97 1.03 28.82 0.31 27.48 0.84
324
+ 1976 11 22.14 0.40 25.93 0.87 28.92 0.47 27.42 0.82
325
+ 1976 12 23.29 0.39 25.91 0.70 28.45 0.10 27.17 0.60
326
+ 1977 1 24.93 0.39 26.57 0.92 28.38 0.23 27.31 0.76
327
+ 1977 2 25.79 -0.13 27.03 0.65 28.11 0.04 27.15 0.41
328
+ 1977 3 26.13 -0.24 27.51 0.38 28.28 0.10 27.57 0.34
329
+ 1977 4 25.29 -0.28 27.02 -0.41 28.50 0.10 27.61 -0.05
330
+ 1977 5 23.88 -0.54 27.04 -0.06 28.78 0.09 27.97 0.19
331
+ 1977 6 22.70 -0.37 26.56 0.09 28.97 0.30 27.96 0.43
332
+ 1977 7 21.63 -0.34 25.70 0.05 29.13 0.52 27.56 0.45
333
+ 1977 8 20.25 -0.76 24.81 -0.25 28.87 0.38 26.93 0.18
334
+ 1977 9 19.82 -0.95 24.97 0.04 28.98 0.47 27.21 0.50
335
+ 1977 10 20.61 -0.46 25.34 0.39 28.96 0.45 27.37 0.73
336
+ 1977 11 21.29 -0.45 25.41 0.35 29.10 0.65 27.28 0.67
337
+ 1977 12 22.47 -0.44 25.54 0.33 29.11 0.76 27.37 0.80
338
+ 1978 1 24.32 -0.22 25.92 0.27 28.80 0.65 27.32 0.77
339
+ 1978 2 25.77 -0.15 26.46 0.09 28.48 0.41 27.17 0.43
340
+ 1978 3 25.39 -0.98 26.83 -0.30 28.26 0.09 27.24 0.01
341
+ 1978 4 24.73 -0.84 26.66 -0.77 28.28 -0.11 27.26 -0.41
342
+ 1978 5 23.15 -1.27 26.13 -0.97 28.72 0.03 27.36 -0.42
343
+ 1978 6 21.89 -1.18 25.68 -0.79 28.56 -0.11 27.16 -0.37
344
+ 1978 7 21.01 -0.96 25.08 -0.57 28.26 -0.35 26.81 -0.29
345
+ 1978 8 19.66 -1.35 24.35 -0.71 28.25 -0.24 26.23 -0.52
346
+ 1978 9 19.98 -0.79 24.33 -0.61 28.43 -0.08 26.20 -0.50
347
+ 1978 10 20.22 -0.86 24.72 -0.22 28.35 -0.16 26.40 -0.24
348
+ 1978 11 21.62 -0.12 24.94 -0.11 28.37 -0.09 26.43 -0.17
349
+ 1978 12 22.94 0.03 25.34 0.13 28.27 -0.08 26.48 -0.09
350
+ 1979 1 24.71 0.17 25.43 -0.23 28.40 0.25 26.45 -0.11
351
+ 1979 2 25.60 -0.32 26.19 -0.19 28.22 0.14 26.60 -0.13
352
+ 1979 3 25.93 -0.44 27.25 0.12 28.26 0.09 27.48 0.25
353
+ 1979 4 25.58 0.01 27.66 0.23 28.35 -0.05 27.87 0.20
354
+ 1979 5 24.52 0.10 27.26 0.16 28.70 0.01 27.74 -0.03
355
+ 1979 6 23.28 0.22 26.54 0.08 28.74 0.07 27.55 0.02
356
+ 1979 7 21.79 -0.19 25.56 -0.09 28.66 0.05 26.95 -0.15
357
+ 1979 8 21.05 0.04 25.29 0.23 28.36 -0.13 26.77 0.02
358
+ 1979 9 21.15 0.39 25.58 0.65 28.67 0.16 27.15 0.45
359
+ 1979 10 21.43 0.36 25.54 0.60 28.81 0.31 27.01 0.36
360
+ 1979 11 21.95 0.21 25.58 0.53 28.87 0.42 27.08 0.48
361
+ 1979 12 22.97 0.07 25.68 0.47 28.79 0.45 27.09 0.52
362
+ 1980 1 24.35 -0.18 26.12 0.47 28.62 0.47 27.10 0.54
363
+ 1980 2 25.73 -0.18 26.52 0.15 28.47 0.39 27.03 0.29
364
+ 1980 3 26.46 0.08 27.05 -0.07 28.51 0.34 27.38 0.15
365
+ 1980 4 25.71 0.14 27.33 -0.10 28.70 0.30 27.78 0.12
366
+ 1980 5 24.46 0.04 27.15 0.05 29.08 0.39 27.99 0.21
367
+ 1980 6 22.88 -0.19 26.76 0.29 29.15 0.48 27.99 0.46
368
+ 1980 7 21.26 -0.71 25.65 0.00 28.95 0.34 27.35 0.24
369
+ 1980 8 20.57 -0.44 24.87 -0.19 28.47 -0.02 26.62 -0.13
370
+ 1980 9 20.45 -0.32 24.86 -0.08 28.50 -0.01 26.57 -0.13
371
+ 1980 10 20.43 -0.64 24.62 -0.32 28.66 0.15 26.51 -0.13
372
+ 1980 11 21.23 -0.51 25.07 0.02 28.58 0.13 26.63 0.03
373
+ 1980 12 22.34 -0.56 25.28 0.07 28.44 0.10 26.58 0.01
374
+ 1981 1 22.98 -1.56 25.05 -0.61 28.08 -0.08 26.17 -0.39
375
+ 1981 2 24.90 -1.01 25.63 -0.75 27.94 -0.14 26.13 -0.60
376
+ 1981 3 25.94 -0.43 26.74 -0.39 28.08 -0.09 26.75 -0.48
377
+ 1981 4 24.89 -0.68 27.10 -0.32 28.17 -0.22 27.32 -0.34
378
+ 1981 5 23.90 -0.52 26.74 -0.37 28.34 -0.35 27.41 -0.36
379
+ 1981 6 22.57 -0.50 26.26 -0.20 28.36 -0.31 27.35 -0.18
380
+ 1981 7 21.10 -0.87 25.26 -0.39 28.29 -0.32 26.66 -0.44
381
+ 1981 8 20.03 -0.98 24.43 -0.63 28.22 -0.28 26.25 -0.50
382
+ 1981 9 20.09 -0.68 24.74 -0.20 28.30 -0.22 26.54 -0.17
383
+ 1981 10 20.58 -0.49 24.92 -0.03 28.45 -0.06 26.52 -0.12
384
+ 1981 11 21.26 -0.48 24.83 -0.22 28.47 0.02 26.41 -0.19
385
+ 1981 12 22.60 -0.30 25.23 0.03 28.43 0.09 26.47 -0.10
386
+ 1982 1 24.36 -0.18 25.96 0.30 28.19 0.03 26.69 0.14
387
+ 1982 2 25.42 -0.49 26.55 0.17 28.04 -0.04 26.71 -0.02
388
+ 1982 3 25.40 -0.98 27.06 -0.07 28.37 0.19 27.36 0.13
389
+ 1982 4 24.96 -0.61 27.52 0.10 28.78 0.39 27.90 0.24
390
+ 1982 5 24.21 -0.21 27.66 0.56 29.21 0.52 28.42 0.65
391
+ 1982 6 23.35 0.29 27.31 0.84 29.20 0.53 28.32 0.79
392
+ 1982 7 22.50 0.52 26.33 0.68 28.83 0.22 27.65 0.54
393
+ 1982 8 21.89 0.88 26.21 1.15 28.81 0.32 27.64 0.89
394
+ 1982 9 22.04 1.27 26.82 1.88 28.98 0.47 28.21 1.50
395
+ 1982 10 22.88 1.81 27.31 2.37 29.37 0.86 28.68 2.04
396
+ 1982 11 24.57 2.83 27.68 2.63 29.18 0.73 28.72 2.11
397
+ 1982 12 25.89 2.98 28.23 3.02 29.13 0.79 28.94 2.37
398
+ 1983 1 27.25 2.71 28.60 2.95 28.96 0.81 28.93 2.37
399
+ 1983 2 28.23 2.32 28.63 2.26 28.80 0.73 28.75 2.01
400
+ 1983 3 28.85 2.48 28.91 1.78 28.81 0.64 28.76 1.53
401
+ 1983 4 28.82 3.25 29.06 1.63 28.81 0.42 28.74 1.07
402
+ 1983 5 28.37 3.95 28.98 1.87 29.21 0.51 28.82 1.05
403
+ 1983 6 27.43 4.36 28.19 1.72 28.98 0.31 28.27 0.74
404
+ 1983 7 25.73 3.75 26.66 1.01 28.64 0.03 27.18 0.07
405
+ 1983 8 23.88 2.87 25.78 0.72 28.35 -0.14 26.51 -0.24
406
+ 1983 9 22.26 1.49 25.02 0.09 28.05 -0.46 26.18 -0.52
407
+ 1983 10 22.22 1.15 24.48 -0.46 27.92 -0.59 25.75 -0.89
408
+ 1983 11 22.21 0.47 24.19 -0.86 27.73 -0.73 25.54 -1.06
409
+ 1983 12 23.19 0.29 24.58 -0.63 27.75 -0.59 25.82 -0.75
410
+ 1984 1 24.32 -0.21 25.30 -0.35 27.64 -0.51 26.14 -0.42
411
+ 1984 2 25.12 -0.79 26.43 0.05 27.60 -0.48 26.72 -0.02
412
+ 1984 3 25.75 -0.63 27.14 0.01 27.59 -0.58 27.05 -0.19
413
+ 1984 4 25.40 -0.17 27.24 -0.18 27.78 -0.61 27.30 -0.37
414
+ 1984 5 23.58 -0.84 26.38 -0.72 28.19 -0.51 27.31 -0.47
415
+ 1984 6 22.30 -0.77 25.50 -0.97 28.38 -0.29 26.95 -0.58
416
+ 1984 7 21.53 -0.44 25.04 -0.60 28.47 -0.14 26.84 -0.26
417
+ 1984 8 20.64 -0.37 24.81 -0.25 28.30 -0.19 26.67 -0.08
418
+ 1984 9 20.73 -0.04 24.63 -0.30 28.26 -0.25 26.43 -0.27
419
+ 1984 10 20.62 -0.45 24.34 -0.61 28.19 -0.32 26.15 -0.49
420
+ 1984 11 21.70 -0.04 24.23 -0.83 27.92 -0.53 25.60 -1.00
421
+ 1984 12 22.47 -0.44 24.10 -1.11 27.60 -0.74 25.38 -1.19
422
+ 1985 1 23.84 -0.70 24.68 -0.97 27.55 -0.60 25.58 -0.98
423
+ 1985 2 24.83 -1.08 25.65 -0.72 27.68 -0.39 26.11 -0.63
424
+ 1985 3 25.60 -0.77 26.45 -0.68 27.59 -0.58 26.53 -0.71
425
+ 1985 4 24.28 -1.29 26.63 -0.79 27.78 -0.61 26.93 -0.74
426
+ 1985 5 22.67 -1.75 26.26 -0.84 27.99 -0.70 27.09 -0.68
427
+ 1985 6 21.84 -1.23 25.66 -0.81 28.09 -0.58 26.92 -0.61
428
+ 1985 7 20.75 -1.23 24.72 -0.93 28.32 -0.30 26.64 -0.46
429
+ 1985 8 19.90 -1.11 24.12 -0.94 28.34 -0.16 26.28 -0.47
430
+ 1985 9 19.86 -0.91 24.05 -0.88 28.32 -0.20 26.08 -0.62
431
+ 1985 10 20.26 -0.81 24.23 -0.71 28.40 -0.11 26.22 -0.42
432
+ 1985 11 20.97 -0.77 24.40 -0.65 28.48 0.03 26.39 -0.22
433
+ 1985 12 22.49 -0.41 24.56 -0.65 28.39 0.05 26.19 -0.38
434
+ 1986 1 24.31 -0.23 24.99 -0.67 27.96 -0.19 26.04 -0.52
435
+ 1986 2 25.90 -0.02 26.04 -0.33 27.95 -0.13 26.26 -0.48
436
+ 1986 3 25.78 -0.59 26.92 -0.21 28.11 -0.06 26.99 -0.24
437
+ 1986 4 24.86 -0.71 27.30 -0.13 28.23 -0.17 27.65 -0.02
438
+ 1986 5 23.35 -1.07 26.78 -0.32 28.53 -0.17 27.58 -0.20
439
+ 1986 6 22.03 -1.04 26.27 -0.20 28.76 0.09 27.56 0.03
440
+ 1986 7 21.64 -0.33 25.82 0.18 28.75 0.14 27.39 0.28
441
+ 1986 8 21.07 0.06 25.38 0.33 28.95 0.46 27.21 0.46
442
+ 1986 9 21.13 0.36 25.38 0.44 29.20 0.69 27.35 0.65
443
+ 1986 10 21.46 0.39 25.65 0.70 29.27 0.76 27.60 0.95
444
+ 1986 11 22.17 0.43 25.94 0.88 29.33 0.88 27.67 1.07
445
+ 1986 12 23.53 0.63 26.26 1.05 28.97 0.63 27.75 1.18
446
+ 1987 1 25.60 1.07 26.74 1.09 28.81 0.65 27.82 1.27
447
+ 1987 2 27.02 1.10 27.60 1.23 28.82 0.74 28.02 1.29
448
+ 1987 3 27.89 1.51 28.38 1.26 28.95 0.77 28.49 1.26
449
+ 1987 4 26.95 1.38 28.63 1.20 28.97 0.58 28.68 1.02
450
+ 1987 5 25.96 1.53 28.30 1.19 29.24 0.55 28.70 0.93
451
+ 1987 6 24.04 0.97 27.51 1.04 29.44 0.77 28.67 1.14
452
+ 1987 7 23.00 1.03 26.94 1.30 29.37 0.76 28.52 1.42
453
+ 1987 8 21.92 0.91 26.59 1.53 29.40 0.91 28.48 1.73
454
+ 1987 9 22.00 1.23 26.62 1.68 29.47 0.96 28.42 1.71
455
+ 1987 10 22.54 1.47 26.19 1.25 29.67 1.17 28.08 1.43
456
+ 1987 11 22.84 1.10 26.21 1.16 29.53 1.08 27.94 1.34
457
+ 1987 12 23.51 0.60 26.33 1.12 29.25 0.90 27.60 1.03
458
+ 1988 1 24.76 0.22 26.47 0.82 28.97 0.81 27.49 0.94
459
+ 1988 2 25.74 -0.18 26.43 0.05 28.54 0.46 27.01 0.28
460
+ 1988 3 25.71 -0.66 27.10 -0.03 28.46 0.29 27.45 0.22
461
+ 1988 4 24.68 -0.89 27.01 -0.41 28.41 0.02 27.56 -0.10
462
+ 1988 5 23.18 -1.24 25.88 -1.22 28.26 -0.43 26.97 -0.80
463
+ 1988 6 21.66 -1.41 24.61 -1.86 28.00 -0.67 26.21 -1.32
464
+ 1988 7 20.59 -1.38 23.79 -1.85 27.95 -0.67 25.66 -1.45
465
+ 1988 8 19.63 -1.38 23.71 -1.35 28.07 -0.43 25.71 -1.04
466
+ 1988 9 19.44 -1.32 23.88 -1.06 27.90 -0.61 25.72 -0.99
467
+ 1988 10 19.83 -1.24 23.41 -1.53 27.12 -1.39 24.82 -1.82
468
+ 1988 11 20.96 -0.78 23.45 -1.61 27.06 -1.39 24.73 -1.87
469
+ 1988 12 22.25 -0.66 23.50 -1.71 26.85 -1.49 24.68 -1.89
470
+ 1989 1 24.36 -0.18 24.27 -1.38 26.63 -1.52 24.70 -1.86
471
+ 1989 2 26.02 0.10 25.49 -0.89 26.75 -1.33 25.34 -1.40
472
+ 1989 3 26.21 -0.17 26.23 -0.90 27.25 -0.93 26.12 -1.12
473
+ 1989 4 25.54 -0.03 26.85 -0.57 27.71 -0.68 26.83 -0.83
474
+ 1989 5 23.36 -1.06 26.58 -0.53 28.24 -0.46 27.18 -0.60
475
+ 1989 6 22.14 -0.93 26.42 -0.05 28.12 -0.55 27.23 -0.30
476
+ 1989 7 21.27 -0.70 25.32 -0.32 28.23 -0.38 26.80 -0.31
477
+ 1989 8 20.86 -0.15 24.73 -0.33 28.10 -0.39 26.43 -0.32
478
+ 1989 9 20.17 -0.60 24.67 -0.27 28.37 -0.14 26.46 -0.24
479
+ 1989 10 20.52 -0.55 24.61 -0.34 28.27 -0.24 26.31 -0.34
480
+ 1989 11 21.44 -0.30 24.56 -0.49 28.10 -0.36 26.29 -0.31
481
+ 1989 12 22.61 -0.30 24.92 -0.29 28.51 0.17 26.58 0.01
482
+ 1990 1 24.22 -0.32 25.45 -0.20 28.49 0.33 26.63 0.07
483
+ 1990 2 26.17 0.26 26.54 0.16 28.58 0.50 27.03 0.29
484
+ 1990 3 26.15 -0.22 27.01 -0.12 28.69 0.51 27.39 0.16
485
+ 1990 4 25.15 -0.42 27.56 0.14 28.83 0.44 27.94 0.27
486
+ 1990 5 24.14 -0.29 27.42 0.32 28.93 0.23 28.08 0.30
487
+ 1990 6 22.76 -0.31 26.55 0.08 28.97 0.30 27.63 0.10
488
+ 1990 7 21.36 -0.61 25.82 0.18 29.01 0.40 27.42 0.31
489
+ 1990 8 20.70 -0.31 25.32 0.26 28.99 0.49 27.16 0.41
490
+ 1990 9 20.28 -0.49 25.15 0.21 28.92 0.41 26.96 0.25
491
+ 1990 10 20.40 -0.67 24.96 0.02 29.10 0.59 27.01 0.37
492
+ 1990 11 21.19 -0.55 25.00 -0.06 29.13 0.68 26.88 0.28
493
+ 1990 12 22.29 -0.61 25.23 0.02 29.16 0.81 26.96 0.39
494
+ 1991 1 23.99 -0.55 25.84 0.19 28.96 0.81 27.07 0.51
495
+ 1991 2 25.59 -0.33 26.50 0.12 28.71 0.63 27.12 0.38
496
+ 1991 3 26.31 -0.06 27.12 -0.01 28.58 0.40 27.38 0.15
497
+ 1991 4 25.15 -0.42 27.65 0.22 28.94 0.55 28.10 0.44
498
+ 1991 5 24.44 0.02 27.64 0.54 29.37 0.68 28.36 0.58
499
+ 1991 6 23.28 0.21 27.43 0.96 29.28 0.61 28.41 0.88
500
+ 1991 7 22.39 0.42 26.75 1.10 29.27 0.66 28.17 1.07
501
+ 1991 8 21.39 0.38 25.71 0.65 29.23 0.74 27.73 0.98
502
+ 1991 9 21.22 0.45 25.32 0.39 29.24 0.73 27.42 0.71
503
+ 1991 10 21.73 0.66 25.63 0.69 29.44 0.93 27.62 0.98
504
+ 1991 11 22.40 0.66 26.10 1.04 29.40 0.95 27.93 1.33
505
+ 1991 12 23.75 0.85 26.42 1.21 29.46 1.12 28.32 1.75
506
+ 1992 1 25.02 0.48 27.03 1.38 29.03 0.87 28.36 1.81
507
+ 1992 2 26.62 0.71 27.61 1.23 29.00 0.92 28.43 1.69
508
+ 1992 3 27.72 1.34 28.22 1.09 29.03 0.86 28.66 1.42
509
+ 1992 4 27.58 2.01 28.79 1.37 29.16 0.77 29.05 1.39
510
+ 1992 5 26.44 2.02 28.49 1.38 29.39 0.70 29.01 1.24
511
+ 1992 6 23.86 0.79 27.28 0.82 29.28 0.60 28.35 0.82
512
+ 1992 7 21.84 -0.14 25.84 0.19 29.15 0.54 27.56 0.45
513
+ 1992 8 20.87 -0.14 25.11 0.06 28.92 0.43 26.96 0.21
514
+ 1992 9 20.85 0.08 24.90 -0.03 28.83 0.32 26.66 -0.04
515
+ 1992 10 21.15 0.08 24.65 -0.29 28.69 0.18 26.39 -0.25
516
+ 1992 11 21.84 0.10 24.77 -0.29 28.67 0.21 26.60 0.00
517
+ 1992 12 22.79 -0.12 24.97 -0.24 28.82 0.47 26.72 0.15
518
+ 1993 1 24.68 0.15 25.79 0.14 28.71 0.56 26.87 0.31
519
+ 1993 2 26.46 0.55 26.94 0.57 28.37 0.29 27.20 0.46
520
+ 1993 3 27.07 0.69 27.64 0.51 28.50 0.32 27.71 0.48
521
+ 1993 4 26.84 1.28 28.43 1.00 28.78 0.38 28.50 0.83
522
+ 1993 5 25.60 1.18 28.33 1.23 29.03 0.34 28.70 0.93
523
+ 1993 6 24.11 1.04 27.03 0.56 29.03 0.36 28.08 0.55
524
+ 1993 7 22.61 0.64 26.19 0.54 29.01 0.40 27.59 0.49
525
+ 1993 8 21.65 0.64 25.52 0.46 28.86 0.37 27.01 0.26
526
+ 1993 9 21.11 0.34 25.25 0.31 29.02 0.51 27.14 0.43
527
+ 1993 10 21.71 0.64 25.28 0.33 28.84 0.33 27.01 0.36
528
+ 1993 11 22.07 0.33 25.20 0.14 28.88 0.43 26.92 0.32
529
+ 1993 12 22.86 -0.05 25.30 0.09 28.85 0.50 26.79 0.22
530
+ 1994 1 24.56 0.02 25.84 0.18 28.54 0.39 26.74 0.19
531
+ 1994 2 25.89 -0.03 26.40 0.02 28.27 0.20 26.97 0.23
532
+ 1994 3 25.75 -0.62 26.88 -0.24 28.46 0.28 27.52 0.29
533
+ 1994 4 24.49 -1.08 27.15 -0.28 28.82 0.43 28.13 0.46
534
+ 1994 5 23.52 -0.90 27.17 0.06 29.20 0.51 28.27 0.50
535
+ 1994 6 22.31 -0.76 26.63 0.17 29.27 0.60 28.09 0.56
536
+ 1994 7 21.17 -0.80 25.61 -0.04 29.49 0.88 27.68 0.57
537
+ 1994 8 20.22 -0.79 24.93 -0.13 29.51 1.02 27.40 0.65
538
+ 1994 9 20.65 -0.12 24.97 0.03 29.38 0.87 27.25 0.54
539
+ 1994 10 22.04 0.97 25.65 0.70 29.51 1.00 27.53 0.89
540
+ 1994 11 22.27 0.53 26.17 1.12 29.60 1.15 27.95 1.35
541
+ 1994 12 23.75 0.85 26.23 1.02 29.56 1.22 28.02 1.45
542
+ 1995 1 25.48 0.94 26.51 0.86 29.24 1.09 27.74 1.18
543
+ 1995 2 26.25 0.33 26.90 0.52 29.16 1.09 27.67 0.94
544
+ 1995 3 26.09 -0.28 27.26 0.13 29.23 1.05 27.91 0.68
545
+ 1995 4 24.32 -1.25 27.20 -0.23 29.26 0.87 28.17 0.50
546
+ 1995 5 23.37 -1.05 26.55 -0.55 29.36 0.67 27.87 0.10
547
+ 1995 6 22.43 -0.64 26.30 -0.17 29.21 0.54 27.80 0.27
548
+ 1995 7 21.42 -0.55 25.65 0.00 29.03 0.42 27.24 0.14
549
+ 1995 8 20.46 -0.55 24.36 -0.70 28.81 0.32 26.42 -0.33
550
+ 1995 9 20.50 -0.27 24.05 -0.89 28.59 0.08 26.20 -0.50
551
+ 1995 10 20.62 -0.45 24.16 -0.78 28.52 0.01 26.08 -0.57
552
+ 1995 11 21.49 -0.25 24.22 -0.84 28.32 -0.13 25.82 -0.78
553
+ 1995 12 22.03 -0.87 24.45 -0.76 28.13 -0.22 25.86 -0.71
554
+ 1996 1 23.81 -0.73 25.06 -0.59 27.89 -0.27 25.83 -0.73
555
+ 1996 2 25.52 -0.40 25.84 -0.54 27.61 -0.46 25.98 -0.76
556
+ 1996 3 26.28 -0.09 26.75 -0.38 27.91 -0.27 26.73 -0.50
557
+ 1996 4 24.00 -1.57 26.83 -0.59 28.25 -0.15 27.42 -0.25
558
+ 1996 5 23.11 -1.31 26.63 -0.47 28.62 -0.07 27.65 -0.12
559
+ 1996 6 21.66 -1.41 26.10 -0.37 28.71 0.04 27.49 -0.04
560
+ 1996 7 20.72 -1.26 25.29 -0.36 28.65 0.04 27.02 -0.09
561
+ 1996 8 20.23 -0.78 24.78 -0.28 28.62 0.12 26.75 0.00
562
+ 1996 9 20.43 -0.34 24.53 -0.41 28.57 0.05 26.44 -0.27
563
+ 1996 10 20.52 -0.55 24.52 -0.42 28.62 0.11 26.49 -0.15
564
+ 1996 11 20.77 -0.97 24.56 -0.49 28.62 0.17 26.43 -0.17
565
+ 1996 12 21.68 -1.22 24.31 -0.90 28.52 0.18 26.13 -0.44
566
+ 1997 1 23.70 -0.83 24.80 -0.85 28.42 0.26 26.09 -0.47
567
+ 1997 2 26.08 0.16 25.78 -0.60 28.53 0.45 26.46 -0.28
568
+ 1997 3 27.17 0.80 26.97 -0.16 28.73 0.56 27.13 -0.10
569
+ 1997 4 26.74 1.17 27.50 0.07 29.33 0.94 27.97 0.31
570
+ 1997 5 26.77 2.35 28.03 0.92 29.51 0.82 28.63 0.85
571
+ 1997 6 26.15 3.08 28.23 1.76 29.37 0.70 28.86 1.33
572
+ 1997 7 25.59 3.61 27.99 2.34 29.41 0.80 28.86 1.76
573
+ 1997 8 24.95 3.94 27.75 2.69 29.31 0.82 28.69 1.94
574
+ 1997 9 24.69 3.92 27.82 2.88 29.54 1.03 28.89 2.19
575
+ 1997 10 24.64 3.57 28.09 3.15 29.51 1.00 29.14 2.50
576
+ 1997 11 25.85 4.11 28.40 3.35 29.45 1.00 29.13 2.52
577
+ 1997 12 27.08 4.18 28.53 3.32 29.27 0.93 29.04 2.48
578
+ 1998 1 28.12 3.58 28.71 3.06 29.06 0.91 28.98 2.43
579
+ 1998 2 28.82 2.90 28.86 2.48 28.90 0.82 28.71 1.97
580
+ 1998 3 29.24 2.87 29.10 1.97 28.83 0.66 28.66 1.43
581
+ 1998 4 28.45 2.88 29.16 1.74 28.77 0.38 28.64 0.98
582
+ 1998 5 27.36 2.94 28.53 1.42 28.87 0.18 28.47 0.70
583
+ 1998 6 25.19 2.12 27.04 0.57 28.46 -0.21 27.41 -0.12
584
+ 1998 7 23.61 1.64 25.60 -0.05 28.30 -0.31 26.52 -0.59
585
+ 1998 8 22.27 1.26 24.78 -0.28 27.99 -0.50 25.91 -0.84
586
+ 1998 9 21.31 0.54 24.19 -0.75 27.83 -0.68 25.66 -1.05
587
+ 1998 10 21.37 0.30 24.08 -0.86 27.51 -1.00 25.46 -1.19
588
+ 1998 11 21.60 -0.14 24.40 -0.66 27.41 -1.04 25.48 -1.12
589
+ 1998 12 22.81 -0.10 24.25 -0.96 27.19 -1.16 25.12 -1.45
590
+ 1999 1 24.23 -0.31 24.41 -1.24 26.89 -1.26 24.96 -1.59
591
+ 1999 2 25.73 -0.19 25.56 -0.82 26.90 -1.18 25.58 -1.16
592
+ 1999 3 26.47 0.10 26.81 -0.32 27.14 -1.04 26.43 -0.80
593
+ 1999 4 24.53 -1.04 26.90 -0.52 27.66 -0.73 26.92 -0.75
594
+ 1999 5 23.64 -0.78 26.55 -0.56 28.14 -0.55 26.99 -0.78
595
+ 1999 6 22.09 -0.98 25.89 -0.58 28.05 -0.62 26.66 -0.87
596
+ 1999 7 21.36 -0.61 25.03 -0.62 27.89 -0.72 26.28 -0.83
597
+ 1999 8 20.67 -0.34 24.36 -0.70 27.77 -0.73 25.82 -0.93
598
+ 1999 9 20.08 -0.69 23.91 -1.03 27.96 -0.56 25.77 -0.94
599
+ 1999 10 20.46 -0.61 23.77 -1.18 27.93 -0.58 25.62 -1.03
600
+ 1999 11 20.62 -1.12 23.72 -1.34 27.54 -0.91 25.20 -1.40
601
+ 1999 12 22.42 -0.48 23.76 -1.45 27.30 -1.05 24.97 -1.60
602
+ 2000 1 24.01 -0.53 24.12 -1.53 27.17 -0.99 24.88 -1.68
603
+ 2000 2 25.38 -0.54 25.35 -1.03 26.88 -1.20 25.23 -1.50
604
+ 2000 3 25.67 -0.70 26.78 -0.35 26.95 -1.22 26.27 -0.96
605
+ 2000 4 25.53 -0.04 27.46 0.04 27.40 -0.99 26.99 -0.68
606
+ 2000 5 24.27 -0.15 26.85 -0.26 27.90 -0.79 27.10 -0.67
607
+ 2000 6 22.93 -0.13 26.01 -0.46 28.25 -0.42 26.97 -0.56
608
+ 2000 7 21.47 -0.50 25.24 -0.41 28.41 -0.20 26.69 -0.41
609
+ 2000 8 20.07 -0.94 24.74 -0.31 28.28 -0.21 26.46 -0.29
610
+ 2000 9 20.64 -0.13 24.73 -0.21 28.37 -0.14 26.32 -0.39
611
+ 2000 10 20.90 -0.17 24.60 -0.34 28.27 -0.24 26.11 -0.53
612
+ 2000 11 20.67 -1.07 24.43 -0.62 28.06 -0.39 26.01 -0.59
613
+ 2000 12 22.08 -0.83 24.73 -0.48 27.66 -0.68 25.83 -0.74
614
+ 2001 1 24.24 -0.29 25.37 -0.29 27.49 -0.66 25.93 -0.63
615
+ 2001 2 26.11 0.20 26.38 0.01 27.38 -0.70 26.24 -0.49
616
+ 2001 3 26.89 0.52 27.31 0.18 27.68 -0.50 26.89 -0.35
617
+ 2001 4 25.99 0.42 27.52 0.09 28.16 -0.23 27.38 -0.28
618
+ 2001 5 23.98 -0.44 27.21 0.11 28.65 -0.04 27.70 -0.08
619
+ 2001 6 22.71 -0.36 26.44 -0.03 28.91 0.24 27.60 0.07
620
+ 2001 7 21.48 -0.50 25.63 -0.02 29.12 0.51 27.37 0.26
621
+ 2001 8 20.24 -0.77 25.03 -0.03 28.98 0.48 26.95 0.20
622
+ 2001 9 19.73 -1.04 24.49 -0.45 29.11 0.60 26.74 0.04
623
+ 2001 10 20.14 -0.93 24.59 -0.36 29.08 0.58 26.66 0.02
624
+ 2001 11 20.68 -1.06 24.53 -0.53 28.93 0.48 26.47 -0.13
625
+ 2001 12 21.73 -1.17 24.79 -0.42 28.77 0.42 26.32 -0.25
626
+ 2002 1 24.09 -0.45 25.23 -0.42 28.84 0.69 26.49 -0.07
627
+ 2002 2 26.23 0.31 26.22 -0.15 28.70 0.63 26.83 0.09
628
+ 2002 3 27.39 1.01 27.51 0.38 28.62 0.44 27.48 0.25
629
+ 2002 4 26.44 0.87 27.71 0.28 29.14 0.75 28.00 0.34
630
+ 2002 5 25.29 0.87 27.68 0.58 29.61 0.92 28.44 0.66
631
+ 2002 6 23.28 0.21 27.30 0.83 29.58 0.91 28.48 0.95
632
+ 2002 7 21.64 -0.34 26.31 0.67 29.53 0.92 28.03 0.93
633
+ 2002 8 21.32 0.31 25.62 0.56 29.41 0.92 27.67 0.92
634
+ 2002 9 21.42 0.65 25.69 0.75 29.41 0.90 27.75 1.05
635
+ 2002 10 21.85 0.78 25.94 1.00 29.52 1.01 27.95 1.31
636
+ 2002 11 22.85 1.11 26.43 1.37 29.66 1.21 28.14 1.54
637
+ 2002 12 24.05 1.15 26.62 1.41 29.57 1.23 28.08 1.52
638
+ 2003 1 25.01 0.47 26.68 1.02 29.09 0.94 27.68 1.12
639
+ 2003 2 26.27 0.35 27.01 0.63 28.94 0.86 27.63 0.89
640
+ 2003 3 26.91 0.53 27.48 0.35 28.95 0.78 27.84 0.61
641
+ 2003 4 25.41 -0.15 27.22 -0.20 28.94 0.55 27.75 0.08
642
+ 2003 5 23.24 -1.18 26.44 -0.66 29.01 0.32 27.42 -0.36
643
+ 2003 6 22.15 -0.91 26.20 -0.27 29.17 0.50 27.56 0.03
644
+ 2003 7 21.50 -0.48 26.16 0.52 29.19 0.58 27.66 0.55
645
+ 2003 8 21.25 0.24 25.65 0.59 29.09 0.59 27.32 0.57
646
+ 2003 9 20.75 -0.02 25.20 0.26 29.05 0.54 27.10 0.40
647
+ 2003 10 21.70 0.63 25.58 0.63 29.22 0.71 27.33 0.69
648
+ 2003 11 22.33 0.59 25.85 0.80 29.08 0.62 27.13 0.53
649
+ 2003 12 23.60 0.70 26.07 0.86 28.97 0.63 27.04 0.47
650
+ 2004 1 25.09 0.55 26.23 0.58 28.71 0.56 26.90 0.35
651
+ 2004 2 26.47 0.55 26.81 0.44 28.61 0.53 27.04 0.31
652
+ 2004 3 26.12 -0.26 27.47 0.34 28.53 0.36 27.38 0.15
653
+ 2004 4 25.27 -0.30 27.62 0.19 28.82 0.43 27.91 0.24
654
+ 2004 5 23.44 -0.98 26.96 -0.14 29.18 0.49 28.02 0.24
655
+ 2004 6 22.54 -0.53 26.55 0.08 29.24 0.57 27.93 0.40
656
+ 2004 7 21.26 -0.72 25.94 0.30 29.36 0.75 27.86 0.75
657
+ 2004 8 20.79 -0.22 25.47 0.41 29.47 0.98 27.67 0.92
658
+ 2004 9 20.83 0.06 25.42 0.48 29.54 1.02 27.58 0.88
659
+ 2004 10 21.56 0.49 25.64 0.70 29.53 1.03 27.53 0.89
660
+ 2004 11 22.88 1.14 25.84 0.79 29.49 1.04 27.37 0.77
661
+ 2004 12 23.39 0.49 25.95 0.74 29.41 1.07 27.38 0.81
662
+ 2005 1 24.61 0.07 26.10 0.45 29.23 1.08 27.32 0.76
663
+ 2005 2 25.09 -0.83 26.38 0.00 28.91 0.83 27.17 0.43
664
+ 2005 3 25.23 -1.14 27.12 -0.01 28.89 0.71 27.63 0.40
665
+ 2005 4 25.21 -0.36 27.62 0.20 29.03 0.64 28.02 0.36
666
+ 2005 5 24.31 -0.11 27.56 0.46 29.24 0.55 28.30 0.52
667
+ 2005 6 22.60 -0.47 26.86 0.39 29.20 0.53 27.99 0.46
668
+ 2005 7 21.61 -0.37 26.07 0.42 28.93 0.32 27.45 0.34
669
+ 2005 8 20.47 -0.54 25.44 0.38 28.78 0.29 27.11 0.36
670
+ 2005 9 20.00 -0.77 24.88 -0.05 28.85 0.34 26.79 0.09
671
+ 2005 10 19.89 -1.18 24.83 -0.12 28.85 0.34 26.70 0.06
672
+ 2005 11 20.61 -1.13 23.92 -1.14 28.65 0.19 26.13 -0.48
673
+ 2005 12 22.20 -0.70 24.01 -1.20 28.34 0.00 25.80 -0.77
674
+ 2006 1 24.76 0.22 24.66 -0.99 27.91 -0.25 25.68 -0.87
675
+ 2006 2 26.52 0.60 26.02 -0.35 27.58 -0.50 26.15 -0.59
676
+ 2006 3 26.22 -0.15 26.83 -0.30 27.82 -0.35 26.80 -0.43
677
+ 2006 4 24.29 -1.28 27.18 -0.24 28.36 -0.04 27.54 -0.13
678
+ 2006 5 23.84 -0.58 27.30 0.19 28.91 0.21 27.91 0.13
679
+ 2006 6 22.82 -0.24 26.73 0.27 29.15 0.48 27.82 0.29
680
+ 2006 7 22.20 0.22 25.93 0.28 29.14 0.53 27.36 0.25
681
+ 2006 8 21.89 0.88 25.68 0.62 29.20 0.71 27.25 0.50
682
+ 2006 9 21.93 1.16 25.77 0.83 29.30 0.79 27.32 0.61
683
+ 2006 10 22.46 1.39 26.00 1.06 29.43 0.92 27.47 0.83
684
+ 2006 11 22.61 0.87 26.39 1.33 29.55 1.09 27.81 1.21
685
+ 2006 12 24.15 1.24 26.63 1.42 29.45 1.11 27.86 1.29
686
+ 2007 1 25.82 1.28 26.68 1.03 28.98 0.82 27.36 0.81
687
+ 2007 2 26.81 0.90 26.56 0.18 28.69 0.61 26.98 0.24
688
+ 2007 3 26.41 0.04 26.77 -0.36 28.81 0.64 27.25 0.02
689
+ 2007 4 24.96 -0.61 26.93 -0.50 28.88 0.49 27.56 -0.10
690
+ 2007 5 23.05 -1.37 26.40 -0.70 28.90 0.21 27.54 -0.23
691
+ 2007 6 21.61 -1.46 26.11 -0.35 28.92 0.25 27.54 0.01
692
+ 2007 7 21.05 -0.93 25.14 -0.51 28.80 0.19 26.99 -0.12
693
+ 2007 8 19.95 -1.06 24.24 -0.82 28.57 0.08 26.41 -0.34
694
+ 2007 9 19.85 -0.91 23.84 -1.10 28.21 -0.31 25.86 -0.84
695
+ 2007 10 19.31 -1.76 23.85 -1.09 28.09 -0.42 25.73 -0.92
696
+ 2007 11 19.82 -1.92 23.76 -1.30 27.90 -0.56 25.47 -1.14
697
+ 2007 12 21.15 -1.76 23.91 -1.30 27.70 -0.64 25.40 -1.17
698
+ 2008 1 24.24 -0.30 24.42 -1.23 27.18 -0.98 25.06 -1.50
699
+ 2008 2 26.39 0.47 25.34 -1.04 26.79 -1.29 25.19 -1.55
700
+ 2008 3 26.91 0.53 26.54 -0.59 27.22 -0.95 26.16 -1.07
701
+ 2008 4 25.68 0.12 27.36 -0.07 27.53 -0.86 26.97 -0.70
702
+ 2008 5 24.43 0.00 27.15 0.05 27.93 -0.76 27.19 -0.58
703
+ 2008 6 23.19 0.12 26.49 0.02 28.10 -0.57 27.15 -0.38
704
+ 2008 7 23.02 1.05 26.01 0.36 28.18 -0.43 27.00 -0.11
705
+ 2008 8 22.14 1.13 25.56 0.51 28.27 -0.22 26.81 0.06
706
+ 2008 9 21.60 0.84 25.36 0.42 28.25 -0.27 26.70 0.00
707
+ 2008 10 21.39 0.32 25.48 0.53 28.23 -0.28 26.66 0.02
708
+ 2008 11 21.54 -0.20 25.25 0.20 28.16 -0.29 26.52 -0.08
709
+ 2008 12 22.73 -0.18 24.59 -0.62 27.83 -0.52 25.78 -0.79
710
+ 2009 1 24.39 -0.15 25.26 -0.39 27.47 -0.69 25.69 -0.87
711
+ 2009 2 25.53 -0.38 26.16 -0.22 27.34 -0.74 26.02 -0.71
712
+ 2009 3 25.48 -0.89 26.62 -0.51 27.85 -0.32 26.66 -0.57
713
+ 2009 4 25.84 0.27 27.38 -0.04 28.36 -0.03 27.53 -0.13
714
+ 2009 5 24.95 0.52 27.57 0.47 29.09 0.40 28.10 0.33
715
+ 2009 6 24.09 1.02 27.15 0.68 29.15 0.48 28.06 0.53
716
+ 2009 7 23.09 1.12 26.56 0.91 29.13 0.52 27.88 0.78
717
+ 2009 8 22.03 1.02 25.90 0.84 29.20 0.71 27.51 0.76
718
+ 2009 9 21.48 0.71 25.74 0.80 29.24 0.73 27.48 0.78
719
+ 2009 10 21.64 0.57 25.82 0.87 29.68 1.17 27.73 1.09
720
+ 2009 11 21.99 0.25 26.13 1.07 29.90 1.44 28.17 1.57
721
+ 2009 12 23.21 0.31 26.69 1.48 29.80 1.45 28.51 1.94
722
+ 2010 1 24.70 0.17 26.86 1.21 29.58 1.42 28.32 1.76
723
+ 2010 2 26.16 0.24 27.37 1.00 29.25 1.18 28.19 1.45
724
+ 2010 3 26.54 0.16 28.04 0.91 29.18 1.01 28.46 1.23
725
+ 2010 4 26.04 0.47 28.08 0.66 29.28 0.89 28.49 0.82
726
+ 2010 5 24.75 0.33 27.34 0.24 29.27 0.57 28.13 0.36
727
+ 2010 6 23.26 0.19 26.32 -0.15 28.76 0.09 27.35 -0.18
728
+ 2010 7 21.11 -0.87 24.95 -0.70 28.33 -0.28 26.44 -0.67
729
+ 2010 8 19.49 -1.52 24.21 -0.85 27.82 -0.68 25.70 -1.05
730
+ 2010 9 19.28 -1.49 23.83 -1.11 27.47 -1.05 25.36 -1.34
731
+ 2010 10 19.73 -1.34 23.67 -1.28 27.35 -1.16 25.25 -1.40
732
+ 2010 11 20.44 -1.30 23.68 -1.37 27.47 -0.99 25.20 -1.41
733
+ 2010 12 22.07 -0.83 24.00 -1.21 27.54 -0.81 25.29 -1.28
shared/package-files/33/334bd92019e33c11d5e2f1549cf0482daaa247f7204ae539d24141fafee5d600/test_numbers.py ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Tests on algebraic numbers. """
2
+
3
+ from sympy.core.containers import Tuple
4
+ from sympy.core.numbers import (AlgebraicNumber, I, Rational)
5
+ from sympy.core.singleton import S
6
+ from sympy.core.symbol import Symbol
7
+ from sympy.functions.elementary.miscellaneous import sqrt
8
+ from sympy.polys.polytools import Poly
9
+ from sympy.polys.numberfields.subfield import to_number_field
10
+ from sympy.polys.polyclasses import DMP
11
+ from sympy.polys.domains import QQ
12
+ from sympy.polys.rootoftools import CRootOf
13
+ from sympy.abc import x, y
14
+
15
+
16
+ def test_AlgebraicNumber():
17
+ minpoly, root = x**2 - 2, sqrt(2)
18
+
19
+ a = AlgebraicNumber(root, gen=x)
20
+
21
+ assert a.rep == DMP([QQ(1), QQ(0)], QQ)
22
+ assert a.root == root
23
+ assert a.alias is None
24
+ assert a.minpoly == minpoly
25
+ assert a.is_number
26
+
27
+ assert a.is_aliased is False
28
+
29
+ assert a.coeffs() == [S.One, S.Zero]
30
+ assert a.native_coeffs() == [QQ(1), QQ(0)]
31
+
32
+ a = AlgebraicNumber(root, gen=x, alias='y')
33
+
34
+ assert a.rep == DMP([QQ(1), QQ(0)], QQ)
35
+ assert a.root == root
36
+ assert a.alias == Symbol('y')
37
+ assert a.minpoly == minpoly
38
+ assert a.is_number
39
+
40
+ assert a.is_aliased is True
41
+
42
+ a = AlgebraicNumber(root, gen=x, alias=Symbol('y'))
43
+
44
+ assert a.rep == DMP([QQ(1), QQ(0)], QQ)
45
+ assert a.root == root
46
+ assert a.alias == Symbol('y')
47
+ assert a.minpoly == minpoly
48
+ assert a.is_number
49
+
50
+ assert a.is_aliased is True
51
+
52
+ assert AlgebraicNumber(sqrt(2), []).rep == DMP([], QQ)
53
+ assert AlgebraicNumber(sqrt(2), ()).rep == DMP([], QQ)
54
+ assert AlgebraicNumber(sqrt(2), (0, 0)).rep == DMP([], QQ)
55
+
56
+ assert AlgebraicNumber(sqrt(2), [8]).rep == DMP([QQ(8)], QQ)
57
+ assert AlgebraicNumber(sqrt(2), [Rational(8, 3)]).rep == DMP([QQ(8, 3)], QQ)
58
+
59
+ assert AlgebraicNumber(sqrt(2), [7, 3]).rep == DMP([QQ(7), QQ(3)], QQ)
60
+ assert AlgebraicNumber(
61
+ sqrt(2), [Rational(7, 9), Rational(3, 2)]).rep == DMP([QQ(7, 9), QQ(3, 2)], QQ)
62
+
63
+ assert AlgebraicNumber(sqrt(2), [1, 2, 3]).rep == DMP([QQ(2), QQ(5)], QQ)
64
+
65
+ a = AlgebraicNumber(AlgebraicNumber(root, gen=x), [1, 2])
66
+
67
+ assert a.rep == DMP([QQ(1), QQ(2)], QQ)
68
+ assert a.root == root
69
+ assert a.alias is None
70
+ assert a.minpoly == minpoly
71
+ assert a.is_number
72
+
73
+ assert a.is_aliased is False
74
+
75
+ assert a.coeffs() == [S.One, S(2)]
76
+ assert a.native_coeffs() == [QQ(1), QQ(2)]
77
+
78
+ a = AlgebraicNumber((minpoly, root), [1, 2])
79
+
80
+ assert a.rep == DMP([QQ(1), QQ(2)], QQ)
81
+ assert a.root == root
82
+ assert a.alias is None
83
+ assert a.minpoly == minpoly
84
+ assert a.is_number
85
+
86
+ assert a.is_aliased is False
87
+
88
+ a = AlgebraicNumber((Poly(minpoly), root), [1, 2])
89
+
90
+ assert a.rep == DMP([QQ(1), QQ(2)], QQ)
91
+ assert a.root == root
92
+ assert a.alias is None
93
+ assert a.minpoly == minpoly
94
+ assert a.is_number
95
+
96
+ assert a.is_aliased is False
97
+
98
+ assert AlgebraicNumber( sqrt(3)).rep == DMP([ QQ(1), QQ(0)], QQ)
99
+ assert AlgebraicNumber(-sqrt(3)).rep == DMP([ QQ(1), QQ(0)], QQ)
100
+
101
+ a = AlgebraicNumber(sqrt(2))
102
+ b = AlgebraicNumber(sqrt(2))
103
+
104
+ assert a == b
105
+
106
+ c = AlgebraicNumber(sqrt(2), gen=x)
107
+
108
+ assert a == b
109
+ assert a == c
110
+
111
+ a = AlgebraicNumber(sqrt(2), [1, 2])
112
+ b = AlgebraicNumber(sqrt(2), [1, 3])
113
+
114
+ assert a != b and a != sqrt(2) + 3
115
+
116
+ assert (a == x) is False and (a != x) is True
117
+
118
+ a = AlgebraicNumber(sqrt(2), [1, 0])
119
+ b = AlgebraicNumber(sqrt(2), [1, 0], alias=y)
120
+
121
+ assert a.as_poly(x) == Poly(x, domain='QQ')
122
+ assert b.as_poly() == Poly(y, domain='QQ')
123
+
124
+ assert a.as_expr() == sqrt(2)
125
+ assert a.as_expr(x) == x
126
+ assert b.as_expr() == sqrt(2)
127
+ assert b.as_expr(x) == x
128
+
129
+ a = AlgebraicNumber(sqrt(2), [2, 3])
130
+ b = AlgebraicNumber(sqrt(2), [2, 3], alias=y)
131
+
132
+ p = a.as_poly()
133
+
134
+ assert p == Poly(2*p.gen + 3)
135
+
136
+ assert a.as_poly(x) == Poly(2*x + 3, domain='QQ')
137
+ assert b.as_poly() == Poly(2*y + 3, domain='QQ')
138
+
139
+ assert a.as_expr() == 2*sqrt(2) + 3
140
+ assert a.as_expr(x) == 2*x + 3
141
+ assert b.as_expr() == 2*sqrt(2) + 3
142
+ assert b.as_expr(x) == 2*x + 3
143
+
144
+ a = AlgebraicNumber(sqrt(2))
145
+ b = to_number_field(sqrt(2))
146
+ assert a.args == b.args == (sqrt(2), Tuple(1, 0))
147
+ b = AlgebraicNumber(sqrt(2), alias='alpha')
148
+ assert b.args == (sqrt(2), Tuple(1, 0), Symbol('alpha'))
149
+
150
+ a = AlgebraicNumber(sqrt(2), [1, 2, 3])
151
+ assert a.args == (sqrt(2), Tuple(1, 2, 3))
152
+
153
+ a = AlgebraicNumber(sqrt(2), [1, 2], "alpha")
154
+ b = AlgebraicNumber(a)
155
+ c = AlgebraicNumber(a, alias="gamma")
156
+ assert a == b
157
+ assert c.alias.name == "gamma"
158
+
159
+ a = AlgebraicNumber(sqrt(2) + sqrt(3), [S(1)/2, 0, S(-9)/2, 0])
160
+ b = AlgebraicNumber(a, [1, 0, 0])
161
+ assert b.root == a.root
162
+ assert a.to_root() == sqrt(2)
163
+ assert b.to_root() == 2
164
+
165
+ a = AlgebraicNumber(2)
166
+ assert a.is_primitive_element is True
167
+
168
+
169
+ def test_to_algebraic_integer():
170
+ a = AlgebraicNumber(sqrt(3), gen=x).to_algebraic_integer()
171
+
172
+ assert a.minpoly == x**2 - 3
173
+ assert a.root == sqrt(3)
174
+ assert a.rep == DMP([QQ(1), QQ(0)], QQ)
175
+
176
+ a = AlgebraicNumber(2*sqrt(3), gen=x).to_algebraic_integer()
177
+ assert a.minpoly == x**2 - 12
178
+ assert a.root == 2*sqrt(3)
179
+ assert a.rep == DMP([QQ(1), QQ(0)], QQ)
180
+
181
+ a = AlgebraicNumber(sqrt(3)/2, gen=x).to_algebraic_integer()
182
+
183
+ assert a.minpoly == x**2 - 12
184
+ assert a.root == 2*sqrt(3)
185
+ assert a.rep == DMP([QQ(1), QQ(0)], QQ)
186
+
187
+ a = AlgebraicNumber(sqrt(3)/2, [Rational(7, 19), 3], gen=x).to_algebraic_integer()
188
+
189
+ assert a.minpoly == x**2 - 12
190
+ assert a.root == 2*sqrt(3)
191
+ assert a.rep == DMP([QQ(7, 19), QQ(3)], QQ)
192
+
193
+
194
+ def test_AlgebraicNumber_to_root():
195
+ assert AlgebraicNumber(sqrt(2)).to_root() == sqrt(2)
196
+
197
+ zeta5_squared = AlgebraicNumber(CRootOf(x**5 - 1, 4), coeffs=[1, 0, 0])
198
+ assert zeta5_squared.to_root() == CRootOf(x**4 + x**3 + x**2 + x + 1, 1)
199
+
200
+ zeta3_squared = AlgebraicNumber(CRootOf(x**3 - 1, 2), coeffs=[1, 0, 0])
201
+ assert zeta3_squared.to_root() == -S(1)/2 - sqrt(3)*I/2
202
+ assert zeta3_squared.to_root(radicals=False) == CRootOf(x**2 + x + 1, 0)
shared/package-files/33/334f71e0cc7a85c040c24b6fc2fd7a62f3d19acb838d9103c074f452691c832a/Center ADDED
Binary file (990 Bytes). View file
 
shared/package-files/33/3352c161f9ce47e35e01d8cdd20fb76753cfd89e71cbc402c338099e1f13c26d/_neg_view_compositeexplicitautograd_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 compositeexplicitautograd {
19
+
20
+ TORCH_API at::Tensor _neg_view(const at::Tensor & self);
21
+
22
+ } // namespace compositeexplicitautograd
23
+ } // namespace at
shared/package-files/33/3353358982c168f4c099f0d278b065bc3af648d7a61dc7708c70c56b2d3fa1a3/regression.py ADDED
@@ -0,0 +1,940 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Plotting functions for linear models (broadly construed)."""
2
+ import copy
3
+ from textwrap import dedent
4
+ import warnings
5
+ import numpy as np
6
+ import pandas as pd
7
+ import matplotlib as mpl
8
+ import matplotlib.pyplot as plt
9
+
10
+ try:
11
+ import statsmodels
12
+ assert statsmodels
13
+ _has_statsmodels = True
14
+ except ImportError:
15
+ _has_statsmodels = False
16
+
17
+ from . import utils
18
+ from . import algorithms as algo
19
+ from .axisgrid import FacetGrid, _facet_docs
20
+
21
+
22
+ __all__ = ["lmplot", "regplot", "residplot"]
23
+
24
+
25
+ class _LinearPlotter:
26
+ """Base class for plotting relational data in tidy format.
27
+
28
+ To get anything useful done you'll have to inherit from this, but setup
29
+ code that can be abstracted out should be put here.
30
+
31
+ """
32
+ def establish_variables(self, data, **kws):
33
+ """Extract variables from data or use directly."""
34
+ self.data = data
35
+
36
+ # Validate the inputs
37
+ any_strings = any([isinstance(v, str) for v in kws.values()])
38
+ if any_strings and data is None:
39
+ raise ValueError("Must pass `data` if using named variables.")
40
+
41
+ # Set the variables
42
+ for var, val in kws.items():
43
+ if isinstance(val, str):
44
+ vector = data[val]
45
+ elif isinstance(val, list):
46
+ vector = np.asarray(val)
47
+ else:
48
+ vector = val
49
+ if vector is not None and vector.shape != (1,):
50
+ vector = np.squeeze(vector)
51
+ if np.ndim(vector) > 1:
52
+ err = "regplot inputs must be 1d"
53
+ raise ValueError(err)
54
+ setattr(self, var, vector)
55
+
56
+ def dropna(self, *vars):
57
+ """Remove observations with missing data."""
58
+ vals = [getattr(self, var) for var in vars]
59
+ vals = [v for v in vals if v is not None]
60
+ not_na = np.all(np.column_stack([pd.notnull(v) for v in vals]), axis=1)
61
+ for var in vars:
62
+ val = getattr(self, var)
63
+ if val is not None:
64
+ setattr(self, var, val[not_na])
65
+
66
+ def plot(self, ax):
67
+ raise NotImplementedError
68
+
69
+
70
+ class _RegressionPlotter(_LinearPlotter):
71
+ """Plotter for numeric independent variables with regression model.
72
+
73
+ This does the computations and drawing for the `regplot` function, and
74
+ is thus also used indirectly by `lmplot`.
75
+ """
76
+ def __init__(self, x, y, data=None, x_estimator=None, x_bins=None,
77
+ x_ci="ci", scatter=True, fit_reg=True, ci=95, n_boot=1000,
78
+ units=None, seed=None, order=1, logistic=False, lowess=False,
79
+ robust=False, logx=False, x_partial=None, y_partial=None,
80
+ truncate=False, dropna=True, x_jitter=None, y_jitter=None,
81
+ color=None, label=None):
82
+
83
+ # Set member attributes
84
+ self.x_estimator = x_estimator
85
+ self.ci = ci
86
+ self.x_ci = ci if x_ci == "ci" else x_ci
87
+ self.n_boot = n_boot
88
+ self.seed = seed
89
+ self.scatter = scatter
90
+ self.fit_reg = fit_reg
91
+ self.order = order
92
+ self.logistic = logistic
93
+ self.lowess = lowess
94
+ self.robust = robust
95
+ self.logx = logx
96
+ self.truncate = truncate
97
+ self.x_jitter = x_jitter
98
+ self.y_jitter = y_jitter
99
+ self.color = color
100
+ self.label = label
101
+
102
+ # Validate the regression options:
103
+ if sum((order > 1, logistic, robust, lowess, logx)) > 1:
104
+ raise ValueError("Mutually exclusive regression options.")
105
+
106
+ # Extract the data vals from the arguments or passed dataframe
107
+ self.establish_variables(data, x=x, y=y, units=units,
108
+ x_partial=x_partial, y_partial=y_partial)
109
+
110
+ # Drop null observations
111
+ if dropna:
112
+ self.dropna("x", "y", "units", "x_partial", "y_partial")
113
+
114
+ # Regress nuisance variables out of the data
115
+ if self.x_partial is not None:
116
+ self.x = self.regress_out(self.x, self.x_partial)
117
+ if self.y_partial is not None:
118
+ self.y = self.regress_out(self.y, self.y_partial)
119
+
120
+ # Possibly bin the predictor variable, which implies a point estimate
121
+ if x_bins is not None:
122
+ self.x_estimator = np.mean if x_estimator is None else x_estimator
123
+ x_discrete, x_bins = self.bin_predictor(x_bins)
124
+ self.x_discrete = x_discrete
125
+ else:
126
+ self.x_discrete = self.x
127
+
128
+ # Disable regression in case of singleton inputs
129
+ if len(self.x) <= 1:
130
+ self.fit_reg = False
131
+
132
+ # Save the range of the x variable for the grid later
133
+ if self.fit_reg:
134
+ self.x_range = self.x.min(), self.x.max()
135
+
136
+ @property
137
+ def scatter_data(self):
138
+ """Data where each observation is a point."""
139
+ x_j = self.x_jitter
140
+ if x_j is None:
141
+ x = self.x
142
+ else:
143
+ x = self.x + np.random.uniform(-x_j, x_j, len(self.x))
144
+
145
+ y_j = self.y_jitter
146
+ if y_j is None:
147
+ y = self.y
148
+ else:
149
+ y = self.y + np.random.uniform(-y_j, y_j, len(self.y))
150
+
151
+ return x, y
152
+
153
+ @property
154
+ def estimate_data(self):
155
+ """Data with a point estimate and CI for each discrete x value."""
156
+ x, y = self.x_discrete, self.y
157
+ vals = sorted(np.unique(x))
158
+ points, cis = [], []
159
+
160
+ for val in vals:
161
+
162
+ # Get the point estimate of the y variable
163
+ _y = y[x == val]
164
+ est = self.x_estimator(_y)
165
+ points.append(est)
166
+
167
+ # Compute the confidence interval for this estimate
168
+ if self.x_ci is None:
169
+ cis.append(None)
170
+ else:
171
+ units = None
172
+ if self.x_ci == "sd":
173
+ sd = np.std(_y)
174
+ _ci = est - sd, est + sd
175
+ else:
176
+ if self.units is not None:
177
+ units = self.units[x == val]
178
+ boots = algo.bootstrap(_y,
179
+ func=self.x_estimator,
180
+ n_boot=self.n_boot,
181
+ units=units,
182
+ seed=self.seed)
183
+ _ci = utils.ci(boots, self.x_ci)
184
+ cis.append(_ci)
185
+
186
+ return vals, points, cis
187
+
188
+ def _check_statsmodels(self):
189
+ """Check whether statsmodels is installed if any boolean options require it."""
190
+ options = "logistic", "robust", "lowess"
191
+ err = "`{}=True` requires statsmodels, an optional dependency, to be installed."
192
+ for option in options:
193
+ if getattr(self, option) and not _has_statsmodels:
194
+ raise RuntimeError(err.format(option))
195
+
196
+ def fit_regression(self, ax=None, x_range=None, grid=None):
197
+ """Fit the regression model."""
198
+ self._check_statsmodels()
199
+
200
+ # Create the grid for the regression
201
+ if grid is None:
202
+ if self.truncate:
203
+ x_min, x_max = self.x_range
204
+ else:
205
+ if ax is None:
206
+ x_min, x_max = x_range
207
+ else:
208
+ x_min, x_max = ax.get_xlim()
209
+ grid = np.linspace(x_min, x_max, 100)
210
+ ci = self.ci
211
+
212
+ # Fit the regression
213
+ if self.order > 1:
214
+ yhat, yhat_boots = self.fit_poly(grid, self.order)
215
+ elif self.logistic:
216
+ from statsmodels.genmod.generalized_linear_model import GLM
217
+ from statsmodels.genmod.families import Binomial
218
+ yhat, yhat_boots = self.fit_statsmodels(grid, GLM,
219
+ family=Binomial())
220
+ elif self.lowess:
221
+ ci = None
222
+ grid, yhat = self.fit_lowess()
223
+ elif self.robust:
224
+ from statsmodels.robust.robust_linear_model import RLM
225
+ yhat, yhat_boots = self.fit_statsmodels(grid, RLM)
226
+ elif self.logx:
227
+ yhat, yhat_boots = self.fit_logx(grid)
228
+ else:
229
+ yhat, yhat_boots = self.fit_fast(grid)
230
+
231
+ # Compute the confidence interval at each grid point
232
+ if ci is None:
233
+ err_bands = None
234
+ else:
235
+ err_bands = utils.ci(yhat_boots, ci, axis=0)
236
+
237
+ return grid, yhat, err_bands
238
+
239
+ def fit_fast(self, grid):
240
+ """Low-level regression and prediction using linear algebra."""
241
+ def reg_func(_x, _y):
242
+ return np.linalg.pinv(_x).dot(_y)
243
+
244
+ X, y = np.c_[np.ones(len(self.x)), self.x], self.y
245
+ grid = np.c_[np.ones(len(grid)), grid]
246
+ yhat = grid.dot(reg_func(X, y))
247
+ if self.ci is None:
248
+ return yhat, None
249
+
250
+ beta_boots = algo.bootstrap(X, y,
251
+ func=reg_func,
252
+ n_boot=self.n_boot,
253
+ units=self.units,
254
+ seed=self.seed).T
255
+ yhat_boots = grid.dot(beta_boots).T
256
+ return yhat, yhat_boots
257
+
258
+ def fit_poly(self, grid, order):
259
+ """Regression using numpy polyfit for higher-order trends."""
260
+ def reg_func(_x, _y):
261
+ return np.polyval(np.polyfit(_x, _y, order), grid)
262
+
263
+ x, y = self.x, self.y
264
+ yhat = reg_func(x, y)
265
+ if self.ci is None:
266
+ return yhat, None
267
+
268
+ yhat_boots = algo.bootstrap(x, y,
269
+ func=reg_func,
270
+ n_boot=self.n_boot,
271
+ units=self.units,
272
+ seed=self.seed)
273
+ return yhat, yhat_boots
274
+
275
+ def fit_statsmodels(self, grid, model, **kwargs):
276
+ """More general regression function using statsmodels objects."""
277
+ import statsmodels.tools.sm_exceptions as sme
278
+ X, y = np.c_[np.ones(len(self.x)), self.x], self.y
279
+ grid = np.c_[np.ones(len(grid)), grid]
280
+
281
+ def reg_func(_x, _y):
282
+ err_classes = (sme.PerfectSeparationError,)
283
+ try:
284
+ with warnings.catch_warnings():
285
+ if hasattr(sme, "PerfectSeparationWarning"):
286
+ # statsmodels>=0.14.0
287
+ warnings.simplefilter("error", sme.PerfectSeparationWarning)
288
+ err_classes = (*err_classes, sme.PerfectSeparationWarning)
289
+ yhat = model(_y, _x, **kwargs).fit().predict(grid)
290
+ except err_classes:
291
+ yhat = np.empty(len(grid))
292
+ yhat.fill(np.nan)
293
+ return yhat
294
+
295
+ yhat = reg_func(X, y)
296
+ if self.ci is None:
297
+ return yhat, None
298
+
299
+ yhat_boots = algo.bootstrap(X, y,
300
+ func=reg_func,
301
+ n_boot=self.n_boot,
302
+ units=self.units,
303
+ seed=self.seed)
304
+ return yhat, yhat_boots
305
+
306
+ def fit_lowess(self):
307
+ """Fit a locally-weighted regression, which returns its own grid."""
308
+ from statsmodels.nonparametric.smoothers_lowess import lowess
309
+ grid, yhat = lowess(self.y, self.x).T
310
+ return grid, yhat
311
+
312
+ def fit_logx(self, grid):
313
+ """Fit the model in log-space."""
314
+ X, y = np.c_[np.ones(len(self.x)), self.x], self.y
315
+ grid = np.c_[np.ones(len(grid)), np.log(grid)]
316
+
317
+ def reg_func(_x, _y):
318
+ _x = np.c_[_x[:, 0], np.log(_x[:, 1])]
319
+ return np.linalg.pinv(_x).dot(_y)
320
+
321
+ yhat = grid.dot(reg_func(X, y))
322
+ if self.ci is None:
323
+ return yhat, None
324
+
325
+ beta_boots = algo.bootstrap(X, y,
326
+ func=reg_func,
327
+ n_boot=self.n_boot,
328
+ units=self.units,
329
+ seed=self.seed).T
330
+ yhat_boots = grid.dot(beta_boots).T
331
+ return yhat, yhat_boots
332
+
333
+ def bin_predictor(self, bins):
334
+ """Discretize a predictor by assigning value to closest bin."""
335
+ x = np.asarray(self.x)
336
+ if np.isscalar(bins):
337
+ percentiles = np.linspace(0, 100, bins + 2)[1:-1]
338
+ bins = np.percentile(x, percentiles)
339
+ else:
340
+ bins = np.ravel(bins)
341
+
342
+ dist = np.abs(np.subtract.outer(x, bins))
343
+ x_binned = bins[np.argmin(dist, axis=1)].ravel()
344
+
345
+ return x_binned, bins
346
+
347
+ def regress_out(self, a, b):
348
+ """Regress b from a keeping a's original mean."""
349
+ a_mean = a.mean()
350
+ a = a - a_mean
351
+ b = b - b.mean()
352
+ b = np.c_[b]
353
+ a_prime = a - b.dot(np.linalg.pinv(b).dot(a))
354
+ return np.asarray(a_prime + a_mean).reshape(a.shape)
355
+
356
+ def plot(self, ax, scatter_kws, line_kws):
357
+ """Draw the full plot."""
358
+ # Insert the plot label into the correct set of keyword arguments
359
+ if self.scatter:
360
+ scatter_kws["label"] = self.label
361
+ else:
362
+ line_kws["label"] = self.label
363
+
364
+ # Use the current color cycle state as a default
365
+ if self.color is None:
366
+ lines, = ax.plot([], [])
367
+ color = lines.get_color()
368
+ lines.remove()
369
+ else:
370
+ color = self.color
371
+
372
+ # Ensure that color is hex to avoid matplotlib weirdness
373
+ color = mpl.colors.rgb2hex(mpl.colors.colorConverter.to_rgb(color))
374
+
375
+ # Let color in keyword arguments override overall plot color
376
+ scatter_kws.setdefault("color", color)
377
+ line_kws.setdefault("color", color)
378
+
379
+ # Draw the constituent plots
380
+ if self.scatter:
381
+ self.scatterplot(ax, scatter_kws)
382
+
383
+ if self.fit_reg:
384
+ self.lineplot(ax, line_kws)
385
+
386
+ # Label the axes
387
+ if hasattr(self.x, "name"):
388
+ ax.set_xlabel(self.x.name)
389
+ if hasattr(self.y, "name"):
390
+ ax.set_ylabel(self.y.name)
391
+
392
+ def scatterplot(self, ax, kws):
393
+ """Draw the data."""
394
+ # Treat the line-based markers specially, explicitly setting larger
395
+ # linewidth than is provided by the seaborn style defaults.
396
+ # This would ideally be handled better in matplotlib (i.e., distinguish
397
+ # between edgewidth for solid glyphs and linewidth for line glyphs
398
+ # but this should do for now.
399
+ line_markers = ["1", "2", "3", "4", "+", "x", "|", "_"]
400
+ if self.x_estimator is None:
401
+ if "marker" in kws and kws["marker"] in line_markers:
402
+ lw = mpl.rcParams["lines.linewidth"]
403
+ else:
404
+ lw = mpl.rcParams["lines.markeredgewidth"]
405
+ kws.setdefault("linewidths", lw)
406
+
407
+ if not hasattr(kws['color'], 'shape') or kws['color'].shape[1] < 4:
408
+ kws.setdefault("alpha", .8)
409
+
410
+ x, y = self.scatter_data
411
+ ax.scatter(x, y, **kws)
412
+ else:
413
+ # TODO abstraction
414
+ ci_kws = {"color": kws["color"]}
415
+ if "alpha" in kws:
416
+ ci_kws["alpha"] = kws["alpha"]
417
+ ci_kws["linewidth"] = mpl.rcParams["lines.linewidth"] * 1.75
418
+ kws.setdefault("s", 50)
419
+
420
+ xs, ys, cis = self.estimate_data
421
+ if [ci for ci in cis if ci is not None]:
422
+ for x, ci in zip(xs, cis):
423
+ ax.plot([x, x], ci, **ci_kws)
424
+ ax.scatter(xs, ys, **kws)
425
+
426
+ def lineplot(self, ax, kws):
427
+ """Draw the model."""
428
+ # Fit the regression model
429
+ grid, yhat, err_bands = self.fit_regression(ax)
430
+ edges = grid[0], grid[-1]
431
+
432
+ # Get set default aesthetics
433
+ fill_color = kws["color"]
434
+ lw = kws.pop("lw", mpl.rcParams["lines.linewidth"] * 1.5)
435
+ kws.setdefault("linewidth", lw)
436
+
437
+ # Draw the regression line and confidence interval
438
+ line, = ax.plot(grid, yhat, **kws)
439
+ if not self.truncate:
440
+ line.sticky_edges.x[:] = edges # Prevent mpl from adding margin
441
+ if err_bands is not None:
442
+ ax.fill_between(grid, *err_bands, facecolor=fill_color, alpha=.15)
443
+
444
+
445
+ _regression_docs = dict(
446
+
447
+ model_api=dedent("""\
448
+ There are a number of mutually exclusive options for estimating the
449
+ regression model. See the :ref:`tutorial <regression_tutorial>` for more
450
+ information.\
451
+ """),
452
+ regplot_vs_lmplot=dedent("""\
453
+ The :func:`regplot` and :func:`lmplot` functions are closely related, but
454
+ the former is an axes-level function while the latter is a figure-level
455
+ function that combines :func:`regplot` and :class:`FacetGrid`.\
456
+ """),
457
+ x_estimator=dedent("""\
458
+ x_estimator : callable that maps vector -> scalar, optional
459
+ Apply this function to each unique value of ``x`` and plot the
460
+ resulting estimate. This is useful when ``x`` is a discrete variable.
461
+ If ``x_ci`` is given, this estimate will be bootstrapped and a
462
+ confidence interval will be drawn.\
463
+ """),
464
+ x_bins=dedent("""\
465
+ x_bins : int or vector, optional
466
+ Bin the ``x`` variable into discrete bins and then estimate the central
467
+ tendency and a confidence interval. This binning only influences how
468
+ the scatterplot is drawn; the regression is still fit to the original
469
+ data. This parameter is interpreted either as the number of
470
+ evenly-sized (not necessary spaced) bins or the positions of the bin
471
+ centers. When this parameter is used, it implies that the default of
472
+ ``x_estimator`` is ``numpy.mean``.\
473
+ """),
474
+ x_ci=dedent("""\
475
+ x_ci : "ci", "sd", int in [0, 100] or None, optional
476
+ Size of the confidence interval used when plotting a central tendency
477
+ for discrete values of ``x``. If ``"ci"``, defer to the value of the
478
+ ``ci`` parameter. If ``"sd"``, skip bootstrapping and show the
479
+ standard deviation of the observations in each bin.\
480
+ """),
481
+ scatter=dedent("""\
482
+ scatter : bool, optional
483
+ If ``True``, draw a scatterplot with the underlying observations (or
484
+ the ``x_estimator`` values).\
485
+ """),
486
+ fit_reg=dedent("""\
487
+ fit_reg : bool, optional
488
+ If ``True``, estimate and plot a regression model relating the ``x``
489
+ and ``y`` variables.\
490
+ """),
491
+ ci=dedent("""\
492
+ ci : int in [0, 100] or None, optional
493
+ Size of the confidence interval for the regression estimate. This will
494
+ be drawn using translucent bands around the regression line. The
495
+ confidence interval is estimated using a bootstrap; for large
496
+ datasets, it may be advisable to avoid that computation by setting
497
+ this parameter to None.\
498
+ """),
499
+ n_boot=dedent("""\
500
+ n_boot : int, optional
501
+ Number of bootstrap resamples used to estimate the ``ci``. The default
502
+ value attempts to balance time and stability; you may want to increase
503
+ this value for "final" versions of plots.\
504
+ """),
505
+ units=dedent("""\
506
+ units : variable name in ``data``, optional
507
+ If the ``x`` and ``y`` observations are nested within sampling units,
508
+ those can be specified here. This will be taken into account when
509
+ computing the confidence intervals by performing a multilevel bootstrap
510
+ that resamples both units and observations (within unit). This does not
511
+ otherwise influence how the regression is estimated or drawn.\
512
+ """),
513
+ seed=dedent("""\
514
+ seed : int, numpy.random.Generator, or numpy.random.RandomState, optional
515
+ Seed or random number generator for reproducible bootstrapping.\
516
+ """),
517
+ order=dedent("""\
518
+ order : int, optional
519
+ If ``order`` is greater than 1, use ``numpy.polyfit`` to estimate a
520
+ polynomial regression.\
521
+ """),
522
+ logistic=dedent("""\
523
+ logistic : bool, optional
524
+ If ``True``, assume that ``y`` is a binary variable and use
525
+ ``statsmodels`` to estimate a logistic regression model. Note that this
526
+ is substantially more computationally intensive than linear regression,
527
+ so you may wish to decrease the number of bootstrap resamples
528
+ (``n_boot``) or set ``ci`` to None.\
529
+ """),
530
+ lowess=dedent("""\
531
+ lowess : bool, optional
532
+ If ``True``, use ``statsmodels`` to estimate a nonparametric lowess
533
+ model (locally weighted linear regression). Note that confidence
534
+ intervals cannot currently be drawn for this kind of model.\
535
+ """),
536
+ robust=dedent("""\
537
+ robust : bool, optional
538
+ If ``True``, use ``statsmodels`` to estimate a robust regression. This
539
+ will de-weight outliers. Note that this is substantially more
540
+ computationally intensive than standard linear regression, so you may
541
+ wish to decrease the number of bootstrap resamples (``n_boot``) or set
542
+ ``ci`` to None.\
543
+ """),
544
+ logx=dedent("""\
545
+ logx : bool, optional
546
+ If ``True``, estimate a linear regression of the form y ~ log(x), but
547
+ plot the scatterplot and regression model in the input space. Note that
548
+ ``x`` must be positive for this to work.\
549
+ """),
550
+ xy_partial=dedent("""\
551
+ {x,y}_partial : strings in ``data`` or matrices
552
+ Confounding variables to regress out of the ``x`` or ``y`` variables
553
+ before plotting.\
554
+ """),
555
+ truncate=dedent("""\
556
+ truncate : bool, optional
557
+ If ``True``, the regression line is bounded by the data limits. If
558
+ ``False``, it extends to the ``x`` axis limits.
559
+ """),
560
+ xy_jitter=dedent("""\
561
+ {x,y}_jitter : floats, optional
562
+ Add uniform random noise of this size to either the ``x`` or ``y``
563
+ variables. The noise is added to a copy of the data after fitting the
564
+ regression, and only influences the look of the scatterplot. This can
565
+ be helpful when plotting variables that take discrete values.\
566
+ """),
567
+ scatter_line_kws=dedent("""\
568
+ {scatter,line}_kws : dictionaries
569
+ Additional keyword arguments to pass to ``plt.scatter`` and
570
+ ``plt.plot``.\
571
+ """),
572
+ )
573
+ _regression_docs.update(_facet_docs)
574
+
575
+
576
+ def lmplot(
577
+ data, *,
578
+ x=None, y=None, hue=None, col=None, row=None,
579
+ palette=None, col_wrap=None, height=5, aspect=1, markers="o",
580
+ sharex=None, sharey=None, hue_order=None, col_order=None, row_order=None,
581
+ legend=True, legend_out=None, x_estimator=None, x_bins=None,
582
+ x_ci="ci", scatter=True, fit_reg=True, ci=95, n_boot=1000,
583
+ units=None, seed=None, order=1, logistic=False, lowess=False,
584
+ robust=False, logx=False, x_partial=None, y_partial=None,
585
+ truncate=True, x_jitter=None, y_jitter=None, scatter_kws=None,
586
+ line_kws=None, facet_kws=None,
587
+ ):
588
+
589
+ if facet_kws is None:
590
+ facet_kws = {}
591
+
592
+ def facet_kw_deprecation(key, val):
593
+ msg = (
594
+ f"{key} is deprecated from the `lmplot` function signature. "
595
+ "Please update your code to pass it using `facet_kws`."
596
+ )
597
+ if val is not None:
598
+ warnings.warn(msg, UserWarning)
599
+ facet_kws[key] = val
600
+
601
+ facet_kw_deprecation("sharex", sharex)
602
+ facet_kw_deprecation("sharey", sharey)
603
+ facet_kw_deprecation("legend_out", legend_out)
604
+
605
+ if data is None:
606
+ raise TypeError("Missing required keyword argument `data`.")
607
+
608
+ # Reduce the dataframe to only needed columns
609
+ need_cols = [x, y, hue, col, row, units, x_partial, y_partial]
610
+ cols = np.unique([a for a in need_cols if a is not None]).tolist()
611
+ data = data[cols]
612
+
613
+ # Initialize the grid
614
+ facets = FacetGrid(
615
+ data, row=row, col=col, hue=hue,
616
+ palette=palette,
617
+ row_order=row_order, col_order=col_order, hue_order=hue_order,
618
+ height=height, aspect=aspect, col_wrap=col_wrap,
619
+ **facet_kws,
620
+ )
621
+
622
+ # Add the markers here as FacetGrid has figured out how many levels of the
623
+ # hue variable are needed and we don't want to duplicate that process
624
+ if facets.hue_names is None:
625
+ n_markers = 1
626
+ else:
627
+ n_markers = len(facets.hue_names)
628
+ if not isinstance(markers, list):
629
+ markers = [markers] * n_markers
630
+ if len(markers) != n_markers:
631
+ raise ValueError("markers must be a singleton or a list of markers "
632
+ "for each level of the hue variable")
633
+ facets.hue_kws = {"marker": markers}
634
+
635
+ def update_datalim(data, x, y, ax, **kws):
636
+ xys = data[[x, y]].to_numpy().astype(float)
637
+ ax.update_datalim(xys, updatey=False)
638
+ ax.autoscale_view(scaley=False)
639
+
640
+ facets.map_dataframe(update_datalim, x=x, y=y)
641
+
642
+ # Draw the regression plot on each facet
643
+ regplot_kws = dict(
644
+ x_estimator=x_estimator, x_bins=x_bins, x_ci=x_ci,
645
+ scatter=scatter, fit_reg=fit_reg, ci=ci, n_boot=n_boot, units=units,
646
+ seed=seed, order=order, logistic=logistic, lowess=lowess,
647
+ robust=robust, logx=logx, x_partial=x_partial, y_partial=y_partial,
648
+ truncate=truncate, x_jitter=x_jitter, y_jitter=y_jitter,
649
+ scatter_kws=scatter_kws, line_kws=line_kws,
650
+ )
651
+ facets.map_dataframe(regplot, x=x, y=y, **regplot_kws)
652
+ facets.set_axis_labels(x, y)
653
+
654
+ # Add a legend
655
+ if legend and (hue is not None) and (hue not in [col, row]):
656
+ facets.add_legend()
657
+ return facets
658
+
659
+
660
+ lmplot.__doc__ = dedent("""\
661
+ Plot data and regression model fits across a FacetGrid.
662
+
663
+ This function combines :func:`regplot` and :class:`FacetGrid`. It is
664
+ intended as a convenient interface to fit regression models across
665
+ conditional subsets of a dataset.
666
+
667
+ When thinking about how to assign variables to different facets, a general
668
+ rule is that it makes sense to use ``hue`` for the most important
669
+ comparison, followed by ``col`` and ``row``. However, always think about
670
+ your particular dataset and the goals of the visualization you are
671
+ creating.
672
+
673
+ {model_api}
674
+
675
+ The parameters to this function span most of the options in
676
+ :class:`FacetGrid`, although there may be occasional cases where you will
677
+ want to use that class and :func:`regplot` directly.
678
+
679
+ Parameters
680
+ ----------
681
+ {data}
682
+ x, y : strings, optional
683
+ Input variables; these should be column names in ``data``.
684
+ hue, col, row : strings
685
+ Variables that define subsets of the data, which will be drawn on
686
+ separate facets in the grid. See the ``*_order`` parameters to control
687
+ the order of levels of this variable.
688
+ {palette}
689
+ {col_wrap}
690
+ {height}
691
+ {aspect}
692
+ markers : matplotlib marker code or list of marker codes, optional
693
+ Markers for the scatterplot. If a list, each marker in the list will be
694
+ used for each level of the ``hue`` variable.
695
+ {share_xy}
696
+
697
+ .. deprecated:: 0.12.0
698
+ Pass using the `facet_kws` dictionary.
699
+
700
+ {{hue,col,row}}_order : lists, optional
701
+ Order for the levels of the faceting variables. By default, this will
702
+ be the order that the levels appear in ``data`` or, if the variables
703
+ are pandas categoricals, the category order.
704
+ legend : bool, optional
705
+ If ``True`` and there is a ``hue`` variable, add a legend.
706
+ {legend_out}
707
+
708
+ .. deprecated:: 0.12.0
709
+ Pass using the `facet_kws` dictionary.
710
+
711
+ {x_estimator}
712
+ {x_bins}
713
+ {x_ci}
714
+ {scatter}
715
+ {fit_reg}
716
+ {ci}
717
+ {n_boot}
718
+ {units}
719
+ {seed}
720
+ {order}
721
+ {logistic}
722
+ {lowess}
723
+ {robust}
724
+ {logx}
725
+ {xy_partial}
726
+ {truncate}
727
+ {xy_jitter}
728
+ {scatter_line_kws}
729
+ facet_kws : dict
730
+ Dictionary of keyword arguments for :class:`FacetGrid`.
731
+
732
+ See Also
733
+ --------
734
+ regplot : Plot data and a conditional model fit.
735
+ FacetGrid : Subplot grid for plotting conditional relationships.
736
+ pairplot : Combine :func:`regplot` and :class:`PairGrid` (when used with
737
+ ``kind="reg"``).
738
+
739
+ Notes
740
+ -----
741
+
742
+ {regplot_vs_lmplot}
743
+
744
+ Examples
745
+ --------
746
+
747
+ .. include:: ../docstrings/lmplot.rst
748
+
749
+ """).format(**_regression_docs)
750
+
751
+
752
+ def regplot(
753
+ data=None, *, x=None, y=None,
754
+ x_estimator=None, x_bins=None, x_ci="ci",
755
+ scatter=True, fit_reg=True, ci=95, n_boot=1000, units=None,
756
+ seed=None, order=1, logistic=False, lowess=False, robust=False,
757
+ logx=False, x_partial=None, y_partial=None,
758
+ truncate=True, dropna=True, x_jitter=None, y_jitter=None,
759
+ label=None, color=None, marker="o",
760
+ scatter_kws=None, line_kws=None, ax=None
761
+ ):
762
+
763
+ plotter = _RegressionPlotter(x, y, data, x_estimator, x_bins, x_ci,
764
+ scatter, fit_reg, ci, n_boot, units, seed,
765
+ order, logistic, lowess, robust, logx,
766
+ x_partial, y_partial, truncate, dropna,
767
+ x_jitter, y_jitter, color, label)
768
+
769
+ if ax is None:
770
+ ax = plt.gca()
771
+
772
+ scatter_kws = {} if scatter_kws is None else copy.copy(scatter_kws)
773
+ scatter_kws["marker"] = marker
774
+ line_kws = {} if line_kws is None else copy.copy(line_kws)
775
+ plotter.plot(ax, scatter_kws, line_kws)
776
+ return ax
777
+
778
+
779
+ regplot.__doc__ = dedent("""\
780
+ Plot data and a linear regression model fit.
781
+
782
+ {model_api}
783
+
784
+ Parameters
785
+ ----------
786
+ x, y: string, series, or vector array
787
+ Input variables. If strings, these should correspond with column names
788
+ in ``data``. When pandas objects are used, axes will be labeled with
789
+ the series name.
790
+ {data}
791
+ {x_estimator}
792
+ {x_bins}
793
+ {x_ci}
794
+ {scatter}
795
+ {fit_reg}
796
+ {ci}
797
+ {n_boot}
798
+ {units}
799
+ {seed}
800
+ {order}
801
+ {logistic}
802
+ {lowess}
803
+ {robust}
804
+ {logx}
805
+ {xy_partial}
806
+ {truncate}
807
+ {xy_jitter}
808
+ label : string
809
+ Label to apply to either the scatterplot or regression line (if
810
+ ``scatter`` is ``False``) for use in a legend.
811
+ color : matplotlib color
812
+ Color to apply to all plot elements; will be superseded by colors
813
+ passed in ``scatter_kws`` or ``line_kws``.
814
+ marker : matplotlib marker code
815
+ Marker to use for the scatterplot glyphs.
816
+ {scatter_line_kws}
817
+ ax : matplotlib Axes, optional
818
+ Axes object to draw the plot onto, otherwise uses the current Axes.
819
+
820
+ Returns
821
+ -------
822
+ ax : matplotlib Axes
823
+ The Axes object containing the plot.
824
+
825
+ See Also
826
+ --------
827
+ lmplot : Combine :func:`regplot` and :class:`FacetGrid` to plot multiple
828
+ linear relationships in a dataset.
829
+ jointplot : Combine :func:`regplot` and :class:`JointGrid` (when used with
830
+ ``kind="reg"``).
831
+ pairplot : Combine :func:`regplot` and :class:`PairGrid` (when used with
832
+ ``kind="reg"``).
833
+ residplot : Plot the residuals of a linear regression model.
834
+
835
+ Notes
836
+ -----
837
+
838
+ {regplot_vs_lmplot}
839
+
840
+
841
+ It's also easy to combine :func:`regplot` and :class:`JointGrid` or
842
+ :class:`PairGrid` through the :func:`jointplot` and :func:`pairplot`
843
+ functions, although these do not directly accept all of :func:`regplot`'s
844
+ parameters.
845
+
846
+ Examples
847
+ --------
848
+
849
+ .. include:: ../docstrings/regplot.rst
850
+
851
+ """).format(**_regression_docs)
852
+
853
+
854
+ def residplot(
855
+ data=None, *, x=None, y=None,
856
+ x_partial=None, y_partial=None, lowess=False,
857
+ order=1, robust=False, dropna=True, label=None, color=None,
858
+ scatter_kws=None, line_kws=None, ax=None
859
+ ):
860
+ """Plot the residuals of a linear regression.
861
+
862
+ This function will regress y on x (possibly as a robust or polynomial
863
+ regression) and then draw a scatterplot of the residuals. You can
864
+ optionally fit a lowess smoother to the residual plot, which can
865
+ help in determining if there is structure to the residuals.
866
+
867
+ Parameters
868
+ ----------
869
+ data : DataFrame, optional
870
+ DataFrame to use if `x` and `y` are column names.
871
+ x : vector or string
872
+ Data or column name in `data` for the predictor variable.
873
+ y : vector or string
874
+ Data or column name in `data` for the response variable.
875
+ {x, y}_partial : vectors or string(s) , optional
876
+ These variables are treated as confounding and are removed from
877
+ the `x` or `y` variables before plotting.
878
+ lowess : boolean, optional
879
+ Fit a lowess smoother to the residual scatterplot.
880
+ order : int, optional
881
+ Order of the polynomial to fit when calculating the residuals.
882
+ robust : boolean, optional
883
+ Fit a robust linear regression when calculating the residuals.
884
+ dropna : boolean, optional
885
+ If True, ignore observations with missing data when fitting and
886
+ plotting.
887
+ label : string, optional
888
+ Label that will be used in any plot legends.
889
+ color : matplotlib color, optional
890
+ Color to use for all elements of the plot.
891
+ {scatter, line}_kws : dictionaries, optional
892
+ Additional keyword arguments passed to scatter() and plot() for drawing
893
+ the components of the plot.
894
+ ax : matplotlib axis, optional
895
+ Plot into this axis, otherwise grab the current axis or make a new
896
+ one if not existing.
897
+
898
+ Returns
899
+ -------
900
+ ax: matplotlib axes
901
+ Axes with the regression plot.
902
+
903
+ See Also
904
+ --------
905
+ regplot : Plot a simple linear regression model.
906
+ jointplot : Draw a :func:`residplot` with univariate marginal distributions
907
+ (when used with ``kind="resid"``).
908
+
909
+ Examples
910
+ --------
911
+
912
+ .. include:: ../docstrings/residplot.rst
913
+
914
+ """
915
+ plotter = _RegressionPlotter(x, y, data, ci=None,
916
+ order=order, robust=robust,
917
+ x_partial=x_partial, y_partial=y_partial,
918
+ dropna=dropna, color=color, label=label)
919
+
920
+ if ax is None:
921
+ ax = plt.gca()
922
+
923
+ # Calculate the residual from a linear regression
924
+ _, yhat, _ = plotter.fit_regression(grid=plotter.x)
925
+ plotter.y = plotter.y - yhat
926
+
927
+ # Set the regression option on the plotter
928
+ if lowess:
929
+ plotter.lowess = True
930
+ else:
931
+ plotter.fit_reg = False
932
+
933
+ # Plot a horizontal line at 0
934
+ ax.axhline(0, ls=":", c=".2")
935
+
936
+ # Draw the scatterplot
937
+ scatter_kws = {} if scatter_kws is None else scatter_kws.copy()
938
+ line_kws = {} if line_kws is None else line_kws.copy()
939
+ plotter.plot(ax, scatter_kws, line_kws)
940
+ return ax
shared/package-files/33/335449ddfb59e317ccded7a8fd45adfa06bb827e3bc9f24d9b80569a6a8da815/_rgi.py ADDED
@@ -0,0 +1,759 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ __all__ = ['RegularGridInterpolator', 'interpn']
2
+
3
+ import itertools
4
+
5
+ import numpy as np
6
+
7
+ import scipy.sparse.linalg as ssl
8
+
9
+ from ._interpnd import _ndim_coords_from_arrays
10
+ from ._cubic import PchipInterpolator
11
+ from ._rgi_cython import evaluate_linear_2d, find_indices
12
+ from ._bsplines import make_interp_spline
13
+ from ._fitpack2 import RectBivariateSpline
14
+ from ._ndbspline import make_ndbspl
15
+
16
+
17
+ def _check_points(points):
18
+ descending_dimensions = []
19
+ grid = []
20
+ for i, p in enumerate(points):
21
+ # early make points float
22
+ # see https://github.com/scipy/scipy/pull/17230
23
+ p = np.asarray(p, dtype=float)
24
+ if not np.all(p[1:] > p[:-1]):
25
+ if np.all(p[1:] < p[:-1]):
26
+ # input is descending, so make it ascending
27
+ descending_dimensions.append(i)
28
+ p = np.flip(p)
29
+ else:
30
+ raise ValueError(
31
+ "The points in dimension %d must be strictly "
32
+ "ascending or descending" % i)
33
+ # see https://github.com/scipy/scipy/issues/17716
34
+ p = np.ascontiguousarray(p)
35
+ grid.append(p)
36
+ return tuple(grid), tuple(descending_dimensions)
37
+
38
+
39
+ def _check_dimensionality(points, values):
40
+ if len(points) > values.ndim:
41
+ raise ValueError("There are %d point arrays, but values has %d "
42
+ "dimensions" % (len(points), values.ndim))
43
+ for i, p in enumerate(points):
44
+ if not np.asarray(p).ndim == 1:
45
+ raise ValueError("The points in dimension %d must be "
46
+ "1-dimensional" % i)
47
+ if not values.shape[i] == len(p):
48
+ raise ValueError("There are %d points and %d values in "
49
+ "dimension %d" % (len(p), values.shape[i], i))
50
+
51
+
52
+ class RegularGridInterpolator:
53
+ """
54
+ Interpolator on a regular or rectilinear grid in arbitrary dimensions.
55
+
56
+ The data must be defined on a rectilinear grid; that is, a rectangular
57
+ grid with even or uneven spacing. Linear, nearest-neighbor, spline
58
+ interpolations are supported. After setting up the interpolator object,
59
+ the interpolation method may be chosen at each evaluation.
60
+
61
+ Parameters
62
+ ----------
63
+ points : tuple of ndarray of float, with shapes (m1, ), ..., (mn, )
64
+ The points defining the regular grid in n dimensions. The points in
65
+ each dimension (i.e. every elements of the points tuple) must be
66
+ strictly ascending or descending.
67
+
68
+ values : array_like, shape (m1, ..., mn, ...)
69
+ The data on the regular grid in n dimensions. Complex data is
70
+ accepted.
71
+
72
+ method : str, optional
73
+ The method of interpolation to perform. Supported are "linear",
74
+ "nearest", "slinear", "cubic", "quintic" and "pchip". This
75
+ parameter will become the default for the object's ``__call__``
76
+ method. Default is "linear".
77
+
78
+ bounds_error : bool, optional
79
+ If True, when interpolated values are requested outside of the
80
+ domain of the input data, a ValueError is raised.
81
+ If False, then `fill_value` is used.
82
+ Default is True.
83
+
84
+ fill_value : float or None, optional
85
+ The value to use for points outside of the interpolation domain.
86
+ If None, values outside the domain are extrapolated.
87
+ Default is ``np.nan``.
88
+
89
+ solver : callable, optional
90
+ Only used for methods "slinear", "cubic" and "quintic".
91
+ Sparse linear algebra solver for construction of the NdBSpline instance.
92
+ Default is the iterative solver `scipy.sparse.linalg.gcrotmk`.
93
+
94
+ .. versionadded:: 1.13
95
+
96
+ solver_args: dict, optional
97
+ Additional arguments to pass to `solver`, if any.
98
+
99
+ .. versionadded:: 1.13
100
+
101
+ Methods
102
+ -------
103
+ __call__
104
+
105
+ Attributes
106
+ ----------
107
+ grid : tuple of ndarrays
108
+ The points defining the regular grid in n dimensions.
109
+ This tuple defines the full grid via
110
+ ``np.meshgrid(*grid, indexing='ij')``
111
+ values : ndarray
112
+ Data values at the grid.
113
+ method : str
114
+ Interpolation method.
115
+ fill_value : float or ``None``
116
+ Use this value for out-of-bounds arguments to `__call__`.
117
+ bounds_error : bool
118
+ If ``True``, out-of-bounds argument raise a ``ValueError``.
119
+
120
+ Notes
121
+ -----
122
+ Contrary to `LinearNDInterpolator` and `NearestNDInterpolator`, this class
123
+ avoids expensive triangulation of the input data by taking advantage of the
124
+ regular grid structure.
125
+
126
+ In other words, this class assumes that the data is defined on a
127
+ *rectilinear* grid.
128
+
129
+ .. versionadded:: 0.14
130
+
131
+ The 'slinear'(k=1), 'cubic'(k=3), and 'quintic'(k=5) methods are
132
+ tensor-product spline interpolators, where `k` is the spline degree,
133
+ If any dimension has fewer points than `k` + 1, an error will be raised.
134
+
135
+ .. versionadded:: 1.9
136
+
137
+ If the input data is such that dimensions have incommensurate
138
+ units and differ by many orders of magnitude, the interpolant may have
139
+ numerical artifacts. Consider rescaling the data before interpolating.
140
+
141
+ **Choosing a solver for spline methods**
142
+
143
+ Spline methods, "slinear", "cubic" and "quintic" involve solving a
144
+ large sparse linear system at instantiation time. Depending on data,
145
+ the default solver may or may not be adequate. When it is not, you may
146
+ need to experiment with an optional `solver` argument, where you may
147
+ choose between the direct solver (`scipy.sparse.linalg.spsolve`) or
148
+ iterative solvers from `scipy.sparse.linalg`. You may need to supply
149
+ additional parameters via the optional `solver_args` parameter (for instance,
150
+ you may supply the starting value or target tolerance). See the
151
+ `scipy.sparse.linalg` documentation for the full list of available options.
152
+
153
+ Alternatively, you may instead use the legacy methods, "slinear_legacy",
154
+ "cubic_legacy" and "quintic_legacy". These methods allow faster construction
155
+ but evaluations will be much slower.
156
+
157
+ Examples
158
+ --------
159
+ **Evaluate a function on the points of a 3-D grid**
160
+
161
+ As a first example, we evaluate a simple example function on the points of
162
+ a 3-D grid:
163
+
164
+ >>> from scipy.interpolate import RegularGridInterpolator
165
+ >>> import numpy as np
166
+ >>> def f(x, y, z):
167
+ ... return 2 * x**3 + 3 * y**2 - z
168
+ >>> x = np.linspace(1, 4, 11)
169
+ >>> y = np.linspace(4, 7, 22)
170
+ >>> z = np.linspace(7, 9, 33)
171
+ >>> xg, yg ,zg = np.meshgrid(x, y, z, indexing='ij', sparse=True)
172
+ >>> data = f(xg, yg, zg)
173
+
174
+ ``data`` is now a 3-D array with ``data[i, j, k] = f(x[i], y[j], z[k])``.
175
+ Next, define an interpolating function from this data:
176
+
177
+ >>> interp = RegularGridInterpolator((x, y, z), data)
178
+
179
+ Evaluate the interpolating function at the two points
180
+ ``(x,y,z) = (2.1, 6.2, 8.3)`` and ``(3.3, 5.2, 7.1)``:
181
+
182
+ >>> pts = np.array([[2.1, 6.2, 8.3],
183
+ ... [3.3, 5.2, 7.1]])
184
+ >>> interp(pts)
185
+ array([ 125.80469388, 146.30069388])
186
+
187
+ which is indeed a close approximation to
188
+
189
+ >>> f(2.1, 6.2, 8.3), f(3.3, 5.2, 7.1)
190
+ (125.54200000000002, 145.894)
191
+
192
+ **Interpolate and extrapolate a 2D dataset**
193
+
194
+ As a second example, we interpolate and extrapolate a 2D data set:
195
+
196
+ >>> x, y = np.array([-2, 0, 4]), np.array([-2, 0, 2, 5])
197
+ >>> def ff(x, y):
198
+ ... return x**2 + y**2
199
+
200
+ >>> xg, yg = np.meshgrid(x, y, indexing='ij')
201
+ >>> data = ff(xg, yg)
202
+ >>> interp = RegularGridInterpolator((x, y), data,
203
+ ... bounds_error=False, fill_value=None)
204
+
205
+ >>> import matplotlib.pyplot as plt
206
+ >>> fig = plt.figure()
207
+ >>> ax = fig.add_subplot(projection='3d')
208
+ >>> ax.scatter(xg.ravel(), yg.ravel(), data.ravel(),
209
+ ... s=60, c='k', label='data')
210
+
211
+ Evaluate and plot the interpolator on a finer grid
212
+
213
+ >>> xx = np.linspace(-4, 9, 31)
214
+ >>> yy = np.linspace(-4, 9, 31)
215
+ >>> X, Y = np.meshgrid(xx, yy, indexing='ij')
216
+
217
+ >>> # interpolator
218
+ >>> ax.plot_wireframe(X, Y, interp((X, Y)), rstride=3, cstride=3,
219
+ ... alpha=0.4, color='m', label='linear interp')
220
+
221
+ >>> # ground truth
222
+ >>> ax.plot_wireframe(X, Y, ff(X, Y), rstride=3, cstride=3,
223
+ ... alpha=0.4, label='ground truth')
224
+ >>> plt.legend()
225
+ >>> plt.show()
226
+
227
+ Other examples are given
228
+ :ref:`in the tutorial <tutorial-interpolate_regular_grid_interpolator>`.
229
+
230
+ See Also
231
+ --------
232
+ NearestNDInterpolator : Nearest neighbor interpolator on *unstructured*
233
+ data in N dimensions
234
+
235
+ LinearNDInterpolator : Piecewise linear interpolator on *unstructured* data
236
+ in N dimensions
237
+
238
+ interpn : a convenience function which wraps `RegularGridInterpolator`
239
+
240
+ scipy.ndimage.map_coordinates : interpolation on grids with equal spacing
241
+ (suitable for e.g., N-D image resampling)
242
+
243
+ References
244
+ ----------
245
+ .. [1] Python package *regulargrid* by Johannes Buchner, see
246
+ https://pypi.python.org/pypi/regulargrid/
247
+ .. [2] Wikipedia, "Trilinear interpolation",
248
+ https://en.wikipedia.org/wiki/Trilinear_interpolation
249
+ .. [3] Weiser, Alan, and Sergio E. Zarantonello. "A note on piecewise linear
250
+ and multilinear table interpolation in many dimensions." MATH.
251
+ COMPUT. 50.181 (1988): 189-196.
252
+ https://www.ams.org/journals/mcom/1988-50-181/S0025-5718-1988-0917826-0/S0025-5718-1988-0917826-0.pdf
253
+ :doi:`10.1090/S0025-5718-1988-0917826-0`
254
+
255
+ """
256
+ # this class is based on code originally programmed by Johannes Buchner,
257
+ # see https://github.com/JohannesBuchner/regulargrid
258
+
259
+ _SPLINE_DEGREE_MAP = {"slinear": 1, "cubic": 3, "quintic": 5, 'pchip': 3,
260
+ "slinear_legacy": 1, "cubic_legacy": 3, "quintic_legacy": 5,}
261
+ _SPLINE_METHODS_recursive = {"slinear_legacy", "cubic_legacy",
262
+ "quintic_legacy", "pchip"}
263
+ _SPLINE_METHODS_ndbspl = {"slinear", "cubic", "quintic"}
264
+ _SPLINE_METHODS = list(_SPLINE_DEGREE_MAP.keys())
265
+ _ALL_METHODS = ["linear", "nearest"] + _SPLINE_METHODS
266
+
267
+ def __init__(self, points, values, method="linear", bounds_error=True,
268
+ fill_value=np.nan, *, solver=None, solver_args=None):
269
+ if method not in self._ALL_METHODS:
270
+ raise ValueError(f"Method '{method}' is not defined")
271
+ elif method in self._SPLINE_METHODS:
272
+ self._validate_grid_dimensions(points, method)
273
+ self.method = method
274
+ self._spline = None
275
+ self.bounds_error = bounds_error
276
+ self.grid, self._descending_dimensions = _check_points(points)
277
+ self.values = self._check_values(values)
278
+ self._check_dimensionality(self.grid, self.values)
279
+ self.fill_value = self._check_fill_value(self.values, fill_value)
280
+ if self._descending_dimensions:
281
+ self.values = np.flip(values, axis=self._descending_dimensions)
282
+ if self.method == "pchip" and np.iscomplexobj(self.values):
283
+ msg = ("`PchipInterpolator` only works with real values. If you are trying "
284
+ "to use the real components of the passed array, use `np.real` on "
285
+ "the array before passing to `RegularGridInterpolator`.")
286
+ raise ValueError(msg)
287
+ if method in self._SPLINE_METHODS_ndbspl:
288
+ if solver_args is None:
289
+ solver_args = {}
290
+ self._spline = self._construct_spline(method, solver, **solver_args)
291
+ else:
292
+ if solver is not None or solver_args:
293
+ raise ValueError(
294
+ f"{method =} does not accept the 'solver' argument. Got "
295
+ f" {solver = } and with arguments {solver_args}."
296
+ )
297
+
298
+ def _construct_spline(self, method, solver=None, **solver_args):
299
+ if solver is None:
300
+ solver = ssl.gcrotmk
301
+ spl = make_ndbspl(
302
+ self.grid, self.values, self._SPLINE_DEGREE_MAP[method],
303
+ solver=solver, **solver_args
304
+ )
305
+ return spl
306
+
307
+ def _check_dimensionality(self, grid, values):
308
+ _check_dimensionality(grid, values)
309
+
310
+ def _check_points(self, points):
311
+ return _check_points(points)
312
+
313
+ def _check_values(self, values):
314
+ if not hasattr(values, 'ndim'):
315
+ # allow reasonable duck-typed values
316
+ values = np.asarray(values)
317
+
318
+ if hasattr(values, 'dtype') and hasattr(values, 'astype'):
319
+ if not np.issubdtype(values.dtype, np.inexact):
320
+ values = values.astype(float)
321
+
322
+ return values
323
+
324
+ def _check_fill_value(self, values, fill_value):
325
+ if fill_value is not None:
326
+ fill_value_dtype = np.asarray(fill_value).dtype
327
+ if (hasattr(values, 'dtype') and not
328
+ np.can_cast(fill_value_dtype, values.dtype,
329
+ casting='same_kind')):
330
+ raise ValueError("fill_value must be either 'None' or "
331
+ "of a type compatible with values")
332
+ return fill_value
333
+
334
+ def __call__(self, xi, method=None, *, nu=None):
335
+ """
336
+ Interpolation at coordinates.
337
+
338
+ Parameters
339
+ ----------
340
+ xi : ndarray of shape (..., ndim)
341
+ The coordinates to evaluate the interpolator at.
342
+
343
+ method : str, optional
344
+ The method of interpolation to perform. Supported are "linear",
345
+ "nearest", "slinear", "cubic", "quintic" and "pchip". Default is
346
+ the method chosen when the interpolator was created.
347
+
348
+ nu : sequence of ints, length ndim, optional
349
+ If not None, the orders of the derivatives to evaluate.
350
+ Each entry must be non-negative.
351
+ Only allowed for methods "slinear", "cubic" and "quintic".
352
+
353
+ .. versionadded:: 1.13
354
+
355
+ Returns
356
+ -------
357
+ values_x : ndarray, shape xi.shape[:-1] + values.shape[ndim:]
358
+ Interpolated values at `xi`. See notes for behaviour when
359
+ ``xi.ndim == 1``.
360
+
361
+ Notes
362
+ -----
363
+ In the case that ``xi.ndim == 1`` a new axis is inserted into
364
+ the 0 position of the returned array, values_x, so its shape is
365
+ instead ``(1,) + values.shape[ndim:]``.
366
+
367
+ Examples
368
+ --------
369
+ Here we define a nearest-neighbor interpolator of a simple function
370
+
371
+ >>> import numpy as np
372
+ >>> x, y = np.array([0, 1, 2]), np.array([1, 3, 7])
373
+ >>> def f(x, y):
374
+ ... return x**2 + y**2
375
+ >>> data = f(*np.meshgrid(x, y, indexing='ij', sparse=True))
376
+ >>> from scipy.interpolate import RegularGridInterpolator
377
+ >>> interp = RegularGridInterpolator((x, y), data, method='nearest')
378
+
379
+ By construction, the interpolator uses the nearest-neighbor
380
+ interpolation
381
+
382
+ >>> interp([[1.5, 1.3], [0.3, 4.5]])
383
+ array([2., 9.])
384
+
385
+ We can however evaluate the linear interpolant by overriding the
386
+ `method` parameter
387
+
388
+ >>> interp([[1.5, 1.3], [0.3, 4.5]], method='linear')
389
+ array([ 4.7, 24.3])
390
+ """
391
+ _spline = self._spline
392
+ method = self.method if method is None else method
393
+ is_method_changed = self.method != method
394
+ if method not in self._ALL_METHODS:
395
+ raise ValueError(f"Method '{method}' is not defined")
396
+ if is_method_changed and method in self._SPLINE_METHODS_ndbspl:
397
+ _spline = self._construct_spline(method)
398
+
399
+ if nu is not None and method not in self._SPLINE_METHODS_ndbspl:
400
+ raise ValueError(
401
+ f"Can only compute derivatives for methods "
402
+ f"{self._SPLINE_METHODS_ndbspl}, got {method =}."
403
+ )
404
+
405
+ xi, xi_shape, ndim, nans, out_of_bounds = self._prepare_xi(xi)
406
+
407
+ if method == "linear":
408
+ indices, norm_distances = self._find_indices(xi.T)
409
+ if (ndim == 2 and hasattr(self.values, 'dtype') and
410
+ self.values.ndim == 2 and self.values.flags.writeable and
411
+ self.values.dtype in (np.float64, np.complex128) and
412
+ self.values.dtype.byteorder == '='):
413
+ # until cython supports const fused types, the fast path
414
+ # cannot support non-writeable values
415
+ # a fast path
416
+ out = np.empty(indices.shape[1], dtype=self.values.dtype)
417
+ result = evaluate_linear_2d(self.values,
418
+ indices,
419
+ norm_distances,
420
+ self.grid,
421
+ out)
422
+ else:
423
+ result = self._evaluate_linear(indices, norm_distances)
424
+ elif method == "nearest":
425
+ indices, norm_distances = self._find_indices(xi.T)
426
+ result = self._evaluate_nearest(indices, norm_distances)
427
+ elif method in self._SPLINE_METHODS:
428
+ if is_method_changed:
429
+ self._validate_grid_dimensions(self.grid, method)
430
+ if method in self._SPLINE_METHODS_recursive:
431
+ result = self._evaluate_spline(xi, method)
432
+ else:
433
+ result = _spline(xi, nu=nu)
434
+
435
+ if not self.bounds_error and self.fill_value is not None:
436
+ result[out_of_bounds] = self.fill_value
437
+
438
+ # f(nan) = nan, if any
439
+ if np.any(nans):
440
+ result[nans] = np.nan
441
+ return result.reshape(xi_shape[:-1] + self.values.shape[ndim:])
442
+
443
+ def _prepare_xi(self, xi):
444
+ ndim = len(self.grid)
445
+ xi = _ndim_coords_from_arrays(xi, ndim=ndim)
446
+ if xi.shape[-1] != len(self.grid):
447
+ raise ValueError("The requested sample points xi have dimension "
448
+ f"{xi.shape[-1]} but this "
449
+ f"RegularGridInterpolator has dimension {ndim}")
450
+
451
+ xi_shape = xi.shape
452
+ xi = xi.reshape(-1, xi_shape[-1])
453
+ xi = np.asarray(xi, dtype=float)
454
+
455
+ # find nans in input
456
+ nans = np.any(np.isnan(xi), axis=-1)
457
+
458
+ if self.bounds_error:
459
+ for i, p in enumerate(xi.T):
460
+ if not np.logical_and(np.all(self.grid[i][0] <= p),
461
+ np.all(p <= self.grid[i][-1])):
462
+ raise ValueError("One of the requested xi is out of bounds "
463
+ "in dimension %d" % i)
464
+ out_of_bounds = None
465
+ else:
466
+ out_of_bounds = self._find_out_of_bounds(xi.T)
467
+
468
+ return xi, xi_shape, ndim, nans, out_of_bounds
469
+
470
+ def _evaluate_linear(self, indices, norm_distances):
471
+ # slice for broadcasting over trailing dimensions in self.values
472
+ vslice = (slice(None),) + (None,)*(self.values.ndim - len(indices))
473
+
474
+ # Compute shifting up front before zipping everything together
475
+ shift_norm_distances = [1 - yi for yi in norm_distances]
476
+ shift_indices = [i + 1 for i in indices]
477
+
478
+ # The formula for linear interpolation in 2d takes the form:
479
+ # values = self.values[(i0, i1)] * (1 - y0) * (1 - y1) + \
480
+ # self.values[(i0, i1 + 1)] * (1 - y0) * y1 + \
481
+ # self.values[(i0 + 1, i1)] * y0 * (1 - y1) + \
482
+ # self.values[(i0 + 1, i1 + 1)] * y0 * y1
483
+ # We pair i with 1 - yi (zipped1) and i + 1 with yi (zipped2)
484
+ zipped1 = zip(indices, shift_norm_distances)
485
+ zipped2 = zip(shift_indices, norm_distances)
486
+
487
+ # Take all products of zipped1 and zipped2 and iterate over them
488
+ # to get the terms in the above formula. This corresponds to iterating
489
+ # over the vertices of a hypercube.
490
+ hypercube = itertools.product(*zip(zipped1, zipped2))
491
+ value = np.array([0.])
492
+ for h in hypercube:
493
+ edge_indices, weights = zip(*h)
494
+ weight = np.array([1.])
495
+ for w in weights:
496
+ weight = weight * w
497
+ term = np.asarray(self.values[edge_indices]) * weight[vslice]
498
+ value = value + term # cannot use += because broadcasting
499
+ return value
500
+
501
+ def _evaluate_nearest(self, indices, norm_distances):
502
+ idx_res = [np.where(yi <= .5, i, i + 1)
503
+ for i, yi in zip(indices, norm_distances)]
504
+ return self.values[tuple(idx_res)]
505
+
506
+ def _validate_grid_dimensions(self, points, method):
507
+ k = self._SPLINE_DEGREE_MAP[method]
508
+ for i, point in enumerate(points):
509
+ ndim = len(np.atleast_1d(point))
510
+ if ndim <= k:
511
+ raise ValueError(f"There are {ndim} points in dimension {i},"
512
+ f" but method {method} requires at least "
513
+ f" {k+1} points per dimension.")
514
+
515
+ def _evaluate_spline(self, xi, method):
516
+ # ensure xi is 2D list of points to evaluate (`m` is the number of
517
+ # points and `n` is the number of interpolation dimensions,
518
+ # ``n == len(self.grid)``.)
519
+ if xi.ndim == 1:
520
+ xi = xi.reshape((1, xi.size))
521
+ m, n = xi.shape
522
+
523
+ # Reorder the axes: n-dimensional process iterates over the
524
+ # interpolation axes from the last axis downwards: E.g. for a 4D grid
525
+ # the order of axes is 3, 2, 1, 0. Each 1D interpolation works along
526
+ # the 0th axis of its argument array (for 1D routine it's its ``y``
527
+ # array). Thus permute the interpolation axes of `values` *and keep
528
+ # trailing dimensions trailing*.
529
+ axes = tuple(range(self.values.ndim))
530
+ axx = axes[:n][::-1] + axes[n:]
531
+ values = self.values.transpose(axx)
532
+
533
+ if method == 'pchip':
534
+ _eval_func = self._do_pchip
535
+ else:
536
+ _eval_func = self._do_spline_fit
537
+ k = self._SPLINE_DEGREE_MAP[method]
538
+
539
+ # Non-stationary procedure: difficult to vectorize this part entirely
540
+ # into numpy-level operations. Unfortunately this requires explicit
541
+ # looping over each point in xi.
542
+
543
+ # can at least vectorize the first pass across all points in the
544
+ # last variable of xi.
545
+ last_dim = n - 1
546
+ first_values = _eval_func(self.grid[last_dim],
547
+ values,
548
+ xi[:, last_dim],
549
+ k)
550
+
551
+ # the rest of the dimensions have to be on a per point-in-xi basis
552
+ shape = (m, *self.values.shape[n:])
553
+ result = np.empty(shape, dtype=self.values.dtype)
554
+ for j in range(m):
555
+ # Main process: Apply 1D interpolate in each dimension
556
+ # sequentially, starting with the last dimension.
557
+ # These are then "folded" into the next dimension in-place.
558
+ folded_values = first_values[j, ...]
559
+ for i in range(last_dim-1, -1, -1):
560
+ # Interpolate for each 1D from the last dimensions.
561
+ # This collapses each 1D sequence into a scalar.
562
+ folded_values = _eval_func(self.grid[i],
563
+ folded_values,
564
+ xi[j, i],
565
+ k)
566
+ result[j, ...] = folded_values
567
+
568
+ return result
569
+
570
+ @staticmethod
571
+ def _do_spline_fit(x, y, pt, k):
572
+ local_interp = make_interp_spline(x, y, k=k, axis=0)
573
+ values = local_interp(pt)
574
+ return values
575
+
576
+ @staticmethod
577
+ def _do_pchip(x, y, pt, k):
578
+ local_interp = PchipInterpolator(x, y, axis=0)
579
+ values = local_interp(pt)
580
+ return values
581
+
582
+ def _find_indices(self, xi):
583
+ return find_indices(self.grid, xi)
584
+
585
+ def _find_out_of_bounds(self, xi):
586
+ # check for out of bounds xi
587
+ out_of_bounds = np.zeros((xi.shape[1]), dtype=bool)
588
+ # iterate through dimensions
589
+ for x, grid in zip(xi, self.grid):
590
+ out_of_bounds += x < grid[0]
591
+ out_of_bounds += x > grid[-1]
592
+ return out_of_bounds
593
+
594
+
595
+ def interpn(points, values, xi, method="linear", bounds_error=True,
596
+ fill_value=np.nan):
597
+ """
598
+ Multidimensional interpolation on regular or rectilinear grids.
599
+
600
+ Strictly speaking, not all regular grids are supported - this function
601
+ works on *rectilinear* grids, that is, a rectangular grid with even or
602
+ uneven spacing.
603
+
604
+ Parameters
605
+ ----------
606
+ points : tuple of ndarray of float, with shapes (m1, ), ..., (mn, )
607
+ The points defining the regular grid in n dimensions. The points in
608
+ each dimension (i.e. every elements of the points tuple) must be
609
+ strictly ascending or descending.
610
+
611
+ values : array_like, shape (m1, ..., mn, ...)
612
+ The data on the regular grid in n dimensions. Complex data is
613
+ accepted.
614
+
615
+ .. deprecated:: 1.13.0
616
+ Complex data is deprecated with ``method="pchip"`` and will raise an
617
+ error in SciPy 1.15.0. This is because ``PchipInterpolator`` only
618
+ works with real values. If you are trying to use the real components of
619
+ the passed array, use ``np.real`` on ``values``.
620
+
621
+ xi : ndarray of shape (..., ndim)
622
+ The coordinates to sample the gridded data at
623
+
624
+ method : str, optional
625
+ The method of interpolation to perform. Supported are "linear",
626
+ "nearest", "slinear", "cubic", "quintic", "pchip", and "splinef2d".
627
+ "splinef2d" is only supported for 2-dimensional data.
628
+
629
+ bounds_error : bool, optional
630
+ If True, when interpolated values are requested outside of the
631
+ domain of the input data, a ValueError is raised.
632
+ If False, then `fill_value` is used.
633
+
634
+ fill_value : number, optional
635
+ If provided, the value to use for points outside of the
636
+ interpolation domain. If None, values outside
637
+ the domain are extrapolated. Extrapolation is not supported by method
638
+ "splinef2d".
639
+
640
+ Returns
641
+ -------
642
+ values_x : ndarray, shape xi.shape[:-1] + values.shape[ndim:]
643
+ Interpolated values at `xi`. See notes for behaviour when
644
+ ``xi.ndim == 1``.
645
+
646
+ See Also
647
+ --------
648
+ NearestNDInterpolator : Nearest neighbor interpolation on unstructured
649
+ data in N dimensions
650
+ LinearNDInterpolator : Piecewise linear interpolant on unstructured data
651
+ in N dimensions
652
+ RegularGridInterpolator : interpolation on a regular or rectilinear grid
653
+ in arbitrary dimensions (`interpn` wraps this
654
+ class).
655
+ RectBivariateSpline : Bivariate spline approximation over a rectangular mesh
656
+ scipy.ndimage.map_coordinates : interpolation on grids with equal spacing
657
+ (suitable for e.g., N-D image resampling)
658
+
659
+ Notes
660
+ -----
661
+
662
+ .. versionadded:: 0.14
663
+
664
+ In the case that ``xi.ndim == 1`` a new axis is inserted into
665
+ the 0 position of the returned array, values_x, so its shape is
666
+ instead ``(1,) + values.shape[ndim:]``.
667
+
668
+ If the input data is such that input dimensions have incommensurate
669
+ units and differ by many orders of magnitude, the interpolant may have
670
+ numerical artifacts. Consider rescaling the data before interpolation.
671
+
672
+ Examples
673
+ --------
674
+ Evaluate a simple example function on the points of a regular 3-D grid:
675
+
676
+ >>> import numpy as np
677
+ >>> from scipy.interpolate import interpn
678
+ >>> def value_func_3d(x, y, z):
679
+ ... return 2 * x + 3 * y - z
680
+ >>> x = np.linspace(0, 4, 5)
681
+ >>> y = np.linspace(0, 5, 6)
682
+ >>> z = np.linspace(0, 6, 7)
683
+ >>> points = (x, y, z)
684
+ >>> values = value_func_3d(*np.meshgrid(*points, indexing='ij'))
685
+
686
+ Evaluate the interpolating function at a point
687
+
688
+ >>> point = np.array([2.21, 3.12, 1.15])
689
+ >>> print(interpn(points, values, point))
690
+ [12.63]
691
+
692
+ """
693
+ # sanity check 'method' kwarg
694
+ if method not in ["linear", "nearest", "cubic", "quintic", "pchip",
695
+ "splinef2d", "slinear",
696
+ "slinear_legacy", "cubic_legacy", "quintic_legacy"]:
697
+ raise ValueError("interpn only understands the methods 'linear', "
698
+ "'nearest', 'slinear', 'cubic', 'quintic', 'pchip', "
699
+ f"and 'splinef2d'. You provided {method}.")
700
+
701
+ if not hasattr(values, 'ndim'):
702
+ values = np.asarray(values)
703
+
704
+ ndim = values.ndim
705
+ if ndim > 2 and method == "splinef2d":
706
+ raise ValueError("The method splinef2d can only be used for "
707
+ "2-dimensional input data")
708
+ if not bounds_error and fill_value is None and method == "splinef2d":
709
+ raise ValueError("The method splinef2d does not support extrapolation.")
710
+
711
+ # sanity check consistency of input dimensions
712
+ if len(points) > ndim:
713
+ raise ValueError("There are %d point arrays, but values has %d "
714
+ "dimensions" % (len(points), ndim))
715
+ if len(points) != ndim and method == 'splinef2d':
716
+ raise ValueError("The method splinef2d can only be used for "
717
+ "scalar data with one point per coordinate")
718
+
719
+ grid, descending_dimensions = _check_points(points)
720
+ _check_dimensionality(grid, values)
721
+
722
+ # sanity check requested xi
723
+ xi = _ndim_coords_from_arrays(xi, ndim=len(grid))
724
+ if xi.shape[-1] != len(grid):
725
+ raise ValueError("The requested sample points xi have dimension "
726
+ "%d, but this RegularGridInterpolator has "
727
+ "dimension %d" % (xi.shape[-1], len(grid)))
728
+
729
+ if bounds_error:
730
+ for i, p in enumerate(xi.T):
731
+ if not np.logical_and(np.all(grid[i][0] <= p),
732
+ np.all(p <= grid[i][-1])):
733
+ raise ValueError("One of the requested xi is out of bounds "
734
+ "in dimension %d" % i)
735
+
736
+ # perform interpolation
737
+ if method in RegularGridInterpolator._ALL_METHODS:
738
+ interp = RegularGridInterpolator(points, values, method=method,
739
+ bounds_error=bounds_error,
740
+ fill_value=fill_value)
741
+ return interp(xi)
742
+ elif method == "splinef2d":
743
+ xi_shape = xi.shape
744
+ xi = xi.reshape(-1, xi.shape[-1])
745
+
746
+ # RectBivariateSpline doesn't support fill_value; we need to wrap here
747
+ idx_valid = np.all((grid[0][0] <= xi[:, 0], xi[:, 0] <= grid[0][-1],
748
+ grid[1][0] <= xi[:, 1], xi[:, 1] <= grid[1][-1]),
749
+ axis=0)
750
+ result = np.empty_like(xi[:, 0])
751
+
752
+ # make a copy of values for RectBivariateSpline
753
+ interp = RectBivariateSpline(points[0], points[1], values[:])
754
+ result[idx_valid] = interp.ev(xi[idx_valid, 0], xi[idx_valid, 1])
755
+ result[np.logical_not(idx_valid)] = fill_value
756
+
757
+ return result.reshape(xi_shape[:-1])
758
+ else:
759
+ raise ValueError(f"unknown {method = }")
shared/package-files/33/335515c7106005c298d2bee9bfc0ef384ebf0896afc3439dddf8bc887f803c49/__init__.pyi ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ from typing import Dict, Any
2
+
3
+ LANG_INFO: Dict[str, Any] = ...
shared/package-files/33/3357196f3fa52433326a6626880e34964e00c5570aee50e9a0a0a7c6d86f6e4f/utf_16_be.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """ Python 'utf-16-be' Codec
2
+
3
+
4
+ Written by Marc-Andre Lemburg (mal@lemburg.com).
5
+
6
+ (c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
7
+
8
+ """
9
+ import codecs
10
+
11
+ ### Codec APIs
12
+
13
+ encode = codecs.utf_16_be_encode
14
+
15
+ def decode(input, errors='strict'):
16
+ return codecs.utf_16_be_decode(input, errors, True)
17
+
18
+ class IncrementalEncoder(codecs.IncrementalEncoder):
19
+ def encode(self, input, final=False):
20
+ return codecs.utf_16_be_encode(input, self.errors)[0]
21
+
22
+ class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
23
+ _buffer_decode = codecs.utf_16_be_decode
24
+
25
+ class StreamWriter(codecs.StreamWriter):
26
+ encode = codecs.utf_16_be_encode
27
+
28
+ class StreamReader(codecs.StreamReader):
29
+ decode = codecs.utf_16_be_decode
30
+
31
+ ### encodings module API
32
+
33
+ def getregentry():
34
+ return codecs.CodecInfo(
35
+ name='utf-16-be',
36
+ encode=encode,
37
+ decode=decode,
38
+ incrementalencoder=IncrementalEncoder,
39
+ incrementaldecoder=IncrementalDecoder,
40
+ streamreader=StreamReader,
41
+ streamwriter=StreamWriter,
42
+ )
shared/package-files/33/3359968d2ef4a582c525abb9df836d82c95ca58ffc362638751991813ef74d5a/dataframe.py ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ from collections import abc
4
+ from typing import TYPE_CHECKING
5
+
6
+ from pandas.core.interchange.column import PandasColumn
7
+ from pandas.core.interchange.dataframe_protocol import DataFrame as DataFrameXchg
8
+ from pandas.core.interchange.utils import maybe_rechunk
9
+
10
+ if TYPE_CHECKING:
11
+ from collections.abc import (
12
+ Iterable,
13
+ Sequence,
14
+ )
15
+
16
+ from pandas import (
17
+ DataFrame,
18
+ Index,
19
+ )
20
+
21
+
22
+ class PandasDataFrameXchg(DataFrameXchg):
23
+ """
24
+ A data frame class, with only the methods required by the interchange
25
+ protocol defined.
26
+ Instances of this (private) class are returned from
27
+ ``pd.DataFrame.__dataframe__`` as objects with the methods and
28
+ attributes defined on this class.
29
+ """
30
+
31
+ def __init__(self, df: DataFrame, allow_copy: bool = True) -> None:
32
+ """
33
+ Constructor - an instance of this (private) class is returned from
34
+ `pd.DataFrame.__dataframe__`.
35
+ """
36
+ self._df = df.rename(columns=str, copy=False)
37
+ self._allow_copy = allow_copy
38
+ for i, _col in enumerate(self._df.columns):
39
+ rechunked = maybe_rechunk(self._df.iloc[:, i], allow_copy=allow_copy)
40
+ if rechunked is not None:
41
+ self._df.isetitem(i, rechunked)
42
+
43
+ def __dataframe__(
44
+ self, nan_as_null: bool = False, allow_copy: bool = True
45
+ ) -> PandasDataFrameXchg:
46
+ # `nan_as_null` can be removed here once it's removed from
47
+ # Dataframe.__dataframe__
48
+ return PandasDataFrameXchg(self._df, allow_copy)
49
+
50
+ @property
51
+ def metadata(self) -> dict[str, Index]:
52
+ # `index` isn't a regular column, and the protocol doesn't support row
53
+ # labels - so we export it as Pandas-specific metadata here.
54
+ return {"pandas.index": self._df.index}
55
+
56
+ def num_columns(self) -> int:
57
+ return len(self._df.columns)
58
+
59
+ def num_rows(self) -> int:
60
+ return len(self._df)
61
+
62
+ def num_chunks(self) -> int:
63
+ return 1
64
+
65
+ def column_names(self) -> Index:
66
+ return self._df.columns
67
+
68
+ def get_column(self, i: int) -> PandasColumn:
69
+ return PandasColumn(self._df.iloc[:, i], allow_copy=self._allow_copy)
70
+
71
+ def get_column_by_name(self, name: str) -> PandasColumn:
72
+ return PandasColumn(self._df[name], allow_copy=self._allow_copy)
73
+
74
+ def get_columns(self) -> list[PandasColumn]:
75
+ return [
76
+ PandasColumn(self._df[name], allow_copy=self._allow_copy)
77
+ for name in self._df.columns
78
+ ]
79
+
80
+ def select_columns(self, indices: Sequence[int]) -> PandasDataFrameXchg:
81
+ if not isinstance(indices, abc.Sequence):
82
+ raise ValueError("`indices` is not a sequence")
83
+ if not isinstance(indices, list):
84
+ indices = list(indices)
85
+
86
+ return PandasDataFrameXchg(
87
+ self._df.iloc[:, indices], allow_copy=self._allow_copy
88
+ )
89
+
90
+ def select_columns_by_name(self, names: list[str]) -> PandasDataFrameXchg: # type: ignore[override]
91
+ if not isinstance(names, abc.Sequence):
92
+ raise ValueError("`names` is not a sequence")
93
+ if not isinstance(names, list):
94
+ names = list(names)
95
+
96
+ return PandasDataFrameXchg(self._df.loc[:, names], allow_copy=self._allow_copy)
97
+
98
+ def get_chunks(self, n_chunks: int | None = None) -> Iterable[PandasDataFrameXchg]:
99
+ """
100
+ Return an iterator yielding the chunks.
101
+ """
102
+ if n_chunks and n_chunks > 1:
103
+ size = len(self._df)
104
+ step = size // n_chunks
105
+ if size % n_chunks != 0:
106
+ step += 1
107
+ for start in range(0, step * n_chunks, step):
108
+ yield PandasDataFrameXchg(
109
+ self._df.iloc[start : start + step, :],
110
+ allow_copy=self._allow_copy,
111
+ )
112
+ else:
113
+ yield self
shared/package-files/33/335d111c3ea2342e83a5b02c3eb2e423783fad1fdfb3424854a6988135c720d2/apple80p ADDED
Binary file (262 Bytes). View file
 
shared/package-files/33/335fb9da0445995a7f6748e7c997d3503a9bc8c4db9a1693711b7e3fb1fd276f/missing.py ADDED
@@ -0,0 +1,269 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file is part of Patsy
2
+ # Copyright (C) 2013 Nathaniel Smith <njs@pobox.com>
3
+ # See file LICENSE.txt for license information.
4
+
5
+ # Missing data detection/handling
6
+
7
+ # First, how do we represent missing data? (i.e., which values count as
8
+ # "missing"?) In the long run, we want to use numpy's NA support... but that
9
+ # doesn't exist yet. Until then, people use various sorts of ad-hoc
10
+ # things. Some things that might be considered NA:
11
+ # NA (eventually)
12
+ # NaN (in float or object arrays)
13
+ # None (in object arrays)
14
+ # np.ma.masked (in numpy.ma masked arrays)
15
+ # Pandas compatibility considerations:
16
+ # For numeric arrays, None is unconditionally converted to NaN.
17
+ # For object arrays (including string arrays!), None and NaN are preserved,
18
+ # but pandas.isnull() returns True for both.
19
+ # np.ma compatibility considerations:
20
+ # Preserving array subtypes is a huge pain, because it means that we can't
21
+ # just call 'asarray' and be done... we already jump through tons of hoops
22
+ # to write code that can handle both ndarray's and pandas objects, and
23
+ # just thinking about adding another item to this list makes me tired. So
24
+ # for now we don't support np.ma missing values. Use pandas!
25
+
26
+ # Next, what should be done once we find missing data? R's options:
27
+ # -- throw away those rows (from all aligned matrices)
28
+ # -- with or without preserving information on which rows were discarded
29
+ # -- error out
30
+ # -- carry on
31
+ # The 'carry on' option requires that we have some way to represent NA in our
32
+ # output array. To avoid further solidifying the use of NaN for this purpose,
33
+ # we'll leave this option out for now, until real NA support is
34
+ # available. Also, we always preserve information on which rows were
35
+ # discarded, using the pandas index functionality (currently this is only
36
+ # returned to the original caller if they used return_type="dataframe",
37
+ # though).
38
+
39
+ import numpy as np
40
+ from patsy import PatsyError
41
+ from patsy.util import safe_isnan, safe_scalar_isnan, no_pickling, assert_no_pickling
42
+
43
+ # These are made available in the patsy.* namespace
44
+ __all__ = ["NAAction"]
45
+
46
+ _valid_NA_types = ["None", "NaN"]
47
+ _valid_NA_responses = ["raise", "drop"]
48
+
49
+
50
+ def _desc_options(options):
51
+ return ", ".join([repr(opt) for opt in options])
52
+
53
+
54
+ class NAAction(object):
55
+ """An :class:`NAAction` object defines a strategy for handling missing
56
+ data.
57
+
58
+ "NA" is short for "Not Available", and is used to refer to any value which
59
+ is somehow unmeasured or unavailable. In the long run, it is devoutly
60
+ hoped that numpy will gain first-class missing value support. Until then,
61
+ we work around this lack as best we're able.
62
+
63
+ There are two parts to this: First, we have to determine what counts as
64
+ missing data. For numerical data, the default is to treat NaN values
65
+ (e.g., ``numpy.nan``) as missing. For categorical data, the default is to
66
+ treat NaN values, and also the Python object None, as missing. (This is
67
+ consistent with how pandas does things, so if you're already using
68
+ None/NaN to mark missing data in your pandas DataFrames, you're good to
69
+ go.)
70
+
71
+ Second, we have to decide what to do with any missing data when we
72
+ encounter it. One option is to simply discard any rows which contain
73
+ missing data from our design matrices (``drop``). Another option is to
74
+ raise an error (``raise``). A third option would be to simply let the
75
+ missing values pass through into the returned design matrices. However,
76
+ this last option is not yet implemented, because of the lack of any
77
+ standard way to represent missing values in arbitrary numpy matrices;
78
+ we're hoping numpy will get this sorted out before we standardize on
79
+ anything ourselves.
80
+
81
+ You can control how patsy handles missing data through the ``NA_action=``
82
+ argument to functions like :func:`build_design_matrices` and
83
+ :func:`dmatrix`. If all you want to do is to choose between ``drop`` and
84
+ ``raise`` behaviour, you can pass one of those strings as the
85
+ ``NA_action=`` argument directly. If you want more fine-grained control
86
+ over how missing values are detected and handled, then you can create an
87
+ instance of this class, or your own object that implements the same
88
+ interface, and pass that as the ``NA_action=`` argument instead.
89
+ """
90
+
91
+ def __init__(self, on_NA="drop", NA_types=["None", "NaN"]):
92
+ """The :class:`NAAction` constructor takes the following arguments:
93
+
94
+ :arg on_NA: How to handle missing values. The default is ``"drop"``,
95
+ which removes all rows from all matrices which contain any missing
96
+ values. Also available is ``"raise"``, which raises an exception
97
+ when any missing values are encountered.
98
+ :arg NA_types: Which rules are used to identify missing values, as a
99
+ list of strings. Allowed values are:
100
+
101
+ * ``"None"``: treat the ``None`` object as missing in categorical
102
+ data.
103
+ * ``"NaN"``: treat floating point NaN values as missing in
104
+ categorical and numerical data.
105
+
106
+ .. versionadded:: 0.2.0
107
+ """
108
+ self.on_NA = on_NA
109
+ if self.on_NA not in _valid_NA_responses:
110
+ raise ValueError(
111
+ "invalid on_NA action %r "
112
+ "(should be one of %s)" % (on_NA, _desc_options(_valid_NA_responses))
113
+ )
114
+ if isinstance(NA_types, str):
115
+ raise ValueError("NA_types should be a list of strings")
116
+ self.NA_types = tuple(NA_types)
117
+ for NA_type in self.NA_types:
118
+ if NA_type not in _valid_NA_types:
119
+ raise ValueError(
120
+ "invalid NA_type %r "
121
+ "(should be one of %s)" % (NA_type, _desc_options(_valid_NA_types))
122
+ )
123
+
124
+ def is_categorical_NA(self, obj):
125
+ """Return True if `obj` is a categorical NA value.
126
+
127
+ Note that here `obj` is a single scalar value."""
128
+ if "NaN" in self.NA_types and safe_scalar_isnan(obj):
129
+ return True
130
+ if "None" in self.NA_types and obj is None:
131
+ return True
132
+ return False
133
+
134
+ def is_numerical_NA(self, arr):
135
+ """Returns a 1-d mask array indicating which rows in an array of
136
+ numerical values contain at least one NA value.
137
+
138
+ Note that here `arr` is a numpy array or pandas DataFrame."""
139
+ mask = np.zeros(arr.shape, dtype=bool)
140
+ if "NaN" in self.NA_types:
141
+ mask |= np.isnan(arr)
142
+ if mask.ndim > 1:
143
+ mask = np.any(mask, axis=1)
144
+ return mask
145
+
146
+ def handle_NA(self, values, is_NAs, origins):
147
+ """Takes a set of factor values that may have NAs, and handles them
148
+ appropriately.
149
+
150
+ :arg values: A list of `ndarray` objects representing the data.
151
+ These may be 1- or 2-dimensional, and may be of varying dtype. All
152
+ will have the same number of rows (or entries, for 1-d arrays).
153
+ :arg is_NAs: A list with the same number of entries as `values`,
154
+ containing boolean `ndarray` objects that indicate which rows
155
+ contain NAs in the corresponding entry in `values`.
156
+ :arg origins: A list with the same number of entries as
157
+ `values`, containing information on the origin of each
158
+ value. If we encounter a problem with some particular value, we use
159
+ the corresponding entry in `origins` as the origin argument when
160
+ raising a :class:`PatsyError`.
161
+ :returns: A list of new values (which may have a differing number of
162
+ rows.)
163
+ """
164
+ assert len(values) == len(is_NAs) == len(origins)
165
+ if len(values) == 0:
166
+ return values
167
+ if self.on_NA == "raise":
168
+ return self._handle_NA_raise(values, is_NAs, origins)
169
+ elif self.on_NA == "drop":
170
+ return self._handle_NA_drop(values, is_NAs, origins)
171
+ else: # pragma: no cover
172
+ assert False
173
+
174
+ def _handle_NA_raise(self, values, is_NAs, origins):
175
+ for is_NA, origin in zip(is_NAs, origins):
176
+ if np.any(is_NA):
177
+ raise PatsyError("factor contains missing values", origin)
178
+ return values
179
+
180
+ def _handle_NA_drop(self, values, is_NAs, origins):
181
+ total_mask = np.zeros(is_NAs[0].shape[0], dtype=bool)
182
+ for is_NA in is_NAs:
183
+ total_mask |= is_NA
184
+ good_mask = ~total_mask
185
+ # "..." to handle 1- versus 2-dim indexing
186
+ return [v[good_mask] if v.ndim == 1 else v[good_mask, ...] for v in values]
187
+
188
+ __getstate__ = no_pickling
189
+
190
+
191
+ def test_NAAction_basic():
192
+ import pytest
193
+
194
+ pytest.raises(ValueError, NAAction, on_NA="pord")
195
+ pytest.raises(ValueError, NAAction, NA_types=("NaN", "asdf"))
196
+ pytest.raises(ValueError, NAAction, NA_types="NaN")
197
+
198
+ assert_no_pickling(NAAction())
199
+
200
+
201
+ def test_NAAction_NA_types_numerical():
202
+ for NA_types in [[], ["NaN"], ["None"], ["NaN", "None"]]:
203
+ action = NAAction(NA_types=NA_types)
204
+ for extra_shape in [(), (1,), (2,)]:
205
+ arr = np.ones((4,) + extra_shape, dtype=float)
206
+ nan_rows = [0, 2]
207
+ if arr.ndim > 1 and arr.shape[1] > 1:
208
+ arr[nan_rows, [0, 1]] = np.nan
209
+ else:
210
+ arr[nan_rows] = np.nan
211
+ exp_NA_mask = np.zeros(4, dtype=bool)
212
+ if "NaN" in NA_types:
213
+ exp_NA_mask[nan_rows] = True
214
+ got_NA_mask = action.is_numerical_NA(arr)
215
+ assert np.array_equal(got_NA_mask, exp_NA_mask)
216
+
217
+
218
+ def test_NAAction_NA_types_categorical():
219
+ for NA_types in [[], ["NaN"], ["None"], ["NaN", "None"]]:
220
+ action = NAAction(NA_types=NA_types)
221
+ assert not action.is_categorical_NA("a")
222
+ assert not action.is_categorical_NA(1)
223
+ assert action.is_categorical_NA(None) == ("None" in NA_types)
224
+ assert action.is_categorical_NA(np.nan) == ("NaN" in NA_types)
225
+
226
+
227
+ def test_NAAction_drop():
228
+ action = NAAction("drop")
229
+ in_values = [
230
+ np.asarray([-1, 2, -1, 4, 5]),
231
+ np.asarray([10.0, 20.0, 30.0, 40.0, 50.0]),
232
+ np.asarray([[1.0, np.nan], [3.0, 4.0], [10.0, 5.0], [6.0, 7.0], [8.0, np.nan]]),
233
+ ]
234
+ is_NAs = [
235
+ np.asarray([True, False, True, False, False]),
236
+ np.zeros(5, dtype=bool),
237
+ np.asarray([True, False, False, False, True]),
238
+ ]
239
+ out_values = action.handle_NA(in_values, is_NAs, [None] * 3)
240
+ assert len(out_values) == 3
241
+ assert np.array_equal(out_values[0], [2, 4])
242
+ assert np.array_equal(out_values[1], [20.0, 40.0])
243
+ assert np.array_equal(out_values[2], [[3.0, 4.0], [6.0, 7.0]])
244
+
245
+
246
+ def test_NAAction_raise():
247
+ action = NAAction(on_NA="raise")
248
+
249
+ # no-NA just passes through:
250
+ in_arrs = [np.asarray([1.1, 1.2]), np.asarray([1, 2])]
251
+ is_NAs = [np.asarray([False, False])] * 2
252
+ got_arrs = action.handle_NA(in_arrs, is_NAs, [None, None])
253
+ assert np.array_equal(got_arrs[0], in_arrs[0])
254
+ assert np.array_equal(got_arrs[1], in_arrs[1])
255
+
256
+ from patsy.origin import Origin
257
+
258
+ o1 = Origin("asdf", 0, 1)
259
+ o2 = Origin("asdf", 2, 3)
260
+
261
+ # NA raises an error with a correct origin
262
+ in_idx = np.arange(2)
263
+ in_arrs = [np.asarray([1.1, 1.2]), np.asarray([1.0, np.nan])]
264
+ is_NAs = [np.asarray([False, False]), np.asarray([False, True])]
265
+ try:
266
+ action.handle_NA(in_arrs, is_NAs, [o1, o2])
267
+ assert False
268
+ except PatsyError as e:
269
+ assert e.origin is o2
shared/package-files/33/335fe549be2e3479766a466442580e7f6d529dfbeb590cfaaf26ed0885407584/types.pxi ADDED
The diff for this file is too large to render. See raw diff
 
shared/package-files/33/33604784129b509f04d81d901317d57fc35b00ae1916126d98a45e9416590e1e/registry.py ADDED
@@ -0,0 +1,414 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from enum import Enum
2
+ import importlib
3
+
4
+
5
+ class BackendFilter(Enum):
6
+ """
7
+ Filter used with :meth:`~matplotlib.backends.registry.BackendRegistry.list_builtin`
8
+
9
+ .. versionadded:: 3.9
10
+ """
11
+ INTERACTIVE = 0
12
+ NON_INTERACTIVE = 1
13
+
14
+
15
+ class BackendRegistry:
16
+ """
17
+ Registry of backends available within Matplotlib.
18
+
19
+ This is the single source of truth for available backends.
20
+
21
+ All use of ``BackendRegistry`` should be via the singleton instance
22
+ ``backend_registry`` which can be imported from ``matplotlib.backends``.
23
+
24
+ Each backend has a name, a module name containing the backend code, and an
25
+ optional GUI framework that must be running if the backend is interactive.
26
+ There are three sources of backends: built-in (source code is within the
27
+ Matplotlib repository), explicit ``module://some.backend`` syntax (backend is
28
+ obtained by loading the module), or via an entry point (self-registering
29
+ backend in an external package).
30
+
31
+ .. versionadded:: 3.9
32
+ """
33
+ # Mapping of built-in backend name to GUI framework, or "headless" for no
34
+ # GUI framework. Built-in backends are those which are included in the
35
+ # Matplotlib repo. A backend with name 'name' is located in the module
36
+ # f"matplotlib.backends.backend_{name.lower()}"
37
+ _BUILTIN_BACKEND_TO_GUI_FRAMEWORK = {
38
+ "gtk3agg": "gtk3",
39
+ "gtk3cairo": "gtk3",
40
+ "gtk4agg": "gtk4",
41
+ "gtk4cairo": "gtk4",
42
+ "macosx": "macosx",
43
+ "nbagg": "nbagg",
44
+ "notebook": "nbagg",
45
+ "qtagg": "qt",
46
+ "qtcairo": "qt",
47
+ "qt5agg": "qt5",
48
+ "qt5cairo": "qt5",
49
+ "tkagg": "tk",
50
+ "tkcairo": "tk",
51
+ "webagg": "webagg",
52
+ "wx": "wx",
53
+ "wxagg": "wx",
54
+ "wxcairo": "wx",
55
+ "agg": "headless",
56
+ "cairo": "headless",
57
+ "pdf": "headless",
58
+ "pgf": "headless",
59
+ "ps": "headless",
60
+ "svg": "headless",
61
+ "template": "headless",
62
+ }
63
+
64
+ # Reverse mapping of gui framework to preferred built-in backend.
65
+ _GUI_FRAMEWORK_TO_BACKEND = {
66
+ "gtk3": "gtk3agg",
67
+ "gtk4": "gtk4agg",
68
+ "headless": "agg",
69
+ "macosx": "macosx",
70
+ "qt": "qtagg",
71
+ "qt5": "qt5agg",
72
+ "qt6": "qtagg",
73
+ "tk": "tkagg",
74
+ "wx": "wxagg",
75
+ }
76
+
77
+ def __init__(self):
78
+ # Only load entry points when first needed.
79
+ self._loaded_entry_points = False
80
+
81
+ # Mapping of non-built-in backend to GUI framework, added dynamically from
82
+ # entry points and from matplotlib.use("module://some.backend") format.
83
+ # New entries have an "unknown" GUI framework that is determined when first
84
+ # needed by calling _get_gui_framework_by_loading.
85
+ self._backend_to_gui_framework = {}
86
+
87
+ # Mapping of backend name to module name, where different from
88
+ # f"matplotlib.backends.backend_{backend_name.lower()}". These are either
89
+ # hardcoded for backward compatibility, or loaded from entry points or
90
+ # "module://some.backend" syntax.
91
+ self._name_to_module = {
92
+ "notebook": "nbagg",
93
+ }
94
+
95
+ def _backend_module_name(self, backend):
96
+ if backend.startswith("module://"):
97
+ return backend[9:]
98
+
99
+ # Return name of module containing the specified backend.
100
+ # Does not check if the backend is valid, use is_valid_backend for that.
101
+ backend = backend.lower()
102
+
103
+ # Check if have specific name to module mapping.
104
+ backend = self._name_to_module.get(backend, backend)
105
+
106
+ return (backend[9:] if backend.startswith("module://")
107
+ else f"matplotlib.backends.backend_{backend}")
108
+
109
+ def _clear(self):
110
+ # Clear all dynamically-added data, used for testing only.
111
+ self.__init__()
112
+
113
+ def _ensure_entry_points_loaded(self):
114
+ # Load entry points, if they have not already been loaded.
115
+ if not self._loaded_entry_points:
116
+ entries = self._read_entry_points()
117
+ self._validate_and_store_entry_points(entries)
118
+ self._loaded_entry_points = True
119
+
120
+ def _get_gui_framework_by_loading(self, backend):
121
+ # Determine GUI framework for a backend by loading its module and reading the
122
+ # FigureCanvas.required_interactive_framework attribute.
123
+ # Returns "headless" if there is no GUI framework.
124
+ module = self.load_backend_module(backend)
125
+ canvas_class = module.FigureCanvas
126
+ return canvas_class.required_interactive_framework or "headless"
127
+
128
+ def _read_entry_points(self):
129
+ # Read entry points of modules that self-advertise as Matplotlib backends.
130
+ # Expects entry points like this one from matplotlib-inline (in pyproject.toml
131
+ # format):
132
+ # [project.entry-points."matplotlib.backend"]
133
+ # inline = "matplotlib_inline.backend_inline"
134
+ import importlib.metadata as im
135
+
136
+ entry_points = im.entry_points(group="matplotlib.backend")
137
+ entries = [(entry.name, entry.value) for entry in entry_points]
138
+
139
+ # For backward compatibility, if matplotlib-inline and/or ipympl are installed
140
+ # but too old to include entry points, create them. Do not import ipympl
141
+ # directly as this calls matplotlib.use() whilst in this function.
142
+ def backward_compatible_entry_points(
143
+ entries, module_name, threshold_version, names, target):
144
+ from matplotlib import _parse_to_version_info
145
+ try:
146
+ module_version = im.version(module_name)
147
+ if _parse_to_version_info(module_version) < threshold_version:
148
+ for name in names:
149
+ entries.append((name, target))
150
+ except im.PackageNotFoundError:
151
+ pass
152
+
153
+ names = [entry[0] for entry in entries]
154
+ if "inline" not in names:
155
+ backward_compatible_entry_points(
156
+ entries, "matplotlib_inline", (0, 1, 7), ["inline"],
157
+ "matplotlib_inline.backend_inline")
158
+ if "ipympl" not in names:
159
+ backward_compatible_entry_points(
160
+ entries, "ipympl", (0, 9, 4), ["ipympl", "widget"],
161
+ "ipympl.backend_nbagg")
162
+
163
+ return entries
164
+
165
+ def _validate_and_store_entry_points(self, entries):
166
+ # Validate and store entry points so that they can be used via matplotlib.use()
167
+ # in the normal manner. Entry point names cannot be of module:// format, cannot
168
+ # shadow a built-in backend name, and there cannot be multiple entry points
169
+ # with the same name but different modules. Multiple entry points with the same
170
+ # name and value are permitted (it can sometimes happen outside of our control,
171
+ # see https://github.com/matplotlib/matplotlib/issues/28367).
172
+ for name, module in set(entries):
173
+ name = name.lower()
174
+ if name.startswith("module://"):
175
+ raise RuntimeError(
176
+ f"Entry point name '{name}' cannot start with 'module://'")
177
+ if name in self._BUILTIN_BACKEND_TO_GUI_FRAMEWORK:
178
+ raise RuntimeError(f"Entry point name '{name}' is a built-in backend")
179
+ if name in self._backend_to_gui_framework:
180
+ raise RuntimeError(f"Entry point name '{name}' duplicated")
181
+
182
+ self._name_to_module[name] = "module://" + module
183
+ # Do not yet know backend GUI framework, determine it only when necessary.
184
+ self._backend_to_gui_framework[name] = "unknown"
185
+
186
+ def backend_for_gui_framework(self, framework):
187
+ """
188
+ Return the name of the backend corresponding to the specified GUI framework.
189
+
190
+ Parameters
191
+ ----------
192
+ framework : str
193
+ GUI framework such as "qt".
194
+
195
+ Returns
196
+ -------
197
+ str or None
198
+ Backend name or None if GUI framework not recognised.
199
+ """
200
+ return self._GUI_FRAMEWORK_TO_BACKEND.get(framework.lower())
201
+
202
+ def is_valid_backend(self, backend):
203
+ """
204
+ Return True if the backend name is valid, False otherwise.
205
+
206
+ A backend name is valid if it is one of the built-in backends or has been
207
+ dynamically added via an entry point. Those beginning with ``module://`` are
208
+ always considered valid and are added to the current list of all backends
209
+ within this function.
210
+
211
+ Even if a name is valid, it may not be importable or usable. This can only be
212
+ determined by loading and using the backend module.
213
+
214
+ Parameters
215
+ ----------
216
+ backend : str
217
+ Name of backend.
218
+
219
+ Returns
220
+ -------
221
+ bool
222
+ True if backend is valid, False otherwise.
223
+ """
224
+ if not backend.startswith("module://"):
225
+ backend = backend.lower()
226
+
227
+ # For backward compatibility, convert ipympl and matplotlib-inline long
228
+ # module:// names to their shortened forms.
229
+ backwards_compat = {
230
+ "module://ipympl.backend_nbagg": "widget",
231
+ "module://matplotlib_inline.backend_inline": "inline",
232
+ }
233
+ backend = backwards_compat.get(backend, backend)
234
+
235
+ if (backend in self._BUILTIN_BACKEND_TO_GUI_FRAMEWORK or
236
+ backend in self._backend_to_gui_framework):
237
+ return True
238
+
239
+ if backend.startswith("module://"):
240
+ self._backend_to_gui_framework[backend] = "unknown"
241
+ return True
242
+
243
+ # Only load entry points if really need to and not already done so.
244
+ self._ensure_entry_points_loaded()
245
+ if backend in self._backend_to_gui_framework:
246
+ return True
247
+
248
+ return False
249
+
250
+ def list_all(self):
251
+ """
252
+ Return list of all known backends.
253
+
254
+ These include built-in backends and those obtained at runtime either from entry
255
+ points or explicit ``module://some.backend`` syntax.
256
+
257
+ Entry points will be loaded if they haven't been already.
258
+
259
+ Returns
260
+ -------
261
+ list of str
262
+ Backend names.
263
+ """
264
+ self._ensure_entry_points_loaded()
265
+ return [*self.list_builtin(), *self._backend_to_gui_framework]
266
+
267
+ def list_builtin(self, filter_=None):
268
+ """
269
+ Return list of backends that are built into Matplotlib.
270
+
271
+ Parameters
272
+ ----------
273
+ filter_ : `~.BackendFilter`, optional
274
+ Filter to apply to returned backends. For example, to return only
275
+ non-interactive backends use `.BackendFilter.NON_INTERACTIVE`.
276
+
277
+ Returns
278
+ -------
279
+ list of str
280
+ Backend names.
281
+ """
282
+ if filter_ == BackendFilter.INTERACTIVE:
283
+ return [k for k, v in self._BUILTIN_BACKEND_TO_GUI_FRAMEWORK.items()
284
+ if v != "headless"]
285
+ elif filter_ == BackendFilter.NON_INTERACTIVE:
286
+ return [k for k, v in self._BUILTIN_BACKEND_TO_GUI_FRAMEWORK.items()
287
+ if v == "headless"]
288
+
289
+ return [*self._BUILTIN_BACKEND_TO_GUI_FRAMEWORK]
290
+
291
+ def list_gui_frameworks(self):
292
+ """
293
+ Return list of GUI frameworks used by Matplotlib backends.
294
+
295
+ Returns
296
+ -------
297
+ list of str
298
+ GUI framework names.
299
+ """
300
+ return [k for k in self._GUI_FRAMEWORK_TO_BACKEND if k != "headless"]
301
+
302
+ def load_backend_module(self, backend):
303
+ """
304
+ Load and return the module containing the specified backend.
305
+
306
+ Parameters
307
+ ----------
308
+ backend : str
309
+ Name of backend to load.
310
+
311
+ Returns
312
+ -------
313
+ Module
314
+ Module containing backend.
315
+ """
316
+ module_name = self._backend_module_name(backend)
317
+ return importlib.import_module(module_name)
318
+
319
+ def resolve_backend(self, backend):
320
+ """
321
+ Return the backend and GUI framework for the specified backend name.
322
+
323
+ If the GUI framework is not yet known then it will be determined by loading the
324
+ backend module and checking the ``FigureCanvas.required_interactive_framework``
325
+ attribute.
326
+
327
+ This function only loads entry points if they have not already been loaded and
328
+ the backend is not built-in and not of ``module://some.backend`` format.
329
+
330
+ Parameters
331
+ ----------
332
+ backend : str or None
333
+ Name of backend, or None to use the default backend.
334
+
335
+ Returns
336
+ -------
337
+ backend : str
338
+ The backend name.
339
+ framework : str or None
340
+ The GUI framework, which will be None for a backend that is non-interactive.
341
+ """
342
+ if isinstance(backend, str):
343
+ if not backend.startswith("module://"):
344
+ backend = backend.lower()
345
+ else: # Might be _auto_backend_sentinel or None
346
+ # Use whatever is already running...
347
+ from matplotlib import get_backend
348
+ backend = get_backend()
349
+
350
+ # Is backend already known (built-in or dynamically loaded)?
351
+ gui = (self._BUILTIN_BACKEND_TO_GUI_FRAMEWORK.get(backend) or
352
+ self._backend_to_gui_framework.get(backend))
353
+
354
+ # Is backend "module://something"?
355
+ if gui is None and isinstance(backend, str) and backend.startswith("module://"):
356
+ gui = "unknown"
357
+
358
+ # Is backend a possible entry point?
359
+ if gui is None and not self._loaded_entry_points:
360
+ self._ensure_entry_points_loaded()
361
+ gui = self._backend_to_gui_framework.get(backend)
362
+
363
+ # Backend known but not its gui framework.
364
+ if gui == "unknown":
365
+ gui = self._get_gui_framework_by_loading(backend)
366
+ self._backend_to_gui_framework[backend] = gui
367
+
368
+ if gui is None:
369
+ raise RuntimeError(f"'{backend}' is not a recognised backend name")
370
+
371
+ return backend, gui if gui != "headless" else None
372
+
373
+ def resolve_gui_or_backend(self, gui_or_backend):
374
+ """
375
+ Return the backend and GUI framework for the specified string that may be
376
+ either a GUI framework or a backend name, tested in that order.
377
+
378
+ This is for use with the IPython %matplotlib magic command which may be a GUI
379
+ framework such as ``%matplotlib qt`` or a backend name such as
380
+ ``%matplotlib qtagg``.
381
+
382
+ This function only loads entry points if they have not already been loaded and
383
+ the backend is not built-in and not of ``module://some.backend`` format.
384
+
385
+ Parameters
386
+ ----------
387
+ gui_or_backend : str or None
388
+ Name of GUI framework or backend, or None to use the default backend.
389
+
390
+ Returns
391
+ -------
392
+ backend : str
393
+ The backend name.
394
+ framework : str or None
395
+ The GUI framework, which will be None for a backend that is non-interactive.
396
+ """
397
+ if not gui_or_backend.startswith("module://"):
398
+ gui_or_backend = gui_or_backend.lower()
399
+
400
+ # First check if it is a gui loop name.
401
+ backend = self.backend_for_gui_framework(gui_or_backend)
402
+ if backend is not None:
403
+ return backend, gui_or_backend if gui_or_backend != "headless" else None
404
+
405
+ # Then check if it is a backend name.
406
+ try:
407
+ return self.resolve_backend(gui_or_backend)
408
+ except Exception: # KeyError ?
409
+ raise RuntimeError(
410
+ f"'{gui_or_backend}' is not a recognised GUI loop or backend name")
411
+
412
+
413
+ # Singleton
414
+ backend_registry = BackendRegistry()
shared/package-files/33/33608e94a85d3ddb541c831a396b65188564e4d1b36a0d4e1047172f4bed4e8e/__init__.pyi ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Any, Container, Iterable, Optional, Text
2
+
3
+ from bleach.linkifier import DEFAULT_CALLBACKS as DEFAULT_CALLBACKS, Linker as Linker, _Callback
4
+ from bleach.sanitizer import (
5
+ ALLOWED_ATTRIBUTES as ALLOWED_ATTRIBUTES,
6
+ ALLOWED_PROTOCOLS as ALLOWED_PROTOCOLS,
7
+ ALLOWED_STYLES as ALLOWED_STYLES,
8
+ ALLOWED_TAGS as ALLOWED_TAGS,
9
+ Cleaner as Cleaner,
10
+ )
11
+
12
+ __releasedate__: Text
13
+ __version__: Text
14
+ VERSION: Any # packaging.version.Version
15
+
16
+ def clean(
17
+ text: Text,
18
+ tags: Container[Text] = ...,
19
+ attributes: Any = ...,
20
+ styles: Container[Text] = ...,
21
+ protocols: Container[Text] = ...,
22
+ strip: bool = ...,
23
+ strip_comments: bool = ...,
24
+ ) -> Text: ...
25
+ def linkify(
26
+ text: Text, callbacks: Iterable[_Callback] = ..., skip_tags: Optional[Container[Text]] = ..., parse_email: bool = ...
27
+ ) -> Text: ...