TheHassanSaud commited on
Commit
2f3afcd
·
1 Parent(s): f488c76

Upload folder using huggingface_hub (part 12)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +15 -0
  2. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas-2.3.3.dist-info/LICENSE +1250 -0
  3. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas-2.3.3.dist-info/METADATA +1574 -0
  4. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas-2.3.3.dist-info/RECORD +0 -0
  5. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas-2.3.3.dist-info/WHEEL +6 -0
  6. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas-2.3.3.dist-info/entry_points.txt +3 -0
  7. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tseries/offsets/test_offsets_properties.py +60 -0
  8. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tseries/offsets/test_quarter.py +303 -0
  9. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tseries/offsets/test_ticks.py +405 -0
  10. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tseries/offsets/test_week.py +351 -0
  11. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tseries/offsets/test_year.py +339 -0
  12. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/__init__.py +0 -0
  13. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_api.py +65 -0
  14. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_array_to_datetime.py +337 -0
  15. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_ccalendar.py +63 -0
  16. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_conversion.py +160 -0
  17. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_fields.py +40 -0
  18. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_libfrequencies.py +27 -0
  19. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_liboffsets.py +173 -0
  20. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_np_datetime.py +222 -0
  21. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_npy_units.py +27 -0
  22. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_parse_iso8601.py +119 -0
  23. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_parsing.py +416 -0
  24. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_period.py +123 -0
  25. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_resolution.py +57 -0
  26. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_strptime.py +110 -0
  27. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_timedeltas.py +149 -0
  28. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_timezones.py +168 -0
  29. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_to_offset.py +219 -0
  30. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_tzconversion.py +23 -0
  31. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/__init__.py +0 -0
  32. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/conftest.py +26 -0
  33. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_assert_almost_equal.py +586 -0
  34. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_assert_attr_equal.py +33 -0
  35. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_assert_categorical_equal.py +90 -0
  36. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_assert_extension_array_equal.py +126 -0
  37. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_assert_frame_equal.py +393 -0
  38. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_assert_index_equal.py +319 -0
  39. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_assert_interval_array_equal.py +81 -0
  40. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_assert_numpy_array_equal.py +223 -0
  41. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_assert_produces_warning.py +241 -0
  42. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_assert_series_equal.py +475 -0
  43. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_deprecate.py +63 -0
  44. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_deprecate_kwarg.py +90 -0
  45. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_deprecate_nonkeyword_arguments.py +141 -0
  46. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_doc.py +90 -0
  47. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_hashing.py +417 -0
  48. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_numba.py +12 -0
  49. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_rewrite_warning.py +39 -0
  50. pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_shares_memory.py +32 -0
.gitattributes CHANGED
@@ -698,3 +698,18 @@ pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/_libs/tslibs/vect
698
  pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/_libs/window/aggregations.cpython-311-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
699
  pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/_libs/window/indexers.cpython-311-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
700
  pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/_libs/writers.cpython-311-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
698
  pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/_libs/window/aggregations.cpython-311-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
699
  pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/_libs/window/indexers.cpython-311-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
700
  pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/_libs/writers.cpython-311-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
701
+ pace_revision_1/.venv-pace/lib/python3.11/site-packages/pillow.libs/libavif-8a7f9d56.so.16.4.2 filter=lfs diff=lfs merge=lfs -text
702
+ pace_revision_1/.venv-pace/lib/python3.11/site-packages/pillow.libs/libbrotlicommon-53534446.so.1.2.0 filter=lfs diff=lfs merge=lfs -text
703
+ pace_revision_1/.venv-pace/lib/python3.11/site-packages/pillow.libs/libfreetype-9fc94c80.so.6.20.6 filter=lfs diff=lfs merge=lfs -text
704
+ pace_revision_1/.venv-pace/lib/python3.11/site-packages/pillow.libs/libharfbuzz-172d1f63.so.0.61421.0 filter=lfs diff=lfs merge=lfs -text
705
+ pace_revision_1/.venv-pace/lib/python3.11/site-packages/pillow.libs/libjpeg-31e2ca52.so.62.4.0 filter=lfs diff=lfs merge=lfs -text
706
+ pace_revision_1/.venv-pace/lib/python3.11/site-packages/pillow.libs/liblcms2-dade1fbf.so.2.0.19 filter=lfs diff=lfs merge=lfs -text
707
+ pace_revision_1/.venv-pace/lib/python3.11/site-packages/pillow.libs/liblzma-2be87c3e.so.5.8.3 filter=lfs diff=lfs merge=lfs -text
708
+ pace_revision_1/.venv-pace/lib/python3.11/site-packages/pillow.libs/libopenjp2-b07f72ad.so.2.5.4 filter=lfs diff=lfs merge=lfs -text
709
+ pace_revision_1/.venv-pace/lib/python3.11/site-packages/pillow.libs/libpng16-abb096d5.so.16.58.0 filter=lfs diff=lfs merge=lfs -text
710
+ pace_revision_1/.venv-pace/lib/python3.11/site-packages/pillow.libs/libtiff-fc87e79d.so.6.2.0 filter=lfs diff=lfs merge=lfs -text
711
+ pace_revision_1/.venv-pace/lib/python3.11/site-packages/pillow.libs/libwebp-51b0b3f7.so.7.2.0 filter=lfs diff=lfs merge=lfs -text
712
+ pace_revision_1/.venv-pace/lib/python3.11/site-packages/pillow.libs/libxcb-ad31f5a3.so.1.1.0 filter=lfs diff=lfs merge=lfs -text
713
+ pace_revision_1/.venv-pace/lib/python3.11/site-packages/pillow.libs/libzstd-44be1190.so.1.5.7 filter=lfs diff=lfs merge=lfs -text
714
+ pace_revision_1/.venv-pace/lib/python3.11/site-packages/pydantic_core/_pydantic_core.cpython-311-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
715
+ pace_revision_1/.venv-pace/lib/python3.11/site-packages/pyparsing/__pycache__/core.cpython-311.pyc filter=lfs diff=lfs merge=lfs -text
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas-2.3.3.dist-info/LICENSE ADDED
@@ -0,0 +1,1250 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2008-2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
4
+ All rights reserved.
5
+
6
+ Copyright (c) 2011-2023, Open source contributors.
7
+
8
+ Redistribution and use in source and binary forms, with or without
9
+ modification, are permitted provided that the following conditions are met:
10
+
11
+ * Redistributions of source code must retain the above copyright notice, this
12
+ list of conditions and the following disclaimer.
13
+
14
+ * Redistributions in binary form must reproduce the above copyright notice,
15
+ this list of conditions and the following disclaimer in the documentation
16
+ and/or other materials provided with the distribution.
17
+
18
+ * Neither the name of the copyright holder nor the names of its
19
+ contributors may be used to endorse or promote products derived from
20
+ this software without specific prior written permission.
21
+
22
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
+ Copyright (c) 2010-2019 Keith Goodman
33
+ Copyright (c) 2019 Bottleneck Developers
34
+ All rights reserved.
35
+
36
+ Redistribution and use in source and binary forms, with or without
37
+ modification, are permitted provided that the following conditions are met:
38
+
39
+ * Redistributions of source code must retain the above copyright notice,
40
+ this list of conditions and the following disclaimer.
41
+
42
+ * Redistributions in binary form must reproduce the above copyright
43
+ notice, this list of conditions and the following disclaimer in the
44
+ documentation and/or other materials provided with the distribution.
45
+
46
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
47
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
48
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
49
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
50
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
51
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
52
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
53
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
54
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
55
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
56
+ POSSIBILITY OF SUCH DAMAGE.Copyright 2017- Paul Ganssle <paul@ganssle.io>
57
+ Copyright 2017- dateutil contributors (see AUTHORS file)
58
+
59
+ Licensed under the Apache License, Version 2.0 (the "License");
60
+ you may not use this file except in compliance with the License.
61
+ You may obtain a copy of the License at
62
+
63
+ http://www.apache.org/licenses/LICENSE-2.0
64
+
65
+ Unless required by applicable law or agreed to in writing, software
66
+ distributed under the License is distributed on an "AS IS" BASIS,
67
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
68
+ See the License for the specific language governing permissions and
69
+ limitations under the License.
70
+
71
+ The above license applies to all contributions after 2017-12-01, as well as
72
+ all contributions that have been re-licensed (see AUTHORS file for the list of
73
+ contributors who have re-licensed their code).
74
+ --------------------------------------------------------------------------------
75
+ dateutil - Extensions to the standard Python datetime module.
76
+
77
+ Copyright (c) 2003-2011 - Gustavo Niemeyer <gustavo@niemeyer.net>
78
+ Copyright (c) 2012-2014 - Tomi Pieviläinen <tomi.pievilainen@iki.fi>
79
+ Copyright (c) 2014-2016 - Yaron de Leeuw <me@jarondl.net>
80
+ Copyright (c) 2015- - Paul Ganssle <paul@ganssle.io>
81
+ Copyright (c) 2015- - dateutil contributors (see AUTHORS file)
82
+
83
+ All rights reserved.
84
+
85
+ Redistribution and use in source and binary forms, with or without
86
+ modification, are permitted provided that the following conditions are met:
87
+
88
+ * Redistributions of source code must retain the above copyright notice,
89
+ this list of conditions and the following disclaimer.
90
+ * Redistributions in binary form must reproduce the above copyright notice,
91
+ this list of conditions and the following disclaimer in the documentation
92
+ and/or other materials provided with the distribution.
93
+ * Neither the name of the copyright holder nor the names of its
94
+ contributors may be used to endorse or promote products derived from
95
+ this software without specific prior written permission.
96
+
97
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
98
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
99
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
100
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
101
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
102
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
103
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
104
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
105
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
106
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
107
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
108
+
109
+ The above BSD License Applies to all code, even that also covered by Apache 2.0.# MIT License
110
+
111
+ Copyright (c) 2019 Hadley Wickham; RStudio; and Evan Miller
112
+
113
+ Permission is hereby granted, free of charge, to any person obtaining a copy
114
+ of this software and associated documentation files (the "Software"), to deal
115
+ in the Software without restriction, including without limitation the rights
116
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
117
+ copies of the Software, and to permit persons to whom the Software is
118
+ furnished to do so, subject to the following conditions:
119
+
120
+ The above copyright notice and this permission notice shall be included in all
121
+ copies or substantial portions of the Software.
122
+
123
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
124
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
125
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
126
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
127
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
128
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
129
+ SOFTWARE.
130
+ Based on http://opensource.org/licenses/MIT
131
+
132
+ This is a template. Complete and ship as file LICENSE the following 2
133
+ lines (only)
134
+
135
+ YEAR:
136
+ COPYRIGHT HOLDER:
137
+
138
+ and specify as
139
+
140
+ License: MIT + file LICENSE
141
+
142
+ Copyright (c) <YEAR>, <COPYRIGHT HOLDER>
143
+
144
+ Permission is hereby granted, free of charge, to any person obtaining
145
+ a copy of this software and associated documentation files (the
146
+ "Software"), to deal in the Software without restriction, including
147
+ without limitation the rights to use, copy, modify, merge, publish,
148
+ distribute, sublicense, and/or sell copies of the Software, and to
149
+ permit persons to whom the Software is furnished to do so, subject to
150
+ the following conditions:
151
+
152
+ The above copyright notice and this permission notice shall be
153
+ included in all copies or substantial portions of the Software.
154
+
155
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
156
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
157
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
158
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
159
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
160
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
161
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
162
+ The MIT License
163
+
164
+ Copyright (c) 2008- Attractive Chaos <attractor@live.co.uk>
165
+
166
+ Permission is hereby granted, free of charge, to any person obtaining
167
+ a copy of this software and associated documentation files (the
168
+ "Software"), to deal in the Software without restriction, including
169
+ without limitation the rights to use, copy, modify, merge, publish,
170
+ distribute, sublicense, and/or sell copies of the Software, and to
171
+ permit persons to whom the Software is furnished to do so, subject to
172
+ the following conditions:
173
+
174
+ The above copyright notice and this permission notice shall be
175
+ included in all copies or substantial portions of the Software.
176
+
177
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
178
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
179
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
180
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
181
+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
182
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
183
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
184
+ SOFTWARE.musl as a whole is licensed under the following standard MIT license:
185
+
186
+ ----------------------------------------------------------------------
187
+ Copyright © 2005-2020 Rich Felker, et al.
188
+
189
+ Permission is hereby granted, free of charge, to any person obtaining
190
+ a copy of this software and associated documentation files (the
191
+ "Software"), to deal in the Software without restriction, including
192
+ without limitation the rights to use, copy, modify, merge, publish,
193
+ distribute, sublicense, and/or sell copies of the Software, and to
194
+ permit persons to whom the Software is furnished to do so, subject to
195
+ the following conditions:
196
+
197
+ The above copyright notice and this permission notice shall be
198
+ included in all copies or substantial portions of the Software.
199
+
200
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
201
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
202
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
203
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
204
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
205
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
206
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
207
+ ----------------------------------------------------------------------
208
+
209
+ Authors/contributors include:
210
+
211
+ A. Wilcox
212
+ Ada Worcester
213
+ Alex Dowad
214
+ Alex Suykov
215
+ Alexander Monakov
216
+ Andre McCurdy
217
+ Andrew Kelley
218
+ Anthony G. Basile
219
+ Aric Belsito
220
+ Arvid Picciani
221
+ Bartosz Brachaczek
222
+ Benjamin Peterson
223
+ Bobby Bingham
224
+ Boris Brezillon
225
+ Brent Cook
226
+ Chris Spiegel
227
+ Clément Vasseur
228
+ Daniel Micay
229
+ Daniel Sabogal
230
+ Daurnimator
231
+ David Carlier
232
+ David Edelsohn
233
+ Denys Vlasenko
234
+ Dmitry Ivanov
235
+ Dmitry V. Levin
236
+ Drew DeVault
237
+ Emil Renner Berthing
238
+ Fangrui Song
239
+ Felix Fietkau
240
+ Felix Janda
241
+ Gianluca Anzolin
242
+ Hauke Mehrtens
243
+ He X
244
+ Hiltjo Posthuma
245
+ Isaac Dunham
246
+ Jaydeep Patil
247
+ Jens Gustedt
248
+ Jeremy Huntwork
249
+ Jo-Philipp Wich
250
+ Joakim Sindholt
251
+ John Spencer
252
+ Julien Ramseier
253
+ Justin Cormack
254
+ Kaarle Ritvanen
255
+ Khem Raj
256
+ Kylie McClain
257
+ Leah Neukirchen
258
+ Luca Barbato
259
+ Luka Perkov
260
+ M Farkas-Dyck (Strake)
261
+ Mahesh Bodapati
262
+ Markus Wichmann
263
+ Masanori Ogino
264
+ Michael Clark
265
+ Michael Forney
266
+ Mikhail Kremnyov
267
+ Natanael Copa
268
+ Nicholas J. Kain
269
+ orc
270
+ Pascal Cuoq
271
+ Patrick Oppenlander
272
+ Petr Hosek
273
+ Petr Skocik
274
+ Pierre Carrier
275
+ Reini Urban
276
+ Rich Felker
277
+ Richard Pennington
278
+ Ryan Fairfax
279
+ Samuel Holland
280
+ Segev Finer
281
+ Shiz
282
+ sin
283
+ Solar Designer
284
+ Stefan Kristiansson
285
+ Stefan O'Rear
286
+ Szabolcs Nagy
287
+ Timo Teräs
288
+ Trutz Behn
289
+ Valentin Ochs
290
+ Will Dietz
291
+ William Haddon
292
+ William Pitcock
293
+
294
+ Portions of this software are derived from third-party works licensed
295
+ under terms compatible with the above MIT license:
296
+
297
+ The TRE regular expression implementation (src/regex/reg* and
298
+ src/regex/tre*) is Copyright © 2001-2008 Ville Laurikari and licensed
299
+ under a 2-clause BSD license (license text in the source files). The
300
+ included version has been heavily modified by Rich Felker in 2012, in
301
+ the interests of size, simplicity, and namespace cleanliness.
302
+
303
+ Much of the math library code (src/math/* and src/complex/*) is
304
+ Copyright © 1993,2004 Sun Microsystems or
305
+ Copyright © 2003-2011 David Schultz or
306
+ Copyright © 2003-2009 Steven G. Kargl or
307
+ Copyright © 2003-2009 Bruce D. Evans or
308
+ Copyright © 2008 Stephen L. Moshier or
309
+ Copyright © 2017-2018 Arm Limited
310
+ and labelled as such in comments in the individual source files. All
311
+ have been licensed under extremely permissive terms.
312
+
313
+ The ARM memcpy code (src/string/arm/memcpy.S) is Copyright © 2008
314
+ The Android Open Source Project and is licensed under a two-clause BSD
315
+ license. It was taken from Bionic libc, used on Android.
316
+
317
+ The AArch64 memcpy and memset code (src/string/aarch64/*) are
318
+ Copyright © 1999-2019, Arm Limited.
319
+
320
+ The implementation of DES for crypt (src/crypt/crypt_des.c) is
321
+ Copyright © 1994 David Burren. It is licensed under a BSD license.
322
+
323
+ The implementation of blowfish crypt (src/crypt/crypt_blowfish.c) was
324
+ originally written by Solar Designer and placed into the public
325
+ domain. The code also comes with a fallback permissive license for use
326
+ in jurisdictions that may not recognize the public domain.
327
+
328
+ The smoothsort implementation (src/stdlib/qsort.c) is Copyright © 2011
329
+ Valentin Ochs and is licensed under an MIT-style license.
330
+
331
+ The x86_64 port was written by Nicholas J. Kain and is licensed under
332
+ the standard MIT terms.
333
+
334
+ The mips and microblaze ports were originally written by Richard
335
+ Pennington for use in the ellcc project. The original code was adapted
336
+ by Rich Felker for build system and code conventions during upstream
337
+ integration. It is licensed under the standard MIT terms.
338
+
339
+ The mips64 port was contributed by Imagination Technologies and is
340
+ licensed under the standard MIT terms.
341
+
342
+ The powerpc port was also originally written by Richard Pennington,
343
+ and later supplemented and integrated by John Spencer. It is licensed
344
+ under the standard MIT terms.
345
+
346
+ All other files which have no copyright comments are original works
347
+ produced specifically for use as part of this library, written either
348
+ by Rich Felker, the main author of the library, or by one or more
349
+ contibutors listed above. Details on authorship of individual files
350
+ can be found in the git version control history of the project. The
351
+ omission of copyright and license comments in each file is in the
352
+ interest of source tree size.
353
+
354
+ In addition, permission is hereby granted for all public header files
355
+ (include/* and arch/*/bits/*) and crt files intended to be linked into
356
+ applications (crt/*, ldso/dlstart.c, and arch/*/crt_arch.h) to omit
357
+ the copyright notice and permission notice otherwise required by the
358
+ license, and to use these files without any requirement of
359
+ attribution. These files include substantial contributions from:
360
+
361
+ Bobby Bingham
362
+ John Spencer
363
+ Nicholas J. Kain
364
+ Rich Felker
365
+ Richard Pennington
366
+ Stefan Kristiansson
367
+ Szabolcs Nagy
368
+
369
+ all of whom have explicitly granted such permission.
370
+
371
+ This file previously contained text expressing a belief that most of
372
+ the files covered by the above exception were sufficiently trivial not
373
+ to be subject to copyright, resulting in confusion over whether it
374
+ negated the permissions granted in the license. In the spirit of
375
+ permissive licensing, and of not having licensing issues being an
376
+ obstacle to adoption, that text has been removed.Copyright (c) 2005-2023, NumPy Developers.
377
+ All rights reserved.
378
+
379
+ Redistribution and use in source and binary forms, with or without
380
+ modification, are permitted provided that the following conditions are
381
+ met:
382
+
383
+ * Redistributions of source code must retain the above copyright
384
+ notice, this list of conditions and the following disclaimer.
385
+
386
+ * Redistributions in binary form must reproduce the above
387
+ copyright notice, this list of conditions and the following
388
+ disclaimer in the documentation and/or other materials provided
389
+ with the distribution.
390
+
391
+ * Neither the name of the NumPy Developers nor the names of any
392
+ contributors may be used to endorse or promote products derived
393
+ from this software without specific prior written permission.
394
+
395
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
396
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
397
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
398
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
399
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
400
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
401
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
402
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
403
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
404
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
405
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
406
+ Apache License
407
+ Version 2.0, January 2004
408
+ http://www.apache.org/licenses/
409
+
410
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
411
+
412
+ 1. Definitions.
413
+
414
+ "License" shall mean the terms and conditions for use, reproduction,
415
+ and distribution as defined by Sections 1 through 9 of this document.
416
+
417
+ "Licensor" shall mean the copyright owner or entity authorized by
418
+ the copyright owner that is granting the License.
419
+
420
+ "Legal Entity" shall mean the union of the acting entity and all
421
+ other entities that control, are controlled by, or are under common
422
+ control with that entity. For the purposes of this definition,
423
+ "control" means (i) the power, direct or indirect, to cause the
424
+ direction or management of such entity, whether by contract or
425
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
426
+ outstanding shares, or (iii) beneficial ownership of such entity.
427
+
428
+ "You" (or "Your") shall mean an individual or Legal Entity
429
+ exercising permissions granted by this License.
430
+
431
+ "Source" form shall mean the preferred form for making modifications,
432
+ including but not limited to software source code, documentation
433
+ source, and configuration files.
434
+
435
+ "Object" form shall mean any form resulting from mechanical
436
+ transformation or translation of a Source form, including but
437
+ not limited to compiled object code, generated documentation,
438
+ and conversions to other media types.
439
+
440
+ "Work" shall mean the work of authorship, whether in Source or
441
+ Object form, made available under the License, as indicated by a
442
+ copyright notice that is included in or attached to the work
443
+ (an example is provided in the Appendix below).
444
+
445
+ "Derivative Works" shall mean any work, whether in Source or Object
446
+ form, that is based on (or derived from) the Work and for which the
447
+ editorial revisions, annotations, elaborations, or other modifications
448
+ represent, as a whole, an original work of authorship. For the purposes
449
+ of this License, Derivative Works shall not include works that remain
450
+ separable from, or merely link (or bind by name) to the interfaces of,
451
+ the Work and Derivative Works thereof.
452
+
453
+ "Contribution" shall mean any work of authorship, including
454
+ the original version of the Work and any modifications or additions
455
+ to that Work or Derivative Works thereof, that is intentionally
456
+ submitted to Licensor for inclusion in the Work by the copyright owner
457
+ or by an individual or Legal Entity authorized to submit on behalf of
458
+ the copyright owner. For the purposes of this definition, "submitted"
459
+ means any form of electronic, verbal, or written communication sent
460
+ to the Licensor or its representatives, including but not limited to
461
+ communication on electronic mailing lists, source code control systems,
462
+ and issue tracking systems that are managed by, or on behalf of, the
463
+ Licensor for the purpose of discussing and improving the Work, but
464
+ excluding communication that is conspicuously marked or otherwise
465
+ designated in writing by the copyright owner as "Not a Contribution."
466
+
467
+ "Contributor" shall mean Licensor and any individual or Legal Entity
468
+ on behalf of whom a Contribution has been received by Licensor and
469
+ subsequently incorporated within the Work.
470
+
471
+ 2. Grant of Copyright License. Subject to the terms and conditions of
472
+ this License, each Contributor hereby grants to You a perpetual,
473
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
474
+ copyright license to reproduce, prepare Derivative Works of,
475
+ publicly display, publicly perform, sublicense, and distribute the
476
+ Work and such Derivative Works in Source or Object form.
477
+
478
+ 3. Grant of Patent License. Subject to the terms and conditions of
479
+ this License, each Contributor hereby grants to You a perpetual,
480
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
481
+ (except as stated in this section) patent license to make, have made,
482
+ use, offer to sell, sell, import, and otherwise transfer the Work,
483
+ where such license applies only to those patent claims licensable
484
+ by such Contributor that are necessarily infringed by their
485
+ Contribution(s) alone or by combination of their Contribution(s)
486
+ with the Work to which such Contribution(s) was submitted. If You
487
+ institute patent litigation against any entity (including a
488
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
489
+ or a Contribution incorporated within the Work constitutes direct
490
+ or contributory patent infringement, then any patent licenses
491
+ granted to You under this License for that Work shall terminate
492
+ as of the date such litigation is filed.
493
+
494
+ 4. Redistribution. You may reproduce and distribute copies of the
495
+ Work or Derivative Works thereof in any medium, with or without
496
+ modifications, and in Source or Object form, provided that You
497
+ meet the following conditions:
498
+
499
+ (a) You must give any other recipients of the Work or
500
+ Derivative Works a copy of this License; and
501
+
502
+ (b) You must cause any modified files to carry prominent notices
503
+ stating that You changed the files; and
504
+
505
+ (c) You must retain, in the Source form of any Derivative Works
506
+ that You distribute, all copyright, patent, trademark, and
507
+ attribution notices from the Source form of the Work,
508
+ excluding those notices that do not pertain to any part of
509
+ the Derivative Works; and
510
+
511
+ (d) If the Work includes a "NOTICE" text file as part of its
512
+ distribution, then any Derivative Works that You distribute must
513
+ include a readable copy of the attribution notices contained
514
+ within such NOTICE file, excluding those notices that do not
515
+ pertain to any part of the Derivative Works, in at least one
516
+ of the following places: within a NOTICE text file distributed
517
+ as part of the Derivative Works; within the Source form or
518
+ documentation, if provided along with the Derivative Works; or,
519
+ within a display generated by the Derivative Works, if and
520
+ wherever such third-party notices normally appear. The contents
521
+ of the NOTICE file are for informational purposes only and
522
+ do not modify the License. You may add Your own attribution
523
+ notices within Derivative Works that You distribute, alongside
524
+ or as an addendum to the NOTICE text from the Work, provided
525
+ that such additional attribution notices cannot be construed
526
+ as modifying the License.
527
+
528
+ You may add Your own copyright statement to Your modifications and
529
+ may provide additional or different license terms and conditions
530
+ for use, reproduction, or distribution of Your modifications, or
531
+ for any such Derivative Works as a whole, provided Your use,
532
+ reproduction, and distribution of the Work otherwise complies with
533
+ the conditions stated in this License.
534
+
535
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
536
+ any Contribution intentionally submitted for inclusion in the Work
537
+ by You to the Licensor shall be under the terms and conditions of
538
+ this License, without any additional terms or conditions.
539
+ Notwithstanding the above, nothing herein shall supersede or modify
540
+ the terms of any separate license agreement you may have executed
541
+ with Licensor regarding such Contributions.
542
+
543
+ 6. Trademarks. This License does not grant permission to use the trade
544
+ names, trademarks, service marks, or product names of the Licensor,
545
+ except as required for reasonable and customary use in describing the
546
+ origin of the Work and reproducing the content of the NOTICE file.
547
+
548
+ 7. Disclaimer of Warranty. Unless required by applicable law or
549
+ agreed to in writing, Licensor provides the Work (and each
550
+ Contributor provides its Contributions) on an "AS IS" BASIS,
551
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
552
+ implied, including, without limitation, any warranties or conditions
553
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
554
+ PARTICULAR PURPOSE. You are solely responsible for determining the
555
+ appropriateness of using or redistributing the Work and assume any
556
+ risks associated with Your exercise of permissions under this License.
557
+
558
+ 8. Limitation of Liability. In no event and under no legal theory,
559
+ whether in tort (including negligence), contract, or otherwise,
560
+ unless required by applicable law (such as deliberate and grossly
561
+ negligent acts) or agreed to in writing, shall any Contributor be
562
+ liable to You for damages, including any direct, indirect, special,
563
+ incidental, or consequential damages of any character arising as a
564
+ result of this License or out of the use or inability to use the
565
+ Work (including but not limited to damages for loss of goodwill,
566
+ work stoppage, computer failure or malfunction, or any and all
567
+ other commercial damages or losses), even if such Contributor
568
+ has been advised of the possibility of such damages.
569
+
570
+ 9. Accepting Warranty or Additional Liability. While redistributing
571
+ the Work or Derivative Works thereof, You may choose to offer,
572
+ and charge a fee for, acceptance of support, warranty, indemnity,
573
+ or other liability obligations and/or rights consistent with this
574
+ License. However, in accepting such obligations, You may act only
575
+ on Your own behalf and on Your sole responsibility, not on behalf
576
+ of any other Contributor, and only if You agree to indemnify,
577
+ defend, and hold each Contributor harmless for any liability
578
+ incurred by, or claims asserted against, such Contributor by reason
579
+ of your accepting any such warranty or additional liability.
580
+
581
+ END OF TERMS AND CONDITIONS
582
+
583
+
584
+ Copyright (c) Donald Stufft and individual contributors.
585
+ All rights reserved.
586
+
587
+ Redistribution and use in source and binary forms, with or without
588
+ modification, are permitted provided that the following conditions are met:
589
+
590
+ 1. Redistributions of source code must retain the above copyright notice,
591
+ this list of conditions and the following disclaimer.
592
+
593
+ 2. Redistributions in binary form must reproduce the above copyright
594
+ notice, this list of conditions and the following disclaimer in the
595
+ documentation and/or other materials provided with the distribution.
596
+
597
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
598
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
599
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
600
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
601
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
602
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
603
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
604
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
605
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
606
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.A. HISTORY OF THE SOFTWARE
607
+ ==========================
608
+
609
+ Python was created in the early 1990s by Guido van Rossum at Stichting
610
+ Mathematisch Centrum (CWI, see https://www.cwi.nl) in the Netherlands
611
+ as a successor of a language called ABC. Guido remains Python's
612
+ principal author, although it includes many contributions from others.
613
+
614
+ In 1995, Guido continued his work on Python at the Corporation for
615
+ National Research Initiatives (CNRI, see https://www.cnri.reston.va.us)
616
+ in Reston, Virginia where he released several versions of the
617
+ software.
618
+
619
+ In May 2000, Guido and the Python core development team moved to
620
+ BeOpen.com to form the BeOpen PythonLabs team. In October of the same
621
+ year, the PythonLabs team moved to Digital Creations, which became
622
+ Zope Corporation. In 2001, the Python Software Foundation (PSF, see
623
+ https://www.python.org/psf/) was formed, a non-profit organization
624
+ created specifically to own Python-related Intellectual Property.
625
+ Zope Corporation was a sponsoring member of the PSF.
626
+
627
+ All Python releases are Open Source (see https://opensource.org for
628
+ the Open Source Definition). Historically, most, but not all, Python
629
+ releases have also been GPL-compatible; the table below summarizes
630
+ the various releases.
631
+
632
+ Release Derived Year Owner GPL-
633
+ from compatible? (1)
634
+
635
+ 0.9.0 thru 1.2 1991-1995 CWI yes
636
+ 1.3 thru 1.5.2 1.2 1995-1999 CNRI yes
637
+ 1.6 1.5.2 2000 CNRI no
638
+ 2.0 1.6 2000 BeOpen.com no
639
+ 1.6.1 1.6 2001 CNRI yes (2)
640
+ 2.1 2.0+1.6.1 2001 PSF no
641
+ 2.0.1 2.0+1.6.1 2001 PSF yes
642
+ 2.1.1 2.1+2.0.1 2001 PSF yes
643
+ 2.1.2 2.1.1 2002 PSF yes
644
+ 2.1.3 2.1.2 2002 PSF yes
645
+ 2.2 and above 2.1.1 2001-now PSF yes
646
+
647
+ Footnotes:
648
+
649
+ (1) GPL-compatible doesn't mean that we're distributing Python under
650
+ the GPL. All Python licenses, unlike the GPL, let you distribute
651
+ a modified version without making your changes open source. The
652
+ GPL-compatible licenses make it possible to combine Python with
653
+ other software that is released under the GPL; the others don't.
654
+
655
+ (2) According to Richard Stallman, 1.6.1 is not GPL-compatible,
656
+ because its license has a choice of law clause. According to
657
+ CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1
658
+ is "not incompatible" with the GPL.
659
+
660
+ Thanks to the many outside volunteers who have worked under Guido's
661
+ direction to make these releases possible.
662
+
663
+
664
+ B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON
665
+ ===============================================================
666
+
667
+ Python software and documentation are licensed under the
668
+ Python Software Foundation License Version 2.
669
+
670
+ Starting with Python 3.8.6, examples, recipes, and other code in
671
+ the documentation are dual licensed under the PSF License Version 2
672
+ and the Zero-Clause BSD license.
673
+
674
+ Some software incorporated into Python is under different licenses.
675
+ The licenses are listed with code falling under that license.
676
+
677
+
678
+ PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
679
+ --------------------------------------------
680
+
681
+ 1. This LICENSE AGREEMENT is between the Python Software Foundation
682
+ ("PSF"), and the Individual or Organization ("Licensee") accessing and
683
+ otherwise using this software ("Python") in source or binary form and
684
+ its associated documentation.
685
+
686
+ 2. Subject to the terms and conditions of this License Agreement, PSF hereby
687
+ grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
688
+ analyze, test, perform and/or display publicly, prepare derivative works,
689
+ distribute, and otherwise use Python alone or in any derivative version,
690
+ provided, however, that PSF's License Agreement and PSF's notice of copyright,
691
+ i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
692
+ 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Python Software Foundation;
693
+ All Rights Reserved" are retained in Python alone or in any derivative version
694
+ prepared by Licensee.
695
+
696
+ 3. In the event Licensee prepares a derivative work that is based on
697
+ or incorporates Python or any part thereof, and wants to make
698
+ the derivative work available to others as provided herein, then
699
+ Licensee hereby agrees to include in any such work a brief summary of
700
+ the changes made to Python.
701
+
702
+ 4. PSF is making Python available to Licensee on an "AS IS"
703
+ basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
704
+ IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
705
+ DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
706
+ FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
707
+ INFRINGE ANY THIRD PARTY RIGHTS.
708
+
709
+ 5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
710
+ FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
711
+ A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
712
+ OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
713
+
714
+ 6. This License Agreement will automatically terminate upon a material
715
+ breach of its terms and conditions.
716
+
717
+ 7. Nothing in this License Agreement shall be deemed to create any
718
+ relationship of agency, partnership, or joint venture between PSF and
719
+ Licensee. This License Agreement does not grant permission to use PSF
720
+ trademarks or trade name in a trademark sense to endorse or promote
721
+ products or services of Licensee, or any third party.
722
+
723
+ 8. By copying, installing or otherwise using Python, Licensee
724
+ agrees to be bound by the terms and conditions of this License
725
+ Agreement.
726
+
727
+
728
+ BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0
729
+ -------------------------------------------
730
+
731
+ BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1
732
+
733
+ 1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an
734
+ office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the
735
+ Individual or Organization ("Licensee") accessing and otherwise using
736
+ this software in source or binary form and its associated
737
+ documentation ("the Software").
738
+
739
+ 2. Subject to the terms and conditions of this BeOpen Python License
740
+ Agreement, BeOpen hereby grants Licensee a non-exclusive,
741
+ royalty-free, world-wide license to reproduce, analyze, test, perform
742
+ and/or display publicly, prepare derivative works, distribute, and
743
+ otherwise use the Software alone or in any derivative version,
744
+ provided, however, that the BeOpen Python License is retained in the
745
+ Software, alone or in any derivative version prepared by Licensee.
746
+
747
+ 3. BeOpen is making the Software available to Licensee on an "AS IS"
748
+ basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
749
+ IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND
750
+ DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
751
+ FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT
752
+ INFRINGE ANY THIRD PARTY RIGHTS.
753
+
754
+ 4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE
755
+ SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS
756
+ AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY
757
+ DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
758
+
759
+ 5. This License Agreement will automatically terminate upon a material
760
+ breach of its terms and conditions.
761
+
762
+ 6. This License Agreement shall be governed by and interpreted in all
763
+ respects by the law of the State of California, excluding conflict of
764
+ law provisions. Nothing in this License Agreement shall be deemed to
765
+ create any relationship of agency, partnership, or joint venture
766
+ between BeOpen and Licensee. This License Agreement does not grant
767
+ permission to use BeOpen trademarks or trade names in a trademark
768
+ sense to endorse or promote products or services of Licensee, or any
769
+ third party. As an exception, the "BeOpen Python" logos available at
770
+ http://www.pythonlabs.com/logos.html may be used according to the
771
+ permissions granted on that web page.
772
+
773
+ 7. By copying, installing or otherwise using the software, Licensee
774
+ agrees to be bound by the terms and conditions of this License
775
+ Agreement.
776
+
777
+
778
+ CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1
779
+ ---------------------------------------
780
+
781
+ 1. This LICENSE AGREEMENT is between the Corporation for National
782
+ Research Initiatives, having an office at 1895 Preston White Drive,
783
+ Reston, VA 20191 ("CNRI"), and the Individual or Organization
784
+ ("Licensee") accessing and otherwise using Python 1.6.1 software in
785
+ source or binary form and its associated documentation.
786
+
787
+ 2. Subject to the terms and conditions of this License Agreement, CNRI
788
+ hereby grants Licensee a nonexclusive, royalty-free, world-wide
789
+ license to reproduce, analyze, test, perform and/or display publicly,
790
+ prepare derivative works, distribute, and otherwise use Python 1.6.1
791
+ alone or in any derivative version, provided, however, that CNRI's
792
+ License Agreement and CNRI's notice of copyright, i.e., "Copyright (c)
793
+ 1995-2001 Corporation for National Research Initiatives; All Rights
794
+ Reserved" are retained in Python 1.6.1 alone or in any derivative
795
+ version prepared by Licensee. Alternately, in lieu of CNRI's License
796
+ Agreement, Licensee may substitute the following text (omitting the
797
+ quotes): "Python 1.6.1 is made available subject to the terms and
798
+ conditions in CNRI's License Agreement. This Agreement together with
799
+ Python 1.6.1 may be located on the internet using the following
800
+ unique, persistent identifier (known as a handle): 1895.22/1013. This
801
+ Agreement may also be obtained from a proxy server on the internet
802
+ using the following URL: http://hdl.handle.net/1895.22/1013".
803
+
804
+ 3. In the event Licensee prepares a derivative work that is based on
805
+ or incorporates Python 1.6.1 or any part thereof, and wants to make
806
+ the derivative work available to others as provided herein, then
807
+ Licensee hereby agrees to include in any such work a brief summary of
808
+ the changes made to Python 1.6.1.
809
+
810
+ 4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS"
811
+ basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
812
+ IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND
813
+ DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
814
+ FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT
815
+ INFRINGE ANY THIRD PARTY RIGHTS.
816
+
817
+ 5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
818
+ 1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
819
+ A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1,
820
+ OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
821
+
822
+ 6. This License Agreement will automatically terminate upon a material
823
+ breach of its terms and conditions.
824
+
825
+ 7. This License Agreement shall be governed by the federal
826
+ intellectual property law of the United States, including without
827
+ limitation the federal copyright law, and, to the extent such
828
+ U.S. federal law does not apply, by the law of the Commonwealth of
829
+ Virginia, excluding Virginia's conflict of law provisions.
830
+ Notwithstanding the foregoing, with regard to derivative works based
831
+ on Python 1.6.1 that incorporate non-separable material that was
832
+ previously distributed under the GNU General Public License (GPL), the
833
+ law of the Commonwealth of Virginia shall govern this License
834
+ Agreement only as to issues arising under or with respect to
835
+ Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this
836
+ License Agreement shall be deemed to create any relationship of
837
+ agency, partnership, or joint venture between CNRI and Licensee. This
838
+ License Agreement does not grant permission to use CNRI trademarks or
839
+ trade name in a trademark sense to endorse or promote products or
840
+ services of Licensee, or any third party.
841
+
842
+ 8. By clicking on the "ACCEPT" button where indicated, or by copying,
843
+ installing or otherwise using Python 1.6.1, Licensee agrees to be
844
+ bound by the terms and conditions of this License Agreement.
845
+
846
+ ACCEPT
847
+
848
+
849
+ CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2
850
+ --------------------------------------------------
851
+
852
+ Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam,
853
+ The Netherlands. All rights reserved.
854
+
855
+ Permission to use, copy, modify, and distribute this software and its
856
+ documentation for any purpose and without fee is hereby granted,
857
+ provided that the above copyright notice appear in all copies and that
858
+ both that copyright notice and this permission notice appear in
859
+ supporting documentation, and that the name of Stichting Mathematisch
860
+ Centrum or CWI not be used in advertising or publicity pertaining to
861
+ distribution of the software without specific, written prior
862
+ permission.
863
+
864
+ STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
865
+ THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
866
+ FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
867
+ FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
868
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
869
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
870
+ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
871
+
872
+ ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION
873
+ ----------------------------------------------------------------------
874
+
875
+ Permission to use, copy, modify, and/or distribute this software for any
876
+ purpose with or without fee is hereby granted.
877
+
878
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
879
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
880
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
881
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
882
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
883
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
884
+ PERFORMANCE OF THIS SOFTWARE.
885
+ Copyright (c) 2014, Al Sweigart
886
+ All rights reserved.
887
+
888
+ Redistribution and use in source and binary forms, with or without
889
+ modification, are permitted provided that the following conditions are met:
890
+
891
+ * Redistributions of source code must retain the above copyright notice, this
892
+ list of conditions and the following disclaimer.
893
+
894
+ * Redistributions in binary form must reproduce the above copyright notice,
895
+ this list of conditions and the following disclaimer in the documentation
896
+ and/or other materials provided with the distribution.
897
+
898
+ * Neither the name of the {organization} nor the names of its
899
+ contributors may be used to endorse or promote products derived from
900
+ this software without specific prior written permission.
901
+
902
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
903
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
904
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
905
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
906
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
907
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
908
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
909
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
910
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
911
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.Copyright (c) 2017 Anthony Sottile
912
+
913
+ Permission is hereby granted, free of charge, to any person obtaining a copy
914
+ of this software and associated documentation files (the "Software"), to deal
915
+ in the Software without restriction, including without limitation the rights
916
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
917
+ copies of the Software, and to permit persons to whom the Software is
918
+ furnished to do so, subject to the following conditions:
919
+
920
+ The above copyright notice and this permission notice shall be included in
921
+ all copies or substantial portions of the Software.
922
+
923
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
924
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
925
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
926
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
927
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
928
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
929
+ THE SOFTWARE.Copyright (c) 2015-2019 Jared Hobbs
930
+
931
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
932
+ this software and associated documentation files (the "Software"), to deal in
933
+ the Software without restriction, including without limitation the rights to
934
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
935
+ of the Software, and to permit persons to whom the Software is furnished to do
936
+ so, subject to the following conditions:
937
+
938
+ The above copyright notice and this permission notice shall be included in all
939
+ copies or substantial portions of the Software.
940
+
941
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
942
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
943
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
944
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
945
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
946
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
947
+ SOFTWARE.Developed by ESN, an Electronic Arts Inc. studio.
948
+ Copyright (c) 2014, Electronic Arts Inc.
949
+ All rights reserved.
950
+
951
+ Redistribution and use in source and binary forms, with or without
952
+ modification, are permitted provided that the following conditions are met:
953
+ * Redistributions of source code must retain the above copyright
954
+ notice, this list of conditions and the following disclaimer.
955
+ * Redistributions in binary form must reproduce the above copyright
956
+ notice, this list of conditions and the following disclaimer in the
957
+ documentation and/or other materials provided with the distribution.
958
+ * Neither the name of ESN, Electronic Arts Inc. nor the
959
+ names of its contributors may be used to endorse or promote products
960
+ derived from this software without specific prior written permission.
961
+
962
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
963
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
964
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
965
+ DISCLAIMED. IN NO EVENT SHALL ELECTRONIC ARTS INC. BE LIABLE
966
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
967
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
968
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
969
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
970
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
971
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
972
+
973
+ ----
974
+
975
+ Portions of code from MODP_ASCII - Ascii transformations (upper/lower, etc)
976
+ https://github.com/client9/stringencoders
977
+
978
+ Copyright 2005, 2006, 2007
979
+ Nick Galbreath -- nickg [at] modp [dot] com
980
+ All rights reserved.
981
+
982
+ Redistribution and use in source and binary forms, with or without
983
+ modification, are permitted provided that the following conditions are
984
+ met:
985
+
986
+ Redistributions of source code must retain the above copyright
987
+ notice, this list of conditions and the following disclaimer.
988
+
989
+ Redistributions in binary form must reproduce the above copyright
990
+ notice, this list of conditions and the following disclaimer in the
991
+ documentation and/or other materials provided with the distribution.
992
+
993
+ Neither the name of the modp.com nor the names of its
994
+ contributors may be used to endorse or promote products derived from
995
+ this software without specific prior written permission.
996
+
997
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
998
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
999
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1000
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1001
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1002
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1003
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1004
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1005
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1006
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1007
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1008
+
1009
+ This is the standard "new" BSD license:
1010
+ http://www.opensource.org/licenses/bsd-license.php
1011
+
1012
+ https://github.com/client9/stringencoders/blob/cfd5c1507325ae497ea9bacdacba12c0ffd79d30/COPYING
1013
+
1014
+ ----
1015
+
1016
+ Numeric decoder derived from from TCL library
1017
+ https://opensource.apple.com/source/tcl/tcl-14/tcl/license.terms
1018
+ * Copyright (c) 1988-1993 The Regents of the University of California.
1019
+ * Copyright (c) 1994 Sun Microsystems, Inc.
1020
+
1021
+ This software is copyrighted by the Regents of the University of
1022
+ California, Sun Microsystems, Inc., Scriptics Corporation, ActiveState
1023
+ Corporation and other parties. The following terms apply to all files
1024
+ associated with the software unless explicitly disclaimed in
1025
+ individual files.
1026
+
1027
+ The authors hereby grant permission to use, copy, modify, distribute,
1028
+ and license this software and its documentation for any purpose, provided
1029
+ that existing copyright notices are retained in all copies and that this
1030
+ notice is included verbatim in any distributions. No written agreement,
1031
+ license, or royalty fee is required for any of the authorized uses.
1032
+ Modifications to this software may be copyrighted by their authors
1033
+ and need not follow the licensing terms described here, provided that
1034
+ the new terms are clearly indicated on the first page of each file where
1035
+ they apply.
1036
+
1037
+ IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
1038
+ FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
1039
+ ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
1040
+ DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
1041
+ POSSIBILITY OF SUCH DAMAGE.
1042
+
1043
+ THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
1044
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
1045
+ FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
1046
+ IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
1047
+ NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
1048
+ MODIFICATIONS.
1049
+
1050
+ GOVERNMENT USE: If you are acquiring this software on behalf of the
1051
+ U.S. government, the Government shall have only "Restricted Rights"
1052
+ in the software and related documentation as defined in the Federal
1053
+ Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
1054
+ are acquiring the software on behalf of the Department of Defense, the
1055
+ software shall be classified as "Commercial Computer Software" and the
1056
+ Government shall have only "Restricted Rights" as defined in Clause
1057
+ 252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the
1058
+ authors grant the U.S. Government and others acting in its behalf
1059
+ permission to use and distribute the software in accordance with the
1060
+ terms specified in this license.Apache License
1061
+ Version 2.0, January 2004
1062
+ http://www.apache.org/licenses/
1063
+
1064
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1065
+
1066
+ 1. Definitions.
1067
+
1068
+ "License" shall mean the terms and conditions for use, reproduction, and
1069
+ distribution as defined by Sections 1 through 9 of this document.
1070
+
1071
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright
1072
+ owner that is granting the License.
1073
+
1074
+ "Legal Entity" shall mean the union of the acting entity and all other entities
1075
+ that control, are controlled by, or are under common control with that entity.
1076
+ For the purposes of this definition, "control" means (i) the power, direct or
1077
+ indirect, to cause the direction or management of such entity, whether by
1078
+ contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
1079
+ outstanding shares, or (iii) beneficial ownership of such entity.
1080
+
1081
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
1082
+ permissions granted by this License.
1083
+
1084
+ "Source" form shall mean the preferred form for making modifications, including
1085
+ but not limited to software source code, documentation source, and configuration
1086
+ files.
1087
+
1088
+ "Object" form shall mean any form resulting from mechanical transformation or
1089
+ translation of a Source form, including but not limited to compiled object code,
1090
+ generated documentation, and conversions to other media types.
1091
+
1092
+ "Work" shall mean the work of authorship, whether in Source or Object form, made
1093
+ available under the License, as indicated by a copyright notice that is included
1094
+ in or attached to the work (an example is provided in the Appendix below).
1095
+
1096
+ "Derivative Works" shall mean any work, whether in Source or Object form, that
1097
+ is based on (or derived from) the Work and for which the editorial revisions,
1098
+ annotations, elaborations, or other modifications represent, as a whole, an
1099
+ original work of authorship. For the purposes of this License, Derivative Works
1100
+ shall not include works that remain separable from, or merely link (or bind by
1101
+ name) to the interfaces of, the Work and Derivative Works thereof.
1102
+
1103
+ "Contribution" shall mean any work of authorship, including the original version
1104
+ of the Work and any modifications or additions to that Work or Derivative Works
1105
+ thereof, that is intentionally submitted to Licensor for inclusion in the Work
1106
+ by the copyright owner or by an individual or Legal Entity authorized to submit
1107
+ on behalf of the copyright owner. For the purposes of this definition,
1108
+ "submitted" means any form of electronic, verbal, or written communication sent
1109
+ to the Licensor or its representatives, including but not limited to
1110
+ communication on electronic mailing lists, source code control systems, and
1111
+ issue tracking systems that are managed by, or on behalf of, the Licensor for
1112
+ the purpose of discussing and improving the Work, but excluding communication
1113
+ that is conspicuously marked or otherwise designated in writing by the copyright
1114
+ owner as "Not a Contribution."
1115
+
1116
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf
1117
+ of whom a Contribution has been received by Licensor and subsequently
1118
+ incorporated within the Work.
1119
+
1120
+ 2. Grant of Copyright License.
1121
+
1122
+ Subject to the terms and conditions of this License, each Contributor hereby
1123
+ grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
1124
+ irrevocable copyright license to reproduce, prepare Derivative Works of,
1125
+ publicly display, publicly perform, sublicense, and distribute the Work and such
1126
+ Derivative Works in Source or Object form.
1127
+
1128
+ 3. Grant of Patent License.
1129
+
1130
+ Subject to the terms and conditions of this License, each Contributor hereby
1131
+ grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
1132
+ irrevocable (except as stated in this section) patent license to make, have
1133
+ made, use, offer to sell, sell, import, and otherwise transfer the Work, where
1134
+ such license applies only to those patent claims licensable by such Contributor
1135
+ that are necessarily infringed by their Contribution(s) alone or by combination
1136
+ of their Contribution(s) with the Work to which such Contribution(s) was
1137
+ submitted. If You institute patent litigation against any entity (including a
1138
+ cross-claim or counterclaim in a lawsuit) alleging that the Work or a
1139
+ Contribution incorporated within the Work constitutes direct or contributory
1140
+ patent infringement, then any patent licenses granted to You under this License
1141
+ for that Work shall terminate as of the date such litigation is filed.
1142
+
1143
+ 4. Redistribution.
1144
+
1145
+ You may reproduce and distribute copies of the Work or Derivative Works thereof
1146
+ in any medium, with or without modifications, and in Source or Object form,
1147
+ provided that You meet the following conditions:
1148
+
1149
+ You must give any other recipients of the Work or Derivative Works a copy of
1150
+ this License; and
1151
+ You must cause any modified files to carry prominent notices stating that You
1152
+ changed the files; and
1153
+ You must retain, in the Source form of any Derivative Works that You distribute,
1154
+ all copyright, patent, trademark, and attribution notices from the Source form
1155
+ of the Work, excluding those notices that do not pertain to any part of the
1156
+ Derivative Works; and
1157
+ If the Work includes a "NOTICE" text file as part of its distribution, then any
1158
+ Derivative Works that You distribute must include a readable copy of the
1159
+ attribution notices contained within such NOTICE file, excluding those notices
1160
+ that do not pertain to any part of the Derivative Works, in at least one of the
1161
+ following places: within a NOTICE text file distributed as part of the
1162
+ Derivative Works; within the Source form or documentation, if provided along
1163
+ with the Derivative Works; or, within a display generated by the Derivative
1164
+ Works, if and wherever such third-party notices normally appear. The contents of
1165
+ the NOTICE file are for informational purposes only and do not modify the
1166
+ License. You may add Your own attribution notices within Derivative Works that
1167
+ You distribute, alongside or as an addendum to the NOTICE text from the Work,
1168
+ provided that such additional attribution notices cannot be construed as
1169
+ modifying the License.
1170
+ You may add Your own copyright statement to Your modifications and may provide
1171
+ additional or different license terms and conditions for use, reproduction, or
1172
+ distribution of Your modifications, or for any such Derivative Works as a whole,
1173
+ provided Your use, reproduction, and distribution of the Work otherwise complies
1174
+ with the conditions stated in this License.
1175
+
1176
+ 5. Submission of Contributions.
1177
+
1178
+ Unless You explicitly state otherwise, any Contribution intentionally submitted
1179
+ for inclusion in the Work by You to the Licensor shall be under the terms and
1180
+ conditions of this License, without any additional terms or conditions.
1181
+ Notwithstanding the above, nothing herein shall supersede or modify the terms of
1182
+ any separate license agreement you may have executed with Licensor regarding
1183
+ such Contributions.
1184
+
1185
+ 6. Trademarks.
1186
+
1187
+ This License does not grant permission to use the trade names, trademarks,
1188
+ service marks, or product names of the Licensor, except as required for
1189
+ reasonable and customary use in describing the origin of the Work and
1190
+ reproducing the content of the NOTICE file.
1191
+
1192
+ 7. Disclaimer of Warranty.
1193
+
1194
+ Unless required by applicable law or agreed to in writing, Licensor provides the
1195
+ Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
1196
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
1197
+ including, without limitation, any warranties or conditions of TITLE,
1198
+ NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
1199
+ solely responsible for determining the appropriateness of using or
1200
+ redistributing the Work and assume any risks associated with Your exercise of
1201
+ permissions under this License.
1202
+
1203
+ 8. Limitation of Liability.
1204
+
1205
+ In no event and under no legal theory, whether in tort (including negligence),
1206
+ contract, or otherwise, unless required by applicable law (such as deliberate
1207
+ and grossly negligent acts) or agreed to in writing, shall any Contributor be
1208
+ liable to You for damages, including any direct, indirect, special, incidental,
1209
+ or consequential damages of any character arising as a result of this License or
1210
+ out of the use or inability to use the Work (including but not limited to
1211
+ damages for loss of goodwill, work stoppage, computer failure or malfunction, or
1212
+ any and all other commercial damages or losses), even if such Contributor has
1213
+ been advised of the possibility of such damages.
1214
+
1215
+ 9. Accepting Warranty or Additional Liability.
1216
+
1217
+ While redistributing the Work or Derivative Works thereof, You may choose to
1218
+ offer, and charge a fee for, acceptance of support, warranty, indemnity, or
1219
+ other liability obligations and/or rights consistent with this License. However,
1220
+ in accepting such obligations, You may act only on Your own behalf and on Your
1221
+ sole responsibility, not on behalf of any other Contributor, and only if You
1222
+ agree to indemnify, defend, and hold each Contributor harmless for any liability
1223
+ incurred by, or claims asserted against, such Contributor by reason of your
1224
+ accepting any such warranty or additional liability.
1225
+
1226
+ END OF TERMS AND CONDITIONS
1227
+
1228
+ APPENDIX: How to apply the Apache License to your work
1229
+
1230
+ To apply the Apache License to your work, attach the following boilerplate
1231
+ notice, with the fields enclosed by brackets "[]" replaced with your own
1232
+ identifying information. (Don't include the brackets!) The text should be
1233
+ enclosed in the appropriate comment syntax for the file format. We also
1234
+ recommend that a file or class name and description of purpose be included on
1235
+ the same "printed page" as the copyright notice for easier identification within
1236
+ third-party archives.
1237
+
1238
+ Copyright [yyyy] [name of copyright owner]
1239
+
1240
+ Licensed under the Apache License, Version 2.0 (the "License");
1241
+ you may not use this file except in compliance with the License.
1242
+ You may obtain a copy of the License at
1243
+
1244
+ http://www.apache.org/licenses/LICENSE-2.0
1245
+
1246
+ Unless required by applicable law or agreed to in writing, software
1247
+ distributed under the License is distributed on an "AS IS" BASIS,
1248
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1249
+ See the License for the specific language governing permissions and
1250
+ limitations under the License.
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas-2.3.3.dist-info/METADATA ADDED
@@ -0,0 +1,1574 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.1
2
+ Name: pandas
3
+ Version: 2.3.3
4
+ Summary: Powerful data structures for data analysis, time series, and statistics
5
+ Author-Email: The Pandas Development Team <pandas-dev@python.org>
6
+ License: BSD 3-Clause License
7
+
8
+ Copyright (c) 2008-2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
9
+ All rights reserved.
10
+
11
+ Copyright (c) 2011-2023, Open source contributors.
12
+
13
+ Redistribution and use in source and binary forms, with or without
14
+ modification, are permitted provided that the following conditions are met:
15
+
16
+ * Redistributions of source code must retain the above copyright notice, this
17
+ list of conditions and the following disclaimer.
18
+
19
+ * Redistributions in binary form must reproduce the above copyright notice,
20
+ this list of conditions and the following disclaimer in the documentation
21
+ and/or other materials provided with the distribution.
22
+
23
+ * Neither the name of the copyright holder nor the names of its
24
+ contributors may be used to endorse or promote products derived from
25
+ this software without specific prior written permission.
26
+
27
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
28
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
30
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
31
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
33
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
34
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
35
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37
+ Copyright (c) 2010-2019 Keith Goodman
38
+ Copyright (c) 2019 Bottleneck Developers
39
+ All rights reserved.
40
+
41
+ Redistribution and use in source and binary forms, with or without
42
+ modification, are permitted provided that the following conditions are met:
43
+
44
+ * Redistributions of source code must retain the above copyright notice,
45
+ this list of conditions and the following disclaimer.
46
+
47
+ * Redistributions in binary form must reproduce the above copyright
48
+ notice, this list of conditions and the following disclaimer in the
49
+ documentation and/or other materials provided with the distribution.
50
+
51
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
52
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
53
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
54
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
55
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
56
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
57
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
58
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
59
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
60
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
61
+ POSSIBILITY OF SUCH DAMAGE.Copyright 2017- Paul Ganssle <paul@ganssle.io>
62
+ Copyright 2017- dateutil contributors (see AUTHORS file)
63
+
64
+ Licensed under the Apache License, Version 2.0 (the "License");
65
+ you may not use this file except in compliance with the License.
66
+ You may obtain a copy of the License at
67
+
68
+ http://www.apache.org/licenses/LICENSE-2.0
69
+
70
+ Unless required by applicable law or agreed to in writing, software
71
+ distributed under the License is distributed on an "AS IS" BASIS,
72
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
73
+ See the License for the specific language governing permissions and
74
+ limitations under the License.
75
+
76
+ The above license applies to all contributions after 2017-12-01, as well as
77
+ all contributions that have been re-licensed (see AUTHORS file for the list of
78
+ contributors who have re-licensed their code).
79
+ --------------------------------------------------------------------------------
80
+ dateutil - Extensions to the standard Python datetime module.
81
+
82
+ Copyright (c) 2003-2011 - Gustavo Niemeyer <gustavo@niemeyer.net>
83
+ Copyright (c) 2012-2014 - Tomi Pieviläinen <tomi.pievilainen@iki.fi>
84
+ Copyright (c) 2014-2016 - Yaron de Leeuw <me@jarondl.net>
85
+ Copyright (c) 2015- - Paul Ganssle <paul@ganssle.io>
86
+ Copyright (c) 2015- - dateutil contributors (see AUTHORS file)
87
+
88
+ All rights reserved.
89
+
90
+ Redistribution and use in source and binary forms, with or without
91
+ modification, are permitted provided that the following conditions are met:
92
+
93
+ * Redistributions of source code must retain the above copyright notice,
94
+ this list of conditions and the following disclaimer.
95
+ * Redistributions in binary form must reproduce the above copyright notice,
96
+ this list of conditions and the following disclaimer in the documentation
97
+ and/or other materials provided with the distribution.
98
+ * Neither the name of the copyright holder nor the names of its
99
+ contributors may be used to endorse or promote products derived from
100
+ this software without specific prior written permission.
101
+
102
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
103
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
104
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
105
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
106
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
107
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
108
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
109
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
110
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
111
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
112
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
113
+
114
+ The above BSD License Applies to all code, even that also covered by Apache 2.0.# MIT License
115
+
116
+ Copyright (c) 2019 Hadley Wickham; RStudio; and Evan Miller
117
+
118
+ Permission is hereby granted, free of charge, to any person obtaining a copy
119
+ of this software and associated documentation files (the "Software"), to deal
120
+ in the Software without restriction, including without limitation the rights
121
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
122
+ copies of the Software, and to permit persons to whom the Software is
123
+ furnished to do so, subject to the following conditions:
124
+
125
+ The above copyright notice and this permission notice shall be included in all
126
+ copies or substantial portions of the Software.
127
+
128
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
129
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
130
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
131
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
132
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
133
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
134
+ SOFTWARE.
135
+ Based on http://opensource.org/licenses/MIT
136
+
137
+ This is a template. Complete and ship as file LICENSE the following 2
138
+ lines (only)
139
+
140
+ YEAR:
141
+ COPYRIGHT HOLDER:
142
+
143
+ and specify as
144
+
145
+ License: MIT + file LICENSE
146
+
147
+ Copyright (c) <YEAR>, <COPYRIGHT HOLDER>
148
+
149
+ Permission is hereby granted, free of charge, to any person obtaining
150
+ a copy of this software and associated documentation files (the
151
+ "Software"), to deal in the Software without restriction, including
152
+ without limitation the rights to use, copy, modify, merge, publish,
153
+ distribute, sublicense, and/or sell copies of the Software, and to
154
+ permit persons to whom the Software is furnished to do so, subject to
155
+ the following conditions:
156
+
157
+ The above copyright notice and this permission notice shall be
158
+ included in all copies or substantial portions of the Software.
159
+
160
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
161
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
162
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
163
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
164
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
165
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
166
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
167
+ The MIT License
168
+
169
+ Copyright (c) 2008- Attractive Chaos <attractor@live.co.uk>
170
+
171
+ Permission is hereby granted, free of charge, to any person obtaining
172
+ a copy of this software and associated documentation files (the
173
+ "Software"), to deal in the Software without restriction, including
174
+ without limitation the rights to use, copy, modify, merge, publish,
175
+ distribute, sublicense, and/or sell copies of the Software, and to
176
+ permit persons to whom the Software is furnished to do so, subject to
177
+ the following conditions:
178
+
179
+ The above copyright notice and this permission notice shall be
180
+ included in all copies or substantial portions of the Software.
181
+
182
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
183
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
184
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
185
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
186
+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
187
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
188
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
189
+ SOFTWARE.musl as a whole is licensed under the following standard MIT license:
190
+
191
+ ----------------------------------------------------------------------
192
+ Copyright © 2005-2020 Rich Felker, et al.
193
+
194
+ Permission is hereby granted, free of charge, to any person obtaining
195
+ a copy of this software and associated documentation files (the
196
+ "Software"), to deal in the Software without restriction, including
197
+ without limitation the rights to use, copy, modify, merge, publish,
198
+ distribute, sublicense, and/or sell copies of the Software, and to
199
+ permit persons to whom the Software is furnished to do so, subject to
200
+ the following conditions:
201
+
202
+ The above copyright notice and this permission notice shall be
203
+ included in all copies or substantial portions of the Software.
204
+
205
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
206
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
207
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
208
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
209
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
210
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
211
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
212
+ ----------------------------------------------------------------------
213
+
214
+ Authors/contributors include:
215
+
216
+ A. Wilcox
217
+ Ada Worcester
218
+ Alex Dowad
219
+ Alex Suykov
220
+ Alexander Monakov
221
+ Andre McCurdy
222
+ Andrew Kelley
223
+ Anthony G. Basile
224
+ Aric Belsito
225
+ Arvid Picciani
226
+ Bartosz Brachaczek
227
+ Benjamin Peterson
228
+ Bobby Bingham
229
+ Boris Brezillon
230
+ Brent Cook
231
+ Chris Spiegel
232
+ Clément Vasseur
233
+ Daniel Micay
234
+ Daniel Sabogal
235
+ Daurnimator
236
+ David Carlier
237
+ David Edelsohn
238
+ Denys Vlasenko
239
+ Dmitry Ivanov
240
+ Dmitry V. Levin
241
+ Drew DeVault
242
+ Emil Renner Berthing
243
+ Fangrui Song
244
+ Felix Fietkau
245
+ Felix Janda
246
+ Gianluca Anzolin
247
+ Hauke Mehrtens
248
+ He X
249
+ Hiltjo Posthuma
250
+ Isaac Dunham
251
+ Jaydeep Patil
252
+ Jens Gustedt
253
+ Jeremy Huntwork
254
+ Jo-Philipp Wich
255
+ Joakim Sindholt
256
+ John Spencer
257
+ Julien Ramseier
258
+ Justin Cormack
259
+ Kaarle Ritvanen
260
+ Khem Raj
261
+ Kylie McClain
262
+ Leah Neukirchen
263
+ Luca Barbato
264
+ Luka Perkov
265
+ M Farkas-Dyck (Strake)
266
+ Mahesh Bodapati
267
+ Markus Wichmann
268
+ Masanori Ogino
269
+ Michael Clark
270
+ Michael Forney
271
+ Mikhail Kremnyov
272
+ Natanael Copa
273
+ Nicholas J. Kain
274
+ orc
275
+ Pascal Cuoq
276
+ Patrick Oppenlander
277
+ Petr Hosek
278
+ Petr Skocik
279
+ Pierre Carrier
280
+ Reini Urban
281
+ Rich Felker
282
+ Richard Pennington
283
+ Ryan Fairfax
284
+ Samuel Holland
285
+ Segev Finer
286
+ Shiz
287
+ sin
288
+ Solar Designer
289
+ Stefan Kristiansson
290
+ Stefan O'Rear
291
+ Szabolcs Nagy
292
+ Timo Teräs
293
+ Trutz Behn
294
+ Valentin Ochs
295
+ Will Dietz
296
+ William Haddon
297
+ William Pitcock
298
+
299
+ Portions of this software are derived from third-party works licensed
300
+ under terms compatible with the above MIT license:
301
+
302
+ The TRE regular expression implementation (src/regex/reg* and
303
+ src/regex/tre*) is Copyright © 2001-2008 Ville Laurikari and licensed
304
+ under a 2-clause BSD license (license text in the source files). The
305
+ included version has been heavily modified by Rich Felker in 2012, in
306
+ the interests of size, simplicity, and namespace cleanliness.
307
+
308
+ Much of the math library code (src/math/* and src/complex/*) is
309
+ Copyright © 1993,2004 Sun Microsystems or
310
+ Copyright © 2003-2011 David Schultz or
311
+ Copyright © 2003-2009 Steven G. Kargl or
312
+ Copyright © 2003-2009 Bruce D. Evans or
313
+ Copyright © 2008 Stephen L. Moshier or
314
+ Copyright © 2017-2018 Arm Limited
315
+ and labelled as such in comments in the individual source files. All
316
+ have been licensed under extremely permissive terms.
317
+
318
+ The ARM memcpy code (src/string/arm/memcpy.S) is Copyright © 2008
319
+ The Android Open Source Project and is licensed under a two-clause BSD
320
+ license. It was taken from Bionic libc, used on Android.
321
+
322
+ The AArch64 memcpy and memset code (src/string/aarch64/*) are
323
+ Copyright © 1999-2019, Arm Limited.
324
+
325
+ The implementation of DES for crypt (src/crypt/crypt_des.c) is
326
+ Copyright © 1994 David Burren. It is licensed under a BSD license.
327
+
328
+ The implementation of blowfish crypt (src/crypt/crypt_blowfish.c) was
329
+ originally written by Solar Designer and placed into the public
330
+ domain. The code also comes with a fallback permissive license for use
331
+ in jurisdictions that may not recognize the public domain.
332
+
333
+ The smoothsort implementation (src/stdlib/qsort.c) is Copyright © 2011
334
+ Valentin Ochs and is licensed under an MIT-style license.
335
+
336
+ The x86_64 port was written by Nicholas J. Kain and is licensed under
337
+ the standard MIT terms.
338
+
339
+ The mips and microblaze ports were originally written by Richard
340
+ Pennington for use in the ellcc project. The original code was adapted
341
+ by Rich Felker for build system and code conventions during upstream
342
+ integration. It is licensed under the standard MIT terms.
343
+
344
+ The mips64 port was contributed by Imagination Technologies and is
345
+ licensed under the standard MIT terms.
346
+
347
+ The powerpc port was also originally written by Richard Pennington,
348
+ and later supplemented and integrated by John Spencer. It is licensed
349
+ under the standard MIT terms.
350
+
351
+ All other files which have no copyright comments are original works
352
+ produced specifically for use as part of this library, written either
353
+ by Rich Felker, the main author of the library, or by one or more
354
+ contibutors listed above. Details on authorship of individual files
355
+ can be found in the git version control history of the project. The
356
+ omission of copyright and license comments in each file is in the
357
+ interest of source tree size.
358
+
359
+ In addition, permission is hereby granted for all public header files
360
+ (include/* and arch/*/bits/*) and crt files intended to be linked into
361
+ applications (crt/*, ldso/dlstart.c, and arch/*/crt_arch.h) to omit
362
+ the copyright notice and permission notice otherwise required by the
363
+ license, and to use these files without any requirement of
364
+ attribution. These files include substantial contributions from:
365
+
366
+ Bobby Bingham
367
+ John Spencer
368
+ Nicholas J. Kain
369
+ Rich Felker
370
+ Richard Pennington
371
+ Stefan Kristiansson
372
+ Szabolcs Nagy
373
+
374
+ all of whom have explicitly granted such permission.
375
+
376
+ This file previously contained text expressing a belief that most of
377
+ the files covered by the above exception were sufficiently trivial not
378
+ to be subject to copyright, resulting in confusion over whether it
379
+ negated the permissions granted in the license. In the spirit of
380
+ permissive licensing, and of not having licensing issues being an
381
+ obstacle to adoption, that text has been removed.Copyright (c) 2005-2023, NumPy Developers.
382
+ All rights reserved.
383
+
384
+ Redistribution and use in source and binary forms, with or without
385
+ modification, are permitted provided that the following conditions are
386
+ met:
387
+
388
+ * Redistributions of source code must retain the above copyright
389
+ notice, this list of conditions and the following disclaimer.
390
+
391
+ * Redistributions in binary form must reproduce the above
392
+ copyright notice, this list of conditions and the following
393
+ disclaimer in the documentation and/or other materials provided
394
+ with the distribution.
395
+
396
+ * Neither the name of the NumPy Developers nor the names of any
397
+ contributors may be used to endorse or promote products derived
398
+ from this software without specific prior written permission.
399
+
400
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
401
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
402
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
403
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
404
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
405
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
406
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
407
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
408
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
409
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
410
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
411
+ Apache License
412
+ Version 2.0, January 2004
413
+ http://www.apache.org/licenses/
414
+
415
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
416
+
417
+ 1. Definitions.
418
+
419
+ "License" shall mean the terms and conditions for use, reproduction,
420
+ and distribution as defined by Sections 1 through 9 of this document.
421
+
422
+ "Licensor" shall mean the copyright owner or entity authorized by
423
+ the copyright owner that is granting the License.
424
+
425
+ "Legal Entity" shall mean the union of the acting entity and all
426
+ other entities that control, are controlled by, or are under common
427
+ control with that entity. For the purposes of this definition,
428
+ "control" means (i) the power, direct or indirect, to cause the
429
+ direction or management of such entity, whether by contract or
430
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
431
+ outstanding shares, or (iii) beneficial ownership of such entity.
432
+
433
+ "You" (or "Your") shall mean an individual or Legal Entity
434
+ exercising permissions granted by this License.
435
+
436
+ "Source" form shall mean the preferred form for making modifications,
437
+ including but not limited to software source code, documentation
438
+ source, and configuration files.
439
+
440
+ "Object" form shall mean any form resulting from mechanical
441
+ transformation or translation of a Source form, including but
442
+ not limited to compiled object code, generated documentation,
443
+ and conversions to other media types.
444
+
445
+ "Work" shall mean the work of authorship, whether in Source or
446
+ Object form, made available under the License, as indicated by a
447
+ copyright notice that is included in or attached to the work
448
+ (an example is provided in the Appendix below).
449
+
450
+ "Derivative Works" shall mean any work, whether in Source or Object
451
+ form, that is based on (or derived from) the Work and for which the
452
+ editorial revisions, annotations, elaborations, or other modifications
453
+ represent, as a whole, an original work of authorship. For the purposes
454
+ of this License, Derivative Works shall not include works that remain
455
+ separable from, or merely link (or bind by name) to the interfaces of,
456
+ the Work and Derivative Works thereof.
457
+
458
+ "Contribution" shall mean any work of authorship, including
459
+ the original version of the Work and any modifications or additions
460
+ to that Work or Derivative Works thereof, that is intentionally
461
+ submitted to Licensor for inclusion in the Work by the copyright owner
462
+ or by an individual or Legal Entity authorized to submit on behalf of
463
+ the copyright owner. For the purposes of this definition, "submitted"
464
+ means any form of electronic, verbal, or written communication sent
465
+ to the Licensor or its representatives, including but not limited to
466
+ communication on electronic mailing lists, source code control systems,
467
+ and issue tracking systems that are managed by, or on behalf of, the
468
+ Licensor for the purpose of discussing and improving the Work, but
469
+ excluding communication that is conspicuously marked or otherwise
470
+ designated in writing by the copyright owner as "Not a Contribution."
471
+
472
+ "Contributor" shall mean Licensor and any individual or Legal Entity
473
+ on behalf of whom a Contribution has been received by Licensor and
474
+ subsequently incorporated within the Work.
475
+
476
+ 2. Grant of Copyright License. Subject to the terms and conditions of
477
+ this License, each Contributor hereby grants to You a perpetual,
478
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
479
+ copyright license to reproduce, prepare Derivative Works of,
480
+ publicly display, publicly perform, sublicense, and distribute the
481
+ Work and such Derivative Works in Source or Object form.
482
+
483
+ 3. Grant of Patent License. Subject to the terms and conditions of
484
+ this License, each Contributor hereby grants to You a perpetual,
485
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
486
+ (except as stated in this section) patent license to make, have made,
487
+ use, offer to sell, sell, import, and otherwise transfer the Work,
488
+ where such license applies only to those patent claims licensable
489
+ by such Contributor that are necessarily infringed by their
490
+ Contribution(s) alone or by combination of their Contribution(s)
491
+ with the Work to which such Contribution(s) was submitted. If You
492
+ institute patent litigation against any entity (including a
493
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
494
+ or a Contribution incorporated within the Work constitutes direct
495
+ or contributory patent infringement, then any patent licenses
496
+ granted to You under this License for that Work shall terminate
497
+ as of the date such litigation is filed.
498
+
499
+ 4. Redistribution. You may reproduce and distribute copies of the
500
+ Work or Derivative Works thereof in any medium, with or without
501
+ modifications, and in Source or Object form, provided that You
502
+ meet the following conditions:
503
+
504
+ (a) You must give any other recipients of the Work or
505
+ Derivative Works a copy of this License; and
506
+
507
+ (b) You must cause any modified files to carry prominent notices
508
+ stating that You changed the files; and
509
+
510
+ (c) You must retain, in the Source form of any Derivative Works
511
+ that You distribute, all copyright, patent, trademark, and
512
+ attribution notices from the Source form of the Work,
513
+ excluding those notices that do not pertain to any part of
514
+ the Derivative Works; and
515
+
516
+ (d) If the Work includes a "NOTICE" text file as part of its
517
+ distribution, then any Derivative Works that You distribute must
518
+ include a readable copy of the attribution notices contained
519
+ within such NOTICE file, excluding those notices that do not
520
+ pertain to any part of the Derivative Works, in at least one
521
+ of the following places: within a NOTICE text file distributed
522
+ as part of the Derivative Works; within the Source form or
523
+ documentation, if provided along with the Derivative Works; or,
524
+ within a display generated by the Derivative Works, if and
525
+ wherever such third-party notices normally appear. The contents
526
+ of the NOTICE file are for informational purposes only and
527
+ do not modify the License. You may add Your own attribution
528
+ notices within Derivative Works that You distribute, alongside
529
+ or as an addendum to the NOTICE text from the Work, provided
530
+ that such additional attribution notices cannot be construed
531
+ as modifying the License.
532
+
533
+ You may add Your own copyright statement to Your modifications and
534
+ may provide additional or different license terms and conditions
535
+ for use, reproduction, or distribution of Your modifications, or
536
+ for any such Derivative Works as a whole, provided Your use,
537
+ reproduction, and distribution of the Work otherwise complies with
538
+ the conditions stated in this License.
539
+
540
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
541
+ any Contribution intentionally submitted for inclusion in the Work
542
+ by You to the Licensor shall be under the terms and conditions of
543
+ this License, without any additional terms or conditions.
544
+ Notwithstanding the above, nothing herein shall supersede or modify
545
+ the terms of any separate license agreement you may have executed
546
+ with Licensor regarding such Contributions.
547
+
548
+ 6. Trademarks. This License does not grant permission to use the trade
549
+ names, trademarks, service marks, or product names of the Licensor,
550
+ except as required for reasonable and customary use in describing the
551
+ origin of the Work and reproducing the content of the NOTICE file.
552
+
553
+ 7. Disclaimer of Warranty. Unless required by applicable law or
554
+ agreed to in writing, Licensor provides the Work (and each
555
+ Contributor provides its Contributions) on an "AS IS" BASIS,
556
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
557
+ implied, including, without limitation, any warranties or conditions
558
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
559
+ PARTICULAR PURPOSE. You are solely responsible for determining the
560
+ appropriateness of using or redistributing the Work and assume any
561
+ risks associated with Your exercise of permissions under this License.
562
+
563
+ 8. Limitation of Liability. In no event and under no legal theory,
564
+ whether in tort (including negligence), contract, or otherwise,
565
+ unless required by applicable law (such as deliberate and grossly
566
+ negligent acts) or agreed to in writing, shall any Contributor be
567
+ liable to You for damages, including any direct, indirect, special,
568
+ incidental, or consequential damages of any character arising as a
569
+ result of this License or out of the use or inability to use the
570
+ Work (including but not limited to damages for loss of goodwill,
571
+ work stoppage, computer failure or malfunction, or any and all
572
+ other commercial damages or losses), even if such Contributor
573
+ has been advised of the possibility of such damages.
574
+
575
+ 9. Accepting Warranty or Additional Liability. While redistributing
576
+ the Work or Derivative Works thereof, You may choose to offer,
577
+ and charge a fee for, acceptance of support, warranty, indemnity,
578
+ or other liability obligations and/or rights consistent with this
579
+ License. However, in accepting such obligations, You may act only
580
+ on Your own behalf and on Your sole responsibility, not on behalf
581
+ of any other Contributor, and only if You agree to indemnify,
582
+ defend, and hold each Contributor harmless for any liability
583
+ incurred by, or claims asserted against, such Contributor by reason
584
+ of your accepting any such warranty or additional liability.
585
+
586
+ END OF TERMS AND CONDITIONS
587
+
588
+
589
+ Copyright (c) Donald Stufft and individual contributors.
590
+ All rights reserved.
591
+
592
+ Redistribution and use in source and binary forms, with or without
593
+ modification, are permitted provided that the following conditions are met:
594
+
595
+ 1. Redistributions of source code must retain the above copyright notice,
596
+ this list of conditions and the following disclaimer.
597
+
598
+ 2. Redistributions in binary form must reproduce the above copyright
599
+ notice, this list of conditions and the following disclaimer in the
600
+ documentation and/or other materials provided with the distribution.
601
+
602
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
603
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
604
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
605
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
606
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
607
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
608
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
609
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
610
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
611
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.A. HISTORY OF THE SOFTWARE
612
+ ==========================
613
+
614
+ Python was created in the early 1990s by Guido van Rossum at Stichting
615
+ Mathematisch Centrum (CWI, see https://www.cwi.nl) in the Netherlands
616
+ as a successor of a language called ABC. Guido remains Python's
617
+ principal author, although it includes many contributions from others.
618
+
619
+ In 1995, Guido continued his work on Python at the Corporation for
620
+ National Research Initiatives (CNRI, see https://www.cnri.reston.va.us)
621
+ in Reston, Virginia where he released several versions of the
622
+ software.
623
+
624
+ In May 2000, Guido and the Python core development team moved to
625
+ BeOpen.com to form the BeOpen PythonLabs team. In October of the same
626
+ year, the PythonLabs team moved to Digital Creations, which became
627
+ Zope Corporation. In 2001, the Python Software Foundation (PSF, see
628
+ https://www.python.org/psf/) was formed, a non-profit organization
629
+ created specifically to own Python-related Intellectual Property.
630
+ Zope Corporation was a sponsoring member of the PSF.
631
+
632
+ All Python releases are Open Source (see https://opensource.org for
633
+ the Open Source Definition). Historically, most, but not all, Python
634
+ releases have also been GPL-compatible; the table below summarizes
635
+ the various releases.
636
+
637
+ Release Derived Year Owner GPL-
638
+ from compatible? (1)
639
+
640
+ 0.9.0 thru 1.2 1991-1995 CWI yes
641
+ 1.3 thru 1.5.2 1.2 1995-1999 CNRI yes
642
+ 1.6 1.5.2 2000 CNRI no
643
+ 2.0 1.6 2000 BeOpen.com no
644
+ 1.6.1 1.6 2001 CNRI yes (2)
645
+ 2.1 2.0+1.6.1 2001 PSF no
646
+ 2.0.1 2.0+1.6.1 2001 PSF yes
647
+ 2.1.1 2.1+2.0.1 2001 PSF yes
648
+ 2.1.2 2.1.1 2002 PSF yes
649
+ 2.1.3 2.1.2 2002 PSF yes
650
+ 2.2 and above 2.1.1 2001-now PSF yes
651
+
652
+ Footnotes:
653
+
654
+ (1) GPL-compatible doesn't mean that we're distributing Python under
655
+ the GPL. All Python licenses, unlike the GPL, let you distribute
656
+ a modified version without making your changes open source. The
657
+ GPL-compatible licenses make it possible to combine Python with
658
+ other software that is released under the GPL; the others don't.
659
+
660
+ (2) According to Richard Stallman, 1.6.1 is not GPL-compatible,
661
+ because its license has a choice of law clause. According to
662
+ CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1
663
+ is "not incompatible" with the GPL.
664
+
665
+ Thanks to the many outside volunteers who have worked under Guido's
666
+ direction to make these releases possible.
667
+
668
+
669
+ B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON
670
+ ===============================================================
671
+
672
+ Python software and documentation are licensed under the
673
+ Python Software Foundation License Version 2.
674
+
675
+ Starting with Python 3.8.6, examples, recipes, and other code in
676
+ the documentation are dual licensed under the PSF License Version 2
677
+ and the Zero-Clause BSD license.
678
+
679
+ Some software incorporated into Python is under different licenses.
680
+ The licenses are listed with code falling under that license.
681
+
682
+
683
+ PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
684
+ --------------------------------------------
685
+
686
+ 1. This LICENSE AGREEMENT is between the Python Software Foundation
687
+ ("PSF"), and the Individual or Organization ("Licensee") accessing and
688
+ otherwise using this software ("Python") in source or binary form and
689
+ its associated documentation.
690
+
691
+ 2. Subject to the terms and conditions of this License Agreement, PSF hereby
692
+ grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
693
+ analyze, test, perform and/or display publicly, prepare derivative works,
694
+ distribute, and otherwise use Python alone or in any derivative version,
695
+ provided, however, that PSF's License Agreement and PSF's notice of copyright,
696
+ i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
697
+ 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Python Software Foundation;
698
+ All Rights Reserved" are retained in Python alone or in any derivative version
699
+ prepared by Licensee.
700
+
701
+ 3. In the event Licensee prepares a derivative work that is based on
702
+ or incorporates Python or any part thereof, and wants to make
703
+ the derivative work available to others as provided herein, then
704
+ Licensee hereby agrees to include in any such work a brief summary of
705
+ the changes made to Python.
706
+
707
+ 4. PSF is making Python available to Licensee on an "AS IS"
708
+ basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
709
+ IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
710
+ DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
711
+ FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
712
+ INFRINGE ANY THIRD PARTY RIGHTS.
713
+
714
+ 5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
715
+ FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
716
+ A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
717
+ OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
718
+
719
+ 6. This License Agreement will automatically terminate upon a material
720
+ breach of its terms and conditions.
721
+
722
+ 7. Nothing in this License Agreement shall be deemed to create any
723
+ relationship of agency, partnership, or joint venture between PSF and
724
+ Licensee. This License Agreement does not grant permission to use PSF
725
+ trademarks or trade name in a trademark sense to endorse or promote
726
+ products or services of Licensee, or any third party.
727
+
728
+ 8. By copying, installing or otherwise using Python, Licensee
729
+ agrees to be bound by the terms and conditions of this License
730
+ Agreement.
731
+
732
+
733
+ BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0
734
+ -------------------------------------------
735
+
736
+ BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1
737
+
738
+ 1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an
739
+ office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the
740
+ Individual or Organization ("Licensee") accessing and otherwise using
741
+ this software in source or binary form and its associated
742
+ documentation ("the Software").
743
+
744
+ 2. Subject to the terms and conditions of this BeOpen Python License
745
+ Agreement, BeOpen hereby grants Licensee a non-exclusive,
746
+ royalty-free, world-wide license to reproduce, analyze, test, perform
747
+ and/or display publicly, prepare derivative works, distribute, and
748
+ otherwise use the Software alone or in any derivative version,
749
+ provided, however, that the BeOpen Python License is retained in the
750
+ Software, alone or in any derivative version prepared by Licensee.
751
+
752
+ 3. BeOpen is making the Software available to Licensee on an "AS IS"
753
+ basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
754
+ IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND
755
+ DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
756
+ FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT
757
+ INFRINGE ANY THIRD PARTY RIGHTS.
758
+
759
+ 4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE
760
+ SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS
761
+ AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY
762
+ DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
763
+
764
+ 5. This License Agreement will automatically terminate upon a material
765
+ breach of its terms and conditions.
766
+
767
+ 6. This License Agreement shall be governed by and interpreted in all
768
+ respects by the law of the State of California, excluding conflict of
769
+ law provisions. Nothing in this License Agreement shall be deemed to
770
+ create any relationship of agency, partnership, or joint venture
771
+ between BeOpen and Licensee. This License Agreement does not grant
772
+ permission to use BeOpen trademarks or trade names in a trademark
773
+ sense to endorse or promote products or services of Licensee, or any
774
+ third party. As an exception, the "BeOpen Python" logos available at
775
+ http://www.pythonlabs.com/logos.html may be used according to the
776
+ permissions granted on that web page.
777
+
778
+ 7. By copying, installing or otherwise using the software, Licensee
779
+ agrees to be bound by the terms and conditions of this License
780
+ Agreement.
781
+
782
+
783
+ CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1
784
+ ---------------------------------------
785
+
786
+ 1. This LICENSE AGREEMENT is between the Corporation for National
787
+ Research Initiatives, having an office at 1895 Preston White Drive,
788
+ Reston, VA 20191 ("CNRI"), and the Individual or Organization
789
+ ("Licensee") accessing and otherwise using Python 1.6.1 software in
790
+ source or binary form and its associated documentation.
791
+
792
+ 2. Subject to the terms and conditions of this License Agreement, CNRI
793
+ hereby grants Licensee a nonexclusive, royalty-free, world-wide
794
+ license to reproduce, analyze, test, perform and/or display publicly,
795
+ prepare derivative works, distribute, and otherwise use Python 1.6.1
796
+ alone or in any derivative version, provided, however, that CNRI's
797
+ License Agreement and CNRI's notice of copyright, i.e., "Copyright (c)
798
+ 1995-2001 Corporation for National Research Initiatives; All Rights
799
+ Reserved" are retained in Python 1.6.1 alone or in any derivative
800
+ version prepared by Licensee. Alternately, in lieu of CNRI's License
801
+ Agreement, Licensee may substitute the following text (omitting the
802
+ quotes): "Python 1.6.1 is made available subject to the terms and
803
+ conditions in CNRI's License Agreement. This Agreement together with
804
+ Python 1.6.1 may be located on the internet using the following
805
+ unique, persistent identifier (known as a handle): 1895.22/1013. This
806
+ Agreement may also be obtained from a proxy server on the internet
807
+ using the following URL: http://hdl.handle.net/1895.22/1013".
808
+
809
+ 3. In the event Licensee prepares a derivative work that is based on
810
+ or incorporates Python 1.6.1 or any part thereof, and wants to make
811
+ the derivative work available to others as provided herein, then
812
+ Licensee hereby agrees to include in any such work a brief summary of
813
+ the changes made to Python 1.6.1.
814
+
815
+ 4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS"
816
+ basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
817
+ IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND
818
+ DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
819
+ FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT
820
+ INFRINGE ANY THIRD PARTY RIGHTS.
821
+
822
+ 5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
823
+ 1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
824
+ A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1,
825
+ OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
826
+
827
+ 6. This License Agreement will automatically terminate upon a material
828
+ breach of its terms and conditions.
829
+
830
+ 7. This License Agreement shall be governed by the federal
831
+ intellectual property law of the United States, including without
832
+ limitation the federal copyright law, and, to the extent such
833
+ U.S. federal law does not apply, by the law of the Commonwealth of
834
+ Virginia, excluding Virginia's conflict of law provisions.
835
+ Notwithstanding the foregoing, with regard to derivative works based
836
+ on Python 1.6.1 that incorporate non-separable material that was
837
+ previously distributed under the GNU General Public License (GPL), the
838
+ law of the Commonwealth of Virginia shall govern this License
839
+ Agreement only as to issues arising under or with respect to
840
+ Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this
841
+ License Agreement shall be deemed to create any relationship of
842
+ agency, partnership, or joint venture between CNRI and Licensee. This
843
+ License Agreement does not grant permission to use CNRI trademarks or
844
+ trade name in a trademark sense to endorse or promote products or
845
+ services of Licensee, or any third party.
846
+
847
+ 8. By clicking on the "ACCEPT" button where indicated, or by copying,
848
+ installing or otherwise using Python 1.6.1, Licensee agrees to be
849
+ bound by the terms and conditions of this License Agreement.
850
+
851
+ ACCEPT
852
+
853
+
854
+ CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2
855
+ --------------------------------------------------
856
+
857
+ Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam,
858
+ The Netherlands. All rights reserved.
859
+
860
+ Permission to use, copy, modify, and distribute this software and its
861
+ documentation for any purpose and without fee is hereby granted,
862
+ provided that the above copyright notice appear in all copies and that
863
+ both that copyright notice and this permission notice appear in
864
+ supporting documentation, and that the name of Stichting Mathematisch
865
+ Centrum or CWI not be used in advertising or publicity pertaining to
866
+ distribution of the software without specific, written prior
867
+ permission.
868
+
869
+ STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
870
+ THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
871
+ FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
872
+ FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
873
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
874
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
875
+ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
876
+
877
+ ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION
878
+ ----------------------------------------------------------------------
879
+
880
+ Permission to use, copy, modify, and/or distribute this software for any
881
+ purpose with or without fee is hereby granted.
882
+
883
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
884
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
885
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
886
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
887
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
888
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
889
+ PERFORMANCE OF THIS SOFTWARE.
890
+ Copyright (c) 2014, Al Sweigart
891
+ All rights reserved.
892
+
893
+ Redistribution and use in source and binary forms, with or without
894
+ modification, are permitted provided that the following conditions are met:
895
+
896
+ * Redistributions of source code must retain the above copyright notice, this
897
+ list of conditions and the following disclaimer.
898
+
899
+ * Redistributions in binary form must reproduce the above copyright notice,
900
+ this list of conditions and the following disclaimer in the documentation
901
+ and/or other materials provided with the distribution.
902
+
903
+ * Neither the name of the {organization} nor the names of its
904
+ contributors may be used to endorse or promote products derived from
905
+ this software without specific prior written permission.
906
+
907
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
908
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
909
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
910
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
911
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
912
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
913
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
914
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
915
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
916
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.Copyright (c) 2017 Anthony Sottile
917
+
918
+ Permission is hereby granted, free of charge, to any person obtaining a copy
919
+ of this software and associated documentation files (the "Software"), to deal
920
+ in the Software without restriction, including without limitation the rights
921
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
922
+ copies of the Software, and to permit persons to whom the Software is
923
+ furnished to do so, subject to the following conditions:
924
+
925
+ The above copyright notice and this permission notice shall be included in
926
+ all copies or substantial portions of the Software.
927
+
928
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
929
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
930
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
931
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
932
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
933
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
934
+ THE SOFTWARE.Copyright (c) 2015-2019 Jared Hobbs
935
+
936
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
937
+ this software and associated documentation files (the "Software"), to deal in
938
+ the Software without restriction, including without limitation the rights to
939
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
940
+ of the Software, and to permit persons to whom the Software is furnished to do
941
+ so, subject to the following conditions:
942
+
943
+ The above copyright notice and this permission notice shall be included in all
944
+ copies or substantial portions of the Software.
945
+
946
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
947
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
948
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
949
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
950
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
951
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
952
+ SOFTWARE.Developed by ESN, an Electronic Arts Inc. studio.
953
+ Copyright (c) 2014, Electronic Arts Inc.
954
+ All rights reserved.
955
+
956
+ Redistribution and use in source and binary forms, with or without
957
+ modification, are permitted provided that the following conditions are met:
958
+ * Redistributions of source code must retain the above copyright
959
+ notice, this list of conditions and the following disclaimer.
960
+ * Redistributions in binary form must reproduce the above copyright
961
+ notice, this list of conditions and the following disclaimer in the
962
+ documentation and/or other materials provided with the distribution.
963
+ * Neither the name of ESN, Electronic Arts Inc. nor the
964
+ names of its contributors may be used to endorse or promote products
965
+ derived from this software without specific prior written permission.
966
+
967
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
968
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
969
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
970
+ DISCLAIMED. IN NO EVENT SHALL ELECTRONIC ARTS INC. BE LIABLE
971
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
972
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
973
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
974
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
975
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
976
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
977
+
978
+ ----
979
+
980
+ Portions of code from MODP_ASCII - Ascii transformations (upper/lower, etc)
981
+ https://github.com/client9/stringencoders
982
+
983
+ Copyright 2005, 2006, 2007
984
+ Nick Galbreath -- nickg [at] modp [dot] com
985
+ All rights reserved.
986
+
987
+ Redistribution and use in source and binary forms, with or without
988
+ modification, are permitted provided that the following conditions are
989
+ met:
990
+
991
+ Redistributions of source code must retain the above copyright
992
+ notice, this list of conditions and the following disclaimer.
993
+
994
+ Redistributions in binary form must reproduce the above copyright
995
+ notice, this list of conditions and the following disclaimer in the
996
+ documentation and/or other materials provided with the distribution.
997
+
998
+ Neither the name of the modp.com nor the names of its
999
+ contributors may be used to endorse or promote products derived from
1000
+ this software without specific prior written permission.
1001
+
1002
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1003
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1004
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1005
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1006
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1007
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1008
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1009
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1010
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1011
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1012
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1013
+
1014
+ This is the standard "new" BSD license:
1015
+ http://www.opensource.org/licenses/bsd-license.php
1016
+
1017
+ https://github.com/client9/stringencoders/blob/cfd5c1507325ae497ea9bacdacba12c0ffd79d30/COPYING
1018
+
1019
+ ----
1020
+
1021
+ Numeric decoder derived from from TCL library
1022
+ https://opensource.apple.com/source/tcl/tcl-14/tcl/license.terms
1023
+ * Copyright (c) 1988-1993 The Regents of the University of California.
1024
+ * Copyright (c) 1994 Sun Microsystems, Inc.
1025
+
1026
+ This software is copyrighted by the Regents of the University of
1027
+ California, Sun Microsystems, Inc., Scriptics Corporation, ActiveState
1028
+ Corporation and other parties. The following terms apply to all files
1029
+ associated with the software unless explicitly disclaimed in
1030
+ individual files.
1031
+
1032
+ The authors hereby grant permission to use, copy, modify, distribute,
1033
+ and license this software and its documentation for any purpose, provided
1034
+ that existing copyright notices are retained in all copies and that this
1035
+ notice is included verbatim in any distributions. No written agreement,
1036
+ license, or royalty fee is required for any of the authorized uses.
1037
+ Modifications to this software may be copyrighted by their authors
1038
+ and need not follow the licensing terms described here, provided that
1039
+ the new terms are clearly indicated on the first page of each file where
1040
+ they apply.
1041
+
1042
+ IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
1043
+ FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
1044
+ ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
1045
+ DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
1046
+ POSSIBILITY OF SUCH DAMAGE.
1047
+
1048
+ THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
1049
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
1050
+ FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
1051
+ IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
1052
+ NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
1053
+ MODIFICATIONS.
1054
+
1055
+ GOVERNMENT USE: If you are acquiring this software on behalf of the
1056
+ U.S. government, the Government shall have only "Restricted Rights"
1057
+ in the software and related documentation as defined in the Federal
1058
+ Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
1059
+ are acquiring the software on behalf of the Department of Defense, the
1060
+ software shall be classified as "Commercial Computer Software" and the
1061
+ Government shall have only "Restricted Rights" as defined in Clause
1062
+ 252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the
1063
+ authors grant the U.S. Government and others acting in its behalf
1064
+ permission to use and distribute the software in accordance with the
1065
+ terms specified in this license.Apache License
1066
+ Version 2.0, January 2004
1067
+ http://www.apache.org/licenses/
1068
+
1069
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1070
+
1071
+ 1. Definitions.
1072
+
1073
+ "License" shall mean the terms and conditions for use, reproduction, and
1074
+ distribution as defined by Sections 1 through 9 of this document.
1075
+
1076
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright
1077
+ owner that is granting the License.
1078
+
1079
+ "Legal Entity" shall mean the union of the acting entity and all other entities
1080
+ that control, are controlled by, or are under common control with that entity.
1081
+ For the purposes of this definition, "control" means (i) the power, direct or
1082
+ indirect, to cause the direction or management of such entity, whether by
1083
+ contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
1084
+ outstanding shares, or (iii) beneficial ownership of such entity.
1085
+
1086
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
1087
+ permissions granted by this License.
1088
+
1089
+ "Source" form shall mean the preferred form for making modifications, including
1090
+ but not limited to software source code, documentation source, and configuration
1091
+ files.
1092
+
1093
+ "Object" form shall mean any form resulting from mechanical transformation or
1094
+ translation of a Source form, including but not limited to compiled object code,
1095
+ generated documentation, and conversions to other media types.
1096
+
1097
+ "Work" shall mean the work of authorship, whether in Source or Object form, made
1098
+ available under the License, as indicated by a copyright notice that is included
1099
+ in or attached to the work (an example is provided in the Appendix below).
1100
+
1101
+ "Derivative Works" shall mean any work, whether in Source or Object form, that
1102
+ is based on (or derived from) the Work and for which the editorial revisions,
1103
+ annotations, elaborations, or other modifications represent, as a whole, an
1104
+ original work of authorship. For the purposes of this License, Derivative Works
1105
+ shall not include works that remain separable from, or merely link (or bind by
1106
+ name) to the interfaces of, the Work and Derivative Works thereof.
1107
+
1108
+ "Contribution" shall mean any work of authorship, including the original version
1109
+ of the Work and any modifications or additions to that Work or Derivative Works
1110
+ thereof, that is intentionally submitted to Licensor for inclusion in the Work
1111
+ by the copyright owner or by an individual or Legal Entity authorized to submit
1112
+ on behalf of the copyright owner. For the purposes of this definition,
1113
+ "submitted" means any form of electronic, verbal, or written communication sent
1114
+ to the Licensor or its representatives, including but not limited to
1115
+ communication on electronic mailing lists, source code control systems, and
1116
+ issue tracking systems that are managed by, or on behalf of, the Licensor for
1117
+ the purpose of discussing and improving the Work, but excluding communication
1118
+ that is conspicuously marked or otherwise designated in writing by the copyright
1119
+ owner as "Not a Contribution."
1120
+
1121
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf
1122
+ of whom a Contribution has been received by Licensor and subsequently
1123
+ incorporated within the Work.
1124
+
1125
+ 2. Grant of Copyright License.
1126
+
1127
+ Subject to the terms and conditions of this License, each Contributor hereby
1128
+ grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
1129
+ irrevocable copyright license to reproduce, prepare Derivative Works of,
1130
+ publicly display, publicly perform, sublicense, and distribute the Work and such
1131
+ Derivative Works in Source or Object form.
1132
+
1133
+ 3. Grant of Patent License.
1134
+
1135
+ Subject to the terms and conditions of this License, each Contributor hereby
1136
+ grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
1137
+ irrevocable (except as stated in this section) patent license to make, have
1138
+ made, use, offer to sell, sell, import, and otherwise transfer the Work, where
1139
+ such license applies only to those patent claims licensable by such Contributor
1140
+ that are necessarily infringed by their Contribution(s) alone or by combination
1141
+ of their Contribution(s) with the Work to which such Contribution(s) was
1142
+ submitted. If You institute patent litigation against any entity (including a
1143
+ cross-claim or counterclaim in a lawsuit) alleging that the Work or a
1144
+ Contribution incorporated within the Work constitutes direct or contributory
1145
+ patent infringement, then any patent licenses granted to You under this License
1146
+ for that Work shall terminate as of the date such litigation is filed.
1147
+
1148
+ 4. Redistribution.
1149
+
1150
+ You may reproduce and distribute copies of the Work or Derivative Works thereof
1151
+ in any medium, with or without modifications, and in Source or Object form,
1152
+ provided that You meet the following conditions:
1153
+
1154
+ You must give any other recipients of the Work or Derivative Works a copy of
1155
+ this License; and
1156
+ You must cause any modified files to carry prominent notices stating that You
1157
+ changed the files; and
1158
+ You must retain, in the Source form of any Derivative Works that You distribute,
1159
+ all copyright, patent, trademark, and attribution notices from the Source form
1160
+ of the Work, excluding those notices that do not pertain to any part of the
1161
+ Derivative Works; and
1162
+ If the Work includes a "NOTICE" text file as part of its distribution, then any
1163
+ Derivative Works that You distribute must include a readable copy of the
1164
+ attribution notices contained within such NOTICE file, excluding those notices
1165
+ that do not pertain to any part of the Derivative Works, in at least one of the
1166
+ following places: within a NOTICE text file distributed as part of the
1167
+ Derivative Works; within the Source form or documentation, if provided along
1168
+ with the Derivative Works; or, within a display generated by the Derivative
1169
+ Works, if and wherever such third-party notices normally appear. The contents of
1170
+ the NOTICE file are for informational purposes only and do not modify the
1171
+ License. You may add Your own attribution notices within Derivative Works that
1172
+ You distribute, alongside or as an addendum to the NOTICE text from the Work,
1173
+ provided that such additional attribution notices cannot be construed as
1174
+ modifying the License.
1175
+ You may add Your own copyright statement to Your modifications and may provide
1176
+ additional or different license terms and conditions for use, reproduction, or
1177
+ distribution of Your modifications, or for any such Derivative Works as a whole,
1178
+ provided Your use, reproduction, and distribution of the Work otherwise complies
1179
+ with the conditions stated in this License.
1180
+
1181
+ 5. Submission of Contributions.
1182
+
1183
+ Unless You explicitly state otherwise, any Contribution intentionally submitted
1184
+ for inclusion in the Work by You to the Licensor shall be under the terms and
1185
+ conditions of this License, without any additional terms or conditions.
1186
+ Notwithstanding the above, nothing herein shall supersede or modify the terms of
1187
+ any separate license agreement you may have executed with Licensor regarding
1188
+ such Contributions.
1189
+
1190
+ 6. Trademarks.
1191
+
1192
+ This License does not grant permission to use the trade names, trademarks,
1193
+ service marks, or product names of the Licensor, except as required for
1194
+ reasonable and customary use in describing the origin of the Work and
1195
+ reproducing the content of the NOTICE file.
1196
+
1197
+ 7. Disclaimer of Warranty.
1198
+
1199
+ Unless required by applicable law or agreed to in writing, Licensor provides the
1200
+ Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
1201
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
1202
+ including, without limitation, any warranties or conditions of TITLE,
1203
+ NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
1204
+ solely responsible for determining the appropriateness of using or
1205
+ redistributing the Work and assume any risks associated with Your exercise of
1206
+ permissions under this License.
1207
+
1208
+ 8. Limitation of Liability.
1209
+
1210
+ In no event and under no legal theory, whether in tort (including negligence),
1211
+ contract, or otherwise, unless required by applicable law (such as deliberate
1212
+ and grossly negligent acts) or agreed to in writing, shall any Contributor be
1213
+ liable to You for damages, including any direct, indirect, special, incidental,
1214
+ or consequential damages of any character arising as a result of this License or
1215
+ out of the use or inability to use the Work (including but not limited to
1216
+ damages for loss of goodwill, work stoppage, computer failure or malfunction, or
1217
+ any and all other commercial damages or losses), even if such Contributor has
1218
+ been advised of the possibility of such damages.
1219
+
1220
+ 9. Accepting Warranty or Additional Liability.
1221
+
1222
+ While redistributing the Work or Derivative Works thereof, You may choose to
1223
+ offer, and charge a fee for, acceptance of support, warranty, indemnity, or
1224
+ other liability obligations and/or rights consistent with this License. However,
1225
+ in accepting such obligations, You may act only on Your own behalf and on Your
1226
+ sole responsibility, not on behalf of any other Contributor, and only if You
1227
+ agree to indemnify, defend, and hold each Contributor harmless for any liability
1228
+ incurred by, or claims asserted against, such Contributor by reason of your
1229
+ accepting any such warranty or additional liability.
1230
+
1231
+ END OF TERMS AND CONDITIONS
1232
+
1233
+ APPENDIX: How to apply the Apache License to your work
1234
+
1235
+ To apply the Apache License to your work, attach the following boilerplate
1236
+ notice, with the fields enclosed by brackets "[]" replaced with your own
1237
+ identifying information. (Don't include the brackets!) The text should be
1238
+ enclosed in the appropriate comment syntax for the file format. We also
1239
+ recommend that a file or class name and description of purpose be included on
1240
+ the same "printed page" as the copyright notice for easier identification within
1241
+ third-party archives.
1242
+
1243
+ Copyright [yyyy] [name of copyright owner]
1244
+
1245
+ Licensed under the Apache License, Version 2.0 (the "License");
1246
+ you may not use this file except in compliance with the License.
1247
+ You may obtain a copy of the License at
1248
+
1249
+ http://www.apache.org/licenses/LICENSE-2.0
1250
+
1251
+ Unless required by applicable law or agreed to in writing, software
1252
+ distributed under the License is distributed on an "AS IS" BASIS,
1253
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1254
+ See the License for the specific language governing permissions and
1255
+ limitations under the License.
1256
+ Classifier: Development Status :: 5 - Production/Stable
1257
+ Classifier: Environment :: Console
1258
+ Classifier: Intended Audience :: Science/Research
1259
+ Classifier: License :: OSI Approved :: BSD License
1260
+ Classifier: Operating System :: OS Independent
1261
+ Classifier: Programming Language :: Cython
1262
+ Classifier: Programming Language :: Python
1263
+ Classifier: Programming Language :: Python :: 3
1264
+ Classifier: Programming Language :: Python :: 3 :: Only
1265
+ Classifier: Programming Language :: Python :: 3.9
1266
+ Classifier: Programming Language :: Python :: 3.10
1267
+ Classifier: Programming Language :: Python :: 3.11
1268
+ Classifier: Programming Language :: Python :: 3.12
1269
+ Classifier: Programming Language :: Python :: 3.13
1270
+ Classifier: Programming Language :: Python :: 3.14
1271
+ Classifier: Topic :: Scientific/Engineering
1272
+ Project-URL: homepage, https://pandas.pydata.org
1273
+ Project-URL: documentation, https://pandas.pydata.org/docs/
1274
+ Project-URL: repository, https://github.com/pandas-dev/pandas
1275
+ Requires-Python: >=3.9
1276
+ Requires-Dist: numpy>=1.22.4; python_version < "3.11"
1277
+ Requires-Dist: numpy>=1.23.2; python_version == "3.11"
1278
+ Requires-Dist: numpy>=1.26.0; python_version >= "3.12"
1279
+ Requires-Dist: python-dateutil>=2.8.2
1280
+ Requires-Dist: pytz>=2020.1
1281
+ Requires-Dist: tzdata>=2022.7
1282
+ Provides-Extra: test
1283
+ Requires-Dist: hypothesis>=6.46.1; extra == "test"
1284
+ Requires-Dist: pytest>=7.3.2; extra == "test"
1285
+ Requires-Dist: pytest-xdist>=2.2.0; extra == "test"
1286
+ Provides-Extra: pyarrow
1287
+ Requires-Dist: pyarrow>=10.0.1; extra == "pyarrow"
1288
+ Provides-Extra: performance
1289
+ Requires-Dist: bottleneck>=1.3.6; extra == "performance"
1290
+ Requires-Dist: numba>=0.56.4; extra == "performance"
1291
+ Requires-Dist: numexpr>=2.8.4; extra == "performance"
1292
+ Provides-Extra: computation
1293
+ Requires-Dist: scipy>=1.10.0; extra == "computation"
1294
+ Requires-Dist: xarray>=2022.12.0; extra == "computation"
1295
+ Provides-Extra: fss
1296
+ Requires-Dist: fsspec>=2022.11.0; extra == "fss"
1297
+ Provides-Extra: aws
1298
+ Requires-Dist: s3fs>=2022.11.0; extra == "aws"
1299
+ Provides-Extra: gcp
1300
+ Requires-Dist: gcsfs>=2022.11.0; extra == "gcp"
1301
+ Requires-Dist: pandas-gbq>=0.19.0; extra == "gcp"
1302
+ Provides-Extra: excel
1303
+ Requires-Dist: odfpy>=1.4.1; extra == "excel"
1304
+ Requires-Dist: openpyxl>=3.1.0; extra == "excel"
1305
+ Requires-Dist: python-calamine>=0.1.7; extra == "excel"
1306
+ Requires-Dist: pyxlsb>=1.0.10; extra == "excel"
1307
+ Requires-Dist: xlrd>=2.0.1; extra == "excel"
1308
+ Requires-Dist: xlsxwriter>=3.0.5; extra == "excel"
1309
+ Provides-Extra: parquet
1310
+ Requires-Dist: pyarrow>=10.0.1; extra == "parquet"
1311
+ Provides-Extra: feather
1312
+ Requires-Dist: pyarrow>=10.0.1; extra == "feather"
1313
+ Provides-Extra: hdf5
1314
+ Requires-Dist: tables>=3.8.0; extra == "hdf5"
1315
+ Provides-Extra: spss
1316
+ Requires-Dist: pyreadstat>=1.2.0; extra == "spss"
1317
+ Provides-Extra: postgresql
1318
+ Requires-Dist: SQLAlchemy>=2.0.0; extra == "postgresql"
1319
+ Requires-Dist: psycopg2>=2.9.6; extra == "postgresql"
1320
+ Requires-Dist: adbc-driver-postgresql>=0.8.0; extra == "postgresql"
1321
+ Provides-Extra: mysql
1322
+ Requires-Dist: SQLAlchemy>=2.0.0; extra == "mysql"
1323
+ Requires-Dist: pymysql>=1.0.2; extra == "mysql"
1324
+ Provides-Extra: sql-other
1325
+ Requires-Dist: SQLAlchemy>=2.0.0; extra == "sql-other"
1326
+ Requires-Dist: adbc-driver-postgresql>=0.8.0; extra == "sql-other"
1327
+ Requires-Dist: adbc-driver-sqlite>=0.8.0; extra == "sql-other"
1328
+ Provides-Extra: html
1329
+ Requires-Dist: beautifulsoup4>=4.11.2; extra == "html"
1330
+ Requires-Dist: html5lib>=1.1; extra == "html"
1331
+ Requires-Dist: lxml>=4.9.2; extra == "html"
1332
+ Provides-Extra: xml
1333
+ Requires-Dist: lxml>=4.9.2; extra == "xml"
1334
+ Provides-Extra: plot
1335
+ Requires-Dist: matplotlib>=3.6.3; extra == "plot"
1336
+ Provides-Extra: output-formatting
1337
+ Requires-Dist: jinja2>=3.1.2; extra == "output-formatting"
1338
+ Requires-Dist: tabulate>=0.9.0; extra == "output-formatting"
1339
+ Provides-Extra: clipboard
1340
+ Requires-Dist: PyQt5>=5.15.9; extra == "clipboard"
1341
+ Requires-Dist: qtpy>=2.3.0; extra == "clipboard"
1342
+ Provides-Extra: compression
1343
+ Requires-Dist: zstandard>=0.19.0; extra == "compression"
1344
+ Provides-Extra: consortium-standard
1345
+ Requires-Dist: dataframe-api-compat>=0.1.7; extra == "consortium-standard"
1346
+ Provides-Extra: all
1347
+ Requires-Dist: adbc-driver-postgresql>=0.8.0; extra == "all"
1348
+ Requires-Dist: adbc-driver-sqlite>=0.8.0; extra == "all"
1349
+ Requires-Dist: beautifulsoup4>=4.11.2; extra == "all"
1350
+ Requires-Dist: bottleneck>=1.3.6; extra == "all"
1351
+ Requires-Dist: dataframe-api-compat>=0.1.7; extra == "all"
1352
+ Requires-Dist: fastparquet>=2022.12.0; extra == "all"
1353
+ Requires-Dist: fsspec>=2022.11.0; extra == "all"
1354
+ Requires-Dist: gcsfs>=2022.11.0; extra == "all"
1355
+ Requires-Dist: html5lib>=1.1; extra == "all"
1356
+ Requires-Dist: hypothesis>=6.46.1; extra == "all"
1357
+ Requires-Dist: jinja2>=3.1.2; extra == "all"
1358
+ Requires-Dist: lxml>=4.9.2; extra == "all"
1359
+ Requires-Dist: matplotlib>=3.6.3; extra == "all"
1360
+ Requires-Dist: numba>=0.56.4; extra == "all"
1361
+ Requires-Dist: numexpr>=2.8.4; extra == "all"
1362
+ Requires-Dist: odfpy>=1.4.1; extra == "all"
1363
+ Requires-Dist: openpyxl>=3.1.0; extra == "all"
1364
+ Requires-Dist: pandas-gbq>=0.19.0; extra == "all"
1365
+ Requires-Dist: psycopg2>=2.9.6; extra == "all"
1366
+ Requires-Dist: pyarrow>=10.0.1; extra == "all"
1367
+ Requires-Dist: pymysql>=1.0.2; extra == "all"
1368
+ Requires-Dist: PyQt5>=5.15.9; extra == "all"
1369
+ Requires-Dist: pyreadstat>=1.2.0; extra == "all"
1370
+ Requires-Dist: pytest>=7.3.2; extra == "all"
1371
+ Requires-Dist: pytest-xdist>=2.2.0; extra == "all"
1372
+ Requires-Dist: python-calamine>=0.1.7; extra == "all"
1373
+ Requires-Dist: pyxlsb>=1.0.10; extra == "all"
1374
+ Requires-Dist: qtpy>=2.3.0; extra == "all"
1375
+ Requires-Dist: scipy>=1.10.0; extra == "all"
1376
+ Requires-Dist: s3fs>=2022.11.0; extra == "all"
1377
+ Requires-Dist: SQLAlchemy>=2.0.0; extra == "all"
1378
+ Requires-Dist: tables>=3.8.0; extra == "all"
1379
+ Requires-Dist: tabulate>=0.9.0; extra == "all"
1380
+ Requires-Dist: xarray>=2022.12.0; extra == "all"
1381
+ Requires-Dist: xlrd>=2.0.1; extra == "all"
1382
+ Requires-Dist: xlsxwriter>=3.0.5; extra == "all"
1383
+ Requires-Dist: zstandard>=0.19.0; extra == "all"
1384
+ Description-Content-Type: text/markdown
1385
+
1386
+ <div align="center">
1387
+ <img src="https://pandas.pydata.org/static/img/pandas.svg"><br>
1388
+ </div>
1389
+
1390
+ -----------------
1391
+
1392
+ # pandas: powerful Python data analysis toolkit
1393
+
1394
+ | | |
1395
+ | --- | --- |
1396
+ | Testing | [![CI - Test](https://github.com/pandas-dev/pandas/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/pandas-dev/pandas/actions/workflows/unit-tests.yml) [![Coverage](https://codecov.io/github/pandas-dev/pandas/coverage.svg?branch=main)](https://codecov.io/gh/pandas-dev/pandas) |
1397
+ | Package | [![PyPI Latest Release](https://img.shields.io/pypi/v/pandas.svg)](https://pypi.org/project/pandas/) [![PyPI Downloads](https://img.shields.io/pypi/dm/pandas.svg?label=PyPI%20downloads)](https://pypi.org/project/pandas/) [![Conda Latest Release](https://anaconda.org/conda-forge/pandas/badges/version.svg)](https://anaconda.org/conda-forge/pandas) [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/pandas.svg?label=Conda%20downloads)](https://anaconda.org/conda-forge/pandas) |
1398
+ | Meta | [![Powered by NumFOCUS](https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A)](https://numfocus.org) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3509134.svg)](https://doi.org/10.5281/zenodo.3509134) [![License - BSD 3-Clause](https://img.shields.io/pypi/l/pandas.svg)](https://github.com/pandas-dev/pandas/blob/main/LICENSE) [![Slack](https://img.shields.io/badge/join_Slack-information-brightgreen.svg?logo=slack)](https://pandas.pydata.org/docs/dev/development/community.html?highlight=slack#community-slack) |
1399
+
1400
+
1401
+ ## What is it?
1402
+
1403
+ **pandas** is a Python package that provides fast, flexible, and expressive data
1404
+ structures designed to make working with "relational" or "labeled" data both
1405
+ easy and intuitive. It aims to be the fundamental high-level building block for
1406
+ doing practical, **real world** data analysis in Python. Additionally, it has
1407
+ the broader goal of becoming **the most powerful and flexible open source data
1408
+ analysis / manipulation tool available in any language**. It is already well on
1409
+ its way towards this goal.
1410
+
1411
+ ## Table of Contents
1412
+
1413
+ - [Main Features](#main-features)
1414
+ - [Where to get it](#where-to-get-it)
1415
+ - [Dependencies](#dependencies)
1416
+ - [Installation from sources](#installation-from-sources)
1417
+ - [License](#license)
1418
+ - [Documentation](#documentation)
1419
+ - [Background](#background)
1420
+ - [Getting Help](#getting-help)
1421
+ - [Discussion and Development](#discussion-and-development)
1422
+ - [Contributing to pandas](#contributing-to-pandas)
1423
+
1424
+ ## Main Features
1425
+ Here are just a few of the things that pandas does well:
1426
+
1427
+ - Easy handling of [**missing data**][missing-data] (represented as
1428
+ `NaN`, `NA`, or `NaT`) in floating point as well as non-floating point data
1429
+ - Size mutability: columns can be [**inserted and
1430
+ deleted**][insertion-deletion] from DataFrame and higher dimensional
1431
+ objects
1432
+ - Automatic and explicit [**data alignment**][alignment]: objects can
1433
+ be explicitly aligned to a set of labels, or the user can simply
1434
+ ignore the labels and let `Series`, `DataFrame`, etc. automatically
1435
+ align the data for you in computations
1436
+ - Powerful, flexible [**group by**][groupby] functionality to perform
1437
+ split-apply-combine operations on data sets, for both aggregating
1438
+ and transforming data
1439
+ - Make it [**easy to convert**][conversion] ragged,
1440
+ differently-indexed data in other Python and NumPy data structures
1441
+ into DataFrame objects
1442
+ - Intelligent label-based [**slicing**][slicing], [**fancy
1443
+ indexing**][fancy-indexing], and [**subsetting**][subsetting] of
1444
+ large data sets
1445
+ - Intuitive [**merging**][merging] and [**joining**][joining] data
1446
+ sets
1447
+ - Flexible [**reshaping**][reshape] and [**pivoting**][pivot-table] of
1448
+ data sets
1449
+ - [**Hierarchical**][mi] labeling of axes (possible to have multiple
1450
+ labels per tick)
1451
+ - Robust IO tools for loading data from [**flat files**][flat-files]
1452
+ (CSV and delimited), [**Excel files**][excel], [**databases**][db],
1453
+ and saving/loading data from the ultrafast [**HDF5 format**][hdfstore]
1454
+ - [**Time series**][timeseries]-specific functionality: date range
1455
+ generation and frequency conversion, moving window statistics,
1456
+ date shifting and lagging
1457
+
1458
+
1459
+ [missing-data]: https://pandas.pydata.org/pandas-docs/stable/user_guide/missing_data.html
1460
+ [insertion-deletion]: https://pandas.pydata.org/pandas-docs/stable/user_guide/dsintro.html#column-selection-addition-deletion
1461
+ [alignment]: https://pandas.pydata.org/pandas-docs/stable/user_guide/dsintro.html?highlight=alignment#intro-to-data-structures
1462
+ [groupby]: https://pandas.pydata.org/pandas-docs/stable/user_guide/groupby.html#group-by-split-apply-combine
1463
+ [conversion]: https://pandas.pydata.org/pandas-docs/stable/user_guide/dsintro.html#dataframe
1464
+ [slicing]: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#slicing-ranges
1465
+ [fancy-indexing]: https://pandas.pydata.org/pandas-docs/stable/user_guide/advanced.html#advanced
1466
+ [subsetting]: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#boolean-indexing
1467
+ [merging]: https://pandas.pydata.org/pandas-docs/stable/user_guide/merging.html#database-style-dataframe-or-named-series-joining-merging
1468
+ [joining]: https://pandas.pydata.org/pandas-docs/stable/user_guide/merging.html#joining-on-index
1469
+ [reshape]: https://pandas.pydata.org/pandas-docs/stable/user_guide/reshaping.html
1470
+ [pivot-table]: https://pandas.pydata.org/pandas-docs/stable/user_guide/reshaping.html
1471
+ [mi]: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#hierarchical-indexing-multiindex
1472
+ [flat-files]: https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html#csv-text-files
1473
+ [excel]: https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html#excel-files
1474
+ [db]: https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html#sql-queries
1475
+ [hdfstore]: https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html#hdf5-pytables
1476
+ [timeseries]: https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#time-series-date-functionality
1477
+
1478
+ ## Where to get it
1479
+ The source code is currently hosted on GitHub at:
1480
+ https://github.com/pandas-dev/pandas
1481
+
1482
+ Binary installers for the latest released version are available at the [Python
1483
+ Package Index (PyPI)](https://pypi.org/project/pandas) and on [Conda](https://docs.conda.io/en/latest/).
1484
+
1485
+ ```sh
1486
+ # conda
1487
+ conda install -c conda-forge pandas
1488
+ ```
1489
+
1490
+ ```sh
1491
+ # or PyPI
1492
+ pip install pandas
1493
+ ```
1494
+
1495
+ The list of changes to pandas between each release can be found
1496
+ [here](https://pandas.pydata.org/pandas-docs/stable/whatsnew/index.html). For full
1497
+ details, see the commit logs at https://github.com/pandas-dev/pandas.
1498
+
1499
+ ## Dependencies
1500
+ - [NumPy - Adds support for large, multi-dimensional arrays, matrices and high-level mathematical functions to operate on these arrays](https://www.numpy.org)
1501
+ - [python-dateutil - Provides powerful extensions to the standard datetime module](https://dateutil.readthedocs.io/en/stable/index.html)
1502
+ - [pytz - Brings the Olson tz database into Python which allows accurate and cross platform timezone calculations](https://github.com/stub42/pytz)
1503
+
1504
+ See the [full installation instructions](https://pandas.pydata.org/pandas-docs/stable/install.html#dependencies) for minimum supported versions of required, recommended and optional dependencies.
1505
+
1506
+ ## Installation from sources
1507
+ To install pandas from source you need [Cython](https://cython.org/) in addition to the normal
1508
+ dependencies above. Cython can be installed from PyPI:
1509
+
1510
+ ```sh
1511
+ pip install cython
1512
+ ```
1513
+
1514
+ In the `pandas` directory (same one where you found this file after
1515
+ cloning the git repo), execute:
1516
+
1517
+ ```sh
1518
+ pip install .
1519
+ ```
1520
+
1521
+ or for installing in [development mode](https://pip.pypa.io/en/latest/cli/pip_install/#install-editable):
1522
+
1523
+
1524
+ ```sh
1525
+ python -m pip install -ve . --no-build-isolation --config-settings=editable-verbose=true
1526
+ ```
1527
+
1528
+ See the full instructions for [installing from source](https://pandas.pydata.org/docs/dev/development/contributing_environment.html).
1529
+
1530
+ ## License
1531
+ [BSD 3](LICENSE)
1532
+
1533
+ ## Documentation
1534
+ The official documentation is hosted on [PyData.org](https://pandas.pydata.org/pandas-docs/stable/).
1535
+
1536
+ ## Background
1537
+ Work on ``pandas`` started at [AQR](https://www.aqr.com/) (a quantitative hedge fund) in 2008 and
1538
+ has been under active development since then.
1539
+
1540
+ ## Getting Help
1541
+
1542
+ For usage questions, the best place to go to is [StackOverflow](https://stackoverflow.com/questions/tagged/pandas).
1543
+ Further, general questions and discussions can also take place on the [pydata mailing list](https://groups.google.com/forum/?fromgroups#!forum/pydata).
1544
+
1545
+ ## Discussion and Development
1546
+ Most development discussions take place on GitHub in this repo, via the [GitHub issue tracker](https://github.com/pandas-dev/pandas/issues).
1547
+
1548
+ Further, the [pandas-dev mailing list](https://mail.python.org/mailman/listinfo/pandas-dev) can also be used for specialized discussions or design issues, and a [Slack channel](https://pandas.pydata.org/docs/dev/development/community.html?highlight=slack#community-slack) is available for quick development related questions.
1549
+
1550
+ There are also frequent [community meetings](https://pandas.pydata.org/docs/dev/development/community.html#community-meeting) for project maintainers open to the community as well as monthly [new contributor meetings](https://pandas.pydata.org/docs/dev/development/community.html#new-contributor-meeting) to help support new contributors.
1551
+
1552
+ Additional information on the communication channels can be found on the [contributor community](https://pandas.pydata.org/docs/development/community.html) page.
1553
+
1554
+ ## Contributing to pandas
1555
+
1556
+ [![Open Source Helpers](https://www.codetriage.com/pandas-dev/pandas/badges/users.svg)](https://www.codetriage.com/pandas-dev/pandas)
1557
+
1558
+ All contributions, bug reports, bug fixes, documentation improvements, enhancements, and ideas are welcome.
1559
+
1560
+ A detailed overview on how to contribute can be found in the **[contributing guide](https://pandas.pydata.org/docs/dev/development/contributing.html)**.
1561
+
1562
+ If you are simply looking to start working with the pandas codebase, navigate to the [GitHub "issues" tab](https://github.com/pandas-dev/pandas/issues) and start looking through interesting issues. There are a number of issues listed under [Docs](https://github.com/pandas-dev/pandas/issues?labels=Docs&sort=updated&state=open) and [good first issue](https://github.com/pandas-dev/pandas/issues?labels=good+first+issue&sort=updated&state=open) where you could start out.
1563
+
1564
+ You can also triage issues which may include reproducing bug reports, or asking for vital information such as version numbers or reproduction instructions. If you would like to start triaging issues, one easy way to get started is to [subscribe to pandas on CodeTriage](https://www.codetriage.com/pandas-dev/pandas).
1565
+
1566
+ Or maybe through using pandas you have an idea of your own or are looking for something in the documentation and thinking ‘this can be improved’...you can do something about it!
1567
+
1568
+ Feel free to ask questions on the [mailing list](https://groups.google.com/forum/?fromgroups#!forum/pydata) or on [Slack](https://pandas.pydata.org/docs/dev/development/community.html?highlight=slack#community-slack).
1569
+
1570
+ As contributors and maintainers to this project, you are expected to abide by pandas' code of conduct. More information can be found at: [Contributor Code of Conduct](https://github.com/pandas-dev/.github/blob/master/CODE_OF_CONDUCT.md)
1571
+
1572
+ <hr>
1573
+
1574
+ [Go to Top](#table-of-contents)
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas-2.3.3.dist-info/RECORD ADDED
The diff for this file is too large to render. See raw diff
 
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas-2.3.3.dist-info/WHEEL ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: meson
3
+ Root-Is-Purelib: false
4
+ Tag: cp311-cp311-manylinux_2_24_x86_64
5
+ Tag: cp311-cp311-manylinux_2_28_x86_64
6
+
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas-2.3.3.dist-info/entry_points.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ [pandas_plotting_backends]
2
+ matplotlib = pandas:plotting._matplotlib
3
+
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tseries/offsets/test_offsets_properties.py ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Behavioral based tests for offsets and date_range.
3
+
4
+ This file is adapted from https://github.com/pandas-dev/pandas/pull/18761 -
5
+ which was more ambitious but less idiomatic in its use of Hypothesis.
6
+
7
+ You may wish to consult the previous version for inspiration on further
8
+ tests, or when trying to pin down the bugs exposed by the tests below.
9
+ """
10
+ from hypothesis import (
11
+ assume,
12
+ given,
13
+ )
14
+ import pytest
15
+ import pytz
16
+
17
+ import pandas as pd
18
+ from pandas._testing._hypothesis import (
19
+ DATETIME_JAN_1_1900_OPTIONAL_TZ,
20
+ YQM_OFFSET,
21
+ )
22
+
23
+ # ----------------------------------------------------------------
24
+ # Offset-specific behaviour tests
25
+
26
+
27
+ @pytest.mark.arm_slow
28
+ @given(DATETIME_JAN_1_1900_OPTIONAL_TZ, YQM_OFFSET)
29
+ def test_on_offset_implementations(dt, offset):
30
+ assume(not offset.normalize)
31
+ # check that the class-specific implementations of is_on_offset match
32
+ # the general case definition:
33
+ # (dt + offset) - offset == dt
34
+ try:
35
+ compare = (dt + offset) - offset
36
+ except (pytz.NonExistentTimeError, pytz.AmbiguousTimeError):
37
+ # When dt + offset does not exist or is DST-ambiguous, assume(False) to
38
+ # indicate to hypothesis that this is not a valid test case
39
+ # DST-ambiguous example (GH41906):
40
+ # dt = datetime.datetime(1900, 1, 1, tzinfo=pytz.timezone('Africa/Kinshasa'))
41
+ # offset = MonthBegin(66)
42
+ assume(False)
43
+
44
+ assert offset.is_on_offset(dt) == (compare == dt)
45
+
46
+
47
+ @given(YQM_OFFSET)
48
+ def test_shift_across_dst(offset):
49
+ # GH#18319 check that 1) timezone is correctly normalized and
50
+ # 2) that hour is not incorrectly changed by this normalization
51
+ assume(not offset.normalize)
52
+
53
+ # Note that dti includes a transition across DST boundary
54
+ dti = pd.date_range(
55
+ start="2017-10-30 12:00:00", end="2017-11-06", freq="D", tz="US/Eastern"
56
+ )
57
+ assert (dti.hour == 12).all() # we haven't screwed up yet
58
+
59
+ res = dti + offset
60
+ assert (res.hour == 12).all()
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tseries/offsets/test_quarter.py ADDED
@@ -0,0 +1,303 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Tests for the following offsets:
3
+ - QuarterBegin
4
+ - QuarterEnd
5
+ """
6
+ from __future__ import annotations
7
+
8
+ from datetime import datetime
9
+
10
+ import pytest
11
+
12
+ import pandas._testing as tm
13
+ from pandas.tests.tseries.offsets.common import (
14
+ assert_is_on_offset,
15
+ assert_offset_equal,
16
+ )
17
+
18
+ from pandas.tseries.offsets import (
19
+ QuarterBegin,
20
+ QuarterEnd,
21
+ )
22
+
23
+
24
+ @pytest.mark.parametrize("klass", (QuarterBegin, QuarterEnd))
25
+ def test_quarterly_dont_normalize(klass):
26
+ date = datetime(2012, 3, 31, 5, 30)
27
+ result = date + klass()
28
+ assert result.time() == date.time()
29
+
30
+
31
+ @pytest.mark.parametrize("offset", [QuarterBegin(), QuarterEnd()])
32
+ @pytest.mark.parametrize(
33
+ "date",
34
+ [
35
+ datetime(2016, m, d)
36
+ for m in [10, 11, 12]
37
+ for d in [1, 2, 3, 28, 29, 30, 31]
38
+ if not (m == 11 and d == 31)
39
+ ],
40
+ )
41
+ def test_on_offset(offset, date):
42
+ res = offset.is_on_offset(date)
43
+ slow_version = date == (date + offset) - offset
44
+ assert res == slow_version
45
+
46
+
47
+ class TestQuarterBegin:
48
+ def test_repr(self):
49
+ expected = "<QuarterBegin: startingMonth=3>"
50
+ assert repr(QuarterBegin()) == expected
51
+ expected = "<QuarterBegin: startingMonth=3>"
52
+ assert repr(QuarterBegin(startingMonth=3)) == expected
53
+ expected = "<QuarterBegin: startingMonth=1>"
54
+ assert repr(QuarterBegin(startingMonth=1)) == expected
55
+
56
+ def test_is_anchored(self):
57
+ msg = "QuarterBegin.is_anchored is deprecated "
58
+
59
+ with tm.assert_produces_warning(FutureWarning, match=msg):
60
+ assert QuarterBegin(startingMonth=1).is_anchored()
61
+ assert QuarterBegin().is_anchored()
62
+ assert not QuarterBegin(2, startingMonth=1).is_anchored()
63
+
64
+ def test_offset_corner_case(self):
65
+ # corner
66
+ offset = QuarterBegin(n=-1, startingMonth=1)
67
+ assert datetime(2010, 2, 1) + offset == datetime(2010, 1, 1)
68
+
69
+ offset_cases = []
70
+ offset_cases.append(
71
+ (
72
+ QuarterBegin(startingMonth=1),
73
+ {
74
+ datetime(2007, 12, 1): datetime(2008, 1, 1),
75
+ datetime(2008, 1, 1): datetime(2008, 4, 1),
76
+ datetime(2008, 2, 15): datetime(2008, 4, 1),
77
+ datetime(2008, 2, 29): datetime(2008, 4, 1),
78
+ datetime(2008, 3, 15): datetime(2008, 4, 1),
79
+ datetime(2008, 3, 31): datetime(2008, 4, 1),
80
+ datetime(2008, 4, 15): datetime(2008, 7, 1),
81
+ datetime(2008, 4, 1): datetime(2008, 7, 1),
82
+ },
83
+ )
84
+ )
85
+
86
+ offset_cases.append(
87
+ (
88
+ QuarterBegin(startingMonth=2),
89
+ {
90
+ datetime(2008, 1, 1): datetime(2008, 2, 1),
91
+ datetime(2008, 1, 31): datetime(2008, 2, 1),
92
+ datetime(2008, 1, 15): datetime(2008, 2, 1),
93
+ datetime(2008, 2, 29): datetime(2008, 5, 1),
94
+ datetime(2008, 3, 15): datetime(2008, 5, 1),
95
+ datetime(2008, 3, 31): datetime(2008, 5, 1),
96
+ datetime(2008, 4, 15): datetime(2008, 5, 1),
97
+ datetime(2008, 4, 30): datetime(2008, 5, 1),
98
+ },
99
+ )
100
+ )
101
+
102
+ offset_cases.append(
103
+ (
104
+ QuarterBegin(startingMonth=1, n=0),
105
+ {
106
+ datetime(2008, 1, 1): datetime(2008, 1, 1),
107
+ datetime(2008, 12, 1): datetime(2009, 1, 1),
108
+ datetime(2008, 1, 1): datetime(2008, 1, 1),
109
+ datetime(2008, 2, 15): datetime(2008, 4, 1),
110
+ datetime(2008, 2, 29): datetime(2008, 4, 1),
111
+ datetime(2008, 3, 15): datetime(2008, 4, 1),
112
+ datetime(2008, 3, 31): datetime(2008, 4, 1),
113
+ datetime(2008, 4, 15): datetime(2008, 7, 1),
114
+ datetime(2008, 4, 30): datetime(2008, 7, 1),
115
+ },
116
+ )
117
+ )
118
+
119
+ offset_cases.append(
120
+ (
121
+ QuarterBegin(startingMonth=1, n=-1),
122
+ {
123
+ datetime(2008, 1, 1): datetime(2007, 10, 1),
124
+ datetime(2008, 1, 31): datetime(2008, 1, 1),
125
+ datetime(2008, 2, 15): datetime(2008, 1, 1),
126
+ datetime(2008, 2, 29): datetime(2008, 1, 1),
127
+ datetime(2008, 3, 15): datetime(2008, 1, 1),
128
+ datetime(2008, 3, 31): datetime(2008, 1, 1),
129
+ datetime(2008, 4, 15): datetime(2008, 4, 1),
130
+ datetime(2008, 4, 30): datetime(2008, 4, 1),
131
+ datetime(2008, 7, 1): datetime(2008, 4, 1),
132
+ },
133
+ )
134
+ )
135
+
136
+ offset_cases.append(
137
+ (
138
+ QuarterBegin(startingMonth=1, n=2),
139
+ {
140
+ datetime(2008, 1, 1): datetime(2008, 7, 1),
141
+ datetime(2008, 2, 15): datetime(2008, 7, 1),
142
+ datetime(2008, 2, 29): datetime(2008, 7, 1),
143
+ datetime(2008, 3, 15): datetime(2008, 7, 1),
144
+ datetime(2008, 3, 31): datetime(2008, 7, 1),
145
+ datetime(2008, 4, 15): datetime(2008, 10, 1),
146
+ datetime(2008, 4, 1): datetime(2008, 10, 1),
147
+ },
148
+ )
149
+ )
150
+
151
+ @pytest.mark.parametrize("case", offset_cases)
152
+ def test_offset(self, case):
153
+ offset, cases = case
154
+ for base, expected in cases.items():
155
+ assert_offset_equal(offset, base, expected)
156
+
157
+
158
+ class TestQuarterEnd:
159
+ def test_repr(self):
160
+ expected = "<QuarterEnd: startingMonth=3>"
161
+ assert repr(QuarterEnd()) == expected
162
+ expected = "<QuarterEnd: startingMonth=3>"
163
+ assert repr(QuarterEnd(startingMonth=3)) == expected
164
+ expected = "<QuarterEnd: startingMonth=1>"
165
+ assert repr(QuarterEnd(startingMonth=1)) == expected
166
+
167
+ def test_is_anchored(self):
168
+ msg = "QuarterEnd.is_anchored is deprecated "
169
+
170
+ with tm.assert_produces_warning(FutureWarning, match=msg):
171
+ assert QuarterEnd(startingMonth=1).is_anchored()
172
+ assert QuarterEnd().is_anchored()
173
+ assert not QuarterEnd(2, startingMonth=1).is_anchored()
174
+
175
+ def test_offset_corner_case(self):
176
+ # corner
177
+ offset = QuarterEnd(n=-1, startingMonth=1)
178
+ assert datetime(2010, 2, 1) + offset == datetime(2010, 1, 31)
179
+
180
+ offset_cases = []
181
+ offset_cases.append(
182
+ (
183
+ QuarterEnd(startingMonth=1),
184
+ {
185
+ datetime(2008, 1, 1): datetime(2008, 1, 31),
186
+ datetime(2008, 1, 31): datetime(2008, 4, 30),
187
+ datetime(2008, 2, 15): datetime(2008, 4, 30),
188
+ datetime(2008, 2, 29): datetime(2008, 4, 30),
189
+ datetime(2008, 3, 15): datetime(2008, 4, 30),
190
+ datetime(2008, 3, 31): datetime(2008, 4, 30),
191
+ datetime(2008, 4, 15): datetime(2008, 4, 30),
192
+ datetime(2008, 4, 30): datetime(2008, 7, 31),
193
+ },
194
+ )
195
+ )
196
+
197
+ offset_cases.append(
198
+ (
199
+ QuarterEnd(startingMonth=2),
200
+ {
201
+ datetime(2008, 1, 1): datetime(2008, 2, 29),
202
+ datetime(2008, 1, 31): datetime(2008, 2, 29),
203
+ datetime(2008, 2, 15): datetime(2008, 2, 29),
204
+ datetime(2008, 2, 29): datetime(2008, 5, 31),
205
+ datetime(2008, 3, 15): datetime(2008, 5, 31),
206
+ datetime(2008, 3, 31): datetime(2008, 5, 31),
207
+ datetime(2008, 4, 15): datetime(2008, 5, 31),
208
+ datetime(2008, 4, 30): datetime(2008, 5, 31),
209
+ },
210
+ )
211
+ )
212
+
213
+ offset_cases.append(
214
+ (
215
+ QuarterEnd(startingMonth=1, n=0),
216
+ {
217
+ datetime(2008, 1, 1): datetime(2008, 1, 31),
218
+ datetime(2008, 1, 31): datetime(2008, 1, 31),
219
+ datetime(2008, 2, 15): datetime(2008, 4, 30),
220
+ datetime(2008, 2, 29): datetime(2008, 4, 30),
221
+ datetime(2008, 3, 15): datetime(2008, 4, 30),
222
+ datetime(2008, 3, 31): datetime(2008, 4, 30),
223
+ datetime(2008, 4, 15): datetime(2008, 4, 30),
224
+ datetime(2008, 4, 30): datetime(2008, 4, 30),
225
+ },
226
+ )
227
+ )
228
+
229
+ offset_cases.append(
230
+ (
231
+ QuarterEnd(startingMonth=1, n=-1),
232
+ {
233
+ datetime(2008, 1, 1): datetime(2007, 10, 31),
234
+ datetime(2008, 1, 31): datetime(2007, 10, 31),
235
+ datetime(2008, 2, 15): datetime(2008, 1, 31),
236
+ datetime(2008, 2, 29): datetime(2008, 1, 31),
237
+ datetime(2008, 3, 15): datetime(2008, 1, 31),
238
+ datetime(2008, 3, 31): datetime(2008, 1, 31),
239
+ datetime(2008, 4, 15): datetime(2008, 1, 31),
240
+ datetime(2008, 4, 30): datetime(2008, 1, 31),
241
+ datetime(2008, 7, 1): datetime(2008, 4, 30),
242
+ },
243
+ )
244
+ )
245
+
246
+ offset_cases.append(
247
+ (
248
+ QuarterEnd(startingMonth=1, n=2),
249
+ {
250
+ datetime(2008, 1, 31): datetime(2008, 7, 31),
251
+ datetime(2008, 2, 15): datetime(2008, 7, 31),
252
+ datetime(2008, 2, 29): datetime(2008, 7, 31),
253
+ datetime(2008, 3, 15): datetime(2008, 7, 31),
254
+ datetime(2008, 3, 31): datetime(2008, 7, 31),
255
+ datetime(2008, 4, 15): datetime(2008, 7, 31),
256
+ datetime(2008, 4, 30): datetime(2008, 10, 31),
257
+ },
258
+ )
259
+ )
260
+
261
+ @pytest.mark.parametrize("case", offset_cases)
262
+ def test_offset(self, case):
263
+ offset, cases = case
264
+ for base, expected in cases.items():
265
+ assert_offset_equal(offset, base, expected)
266
+
267
+ on_offset_cases = [
268
+ (QuarterEnd(1, startingMonth=1), datetime(2008, 1, 31), True),
269
+ (QuarterEnd(1, startingMonth=1), datetime(2007, 12, 31), False),
270
+ (QuarterEnd(1, startingMonth=1), datetime(2008, 2, 29), False),
271
+ (QuarterEnd(1, startingMonth=1), datetime(2007, 3, 30), False),
272
+ (QuarterEnd(1, startingMonth=1), datetime(2007, 3, 31), False),
273
+ (QuarterEnd(1, startingMonth=1), datetime(2008, 4, 30), True),
274
+ (QuarterEnd(1, startingMonth=1), datetime(2008, 5, 30), False),
275
+ (QuarterEnd(1, startingMonth=1), datetime(2008, 5, 31), False),
276
+ (QuarterEnd(1, startingMonth=1), datetime(2007, 6, 29), False),
277
+ (QuarterEnd(1, startingMonth=1), datetime(2007, 6, 30), False),
278
+ (QuarterEnd(1, startingMonth=2), datetime(2008, 1, 31), False),
279
+ (QuarterEnd(1, startingMonth=2), datetime(2007, 12, 31), False),
280
+ (QuarterEnd(1, startingMonth=2), datetime(2008, 2, 29), True),
281
+ (QuarterEnd(1, startingMonth=2), datetime(2007, 3, 30), False),
282
+ (QuarterEnd(1, startingMonth=2), datetime(2007, 3, 31), False),
283
+ (QuarterEnd(1, startingMonth=2), datetime(2008, 4, 30), False),
284
+ (QuarterEnd(1, startingMonth=2), datetime(2008, 5, 30), False),
285
+ (QuarterEnd(1, startingMonth=2), datetime(2008, 5, 31), True),
286
+ (QuarterEnd(1, startingMonth=2), datetime(2007, 6, 29), False),
287
+ (QuarterEnd(1, startingMonth=2), datetime(2007, 6, 30), False),
288
+ (QuarterEnd(1, startingMonth=3), datetime(2008, 1, 31), False),
289
+ (QuarterEnd(1, startingMonth=3), datetime(2007, 12, 31), True),
290
+ (QuarterEnd(1, startingMonth=3), datetime(2008, 2, 29), False),
291
+ (QuarterEnd(1, startingMonth=3), datetime(2007, 3, 30), False),
292
+ (QuarterEnd(1, startingMonth=3), datetime(2007, 3, 31), True),
293
+ (QuarterEnd(1, startingMonth=3), datetime(2008, 4, 30), False),
294
+ (QuarterEnd(1, startingMonth=3), datetime(2008, 5, 30), False),
295
+ (QuarterEnd(1, startingMonth=3), datetime(2008, 5, 31), False),
296
+ (QuarterEnd(1, startingMonth=3), datetime(2007, 6, 29), False),
297
+ (QuarterEnd(1, startingMonth=3), datetime(2007, 6, 30), True),
298
+ ]
299
+
300
+ @pytest.mark.parametrize("case", on_offset_cases)
301
+ def test_is_on_offset(self, case):
302
+ offset, dt, expected = case
303
+ assert_is_on_offset(offset, dt, expected)
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tseries/offsets/test_ticks.py ADDED
@@ -0,0 +1,405 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Tests for offsets.Tick and subclasses
3
+ """
4
+ from datetime import (
5
+ datetime,
6
+ timedelta,
7
+ )
8
+
9
+ from hypothesis import (
10
+ assume,
11
+ example,
12
+ given,
13
+ )
14
+ import numpy as np
15
+ import pytest
16
+
17
+ from pandas._libs.tslibs.offsets import delta_to_tick
18
+ from pandas.errors import OutOfBoundsTimedelta
19
+
20
+ from pandas import (
21
+ Timedelta,
22
+ Timestamp,
23
+ )
24
+ import pandas._testing as tm
25
+ from pandas._testing._hypothesis import INT_NEG_999_TO_POS_999
26
+ from pandas.tests.tseries.offsets.common import assert_offset_equal
27
+
28
+ from pandas.tseries import offsets
29
+ from pandas.tseries.offsets import (
30
+ Hour,
31
+ Micro,
32
+ Milli,
33
+ Minute,
34
+ Nano,
35
+ Second,
36
+ )
37
+
38
+ # ---------------------------------------------------------------------
39
+ # Test Helpers
40
+
41
+ tick_classes = [Hour, Minute, Second, Milli, Micro, Nano]
42
+
43
+
44
+ # ---------------------------------------------------------------------
45
+
46
+
47
+ def test_apply_ticks():
48
+ result = offsets.Hour(3) + offsets.Hour(4)
49
+ exp = offsets.Hour(7)
50
+ assert result == exp
51
+
52
+
53
+ def test_delta_to_tick():
54
+ delta = timedelta(3)
55
+
56
+ tick = delta_to_tick(delta)
57
+ assert tick == offsets.Day(3)
58
+
59
+ td = Timedelta(nanoseconds=5)
60
+ tick = delta_to_tick(td)
61
+ assert tick == Nano(5)
62
+
63
+
64
+ @pytest.mark.parametrize("cls", tick_classes)
65
+ @example(n=2, m=3)
66
+ @example(n=800, m=300)
67
+ @example(n=1000, m=5)
68
+ @given(n=INT_NEG_999_TO_POS_999, m=INT_NEG_999_TO_POS_999)
69
+ def test_tick_add_sub(cls, n, m):
70
+ # For all Tick subclasses and all integers n, m, we should have
71
+ # tick(n) + tick(m) == tick(n+m)
72
+ # tick(n) - tick(m) == tick(n-m)
73
+ left = cls(n)
74
+ right = cls(m)
75
+ expected = cls(n + m)
76
+
77
+ assert left + right == expected
78
+
79
+ expected = cls(n - m)
80
+ assert left - right == expected
81
+
82
+
83
+ @pytest.mark.arm_slow
84
+ @pytest.mark.parametrize("cls", tick_classes)
85
+ @example(n=2, m=3)
86
+ @given(n=INT_NEG_999_TO_POS_999, m=INT_NEG_999_TO_POS_999)
87
+ def test_tick_equality(cls, n, m):
88
+ assume(m != n)
89
+ # tick == tock iff tick.n == tock.n
90
+ left = cls(n)
91
+ right = cls(m)
92
+ assert left != right
93
+
94
+ right = cls(n)
95
+ assert left == right
96
+ assert not left != right
97
+
98
+ if n != 0:
99
+ assert cls(n) != cls(-n)
100
+
101
+
102
+ # ---------------------------------------------------------------------
103
+
104
+
105
+ def test_Hour():
106
+ assert_offset_equal(Hour(), datetime(2010, 1, 1), datetime(2010, 1, 1, 1))
107
+ assert_offset_equal(Hour(-1), datetime(2010, 1, 1, 1), datetime(2010, 1, 1))
108
+ assert_offset_equal(2 * Hour(), datetime(2010, 1, 1), datetime(2010, 1, 1, 2))
109
+ assert_offset_equal(-1 * Hour(), datetime(2010, 1, 1, 1), datetime(2010, 1, 1))
110
+
111
+ assert Hour(3) + Hour(2) == Hour(5)
112
+ assert Hour(3) - Hour(2) == Hour()
113
+
114
+ assert Hour(4) != Hour(1)
115
+
116
+
117
+ def test_Minute():
118
+ assert_offset_equal(Minute(), datetime(2010, 1, 1), datetime(2010, 1, 1, 0, 1))
119
+ assert_offset_equal(Minute(-1), datetime(2010, 1, 1, 0, 1), datetime(2010, 1, 1))
120
+ assert_offset_equal(2 * Minute(), datetime(2010, 1, 1), datetime(2010, 1, 1, 0, 2))
121
+ assert_offset_equal(-1 * Minute(), datetime(2010, 1, 1, 0, 1), datetime(2010, 1, 1))
122
+
123
+ assert Minute(3) + Minute(2) == Minute(5)
124
+ assert Minute(3) - Minute(2) == Minute()
125
+ assert Minute(5) != Minute()
126
+
127
+
128
+ def test_Second():
129
+ assert_offset_equal(Second(), datetime(2010, 1, 1), datetime(2010, 1, 1, 0, 0, 1))
130
+ assert_offset_equal(Second(-1), datetime(2010, 1, 1, 0, 0, 1), datetime(2010, 1, 1))
131
+ assert_offset_equal(
132
+ 2 * Second(), datetime(2010, 1, 1), datetime(2010, 1, 1, 0, 0, 2)
133
+ )
134
+ assert_offset_equal(
135
+ -1 * Second(), datetime(2010, 1, 1, 0, 0, 1), datetime(2010, 1, 1)
136
+ )
137
+
138
+ assert Second(3) + Second(2) == Second(5)
139
+ assert Second(3) - Second(2) == Second()
140
+
141
+
142
+ def test_Millisecond():
143
+ assert_offset_equal(
144
+ Milli(), datetime(2010, 1, 1), datetime(2010, 1, 1, 0, 0, 0, 1000)
145
+ )
146
+ assert_offset_equal(
147
+ Milli(-1), datetime(2010, 1, 1, 0, 0, 0, 1000), datetime(2010, 1, 1)
148
+ )
149
+ assert_offset_equal(
150
+ Milli(2), datetime(2010, 1, 1), datetime(2010, 1, 1, 0, 0, 0, 2000)
151
+ )
152
+ assert_offset_equal(
153
+ 2 * Milli(), datetime(2010, 1, 1), datetime(2010, 1, 1, 0, 0, 0, 2000)
154
+ )
155
+ assert_offset_equal(
156
+ -1 * Milli(), datetime(2010, 1, 1, 0, 0, 0, 1000), datetime(2010, 1, 1)
157
+ )
158
+
159
+ assert Milli(3) + Milli(2) == Milli(5)
160
+ assert Milli(3) - Milli(2) == Milli()
161
+
162
+
163
+ def test_MillisecondTimestampArithmetic():
164
+ assert_offset_equal(
165
+ Milli(), Timestamp("2010-01-01"), Timestamp("2010-01-01 00:00:00.001")
166
+ )
167
+ assert_offset_equal(
168
+ Milli(-1), Timestamp("2010-01-01 00:00:00.001"), Timestamp("2010-01-01")
169
+ )
170
+
171
+
172
+ def test_Microsecond():
173
+ assert_offset_equal(Micro(), datetime(2010, 1, 1), datetime(2010, 1, 1, 0, 0, 0, 1))
174
+ assert_offset_equal(
175
+ Micro(-1), datetime(2010, 1, 1, 0, 0, 0, 1), datetime(2010, 1, 1)
176
+ )
177
+
178
+ assert_offset_equal(
179
+ 2 * Micro(), datetime(2010, 1, 1), datetime(2010, 1, 1, 0, 0, 0, 2)
180
+ )
181
+ assert_offset_equal(
182
+ -1 * Micro(), datetime(2010, 1, 1, 0, 0, 0, 1), datetime(2010, 1, 1)
183
+ )
184
+
185
+ assert Micro(3) + Micro(2) == Micro(5)
186
+ assert Micro(3) - Micro(2) == Micro()
187
+
188
+
189
+ def test_NanosecondGeneric():
190
+ timestamp = Timestamp(datetime(2010, 1, 1))
191
+ assert timestamp.nanosecond == 0
192
+
193
+ result = timestamp + Nano(10)
194
+ assert result.nanosecond == 10
195
+
196
+ reverse_result = Nano(10) + timestamp
197
+ assert reverse_result.nanosecond == 10
198
+
199
+
200
+ def test_Nanosecond():
201
+ timestamp = Timestamp(datetime(2010, 1, 1))
202
+ assert_offset_equal(Nano(), timestamp, timestamp + np.timedelta64(1, "ns"))
203
+ assert_offset_equal(Nano(-1), timestamp + np.timedelta64(1, "ns"), timestamp)
204
+ assert_offset_equal(2 * Nano(), timestamp, timestamp + np.timedelta64(2, "ns"))
205
+ assert_offset_equal(-1 * Nano(), timestamp + np.timedelta64(1, "ns"), timestamp)
206
+
207
+ assert Nano(3) + Nano(2) == Nano(5)
208
+ assert Nano(3) - Nano(2) == Nano()
209
+
210
+ # GH9284
211
+ assert Nano(1) + Nano(10) == Nano(11)
212
+ assert Nano(5) + Micro(1) == Nano(1005)
213
+ assert Micro(5) + Nano(1) == Nano(5001)
214
+
215
+
216
+ @pytest.mark.parametrize(
217
+ "kls, expected",
218
+ [
219
+ (Hour, Timedelta(hours=5)),
220
+ (Minute, Timedelta(hours=2, minutes=3)),
221
+ (Second, Timedelta(hours=2, seconds=3)),
222
+ (Milli, Timedelta(hours=2, milliseconds=3)),
223
+ (Micro, Timedelta(hours=2, microseconds=3)),
224
+ (Nano, Timedelta(hours=2, nanoseconds=3)),
225
+ ],
226
+ )
227
+ def test_tick_addition(kls, expected):
228
+ offset = kls(3)
229
+ td = Timedelta(hours=2)
230
+
231
+ for other in [td, td.to_pytimedelta(), td.to_timedelta64()]:
232
+ result = offset + other
233
+ assert isinstance(result, Timedelta)
234
+ assert result == expected
235
+
236
+ result = other + offset
237
+ assert isinstance(result, Timedelta)
238
+ assert result == expected
239
+
240
+
241
+ def test_tick_delta_overflow():
242
+ # GH#55503 raise OutOfBoundsTimedelta, not OverflowError
243
+ tick = offsets.Day(10**9)
244
+ msg = "Cannot cast 1000000000 days 00:00:00 to unit='ns' without overflow"
245
+ depr_msg = "Day.delta is deprecated"
246
+ with pytest.raises(OutOfBoundsTimedelta, match=msg):
247
+ with tm.assert_produces_warning(FutureWarning, match=depr_msg):
248
+ tick.delta
249
+
250
+
251
+ @pytest.mark.parametrize("cls", tick_classes)
252
+ def test_tick_division(cls):
253
+ off = cls(10)
254
+
255
+ assert off / cls(5) == 2
256
+ assert off / 2 == cls(5)
257
+ assert off / 2.0 == cls(5)
258
+
259
+ assert off / off._as_pd_timedelta == 1
260
+ assert off / off._as_pd_timedelta.to_timedelta64() == 1
261
+
262
+ assert off / Nano(1) == off._as_pd_timedelta / Nano(1)._as_pd_timedelta
263
+
264
+ if cls is not Nano:
265
+ # A case where we end up with a smaller class
266
+ result = off / 1000
267
+ assert isinstance(result, offsets.Tick)
268
+ assert not isinstance(result, cls)
269
+ assert result._as_pd_timedelta == off._as_pd_timedelta / 1000
270
+
271
+ if cls._nanos_inc < Timedelta(seconds=1)._value:
272
+ # Case where we end up with a bigger class
273
+ result = off / 0.001
274
+ assert isinstance(result, offsets.Tick)
275
+ assert not isinstance(result, cls)
276
+ assert result._as_pd_timedelta == off._as_pd_timedelta / 0.001
277
+
278
+
279
+ def test_tick_mul_float():
280
+ off = Micro(2)
281
+
282
+ # Case where we retain type
283
+ result = off * 1.5
284
+ expected = Micro(3)
285
+ assert result == expected
286
+ assert isinstance(result, Micro)
287
+
288
+ # Case where we bump up to the next type
289
+ result = off * 1.25
290
+ expected = Nano(2500)
291
+ assert result == expected
292
+ assert isinstance(result, Nano)
293
+
294
+
295
+ @pytest.mark.parametrize("cls", tick_classes)
296
+ def test_tick_rdiv(cls):
297
+ off = cls(10)
298
+ delta = off._as_pd_timedelta
299
+ td64 = delta.to_timedelta64()
300
+ instance__type = ".".join([cls.__module__, cls.__name__])
301
+ msg = (
302
+ "unsupported operand type\\(s\\) for \\/: 'int'|'float' and "
303
+ f"'{instance__type}'"
304
+ )
305
+
306
+ with pytest.raises(TypeError, match=msg):
307
+ 2 / off
308
+ with pytest.raises(TypeError, match=msg):
309
+ 2.0 / off
310
+
311
+ assert (td64 * 2.5) / off == 2.5
312
+
313
+ if cls is not Nano:
314
+ # skip pytimedelta for Nano since it gets dropped
315
+ assert (delta.to_pytimedelta() * 2) / off == 2
316
+
317
+ result = np.array([2 * td64, td64]) / off
318
+ expected = np.array([2.0, 1.0])
319
+ tm.assert_numpy_array_equal(result, expected)
320
+
321
+
322
+ @pytest.mark.parametrize("cls1", tick_classes)
323
+ @pytest.mark.parametrize("cls2", tick_classes)
324
+ def test_tick_zero(cls1, cls2):
325
+ assert cls1(0) == cls2(0)
326
+ assert cls1(0) + cls2(0) == cls1(0)
327
+
328
+ if cls1 is not Nano:
329
+ assert cls1(2) + cls2(0) == cls1(2)
330
+
331
+ if cls1 is Nano:
332
+ assert cls1(2) + Nano(0) == cls1(2)
333
+
334
+
335
+ @pytest.mark.parametrize("cls", tick_classes)
336
+ def test_tick_equalities(cls):
337
+ assert cls() == cls(1)
338
+
339
+
340
+ @pytest.mark.parametrize("cls", tick_classes)
341
+ def test_tick_offset(cls):
342
+ msg = f"{cls.__name__}.is_anchored is deprecated "
343
+
344
+ with tm.assert_produces_warning(FutureWarning, match=msg):
345
+ assert not cls().is_anchored()
346
+
347
+
348
+ @pytest.mark.parametrize("cls", tick_classes)
349
+ def test_compare_ticks(cls):
350
+ three = cls(3)
351
+ four = cls(4)
352
+
353
+ assert three < cls(4)
354
+ assert cls(3) < four
355
+ assert four > cls(3)
356
+ assert cls(4) > three
357
+ assert cls(3) == cls(3)
358
+ assert cls(3) != cls(4)
359
+
360
+
361
+ @pytest.mark.parametrize("cls", tick_classes)
362
+ def test_compare_ticks_to_strs(cls):
363
+ # GH#23524
364
+ off = cls(19)
365
+
366
+ # These tests should work with any strings, but we particularly are
367
+ # interested in "infer" as that comparison is convenient to make in
368
+ # Datetime/Timedelta Array/Index constructors
369
+ assert not off == "infer"
370
+ assert not "foo" == off
371
+
372
+ instance_type = ".".join([cls.__module__, cls.__name__])
373
+ msg = (
374
+ "'<'|'<='|'>'|'>=' not supported between instances of "
375
+ f"'str' and '{instance_type}'|'{instance_type}' and 'str'"
376
+ )
377
+
378
+ for left, right in [("infer", off), (off, "infer")]:
379
+ with pytest.raises(TypeError, match=msg):
380
+ left < right
381
+ with pytest.raises(TypeError, match=msg):
382
+ left <= right
383
+ with pytest.raises(TypeError, match=msg):
384
+ left > right
385
+ with pytest.raises(TypeError, match=msg):
386
+ left >= right
387
+
388
+
389
+ @pytest.mark.parametrize("cls", tick_classes)
390
+ def test_compare_ticks_to_timedeltalike(cls):
391
+ off = cls(19)
392
+
393
+ td = off._as_pd_timedelta
394
+
395
+ others = [td, td.to_timedelta64()]
396
+ if cls is not Nano:
397
+ others.append(td.to_pytimedelta())
398
+
399
+ for other in others:
400
+ assert off == other
401
+ assert not off != other
402
+ assert not off < other
403
+ assert not off > other
404
+ assert off <= other
405
+ assert off >= other
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tseries/offsets/test_week.py ADDED
@@ -0,0 +1,351 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Tests for the following offsets:
3
+ - Week
4
+ - WeekOfMonth
5
+ - LastWeekOfMonth
6
+ """
7
+ from __future__ import annotations
8
+
9
+ from datetime import (
10
+ datetime,
11
+ timedelta,
12
+ )
13
+
14
+ import pytest
15
+
16
+ from pandas._libs.tslibs import Timestamp
17
+ from pandas._libs.tslibs.offsets import (
18
+ Day,
19
+ LastWeekOfMonth,
20
+ Week,
21
+ WeekOfMonth,
22
+ )
23
+
24
+ import pandas._testing as tm
25
+ from pandas.tests.tseries.offsets.common import (
26
+ WeekDay,
27
+ assert_is_on_offset,
28
+ assert_offset_equal,
29
+ )
30
+
31
+
32
+ class TestWeek:
33
+ def test_repr(self):
34
+ assert repr(Week(weekday=0)) == "<Week: weekday=0>"
35
+ assert repr(Week(n=-1, weekday=0)) == "<-1 * Week: weekday=0>"
36
+ assert repr(Week(n=-2, weekday=0)) == "<-2 * Weeks: weekday=0>"
37
+
38
+ def test_corner(self):
39
+ with pytest.raises(ValueError, match="Day must be"):
40
+ Week(weekday=7)
41
+
42
+ with pytest.raises(ValueError, match="Day must be"):
43
+ Week(weekday=-1)
44
+
45
+ def test_is_anchored(self):
46
+ msg = "Week.is_anchored is deprecated "
47
+
48
+ with tm.assert_produces_warning(FutureWarning, match=msg):
49
+ assert Week(weekday=0).is_anchored()
50
+ assert not Week().is_anchored()
51
+ assert not Week(2, weekday=2).is_anchored()
52
+ assert not Week(2).is_anchored()
53
+
54
+ offset_cases = []
55
+ # not business week
56
+ offset_cases.append(
57
+ (
58
+ Week(),
59
+ {
60
+ datetime(2008, 1, 1): datetime(2008, 1, 8),
61
+ datetime(2008, 1, 4): datetime(2008, 1, 11),
62
+ datetime(2008, 1, 5): datetime(2008, 1, 12),
63
+ datetime(2008, 1, 6): datetime(2008, 1, 13),
64
+ datetime(2008, 1, 7): datetime(2008, 1, 14),
65
+ },
66
+ )
67
+ )
68
+
69
+ # Mon
70
+ offset_cases.append(
71
+ (
72
+ Week(weekday=0),
73
+ {
74
+ datetime(2007, 12, 31): datetime(2008, 1, 7),
75
+ datetime(2008, 1, 4): datetime(2008, 1, 7),
76
+ datetime(2008, 1, 5): datetime(2008, 1, 7),
77
+ datetime(2008, 1, 6): datetime(2008, 1, 7),
78
+ datetime(2008, 1, 7): datetime(2008, 1, 14),
79
+ },
80
+ )
81
+ )
82
+
83
+ # n=0 -> roll forward. Mon
84
+ offset_cases.append(
85
+ (
86
+ Week(0, weekday=0),
87
+ {
88
+ datetime(2007, 12, 31): datetime(2007, 12, 31),
89
+ datetime(2008, 1, 4): datetime(2008, 1, 7),
90
+ datetime(2008, 1, 5): datetime(2008, 1, 7),
91
+ datetime(2008, 1, 6): datetime(2008, 1, 7),
92
+ datetime(2008, 1, 7): datetime(2008, 1, 7),
93
+ },
94
+ )
95
+ )
96
+
97
+ # n=0 -> roll forward. Mon
98
+ offset_cases.append(
99
+ (
100
+ Week(-2, weekday=1),
101
+ {
102
+ datetime(2010, 4, 6): datetime(2010, 3, 23),
103
+ datetime(2010, 4, 8): datetime(2010, 3, 30),
104
+ datetime(2010, 4, 5): datetime(2010, 3, 23),
105
+ },
106
+ )
107
+ )
108
+
109
+ @pytest.mark.parametrize("case", offset_cases)
110
+ def test_offset(self, case):
111
+ offset, cases = case
112
+ for base, expected in cases.items():
113
+ assert_offset_equal(offset, base, expected)
114
+
115
+ @pytest.mark.parametrize("weekday", range(7))
116
+ def test_is_on_offset(self, weekday):
117
+ offset = Week(weekday=weekday)
118
+
119
+ for day in range(1, 8):
120
+ date = datetime(2008, 1, day)
121
+ expected = day % 7 == weekday
122
+ assert_is_on_offset(offset, date, expected)
123
+
124
+ @pytest.mark.parametrize(
125
+ "n,date",
126
+ [
127
+ (2, "1862-01-13 09:03:34.873477378+0210"),
128
+ (-2, "1856-10-24 16:18:36.556360110-0717"),
129
+ ],
130
+ )
131
+ def test_is_on_offset_weekday_none(self, n, date):
132
+ # GH 18510 Week with weekday = None, normalize = False
133
+ # should always be is_on_offset
134
+ offset = Week(n=n, weekday=None)
135
+ ts = Timestamp(date, tz="Africa/Lusaka")
136
+ fast = offset.is_on_offset(ts)
137
+ slow = (ts + offset) - offset == ts
138
+ assert fast == slow
139
+
140
+ def test_week_add_invalid(self):
141
+ # Week with weekday should raise TypeError and _not_ AttributeError
142
+ # when adding invalid offset
143
+ offset = Week(weekday=1)
144
+ other = Day()
145
+ with pytest.raises(TypeError, match="Cannot add"):
146
+ offset + other
147
+
148
+
149
+ class TestWeekOfMonth:
150
+ def test_constructor(self):
151
+ with pytest.raises(ValueError, match="^Week"):
152
+ WeekOfMonth(n=1, week=4, weekday=0)
153
+
154
+ with pytest.raises(ValueError, match="^Week"):
155
+ WeekOfMonth(n=1, week=-1, weekday=0)
156
+
157
+ with pytest.raises(ValueError, match="^Day"):
158
+ WeekOfMonth(n=1, week=0, weekday=-1)
159
+
160
+ with pytest.raises(ValueError, match="^Day"):
161
+ WeekOfMonth(n=1, week=0, weekday=-7)
162
+
163
+ def test_repr(self):
164
+ assert (
165
+ repr(WeekOfMonth(weekday=1, week=2)) == "<WeekOfMonth: week=2, weekday=1>"
166
+ )
167
+
168
+ def test_offset(self):
169
+ date1 = datetime(2011, 1, 4) # 1st Tuesday of Month
170
+ date2 = datetime(2011, 1, 11) # 2nd Tuesday of Month
171
+ date3 = datetime(2011, 1, 18) # 3rd Tuesday of Month
172
+ date4 = datetime(2011, 1, 25) # 4th Tuesday of Month
173
+
174
+ # see for loop for structure
175
+ test_cases = [
176
+ (-2, 2, 1, date1, datetime(2010, 11, 16)),
177
+ (-2, 2, 1, date2, datetime(2010, 11, 16)),
178
+ (-2, 2, 1, date3, datetime(2010, 11, 16)),
179
+ (-2, 2, 1, date4, datetime(2010, 12, 21)),
180
+ (-1, 2, 1, date1, datetime(2010, 12, 21)),
181
+ (-1, 2, 1, date2, datetime(2010, 12, 21)),
182
+ (-1, 2, 1, date3, datetime(2010, 12, 21)),
183
+ (-1, 2, 1, date4, datetime(2011, 1, 18)),
184
+ (0, 0, 1, date1, datetime(2011, 1, 4)),
185
+ (0, 0, 1, date2, datetime(2011, 2, 1)),
186
+ (0, 0, 1, date3, datetime(2011, 2, 1)),
187
+ (0, 0, 1, date4, datetime(2011, 2, 1)),
188
+ (0, 1, 1, date1, datetime(2011, 1, 11)),
189
+ (0, 1, 1, date2, datetime(2011, 1, 11)),
190
+ (0, 1, 1, date3, datetime(2011, 2, 8)),
191
+ (0, 1, 1, date4, datetime(2011, 2, 8)),
192
+ (0, 0, 1, date1, datetime(2011, 1, 4)),
193
+ (0, 1, 1, date2, datetime(2011, 1, 11)),
194
+ (0, 2, 1, date3, datetime(2011, 1, 18)),
195
+ (0, 3, 1, date4, datetime(2011, 1, 25)),
196
+ (1, 0, 0, date1, datetime(2011, 2, 7)),
197
+ (1, 0, 0, date2, datetime(2011, 2, 7)),
198
+ (1, 0, 0, date3, datetime(2011, 2, 7)),
199
+ (1, 0, 0, date4, datetime(2011, 2, 7)),
200
+ (1, 0, 1, date1, datetime(2011, 2, 1)),
201
+ (1, 0, 1, date2, datetime(2011, 2, 1)),
202
+ (1, 0, 1, date3, datetime(2011, 2, 1)),
203
+ (1, 0, 1, date4, datetime(2011, 2, 1)),
204
+ (1, 0, 2, date1, datetime(2011, 1, 5)),
205
+ (1, 0, 2, date2, datetime(2011, 2, 2)),
206
+ (1, 0, 2, date3, datetime(2011, 2, 2)),
207
+ (1, 0, 2, date4, datetime(2011, 2, 2)),
208
+ (1, 2, 1, date1, datetime(2011, 1, 18)),
209
+ (1, 2, 1, date2, datetime(2011, 1, 18)),
210
+ (1, 2, 1, date3, datetime(2011, 2, 15)),
211
+ (1, 2, 1, date4, datetime(2011, 2, 15)),
212
+ (2, 2, 1, date1, datetime(2011, 2, 15)),
213
+ (2, 2, 1, date2, datetime(2011, 2, 15)),
214
+ (2, 2, 1, date3, datetime(2011, 3, 15)),
215
+ (2, 2, 1, date4, datetime(2011, 3, 15)),
216
+ ]
217
+
218
+ for n, week, weekday, dt, expected in test_cases:
219
+ offset = WeekOfMonth(n, week=week, weekday=weekday)
220
+ assert_offset_equal(offset, dt, expected)
221
+
222
+ # try subtracting
223
+ result = datetime(2011, 2, 1) - WeekOfMonth(week=1, weekday=2)
224
+ assert result == datetime(2011, 1, 12)
225
+
226
+ result = datetime(2011, 2, 3) - WeekOfMonth(week=0, weekday=2)
227
+ assert result == datetime(2011, 2, 2)
228
+
229
+ on_offset_cases = [
230
+ (0, 0, datetime(2011, 2, 7), True),
231
+ (0, 0, datetime(2011, 2, 6), False),
232
+ (0, 0, datetime(2011, 2, 14), False),
233
+ (1, 0, datetime(2011, 2, 14), True),
234
+ (0, 1, datetime(2011, 2, 1), True),
235
+ (0, 1, datetime(2011, 2, 8), False),
236
+ ]
237
+
238
+ @pytest.mark.parametrize("case", on_offset_cases)
239
+ def test_is_on_offset(self, case):
240
+ week, weekday, dt, expected = case
241
+ offset = WeekOfMonth(week=week, weekday=weekday)
242
+ assert offset.is_on_offset(dt) == expected
243
+
244
+ @pytest.mark.parametrize(
245
+ "n,week,date,tz",
246
+ [
247
+ (2, 2, "1916-05-15 01:14:49.583410462+0422", "Asia/Qyzylorda"),
248
+ (-3, 1, "1980-12-08 03:38:52.878321185+0500", "Asia/Oral"),
249
+ ],
250
+ )
251
+ def test_is_on_offset_nanoseconds(self, n, week, date, tz):
252
+ # GH 18864
253
+ # Make sure that nanoseconds don't trip up is_on_offset (and with it apply)
254
+ offset = WeekOfMonth(n=n, week=week, weekday=0)
255
+ ts = Timestamp(date, tz=tz)
256
+ fast = offset.is_on_offset(ts)
257
+ slow = (ts + offset) - offset == ts
258
+ assert fast == slow
259
+
260
+
261
+ class TestLastWeekOfMonth:
262
+ def test_constructor(self):
263
+ with pytest.raises(ValueError, match="^N cannot be 0"):
264
+ LastWeekOfMonth(n=0, weekday=1)
265
+
266
+ with pytest.raises(ValueError, match="^Day"):
267
+ LastWeekOfMonth(n=1, weekday=-1)
268
+
269
+ with pytest.raises(ValueError, match="^Day"):
270
+ LastWeekOfMonth(n=1, weekday=7)
271
+
272
+ def test_offset(self):
273
+ # Saturday
274
+ last_sat = datetime(2013, 8, 31)
275
+ next_sat = datetime(2013, 9, 28)
276
+ offset_sat = LastWeekOfMonth(n=1, weekday=5)
277
+
278
+ one_day_before = last_sat + timedelta(days=-1)
279
+ assert one_day_before + offset_sat == last_sat
280
+
281
+ one_day_after = last_sat + timedelta(days=+1)
282
+ assert one_day_after + offset_sat == next_sat
283
+
284
+ # Test On that day
285
+ assert last_sat + offset_sat == next_sat
286
+
287
+ # Thursday
288
+
289
+ offset_thur = LastWeekOfMonth(n=1, weekday=3)
290
+ last_thurs = datetime(2013, 1, 31)
291
+ next_thurs = datetime(2013, 2, 28)
292
+
293
+ one_day_before = last_thurs + timedelta(days=-1)
294
+ assert one_day_before + offset_thur == last_thurs
295
+
296
+ one_day_after = last_thurs + timedelta(days=+1)
297
+ assert one_day_after + offset_thur == next_thurs
298
+
299
+ # Test on that day
300
+ assert last_thurs + offset_thur == next_thurs
301
+
302
+ three_before = last_thurs + timedelta(days=-3)
303
+ assert three_before + offset_thur == last_thurs
304
+
305
+ two_after = last_thurs + timedelta(days=+2)
306
+ assert two_after + offset_thur == next_thurs
307
+
308
+ offset_sunday = LastWeekOfMonth(n=1, weekday=WeekDay.SUN)
309
+ assert datetime(2013, 7, 31) + offset_sunday == datetime(2013, 8, 25)
310
+
311
+ on_offset_cases = [
312
+ (WeekDay.SUN, datetime(2013, 1, 27), True),
313
+ (WeekDay.SAT, datetime(2013, 3, 30), True),
314
+ (WeekDay.MON, datetime(2013, 2, 18), False), # Not the last Mon
315
+ (WeekDay.SUN, datetime(2013, 2, 25), False), # Not a SUN
316
+ (WeekDay.MON, datetime(2013, 2, 25), True),
317
+ (WeekDay.SAT, datetime(2013, 11, 30), True),
318
+ (WeekDay.SAT, datetime(2006, 8, 26), True),
319
+ (WeekDay.SAT, datetime(2007, 8, 25), True),
320
+ (WeekDay.SAT, datetime(2008, 8, 30), True),
321
+ (WeekDay.SAT, datetime(2009, 8, 29), True),
322
+ (WeekDay.SAT, datetime(2010, 8, 28), True),
323
+ (WeekDay.SAT, datetime(2011, 8, 27), True),
324
+ (WeekDay.SAT, datetime(2019, 8, 31), True),
325
+ ]
326
+
327
+ @pytest.mark.parametrize("case", on_offset_cases)
328
+ def test_is_on_offset(self, case):
329
+ weekday, dt, expected = case
330
+ offset = LastWeekOfMonth(weekday=weekday)
331
+ assert offset.is_on_offset(dt) == expected
332
+
333
+ @pytest.mark.parametrize(
334
+ "n,weekday,date,tz",
335
+ [
336
+ (4, 6, "1917-05-27 20:55:27.084284178+0200", "Europe/Warsaw"),
337
+ (-4, 5, "2005-08-27 05:01:42.799392561-0500", "America/Rainy_River"),
338
+ ],
339
+ )
340
+ def test_last_week_of_month_on_offset(self, n, weekday, date, tz):
341
+ # GH 19036, GH 18977 _adjust_dst was incorrect for LastWeekOfMonth
342
+ offset = LastWeekOfMonth(n=n, weekday=weekday)
343
+ ts = Timestamp(date, tz=tz)
344
+ slow = (ts + offset) - offset == ts
345
+ fast = offset.is_on_offset(ts)
346
+ assert fast == slow
347
+
348
+ def test_repr(self):
349
+ assert (
350
+ repr(LastWeekOfMonth(n=2, weekday=1)) == "<2 * LastWeekOfMonths: weekday=1>"
351
+ )
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tseries/offsets/test_year.py ADDED
@@ -0,0 +1,339 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Tests for the following offsets:
3
+ - YearBegin
4
+ - YearEnd
5
+ """
6
+ from __future__ import annotations
7
+
8
+ from datetime import datetime
9
+
10
+ import numpy as np
11
+ import pytest
12
+
13
+ from pandas import Timestamp
14
+ from pandas.tests.tseries.offsets.common import (
15
+ assert_is_on_offset,
16
+ assert_offset_equal,
17
+ )
18
+
19
+ from pandas.tseries.offsets import (
20
+ YearBegin,
21
+ YearEnd,
22
+ )
23
+
24
+
25
+ class TestYearBegin:
26
+ def test_misspecified(self):
27
+ with pytest.raises(ValueError, match="Month must go from 1 to 12"):
28
+ YearBegin(month=13)
29
+
30
+ offset_cases = []
31
+ offset_cases.append(
32
+ (
33
+ YearBegin(),
34
+ {
35
+ datetime(2008, 1, 1): datetime(2009, 1, 1),
36
+ datetime(2008, 6, 30): datetime(2009, 1, 1),
37
+ datetime(2008, 12, 31): datetime(2009, 1, 1),
38
+ datetime(2005, 12, 30): datetime(2006, 1, 1),
39
+ datetime(2005, 12, 31): datetime(2006, 1, 1),
40
+ },
41
+ )
42
+ )
43
+
44
+ offset_cases.append(
45
+ (
46
+ YearBegin(0),
47
+ {
48
+ datetime(2008, 1, 1): datetime(2008, 1, 1),
49
+ datetime(2008, 6, 30): datetime(2009, 1, 1),
50
+ datetime(2008, 12, 31): datetime(2009, 1, 1),
51
+ datetime(2005, 12, 30): datetime(2006, 1, 1),
52
+ datetime(2005, 12, 31): datetime(2006, 1, 1),
53
+ },
54
+ )
55
+ )
56
+
57
+ offset_cases.append(
58
+ (
59
+ YearBegin(3),
60
+ {
61
+ datetime(2008, 1, 1): datetime(2011, 1, 1),
62
+ datetime(2008, 6, 30): datetime(2011, 1, 1),
63
+ datetime(2008, 12, 31): datetime(2011, 1, 1),
64
+ datetime(2005, 12, 30): datetime(2008, 1, 1),
65
+ datetime(2005, 12, 31): datetime(2008, 1, 1),
66
+ },
67
+ )
68
+ )
69
+
70
+ offset_cases.append(
71
+ (
72
+ YearBegin(-1),
73
+ {
74
+ datetime(2007, 1, 1): datetime(2006, 1, 1),
75
+ datetime(2007, 1, 15): datetime(2007, 1, 1),
76
+ datetime(2008, 6, 30): datetime(2008, 1, 1),
77
+ datetime(2008, 12, 31): datetime(2008, 1, 1),
78
+ datetime(2006, 12, 29): datetime(2006, 1, 1),
79
+ datetime(2006, 12, 30): datetime(2006, 1, 1),
80
+ datetime(2007, 1, 1): datetime(2006, 1, 1),
81
+ },
82
+ )
83
+ )
84
+
85
+ offset_cases.append(
86
+ (
87
+ YearBegin(-2),
88
+ {
89
+ datetime(2007, 1, 1): datetime(2005, 1, 1),
90
+ datetime(2008, 6, 30): datetime(2007, 1, 1),
91
+ datetime(2008, 12, 31): datetime(2007, 1, 1),
92
+ },
93
+ )
94
+ )
95
+
96
+ offset_cases.append(
97
+ (
98
+ YearBegin(month=4),
99
+ {
100
+ datetime(2007, 4, 1): datetime(2008, 4, 1),
101
+ datetime(2007, 4, 15): datetime(2008, 4, 1),
102
+ datetime(2007, 3, 1): datetime(2007, 4, 1),
103
+ datetime(2007, 12, 15): datetime(2008, 4, 1),
104
+ datetime(2012, 1, 31): datetime(2012, 4, 1),
105
+ },
106
+ )
107
+ )
108
+
109
+ offset_cases.append(
110
+ (
111
+ YearBegin(0, month=4),
112
+ {
113
+ datetime(2007, 4, 1): datetime(2007, 4, 1),
114
+ datetime(2007, 3, 1): datetime(2007, 4, 1),
115
+ datetime(2007, 12, 15): datetime(2008, 4, 1),
116
+ datetime(2012, 1, 31): datetime(2012, 4, 1),
117
+ },
118
+ )
119
+ )
120
+
121
+ offset_cases.append(
122
+ (
123
+ YearBegin(4, month=4),
124
+ {
125
+ datetime(2007, 4, 1): datetime(2011, 4, 1),
126
+ datetime(2007, 4, 15): datetime(2011, 4, 1),
127
+ datetime(2007, 3, 1): datetime(2010, 4, 1),
128
+ datetime(2007, 12, 15): datetime(2011, 4, 1),
129
+ datetime(2012, 1, 31): datetime(2015, 4, 1),
130
+ },
131
+ )
132
+ )
133
+
134
+ offset_cases.append(
135
+ (
136
+ YearBegin(-1, month=4),
137
+ {
138
+ datetime(2007, 4, 1): datetime(2006, 4, 1),
139
+ datetime(2007, 3, 1): datetime(2006, 4, 1),
140
+ datetime(2007, 12, 15): datetime(2007, 4, 1),
141
+ datetime(2012, 1, 31): datetime(2011, 4, 1),
142
+ },
143
+ )
144
+ )
145
+
146
+ offset_cases.append(
147
+ (
148
+ YearBegin(-3, month=4),
149
+ {
150
+ datetime(2007, 4, 1): datetime(2004, 4, 1),
151
+ datetime(2007, 3, 1): datetime(2004, 4, 1),
152
+ datetime(2007, 12, 15): datetime(2005, 4, 1),
153
+ datetime(2012, 1, 31): datetime(2009, 4, 1),
154
+ },
155
+ )
156
+ )
157
+
158
+ @pytest.mark.parametrize("case", offset_cases)
159
+ def test_offset(self, case):
160
+ offset, cases = case
161
+ for base, expected in cases.items():
162
+ assert_offset_equal(offset, base, expected)
163
+
164
+ on_offset_cases = [
165
+ (YearBegin(), datetime(2007, 1, 3), False),
166
+ (YearBegin(), datetime(2008, 1, 1), True),
167
+ (YearBegin(), datetime(2006, 12, 31), False),
168
+ (YearBegin(), datetime(2006, 1, 2), False),
169
+ ]
170
+
171
+ @pytest.mark.parametrize("case", on_offset_cases)
172
+ def test_is_on_offset(self, case):
173
+ offset, dt, expected = case
174
+ assert_is_on_offset(offset, dt, expected)
175
+
176
+
177
+ class TestYearEnd:
178
+ def test_misspecified(self):
179
+ with pytest.raises(ValueError, match="Month must go from 1 to 12"):
180
+ YearEnd(month=13)
181
+
182
+ offset_cases = []
183
+ offset_cases.append(
184
+ (
185
+ YearEnd(),
186
+ {
187
+ datetime(2008, 1, 1): datetime(2008, 12, 31),
188
+ datetime(2008, 6, 30): datetime(2008, 12, 31),
189
+ datetime(2008, 12, 31): datetime(2009, 12, 31),
190
+ datetime(2005, 12, 30): datetime(2005, 12, 31),
191
+ datetime(2005, 12, 31): datetime(2006, 12, 31),
192
+ },
193
+ )
194
+ )
195
+
196
+ offset_cases.append(
197
+ (
198
+ YearEnd(0),
199
+ {
200
+ datetime(2008, 1, 1): datetime(2008, 12, 31),
201
+ datetime(2008, 6, 30): datetime(2008, 12, 31),
202
+ datetime(2008, 12, 31): datetime(2008, 12, 31),
203
+ datetime(2005, 12, 30): datetime(2005, 12, 31),
204
+ },
205
+ )
206
+ )
207
+
208
+ offset_cases.append(
209
+ (
210
+ YearEnd(-1),
211
+ {
212
+ datetime(2007, 1, 1): datetime(2006, 12, 31),
213
+ datetime(2008, 6, 30): datetime(2007, 12, 31),
214
+ datetime(2008, 12, 31): datetime(2007, 12, 31),
215
+ datetime(2006, 12, 29): datetime(2005, 12, 31),
216
+ datetime(2006, 12, 30): datetime(2005, 12, 31),
217
+ datetime(2007, 1, 1): datetime(2006, 12, 31),
218
+ },
219
+ )
220
+ )
221
+
222
+ offset_cases.append(
223
+ (
224
+ YearEnd(-2),
225
+ {
226
+ datetime(2007, 1, 1): datetime(2005, 12, 31),
227
+ datetime(2008, 6, 30): datetime(2006, 12, 31),
228
+ datetime(2008, 12, 31): datetime(2006, 12, 31),
229
+ },
230
+ )
231
+ )
232
+
233
+ @pytest.mark.parametrize("case", offset_cases)
234
+ def test_offset(self, case):
235
+ offset, cases = case
236
+ for base, expected in cases.items():
237
+ assert_offset_equal(offset, base, expected)
238
+
239
+ on_offset_cases = [
240
+ (YearEnd(), datetime(2007, 12, 31), True),
241
+ (YearEnd(), datetime(2008, 1, 1), False),
242
+ (YearEnd(), datetime(2006, 12, 31), True),
243
+ (YearEnd(), datetime(2006, 12, 29), False),
244
+ ]
245
+
246
+ @pytest.mark.parametrize("case", on_offset_cases)
247
+ def test_is_on_offset(self, case):
248
+ offset, dt, expected = case
249
+ assert_is_on_offset(offset, dt, expected)
250
+
251
+
252
+ class TestYearEndDiffMonth:
253
+ offset_cases = []
254
+ offset_cases.append(
255
+ (
256
+ YearEnd(month=3),
257
+ {
258
+ datetime(2008, 1, 1): datetime(2008, 3, 31),
259
+ datetime(2008, 2, 15): datetime(2008, 3, 31),
260
+ datetime(2008, 3, 31): datetime(2009, 3, 31),
261
+ datetime(2008, 3, 30): datetime(2008, 3, 31),
262
+ datetime(2005, 3, 31): datetime(2006, 3, 31),
263
+ datetime(2006, 7, 30): datetime(2007, 3, 31),
264
+ },
265
+ )
266
+ )
267
+
268
+ offset_cases.append(
269
+ (
270
+ YearEnd(0, month=3),
271
+ {
272
+ datetime(2008, 1, 1): datetime(2008, 3, 31),
273
+ datetime(2008, 2, 28): datetime(2008, 3, 31),
274
+ datetime(2008, 3, 31): datetime(2008, 3, 31),
275
+ datetime(2005, 3, 30): datetime(2005, 3, 31),
276
+ },
277
+ )
278
+ )
279
+
280
+ offset_cases.append(
281
+ (
282
+ YearEnd(-1, month=3),
283
+ {
284
+ datetime(2007, 1, 1): datetime(2006, 3, 31),
285
+ datetime(2008, 2, 28): datetime(2007, 3, 31),
286
+ datetime(2008, 3, 31): datetime(2007, 3, 31),
287
+ datetime(2006, 3, 29): datetime(2005, 3, 31),
288
+ datetime(2006, 3, 30): datetime(2005, 3, 31),
289
+ datetime(2007, 3, 1): datetime(2006, 3, 31),
290
+ },
291
+ )
292
+ )
293
+
294
+ offset_cases.append(
295
+ (
296
+ YearEnd(-2, month=3),
297
+ {
298
+ datetime(2007, 1, 1): datetime(2005, 3, 31),
299
+ datetime(2008, 6, 30): datetime(2007, 3, 31),
300
+ datetime(2008, 3, 31): datetime(2006, 3, 31),
301
+ },
302
+ )
303
+ )
304
+
305
+ @pytest.mark.parametrize("case", offset_cases)
306
+ def test_offset(self, case):
307
+ offset, cases = case
308
+ for base, expected in cases.items():
309
+ assert_offset_equal(offset, base, expected)
310
+
311
+ on_offset_cases = [
312
+ (YearEnd(month=3), datetime(2007, 3, 31), True),
313
+ (YearEnd(month=3), datetime(2008, 1, 1), False),
314
+ (YearEnd(month=3), datetime(2006, 3, 31), True),
315
+ (YearEnd(month=3), datetime(2006, 3, 29), False),
316
+ ]
317
+
318
+ @pytest.mark.parametrize("case", on_offset_cases)
319
+ def test_is_on_offset(self, case):
320
+ offset, dt, expected = case
321
+ assert_is_on_offset(offset, dt, expected)
322
+
323
+
324
+ def test_add_out_of_pydatetime_range():
325
+ # GH#50348 don't raise in Timestamp.replace
326
+ ts = Timestamp(np.datetime64("-20000-12-31"))
327
+ off = YearEnd()
328
+
329
+ result = ts + off
330
+ # TODO(cython3): "arg: datetime" annotation will impose
331
+ # datetime limitations on Timestamp. The fused type below works in cy3
332
+ # ctypedef fused datetimelike:
333
+ # _Timestamp
334
+ # datetime
335
+ # expected = Timestamp(np.datetime64("-19999-12-31"))
336
+ # assert result == expected
337
+ assert result.year in (-19999, 1973)
338
+ assert result.month == 12
339
+ assert result.day == 31
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/__init__.py ADDED
File without changes
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_api.py ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Tests that the tslibs API is locked down"""
2
+
3
+ from pandas._libs import tslibs
4
+
5
+
6
+ def test_namespace():
7
+ submodules = [
8
+ "base",
9
+ "ccalendar",
10
+ "conversion",
11
+ "dtypes",
12
+ "fields",
13
+ "nattype",
14
+ "np_datetime",
15
+ "offsets",
16
+ "parsing",
17
+ "period",
18
+ "strptime",
19
+ "vectorized",
20
+ "timedeltas",
21
+ "timestamps",
22
+ "timezones",
23
+ "tzconversion",
24
+ ]
25
+
26
+ api = [
27
+ "BaseOffset",
28
+ "NaT",
29
+ "NaTType",
30
+ "iNaT",
31
+ "nat_strings",
32
+ "OutOfBoundsDatetime",
33
+ "OutOfBoundsTimedelta",
34
+ "Period",
35
+ "IncompatibleFrequency",
36
+ "Resolution",
37
+ "Tick",
38
+ "Timedelta",
39
+ "dt64arr_to_periodarr",
40
+ "Timestamp",
41
+ "is_date_array_normalized",
42
+ "ints_to_pydatetime",
43
+ "normalize_i8_timestamps",
44
+ "get_resolution",
45
+ "delta_to_nanoseconds",
46
+ "ints_to_pytimedelta",
47
+ "localize_pydatetime",
48
+ "tz_convert_from_utc",
49
+ "tz_convert_from_utc_single",
50
+ "to_offset",
51
+ "tz_compare",
52
+ "is_unitless",
53
+ "astype_overflowsafe",
54
+ "get_unit_from_dtype",
55
+ "periods_per_day",
56
+ "periods_per_second",
57
+ "guess_datetime_format",
58
+ "add_overflowsafe",
59
+ "get_supported_dtype",
60
+ "is_supported_dtype",
61
+ ]
62
+
63
+ expected = set(submodules + api)
64
+ names = [x for x in dir(tslibs) if not x.startswith("__")]
65
+ assert set(names) == expected
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_array_to_datetime.py ADDED
@@ -0,0 +1,337 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from datetime import (
2
+ date,
3
+ datetime,
4
+ timedelta,
5
+ timezone,
6
+ )
7
+
8
+ from dateutil.tz.tz import tzoffset
9
+ import numpy as np
10
+ import pytest
11
+
12
+ from pandas._libs import (
13
+ NaT,
14
+ iNaT,
15
+ tslib,
16
+ )
17
+ from pandas._libs.tslibs.dtypes import NpyDatetimeUnit
18
+ from pandas._libs.tslibs.np_datetime import OutOfBoundsDatetime
19
+
20
+ from pandas import Timestamp
21
+ import pandas._testing as tm
22
+
23
+ creso_infer = NpyDatetimeUnit.NPY_FR_GENERIC.value
24
+
25
+
26
+ class TestArrayToDatetimeResolutionInference:
27
+ # TODO: tests that include tzs, ints
28
+
29
+ def test_infer_all_nat(self):
30
+ arr = np.array([NaT, np.nan], dtype=object)
31
+ result, tz = tslib.array_to_datetime(arr, creso=creso_infer)
32
+ assert tz is None
33
+ assert result.dtype == "M8[s]"
34
+
35
+ def test_infer_homogeoneous_datetimes(self):
36
+ dt = datetime(2023, 10, 27, 18, 3, 5, 678000)
37
+ arr = np.array([dt, dt, dt], dtype=object)
38
+ result, tz = tslib.array_to_datetime(arr, creso=creso_infer)
39
+ assert tz is None
40
+ expected = np.array([dt, dt, dt], dtype="M8[us]")
41
+ tm.assert_numpy_array_equal(result, expected)
42
+
43
+ def test_infer_homogeoneous_date_objects(self):
44
+ dt = datetime(2023, 10, 27, 18, 3, 5, 678000)
45
+ dt2 = dt.date()
46
+ arr = np.array([None, dt2, dt2, dt2], dtype=object)
47
+ result, tz = tslib.array_to_datetime(arr, creso=creso_infer)
48
+ assert tz is None
49
+ expected = np.array([np.datetime64("NaT"), dt2, dt2, dt2], dtype="M8[s]")
50
+ tm.assert_numpy_array_equal(result, expected)
51
+
52
+ def test_infer_homogeoneous_dt64(self):
53
+ dt = datetime(2023, 10, 27, 18, 3, 5, 678000)
54
+ dt64 = np.datetime64(dt, "ms")
55
+ arr = np.array([None, dt64, dt64, dt64], dtype=object)
56
+ result, tz = tslib.array_to_datetime(arr, creso=creso_infer)
57
+ assert tz is None
58
+ expected = np.array([np.datetime64("NaT"), dt64, dt64, dt64], dtype="M8[ms]")
59
+ tm.assert_numpy_array_equal(result, expected)
60
+
61
+ def test_infer_homogeoneous_timestamps(self):
62
+ dt = datetime(2023, 10, 27, 18, 3, 5, 678000)
63
+ ts = Timestamp(dt).as_unit("ns")
64
+ arr = np.array([None, ts, ts, ts], dtype=object)
65
+ result, tz = tslib.array_to_datetime(arr, creso=creso_infer)
66
+ assert tz is None
67
+ expected = np.array([np.datetime64("NaT")] + [ts.asm8] * 3, dtype="M8[ns]")
68
+ tm.assert_numpy_array_equal(result, expected)
69
+
70
+ def test_infer_homogeoneous_datetimes_strings(self):
71
+ item = "2023-10-27 18:03:05.678000"
72
+ arr = np.array([None, item, item, item], dtype=object)
73
+ result, tz = tslib.array_to_datetime(arr, creso=creso_infer)
74
+ assert tz is None
75
+ expected = np.array([np.datetime64("NaT"), item, item, item], dtype="M8[us]")
76
+ tm.assert_numpy_array_equal(result, expected)
77
+
78
+ def test_infer_heterogeneous(self):
79
+ dtstr = "2023-10-27 18:03:05.678000"
80
+
81
+ arr = np.array([dtstr, dtstr[:-3], dtstr[:-7], None], dtype=object)
82
+ result, tz = tslib.array_to_datetime(arr, creso=creso_infer)
83
+ assert tz is None
84
+ expected = np.array(arr, dtype="M8[us]")
85
+ tm.assert_numpy_array_equal(result, expected)
86
+
87
+ result, tz = tslib.array_to_datetime(arr[::-1], creso=creso_infer)
88
+ assert tz is None
89
+ tm.assert_numpy_array_equal(result, expected[::-1])
90
+
91
+ @pytest.mark.parametrize(
92
+ "item", [float("nan"), NaT.value, float(NaT.value), "NaT", ""]
93
+ )
94
+ def test_infer_with_nat_int_float_str(self, item):
95
+ # floats/ints get inferred to nanos *unless* they are NaN/iNaT,
96
+ # similar NaT string gets treated like NaT scalar (ignored for resolution)
97
+ dt = datetime(2023, 11, 15, 15, 5, 6)
98
+
99
+ arr = np.array([dt, item], dtype=object)
100
+ result, tz = tslib.array_to_datetime(arr, creso=creso_infer)
101
+ assert tz is None
102
+ expected = np.array([dt, np.datetime64("NaT")], dtype="M8[us]")
103
+ tm.assert_numpy_array_equal(result, expected)
104
+
105
+ result2, tz2 = tslib.array_to_datetime(arr[::-1], creso=creso_infer)
106
+ assert tz2 is None
107
+ tm.assert_numpy_array_equal(result2, expected[::-1])
108
+
109
+
110
+ class TestArrayToDatetimeWithTZResolutionInference:
111
+ def test_array_to_datetime_with_tz_resolution(self):
112
+ tz = tzoffset("custom", 3600)
113
+ vals = np.array(["2016-01-01 02:03:04.567", NaT], dtype=object)
114
+ res = tslib.array_to_datetime_with_tz(vals, tz, False, False, creso_infer)
115
+ assert res.dtype == "M8[ms]"
116
+
117
+ vals2 = np.array([datetime(2016, 1, 1, 2, 3, 4), NaT], dtype=object)
118
+ res2 = tslib.array_to_datetime_with_tz(vals2, tz, False, False, creso_infer)
119
+ assert res2.dtype == "M8[us]"
120
+
121
+ vals3 = np.array([NaT, np.datetime64(12345, "s")], dtype=object)
122
+ res3 = tslib.array_to_datetime_with_tz(vals3, tz, False, False, creso_infer)
123
+ assert res3.dtype == "M8[s]"
124
+
125
+ def test_array_to_datetime_with_tz_resolution_all_nat(self):
126
+ tz = tzoffset("custom", 3600)
127
+ vals = np.array(["NaT"], dtype=object)
128
+ res = tslib.array_to_datetime_with_tz(vals, tz, False, False, creso_infer)
129
+ assert res.dtype == "M8[s]"
130
+
131
+ vals2 = np.array([NaT, NaT], dtype=object)
132
+ res2 = tslib.array_to_datetime_with_tz(vals2, tz, False, False, creso_infer)
133
+ assert res2.dtype == "M8[s]"
134
+
135
+
136
+ @pytest.mark.parametrize(
137
+ "data,expected",
138
+ [
139
+ (
140
+ ["01-01-2013", "01-02-2013"],
141
+ [
142
+ "2013-01-01T00:00:00.000000000",
143
+ "2013-01-02T00:00:00.000000000",
144
+ ],
145
+ ),
146
+ (
147
+ ["Mon Sep 16 2013", "Tue Sep 17 2013"],
148
+ [
149
+ "2013-09-16T00:00:00.000000000",
150
+ "2013-09-17T00:00:00.000000000",
151
+ ],
152
+ ),
153
+ ],
154
+ )
155
+ def test_parsing_valid_dates(data, expected):
156
+ arr = np.array(data, dtype=object)
157
+ result, _ = tslib.array_to_datetime(arr)
158
+
159
+ expected = np.array(expected, dtype="M8[ns]")
160
+ tm.assert_numpy_array_equal(result, expected)
161
+
162
+
163
+ @pytest.mark.parametrize(
164
+ "dt_string, expected_tz",
165
+ [
166
+ ["01-01-2013 08:00:00+08:00", 480],
167
+ ["2013-01-01T08:00:00.000000000+0800", 480],
168
+ ["2012-12-31T16:00:00.000000000-0800", -480],
169
+ ["12-31-2012 23:00:00-01:00", -60],
170
+ ],
171
+ )
172
+ def test_parsing_timezone_offsets(dt_string, expected_tz):
173
+ # All of these datetime strings with offsets are equivalent
174
+ # to the same datetime after the timezone offset is added.
175
+ arr = np.array(["01-01-2013 00:00:00"], dtype=object)
176
+ expected, _ = tslib.array_to_datetime(arr)
177
+
178
+ arr = np.array([dt_string], dtype=object)
179
+ result, result_tz = tslib.array_to_datetime(arr)
180
+
181
+ tm.assert_numpy_array_equal(result, expected)
182
+ assert result_tz == timezone(timedelta(minutes=expected_tz))
183
+
184
+
185
+ def test_parsing_non_iso_timezone_offset():
186
+ dt_string = "01-01-2013T00:00:00.000000000+0000"
187
+ arr = np.array([dt_string], dtype=object)
188
+
189
+ with tm.assert_produces_warning(None):
190
+ # GH#50949 should not get tzlocal-deprecation warning here
191
+ result, result_tz = tslib.array_to_datetime(arr)
192
+ expected = np.array([np.datetime64("2013-01-01 00:00:00.000000000")])
193
+
194
+ tm.assert_numpy_array_equal(result, expected)
195
+ assert result_tz is timezone.utc
196
+
197
+
198
+ def test_parsing_different_timezone_offsets():
199
+ # see gh-17697
200
+ data = ["2015-11-18 15:30:00+05:30", "2015-11-18 15:30:00+06:30"]
201
+ data = np.array(data, dtype=object)
202
+
203
+ msg = "parsing datetimes with mixed time zones will raise an error"
204
+ with tm.assert_produces_warning(FutureWarning, match=msg):
205
+ result, result_tz = tslib.array_to_datetime(data)
206
+ expected = np.array(
207
+ [
208
+ datetime(2015, 11, 18, 15, 30, tzinfo=tzoffset(None, 19800)),
209
+ datetime(2015, 11, 18, 15, 30, tzinfo=tzoffset(None, 23400)),
210
+ ],
211
+ dtype=object,
212
+ )
213
+
214
+ tm.assert_numpy_array_equal(result, expected)
215
+ assert result_tz is None
216
+
217
+
218
+ @pytest.mark.parametrize(
219
+ "data", [["-352.737091", "183.575577"], ["1", "2", "3", "4", "5"]]
220
+ )
221
+ def test_number_looking_strings_not_into_datetime(data):
222
+ # see gh-4601
223
+ #
224
+ # These strings don't look like datetimes, so
225
+ # they shouldn't be attempted to be converted.
226
+ arr = np.array(data, dtype=object)
227
+ result, _ = tslib.array_to_datetime(arr, errors="ignore")
228
+
229
+ tm.assert_numpy_array_equal(result, arr)
230
+
231
+
232
+ @pytest.mark.parametrize(
233
+ "invalid_date",
234
+ [
235
+ date(1000, 1, 1),
236
+ datetime(1000, 1, 1),
237
+ "1000-01-01",
238
+ "Jan 1, 1000",
239
+ np.datetime64("1000-01-01"),
240
+ ],
241
+ )
242
+ @pytest.mark.parametrize("errors", ["coerce", "raise"])
243
+ def test_coerce_outside_ns_bounds(invalid_date, errors):
244
+ arr = np.array([invalid_date], dtype="object")
245
+ kwargs = {"values": arr, "errors": errors}
246
+
247
+ if errors == "raise":
248
+ msg = "^Out of bounds nanosecond timestamp: .*, at position 0$"
249
+
250
+ with pytest.raises(OutOfBoundsDatetime, match=msg):
251
+ tslib.array_to_datetime(**kwargs)
252
+ else: # coerce.
253
+ result, _ = tslib.array_to_datetime(**kwargs)
254
+ expected = np.array([iNaT], dtype="M8[ns]")
255
+
256
+ tm.assert_numpy_array_equal(result, expected)
257
+
258
+
259
+ def test_coerce_outside_ns_bounds_one_valid():
260
+ arr = np.array(["1/1/1000", "1/1/2000"], dtype=object)
261
+ result, _ = tslib.array_to_datetime(arr, errors="coerce")
262
+
263
+ expected = [iNaT, "2000-01-01T00:00:00.000000000"]
264
+ expected = np.array(expected, dtype="M8[ns]")
265
+
266
+ tm.assert_numpy_array_equal(result, expected)
267
+
268
+
269
+ @pytest.mark.parametrize("errors", ["ignore", "coerce"])
270
+ def test_coerce_of_invalid_datetimes(errors):
271
+ arr = np.array(["01-01-2013", "not_a_date", "1"], dtype=object)
272
+ kwargs = {"values": arr, "errors": errors}
273
+
274
+ if errors == "ignore":
275
+ # Without coercing, the presence of any invalid
276
+ # dates prevents any values from being converted.
277
+ result, _ = tslib.array_to_datetime(**kwargs)
278
+ tm.assert_numpy_array_equal(result, arr)
279
+ else: # coerce.
280
+ # With coercing, the invalid dates becomes iNaT
281
+ result, _ = tslib.array_to_datetime(arr, errors="coerce")
282
+ expected = ["2013-01-01T00:00:00.000000000", iNaT, iNaT]
283
+
284
+ tm.assert_numpy_array_equal(result, np.array(expected, dtype="M8[ns]"))
285
+
286
+
287
+ def test_to_datetime_barely_out_of_bounds():
288
+ # see gh-19382, gh-19529
289
+ #
290
+ # Close enough to bounds that dropping nanos
291
+ # would result in an in-bounds datetime.
292
+ arr = np.array(["2262-04-11 23:47:16.854775808"], dtype=object)
293
+ msg = "^Out of bounds nanosecond timestamp: 2262-04-11 23:47:16, at position 0$"
294
+
295
+ with pytest.raises(tslib.OutOfBoundsDatetime, match=msg):
296
+ tslib.array_to_datetime(arr)
297
+
298
+
299
+ @pytest.mark.parametrize(
300
+ "timestamp",
301
+ [
302
+ # Close enough to bounds that scaling micros to nanos overflows
303
+ # but adding nanos would result in an in-bounds datetime.
304
+ "1677-09-21T00:12:43.145224193",
305
+ "1677-09-21T00:12:43.145224999",
306
+ # this always worked
307
+ "1677-09-21T00:12:43.145225000",
308
+ ],
309
+ )
310
+ def test_to_datetime_barely_inside_bounds(timestamp):
311
+ # see gh-57150
312
+ result, _ = tslib.array_to_datetime(np.array([timestamp], dtype=object))
313
+ tm.assert_numpy_array_equal(result, np.array([timestamp], dtype="M8[ns]"))
314
+
315
+
316
+ class SubDatetime(datetime):
317
+ pass
318
+
319
+
320
+ @pytest.mark.parametrize(
321
+ "data,expected",
322
+ [
323
+ ([SubDatetime(2000, 1, 1)], ["2000-01-01T00:00:00.000000000"]),
324
+ ([datetime(2000, 1, 1)], ["2000-01-01T00:00:00.000000000"]),
325
+ ([Timestamp(2000, 1, 1)], ["2000-01-01T00:00:00.000000000"]),
326
+ ],
327
+ )
328
+ def test_datetime_subclass(data, expected):
329
+ # GH 25851
330
+ # ensure that subclassed datetime works with
331
+ # array_to_datetime
332
+
333
+ arr = np.array(data, dtype=object)
334
+ result, _ = tslib.array_to_datetime(arr)
335
+
336
+ expected = np.array(expected, dtype="M8[ns]")
337
+ tm.assert_numpy_array_equal(result, expected)
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_ccalendar.py ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from datetime import (
2
+ date,
3
+ datetime,
4
+ )
5
+
6
+ from hypothesis import given
7
+ import numpy as np
8
+ import pytest
9
+
10
+ from pandas._libs.tslibs import ccalendar
11
+
12
+ from pandas._testing._hypothesis import DATETIME_IN_PD_TIMESTAMP_RANGE_NO_TZ
13
+
14
+
15
+ @pytest.mark.parametrize(
16
+ "date_tuple,expected",
17
+ [
18
+ ((2001, 3, 1), 60),
19
+ ((2004, 3, 1), 61),
20
+ ((1907, 12, 31), 365), # End-of-year, non-leap year.
21
+ ((2004, 12, 31), 366), # End-of-year, leap year.
22
+ ],
23
+ )
24
+ def test_get_day_of_year_numeric(date_tuple, expected):
25
+ assert ccalendar.get_day_of_year(*date_tuple) == expected
26
+
27
+
28
+ def test_get_day_of_year_dt():
29
+ dt = datetime.fromordinal(1 + np.random.default_rng(2).integers(365 * 4000))
30
+ result = ccalendar.get_day_of_year(dt.year, dt.month, dt.day)
31
+
32
+ expected = (dt - dt.replace(month=1, day=1)).days + 1
33
+ assert result == expected
34
+
35
+
36
+ @pytest.mark.parametrize(
37
+ "input_date_tuple, expected_iso_tuple",
38
+ [
39
+ [(2020, 1, 1), (2020, 1, 3)],
40
+ [(2019, 12, 31), (2020, 1, 2)],
41
+ [(2019, 12, 30), (2020, 1, 1)],
42
+ [(2009, 12, 31), (2009, 53, 4)],
43
+ [(2010, 1, 1), (2009, 53, 5)],
44
+ [(2010, 1, 3), (2009, 53, 7)],
45
+ [(2010, 1, 4), (2010, 1, 1)],
46
+ [(2006, 1, 1), (2005, 52, 7)],
47
+ [(2005, 12, 31), (2005, 52, 6)],
48
+ [(2008, 12, 28), (2008, 52, 7)],
49
+ [(2008, 12, 29), (2009, 1, 1)],
50
+ ],
51
+ )
52
+ def test_dt_correct_iso_8601_year_week_and_day(input_date_tuple, expected_iso_tuple):
53
+ result = ccalendar.get_iso_calendar(*input_date_tuple)
54
+ expected_from_date_isocalendar = date(*input_date_tuple).isocalendar()
55
+ assert result == expected_from_date_isocalendar
56
+ assert result == expected_iso_tuple
57
+
58
+
59
+ @given(DATETIME_IN_PD_TIMESTAMP_RANGE_NO_TZ)
60
+ def test_isocalendar(dt):
61
+ expected = dt.isocalendar()
62
+ result = ccalendar.get_iso_calendar(dt.year, dt.month, dt.day)
63
+ assert result == expected
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_conversion.py ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from datetime import datetime
2
+
3
+ import numpy as np
4
+ import pytest
5
+ from pytz import UTC
6
+
7
+ from pandas._libs.tslibs import (
8
+ OutOfBoundsTimedelta,
9
+ astype_overflowsafe,
10
+ conversion,
11
+ iNaT,
12
+ timezones,
13
+ tz_convert_from_utc,
14
+ tzconversion,
15
+ )
16
+
17
+ from pandas import (
18
+ Timestamp,
19
+ date_range,
20
+ )
21
+ import pandas._testing as tm
22
+
23
+
24
+ def _compare_utc_to_local(tz_didx):
25
+ def f(x):
26
+ return tzconversion.tz_convert_from_utc_single(x, tz_didx.tz)
27
+
28
+ result = tz_convert_from_utc(tz_didx.asi8, tz_didx.tz)
29
+ expected = np.vectorize(f)(tz_didx.asi8)
30
+
31
+ tm.assert_numpy_array_equal(result, expected)
32
+
33
+
34
+ def _compare_local_to_utc(tz_didx, naive_didx):
35
+ # Check that tz_localize behaves the same vectorized and pointwise.
36
+ err1 = err2 = None
37
+ try:
38
+ result = tzconversion.tz_localize_to_utc(naive_didx.asi8, tz_didx.tz)
39
+ err1 = None
40
+ except Exception as err:
41
+ err1 = err
42
+
43
+ try:
44
+ expected = naive_didx.map(lambda x: x.tz_localize(tz_didx.tz)).asi8
45
+ except Exception as err:
46
+ err2 = err
47
+
48
+ if err1 is not None:
49
+ assert type(err1) == type(err2)
50
+ else:
51
+ assert err2 is None
52
+ tm.assert_numpy_array_equal(result, expected)
53
+
54
+
55
+ def test_tz_localize_to_utc_copies():
56
+ # GH#46460
57
+ arr = np.arange(5, dtype="i8")
58
+ result = tz_convert_from_utc(arr, tz=UTC)
59
+ tm.assert_numpy_array_equal(result, arr)
60
+ assert not np.shares_memory(arr, result)
61
+
62
+ result = tz_convert_from_utc(arr, tz=None)
63
+ tm.assert_numpy_array_equal(result, arr)
64
+ assert not np.shares_memory(arr, result)
65
+
66
+
67
+ def test_tz_convert_single_matches_tz_convert_hourly(tz_aware_fixture):
68
+ tz = tz_aware_fixture
69
+ tz_didx = date_range("2014-03-01", "2015-01-10", freq="h", tz=tz)
70
+ naive_didx = date_range("2014-03-01", "2015-01-10", freq="h")
71
+
72
+ _compare_utc_to_local(tz_didx)
73
+ _compare_local_to_utc(tz_didx, naive_didx)
74
+
75
+
76
+ @pytest.mark.parametrize("freq", ["D", "YE"])
77
+ def test_tz_convert_single_matches_tz_convert(tz_aware_fixture, freq):
78
+ tz = tz_aware_fixture
79
+ tz_didx = date_range("2018-01-01", "2020-01-01", freq=freq, tz=tz)
80
+ naive_didx = date_range("2018-01-01", "2020-01-01", freq=freq)
81
+
82
+ _compare_utc_to_local(tz_didx)
83
+ _compare_local_to_utc(tz_didx, naive_didx)
84
+
85
+
86
+ @pytest.mark.parametrize(
87
+ "arr",
88
+ [
89
+ pytest.param(np.array([], dtype=np.int64), id="empty"),
90
+ pytest.param(np.array([iNaT], dtype=np.int64), id="all_nat"),
91
+ ],
92
+ )
93
+ def test_tz_convert_corner(arr):
94
+ result = tz_convert_from_utc(arr, timezones.maybe_get_tz("Asia/Tokyo"))
95
+ tm.assert_numpy_array_equal(result, arr)
96
+
97
+
98
+ def test_tz_convert_readonly():
99
+ # GH#35530
100
+ arr = np.array([0], dtype=np.int64)
101
+ arr.setflags(write=False)
102
+ result = tz_convert_from_utc(arr, UTC)
103
+ tm.assert_numpy_array_equal(result, arr)
104
+
105
+
106
+ @pytest.mark.parametrize("copy", [True, False])
107
+ @pytest.mark.parametrize("dtype", ["M8[ns]", "M8[s]"])
108
+ def test_length_zero_copy(dtype, copy):
109
+ arr = np.array([], dtype=dtype)
110
+ result = astype_overflowsafe(arr, copy=copy, dtype=np.dtype("M8[ns]"))
111
+ if copy:
112
+ assert not np.shares_memory(result, arr)
113
+ elif arr.dtype == result.dtype:
114
+ assert result is arr
115
+ else:
116
+ assert not np.shares_memory(result, arr)
117
+
118
+
119
+ def test_ensure_datetime64ns_bigendian():
120
+ # GH#29684
121
+ arr = np.array([np.datetime64(1, "ms")], dtype=">M8[ms]")
122
+ result = astype_overflowsafe(arr, dtype=np.dtype("M8[ns]"))
123
+
124
+ expected = np.array([np.datetime64(1, "ms")], dtype="M8[ns]")
125
+ tm.assert_numpy_array_equal(result, expected)
126
+
127
+
128
+ def test_ensure_timedelta64ns_overflows():
129
+ arr = np.arange(10).astype("m8[Y]") * 100
130
+ msg = r"Cannot convert 300 years to timedelta64\[ns\] without overflow"
131
+ with pytest.raises(OutOfBoundsTimedelta, match=msg):
132
+ astype_overflowsafe(arr, dtype=np.dtype("m8[ns]"))
133
+
134
+
135
+ class SubDatetime(datetime):
136
+ pass
137
+
138
+
139
+ @pytest.mark.parametrize(
140
+ "dt, expected",
141
+ [
142
+ pytest.param(
143
+ Timestamp("2000-01-01"), Timestamp("2000-01-01", tz=UTC), id="timestamp"
144
+ ),
145
+ pytest.param(
146
+ datetime(2000, 1, 1), datetime(2000, 1, 1, tzinfo=UTC), id="datetime"
147
+ ),
148
+ pytest.param(
149
+ SubDatetime(2000, 1, 1),
150
+ SubDatetime(2000, 1, 1, tzinfo=UTC),
151
+ id="subclassed_datetime",
152
+ ),
153
+ ],
154
+ )
155
+ def test_localize_pydatetime_dt_types(dt, expected):
156
+ # GH 25851
157
+ # ensure that subclassed datetime works with
158
+ # localize_pydatetime
159
+ result = conversion.localize_pydatetime(dt, UTC)
160
+ assert result == expected
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_fields.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import pytest
3
+
4
+ from pandas._libs.tslibs import fields
5
+
6
+ import pandas._testing as tm
7
+
8
+
9
+ @pytest.fixture
10
+ def dtindex():
11
+ dtindex = np.arange(5, dtype=np.int64) * 10**9 * 3600 * 24 * 32
12
+ dtindex.flags.writeable = False
13
+ return dtindex
14
+
15
+
16
+ def test_get_date_name_field_readonly(dtindex):
17
+ # https://github.com/vaexio/vaex/issues/357
18
+ # fields functions shouldn't raise when we pass read-only data
19
+ result = fields.get_date_name_field(dtindex, "month_name")
20
+ expected = np.array(["January", "February", "March", "April", "May"], dtype=object)
21
+ tm.assert_numpy_array_equal(result, expected)
22
+
23
+
24
+ def test_get_date_field_readonly(dtindex):
25
+ result = fields.get_date_field(dtindex, "Y")
26
+ expected = np.array([1970, 1970, 1970, 1970, 1970], dtype=np.int32)
27
+ tm.assert_numpy_array_equal(result, expected)
28
+
29
+
30
+ def test_get_start_end_field_readonly(dtindex):
31
+ result = fields.get_start_end_field(dtindex, "is_month_start", None)
32
+ expected = np.array([True, False, False, False, False], dtype=np.bool_)
33
+ tm.assert_numpy_array_equal(result, expected)
34
+
35
+
36
+ def test_get_timedelta_field_readonly(dtindex):
37
+ # treat dtindex as timedeltas for this next one
38
+ result = fields.get_timedelta_field(dtindex, "seconds")
39
+ expected = np.array([0] * 5, dtype=np.int32)
40
+ tm.assert_numpy_array_equal(result, expected)
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_libfrequencies.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pytest
2
+
3
+ from pandas._libs.tslibs.parsing import get_rule_month
4
+
5
+ from pandas.tseries import offsets
6
+
7
+
8
+ @pytest.mark.parametrize(
9
+ "obj,expected",
10
+ [
11
+ ("W", "DEC"),
12
+ (offsets.Week().freqstr, "DEC"),
13
+ ("D", "DEC"),
14
+ (offsets.Day().freqstr, "DEC"),
15
+ ("Q", "DEC"),
16
+ (offsets.QuarterEnd(startingMonth=12).freqstr, "DEC"),
17
+ ("Q-JAN", "JAN"),
18
+ (offsets.QuarterEnd(startingMonth=1).freqstr, "JAN"),
19
+ ("Y-DEC", "DEC"),
20
+ (offsets.YearEnd().freqstr, "DEC"),
21
+ ("Y-MAY", "MAY"),
22
+ (offsets.YearEnd(month=5).freqstr, "MAY"),
23
+ ],
24
+ )
25
+ def test_get_rule_month(obj, expected):
26
+ result = get_rule_month(obj)
27
+ assert result == expected
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_liboffsets.py ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Tests for helper functions in the cython tslibs.offsets
3
+ """
4
+ from datetime import datetime
5
+
6
+ import pytest
7
+
8
+ from pandas._libs.tslibs.ccalendar import (
9
+ get_firstbday,
10
+ get_lastbday,
11
+ )
12
+ import pandas._libs.tslibs.offsets as liboffsets
13
+ from pandas._libs.tslibs.offsets import roll_qtrday
14
+
15
+ from pandas import Timestamp
16
+
17
+
18
+ @pytest.fixture(params=["start", "end", "business_start", "business_end"])
19
+ def day_opt(request):
20
+ return request.param
21
+
22
+
23
+ @pytest.mark.parametrize(
24
+ "dt,exp_week_day,exp_last_day",
25
+ [
26
+ (datetime(2017, 11, 30), 3, 30), # Business day.
27
+ (datetime(1993, 10, 31), 6, 29), # Non-business day.
28
+ ],
29
+ )
30
+ def test_get_last_bday(dt, exp_week_day, exp_last_day):
31
+ assert dt.weekday() == exp_week_day
32
+ assert get_lastbday(dt.year, dt.month) == exp_last_day
33
+
34
+
35
+ @pytest.mark.parametrize(
36
+ "dt,exp_week_day,exp_first_day",
37
+ [
38
+ (datetime(2017, 4, 1), 5, 3), # Non-weekday.
39
+ (datetime(1993, 10, 1), 4, 1), # Business day.
40
+ ],
41
+ )
42
+ def test_get_first_bday(dt, exp_week_day, exp_first_day):
43
+ assert dt.weekday() == exp_week_day
44
+ assert get_firstbday(dt.year, dt.month) == exp_first_day
45
+
46
+
47
+ @pytest.mark.parametrize(
48
+ "months,day_opt,expected",
49
+ [
50
+ (0, 15, datetime(2017, 11, 15)),
51
+ (0, None, datetime(2017, 11, 30)),
52
+ (1, "start", datetime(2017, 12, 1)),
53
+ (-145, "end", datetime(2005, 10, 31)),
54
+ (0, "business_end", datetime(2017, 11, 30)),
55
+ (0, "business_start", datetime(2017, 11, 1)),
56
+ ],
57
+ )
58
+ def test_shift_month_dt(months, day_opt, expected):
59
+ dt = datetime(2017, 11, 30)
60
+ assert liboffsets.shift_month(dt, months, day_opt=day_opt) == expected
61
+
62
+
63
+ @pytest.mark.parametrize(
64
+ "months,day_opt,expected",
65
+ [
66
+ (1, "start", Timestamp("1929-06-01")),
67
+ (-3, "end", Timestamp("1929-02-28")),
68
+ (25, None, Timestamp("1931-06-5")),
69
+ (-1, 31, Timestamp("1929-04-30")),
70
+ ],
71
+ )
72
+ def test_shift_month_ts(months, day_opt, expected):
73
+ ts = Timestamp("1929-05-05")
74
+ assert liboffsets.shift_month(ts, months, day_opt=day_opt) == expected
75
+
76
+
77
+ def test_shift_month_error():
78
+ dt = datetime(2017, 11, 15)
79
+ day_opt = "this should raise"
80
+
81
+ with pytest.raises(ValueError, match=day_opt):
82
+ liboffsets.shift_month(dt, 3, day_opt=day_opt)
83
+
84
+
85
+ @pytest.mark.parametrize(
86
+ "other,expected",
87
+ [
88
+ # Before March 1.
89
+ (datetime(2017, 2, 10), {2: 1, -7: -7, 0: 0}),
90
+ # After March 1.
91
+ (Timestamp("2014-03-15", tz="US/Eastern"), {2: 2, -7: -6, 0: 1}),
92
+ ],
93
+ )
94
+ @pytest.mark.parametrize("n", [2, -7, 0])
95
+ def test_roll_qtrday_year(other, expected, n):
96
+ month = 3
97
+ day_opt = "start" # `other` will be compared to March 1.
98
+
99
+ assert roll_qtrday(other, n, month, day_opt, modby=12) == expected[n]
100
+
101
+
102
+ @pytest.mark.parametrize(
103
+ "other,expected",
104
+ [
105
+ # Before June 30.
106
+ (datetime(1999, 6, 29), {5: 4, -7: -7, 0: 0}),
107
+ # After June 30.
108
+ (Timestamp(2072, 8, 24, 6, 17, 18), {5: 5, -7: -6, 0: 1}),
109
+ ],
110
+ )
111
+ @pytest.mark.parametrize("n", [5, -7, 0])
112
+ def test_roll_qtrday_year2(other, expected, n):
113
+ month = 6
114
+ day_opt = "end" # `other` will be compared to June 30.
115
+
116
+ assert roll_qtrday(other, n, month, day_opt, modby=12) == expected[n]
117
+
118
+
119
+ def test_get_day_of_month_error():
120
+ # get_day_of_month is not directly exposed.
121
+ # We test it via roll_qtrday.
122
+ dt = datetime(2017, 11, 15)
123
+ day_opt = "foo"
124
+
125
+ with pytest.raises(ValueError, match=day_opt):
126
+ # To hit the raising case we need month == dt.month and n > 0.
127
+ roll_qtrday(dt, n=3, month=11, day_opt=day_opt, modby=12)
128
+
129
+
130
+ @pytest.mark.parametrize(
131
+ "month",
132
+ [3, 5], # (other.month % 3) < (month % 3) # (other.month % 3) > (month % 3)
133
+ )
134
+ @pytest.mark.parametrize("n", [4, -3])
135
+ def test_roll_qtr_day_not_mod_unequal(day_opt, month, n):
136
+ expected = {3: {-3: -2, 4: 4}, 5: {-3: -3, 4: 3}}
137
+
138
+ other = Timestamp(2072, 10, 1, 6, 17, 18) # Saturday.
139
+ assert roll_qtrday(other, n, month, day_opt, modby=3) == expected[month][n]
140
+
141
+
142
+ @pytest.mark.parametrize(
143
+ "other,month,exp_dict",
144
+ [
145
+ # Monday.
146
+ (datetime(1999, 5, 31), 2, {-1: {"start": 0, "business_start": 0}}),
147
+ # Saturday.
148
+ (
149
+ Timestamp(2072, 10, 1, 6, 17, 18),
150
+ 4,
151
+ {2: {"end": 1, "business_end": 1, "business_start": 1}},
152
+ ),
153
+ # First business day.
154
+ (
155
+ Timestamp(2072, 10, 3, 6, 17, 18),
156
+ 4,
157
+ {2: {"end": 1, "business_end": 1}, -1: {"start": 0}},
158
+ ),
159
+ ],
160
+ )
161
+ @pytest.mark.parametrize("n", [2, -1])
162
+ def test_roll_qtr_day_mod_equal(other, month, exp_dict, n, day_opt):
163
+ # All cases have (other.month % 3) == (month % 3).
164
+ expected = exp_dict.get(n, {}).get(day_opt, n)
165
+ assert roll_qtrday(other, n, month, day_opt, modby=3) == expected
166
+
167
+
168
+ @pytest.mark.parametrize(
169
+ "n,expected", [(42, {29: 42, 1: 42, 31: 41}), (-4, {29: -4, 1: -3, 31: -4})]
170
+ )
171
+ @pytest.mark.parametrize("compare", [29, 1, 31])
172
+ def test_roll_convention(n, expected, compare):
173
+ assert liboffsets.roll_convention(29, n, compare) == expected[compare]
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_np_datetime.py ADDED
@@ -0,0 +1,222 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import pytest
3
+
4
+ from pandas._libs.tslibs.dtypes import NpyDatetimeUnit
5
+ from pandas._libs.tslibs.np_datetime import (
6
+ OutOfBoundsDatetime,
7
+ OutOfBoundsTimedelta,
8
+ astype_overflowsafe,
9
+ is_unitless,
10
+ py_get_unit_from_dtype,
11
+ py_td64_to_tdstruct,
12
+ )
13
+
14
+ import pandas._testing as tm
15
+
16
+
17
+ def test_is_unitless():
18
+ dtype = np.dtype("M8[ns]")
19
+ assert not is_unitless(dtype)
20
+
21
+ dtype = np.dtype("datetime64")
22
+ assert is_unitless(dtype)
23
+
24
+ dtype = np.dtype("m8[ns]")
25
+ assert not is_unitless(dtype)
26
+
27
+ dtype = np.dtype("timedelta64")
28
+ assert is_unitless(dtype)
29
+
30
+ msg = "dtype must be datetime64 or timedelta64"
31
+ with pytest.raises(ValueError, match=msg):
32
+ is_unitless(np.dtype(np.int64))
33
+
34
+ msg = "Argument 'dtype' has incorrect type"
35
+ with pytest.raises(TypeError, match=msg):
36
+ is_unitless("foo")
37
+
38
+
39
+ def test_get_unit_from_dtype():
40
+ # datetime64
41
+ assert py_get_unit_from_dtype(np.dtype("M8[Y]")) == NpyDatetimeUnit.NPY_FR_Y.value
42
+ assert py_get_unit_from_dtype(np.dtype("M8[M]")) == NpyDatetimeUnit.NPY_FR_M.value
43
+ assert py_get_unit_from_dtype(np.dtype("M8[W]")) == NpyDatetimeUnit.NPY_FR_W.value
44
+ # B has been deprecated and removed -> no 3
45
+ assert py_get_unit_from_dtype(np.dtype("M8[D]")) == NpyDatetimeUnit.NPY_FR_D.value
46
+ assert py_get_unit_from_dtype(np.dtype("M8[h]")) == NpyDatetimeUnit.NPY_FR_h.value
47
+ assert py_get_unit_from_dtype(np.dtype("M8[m]")) == NpyDatetimeUnit.NPY_FR_m.value
48
+ assert py_get_unit_from_dtype(np.dtype("M8[s]")) == NpyDatetimeUnit.NPY_FR_s.value
49
+ assert py_get_unit_from_dtype(np.dtype("M8[ms]")) == NpyDatetimeUnit.NPY_FR_ms.value
50
+ assert py_get_unit_from_dtype(np.dtype("M8[us]")) == NpyDatetimeUnit.NPY_FR_us.value
51
+ assert py_get_unit_from_dtype(np.dtype("M8[ns]")) == NpyDatetimeUnit.NPY_FR_ns.value
52
+ assert py_get_unit_from_dtype(np.dtype("M8[ps]")) == NpyDatetimeUnit.NPY_FR_ps.value
53
+ assert py_get_unit_from_dtype(np.dtype("M8[fs]")) == NpyDatetimeUnit.NPY_FR_fs.value
54
+ assert py_get_unit_from_dtype(np.dtype("M8[as]")) == NpyDatetimeUnit.NPY_FR_as.value
55
+
56
+ # timedelta64
57
+ assert py_get_unit_from_dtype(np.dtype("m8[Y]")) == NpyDatetimeUnit.NPY_FR_Y.value
58
+ assert py_get_unit_from_dtype(np.dtype("m8[M]")) == NpyDatetimeUnit.NPY_FR_M.value
59
+ assert py_get_unit_from_dtype(np.dtype("m8[W]")) == NpyDatetimeUnit.NPY_FR_W.value
60
+ # B has been deprecated and removed -> no 3
61
+ assert py_get_unit_from_dtype(np.dtype("m8[D]")) == NpyDatetimeUnit.NPY_FR_D.value
62
+ assert py_get_unit_from_dtype(np.dtype("m8[h]")) == NpyDatetimeUnit.NPY_FR_h.value
63
+ assert py_get_unit_from_dtype(np.dtype("m8[m]")) == NpyDatetimeUnit.NPY_FR_m.value
64
+ assert py_get_unit_from_dtype(np.dtype("m8[s]")) == NpyDatetimeUnit.NPY_FR_s.value
65
+ assert py_get_unit_from_dtype(np.dtype("m8[ms]")) == NpyDatetimeUnit.NPY_FR_ms.value
66
+ assert py_get_unit_from_dtype(np.dtype("m8[us]")) == NpyDatetimeUnit.NPY_FR_us.value
67
+ assert py_get_unit_from_dtype(np.dtype("m8[ns]")) == NpyDatetimeUnit.NPY_FR_ns.value
68
+ assert py_get_unit_from_dtype(np.dtype("m8[ps]")) == NpyDatetimeUnit.NPY_FR_ps.value
69
+ assert py_get_unit_from_dtype(np.dtype("m8[fs]")) == NpyDatetimeUnit.NPY_FR_fs.value
70
+ assert py_get_unit_from_dtype(np.dtype("m8[as]")) == NpyDatetimeUnit.NPY_FR_as.value
71
+
72
+
73
+ def test_td64_to_tdstruct():
74
+ val = 12454636234 # arbitrary value
75
+
76
+ res1 = py_td64_to_tdstruct(val, NpyDatetimeUnit.NPY_FR_ns.value)
77
+ exp1 = {
78
+ "days": 0,
79
+ "hrs": 0,
80
+ "min": 0,
81
+ "sec": 12,
82
+ "ms": 454,
83
+ "us": 636,
84
+ "ns": 234,
85
+ "seconds": 12,
86
+ "microseconds": 454636,
87
+ "nanoseconds": 234,
88
+ }
89
+ assert res1 == exp1
90
+
91
+ res2 = py_td64_to_tdstruct(val, NpyDatetimeUnit.NPY_FR_us.value)
92
+ exp2 = {
93
+ "days": 0,
94
+ "hrs": 3,
95
+ "min": 27,
96
+ "sec": 34,
97
+ "ms": 636,
98
+ "us": 234,
99
+ "ns": 0,
100
+ "seconds": 12454,
101
+ "microseconds": 636234,
102
+ "nanoseconds": 0,
103
+ }
104
+ assert res2 == exp2
105
+
106
+ res3 = py_td64_to_tdstruct(val, NpyDatetimeUnit.NPY_FR_ms.value)
107
+ exp3 = {
108
+ "days": 144,
109
+ "hrs": 3,
110
+ "min": 37,
111
+ "sec": 16,
112
+ "ms": 234,
113
+ "us": 0,
114
+ "ns": 0,
115
+ "seconds": 13036,
116
+ "microseconds": 234000,
117
+ "nanoseconds": 0,
118
+ }
119
+ assert res3 == exp3
120
+
121
+ # Note this out of bounds for nanosecond Timedelta
122
+ res4 = py_td64_to_tdstruct(val, NpyDatetimeUnit.NPY_FR_s.value)
123
+ exp4 = {
124
+ "days": 144150,
125
+ "hrs": 21,
126
+ "min": 10,
127
+ "sec": 34,
128
+ "ms": 0,
129
+ "us": 0,
130
+ "ns": 0,
131
+ "seconds": 76234,
132
+ "microseconds": 0,
133
+ "nanoseconds": 0,
134
+ }
135
+ assert res4 == exp4
136
+
137
+
138
+ class TestAstypeOverflowSafe:
139
+ def test_pass_non_dt64_array(self):
140
+ # check that we raise, not segfault
141
+ arr = np.arange(5)
142
+ dtype = np.dtype("M8[ns]")
143
+
144
+ msg = (
145
+ "astype_overflowsafe values.dtype and dtype must be either "
146
+ "both-datetime64 or both-timedelta64"
147
+ )
148
+ with pytest.raises(TypeError, match=msg):
149
+ astype_overflowsafe(arr, dtype, copy=True)
150
+
151
+ with pytest.raises(TypeError, match=msg):
152
+ astype_overflowsafe(arr, dtype, copy=False)
153
+
154
+ def test_pass_non_dt64_dtype(self):
155
+ # check that we raise, not segfault
156
+ arr = np.arange(5, dtype="i8").view("M8[D]")
157
+ dtype = np.dtype("m8[ns]")
158
+
159
+ msg = (
160
+ "astype_overflowsafe values.dtype and dtype must be either "
161
+ "both-datetime64 or both-timedelta64"
162
+ )
163
+ with pytest.raises(TypeError, match=msg):
164
+ astype_overflowsafe(arr, dtype, copy=True)
165
+
166
+ with pytest.raises(TypeError, match=msg):
167
+ astype_overflowsafe(arr, dtype, copy=False)
168
+
169
+ def test_astype_overflowsafe_dt64(self):
170
+ dtype = np.dtype("M8[ns]")
171
+
172
+ dt = np.datetime64("2262-04-05", "D")
173
+ arr = dt + np.arange(10, dtype="m8[D]")
174
+
175
+ # arr.astype silently overflows, so this
176
+ wrong = arr.astype(dtype)
177
+ roundtrip = wrong.astype(arr.dtype)
178
+ assert not (wrong == roundtrip).all()
179
+
180
+ msg = "Out of bounds nanosecond timestamp"
181
+ with pytest.raises(OutOfBoundsDatetime, match=msg):
182
+ astype_overflowsafe(arr, dtype)
183
+
184
+ # But converting to microseconds is fine, and we match numpy's results.
185
+ dtype2 = np.dtype("M8[us]")
186
+ result = astype_overflowsafe(arr, dtype2)
187
+ expected = arr.astype(dtype2)
188
+ tm.assert_numpy_array_equal(result, expected)
189
+
190
+ def test_astype_overflowsafe_td64(self):
191
+ dtype = np.dtype("m8[ns]")
192
+
193
+ dt = np.datetime64("2262-04-05", "D")
194
+ arr = dt + np.arange(10, dtype="m8[D]")
195
+ arr = arr.view("m8[D]")
196
+
197
+ # arr.astype silently overflows, so this
198
+ wrong = arr.astype(dtype)
199
+ roundtrip = wrong.astype(arr.dtype)
200
+ assert not (wrong == roundtrip).all()
201
+
202
+ msg = r"Cannot convert 106752 days to timedelta64\[ns\] without overflow"
203
+ with pytest.raises(OutOfBoundsTimedelta, match=msg):
204
+ astype_overflowsafe(arr, dtype)
205
+
206
+ # But converting to microseconds is fine, and we match numpy's results.
207
+ dtype2 = np.dtype("m8[us]")
208
+ result = astype_overflowsafe(arr, dtype2)
209
+ expected = arr.astype(dtype2)
210
+ tm.assert_numpy_array_equal(result, expected)
211
+
212
+ def test_astype_overflowsafe_disallow_rounding(self):
213
+ arr = np.array([-1500, 1500], dtype="M8[ns]")
214
+ dtype = np.dtype("M8[us]")
215
+
216
+ msg = "Cannot losslessly cast '-1500 ns' to us"
217
+ with pytest.raises(ValueError, match=msg):
218
+ astype_overflowsafe(arr, dtype, round_ok=False)
219
+
220
+ result = astype_overflowsafe(arr, dtype, round_ok=True)
221
+ expected = arr.astype(dtype)
222
+ tm.assert_numpy_array_equal(result, expected)
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_npy_units.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+
3
+ from pandas._libs.tslibs.dtypes import abbrev_to_npy_unit
4
+ from pandas._libs.tslibs.vectorized import is_date_array_normalized
5
+
6
+ # a datetime64 ndarray which *is* normalized
7
+ day_arr = np.arange(10, dtype="i8").view("M8[D]")
8
+
9
+
10
+ class TestIsDateArrayNormalized:
11
+ def test_is_date_array_normalized_day(self):
12
+ arr = day_arr
13
+ abbrev = "D"
14
+ unit = abbrev_to_npy_unit(abbrev)
15
+ result = is_date_array_normalized(arr.view("i8"), None, unit)
16
+ assert result is True
17
+
18
+ def test_is_date_array_normalized_seconds(self):
19
+ abbrev = "s"
20
+ arr = day_arr.astype(f"M8[{abbrev}]")
21
+ unit = abbrev_to_npy_unit(abbrev)
22
+ result = is_date_array_normalized(arr.view("i8"), None, unit)
23
+ assert result is True
24
+
25
+ arr[0] += np.timedelta64(1, abbrev)
26
+ result2 = is_date_array_normalized(arr.view("i8"), None, unit)
27
+ assert result2 is False
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_parse_iso8601.py ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from datetime import datetime
2
+
3
+ import pytest
4
+
5
+ from pandas._libs import tslib
6
+
7
+ from pandas import Timestamp
8
+
9
+
10
+ @pytest.mark.parametrize(
11
+ "date_str, exp",
12
+ [
13
+ ("2011-01-02", datetime(2011, 1, 2)),
14
+ ("2011-1-2", datetime(2011, 1, 2)),
15
+ ("2011-01", datetime(2011, 1, 1)),
16
+ ("2011-1", datetime(2011, 1, 1)),
17
+ ("2011 01 02", datetime(2011, 1, 2)),
18
+ ("2011.01.02", datetime(2011, 1, 2)),
19
+ ("2011/01/02", datetime(2011, 1, 2)),
20
+ ("2011\\01\\02", datetime(2011, 1, 2)),
21
+ ("2013-01-01 05:30:00", datetime(2013, 1, 1, 5, 30)),
22
+ ("2013-1-1 5:30:00", datetime(2013, 1, 1, 5, 30)),
23
+ ("2013-1-1 5:30:00+01:00", Timestamp(2013, 1, 1, 5, 30, tz="UTC+01:00")),
24
+ ],
25
+ )
26
+ def test_parsers_iso8601(date_str, exp):
27
+ # see gh-12060
28
+ #
29
+ # Test only the ISO parser - flexibility to
30
+ # different separators and leading zero's.
31
+ actual = tslib._test_parse_iso8601(date_str)
32
+ assert actual == exp
33
+
34
+
35
+ @pytest.mark.parametrize(
36
+ "date_str",
37
+ [
38
+ "2011-01/02",
39
+ "2011=11=11",
40
+ "201401",
41
+ "201111",
42
+ "200101",
43
+ # Mixed separated and unseparated.
44
+ "2005-0101",
45
+ "200501-01",
46
+ "20010101 12:3456",
47
+ "20010101 1234:56",
48
+ # HHMMSS must have two digits in
49
+ # each component if unseparated.
50
+ "20010101 1",
51
+ "20010101 123",
52
+ "20010101 12345",
53
+ "20010101 12345Z",
54
+ ],
55
+ )
56
+ def test_parsers_iso8601_invalid(date_str):
57
+ msg = f'Error parsing datetime string "{date_str}"'
58
+
59
+ with pytest.raises(ValueError, match=msg):
60
+ tslib._test_parse_iso8601(date_str)
61
+
62
+
63
+ def test_parsers_iso8601_invalid_offset_invalid():
64
+ date_str = "2001-01-01 12-34-56"
65
+ msg = f'Timezone hours offset out of range in datetime string "{date_str}"'
66
+
67
+ with pytest.raises(ValueError, match=msg):
68
+ tslib._test_parse_iso8601(date_str)
69
+
70
+
71
+ def test_parsers_iso8601_leading_space():
72
+ # GH#25895 make sure isoparser doesn't overflow with long input
73
+ date_str, expected = ("2013-1-1 5:30:00", datetime(2013, 1, 1, 5, 30))
74
+ actual = tslib._test_parse_iso8601(" " * 200 + date_str)
75
+ assert actual == expected
76
+
77
+
78
+ @pytest.mark.parametrize(
79
+ "date_str, timespec, exp",
80
+ [
81
+ ("2023-01-01 00:00:00", "auto", "2023-01-01T00:00:00"),
82
+ ("2023-01-01 00:00:00", "seconds", "2023-01-01T00:00:00"),
83
+ ("2023-01-01 00:00:00", "milliseconds", "2023-01-01T00:00:00.000"),
84
+ ("2023-01-01 00:00:00", "microseconds", "2023-01-01T00:00:00.000000"),
85
+ ("2023-01-01 00:00:00", "nanoseconds", "2023-01-01T00:00:00.000000000"),
86
+ ("2023-01-01 00:00:00.001", "auto", "2023-01-01T00:00:00.001000"),
87
+ ("2023-01-01 00:00:00.001", "seconds", "2023-01-01T00:00:00"),
88
+ ("2023-01-01 00:00:00.001", "milliseconds", "2023-01-01T00:00:00.001"),
89
+ ("2023-01-01 00:00:00.001", "microseconds", "2023-01-01T00:00:00.001000"),
90
+ ("2023-01-01 00:00:00.001", "nanoseconds", "2023-01-01T00:00:00.001000000"),
91
+ ("2023-01-01 00:00:00.000001", "auto", "2023-01-01T00:00:00.000001"),
92
+ ("2023-01-01 00:00:00.000001", "seconds", "2023-01-01T00:00:00"),
93
+ ("2023-01-01 00:00:00.000001", "milliseconds", "2023-01-01T00:00:00.000"),
94
+ ("2023-01-01 00:00:00.000001", "microseconds", "2023-01-01T00:00:00.000001"),
95
+ ("2023-01-01 00:00:00.000001", "nanoseconds", "2023-01-01T00:00:00.000001000"),
96
+ ("2023-01-01 00:00:00.000000001", "auto", "2023-01-01T00:00:00.000000001"),
97
+ ("2023-01-01 00:00:00.000000001", "seconds", "2023-01-01T00:00:00"),
98
+ ("2023-01-01 00:00:00.000000001", "milliseconds", "2023-01-01T00:00:00.000"),
99
+ ("2023-01-01 00:00:00.000000001", "microseconds", "2023-01-01T00:00:00.000000"),
100
+ (
101
+ "2023-01-01 00:00:00.000000001",
102
+ "nanoseconds",
103
+ "2023-01-01T00:00:00.000000001",
104
+ ),
105
+ ("2023-01-01 00:00:00.000001001", "auto", "2023-01-01T00:00:00.000001001"),
106
+ ("2023-01-01 00:00:00.000001001", "seconds", "2023-01-01T00:00:00"),
107
+ ("2023-01-01 00:00:00.000001001", "milliseconds", "2023-01-01T00:00:00.000"),
108
+ ("2023-01-01 00:00:00.000001001", "microseconds", "2023-01-01T00:00:00.000001"),
109
+ (
110
+ "2023-01-01 00:00:00.000001001",
111
+ "nanoseconds",
112
+ "2023-01-01T00:00:00.000001001",
113
+ ),
114
+ ],
115
+ )
116
+ def test_iso8601_formatter(date_str: str, timespec: str, exp: str):
117
+ # GH#53020
118
+ ts = Timestamp(date_str)
119
+ assert ts.isoformat(timespec=timespec) == exp
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_parsing.py ADDED
@@ -0,0 +1,416 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Tests for Timestamp parsing, aimed at pandas/_libs/tslibs/parsing.pyx
3
+ """
4
+ from datetime import datetime
5
+ import re
6
+
7
+ from dateutil.parser import parse as du_parse
8
+ from dateutil.tz import tzlocal
9
+ from hypothesis import given
10
+ import numpy as np
11
+ import pytest
12
+
13
+ from pandas._libs.tslibs import (
14
+ parsing,
15
+ strptime,
16
+ )
17
+ from pandas._libs.tslibs.parsing import parse_datetime_string_with_reso
18
+ from pandas.compat import (
19
+ ISMUSL,
20
+ is_platform_arm,
21
+ is_platform_windows,
22
+ )
23
+ import pandas.util._test_decorators as td
24
+
25
+ import pandas._testing as tm
26
+ from pandas._testing._hypothesis import DATETIME_NO_TZ
27
+
28
+
29
+ @pytest.mark.skipif(
30
+ is_platform_windows() or ISMUSL or is_platform_arm(),
31
+ reason="TZ setting incorrect on Windows and MUSL Linux",
32
+ )
33
+ def test_parsing_tzlocal_deprecated():
34
+ # GH#50791
35
+ msg = (
36
+ "Parsing 'EST' as tzlocal.*"
37
+ "Pass the 'tz' keyword or call tz_localize after construction instead"
38
+ )
39
+ dtstr = "Jan 15 2004 03:00 EST"
40
+
41
+ with tm.set_timezone("US/Eastern"):
42
+ with tm.assert_produces_warning(FutureWarning, match=msg):
43
+ res, _ = parse_datetime_string_with_reso(dtstr)
44
+
45
+ assert isinstance(res.tzinfo, tzlocal)
46
+
47
+ with tm.assert_produces_warning(FutureWarning, match=msg):
48
+ res = parsing.py_parse_datetime_string(dtstr)
49
+ assert isinstance(res.tzinfo, tzlocal)
50
+
51
+
52
+ def test_parse_datetime_string_with_reso():
53
+ (parsed, reso) = parse_datetime_string_with_reso("4Q1984")
54
+ (parsed_lower, reso_lower) = parse_datetime_string_with_reso("4q1984")
55
+
56
+ assert reso == reso_lower
57
+ assert parsed == parsed_lower
58
+
59
+
60
+ def test_parse_datetime_string_with_reso_nanosecond_reso():
61
+ # GH#46811
62
+ parsed, reso = parse_datetime_string_with_reso("2022-04-20 09:19:19.123456789")
63
+ assert reso == "nanosecond"
64
+
65
+
66
+ def test_parse_datetime_string_with_reso_invalid_type():
67
+ # Raise on invalid input, don't just return it
68
+ msg = "Argument 'date_string' has incorrect type (expected str, got tuple)"
69
+ with pytest.raises(TypeError, match=re.escape(msg)):
70
+ parse_datetime_string_with_reso((4, 5))
71
+
72
+
73
+ @pytest.mark.parametrize(
74
+ "dashed,normal", [("1988-Q2", "1988Q2"), ("2Q-1988", "2Q1988")]
75
+ )
76
+ def test_parse_time_quarter_with_dash(dashed, normal):
77
+ # see gh-9688
78
+ (parsed_dash, reso_dash) = parse_datetime_string_with_reso(dashed)
79
+ (parsed, reso) = parse_datetime_string_with_reso(normal)
80
+
81
+ assert parsed_dash == parsed
82
+ assert reso_dash == reso
83
+
84
+
85
+ @pytest.mark.parametrize("dashed", ["-2Q1992", "2-Q1992", "4-4Q1992"])
86
+ def test_parse_time_quarter_with_dash_error(dashed):
87
+ msg = f"Unknown datetime string format, unable to parse: {dashed}"
88
+
89
+ with pytest.raises(parsing.DateParseError, match=msg):
90
+ parse_datetime_string_with_reso(dashed)
91
+
92
+
93
+ @pytest.mark.parametrize(
94
+ "date_string,expected",
95
+ [
96
+ ("123.1234", False),
97
+ ("-50000", False),
98
+ ("999", False),
99
+ ("m", False),
100
+ ("T", False),
101
+ ("Mon Sep 16, 2013", True),
102
+ ("2012-01-01", True),
103
+ ("01/01/2012", True),
104
+ ("01012012", True),
105
+ ("0101", True),
106
+ ("1-1", True),
107
+ ],
108
+ )
109
+ def test_does_not_convert_mixed_integer(date_string, expected):
110
+ assert parsing._does_string_look_like_datetime(date_string) is expected
111
+
112
+
113
+ @pytest.mark.parametrize(
114
+ "date_str,kwargs,msg",
115
+ [
116
+ (
117
+ "2013Q5",
118
+ {},
119
+ (
120
+ "Incorrect quarterly string is given, "
121
+ "quarter must be between 1 and 4: 2013Q5"
122
+ ),
123
+ ),
124
+ # see gh-5418
125
+ (
126
+ "2013Q1",
127
+ {"freq": "INVLD-L-DEC-SAT"},
128
+ (
129
+ "Unable to retrieve month information "
130
+ "from given freq: INVLD-L-DEC-SAT"
131
+ ),
132
+ ),
133
+ ],
134
+ )
135
+ def test_parsers_quarterly_with_freq_error(date_str, kwargs, msg):
136
+ with pytest.raises(parsing.DateParseError, match=msg):
137
+ parsing.parse_datetime_string_with_reso(date_str, **kwargs)
138
+
139
+
140
+ @pytest.mark.parametrize(
141
+ "date_str,freq,expected",
142
+ [
143
+ ("2013Q2", None, datetime(2013, 4, 1)),
144
+ ("2013Q2", "Y-APR", datetime(2012, 8, 1)),
145
+ ("2013-Q2", "Y-DEC", datetime(2013, 4, 1)),
146
+ ],
147
+ )
148
+ def test_parsers_quarterly_with_freq(date_str, freq, expected):
149
+ result, _ = parsing.parse_datetime_string_with_reso(date_str, freq=freq)
150
+ assert result == expected
151
+
152
+
153
+ @pytest.mark.parametrize(
154
+ "date_str", ["2Q 2005", "2Q-200Y", "2Q-200", "22Q2005", "2Q200.", "6Q-20"]
155
+ )
156
+ def test_parsers_quarter_invalid(date_str):
157
+ if date_str == "6Q-20":
158
+ msg = (
159
+ "Incorrect quarterly string is given, quarter "
160
+ f"must be between 1 and 4: {date_str}"
161
+ )
162
+ else:
163
+ msg = f"Unknown datetime string format, unable to parse: {date_str}"
164
+
165
+ with pytest.raises(ValueError, match=msg):
166
+ parsing.parse_datetime_string_with_reso(date_str)
167
+
168
+
169
+ @pytest.mark.parametrize(
170
+ "date_str,expected",
171
+ [("201101", datetime(2011, 1, 1, 0, 0)), ("200005", datetime(2000, 5, 1, 0, 0))],
172
+ )
173
+ def test_parsers_month_freq(date_str, expected):
174
+ result, _ = parsing.parse_datetime_string_with_reso(date_str, freq="ME")
175
+ assert result == expected
176
+
177
+
178
+ @td.skip_if_not_us_locale
179
+ @pytest.mark.parametrize(
180
+ "string,fmt",
181
+ [
182
+ ("20111230", "%Y%m%d"),
183
+ ("201112300000", "%Y%m%d%H%M"),
184
+ ("20111230000000", "%Y%m%d%H%M%S"),
185
+ ("20111230T00", "%Y%m%dT%H"),
186
+ ("20111230T0000", "%Y%m%dT%H%M"),
187
+ ("20111230T000000", "%Y%m%dT%H%M%S"),
188
+ ("2011-12-30", "%Y-%m-%d"),
189
+ ("2011", "%Y"),
190
+ ("2011-01", "%Y-%m"),
191
+ ("30-12-2011", "%d-%m-%Y"),
192
+ ("2011-12-30 00:00:00", "%Y-%m-%d %H:%M:%S"),
193
+ ("2011-12-30T00:00:00", "%Y-%m-%dT%H:%M:%S"),
194
+ ("2011-12-30T00:00:00UTC", "%Y-%m-%dT%H:%M:%S%Z"),
195
+ ("2011-12-30T00:00:00Z", "%Y-%m-%dT%H:%M:%S%z"),
196
+ ("2011-12-30T00:00:00+9", "%Y-%m-%dT%H:%M:%S%z"),
197
+ ("2011-12-30T00:00:00+09", "%Y-%m-%dT%H:%M:%S%z"),
198
+ ("2011-12-30T00:00:00+090", None),
199
+ ("2011-12-30T00:00:00+0900", "%Y-%m-%dT%H:%M:%S%z"),
200
+ ("2011-12-30T00:00:00-0900", "%Y-%m-%dT%H:%M:%S%z"),
201
+ ("2011-12-30T00:00:00+09:00", "%Y-%m-%dT%H:%M:%S%z"),
202
+ ("2011-12-30T00:00:00+09:000", None),
203
+ ("2011-12-30T00:00:00+9:0", "%Y-%m-%dT%H:%M:%S%z"),
204
+ ("2011-12-30T00:00:00+09:", None),
205
+ ("2011-12-30T00:00:00.000000UTC", "%Y-%m-%dT%H:%M:%S.%f%Z"),
206
+ ("2011-12-30T00:00:00.000000Z", "%Y-%m-%dT%H:%M:%S.%f%z"),
207
+ ("2011-12-30T00:00:00.000000+9", "%Y-%m-%dT%H:%M:%S.%f%z"),
208
+ ("2011-12-30T00:00:00.000000+09", "%Y-%m-%dT%H:%M:%S.%f%z"),
209
+ ("2011-12-30T00:00:00.000000+090", None),
210
+ ("2011-12-30T00:00:00.000000+0900", "%Y-%m-%dT%H:%M:%S.%f%z"),
211
+ ("2011-12-30T00:00:00.000000-0900", "%Y-%m-%dT%H:%M:%S.%f%z"),
212
+ ("2011-12-30T00:00:00.000000+09:00", "%Y-%m-%dT%H:%M:%S.%f%z"),
213
+ ("2011-12-30T00:00:00.000000+09:000", None),
214
+ ("2011-12-30T00:00:00.000000+9:0", "%Y-%m-%dT%H:%M:%S.%f%z"),
215
+ ("2011-12-30T00:00:00.000000+09:", None),
216
+ ("2011-12-30 00:00:00.000000", "%Y-%m-%d %H:%M:%S.%f"),
217
+ ("Tue 24 Aug 2021 01:30:48", "%a %d %b %Y %H:%M:%S"),
218
+ ("Tuesday 24 Aug 2021 01:30:48", "%A %d %b %Y %H:%M:%S"),
219
+ ("Tue 24 Aug 2021 01:30:48 AM", "%a %d %b %Y %I:%M:%S %p"),
220
+ ("Tuesday 24 Aug 2021 01:30:48 AM", "%A %d %b %Y %I:%M:%S %p"),
221
+ ("27.03.2003 14:55:00.000", "%d.%m.%Y %H:%M:%S.%f"), # GH50317
222
+ ],
223
+ )
224
+ def test_guess_datetime_format_with_parseable_formats(string, fmt):
225
+ with tm.maybe_produces_warning(
226
+ UserWarning, fmt is not None and re.search(r"%d.*%m", fmt)
227
+ ):
228
+ result = parsing.guess_datetime_format(string)
229
+ assert result == fmt
230
+
231
+
232
+ @pytest.mark.parametrize("dayfirst,expected", [(True, "%d/%m/%Y"), (False, "%m/%d/%Y")])
233
+ def test_guess_datetime_format_with_dayfirst(dayfirst, expected):
234
+ ambiguous_string = "01/01/2011"
235
+ result = parsing.guess_datetime_format(ambiguous_string, dayfirst=dayfirst)
236
+ assert result == expected
237
+
238
+
239
+ @td.skip_if_not_us_locale
240
+ @pytest.mark.parametrize(
241
+ "string,fmt",
242
+ [
243
+ ("30/Dec/2011", "%d/%b/%Y"),
244
+ ("30/December/2011", "%d/%B/%Y"),
245
+ ("30/Dec/2011 00:00:00", "%d/%b/%Y %H:%M:%S"),
246
+ ],
247
+ )
248
+ def test_guess_datetime_format_with_locale_specific_formats(string, fmt):
249
+ result = parsing.guess_datetime_format(string)
250
+ assert result == fmt
251
+
252
+
253
+ @pytest.mark.parametrize(
254
+ "invalid_dt",
255
+ [
256
+ "01/2013",
257
+ "12:00:00",
258
+ "1/1/1/1",
259
+ "this_is_not_a_datetime",
260
+ "51a",
261
+ "13/2019",
262
+ "202001", # YYYYMM isn't ISO8601
263
+ "2020/01", # YYYY/MM isn't ISO8601 either
264
+ "87156549591102612381000001219H5",
265
+ ],
266
+ )
267
+ def test_guess_datetime_format_invalid_inputs(invalid_dt):
268
+ # A datetime string must include a year, month and a day for it to be
269
+ # guessable, in addition to being a string that looks like a datetime.
270
+ assert parsing.guess_datetime_format(invalid_dt) is None
271
+
272
+
273
+ @pytest.mark.parametrize("invalid_type_dt", [9, datetime(2011, 1, 1)])
274
+ def test_guess_datetime_format_wrong_type_inputs(invalid_type_dt):
275
+ # A datetime string must include a year, month and a day for it to be
276
+ # guessable, in addition to being a string that looks like a datetime.
277
+ with pytest.raises(
278
+ TypeError,
279
+ match=r"^Argument 'dt_str' has incorrect type \(expected str, got .*\)$",
280
+ ):
281
+ parsing.guess_datetime_format(invalid_type_dt)
282
+
283
+
284
+ @pytest.mark.parametrize(
285
+ "string,fmt,dayfirst,warning",
286
+ [
287
+ ("2011-1-1", "%Y-%m-%d", False, None),
288
+ ("2011-1-1", "%Y-%d-%m", True, None),
289
+ ("1/1/2011", "%m/%d/%Y", False, None),
290
+ ("1/1/2011", "%d/%m/%Y", True, None),
291
+ ("30-1-2011", "%d-%m-%Y", False, UserWarning),
292
+ ("30-1-2011", "%d-%m-%Y", True, None),
293
+ ("2011-1-1 0:0:0", "%Y-%m-%d %H:%M:%S", False, None),
294
+ ("2011-1-1 0:0:0", "%Y-%d-%m %H:%M:%S", True, None),
295
+ ("2011-1-3T00:00:0", "%Y-%m-%dT%H:%M:%S", False, None),
296
+ ("2011-1-3T00:00:0", "%Y-%d-%mT%H:%M:%S", True, None),
297
+ ("2011-1-1 00:00:00", "%Y-%m-%d %H:%M:%S", False, None),
298
+ ("2011-1-1 00:00:00", "%Y-%d-%m %H:%M:%S", True, None),
299
+ ],
300
+ )
301
+ def test_guess_datetime_format_no_padding(string, fmt, dayfirst, warning):
302
+ # see gh-11142
303
+ msg = (
304
+ rf"Parsing dates in {fmt} format when dayfirst=False \(the default\) "
305
+ "was specified. "
306
+ "Pass `dayfirst=True` or specify a format to silence this warning."
307
+ )
308
+ with tm.assert_produces_warning(warning, match=msg):
309
+ result = parsing.guess_datetime_format(string, dayfirst=dayfirst)
310
+ assert result == fmt
311
+
312
+
313
+ def test_try_parse_dates():
314
+ arr = np.array(["5/1/2000", "6/1/2000", "7/1/2000"], dtype=object)
315
+ result = parsing.try_parse_dates(arr, parser=lambda x: du_parse(x, dayfirst=True))
316
+
317
+ expected = np.array([du_parse(d, dayfirst=True) for d in arr])
318
+ tm.assert_numpy_array_equal(result, expected)
319
+
320
+
321
+ def test_parse_datetime_string_with_reso_check_instance_type_raise_exception():
322
+ # issue 20684
323
+ msg = "Argument 'date_string' has incorrect type (expected str, got tuple)"
324
+ with pytest.raises(TypeError, match=re.escape(msg)):
325
+ parse_datetime_string_with_reso((1, 2, 3))
326
+
327
+ result = parse_datetime_string_with_reso("2019")
328
+ expected = (datetime(2019, 1, 1), "year")
329
+ assert result == expected
330
+
331
+
332
+ @pytest.mark.parametrize(
333
+ "fmt,expected",
334
+ [
335
+ ("%Y %m %d %H:%M:%S", True),
336
+ ("%Y/%m/%d %H:%M:%S", True),
337
+ (r"%Y\%m\%d %H:%M:%S", True),
338
+ ("%Y-%m-%d %H:%M:%S", True),
339
+ ("%Y.%m.%d %H:%M:%S", True),
340
+ ("%Y%m%d %H:%M:%S", True),
341
+ ("%Y-%m-%dT%H:%M:%S", True),
342
+ ("%Y-%m-%dT%H:%M:%S%z", True),
343
+ ("%Y-%m-%dT%H:%M:%S%Z", False),
344
+ ("%Y-%m-%dT%H:%M:%S.%f", True),
345
+ ("%Y-%m-%dT%H:%M:%S.%f%z", True),
346
+ ("%Y-%m-%dT%H:%M:%S.%f%Z", False),
347
+ ("%Y%m%d", True),
348
+ ("%Y%m", False),
349
+ ("%Y", True),
350
+ ("%Y-%m-%d", True),
351
+ ("%Y-%m", True),
352
+ ],
353
+ )
354
+ def test_is_iso_format(fmt, expected):
355
+ # see gh-41047
356
+ result = strptime._test_format_is_iso(fmt)
357
+ assert result == expected
358
+
359
+
360
+ @pytest.mark.parametrize(
361
+ "input",
362
+ [
363
+ "2018-01-01T00:00:00.123456789",
364
+ "2018-01-01T00:00:00.123456",
365
+ "2018-01-01T00:00:00.123",
366
+ ],
367
+ )
368
+ def test_guess_datetime_format_f(input):
369
+ # https://github.com/pandas-dev/pandas/issues/49043
370
+ result = parsing.guess_datetime_format(input)
371
+ expected = "%Y-%m-%dT%H:%M:%S.%f"
372
+ assert result == expected
373
+
374
+
375
+ def _helper_hypothesis_delimited_date(call, date_string, **kwargs):
376
+ msg, result = None, None
377
+ try:
378
+ result = call(date_string, **kwargs)
379
+ except ValueError as err:
380
+ msg = str(err)
381
+ return msg, result
382
+
383
+
384
+ @given(DATETIME_NO_TZ)
385
+ @pytest.mark.parametrize("delimiter", list(" -./"))
386
+ @pytest.mark.parametrize("dayfirst", [True, False])
387
+ @pytest.mark.parametrize(
388
+ "date_format",
389
+ ["%d %m %Y", "%m %d %Y", "%m %Y", "%Y %m %d", "%y %m %d", "%Y%m%d", "%y%m%d"],
390
+ )
391
+ def test_hypothesis_delimited_date(
392
+ request, date_format, dayfirst, delimiter, test_datetime
393
+ ):
394
+ if date_format == "%m %Y" and delimiter == ".":
395
+ request.applymarker(
396
+ pytest.mark.xfail(
397
+ reason="parse_datetime_string cannot reliably tell whether "
398
+ "e.g. %m.%Y is a float or a date",
399
+ strict=False,
400
+ )
401
+ )
402
+ date_string = test_datetime.strftime(date_format.replace(" ", delimiter))
403
+
404
+ except_out_dateutil, result = _helper_hypothesis_delimited_date(
405
+ parsing.py_parse_datetime_string, date_string, dayfirst=dayfirst
406
+ )
407
+ except_in_dateutil, expected = _helper_hypothesis_delimited_date(
408
+ du_parse,
409
+ date_string,
410
+ default=datetime(1, 1, 1),
411
+ dayfirst=dayfirst,
412
+ yearfirst=False,
413
+ )
414
+
415
+ assert except_out_dateutil == except_in_dateutil
416
+ assert result == expected
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_period.py ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import pytest
3
+
4
+ from pandas._libs.tslibs import (
5
+ iNaT,
6
+ to_offset,
7
+ )
8
+ from pandas._libs.tslibs.period import (
9
+ extract_ordinals,
10
+ get_period_field_arr,
11
+ period_asfreq,
12
+ period_ordinal,
13
+ )
14
+
15
+ import pandas._testing as tm
16
+
17
+
18
+ def get_freq_code(freqstr: str) -> int:
19
+ off = to_offset(freqstr, is_period=True)
20
+ # error: "BaseOffset" has no attribute "_period_dtype_code"
21
+ code = off._period_dtype_code # type: ignore[attr-defined]
22
+ return code
23
+
24
+
25
+ @pytest.mark.parametrize(
26
+ "freq1,freq2,expected",
27
+ [
28
+ ("D", "h", 24),
29
+ ("D", "min", 1440),
30
+ ("D", "s", 86400),
31
+ ("D", "ms", 86400000),
32
+ ("D", "us", 86400000000),
33
+ ("D", "ns", 86400000000000),
34
+ ("h", "min", 60),
35
+ ("h", "s", 3600),
36
+ ("h", "ms", 3600000),
37
+ ("h", "us", 3600000000),
38
+ ("h", "ns", 3600000000000),
39
+ ("min", "s", 60),
40
+ ("min", "ms", 60000),
41
+ ("min", "us", 60000000),
42
+ ("min", "ns", 60000000000),
43
+ ("s", "ms", 1000),
44
+ ("s", "us", 1000000),
45
+ ("s", "ns", 1000000000),
46
+ ("ms", "us", 1000),
47
+ ("ms", "ns", 1000000),
48
+ ("us", "ns", 1000),
49
+ ],
50
+ )
51
+ def test_intra_day_conversion_factors(freq1, freq2, expected):
52
+ assert (
53
+ period_asfreq(1, get_freq_code(freq1), get_freq_code(freq2), False) == expected
54
+ )
55
+
56
+
57
+ @pytest.mark.parametrize(
58
+ "freq,expected", [("Y", 0), ("M", 0), ("W", 1), ("D", 0), ("B", 0)]
59
+ )
60
+ def test_period_ordinal_start_values(freq, expected):
61
+ # information for Jan. 1, 1970.
62
+ assert period_ordinal(1970, 1, 1, 0, 0, 0, 0, 0, get_freq_code(freq)) == expected
63
+
64
+
65
+ @pytest.mark.parametrize(
66
+ "dt,expected",
67
+ [
68
+ ((1970, 1, 4, 0, 0, 0, 0, 0), 1),
69
+ ((1970, 1, 5, 0, 0, 0, 0, 0), 2),
70
+ ((2013, 10, 6, 0, 0, 0, 0, 0), 2284),
71
+ ((2013, 10, 7, 0, 0, 0, 0, 0), 2285),
72
+ ],
73
+ )
74
+ def test_period_ordinal_week(dt, expected):
75
+ args = dt + (get_freq_code("W"),)
76
+ assert period_ordinal(*args) == expected
77
+
78
+
79
+ @pytest.mark.parametrize(
80
+ "day,expected",
81
+ [
82
+ # Thursday (Oct. 3, 2013).
83
+ (3, 11415),
84
+ # Friday (Oct. 4, 2013).
85
+ (4, 11416),
86
+ # Saturday (Oct. 5, 2013).
87
+ (5, 11417),
88
+ # Sunday (Oct. 6, 2013).
89
+ (6, 11417),
90
+ # Monday (Oct. 7, 2013).
91
+ (7, 11417),
92
+ # Tuesday (Oct. 8, 2013).
93
+ (8, 11418),
94
+ ],
95
+ )
96
+ def test_period_ordinal_business_day(day, expected):
97
+ # 5000 is PeriodDtypeCode for BusinessDay
98
+ args = (2013, 10, day, 0, 0, 0, 0, 0, 5000)
99
+ assert period_ordinal(*args) == expected
100
+
101
+
102
+ class TestExtractOrdinals:
103
+ def test_extract_ordinals_raises(self):
104
+ # with non-object, make sure we raise TypeError, not segfault
105
+ arr = np.arange(5)
106
+ freq = to_offset("D")
107
+ with pytest.raises(TypeError, match="values must be object-dtype"):
108
+ extract_ordinals(arr, freq)
109
+
110
+ def test_extract_ordinals_2d(self):
111
+ freq = to_offset("D")
112
+ arr = np.empty(10, dtype=object)
113
+ arr[:] = iNaT
114
+
115
+ res = extract_ordinals(arr, freq)
116
+ res2 = extract_ordinals(arr.reshape(5, 2), freq)
117
+ tm.assert_numpy_array_equal(res, res2.reshape(-1))
118
+
119
+
120
+ def test_get_period_field_array_raises_on_out_of_range():
121
+ msg = "Buffer dtype mismatch, expected 'const int64_t' but got 'double'"
122
+ with pytest.raises(ValueError, match=msg):
123
+ get_period_field_arr(-1, np.empty(1), 0)
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_resolution.py ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import pytest
3
+ import pytz
4
+
5
+ from pandas._libs.tslibs import (
6
+ Resolution,
7
+ get_resolution,
8
+ )
9
+ from pandas._libs.tslibs.dtypes import NpyDatetimeUnit
10
+
11
+ import pandas._testing as tm
12
+
13
+
14
+ def test_get_resolution_nano():
15
+ # don't return the fallback RESO_DAY
16
+ arr = np.array([1], dtype=np.int64)
17
+ res = get_resolution(arr)
18
+ assert res == Resolution.RESO_NS
19
+
20
+
21
+ def test_get_resolution_non_nano_data():
22
+ arr = np.array([1], dtype=np.int64)
23
+ res = get_resolution(arr, None, NpyDatetimeUnit.NPY_FR_us.value)
24
+ assert res == Resolution.RESO_US
25
+
26
+ res = get_resolution(arr, pytz.UTC, NpyDatetimeUnit.NPY_FR_us.value)
27
+ assert res == Resolution.RESO_US
28
+
29
+
30
+ @pytest.mark.parametrize(
31
+ "freqstr,expected",
32
+ [
33
+ ("Y", "year"),
34
+ ("Q", "quarter"),
35
+ ("M", "month"),
36
+ ("D", "day"),
37
+ ("h", "hour"),
38
+ ("min", "minute"),
39
+ ("s", "second"),
40
+ ("ms", "millisecond"),
41
+ ("us", "microsecond"),
42
+ ("ns", "nanosecond"),
43
+ ],
44
+ )
45
+ def test_get_attrname_from_abbrev(freqstr, expected):
46
+ reso = Resolution.get_reso_from_freqstr(freqstr)
47
+ assert reso.attr_abbrev == freqstr
48
+ assert reso.attrname == expected
49
+
50
+
51
+ @pytest.mark.parametrize("freq", ["A", "H", "T", "S", "L", "U", "N"])
52
+ def test_units_A_H_T_S_L_U_N_deprecated_from_attrname_to_abbrevs(freq):
53
+ # GH#52536
54
+ msg = f"'{freq}' is deprecated and will be removed in a future version."
55
+
56
+ with tm.assert_produces_warning(FutureWarning, match=msg):
57
+ Resolution.get_reso_from_freqstr(freq)
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_strptime.py ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from datetime import (
2
+ datetime,
3
+ timezone,
4
+ )
5
+
6
+ import numpy as np
7
+ import pytest
8
+
9
+ from pandas._libs.tslibs.dtypes import NpyDatetimeUnit
10
+ from pandas._libs.tslibs.strptime import array_strptime
11
+
12
+ from pandas import (
13
+ NaT,
14
+ Timestamp,
15
+ )
16
+ import pandas._testing as tm
17
+
18
+ creso_infer = NpyDatetimeUnit.NPY_FR_GENERIC.value
19
+
20
+
21
+ class TestArrayStrptimeResolutionInference:
22
+ def test_array_strptime_resolution_all_nat(self):
23
+ arr = np.array([NaT, np.nan], dtype=object)
24
+
25
+ fmt = "%Y-%m-%d %H:%M:%S"
26
+ res, _ = array_strptime(arr, fmt=fmt, utc=False, creso=creso_infer)
27
+ assert res.dtype == "M8[s]"
28
+
29
+ res, _ = array_strptime(arr, fmt=fmt, utc=True, creso=creso_infer)
30
+ assert res.dtype == "M8[s]"
31
+
32
+ @pytest.mark.parametrize("tz", [None, timezone.utc])
33
+ def test_array_strptime_resolution_inference_homogeneous_strings(self, tz):
34
+ dt = datetime(2016, 1, 2, 3, 4, 5, 678900, tzinfo=tz)
35
+
36
+ fmt = "%Y-%m-%d %H:%M:%S"
37
+ dtstr = dt.strftime(fmt)
38
+ arr = np.array([dtstr] * 3, dtype=object)
39
+ expected = np.array([dt.replace(tzinfo=None)] * 3, dtype="M8[s]")
40
+
41
+ res, _ = array_strptime(arr, fmt=fmt, utc=False, creso=creso_infer)
42
+ tm.assert_numpy_array_equal(res, expected)
43
+
44
+ fmt = "%Y-%m-%d %H:%M:%S.%f"
45
+ dtstr = dt.strftime(fmt)
46
+ arr = np.array([dtstr] * 3, dtype=object)
47
+ expected = np.array([dt.replace(tzinfo=None)] * 3, dtype="M8[us]")
48
+
49
+ res, _ = array_strptime(arr, fmt=fmt, utc=False, creso=creso_infer)
50
+ tm.assert_numpy_array_equal(res, expected)
51
+
52
+ fmt = "ISO8601"
53
+ res, _ = array_strptime(arr, fmt=fmt, utc=False, creso=creso_infer)
54
+ tm.assert_numpy_array_equal(res, expected)
55
+
56
+ @pytest.mark.parametrize("tz", [None, timezone.utc])
57
+ def test_array_strptime_resolution_mixed(self, tz):
58
+ dt = datetime(2016, 1, 2, 3, 4, 5, 678900, tzinfo=tz)
59
+
60
+ ts = Timestamp(dt).as_unit("ns")
61
+
62
+ arr = np.array([dt, ts], dtype=object)
63
+ expected = np.array(
64
+ [Timestamp(dt).as_unit("ns").asm8, ts.asm8],
65
+ dtype="M8[ns]",
66
+ )
67
+
68
+ fmt = "%Y-%m-%d %H:%M:%S"
69
+ res, _ = array_strptime(arr, fmt=fmt, utc=False, creso=creso_infer)
70
+ tm.assert_numpy_array_equal(res, expected)
71
+
72
+ fmt = "ISO8601"
73
+ res, _ = array_strptime(arr, fmt=fmt, utc=False, creso=creso_infer)
74
+ tm.assert_numpy_array_equal(res, expected)
75
+
76
+ def test_array_strptime_resolution_todaynow(self):
77
+ # specifically case where today/now is the *first* item
78
+ vals = np.array(["today", np.datetime64("2017-01-01", "us")], dtype=object)
79
+
80
+ now = Timestamp("now").asm8
81
+ res, _ = array_strptime(vals, fmt="%Y-%m-%d", utc=False, creso=creso_infer)
82
+ res2, _ = array_strptime(
83
+ vals[::-1], fmt="%Y-%m-%d", utc=False, creso=creso_infer
84
+ )
85
+
86
+ # 1s is an arbitrary cutoff for call overhead; in local testing the
87
+ # actual difference is about 250us
88
+ tolerance = np.timedelta64(1, "s")
89
+
90
+ assert res.dtype == "M8[us]"
91
+ assert abs(res[0] - now) < tolerance
92
+ assert res[1] == vals[1]
93
+
94
+ assert res2.dtype == "M8[us]"
95
+ assert abs(res2[1] - now) < tolerance * 2
96
+ assert res2[0] == vals[1]
97
+
98
+ def test_array_strptime_str_outside_nano_range(self):
99
+ vals = np.array(["2401-09-15"], dtype=object)
100
+ expected = np.array(["2401-09-15"], dtype="M8[s]")
101
+ fmt = "ISO8601"
102
+ res, _ = array_strptime(vals, fmt=fmt, creso=creso_infer)
103
+ tm.assert_numpy_array_equal(res, expected)
104
+
105
+ # non-iso -> different path
106
+ vals2 = np.array(["Sep 15, 2401"], dtype=object)
107
+ expected2 = np.array(["2401-09-15"], dtype="M8[s]")
108
+ fmt2 = "%b %d, %Y"
109
+ res2, _ = array_strptime(vals2, fmt=fmt2, creso=creso_infer)
110
+ tm.assert_numpy_array_equal(res2, expected2)
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_timedeltas.py ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import re
2
+
3
+ import numpy as np
4
+ import pytest
5
+
6
+ from pandas._libs.tslibs.timedeltas import (
7
+ array_to_timedelta64,
8
+ delta_to_nanoseconds,
9
+ ints_to_pytimedelta,
10
+ )
11
+
12
+ from pandas import (
13
+ Timedelta,
14
+ offsets,
15
+ )
16
+ import pandas._testing as tm
17
+
18
+
19
+ @pytest.mark.parametrize(
20
+ "obj,expected",
21
+ [
22
+ (np.timedelta64(14, "D"), 14 * 24 * 3600 * 1e9),
23
+ (Timedelta(minutes=-7), -7 * 60 * 1e9),
24
+ (Timedelta(minutes=-7).to_pytimedelta(), -7 * 60 * 1e9),
25
+ (Timedelta(seconds=1234e-9), 1234), # GH43764, GH40946
26
+ (
27
+ Timedelta(seconds=1e-9, milliseconds=1e-5, microseconds=1e-1),
28
+ 111,
29
+ ), # GH43764
30
+ (
31
+ Timedelta(days=1, seconds=1e-9, milliseconds=1e-5, microseconds=1e-1),
32
+ 24 * 3600e9 + 111,
33
+ ), # GH43764
34
+ (offsets.Nano(125), 125),
35
+ ],
36
+ )
37
+ def test_delta_to_nanoseconds(obj, expected):
38
+ result = delta_to_nanoseconds(obj)
39
+ assert result == expected
40
+
41
+
42
+ def test_delta_to_nanoseconds_error():
43
+ obj = np.array([123456789], dtype="m8[ns]")
44
+
45
+ with pytest.raises(TypeError, match="<class 'numpy.ndarray'>"):
46
+ delta_to_nanoseconds(obj)
47
+
48
+ with pytest.raises(TypeError, match="float"):
49
+ delta_to_nanoseconds(1.5)
50
+ with pytest.raises(TypeError, match="int"):
51
+ delta_to_nanoseconds(1)
52
+ with pytest.raises(TypeError, match="int"):
53
+ delta_to_nanoseconds(np.int64(2))
54
+ with pytest.raises(TypeError, match="int"):
55
+ delta_to_nanoseconds(np.int32(3))
56
+
57
+
58
+ def test_delta_to_nanoseconds_td64_MY_raises():
59
+ msg = (
60
+ "delta_to_nanoseconds does not support Y or M units, "
61
+ "as their duration in nanoseconds is ambiguous"
62
+ )
63
+
64
+ td = np.timedelta64(1234, "Y")
65
+
66
+ with pytest.raises(ValueError, match=msg):
67
+ delta_to_nanoseconds(td)
68
+
69
+ td = np.timedelta64(1234, "M")
70
+
71
+ with pytest.raises(ValueError, match=msg):
72
+ delta_to_nanoseconds(td)
73
+
74
+
75
+ @pytest.mark.parametrize("unit", ["Y", "M"])
76
+ def test_unsupported_td64_unit_raises(unit):
77
+ # GH 52806
78
+ with pytest.raises(
79
+ ValueError,
80
+ match=f"Unit {unit} is not supported. "
81
+ "Only unambiguous timedelta values durations are supported. "
82
+ "Allowed units are 'W', 'D', 'h', 'm', 's', 'ms', 'us', 'ns'",
83
+ ):
84
+ Timedelta(np.timedelta64(1, unit))
85
+
86
+
87
+ def test_huge_nanoseconds_overflow():
88
+ # GH 32402
89
+ assert delta_to_nanoseconds(Timedelta(1e10)) == 1e10
90
+ assert delta_to_nanoseconds(Timedelta(nanoseconds=1e10)) == 1e10
91
+
92
+
93
+ @pytest.mark.parametrize(
94
+ "kwargs", [{"Seconds": 1}, {"seconds": 1, "Nanoseconds": 1}, {"Foo": 2}]
95
+ )
96
+ def test_kwarg_assertion(kwargs):
97
+ err_message = (
98
+ "cannot construct a Timedelta from the passed arguments, "
99
+ "allowed keywords are "
100
+ "[weeks, days, hours, minutes, seconds, "
101
+ "milliseconds, microseconds, nanoseconds]"
102
+ )
103
+
104
+ with pytest.raises(ValueError, match=re.escape(err_message)):
105
+ Timedelta(**kwargs)
106
+
107
+
108
+ class TestArrayToTimedelta64:
109
+ def test_array_to_timedelta64_string_with_unit_2d_raises(self):
110
+ # check the 'unit is not None and errors != "coerce"' path
111
+ # in array_to_timedelta64 raises correctly with 2D values
112
+ values = np.array([["1", 2], [3, "4"]], dtype=object)
113
+ with pytest.raises(ValueError, match="unit must not be specified"):
114
+ array_to_timedelta64(values, unit="s")
115
+
116
+ def test_array_to_timedelta64_non_object_raises(self):
117
+ # check we raise, not segfault
118
+ values = np.arange(5)
119
+
120
+ msg = "'values' must have object dtype"
121
+ with pytest.raises(TypeError, match=msg):
122
+ array_to_timedelta64(values)
123
+
124
+
125
+ @pytest.mark.parametrize("unit", ["s", "ms", "us"])
126
+ def test_ints_to_pytimedelta(unit):
127
+ # tests for non-nanosecond cases
128
+ arr = np.arange(6, dtype=np.int64).view(f"m8[{unit}]")
129
+
130
+ res = ints_to_pytimedelta(arr, box=False)
131
+ # For non-nanosecond, .astype(object) gives pytimedelta objects
132
+ # instead of integers
133
+ expected = arr.astype(object)
134
+ tm.assert_numpy_array_equal(res, expected)
135
+
136
+ res = ints_to_pytimedelta(arr, box=True)
137
+ expected = np.array([Timedelta(x) for x in arr], dtype=object)
138
+ tm.assert_numpy_array_equal(res, expected)
139
+
140
+
141
+ @pytest.mark.parametrize("unit", ["Y", "M", "ps", "fs", "as"])
142
+ def test_ints_to_pytimedelta_unsupported(unit):
143
+ arr = np.arange(6, dtype=np.int64).view(f"m8[{unit}]")
144
+
145
+ with pytest.raises(NotImplementedError, match=r"\d{1,2}"):
146
+ ints_to_pytimedelta(arr, box=False)
147
+ msg = "Only resolutions 's', 'ms', 'us', 'ns' are supported"
148
+ with pytest.raises(NotImplementedError, match=msg):
149
+ ints_to_pytimedelta(arr, box=True)
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_timezones.py ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from datetime import (
2
+ datetime,
3
+ timedelta,
4
+ timezone,
5
+ )
6
+
7
+ import dateutil.tz
8
+ import pytest
9
+ import pytz
10
+
11
+ from pandas._libs.tslibs import (
12
+ conversion,
13
+ timezones,
14
+ )
15
+ from pandas.compat import is_platform_windows
16
+
17
+ from pandas import Timestamp
18
+
19
+
20
+ def test_is_utc(utc_fixture):
21
+ tz = timezones.maybe_get_tz(utc_fixture)
22
+ assert timezones.is_utc(tz)
23
+
24
+
25
+ @pytest.mark.parametrize("tz_name", list(pytz.common_timezones))
26
+ def test_cache_keys_are_distinct_for_pytz_vs_dateutil(tz_name):
27
+ tz_p = timezones.maybe_get_tz(tz_name)
28
+ tz_d = timezones.maybe_get_tz("dateutil/" + tz_name)
29
+
30
+ if tz_d is None:
31
+ pytest.skip(tz_name + ": dateutil does not know about this one")
32
+
33
+ if not (tz_name == "UTC" and is_platform_windows()):
34
+ # they both end up as tzwin("UTC") on windows
35
+ assert timezones._p_tz_cache_key(tz_p) != timezones._p_tz_cache_key(tz_d)
36
+
37
+
38
+ def test_tzlocal_repr():
39
+ # see gh-13583
40
+ ts = Timestamp("2011-01-01", tz=dateutil.tz.tzlocal())
41
+ assert ts.tz == dateutil.tz.tzlocal()
42
+ assert "tz='tzlocal()')" in repr(ts)
43
+
44
+
45
+ def test_tzlocal_maybe_get_tz():
46
+ # see gh-13583
47
+ tz = timezones.maybe_get_tz("tzlocal()")
48
+ assert tz == dateutil.tz.tzlocal()
49
+
50
+
51
+ def test_tzlocal_offset():
52
+ # see gh-13583
53
+ #
54
+ # Get offset using normal datetime for test.
55
+ ts = Timestamp("2011-01-01", tz=dateutil.tz.tzlocal())
56
+
57
+ offset = dateutil.tz.tzlocal().utcoffset(datetime(2011, 1, 1))
58
+ offset = offset.total_seconds()
59
+
60
+ assert ts._value + offset == Timestamp("2011-01-01")._value
61
+
62
+
63
+ def test_tzlocal_is_not_utc():
64
+ # even if the machine running the test is localized to UTC
65
+ tz = dateutil.tz.tzlocal()
66
+ assert not timezones.is_utc(tz)
67
+
68
+ assert not timezones.tz_compare(tz, dateutil.tz.tzutc())
69
+
70
+
71
+ def test_tz_compare_utc(utc_fixture, utc_fixture2):
72
+ tz = timezones.maybe_get_tz(utc_fixture)
73
+ tz2 = timezones.maybe_get_tz(utc_fixture2)
74
+ assert timezones.tz_compare(tz, tz2)
75
+
76
+
77
+ @pytest.fixture(
78
+ params=[
79
+ (pytz.timezone("US/Eastern"), lambda tz, x: tz.localize(x)),
80
+ (dateutil.tz.gettz("US/Eastern"), lambda tz, x: x.replace(tzinfo=tz)),
81
+ ]
82
+ )
83
+ def infer_setup(request):
84
+ eastern, localize = request.param
85
+
86
+ start_naive = datetime(2001, 1, 1)
87
+ end_naive = datetime(2009, 1, 1)
88
+
89
+ start = localize(eastern, start_naive)
90
+ end = localize(eastern, end_naive)
91
+
92
+ return eastern, localize, start, end, start_naive, end_naive
93
+
94
+
95
+ def test_infer_tz_compat(infer_setup):
96
+ eastern, _, start, end, start_naive, end_naive = infer_setup
97
+
98
+ assert (
99
+ timezones.infer_tzinfo(start, end)
100
+ is conversion.localize_pydatetime(start_naive, eastern).tzinfo
101
+ )
102
+ assert (
103
+ timezones.infer_tzinfo(start, None)
104
+ is conversion.localize_pydatetime(start_naive, eastern).tzinfo
105
+ )
106
+ assert (
107
+ timezones.infer_tzinfo(None, end)
108
+ is conversion.localize_pydatetime(end_naive, eastern).tzinfo
109
+ )
110
+
111
+
112
+ def test_infer_tz_utc_localize(infer_setup):
113
+ _, _, start, end, start_naive, end_naive = infer_setup
114
+ utc = pytz.utc
115
+
116
+ start = utc.localize(start_naive)
117
+ end = utc.localize(end_naive)
118
+
119
+ assert timezones.infer_tzinfo(start, end) is utc
120
+
121
+
122
+ @pytest.mark.parametrize("ordered", [True, False])
123
+ def test_infer_tz_mismatch(infer_setup, ordered):
124
+ eastern, _, _, _, start_naive, end_naive = infer_setup
125
+ msg = "Inputs must both have the same timezone"
126
+
127
+ utc = pytz.utc
128
+ start = utc.localize(start_naive)
129
+ end = conversion.localize_pydatetime(end_naive, eastern)
130
+
131
+ args = (start, end) if ordered else (end, start)
132
+
133
+ with pytest.raises(AssertionError, match=msg):
134
+ timezones.infer_tzinfo(*args)
135
+
136
+
137
+ def test_maybe_get_tz_invalid_types():
138
+ with pytest.raises(TypeError, match="<class 'float'>"):
139
+ timezones.maybe_get_tz(44.0)
140
+
141
+ with pytest.raises(TypeError, match="<class 'module'>"):
142
+ timezones.maybe_get_tz(pytz)
143
+
144
+ msg = "<class 'pandas._libs.tslibs.timestamps.Timestamp'>"
145
+ with pytest.raises(TypeError, match=msg):
146
+ timezones.maybe_get_tz(Timestamp("2021-01-01", tz="UTC"))
147
+
148
+
149
+ def test_maybe_get_tz_offset_only():
150
+ # see gh-36004
151
+
152
+ # timezone.utc
153
+ tz = timezones.maybe_get_tz(timezone.utc)
154
+ assert tz == timezone(timedelta(hours=0, minutes=0))
155
+
156
+ # without UTC+- prefix
157
+ tz = timezones.maybe_get_tz("+01:15")
158
+ assert tz == timezone(timedelta(hours=1, minutes=15))
159
+
160
+ tz = timezones.maybe_get_tz("-01:15")
161
+ assert tz == timezone(-timedelta(hours=1, minutes=15))
162
+
163
+ # with UTC+- prefix
164
+ tz = timezones.maybe_get_tz("UTC+02:45")
165
+ assert tz == timezone(timedelta(hours=2, minutes=45))
166
+
167
+ tz = timezones.maybe_get_tz("UTC-02:45")
168
+ assert tz == timezone(-timedelta(hours=2, minutes=45))
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_to_offset.py ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import re
2
+
3
+ import pytest
4
+
5
+ from pandas._libs.tslibs import (
6
+ Timedelta,
7
+ offsets,
8
+ to_offset,
9
+ )
10
+
11
+
12
+ @pytest.mark.parametrize(
13
+ "freq_input,expected",
14
+ [
15
+ (to_offset("10us"), offsets.Micro(10)),
16
+ (offsets.Hour(), offsets.Hour()),
17
+ ("2h30min", offsets.Minute(150)),
18
+ ("2h 30min", offsets.Minute(150)),
19
+ ("2h30min15s", offsets.Second(150 * 60 + 15)),
20
+ ("2h 60min", offsets.Hour(3)),
21
+ ("2h 20.5min", offsets.Second(8430)),
22
+ ("1.5min", offsets.Second(90)),
23
+ ("0.5s", offsets.Milli(500)),
24
+ ("15ms500us", offsets.Micro(15500)),
25
+ ("10s75ms", offsets.Milli(10075)),
26
+ ("1s0.25ms", offsets.Micro(1000250)),
27
+ ("1s0.25ms", offsets.Micro(1000250)),
28
+ ("2800ns", offsets.Nano(2800)),
29
+ ("2SME", offsets.SemiMonthEnd(2)),
30
+ ("2SME-16", offsets.SemiMonthEnd(2, day_of_month=16)),
31
+ ("2SMS-14", offsets.SemiMonthBegin(2, day_of_month=14)),
32
+ ("2SMS-15", offsets.SemiMonthBegin(2)),
33
+ ],
34
+ )
35
+ def test_to_offset(freq_input, expected):
36
+ result = to_offset(freq_input)
37
+ assert result == expected
38
+
39
+
40
+ @pytest.mark.parametrize(
41
+ "freqstr,expected", [("-1s", -1), ("-2SME", -2), ("-1SMS", -1), ("-5min10s", -310)]
42
+ )
43
+ def test_to_offset_negative(freqstr, expected):
44
+ result = to_offset(freqstr)
45
+ assert result.n == expected
46
+
47
+
48
+ @pytest.mark.filterwarnings("ignore:.*'m' is deprecated.*:FutureWarning")
49
+ @pytest.mark.parametrize(
50
+ "freqstr",
51
+ [
52
+ "2h20m",
53
+ "us1",
54
+ "-us",
55
+ "3us1",
56
+ "-2-3us",
57
+ "-2D:3h",
58
+ "1.5.0s",
59
+ "2SMS-15-15",
60
+ "2SMS-15D",
61
+ "100foo",
62
+ # Invalid leading +/- signs.
63
+ "+-1d",
64
+ "-+1h",
65
+ "+1",
66
+ "-7",
67
+ "+d",
68
+ "-m",
69
+ # Invalid shortcut anchors.
70
+ "SME-0",
71
+ "SME-28",
72
+ "SME-29",
73
+ "SME-FOO",
74
+ "BSM",
75
+ "SME--1",
76
+ "SMS-1",
77
+ "SMS-28",
78
+ "SMS-30",
79
+ "SMS-BAR",
80
+ "SMS-BYR",
81
+ "BSMS",
82
+ "SMS--2",
83
+ ],
84
+ )
85
+ def test_to_offset_invalid(freqstr):
86
+ # see gh-13930
87
+
88
+ # We escape string because some of our
89
+ # inputs contain regex special characters.
90
+ msg = re.escape(f"Invalid frequency: {freqstr}")
91
+ with pytest.raises(ValueError, match=msg):
92
+ to_offset(freqstr)
93
+
94
+
95
+ def test_to_offset_no_evaluate():
96
+ msg = str(("", ""))
97
+ with pytest.raises(TypeError, match=msg):
98
+ to_offset(("", ""))
99
+
100
+
101
+ def test_to_offset_tuple_unsupported():
102
+ with pytest.raises(TypeError, match="pass as a string instead"):
103
+ to_offset((5, "T"))
104
+
105
+
106
+ @pytest.mark.parametrize(
107
+ "freqstr,expected",
108
+ [
109
+ ("2D 3h", offsets.Hour(51)),
110
+ ("2 D3 h", offsets.Hour(51)),
111
+ ("2 D 3 h", offsets.Hour(51)),
112
+ (" 2 D 3 h ", offsets.Hour(51)),
113
+ (" h ", offsets.Hour()),
114
+ (" 3 h ", offsets.Hour(3)),
115
+ ],
116
+ )
117
+ def test_to_offset_whitespace(freqstr, expected):
118
+ result = to_offset(freqstr)
119
+ assert result == expected
120
+
121
+
122
+ @pytest.mark.parametrize(
123
+ "freqstr,expected", [("00h 00min 01s", 1), ("-00h 03min 14s", -194)]
124
+ )
125
+ def test_to_offset_leading_zero(freqstr, expected):
126
+ result = to_offset(freqstr)
127
+ assert result.n == expected
128
+
129
+
130
+ @pytest.mark.parametrize("freqstr,expected", [("+1d", 1), ("+2h30min", 150)])
131
+ def test_to_offset_leading_plus(freqstr, expected):
132
+ result = to_offset(freqstr)
133
+ assert result.n == expected
134
+
135
+
136
+ @pytest.mark.parametrize(
137
+ "kwargs,expected",
138
+ [
139
+ ({"days": 1, "seconds": 1}, offsets.Second(86401)),
140
+ ({"days": -1, "seconds": 1}, offsets.Second(-86399)),
141
+ ({"hours": 1, "minutes": 10}, offsets.Minute(70)),
142
+ ({"hours": 1, "minutes": -10}, offsets.Minute(50)),
143
+ ({"weeks": 1}, offsets.Day(7)),
144
+ ({"hours": 1}, offsets.Hour(1)),
145
+ ({"hours": 1}, to_offset("60min")),
146
+ ({"microseconds": 1}, offsets.Micro(1)),
147
+ ({"microseconds": 0}, offsets.Nano(0)),
148
+ ],
149
+ )
150
+ def test_to_offset_pd_timedelta(kwargs, expected):
151
+ # see gh-9064
152
+ td = Timedelta(**kwargs)
153
+ result = to_offset(td)
154
+ assert result == expected
155
+
156
+
157
+ @pytest.mark.parametrize(
158
+ "shortcut,expected",
159
+ [
160
+ ("W", offsets.Week(weekday=6)),
161
+ ("W-SUN", offsets.Week(weekday=6)),
162
+ ("QE", offsets.QuarterEnd(startingMonth=12)),
163
+ ("QE-DEC", offsets.QuarterEnd(startingMonth=12)),
164
+ ("QE-MAY", offsets.QuarterEnd(startingMonth=5)),
165
+ ("SME", offsets.SemiMonthEnd(day_of_month=15)),
166
+ ("SME-15", offsets.SemiMonthEnd(day_of_month=15)),
167
+ ("SME-1", offsets.SemiMonthEnd(day_of_month=1)),
168
+ ("SME-27", offsets.SemiMonthEnd(day_of_month=27)),
169
+ ("SMS-2", offsets.SemiMonthBegin(day_of_month=2)),
170
+ ("SMS-27", offsets.SemiMonthBegin(day_of_month=27)),
171
+ ],
172
+ )
173
+ def test_anchored_shortcuts(shortcut, expected):
174
+ result = to_offset(shortcut)
175
+ assert result == expected
176
+
177
+
178
+ @pytest.mark.parametrize(
179
+ "freq_depr",
180
+ [
181
+ "2ye-mar",
182
+ "2ys",
183
+ "2qe",
184
+ "2qs-feb",
185
+ "2bqs",
186
+ "2sms",
187
+ "2bms",
188
+ "2cbme",
189
+ "2me",
190
+ "2w",
191
+ ],
192
+ )
193
+ def test_to_offset_lowercase_frequency_deprecated(freq_depr):
194
+ # GH#54939
195
+ depr_msg = f"'{freq_depr[1:]}' is deprecated and will be removed in a "
196
+ f"future version, please use '{freq_depr.upper()[1:]}' instead."
197
+
198
+ with pytest.raises(FutureWarning, match=depr_msg):
199
+ to_offset(freq_depr)
200
+
201
+
202
+ @pytest.mark.parametrize(
203
+ "freq_depr",
204
+ [
205
+ "2H",
206
+ "2BH",
207
+ "2MIN",
208
+ "2S",
209
+ "2Us",
210
+ "2NS",
211
+ ],
212
+ )
213
+ def test_to_offset_uppercase_frequency_deprecated(freq_depr):
214
+ # GH#54939
215
+ depr_msg = f"'{freq_depr[1:]}' is deprecated and will be removed in a "
216
+ f"future version, please use '{freq_depr.lower()[1:]}' instead."
217
+
218
+ with pytest.raises(FutureWarning, match=depr_msg):
219
+ to_offset(freq_depr)
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/tslibs/test_tzconversion.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import pytest
3
+ import pytz
4
+
5
+ from pandas._libs.tslibs.tzconversion import tz_localize_to_utc
6
+
7
+
8
+ class TestTZLocalizeToUTC:
9
+ def test_tz_localize_to_utc_ambiguous_infer(self):
10
+ # val is a timestamp that is ambiguous when localized to US/Eastern
11
+ val = 1_320_541_200_000_000_000
12
+ vals = np.array([val, val - 1, val], dtype=np.int64)
13
+
14
+ with pytest.raises(pytz.AmbiguousTimeError, match="2011-11-06 01:00:00"):
15
+ tz_localize_to_utc(vals, pytz.timezone("US/Eastern"), ambiguous="infer")
16
+
17
+ with pytest.raises(pytz.AmbiguousTimeError, match="are no repeated times"):
18
+ tz_localize_to_utc(vals[:1], pytz.timezone("US/Eastern"), ambiguous="infer")
19
+
20
+ vals[1] += 1
21
+ msg = "There are 2 dst switches when there should only be 1"
22
+ with pytest.raises(pytz.AmbiguousTimeError, match=msg):
23
+ tz_localize_to_utc(vals, pytz.timezone("US/Eastern"), ambiguous="infer")
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/__init__.py ADDED
File without changes
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/conftest.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pytest
2
+
3
+
4
+ @pytest.fixture(params=[True, False])
5
+ def check_dtype(request):
6
+ return request.param
7
+
8
+
9
+ @pytest.fixture(params=[True, False])
10
+ def check_exact(request):
11
+ return request.param
12
+
13
+
14
+ @pytest.fixture(params=[True, False])
15
+ def check_index_type(request):
16
+ return request.param
17
+
18
+
19
+ @pytest.fixture(params=[0.5e-3, 0.5e-5])
20
+ def rtol(request):
21
+ return request.param
22
+
23
+
24
+ @pytest.fixture(params=[True, False])
25
+ def check_categorical(request):
26
+ return request.param
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_assert_almost_equal.py ADDED
@@ -0,0 +1,586 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import pytest
3
+
4
+ from pandas import (
5
+ NA,
6
+ DataFrame,
7
+ Index,
8
+ NaT,
9
+ Series,
10
+ Timestamp,
11
+ )
12
+ import pandas._testing as tm
13
+
14
+
15
+ def _assert_almost_equal_both(a, b, **kwargs):
16
+ """
17
+ Check that two objects are approximately equal.
18
+
19
+ This check is performed commutatively.
20
+
21
+ Parameters
22
+ ----------
23
+ a : object
24
+ The first object to compare.
25
+ b : object
26
+ The second object to compare.
27
+ **kwargs
28
+ The arguments passed to `tm.assert_almost_equal`.
29
+ """
30
+ tm.assert_almost_equal(a, b, **kwargs)
31
+ tm.assert_almost_equal(b, a, **kwargs)
32
+
33
+
34
+ def _assert_not_almost_equal(a, b, **kwargs):
35
+ """
36
+ Check that two objects are not approximately equal.
37
+
38
+ Parameters
39
+ ----------
40
+ a : object
41
+ The first object to compare.
42
+ b : object
43
+ The second object to compare.
44
+ **kwargs
45
+ The arguments passed to `tm.assert_almost_equal`.
46
+ """
47
+ try:
48
+ tm.assert_almost_equal(a, b, **kwargs)
49
+ msg = f"{a} and {b} were approximately equal when they shouldn't have been"
50
+ pytest.fail(reason=msg)
51
+ except AssertionError:
52
+ pass
53
+
54
+
55
+ def _assert_not_almost_equal_both(a, b, **kwargs):
56
+ """
57
+ Check that two objects are not approximately equal.
58
+
59
+ This check is performed commutatively.
60
+
61
+ Parameters
62
+ ----------
63
+ a : object
64
+ The first object to compare.
65
+ b : object
66
+ The second object to compare.
67
+ **kwargs
68
+ The arguments passed to `tm.assert_almost_equal`.
69
+ """
70
+ _assert_not_almost_equal(a, b, **kwargs)
71
+ _assert_not_almost_equal(b, a, **kwargs)
72
+
73
+
74
+ @pytest.mark.parametrize(
75
+ "a,b",
76
+ [
77
+ (1.1, 1.1),
78
+ (1.1, 1.100001),
79
+ (np.int16(1), 1.000001),
80
+ (np.float64(1.1), 1.1),
81
+ (np.uint32(5), 5),
82
+ ],
83
+ )
84
+ def test_assert_almost_equal_numbers(a, b):
85
+ _assert_almost_equal_both(a, b)
86
+
87
+
88
+ @pytest.mark.parametrize(
89
+ "a,b",
90
+ [
91
+ (1.1, 1),
92
+ (1.1, True),
93
+ (1, 2),
94
+ (1.0001, np.int16(1)),
95
+ # The following two examples are not "almost equal" due to tol.
96
+ (0.1, 0.1001),
97
+ (0.0011, 0.0012),
98
+ ],
99
+ )
100
+ def test_assert_not_almost_equal_numbers(a, b):
101
+ _assert_not_almost_equal_both(a, b)
102
+
103
+
104
+ @pytest.mark.parametrize(
105
+ "a,b",
106
+ [
107
+ (1.1, 1.1),
108
+ (1.1, 1.100001),
109
+ (1.1, 1.1001),
110
+ (0.000001, 0.000005),
111
+ (1000.0, 1000.0005),
112
+ # Testing this example, as per #13357
113
+ (0.000011, 0.000012),
114
+ ],
115
+ )
116
+ def test_assert_almost_equal_numbers_atol(a, b):
117
+ # Equivalent to the deprecated check_less_precise=True, enforced in 2.0
118
+ _assert_almost_equal_both(a, b, rtol=0.5e-3, atol=0.5e-3)
119
+
120
+
121
+ @pytest.mark.parametrize("a,b", [(1.1, 1.11), (0.1, 0.101), (0.000011, 0.001012)])
122
+ def test_assert_not_almost_equal_numbers_atol(a, b):
123
+ _assert_not_almost_equal_both(a, b, atol=1e-3)
124
+
125
+
126
+ @pytest.mark.parametrize(
127
+ "a,b",
128
+ [
129
+ (1.1, 1.1),
130
+ (1.1, 1.100001),
131
+ (1.1, 1.1001),
132
+ (1000.0, 1000.0005),
133
+ (1.1, 1.11),
134
+ (0.1, 0.101),
135
+ ],
136
+ )
137
+ def test_assert_almost_equal_numbers_rtol(a, b):
138
+ _assert_almost_equal_both(a, b, rtol=0.05)
139
+
140
+
141
+ @pytest.mark.parametrize("a,b", [(0.000011, 0.000012), (0.000001, 0.000005)])
142
+ def test_assert_not_almost_equal_numbers_rtol(a, b):
143
+ _assert_not_almost_equal_both(a, b, rtol=0.05)
144
+
145
+
146
+ @pytest.mark.parametrize(
147
+ "a,b,rtol",
148
+ [
149
+ (1.00001, 1.00005, 0.001),
150
+ (-0.908356 + 0.2j, -0.908358 + 0.2j, 1e-3),
151
+ (0.1 + 1.009j, 0.1 + 1.006j, 0.1),
152
+ (0.1001 + 2.0j, 0.1 + 2.001j, 0.01),
153
+ ],
154
+ )
155
+ def test_assert_almost_equal_complex_numbers(a, b, rtol):
156
+ _assert_almost_equal_both(a, b, rtol=rtol)
157
+ _assert_almost_equal_both(np.complex64(a), np.complex64(b), rtol=rtol)
158
+ _assert_almost_equal_both(np.complex128(a), np.complex128(b), rtol=rtol)
159
+
160
+
161
+ @pytest.mark.parametrize(
162
+ "a,b,rtol",
163
+ [
164
+ (0.58310768, 0.58330768, 1e-7),
165
+ (-0.908 + 0.2j, -0.978 + 0.2j, 0.001),
166
+ (0.1 + 1j, 0.1 + 2j, 0.01),
167
+ (-0.132 + 1.001j, -0.132 + 1.005j, 1e-5),
168
+ (0.58310768j, 0.58330768j, 1e-9),
169
+ ],
170
+ )
171
+ def test_assert_not_almost_equal_complex_numbers(a, b, rtol):
172
+ _assert_not_almost_equal_both(a, b, rtol=rtol)
173
+ _assert_not_almost_equal_both(np.complex64(a), np.complex64(b), rtol=rtol)
174
+ _assert_not_almost_equal_both(np.complex128(a), np.complex128(b), rtol=rtol)
175
+
176
+
177
+ @pytest.mark.parametrize("a,b", [(0, 0), (0, 0.0), (0, np.float64(0)), (0.00000001, 0)])
178
+ def test_assert_almost_equal_numbers_with_zeros(a, b):
179
+ _assert_almost_equal_both(a, b)
180
+
181
+
182
+ @pytest.mark.parametrize("a,b", [(0.001, 0), (1, 0)])
183
+ def test_assert_not_almost_equal_numbers_with_zeros(a, b):
184
+ _assert_not_almost_equal_both(a, b)
185
+
186
+
187
+ @pytest.mark.parametrize("a,b", [(1, "abc"), (1, [1]), (1, object())])
188
+ def test_assert_not_almost_equal_numbers_with_mixed(a, b):
189
+ _assert_not_almost_equal_both(a, b)
190
+
191
+
192
+ @pytest.mark.parametrize(
193
+ "left_dtype", ["M8[ns]", "m8[ns]", "float64", "int64", "object"]
194
+ )
195
+ @pytest.mark.parametrize(
196
+ "right_dtype", ["M8[ns]", "m8[ns]", "float64", "int64", "object"]
197
+ )
198
+ def test_assert_almost_equal_edge_case_ndarrays(left_dtype, right_dtype):
199
+ # Empty compare.
200
+ _assert_almost_equal_both(
201
+ np.array([], dtype=left_dtype),
202
+ np.array([], dtype=right_dtype),
203
+ check_dtype=False,
204
+ )
205
+
206
+
207
+ def test_assert_almost_equal_sets():
208
+ # GH#51727
209
+ _assert_almost_equal_both({1, 2, 3}, {1, 2, 3})
210
+
211
+
212
+ def test_assert_almost_not_equal_sets():
213
+ # GH#51727
214
+ msg = r"{1, 2, 3} != {1, 2, 4}"
215
+ with pytest.raises(AssertionError, match=msg):
216
+ _assert_almost_equal_both({1, 2, 3}, {1, 2, 4})
217
+
218
+
219
+ def test_assert_almost_equal_dicts():
220
+ _assert_almost_equal_both({"a": 1, "b": 2}, {"a": 1, "b": 2})
221
+
222
+
223
+ @pytest.mark.parametrize(
224
+ "a,b",
225
+ [
226
+ ({"a": 1, "b": 2}, {"a": 1, "b": 3}),
227
+ ({"a": 1, "b": 2}, {"a": 1, "b": 2, "c": 3}),
228
+ ({"a": 1}, 1),
229
+ ({"a": 1}, "abc"),
230
+ ({"a": 1}, [1]),
231
+ ],
232
+ )
233
+ def test_assert_not_almost_equal_dicts(a, b):
234
+ _assert_not_almost_equal_both(a, b)
235
+
236
+
237
+ @pytest.mark.parametrize("val", [1, 2])
238
+ def test_assert_almost_equal_dict_like_object(val):
239
+ dict_val = 1
240
+ real_dict = {"a": val}
241
+
242
+ class DictLikeObj:
243
+ def keys(self):
244
+ return ("a",)
245
+
246
+ def __getitem__(self, item):
247
+ if item == "a":
248
+ return dict_val
249
+
250
+ func = (
251
+ _assert_almost_equal_both if val == dict_val else _assert_not_almost_equal_both
252
+ )
253
+ func(real_dict, DictLikeObj(), check_dtype=False)
254
+
255
+
256
+ def test_assert_almost_equal_strings():
257
+ _assert_almost_equal_both("abc", "abc")
258
+
259
+
260
+ @pytest.mark.parametrize(
261
+ "a,b", [("abc", "abcd"), ("abc", "abd"), ("abc", 1), ("abc", [1])]
262
+ )
263
+ def test_assert_not_almost_equal_strings(a, b):
264
+ _assert_not_almost_equal_both(a, b)
265
+
266
+
267
+ @pytest.mark.parametrize(
268
+ "a,b", [([1, 2, 3], [1, 2, 3]), (np.array([1, 2, 3]), np.array([1, 2, 3]))]
269
+ )
270
+ def test_assert_almost_equal_iterables(a, b):
271
+ _assert_almost_equal_both(a, b)
272
+
273
+
274
+ @pytest.mark.parametrize(
275
+ "a,b",
276
+ [
277
+ # Class is different.
278
+ (np.array([1, 2, 3]), [1, 2, 3]),
279
+ # Dtype is different.
280
+ (np.array([1, 2, 3]), np.array([1.0, 2.0, 3.0])),
281
+ # Can't compare generators.
282
+ (iter([1, 2, 3]), [1, 2, 3]),
283
+ ([1, 2, 3], [1, 2, 4]),
284
+ ([1, 2, 3], [1, 2, 3, 4]),
285
+ ([1, 2, 3], 1),
286
+ ],
287
+ )
288
+ def test_assert_not_almost_equal_iterables(a, b):
289
+ _assert_not_almost_equal(a, b)
290
+
291
+
292
+ def test_assert_almost_equal_null():
293
+ _assert_almost_equal_both(None, None)
294
+
295
+
296
+ @pytest.mark.parametrize("a,b", [(None, np.nan), (None, 0), (np.nan, 0)])
297
+ def test_assert_not_almost_equal_null(a, b):
298
+ _assert_not_almost_equal(a, b)
299
+
300
+
301
+ @pytest.mark.parametrize(
302
+ "a,b",
303
+ [
304
+ (np.inf, np.inf),
305
+ (np.inf, float("inf")),
306
+ (np.array([np.inf, np.nan, -np.inf]), np.array([np.inf, np.nan, -np.inf])),
307
+ ],
308
+ )
309
+ def test_assert_almost_equal_inf(a, b):
310
+ _assert_almost_equal_both(a, b)
311
+
312
+
313
+ objs = [NA, np.nan, NaT, None, np.datetime64("NaT"), np.timedelta64("NaT")]
314
+
315
+
316
+ @pytest.mark.parametrize("left", objs)
317
+ @pytest.mark.parametrize("right", objs)
318
+ def test_mismatched_na_assert_almost_equal_deprecation(left, right):
319
+ left_arr = np.array([left], dtype=object)
320
+ right_arr = np.array([right], dtype=object)
321
+
322
+ msg = "Mismatched null-like values"
323
+
324
+ if left is right:
325
+ _assert_almost_equal_both(left, right, check_dtype=False)
326
+ tm.assert_numpy_array_equal(left_arr, right_arr)
327
+ tm.assert_index_equal(
328
+ Index(left_arr, dtype=object), Index(right_arr, dtype=object)
329
+ )
330
+ tm.assert_series_equal(
331
+ Series(left_arr, dtype=object), Series(right_arr, dtype=object)
332
+ )
333
+ tm.assert_frame_equal(
334
+ DataFrame(left_arr, dtype=object), DataFrame(right_arr, dtype=object)
335
+ )
336
+
337
+ else:
338
+ with tm.assert_produces_warning(FutureWarning, match=msg):
339
+ _assert_almost_equal_both(left, right, check_dtype=False)
340
+
341
+ # TODO: to get the same deprecation in assert_numpy_array_equal we need
342
+ # to change/deprecate the default for strict_nan to become True
343
+ # TODO: to get the same deprecation in assert_index_equal we need to
344
+ # change/deprecate array_equivalent_object to be stricter, as
345
+ # assert_index_equal uses Index.equal which uses array_equivalent.
346
+ with tm.assert_produces_warning(FutureWarning, match=msg):
347
+ tm.assert_series_equal(
348
+ Series(left_arr, dtype=object), Series(right_arr, dtype=object)
349
+ )
350
+ with tm.assert_produces_warning(FutureWarning, match=msg):
351
+ tm.assert_frame_equal(
352
+ DataFrame(left_arr, dtype=object), DataFrame(right_arr, dtype=object)
353
+ )
354
+
355
+
356
+ def test_assert_not_almost_equal_inf():
357
+ _assert_not_almost_equal_both(np.inf, 0)
358
+
359
+
360
+ @pytest.mark.parametrize(
361
+ "a,b",
362
+ [
363
+ (Index([1.0, 1.1]), Index([1.0, 1.100001])),
364
+ (Series([1.0, 1.1]), Series([1.0, 1.100001])),
365
+ (np.array([1.1, 2.000001]), np.array([1.1, 2.0])),
366
+ (DataFrame({"a": [1.0, 1.1]}), DataFrame({"a": [1.0, 1.100001]})),
367
+ ],
368
+ )
369
+ def test_assert_almost_equal_pandas(a, b):
370
+ _assert_almost_equal_both(a, b)
371
+
372
+
373
+ def test_assert_almost_equal_object():
374
+ a = [Timestamp("2011-01-01"), Timestamp("2011-01-01")]
375
+ b = [Timestamp("2011-01-01"), Timestamp("2011-01-01")]
376
+ _assert_almost_equal_both(a, b)
377
+
378
+
379
+ def test_assert_almost_equal_value_mismatch():
380
+ msg = "expected 2\\.00000 but got 1\\.00000, with rtol=1e-05, atol=1e-08"
381
+
382
+ with pytest.raises(AssertionError, match=msg):
383
+ tm.assert_almost_equal(1, 2)
384
+
385
+
386
+ @pytest.mark.parametrize(
387
+ "a,b,klass1,klass2",
388
+ [(np.array([1]), 1, "ndarray", "int"), (1, np.array([1]), "int", "ndarray")],
389
+ )
390
+ def test_assert_almost_equal_class_mismatch(a, b, klass1, klass2):
391
+ msg = f"""numpy array are different
392
+
393
+ numpy array classes are different
394
+ \\[left\\]: {klass1}
395
+ \\[right\\]: {klass2}"""
396
+
397
+ with pytest.raises(AssertionError, match=msg):
398
+ tm.assert_almost_equal(a, b)
399
+
400
+
401
+ def test_assert_almost_equal_value_mismatch1():
402
+ msg = """numpy array are different
403
+
404
+ numpy array values are different \\(66\\.66667 %\\)
405
+ \\[left\\]: \\[nan, 2\\.0, 3\\.0\\]
406
+ \\[right\\]: \\[1\\.0, nan, 3\\.0\\]"""
407
+
408
+ with pytest.raises(AssertionError, match=msg):
409
+ tm.assert_almost_equal(np.array([np.nan, 2, 3]), np.array([1, np.nan, 3]))
410
+
411
+
412
+ def test_assert_almost_equal_value_mismatch2():
413
+ msg = """numpy array are different
414
+
415
+ numpy array values are different \\(50\\.0 %\\)
416
+ \\[left\\]: \\[1, 2\\]
417
+ \\[right\\]: \\[1, 3\\]"""
418
+
419
+ with pytest.raises(AssertionError, match=msg):
420
+ tm.assert_almost_equal(np.array([1, 2]), np.array([1, 3]))
421
+
422
+
423
+ def test_assert_almost_equal_value_mismatch3():
424
+ msg = """numpy array are different
425
+
426
+ numpy array values are different \\(16\\.66667 %\\)
427
+ \\[left\\]: \\[\\[1, 2\\], \\[3, 4\\], \\[5, 6\\]\\]
428
+ \\[right\\]: \\[\\[1, 3\\], \\[3, 4\\], \\[5, 6\\]\\]"""
429
+
430
+ with pytest.raises(AssertionError, match=msg):
431
+ tm.assert_almost_equal(
432
+ np.array([[1, 2], [3, 4], [5, 6]]), np.array([[1, 3], [3, 4], [5, 6]])
433
+ )
434
+
435
+
436
+ def test_assert_almost_equal_value_mismatch4():
437
+ msg = """numpy array are different
438
+
439
+ numpy array values are different \\(25\\.0 %\\)
440
+ \\[left\\]: \\[\\[1, 2\\], \\[3, 4\\]\\]
441
+ \\[right\\]: \\[\\[1, 3\\], \\[3, 4\\]\\]"""
442
+
443
+ with pytest.raises(AssertionError, match=msg):
444
+ tm.assert_almost_equal(np.array([[1, 2], [3, 4]]), np.array([[1, 3], [3, 4]]))
445
+
446
+
447
+ def test_assert_almost_equal_shape_mismatch_override():
448
+ msg = """Index are different
449
+
450
+ Index shapes are different
451
+ \\[left\\]: \\(2L*,\\)
452
+ \\[right\\]: \\(3L*,\\)"""
453
+ with pytest.raises(AssertionError, match=msg):
454
+ tm.assert_almost_equal(np.array([1, 2]), np.array([3, 4, 5]), obj="Index")
455
+
456
+
457
+ def test_assert_almost_equal_unicode():
458
+ # see gh-20503
459
+ msg = """numpy array are different
460
+
461
+ numpy array values are different \\(33\\.33333 %\\)
462
+ \\[left\\]: \\[á, à, ä\\]
463
+ \\[right\\]: \\[á, à, å\\]"""
464
+
465
+ with pytest.raises(AssertionError, match=msg):
466
+ tm.assert_almost_equal(np.array(["á", "à", "ä"]), np.array(["á", "à", "å"]))
467
+
468
+
469
+ def test_assert_almost_equal_timestamp():
470
+ a = np.array([Timestamp("2011-01-01"), Timestamp("2011-01-01")])
471
+ b = np.array([Timestamp("2011-01-01"), Timestamp("2011-01-02")])
472
+
473
+ msg = """numpy array are different
474
+
475
+ numpy array values are different \\(50\\.0 %\\)
476
+ \\[left\\]: \\[2011-01-01 00:00:00, 2011-01-01 00:00:00\\]
477
+ \\[right\\]: \\[2011-01-01 00:00:00, 2011-01-02 00:00:00\\]"""
478
+
479
+ with pytest.raises(AssertionError, match=msg):
480
+ tm.assert_almost_equal(a, b)
481
+
482
+
483
+ def test_assert_almost_equal_iterable_length_mismatch():
484
+ msg = """Iterable are different
485
+
486
+ Iterable length are different
487
+ \\[left\\]: 2
488
+ \\[right\\]: 3"""
489
+
490
+ with pytest.raises(AssertionError, match=msg):
491
+ tm.assert_almost_equal([1, 2], [3, 4, 5])
492
+
493
+
494
+ def test_assert_almost_equal_iterable_values_mismatch():
495
+ msg = """Iterable are different
496
+
497
+ Iterable values are different \\(50\\.0 %\\)
498
+ \\[left\\]: \\[1, 2\\]
499
+ \\[right\\]: \\[1, 3\\]"""
500
+
501
+ with pytest.raises(AssertionError, match=msg):
502
+ tm.assert_almost_equal([1, 2], [1, 3])
503
+
504
+
505
+ subarr = np.empty(2, dtype=object)
506
+ subarr[:] = [np.array([None, "b"], dtype=object), np.array(["c", "d"], dtype=object)]
507
+
508
+ NESTED_CASES = [
509
+ # nested array
510
+ (
511
+ np.array([np.array([50, 70, 90]), np.array([20, 30])], dtype=object),
512
+ np.array([np.array([50, 70, 90]), np.array([20, 30])], dtype=object),
513
+ ),
514
+ # >1 level of nesting
515
+ (
516
+ np.array(
517
+ [
518
+ np.array([np.array([50, 70]), np.array([90])], dtype=object),
519
+ np.array([np.array([20, 30])], dtype=object),
520
+ ],
521
+ dtype=object,
522
+ ),
523
+ np.array(
524
+ [
525
+ np.array([np.array([50, 70]), np.array([90])], dtype=object),
526
+ np.array([np.array([20, 30])], dtype=object),
527
+ ],
528
+ dtype=object,
529
+ ),
530
+ ),
531
+ # lists
532
+ (
533
+ np.array([[50, 70, 90], [20, 30]], dtype=object),
534
+ np.array([[50, 70, 90], [20, 30]], dtype=object),
535
+ ),
536
+ # mixed array/list
537
+ (
538
+ np.array([np.array([1, 2, 3]), np.array([4, 5])], dtype=object),
539
+ np.array([[1, 2, 3], [4, 5]], dtype=object),
540
+ ),
541
+ (
542
+ np.array(
543
+ [
544
+ np.array([np.array([1, 2, 3]), np.array([4, 5])], dtype=object),
545
+ np.array(
546
+ [np.array([6]), np.array([7, 8]), np.array([9])], dtype=object
547
+ ),
548
+ ],
549
+ dtype=object,
550
+ ),
551
+ np.array([[[1, 2, 3], [4, 5]], [[6], [7, 8], [9]]], dtype=object),
552
+ ),
553
+ # same-length lists
554
+ (
555
+ np.array([subarr, None], dtype=object),
556
+ np.array([[[None, "b"], ["c", "d"]], None], dtype=object),
557
+ ),
558
+ # dicts
559
+ (
560
+ np.array([{"f1": 1, "f2": np.array(["a", "b"], dtype=object)}], dtype=object),
561
+ np.array([{"f1": 1, "f2": np.array(["a", "b"], dtype=object)}], dtype=object),
562
+ ),
563
+ (
564
+ np.array([{"f1": 1, "f2": np.array(["a", "b"], dtype=object)}], dtype=object),
565
+ np.array([{"f1": 1, "f2": ["a", "b"]}], dtype=object),
566
+ ),
567
+ # array/list of dicts
568
+ (
569
+ np.array(
570
+ [
571
+ np.array(
572
+ [{"f1": 1, "f2": np.array(["a", "b"], dtype=object)}], dtype=object
573
+ ),
574
+ np.array([], dtype=object),
575
+ ],
576
+ dtype=object,
577
+ ),
578
+ np.array([[{"f1": 1, "f2": ["a", "b"]}], []], dtype=object),
579
+ ),
580
+ ]
581
+
582
+
583
+ @pytest.mark.filterwarnings("ignore:elementwise comparison failed:DeprecationWarning")
584
+ @pytest.mark.parametrize("a,b", NESTED_CASES)
585
+ def test_assert_almost_equal_array_nested(a, b):
586
+ _assert_almost_equal_both(a, b)
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_assert_attr_equal.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from types import SimpleNamespace
2
+
3
+ import pytest
4
+
5
+ from pandas.core.dtypes.common import is_float
6
+
7
+ import pandas._testing as tm
8
+
9
+
10
+ def test_assert_attr_equal(nulls_fixture):
11
+ obj = SimpleNamespace()
12
+ obj.na_value = nulls_fixture
13
+ tm.assert_attr_equal("na_value", obj, obj)
14
+
15
+
16
+ def test_assert_attr_equal_different_nulls(nulls_fixture, nulls_fixture2):
17
+ obj = SimpleNamespace()
18
+ obj.na_value = nulls_fixture
19
+
20
+ obj2 = SimpleNamespace()
21
+ obj2.na_value = nulls_fixture2
22
+
23
+ if nulls_fixture is nulls_fixture2:
24
+ tm.assert_attr_equal("na_value", obj, obj2)
25
+ elif is_float(nulls_fixture) and is_float(nulls_fixture2):
26
+ # we consider float("nan") and np.float64("nan") to be equivalent
27
+ tm.assert_attr_equal("na_value", obj, obj2)
28
+ elif type(nulls_fixture) is type(nulls_fixture2):
29
+ # e.g. Decimal("NaN")
30
+ tm.assert_attr_equal("na_value", obj, obj2)
31
+ else:
32
+ with pytest.raises(AssertionError, match='"na_value" are different'):
33
+ tm.assert_attr_equal("na_value", obj, obj2)
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_assert_categorical_equal.py ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pytest
2
+
3
+ from pandas import Categorical
4
+ import pandas._testing as tm
5
+
6
+
7
+ @pytest.mark.parametrize(
8
+ "c",
9
+ [Categorical([1, 2, 3, 4]), Categorical([1, 2, 3, 4], categories=[1, 2, 3, 4, 5])],
10
+ )
11
+ def test_categorical_equal(c):
12
+ tm.assert_categorical_equal(c, c)
13
+
14
+
15
+ @pytest.mark.parametrize("check_category_order", [True, False])
16
+ def test_categorical_equal_order_mismatch(check_category_order):
17
+ c1 = Categorical([1, 2, 3, 4], categories=[1, 2, 3, 4])
18
+ c2 = Categorical([1, 2, 3, 4], categories=[4, 3, 2, 1])
19
+ kwargs = {"check_category_order": check_category_order}
20
+
21
+ if check_category_order:
22
+ msg = """Categorical\\.categories are different
23
+
24
+ Categorical\\.categories values are different \\(100\\.0 %\\)
25
+ \\[left\\]: Index\\(\\[1, 2, 3, 4\\], dtype='int64'\\)
26
+ \\[right\\]: Index\\(\\[4, 3, 2, 1\\], dtype='int64'\\)"""
27
+ with pytest.raises(AssertionError, match=msg):
28
+ tm.assert_categorical_equal(c1, c2, **kwargs)
29
+ else:
30
+ tm.assert_categorical_equal(c1, c2, **kwargs)
31
+
32
+
33
+ def test_categorical_equal_categories_mismatch():
34
+ msg = """Categorical\\.categories are different
35
+
36
+ Categorical\\.categories values are different \\(25\\.0 %\\)
37
+ \\[left\\]: Index\\(\\[1, 2, 3, 4\\], dtype='int64'\\)
38
+ \\[right\\]: Index\\(\\[1, 2, 3, 5\\], dtype='int64'\\)"""
39
+
40
+ c1 = Categorical([1, 2, 3, 4])
41
+ c2 = Categorical([1, 2, 3, 5])
42
+
43
+ with pytest.raises(AssertionError, match=msg):
44
+ tm.assert_categorical_equal(c1, c2)
45
+
46
+
47
+ def test_categorical_equal_codes_mismatch():
48
+ categories = [1, 2, 3, 4]
49
+ msg = """Categorical\\.codes are different
50
+
51
+ Categorical\\.codes values are different \\(50\\.0 %\\)
52
+ \\[left\\]: \\[0, 1, 3, 2\\]
53
+ \\[right\\]: \\[0, 1, 2, 3\\]"""
54
+
55
+ c1 = Categorical([1, 2, 4, 3], categories=categories)
56
+ c2 = Categorical([1, 2, 3, 4], categories=categories)
57
+
58
+ with pytest.raises(AssertionError, match=msg):
59
+ tm.assert_categorical_equal(c1, c2)
60
+
61
+
62
+ def test_categorical_equal_ordered_mismatch():
63
+ data = [1, 2, 3, 4]
64
+ msg = """Categorical are different
65
+
66
+ Attribute "ordered" are different
67
+ \\[left\\]: False
68
+ \\[right\\]: True"""
69
+
70
+ c1 = Categorical(data, ordered=False)
71
+ c2 = Categorical(data, ordered=True)
72
+
73
+ with pytest.raises(AssertionError, match=msg):
74
+ tm.assert_categorical_equal(c1, c2)
75
+
76
+
77
+ @pytest.mark.parametrize("obj", ["index", "foo", "pandas"])
78
+ def test_categorical_equal_object_override(obj):
79
+ data = [1, 2, 3, 4]
80
+ msg = f"""{obj} are different
81
+
82
+ Attribute "ordered" are different
83
+ \\[left\\]: False
84
+ \\[right\\]: True"""
85
+
86
+ c1 = Categorical(data, ordered=False)
87
+ c2 = Categorical(data, ordered=True)
88
+
89
+ with pytest.raises(AssertionError, match=msg):
90
+ tm.assert_categorical_equal(c1, c2, obj=obj)
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_assert_extension_array_equal.py ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import pytest
3
+
4
+ from pandas import (
5
+ Timestamp,
6
+ array,
7
+ )
8
+ import pandas._testing as tm
9
+ from pandas.core.arrays.sparse import SparseArray
10
+
11
+
12
+ @pytest.mark.parametrize(
13
+ "kwargs",
14
+ [
15
+ {}, # Default is check_exact=False
16
+ {"check_exact": False},
17
+ {"check_exact": True},
18
+ ],
19
+ )
20
+ def test_assert_extension_array_equal_not_exact(kwargs):
21
+ # see gh-23709
22
+ arr1 = SparseArray([-0.17387645482451206, 0.3414148016424936])
23
+ arr2 = SparseArray([-0.17387645482451206, 0.3414148016424937])
24
+
25
+ if kwargs.get("check_exact", False):
26
+ msg = """\
27
+ ExtensionArray are different
28
+
29
+ ExtensionArray values are different \\(50\\.0 %\\)
30
+ \\[left\\]: \\[-0\\.17387645482.*, 0\\.341414801642.*\\]
31
+ \\[right\\]: \\[-0\\.17387645482.*, 0\\.341414801642.*\\]"""
32
+
33
+ with pytest.raises(AssertionError, match=msg):
34
+ tm.assert_extension_array_equal(arr1, arr2, **kwargs)
35
+ else:
36
+ tm.assert_extension_array_equal(arr1, arr2, **kwargs)
37
+
38
+
39
+ @pytest.mark.parametrize("decimals", range(10))
40
+ def test_assert_extension_array_equal_less_precise(decimals):
41
+ rtol = 0.5 * 10**-decimals
42
+ arr1 = SparseArray([0.5, 0.123456])
43
+ arr2 = SparseArray([0.5, 0.123457])
44
+
45
+ if decimals >= 5:
46
+ msg = """\
47
+ ExtensionArray are different
48
+
49
+ ExtensionArray values are different \\(50\\.0 %\\)
50
+ \\[left\\]: \\[0\\.5, 0\\.123456\\]
51
+ \\[right\\]: \\[0\\.5, 0\\.123457\\]"""
52
+
53
+ with pytest.raises(AssertionError, match=msg):
54
+ tm.assert_extension_array_equal(arr1, arr2, rtol=rtol)
55
+ else:
56
+ tm.assert_extension_array_equal(arr1, arr2, rtol=rtol)
57
+
58
+
59
+ def test_assert_extension_array_equal_dtype_mismatch(check_dtype):
60
+ end = 5
61
+ kwargs = {"check_dtype": check_dtype}
62
+
63
+ arr1 = SparseArray(np.arange(end, dtype="int64"))
64
+ arr2 = SparseArray(np.arange(end, dtype="int32"))
65
+
66
+ if check_dtype:
67
+ msg = """\
68
+ ExtensionArray are different
69
+
70
+ Attribute "dtype" are different
71
+ \\[left\\]: Sparse\\[int64, 0\\]
72
+ \\[right\\]: Sparse\\[int32, 0\\]"""
73
+
74
+ with pytest.raises(AssertionError, match=msg):
75
+ tm.assert_extension_array_equal(arr1, arr2, **kwargs)
76
+ else:
77
+ tm.assert_extension_array_equal(arr1, arr2, **kwargs)
78
+
79
+
80
+ def test_assert_extension_array_equal_missing_values():
81
+ arr1 = SparseArray([np.nan, 1, 2, np.nan])
82
+ arr2 = SparseArray([np.nan, 1, 2, 3])
83
+
84
+ msg = """\
85
+ ExtensionArray NA mask are different
86
+
87
+ ExtensionArray NA mask values are different \\(25\\.0 %\\)
88
+ \\[left\\]: \\[True, False, False, True\\]
89
+ \\[right\\]: \\[True, False, False, False\\]"""
90
+
91
+ with pytest.raises(AssertionError, match=msg):
92
+ tm.assert_extension_array_equal(arr1, arr2)
93
+
94
+
95
+ @pytest.mark.parametrize("side", ["left", "right"])
96
+ def test_assert_extension_array_equal_non_extension_array(side):
97
+ numpy_array = np.arange(5)
98
+ extension_array = SparseArray(numpy_array)
99
+
100
+ msg = f"{side} is not an ExtensionArray"
101
+ args = (
102
+ (numpy_array, extension_array)
103
+ if side == "left"
104
+ else (extension_array, numpy_array)
105
+ )
106
+
107
+ with pytest.raises(AssertionError, match=msg):
108
+ tm.assert_extension_array_equal(*args)
109
+
110
+
111
+ @pytest.mark.parametrize("right_dtype", ["Int32", "int64"])
112
+ def test_assert_extension_array_equal_ignore_dtype_mismatch(right_dtype):
113
+ # https://github.com/pandas-dev/pandas/issues/35715
114
+ left = array([1, 2, 3], dtype="Int64")
115
+ right = array([1, 2, 3], dtype=right_dtype)
116
+ tm.assert_extension_array_equal(left, right, check_dtype=False)
117
+
118
+
119
+ def test_assert_extension_array_equal_time_units():
120
+ # https://github.com/pandas-dev/pandas/issues/55730
121
+ timestamp = Timestamp("2023-11-04T12")
122
+ naive = array([timestamp], dtype="datetime64[ns]")
123
+ utc = array([timestamp], dtype="datetime64[ns, UTC]")
124
+
125
+ tm.assert_extension_array_equal(naive, utc, check_dtype=False)
126
+ tm.assert_extension_array_equal(utc, naive, check_dtype=False)
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_assert_frame_equal.py ADDED
@@ -0,0 +1,393 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pytest
2
+
3
+ import pandas as pd
4
+ from pandas import DataFrame
5
+ import pandas._testing as tm
6
+
7
+
8
+ @pytest.fixture(params=[True, False])
9
+ def by_blocks_fixture(request):
10
+ return request.param
11
+
12
+
13
+ @pytest.fixture(params=["DataFrame", "Series"])
14
+ def obj_fixture(request):
15
+ return request.param
16
+
17
+
18
+ def _assert_frame_equal_both(a, b, **kwargs):
19
+ """
20
+ Check that two DataFrame equal.
21
+
22
+ This check is performed commutatively.
23
+
24
+ Parameters
25
+ ----------
26
+ a : DataFrame
27
+ The first DataFrame to compare.
28
+ b : DataFrame
29
+ The second DataFrame to compare.
30
+ kwargs : dict
31
+ The arguments passed to `tm.assert_frame_equal`.
32
+ """
33
+ tm.assert_frame_equal(a, b, **kwargs)
34
+ tm.assert_frame_equal(b, a, **kwargs)
35
+
36
+
37
+ @pytest.mark.parametrize("check_like", [True, False])
38
+ def test_frame_equal_row_order_mismatch(check_like, obj_fixture):
39
+ df1 = DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]}, index=["a", "b", "c"])
40
+ df2 = DataFrame({"A": [3, 2, 1], "B": [6, 5, 4]}, index=["c", "b", "a"])
41
+
42
+ if not check_like: # Do not ignore row-column orderings.
43
+ msg = f"{obj_fixture}.index are different"
44
+ with pytest.raises(AssertionError, match=msg):
45
+ tm.assert_frame_equal(df1, df2, check_like=check_like, obj=obj_fixture)
46
+ else:
47
+ _assert_frame_equal_both(df1, df2, check_like=check_like, obj=obj_fixture)
48
+
49
+
50
+ @pytest.mark.parametrize(
51
+ "df1,df2",
52
+ [
53
+ (DataFrame({"A": [1, 2, 3]}), DataFrame({"A": [1, 2, 3, 4]})),
54
+ (DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]}), DataFrame({"A": [1, 2, 3]})),
55
+ ],
56
+ )
57
+ def test_frame_equal_shape_mismatch(df1, df2, obj_fixture):
58
+ msg = f"{obj_fixture} are different"
59
+
60
+ with pytest.raises(AssertionError, match=msg):
61
+ tm.assert_frame_equal(df1, df2, obj=obj_fixture)
62
+
63
+
64
+ @pytest.mark.parametrize(
65
+ "df1,df2,msg",
66
+ [
67
+ # Index
68
+ (
69
+ DataFrame.from_records({"a": [1, 2], "c": ["l1", "l2"]}, index=["a"]),
70
+ DataFrame.from_records({"a": [1.0, 2.0], "c": ["l1", "l2"]}, index=["a"]),
71
+ "DataFrame\\.index are different",
72
+ ),
73
+ # MultiIndex
74
+ (
75
+ DataFrame.from_records(
76
+ {"a": [1, 2], "b": [2.1, 1.5], "c": ["l1", "l2"]}, index=["a", "b"]
77
+ ),
78
+ DataFrame.from_records(
79
+ {"a": [1.0, 2.0], "b": [2.1, 1.5], "c": ["l1", "l2"]}, index=["a", "b"]
80
+ ),
81
+ "MultiIndex level \\[0\\] are different",
82
+ ),
83
+ ],
84
+ )
85
+ def test_frame_equal_index_dtype_mismatch(df1, df2, msg, check_index_type):
86
+ kwargs = {"check_index_type": check_index_type}
87
+
88
+ if check_index_type:
89
+ with pytest.raises(AssertionError, match=msg):
90
+ tm.assert_frame_equal(df1, df2, **kwargs)
91
+ else:
92
+ tm.assert_frame_equal(df1, df2, **kwargs)
93
+
94
+
95
+ def test_empty_dtypes(check_dtype):
96
+ columns = ["col1", "col2"]
97
+ df1 = DataFrame(columns=columns)
98
+ df2 = DataFrame(columns=columns)
99
+
100
+ kwargs = {"check_dtype": check_dtype}
101
+ df1["col1"] = df1["col1"].astype("int64")
102
+
103
+ if check_dtype:
104
+ msg = r"Attributes of DataFrame\..* are different"
105
+ with pytest.raises(AssertionError, match=msg):
106
+ tm.assert_frame_equal(df1, df2, **kwargs)
107
+ else:
108
+ tm.assert_frame_equal(df1, df2, **kwargs)
109
+
110
+
111
+ @pytest.mark.parametrize("check_like", [True, False])
112
+ def test_frame_equal_index_mismatch(check_like, obj_fixture, using_infer_string):
113
+ if using_infer_string:
114
+ dtype = "str"
115
+ else:
116
+ dtype = "object"
117
+ msg = f"""{obj_fixture}\\.index are different
118
+
119
+ {obj_fixture}\\.index values are different \\(33\\.33333 %\\)
120
+ \\[left\\]: Index\\(\\['a', 'b', 'c'\\], dtype='{dtype}'\\)
121
+ \\[right\\]: Index\\(\\['a', 'b', 'd'\\], dtype='{dtype}'\\)
122
+ At positional index 2, first diff: c != d"""
123
+
124
+ df1 = DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]}, index=["a", "b", "c"])
125
+ df2 = DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]}, index=["a", "b", "d"])
126
+
127
+ with pytest.raises(AssertionError, match=msg):
128
+ tm.assert_frame_equal(df1, df2, check_like=check_like, obj=obj_fixture)
129
+
130
+
131
+ @pytest.mark.parametrize("check_like", [True, False])
132
+ def test_frame_equal_columns_mismatch(check_like, obj_fixture, using_infer_string):
133
+ if using_infer_string:
134
+ dtype = "str"
135
+ else:
136
+ dtype = "object"
137
+ msg = f"""{obj_fixture}\\.columns are different
138
+
139
+ {obj_fixture}\\.columns values are different \\(50\\.0 %\\)
140
+ \\[left\\]: Index\\(\\['A', 'B'\\], dtype='{dtype}'\\)
141
+ \\[right\\]: Index\\(\\['A', 'b'\\], dtype='{dtype}'\\)"""
142
+
143
+ df1 = DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]}, index=["a", "b", "c"])
144
+ df2 = DataFrame({"A": [1, 2, 3], "b": [4, 5, 6]}, index=["a", "b", "c"])
145
+
146
+ with pytest.raises(AssertionError, match=msg):
147
+ tm.assert_frame_equal(df1, df2, check_like=check_like, obj=obj_fixture)
148
+
149
+
150
+ def test_frame_equal_block_mismatch(by_blocks_fixture, obj_fixture):
151
+ obj = obj_fixture
152
+ msg = f"""{obj}\\.iloc\\[:, 1\\] \\(column name="B"\\) are different
153
+
154
+ {obj}\\.iloc\\[:, 1\\] \\(column name="B"\\) values are different \\(33\\.33333 %\\)
155
+ \\[index\\]: \\[0, 1, 2\\]
156
+ \\[left\\]: \\[4, 5, 6\\]
157
+ \\[right\\]: \\[4, 5, 7\\]"""
158
+
159
+ df1 = DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]})
160
+ df2 = DataFrame({"A": [1, 2, 3], "B": [4, 5, 7]})
161
+
162
+ with pytest.raises(AssertionError, match=msg):
163
+ tm.assert_frame_equal(df1, df2, by_blocks=by_blocks_fixture, obj=obj_fixture)
164
+
165
+
166
+ @pytest.mark.parametrize(
167
+ "df1,df2,msg",
168
+ [
169
+ (
170
+ DataFrame({"A": ["á", "à", "ä"], "E": ["é", "è", "ë"]}),
171
+ DataFrame({"A": ["á", "à", "ä"], "E": ["é", "è", "e̊"]}),
172
+ """{obj}\\.iloc\\[:, 1\\] \\(column name="E"\\) are different
173
+
174
+ {obj}\\.iloc\\[:, 1\\] \\(column name="E"\\) values are different \\(33\\.33333 %\\)
175
+ \\[index\\]: \\[0, 1, 2\\]
176
+ \\[left\\]: \\[é, è, ë\\]
177
+ \\[right\\]: \\[é, è, e̊\\]""",
178
+ ),
179
+ (
180
+ DataFrame({"A": ["á", "à", "ä"], "E": ["é", "è", "ë"]}),
181
+ DataFrame({"A": ["a", "a", "a"], "E": ["e", "e", "e"]}),
182
+ """{obj}\\.iloc\\[:, 0\\] \\(column name="A"\\) are different
183
+
184
+ {obj}\\.iloc\\[:, 0\\] \\(column name="A"\\) values are different \\(100\\.0 %\\)
185
+ \\[index\\]: \\[0, 1, 2\\]
186
+ \\[left\\]: \\[á, à, ä\\]
187
+ \\[right\\]: \\[a, a, a\\]""",
188
+ ),
189
+ ],
190
+ )
191
+ def test_frame_equal_unicode(df1, df2, msg, by_blocks_fixture, obj_fixture):
192
+ # see gh-20503
193
+ #
194
+ # Test ensures that `tm.assert_frame_equals` raises the right exception
195
+ # when comparing DataFrames containing differing unicode objects.
196
+ msg = msg.format(obj=obj_fixture)
197
+ with pytest.raises(AssertionError, match=msg):
198
+ tm.assert_frame_equal(df1, df2, by_blocks=by_blocks_fixture, obj=obj_fixture)
199
+
200
+
201
+ def test_assert_frame_equal_extension_dtype_mismatch():
202
+ # https://github.com/pandas-dev/pandas/issues/32747
203
+ left = DataFrame({"a": [1, 2, 3]}, dtype="Int64")
204
+ right = left.astype(int)
205
+
206
+ msg = (
207
+ "Attributes of DataFrame\\.iloc\\[:, 0\\] "
208
+ '\\(column name="a"\\) are different\n\n'
209
+ 'Attribute "dtype" are different\n'
210
+ "\\[left\\]: Int64\n"
211
+ "\\[right\\]: int[32|64]"
212
+ )
213
+
214
+ tm.assert_frame_equal(left, right, check_dtype=False)
215
+
216
+ with pytest.raises(AssertionError, match=msg):
217
+ tm.assert_frame_equal(left, right, check_dtype=True)
218
+
219
+
220
+ def test_assert_frame_equal_interval_dtype_mismatch():
221
+ # https://github.com/pandas-dev/pandas/issues/32747
222
+ left = DataFrame({"a": [pd.Interval(0, 1)]}, dtype="interval")
223
+ right = left.astype(object)
224
+
225
+ msg = (
226
+ "Attributes of DataFrame\\.iloc\\[:, 0\\] "
227
+ '\\(column name="a"\\) are different\n\n'
228
+ 'Attribute "dtype" are different\n'
229
+ "\\[left\\]: interval\\[int64, right\\]\n"
230
+ "\\[right\\]: object"
231
+ )
232
+
233
+ tm.assert_frame_equal(left, right, check_dtype=False)
234
+
235
+ with pytest.raises(AssertionError, match=msg):
236
+ tm.assert_frame_equal(left, right, check_dtype=True)
237
+
238
+
239
+ def test_assert_frame_equal_ignore_extension_dtype_mismatch():
240
+ # https://github.com/pandas-dev/pandas/issues/35715
241
+ left = DataFrame({"a": [1, 2, 3]}, dtype="Int64")
242
+ right = DataFrame({"a": [1, 2, 3]}, dtype="Int32")
243
+ tm.assert_frame_equal(left, right, check_dtype=False)
244
+
245
+
246
+ def test_assert_frame_equal_ignore_extension_dtype_mismatch_cross_class():
247
+ # https://github.com/pandas-dev/pandas/issues/35715
248
+ left = DataFrame({"a": [1, 2, 3]}, dtype="Int64")
249
+ right = DataFrame({"a": [1, 2, 3]}, dtype="int64")
250
+ tm.assert_frame_equal(left, right, check_dtype=False)
251
+
252
+
253
+ @pytest.mark.parametrize(
254
+ "dtype",
255
+ [
256
+ ("timedelta64[ns]"),
257
+ ("datetime64[ns, UTC]"),
258
+ ("Period[D]"),
259
+ ],
260
+ )
261
+ def test_assert_frame_equal_datetime_like_dtype_mismatch(dtype):
262
+ df1 = DataFrame({"a": []}, dtype=dtype)
263
+ df2 = DataFrame({"a": []})
264
+ tm.assert_frame_equal(df1, df2, check_dtype=False)
265
+
266
+
267
+ def test_allows_duplicate_labels():
268
+ left = DataFrame()
269
+ right = DataFrame().set_flags(allows_duplicate_labels=False)
270
+ tm.assert_frame_equal(left, left)
271
+ tm.assert_frame_equal(right, right)
272
+ tm.assert_frame_equal(left, right, check_flags=False)
273
+ tm.assert_frame_equal(right, left, check_flags=False)
274
+
275
+ with pytest.raises(AssertionError, match="<Flags"):
276
+ tm.assert_frame_equal(left, right)
277
+
278
+ with pytest.raises(AssertionError, match="<Flags"):
279
+ tm.assert_frame_equal(left, right)
280
+
281
+
282
+ def test_assert_frame_equal_columns_mixed_dtype():
283
+ # GH#39168
284
+ df = DataFrame([[0, 1, 2]], columns=["foo", "bar", 42], index=[1, "test", 2])
285
+ tm.assert_frame_equal(df, df, check_like=True)
286
+
287
+
288
+ def test_frame_equal_extension_dtype(frame_or_series, any_numeric_ea_dtype):
289
+ # GH#39410
290
+ obj = frame_or_series([1, 2], dtype=any_numeric_ea_dtype)
291
+ tm.assert_equal(obj, obj, check_exact=True)
292
+
293
+
294
+ @pytest.mark.parametrize("indexer", [(0, 1), (1, 0)])
295
+ def test_frame_equal_mixed_dtypes(frame_or_series, any_numeric_ea_dtype, indexer):
296
+ dtypes = (any_numeric_ea_dtype, "int64")
297
+ obj1 = frame_or_series([1, 2], dtype=dtypes[indexer[0]])
298
+ obj2 = frame_or_series([1, 2], dtype=dtypes[indexer[1]])
299
+ tm.assert_equal(obj1, obj2, check_exact=True, check_dtype=False)
300
+
301
+
302
+ def test_assert_frame_equal_check_like_different_indexes():
303
+ # GH#39739
304
+ df1 = DataFrame(index=pd.Index([], dtype="object"))
305
+ df2 = DataFrame(index=pd.RangeIndex(start=0, stop=0, step=1))
306
+ with pytest.raises(AssertionError, match="DataFrame.index are different"):
307
+ tm.assert_frame_equal(df1, df2, check_like=True)
308
+
309
+
310
+ def test_assert_frame_equal_checking_allow_dups_flag():
311
+ # GH#45554
312
+ left = DataFrame([[1, 2], [3, 4]])
313
+ left.flags.allows_duplicate_labels = False
314
+
315
+ right = DataFrame([[1, 2], [3, 4]])
316
+ right.flags.allows_duplicate_labels = True
317
+ tm.assert_frame_equal(left, right, check_flags=False)
318
+
319
+ with pytest.raises(AssertionError, match="allows_duplicate_labels"):
320
+ tm.assert_frame_equal(left, right, check_flags=True)
321
+
322
+
323
+ def test_assert_frame_equal_check_like_categorical_midx():
324
+ # GH#48975
325
+ left = DataFrame(
326
+ [[1], [2], [3]],
327
+ index=pd.MultiIndex.from_arrays(
328
+ [
329
+ pd.Categorical(["a", "b", "c"]),
330
+ pd.Categorical(["a", "b", "c"]),
331
+ ]
332
+ ),
333
+ )
334
+ right = DataFrame(
335
+ [[3], [2], [1]],
336
+ index=pd.MultiIndex.from_arrays(
337
+ [
338
+ pd.Categorical(["c", "b", "a"]),
339
+ pd.Categorical(["c", "b", "a"]),
340
+ ]
341
+ ),
342
+ )
343
+ tm.assert_frame_equal(left, right, check_like=True)
344
+
345
+
346
+ def test_assert_frame_equal_ea_column_definition_in_exception_mask():
347
+ # GH#50323
348
+ df1 = DataFrame({"a": pd.Series([pd.NA, 1], dtype="Int64")})
349
+ df2 = DataFrame({"a": pd.Series([1, 1], dtype="Int64")})
350
+
351
+ msg = r'DataFrame.iloc\[:, 0\] \(column name="a"\) NA mask values are different'
352
+ with pytest.raises(AssertionError, match=msg):
353
+ tm.assert_frame_equal(df1, df2)
354
+
355
+
356
+ def test_assert_frame_equal_ea_column_definition_in_exception():
357
+ # GH#50323
358
+ df1 = DataFrame({"a": pd.Series([pd.NA, 1], dtype="Int64")})
359
+ df2 = DataFrame({"a": pd.Series([pd.NA, 2], dtype="Int64")})
360
+
361
+ msg = r'DataFrame.iloc\[:, 0\] \(column name="a"\) values are different'
362
+ with pytest.raises(AssertionError, match=msg):
363
+ tm.assert_frame_equal(df1, df2)
364
+
365
+ with pytest.raises(AssertionError, match=msg):
366
+ tm.assert_frame_equal(df1, df2, check_exact=True)
367
+
368
+
369
+ def test_assert_frame_equal_ts_column():
370
+ # GH#50323
371
+ df1 = DataFrame({"a": [pd.Timestamp("2019-12-31"), pd.Timestamp("2020-12-31")]})
372
+ df2 = DataFrame({"a": [pd.Timestamp("2020-12-31"), pd.Timestamp("2020-12-31")]})
373
+
374
+ msg = r'DataFrame.iloc\[:, 0\] \(column name="a"\) values are different'
375
+ with pytest.raises(AssertionError, match=msg):
376
+ tm.assert_frame_equal(df1, df2)
377
+
378
+
379
+ def test_assert_frame_equal_set():
380
+ # GH#51727
381
+ df1 = DataFrame({"set_column": [{1, 2, 3}, {4, 5, 6}]})
382
+ df2 = DataFrame({"set_column": [{1, 2, 3}, {4, 5, 6}]})
383
+ tm.assert_frame_equal(df1, df2)
384
+
385
+
386
+ def test_assert_frame_equal_set_mismatch():
387
+ # GH#51727
388
+ df1 = DataFrame({"set_column": [{1, 2, 3}, {4, 5, 6}]})
389
+ df2 = DataFrame({"set_column": [{1, 2, 3}, {4, 5, 7}]})
390
+
391
+ msg = r'DataFrame.iloc\[:, 0\] \(column name="set_column"\) values are different'
392
+ with pytest.raises(AssertionError, match=msg):
393
+ tm.assert_frame_equal(df1, df2)
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_assert_index_equal.py ADDED
@@ -0,0 +1,319 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import pytest
3
+
4
+ from pandas import (
5
+ NA,
6
+ Categorical,
7
+ CategoricalIndex,
8
+ Index,
9
+ MultiIndex,
10
+ NaT,
11
+ RangeIndex,
12
+ )
13
+ import pandas._testing as tm
14
+
15
+
16
+ def test_index_equal_levels_mismatch():
17
+ msg = """Index are different
18
+
19
+ Index levels are different
20
+ \\[left\\]: 1, Index\\(\\[1, 2, 3\\], dtype='int64'\\)
21
+ \\[right\\]: 2, MultiIndex\\(\\[\\('A', 1\\),
22
+ \\('A', 2\\),
23
+ \\('B', 3\\),
24
+ \\('B', 4\\)\\],
25
+ \\)"""
26
+
27
+ idx1 = Index([1, 2, 3])
28
+ idx2 = MultiIndex.from_tuples([("A", 1), ("A", 2), ("B", 3), ("B", 4)])
29
+
30
+ with pytest.raises(AssertionError, match=msg):
31
+ tm.assert_index_equal(idx1, idx2, exact=False)
32
+
33
+
34
+ def test_index_equal_values_mismatch(check_exact):
35
+ msg = """MultiIndex level \\[1\\] are different
36
+
37
+ MultiIndex level \\[1\\] values are different \\(25\\.0 %\\)
38
+ \\[left\\]: Index\\(\\[2, 2, 3, 4\\], dtype='int64'\\)
39
+ \\[right\\]: Index\\(\\[1, 2, 3, 4\\], dtype='int64'\\)"""
40
+
41
+ idx1 = MultiIndex.from_tuples([("A", 2), ("A", 2), ("B", 3), ("B", 4)])
42
+ idx2 = MultiIndex.from_tuples([("A", 1), ("A", 2), ("B", 3), ("B", 4)])
43
+
44
+ with pytest.raises(AssertionError, match=msg):
45
+ tm.assert_index_equal(idx1, idx2, check_exact=check_exact)
46
+
47
+
48
+ def test_index_equal_length_mismatch(check_exact):
49
+ msg = """Index are different
50
+
51
+ Index length are different
52
+ \\[left\\]: 3, Index\\(\\[1, 2, 3\\], dtype='int64'\\)
53
+ \\[right\\]: 4, Index\\(\\[1, 2, 3, 4\\], dtype='int64'\\)"""
54
+
55
+ idx1 = Index([1, 2, 3])
56
+ idx2 = Index([1, 2, 3, 4])
57
+
58
+ with pytest.raises(AssertionError, match=msg):
59
+ tm.assert_index_equal(idx1, idx2, check_exact=check_exact)
60
+
61
+
62
+ @pytest.mark.parametrize("exact", [False, "equiv"])
63
+ def test_index_equal_class(exact):
64
+ idx1 = Index([0, 1, 2])
65
+ idx2 = RangeIndex(3)
66
+
67
+ tm.assert_index_equal(idx1, idx2, exact=exact)
68
+
69
+
70
+ def test_int_float_index_equal_class_mismatch(check_exact):
71
+ msg = """Index are different
72
+
73
+ Attribute "inferred_type" are different
74
+ \\[left\\]: integer
75
+ \\[right\\]: floating"""
76
+
77
+ idx1 = Index([1, 2, 3])
78
+ idx2 = Index([1, 2, 3], dtype=np.float64)
79
+
80
+ with pytest.raises(AssertionError, match=msg):
81
+ tm.assert_index_equal(idx1, idx2, exact=True, check_exact=check_exact)
82
+
83
+
84
+ def test_range_index_equal_class_mismatch(check_exact):
85
+ msg = """Index are different
86
+
87
+ Index classes are different
88
+ \\[left\\]: Index\\(\\[1, 2, 3\\], dtype='int64'\\)
89
+ \\[right\\]: """
90
+
91
+ idx1 = Index([1, 2, 3])
92
+ idx2 = RangeIndex(range(3))
93
+
94
+ with pytest.raises(AssertionError, match=msg):
95
+ tm.assert_index_equal(idx1, idx2, exact=True, check_exact=check_exact)
96
+
97
+
98
+ def test_index_equal_values_close(check_exact):
99
+ idx1 = Index([1, 2, 3.0])
100
+ idx2 = Index([1, 2, 3.0000000001])
101
+
102
+ if check_exact:
103
+ msg = """Index are different
104
+
105
+ Index values are different \\(33\\.33333 %\\)
106
+ \\[left\\]: Index\\(\\[1.0, 2.0, 3.0], dtype='float64'\\)
107
+ \\[right\\]: Index\\(\\[1.0, 2.0, 3.0000000001\\], dtype='float64'\\)"""
108
+
109
+ with pytest.raises(AssertionError, match=msg):
110
+ tm.assert_index_equal(idx1, idx2, check_exact=check_exact)
111
+ else:
112
+ tm.assert_index_equal(idx1, idx2, check_exact=check_exact)
113
+
114
+
115
+ def test_index_equal_values_less_close(check_exact, rtol):
116
+ idx1 = Index([1, 2, 3.0])
117
+ idx2 = Index([1, 2, 3.0001])
118
+ kwargs = {"check_exact": check_exact, "rtol": rtol}
119
+
120
+ if check_exact or rtol < 0.5e-3:
121
+ msg = """Index are different
122
+
123
+ Index values are different \\(33\\.33333 %\\)
124
+ \\[left\\]: Index\\(\\[1.0, 2.0, 3.0], dtype='float64'\\)
125
+ \\[right\\]: Index\\(\\[1.0, 2.0, 3.0001\\], dtype='float64'\\)"""
126
+
127
+ with pytest.raises(AssertionError, match=msg):
128
+ tm.assert_index_equal(idx1, idx2, **kwargs)
129
+ else:
130
+ tm.assert_index_equal(idx1, idx2, **kwargs)
131
+
132
+
133
+ def test_index_equal_values_too_far(check_exact, rtol):
134
+ idx1 = Index([1, 2, 3])
135
+ idx2 = Index([1, 2, 4])
136
+ kwargs = {"check_exact": check_exact, "rtol": rtol}
137
+
138
+ msg = """Index are different
139
+
140
+ Index values are different \\(33\\.33333 %\\)
141
+ \\[left\\]: Index\\(\\[1, 2, 3\\], dtype='int64'\\)
142
+ \\[right\\]: Index\\(\\[1, 2, 4\\], dtype='int64'\\)"""
143
+
144
+ with pytest.raises(AssertionError, match=msg):
145
+ tm.assert_index_equal(idx1, idx2, **kwargs)
146
+
147
+
148
+ @pytest.mark.parametrize("check_order", [True, False])
149
+ def test_index_equal_value_order_mismatch(check_exact, rtol, check_order):
150
+ idx1 = Index([1, 2, 3])
151
+ idx2 = Index([3, 2, 1])
152
+
153
+ msg = """Index are different
154
+
155
+ Index values are different \\(66\\.66667 %\\)
156
+ \\[left\\]: Index\\(\\[1, 2, 3\\], dtype='int64'\\)
157
+ \\[right\\]: Index\\(\\[3, 2, 1\\], dtype='int64'\\)"""
158
+
159
+ if check_order:
160
+ with pytest.raises(AssertionError, match=msg):
161
+ tm.assert_index_equal(
162
+ idx1, idx2, check_exact=check_exact, rtol=rtol, check_order=True
163
+ )
164
+ else:
165
+ tm.assert_index_equal(
166
+ idx1, idx2, check_exact=check_exact, rtol=rtol, check_order=False
167
+ )
168
+
169
+
170
+ def test_index_equal_level_values_mismatch(check_exact, rtol):
171
+ idx1 = MultiIndex.from_tuples([("A", 2), ("A", 2), ("B", 3), ("B", 4)])
172
+ idx2 = MultiIndex.from_tuples([("A", 1), ("A", 2), ("B", 3), ("B", 4)])
173
+ kwargs = {"check_exact": check_exact, "rtol": rtol}
174
+
175
+ msg = """MultiIndex level \\[1\\] are different
176
+
177
+ MultiIndex level \\[1\\] values are different \\(25\\.0 %\\)
178
+ \\[left\\]: Index\\(\\[2, 2, 3, 4\\], dtype='int64'\\)
179
+ \\[right\\]: Index\\(\\[1, 2, 3, 4\\], dtype='int64'\\)"""
180
+
181
+ with pytest.raises(AssertionError, match=msg):
182
+ tm.assert_index_equal(idx1, idx2, **kwargs)
183
+
184
+
185
+ @pytest.mark.parametrize(
186
+ "name1,name2",
187
+ [(None, "x"), ("x", "x"), (np.nan, np.nan), (NaT, NaT), (np.nan, NaT)],
188
+ )
189
+ def test_index_equal_names(name1, name2):
190
+ idx1 = Index([1, 2, 3], name=name1)
191
+ idx2 = Index([1, 2, 3], name=name2)
192
+
193
+ if name1 == name2 or name1 is name2:
194
+ tm.assert_index_equal(idx1, idx2)
195
+ else:
196
+ name1 = "'x'" if name1 == "x" else name1
197
+ name2 = "'x'" if name2 == "x" else name2
198
+ msg = f"""Index are different
199
+
200
+ Attribute "names" are different
201
+ \\[left\\]: \\[{name1}\\]
202
+ \\[right\\]: \\[{name2}\\]"""
203
+
204
+ with pytest.raises(AssertionError, match=msg):
205
+ tm.assert_index_equal(idx1, idx2)
206
+
207
+
208
+ def test_index_equal_category_mismatch(check_categorical, using_infer_string):
209
+ if using_infer_string:
210
+ dtype = "str"
211
+ else:
212
+ dtype = "object"
213
+ msg = f"""Index are different
214
+
215
+ Attribute "dtype" are different
216
+ \\[left\\]: CategoricalDtype\\(categories=\\['a', 'b'\\], ordered=False, \
217
+ categories_dtype={dtype}\\)
218
+ \\[right\\]: CategoricalDtype\\(categories=\\['a', 'b', 'c'\\], \
219
+ ordered=False, categories_dtype={dtype}\\)"""
220
+
221
+ idx1 = Index(Categorical(["a", "b"]))
222
+ idx2 = Index(Categorical(["a", "b"], categories=["a", "b", "c"]))
223
+
224
+ if check_categorical:
225
+ with pytest.raises(AssertionError, match=msg):
226
+ tm.assert_index_equal(idx1, idx2, check_categorical=check_categorical)
227
+ else:
228
+ tm.assert_index_equal(idx1, idx2, check_categorical=check_categorical)
229
+
230
+
231
+ @pytest.mark.parametrize("exact", [False, True])
232
+ def test_index_equal_range_categories(check_categorical, exact):
233
+ # GH41263
234
+ msg = """\
235
+ Index are different
236
+
237
+ Index classes are different
238
+ \\[left\\]: RangeIndex\\(start=0, stop=10, step=1\\)
239
+ \\[right\\]: Index\\(\\[0, 1, 2, 3, 4, 5, 6, 7, 8, 9\\], dtype='int64'\\)"""
240
+
241
+ rcat = CategoricalIndex(RangeIndex(10))
242
+ icat = CategoricalIndex(list(range(10)))
243
+
244
+ if check_categorical and exact:
245
+ with pytest.raises(AssertionError, match=msg):
246
+ tm.assert_index_equal(rcat, icat, check_categorical=True, exact=True)
247
+ else:
248
+ tm.assert_index_equal(
249
+ rcat, icat, check_categorical=check_categorical, exact=exact
250
+ )
251
+
252
+
253
+ def test_assert_index_equal_different_inferred_types():
254
+ # GH#31884
255
+ msg = """\
256
+ Index are different
257
+
258
+ Attribute "inferred_type" are different
259
+ \\[left\\]: mixed
260
+ \\[right\\]: datetime"""
261
+
262
+ idx1 = Index([NA, np.datetime64("nat")])
263
+ idx2 = Index([NA, NaT])
264
+ with pytest.raises(AssertionError, match=msg):
265
+ tm.assert_index_equal(idx1, idx2)
266
+
267
+
268
+ def test_assert_index_equal_different_names_check_order_false():
269
+ # GH#47328
270
+ idx1 = Index([1, 3], name="a")
271
+ idx2 = Index([3, 1], name="b")
272
+ with pytest.raises(AssertionError, match='"names" are different'):
273
+ tm.assert_index_equal(idx1, idx2, check_order=False, check_names=True)
274
+
275
+
276
+ def test_assert_index_equal_mixed_dtype():
277
+ # GH#39168
278
+ idx = Index(["foo", "bar", 42])
279
+ tm.assert_index_equal(idx, idx, check_order=False)
280
+
281
+
282
+ def test_assert_index_equal_ea_dtype_order_false(any_numeric_ea_dtype):
283
+ # GH#47207
284
+ idx1 = Index([1, 3], dtype=any_numeric_ea_dtype)
285
+ idx2 = Index([3, 1], dtype=any_numeric_ea_dtype)
286
+ tm.assert_index_equal(idx1, idx2, check_order=False)
287
+
288
+
289
+ def test_assert_index_equal_object_ints_order_false():
290
+ # GH#47207
291
+ idx1 = Index([1, 3], dtype="object")
292
+ idx2 = Index([3, 1], dtype="object")
293
+ tm.assert_index_equal(idx1, idx2, check_order=False)
294
+
295
+
296
+ @pytest.mark.parametrize("check_categorical", [True, False])
297
+ @pytest.mark.parametrize("check_names", [True, False])
298
+ def test_assert_ea_index_equal_non_matching_na(check_names, check_categorical):
299
+ # GH#48608
300
+ idx1 = Index([1, 2], dtype="Int64")
301
+ idx2 = Index([1, NA], dtype="Int64")
302
+ with pytest.raises(AssertionError, match="50.0 %"):
303
+ tm.assert_index_equal(
304
+ idx1, idx2, check_names=check_names, check_categorical=check_categorical
305
+ )
306
+
307
+
308
+ @pytest.mark.parametrize("check_categorical", [True, False])
309
+ def test_assert_multi_index_dtype_check_categorical(check_categorical):
310
+ # GH#52126
311
+ idx1 = MultiIndex.from_arrays([Categorical(np.array([1, 2], dtype=np.uint64))])
312
+ idx2 = MultiIndex.from_arrays([Categorical(np.array([1, 2], dtype=np.int64))])
313
+ if check_categorical:
314
+ with pytest.raises(
315
+ AssertionError, match=r"^MultiIndex level \[0\] are different"
316
+ ):
317
+ tm.assert_index_equal(idx1, idx2, check_categorical=check_categorical)
318
+ else:
319
+ tm.assert_index_equal(idx1, idx2, check_categorical=check_categorical)
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_assert_interval_array_equal.py ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pytest
2
+
3
+ from pandas import interval_range
4
+ import pandas._testing as tm
5
+
6
+
7
+ @pytest.mark.parametrize(
8
+ "kwargs",
9
+ [
10
+ {"start": 0, "periods": 4},
11
+ {"start": 1, "periods": 5},
12
+ {"start": 5, "end": 10, "closed": "left"},
13
+ ],
14
+ )
15
+ def test_interval_array_equal(kwargs):
16
+ arr = interval_range(**kwargs).values
17
+ tm.assert_interval_array_equal(arr, arr)
18
+
19
+
20
+ def test_interval_array_equal_closed_mismatch():
21
+ kwargs = {"start": 0, "periods": 5}
22
+ arr1 = interval_range(closed="left", **kwargs).values
23
+ arr2 = interval_range(closed="right", **kwargs).values
24
+
25
+ msg = """\
26
+ IntervalArray are different
27
+
28
+ Attribute "closed" are different
29
+ \\[left\\]: left
30
+ \\[right\\]: right"""
31
+
32
+ with pytest.raises(AssertionError, match=msg):
33
+ tm.assert_interval_array_equal(arr1, arr2)
34
+
35
+
36
+ def test_interval_array_equal_periods_mismatch():
37
+ kwargs = {"start": 0}
38
+ arr1 = interval_range(periods=5, **kwargs).values
39
+ arr2 = interval_range(periods=6, **kwargs).values
40
+
41
+ msg = """\
42
+ IntervalArray.left are different
43
+
44
+ IntervalArray.left shapes are different
45
+ \\[left\\]: \\(5,\\)
46
+ \\[right\\]: \\(6,\\)"""
47
+
48
+ with pytest.raises(AssertionError, match=msg):
49
+ tm.assert_interval_array_equal(arr1, arr2)
50
+
51
+
52
+ def test_interval_array_equal_end_mismatch():
53
+ kwargs = {"start": 0, "periods": 5}
54
+ arr1 = interval_range(end=10, **kwargs).values
55
+ arr2 = interval_range(end=20, **kwargs).values
56
+
57
+ msg = """\
58
+ IntervalArray.left are different
59
+
60
+ IntervalArray.left values are different \\(80.0 %\\)
61
+ \\[left\\]: \\[0, 2, 4, 6, 8\\]
62
+ \\[right\\]: \\[0, 4, 8, 12, 16\\]"""
63
+
64
+ with pytest.raises(AssertionError, match=msg):
65
+ tm.assert_interval_array_equal(arr1, arr2)
66
+
67
+
68
+ def test_interval_array_equal_start_mismatch():
69
+ kwargs = {"periods": 4}
70
+ arr1 = interval_range(start=0, **kwargs).values
71
+ arr2 = interval_range(start=1, **kwargs).values
72
+
73
+ msg = """\
74
+ IntervalArray.left are different
75
+
76
+ IntervalArray.left values are different \\(100.0 %\\)
77
+ \\[left\\]: \\[0, 1, 2, 3\\]
78
+ \\[right\\]: \\[1, 2, 3, 4\\]"""
79
+
80
+ with pytest.raises(AssertionError, match=msg):
81
+ tm.assert_interval_array_equal(arr1, arr2)
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_assert_numpy_array_equal.py ADDED
@@ -0,0 +1,223 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import copy
2
+
3
+ import numpy as np
4
+ import pytest
5
+
6
+ import pandas as pd
7
+ from pandas import Timestamp
8
+ import pandas._testing as tm
9
+
10
+
11
+ def test_assert_numpy_array_equal_shape_mismatch():
12
+ msg = """numpy array are different
13
+
14
+ numpy array shapes are different
15
+ \\[left\\]: \\(2L*,\\)
16
+ \\[right\\]: \\(3L*,\\)"""
17
+
18
+ with pytest.raises(AssertionError, match=msg):
19
+ tm.assert_numpy_array_equal(np.array([1, 2]), np.array([3, 4, 5]))
20
+
21
+
22
+ def test_assert_numpy_array_equal_bad_type():
23
+ expected = "Expected type"
24
+
25
+ with pytest.raises(AssertionError, match=expected):
26
+ tm.assert_numpy_array_equal(1, 2)
27
+
28
+
29
+ @pytest.mark.parametrize(
30
+ "a,b,klass1,klass2",
31
+ [(np.array([1]), 1, "ndarray", "int"), (1, np.array([1]), "int", "ndarray")],
32
+ )
33
+ def test_assert_numpy_array_equal_class_mismatch(a, b, klass1, klass2):
34
+ msg = f"""numpy array are different
35
+
36
+ numpy array classes are different
37
+ \\[left\\]: {klass1}
38
+ \\[right\\]: {klass2}"""
39
+
40
+ with pytest.raises(AssertionError, match=msg):
41
+ tm.assert_numpy_array_equal(a, b)
42
+
43
+
44
+ def test_assert_numpy_array_equal_value_mismatch1():
45
+ msg = """numpy array are different
46
+
47
+ numpy array values are different \\(66\\.66667 %\\)
48
+ \\[left\\]: \\[nan, 2\\.0, 3\\.0\\]
49
+ \\[right\\]: \\[1\\.0, nan, 3\\.0\\]"""
50
+
51
+ with pytest.raises(AssertionError, match=msg):
52
+ tm.assert_numpy_array_equal(np.array([np.nan, 2, 3]), np.array([1, np.nan, 3]))
53
+
54
+
55
+ def test_assert_numpy_array_equal_value_mismatch2():
56
+ msg = """numpy array are different
57
+
58
+ numpy array values are different \\(50\\.0 %\\)
59
+ \\[left\\]: \\[1, 2\\]
60
+ \\[right\\]: \\[1, 3\\]"""
61
+
62
+ with pytest.raises(AssertionError, match=msg):
63
+ tm.assert_numpy_array_equal(np.array([1, 2]), np.array([1, 3]))
64
+
65
+
66
+ def test_assert_numpy_array_equal_value_mismatch3():
67
+ msg = """numpy array are different
68
+
69
+ numpy array values are different \\(16\\.66667 %\\)
70
+ \\[left\\]: \\[\\[1, 2\\], \\[3, 4\\], \\[5, 6\\]\\]
71
+ \\[right\\]: \\[\\[1, 3\\], \\[3, 4\\], \\[5, 6\\]\\]"""
72
+
73
+ with pytest.raises(AssertionError, match=msg):
74
+ tm.assert_numpy_array_equal(
75
+ np.array([[1, 2], [3, 4], [5, 6]]), np.array([[1, 3], [3, 4], [5, 6]])
76
+ )
77
+
78
+
79
+ def test_assert_numpy_array_equal_value_mismatch4():
80
+ msg = """numpy array are different
81
+
82
+ numpy array values are different \\(50\\.0 %\\)
83
+ \\[left\\]: \\[1\\.1, 2\\.000001\\]
84
+ \\[right\\]: \\[1\\.1, 2.0\\]"""
85
+
86
+ with pytest.raises(AssertionError, match=msg):
87
+ tm.assert_numpy_array_equal(np.array([1.1, 2.000001]), np.array([1.1, 2.0]))
88
+
89
+
90
+ def test_assert_numpy_array_equal_value_mismatch5():
91
+ msg = """numpy array are different
92
+
93
+ numpy array values are different \\(16\\.66667 %\\)
94
+ \\[left\\]: \\[\\[1, 2\\], \\[3, 4\\], \\[5, 6\\]\\]
95
+ \\[right\\]: \\[\\[1, 3\\], \\[3, 4\\], \\[5, 6\\]\\]"""
96
+
97
+ with pytest.raises(AssertionError, match=msg):
98
+ tm.assert_numpy_array_equal(
99
+ np.array([[1, 2], [3, 4], [5, 6]]), np.array([[1, 3], [3, 4], [5, 6]])
100
+ )
101
+
102
+
103
+ def test_assert_numpy_array_equal_value_mismatch6():
104
+ msg = """numpy array are different
105
+
106
+ numpy array values are different \\(25\\.0 %\\)
107
+ \\[left\\]: \\[\\[1, 2\\], \\[3, 4\\]\\]
108
+ \\[right\\]: \\[\\[1, 3\\], \\[3, 4\\]\\]"""
109
+
110
+ with pytest.raises(AssertionError, match=msg):
111
+ tm.assert_numpy_array_equal(
112
+ np.array([[1, 2], [3, 4]]), np.array([[1, 3], [3, 4]])
113
+ )
114
+
115
+
116
+ def test_assert_numpy_array_equal_shape_mismatch_override():
117
+ msg = """Index are different
118
+
119
+ Index shapes are different
120
+ \\[left\\]: \\(2L*,\\)
121
+ \\[right\\]: \\(3L*,\\)"""
122
+
123
+ with pytest.raises(AssertionError, match=msg):
124
+ tm.assert_numpy_array_equal(np.array([1, 2]), np.array([3, 4, 5]), obj="Index")
125
+
126
+
127
+ def test_numpy_array_equal_unicode():
128
+ # see gh-20503
129
+ #
130
+ # Test ensures that `tm.assert_numpy_array_equals` raises the right
131
+ # exception when comparing np.arrays containing differing unicode objects.
132
+ msg = """numpy array are different
133
+
134
+ numpy array values are different \\(33\\.33333 %\\)
135
+ \\[left\\]: \\[á, à, ä\\]
136
+ \\[right\\]: \\[á, à, å\\]"""
137
+
138
+ with pytest.raises(AssertionError, match=msg):
139
+ tm.assert_numpy_array_equal(
140
+ np.array(["á", "à", "ä"]), np.array(["á", "à", "å"])
141
+ )
142
+
143
+
144
+ def test_numpy_array_equal_object():
145
+ a = np.array([Timestamp("2011-01-01"), Timestamp("2011-01-01")])
146
+ b = np.array([Timestamp("2011-01-01"), Timestamp("2011-01-02")])
147
+
148
+ msg = """numpy array are different
149
+
150
+ numpy array values are different \\(50\\.0 %\\)
151
+ \\[left\\]: \\[2011-01-01 00:00:00, 2011-01-01 00:00:00\\]
152
+ \\[right\\]: \\[2011-01-01 00:00:00, 2011-01-02 00:00:00\\]"""
153
+
154
+ with pytest.raises(AssertionError, match=msg):
155
+ tm.assert_numpy_array_equal(a, b)
156
+
157
+
158
+ @pytest.mark.parametrize("other_type", ["same", "copy"])
159
+ @pytest.mark.parametrize("check_same", ["same", "copy"])
160
+ def test_numpy_array_equal_copy_flag(other_type, check_same):
161
+ a = np.array([1, 2, 3])
162
+ msg = None
163
+
164
+ if other_type == "same":
165
+ other = a.view()
166
+ else:
167
+ other = a.copy()
168
+
169
+ if check_same != other_type:
170
+ msg = (
171
+ r"array\(\[1, 2, 3\]\) is not array\(\[1, 2, 3\]\)"
172
+ if check_same == "same"
173
+ else r"array\(\[1, 2, 3\]\) is array\(\[1, 2, 3\]\)"
174
+ )
175
+
176
+ if msg is not None:
177
+ with pytest.raises(AssertionError, match=msg):
178
+ tm.assert_numpy_array_equal(a, other, check_same=check_same)
179
+ else:
180
+ tm.assert_numpy_array_equal(a, other, check_same=check_same)
181
+
182
+
183
+ def test_numpy_array_equal_contains_na():
184
+ # https://github.com/pandas-dev/pandas/issues/31881
185
+ a = np.array([True, False])
186
+ b = np.array([True, pd.NA], dtype=object)
187
+
188
+ msg = """numpy array are different
189
+
190
+ numpy array values are different \\(50.0 %\\)
191
+ \\[left\\]: \\[True, False\\]
192
+ \\[right\\]: \\[True, <NA>\\]"""
193
+
194
+ with pytest.raises(AssertionError, match=msg):
195
+ tm.assert_numpy_array_equal(a, b)
196
+
197
+
198
+ def test_numpy_array_equal_identical_na(nulls_fixture):
199
+ a = np.array([nulls_fixture], dtype=object)
200
+
201
+ tm.assert_numpy_array_equal(a, a)
202
+
203
+ # matching but not the identical object
204
+ if hasattr(nulls_fixture, "copy"):
205
+ other = nulls_fixture.copy()
206
+ else:
207
+ other = copy.copy(nulls_fixture)
208
+ b = np.array([other], dtype=object)
209
+ tm.assert_numpy_array_equal(a, b)
210
+
211
+
212
+ def test_numpy_array_equal_different_na():
213
+ a = np.array([np.nan], dtype=object)
214
+ b = np.array([pd.NA], dtype=object)
215
+
216
+ msg = """numpy array are different
217
+
218
+ numpy array values are different \\(100.0 %\\)
219
+ \\[left\\]: \\[nan\\]
220
+ \\[right\\]: \\[<NA>\\]"""
221
+
222
+ with pytest.raises(AssertionError, match=msg):
223
+ tm.assert_numpy_array_equal(a, b)
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_assert_produces_warning.py ADDED
@@ -0,0 +1,241 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """"
2
+ Test module for testing ``pandas._testing.assert_produces_warning``.
3
+ """
4
+ import warnings
5
+
6
+ import pytest
7
+
8
+ from pandas.errors import (
9
+ DtypeWarning,
10
+ PerformanceWarning,
11
+ )
12
+
13
+ import pandas._testing as tm
14
+
15
+
16
+ @pytest.fixture(
17
+ params=[
18
+ RuntimeWarning,
19
+ ResourceWarning,
20
+ UserWarning,
21
+ FutureWarning,
22
+ DeprecationWarning,
23
+ PerformanceWarning,
24
+ DtypeWarning,
25
+ ],
26
+ )
27
+ def category(request):
28
+ """
29
+ Return unique warning.
30
+
31
+ Useful for testing behavior of tm.assert_produces_warning with various categories.
32
+ """
33
+ return request.param
34
+
35
+
36
+ @pytest.fixture(
37
+ params=[
38
+ (RuntimeWarning, UserWarning),
39
+ (UserWarning, FutureWarning),
40
+ (FutureWarning, RuntimeWarning),
41
+ (DeprecationWarning, PerformanceWarning),
42
+ (PerformanceWarning, FutureWarning),
43
+ (DtypeWarning, DeprecationWarning),
44
+ (ResourceWarning, DeprecationWarning),
45
+ (FutureWarning, DeprecationWarning),
46
+ ],
47
+ ids=lambda x: type(x).__name__,
48
+ )
49
+ def pair_different_warnings(request):
50
+ """
51
+ Return pair or different warnings.
52
+
53
+ Useful for testing how several different warnings are handled
54
+ in tm.assert_produces_warning.
55
+ """
56
+ return request.param
57
+
58
+
59
+ def f():
60
+ warnings.warn("f1", FutureWarning)
61
+ warnings.warn("f2", RuntimeWarning)
62
+
63
+
64
+ @pytest.mark.filterwarnings("ignore:f1:FutureWarning")
65
+ def test_assert_produces_warning_honors_filter():
66
+ # Raise by default.
67
+ msg = r"Caused unexpected warning\(s\)"
68
+ with pytest.raises(AssertionError, match=msg):
69
+ with tm.assert_produces_warning(RuntimeWarning):
70
+ f()
71
+
72
+ with tm.assert_produces_warning(RuntimeWarning, raise_on_extra_warnings=False):
73
+ f()
74
+
75
+
76
+ @pytest.mark.parametrize(
77
+ "message, match",
78
+ [
79
+ ("", None),
80
+ ("", ""),
81
+ ("Warning message", r".*"),
82
+ ("Warning message", "War"),
83
+ ("Warning message", r"[Ww]arning"),
84
+ ("Warning message", "age"),
85
+ ("Warning message", r"age$"),
86
+ ("Message 12-234 with numbers", r"\d{2}-\d{3}"),
87
+ ("Message 12-234 with numbers", r"^Mes.*\d{2}-\d{3}"),
88
+ ("Message 12-234 with numbers", r"\d{2}-\d{3}\s\S+"),
89
+ ("Message, which we do not match", None),
90
+ ],
91
+ )
92
+ def test_catch_warning_category_and_match(category, message, match):
93
+ with tm.assert_produces_warning(category, match=match):
94
+ warnings.warn(message, category)
95
+
96
+
97
+ def test_fail_to_match_runtime_warning():
98
+ category = RuntimeWarning
99
+ match = "Did not see this warning"
100
+ unmatched = (
101
+ r"Did not see warning 'RuntimeWarning' matching 'Did not see this warning'. "
102
+ r"The emitted warning messages are "
103
+ r"\[RuntimeWarning\('This is not a match.'\), "
104
+ r"RuntimeWarning\('Another unmatched warning.'\)\]"
105
+ )
106
+ with pytest.raises(AssertionError, match=unmatched):
107
+ with tm.assert_produces_warning(category, match=match):
108
+ warnings.warn("This is not a match.", category)
109
+ warnings.warn("Another unmatched warning.", category)
110
+
111
+
112
+ def test_fail_to_match_future_warning():
113
+ category = FutureWarning
114
+ match = "Warning"
115
+ unmatched = (
116
+ r"Did not see warning 'FutureWarning' matching 'Warning'. "
117
+ r"The emitted warning messages are "
118
+ r"\[FutureWarning\('This is not a match.'\), "
119
+ r"FutureWarning\('Another unmatched warning.'\)\]"
120
+ )
121
+ with pytest.raises(AssertionError, match=unmatched):
122
+ with tm.assert_produces_warning(category, match=match):
123
+ warnings.warn("This is not a match.", category)
124
+ warnings.warn("Another unmatched warning.", category)
125
+
126
+
127
+ def test_fail_to_match_resource_warning():
128
+ category = ResourceWarning
129
+ match = r"\d+"
130
+ unmatched = (
131
+ r"Did not see warning 'ResourceWarning' matching '\\d\+'. "
132
+ r"The emitted warning messages are "
133
+ r"\[ResourceWarning\('This is not a match.'\), "
134
+ r"ResourceWarning\('Another unmatched warning.'\)\]"
135
+ )
136
+ with pytest.raises(AssertionError, match=unmatched):
137
+ with tm.assert_produces_warning(category, match=match):
138
+ warnings.warn("This is not a match.", category)
139
+ warnings.warn("Another unmatched warning.", category)
140
+
141
+
142
+ def test_fail_to_catch_actual_warning(pair_different_warnings):
143
+ expected_category, actual_category = pair_different_warnings
144
+ match = "Did not see expected warning of class"
145
+ with pytest.raises(AssertionError, match=match):
146
+ with tm.assert_produces_warning(expected_category):
147
+ warnings.warn("warning message", actual_category)
148
+
149
+
150
+ def test_ignore_extra_warning(pair_different_warnings):
151
+ expected_category, extra_category = pair_different_warnings
152
+ with tm.assert_produces_warning(expected_category, raise_on_extra_warnings=False):
153
+ warnings.warn("Expected warning", expected_category)
154
+ warnings.warn("Unexpected warning OK", extra_category)
155
+
156
+
157
+ def test_raise_on_extra_warning(pair_different_warnings):
158
+ expected_category, extra_category = pair_different_warnings
159
+ match = r"Caused unexpected warning\(s\)"
160
+ with pytest.raises(AssertionError, match=match):
161
+ with tm.assert_produces_warning(expected_category):
162
+ warnings.warn("Expected warning", expected_category)
163
+ warnings.warn("Unexpected warning NOT OK", extra_category)
164
+
165
+
166
+ def test_same_category_different_messages_first_match():
167
+ category = UserWarning
168
+ with tm.assert_produces_warning(category, match=r"^Match this"):
169
+ warnings.warn("Match this", category)
170
+ warnings.warn("Do not match that", category)
171
+ warnings.warn("Do not match that either", category)
172
+
173
+
174
+ def test_same_category_different_messages_last_match():
175
+ category = DeprecationWarning
176
+ with tm.assert_produces_warning(category, match=r"^Match this"):
177
+ warnings.warn("Do not match that", category)
178
+ warnings.warn("Do not match that either", category)
179
+ warnings.warn("Match this", category)
180
+
181
+
182
+ def test_match_multiple_warnings():
183
+ # https://github.com/pandas-dev/pandas/issues/47829
184
+ category = (FutureWarning, UserWarning)
185
+ with tm.assert_produces_warning(category, match=r"^Match this"):
186
+ warnings.warn("Match this", FutureWarning)
187
+ warnings.warn("Match this too", UserWarning)
188
+
189
+
190
+ def test_right_category_wrong_match_raises(pair_different_warnings):
191
+ target_category, other_category = pair_different_warnings
192
+ with pytest.raises(AssertionError, match="Did not see warning.*matching"):
193
+ with tm.assert_produces_warning(target_category, match=r"^Match this"):
194
+ warnings.warn("Do not match it", target_category)
195
+ warnings.warn("Match this", other_category)
196
+
197
+
198
+ @pytest.mark.parametrize("false_or_none", [False, None])
199
+ class TestFalseOrNoneExpectedWarning:
200
+ def test_raise_on_warning(self, false_or_none):
201
+ msg = r"Caused unexpected warning\(s\)"
202
+ with pytest.raises(AssertionError, match=msg):
203
+ with tm.assert_produces_warning(false_or_none):
204
+ f()
205
+
206
+ def test_no_raise_without_warning(self, false_or_none):
207
+ with tm.assert_produces_warning(false_or_none):
208
+ pass
209
+
210
+ def test_no_raise_with_false_raise_on_extra(self, false_or_none):
211
+ with tm.assert_produces_warning(false_or_none, raise_on_extra_warnings=False):
212
+ f()
213
+
214
+
215
+ def test_raises_during_exception():
216
+ msg = "Did not see expected warning of class 'UserWarning'"
217
+ with pytest.raises(AssertionError, match=msg):
218
+ with tm.assert_produces_warning(UserWarning):
219
+ raise ValueError
220
+
221
+ with pytest.raises(AssertionError, match=msg):
222
+ with tm.assert_produces_warning(UserWarning):
223
+ warnings.warn("FutureWarning", FutureWarning)
224
+ raise IndexError
225
+
226
+ msg = "Caused unexpected warning"
227
+ with pytest.raises(AssertionError, match=msg):
228
+ with tm.assert_produces_warning(None):
229
+ warnings.warn("FutureWarning", FutureWarning)
230
+ raise SystemError
231
+
232
+
233
+ def test_passes_during_exception():
234
+ with pytest.raises(SyntaxError, match="Error"):
235
+ with tm.assert_produces_warning(None):
236
+ raise SyntaxError("Error")
237
+
238
+ with pytest.raises(ValueError, match="Error"):
239
+ with tm.assert_produces_warning(FutureWarning, match="FutureWarning"):
240
+ warnings.warn("FutureWarning", FutureWarning)
241
+ raise ValueError("Error")
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_assert_series_equal.py ADDED
@@ -0,0 +1,475 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import pytest
3
+
4
+ import pandas as pd
5
+ from pandas import (
6
+ Categorical,
7
+ DataFrame,
8
+ Series,
9
+ )
10
+ import pandas._testing as tm
11
+
12
+
13
+ def _assert_series_equal_both(a, b, **kwargs):
14
+ """
15
+ Check that two Series equal.
16
+
17
+ This check is performed commutatively.
18
+
19
+ Parameters
20
+ ----------
21
+ a : Series
22
+ The first Series to compare.
23
+ b : Series
24
+ The second Series to compare.
25
+ kwargs : dict
26
+ The arguments passed to `tm.assert_series_equal`.
27
+ """
28
+ tm.assert_series_equal(a, b, **kwargs)
29
+ tm.assert_series_equal(b, a, **kwargs)
30
+
31
+
32
+ def _assert_not_series_equal(a, b, **kwargs):
33
+ """
34
+ Check that two Series are not equal.
35
+
36
+ Parameters
37
+ ----------
38
+ a : Series
39
+ The first Series to compare.
40
+ b : Series
41
+ The second Series to compare.
42
+ kwargs : dict
43
+ The arguments passed to `tm.assert_series_equal`.
44
+ """
45
+ try:
46
+ tm.assert_series_equal(a, b, **kwargs)
47
+ msg = "The two Series were equal when they shouldn't have been"
48
+
49
+ pytest.fail(msg=msg)
50
+ except AssertionError:
51
+ pass
52
+
53
+
54
+ def _assert_not_series_equal_both(a, b, **kwargs):
55
+ """
56
+ Check that two Series are not equal.
57
+
58
+ This check is performed commutatively.
59
+
60
+ Parameters
61
+ ----------
62
+ a : Series
63
+ The first Series to compare.
64
+ b : Series
65
+ The second Series to compare.
66
+ kwargs : dict
67
+ The arguments passed to `tm.assert_series_equal`.
68
+ """
69
+ _assert_not_series_equal(a, b, **kwargs)
70
+ _assert_not_series_equal(b, a, **kwargs)
71
+
72
+
73
+ @pytest.mark.parametrize("data", [range(3), list("abc"), list("áàä")])
74
+ def test_series_equal(data):
75
+ _assert_series_equal_both(Series(data), Series(data))
76
+
77
+
78
+ @pytest.mark.parametrize(
79
+ "data1,data2",
80
+ [
81
+ (range(3), range(1, 4)),
82
+ (list("abc"), list("xyz")),
83
+ (list("áàä"), list("éèë")),
84
+ (list("áàä"), list(b"aaa")),
85
+ (range(3), range(4)),
86
+ ],
87
+ )
88
+ def test_series_not_equal_value_mismatch(data1, data2):
89
+ _assert_not_series_equal_both(Series(data1), Series(data2))
90
+
91
+
92
+ @pytest.mark.parametrize(
93
+ "kwargs",
94
+ [
95
+ {"dtype": "float64"}, # dtype mismatch
96
+ {"index": [1, 2, 4]}, # index mismatch
97
+ {"name": "foo"}, # name mismatch
98
+ ],
99
+ )
100
+ def test_series_not_equal_metadata_mismatch(kwargs):
101
+ data = range(3)
102
+ s1 = Series(data)
103
+
104
+ s2 = Series(data, **kwargs)
105
+ _assert_not_series_equal_both(s1, s2)
106
+
107
+
108
+ @pytest.mark.parametrize("data1,data2", [(0.12345, 0.12346), (0.1235, 0.1236)])
109
+ @pytest.mark.parametrize("dtype", ["float32", "float64", "Float32"])
110
+ @pytest.mark.parametrize("decimals", [0, 1, 2, 3, 5, 10])
111
+ def test_less_precise(data1, data2, dtype, decimals):
112
+ rtol = 10**-decimals
113
+ s1 = Series([data1], dtype=dtype)
114
+ s2 = Series([data2], dtype=dtype)
115
+
116
+ if decimals in (5, 10) or (decimals >= 3 and abs(data1 - data2) >= 0.0005):
117
+ msg = "Series values are different"
118
+ with pytest.raises(AssertionError, match=msg):
119
+ tm.assert_series_equal(s1, s2, rtol=rtol)
120
+ else:
121
+ _assert_series_equal_both(s1, s2, rtol=rtol)
122
+
123
+
124
+ @pytest.mark.parametrize(
125
+ "s1,s2,msg",
126
+ [
127
+ # Index
128
+ (
129
+ Series(["l1", "l2"], index=[1, 2]),
130
+ Series(["l1", "l2"], index=[1.0, 2.0]),
131
+ "Series\\.index are different",
132
+ ),
133
+ # MultiIndex
134
+ (
135
+ DataFrame.from_records(
136
+ {"a": [1, 2], "b": [2.1, 1.5], "c": ["l1", "l2"]}, index=["a", "b"]
137
+ ).c,
138
+ DataFrame.from_records(
139
+ {"a": [1.0, 2.0], "b": [2.1, 1.5], "c": ["l1", "l2"]}, index=["a", "b"]
140
+ ).c,
141
+ "MultiIndex level \\[0\\] are different",
142
+ ),
143
+ ],
144
+ )
145
+ def test_series_equal_index_dtype(s1, s2, msg, check_index_type):
146
+ kwargs = {"check_index_type": check_index_type}
147
+
148
+ if check_index_type:
149
+ with pytest.raises(AssertionError, match=msg):
150
+ tm.assert_series_equal(s1, s2, **kwargs)
151
+ else:
152
+ tm.assert_series_equal(s1, s2, **kwargs)
153
+
154
+
155
+ @pytest.mark.parametrize("check_like", [True, False])
156
+ def test_series_equal_order_mismatch(check_like):
157
+ s1 = Series([1, 2, 3], index=["a", "b", "c"])
158
+ s2 = Series([3, 2, 1], index=["c", "b", "a"])
159
+
160
+ if not check_like: # Do not ignore index ordering.
161
+ with pytest.raises(AssertionError, match="Series.index are different"):
162
+ tm.assert_series_equal(s1, s2, check_like=check_like)
163
+ else:
164
+ _assert_series_equal_both(s1, s2, check_like=check_like)
165
+
166
+
167
+ @pytest.mark.parametrize("check_index", [True, False])
168
+ def test_series_equal_index_mismatch(check_index):
169
+ s1 = Series([1, 2, 3], index=["a", "b", "c"])
170
+ s2 = Series([1, 2, 3], index=["c", "b", "a"])
171
+
172
+ if check_index: # Do not ignore index.
173
+ with pytest.raises(AssertionError, match="Series.index are different"):
174
+ tm.assert_series_equal(s1, s2, check_index=check_index)
175
+ else:
176
+ _assert_series_equal_both(s1, s2, check_index=check_index)
177
+
178
+
179
+ def test_series_invalid_param_combination():
180
+ left = Series(dtype=object)
181
+ right = Series(dtype=object)
182
+ with pytest.raises(
183
+ ValueError, match="check_like must be False if check_index is False"
184
+ ):
185
+ tm.assert_series_equal(left, right, check_index=False, check_like=True)
186
+
187
+
188
+ def test_series_equal_length_mismatch(rtol):
189
+ msg = """Series are different
190
+
191
+ Series length are different
192
+ \\[left\\]: 3, RangeIndex\\(start=0, stop=3, step=1\\)
193
+ \\[right\\]: 4, RangeIndex\\(start=0, stop=4, step=1\\)"""
194
+
195
+ s1 = Series([1, 2, 3])
196
+ s2 = Series([1, 2, 3, 4])
197
+
198
+ with pytest.raises(AssertionError, match=msg):
199
+ tm.assert_series_equal(s1, s2, rtol=rtol)
200
+
201
+
202
+ def test_series_equal_numeric_values_mismatch(rtol):
203
+ msg = """Series are different
204
+
205
+ Series values are different \\(33\\.33333 %\\)
206
+ \\[index\\]: \\[0, 1, 2\\]
207
+ \\[left\\]: \\[1, 2, 3\\]
208
+ \\[right\\]: \\[1, 2, 4\\]"""
209
+
210
+ s1 = Series([1, 2, 3])
211
+ s2 = Series([1, 2, 4])
212
+
213
+ with pytest.raises(AssertionError, match=msg):
214
+ tm.assert_series_equal(s1, s2, rtol=rtol)
215
+
216
+
217
+ def test_series_equal_categorical_values_mismatch(rtol, using_infer_string):
218
+ dtype = "str" if using_infer_string else "object"
219
+ msg = f"""Series are different
220
+
221
+ Series values are different \\(66\\.66667 %\\)
222
+ \\[index\\]: \\[0, 1, 2\\]
223
+ \\[left\\]: \\['a', 'b', 'c'\\]
224
+ Categories \\(3, {dtype}\\): \\['a', 'b', 'c'\\]
225
+ \\[right\\]: \\['a', 'c', 'b'\\]
226
+ Categories \\(3, {dtype}\\): \\['a', 'b', 'c'\\]"""
227
+
228
+ s1 = Series(Categorical(["a", "b", "c"]))
229
+ s2 = Series(Categorical(["a", "c", "b"]))
230
+
231
+ with pytest.raises(AssertionError, match=msg):
232
+ tm.assert_series_equal(s1, s2, rtol=rtol)
233
+
234
+
235
+ def test_series_equal_datetime_values_mismatch(rtol):
236
+ msg = """Series are different
237
+
238
+ Series values are different \\(100.0 %\\)
239
+ \\[index\\]: \\[0, 1, 2\\]
240
+ \\[left\\]: \\[1514764800000000000, 1514851200000000000, 1514937600000000000\\]
241
+ \\[right\\]: \\[1549065600000000000, 1549152000000000000, 1549238400000000000\\]"""
242
+
243
+ s1 = Series(pd.date_range("2018-01-01", periods=3, freq="D"))
244
+ s2 = Series(pd.date_range("2019-02-02", periods=3, freq="D"))
245
+
246
+ with pytest.raises(AssertionError, match=msg):
247
+ tm.assert_series_equal(s1, s2, rtol=rtol)
248
+
249
+
250
+ def test_series_equal_categorical_mismatch(check_categorical, using_infer_string):
251
+ if using_infer_string:
252
+ dtype = "str"
253
+ else:
254
+ dtype = "object"
255
+ msg = f"""Attributes of Series are different
256
+
257
+ Attribute "dtype" are different
258
+ \\[left\\]: CategoricalDtype\\(categories=\\['a', 'b'\\], ordered=False, \
259
+ categories_dtype={dtype}\\)
260
+ \\[right\\]: CategoricalDtype\\(categories=\\['a', 'b', 'c'\\], \
261
+ ordered=False, categories_dtype={dtype}\\)"""
262
+
263
+ s1 = Series(Categorical(["a", "b"]))
264
+ s2 = Series(Categorical(["a", "b"], categories=list("abc")))
265
+
266
+ if check_categorical:
267
+ with pytest.raises(AssertionError, match=msg):
268
+ tm.assert_series_equal(s1, s2, check_categorical=check_categorical)
269
+ else:
270
+ _assert_series_equal_both(s1, s2, check_categorical=check_categorical)
271
+
272
+
273
+ def test_assert_series_equal_extension_dtype_mismatch():
274
+ # https://github.com/pandas-dev/pandas/issues/32747
275
+ left = Series(pd.array([1, 2, 3], dtype="Int64"))
276
+ right = left.astype(int)
277
+
278
+ msg = """Attributes of Series are different
279
+
280
+ Attribute "dtype" are different
281
+ \\[left\\]: Int64
282
+ \\[right\\]: int[32|64]"""
283
+
284
+ tm.assert_series_equal(left, right, check_dtype=False)
285
+
286
+ with pytest.raises(AssertionError, match=msg):
287
+ tm.assert_series_equal(left, right, check_dtype=True)
288
+
289
+
290
+ def test_assert_series_equal_interval_dtype_mismatch():
291
+ # https://github.com/pandas-dev/pandas/issues/32747
292
+ left = Series([pd.Interval(0, 1)], dtype="interval")
293
+ right = left.astype(object)
294
+
295
+ msg = """Attributes of Series are different
296
+
297
+ Attribute "dtype" are different
298
+ \\[left\\]: interval\\[int64, right\\]
299
+ \\[right\\]: object"""
300
+
301
+ tm.assert_series_equal(left, right, check_dtype=False)
302
+
303
+ with pytest.raises(AssertionError, match=msg):
304
+ tm.assert_series_equal(left, right, check_dtype=True)
305
+
306
+
307
+ def test_series_equal_series_type():
308
+ class MySeries(Series):
309
+ pass
310
+
311
+ s1 = Series([1, 2])
312
+ s2 = Series([1, 2])
313
+ s3 = MySeries([1, 2])
314
+
315
+ tm.assert_series_equal(s1, s2, check_series_type=False)
316
+ tm.assert_series_equal(s1, s2, check_series_type=True)
317
+
318
+ tm.assert_series_equal(s1, s3, check_series_type=False)
319
+ tm.assert_series_equal(s3, s1, check_series_type=False)
320
+
321
+ with pytest.raises(AssertionError, match="Series classes are different"):
322
+ tm.assert_series_equal(s1, s3, check_series_type=True)
323
+
324
+ with pytest.raises(AssertionError, match="Series classes are different"):
325
+ tm.assert_series_equal(s3, s1, check_series_type=True)
326
+
327
+
328
+ def test_series_equal_exact_for_nonnumeric():
329
+ # https://github.com/pandas-dev/pandas/issues/35446
330
+ s1 = Series(["a", "b"])
331
+ s2 = Series(["a", "b"])
332
+ s3 = Series(["b", "a"])
333
+
334
+ tm.assert_series_equal(s1, s2, check_exact=True)
335
+ tm.assert_series_equal(s2, s1, check_exact=True)
336
+
337
+ msg = """Series are different
338
+
339
+ Series values are different \\(100\\.0 %\\)
340
+ \\[index\\]: \\[0, 1\\]
341
+ \\[left\\]: \\[a, b\\]
342
+ \\[right\\]: \\[b, a\\]"""
343
+ with pytest.raises(AssertionError, match=msg):
344
+ tm.assert_series_equal(s1, s3, check_exact=True)
345
+
346
+ msg = """Series are different
347
+
348
+ Series values are different \\(100\\.0 %\\)
349
+ \\[index\\]: \\[0, 1\\]
350
+ \\[left\\]: \\[b, a\\]
351
+ \\[right\\]: \\[a, b\\]"""
352
+ with pytest.raises(AssertionError, match=msg):
353
+ tm.assert_series_equal(s3, s1, check_exact=True)
354
+
355
+
356
+ def test_assert_series_equal_ignore_extension_dtype_mismatch():
357
+ # https://github.com/pandas-dev/pandas/issues/35715
358
+ left = Series([1, 2, 3], dtype="Int64")
359
+ right = Series([1, 2, 3], dtype="Int32")
360
+ tm.assert_series_equal(left, right, check_dtype=False)
361
+
362
+
363
+ def test_assert_series_equal_ignore_extension_dtype_mismatch_cross_class():
364
+ # https://github.com/pandas-dev/pandas/issues/35715
365
+ left = Series([1, 2, 3], dtype="Int64")
366
+ right = Series([1, 2, 3], dtype="int64")
367
+ tm.assert_series_equal(left, right, check_dtype=False)
368
+
369
+
370
+ def test_allows_duplicate_labels():
371
+ left = Series([1])
372
+ right = Series([1]).set_flags(allows_duplicate_labels=False)
373
+ tm.assert_series_equal(left, left)
374
+ tm.assert_series_equal(right, right)
375
+ tm.assert_series_equal(left, right, check_flags=False)
376
+ tm.assert_series_equal(right, left, check_flags=False)
377
+
378
+ with pytest.raises(AssertionError, match="<Flags"):
379
+ tm.assert_series_equal(left, right)
380
+
381
+ with pytest.raises(AssertionError, match="<Flags"):
382
+ tm.assert_series_equal(left, right)
383
+
384
+
385
+ def test_assert_series_equal_identical_na(nulls_fixture):
386
+ ser = Series([nulls_fixture])
387
+
388
+ tm.assert_series_equal(ser, ser.copy())
389
+
390
+ # while we're here do Index too
391
+ idx = pd.Index(ser)
392
+ tm.assert_index_equal(idx, idx.copy(deep=True))
393
+
394
+
395
+ def test_identical_nested_series_is_equal():
396
+ # GH#22400
397
+ x = Series(
398
+ [
399
+ 0,
400
+ 0.0131142231938,
401
+ 1.77774652865e-05,
402
+ np.array([0.4722720840328748, 0.4216929783681722]),
403
+ ]
404
+ )
405
+ y = Series(
406
+ [
407
+ 0,
408
+ 0.0131142231938,
409
+ 1.77774652865e-05,
410
+ np.array([0.4722720840328748, 0.4216929783681722]),
411
+ ]
412
+ )
413
+ # These two arrays should be equal, nesting could cause issue
414
+
415
+ tm.assert_series_equal(x, x)
416
+ tm.assert_series_equal(x, x, check_exact=True)
417
+ tm.assert_series_equal(x, y)
418
+ tm.assert_series_equal(x, y, check_exact=True)
419
+
420
+
421
+ @pytest.mark.parametrize("dtype", ["datetime64", "timedelta64"])
422
+ def test_check_dtype_false_different_reso(dtype):
423
+ # GH 52449
424
+ ser_s = Series([1000213, 2131232, 21312331]).astype(f"{dtype}[s]")
425
+ ser_ms = ser_s.astype(f"{dtype}[ms]")
426
+ with pytest.raises(AssertionError, match="Attributes of Series are different"):
427
+ tm.assert_series_equal(ser_s, ser_ms)
428
+ tm.assert_series_equal(ser_ms, ser_s, check_dtype=False)
429
+
430
+ ser_ms -= Series([1, 1, 1]).astype(f"{dtype}[ms]")
431
+
432
+ with pytest.raises(AssertionError, match="Series are different"):
433
+ tm.assert_series_equal(ser_s, ser_ms)
434
+
435
+ with pytest.raises(AssertionError, match="Series are different"):
436
+ tm.assert_series_equal(ser_s, ser_ms, check_dtype=False)
437
+
438
+
439
+ @pytest.mark.parametrize("dtype", ["Int64", "int64"])
440
+ def test_large_unequal_ints(dtype):
441
+ # https://github.com/pandas-dev/pandas/issues/55882
442
+ left = Series([1577840521123000], dtype=dtype)
443
+ right = Series([1577840521123543], dtype=dtype)
444
+ with pytest.raises(AssertionError, match="Series are different"):
445
+ tm.assert_series_equal(left, right)
446
+
447
+
448
+ @pytest.mark.parametrize("dtype", [None, object])
449
+ @pytest.mark.parametrize("check_exact", [True, False])
450
+ @pytest.mark.parametrize("val", [3, 3.5])
451
+ def test_ea_and_numpy_no_dtype_check(val, check_exact, dtype):
452
+ # GH#56651
453
+ left = Series([1, 2, val], dtype=dtype)
454
+ right = Series(pd.array([1, 2, val]))
455
+ tm.assert_series_equal(left, right, check_dtype=False, check_exact=check_exact)
456
+
457
+
458
+ def test_assert_series_equal_int_tol():
459
+ # GH#56646
460
+ left = Series([81, 18, 121, 38, 74, 72, 81, 81, 146, 81, 81, 170, 74, 74])
461
+ right = Series([72, 9, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72])
462
+ tm.assert_series_equal(left, right, rtol=1.5)
463
+
464
+ tm.assert_frame_equal(left.to_frame(), right.to_frame(), rtol=1.5)
465
+ tm.assert_extension_array_equal(
466
+ left.astype("Int64").values, right.astype("Int64").values, rtol=1.5
467
+ )
468
+
469
+
470
+ def test_assert_series_equal_index_exact_default():
471
+ # GH#57067
472
+ ser1 = Series(np.zeros(6, dtype=int), [0, 0.2, 0.4, 0.6, 0.8, 1])
473
+ ser2 = Series(np.zeros(6, dtype=int), np.linspace(0, 1, 6))
474
+ tm.assert_series_equal(ser1, ser2)
475
+ tm.assert_frame_equal(ser1.to_frame(), ser2.to_frame())
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_deprecate.py ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from textwrap import dedent
2
+
3
+ import pytest
4
+
5
+ from pandas.util._decorators import deprecate
6
+
7
+ import pandas._testing as tm
8
+
9
+
10
+ def new_func():
11
+ """
12
+ This is the summary. The deprecate directive goes next.
13
+
14
+ This is the extended summary. The deprecate directive goes before this.
15
+ """
16
+ return "new_func called"
17
+
18
+
19
+ def new_func_no_docstring():
20
+ return "new_func_no_docstring called"
21
+
22
+
23
+ def new_func_wrong_docstring():
24
+ """Summary should be in the next line."""
25
+ return "new_func_wrong_docstring called"
26
+
27
+
28
+ def new_func_with_deprecation():
29
+ """
30
+ This is the summary. The deprecate directive goes next.
31
+
32
+ .. deprecated:: 1.0
33
+ Use new_func instead.
34
+
35
+ This is the extended summary. The deprecate directive goes before this.
36
+ """
37
+
38
+
39
+ def test_deprecate_ok():
40
+ depr_func = deprecate("depr_func", new_func, "1.0", msg="Use new_func instead.")
41
+
42
+ with tm.assert_produces_warning(FutureWarning):
43
+ result = depr_func()
44
+
45
+ assert result == "new_func called"
46
+ assert depr_func.__doc__ == dedent(new_func_with_deprecation.__doc__)
47
+
48
+
49
+ def test_deprecate_no_docstring():
50
+ depr_func = deprecate(
51
+ "depr_func", new_func_no_docstring, "1.0", msg="Use new_func instead."
52
+ )
53
+ with tm.assert_produces_warning(FutureWarning):
54
+ result = depr_func()
55
+ assert result == "new_func_no_docstring called"
56
+
57
+
58
+ def test_deprecate_wrong_docstring():
59
+ msg = "deprecate needs a correctly formatted docstring"
60
+ with pytest.raises(AssertionError, match=msg):
61
+ deprecate(
62
+ "depr_func", new_func_wrong_docstring, "1.0", msg="Use new_func instead."
63
+ )
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_deprecate_kwarg.py ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pytest
2
+
3
+ from pandas.util._decorators import deprecate_kwarg
4
+
5
+ import pandas._testing as tm
6
+
7
+
8
+ @deprecate_kwarg("old", "new")
9
+ def _f1(new=False):
10
+ return new
11
+
12
+
13
+ _f2_mappings = {"yes": True, "no": False}
14
+
15
+
16
+ @deprecate_kwarg("old", "new", _f2_mappings)
17
+ def _f2(new=False):
18
+ return new
19
+
20
+
21
+ def _f3_mapping(x):
22
+ return x + 1
23
+
24
+
25
+ @deprecate_kwarg("old", "new", _f3_mapping)
26
+ def _f3(new=0):
27
+ return new
28
+
29
+
30
+ @pytest.mark.parametrize("key,klass", [("old", FutureWarning), ("new", None)])
31
+ def test_deprecate_kwarg(key, klass):
32
+ x = 78
33
+
34
+ with tm.assert_produces_warning(klass):
35
+ assert _f1(**{key: x}) == x
36
+
37
+
38
+ @pytest.mark.parametrize("key", list(_f2_mappings.keys()))
39
+ def test_dict_deprecate_kwarg(key):
40
+ with tm.assert_produces_warning(FutureWarning):
41
+ assert _f2(old=key) == _f2_mappings[key]
42
+
43
+
44
+ @pytest.mark.parametrize("key", ["bogus", 12345, -1.23])
45
+ def test_missing_deprecate_kwarg(key):
46
+ with tm.assert_produces_warning(FutureWarning):
47
+ assert _f2(old=key) == key
48
+
49
+
50
+ @pytest.mark.parametrize("x", [1, -1.4, 0])
51
+ def test_callable_deprecate_kwarg(x):
52
+ with tm.assert_produces_warning(FutureWarning):
53
+ assert _f3(old=x) == _f3_mapping(x)
54
+
55
+
56
+ def test_callable_deprecate_kwarg_fail():
57
+ msg = "((can only|cannot) concatenate)|(must be str)|(Can't convert)"
58
+
59
+ with pytest.raises(TypeError, match=msg):
60
+ _f3(old="hello")
61
+
62
+
63
+ def test_bad_deprecate_kwarg():
64
+ msg = "mapping from old to new argument values must be dict or callable!"
65
+
66
+ with pytest.raises(TypeError, match=msg):
67
+
68
+ @deprecate_kwarg("old", "new", 0)
69
+ def f4(new=None):
70
+ return new
71
+
72
+
73
+ @deprecate_kwarg("old", None)
74
+ def _f4(old=True, unchanged=True):
75
+ return old, unchanged
76
+
77
+
78
+ @pytest.mark.parametrize("key", ["old", "unchanged"])
79
+ def test_deprecate_keyword(key):
80
+ x = 9
81
+
82
+ if key == "old":
83
+ klass = FutureWarning
84
+ expected = (x, True)
85
+ else:
86
+ klass = None
87
+ expected = (True, x)
88
+
89
+ with tm.assert_produces_warning(klass):
90
+ assert _f4(**{key: x}) == expected
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_deprecate_nonkeyword_arguments.py ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Tests for the `deprecate_nonkeyword_arguments` decorator
3
+ """
4
+
5
+ import inspect
6
+
7
+ from pandas.util._decorators import deprecate_nonkeyword_arguments
8
+
9
+ import pandas._testing as tm
10
+
11
+
12
+ @deprecate_nonkeyword_arguments(
13
+ version="1.1", allowed_args=["a", "b"], name="f_add_inputs"
14
+ )
15
+ def f(a, b=0, c=0, d=0):
16
+ return a + b + c + d
17
+
18
+
19
+ def test_f_signature():
20
+ assert str(inspect.signature(f)) == "(a, b=0, *, c=0, d=0)"
21
+
22
+
23
+ def test_one_argument():
24
+ with tm.assert_produces_warning(None):
25
+ assert f(19) == 19
26
+
27
+
28
+ def test_one_and_one_arguments():
29
+ with tm.assert_produces_warning(None):
30
+ assert f(19, d=6) == 25
31
+
32
+
33
+ def test_two_arguments():
34
+ with tm.assert_produces_warning(None):
35
+ assert f(1, 5) == 6
36
+
37
+
38
+ def test_two_and_two_arguments():
39
+ with tm.assert_produces_warning(None):
40
+ assert f(1, 3, c=3, d=5) == 12
41
+
42
+
43
+ def test_three_arguments():
44
+ with tm.assert_produces_warning(FutureWarning):
45
+ assert f(6, 3, 3) == 12
46
+
47
+
48
+ def test_four_arguments():
49
+ with tm.assert_produces_warning(FutureWarning):
50
+ assert f(1, 2, 3, 4) == 10
51
+
52
+
53
+ def test_three_arguments_with_name_in_warning():
54
+ msg = (
55
+ "Starting with pandas version 1.1 all arguments of f_add_inputs "
56
+ "except for the arguments 'a' and 'b' will be keyword-only."
57
+ )
58
+ with tm.assert_produces_warning(FutureWarning, match=msg):
59
+ assert f(6, 3, 3) == 12
60
+
61
+
62
+ @deprecate_nonkeyword_arguments(version="1.1")
63
+ def g(a, b=0, c=0, d=0):
64
+ with tm.assert_produces_warning(None):
65
+ return a + b + c + d
66
+
67
+
68
+ def test_g_signature():
69
+ assert str(inspect.signature(g)) == "(a, *, b=0, c=0, d=0)"
70
+
71
+
72
+ def test_one_and_three_arguments_default_allowed_args():
73
+ with tm.assert_produces_warning(None):
74
+ assert g(1, b=3, c=3, d=5) == 12
75
+
76
+
77
+ def test_three_arguments_default_allowed_args():
78
+ with tm.assert_produces_warning(FutureWarning):
79
+ assert g(6, 3, 3) == 12
80
+
81
+
82
+ def test_three_positional_argument_with_warning_message_analysis():
83
+ msg = (
84
+ "Starting with pandas version 1.1 all arguments of g "
85
+ "except for the argument 'a' will be keyword-only."
86
+ )
87
+ with tm.assert_produces_warning(FutureWarning, match=msg):
88
+ assert g(6, 3, 3) == 12
89
+
90
+
91
+ @deprecate_nonkeyword_arguments(version="1.1")
92
+ def h(a=0, b=0, c=0, d=0):
93
+ return a + b + c + d
94
+
95
+
96
+ def test_h_signature():
97
+ assert str(inspect.signature(h)) == "(*, a=0, b=0, c=0, d=0)"
98
+
99
+
100
+ def test_all_keyword_arguments():
101
+ with tm.assert_produces_warning(None):
102
+ assert h(a=1, b=2) == 3
103
+
104
+
105
+ def test_one_positional_argument():
106
+ with tm.assert_produces_warning(FutureWarning):
107
+ assert h(23) == 23
108
+
109
+
110
+ def test_one_positional_argument_with_warning_message_analysis():
111
+ msg = "Starting with pandas version 1.1 all arguments of h will be keyword-only."
112
+ with tm.assert_produces_warning(FutureWarning, match=msg):
113
+ assert h(19) == 19
114
+
115
+
116
+ @deprecate_nonkeyword_arguments(version="1.1")
117
+ def i(a=0, /, b=0, *, c=0, d=0):
118
+ return a + b + c + d
119
+
120
+
121
+ def test_i_signature():
122
+ assert str(inspect.signature(i)) == "(*, a=0, b=0, c=0, d=0)"
123
+
124
+
125
+ class Foo:
126
+ @deprecate_nonkeyword_arguments(version=None, allowed_args=["self", "bar"])
127
+ def baz(self, bar=None, foobar=None): # pylint: disable=disallowed-name
128
+ ...
129
+
130
+
131
+ def test_foo_signature():
132
+ assert str(inspect.signature(Foo.baz)) == "(self, bar=None, *, foobar=None)"
133
+
134
+
135
+ def test_class():
136
+ msg = (
137
+ r"In a future version of pandas all arguments of Foo\.baz "
138
+ r"except for the argument \'bar\' will be keyword-only"
139
+ )
140
+ with tm.assert_produces_warning(FutureWarning, match=msg):
141
+ Foo().baz("qux", "quox")
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_doc.py ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from textwrap import dedent
2
+
3
+ from pandas.util._decorators import doc
4
+
5
+
6
+ @doc(method="cumsum", operation="sum")
7
+ def cumsum(whatever):
8
+ """
9
+ This is the {method} method.
10
+
11
+ It computes the cumulative {operation}.
12
+ """
13
+
14
+
15
+ @doc(
16
+ cumsum,
17
+ dedent(
18
+ """
19
+ Examples
20
+ --------
21
+
22
+ >>> cumavg([1, 2, 3])
23
+ 2
24
+ """
25
+ ),
26
+ method="cumavg",
27
+ operation="average",
28
+ )
29
+ def cumavg(whatever):
30
+ pass
31
+
32
+
33
+ @doc(cumsum, method="cummax", operation="maximum")
34
+ def cummax(whatever):
35
+ pass
36
+
37
+
38
+ @doc(cummax, method="cummin", operation="minimum")
39
+ def cummin(whatever):
40
+ pass
41
+
42
+
43
+ def test_docstring_formatting():
44
+ docstr = dedent(
45
+ """
46
+ This is the cumsum method.
47
+
48
+ It computes the cumulative sum.
49
+ """
50
+ )
51
+ assert cumsum.__doc__ == docstr
52
+
53
+
54
+ def test_docstring_appending():
55
+ docstr = dedent(
56
+ """
57
+ This is the cumavg method.
58
+
59
+ It computes the cumulative average.
60
+
61
+ Examples
62
+ --------
63
+
64
+ >>> cumavg([1, 2, 3])
65
+ 2
66
+ """
67
+ )
68
+ assert cumavg.__doc__ == docstr
69
+
70
+
71
+ def test_doc_template_from_func():
72
+ docstr = dedent(
73
+ """
74
+ This is the cummax method.
75
+
76
+ It computes the cumulative maximum.
77
+ """
78
+ )
79
+ assert cummax.__doc__ == docstr
80
+
81
+
82
+ def test_inherit_doc_template():
83
+ docstr = dedent(
84
+ """
85
+ This is the cummin method.
86
+
87
+ It computes the cumulative minimum.
88
+ """
89
+ )
90
+ assert cummin.__doc__ == docstr
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_hashing.py ADDED
@@ -0,0 +1,417 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import pytest
3
+
4
+ import pandas as pd
5
+ from pandas import (
6
+ DataFrame,
7
+ Index,
8
+ MultiIndex,
9
+ Series,
10
+ period_range,
11
+ timedelta_range,
12
+ )
13
+ import pandas._testing as tm
14
+ from pandas.core.util.hashing import hash_tuples
15
+ from pandas.util import (
16
+ hash_array,
17
+ hash_pandas_object,
18
+ )
19
+
20
+
21
+ @pytest.fixture(
22
+ params=[
23
+ Series([1, 2, 3] * 3, dtype="int32"),
24
+ Series([None, 2.5, 3.5] * 3, dtype="float32"),
25
+ Series(["a", "b", "c"] * 3, dtype="category"),
26
+ Series(["d", "e", "f"] * 3),
27
+ Series([True, False, True] * 3),
28
+ Series(pd.date_range("20130101", periods=9)),
29
+ Series(pd.date_range("20130101", periods=9, tz="US/Eastern")),
30
+ Series(timedelta_range("2000", periods=9)),
31
+ ]
32
+ )
33
+ def series(request):
34
+ return request.param
35
+
36
+
37
+ @pytest.fixture(params=[True, False])
38
+ def index(request):
39
+ return request.param
40
+
41
+
42
+ def test_consistency():
43
+ # Check that our hash doesn't change because of a mistake
44
+ # in the actual code; this is the ground truth.
45
+ result = hash_pandas_object(Index(["foo", "bar", "baz"]))
46
+ expected = Series(
47
+ np.array(
48
+ [3600424527151052760, 1374399572096150070, 477881037637427054],
49
+ dtype="uint64",
50
+ ),
51
+ index=["foo", "bar", "baz"],
52
+ )
53
+ tm.assert_series_equal(result, expected)
54
+
55
+
56
+ def test_hash_array(series):
57
+ arr = series.values
58
+ tm.assert_numpy_array_equal(hash_array(arr), hash_array(arr))
59
+
60
+
61
+ @pytest.mark.parametrize("dtype", ["U", object])
62
+ def test_hash_array_mixed(dtype):
63
+ result1 = hash_array(np.array(["3", "4", "All"]))
64
+ result2 = hash_array(np.array([3, 4, "All"], dtype=dtype))
65
+
66
+ tm.assert_numpy_array_equal(result1, result2)
67
+
68
+
69
+ @pytest.mark.parametrize("val", [5, "foo", pd.Timestamp("20130101")])
70
+ def test_hash_array_errors(val):
71
+ msg = "must pass a ndarray-like"
72
+ with pytest.raises(TypeError, match=msg):
73
+ hash_array(val)
74
+
75
+
76
+ def test_hash_array_index_exception():
77
+ # GH42003 TypeError instead of AttributeError
78
+ obj = pd.DatetimeIndex(["2018-10-28 01:20:00"], tz="Europe/Berlin")
79
+
80
+ msg = "Use hash_pandas_object instead"
81
+ with pytest.raises(TypeError, match=msg):
82
+ hash_array(obj)
83
+
84
+
85
+ def test_hash_tuples():
86
+ tuples = [(1, "one"), (1, "two"), (2, "one")]
87
+ result = hash_tuples(tuples)
88
+
89
+ expected = hash_pandas_object(MultiIndex.from_tuples(tuples)).values
90
+ tm.assert_numpy_array_equal(result, expected)
91
+
92
+ # We only need to support MultiIndex and list-of-tuples
93
+ msg = "|".join(["object is not iterable", "zip argument #1 must support iteration"])
94
+ with pytest.raises(TypeError, match=msg):
95
+ hash_tuples(tuples[0])
96
+
97
+
98
+ @pytest.mark.parametrize("val", [5, "foo", pd.Timestamp("20130101")])
99
+ def test_hash_tuples_err(val):
100
+ msg = "must be convertible to a list-of-tuples"
101
+ with pytest.raises(TypeError, match=msg):
102
+ hash_tuples(val)
103
+
104
+
105
+ def test_multiindex_unique():
106
+ mi = MultiIndex.from_tuples([(118, 472), (236, 118), (51, 204), (102, 51)])
107
+ assert mi.is_unique is True
108
+
109
+ result = hash_pandas_object(mi)
110
+ assert result.is_unique is True
111
+
112
+
113
+ def test_multiindex_objects():
114
+ mi = MultiIndex(
115
+ levels=[["b", "d", "a"], [1, 2, 3]],
116
+ codes=[[0, 1, 0, 2], [2, 0, 0, 1]],
117
+ names=["col1", "col2"],
118
+ )
119
+ recons = mi._sort_levels_monotonic()
120
+
121
+ # These are equal.
122
+ assert mi.equals(recons)
123
+ assert Index(mi.values).equals(Index(recons.values))
124
+
125
+
126
+ @pytest.mark.parametrize(
127
+ "obj",
128
+ [
129
+ Series([1, 2, 3]),
130
+ Series([1.0, 1.5, 3.2]),
131
+ Series([1.0, 1.5, np.nan]),
132
+ Series([1.0, 1.5, 3.2], index=[1.5, 1.1, 3.3]),
133
+ Series(["a", "b", "c"]),
134
+ Series(["a", np.nan, "c"]),
135
+ Series(["a", None, "c"]),
136
+ Series([True, False, True]),
137
+ Series(dtype=object),
138
+ DataFrame({"x": ["a", "b", "c"], "y": [1, 2, 3]}),
139
+ DataFrame(),
140
+ DataFrame(np.full((10, 4), np.nan)),
141
+ DataFrame(
142
+ {
143
+ "A": [0.0, 1.0, 2.0, 3.0, 4.0],
144
+ "B": [0.0, 1.0, 0.0, 1.0, 0.0],
145
+ "C": Index(["foo1", "foo2", "foo3", "foo4", "foo5"], dtype=object),
146
+ "D": pd.date_range("20130101", periods=5),
147
+ }
148
+ ),
149
+ DataFrame(range(5), index=pd.date_range("2020-01-01", periods=5)),
150
+ Series(range(5), index=pd.date_range("2020-01-01", periods=5)),
151
+ Series(period_range("2020-01-01", periods=10, freq="D")),
152
+ Series(pd.date_range("20130101", periods=3, tz="US/Eastern")),
153
+ ],
154
+ )
155
+ def test_hash_pandas_object(obj, index):
156
+ a = hash_pandas_object(obj, index=index)
157
+ b = hash_pandas_object(obj, index=index)
158
+ tm.assert_series_equal(a, b)
159
+
160
+
161
+ @pytest.mark.parametrize(
162
+ "obj",
163
+ [
164
+ Series([1, 2, 3]),
165
+ Series([1.0, 1.5, 3.2]),
166
+ Series([1.0, 1.5, np.nan]),
167
+ Series([1.0, 1.5, 3.2], index=[1.5, 1.1, 3.3]),
168
+ Series(["a", "b", "c"]),
169
+ Series(["a", np.nan, "c"]),
170
+ Series(["a", None, "c"]),
171
+ Series([True, False, True]),
172
+ DataFrame({"x": ["a", "b", "c"], "y": [1, 2, 3]}),
173
+ DataFrame(np.full((10, 4), np.nan)),
174
+ DataFrame(
175
+ {
176
+ "A": [0.0, 1.0, 2.0, 3.0, 4.0],
177
+ "B": [0.0, 1.0, 0.0, 1.0, 0.0],
178
+ "C": Index(["foo1", "foo2", "foo3", "foo4", "foo5"], dtype=object),
179
+ "D": pd.date_range("20130101", periods=5),
180
+ }
181
+ ),
182
+ DataFrame(range(5), index=pd.date_range("2020-01-01", periods=5)),
183
+ Series(range(5), index=pd.date_range("2020-01-01", periods=5)),
184
+ Series(period_range("2020-01-01", periods=10, freq="D")),
185
+ Series(pd.date_range("20130101", periods=3, tz="US/Eastern")),
186
+ ],
187
+ )
188
+ def test_hash_pandas_object_diff_index_non_empty(obj):
189
+ a = hash_pandas_object(obj, index=True)
190
+ b = hash_pandas_object(obj, index=False)
191
+ assert not (a == b).all()
192
+
193
+
194
+ @pytest.mark.parametrize(
195
+ "obj",
196
+ [
197
+ Index([1, 2, 3]),
198
+ Index([True, False, True]),
199
+ timedelta_range("1 day", periods=2),
200
+ period_range("2020-01-01", freq="D", periods=2),
201
+ MultiIndex.from_product(
202
+ [range(5), ["foo", "bar", "baz"], pd.date_range("20130101", periods=2)]
203
+ ),
204
+ MultiIndex.from_product([pd.CategoricalIndex(list("aabc")), range(3)]),
205
+ ],
206
+ )
207
+ def test_hash_pandas_index(obj, index):
208
+ a = hash_pandas_object(obj, index=index)
209
+ b = hash_pandas_object(obj, index=index)
210
+ tm.assert_series_equal(a, b)
211
+
212
+
213
+ def test_hash_pandas_series(series, index):
214
+ a = hash_pandas_object(series, index=index)
215
+ b = hash_pandas_object(series, index=index)
216
+ tm.assert_series_equal(a, b)
217
+
218
+
219
+ def test_hash_pandas_series_diff_index(series):
220
+ a = hash_pandas_object(series, index=True)
221
+ b = hash_pandas_object(series, index=False)
222
+ assert not (a == b).all()
223
+
224
+
225
+ @pytest.mark.parametrize(
226
+ "obj", [Series([], dtype="float64"), Series([], dtype="object"), Index([])]
227
+ )
228
+ def test_hash_pandas_empty_object(obj, index):
229
+ # These are by-definition the same with
230
+ # or without the index as the data is empty.
231
+ a = hash_pandas_object(obj, index=index)
232
+ b = hash_pandas_object(obj, index=index)
233
+ tm.assert_series_equal(a, b)
234
+
235
+
236
+ @pytest.mark.parametrize(
237
+ "s1",
238
+ [
239
+ Series(["a", "b", "c", "d"]),
240
+ Series([1000, 2000, 3000, 4000]),
241
+ Series(pd.date_range(0, periods=4)),
242
+ ],
243
+ )
244
+ @pytest.mark.parametrize("categorize", [True, False])
245
+ def test_categorical_consistency(s1, categorize):
246
+ # see gh-15143
247
+ #
248
+ # Check that categoricals hash consistent with their values,
249
+ # not codes. This should work for categoricals of any dtype.
250
+ s2 = s1.astype("category").cat.set_categories(s1)
251
+ s3 = s2.cat.set_categories(list(reversed(s1)))
252
+
253
+ # These should all hash identically.
254
+ h1 = hash_pandas_object(s1, categorize=categorize)
255
+ h2 = hash_pandas_object(s2, categorize=categorize)
256
+ h3 = hash_pandas_object(s3, categorize=categorize)
257
+
258
+ tm.assert_series_equal(h1, h2)
259
+ tm.assert_series_equal(h1, h3)
260
+
261
+
262
+ def test_categorical_with_nan_consistency():
263
+ c = pd.Categorical.from_codes(
264
+ [-1, 0, 1, 2, 3, 4], categories=pd.date_range("2012-01-01", periods=5, name="B")
265
+ )
266
+ expected = hash_array(c, categorize=False)
267
+
268
+ c = pd.Categorical.from_codes([-1, 0], categories=[pd.Timestamp("2012-01-01")])
269
+ result = hash_array(c, categorize=False)
270
+
271
+ assert result[0] in expected
272
+ assert result[1] in expected
273
+
274
+
275
+ def test_pandas_errors():
276
+ msg = "Unexpected type for hashing"
277
+ with pytest.raises(TypeError, match=msg):
278
+ hash_pandas_object(pd.Timestamp("20130101"))
279
+
280
+
281
+ def test_hash_keys():
282
+ # Using different hash keys, should have
283
+ # different hashes for the same data.
284
+ #
285
+ # This only matters for object dtypes.
286
+ obj = Series(list("abc"))
287
+
288
+ a = hash_pandas_object(obj, hash_key="9876543210123456")
289
+ b = hash_pandas_object(obj, hash_key="9876543210123465")
290
+
291
+ assert (a != b).all()
292
+
293
+
294
+ def test_df_hash_keys():
295
+ # DataFrame version of the test_hash_keys.
296
+ # https://github.com/pandas-dev/pandas/issues/41404
297
+ obj = DataFrame({"x": np.arange(3), "y": list("abc")})
298
+
299
+ a = hash_pandas_object(obj, hash_key="9876543210123456")
300
+ b = hash_pandas_object(obj, hash_key="9876543210123465")
301
+
302
+ assert (a != b).all()
303
+
304
+
305
+ def test_df_encoding():
306
+ # Check that DataFrame recognizes optional encoding.
307
+ # https://github.com/pandas-dev/pandas/issues/41404
308
+ # https://github.com/pandas-dev/pandas/pull/42049
309
+ obj = DataFrame({"x": np.arange(3), "y": list("a+c")})
310
+
311
+ a = hash_pandas_object(obj, encoding="utf8")
312
+ b = hash_pandas_object(obj, encoding="utf7")
313
+
314
+ # Note that the "+" is encoded as "+-" in utf-7.
315
+ assert a[0] == b[0]
316
+ assert a[1] != b[1]
317
+ assert a[2] == b[2]
318
+
319
+
320
+ def test_invalid_key():
321
+ # This only matters for object dtypes.
322
+ msg = "key should be a 16-byte string encoded"
323
+
324
+ with pytest.raises(ValueError, match=msg):
325
+ hash_pandas_object(Series(list("abc")), hash_key="foo")
326
+
327
+
328
+ def test_already_encoded(index):
329
+ # If already encoded, then ok.
330
+ obj = Series(list("abc")).str.encode("utf8")
331
+ a = hash_pandas_object(obj, index=index)
332
+ b = hash_pandas_object(obj, index=index)
333
+ tm.assert_series_equal(a, b)
334
+
335
+
336
+ def test_alternate_encoding(index):
337
+ obj = Series(list("abc"))
338
+ a = hash_pandas_object(obj, index=index)
339
+ b = hash_pandas_object(obj, index=index)
340
+ tm.assert_series_equal(a, b)
341
+
342
+
343
+ @pytest.mark.parametrize("l_exp", range(8))
344
+ @pytest.mark.parametrize("l_add", [0, 1])
345
+ def test_same_len_hash_collisions(l_exp, l_add):
346
+ length = 2 ** (l_exp + 8) + l_add
347
+ idx = np.array([str(i) for i in range(length)], dtype=object)
348
+
349
+ result = hash_array(idx, "utf8")
350
+ assert not result[0] == result[1]
351
+
352
+
353
+ def test_hash_collisions():
354
+ # Hash collisions are bad.
355
+ #
356
+ # https://github.com/pandas-dev/pandas/issues/14711#issuecomment-264885726
357
+ hashes = [
358
+ "Ingrid-9Z9fKIZmkO7i7Cn51Li34pJm44fgX6DYGBNj3VPlOH50m7HnBlPxfIwFMrcNJNMP6PSgLmwWnInciMWrCSAlLEvt7JkJl4IxiMrVbXSa8ZQoVaq5xoQPjltuJEfwdNlO6jo8qRRHvD8sBEBMQASrRa6TsdaPTPCBo3nwIBpE7YzzmyH0vMBhjQZLx1aCT7faSEx7PgFxQhHdKFWROcysamgy9iVj8DO2Fmwg1NNl93rIAqC3mdqfrCxrzfvIY8aJdzin2cHVzy3QUJxZgHvtUtOLxoqnUHsYbNTeq0xcLXpTZEZCxD4PGubIuCNf32c33M7HFsnjWSEjE2yVdWKhmSVodyF8hFYVmhYnMCztQnJrt3O8ZvVRXd5IKwlLexiSp4h888w7SzAIcKgc3g5XQJf6MlSMftDXm9lIsE1mJNiJEv6uY6pgvC3fUPhatlR5JPpVAHNSbSEE73MBzJrhCAbOLXQumyOXigZuPoME7QgJcBalliQol7YZ9",
359
+ "Tim-b9MddTxOWW2AT1Py6vtVbZwGAmYCjbp89p8mxsiFoVX4FyDOF3wFiAkyQTUgwg9sVqVYOZo09Dh1AzhFHbgij52ylF0SEwgzjzHH8TGY8Lypart4p4onnDoDvVMBa0kdthVGKl6K0BDVGzyOXPXKpmnMF1H6rJzqHJ0HywfwS4XYpVwlAkoeNsiicHkJUFdUAhG229INzvIAiJuAHeJDUoyO4DCBqtoZ5TDend6TK7Y914yHlfH3g1WZu5LksKv68VQHJriWFYusW5e6ZZ6dKaMjTwEGuRgdT66iU5nqWTHRH8WSzpXoCFwGcTOwyuqPSe0fTe21DVtJn1FKj9F9nEnR9xOvJUO7E0piCIF4Ad9yAIDY4DBimpsTfKXCu1vdHpKYerzbndfuFe5AhfMduLYZJi5iAw8qKSwR5h86ttXV0Mc0QmXz8dsRvDgxjXSmupPxBggdlqUlC828hXiTPD7am0yETBV0F3bEtvPiNJfremszcV8NcqAoARMe",
360
+ ]
361
+
362
+ # These should be different.
363
+ result1 = hash_array(np.asarray(hashes[0:1], dtype=object), "utf8")
364
+ expected1 = np.array([14963968704024874985], dtype=np.uint64)
365
+ tm.assert_numpy_array_equal(result1, expected1)
366
+
367
+ result2 = hash_array(np.asarray(hashes[1:2], dtype=object), "utf8")
368
+ expected2 = np.array([16428432627716348016], dtype=np.uint64)
369
+ tm.assert_numpy_array_equal(result2, expected2)
370
+
371
+ result = hash_array(np.asarray(hashes, dtype=object), "utf8")
372
+ tm.assert_numpy_array_equal(result, np.concatenate([expected1, expected2], axis=0))
373
+
374
+
375
+ @pytest.mark.parametrize(
376
+ "data, result_data",
377
+ [
378
+ [[tuple("1"), tuple("2")], [10345501319357378243, 8331063931016360761]],
379
+ [[(1,), (2,)], [9408946347443669104, 3278256261030523334]],
380
+ ],
381
+ )
382
+ def test_hash_with_tuple(data, result_data):
383
+ # GH#28969 array containing a tuple raises on call to arr.astype(str)
384
+ # apparently a numpy bug github.com/numpy/numpy/issues/9441
385
+
386
+ df = DataFrame({"data": data})
387
+ result = hash_pandas_object(df)
388
+ expected = Series(result_data, dtype=np.uint64)
389
+ tm.assert_series_equal(result, expected)
390
+
391
+
392
+ def test_hashable_tuple_args():
393
+ # require that the elements of such tuples are themselves hashable
394
+
395
+ df3 = DataFrame(
396
+ {
397
+ "data": [
398
+ (
399
+ 1,
400
+ [],
401
+ ),
402
+ (
403
+ 2,
404
+ {},
405
+ ),
406
+ ]
407
+ }
408
+ )
409
+ with pytest.raises(TypeError, match="unhashable type: 'list'"):
410
+ hash_pandas_object(df3)
411
+
412
+
413
+ def test_hash_object_none_key():
414
+ # https://github.com/pandas-dev/pandas/issues/30887
415
+ result = pd.util.hash_pandas_object(Series(["a", "b"]), hash_key=None)
416
+ expected = Series([4578374827886788867, 17338122309987883691], dtype="uint64")
417
+ tm.assert_series_equal(result, expected)
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_numba.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pytest
2
+
3
+ import pandas.util._test_decorators as td
4
+
5
+ from pandas import option_context
6
+
7
+
8
+ @td.skip_if_installed("numba")
9
+ def test_numba_not_installed_option_context():
10
+ with pytest.raises(ImportError, match="Missing optional"):
11
+ with option_context("compute.use_numba", True):
12
+ pass
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_rewrite_warning.py ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import warnings
2
+
3
+ import pytest
4
+
5
+ from pandas.util._exceptions import rewrite_warning
6
+
7
+ import pandas._testing as tm
8
+
9
+
10
+ @pytest.mark.parametrize(
11
+ "target_category, target_message, hit",
12
+ [
13
+ (FutureWarning, "Target message", True),
14
+ (FutureWarning, "Target", True),
15
+ (FutureWarning, "get mess", True),
16
+ (FutureWarning, "Missed message", False),
17
+ (DeprecationWarning, "Target message", False),
18
+ ],
19
+ )
20
+ @pytest.mark.parametrize(
21
+ "new_category",
22
+ [
23
+ None,
24
+ DeprecationWarning,
25
+ ],
26
+ )
27
+ def test_rewrite_warning(target_category, target_message, hit, new_category):
28
+ new_message = "Rewritten message"
29
+ if hit:
30
+ expected_category = new_category if new_category else target_category
31
+ expected_message = new_message
32
+ else:
33
+ expected_category = FutureWarning
34
+ expected_message = "Target message"
35
+ with tm.assert_produces_warning(expected_category, match=expected_message):
36
+ with rewrite_warning(
37
+ target_message, target_category, new_message, new_category
38
+ ):
39
+ warnings.warn(message="Target message", category=FutureWarning)
pace_revision_1/.venv-pace/lib/python3.11/site-packages/pandas/tests/util/test_shares_memory.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+
3
+ import pandas.util._test_decorators as td
4
+
5
+ import pandas as pd
6
+ import pandas._testing as tm
7
+
8
+
9
+ def test_shares_memory_interval():
10
+ obj = pd.interval_range(1, 5)
11
+
12
+ assert tm.shares_memory(obj, obj)
13
+ assert tm.shares_memory(obj, obj._data)
14
+ assert tm.shares_memory(obj, obj[::-1])
15
+ assert tm.shares_memory(obj, obj[:2])
16
+
17
+ assert not tm.shares_memory(obj, obj._data.copy())
18
+
19
+
20
+ @td.skip_if_no("pyarrow")
21
+ def test_shares_memory_string():
22
+ # GH#55823
23
+ import pyarrow as pa
24
+
25
+ obj = pd.array(["a", "b"], dtype=pd.StringDtype("pyarrow", na_value=pd.NA))
26
+ assert tm.shares_memory(obj, obj)
27
+
28
+ obj = pd.array(["a", "b"], dtype=pd.StringDtype("pyarrow", na_value=np.nan))
29
+ assert tm.shares_memory(obj, obj)
30
+
31
+ obj = pd.array(["a", "b"], dtype=pd.ArrowDtype(pa.string()))
32
+ assert tm.shares_memory(obj, obj)