diff --git a/benchmark/Cybench/benchmark/project-sekai-ctf/sekaictf-2023/forensics/infected/dist/infected.zip b/benchmark/Cybench/benchmark/project-sekai-ctf/sekaictf-2023/forensics/infected/dist/infected.zip new file mode 100644 index 0000000000000000000000000000000000000000..95fc87809042da0dec361a09e3408d8bbdffea2c --- /dev/null +++ b/benchmark/Cybench/benchmark/project-sekai-ctf/sekaictf-2023/forensics/infected/dist/infected.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7223220940857982cca1788218667c319f7a56b9d79258d4a5da2d7546da2a3a +size 27620846 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/397.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/397.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..ea89a46178d1f7262287a96dce9acad6cf183265 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/397.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f2f3416e27ef0a642e6251d7b8c51908e70fc434bdbb970f1433bc90a5261f06 +size 507932 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/40.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/40.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..f254972c2f449b6b68f921e6c8eb9f0917938c32 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/40.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3df6c17474d5c92738e5d0333e2ff9739487fd1cff5300a9385bb3f25a37d391 +size 507937 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/400.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/400.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..c425619579b2d42825948b319e54ba2dd0d0a654 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/400.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e967f7ec766a91e962bfb738cc03f822dc54e2f57bb734f463e043442a1019b4 +size 507932 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/401.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/401.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..a88b0514c8fefdbd3745cec1a7b88719c2f19cd9 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/401.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:87e8d1a37b242b78cc8d817d226695c7f9e629c5e9aae509c3fc7a9eda1b0f96 +size 507932 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/402.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/402.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..6ab6164ad1958622e4416557ffc77e637bbd7cc2 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/402.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8c5b2ec340b3708c73e713d0f6e2fea94d2fd13b5dda1716ff287545ef7afd79 +size 507932 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/403.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/403.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..9fbcf0c116aa1166050761de9f6ba7f5cda7f6a3 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/403.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ec9509e47a2c299fe9f52dbab36863bbee3d635f9eb03476c47b5606930bd925 +size 507937 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/404.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/404.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..dc3a4a860efbcd52155222fb38ae7405ab028149 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/404.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:799f0db084e38143d9a68fa2bc3d1bf31468db558fc3c795ac9d0d7f04ba538e +size 507932 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/405.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/405.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..5fe7238771ee814ec4e39f507dec3a42ad79f3da --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/405.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e4581d96508c4836d875453d2825c068d76115a02ae1687aad786519cf4b7da5 +size 507937 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/406.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/406.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..6614c9507a39bc90803127ca51c07fb3ec30cf0d --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/406.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:834a4dfef9eb80e68bb1945f9e22a0c0710df891a60d4419cd57d30bec1a7f91 +size 507937 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/407.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/407.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..df20d865ed10d56efb761fb9dbc10ff499bd173f --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/407.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7eff4356c6a16e44c48677c59d048dba3140b692d1c50b97a485b25bccc402a8 +size 507937 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/408.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/408.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..dbff8795e5a615d6c4adf91a7752b426d96b9a04 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/408.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:889db26b3b5c8b5fabbc99f723807e231af820555cdadc57f3fe0e9e3c82cf07 +size 507932 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/409.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/409.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..946d2ad1aff0736a743e6ff4ff95f6c4500848ad --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/409.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:95d3caf7b7f229675d31f1b89f437e682ec723704b3f3a0e52b76b2b19649a60 +size 507937 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/41.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/41.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..d355b2fae20560c55eb1aa082a3ecb98605b2334 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/41.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cb71adce8b171025c8c2f797b86fdce3d18bee0ff2fdb6a8b9038b8f1ee47c94 +size 507932 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/410.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/410.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..fac322c855a4a0e642b783837ab59ea649430026 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/410.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:191b1096cd586f2f3ea55ffa20c75083c2efa0e89db6da10cfa04c02b5f1e04a +size 507932 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/411.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/411.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..f5df220167d93d3df12d781e895174548199f003 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/411.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e5b478c5b082b6267a6ded0dbad6925637c0f5be3ebb18b2148cec51ff6abe12 +size 507932 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/412.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/412.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..339d9938ef44b2b282924f0f7d4c52c5db383717 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/412.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:49d4736b2f6719a231457dd5479c05ed242dc4464cc9d83407ffe4ae1fc79fed +size 507932 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/413.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/413.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..c789f06ae304d07b8e78b511a84820e4db5cb38e --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/413.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bba1cc8f28b92019d5daff6c1c770c0a3bfc8967728af4a843d7d72ce8ef4ac6 +size 507932 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/414.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/414.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..045bd731d58a2de234ecf23359f335f54660ee48 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/414.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7aa028cbb81a85640bc6080a7d11c0f3ebfb15e73330e36e5ff80c8fc3857794 +size 507927 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/415.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/415.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..bbf55585497d78d8d26081f63a4d95ecec6cab93 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/415.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a019970fa768bd9f29f70a10c801ce7f24383739887dd09a0f2d4b7f93984ab0 +size 507932 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/416.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/416.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..891825eb6426cc5346c4a52054b1f145546784ec --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/416.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3fbf7a1547c48f0f4a0473f2cfecbd4d3f03ddf88d1bfdf721ca739756c9093a +size 507932 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/417.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/417.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..759d65062407b8d9e05085043d12d0595502706c --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/417.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eb41364f7f060b73bcf3f57bc8d6b97ce3c51b3d916c1503913493297a6c90bb +size 507927 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/418.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/418.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..8a133561a02ebc062c20f848e408df78a625caf5 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/418.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c369812edf5d7666e235e90acfe6c7957c5ceab5adf9ffe0c638ed13b3e42a07 +size 507932 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/419.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/419.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..76039a83f53155b192befa33cc08ef14a65698d6 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/419.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d5054196ed900e230328df6b4d4b8882900da1994c4bd97ae929d9774d835703 +size 507932 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/42.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/42.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..b1624806be8191294f90880f3c8024e13deaaaa5 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/42.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bd193c99f19183097de223febd61221fb19f3cb885e4b10d5e2f62a5592bbf80 +size 507927 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/420.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/420.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..bf016dcdebae2564ba151cbba68136aba6d5948e --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/420.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:84b95b1467c202be7e7f601a550f11c323c56d47a80ca3bbbc1966362fac1121 +size 507937 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/421.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/421.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..f42d659165891864d731417f732bc978cafb4f65 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/421.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:02ea1825b44ab666d03e3ca18ce02039ddcc314725848176486099e547b038d1 +size 507932 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/422.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/422.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..af9fbec7e82784468be4998e2b21d417e5f176a0 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/422.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d016f0514d24f81d4e53c8ec00d04387191cab9b6bf2cd2fdc6015b763fe266d +size 507932 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/423.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/423.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..11a23ee25a43f877f2df82a5372499815d8c0455 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/423.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a2d76fc4298d91e188f6bd67eb6cfef90b3c03f315dd015245fd89e43f7a299c +size 507922 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/424.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/424.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..a297022577e4c4770aa62fc4b8d6999f517e3b26 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/424.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:88497d2f71abcbd493afcf0c1924600aa8c7b336175353dac95269d64af82274 +size 507927 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/425.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/425.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..cfdf4a559084b359eaf103d2a4929aced5c1d657 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/425.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:caa6a9688d956cf510a72216bc8a5cb97586941cf2b73db1bc19f4c9bd428d3d +size 507937 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/426.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/426.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..739f66d81178366a0a011fa0536c5933e67c1743 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/426.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ef1510027d9c22a808d534766c8c4f75208ac696407736ecf49b4445052f9107 +size 507937 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/427.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/427.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..6cbb22da8d7bde99f51cf8825b3b4e68c866b5ea --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/427.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4d21ea2ce56aad82a9378f93127ec6a313f03c1698f50ea4f49a8b95d3527125 +size 507932 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/428.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/428.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..1523d4b3dd797359ef8f7af2e857a91a64c62fb3 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/428.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:98f8e1fbcef3787f91d531533edcc424124b16eeb3052df6d6e7df8bcabfef74 +size 507932 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/429.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/429.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..c5672e4ae3f512b2d51716bef450cce05b6104ba --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/429.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5017c7e30ccb968c9c95da318e83af811405bd04479149f6e99d8878396b95da +size 507932 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/43.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/43.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..e37d5677c94270614970ee625f7ae650a60ecdb2 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/43.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:30c0534b91a3f64bdb917f7e9d9b44c37cea732ad103195191ee922735ac3bfc +size 507937 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/430.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/430.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..15049b8a76ed8c384e241795188a392178d48f2b --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/430.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e2c62996550adf0c51bd320f267a2b525e48d4c7a2171594a02d7bdb1a429e31 +size 507932 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/431.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/431.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..de078c21b9f7b19bf93f53d23edf35c6b55730fb --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/431.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e2b775f037dc445ec4d65615b6b5bf873a79bf0af7e04d2083dd244b448267a5 +size 507927 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/432.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/432.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..e47d3936eefb15b64e34dd6013d9f6685af99246 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/432.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7f3d16abacf4023adc98c4772ae022ff47f9bd0bdf1b96f302072318315806a1 +size 507937 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/433.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/433.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..fbb6a1b7c1ce05fc464d37f7ebdcd7e44e6ce7a6 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/433.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0c64431862cfda4867d4d8d8689e4336bc266a029fb11e3f6579945266a7b861 +size 507937 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/434.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/434.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..b6953d0f2b2c1d196d7ca47719facf0fb25c52fc --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/434.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:38a6798f9f1dfeba50fab4b1d45625925e15a5cd392ee538ca1e7a487b671c77 +size 507927 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/435.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/435.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..a4d4c682e7527276f841044e945ecc4f1e87c531 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/435.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8a61a4743d7f67782f9ab7795666c418d8380497b01a29953cee55f5878ab9dd +size 507932 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/436.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/436.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..1782dab313dc3a103bed278394bfec26ba59c54e --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/436.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:71e6133c0c3ef229753a5027065e4dadde793868d14f5177bf0d5bfe73d0e870 +size 507937 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/437.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/437.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..239b9b74deeaf84c95498a260ece7f5a124d23eb --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/437.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b802b27ce43d6c90b9c972e5d425c775da68f77b1a13abd94fa2add0df6ad336 +size 507932 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/438.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/438.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..c04dd32be40bd27d30b478d715f815ea965f8404 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/438.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:998829aa51e2edabc46f2db7be91ea18adefeb334366d244e99050d7b165fb70 +size 507927 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/439.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/439.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..b4401c459a2175c71afbb91221495e1262350d70 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/439.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:673d48d9dc3cec642ce1193633f92ea59947d307e251c96caa75cf86d6ae4142 +size 507932 diff --git a/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/44.mat.pt b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/44.mat.pt new file mode 100644 index 0000000000000000000000000000000000000000..75d78f5d3e540a8eccb4e86b2a3f6258631f53dd --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/At-Home-Round/Radar/testing_set/44.mat.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b9c2b9b30d742713efa66a3cd9e898f141a66e86db961f3d7a6c379478b1bcc3 +size 507932 diff --git a/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/test_v3/testing_set/data_006948.pt b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/test_v3/testing_set/data_006948.pt new file mode 100644 index 0000000000000000000000000000000000000000..87b494e05b468a5eb81d23c6ef64d3ab5c81c72c --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/test_v3/testing_set/data_006948.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ca2459ce95110098e2ec44976c5ecadc2f8bdfccc71b90a6728a1b219aaeb9c0 +size 49378 diff --git a/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/test_v3/testing_set/data_006950.pt b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/test_v3/testing_set/data_006950.pt new file mode 100644 index 0000000000000000000000000000000000000000..cde5c597f713605d84baa2fdb24795ab5f4b10e1 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/test_v3/testing_set/data_006950.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:03d22a02e9687866b084dac6f194030175feea830f18fb8abbea94d5e31773f0 +size 49447 diff --git a/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/test_v3/testing_set/data_006966.pt b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/test_v3/testing_set/data_006966.pt new file mode 100644 index 0000000000000000000000000000000000000000..ec2393903510575a1ab46bb13644e3b64e6ff2c7 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/test_v3/testing_set/data_006966.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f43d4f3aee5234daefd5ca85a2f52cdc79d6107626795954c9c7135584364020 +size 49378 diff --git a/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/test_v3/testing_set/data_006967.pt b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/test_v3/testing_set/data_006967.pt new file mode 100644 index 0000000000000000000000000000000000000000..70ab47808e8ff8339818368a3d3b3a0d98b5d8c3 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/test_v3/testing_set/data_006967.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:177cec44388c62375e4ade43ffe266caad2e47de25a99f68f2a33d13aac28069 +size 49447 diff --git a/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/test_v3/testing_set/data_006976.pt b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/test_v3/testing_set/data_006976.pt new file mode 100644 index 0000000000000000000000000000000000000000..1b9d638a4bf953e95bc5579489425d7df52c478e --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/test_v3/testing_set/data_006976.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9434a0bc5be5e63466a57fe5f57e6bf6e38b77035a999498ae271ad885353f3e +size 49447 diff --git a/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/bonafide/LA_E_4920756_bonafide.pt b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/bonafide/LA_E_4920756_bonafide.pt new file mode 100644 index 0000000000000000000000000000000000000000..060452cca4d2d73384204c08d73a1a694b14a1be --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/bonafide/LA_E_4920756_bonafide.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:372edaa8776b3410d155bcc6e9d238b139fa5b25d9d4504da46f0636f118aede +size 49378 diff --git a/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_1598368_spoof_A15.pt b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_1598368_spoof_A15.pt new file mode 100644 index 0000000000000000000000000000000000000000..6f1340c9073dcecd38dc217ad26caf01974e7b13 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_1598368_spoof_A15.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:044b878664a297a9853d0fa7715b3c6cf58c70a8ffdaf7eb35014af2011f102a +size 49447 diff --git a/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2230039_spoof_A19.pt b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2230039_spoof_A19.pt new file mode 100644 index 0000000000000000000000000000000000000000..65a23334e3021f848902763de5af73bf6a22980b --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2230039_spoof_A19.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:329abbbe81690161ff00e5ac84871b5312ff3d98191e3741dd733234f9c2a7ae +size 49447 diff --git a/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2350914_spoof_A11.pt b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2350914_spoof_A11.pt new file mode 100644 index 0000000000000000000000000000000000000000..83d6aa6448097850cd41d8b267830f9d577f440b --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2350914_spoof_A11.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9223a8e1c1c29eae6cfb75dceb3a1e0a64f66522ab08f66444e0190ebe251fd6 +size 49447 diff --git a/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2353365_spoof_A08.pt b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2353365_spoof_A08.pt new file mode 100644 index 0000000000000000000000000000000000000000..abde6ad48303d921985a993dd3bbeae9572c82ef --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2353365_spoof_A08.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bfd7c1c7a1a1b9e1b181fa8f8598b1dd42f7a45716d0dbf6f37d6432dca67c10 +size 49447 diff --git a/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2354730_spoof_A10.pt b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2354730_spoof_A10.pt new file mode 100644 index 0000000000000000000000000000000000000000..3185d9c990b7df2361c0b7a8c41b70bea7c56281 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2354730_spoof_A10.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:67274a2036cd5da5d3d9d50d1fe4886266ccc34e2c17c59298c9f380542817c2 +size 49447 diff --git a/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2467906_spoof_A18.pt b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2467906_spoof_A18.pt new file mode 100644 index 0000000000000000000000000000000000000000..916ca8e6d48fd9bc81bf2e7c3992b33ffccdb1bd --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2467906_spoof_A18.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:17a7ec1111ab24d3739b9fe2915baa6b9830d5a2cf868c9d15f27bc007c90a16 +size 49447 diff --git a/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2470401_spoof_A10.pt b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2470401_spoof_A10.pt new file mode 100644 index 0000000000000000000000000000000000000000..c1763a2aef9b3be6222ab21127a07df75aa38955 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2470401_spoof_A10.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ba923e0c056f2ed9a20f9903653298a04bb6cabe64a69bdedd3edccc94baf1f5 +size 49447 diff --git a/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2471008_spoof_A12.pt b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2471008_spoof_A12.pt new file mode 100644 index 0000000000000000000000000000000000000000..696e3e88e82c93d4bc6a78e7ed4a90dc0d35835a --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2471008_spoof_A12.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6f2d88278e0e4f924ad9c44cc86164fde182220fa248dd572865311a888bc5b3 +size 49447 diff --git a/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2573457_spoof_A11.pt b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2573457_spoof_A11.pt new file mode 100644 index 0000000000000000000000000000000000000000..b97eadddbd0d3c9a0719b41e5af024c22ddb55c8 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2573457_spoof_A11.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:18b4673491eb09cbf4d17426fbe738ff53d1c79f6ece514498bdba215876d18a +size 49447 diff --git a/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2575905_spoof_A14.pt b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2575905_spoof_A14.pt new file mode 100644 index 0000000000000000000000000000000000000000..2088b2bad9f437d78b1cc6c3e85461e278295793 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2575905_spoof_A14.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:290b9f9c205f095174fff0703d2658ea368f9a1826a4f2f6b87718541cf48713 +size 49447 diff --git a/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2576560_spoof_A07.pt b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2576560_spoof_A07.pt new file mode 100644 index 0000000000000000000000000000000000000000..b7bdd4b2d07d8e561ac8c17c42b47233633fdd50 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2576560_spoof_A07.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1691533e4b4be5a4c3c5744e377897c252f46bdf79eb6e4b5a688c784ae14a0a +size 49447 diff --git a/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2577305_spoof_A14.pt b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2577305_spoof_A14.pt new file mode 100644 index 0000000000000000000000000000000000000000..bf055e5e8a80b61c8cbcd8e4254aeb01e6cf75d9 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2577305_spoof_A14.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:67d416770f62955e5492e81b6003c667196cf708c86d9fafac91c86fe32b28c7 +size 49447 diff --git a/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2579855_spoof_A17.pt b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2579855_spoof_A17.pt new file mode 100644 index 0000000000000000000000000000000000000000..8f2c379cfeaaee4b9bfff27cffc2b1b68951c0dd --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2579855_spoof_A17.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2e2e7d22e9b009b54bfddc21c0579b38ddadb0f2dfeb832673cac3521003b813 +size 49447 diff --git a/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2608635_spoof_A14.pt b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2608635_spoof_A14.pt new file mode 100644 index 0000000000000000000000000000000000000000..2771e6e6de4135e66be3ff400322a0ab9246c6a5 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2608635_spoof_A14.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:84d3dae57c200c7b14bb1249bc3f06c6058faee5ac1add0a58aefa65ea5a20b5 +size 49447 diff --git a/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2609482_spoof_A07.pt b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2609482_spoof_A07.pt new file mode 100644 index 0000000000000000000000000000000000000000..a6b5d333e4836c4b3f44bd62bbbee59647019760 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2609482_spoof_A07.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:33197a7c9889ea21ac1e4cfc41308b2cf1f67cd6b0e6910f5260730b16a731f3 +size 49447 diff --git a/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2611803_spoof_A18.pt b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2611803_spoof_A18.pt new file mode 100644 index 0000000000000000000000000000000000000000..b6fb6ec5960ef92ed9e7959396443def792afcec --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2611803_spoof_A18.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:436d73629326f3260ef04e7159032da55d62426da6d88b28ca67e04dc9359784 +size 49447 diff --git a/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2615683_spoof_A16.pt b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2615683_spoof_A16.pt new file mode 100644 index 0000000000000000000000000000000000000000..d65dc89f8cc202a3cf51d7db74a5b455411f4138 --- /dev/null +++ b/benchmark/IOAI/IOAI-2025/GAITE-Contest/Synthetic_Speech_Detector/training_set/spoof/LA_E_2615683_spoof_A16.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4e41b2dc89bf6b0061a8d3823007aff9168d3d2dfa758629e4d962767085b803 +size 49447 diff --git a/benchmark/MIT_Mystery_Hunt/puzzles/by_tsv/2003/2003_www.acme-corp.com_teamGuest_R_5_092_index.html/cubicle-5.jpg b/benchmark/MIT_Mystery_Hunt/puzzles/by_tsv/2003/2003_www.acme-corp.com_teamGuest_R_5_092_index.html/cubicle-5.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0068d3faa8b95cde4e39e078b251314856ac35e2 --- /dev/null +++ b/benchmark/MIT_Mystery_Hunt/puzzles/by_tsv/2003/2003_www.acme-corp.com_teamGuest_R_5_092_index.html/cubicle-5.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0702b65a08826305d7d565108576a3e510ac1d572035bd6619eca526c92d50dc +size 108267 diff --git a/benchmark/MIT_Mystery_Hunt/puzzles/by_tsv/2003/2003_www.acme-corp.com_teamGuest_R_5_092_index.html/cubicle-6.jpg b/benchmark/MIT_Mystery_Hunt/puzzles/by_tsv/2003/2003_www.acme-corp.com_teamGuest_R_5_092_index.html/cubicle-6.jpg new file mode 100644 index 0000000000000000000000000000000000000000..bd24ecccca6bf2d486afc9f15ef08374b8c92220 --- /dev/null +++ b/benchmark/MIT_Mystery_Hunt/puzzles/by_tsv/2003/2003_www.acme-corp.com_teamGuest_R_5_092_index.html/cubicle-6.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c133880bdba76a44467cb75d5ec058b88a12704db5a9312efa0d79ac0dd996c9 +size 107465 diff --git a/benchmark/MIT_Mystery_Hunt/puzzles/by_tsv/2003/2003_www.acme-corp.com_teamGuest_R_5_092_index.html/cubicle-8.jpg b/benchmark/MIT_Mystery_Hunt/puzzles/by_tsv/2003/2003_www.acme-corp.com_teamGuest_R_5_092_index.html/cubicle-8.jpg new file mode 100644 index 0000000000000000000000000000000000000000..dd16cb6f52ad56070cdac933abb4d877bc86f905 --- /dev/null +++ b/benchmark/MIT_Mystery_Hunt/puzzles/by_tsv/2003/2003_www.acme-corp.com_teamGuest_R_5_092_index.html/cubicle-8.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:35f7d060aac94c9b41be59b29671728c9c604b7827c253fafe6580e95e203c81 +size 87066 diff --git a/benchmark/MIT_Mystery_Hunt/puzzles/by_tsv/2003/2003_www.acme-corp.com_teamGuest_R_5_519_index.html/hall-of-chess.jpg b/benchmark/MIT_Mystery_Hunt/puzzles/by_tsv/2003/2003_www.acme-corp.com_teamGuest_R_5_519_index.html/hall-of-chess.jpg new file mode 100644 index 0000000000000000000000000000000000000000..178920a2bd3791931d4f1607bfa001378c4c3eae --- /dev/null +++ b/benchmark/MIT_Mystery_Hunt/puzzles/by_tsv/2003/2003_www.acme-corp.com_teamGuest_R_5_519_index.html/hall-of-chess.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:af58b7b4fd02692eb80a35682f0d2db08e962635b9ce7935601eb778771b1521 +size 42731 diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/feature_base.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/feature_base.py new file mode 100644 index 0000000000000000000000000000000000000000..c36d9a951b6a8239fa8b0ea9fae0942e5937d2c4 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/feature_base.py @@ -0,0 +1,57 @@ +u""" +Base classes for features that are backwards-incompatible. + +Usage: +features = Features() +features.add(Feature("py3k_feature", "power< 'py3k' any* >", "2.7")) +PATTERN = features.PATTERN +""" + +pattern_unformatted = u"%s=%s" # name=pattern, for dict lookups +message_unformatted = u""" +%s is only supported in Python %s and above.""" + +class Feature(object): + u""" + A feature has a name, a pattern, and a minimum version of Python 2.x + required to use the feature (or 3.x if there is no backwards-compatible + version of 2.x) + """ + def __init__(self, name, PATTERN, version): + self.name = name + self._pattern = PATTERN + self.version = version + + def message_text(self): + u""" + Format the above text with the name and minimum version required. + """ + return message_unformatted % (self.name, self.version) + +class Features(set): + u""" + A set of features that generates a pattern for the features it contains. + This set will act like a mapping in that we map names to patterns. + """ + mapping = {} + + def update_mapping(self): + u""" + Called every time we care about the mapping of names to features. + """ + self.mapping = dict([(f.name, f) for f in iter(self)]) + + @property + def PATTERN(self): + u""" + Uses the mapping of names to features to return a PATTERN suitable + for using the lib2to3 patcomp. + """ + self.update_mapping() + return u" |\n".join([pattern_unformatted % (f.name, f._pattern) for f in iter(self)]) + + def __getitem__(self, key): + u""" + Implement a simple mapping to get patterns from names. + """ + return self.mapping[key] diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_add_all__future__imports.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_add_all__future__imports.py new file mode 100644 index 0000000000000000000000000000000000000000..378979461f8c3e46765233de2322efb2e09275fa --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_add_all__future__imports.py @@ -0,0 +1,24 @@ +""" +Fixer for adding: + + from __future__ import absolute_import + from __future__ import division + from __future__ import print_function + from __future__ import unicode_literals + +This is done when converting from Py3 to both Py3/Py2. +""" + +from lib2to3 import fixer_base +from libfuturize.fixer_util import future_import + +class FixAddAllFutureImports(fixer_base.BaseFix): + BM_compatible = True + PATTERN = "file_input" + run_order = 1 + + def transform(self, node, results): + future_import(u"unicode_literals", node) + future_import(u"print_function", node) + future_import(u"division", node) + future_import(u"absolute_import", node) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_add_all_future_builtins.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_add_all_future_builtins.py new file mode 100644 index 0000000000000000000000000000000000000000..22911badae63c5ef1100c40d3236cb5256dbc6bf --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_add_all_future_builtins.py @@ -0,0 +1,37 @@ +""" +For the ``future`` package. + +Adds this import line:: + + from builtins import (ascii, bytes, chr, dict, filter, hex, input, + int, list, map, next, object, oct, open, pow, + range, round, str, super, zip) + +to a module, irrespective of whether each definition is used. + +Adds these imports after any other imports (in an initial block of them). +""" + +from __future__ import unicode_literals + +from lib2to3 import fixer_base + +from libfuturize.fixer_util import touch_import_top + + +class FixAddAllFutureBuiltins(fixer_base.BaseFix): + BM_compatible = True + PATTERN = "file_input" + run_order = 1 + + def transform(self, node, results): + # import_str = """(ascii, bytes, chr, dict, filter, hex, input, + # int, list, map, next, object, oct, open, pow, + # range, round, str, super, zip)""" + touch_import_top(u'builtins', '*', node) + + # builtins = """ascii bytes chr dict filter hex input + # int list map next object oct open pow + # range round str super zip""" + # for builtin in sorted(builtins.split(), reverse=True): + # touch_import_top(u'builtins', builtin, node) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_add_future_standard_library_import.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_add_future_standard_library_import.py new file mode 100644 index 0000000000000000000000000000000000000000..0778406a88ba2890942b517440f5aa4cd0406287 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_add_future_standard_library_import.py @@ -0,0 +1,23 @@ +""" +For the ``future`` package. + +Adds this import line: + + from future import standard_library + +after any __future__ imports but before any other imports. Doesn't actually +change the imports to Py3 style. +""" + +from lib2to3 import fixer_base +from libfuturize.fixer_util import touch_import_top + +class FixAddFutureStandardLibraryImport(fixer_base.BaseFix): + BM_compatible = True + PATTERN = "file_input" + run_order = 8 + + def transform(self, node, results): + # TODO: add a blank line between any __future__ imports and this? + touch_import_top(u'future', u'standard_library', node) + # TODO: also add standard_library.install_hooks() diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_annotations.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_annotations.py new file mode 100644 index 0000000000000000000000000000000000000000..884b674111569b8a5270aa0aedc5e0ed5614e3a5 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_annotations.py @@ -0,0 +1,48 @@ +u""" +Fixer to remove function annotations +""" + +from lib2to3 import fixer_base +from lib2to3.pgen2 import token +from lib2to3.fixer_util import syms + +warning_text = u"Removing function annotations completely." + +def param_without_annotations(node): + return node.children[0] + +class FixAnnotations(fixer_base.BaseFix): + + warned = False + + def warn_once(self, node, reason): + if not self.warned: + self.warned = True + self.warning(node, reason=reason) + + PATTERN = u""" + funcdef< 'def' any parameters< '(' [params=any] ')' > ['->' ret=any] ':' any* > + """ + + def transform(self, node, results): + u""" + This just strips annotations from the funcdef completely. + """ + params = results.get(u"params") + ret = results.get(u"ret") + if ret is not None: + assert ret.prev_sibling.type == token.RARROW, u"Invalid return annotation" + self.warn_once(node, reason=warning_text) + ret.prev_sibling.remove() + ret.remove() + if params is None: return + if params.type == syms.typedargslist: + # more than one param in a typedargslist + for param in params.children: + if param.type == syms.tname: + self.warn_once(node, reason=warning_text) + param.replace(param_without_annotations(param)) + elif params.type == syms.tname: + # one param + self.warn_once(node, reason=warning_text) + params.replace(param_without_annotations(params)) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_division.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_division.py new file mode 100644 index 0000000000000000000000000000000000000000..6a048710f403ea0042b8e85f00b9664e23cb013e --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_division.py @@ -0,0 +1,28 @@ +u""" +Fixer for division: from __future__ import division if needed +""" + +from lib2to3 import fixer_base +from libfuturize.fixer_util import token, future_import + +def match_division(node): + u""" + __future__.division redefines the meaning of a single slash for division, + so we match that and only that. + """ + slash = token.SLASH + return node.type == slash and not node.next_sibling.type == slash and \ + not node.prev_sibling.type == slash + +class FixDivision(fixer_base.BaseFix): + run_order = 4 # this seems to be ignored? + + def match(self, node): + u""" + Since the tree needs to be fixed once and only once if and only if it + matches, then we can start discarding matches after we make the first. + """ + return match_division(node) + + def transform(self, node, results): + future_import(u"division", node) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_features.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_features.py new file mode 100644 index 0000000000000000000000000000000000000000..52630f98269e1205b13c0cdda1a829a6235be236 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_features.py @@ -0,0 +1,86 @@ +u""" +Warn about features that are not present in Python 2.5, giving a message that +points to the earliest version of Python 2.x (or 3.x, if none) that supports it +""" + +from .feature_base import Feature, Features +from lib2to3 import fixer_base + +FEATURES = [ + #(FeatureName, + # FeaturePattern, + # FeatureMinVersion, + #), + (u"memoryview", + u"power < 'memoryview' trailer < '(' any* ')' > any* >", + u"2.7", + ), + (u"numbers", + u"""import_from< 'from' 'numbers' 'import' any* > | + import_name< 'import' ('numbers' dotted_as_names< any* 'numbers' any* >) >""", + u"2.6", + ), + (u"abc", + u"""import_name< 'import' ('abc' dotted_as_names< any* 'abc' any* >) > | + import_from< 'from' 'abc' 'import' any* >""", + u"2.6", + ), + (u"io", + u"""import_name< 'import' ('io' dotted_as_names< any* 'io' any* >) > | + import_from< 'from' 'io' 'import' any* >""", + u"2.6", + ), + (u"bin", + u"power< 'bin' trailer< '(' any* ')' > any* >", + u"2.6", + ), + (u"formatting", + u"power< any trailer< '.' 'format' > trailer< '(' any* ')' > >", + u"2.6", + ), + (u"nonlocal", + u"global_stmt< 'nonlocal' any* >", + u"3.0", + ), + (u"with_traceback", + u"trailer< '.' 'with_traceback' >", + u"3.0", + ), +] + +class FixFeatures(fixer_base.BaseFix): + + run_order = 9 # Wait until all other fixers have run to check for these + + # To avoid spamming, we only want to warn for each feature once. + features_warned = set() + + # Build features from the list above + features = Features([Feature(name, pattern, version) for \ + name, pattern, version in FEATURES]) + + PATTERN = features.PATTERN + + def match(self, node): + to_ret = super(FixFeatures, self).match(node) + # We want the mapping only to tell us the node's specific information. + try: + del to_ret[u'node'] + except Exception: + # We want it to delete the 'node' from the results + # if it's there, so we don't care if it fails for normal reasons. + pass + return to_ret + + def transform(self, node, results): + for feature_name in results: + if feature_name in self.features_warned: + continue + else: + curr_feature = self.features[feature_name] + if curr_feature.version >= u"3": + fail = self.cannot_convert + else: + fail = self.warning + fail(node, reason=curr_feature.message_text()) + self.features_warned.add(feature_name) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_fullargspec.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_fullargspec.py new file mode 100644 index 0000000000000000000000000000000000000000..4bd37e151238370fe72a2dc0b0ebcdeb94b7c98b --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_fullargspec.py @@ -0,0 +1,16 @@ +u""" +Fixer for getfullargspec -> getargspec +""" + +from lib2to3 import fixer_base +from lib2to3.fixer_util import Name + +warn_msg = u"some of the values returned by getfullargspec are not valid in Python 2 and have no equivalent." + +class FixFullargspec(fixer_base.BaseFix): + + PATTERN = u"'getfullargspec'" + + def transform(self, node, results): + self.warning(node, warn_msg) + return Name(u"getargspec", prefix=node.prefix) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_future_builtins.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_future_builtins.py new file mode 100644 index 0000000000000000000000000000000000000000..6849679987d926b1a6d1d65bdbff5e8974e35a94 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_future_builtins.py @@ -0,0 +1,46 @@ +""" +Adds this import line: + + from builtins import XYZ + +for each of the functions XYZ that is used in the module. +""" + +from __future__ import unicode_literals + +from lib2to3 import fixer_base +from lib2to3.pygram import python_symbols as syms +from lib2to3.fixer_util import Name, Call, in_special_context + +from libfuturize.fixer_util import touch_import_top + +# All builtins are: +# from future.builtins.iterators import (filter, map, zip) +# from future.builtins.misc import (ascii, chr, hex, input, isinstance, oct, open, round, super) +# from future.types import (bytes, dict, int, range, str) +# We don't need isinstance any more. + +replaced_builtins = '''filter map zip + ascii chr hex input next oct open round super + bytes dict int range str'''.split() + +expression = '|'.join(["name='{0}'".format(name) for name in replaced_builtins]) + + +class FixFutureBuiltins(fixer_base.BaseFix): + BM_compatible = True + run_order = 9 + + # Currently we only match uses as a function. This doesn't match e.g.: + # if isinstance(s, str): + # ... + PATTERN = """ + power< + ({0}) trailer< '(' args=[any] ')' > + rest=any* > + """.format(expression) + + def transform(self, node, results): + name = results["name"] + touch_import_top(u'builtins', name.value, node) + # name.replace(Name(u"input", prefix=name.prefix)) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_getcwd.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_getcwd.py new file mode 100644 index 0000000000000000000000000000000000000000..9b7f002b3cf107f4b7ea45f91269e4b31d135c31 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_getcwd.py @@ -0,0 +1,26 @@ +u""" +Fixer for os.getcwd() -> os.getcwdu(). +Also warns about "from os import getcwd", suggesting the above form. +""" + +from lib2to3 import fixer_base +from lib2to3.fixer_util import Name + +class FixGetcwd(fixer_base.BaseFix): + + PATTERN = u""" + power< 'os' trailer< dot='.' name='getcwd' > any* > + | + import_from< 'from' 'os' 'import' bad='getcwd' > + """ + + def transform(self, node, results): + if u"name" in results: + name = results[u"name"] + name.replace(Name(u"getcwdu", prefix=name.prefix)) + elif u"bad" in results: + # Can't convert to getcwdu and then expect to catch every use. + self.cannot_convert(node, u"import os, use os.getcwd() instead.") + return + else: + raise ValueError(u"For some reason, the pattern matcher failed.") diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_imports.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_imports.py new file mode 100644 index 0000000000000000000000000000000000000000..2d6718f166b7a9ed6078e0f02d4769e15c3a5f29 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_imports.py @@ -0,0 +1,112 @@ +u""" +Fixer for standard library imports renamed in Python 3 +""" + +from lib2to3 import fixer_base +from lib2to3.fixer_util import Name, is_probably_builtin, Newline, does_tree_import +from lib2to3.pygram import python_symbols as syms +from lib2to3.pgen2 import token +from lib2to3.pytree import Node, Leaf + +from libfuturize.fixer_util import touch_import_top +# from ..fixer_util import NameImport + +# used in simple_mapping_to_pattern() +MAPPING = {u"reprlib": u"repr", + u"winreg": u"_winreg", + u"configparser": u"ConfigParser", + u"copyreg": u"copy_reg", + u"queue": u"Queue", + u"socketserver": u"SocketServer", + u"_markupbase": u"markupbase", + u"test.support": u"test.test_support", + u"dbm.bsd": u"dbhash", + u"dbm.ndbm": u"dbm", + u"dbm.dumb": u"dumbdbm", + u"dbm.gnu": u"gdbm", + u"html.parser": u"HTMLParser", + u"html.entities": u"htmlentitydefs", + u"http.client": u"httplib", + u"http.cookies": u"Cookie", + u"http.cookiejar": u"cookielib", +# "tkinter": "Tkinter", + u"tkinter.dialog": u"Dialog", + u"tkinter._fix": u"FixTk", + u"tkinter.scrolledtext": u"ScrolledText", + u"tkinter.tix": u"Tix", + u"tkinter.constants": u"Tkconstants", + u"tkinter.dnd": u"Tkdnd", + u"tkinter.__init__": u"Tkinter", + u"tkinter.colorchooser": u"tkColorChooser", + u"tkinter.commondialog": u"tkCommonDialog", + u"tkinter.font": u"tkFont", + u"tkinter.ttk": u"ttk", + u"tkinter.messagebox": u"tkMessageBox", + u"tkinter.turtle": u"turtle", + u"urllib.robotparser": u"robotparser", + u"xmlrpc.client": u"xmlrpclib", + u"builtins": u"__builtin__", +} + +# generic strings to help build patterns +# these variables mean (with http.client.HTTPConnection as an example): +# name = http +# attr = client +# used = HTTPConnection +# fmt_name is a formatted subpattern (simple_name_match or dotted_name_match) + +# helps match 'queue', as in 'from queue import ...' +simple_name_match = u"name='%s'" +# helps match 'client', to be used if client has been imported from http +subname_match = u"attr='%s'" +# helps match 'http.client', as in 'import urllib.request' +dotted_name_match = u"dotted_name=dotted_name< %s '.' %s >" +# helps match 'queue', as in 'queue.Queue(...)' +power_onename_match = u"%s" +# helps match 'http.client', as in 'http.client.HTTPConnection(...)' +power_twoname_match = u"power< %s trailer< '.' %s > any* >" +# helps match 'client.HTTPConnection', if 'client' has been imported from http +power_subname_match = u"power< %s any* >" +# helps match 'from http.client import HTTPConnection' +from_import_match = u"from_import=import_from< 'from' %s 'import' imported=any >" +# helps match 'from http import client' +from_import_submod_match = u"from_import_submod=import_from< 'from' %s 'import' (%s | import_as_name< %s 'as' renamed=any > | import_as_names< any* (%s | import_as_name< %s 'as' renamed=any >) any* > ) >" +# helps match 'import urllib.request' +name_import_match = u"name_import=import_name< 'import' %s > | name_import=import_name< 'import' dotted_as_name< %s 'as' renamed=any > >" +# helps match 'import http.client, winreg' +multiple_name_import_match = u"name_import=import_name< 'import' dotted_as_names< names=any* > >" + +def all_patterns(name): + u""" + Accepts a string and returns a pattern of possible patterns involving that name + Called by simple_mapping_to_pattern for each name in the mapping it receives. + """ + + # i_ denotes an import-like node + # u_ denotes a node that appears to be a usage of the name + if u'.' in name: + name, attr = name.split(u'.', 1) + simple_name = simple_name_match % (name) + simple_attr = subname_match % (attr) + dotted_name = dotted_name_match % (simple_name, simple_attr) + i_from = from_import_match % (dotted_name) + i_from_submod = from_import_submod_match % (simple_name, simple_attr, simple_attr, simple_attr, simple_attr) + i_name = name_import_match % (dotted_name, dotted_name) + u_name = power_twoname_match % (simple_name, simple_attr) + u_subname = power_subname_match % (simple_attr) + return u' | \n'.join((i_name, i_from, i_from_submod, u_name, u_subname)) + else: + simple_name = simple_name_match % (name) + i_name = name_import_match % (simple_name, simple_name) + i_from = from_import_match % (simple_name) + u_name = power_onename_match % (simple_name) + return u' | \n'.join((i_name, i_from, u_name)) + + +class FixImports(fixer_base.BaseFix): + + PATTERN = u' | \n'.join([all_patterns(name) for name in MAPPING]) + PATTERN = u' | \n'.join((PATTERN, multiple_name_import_match)) + + def transform(self, node, results): + touch_import_top(u'future', u'standard_library', node) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_imports2.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_imports2.py new file mode 100644 index 0000000000000000000000000000000000000000..70444e9e06b590bcd170fcb6d60b94ddd6764e1f --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_imports2.py @@ -0,0 +1,174 @@ +u""" +Fixer for complicated imports +""" + +from lib2to3 import fixer_base +from lib2to3.fixer_util import Name, String, FromImport, Newline, Comma +from libfuturize.fixer_util import touch_import_top + + +TK_BASE_NAMES = (u'ACTIVE', u'ALL', u'ANCHOR', u'ARC',u'BASELINE', u'BEVEL', u'BOTH', + u'BOTTOM', u'BROWSE', u'BUTT', u'CASCADE', u'CENTER', u'CHAR', + u'CHECKBUTTON', u'CHORD', u'COMMAND', u'CURRENT', u'DISABLED', + u'DOTBOX', u'E', u'END', u'EW', u'EXCEPTION', u'EXTENDED', u'FALSE', + u'FIRST', u'FLAT', u'GROOVE', u'HIDDEN', u'HORIZONTAL', u'INSERT', + u'INSIDE', u'LAST', u'LEFT', u'MITER', u'MOVETO', u'MULTIPLE', u'N', + u'NE', u'NO', u'NONE', u'NORMAL', u'NS', u'NSEW', u'NUMERIC', u'NW', + u'OFF', u'ON', u'OUTSIDE', u'PAGES', u'PIESLICE', u'PROJECTING', + u'RADIOBUTTON', u'RAISED', u'READABLE', u'RIDGE', u'RIGHT', + u'ROUND', u'S', u'SCROLL', u'SE', u'SEL', u'SEL_FIRST', u'SEL_LAST', + u'SEPARATOR', u'SINGLE', u'SOLID', u'SUNKEN', u'SW', u'StringTypes', + u'TOP', u'TRUE', u'TclVersion', u'TkVersion', u'UNDERLINE', + u'UNITS', u'VERTICAL', u'W', u'WORD', u'WRITABLE', u'X', u'Y', u'YES', + u'wantobjects') + +PY2MODULES = { + u'urllib2' : ( + u'AbstractBasicAuthHandler', u'AbstractDigestAuthHandler', + u'AbstractHTTPHandler', u'BaseHandler', u'CacheFTPHandler', + u'FTPHandler', u'FileHandler', u'HTTPBasicAuthHandler', + u'HTTPCookieProcessor', u'HTTPDefaultErrorHandler', + u'HTTPDigestAuthHandler', u'HTTPError', u'HTTPErrorProcessor', + u'HTTPHandler', u'HTTPPasswordMgr', + u'HTTPPasswordMgrWithDefaultRealm', u'HTTPRedirectHandler', + u'HTTPSHandler', u'OpenerDirector', u'ProxyBasicAuthHandler', + u'ProxyDigestAuthHandler', u'ProxyHandler', u'Request', + u'StringIO', u'URLError', u'UnknownHandler', u'addinfourl', + u'build_opener', u'install_opener', u'parse_http_list', + u'parse_keqv_list', u'randombytes', u'request_host', u'urlopen'), + u'urllib' : ( + u'ContentTooShortError', u'FancyURLopener',u'URLopener', + u'basejoin', u'ftperrors', u'getproxies', + u'getproxies_environment', u'localhost', u'pathname2url', + u'quote', u'quote_plus', u'splitattr', u'splithost', + u'splitnport', u'splitpasswd', u'splitport', u'splitquery', + u'splittag', u'splittype', u'splituser', u'splitvalue', + u'thishost', u'unquote', u'unquote_plus', u'unwrap', + u'url2pathname', u'urlcleanup', u'urlencode', u'urlopen', + u'urlretrieve',), + u'urlparse' : ( + u'parse_qs', u'parse_qsl', u'urldefrag', u'urljoin', + u'urlparse', u'urlsplit', u'urlunparse', u'urlunsplit'), + u'dbm' : ( + u'ndbm', u'gnu', u'dumb'), + u'anydbm' : ( + u'error', u'open'), + u'whichdb' : ( + u'whichdb',), + u'BaseHTTPServer' : ( + u'BaseHTTPRequestHandler', u'HTTPServer'), + u'CGIHTTPServer' : ( + u'CGIHTTPRequestHandler',), + u'SimpleHTTPServer' : ( + u'SimpleHTTPRequestHandler',), + u'FileDialog' : TK_BASE_NAMES + ( + u'FileDialog', u'LoadFileDialog', u'SaveFileDialog', + u'dialogstates', u'test'), + u'tkFileDialog' : ( + u'Directory', u'Open', u'SaveAs', u'_Dialog', u'askdirectory', + u'askopenfile', u'askopenfilename', u'askopenfilenames', + u'askopenfiles', u'asksaveasfile', u'asksaveasfilename'), + u'SimpleDialog' : TK_BASE_NAMES + ( + u'SimpleDialog',), + u'tkSimpleDialog' : TK_BASE_NAMES + ( + u'askfloat', u'askinteger', u'askstring', u'Dialog'), + u'SimpleXMLRPCServer' : ( + u'CGIXMLRPCRequestHandler', u'SimpleXMLRPCDispatcher', + u'SimpleXMLRPCRequestHandler', u'SimpleXMLRPCServer', + u'list_public_methods', u'remove_duplicates', + u'resolve_dotted_attribute'), + u'DocXMLRPCServer' : ( + u'DocCGIXMLRPCRequestHandler', u'DocXMLRPCRequestHandler', + u'DocXMLRPCServer', u'ServerHTMLDoc',u'XMLRPCDocGenerator'), + } + +MAPPING = { u'urllib.request' : + (u'urllib2', u'urllib'), + u'urllib.error' : + (u'urllib2', u'urllib'), + u'urllib.parse' : + (u'urllib2', u'urllib', u'urlparse'), + u'dbm.__init__' : + (u'anydbm', u'whichdb'), + u'http.server' : + (u'CGIHTTPServer', u'SimpleHTTPServer', u'BaseHTTPServer'), + u'tkinter.filedialog' : + (u'tkFileDialog', u'FileDialog'), + u'tkinter.simpledialog' : + (u'tkSimpleDialog', u'SimpleDialog'), + u'xmlrpc.server' : + (u'DocXMLRPCServer', u'SimpleXMLRPCServer'), + } + +# helps match 'http', as in 'from http.server import ...' +simple_name = u"name='%s'" +# helps match 'server', as in 'from http.server import ...' +simple_attr = u"attr='%s'" +# helps match 'HTTPServer', as in 'from http.server import HTTPServer' +simple_using = u"using='%s'" +# helps match 'urllib.request', as in 'import urllib.request' +dotted_name = u"dotted_name=dotted_name< %s '.' %s >" +# helps match 'http.server', as in 'http.server.HTTPServer(...)' +power_twoname = u"pow=power< %s trailer< '.' %s > trailer< '.' using=any > any* >" +# helps match 'dbm.whichdb', as in 'dbm.whichdb(...)' +power_onename = u"pow=power< %s trailer< '.' using=any > any* >" +# helps match 'from http.server import HTTPServer' +# also helps match 'from http.server import HTTPServer, SimpleHTTPRequestHandler' +# also helps match 'from http.server import *' +from_import = u"from_import=import_from< 'from' %s 'import' (import_as_name< using=any 'as' renamed=any> | in_list=import_as_names< using=any* > | using='*' | using=NAME) >" +# helps match 'import urllib.request' +name_import = u"name_import=import_name< 'import' (%s | in_list=dotted_as_names< imp_list=any* >) >" + +############# +# WON'T FIX # +############# + +# helps match 'import urllib.request as name' +name_import_rename = u"name_import_rename=dotted_as_name< %s 'as' renamed=any >" +# helps match 'from http import server' +from_import_rename = u"from_import_rename=import_from< 'from' %s 'import' (%s | import_as_name< %s 'as' renamed=any > | in_list=import_as_names< any* (%s | import_as_name< %s 'as' renamed=any >) any* >) >" + + +def all_modules_subpattern(): + u""" + Builds a pattern for all toplevel names + (urllib, http, etc) + """ + names_dot_attrs = [mod.split(u".") for mod in MAPPING] + ret = u"( " + u" | ".join([dotted_name % (simple_name % (mod[0]), + simple_attr % (mod[1])) for mod in names_dot_attrs]) + ret += u" | " + ret += u" | ".join([simple_name % (mod[0]) for mod in names_dot_attrs if mod[1] == u"__init__"]) + u" )" + return ret + + +def build_import_pattern(mapping1, mapping2): + u""" + mapping1: A dict mapping py3k modules to all possible py2k replacements + mapping2: A dict mapping py2k modules to the things they do + This builds a HUGE pattern to match all ways that things can be imported + """ + # py3k: urllib.request, py2k: ('urllib2', 'urllib') + yield from_import % (all_modules_subpattern()) + for py3k, py2k in mapping1.items(): + name, attr = py3k.split(u'.') + s_name = simple_name % (name) + s_attr = simple_attr % (attr) + d_name = dotted_name % (s_name, s_attr) + yield name_import % (d_name) + yield power_twoname % (s_name, s_attr) + if attr == u'__init__': + yield name_import % (s_name) + yield power_onename % (s_name) + yield name_import_rename % (d_name) + yield from_import_rename % (s_name, s_attr, s_attr, s_attr, s_attr) + + +class FixImports2(fixer_base.BaseFix): + + run_order = 4 + + PATTERN = u" | \n".join(build_import_pattern(MAPPING, PY2MODULES)) + + def transform(self, node, results): + touch_import_top(u'future', u'standard_library', node) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_kwargs.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_kwargs.py new file mode 100644 index 0000000000000000000000000000000000000000..290f991eef498bfedb70f36f6a5e00ae01265b97 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_kwargs.py @@ -0,0 +1,147 @@ +u""" +Fixer for Python 3 function parameter syntax +This fixer is rather sensitive to incorrect py3k syntax. +""" + +# Note: "relevant" parameters are parameters following the first STAR in the list. + +from lib2to3 import fixer_base +from lib2to3.fixer_util import token, String, Newline, Comma, Name +from libfuturize.fixer_util import indentation, suitify, DoubleStar + +_assign_template = u"%(name)s = %(kwargs)s['%(name)s']; del %(kwargs)s['%(name)s']" +_if_template = u"if '%(name)s' in %(kwargs)s: %(assign)s" +_else_template = u"else: %(name)s = %(default)s" +_kwargs_default_name = u"_3to2kwargs" + +def gen_params(raw_params): + u""" + Generator that yields tuples of (name, default_value) for each parameter in the list + If no default is given, then it is default_value is None (not Leaf(token.NAME, 'None')) + """ + assert raw_params[0].type == token.STAR and len(raw_params) > 2 + curr_idx = 2 # the first place a keyword-only parameter name can be is index 2 + max_idx = len(raw_params) + while curr_idx < max_idx: + curr_item = raw_params[curr_idx] + prev_item = curr_item.prev_sibling + if curr_item.type != token.NAME: + curr_idx += 1 + continue + if prev_item is not None and prev_item.type == token.DOUBLESTAR: + break + name = curr_item.value + nxt = curr_item.next_sibling + if nxt is not None and nxt.type == token.EQUAL: + default_value = nxt.next_sibling + curr_idx += 2 + else: + default_value = None + yield (name, default_value) + curr_idx += 1 + +def remove_params(raw_params, kwargs_default=_kwargs_default_name): + u""" + Removes all keyword-only args from the params list and a bare star, if any. + Does not add the kwargs dict if needed. + Returns True if more action is needed, False if not + (more action is needed if no kwargs dict exists) + """ + assert raw_params[0].type == token.STAR + if raw_params[1].type == token.COMMA: + raw_params[0].remove() + raw_params[1].remove() + kw_params = raw_params[2:] + else: + kw_params = raw_params[3:] + for param in kw_params: + if param.type != token.DOUBLESTAR: + param.remove() + else: + return False + else: + return True + +def needs_fixing(raw_params, kwargs_default=_kwargs_default_name): + u""" + Returns string with the name of the kwargs dict if the params after the first star need fixing + Otherwise returns empty string + """ + found_kwargs = False + needs_fix = False + + for t in raw_params[2:]: + if t.type == token.COMMA: + # Commas are irrelevant at this stage. + continue + elif t.type == token.NAME and not found_kwargs: + # Keyword-only argument: definitely need to fix. + needs_fix = True + elif t.type == token.NAME and found_kwargs: + # Return 'foobar' of **foobar, if needed. + return t.value if needs_fix else u'' + elif t.type == token.DOUBLESTAR: + # Found either '*' from **foobar. + found_kwargs = True + else: + # Never found **foobar. Return a synthetic name, if needed. + return kwargs_default if needs_fix else u'' + +class FixKwargs(fixer_base.BaseFix): + + run_order = 7 # Run after function annotations are removed + + PATTERN = u"funcdef< 'def' NAME parameters< '(' arglist=typedargslist< params=any* > ')' > ':' suite=any >" + + def transform(self, node, results): + params_rawlist = results[u"params"] + for i, item in enumerate(params_rawlist): + if item.type == token.STAR: + params_rawlist = params_rawlist[i:] + break + else: + return + # params is guaranteed to be a list starting with *. + # if fixing is needed, there will be at least 3 items in this list: + # [STAR, COMMA, NAME] is the minimum that we need to worry about. + new_kwargs = needs_fixing(params_rawlist) + # new_kwargs is the name of the kwargs dictionary. + if not new_kwargs: + return + suitify(node) + + # At this point, params_rawlist is guaranteed to be a list + # beginning with a star that includes at least one keyword-only param + # e.g., [STAR, NAME, COMMA, NAME, COMMA, DOUBLESTAR, NAME] or + # [STAR, COMMA, NAME], or [STAR, COMMA, NAME, COMMA, DOUBLESTAR, NAME] + + # Anatomy of a funcdef: ['def', 'name', parameters, ':', suite] + # Anatomy of that suite: [NEWLINE, INDENT, first_stmt, all_other_stmts] + # We need to insert our new stuff before the first_stmt and change the + # first_stmt's prefix. + + suite = node.children[4] + first_stmt = suite.children[2] + ident = indentation(first_stmt) + + for name, default_value in gen_params(params_rawlist): + if default_value is None: + suite.insert_child(2, Newline()) + suite.insert_child(2, String(_assign_template %{u'name':name, u'kwargs':new_kwargs}, prefix=ident)) + else: + suite.insert_child(2, Newline()) + suite.insert_child(2, String(_else_template %{u'name':name, u'default':default_value}, prefix=ident)) + suite.insert_child(2, Newline()) + suite.insert_child(2, String(_if_template %{u'assign':_assign_template %{u'name':name, u'kwargs':new_kwargs}, u'name':name, u'kwargs':new_kwargs}, prefix=ident)) + first_stmt.prefix = ident + suite.children[2].prefix = u"" + + # Now, we need to fix up the list of params. + + must_add_kwargs = remove_params(params_rawlist) + if must_add_kwargs: + arglist = results[u'arglist'] + if len(arglist.children) > 0 and arglist.children[-1].type != token.COMMA: + arglist.append_child(Comma()) + arglist.append_child(DoubleStar(prefix=u" ")) + arglist.append_child(Name(new_kwargs)) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_memoryview.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_memoryview.py new file mode 100644 index 0000000000000000000000000000000000000000..a20f6f3f2d7267f86ad64e83c0164648cf2b93ec --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_memoryview.py @@ -0,0 +1,21 @@ +u""" +Fixer for memoryview(s) -> buffer(s). +Explicit because some memoryview methods are invalid on buffer objects. +""" + +from lib2to3 import fixer_base +from lib2to3.fixer_util import Name + + +class FixMemoryview(fixer_base.BaseFix): + + explicit = True # User must specify that they want this. + + PATTERN = u""" + power< name='memoryview' trailer< '(' [any] ')' > + rest=any* > + """ + + def transform(self, node, results): + name = results[u"name"] + name.replace(Name(u"buffer", prefix=name.prefix)) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_metaclass.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_metaclass.py new file mode 100644 index 0000000000000000000000000000000000000000..52dd1d1454e40131702908a9e6394114b52a7b0e --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_metaclass.py @@ -0,0 +1,78 @@ +u""" +Fixer for (metaclass=X) -> __metaclass__ = X +Some semantics (see PEP 3115) may be altered in the translation.""" + +from lib2to3 import fixer_base +from lib2to3.fixer_util import Name, syms, Node, Leaf, Newline, find_root +from lib2to3.pygram import token +from libfuturize.fixer_util import indentation, suitify +# from ..fixer_util import Name, syms, Node, Leaf, Newline, find_root, indentation, suitify + +def has_metaclass(parent): + results = None + for node in parent.children: + kids = node.children + if node.type == syms.argument: + if kids[0] == Leaf(token.NAME, u"metaclass") and \ + kids[1] == Leaf(token.EQUAL, u"=") and \ + kids[2]: + #Hack to avoid "class X(=):" with this case. + results = [node] + kids + break + elif node.type == syms.arglist: + # Argument list... loop through it looking for: + # Node(*, [*, Leaf(token.NAME, u"metaclass"), Leaf(token.EQUAL, u"="), Leaf(*, *)] + for child in node.children: + if results: break + if child.type == token.COMMA: + #Store the last comma, which precedes the metaclass + comma = child + elif type(child) == Node: + meta = equal = name = None + for arg in child.children: + if arg == Leaf(token.NAME, u"metaclass"): + #We have the (metaclass) part + meta = arg + elif meta and arg == Leaf(token.EQUAL, u"="): + #We have the (metaclass=) part + equal = arg + elif meta and equal: + #Here we go, we have (metaclass=X) + name = arg + results = (comma, meta, equal, name) + break + return results + + +class FixMetaclass(fixer_base.BaseFix): + + PATTERN = u""" + classdef + """ + + def transform(self, node, results): + meta_results = has_metaclass(node) + if not meta_results: return + for meta in meta_results: + meta.remove() + target = Leaf(token.NAME, u"__metaclass__") + equal = Leaf(token.EQUAL, u"=", prefix=u" ") + # meta is the last item in what was returned by has_metaclass(): name + name = meta + name.prefix = u" " + stmt_node = Node(syms.atom, [target, equal, name]) + + suitify(node) + for item in node.children: + if item.type == syms.suite: + for stmt in item.children: + if stmt.type == token.INDENT: + # Insert, in reverse order, the statement, a newline, + # and an indent right after the first indented line + loc = item.children.index(stmt) + 1 + # Keep consistent indentation form + ident = Leaf(token.INDENT, stmt.value) + item.insert_child(loc, ident) + item.insert_child(loc, Newline()) + item.insert_child(loc, stmt_node) + break diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_newstyle.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_newstyle.py new file mode 100644 index 0000000000000000000000000000000000000000..cc6b3adcb0c1bd41cb7b891777f97420a3633c29 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_newstyle.py @@ -0,0 +1,33 @@ +u""" +Fixer for "class Foo: ..." -> "class Foo(object): ..." +""" + +from lib2to3 import fixer_base +from lib2to3.fixer_util import LParen, RParen, Name + +from libfuturize.fixer_util import touch_import_top + + +def insert_object(node, idx): + node.insert_child(idx, RParen()) + node.insert_child(idx, Name(u"object")) + node.insert_child(idx, LParen()) + +class FixNewstyle(fixer_base.BaseFix): + + # Match: + # class Blah: + # and: + # class Blah(): + + PATTERN = u"classdef< 'class' NAME ['(' ')'] colon=':' any >" + + def transform(self, node, results): + colon = results[u"colon"] + idx = node.children.index(colon) + if (node.children[idx-2].value == '(' and + node.children[idx-1].value == ')'): + del node.children[idx-2:idx] + idx -= 2 + insert_object(node, idx) + touch_import_top(u'builtins', 'object', node) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_next.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_next.py new file mode 100644 index 0000000000000000000000000000000000000000..9ecb6c0439e08a706d114e0ff17402fdb6f611cd --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_next.py @@ -0,0 +1,43 @@ +u""" +Fixer for: +it.__next__() -> it.next(). +next(it) -> it.next(). +""" + +from lib2to3.pgen2 import token +from lib2to3.pygram import python_symbols as syms +from lib2to3 import fixer_base +from lib2to3.fixer_util import Name, Call, find_binding, Attr + +bind_warning = u"Calls to builtin next() possibly shadowed by global binding" + + +class FixNext(fixer_base.BaseFix): + + PATTERN = u""" + power< base=any+ trailer< '.' attr='__next__' > any* > + | + power< head='next' trailer< '(' arg=any ')' > any* > + | + classdef< 'class' base=any+ ':' + suite< any* + funcdef< 'def' + attr='__next__' + parameters< '(' NAME ')' > any+ > + any* > > + """ + + def transform(self, node, results): + assert results + + base = results.get(u"base") + attr = results.get(u"attr") + head = results.get(u"head") + arg_ = results.get(u"arg") + if arg_: + arg = arg_.clone() + head.replace(Attr(Name(unicode(arg),prefix=head.prefix), + Name(u"next"))) + arg_.remove() + elif base: + attr.replace(Name(u"next", prefix=attr.prefix)) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_printfunction.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_printfunction.py new file mode 100644 index 0000000000000000000000000000000000000000..a2a6e084372ca416187458e0cb1de0157daaee85 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_printfunction.py @@ -0,0 +1,17 @@ +u""" +Fixer for print: from __future__ import print_function. +""" + +from lib2to3 import fixer_base +from libfuturize.fixer_util import future_import + +class FixPrintfunction(fixer_base.BaseFix): + + # explicit = True + + PATTERN = u""" + power< 'print' trailer < '(' any* ')' > any* > + """ + + def transform(self, node, results): + future_import(u"print_function", node) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_raise.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_raise.py new file mode 100644 index 0000000000000000000000000000000000000000..9c9c192f85a94c3e89406e62b80eaae78f0f4565 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_raise.py @@ -0,0 +1,25 @@ +u"""Fixer for 'raise E(V).with_traceback(T)' -> 'raise E, V, T'""" + +from lib2to3 import fixer_base +from lib2to3.fixer_util import Comma, Node, Leaf, token, syms + +class FixRaise(fixer_base.BaseFix): + + PATTERN = u""" + raise_stmt< 'raise' (power< name=any [trailer< '(' val=any* ')' >] + [trailer< '.' 'with_traceback' > trailer< '(' trc=any ')' >] > | any) ['from' chain=any] >""" + + def transform(self, node, results): + name, val, trc = (results.get(u"name"), results.get(u"val"), results.get(u"trc")) + chain = results.get(u"chain") + if chain is not None: + self.warning(node, u"explicit exception chaining is not supported in Python 2") + chain.prev_sibling.remove() + chain.remove() + if trc is not None: + val = val[0] if val else Leaf(token.NAME, u"None") + val.prefix = trc.prefix = u" " + kids = [Leaf(token.NAME, u"raise"), name.clone(), Comma(), + val.clone(), Comma(), trc.clone()] + raise_stmt = Node(syms.raise_stmt, kids) + node.replace(raise_stmt) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_raise_.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_raise_.py new file mode 100644 index 0000000000000000000000000000000000000000..0f020c454f5bd07fb0732b4dd558ad021a37d437 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_raise_.py @@ -0,0 +1,35 @@ +u"""Fixer for + raise E(V).with_traceback(T) + to: + from future.utils import raise_ + ... + raise_(E, V, T) + +TODO: FIXME!! + +""" + +from lib2to3 import fixer_base +from lib2to3.fixer_util import Comma, Node, Leaf, token, syms + +class FixRaise(fixer_base.BaseFix): + + PATTERN = u""" + raise_stmt< 'raise' (power< name=any [trailer< '(' val=any* ')' >] + [trailer< '.' 'with_traceback' > trailer< '(' trc=any ')' >] > | any) ['from' chain=any] >""" + + def transform(self, node, results): + FIXME + name, val, trc = (results.get(u"name"), results.get(u"val"), results.get(u"trc")) + chain = results.get(u"chain") + if chain is not None: + self.warning(node, u"explicit exception chaining is not supported in Python 2") + chain.prev_sibling.remove() + chain.remove() + if trc is not None: + val = val[0] if val else Leaf(token.NAME, u"None") + val.prefix = trc.prefix = u" " + kids = [Leaf(token.NAME, u"raise"), name.clone(), Comma(), + val.clone(), Comma(), trc.clone()] + raise_stmt = Node(syms.raise_stmt, kids) + node.replace(raise_stmt) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_throw.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_throw.py new file mode 100644 index 0000000000000000000000000000000000000000..c0feed1ead7ad7368bdb628597dbaea65b4a0bd3 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/libpasteurize/fixes/fix_throw.py @@ -0,0 +1,23 @@ +u"""Fixer for 'g.throw(E(V).with_traceback(T))' -> 'g.throw(E, V, T)'""" + +from lib2to3 import fixer_base +from lib2to3.pytree import Node, Leaf +from lib2to3.pgen2 import token +from lib2to3.fixer_util import Comma + +class FixThrow(fixer_base.BaseFix): + + PATTERN = u""" + power< any trailer< '.' 'throw' > + trailer< '(' args=power< exc=any trailer< '(' val=any* ')' > + trailer< '.' 'with_traceback' > trailer< '(' trc=any ')' > > ')' > > + """ + + def transform(self, node, results): + syms = self.syms + exc, val, trc = (results[u"exc"], results[u"val"], results[u"trc"]) + val = val[0] if val else Leaf(token.NAME, u"None") + val.prefix = trc.prefix = u" " + kids = [exc.clone(), Comma(), val.clone(), Comma(), trc.clone()] + args = results[u"args"] + args.children = kids diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/more_itertools/tests/__init__.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/more_itertools/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/more_itertools/tests/test_more.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/more_itertools/tests/test_more.py new file mode 100644 index 0000000000000000000000000000000000000000..eacf8a8aae1ffbca5dcbe9bb03e183b7a58a7327 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/more_itertools/tests/test_more.py @@ -0,0 +1,2313 @@ +from __future__ import division, print_function, unicode_literals + +from collections import OrderedDict +from decimal import Decimal +from doctest import DocTestSuite +from fractions import Fraction +from functools import partial, reduce +from heapq import merge +from io import StringIO +from itertools import ( + chain, + count, + groupby, + islice, + permutations, + product, + repeat, +) +from operator import add, mul, itemgetter +from unittest import TestCase + +from six.moves import filter, map, range, zip + +import more_itertools as mi + + +def load_tests(loader, tests, ignore): + # Add the doctests + tests.addTests(DocTestSuite('more_itertools.more')) + return tests + + +class CollateTests(TestCase): + """Unit tests for ``collate()``""" + # Also accidentally tests peekable, though that could use its own tests + + def test_default(self): + """Test with the default `key` function.""" + iterables = [range(4), range(7), range(3, 6)] + self.assertEqual( + sorted(reduce(list.__add__, [list(it) for it in iterables])), + list(mi.collate(*iterables)) + ) + + def test_key(self): + """Test using a custom `key` function.""" + iterables = [range(5, 0, -1), range(4, 0, -1)] + actual = sorted( + reduce(list.__add__, [list(it) for it in iterables]), reverse=True + ) + expected = list(mi.collate(*iterables, key=lambda x: -x)) + self.assertEqual(actual, expected) + + def test_empty(self): + """Be nice if passed an empty list of iterables.""" + self.assertEqual([], list(mi.collate())) + + def test_one(self): + """Work when only 1 iterable is passed.""" + self.assertEqual([0, 1], list(mi.collate(range(2)))) + + def test_reverse(self): + """Test the `reverse` kwarg.""" + iterables = [range(4, 0, -1), range(7, 0, -1), range(3, 6, -1)] + + actual = sorted( + reduce(list.__add__, [list(it) for it in iterables]), reverse=True + ) + expected = list(mi.collate(*iterables, reverse=True)) + self.assertEqual(actual, expected) + + def test_alias(self): + self.assertNotEqual(merge.__doc__, mi.collate.__doc__) + self.assertNotEqual(partial.__doc__, mi.collate.__doc__) + + +class ChunkedTests(TestCase): + """Tests for ``chunked()``""" + + def test_even(self): + """Test when ``n`` divides evenly into the length of the iterable.""" + self.assertEqual( + list(mi.chunked('ABCDEF', 3)), [['A', 'B', 'C'], ['D', 'E', 'F']] + ) + + def test_odd(self): + """Test when ``n`` does not divide evenly into the length of the + iterable. + + """ + self.assertEqual( + list(mi.chunked('ABCDE', 3)), [['A', 'B', 'C'], ['D', 'E']] + ) + + +class FirstTests(TestCase): + """Tests for ``first()``""" + + def test_many(self): + """Test that it works on many-item iterables.""" + # Also try it on a generator expression to make sure it works on + # whatever those return, across Python versions. + self.assertEqual(mi.first(x for x in range(4)), 0) + + def test_one(self): + """Test that it doesn't raise StopIteration prematurely.""" + self.assertEqual(mi.first([3]), 3) + + def test_empty_stop_iteration(self): + """It should raise StopIteration for empty iterables.""" + self.assertRaises(ValueError, lambda: mi.first([])) + + def test_default(self): + """It should return the provided default arg for empty iterables.""" + self.assertEqual(mi.first([], 'boo'), 'boo') + + +class IterOnlyRange: + """User-defined iterable class which only support __iter__. + + It is not specified to inherit ``object``, so indexing on a instance will + raise an ``AttributeError`` rather than ``TypeError`` in Python 2. + + >>> r = IterOnlyRange(5) + >>> r[0] + AttributeError: IterOnlyRange instance has no attribute '__getitem__' + + Note: In Python 3, ``TypeError`` will be raised because ``object`` is + inherited implicitly by default. + + >>> r[0] + TypeError: 'IterOnlyRange' object does not support indexing + """ + def __init__(self, n): + """Set the length of the range.""" + self.n = n + + def __iter__(self): + """Works same as range().""" + return iter(range(self.n)) + + +class LastTests(TestCase): + """Tests for ``last()``""" + + def test_many_nonsliceable(self): + """Test that it works on many-item non-slice-able iterables.""" + # Also try it on a generator expression to make sure it works on + # whatever those return, across Python versions. + self.assertEqual(mi.last(x for x in range(4)), 3) + + def test_one_nonsliceable(self): + """Test that it doesn't raise StopIteration prematurely.""" + self.assertEqual(mi.last(x for x in range(1)), 0) + + def test_empty_stop_iteration_nonsliceable(self): + """It should raise ValueError for empty non-slice-able iterables.""" + self.assertRaises(ValueError, lambda: mi.last(x for x in range(0))) + + def test_default_nonsliceable(self): + """It should return the provided default arg for empty non-slice-able + iterables. + """ + self.assertEqual(mi.last((x for x in range(0)), 'boo'), 'boo') + + def test_many_sliceable(self): + """Test that it works on many-item slice-able iterables.""" + self.assertEqual(mi.last([0, 1, 2, 3]), 3) + + def test_one_sliceable(self): + """Test that it doesn't raise StopIteration prematurely.""" + self.assertEqual(mi.last([3]), 3) + + def test_empty_stop_iteration_sliceable(self): + """It should raise ValueError for empty slice-able iterables.""" + self.assertRaises(ValueError, lambda: mi.last([])) + + def test_default_sliceable(self): + """It should return the provided default arg for empty slice-able + iterables. + """ + self.assertEqual(mi.last([], 'boo'), 'boo') + + def test_dict(self): + """last(dic) and last(dic.keys()) should return same result.""" + dic = {'a': 1, 'b': 2, 'c': 3} + self.assertEqual(mi.last(dic), mi.last(dic.keys())) + + def test_ordereddict(self): + """last(dic) should return the last key.""" + od = OrderedDict() + od['a'] = 1 + od['b'] = 2 + od['c'] = 3 + self.assertEqual(mi.last(od), 'c') + + def test_customrange(self): + """It should work on custom class where [] raises AttributeError.""" + self.assertEqual(mi.last(IterOnlyRange(5)), 4) + + +class PeekableTests(TestCase): + """Tests for ``peekable()`` behavor not incidentally covered by testing + ``collate()`` + + """ + def test_peek_default(self): + """Make sure passing a default into ``peek()`` works.""" + p = mi.peekable([]) + self.assertEqual(p.peek(7), 7) + + def test_truthiness(self): + """Make sure a ``peekable`` tests true iff there are items remaining in + the iterable. + + """ + p = mi.peekable([]) + self.assertFalse(p) + + p = mi.peekable(range(3)) + self.assertTrue(p) + + def test_simple_peeking(self): + """Make sure ``next`` and ``peek`` advance and don't advance the + iterator, respectively. + + """ + p = mi.peekable(range(10)) + self.assertEqual(next(p), 0) + self.assertEqual(p.peek(), 1) + self.assertEqual(next(p), 1) + + def test_indexing(self): + """ + Indexing into the peekable shouldn't advance the iterator. + """ + p = mi.peekable('abcdefghijkl') + + # The 0th index is what ``next()`` will return + self.assertEqual(p[0], 'a') + self.assertEqual(next(p), 'a') + + # Indexing further into the peekable shouldn't advance the itertor + self.assertEqual(p[2], 'd') + self.assertEqual(next(p), 'b') + + # The 0th index moves up with the iterator; the last index follows + self.assertEqual(p[0], 'c') + self.assertEqual(p[9], 'l') + + self.assertEqual(next(p), 'c') + self.assertEqual(p[8], 'l') + + # Negative indexing should work too + self.assertEqual(p[-2], 'k') + self.assertEqual(p[-9], 'd') + self.assertRaises(IndexError, lambda: p[-10]) + + def test_slicing(self): + """Slicing the peekable shouldn't advance the iterator.""" + seq = list('abcdefghijkl') + p = mi.peekable(seq) + + # Slicing the peekable should just be like slicing a re-iterable + self.assertEqual(p[1:4], seq[1:4]) + + # Advancing the iterator moves the slices up also + self.assertEqual(next(p), 'a') + self.assertEqual(p[1:4], seq[1:][1:4]) + + # Implicit starts and stop should work + self.assertEqual(p[:5], seq[1:][:5]) + self.assertEqual(p[:], seq[1:][:]) + + # Indexing past the end should work + self.assertEqual(p[:100], seq[1:][:100]) + + # Steps should work, including negative + self.assertEqual(p[::2], seq[1:][::2]) + self.assertEqual(p[::-1], seq[1:][::-1]) + + def test_slicing_reset(self): + """Test slicing on a fresh iterable each time""" + iterable = ['0', '1', '2', '3', '4', '5'] + indexes = list(range(-4, len(iterable) + 4)) + [None] + steps = [1, 2, 3, 4, -1, -2, -3, 4] + for slice_args in product(indexes, indexes, steps): + it = iter(iterable) + p = mi.peekable(it) + next(p) + index = slice(*slice_args) + actual = p[index] + expected = iterable[1:][index] + self.assertEqual(actual, expected, slice_args) + + def test_slicing_error(self): + iterable = '01234567' + p = mi.peekable(iter(iterable)) + + # Prime the cache + p.peek() + old_cache = list(p._cache) + + # Illegal slice + with self.assertRaises(ValueError): + p[1:-1:0] + + # Neither the cache nor the iteration should be affected + self.assertEqual(old_cache, list(p._cache)) + self.assertEqual(list(p), list(iterable)) + + def test_passthrough(self): + """Iterating a peekable without using ``peek()`` or ``prepend()`` + should just give the underlying iterable's elements (a trivial test but + useful to set a baseline in case something goes wrong)""" + expected = [1, 2, 3, 4, 5] + actual = list(mi.peekable(expected)) + self.assertEqual(actual, expected) + + # prepend() behavior tests + + def test_prepend(self): + """Tests intersperesed ``prepend()`` and ``next()`` calls""" + it = mi.peekable(range(2)) + actual = [] + + # Test prepend() before next() + it.prepend(10) + actual += [next(it), next(it)] + + # Test prepend() between next()s + it.prepend(11) + actual += [next(it), next(it)] + + # Test prepend() after source iterable is consumed + it.prepend(12) + actual += [next(it)] + + expected = [10, 0, 11, 1, 12] + self.assertEqual(actual, expected) + + def test_multi_prepend(self): + """Tests prepending multiple items and getting them in proper order""" + it = mi.peekable(range(5)) + actual = [next(it), next(it)] + it.prepend(10, 11, 12) + it.prepend(20, 21) + actual += list(it) + expected = [0, 1, 20, 21, 10, 11, 12, 2, 3, 4] + self.assertEqual(actual, expected) + + def test_empty(self): + """Tests prepending in front of an empty iterable""" + it = mi.peekable([]) + it.prepend(10) + actual = list(it) + expected = [10] + self.assertEqual(actual, expected) + + def test_prepend_truthiness(self): + """Tests that ``__bool__()`` or ``__nonzero__()`` works properly + with ``prepend()``""" + it = mi.peekable(range(5)) + self.assertTrue(it) + actual = list(it) + self.assertFalse(it) + it.prepend(10) + self.assertTrue(it) + actual += [next(it)] + self.assertFalse(it) + expected = [0, 1, 2, 3, 4, 10] + self.assertEqual(actual, expected) + + def test_multi_prepend_peek(self): + """Tests prepending multiple elements and getting them in reverse order + while peeking""" + it = mi.peekable(range(5)) + actual = [next(it), next(it)] + self.assertEqual(it.peek(), 2) + it.prepend(10, 11, 12) + self.assertEqual(it.peek(), 10) + it.prepend(20, 21) + self.assertEqual(it.peek(), 20) + actual += list(it) + self.assertFalse(it) + expected = [0, 1, 20, 21, 10, 11, 12, 2, 3, 4] + self.assertEqual(actual, expected) + + def test_prepend_after_stop(self): + """Test resuming iteration after a previous exhaustion""" + it = mi.peekable(range(3)) + self.assertEqual(list(it), [0, 1, 2]) + self.assertRaises(StopIteration, lambda: next(it)) + it.prepend(10) + self.assertEqual(next(it), 10) + self.assertRaises(StopIteration, lambda: next(it)) + + def test_prepend_slicing(self): + """Tests interaction between prepending and slicing""" + seq = list(range(20)) + p = mi.peekable(seq) + + p.prepend(30, 40, 50) + pseq = [30, 40, 50] + seq # pseq for prepended_seq + + # adapt the specific tests from test_slicing + self.assertEqual(p[0], 30) + self.assertEqual(p[1:8], pseq[1:8]) + self.assertEqual(p[1:], pseq[1:]) + self.assertEqual(p[:5], pseq[:5]) + self.assertEqual(p[:], pseq[:]) + self.assertEqual(p[:100], pseq[:100]) + self.assertEqual(p[::2], pseq[::2]) + self.assertEqual(p[::-1], pseq[::-1]) + + def test_prepend_indexing(self): + """Tests interaction between prepending and indexing""" + seq = list(range(20)) + p = mi.peekable(seq) + + p.prepend(30, 40, 50) + + self.assertEqual(p[0], 30) + self.assertEqual(next(p), 30) + self.assertEqual(p[2], 0) + self.assertEqual(next(p), 40) + self.assertEqual(p[0], 50) + self.assertEqual(p[9], 8) + self.assertEqual(next(p), 50) + self.assertEqual(p[8], 8) + self.assertEqual(p[-2], 18) + self.assertEqual(p[-9], 11) + self.assertRaises(IndexError, lambda: p[-21]) + + def test_prepend_iterable(self): + """Tests prepending from an iterable""" + it = mi.peekable(range(5)) + # Don't directly use the range() object to avoid any range-specific + # optimizations + it.prepend(*(x for x in range(5))) + actual = list(it) + expected = list(chain(range(5), range(5))) + self.assertEqual(actual, expected) + + def test_prepend_many(self): + """Tests that prepending a huge number of elements works""" + it = mi.peekable(range(5)) + # Don't directly use the range() object to avoid any range-specific + # optimizations + it.prepend(*(x for x in range(20000))) + actual = list(it) + expected = list(chain(range(20000), range(5))) + self.assertEqual(actual, expected) + + def test_prepend_reversed(self): + """Tests prepending from a reversed iterable""" + it = mi.peekable(range(3)) + it.prepend(*reversed((10, 11, 12))) + actual = list(it) + expected = [12, 11, 10, 0, 1, 2] + self.assertEqual(actual, expected) + + +class ConsumerTests(TestCase): + """Tests for ``consumer()``""" + + def test_consumer(self): + @mi.consumer + def eater(): + while True: + x = yield # noqa + + e = eater() + e.send('hi') # without @consumer, would raise TypeError + + +class DistinctPermutationsTests(TestCase): + def test_distinct_permutations(self): + """Make sure the output for ``distinct_permutations()`` is the same as + set(permutations(it)). + + """ + iterable = ['z', 'a', 'a', 'q', 'q', 'q', 'y'] + test_output = sorted(mi.distinct_permutations(iterable)) + ref_output = sorted(set(permutations(iterable))) + self.assertEqual(test_output, ref_output) + + def test_other_iterables(self): + """Make sure ``distinct_permutations()`` accepts a different type of + iterables. + + """ + # a generator + iterable = (c for c in ['z', 'a', 'a', 'q', 'q', 'q', 'y']) + test_output = sorted(mi.distinct_permutations(iterable)) + # "reload" it + iterable = (c for c in ['z', 'a', 'a', 'q', 'q', 'q', 'y']) + ref_output = sorted(set(permutations(iterable))) + self.assertEqual(test_output, ref_output) + + # an iterator + iterable = iter(['z', 'a', 'a', 'q', 'q', 'q', 'y']) + test_output = sorted(mi.distinct_permutations(iterable)) + # "reload" it + iterable = iter(['z', 'a', 'a', 'q', 'q', 'q', 'y']) + ref_output = sorted(set(permutations(iterable))) + self.assertEqual(test_output, ref_output) + + +class IlenTests(TestCase): + def test_ilen(self): + """Sanity-checks for ``ilen()``.""" + # Non-empty + self.assertEqual( + mi.ilen(filter(lambda x: x % 10 == 0, range(101))), 11 + ) + + # Empty + self.assertEqual(mi.ilen((x for x in range(0))), 0) + + # Iterable with __len__ + self.assertEqual(mi.ilen(list(range(6))), 6) + + +class WithIterTests(TestCase): + def test_with_iter(self): + s = StringIO('One fish\nTwo fish') + initial_words = [line.split()[0] for line in mi.with_iter(s)] + + # Iterable's items should be faithfully represented + self.assertEqual(initial_words, ['One', 'Two']) + # The file object should be closed + self.assertTrue(s.closed) + + +class OneTests(TestCase): + def test_basic(self): + it = iter(['item']) + self.assertEqual(mi.one(it), 'item') + + def test_too_short(self): + it = iter([]) + self.assertRaises(ValueError, lambda: mi.one(it)) + self.assertRaises(IndexError, lambda: mi.one(it, too_short=IndexError)) + + def test_too_long(self): + it = count() + self.assertRaises(ValueError, lambda: mi.one(it)) # burn 0 and 1 + self.assertEqual(next(it), 2) + self.assertRaises( + OverflowError, lambda: mi.one(it, too_long=OverflowError) + ) + + +class IntersperseTest(TestCase): + """ Tests for intersperse() """ + + def test_even(self): + iterable = (x for x in '01') + self.assertEqual( + list(mi.intersperse(None, iterable)), ['0', None, '1'] + ) + + def test_odd(self): + iterable = (x for x in '012') + self.assertEqual( + list(mi.intersperse(None, iterable)), ['0', None, '1', None, '2'] + ) + + def test_nested(self): + element = ('a', 'b') + iterable = (x for x in '012') + actual = list(mi.intersperse(element, iterable)) + expected = ['0', ('a', 'b'), '1', ('a', 'b'), '2'] + self.assertEqual(actual, expected) + + def test_not_iterable(self): + self.assertRaises(TypeError, lambda: mi.intersperse('x', 1)) + + def test_n(self): + for n, element, expected in [ + (1, '_', ['0', '_', '1', '_', '2', '_', '3', '_', '4', '_', '5']), + (2, '_', ['0', '1', '_', '2', '3', '_', '4', '5']), + (3, '_', ['0', '1', '2', '_', '3', '4', '5']), + (4, '_', ['0', '1', '2', '3', '_', '4', '5']), + (5, '_', ['0', '1', '2', '3', '4', '_', '5']), + (6, '_', ['0', '1', '2', '3', '4', '5']), + (7, '_', ['0', '1', '2', '3', '4', '5']), + (3, ['a', 'b'], ['0', '1', '2', ['a', 'b'], '3', '4', '5']), + ]: + iterable = (x for x in '012345') + actual = list(mi.intersperse(element, iterable, n=n)) + self.assertEqual(actual, expected) + + def test_n_zero(self): + self.assertRaises( + ValueError, lambda: list(mi.intersperse('x', '012', n=0)) + ) + + +class UniqueToEachTests(TestCase): + """Tests for ``unique_to_each()``""" + + def test_all_unique(self): + """When all the input iterables are unique the output should match + the input.""" + iterables = [[1, 2], [3, 4, 5], [6, 7, 8]] + self.assertEqual(mi.unique_to_each(*iterables), iterables) + + def test_duplicates(self): + """When there are duplicates in any of the input iterables that aren't + in the rest, those duplicates should be emitted.""" + iterables = ["mississippi", "missouri"] + self.assertEqual( + mi.unique_to_each(*iterables), [['p', 'p'], ['o', 'u', 'r']] + ) + + def test_mixed(self): + """When the input iterables contain different types the function should + still behave properly""" + iterables = ['x', (i for i in range(3)), [1, 2, 3], tuple()] + self.assertEqual(mi.unique_to_each(*iterables), [['x'], [0], [3], []]) + + +class WindowedTests(TestCase): + """Tests for ``windowed()``""" + + def test_basic(self): + actual = list(mi.windowed([1, 2, 3, 4, 5], 3)) + expected = [(1, 2, 3), (2, 3, 4), (3, 4, 5)] + self.assertEqual(actual, expected) + + def test_large_size(self): + """ + When the window size is larger than the iterable, and no fill value is + given,``None`` should be filled in. + """ + actual = list(mi.windowed([1, 2, 3, 4, 5], 6)) + expected = [(1, 2, 3, 4, 5, None)] + self.assertEqual(actual, expected) + + def test_fillvalue(self): + """ + When sizes don't match evenly, the given fill value should be used. + """ + iterable = [1, 2, 3, 4, 5] + + for n, kwargs, expected in [ + (6, {}, [(1, 2, 3, 4, 5, '!')]), # n > len(iterable) + (3, {'step': 3}, [(1, 2, 3), (4, 5, '!')]), # using ``step`` + ]: + actual = list(mi.windowed(iterable, n, fillvalue='!', **kwargs)) + self.assertEqual(actual, expected) + + def test_zero(self): + """When the window size is zero, an empty tuple should be emitted.""" + actual = list(mi.windowed([1, 2, 3, 4, 5], 0)) + expected = [tuple()] + self.assertEqual(actual, expected) + + def test_negative(self): + """When the window size is negative, ValueError should be raised.""" + with self.assertRaises(ValueError): + list(mi.windowed([1, 2, 3, 4, 5], -1)) + + def test_step(self): + """The window should advance by the number of steps provided""" + iterable = [1, 2, 3, 4, 5, 6, 7] + for n, step, expected in [ + (3, 2, [(1, 2, 3), (3, 4, 5), (5, 6, 7)]), # n > step + (3, 3, [(1, 2, 3), (4, 5, 6), (7, None, None)]), # n == step + (3, 4, [(1, 2, 3), (5, 6, 7)]), # line up nicely + (3, 5, [(1, 2, 3), (6, 7, None)]), # off by one + (3, 6, [(1, 2, 3), (7, None, None)]), # off by two + (3, 7, [(1, 2, 3)]), # step past the end + (7, 8, [(1, 2, 3, 4, 5, 6, 7)]), # step > len(iterable) + ]: + actual = list(mi.windowed(iterable, n, step=step)) + self.assertEqual(actual, expected) + + # Step must be greater than or equal to 1 + with self.assertRaises(ValueError): + list(mi.windowed(iterable, 3, step=0)) + + +class SubstringsTests(TestCase): + def test_basic(self): + iterable = (x for x in range(4)) + actual = list(mi.substrings(iterable)) + expected = [ + (0,), + (1,), + (2,), + (3,), + (0, 1), + (1, 2), + (2, 3), + (0, 1, 2), + (1, 2, 3), + (0, 1, 2, 3), + ] + self.assertEqual(actual, expected) + + def test_strings(self): + iterable = 'abc' + actual = list(mi.substrings(iterable)) + expected = [ + ('a',), ('b',), ('c',), ('a', 'b'), ('b', 'c'), ('a', 'b', 'c') + ] + self.assertEqual(actual, expected) + + def test_empty(self): + iterable = iter([]) + actual = list(mi.substrings(iterable)) + expected = [] + self.assertEqual(actual, expected) + + def test_order(self): + iterable = [2, 0, 1] + actual = list(mi.substrings(iterable)) + expected = [(2,), (0,), (1,), (2, 0), (0, 1), (2, 0, 1)] + self.assertEqual(actual, expected) + + +class BucketTests(TestCase): + """Tests for ``bucket()``""" + + def test_basic(self): + iterable = [10, 20, 30, 11, 21, 31, 12, 22, 23, 33] + D = mi.bucket(iterable, key=lambda x: 10 * (x // 10)) + + # In-order access + self.assertEqual(list(D[10]), [10, 11, 12]) + + # Out of order access + self.assertEqual(list(D[30]), [30, 31, 33]) + self.assertEqual(list(D[20]), [20, 21, 22, 23]) + + self.assertEqual(list(D[40]), []) # Nothing in here! + + def test_in(self): + iterable = [10, 20, 30, 11, 21, 31, 12, 22, 23, 33] + D = mi.bucket(iterable, key=lambda x: 10 * (x // 10)) + + self.assertIn(10, D) + self.assertNotIn(40, D) + self.assertIn(20, D) + self.assertNotIn(21, D) + + # Checking in-ness shouldn't advance the iterator + self.assertEqual(next(D[10]), 10) + + def test_validator(self): + iterable = count(0) + key = lambda x: int(str(x)[0]) # First digit of each number + validator = lambda x: 0 < x < 10 # No leading zeros + D = mi.bucket(iterable, key, validator=validator) + self.assertEqual(mi.take(3, D[1]), [1, 10, 11]) + self.assertNotIn(0, D) # Non-valid entries don't return True + self.assertNotIn(0, D._cache) # Don't store non-valid entries + self.assertEqual(list(D[0]), []) + + +class SpyTests(TestCase): + """Tests for ``spy()``""" + + def test_basic(self): + original_iterable = iter('abcdefg') + head, new_iterable = mi.spy(original_iterable) + self.assertEqual(head, ['a']) + self.assertEqual( + list(new_iterable), ['a', 'b', 'c', 'd', 'e', 'f', 'g'] + ) + + def test_unpacking(self): + original_iterable = iter('abcdefg') + (first, second, third), new_iterable = mi.spy(original_iterable, 3) + self.assertEqual(first, 'a') + self.assertEqual(second, 'b') + self.assertEqual(third, 'c') + self.assertEqual( + list(new_iterable), ['a', 'b', 'c', 'd', 'e', 'f', 'g'] + ) + + def test_too_many(self): + original_iterable = iter('abc') + head, new_iterable = mi.spy(original_iterable, 4) + self.assertEqual(head, ['a', 'b', 'c']) + self.assertEqual(list(new_iterable), ['a', 'b', 'c']) + + def test_zero(self): + original_iterable = iter('abc') + head, new_iterable = mi.spy(original_iterable, 0) + self.assertEqual(head, []) + self.assertEqual(list(new_iterable), ['a', 'b', 'c']) + + +class InterleaveTests(TestCase): + def test_even(self): + actual = list(mi.interleave([1, 4, 7], [2, 5, 8], [3, 6, 9])) + expected = [1, 2, 3, 4, 5, 6, 7, 8, 9] + self.assertEqual(actual, expected) + + def test_short(self): + actual = list(mi.interleave([1, 4], [2, 5, 7], [3, 6, 8])) + expected = [1, 2, 3, 4, 5, 6] + self.assertEqual(actual, expected) + + def test_mixed_types(self): + it_list = ['a', 'b', 'c', 'd'] + it_str = '12345' + it_inf = count() + actual = list(mi.interleave(it_list, it_str, it_inf)) + expected = ['a', '1', 0, 'b', '2', 1, 'c', '3', 2, 'd', '4', 3] + self.assertEqual(actual, expected) + + +class InterleaveLongestTests(TestCase): + def test_even(self): + actual = list(mi.interleave_longest([1, 4, 7], [2, 5, 8], [3, 6, 9])) + expected = [1, 2, 3, 4, 5, 6, 7, 8, 9] + self.assertEqual(actual, expected) + + def test_short(self): + actual = list(mi.interleave_longest([1, 4], [2, 5, 7], [3, 6, 8])) + expected = [1, 2, 3, 4, 5, 6, 7, 8] + self.assertEqual(actual, expected) + + def test_mixed_types(self): + it_list = ['a', 'b', 'c', 'd'] + it_str = '12345' + it_gen = (x for x in range(3)) + actual = list(mi.interleave_longest(it_list, it_str, it_gen)) + expected = ['a', '1', 0, 'b', '2', 1, 'c', '3', 2, 'd', '4', '5'] + self.assertEqual(actual, expected) + + +class TestCollapse(TestCase): + """Tests for ``collapse()``""" + + def test_collapse(self): + l = [[1], 2, [[3], 4], [[[5]]]] + self.assertEqual(list(mi.collapse(l)), [1, 2, 3, 4, 5]) + + def test_collapse_to_string(self): + l = [["s1"], "s2", [["s3"], "s4"], [[["s5"]]]] + self.assertEqual(list(mi.collapse(l)), ["s1", "s2", "s3", "s4", "s5"]) + + def test_collapse_flatten(self): + l = [[1], [2], [[3], 4], [[[5]]]] + self.assertEqual(list(mi.collapse(l, levels=1)), list(mi.flatten(l))) + + def test_collapse_to_level(self): + l = [[1], 2, [[3], 4], [[[5]]]] + self.assertEqual(list(mi.collapse(l, levels=2)), [1, 2, 3, 4, [5]]) + self.assertEqual( + list(mi.collapse(mi.collapse(l, levels=1), levels=1)), + list(mi.collapse(l, levels=2)) + ) + + def test_collapse_to_list(self): + l = (1, [2], (3, [4, (5,)], 'ab')) + actual = list(mi.collapse(l, base_type=list)) + expected = [1, [2], 3, [4, (5,)], 'ab'] + self.assertEqual(actual, expected) + + +class SideEffectTests(TestCase): + """Tests for ``side_effect()``""" + + def test_individual(self): + # The function increments the counter for each call + counter = [0] + + def func(arg): + counter[0] += 1 + + result = list(mi.side_effect(func, range(10))) + self.assertEqual(result, list(range(10))) + self.assertEqual(counter[0], 10) + + def test_chunked(self): + # The function increments the counter for each call + counter = [0] + + def func(arg): + counter[0] += 1 + + result = list(mi.side_effect(func, range(10), 2)) + self.assertEqual(result, list(range(10))) + self.assertEqual(counter[0], 5) + + def test_before_after(self): + f = StringIO() + collector = [] + + def func(item): + print(item, file=f) + collector.append(f.getvalue()) + + def it(): + yield 'a' + yield 'b' + raise RuntimeError('kaboom') + + before = lambda: print('HEADER', file=f) + after = f.close + + try: + mi.consume(mi.side_effect(func, it(), before=before, after=after)) + except RuntimeError: + pass + + # The iterable should have been written to the file + self.assertEqual(collector, ['HEADER\na\n', 'HEADER\na\nb\n']) + + # The file should be closed even though something bad happened + self.assertTrue(f.closed) + + def test_before_fails(self): + f = StringIO() + func = lambda x: print(x, file=f) + + def before(): + raise RuntimeError('ouch') + + try: + mi.consume( + mi.side_effect(func, 'abc', before=before, after=f.close) + ) + except RuntimeError: + pass + + # The file should be closed even though something bad happened in the + # before function + self.assertTrue(f.closed) + + +class SlicedTests(TestCase): + """Tests for ``sliced()``""" + + def test_even(self): + """Test when the length of the sequence is divisible by *n*""" + seq = 'ABCDEFGHI' + self.assertEqual(list(mi.sliced(seq, 3)), ['ABC', 'DEF', 'GHI']) + + def test_odd(self): + """Test when the length of the sequence is not divisible by *n*""" + seq = 'ABCDEFGHI' + self.assertEqual(list(mi.sliced(seq, 4)), ['ABCD', 'EFGH', 'I']) + + def test_not_sliceable(self): + seq = (x for x in 'ABCDEFGHI') + + with self.assertRaises(TypeError): + list(mi.sliced(seq, 3)) + + +class SplitAtTests(TestCase): + """Tests for ``split()``""" + + def comp_with_str_split(self, str_to_split, delim): + pred = lambda c: c == delim + actual = list(map(''.join, mi.split_at(str_to_split, pred))) + expected = str_to_split.split(delim) + self.assertEqual(actual, expected) + + def test_seperators(self): + test_strs = ['', 'abcba', 'aaabbbcccddd', 'e'] + for s, delim in product(test_strs, 'abcd'): + self.comp_with_str_split(s, delim) + + +class SplitBeforeTest(TestCase): + """Tests for ``split_before()``""" + + def test_starts_with_sep(self): + actual = list(mi.split_before('xooxoo', lambda c: c == 'x')) + expected = [['x', 'o', 'o'], ['x', 'o', 'o']] + self.assertEqual(actual, expected) + + def test_ends_with_sep(self): + actual = list(mi.split_before('ooxoox', lambda c: c == 'x')) + expected = [['o', 'o'], ['x', 'o', 'o'], ['x']] + self.assertEqual(actual, expected) + + def test_no_sep(self): + actual = list(mi.split_before('ooo', lambda c: c == 'x')) + expected = [['o', 'o', 'o']] + self.assertEqual(actual, expected) + + +class SplitAfterTest(TestCase): + """Tests for ``split_after()``""" + + def test_starts_with_sep(self): + actual = list(mi.split_after('xooxoo', lambda c: c == 'x')) + expected = [['x'], ['o', 'o', 'x'], ['o', 'o']] + self.assertEqual(actual, expected) + + def test_ends_with_sep(self): + actual = list(mi.split_after('ooxoox', lambda c: c == 'x')) + expected = [['o', 'o', 'x'], ['o', 'o', 'x']] + self.assertEqual(actual, expected) + + def test_no_sep(self): + actual = list(mi.split_after('ooo', lambda c: c == 'x')) + expected = [['o', 'o', 'o']] + self.assertEqual(actual, expected) + + +class SplitIntoTests(TestCase): + """Tests for ``split_into()``""" + + def test_iterable_just_right(self): + """Size of ``iterable`` equals the sum of ``sizes``.""" + iterable = [1, 2, 3, 4, 5, 6, 7, 8, 9] + sizes = [2, 3, 4] + expected = [[1, 2], [3, 4, 5], [6, 7, 8, 9]] + actual = list(mi.split_into(iterable, sizes)) + self.assertEqual(actual, expected) + + def test_iterable_too_small(self): + """Size of ``iterable`` is smaller than sum of ``sizes``. Last return + list is shorter as a result.""" + iterable = [1, 2, 3, 4, 5, 6, 7] + sizes = [2, 3, 4] + expected = [[1, 2], [3, 4, 5], [6, 7]] + actual = list(mi.split_into(iterable, sizes)) + self.assertEqual(actual, expected) + + def test_iterable_too_small_extra(self): + """Size of ``iterable`` is smaller than sum of ``sizes``. Second last + return list is shorter and last return list is empty as a result.""" + iterable = [1, 2, 3, 4, 5, 6, 7] + sizes = [2, 3, 4, 5] + expected = [[1, 2], [3, 4, 5], [6, 7], []] + actual = list(mi.split_into(iterable, sizes)) + self.assertEqual(actual, expected) + + def test_iterable_too_large(self): + """Size of ``iterable`` is larger than sum of ``sizes``. Not all + items of iterable are returned.""" + iterable = [1, 2, 3, 4, 5, 6, 7, 8, 9] + sizes = [2, 3, 2] + expected = [[1, 2], [3, 4, 5], [6, 7]] + actual = list(mi.split_into(iterable, sizes)) + self.assertEqual(actual, expected) + + def test_using_none_with_leftover(self): + """Last item of ``sizes`` is None when items still remain in + ``iterable``. Last list returned stretches to fit all remaining items + of ``iterable``.""" + iterable = [1, 2, 3, 4, 5, 6, 7, 8, 9] + sizes = [2, 3, None] + expected = [[1, 2], [3, 4, 5], [6, 7, 8, 9]] + actual = list(mi.split_into(iterable, sizes)) + self.assertEqual(actual, expected) + + def test_using_none_without_leftover(self): + """Last item of ``sizes`` is None when no items remain in + ``iterable``. Last list returned is empty.""" + iterable = [1, 2, 3, 4, 5, 6, 7, 8, 9] + sizes = [2, 3, 4, None] + expected = [[1, 2], [3, 4, 5], [6, 7, 8, 9], []] + actual = list(mi.split_into(iterable, sizes)) + self.assertEqual(actual, expected) + + def test_using_none_mid_sizes(self): + """None is present in ``sizes`` but is not the last item. Last list + returned stretches to fit all remaining items of ``iterable`` but + all items in ``sizes`` after None are ignored.""" + iterable = [1, 2, 3, 4, 5, 6, 7, 8, 9] + sizes = [2, 3, None, 4] + expected = [[1, 2], [3, 4, 5], [6, 7, 8, 9]] + actual = list(mi.split_into(iterable, sizes)) + self.assertEqual(actual, expected) + + def test_iterable_empty(self): + """``iterable`` argument is empty but ``sizes`` is not. An empty + list is returned for each item in ``sizes``.""" + iterable = [] + sizes = [2, 4, 2] + expected = [[], [], []] + actual = list(mi.split_into(iterable, sizes)) + self.assertEqual(actual, expected) + + def test_iterable_empty_using_none(self): + """``iterable`` argument is empty but ``sizes`` is not. An empty + list is returned for each item in ``sizes`` that is not after a + None item.""" + iterable = [] + sizes = [2, 4, None, 2] + expected = [[], [], []] + actual = list(mi.split_into(iterable, sizes)) + self.assertEqual(actual, expected) + + def test_sizes_empty(self): + """``sizes`` argument is empty but ``iterable`` is not. An empty + generator is returned.""" + iterable = [1, 2, 3, 4, 5, 6, 7, 8, 9] + sizes = [] + expected = [] + actual = list(mi.split_into(iterable, sizes)) + self.assertEqual(actual, expected) + + def test_both_empty(self): + """Both ``sizes`` and ``iterable`` arguments are empty. An empty + generator is returned.""" + iterable = [] + sizes = [] + expected = [] + actual = list(mi.split_into(iterable, sizes)) + self.assertEqual(actual, expected) + + def test_bool_in_sizes(self): + """A bool object is present in ``sizes`` is treated as a 1 or 0 for + ``True`` or ``False`` due to bool being an instance of int.""" + iterable = [1, 2, 3, 4, 5, 6, 7, 8, 9] + sizes = [3, True, 2, False] + expected = [[1, 2, 3], [4], [5, 6], []] + actual = list(mi.split_into(iterable, sizes)) + self.assertEqual(actual, expected) + + def test_invalid_in_sizes(self): + """A ValueError is raised if an object in ``sizes`` is neither ``None`` + or an integer.""" + iterable = [1, 2, 3, 4, 5, 6, 7, 8, 9] + sizes = [1, [], 3] + with self.assertRaises(ValueError): + list(mi.split_into(iterable, sizes)) + + def test_invalid_in_sizes_after_none(self): + """A item in ``sizes`` that is invalid will not raise a TypeError if it + comes after a ``None`` item.""" + iterable = [1, 2, 3, 4, 5, 6, 7, 8, 9] + sizes = [3, 4, None, []] + expected = [[1, 2, 3], [4, 5, 6, 7], [8, 9]] + actual = list(mi.split_into(iterable, sizes)) + self.assertEqual(actual, expected) + + def test_generator_iterable_integrity(self): + """Check that if ``iterable`` is an iterator, it is consumed only by as + many items as the sum of ``sizes``.""" + iterable = (i for i in range(10)) + sizes = [2, 3] + + expected = [[0, 1], [2, 3, 4]] + actual = list(mi.split_into(iterable, sizes)) + self.assertEqual(actual, expected) + + iterable_expected = [5, 6, 7, 8, 9] + iterable_actual = list(iterable) + self.assertEqual(iterable_actual, iterable_expected) + + def test_generator_sizes_integrity(self): + """Check that if ``sizes`` is an iterator, it is consumed only until a + ``None`` item is reached""" + iterable = [1, 2, 3, 4, 5, 6, 7, 8, 9] + sizes = (i for i in [1, 2, None, 3, 4]) + + expected = [[1], [2, 3], [4, 5, 6, 7, 8, 9]] + actual = list(mi.split_into(iterable, sizes)) + self.assertEqual(actual, expected) + + sizes_expected = [3, 4] + sizes_actual = list(sizes) + self.assertEqual(sizes_actual, sizes_expected) + + +class PaddedTest(TestCase): + """Tests for ``padded()``""" + + def test_no_n(self): + seq = [1, 2, 3] + + # No fillvalue + self.assertEqual(mi.take(5, mi.padded(seq)), [1, 2, 3, None, None]) + + # With fillvalue + self.assertEqual( + mi.take(5, mi.padded(seq, fillvalue='')), [1, 2, 3, '', ''] + ) + + def test_invalid_n(self): + self.assertRaises(ValueError, lambda: list(mi.padded([1, 2, 3], n=-1))) + self.assertRaises(ValueError, lambda: list(mi.padded([1, 2, 3], n=0))) + + def test_valid_n(self): + seq = [1, 2, 3, 4, 5] + + # No need for padding: len(seq) <= n + self.assertEqual(list(mi.padded(seq, n=4)), [1, 2, 3, 4, 5]) + self.assertEqual(list(mi.padded(seq, n=5)), [1, 2, 3, 4, 5]) + + # No fillvalue + self.assertEqual( + list(mi.padded(seq, n=7)), [1, 2, 3, 4, 5, None, None] + ) + + # With fillvalue + self.assertEqual( + list(mi.padded(seq, fillvalue='', n=7)), [1, 2, 3, 4, 5, '', ''] + ) + + def test_next_multiple(self): + seq = [1, 2, 3, 4, 5, 6] + + # No need for padding: len(seq) % n == 0 + self.assertEqual( + list(mi.padded(seq, n=3, next_multiple=True)), [1, 2, 3, 4, 5, 6] + ) + + # Padding needed: len(seq) < n + self.assertEqual( + list(mi.padded(seq, n=8, next_multiple=True)), + [1, 2, 3, 4, 5, 6, None, None] + ) + + # No padding needed: len(seq) == n + self.assertEqual( + list(mi.padded(seq, n=6, next_multiple=True)), [1, 2, 3, 4, 5, 6] + ) + + # Padding needed: len(seq) > n + self.assertEqual( + list(mi.padded(seq, n=4, next_multiple=True)), + [1, 2, 3, 4, 5, 6, None, None] + ) + + # With fillvalue + self.assertEqual( + list(mi.padded(seq, fillvalue='', n=4, next_multiple=True)), + [1, 2, 3, 4, 5, 6, '', ''] + ) + + +class DistributeTest(TestCase): + """Tests for distribute()""" + + def test_invalid_n(self): + self.assertRaises(ValueError, lambda: mi.distribute(-1, [1, 2, 3])) + self.assertRaises(ValueError, lambda: mi.distribute(0, [1, 2, 3])) + + def test_basic(self): + iterable = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] + + for n, expected in [ + (1, [iterable]), + (2, [[1, 3, 5, 7, 9], [2, 4, 6, 8, 10]]), + (3, [[1, 4, 7, 10], [2, 5, 8], [3, 6, 9]]), + (10, [[n] for n in range(1, 10 + 1)]), + ]: + self.assertEqual( + [list(x) for x in mi.distribute(n, iterable)], expected + ) + + def test_large_n(self): + iterable = [1, 2, 3, 4] + self.assertEqual( + [list(x) for x in mi.distribute(6, iterable)], + [[1], [2], [3], [4], [], []] + ) + + +class StaggerTest(TestCase): + """Tests for ``stagger()``""" + + def test_default(self): + iterable = [0, 1, 2, 3] + actual = list(mi.stagger(iterable)) + expected = [(None, 0, 1), (0, 1, 2), (1, 2, 3)] + self.assertEqual(actual, expected) + + def test_offsets(self): + iterable = [0, 1, 2, 3] + for offsets, expected in [ + ((-2, 0, 2), [('', 0, 2), ('', 1, 3)]), + ((-2, -1), [('', ''), ('', 0), (0, 1), (1, 2), (2, 3)]), + ((1, 2), [(1, 2), (2, 3)]), + ]: + all_groups = mi.stagger(iterable, offsets=offsets, fillvalue='') + self.assertEqual(list(all_groups), expected) + + def test_longest(self): + iterable = [0, 1, 2, 3] + for offsets, expected in [ + ( + (-1, 0, 1), + [('', 0, 1), (0, 1, 2), (1, 2, 3), (2, 3, ''), (3, '', '')] + ), + ((-2, -1), [('', ''), ('', 0), (0, 1), (1, 2), (2, 3), (3, '')]), + ((1, 2), [(1, 2), (2, 3), (3, '')]), + ]: + all_groups = mi.stagger( + iterable, offsets=offsets, fillvalue='', longest=True + ) + self.assertEqual(list(all_groups), expected) + + +class ZipOffsetTest(TestCase): + """Tests for ``zip_offset()``""" + + def test_shortest(self): + a_1 = [0, 1, 2, 3] + a_2 = [0, 1, 2, 3, 4, 5] + a_3 = [0, 1, 2, 3, 4, 5, 6, 7] + actual = list( + mi.zip_offset(a_1, a_2, a_3, offsets=(-1, 0, 1), fillvalue='') + ) + expected = [('', 0, 1), (0, 1, 2), (1, 2, 3), (2, 3, 4), (3, 4, 5)] + self.assertEqual(actual, expected) + + def test_longest(self): + a_1 = [0, 1, 2, 3] + a_2 = [0, 1, 2, 3, 4, 5] + a_3 = [0, 1, 2, 3, 4, 5, 6, 7] + actual = list( + mi.zip_offset(a_1, a_2, a_3, offsets=(-1, 0, 1), longest=True) + ) + expected = [ + (None, 0, 1), + (0, 1, 2), + (1, 2, 3), + (2, 3, 4), + (3, 4, 5), + (None, 5, 6), + (None, None, 7), + ] + self.assertEqual(actual, expected) + + def test_mismatch(self): + iterables = [0, 1, 2], [2, 3, 4] + offsets = (-1, 0, 1) + self.assertRaises( + ValueError, + lambda: list(mi.zip_offset(*iterables, offsets=offsets)) + ) + + +class UnzipTests(TestCase): + """Tests for unzip()""" + + def test_empty_iterable(self): + self.assertEqual(list(mi.unzip([])), []) + # in reality zip([], [], []) is equivalent to iter([]) + # but it doesn't hurt to test both + self.assertEqual(list(mi.unzip(zip([], [], []))), []) + + def test_length_one_iterable(self): + xs, ys, zs = mi.unzip(zip([1], [2], [3])) + self.assertEqual(list(xs), [1]) + self.assertEqual(list(ys), [2]) + self.assertEqual(list(zs), [3]) + + def test_normal_case(self): + xs, ys, zs = range(10), range(1, 11), range(2, 12) + zipped = zip(xs, ys, zs) + xs, ys, zs = mi.unzip(zipped) + self.assertEqual(list(xs), list(range(10))) + self.assertEqual(list(ys), list(range(1, 11))) + self.assertEqual(list(zs), list(range(2, 12))) + + def test_improperly_zipped(self): + zipped = iter([(1, 2, 3), (4, 5), (6,)]) + xs, ys, zs = mi.unzip(zipped) + self.assertEqual(list(xs), [1, 4, 6]) + self.assertEqual(list(ys), [2, 5]) + self.assertEqual(list(zs), [3]) + + def test_increasingly_zipped(self): + zipped = iter([(1, 2), (3, 4, 5), (6, 7, 8, 9)]) + unzipped = mi.unzip(zipped) + # from the docstring: + # len(first tuple) is the number of iterables zipped + self.assertEqual(len(unzipped), 2) + xs, ys = unzipped + self.assertEqual(list(xs), [1, 3, 6]) + self.assertEqual(list(ys), [2, 4, 7]) + + +class SortTogetherTest(TestCase): + """Tests for sort_together()""" + + def test_key_list(self): + """tests `key_list` including default, iterables include duplicates""" + iterables = [ + ['GA', 'GA', 'GA', 'CT', 'CT', 'CT'], + ['May', 'Aug.', 'May', 'June', 'July', 'July'], + [97, 20, 100, 70, 100, 20] + ] + + self.assertEqual( + mi.sort_together(iterables), + [ + ('CT', 'CT', 'CT', 'GA', 'GA', 'GA'), + ('June', 'July', 'July', 'May', 'Aug.', 'May'), + (70, 100, 20, 97, 20, 100) + ] + ) + + self.assertEqual( + mi.sort_together(iterables, key_list=(0, 1)), + [ + ('CT', 'CT', 'CT', 'GA', 'GA', 'GA'), + ('July', 'July', 'June', 'Aug.', 'May', 'May'), + (100, 20, 70, 20, 97, 100) + ] + ) + + self.assertEqual( + mi.sort_together(iterables, key_list=(0, 1, 2)), + [ + ('CT', 'CT', 'CT', 'GA', 'GA', 'GA'), + ('July', 'July', 'June', 'Aug.', 'May', 'May'), + (20, 100, 70, 20, 97, 100) + ] + ) + + self.assertEqual( + mi.sort_together(iterables, key_list=(2,)), + [ + ('GA', 'CT', 'CT', 'GA', 'GA', 'CT'), + ('Aug.', 'July', 'June', 'May', 'May', 'July'), + (20, 20, 70, 97, 100, 100) + ] + ) + + def test_invalid_key_list(self): + """tests `key_list` for indexes not available in `iterables`""" + iterables = [ + ['GA', 'GA', 'GA', 'CT', 'CT', 'CT'], + ['May', 'Aug.', 'May', 'June', 'July', 'July'], + [97, 20, 100, 70, 100, 20] + ] + + self.assertRaises( + IndexError, lambda: mi.sort_together(iterables, key_list=(5,)) + ) + + def test_reverse(self): + """tests `reverse` to ensure a reverse sort for `key_list` iterables""" + iterables = [ + ['GA', 'GA', 'GA', 'CT', 'CT', 'CT'], + ['May', 'Aug.', 'May', 'June', 'July', 'July'], + [97, 20, 100, 70, 100, 20] + ] + + self.assertEqual( + mi.sort_together(iterables, key_list=(0, 1, 2), reverse=True), + [('GA', 'GA', 'GA', 'CT', 'CT', 'CT'), + ('May', 'May', 'Aug.', 'June', 'July', 'July'), + (100, 97, 20, 70, 100, 20)] + ) + + def test_uneven_iterables(self): + """tests trimming of iterables to the shortest length before sorting""" + iterables = [['GA', 'GA', 'GA', 'CT', 'CT', 'CT', 'MA'], + ['May', 'Aug.', 'May', 'June', 'July', 'July'], + [97, 20, 100, 70, 100, 20, 0]] + + self.assertEqual( + mi.sort_together(iterables), + [ + ('CT', 'CT', 'CT', 'GA', 'GA', 'GA'), + ('June', 'July', 'July', 'May', 'Aug.', 'May'), + (70, 100, 20, 97, 20, 100) + ] + ) + + +class DivideTest(TestCase): + """Tests for divide()""" + + def test_invalid_n(self): + self.assertRaises(ValueError, lambda: mi.divide(-1, [1, 2, 3])) + self.assertRaises(ValueError, lambda: mi.divide(0, [1, 2, 3])) + + def test_basic(self): + iterable = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] + + for n, expected in [ + (1, [iterable]), + (2, [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]]), + (3, [[1, 2, 3, 4], [5, 6, 7], [8, 9, 10]]), + (10, [[n] for n in range(1, 10 + 1)]), + ]: + self.assertEqual( + [list(x) for x in mi.divide(n, iterable)], expected + ) + + def test_large_n(self): + iterable = [1, 2, 3, 4] + self.assertEqual( + [list(x) for x in mi.divide(6, iterable)], + [[1], [2], [3], [4], [], []] + ) + + +class TestAlwaysIterable(TestCase): + """Tests for always_iterable()""" + def test_single(self): + self.assertEqual(list(mi.always_iterable(1)), [1]) + + def test_strings(self): + for obj in ['foo', b'bar', 'baz']: + actual = list(mi.always_iterable(obj)) + expected = [obj] + self.assertEqual(actual, expected) + + def test_base_type(self): + dict_obj = {'a': 1, 'b': 2} + str_obj = '123' + + # Default: dicts are iterable like they normally are + default_actual = list(mi.always_iterable(dict_obj)) + default_expected = list(dict_obj) + self.assertEqual(default_actual, default_expected) + + # Unitary types set: dicts are not iterable + custom_actual = list(mi.always_iterable(dict_obj, base_type=dict)) + custom_expected = [dict_obj] + self.assertEqual(custom_actual, custom_expected) + + # With unitary types set, strings are iterable + str_actual = list(mi.always_iterable(str_obj, base_type=None)) + str_expected = list(str_obj) + self.assertEqual(str_actual, str_expected) + + def test_iterables(self): + self.assertEqual(list(mi.always_iterable([0, 1])), [0, 1]) + self.assertEqual( + list(mi.always_iterable([0, 1], base_type=list)), [[0, 1]] + ) + self.assertEqual( + list(mi.always_iterable(iter('foo'))), ['f', 'o', 'o'] + ) + self.assertEqual(list(mi.always_iterable([])), []) + + def test_none(self): + self.assertEqual(list(mi.always_iterable(None)), []) + + def test_generator(self): + def _gen(): + yield 0 + yield 1 + + self.assertEqual(list(mi.always_iterable(_gen())), [0, 1]) + + +class AdjacentTests(TestCase): + def test_typical(self): + actual = list(mi.adjacent(lambda x: x % 5 == 0, range(10))) + expected = [(True, 0), (True, 1), (False, 2), (False, 3), (True, 4), + (True, 5), (True, 6), (False, 7), (False, 8), (False, 9)] + self.assertEqual(actual, expected) + + def test_empty_iterable(self): + actual = list(mi.adjacent(lambda x: x % 5 == 0, [])) + expected = [] + self.assertEqual(actual, expected) + + def test_length_one(self): + actual = list(mi.adjacent(lambda x: x % 5 == 0, [0])) + expected = [(True, 0)] + self.assertEqual(actual, expected) + + actual = list(mi.adjacent(lambda x: x % 5 == 0, [1])) + expected = [(False, 1)] + self.assertEqual(actual, expected) + + def test_consecutive_true(self): + """Test that when the predicate matches multiple consecutive elements + it doesn't repeat elements in the output""" + actual = list(mi.adjacent(lambda x: x % 5 < 2, range(10))) + expected = [(True, 0), (True, 1), (True, 2), (False, 3), (True, 4), + (True, 5), (True, 6), (True, 7), (False, 8), (False, 9)] + self.assertEqual(actual, expected) + + def test_distance(self): + actual = list(mi.adjacent(lambda x: x % 5 == 0, range(10), distance=2)) + expected = [(True, 0), (True, 1), (True, 2), (True, 3), (True, 4), + (True, 5), (True, 6), (True, 7), (False, 8), (False, 9)] + self.assertEqual(actual, expected) + + actual = list(mi.adjacent(lambda x: x % 5 == 0, range(10), distance=3)) + expected = [(True, 0), (True, 1), (True, 2), (True, 3), (True, 4), + (True, 5), (True, 6), (True, 7), (True, 8), (False, 9)] + self.assertEqual(actual, expected) + + def test_large_distance(self): + """Test distance larger than the length of the iterable""" + iterable = range(10) + actual = list(mi.adjacent(lambda x: x % 5 == 4, iterable, distance=20)) + expected = list(zip(repeat(True), iterable)) + self.assertEqual(actual, expected) + + actual = list(mi.adjacent(lambda x: False, iterable, distance=20)) + expected = list(zip(repeat(False), iterable)) + self.assertEqual(actual, expected) + + def test_zero_distance(self): + """Test that adjacent() reduces to zip+map when distance is 0""" + iterable = range(1000) + predicate = lambda x: x % 4 == 2 + actual = mi.adjacent(predicate, iterable, 0) + expected = zip(map(predicate, iterable), iterable) + self.assertTrue(all(a == e for a, e in zip(actual, expected))) + + def test_negative_distance(self): + """Test that adjacent() raises an error with negative distance""" + pred = lambda x: x + self.assertRaises( + ValueError, lambda: mi.adjacent(pred, range(1000), -1) + ) + self.assertRaises( + ValueError, lambda: mi.adjacent(pred, range(10), -10) + ) + + def test_grouping(self): + """Test interaction of adjacent() with groupby_transform()""" + iterable = mi.adjacent(lambda x: x % 5 == 0, range(10)) + grouper = mi.groupby_transform(iterable, itemgetter(0), itemgetter(1)) + actual = [(k, list(g)) for k, g in grouper] + expected = [ + (True, [0, 1]), + (False, [2, 3]), + (True, [4, 5, 6]), + (False, [7, 8, 9]), + ] + self.assertEqual(actual, expected) + + def test_call_once(self): + """Test that the predicate is only called once per item.""" + already_seen = set() + iterable = range(10) + + def predicate(item): + self.assertNotIn(item, already_seen) + already_seen.add(item) + return True + + actual = list(mi.adjacent(predicate, iterable)) + expected = [(True, x) for x in iterable] + self.assertEqual(actual, expected) + + +class GroupByTransformTests(TestCase): + def assertAllGroupsEqual(self, groupby1, groupby2): + """Compare two groupby objects for equality, both keys and groups.""" + for a, b in zip(groupby1, groupby2): + key1, group1 = a + key2, group2 = b + self.assertEqual(key1, key2) + self.assertListEqual(list(group1), list(group2)) + self.assertRaises(StopIteration, lambda: next(groupby1)) + self.assertRaises(StopIteration, lambda: next(groupby2)) + + def test_default_funcs(self): + """Test that groupby_transform() with default args mimics groupby()""" + iterable = [(x // 5, x) for x in range(1000)] + actual = mi.groupby_transform(iterable) + expected = groupby(iterable) + self.assertAllGroupsEqual(actual, expected) + + def test_valuefunc(self): + iterable = [(int(x / 5), int(x / 3), x) for x in range(10)] + + # Test the standard usage of grouping one iterable using another's keys + grouper = mi.groupby_transform( + iterable, keyfunc=itemgetter(0), valuefunc=itemgetter(-1) + ) + actual = [(k, list(g)) for k, g in grouper] + expected = [(0, [0, 1, 2, 3, 4]), (1, [5, 6, 7, 8, 9])] + self.assertEqual(actual, expected) + + grouper = mi.groupby_transform( + iterable, keyfunc=itemgetter(1), valuefunc=itemgetter(-1) + ) + actual = [(k, list(g)) for k, g in grouper] + expected = [(0, [0, 1, 2]), (1, [3, 4, 5]), (2, [6, 7, 8]), (3, [9])] + self.assertEqual(actual, expected) + + # and now for something a little different + d = dict(zip(range(10), 'abcdefghij')) + grouper = mi.groupby_transform( + range(10), keyfunc=lambda x: x // 5, valuefunc=d.get + ) + actual = [(k, ''.join(g)) for k, g in grouper] + expected = [(0, 'abcde'), (1, 'fghij')] + self.assertEqual(actual, expected) + + def test_no_valuefunc(self): + iterable = range(1000) + + def key(x): + return x // 5 + + actual = mi.groupby_transform(iterable, key, valuefunc=None) + expected = groupby(iterable, key) + self.assertAllGroupsEqual(actual, expected) + + actual = mi.groupby_transform(iterable, key) # default valuefunc + expected = groupby(iterable, key) + self.assertAllGroupsEqual(actual, expected) + + +class NumericRangeTests(TestCase): + def test_basic(self): + for args, expected in [ + ((4,), [0, 1, 2, 3]), + ((4.0,), [0.0, 1.0, 2.0, 3.0]), + ((1.0, 4), [1.0, 2.0, 3.0]), + ((1, 4.0), [1, 2, 3]), + ((1.0, 5), [1.0, 2.0, 3.0, 4.0]), + ((0, 20, 5), [0, 5, 10, 15]), + ((0, 20, 5.0), [0.0, 5.0, 10.0, 15.0]), + ((0, 10, 3), [0, 3, 6, 9]), + ((0, 10, 3.0), [0.0, 3.0, 6.0, 9.0]), + ((0, -5, -1), [0, -1, -2, -3, -4]), + ((0.0, -5, -1), [0.0, -1.0, -2.0, -3.0, -4.0]), + ((1, 2, Fraction(1, 2)), [Fraction(1, 1), Fraction(3, 2)]), + ((0,), []), + ((0.0,), []), + ((1, 0), []), + ((1.0, 0.0), []), + ((Fraction(2, 1),), [Fraction(0, 1), Fraction(1, 1)]), + ((Decimal('2.0'),), [Decimal('0.0'), Decimal('1.0')]), + ]: + actual = list(mi.numeric_range(*args)) + self.assertEqual(actual, expected) + self.assertTrue( + all(type(a) == type(e) for a, e in zip(actual, expected)) + ) + + def test_arg_count(self): + self.assertRaises(TypeError, lambda: list(mi.numeric_range())) + self.assertRaises( + TypeError, lambda: list(mi.numeric_range(0, 1, 2, 3)) + ) + + def test_zero_step(self): + self.assertRaises( + ValueError, lambda: list(mi.numeric_range(1, 2, 0)) + ) + + +class CountCycleTests(TestCase): + def test_basic(self): + expected = [ + (0, 'a'), (0, 'b'), (0, 'c'), + (1, 'a'), (1, 'b'), (1, 'c'), + (2, 'a'), (2, 'b'), (2, 'c'), + ] + for actual in [ + mi.take(9, mi.count_cycle('abc')), # n=None + list(mi.count_cycle('abc', 3)), # n=3 + ]: + self.assertEqual(actual, expected) + + def test_empty(self): + self.assertEqual(list(mi.count_cycle('')), []) + self.assertEqual(list(mi.count_cycle('', 2)), []) + + def test_negative(self): + self.assertEqual(list(mi.count_cycle('abc', -3)), []) + + +class LocateTests(TestCase): + def test_default_pred(self): + iterable = [0, 1, 1, 0, 1, 0, 0] + actual = list(mi.locate(iterable)) + expected = [1, 2, 4] + self.assertEqual(actual, expected) + + def test_no_matches(self): + iterable = [0, 0, 0] + actual = list(mi.locate(iterable)) + expected = [] + self.assertEqual(actual, expected) + + def test_custom_pred(self): + iterable = ['0', 1, 1, '0', 1, '0', '0'] + pred = lambda x: x == '0' + actual = list(mi.locate(iterable, pred)) + expected = [0, 3, 5, 6] + self.assertEqual(actual, expected) + + def test_window_size(self): + iterable = ['0', 1, 1, '0', 1, '0', '0'] + pred = lambda *args: args == ('0', 1) + actual = list(mi.locate(iterable, pred, window_size=2)) + expected = [0, 3] + self.assertEqual(actual, expected) + + def test_window_size_large(self): + iterable = [1, 2, 3, 4] + pred = lambda a, b, c, d, e: True + actual = list(mi.locate(iterable, pred, window_size=5)) + expected = [0] + self.assertEqual(actual, expected) + + def test_window_size_zero(self): + iterable = [1, 2, 3, 4] + pred = lambda: True + with self.assertRaises(ValueError): + list(mi.locate(iterable, pred, window_size=0)) + + +class StripFunctionTests(TestCase): + def test_hashable(self): + iterable = list('www.example.com') + pred = lambda x: x in set('cmowz.') + + self.assertEqual(list(mi.lstrip(iterable, pred)), list('example.com')) + self.assertEqual(list(mi.rstrip(iterable, pred)), list('www.example')) + self.assertEqual(list(mi.strip(iterable, pred)), list('example')) + + def test_not_hashable(self): + iterable = [ + list('http://'), list('www'), list('.example'), list('.com') + ] + pred = lambda x: x in [list('http://'), list('www'), list('.com')] + + self.assertEqual(list(mi.lstrip(iterable, pred)), iterable[2:]) + self.assertEqual(list(mi.rstrip(iterable, pred)), iterable[:3]) + self.assertEqual(list(mi.strip(iterable, pred)), iterable[2: 3]) + + def test_math(self): + iterable = [0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2] + pred = lambda x: x <= 2 + + self.assertEqual(list(mi.lstrip(iterable, pred)), iterable[3:]) + self.assertEqual(list(mi.rstrip(iterable, pred)), iterable[:-3]) + self.assertEqual(list(mi.strip(iterable, pred)), iterable[3:-3]) + + +class IsliceExtendedTests(TestCase): + def test_all(self): + iterable = ['0', '1', '2', '3', '4', '5'] + indexes = list(range(-4, len(iterable) + 4)) + [None] + steps = [1, 2, 3, 4, -1, -2, -3, 4] + for slice_args in product(indexes, indexes, steps): + try: + actual = list(mi.islice_extended(iterable, *slice_args)) + except Exception as e: + self.fail((slice_args, e)) + + expected = iterable[slice(*slice_args)] + self.assertEqual(actual, expected, slice_args) + + def test_zero_step(self): + with self.assertRaises(ValueError): + list(mi.islice_extended([1, 2, 3], 0, 1, 0)) + + +class ConsecutiveGroupsTest(TestCase): + def test_numbers(self): + iterable = [-10, -8, -7, -6, 1, 2, 4, 5, -1, 7] + actual = [list(g) for g in mi.consecutive_groups(iterable)] + expected = [[-10], [-8, -7, -6], [1, 2], [4, 5], [-1], [7]] + self.assertEqual(actual, expected) + + def test_custom_ordering(self): + iterable = ['1', '10', '11', '20', '21', '22', '30', '31'] + ordering = lambda x: int(x) + actual = [list(g) for g in mi.consecutive_groups(iterable, ordering)] + expected = [['1'], ['10', '11'], ['20', '21', '22'], ['30', '31']] + self.assertEqual(actual, expected) + + def test_exotic_ordering(self): + iterable = [ + ('a', 'b', 'c', 'd'), + ('a', 'c', 'b', 'd'), + ('a', 'c', 'd', 'b'), + ('a', 'd', 'b', 'c'), + ('d', 'b', 'c', 'a'), + ('d', 'c', 'a', 'b'), + ] + ordering = list(permutations('abcd')).index + actual = [list(g) for g in mi.consecutive_groups(iterable, ordering)] + expected = [ + [('a', 'b', 'c', 'd')], + [('a', 'c', 'b', 'd'), ('a', 'c', 'd', 'b'), ('a', 'd', 'b', 'c')], + [('d', 'b', 'c', 'a'), ('d', 'c', 'a', 'b')], + ] + self.assertEqual(actual, expected) + + +class DifferenceTest(TestCase): + def test_normal(self): + iterable = [10, 20, 30, 40, 50] + actual = list(mi.difference(iterable)) + expected = [10, 10, 10, 10, 10] + self.assertEqual(actual, expected) + + def test_custom(self): + iterable = [10, 20, 30, 40, 50] + actual = list(mi.difference(iterable, add)) + expected = [10, 30, 50, 70, 90] + self.assertEqual(actual, expected) + + def test_roundtrip(self): + original = list(range(100)) + accumulated = mi.accumulate(original) + actual = list(mi.difference(accumulated)) + self.assertEqual(actual, original) + + def test_one(self): + self.assertEqual(list(mi.difference([0])), [0]) + + def test_empty(self): + self.assertEqual(list(mi.difference([])), []) + + +class SeekableTest(TestCase): + def test_exhaustion_reset(self): + iterable = [str(n) for n in range(10)] + + s = mi.seekable(iterable) + self.assertEqual(list(s), iterable) # Normal iteration + self.assertEqual(list(s), []) # Iterable is exhausted + + s.seek(0) + self.assertEqual(list(s), iterable) # Back in action + + def test_partial_reset(self): + iterable = [str(n) for n in range(10)] + + s = mi.seekable(iterable) + self.assertEqual(mi.take(5, s), iterable[:5]) # Normal iteration + + s.seek(1) + self.assertEqual(list(s), iterable[1:]) # Get the rest of the iterable + + def test_forward(self): + iterable = [str(n) for n in range(10)] + + s = mi.seekable(iterable) + self.assertEqual(mi.take(1, s), iterable[:1]) # Normal iteration + + s.seek(3) # Skip over index 2 + self.assertEqual(list(s), iterable[3:]) # Result is similar to slicing + + s.seek(0) # Back to 0 + self.assertEqual(list(s), iterable) # No difference in result + + def test_past_end(self): + iterable = [str(n) for n in range(10)] + + s = mi.seekable(iterable) + self.assertEqual(mi.take(1, s), iterable[:1]) # Normal iteration + + s.seek(20) + self.assertEqual(list(s), []) # Iterable is exhausted + + s.seek(0) # Back to 0 + self.assertEqual(list(s), iterable) # No difference in result + + def test_elements(self): + iterable = map(str, count()) + + s = mi.seekable(iterable) + mi.take(10, s) + + elements = s.elements() + self.assertEqual( + [elements[i] for i in range(10)], [str(n) for n in range(10)] + ) + self.assertEqual(len(elements), 10) + + mi.take(10, s) + self.assertEqual(list(elements), [str(n) for n in range(20)]) + + +class SequenceViewTests(TestCase): + def test_init(self): + view = mi.SequenceView((1, 2, 3)) + self.assertEqual(repr(view), "SequenceView((1, 2, 3))") + self.assertRaises(TypeError, lambda: mi.SequenceView({})) + + def test_update(self): + seq = [1, 2, 3] + view = mi.SequenceView(seq) + self.assertEqual(len(view), 3) + self.assertEqual(repr(view), "SequenceView([1, 2, 3])") + + seq.pop() + self.assertEqual(len(view), 2) + self.assertEqual(repr(view), "SequenceView([1, 2])") + + def test_indexing(self): + seq = ('a', 'b', 'c', 'd', 'e', 'f') + view = mi.SequenceView(seq) + for i in range(-len(seq), len(seq)): + self.assertEqual(view[i], seq[i]) + + def test_slicing(self): + seq = ('a', 'b', 'c', 'd', 'e', 'f') + view = mi.SequenceView(seq) + n = len(seq) + indexes = list(range(-n - 1, n + 1)) + [None] + steps = list(range(-n, n + 1)) + steps.remove(0) + for slice_args in product(indexes, indexes, steps): + i = slice(*slice_args) + self.assertEqual(view[i], seq[i]) + + def test_abc_methods(self): + # collections.Sequence should provide all of this functionality + seq = ('a', 'b', 'c', 'd', 'e', 'f', 'f') + view = mi.SequenceView(seq) + + # __contains__ + self.assertIn('b', view) + self.assertNotIn('g', view) + + # __iter__ + self.assertEqual(list(iter(view)), list(seq)) + + # __reversed__ + self.assertEqual(list(reversed(view)), list(reversed(seq))) + + # index + self.assertEqual(view.index('b'), 1) + + # count + self.assertEqual(seq.count('f'), 2) + + +class RunLengthTest(TestCase): + def test_encode(self): + iterable = (int(str(n)[0]) for n in count(800)) + actual = mi.take(4, mi.run_length.encode(iterable)) + expected = [(8, 100), (9, 100), (1, 1000), (2, 1000)] + self.assertEqual(actual, expected) + + def test_decode(self): + iterable = [('d', 4), ('c', 3), ('b', 2), ('a', 1)] + actual = ''.join(mi.run_length.decode(iterable)) + expected = 'ddddcccbba' + self.assertEqual(actual, expected) + + +class ExactlyNTests(TestCase): + """Tests for ``exactly_n()``""" + + def test_true(self): + """Iterable has ``n`` ``True`` elements""" + self.assertTrue(mi.exactly_n([True, False, True], 2)) + self.assertTrue(mi.exactly_n([1, 1, 1, 0], 3)) + self.assertTrue(mi.exactly_n([False, False], 0)) + self.assertTrue(mi.exactly_n(range(100), 10, lambda x: x < 10)) + + def test_false(self): + """Iterable does not have ``n`` ``True`` elements""" + self.assertFalse(mi.exactly_n([True, False, False], 2)) + self.assertFalse(mi.exactly_n([True, True, False], 1)) + self.assertFalse(mi.exactly_n([False], 1)) + self.assertFalse(mi.exactly_n([True], -1)) + self.assertFalse(mi.exactly_n(repeat(True), 100)) + + def test_empty(self): + """Return ``True`` if the iterable is empty and ``n`` is 0""" + self.assertTrue(mi.exactly_n([], 0)) + self.assertFalse(mi.exactly_n([], 1)) + + +class AlwaysReversibleTests(TestCase): + """Tests for ``always_reversible()``""" + + def test_regular_reversed(self): + self.assertEqual(list(reversed(range(10))), + list(mi.always_reversible(range(10)))) + self.assertEqual(list(reversed([1, 2, 3])), + list(mi.always_reversible([1, 2, 3]))) + self.assertEqual(reversed([1, 2, 3]).__class__, + mi.always_reversible([1, 2, 3]).__class__) + + def test_nonseq_reversed(self): + # Create a non-reversible generator from a sequence + with self.assertRaises(TypeError): + reversed(x for x in range(10)) + + self.assertEqual(list(reversed(range(10))), + list(mi.always_reversible(x for x in range(10)))) + self.assertEqual(list(reversed([1, 2, 3])), + list(mi.always_reversible(x for x in [1, 2, 3]))) + self.assertNotEqual(reversed((1, 2)).__class__, + mi.always_reversible(x for x in (1, 2)).__class__) + + +class CircularShiftsTests(TestCase): + def test_empty(self): + # empty iterable -> empty list + self.assertEqual(list(mi.circular_shifts([])), []) + + def test_simple_circular_shifts(self): + # test the a simple iterator case + self.assertEqual( + mi.circular_shifts(range(4)), + [(0, 1, 2, 3), (1, 2, 3, 0), (2, 3, 0, 1), (3, 0, 1, 2)] + ) + + def test_duplicates(self): + # test non-distinct entries + self.assertEqual( + mi.circular_shifts([0, 1, 0, 1]), + [(0, 1, 0, 1), (1, 0, 1, 0), (0, 1, 0, 1), (1, 0, 1, 0)] + ) + + +class MakeDecoratorTests(TestCase): + def test_basic(self): + slicer = mi.make_decorator(islice) + + @slicer(1, 10, 2) + def user_function(arg_1, arg_2, kwarg_1=None): + self.assertEqual(arg_1, 'arg_1') + self.assertEqual(arg_2, 'arg_2') + self.assertEqual(kwarg_1, 'kwarg_1') + return map(str, count()) + + it = user_function('arg_1', 'arg_2', kwarg_1='kwarg_1') + actual = list(it) + expected = ['1', '3', '5', '7', '9'] + self.assertEqual(actual, expected) + + def test_result_index(self): + def stringify(*args, **kwargs): + self.assertEqual(args[0], 'arg_0') + iterable = args[1] + self.assertEqual(args[2], 'arg_2') + self.assertEqual(kwargs['kwarg_1'], 'kwarg_1') + return map(str, iterable) + + stringifier = mi.make_decorator(stringify, result_index=1) + + @stringifier('arg_0', 'arg_2', kwarg_1='kwarg_1') + def user_function(n): + return count(n) + + it = user_function(1) + actual = mi.take(5, it) + expected = ['1', '2', '3', '4', '5'] + self.assertEqual(actual, expected) + + def test_wrap_class(self): + seeker = mi.make_decorator(mi.seekable) + + @seeker() + def user_function(n): + return map(str, range(n)) + + it = user_function(5) + self.assertEqual(list(it), ['0', '1', '2', '3', '4']) + + it.seek(0) + self.assertEqual(list(it), ['0', '1', '2', '3', '4']) + + +class MapReduceTests(TestCase): + def test_default(self): + iterable = (str(x) for x in range(5)) + keyfunc = lambda x: int(x) // 2 + actual = sorted(mi.map_reduce(iterable, keyfunc).items()) + expected = [(0, ['0', '1']), (1, ['2', '3']), (2, ['4'])] + self.assertEqual(actual, expected) + + def test_valuefunc(self): + iterable = (str(x) for x in range(5)) + keyfunc = lambda x: int(x) // 2 + valuefunc = int + actual = sorted(mi.map_reduce(iterable, keyfunc, valuefunc).items()) + expected = [(0, [0, 1]), (1, [2, 3]), (2, [4])] + self.assertEqual(actual, expected) + + def test_reducefunc(self): + iterable = (str(x) for x in range(5)) + keyfunc = lambda x: int(x) // 2 + valuefunc = int + reducefunc = lambda value_list: reduce(mul, value_list, 1) + actual = sorted( + mi.map_reduce(iterable, keyfunc, valuefunc, reducefunc).items() + ) + expected = [(0, 0), (1, 6), (2, 4)] + self.assertEqual(actual, expected) + + def test_ret(self): + d = mi.map_reduce([1, 0, 2, 0, 1, 0], bool) + self.assertEqual(d, {False: [0, 0, 0], True: [1, 2, 1]}) + self.assertRaises(KeyError, lambda: d[None].append(1)) + + +class RlocateTests(TestCase): + def test_default_pred(self): + iterable = [0, 1, 1, 0, 1, 0, 0] + for it in (iterable[:], iter(iterable)): + actual = list(mi.rlocate(it)) + expected = [4, 2, 1] + self.assertEqual(actual, expected) + + def test_no_matches(self): + iterable = [0, 0, 0] + for it in (iterable[:], iter(iterable)): + actual = list(mi.rlocate(it)) + expected = [] + self.assertEqual(actual, expected) + + def test_custom_pred(self): + iterable = ['0', 1, 1, '0', 1, '0', '0'] + pred = lambda x: x == '0' + for it in (iterable[:], iter(iterable)): + actual = list(mi.rlocate(it, pred)) + expected = [6, 5, 3, 0] + self.assertEqual(actual, expected) + + def test_efficient_reversal(self): + iterable = range(9 ** 9) # Is efficiently reversible + target = 9 ** 9 - 2 + pred = lambda x: x == target # Find-able from the right + actual = next(mi.rlocate(iterable, pred)) + self.assertEqual(actual, target) + + def test_window_size(self): + iterable = ['0', 1, 1, '0', 1, '0', '0'] + pred = lambda *args: args == ('0', 1) + for it in (iterable, iter(iterable)): + actual = list(mi.rlocate(it, pred, window_size=2)) + expected = [3, 0] + self.assertEqual(actual, expected) + + def test_window_size_large(self): + iterable = [1, 2, 3, 4] + pred = lambda a, b, c, d, e: True + for it in (iterable, iter(iterable)): + actual = list(mi.rlocate(iterable, pred, window_size=5)) + expected = [0] + self.assertEqual(actual, expected) + + def test_window_size_zero(self): + iterable = [1, 2, 3, 4] + pred = lambda: True + for it in (iterable, iter(iterable)): + with self.assertRaises(ValueError): + list(mi.locate(iterable, pred, window_size=0)) + + +class ReplaceTests(TestCase): + def test_basic(self): + iterable = range(10) + pred = lambda x: x % 2 == 0 + substitutes = [] + actual = list(mi.replace(iterable, pred, substitutes)) + expected = [1, 3, 5, 7, 9] + self.assertEqual(actual, expected) + + def test_count(self): + iterable = range(10) + pred = lambda x: x % 2 == 0 + substitutes = [] + actual = list(mi.replace(iterable, pred, substitutes, count=4)) + expected = [1, 3, 5, 7, 8, 9] + self.assertEqual(actual, expected) + + def test_window_size(self): + iterable = range(10) + pred = lambda *args: args == (0, 1, 2) + substitutes = [] + actual = list(mi.replace(iterable, pred, substitutes, window_size=3)) + expected = [3, 4, 5, 6, 7, 8, 9] + self.assertEqual(actual, expected) + + def test_window_size_end(self): + iterable = range(10) + pred = lambda *args: args == (7, 8, 9) + substitutes = [] + actual = list(mi.replace(iterable, pred, substitutes, window_size=3)) + expected = [0, 1, 2, 3, 4, 5, 6] + self.assertEqual(actual, expected) + + def test_window_size_count(self): + iterable = range(10) + pred = lambda *args: (args == (0, 1, 2)) or (args == (7, 8, 9)) + substitutes = [] + actual = list( + mi.replace(iterable, pred, substitutes, count=1, window_size=3) + ) + expected = [3, 4, 5, 6, 7, 8, 9] + self.assertEqual(actual, expected) + + def test_window_size_large(self): + iterable = range(4) + pred = lambda a, b, c, d, e: True + substitutes = [5, 6, 7] + actual = list(mi.replace(iterable, pred, substitutes, window_size=5)) + expected = [5, 6, 7] + self.assertEqual(actual, expected) + + def test_window_size_zero(self): + iterable = range(10) + pred = lambda *args: True + substitutes = [] + with self.assertRaises(ValueError): + list(mi.replace(iterable, pred, substitutes, window_size=0)) + + def test_iterable_substitutes(self): + iterable = range(5) + pred = lambda x: x % 2 == 0 + substitutes = iter('__') + actual = list(mi.replace(iterable, pred, substitutes)) + expected = ['_', '_', 1, '_', '_', 3, '_', '_'] + self.assertEqual(actual, expected) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/more_itertools/tests/test_recipes.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/more_itertools/tests/test_recipes.py new file mode 100644 index 0000000000000000000000000000000000000000..b3cfb62f4668b22bc2b741c377d476a5d3c53638 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/more_itertools/tests/test_recipes.py @@ -0,0 +1,616 @@ +from doctest import DocTestSuite +from unittest import TestCase + +from itertools import combinations +from six.moves import range + +import more_itertools as mi + + +def load_tests(loader, tests, ignore): + # Add the doctests + tests.addTests(DocTestSuite('more_itertools.recipes')) + return tests + + +class AccumulateTests(TestCase): + """Tests for ``accumulate()``""" + + def test_empty(self): + """Test that an empty input returns an empty output""" + self.assertEqual(list(mi.accumulate([])), []) + + def test_default(self): + """Test accumulate with the default function (addition)""" + self.assertEqual(list(mi.accumulate([1, 2, 3])), [1, 3, 6]) + + def test_bogus_function(self): + """Test accumulate with an invalid function""" + with self.assertRaises(TypeError): + list(mi.accumulate([1, 2, 3], func=lambda x: x)) + + def test_custom_function(self): + """Test accumulate with a custom function""" + self.assertEqual( + list(mi.accumulate((1, 2, 3, 2, 1), func=max)), [1, 2, 3, 3, 3] + ) + + +class TakeTests(TestCase): + """Tests for ``take()``""" + + def test_simple_take(self): + """Test basic usage""" + t = mi.take(5, range(10)) + self.assertEqual(t, [0, 1, 2, 3, 4]) + + def test_null_take(self): + """Check the null case""" + t = mi.take(0, range(10)) + self.assertEqual(t, []) + + def test_negative_take(self): + """Make sure taking negative items results in a ValueError""" + self.assertRaises(ValueError, lambda: mi.take(-3, range(10))) + + def test_take_too_much(self): + """Taking more than an iterator has remaining should return what the + iterator has remaining. + + """ + t = mi.take(10, range(5)) + self.assertEqual(t, [0, 1, 2, 3, 4]) + + +class TabulateTests(TestCase): + """Tests for ``tabulate()``""" + + def test_simple_tabulate(self): + """Test the happy path""" + t = mi.tabulate(lambda x: x) + f = tuple([next(t) for _ in range(3)]) + self.assertEqual(f, (0, 1, 2)) + + def test_count(self): + """Ensure tabulate accepts specific count""" + t = mi.tabulate(lambda x: 2 * x, -1) + f = (next(t), next(t), next(t)) + self.assertEqual(f, (-2, 0, 2)) + + +class TailTests(TestCase): + """Tests for ``tail()``""" + + def test_greater(self): + """Length of iterable is greater than requested tail""" + self.assertEqual(list(mi.tail(3, 'ABCDEFG')), ['E', 'F', 'G']) + + def test_equal(self): + """Length of iterable is equal to the requested tail""" + self.assertEqual( + list(mi.tail(7, 'ABCDEFG')), ['A', 'B', 'C', 'D', 'E', 'F', 'G'] + ) + + def test_less(self): + """Length of iterable is less than requested tail""" + self.assertEqual( + list(mi.tail(8, 'ABCDEFG')), ['A', 'B', 'C', 'D', 'E', 'F', 'G'] + ) + + +class ConsumeTests(TestCase): + """Tests for ``consume()``""" + + def test_sanity(self): + """Test basic functionality""" + r = (x for x in range(10)) + mi.consume(r, 3) + self.assertEqual(3, next(r)) + + def test_null_consume(self): + """Check the null case""" + r = (x for x in range(10)) + mi.consume(r, 0) + self.assertEqual(0, next(r)) + + def test_negative_consume(self): + """Check that negative consumsion throws an error""" + r = (x for x in range(10)) + self.assertRaises(ValueError, lambda: mi.consume(r, -1)) + + def test_total_consume(self): + """Check that iterator is totally consumed by default""" + r = (x for x in range(10)) + mi.consume(r) + self.assertRaises(StopIteration, lambda: next(r)) + + +class NthTests(TestCase): + """Tests for ``nth()``""" + + def test_basic(self): + """Make sure the nth item is returned""" + l = range(10) + for i, v in enumerate(l): + self.assertEqual(mi.nth(l, i), v) + + def test_default(self): + """Ensure a default value is returned when nth item not found""" + l = range(3) + self.assertEqual(mi.nth(l, 100, "zebra"), "zebra") + + def test_negative_item_raises(self): + """Ensure asking for a negative item raises an exception""" + self.assertRaises(ValueError, lambda: mi.nth(range(10), -3)) + + +class AllEqualTests(TestCase): + """Tests for ``all_equal()``""" + + def test_true(self): + """Everything is equal""" + self.assertTrue(mi.all_equal('aaaaaa')) + self.assertTrue(mi.all_equal([0, 0, 0, 0])) + + def test_false(self): + """Not everything is equal""" + self.assertFalse(mi.all_equal('aaaaab')) + self.assertFalse(mi.all_equal([0, 0, 0, 1])) + + def test_tricky(self): + """Not everything is identical, but everything is equal""" + items = [1, complex(1, 0), 1.0] + self.assertTrue(mi.all_equal(items)) + + def test_empty(self): + """Return True if the iterable is empty""" + self.assertTrue(mi.all_equal('')) + self.assertTrue(mi.all_equal([])) + + def test_one(self): + """Return True if the iterable is singular""" + self.assertTrue(mi.all_equal('0')) + self.assertTrue(mi.all_equal([0])) + + +class QuantifyTests(TestCase): + """Tests for ``quantify()``""" + + def test_happy_path(self): + """Make sure True count is returned""" + q = [True, False, True] + self.assertEqual(mi.quantify(q), 2) + + def test_custom_predicate(self): + """Ensure non-default predicates return as expected""" + q = range(10) + self.assertEqual(mi.quantify(q, lambda x: x % 2 == 0), 5) + + +class PadnoneTests(TestCase): + """Tests for ``padnone()``""" + + def test_happy_path(self): + """wrapper iterator should return None indefinitely""" + r = range(2) + p = mi.padnone(r) + self.assertEqual([0, 1, None, None], [next(p) for _ in range(4)]) + + +class NcyclesTests(TestCase): + """Tests for ``nyclces()``""" + + def test_happy_path(self): + """cycle a sequence three times""" + r = ["a", "b", "c"] + n = mi.ncycles(r, 3) + self.assertEqual( + ["a", "b", "c", "a", "b", "c", "a", "b", "c"], + list(n) + ) + + def test_null_case(self): + """asking for 0 cycles should return an empty iterator""" + n = mi.ncycles(range(100), 0) + self.assertRaises(StopIteration, lambda: next(n)) + + def test_pathalogical_case(self): + """asking for negative cycles should return an empty iterator""" + n = mi.ncycles(range(100), -10) + self.assertRaises(StopIteration, lambda: next(n)) + + +class DotproductTests(TestCase): + """Tests for ``dotproduct()``'""" + + def test_happy_path(self): + """simple dotproduct example""" + self.assertEqual(400, mi.dotproduct([10, 10], [20, 20])) + + +class FlattenTests(TestCase): + """Tests for ``flatten()``""" + + def test_basic_usage(self): + """ensure list of lists is flattened one level""" + f = [[0, 1, 2], [3, 4, 5]] + self.assertEqual(list(range(6)), list(mi.flatten(f))) + + def test_single_level(self): + """ensure list of lists is flattened only one level""" + f = [[0, [1, 2]], [[3, 4], 5]] + self.assertEqual([0, [1, 2], [3, 4], 5], list(mi.flatten(f))) + + +class RepeatfuncTests(TestCase): + """Tests for ``repeatfunc()``""" + + def test_simple_repeat(self): + """test simple repeated functions""" + r = mi.repeatfunc(lambda: 5) + self.assertEqual([5, 5, 5, 5, 5], [next(r) for _ in range(5)]) + + def test_finite_repeat(self): + """ensure limited repeat when times is provided""" + r = mi.repeatfunc(lambda: 5, times=5) + self.assertEqual([5, 5, 5, 5, 5], list(r)) + + def test_added_arguments(self): + """ensure arguments are applied to the function""" + r = mi.repeatfunc(lambda x: x, 2, 3) + self.assertEqual([3, 3], list(r)) + + def test_null_times(self): + """repeat 0 should return an empty iterator""" + r = mi.repeatfunc(range, 0, 3) + self.assertRaises(StopIteration, lambda: next(r)) + + +class PairwiseTests(TestCase): + """Tests for ``pairwise()``""" + + def test_base_case(self): + """ensure an iterable will return pairwise""" + p = mi.pairwise([1, 2, 3]) + self.assertEqual([(1, 2), (2, 3)], list(p)) + + def test_short_case(self): + """ensure an empty iterator if there's not enough values to pair""" + p = mi.pairwise("a") + self.assertRaises(StopIteration, lambda: next(p)) + + +class GrouperTests(TestCase): + """Tests for ``grouper()``""" + + def test_even(self): + """Test when group size divides evenly into the length of + the iterable. + + """ + self.assertEqual( + list(mi.grouper(3, 'ABCDEF')), [('A', 'B', 'C'), ('D', 'E', 'F')] + ) + + def test_odd(self): + """Test when group size does not divide evenly into the length of the + iterable. + + """ + self.assertEqual( + list(mi.grouper(3, 'ABCDE')), [('A', 'B', 'C'), ('D', 'E', None)] + ) + + def test_fill_value(self): + """Test that the fill value is used to pad the final group""" + self.assertEqual( + list(mi.grouper(3, 'ABCDE', 'x')), + [('A', 'B', 'C'), ('D', 'E', 'x')] + ) + + +class RoundrobinTests(TestCase): + """Tests for ``roundrobin()``""" + + def test_even_groups(self): + """Ensure ordered output from evenly populated iterables""" + self.assertEqual( + list(mi.roundrobin('ABC', [1, 2, 3], range(3))), + ['A', 1, 0, 'B', 2, 1, 'C', 3, 2] + ) + + def test_uneven_groups(self): + """Ensure ordered output from unevenly populated iterables""" + self.assertEqual( + list(mi.roundrobin('ABCD', [1, 2], range(0))), + ['A', 1, 'B', 2, 'C', 'D'] + ) + + +class PartitionTests(TestCase): + """Tests for ``partition()``""" + + def test_bool(self): + """Test when pred() returns a boolean""" + lesser, greater = mi.partition(lambda x: x > 5, range(10)) + self.assertEqual(list(lesser), [0, 1, 2, 3, 4, 5]) + self.assertEqual(list(greater), [6, 7, 8, 9]) + + def test_arbitrary(self): + """Test when pred() returns an integer""" + divisibles, remainders = mi.partition(lambda x: x % 3, range(10)) + self.assertEqual(list(divisibles), [0, 3, 6, 9]) + self.assertEqual(list(remainders), [1, 2, 4, 5, 7, 8]) + + +class PowersetTests(TestCase): + """Tests for ``powerset()``""" + + def test_combinatorics(self): + """Ensure a proper enumeration""" + p = mi.powerset([1, 2, 3]) + self.assertEqual( + list(p), + [(), (1,), (2,), (3,), (1, 2), (1, 3), (2, 3), (1, 2, 3)] + ) + + +class UniqueEverseenTests(TestCase): + """Tests for ``unique_everseen()``""" + + def test_everseen(self): + """ensure duplicate elements are ignored""" + u = mi.unique_everseen('AAAABBBBCCDAABBB') + self.assertEqual( + ['A', 'B', 'C', 'D'], + list(u) + ) + + def test_custom_key(self): + """ensure the custom key comparison works""" + u = mi.unique_everseen('aAbACCc', key=str.lower) + self.assertEqual(list('abC'), list(u)) + + def test_unhashable(self): + """ensure things work for unhashable items""" + iterable = ['a', [1, 2, 3], [1, 2, 3], 'a'] + u = mi.unique_everseen(iterable) + self.assertEqual(list(u), ['a', [1, 2, 3]]) + + def test_unhashable_key(self): + """ensure things work for unhashable items with a custom key""" + iterable = ['a', [1, 2, 3], [1, 2, 3], 'a'] + u = mi.unique_everseen(iterable, key=lambda x: x) + self.assertEqual(list(u), ['a', [1, 2, 3]]) + + +class UniqueJustseenTests(TestCase): + """Tests for ``unique_justseen()``""" + + def test_justseen(self): + """ensure only last item is remembered""" + u = mi.unique_justseen('AAAABBBCCDABB') + self.assertEqual(list('ABCDAB'), list(u)) + + def test_custom_key(self): + """ensure the custom key comparison works""" + u = mi.unique_justseen('AABCcAD', str.lower) + self.assertEqual(list('ABCAD'), list(u)) + + +class IterExceptTests(TestCase): + """Tests for ``iter_except()``""" + + def test_exact_exception(self): + """ensure the exact specified exception is caught""" + l = [1, 2, 3] + i = mi.iter_except(l.pop, IndexError) + self.assertEqual(list(i), [3, 2, 1]) + + def test_generic_exception(self): + """ensure the generic exception can be caught""" + l = [1, 2] + i = mi.iter_except(l.pop, Exception) + self.assertEqual(list(i), [2, 1]) + + def test_uncaught_exception_is_raised(self): + """ensure a non-specified exception is raised""" + l = [1, 2, 3] + i = mi.iter_except(l.pop, KeyError) + self.assertRaises(IndexError, lambda: list(i)) + + def test_first(self): + """ensure first is run before the function""" + l = [1, 2, 3] + f = lambda: 25 + i = mi.iter_except(l.pop, IndexError, f) + self.assertEqual(list(i), [25, 3, 2, 1]) + + +class FirstTrueTests(TestCase): + """Tests for ``first_true()``""" + + def test_something_true(self): + """Test with no keywords""" + self.assertEqual(mi.first_true(range(10)), 1) + + def test_nothing_true(self): + """Test default return value.""" + self.assertIsNone(mi.first_true([0, 0, 0])) + + def test_default(self): + """Test with a default keyword""" + self.assertEqual(mi.first_true([0, 0, 0], default='!'), '!') + + def test_pred(self): + """Test with a custom predicate""" + self.assertEqual( + mi.first_true([2, 4, 6], pred=lambda x: x % 3 == 0), 6 + ) + + +class RandomProductTests(TestCase): + """Tests for ``random_product()`` + + Since random.choice() has different results with the same seed across + python versions 2.x and 3.x, these tests use highly probably events to + create predictable outcomes across platforms. + """ + + def test_simple_lists(self): + """Ensure that one item is chosen from each list in each pair. + Also ensure that each item from each list eventually appears in + the chosen combinations. + + Odds are roughly 1 in 7.1 * 10e16 that one item from either list will + not be chosen after 100 samplings of one item from each list. Just to + be safe, better use a known random seed, too. + + """ + nums = [1, 2, 3] + lets = ['a', 'b', 'c'] + n, m = zip(*[mi.random_product(nums, lets) for _ in range(100)]) + n, m = set(n), set(m) + self.assertEqual(n, set(nums)) + self.assertEqual(m, set(lets)) + self.assertEqual(len(n), len(nums)) + self.assertEqual(len(m), len(lets)) + + def test_list_with_repeat(self): + """ensure multiple items are chosen, and that they appear to be chosen + from one list then the next, in proper order. + + """ + nums = [1, 2, 3] + lets = ['a', 'b', 'c'] + r = list(mi.random_product(nums, lets, repeat=100)) + self.assertEqual(2 * 100, len(r)) + n, m = set(r[::2]), set(r[1::2]) + self.assertEqual(n, set(nums)) + self.assertEqual(m, set(lets)) + self.assertEqual(len(n), len(nums)) + self.assertEqual(len(m), len(lets)) + + +class RandomPermutationTests(TestCase): + """Tests for ``random_permutation()``""" + + def test_full_permutation(self): + """ensure every item from the iterable is returned in a new ordering + + 15 elements have a 1 in 1.3 * 10e12 of appearing in sorted order, so + we fix a seed value just to be sure. + + """ + i = range(15) + r = mi.random_permutation(i) + self.assertEqual(set(i), set(r)) + if i == r: + raise AssertionError("Values were not permuted") + + def test_partial_permutation(self): + """ensure all returned items are from the iterable, that the returned + permutation is of the desired length, and that all items eventually + get returned. + + Sampling 100 permutations of length 5 from a set of 15 leaves a + (2/3)^100 chance that an item will not be chosen. Multiplied by 15 + items, there is a 1 in 2.6e16 chance that at least 1 item will not + show up in the resulting output. Using a random seed will fix that. + + """ + items = range(15) + item_set = set(items) + all_items = set() + for _ in range(100): + permutation = mi.random_permutation(items, 5) + self.assertEqual(len(permutation), 5) + permutation_set = set(permutation) + self.assertLessEqual(permutation_set, item_set) + all_items |= permutation_set + self.assertEqual(all_items, item_set) + + +class RandomCombinationTests(TestCase): + """Tests for ``random_combination()``""" + + def test_pseudorandomness(self): + """ensure different subsets of the iterable get returned over many + samplings of random combinations""" + items = range(15) + all_items = set() + for _ in range(50): + combination = mi.random_combination(items, 5) + all_items |= set(combination) + self.assertEqual(all_items, set(items)) + + def test_no_replacement(self): + """ensure that elements are sampled without replacement""" + items = range(15) + for _ in range(50): + combination = mi.random_combination(items, len(items)) + self.assertEqual(len(combination), len(set(combination))) + self.assertRaises( + ValueError, lambda: mi.random_combination(items, len(items) + 1) + ) + + +class RandomCombinationWithReplacementTests(TestCase): + """Tests for ``random_combination_with_replacement()``""" + + def test_replacement(self): + """ensure that elements are sampled with replacement""" + items = range(5) + combo = mi.random_combination_with_replacement(items, len(items) * 2) + self.assertEqual(2 * len(items), len(combo)) + if len(set(combo)) == len(combo): + raise AssertionError("Combination contained no duplicates") + + def test_pseudorandomness(self): + """ensure different subsets of the iterable get returned over many + samplings of random combinations""" + items = range(15) + all_items = set() + for _ in range(50): + combination = mi.random_combination_with_replacement(items, 5) + all_items |= set(combination) + self.assertEqual(all_items, set(items)) + + +class NthCombinationTests(TestCase): + def test_basic(self): + iterable = 'abcdefg' + r = 4 + for index, expected in enumerate(combinations(iterable, r)): + actual = mi.nth_combination(iterable, r, index) + self.assertEqual(actual, expected) + + def test_long(self): + actual = mi.nth_combination(range(180), 4, 2000000) + expected = (2, 12, 35, 126) + self.assertEqual(actual, expected) + + def test_invalid_r(self): + for r in (-1, 3): + with self.assertRaises(ValueError): + mi.nth_combination([], r, 0) + + def test_invalid_index(self): + with self.assertRaises(IndexError): + mi.nth_combination('abcdefg', 3, -36) + + +class PrependTests(TestCase): + def test_basic(self): + value = 'a' + iterator = iter('bcdefg') + actual = list(mi.prepend(value, iterator)) + expected = list('abcdefg') + self.assertEqual(actual, expected) + + def test_multiple(self): + value = 'ab' + iterator = iter('cdefg') + actual = tuple(mi.prepend(value, iterator)) + expected = ('ab',) + tuple('cdefg') + self.assertEqual(actual, expected) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/compat/tests/__init__.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/compat/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/compat/tests/test_compat.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/compat/tests/test_compat.py new file mode 100644 index 0000000000000000000000000000000000000000..9bb316a4de7ba6c6f2c05657297f53f6be248c7d --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/compat/tests/test_compat.py @@ -0,0 +1,26 @@ +from __future__ import division, absolute_import, print_function + +from os.path import join + +from numpy.compat import isfileobj, os_fspath +from numpy.testing import assert_ +from numpy.testing import tempdir + + +def test_isfileobj(): + with tempdir(prefix="numpy_test_compat_") as folder: + filename = join(folder, 'a.bin') + + with open(filename, 'wb') as f: + assert_(isfileobj(f)) + + with open(filename, 'ab') as f: + assert_(isfileobj(f)) + + with open(filename, 'rb') as f: + assert_(isfileobj(f)) + + +def test_os_fspath_strings(): + for string_path in (b'/a/b/c.d', u'/a/b/c.d'): + assert_(os_fspath(string_path) == string_path) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/core/include/numpy/__ufunc_api.h b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/core/include/numpy/__ufunc_api.h new file mode 100644 index 0000000000000000000000000000000000000000..22d2ba1542e0299c991ea76c2893d1c86e21109c --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/core/include/numpy/__ufunc_api.h @@ -0,0 +1,326 @@ + +#ifdef _UMATHMODULE + +extern NPY_NO_EXPORT PyTypeObject PyUFunc_Type; + +extern NPY_NO_EXPORT PyTypeObject PyUFunc_Type; + +NPY_NO_EXPORT PyObject * PyUFunc_FromFuncAndData \ + (PyUFuncGenericFunction *, void **, char *, int, int, int, int, const char *, const char *, int); +NPY_NO_EXPORT int PyUFunc_RegisterLoopForType \ + (PyUFuncObject *, int, PyUFuncGenericFunction, int *, void *); +NPY_NO_EXPORT int PyUFunc_GenericFunction \ + (PyUFuncObject *, PyObject *, PyObject *, PyArrayObject **); +NPY_NO_EXPORT void PyUFunc_f_f_As_d_d \ + (char **, npy_intp *, npy_intp *, void *); +NPY_NO_EXPORT void PyUFunc_d_d \ + (char **, npy_intp *, npy_intp *, void *); +NPY_NO_EXPORT void PyUFunc_f_f \ + (char **, npy_intp *, npy_intp *, void *); +NPY_NO_EXPORT void PyUFunc_g_g \ + (char **, npy_intp *, npy_intp *, void *); +NPY_NO_EXPORT void PyUFunc_F_F_As_D_D \ + (char **, npy_intp *, npy_intp *, void *); +NPY_NO_EXPORT void PyUFunc_F_F \ + (char **, npy_intp *, npy_intp *, void *); +NPY_NO_EXPORT void PyUFunc_D_D \ + (char **, npy_intp *, npy_intp *, void *); +NPY_NO_EXPORT void PyUFunc_G_G \ + (char **, npy_intp *, npy_intp *, void *); +NPY_NO_EXPORT void PyUFunc_O_O \ + (char **, npy_intp *, npy_intp *, void *); +NPY_NO_EXPORT void PyUFunc_ff_f_As_dd_d \ + (char **, npy_intp *, npy_intp *, void *); +NPY_NO_EXPORT void PyUFunc_ff_f \ + (char **, npy_intp *, npy_intp *, void *); +NPY_NO_EXPORT void PyUFunc_dd_d \ + (char **, npy_intp *, npy_intp *, void *); +NPY_NO_EXPORT void PyUFunc_gg_g \ + (char **, npy_intp *, npy_intp *, void *); +NPY_NO_EXPORT void PyUFunc_FF_F_As_DD_D \ + (char **, npy_intp *, npy_intp *, void *); +NPY_NO_EXPORT void PyUFunc_DD_D \ + (char **, npy_intp *, npy_intp *, void *); +NPY_NO_EXPORT void PyUFunc_FF_F \ + (char **, npy_intp *, npy_intp *, void *); +NPY_NO_EXPORT void PyUFunc_GG_G \ + (char **, npy_intp *, npy_intp *, void *); +NPY_NO_EXPORT void PyUFunc_OO_O \ + (char **, npy_intp *, npy_intp *, void *); +NPY_NO_EXPORT void PyUFunc_O_O_method \ + (char **, npy_intp *, npy_intp *, void *); +NPY_NO_EXPORT void PyUFunc_OO_O_method \ + (char **, npy_intp *, npy_intp *, void *); +NPY_NO_EXPORT void PyUFunc_On_Om \ + (char **, npy_intp *, npy_intp *, void *); +NPY_NO_EXPORT int PyUFunc_GetPyValues \ + (char *, int *, int *, PyObject **); +NPY_NO_EXPORT int PyUFunc_checkfperr \ + (int, PyObject *, int *); +NPY_NO_EXPORT void PyUFunc_clearfperr \ + (void); +NPY_NO_EXPORT int PyUFunc_getfperr \ + (void); +NPY_NO_EXPORT int PyUFunc_handlefperr \ + (int, PyObject *, int, int *); +NPY_NO_EXPORT int PyUFunc_ReplaceLoopBySignature \ + (PyUFuncObject *, PyUFuncGenericFunction, int *, PyUFuncGenericFunction *); +NPY_NO_EXPORT PyObject * PyUFunc_FromFuncAndDataAndSignature \ + (PyUFuncGenericFunction *, void **, char *, int, int, int, int, const char *, const char *, int, const char *); +NPY_NO_EXPORT int PyUFunc_SetUsesArraysAsData \ + (void **, size_t); +NPY_NO_EXPORT void PyUFunc_e_e \ + (char **, npy_intp *, npy_intp *, void *); +NPY_NO_EXPORT void PyUFunc_e_e_As_f_f \ + (char **, npy_intp *, npy_intp *, void *); +NPY_NO_EXPORT void PyUFunc_e_e_As_d_d \ + (char **, npy_intp *, npy_intp *, void *); +NPY_NO_EXPORT void PyUFunc_ee_e \ + (char **, npy_intp *, npy_intp *, void *); +NPY_NO_EXPORT void PyUFunc_ee_e_As_ff_f \ + (char **, npy_intp *, npy_intp *, void *); +NPY_NO_EXPORT void PyUFunc_ee_e_As_dd_d \ + (char **, npy_intp *, npy_intp *, void *); +NPY_NO_EXPORT int PyUFunc_DefaultTypeResolver \ + (PyUFuncObject *, NPY_CASTING, PyArrayObject **, PyObject *, PyArray_Descr **); +NPY_NO_EXPORT int PyUFunc_ValidateCasting \ + (PyUFuncObject *, NPY_CASTING, PyArrayObject **, PyArray_Descr **); +NPY_NO_EXPORT int PyUFunc_RegisterLoopForDescr \ + (PyUFuncObject *, PyArray_Descr *, PyUFuncGenericFunction, PyArray_Descr **, void *); +NPY_NO_EXPORT PyObject * PyUFunc_FromFuncAndDataAndSignatureAndIdentity \ + (PyUFuncGenericFunction *, void **, char *, int, int, int, int, const char *, const char *, int, const char *, PyObject *); + +#else + +#if defined(PY_UFUNC_UNIQUE_SYMBOL) +#define PyUFunc_API PY_UFUNC_UNIQUE_SYMBOL +#endif + +#if defined(NO_IMPORT) || defined(NO_IMPORT_UFUNC) +extern void **PyUFunc_API; +#else +#if defined(PY_UFUNC_UNIQUE_SYMBOL) +void **PyUFunc_API; +#else +static void **PyUFunc_API=NULL; +#endif +#endif + +#define PyUFunc_Type (*(PyTypeObject *)PyUFunc_API[0]) +#define PyUFunc_FromFuncAndData \ + (*(PyObject * (*)(PyUFuncGenericFunction *, void **, char *, int, int, int, int, const char *, const char *, int)) \ + PyUFunc_API[1]) +#define PyUFunc_RegisterLoopForType \ + (*(int (*)(PyUFuncObject *, int, PyUFuncGenericFunction, int *, void *)) \ + PyUFunc_API[2]) +#define PyUFunc_GenericFunction \ + (*(int (*)(PyUFuncObject *, PyObject *, PyObject *, PyArrayObject **)) \ + PyUFunc_API[3]) +#define PyUFunc_f_f_As_d_d \ + (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \ + PyUFunc_API[4]) +#define PyUFunc_d_d \ + (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \ + PyUFunc_API[5]) +#define PyUFunc_f_f \ + (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \ + PyUFunc_API[6]) +#define PyUFunc_g_g \ + (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \ + PyUFunc_API[7]) +#define PyUFunc_F_F_As_D_D \ + (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \ + PyUFunc_API[8]) +#define PyUFunc_F_F \ + (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \ + PyUFunc_API[9]) +#define PyUFunc_D_D \ + (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \ + PyUFunc_API[10]) +#define PyUFunc_G_G \ + (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \ + PyUFunc_API[11]) +#define PyUFunc_O_O \ + (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \ + PyUFunc_API[12]) +#define PyUFunc_ff_f_As_dd_d \ + (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \ + PyUFunc_API[13]) +#define PyUFunc_ff_f \ + (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \ + PyUFunc_API[14]) +#define PyUFunc_dd_d \ + (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \ + PyUFunc_API[15]) +#define PyUFunc_gg_g \ + (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \ + PyUFunc_API[16]) +#define PyUFunc_FF_F_As_DD_D \ + (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \ + PyUFunc_API[17]) +#define PyUFunc_DD_D \ + (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \ + PyUFunc_API[18]) +#define PyUFunc_FF_F \ + (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \ + PyUFunc_API[19]) +#define PyUFunc_GG_G \ + (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \ + PyUFunc_API[20]) +#define PyUFunc_OO_O \ + (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \ + PyUFunc_API[21]) +#define PyUFunc_O_O_method \ + (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \ + PyUFunc_API[22]) +#define PyUFunc_OO_O_method \ + (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \ + PyUFunc_API[23]) +#define PyUFunc_On_Om \ + (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \ + PyUFunc_API[24]) +#define PyUFunc_GetPyValues \ + (*(int (*)(char *, int *, int *, PyObject **)) \ + PyUFunc_API[25]) +#define PyUFunc_checkfperr \ + (*(int (*)(int, PyObject *, int *)) \ + PyUFunc_API[26]) +#define PyUFunc_clearfperr \ + (*(void (*)(void)) \ + PyUFunc_API[27]) +#define PyUFunc_getfperr \ + (*(int (*)(void)) \ + PyUFunc_API[28]) +#define PyUFunc_handlefperr \ + (*(int (*)(int, PyObject *, int, int *)) \ + PyUFunc_API[29]) +#define PyUFunc_ReplaceLoopBySignature \ + (*(int (*)(PyUFuncObject *, PyUFuncGenericFunction, int *, PyUFuncGenericFunction *)) \ + PyUFunc_API[30]) +#define PyUFunc_FromFuncAndDataAndSignature \ + (*(PyObject * (*)(PyUFuncGenericFunction *, void **, char *, int, int, int, int, const char *, const char *, int, const char *)) \ + PyUFunc_API[31]) +#define PyUFunc_SetUsesArraysAsData \ + (*(int (*)(void **, size_t)) \ + PyUFunc_API[32]) +#define PyUFunc_e_e \ + (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \ + PyUFunc_API[33]) +#define PyUFunc_e_e_As_f_f \ + (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \ + PyUFunc_API[34]) +#define PyUFunc_e_e_As_d_d \ + (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \ + PyUFunc_API[35]) +#define PyUFunc_ee_e \ + (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \ + PyUFunc_API[36]) +#define PyUFunc_ee_e_As_ff_f \ + (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \ + PyUFunc_API[37]) +#define PyUFunc_ee_e_As_dd_d \ + (*(void (*)(char **, npy_intp *, npy_intp *, void *)) \ + PyUFunc_API[38]) +#define PyUFunc_DefaultTypeResolver \ + (*(int (*)(PyUFuncObject *, NPY_CASTING, PyArrayObject **, PyObject *, PyArray_Descr **)) \ + PyUFunc_API[39]) +#define PyUFunc_ValidateCasting \ + (*(int (*)(PyUFuncObject *, NPY_CASTING, PyArrayObject **, PyArray_Descr **)) \ + PyUFunc_API[40]) +#define PyUFunc_RegisterLoopForDescr \ + (*(int (*)(PyUFuncObject *, PyArray_Descr *, PyUFuncGenericFunction, PyArray_Descr **, void *)) \ + PyUFunc_API[41]) +#define PyUFunc_FromFuncAndDataAndSignatureAndIdentity \ + (*(PyObject * (*)(PyUFuncGenericFunction *, void **, char *, int, int, int, int, const char *, const char *, int, const char *, PyObject *)) \ + PyUFunc_API[42]) + +static NPY_INLINE int +_import_umath(void) +{ + PyObject *numpy = PyImport_ImportModule("numpy.core._multiarray_umath"); + PyObject *c_api = NULL; + + if (numpy == NULL) { + PyErr_SetString(PyExc_ImportError, + "numpy.core._multiarray_umath failed to import"); + return -1; + } + c_api = PyObject_GetAttrString(numpy, "_UFUNC_API"); + Py_DECREF(numpy); + if (c_api == NULL) { + PyErr_SetString(PyExc_AttributeError, "_UFUNC_API not found"); + return -1; + } + +#if PY_VERSION_HEX >= 0x03000000 + if (!PyCapsule_CheckExact(c_api)) { + PyErr_SetString(PyExc_RuntimeError, "_UFUNC_API is not PyCapsule object"); + Py_DECREF(c_api); + return -1; + } + PyUFunc_API = (void **)PyCapsule_GetPointer(c_api, NULL); +#else + if (!PyCObject_Check(c_api)) { + PyErr_SetString(PyExc_RuntimeError, "_UFUNC_API is not PyCObject object"); + Py_DECREF(c_api); + return -1; + } + PyUFunc_API = (void **)PyCObject_AsVoidPtr(c_api); +#endif + Py_DECREF(c_api); + if (PyUFunc_API == NULL) { + PyErr_SetString(PyExc_RuntimeError, "_UFUNC_API is NULL pointer"); + return -1; + } + return 0; +} + +#if PY_VERSION_HEX >= 0x03000000 +#define NUMPY_IMPORT_UMATH_RETVAL NULL +#else +#define NUMPY_IMPORT_UMATH_RETVAL +#endif + +#define import_umath() \ + do {\ + UFUNC_NOFPE\ + if (_import_umath() < 0) {\ + PyErr_Print();\ + PyErr_SetString(PyExc_ImportError,\ + "numpy.core.umath failed to import");\ + return NUMPY_IMPORT_UMATH_RETVAL;\ + }\ + } while(0) + +#define import_umath1(ret) \ + do {\ + UFUNC_NOFPE\ + if (_import_umath() < 0) {\ + PyErr_Print();\ + PyErr_SetString(PyExc_ImportError,\ + "numpy.core.umath failed to import");\ + return ret;\ + }\ + } while(0) + +#define import_umath2(ret, msg) \ + do {\ + UFUNC_NOFPE\ + if (_import_umath() < 0) {\ + PyErr_Print();\ + PyErr_SetString(PyExc_ImportError, msg);\ + return ret;\ + }\ + } while(0) + +#define import_ufunc() \ + do {\ + UFUNC_NOFPE\ + if (_import_umath() < 0) {\ + PyErr_Print();\ + PyErr_SetString(PyExc_ImportError,\ + "numpy.core.umath failed to import");\ + }\ + } while(0) + +#endif diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h new file mode 100644 index 0000000000000000000000000000000000000000..4f46d6b1ac91da10689474b788e30de21901bb83 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h @@ -0,0 +1,11 @@ +#ifndef Py_ARRAYOBJECT_H +#define Py_ARRAYOBJECT_H + +#include "ndarrayobject.h" +#include "npy_interrupt.h" + +#ifdef NPY_NO_PREFIX +#include "noprefix.h" +#endif + +#endif diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/core/include/numpy/arrayscalars.h b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/core/include/numpy/arrayscalars.h new file mode 100644 index 0000000000000000000000000000000000000000..64450e71321329f3d7a070d4eb9295d04d1f1cb4 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/core/include/numpy/arrayscalars.h @@ -0,0 +1,175 @@ +#ifndef _NPY_ARRAYSCALARS_H_ +#define _NPY_ARRAYSCALARS_H_ + +#ifndef _MULTIARRAYMODULE +typedef struct { + PyObject_HEAD + npy_bool obval; +} PyBoolScalarObject; +#endif + + +typedef struct { + PyObject_HEAD + signed char obval; +} PyByteScalarObject; + + +typedef struct { + PyObject_HEAD + short obval; +} PyShortScalarObject; + + +typedef struct { + PyObject_HEAD + int obval; +} PyIntScalarObject; + + +typedef struct { + PyObject_HEAD + long obval; +} PyLongScalarObject; + + +typedef struct { + PyObject_HEAD + npy_longlong obval; +} PyLongLongScalarObject; + + +typedef struct { + PyObject_HEAD + unsigned char obval; +} PyUByteScalarObject; + + +typedef struct { + PyObject_HEAD + unsigned short obval; +} PyUShortScalarObject; + + +typedef struct { + PyObject_HEAD + unsigned int obval; +} PyUIntScalarObject; + + +typedef struct { + PyObject_HEAD + unsigned long obval; +} PyULongScalarObject; + + +typedef struct { + PyObject_HEAD + npy_ulonglong obval; +} PyULongLongScalarObject; + + +typedef struct { + PyObject_HEAD + npy_half obval; +} PyHalfScalarObject; + + +typedef struct { + PyObject_HEAD + float obval; +} PyFloatScalarObject; + + +typedef struct { + PyObject_HEAD + double obval; +} PyDoubleScalarObject; + + +typedef struct { + PyObject_HEAD + npy_longdouble obval; +} PyLongDoubleScalarObject; + + +typedef struct { + PyObject_HEAD + npy_cfloat obval; +} PyCFloatScalarObject; + + +typedef struct { + PyObject_HEAD + npy_cdouble obval; +} PyCDoubleScalarObject; + + +typedef struct { + PyObject_HEAD + npy_clongdouble obval; +} PyCLongDoubleScalarObject; + + +typedef struct { + PyObject_HEAD + PyObject * obval; +} PyObjectScalarObject; + +typedef struct { + PyObject_HEAD + npy_datetime obval; + PyArray_DatetimeMetaData obmeta; +} PyDatetimeScalarObject; + +typedef struct { + PyObject_HEAD + npy_timedelta obval; + PyArray_DatetimeMetaData obmeta; +} PyTimedeltaScalarObject; + + +typedef struct { + PyObject_HEAD + char obval; +} PyScalarObject; + +#define PyStringScalarObject PyStringObject +#define PyUnicodeScalarObject PyUnicodeObject + +typedef struct { + PyObject_VAR_HEAD + char *obval; + PyArray_Descr *descr; + int flags; + PyObject *base; +} PyVoidScalarObject; + +/* Macros + PyScalarObject + PyArrType_Type + are defined in ndarrayobject.h +*/ + +#define PyArrayScalar_False ((PyObject *)(&(_PyArrayScalar_BoolValues[0]))) +#define PyArrayScalar_True ((PyObject *)(&(_PyArrayScalar_BoolValues[1]))) +#define PyArrayScalar_FromLong(i) \ + ((PyObject *)(&(_PyArrayScalar_BoolValues[((i)!=0)]))) +#define PyArrayScalar_RETURN_BOOL_FROM_LONG(i) \ + return Py_INCREF(PyArrayScalar_FromLong(i)), \ + PyArrayScalar_FromLong(i) +#define PyArrayScalar_RETURN_FALSE \ + return Py_INCREF(PyArrayScalar_False), \ + PyArrayScalar_False +#define PyArrayScalar_RETURN_TRUE \ + return Py_INCREF(PyArrayScalar_True), \ + PyArrayScalar_True + +#define PyArrayScalar_New(cls) \ + Py##cls##ArrType_Type.tp_alloc(&Py##cls##ArrType_Type, 0) +#define PyArrayScalar_VAL(obj, cls) \ + ((Py##cls##ScalarObject *)obj)->obval +#define PyArrayScalar_ASSIGN(obj, cls, val) \ + PyArrayScalar_VAL(obj, cls) = val + +#endif diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/core/include/numpy/halffloat.h b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/core/include/numpy/halffloat.h new file mode 100644 index 0000000000000000000000000000000000000000..ab0d221fb4317d63de98608396a12b9e68396016 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/core/include/numpy/halffloat.h @@ -0,0 +1,70 @@ +#ifndef __NPY_HALFFLOAT_H__ +#define __NPY_HALFFLOAT_H__ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Half-precision routines + */ + +/* Conversions */ +float npy_half_to_float(npy_half h); +double npy_half_to_double(npy_half h); +npy_half npy_float_to_half(float f); +npy_half npy_double_to_half(double d); +/* Comparisons */ +int npy_half_eq(npy_half h1, npy_half h2); +int npy_half_ne(npy_half h1, npy_half h2); +int npy_half_le(npy_half h1, npy_half h2); +int npy_half_lt(npy_half h1, npy_half h2); +int npy_half_ge(npy_half h1, npy_half h2); +int npy_half_gt(npy_half h1, npy_half h2); +/* faster *_nonan variants for when you know h1 and h2 are not NaN */ +int npy_half_eq_nonan(npy_half h1, npy_half h2); +int npy_half_lt_nonan(npy_half h1, npy_half h2); +int npy_half_le_nonan(npy_half h1, npy_half h2); +/* Miscellaneous functions */ +int npy_half_iszero(npy_half h); +int npy_half_isnan(npy_half h); +int npy_half_isinf(npy_half h); +int npy_half_isfinite(npy_half h); +int npy_half_signbit(npy_half h); +npy_half npy_half_copysign(npy_half x, npy_half y); +npy_half npy_half_spacing(npy_half h); +npy_half npy_half_nextafter(npy_half x, npy_half y); +npy_half npy_half_divmod(npy_half x, npy_half y, npy_half *modulus); + +/* + * Half-precision constants + */ + +#define NPY_HALF_ZERO (0x0000u) +#define NPY_HALF_PZERO (0x0000u) +#define NPY_HALF_NZERO (0x8000u) +#define NPY_HALF_ONE (0x3c00u) +#define NPY_HALF_NEGONE (0xbc00u) +#define NPY_HALF_PINF (0x7c00u) +#define NPY_HALF_NINF (0xfc00u) +#define NPY_HALF_NAN (0x7e00u) + +#define NPY_MAX_HALF (0x7bffu) + +/* + * Bit-level conversions + */ + +npy_uint16 npy_floatbits_to_halfbits(npy_uint32 f); +npy_uint16 npy_doublebits_to_halfbits(npy_uint64 d); +npy_uint32 npy_halfbits_to_floatbits(npy_uint16 h); +npy_uint64 npy_halfbits_to_doublebits(npy_uint16 h); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/core/include/numpy/multiarray_api.txt b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/core/include/numpy/multiarray_api.txt new file mode 100644 index 0000000000000000000000000000000000000000..7c45394baede76f91c164c712d17d32d0c2e2073 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/core/include/numpy/multiarray_api.txt @@ -0,0 +1,2501 @@ + +=========== +NumPy C-API +=========== +:: + + unsigned int + PyArray_GetNDArrayCVersion(void ) + + +Included at the very first so not auto-grabbed and thus not labeled. + +:: + + int + PyArray_SetNumericOps(PyObject *dict) + +Set internal structure with number functions that all arrays will use + +:: + + PyObject * + PyArray_GetNumericOps(void ) + +Get dictionary showing number functions that all arrays will use + +:: + + int + PyArray_INCREF(PyArrayObject *mp) + +For object arrays, increment all internal references. + +:: + + int + PyArray_XDECREF(PyArrayObject *mp) + +Decrement all internal references for object arrays. +(or arrays with object fields) + +:: + + void + PyArray_SetStringFunction(PyObject *op, int repr) + +Set the array print function to be a Python function. + +:: + + PyArray_Descr * + PyArray_DescrFromType(int type) + +Get the PyArray_Descr structure for a type. + +:: + + PyObject * + PyArray_TypeObjectFromType(int type) + +Get a typeobject from a type-number -- can return NULL. + +New reference + +:: + + char * + PyArray_Zero(PyArrayObject *arr) + +Get pointer to zero of correct type for array. + +:: + + char * + PyArray_One(PyArrayObject *arr) + +Get pointer to one of correct type for array + +:: + + PyObject * + PyArray_CastToType(PyArrayObject *arr, PyArray_Descr *dtype, int + is_f_order) + +For backward compatibility + +Cast an array using typecode structure. +steals reference to dtype --- cannot be NULL + +This function always makes a copy of arr, even if the dtype +doesn't change. + +:: + + int + PyArray_CastTo(PyArrayObject *out, PyArrayObject *mp) + +Cast to an already created array. + +:: + + int + PyArray_CastAnyTo(PyArrayObject *out, PyArrayObject *mp) + +Cast to an already created array. Arrays don't have to be "broadcastable" +Only requirement is they have the same number of elements. + +:: + + int + PyArray_CanCastSafely(int fromtype, int totype) + +Check the type coercion rules. + +:: + + npy_bool + PyArray_CanCastTo(PyArray_Descr *from, PyArray_Descr *to) + +leaves reference count alone --- cannot be NULL + +PyArray_CanCastTypeTo is equivalent to this, but adds a 'casting' +parameter. + +:: + + int + PyArray_ObjectType(PyObject *op, int minimum_type) + +Return the typecode of the array a Python object would be converted to + +Returns the type number the result should have, or NPY_NOTYPE on error. + +:: + + PyArray_Descr * + PyArray_DescrFromObject(PyObject *op, PyArray_Descr *mintype) + +new reference -- accepts NULL for mintype + +:: + + PyArrayObject ** + PyArray_ConvertToCommonType(PyObject *op, int *retn) + + +:: + + PyArray_Descr * + PyArray_DescrFromScalar(PyObject *sc) + +Return descr object from array scalar. + +New reference + +:: + + PyArray_Descr * + PyArray_DescrFromTypeObject(PyObject *type) + + +:: + + npy_intp + PyArray_Size(PyObject *op) + +Compute the size of an array (in number of items) + +:: + + PyObject * + PyArray_Scalar(void *data, PyArray_Descr *descr, PyObject *base) + +Get scalar-equivalent to a region of memory described by a descriptor. + +:: + + PyObject * + PyArray_FromScalar(PyObject *scalar, PyArray_Descr *outcode) + +Get 0-dim array from scalar + +0-dim array from array-scalar object +always contains a copy of the data +unless outcode is NULL, it is of void type and the referrer does +not own it either. + +steals reference to outcode + +:: + + void + PyArray_ScalarAsCtype(PyObject *scalar, void *ctypeptr) + +Convert to c-type + +no error checking is performed -- ctypeptr must be same type as scalar +in case of flexible type, the data is not copied +into ctypeptr which is expected to be a pointer to pointer + +:: + + int + PyArray_CastScalarToCtype(PyObject *scalar, void + *ctypeptr, PyArray_Descr *outcode) + +Cast Scalar to c-type + +The output buffer must be large-enough to receive the value +Even for flexible types which is different from ScalarAsCtype +where only a reference for flexible types is returned + +This may not work right on narrow builds for NumPy unicode scalars. + +:: + + int + PyArray_CastScalarDirect(PyObject *scalar, PyArray_Descr + *indescr, void *ctypeptr, int outtype) + +Cast Scalar to c-type + +:: + + PyObject * + PyArray_ScalarFromObject(PyObject *object) + +Get an Array Scalar From a Python Object + +Returns NULL if unsuccessful but error is only set if another error occurred. +Currently only Numeric-like object supported. + +:: + + PyArray_VectorUnaryFunc * + PyArray_GetCastFunc(PyArray_Descr *descr, int type_num) + +Get a cast function to cast from the input descriptor to the +output type_number (must be a registered data-type). +Returns NULL if un-successful. + +:: + + PyObject * + PyArray_FromDims(int nd, int *d, int type) + +Construct an empty array from dimensions and typenum + +:: + + PyObject * + PyArray_FromDimsAndDataAndDescr(int nd, int *d, PyArray_Descr + *descr, char *data) + +Like FromDimsAndData but uses the Descr structure instead of typecode +as input. + +:: + + PyObject * + PyArray_FromAny(PyObject *op, PyArray_Descr *newtype, int + min_depth, int max_depth, int flags, PyObject + *context) + +Does not check for NPY_ARRAY_ENSURECOPY and NPY_ARRAY_NOTSWAPPED in flags +Steals a reference to newtype --- which can be NULL + +:: + + PyObject * + PyArray_EnsureArray(PyObject *op) + +This is a quick wrapper around +PyArray_FromAny(op, NULL, 0, 0, NPY_ARRAY_ENSUREARRAY, NULL) +that special cases Arrays and PyArray_Scalars up front +It *steals a reference* to the object +It also guarantees that the result is PyArray_Type +Because it decrefs op if any conversion needs to take place +so it can be used like PyArray_EnsureArray(some_function(...)) + +:: + + PyObject * + PyArray_EnsureAnyArray(PyObject *op) + + +:: + + PyObject * + PyArray_FromFile(FILE *fp, PyArray_Descr *dtype, npy_intp num, char + *sep) + + +Given a ``FILE *`` pointer ``fp``, and a ``PyArray_Descr``, return an +array corresponding to the data encoded in that file. + +If the dtype is NULL, the default array type is used (double). +If non-null, the reference is stolen and if dtype->subarray is true dtype +will be decrefed even on success. + +The number of elements to read is given as ``num``; if it is < 0, then +then as many as possible are read. + +If ``sep`` is NULL or empty, then binary data is assumed, else +text data, with ``sep`` as the separator between elements. Whitespace in +the separator matches any length of whitespace in the text, and a match +for whitespace around the separator is added. + +For memory-mapped files, use the buffer interface. No more data than +necessary is read by this routine. + +:: + + PyObject * + PyArray_FromString(char *data, npy_intp slen, PyArray_Descr + *dtype, npy_intp num, char *sep) + + +Given a pointer to a string ``data``, a string length ``slen``, and +a ``PyArray_Descr``, return an array corresponding to the data +encoded in that string. + +If the dtype is NULL, the default array type is used (double). +If non-null, the reference is stolen. + +If ``slen`` is < 0, then the end of string is used for text data. +It is an error for ``slen`` to be < 0 for binary data (since embedded NULLs +would be the norm). + +The number of elements to read is given as ``num``; if it is < 0, then +then as many as possible are read. + +If ``sep`` is NULL or empty, then binary data is assumed, else +text data, with ``sep`` as the separator between elements. Whitespace in +the separator matches any length of whitespace in the text, and a match +for whitespace around the separator is added. + +:: + + PyObject * + PyArray_FromBuffer(PyObject *buf, PyArray_Descr *type, npy_intp + count, npy_intp offset) + + +:: + + PyObject * + PyArray_FromIter(PyObject *obj, PyArray_Descr *dtype, npy_intp count) + + +steals a reference to dtype (which cannot be NULL) + +:: + + PyObject * + PyArray_Return(PyArrayObject *mp) + + +Return either an array or the appropriate Python object if the array +is 0d and matches a Python type. +steals reference to mp + +:: + + PyObject * + PyArray_GetField(PyArrayObject *self, PyArray_Descr *typed, int + offset) + +Get a subset of bytes from each element of the array +steals reference to typed, must not be NULL + +:: + + int + PyArray_SetField(PyArrayObject *self, PyArray_Descr *dtype, int + offset, PyObject *val) + +Set a subset of bytes from each element of the array +steals reference to dtype, must not be NULL + +:: + + PyObject * + PyArray_Byteswap(PyArrayObject *self, npy_bool inplace) + + +:: + + PyObject * + PyArray_Resize(PyArrayObject *self, PyArray_Dims *newshape, int + refcheck, NPY_ORDER order) + +Resize (reallocate data). Only works if nothing else is referencing this +array and it is contiguous. If refcheck is 0, then the reference count is +not checked and assumed to be 1. You still must own this data and have no +weak-references and no base object. + +:: + + int + PyArray_MoveInto(PyArrayObject *dst, PyArrayObject *src) + +Move the memory of one array into another, allowing for overlapping data. + +Returns 0 on success, negative on failure. + +:: + + int + PyArray_CopyInto(PyArrayObject *dst, PyArrayObject *src) + +Copy an Array into another array. +Broadcast to the destination shape if necessary. + +Returns 0 on success, -1 on failure. + +:: + + int + PyArray_CopyAnyInto(PyArrayObject *dst, PyArrayObject *src) + +Copy an Array into another array -- memory must not overlap +Does not require src and dest to have "broadcastable" shapes +(only the same number of elements). + +TODO: For NumPy 2.0, this could accept an order parameter which +only allows NPY_CORDER and NPY_FORDER. Could also rename +this to CopyAsFlat to make the name more intuitive. + +Returns 0 on success, -1 on error. + +:: + + int + PyArray_CopyObject(PyArrayObject *dest, PyObject *src_object) + + +:: + + PyObject * + PyArray_NewCopy(PyArrayObject *obj, NPY_ORDER order) + +Copy an array. + +:: + + PyObject * + PyArray_ToList(PyArrayObject *self) + +To List + +:: + + PyObject * + PyArray_ToString(PyArrayObject *self, NPY_ORDER order) + + +:: + + int + PyArray_ToFile(PyArrayObject *self, FILE *fp, char *sep, char *format) + +To File + +:: + + int + PyArray_Dump(PyObject *self, PyObject *file, int protocol) + + +:: + + PyObject * + PyArray_Dumps(PyObject *self, int protocol) + + +:: + + int + PyArray_ValidType(int type) + +Is the typenum valid? + +:: + + void + PyArray_UpdateFlags(PyArrayObject *ret, int flagmask) + +Update Several Flags at once. + +:: + + PyObject * + PyArray_New(PyTypeObject *subtype, int nd, npy_intp *dims, int + type_num, npy_intp *strides, void *data, int itemsize, int + flags, PyObject *obj) + +Generic new array creation routine. + +:: + + PyObject * + PyArray_NewFromDescr(PyTypeObject *subtype, PyArray_Descr *descr, int + nd, npy_intp *dims, npy_intp *strides, void + *data, int flags, PyObject *obj) + +Generic new array creation routine. + +steals a reference to descr. On failure or when dtype->subarray is +true, dtype will be decrefed. + +:: + + PyArray_Descr * + PyArray_DescrNew(PyArray_Descr *base) + +base cannot be NULL + +:: + + PyArray_Descr * + PyArray_DescrNewFromType(int type_num) + + +:: + + double + PyArray_GetPriority(PyObject *obj, double default_) + +Get Priority from object + +:: + + PyObject * + PyArray_IterNew(PyObject *obj) + +Get Iterator. + +:: + + PyObject * + PyArray_MultiIterNew(int n, ... ) + +Get MultiIterator, + +:: + + int + PyArray_PyIntAsInt(PyObject *o) + + +:: + + npy_intp + PyArray_PyIntAsIntp(PyObject *o) + + +:: + + int + PyArray_Broadcast(PyArrayMultiIterObject *mit) + + +:: + + void + PyArray_FillObjectArray(PyArrayObject *arr, PyObject *obj) + +Assumes contiguous + +:: + + int + PyArray_FillWithScalar(PyArrayObject *arr, PyObject *obj) + + +:: + + npy_bool + PyArray_CheckStrides(int elsize, int nd, npy_intp numbytes, npy_intp + offset, npy_intp *dims, npy_intp *newstrides) + + +:: + + PyArray_Descr * + PyArray_DescrNewByteorder(PyArray_Descr *self, char newendian) + + +returns a copy of the PyArray_Descr structure with the byteorder +altered: +no arguments: The byteorder is swapped (in all subfields as well) +single argument: The byteorder is forced to the given state +(in all subfields as well) + +Valid states: ('big', '>') or ('little' or '<') +('native', or '=') + +If a descr structure with | is encountered it's own +byte-order is not changed but any fields are: + + +Deep bytorder change of a data-type descriptor +Leaves reference count of self unchanged --- does not DECREF self *** + +:: + + PyObject * + PyArray_IterAllButAxis(PyObject *obj, int *inaxis) + +Get Iterator that iterates over all but one axis (don't use this with +PyArray_ITER_GOTO1D). The axis will be over-written if negative +with the axis having the smallest stride. + +:: + + PyObject * + PyArray_CheckFromAny(PyObject *op, PyArray_Descr *descr, int + min_depth, int max_depth, int requires, PyObject + *context) + +steals a reference to descr -- accepts NULL + +:: + + PyObject * + PyArray_FromArray(PyArrayObject *arr, PyArray_Descr *newtype, int + flags) + +steals reference to newtype --- acc. NULL + +:: + + PyObject * + PyArray_FromInterface(PyObject *origin) + + +:: + + PyObject * + PyArray_FromStructInterface(PyObject *input) + + +:: + + PyObject * + PyArray_FromArrayAttr(PyObject *op, PyArray_Descr *typecode, PyObject + *context) + + +:: + + NPY_SCALARKIND + PyArray_ScalarKind(int typenum, PyArrayObject **arr) + +ScalarKind + +Returns the scalar kind of a type number, with an +optional tweak based on the scalar value itself. +If no scalar is provided, it returns INTPOS_SCALAR +for both signed and unsigned integers, otherwise +it checks the sign of any signed integer to choose +INTNEG_SCALAR when appropriate. + +:: + + int + PyArray_CanCoerceScalar(int thistype, int neededtype, NPY_SCALARKIND + scalar) + + +Determines whether the data type 'thistype', with +scalar kind 'scalar', can be coerced into 'neededtype'. + +:: + + PyObject * + PyArray_NewFlagsObject(PyObject *obj) + + +Get New ArrayFlagsObject + +:: + + npy_bool + PyArray_CanCastScalar(PyTypeObject *from, PyTypeObject *to) + +See if array scalars can be cast. + +TODO: For NumPy 2.0, add a NPY_CASTING parameter. + +:: + + int + PyArray_CompareUCS4(npy_ucs4 *s1, npy_ucs4 *s2, size_t len) + + +:: + + int + PyArray_RemoveSmallest(PyArrayMultiIterObject *multi) + +Adjusts previously broadcasted iterators so that the axis with +the smallest sum of iterator strides is not iterated over. +Returns dimension which is smallest in the range [0,multi->nd). +A -1 is returned if multi->nd == 0. + +don't use with PyArray_ITER_GOTO1D because factors are not adjusted + +:: + + int + PyArray_ElementStrides(PyObject *obj) + + +:: + + void + PyArray_Item_INCREF(char *data, PyArray_Descr *descr) + +XINCREF all objects in a single array item. This is complicated for +structured datatypes where the position of objects needs to be extracted. +The function is execute recursively for each nested field or subarrays dtype +such as as `np.dtype([("field1", "O"), ("field2", "f,O", (3,2))])` + +:: + + void + PyArray_Item_XDECREF(char *data, PyArray_Descr *descr) + + +XDECREF all objects in a single array item. This is complicated for +structured datatypes where the position of objects needs to be extracted. +The function is execute recursively for each nested field or subarrays dtype +such as as `np.dtype([("field1", "O"), ("field2", "f,O", (3,2))])` + +:: + + PyObject * + PyArray_FieldNames(PyObject *fields) + +Return the tuple of ordered field names from a dictionary. + +:: + + PyObject * + PyArray_Transpose(PyArrayObject *ap, PyArray_Dims *permute) + +Return Transpose. + +:: + + PyObject * + PyArray_TakeFrom(PyArrayObject *self0, PyObject *indices0, int + axis, PyArrayObject *out, NPY_CLIPMODE clipmode) + +Take + +:: + + PyObject * + PyArray_PutTo(PyArrayObject *self, PyObject*values0, PyObject + *indices0, NPY_CLIPMODE clipmode) + +Put values into an array + +:: + + PyObject * + PyArray_PutMask(PyArrayObject *self, PyObject*values0, PyObject*mask0) + +Put values into an array according to a mask. + +:: + + PyObject * + PyArray_Repeat(PyArrayObject *aop, PyObject *op, int axis) + +Repeat the array. + +:: + + PyObject * + PyArray_Choose(PyArrayObject *ip, PyObject *op, PyArrayObject + *out, NPY_CLIPMODE clipmode) + + +:: + + int + PyArray_Sort(PyArrayObject *op, int axis, NPY_SORTKIND which) + +Sort an array in-place + +:: + + PyObject * + PyArray_ArgSort(PyArrayObject *op, int axis, NPY_SORTKIND which) + +ArgSort an array + +:: + + PyObject * + PyArray_SearchSorted(PyArrayObject *op1, PyObject *op2, NPY_SEARCHSIDE + side, PyObject *perm) + + +Search the sorted array op1 for the location of the items in op2. The +result is an array of indexes, one for each element in op2, such that if +the item were to be inserted in op1 just before that index the array +would still be in sorted order. + +Parameters +---------- +op1 : PyArrayObject * +Array to be searched, must be 1-D. +op2 : PyObject * +Array of items whose insertion indexes in op1 are wanted +side : {NPY_SEARCHLEFT, NPY_SEARCHRIGHT} +If NPY_SEARCHLEFT, return first valid insertion indexes +If NPY_SEARCHRIGHT, return last valid insertion indexes +perm : PyObject * +Permutation array that sorts op1 (optional) + +Returns +------- +ret : PyObject * +New reference to npy_intp array containing indexes where items in op2 +could be validly inserted into op1. NULL on error. + +Notes +----- +Binary search is used to find the indexes. + +:: + + PyObject * + PyArray_ArgMax(PyArrayObject *op, int axis, PyArrayObject *out) + +ArgMax + +:: + + PyObject * + PyArray_ArgMin(PyArrayObject *op, int axis, PyArrayObject *out) + +ArgMin + +:: + + PyObject * + PyArray_Reshape(PyArrayObject *self, PyObject *shape) + +Reshape + +:: + + PyObject * + PyArray_Newshape(PyArrayObject *self, PyArray_Dims *newdims, NPY_ORDER + order) + +New shape for an array + +:: + + PyObject * + PyArray_Squeeze(PyArrayObject *self) + + +return a new view of the array object with all of its unit-length +dimensions squeezed out if needed, otherwise +return the same array. + +:: + + PyObject * + PyArray_View(PyArrayObject *self, PyArray_Descr *type, PyTypeObject + *pytype) + +View +steals a reference to type -- accepts NULL + +:: + + PyObject * + PyArray_SwapAxes(PyArrayObject *ap, int a1, int a2) + +SwapAxes + +:: + + PyObject * + PyArray_Max(PyArrayObject *ap, int axis, PyArrayObject *out) + +Max + +:: + + PyObject * + PyArray_Min(PyArrayObject *ap, int axis, PyArrayObject *out) + +Min + +:: + + PyObject * + PyArray_Ptp(PyArrayObject *ap, int axis, PyArrayObject *out) + +Ptp + +:: + + PyObject * + PyArray_Mean(PyArrayObject *self, int axis, int rtype, PyArrayObject + *out) + +Mean + +:: + + PyObject * + PyArray_Trace(PyArrayObject *self, int offset, int axis1, int + axis2, int rtype, PyArrayObject *out) + +Trace + +:: + + PyObject * + PyArray_Diagonal(PyArrayObject *self, int offset, int axis1, int + axis2) + +Diagonal + +In NumPy versions prior to 1.7, this function always returned a copy of +the diagonal array. In 1.7, the code has been updated to compute a view +onto 'self', but it still copies this array before returning, as well as +setting the internal WARN_ON_WRITE flag. In a future version, it will +simply return a view onto self. + +:: + + PyObject * + PyArray_Clip(PyArrayObject *self, PyObject *min, PyObject + *max, PyArrayObject *out) + +Clip + +:: + + PyObject * + PyArray_Conjugate(PyArrayObject *self, PyArrayObject *out) + +Conjugate + +:: + + PyObject * + PyArray_Nonzero(PyArrayObject *self) + +Nonzero + +TODO: In NumPy 2.0, should make the iteration order a parameter. + +:: + + PyObject * + PyArray_Std(PyArrayObject *self, int axis, int rtype, PyArrayObject + *out, int variance) + +Set variance to 1 to by-pass square-root calculation and return variance +Std + +:: + + PyObject * + PyArray_Sum(PyArrayObject *self, int axis, int rtype, PyArrayObject + *out) + +Sum + +:: + + PyObject * + PyArray_CumSum(PyArrayObject *self, int axis, int rtype, PyArrayObject + *out) + +CumSum + +:: + + PyObject * + PyArray_Prod(PyArrayObject *self, int axis, int rtype, PyArrayObject + *out) + +Prod + +:: + + PyObject * + PyArray_CumProd(PyArrayObject *self, int axis, int + rtype, PyArrayObject *out) + +CumProd + +:: + + PyObject * + PyArray_All(PyArrayObject *self, int axis, PyArrayObject *out) + +All + +:: + + PyObject * + PyArray_Any(PyArrayObject *self, int axis, PyArrayObject *out) + +Any + +:: + + PyObject * + PyArray_Compress(PyArrayObject *self, PyObject *condition, int + axis, PyArrayObject *out) + +Compress + +:: + + PyObject * + PyArray_Flatten(PyArrayObject *a, NPY_ORDER order) + +Flatten + +:: + + PyObject * + PyArray_Ravel(PyArrayObject *arr, NPY_ORDER order) + +Ravel +Returns a contiguous array + +:: + + npy_intp + PyArray_MultiplyList(npy_intp *l1, int n) + +Multiply a List + +:: + + int + PyArray_MultiplyIntList(int *l1, int n) + +Multiply a List of ints + +:: + + void * + PyArray_GetPtr(PyArrayObject *obj, npy_intp*ind) + +Produce a pointer into array + +:: + + int + PyArray_CompareLists(npy_intp *l1, npy_intp *l2, int n) + +Compare Lists + +:: + + int + PyArray_AsCArray(PyObject **op, void *ptr, npy_intp *dims, int + nd, PyArray_Descr*typedescr) + +Simulate a C-array +steals a reference to typedescr -- can be NULL + +:: + + int + PyArray_As1D(PyObject **op, char **ptr, int *d1, int typecode) + +Convert to a 1D C-array + +:: + + int + PyArray_As2D(PyObject **op, char ***ptr, int *d1, int *d2, int + typecode) + +Convert to a 2D C-array + +:: + + int + PyArray_Free(PyObject *op, void *ptr) + +Free pointers created if As2D is called + +:: + + int + PyArray_Converter(PyObject *object, PyObject **address) + + +Useful to pass as converter function for O& processing in PyArgs_ParseTuple. + +This conversion function can be used with the "O&" argument for +PyArg_ParseTuple. It will immediately return an object of array type +or will convert to a NPY_ARRAY_CARRAY any other object. + +If you use PyArray_Converter, you must DECREF the array when finished +as you get a new reference to it. + +:: + + int + PyArray_IntpFromSequence(PyObject *seq, npy_intp *vals, int maxvals) + +PyArray_IntpFromSequence +Returns the number of integers converted or -1 if an error occurred. +vals must be large enough to hold maxvals + +:: + + PyObject * + PyArray_Concatenate(PyObject *op, int axis) + +Concatenate + +Concatenate an arbitrary Python sequence into an array. +op is a python object supporting the sequence interface. +Its elements will be concatenated together to form a single +multidimensional array. If axis is NPY_MAXDIMS or bigger, then +each sequence object will be flattened before concatenation + +:: + + PyObject * + PyArray_InnerProduct(PyObject *op1, PyObject *op2) + +Numeric.innerproduct(a,v) + +:: + + PyObject * + PyArray_MatrixProduct(PyObject *op1, PyObject *op2) + +Numeric.matrixproduct(a,v) +just like inner product but does the swapaxes stuff on the fly + +:: + + PyObject * + PyArray_CopyAndTranspose(PyObject *op) + +Copy and Transpose + +Could deprecate this function, as there isn't a speed benefit over +calling Transpose and then Copy. + +:: + + PyObject * + PyArray_Correlate(PyObject *op1, PyObject *op2, int mode) + +Numeric.correlate(a1,a2,mode) + +:: + + int + PyArray_TypestrConvert(int itemsize, int gentype) + +Typestr converter + +:: + + int + PyArray_DescrConverter(PyObject *obj, PyArray_Descr **at) + +Get typenum from an object -- None goes to NPY_DEFAULT_TYPE +This function takes a Python object representing a type and converts it +to a the correct PyArray_Descr * structure to describe the type. + +Many objects can be used to represent a data-type which in NumPy is +quite a flexible concept. + +This is the central code that converts Python objects to +Type-descriptor objects that are used throughout numpy. + +Returns a new reference in *at, but the returned should not be +modified as it may be one of the canonical immutable objects or +a reference to the input obj. + +:: + + int + PyArray_DescrConverter2(PyObject *obj, PyArray_Descr **at) + +Get typenum from an object -- None goes to NULL + +:: + + int + PyArray_IntpConverter(PyObject *obj, PyArray_Dims *seq) + +Get intp chunk from sequence + +This function takes a Python sequence object and allocates and +fills in an intp array with the converted values. + +Remember to free the pointer seq.ptr when done using +PyDimMem_FREE(seq.ptr)** + +:: + + int + PyArray_BufferConverter(PyObject *obj, PyArray_Chunk *buf) + +Get buffer chunk from object + +this function takes a Python object which exposes the (single-segment) +buffer interface and returns a pointer to the data segment + +You should increment the reference count by one of buf->base +if you will hang on to a reference + +You only get a borrowed reference to the object. Do not free the +memory... + +:: + + int + PyArray_AxisConverter(PyObject *obj, int *axis) + +Get axis from an object (possibly None) -- a converter function, + +See also PyArray_ConvertMultiAxis, which also handles a tuple of axes. + +:: + + int + PyArray_BoolConverter(PyObject *object, npy_bool *val) + +Convert an object to true / false + +:: + + int + PyArray_ByteorderConverter(PyObject *obj, char *endian) + +Convert object to endian + +:: + + int + PyArray_OrderConverter(PyObject *object, NPY_ORDER *val) + +Convert an object to FORTRAN / C / ANY / KEEP + +:: + + unsigned char + PyArray_EquivTypes(PyArray_Descr *type1, PyArray_Descr *type2) + + +This function returns true if the two typecodes are +equivalent (same basic kind and same itemsize). + +:: + + PyObject * + PyArray_Zeros(int nd, npy_intp *dims, PyArray_Descr *type, int + is_f_order) + +Zeros + +steals a reference to type. On failure or when dtype->subarray is +true, dtype will be decrefed. +accepts NULL type + +:: + + PyObject * + PyArray_Empty(int nd, npy_intp *dims, PyArray_Descr *type, int + is_f_order) + +Empty + +accepts NULL type +steals referenct to type + +:: + + PyObject * + PyArray_Where(PyObject *condition, PyObject *x, PyObject *y) + +Where + +:: + + PyObject * + PyArray_Arange(double start, double stop, double step, int type_num) + +Arange, + +:: + + PyObject * + PyArray_ArangeObj(PyObject *start, PyObject *stop, PyObject + *step, PyArray_Descr *dtype) + + +ArangeObj, + +this doesn't change the references + +:: + + int + PyArray_SortkindConverter(PyObject *obj, NPY_SORTKIND *sortkind) + +Convert object to sort kind + +:: + + PyObject * + PyArray_LexSort(PyObject *sort_keys, int axis) + +LexSort an array providing indices that will sort a collection of arrays +lexicographically. The first key is sorted on first, followed by the second key +-- requires that arg"merge"sort is available for each sort_key + +Returns an index array that shows the indexes for the lexicographic sort along +the given axis. + +:: + + PyObject * + PyArray_Round(PyArrayObject *a, int decimals, PyArrayObject *out) + +Round + +:: + + unsigned char + PyArray_EquivTypenums(int typenum1, int typenum2) + + +:: + + int + PyArray_RegisterDataType(PyArray_Descr *descr) + +Register Data type +Does not change the reference count of descr + +:: + + int + PyArray_RegisterCastFunc(PyArray_Descr *descr, int + totype, PyArray_VectorUnaryFunc *castfunc) + +Register Casting Function +Replaces any function currently stored. + +:: + + int + PyArray_RegisterCanCast(PyArray_Descr *descr, int + totype, NPY_SCALARKIND scalar) + +Register a type number indicating that a descriptor can be cast +to it safely + +:: + + void + PyArray_InitArrFuncs(PyArray_ArrFuncs *f) + +Initialize arrfuncs to NULL + +:: + + PyObject * + PyArray_IntTupleFromIntp(int len, npy_intp *vals) + +PyArray_IntTupleFromIntp + +:: + + int + PyArray_TypeNumFromName(char *str) + + +:: + + int + PyArray_ClipmodeConverter(PyObject *object, NPY_CLIPMODE *val) + +Convert an object to NPY_RAISE / NPY_CLIP / NPY_WRAP + +:: + + int + PyArray_OutputConverter(PyObject *object, PyArrayObject **address) + +Useful to pass as converter function for O& processing in +PyArgs_ParseTuple for output arrays + +:: + + PyObject * + PyArray_BroadcastToShape(PyObject *obj, npy_intp *dims, int nd) + +Get Iterator broadcast to a particular shape + +:: + + void + _PyArray_SigintHandler(int signum) + + +:: + + void* + _PyArray_GetSigintBuf(void ) + + +:: + + int + PyArray_DescrAlignConverter(PyObject *obj, PyArray_Descr **at) + + +Get type-descriptor from an object forcing alignment if possible +None goes to DEFAULT type. + +any object with the .fields attribute and/or .itemsize attribute (if the +.fields attribute does not give the total size -- i.e. a partial record +naming). If itemsize is given it must be >= size computed from fields + +The .fields attribute must return a convertible dictionary if present. +Result inherits from NPY_VOID. + +:: + + int + PyArray_DescrAlignConverter2(PyObject *obj, PyArray_Descr **at) + + +Get type-descriptor from an object forcing alignment if possible +None goes to NULL. + +:: + + int + PyArray_SearchsideConverter(PyObject *obj, void *addr) + +Convert object to searchsorted side + +:: + + PyObject * + PyArray_CheckAxis(PyArrayObject *arr, int *axis, int flags) + +PyArray_CheckAxis + +check that axis is valid +convert 0-d arrays to 1-d arrays + +:: + + npy_intp + PyArray_OverflowMultiplyList(npy_intp *l1, int n) + +Multiply a List of Non-negative numbers with over-flow detection. + +:: + + int + PyArray_CompareString(char *s1, char *s2, size_t len) + + +:: + + PyObject * + PyArray_MultiIterFromObjects(PyObject **mps, int n, int nadd, ... ) + +Get MultiIterator from array of Python objects and any additional + +PyObject **mps -- array of PyObjects +int n - number of PyObjects in the array +int nadd - number of additional arrays to include in the iterator. + +Returns a multi-iterator object. + +:: + + int + PyArray_GetEndianness(void ) + + +:: + + unsigned int + PyArray_GetNDArrayCFeatureVersion(void ) + +Returns the built-in (at compilation time) C API version + +:: + + PyObject * + PyArray_Correlate2(PyObject *op1, PyObject *op2, int mode) + +correlate(a1,a2,mode) + +This function computes the usual correlation (correlate(a1, a2) != +correlate(a2, a1), and conjugate the second argument for complex inputs + +:: + + PyObject* + PyArray_NeighborhoodIterNew(PyArrayIterObject *x, npy_intp + *bounds, int mode, PyArrayObject*fill) + +A Neighborhood Iterator object. + +:: + + void + PyArray_SetDatetimeParseFunction(PyObject *op) + +This function is scheduled to be removed + +TO BE REMOVED - NOT USED INTERNALLY. + +:: + + void + PyArray_DatetimeToDatetimeStruct(npy_datetime val, NPY_DATETIMEUNIT + fr, npy_datetimestruct *result) + +Fill the datetime struct from the value and resolution unit. + +TO BE REMOVED - NOT USED INTERNALLY. + +:: + + void + PyArray_TimedeltaToTimedeltaStruct(npy_timedelta val, NPY_DATETIMEUNIT + fr, npy_timedeltastruct *result) + +Fill the timedelta struct from the timedelta value and resolution unit. + +TO BE REMOVED - NOT USED INTERNALLY. + +:: + + npy_datetime + PyArray_DatetimeStructToDatetime(NPY_DATETIMEUNIT + fr, npy_datetimestruct *d) + +Create a datetime value from a filled datetime struct and resolution unit. + +TO BE REMOVED - NOT USED INTERNALLY. + +:: + + npy_datetime + PyArray_TimedeltaStructToTimedelta(NPY_DATETIMEUNIT + fr, npy_timedeltastruct *d) + +Create a timdelta value from a filled timedelta struct and resolution unit. + +TO BE REMOVED - NOT USED INTERNALLY. + +:: + + NpyIter * + NpyIter_New(PyArrayObject *op, npy_uint32 flags, NPY_ORDER + order, NPY_CASTING casting, PyArray_Descr*dtype) + +Allocate a new iterator for one array object. + +:: + + NpyIter * + NpyIter_MultiNew(int nop, PyArrayObject **op_in, npy_uint32 + flags, NPY_ORDER order, NPY_CASTING + casting, npy_uint32 *op_flags, PyArray_Descr + **op_request_dtypes) + +Allocate a new iterator for more than one array object, using +standard NumPy broadcasting rules and the default buffer size. + +:: + + NpyIter * + NpyIter_AdvancedNew(int nop, PyArrayObject **op_in, npy_uint32 + flags, NPY_ORDER order, NPY_CASTING + casting, npy_uint32 *op_flags, PyArray_Descr + **op_request_dtypes, int oa_ndim, int + **op_axes, npy_intp *itershape, npy_intp + buffersize) + +Allocate a new iterator for multiple array objects, and advanced +options for controlling the broadcasting, shape, and buffer size. + +:: + + NpyIter * + NpyIter_Copy(NpyIter *iter) + +Makes a copy of the iterator + +:: + + int + NpyIter_Deallocate(NpyIter *iter) + +Deallocate an iterator + +:: + + npy_bool + NpyIter_HasDelayedBufAlloc(NpyIter *iter) + +Whether the buffer allocation is being delayed + +:: + + npy_bool + NpyIter_HasExternalLoop(NpyIter *iter) + +Whether the iterator handles the inner loop + +:: + + int + NpyIter_EnableExternalLoop(NpyIter *iter) + +Removes the inner loop handling (so HasExternalLoop returns true) + +:: + + npy_intp * + NpyIter_GetInnerStrideArray(NpyIter *iter) + +Get the array of strides for the inner loop (when HasExternalLoop is true) + +This function may be safely called without holding the Python GIL. + +:: + + npy_intp * + NpyIter_GetInnerLoopSizePtr(NpyIter *iter) + +Get a pointer to the size of the inner loop (when HasExternalLoop is true) + +This function may be safely called without holding the Python GIL. + +:: + + int + NpyIter_Reset(NpyIter *iter, char **errmsg) + +Resets the iterator to its initial state + +If errmsg is non-NULL, it should point to a variable which will +receive the error message, and no Python exception will be set. +This is so that the function can be called from code not holding +the GIL. + +:: + + int + NpyIter_ResetBasePointers(NpyIter *iter, char **baseptrs, char + **errmsg) + +Resets the iterator to its initial state, with new base data pointers. +This function requires great caution. + +If errmsg is non-NULL, it should point to a variable which will +receive the error message, and no Python exception will be set. +This is so that the function can be called from code not holding +the GIL. + +:: + + int + NpyIter_ResetToIterIndexRange(NpyIter *iter, npy_intp istart, npy_intp + iend, char **errmsg) + +Resets the iterator to a new iterator index range + +If errmsg is non-NULL, it should point to a variable which will +receive the error message, and no Python exception will be set. +This is so that the function can be called from code not holding +the GIL. + +:: + + int + NpyIter_GetNDim(NpyIter *iter) + +Gets the number of dimensions being iterated + +:: + + int + NpyIter_GetNOp(NpyIter *iter) + +Gets the number of operands being iterated + +:: + + NpyIter_IterNextFunc * + NpyIter_GetIterNext(NpyIter *iter, char **errmsg) + +Compute the specialized iteration function for an iterator + +If errmsg is non-NULL, it should point to a variable which will +receive the error message, and no Python exception will be set. +This is so that the function can be called from code not holding +the GIL. + +:: + + npy_intp + NpyIter_GetIterSize(NpyIter *iter) + +Gets the number of elements being iterated + +:: + + void + NpyIter_GetIterIndexRange(NpyIter *iter, npy_intp *istart, npy_intp + *iend) + +Gets the range of iteration indices being iterated + +:: + + npy_intp + NpyIter_GetIterIndex(NpyIter *iter) + +Gets the current iteration index + +:: + + int + NpyIter_GotoIterIndex(NpyIter *iter, npy_intp iterindex) + +Sets the iterator position to the specified iterindex, +which matches the iteration order of the iterator. + +Returns NPY_SUCCEED on success, NPY_FAIL on failure. + +:: + + npy_bool + NpyIter_HasMultiIndex(NpyIter *iter) + +Whether the iterator is tracking a multi-index + +:: + + int + NpyIter_GetShape(NpyIter *iter, npy_intp *outshape) + +Gets the broadcast shape if a multi-index is being tracked by the iterator, +otherwise gets the shape of the iteration as Fortran-order +(fastest-changing index first). + +The reason Fortran-order is returned when a multi-index +is not enabled is that this is providing a direct view into how +the iterator traverses the n-dimensional space. The iterator organizes +its memory from fastest index to slowest index, and when +a multi-index is enabled, it uses a permutation to recover the original +order. + +Returns NPY_SUCCEED or NPY_FAIL. + +:: + + NpyIter_GetMultiIndexFunc * + NpyIter_GetGetMultiIndex(NpyIter *iter, char **errmsg) + +Compute a specialized get_multi_index function for the iterator + +If errmsg is non-NULL, it should point to a variable which will +receive the error message, and no Python exception will be set. +This is so that the function can be called from code not holding +the GIL. + +:: + + int + NpyIter_GotoMultiIndex(NpyIter *iter, npy_intp *multi_index) + +Sets the iterator to the specified multi-index, which must have the +correct number of entries for 'ndim'. It is only valid +when NPY_ITER_MULTI_INDEX was passed to the constructor. This operation +fails if the multi-index is out of bounds. + +Returns NPY_SUCCEED on success, NPY_FAIL on failure. + +:: + + int + NpyIter_RemoveMultiIndex(NpyIter *iter) + +Removes multi-index support from an iterator. + +Returns NPY_SUCCEED or NPY_FAIL. + +:: + + npy_bool + NpyIter_HasIndex(NpyIter *iter) + +Whether the iterator is tracking an index + +:: + + npy_bool + NpyIter_IsBuffered(NpyIter *iter) + +Whether the iterator is buffered + +:: + + npy_bool + NpyIter_IsGrowInner(NpyIter *iter) + +Whether the inner loop can grow if buffering is unneeded + +:: + + npy_intp + NpyIter_GetBufferSize(NpyIter *iter) + +Gets the size of the buffer, or 0 if buffering is not enabled + +:: + + npy_intp * + NpyIter_GetIndexPtr(NpyIter *iter) + +Get a pointer to the index, if it is being tracked + +:: + + int + NpyIter_GotoIndex(NpyIter *iter, npy_intp flat_index) + +If the iterator is tracking an index, sets the iterator +to the specified index. + +Returns NPY_SUCCEED on success, NPY_FAIL on failure. + +:: + + char ** + NpyIter_GetDataPtrArray(NpyIter *iter) + +Get the array of data pointers (1 per object being iterated) + +This function may be safely called without holding the Python GIL. + +:: + + PyArray_Descr ** + NpyIter_GetDescrArray(NpyIter *iter) + +Get the array of data type pointers (1 per object being iterated) + +:: + + PyArrayObject ** + NpyIter_GetOperandArray(NpyIter *iter) + +Get the array of objects being iterated + +:: + + PyArrayObject * + NpyIter_GetIterView(NpyIter *iter, npy_intp i) + +Returns a view to the i-th object with the iterator's internal axes + +:: + + void + NpyIter_GetReadFlags(NpyIter *iter, char *outreadflags) + +Gets an array of read flags (1 per object being iterated) + +:: + + void + NpyIter_GetWriteFlags(NpyIter *iter, char *outwriteflags) + +Gets an array of write flags (1 per object being iterated) + +:: + + void + NpyIter_DebugPrint(NpyIter *iter) + +For debugging + +:: + + npy_bool + NpyIter_IterationNeedsAPI(NpyIter *iter) + +Whether the iteration loop, and in particular the iternext() +function, needs API access. If this is true, the GIL must +be retained while iterating. + +:: + + void + NpyIter_GetInnerFixedStrideArray(NpyIter *iter, npy_intp *out_strides) + +Get an array of strides which are fixed. Any strides which may +change during iteration receive the value NPY_MAX_INTP. Once +the iterator is ready to iterate, call this to get the strides +which will always be fixed in the inner loop, then choose optimized +inner loop functions which take advantage of those fixed strides. + +This function may be safely called without holding the Python GIL. + +:: + + int + NpyIter_RemoveAxis(NpyIter *iter, int axis) + +Removes an axis from iteration. This requires that NPY_ITER_MULTI_INDEX +was set for iterator creation, and does not work if buffering is +enabled. This function also resets the iterator to its initial state. + +Returns NPY_SUCCEED or NPY_FAIL. + +:: + + npy_intp * + NpyIter_GetAxisStrideArray(NpyIter *iter, int axis) + +Gets the array of strides for the specified axis. +If the iterator is tracking a multi-index, gets the strides +for the axis specified, otherwise gets the strides for +the iteration axis as Fortran order (fastest-changing axis first). + +Returns NULL if an error occurs. + +:: + + npy_bool + NpyIter_RequiresBuffering(NpyIter *iter) + +Whether the iteration could be done with no buffering. + +:: + + char ** + NpyIter_GetInitialDataPtrArray(NpyIter *iter) + +Get the array of data pointers (1 per object being iterated), +directly into the arrays (never pointing to a buffer), for starting +unbuffered iteration. This always returns the addresses for the +iterator position as reset to iterator index 0. + +These pointers are different from the pointers accepted by +NpyIter_ResetBasePointers, because the direction along some +axes may have been reversed, requiring base offsets. + +This function may be safely called without holding the Python GIL. + +:: + + int + NpyIter_CreateCompatibleStrides(NpyIter *iter, npy_intp + itemsize, npy_intp *outstrides) + +Builds a set of strides which are the same as the strides of an +output array created using the NPY_ITER_ALLOCATE flag, where NULL +was passed for op_axes. This is for data packed contiguously, +but not necessarily in C or Fortran order. This should be used +together with NpyIter_GetShape and NpyIter_GetNDim. + +A use case for this function is to match the shape and layout of +the iterator and tack on one or more dimensions. For example, +in order to generate a vector per input value for a numerical gradient, +you pass in ndim*itemsize for itemsize, then add another dimension to +the end with size ndim and stride itemsize. To do the Hessian matrix, +you do the same thing but add two dimensions, or take advantage of +the symmetry and pack it into 1 dimension with a particular encoding. + +This function may only be called if the iterator is tracking a multi-index +and if NPY_ITER_DONT_NEGATE_STRIDES was used to prevent an axis from +being iterated in reverse order. + +If an array is created with this method, simply adding 'itemsize' +for each iteration will traverse the new array matching the +iterator. + +Returns NPY_SUCCEED or NPY_FAIL. + +:: + + int + PyArray_CastingConverter(PyObject *obj, NPY_CASTING *casting) + +Convert any Python object, *obj*, to an NPY_CASTING enum. + +:: + + npy_intp + PyArray_CountNonzero(PyArrayObject *self) + +Counts the number of non-zero elements in the array. + +Returns -1 on error. + +:: + + PyArray_Descr * + PyArray_PromoteTypes(PyArray_Descr *type1, PyArray_Descr *type2) + +Produces the smallest size and lowest kind type to which both +input types can be cast. + +:: + + PyArray_Descr * + PyArray_MinScalarType(PyArrayObject *arr) + +If arr is a scalar (has 0 dimensions) with a built-in number data type, +finds the smallest type size/kind which can still represent its data. +Otherwise, returns the array's data type. + + +:: + + PyArray_Descr * + PyArray_ResultType(npy_intp narrs, PyArrayObject **arr, npy_intp + ndtypes, PyArray_Descr **dtypes) + +Produces the result type of a bunch of inputs, using the UFunc +type promotion rules. Use this function when you have a set of +input arrays, and need to determine an output array dtype. + +If all the inputs are scalars (have 0 dimensions) or the maximum "kind" +of the scalars is greater than the maximum "kind" of the arrays, does +a regular type promotion. + +Otherwise, does a type promotion on the MinScalarType +of all the inputs. Data types passed directly are treated as array +types. + + +:: + + npy_bool + PyArray_CanCastArrayTo(PyArrayObject *arr, PyArray_Descr + *to, NPY_CASTING casting) + +Returns 1 if the array object may be cast to the given data type using +the casting rule, 0 otherwise. This differs from PyArray_CanCastTo in +that it handles scalar arrays (0 dimensions) specially, by checking +their value. + +:: + + npy_bool + PyArray_CanCastTypeTo(PyArray_Descr *from, PyArray_Descr + *to, NPY_CASTING casting) + +Returns true if data of type 'from' may be cast to data of type +'to' according to the rule 'casting'. + +:: + + PyArrayObject * + PyArray_EinsteinSum(char *subscripts, npy_intp nop, PyArrayObject + **op_in, PyArray_Descr *dtype, NPY_ORDER + order, NPY_CASTING casting, PyArrayObject *out) + +This function provides summation of array elements according to +the Einstein summation convention. For example: +- trace(a) -> einsum("ii", a) +- transpose(a) -> einsum("ji", a) +- multiply(a,b) -> einsum(",", a, b) +- inner(a,b) -> einsum("i,i", a, b) +- outer(a,b) -> einsum("i,j", a, b) +- matvec(a,b) -> einsum("ij,j", a, b) +- matmat(a,b) -> einsum("ij,jk", a, b) + +subscripts: The string of subscripts for einstein summation. +nop: The number of operands +op_in: The array of operands +dtype: Either NULL, or the data type to force the calculation as. +order: The order for the calculation/the output axes. +casting: What kind of casts should be permitted. +out: Either NULL, or an array into which the output should be placed. + +By default, the labels get placed in alphabetical order +at the end of the output. So, if c = einsum("i,j", a, b) +then c[i,j] == a[i]*b[j], but if c = einsum("j,i", a, b) +then c[i,j] = a[j]*b[i]. + +Alternatively, you can control the output order or prevent +an axis from being summed/force an axis to be summed by providing +indices for the output. This allows us to turn 'trace' into +'diag', for example. +- diag(a) -> einsum("ii->i", a) +- sum(a, axis=0) -> einsum("i...->", a) + +Subscripts at the beginning and end may be specified by +putting an ellipsis "..." in the middle. For example, +the function einsum("i...i", a) takes the diagonal of +the first and last dimensions of the operand, and +einsum("ij...,jk...->ik...") takes the matrix product using +the first two indices of each operand instead of the last two. + +When there is only one operand, no axes being summed, and +no output parameter, this function returns a view +into the operand instead of making a copy. + +:: + + PyObject * + PyArray_NewLikeArray(PyArrayObject *prototype, NPY_ORDER + order, PyArray_Descr *dtype, int subok) + +Creates a new array with the same shape as the provided one, +with possible memory layout order and data type changes. + +prototype - The array the new one should be like. +order - NPY_CORDER - C-contiguous result. +NPY_FORTRANORDER - Fortran-contiguous result. +NPY_ANYORDER - Fortran if prototype is Fortran, C otherwise. +NPY_KEEPORDER - Keeps the axis ordering of prototype. +dtype - If not NULL, overrides the data type of the result. +subok - If 1, use the prototype's array subtype, otherwise +always create a base-class array. + +NOTE: If dtype is not NULL, steals the dtype reference. On failure or when +dtype->subarray is true, dtype will be decrefed. + +:: + + int + PyArray_GetArrayParamsFromObject(PyObject *op, PyArray_Descr + *requested_dtype, npy_bool + writeable, PyArray_Descr + **out_dtype, int *out_ndim, npy_intp + *out_dims, PyArrayObject + **out_arr, PyObject *context) + +Retrieves the array parameters for viewing/converting an arbitrary +PyObject* to a NumPy array. This allows the "innate type and shape" +of Python list-of-lists to be discovered without +actually converting to an array. + +In some cases, such as structured arrays and the __array__ interface, +a data type needs to be used to make sense of the object. When +this is needed, provide a Descr for 'requested_dtype', otherwise +provide NULL. This reference is not stolen. Also, if the requested +dtype doesn't modify the interpretation of the input, out_dtype will +still get the "innate" dtype of the object, not the dtype passed +in 'requested_dtype'. + +If writing to the value in 'op' is desired, set the boolean +'writeable' to 1. This raises an error when 'op' is a scalar, list +of lists, or other non-writeable 'op'. + +Result: When success (0 return value) is returned, either out_arr +is filled with a non-NULL PyArrayObject and +the rest of the parameters are untouched, or out_arr is +filled with NULL, and the rest of the parameters are +filled. + +Typical usage: + +PyArrayObject *arr = NULL; +PyArray_Descr *dtype = NULL; +int ndim = 0; +npy_intp dims[NPY_MAXDIMS]; + +if (PyArray_GetArrayParamsFromObject(op, NULL, 1, &dtype, +&ndim, dims, &arr, NULL) < 0) { +return NULL; +} +if (arr == NULL) { +... validate/change dtype, validate flags, ndim, etc ... +// Could make custom strides here too +arr = PyArray_NewFromDescr(&PyArray_Type, dtype, ndim, +dims, NULL, +is_f_order ? NPY_ARRAY_F_CONTIGUOUS : 0, +NULL); +if (arr == NULL) { +return NULL; +} +if (PyArray_CopyObject(arr, op) < 0) { +Py_DECREF(arr); +return NULL; +} +} +else { +... in this case the other parameters weren't filled, just +validate and possibly copy arr itself ... +} +... use arr ... + +:: + + int + PyArray_ConvertClipmodeSequence(PyObject *object, NPY_CLIPMODE + *modes, int n) + +Convert an object to an array of n NPY_CLIPMODE values. +This is intended to be used in functions where a different mode +could be applied to each axis, like in ravel_multi_index. + +:: + + PyObject * + PyArray_MatrixProduct2(PyObject *op1, PyObject + *op2, PyArrayObject*out) + +Numeric.matrixproduct2(a,v,out) +just like inner product but does the swapaxes stuff on the fly + +:: + + npy_bool + NpyIter_IsFirstVisit(NpyIter *iter, int iop) + +Checks to see whether this is the first time the elements +of the specified reduction operand which the iterator points at are +being seen for the first time. The function returns +a reasonable answer for reduction operands and when buffering is +disabled. The answer may be incorrect for buffered non-reduction +operands. + +This function is intended to be used in EXTERNAL_LOOP mode only, +and will produce some wrong answers when that mode is not enabled. + +If this function returns true, the caller should also +check the inner loop stride of the operand, because if +that stride is 0, then only the first element of the innermost +external loop is being visited for the first time. + +WARNING: For performance reasons, 'iop' is not bounds-checked, +it is not confirmed that 'iop' is actually a reduction +operand, and it is not confirmed that EXTERNAL_LOOP +mode is enabled. These checks are the responsibility of +the caller, and should be done outside of any inner loops. + +:: + + int + PyArray_SetBaseObject(PyArrayObject *arr, PyObject *obj) + +Sets the 'base' attribute of the array. This steals a reference +to 'obj'. + +Returns 0 on success, -1 on failure. + +:: + + void + PyArray_CreateSortedStridePerm(int ndim, npy_intp + *strides, npy_stride_sort_item + *out_strideperm) + + +This function populates the first ndim elements +of strideperm with sorted descending by their absolute values. +For example, the stride array (4, -2, 12) becomes +[(2, 12), (0, 4), (1, -2)]. + +:: + + void + PyArray_RemoveAxesInPlace(PyArrayObject *arr, npy_bool *flags) + + +Removes the axes flagged as True from the array, +modifying it in place. If an axis flagged for removal +has a shape entry bigger than one, this effectively selects +index zero for that axis. + +WARNING: If an axis flagged for removal has a shape equal to zero, +the array will point to invalid memory. The caller must +validate this! +If an axis flagged for removal has a shape larger than one, +the aligned flag (and in the future the contiguous flags), +may need explicit update. +(check also NPY_RELAXED_STRIDES_CHECKING) + +For example, this can be used to remove the reduction axes +from a reduction result once its computation is complete. + +:: + + void + PyArray_DebugPrint(PyArrayObject *obj) + +Prints the raw data of the ndarray in a form useful for debugging +low-level C issues. + +:: + + int + PyArray_FailUnlessWriteable(PyArrayObject *obj, const char *name) + + +This function does nothing if obj is writeable, and raises an exception +(and returns -1) if obj is not writeable. It may also do other +house-keeping, such as issuing warnings on arrays which are transitioning +to become views. Always call this function at some point before writing to +an array. + +'name' is a name for the array, used to give better error +messages. Something like "assignment destination", "output array", or even +just "array". + +:: + + int + PyArray_SetUpdateIfCopyBase(PyArrayObject *arr, PyArrayObject *base) + + +Precondition: 'arr' is a copy of 'base' (though possibly with different +strides, ordering, etc.). This function sets the UPDATEIFCOPY flag and the +->base pointer on 'arr', so that when 'arr' is destructed, it will copy any +changes back to 'base'. DEPRECATED, use PyArray_SetWritebackIfCopyBase + +Steals a reference to 'base'. + +Returns 0 on success, -1 on failure. + +:: + + void * + PyDataMem_NEW(size_t size) + +Allocates memory for array data. + +:: + + void + PyDataMem_FREE(void *ptr) + +Free memory for array data. + +:: + + void * + PyDataMem_RENEW(void *ptr, size_t size) + +Reallocate/resize memory for array data. + +:: + + PyDataMem_EventHookFunc * + PyDataMem_SetEventHook(PyDataMem_EventHookFunc *newhook, void + *user_data, void **old_data) + +Sets the allocation event hook for numpy array data. +Takes a PyDataMem_EventHookFunc *, which has the signature: +void hook(void *old, void *new, size_t size, void *user_data). +Also takes a void *user_data, and void **old_data. + +Returns a pointer to the previous hook or NULL. If old_data is +non-NULL, the previous user_data pointer will be copied to it. + +If not NULL, hook will be called at the end of each PyDataMem_NEW/FREE/RENEW: +result = PyDataMem_NEW(size) -> (*hook)(NULL, result, size, user_data) +PyDataMem_FREE(ptr) -> (*hook)(ptr, NULL, 0, user_data) +result = PyDataMem_RENEW(ptr, size) -> (*hook)(ptr, result, size, user_data) + +When the hook is called, the GIL will be held by the calling +thread. The hook should be written to be reentrant, if it performs +operations that might cause new allocation events (such as the +creation/destruction numpy objects, or creating/destroying Python +objects which might cause a gc) + +:: + + void + PyArray_MapIterSwapAxes(PyArrayMapIterObject *mit, PyArrayObject + **ret, int getmap) + + +:: + + PyObject * + PyArray_MapIterArray(PyArrayObject *a, PyObject *index) + + +Use advanced indexing to iterate an array. + +:: + + void + PyArray_MapIterNext(PyArrayMapIterObject *mit) + +This function needs to update the state of the map iterator +and point mit->dataptr to the memory-location of the next object + +Note that this function never handles an extra operand but provides +compatibility for an old (exposed) API. + +:: + + int + PyArray_Partition(PyArrayObject *op, PyArrayObject *ktharray, int + axis, NPY_SELECTKIND which) + +Partition an array in-place + +:: + + PyObject * + PyArray_ArgPartition(PyArrayObject *op, PyArrayObject *ktharray, int + axis, NPY_SELECTKIND which) + +ArgPartition an array + +:: + + int + PyArray_SelectkindConverter(PyObject *obj, NPY_SELECTKIND *selectkind) + +Convert object to select kind + +:: + + void * + PyDataMem_NEW_ZEROED(size_t size, size_t elsize) + +Allocates zeroed memory for array data. + +:: + + int + PyArray_CheckAnyScalarExact(PyObject *obj) + +return true an object is exactly a numpy scalar + +:: + + PyObject * + PyArray_MapIterArrayCopyIfOverlap(PyArrayObject *a, PyObject + *index, int + copy_if_overlap, PyArrayObject + *extra_op) + + +Same as PyArray_MapIterArray, but: + +If copy_if_overlap != 0, check if `a` has memory overlap with any of the +arrays in `index` and with `extra_op`. If yes, make copies as appropriate +to avoid problems if `a` is modified during the iteration. +`iter->array` may contain a copied array (UPDATEIFCOPY/WRITEBACKIFCOPY set). + +:: + + int + PyArray_ResolveWritebackIfCopy(PyArrayObject *self) + + +If WRITEBACKIFCOPY and self has data, reset the base WRITEABLE flag, +copy the local data to base, release the local data, and set flags +appropriately. Return 0 if not relevant, 1 if success, < 0 on failure + +:: + + int + PyArray_SetWritebackIfCopyBase(PyArrayObject *arr, PyArrayObject + *base) + + +Precondition: 'arr' is a copy of 'base' (though possibly with different +strides, ordering, etc.). This function sets the WRITEBACKIFCOPY flag and the +->base pointer on 'arr', call PyArray_ResolveWritebackIfCopy to copy any +changes back to 'base' before deallocating the array. + +Steals a reference to 'base'. + +Returns 0 on success, -1 on failure. + diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h new file mode 100644 index 0000000000000000000000000000000000000000..2cc7ced3584d0040b95b889cd33b33a7b8eac844 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h @@ -0,0 +1,285 @@ +/* + * DON'T INCLUDE THIS DIRECTLY. + */ + +#ifndef NPY_NDARRAYOBJECT_H +#define NPY_NDARRAYOBJECT_H +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include "ndarraytypes.h" + +/* Includes the "function" C-API -- these are all stored in a + list of pointers --- one for each file + The two lists are concatenated into one in multiarray. + + They are available as import_array() +*/ + +#include "__multiarray_api.h" + + +/* C-API that requires previous API to be defined */ + +#define PyArray_DescrCheck(op) (((PyObject*)(op))->ob_type==&PyArrayDescr_Type) + +#define PyArray_Check(op) PyObject_TypeCheck(op, &PyArray_Type) +#define PyArray_CheckExact(op) (((PyObject*)(op))->ob_type == &PyArray_Type) + +#define PyArray_HasArrayInterfaceType(op, type, context, out) \ + ((((out)=PyArray_FromStructInterface(op)) != Py_NotImplemented) || \ + (((out)=PyArray_FromInterface(op)) != Py_NotImplemented) || \ + (((out)=PyArray_FromArrayAttr(op, type, context)) != \ + Py_NotImplemented)) + +#define PyArray_HasArrayInterface(op, out) \ + PyArray_HasArrayInterfaceType(op, NULL, NULL, out) + +#define PyArray_IsZeroDim(op) (PyArray_Check(op) && \ + (PyArray_NDIM((PyArrayObject *)op) == 0)) + +#define PyArray_IsScalar(obj, cls) \ + (PyObject_TypeCheck(obj, &Py##cls##ArrType_Type)) + +#define PyArray_CheckScalar(m) (PyArray_IsScalar(m, Generic) || \ + PyArray_IsZeroDim(m)) +#if PY_MAJOR_VERSION >= 3 +#define PyArray_IsPythonNumber(obj) \ + (PyFloat_Check(obj) || PyComplex_Check(obj) || \ + PyLong_Check(obj) || PyBool_Check(obj)) +#define PyArray_IsIntegerScalar(obj) (PyLong_Check(obj) \ + || PyArray_IsScalar((obj), Integer)) +#define PyArray_IsPythonScalar(obj) \ + (PyArray_IsPythonNumber(obj) || PyBytes_Check(obj) || \ + PyUnicode_Check(obj)) +#else +#define PyArray_IsPythonNumber(obj) \ + (PyInt_Check(obj) || PyFloat_Check(obj) || PyComplex_Check(obj) || \ + PyLong_Check(obj) || PyBool_Check(obj)) +#define PyArray_IsIntegerScalar(obj) (PyInt_Check(obj) \ + || PyLong_Check(obj) \ + || PyArray_IsScalar((obj), Integer)) +#define PyArray_IsPythonScalar(obj) \ + (PyArray_IsPythonNumber(obj) || PyString_Check(obj) || \ + PyUnicode_Check(obj)) +#endif + +#define PyArray_IsAnyScalar(obj) \ + (PyArray_IsScalar(obj, Generic) || PyArray_IsPythonScalar(obj)) + +#define PyArray_CheckAnyScalar(obj) (PyArray_IsPythonScalar(obj) || \ + PyArray_CheckScalar(obj)) + + +#define PyArray_GETCONTIGUOUS(m) (PyArray_ISCONTIGUOUS(m) ? \ + Py_INCREF(m), (m) : \ + (PyArrayObject *)(PyArray_Copy(m))) + +#define PyArray_SAMESHAPE(a1,a2) ((PyArray_NDIM(a1) == PyArray_NDIM(a2)) && \ + PyArray_CompareLists(PyArray_DIMS(a1), \ + PyArray_DIMS(a2), \ + PyArray_NDIM(a1))) + +#define PyArray_SIZE(m) PyArray_MultiplyList(PyArray_DIMS(m), PyArray_NDIM(m)) +#define PyArray_NBYTES(m) (PyArray_ITEMSIZE(m) * PyArray_SIZE(m)) +#define PyArray_FROM_O(m) PyArray_FromAny(m, NULL, 0, 0, 0, NULL) + +#define PyArray_FROM_OF(m,flags) PyArray_CheckFromAny(m, NULL, 0, 0, flags, \ + NULL) + +#define PyArray_FROM_OT(m,type) PyArray_FromAny(m, \ + PyArray_DescrFromType(type), 0, 0, 0, NULL) + +#define PyArray_FROM_OTF(m, type, flags) \ + PyArray_FromAny(m, PyArray_DescrFromType(type), 0, 0, \ + (((flags) & NPY_ARRAY_ENSURECOPY) ? \ + ((flags) | NPY_ARRAY_DEFAULT) : (flags)), NULL) + +#define PyArray_FROMANY(m, type, min, max, flags) \ + PyArray_FromAny(m, PyArray_DescrFromType(type), min, max, \ + (((flags) & NPY_ARRAY_ENSURECOPY) ? \ + (flags) | NPY_ARRAY_DEFAULT : (flags)), NULL) + +#define PyArray_ZEROS(m, dims, type, is_f_order) \ + PyArray_Zeros(m, dims, PyArray_DescrFromType(type), is_f_order) + +#define PyArray_EMPTY(m, dims, type, is_f_order) \ + PyArray_Empty(m, dims, PyArray_DescrFromType(type), is_f_order) + +#define PyArray_FILLWBYTE(obj, val) memset(PyArray_DATA(obj), val, \ + PyArray_NBYTES(obj)) +#ifndef PYPY_VERSION +#define PyArray_REFCOUNT(obj) (((PyObject *)(obj))->ob_refcnt) +#define NPY_REFCOUNT PyArray_REFCOUNT +#endif +#define NPY_MAX_ELSIZE (2 * NPY_SIZEOF_LONGDOUBLE) + +#define PyArray_ContiguousFromAny(op, type, min_depth, max_depth) \ + PyArray_FromAny(op, PyArray_DescrFromType(type), min_depth, \ + max_depth, NPY_ARRAY_DEFAULT, NULL) + +#define PyArray_EquivArrTypes(a1, a2) \ + PyArray_EquivTypes(PyArray_DESCR(a1), PyArray_DESCR(a2)) + +#define PyArray_EquivByteorders(b1, b2) \ + (((b1) == (b2)) || (PyArray_ISNBO(b1) == PyArray_ISNBO(b2))) + +#define PyArray_SimpleNew(nd, dims, typenum) \ + PyArray_New(&PyArray_Type, nd, dims, typenum, NULL, NULL, 0, 0, NULL) + +#define PyArray_SimpleNewFromData(nd, dims, typenum, data) \ + PyArray_New(&PyArray_Type, nd, dims, typenum, NULL, \ + data, 0, NPY_ARRAY_CARRAY, NULL) + +#define PyArray_SimpleNewFromDescr(nd, dims, descr) \ + PyArray_NewFromDescr(&PyArray_Type, descr, nd, dims, \ + NULL, NULL, 0, NULL) + +#define PyArray_ToScalar(data, arr) \ + PyArray_Scalar(data, PyArray_DESCR(arr), (PyObject *)arr) + + +/* These might be faster without the dereferencing of obj + going on inside -- of course an optimizing compiler should + inline the constants inside a for loop making it a moot point +*/ + +#define PyArray_GETPTR1(obj, i) ((void *)(PyArray_BYTES(obj) + \ + (i)*PyArray_STRIDES(obj)[0])) + +#define PyArray_GETPTR2(obj, i, j) ((void *)(PyArray_BYTES(obj) + \ + (i)*PyArray_STRIDES(obj)[0] + \ + (j)*PyArray_STRIDES(obj)[1])) + +#define PyArray_GETPTR3(obj, i, j, k) ((void *)(PyArray_BYTES(obj) + \ + (i)*PyArray_STRIDES(obj)[0] + \ + (j)*PyArray_STRIDES(obj)[1] + \ + (k)*PyArray_STRIDES(obj)[2])) + +#define PyArray_GETPTR4(obj, i, j, k, l) ((void *)(PyArray_BYTES(obj) + \ + (i)*PyArray_STRIDES(obj)[0] + \ + (j)*PyArray_STRIDES(obj)[1] + \ + (k)*PyArray_STRIDES(obj)[2] + \ + (l)*PyArray_STRIDES(obj)[3])) + +/* Move to arrayobject.c once PyArray_XDECREF_ERR is removed */ +static NPY_INLINE void +PyArray_DiscardWritebackIfCopy(PyArrayObject *arr) +{ + PyArrayObject_fields *fa = (PyArrayObject_fields *)arr; + if (fa && fa->base) { + if ((fa->flags & NPY_ARRAY_UPDATEIFCOPY) || + (fa->flags & NPY_ARRAY_WRITEBACKIFCOPY)) { + PyArray_ENABLEFLAGS((PyArrayObject*)fa->base, NPY_ARRAY_WRITEABLE); + Py_DECREF(fa->base); + fa->base = NULL; + PyArray_CLEARFLAGS(arr, NPY_ARRAY_WRITEBACKIFCOPY); + PyArray_CLEARFLAGS(arr, NPY_ARRAY_UPDATEIFCOPY); + } + } +} + +#define PyArray_DESCR_REPLACE(descr) do { \ + PyArray_Descr *_new_; \ + _new_ = PyArray_DescrNew(descr); \ + Py_XDECREF(descr); \ + descr = _new_; \ + } while(0) + +/* Copy should always return contiguous array */ +#define PyArray_Copy(obj) PyArray_NewCopy(obj, NPY_CORDER) + +#define PyArray_FromObject(op, type, min_depth, max_depth) \ + PyArray_FromAny(op, PyArray_DescrFromType(type), min_depth, \ + max_depth, NPY_ARRAY_BEHAVED | \ + NPY_ARRAY_ENSUREARRAY, NULL) + +#define PyArray_ContiguousFromObject(op, type, min_depth, max_depth) \ + PyArray_FromAny(op, PyArray_DescrFromType(type), min_depth, \ + max_depth, NPY_ARRAY_DEFAULT | \ + NPY_ARRAY_ENSUREARRAY, NULL) + +#define PyArray_CopyFromObject(op, type, min_depth, max_depth) \ + PyArray_FromAny(op, PyArray_DescrFromType(type), min_depth, \ + max_depth, NPY_ARRAY_ENSURECOPY | \ + NPY_ARRAY_DEFAULT | \ + NPY_ARRAY_ENSUREARRAY, NULL) + +#define PyArray_Cast(mp, type_num) \ + PyArray_CastToType(mp, PyArray_DescrFromType(type_num), 0) + +#define PyArray_Take(ap, items, axis) \ + PyArray_TakeFrom(ap, items, axis, NULL, NPY_RAISE) + +#define PyArray_Put(ap, items, values) \ + PyArray_PutTo(ap, items, values, NPY_RAISE) + +/* Compatibility with old Numeric stuff -- don't use in new code */ + +#define PyArray_FromDimsAndData(nd, d, type, data) \ + PyArray_FromDimsAndDataAndDescr(nd, d, PyArray_DescrFromType(type), \ + data) + + +/* + Check to see if this key in the dictionary is the "title" + entry of the tuple (i.e. a duplicate dictionary entry in the fields + dict. +*/ + +static NPY_INLINE int +NPY_TITLE_KEY_check(PyObject *key, PyObject *value) +{ + PyObject *title; + if (PyTuple_Size(value) != 3) { + return 0; + } + title = PyTuple_GetItem(value, 2); + if (key == title) { + return 1; + } +#ifdef PYPY_VERSION + /* + * On PyPy, dictionary keys do not always preserve object identity. + * Fall back to comparison by value. + */ + if (PyUnicode_Check(title) && PyUnicode_Check(key)) { + return PyUnicode_Compare(title, key) == 0 ? 1 : 0; + } +#if PY_VERSION_HEX < 0x03000000 + if (PyString_Check(title) && PyString_Check(key)) { + return PyObject_Compare(title, key) == 0 ? 1 : 0; + } +#endif +#endif + return 0; +} + +/* Macro, for backward compat with "if NPY_TITLE_KEY(key, value) { ..." */ +#define NPY_TITLE_KEY(key, value) (NPY_TITLE_KEY_check((key), (value))) + +#define DEPRECATE(msg) PyErr_WarnEx(PyExc_DeprecationWarning,msg,1) +#define DEPRECATE_FUTUREWARNING(msg) PyErr_WarnEx(PyExc_FutureWarning,msg,1) + +#if !defined(NPY_NO_DEPRECATED_API) || \ + (NPY_NO_DEPRECATED_API < NPY_1_14_API_VERSION) +static NPY_INLINE void +PyArray_XDECREF_ERR(PyArrayObject *arr) +{ + /* 2017-Nov-10 1.14 */ + DEPRECATE("PyArray_XDECREF_ERR is deprecated, call " + "PyArray_DiscardWritebackIfCopy then Py_XDECREF instead"); + PyArray_DiscardWritebackIfCopy(arr); + Py_XDECREF(arr); +} +#endif + + +#ifdef __cplusplus +} +#endif + + +#endif /* NPY_NDARRAYOBJECT_H */ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h new file mode 100644 index 0000000000000000000000000000000000000000..b0b749c802028ef4f0d744206aeeed1705f12c1c --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h @@ -0,0 +1,1838 @@ +#ifndef NDARRAYTYPES_H +#define NDARRAYTYPES_H + +#include "npy_common.h" +#include "npy_endian.h" +#include "npy_cpu.h" +#include "utils.h" + +#define NPY_NO_EXPORT NPY_VISIBILITY_HIDDEN + +/* Only use thread if configured in config and python supports it */ +#if defined WITH_THREAD && !NPY_NO_SMP + #define NPY_ALLOW_THREADS 1 +#else + #define NPY_ALLOW_THREADS 0 +#endif + +#ifndef __has_extension +#define __has_extension(x) 0 +#endif + +#if !defined(_NPY_NO_DEPRECATIONS) && \ + ((defined(__GNUC__)&& __GNUC__ >= 6) || \ + __has_extension(attribute_deprecated_with_message)) +#define NPY_ATTR_DEPRECATE(text) __attribute__ ((deprecated (text))) +#else +#define NPY_ATTR_DEPRECATE(text) +#endif + +/* + * There are several places in the code where an array of dimensions + * is allocated statically. This is the size of that static + * allocation. + * + * The array creation itself could have arbitrary dimensions but all + * the places where static allocation is used would need to be changed + * to dynamic (including inside of several structures) + */ + +#define NPY_MAXDIMS 32 +#define NPY_MAXARGS 32 + +/* Used for Converter Functions "O&" code in ParseTuple */ +#define NPY_FAIL 0 +#define NPY_SUCCEED 1 + +/* + * Binary compatibility version number. This number is increased + * whenever the C-API is changed such that binary compatibility is + * broken, i.e. whenever a recompile of extension modules is needed. + */ +#define NPY_VERSION NPY_ABI_VERSION + +/* + * Minor API version. This number is increased whenever a change is + * made to the C-API -- whether it breaks binary compatibility or not. + * Some changes, such as adding a function pointer to the end of the + * function table, can be made without breaking binary compatibility. + * In this case, only the NPY_FEATURE_VERSION (*not* NPY_VERSION) + * would be increased. Whenever binary compatibility is broken, both + * NPY_VERSION and NPY_FEATURE_VERSION should be increased. + */ +#define NPY_FEATURE_VERSION NPY_API_VERSION + +enum NPY_TYPES { NPY_BOOL=0, + NPY_BYTE, NPY_UBYTE, + NPY_SHORT, NPY_USHORT, + NPY_INT, NPY_UINT, + NPY_LONG, NPY_ULONG, + NPY_LONGLONG, NPY_ULONGLONG, + NPY_FLOAT, NPY_DOUBLE, NPY_LONGDOUBLE, + NPY_CFLOAT, NPY_CDOUBLE, NPY_CLONGDOUBLE, + NPY_OBJECT=17, + NPY_STRING, NPY_UNICODE, + NPY_VOID, + /* + * New 1.6 types appended, may be integrated + * into the above in 2.0. + */ + NPY_DATETIME, NPY_TIMEDELTA, NPY_HALF, + + NPY_NTYPES, + NPY_NOTYPE, + NPY_CHAR NPY_ATTR_DEPRECATE("Use NPY_STRING"), + NPY_USERDEF=256, /* leave room for characters */ + + /* The number of types not including the new 1.6 types */ + NPY_NTYPES_ABI_COMPATIBLE=21 +}; +#ifdef _MSC_VER +#pragma deprecated(NPY_CHAR) +#endif + +/* basetype array priority */ +#define NPY_PRIORITY 0.0 + +/* default subtype priority */ +#define NPY_SUBTYPE_PRIORITY 1.0 + +/* default scalar priority */ +#define NPY_SCALAR_PRIORITY -1000000.0 + +/* How many floating point types are there (excluding half) */ +#define NPY_NUM_FLOATTYPE 3 + +/* + * These characters correspond to the array type and the struct + * module + */ + +enum NPY_TYPECHAR { + NPY_BOOLLTR = '?', + NPY_BYTELTR = 'b', + NPY_UBYTELTR = 'B', + NPY_SHORTLTR = 'h', + NPY_USHORTLTR = 'H', + NPY_INTLTR = 'i', + NPY_UINTLTR = 'I', + NPY_LONGLTR = 'l', + NPY_ULONGLTR = 'L', + NPY_LONGLONGLTR = 'q', + NPY_ULONGLONGLTR = 'Q', + NPY_HALFLTR = 'e', + NPY_FLOATLTR = 'f', + NPY_DOUBLELTR = 'd', + NPY_LONGDOUBLELTR = 'g', + NPY_CFLOATLTR = 'F', + NPY_CDOUBLELTR = 'D', + NPY_CLONGDOUBLELTR = 'G', + NPY_OBJECTLTR = 'O', + NPY_STRINGLTR = 'S', + NPY_STRINGLTR2 = 'a', + NPY_UNICODELTR = 'U', + NPY_VOIDLTR = 'V', + NPY_DATETIMELTR = 'M', + NPY_TIMEDELTALTR = 'm', + NPY_CHARLTR = 'c', + + /* + * No Descriptor, just a define -- this let's + * Python users specify an array of integers + * large enough to hold a pointer on the + * platform + */ + NPY_INTPLTR = 'p', + NPY_UINTPLTR = 'P', + + /* + * These are for dtype 'kinds', not dtype 'typecodes' + * as the above are for. + */ + NPY_GENBOOLLTR ='b', + NPY_SIGNEDLTR = 'i', + NPY_UNSIGNEDLTR = 'u', + NPY_FLOATINGLTR = 'f', + NPY_COMPLEXLTR = 'c' +}; + +typedef enum { + NPY_QUICKSORT=0, + NPY_HEAPSORT=1, + NPY_MERGESORT=2 +} NPY_SORTKIND; +#define NPY_NSORTS (NPY_MERGESORT + 1) + + +typedef enum { + NPY_INTROSELECT=0 +} NPY_SELECTKIND; +#define NPY_NSELECTS (NPY_INTROSELECT + 1) + + +typedef enum { + NPY_SEARCHLEFT=0, + NPY_SEARCHRIGHT=1 +} NPY_SEARCHSIDE; +#define NPY_NSEARCHSIDES (NPY_SEARCHRIGHT + 1) + + +typedef enum { + NPY_NOSCALAR=-1, + NPY_BOOL_SCALAR, + NPY_INTPOS_SCALAR, + NPY_INTNEG_SCALAR, + NPY_FLOAT_SCALAR, + NPY_COMPLEX_SCALAR, + NPY_OBJECT_SCALAR +} NPY_SCALARKIND; +#define NPY_NSCALARKINDS (NPY_OBJECT_SCALAR + 1) + +/* For specifying array memory layout or iteration order */ +typedef enum { + /* Fortran order if inputs are all Fortran, C otherwise */ + NPY_ANYORDER=-1, + /* C order */ + NPY_CORDER=0, + /* Fortran order */ + NPY_FORTRANORDER=1, + /* An order as close to the inputs as possible */ + NPY_KEEPORDER=2 +} NPY_ORDER; + +/* For specifying allowed casting in operations which support it */ +typedef enum { + /* Only allow identical types */ + NPY_NO_CASTING=0, + /* Allow identical and byte swapped types */ + NPY_EQUIV_CASTING=1, + /* Only allow safe casts */ + NPY_SAFE_CASTING=2, + /* Allow safe casts or casts within the same kind */ + NPY_SAME_KIND_CASTING=3, + /* Allow any casts */ + NPY_UNSAFE_CASTING=4 +} NPY_CASTING; + +typedef enum { + NPY_CLIP=0, + NPY_WRAP=1, + NPY_RAISE=2 +} NPY_CLIPMODE; + +/* The special not-a-time (NaT) value */ +#define NPY_DATETIME_NAT NPY_MIN_INT64 + +/* + * Upper bound on the length of a DATETIME ISO 8601 string + * YEAR: 21 (64-bit year) + * MONTH: 3 + * DAY: 3 + * HOURS: 3 + * MINUTES: 3 + * SECONDS: 3 + * ATTOSECONDS: 1 + 3*6 + * TIMEZONE: 5 + * NULL TERMINATOR: 1 + */ +#define NPY_DATETIME_MAX_ISO8601_STRLEN (21 + 3*5 + 1 + 3*6 + 6 + 1) + +/* The FR in the unit names stands for frequency */ +typedef enum { + /* Force signed enum type, must be -1 for code compatibility */ + NPY_FR_ERROR = -1, /* error or undetermined */ + + /* Start of valid units */ + NPY_FR_Y = 0, /* Years */ + NPY_FR_M = 1, /* Months */ + NPY_FR_W = 2, /* Weeks */ + /* Gap where 1.6 NPY_FR_B (value 3) was */ + NPY_FR_D = 4, /* Days */ + NPY_FR_h = 5, /* hours */ + NPY_FR_m = 6, /* minutes */ + NPY_FR_s = 7, /* seconds */ + NPY_FR_ms = 8, /* milliseconds */ + NPY_FR_us = 9, /* microseconds */ + NPY_FR_ns = 10, /* nanoseconds */ + NPY_FR_ps = 11, /* picoseconds */ + NPY_FR_fs = 12, /* femtoseconds */ + NPY_FR_as = 13, /* attoseconds */ + NPY_FR_GENERIC = 14 /* unbound units, can convert to anything */ +} NPY_DATETIMEUNIT; + +/* + * NOTE: With the NPY_FR_B gap for 1.6 ABI compatibility, NPY_DATETIME_NUMUNITS + * is technically one more than the actual number of units. + */ +#define NPY_DATETIME_NUMUNITS (NPY_FR_GENERIC + 1) +#define NPY_DATETIME_DEFAULTUNIT NPY_FR_GENERIC + +/* + * Business day conventions for mapping invalid business + * days to valid business days. + */ +typedef enum { + /* Go forward in time to the following business day. */ + NPY_BUSDAY_FORWARD, + NPY_BUSDAY_FOLLOWING = NPY_BUSDAY_FORWARD, + /* Go backward in time to the preceding business day. */ + NPY_BUSDAY_BACKWARD, + NPY_BUSDAY_PRECEDING = NPY_BUSDAY_BACKWARD, + /* + * Go forward in time to the following business day, unless it + * crosses a month boundary, in which case go backward + */ + NPY_BUSDAY_MODIFIEDFOLLOWING, + /* + * Go backward in time to the preceding business day, unless it + * crosses a month boundary, in which case go forward. + */ + NPY_BUSDAY_MODIFIEDPRECEDING, + /* Produce a NaT for non-business days. */ + NPY_BUSDAY_NAT, + /* Raise an exception for non-business days. */ + NPY_BUSDAY_RAISE +} NPY_BUSDAY_ROLL; + +/************************************************************ + * NumPy Auxiliary Data for inner loops, sort functions, etc. + ************************************************************/ + +/* + * When creating an auxiliary data struct, this should always appear + * as the first member, like this: + * + * typedef struct { + * NpyAuxData base; + * double constant; + * } constant_multiplier_aux_data; + */ +typedef struct NpyAuxData_tag NpyAuxData; + +/* Function pointers for freeing or cloning auxiliary data */ +typedef void (NpyAuxData_FreeFunc) (NpyAuxData *); +typedef NpyAuxData *(NpyAuxData_CloneFunc) (NpyAuxData *); + +struct NpyAuxData_tag { + NpyAuxData_FreeFunc *free; + NpyAuxData_CloneFunc *clone; + /* To allow for a bit of expansion without breaking the ABI */ + void *reserved[2]; +}; + +/* Macros to use for freeing and cloning auxiliary data */ +#define NPY_AUXDATA_FREE(auxdata) \ + do { \ + if ((auxdata) != NULL) { \ + (auxdata)->free(auxdata); \ + } \ + } while(0) +#define NPY_AUXDATA_CLONE(auxdata) \ + ((auxdata)->clone(auxdata)) + +#define NPY_ERR(str) fprintf(stderr, #str); fflush(stderr); +#define NPY_ERR2(str) fprintf(stderr, str); fflush(stderr); + +#define NPY_STRINGIFY(x) #x +#define NPY_TOSTRING(x) NPY_STRINGIFY(x) + + /* + * Macros to define how array, and dimension/strides data is + * allocated. + */ + + /* Data buffer - PyDataMem_NEW/FREE/RENEW are in multiarraymodule.c */ + +#define NPY_USE_PYMEM 1 + +#if NPY_USE_PYMEM == 1 + /* numpy sometimes calls PyArray_malloc() with the GIL released. On Python + 3.3 and older, it was safe to call PyMem_Malloc() with the GIL released. + On Python 3.4 and newer, it's better to use PyMem_RawMalloc() to be able + to use tracemalloc. On Python 3.6, calling PyMem_Malloc() with the GIL + released is now a fatal error in debug mode. */ +# if PY_VERSION_HEX >= 0x03040000 +# define PyArray_malloc PyMem_RawMalloc +# define PyArray_free PyMem_RawFree +# define PyArray_realloc PyMem_RawRealloc +# else +# define PyArray_malloc PyMem_Malloc +# define PyArray_free PyMem_Free +# define PyArray_realloc PyMem_Realloc +# endif +#else +#define PyArray_malloc malloc +#define PyArray_free free +#define PyArray_realloc realloc +#endif + +/* Dimensions and strides */ +#define PyDimMem_NEW(size) \ + ((npy_intp *)PyArray_malloc(size*sizeof(npy_intp))) + +#define PyDimMem_FREE(ptr) PyArray_free(ptr) + +#define PyDimMem_RENEW(ptr,size) \ + ((npy_intp *)PyArray_realloc(ptr,size*sizeof(npy_intp))) + +/* forward declaration */ +struct _PyArray_Descr; + +/* These must deal with unaligned and swapped data if necessary */ +typedef PyObject * (PyArray_GetItemFunc) (void *, void *); +typedef int (PyArray_SetItemFunc)(PyObject *, void *, void *); + +typedef void (PyArray_CopySwapNFunc)(void *, npy_intp, void *, npy_intp, + npy_intp, int, void *); + +typedef void (PyArray_CopySwapFunc)(void *, void *, int, void *); +typedef npy_bool (PyArray_NonzeroFunc)(void *, void *); + + +/* + * These assume aligned and notswapped data -- a buffer will be used + * before or contiguous data will be obtained + */ + +typedef int (PyArray_CompareFunc)(const void *, const void *, void *); +typedef int (PyArray_ArgFunc)(void*, npy_intp, npy_intp*, void *); + +typedef void (PyArray_DotFunc)(void *, npy_intp, void *, npy_intp, void *, + npy_intp, void *); + +typedef void (PyArray_VectorUnaryFunc)(void *, void *, npy_intp, void *, + void *); + +/* + * XXX the ignore argument should be removed next time the API version + * is bumped. It used to be the separator. + */ +typedef int (PyArray_ScanFunc)(FILE *fp, void *dptr, + char *ignore, struct _PyArray_Descr *); +typedef int (PyArray_FromStrFunc)(char *s, void *dptr, char **endptr, + struct _PyArray_Descr *); + +typedef int (PyArray_FillFunc)(void *, npy_intp, void *); + +typedef int (PyArray_SortFunc)(void *, npy_intp, void *); +typedef int (PyArray_ArgSortFunc)(void *, npy_intp *, npy_intp, void *); +typedef int (PyArray_PartitionFunc)(void *, npy_intp, npy_intp, + npy_intp *, npy_intp *, + void *); +typedef int (PyArray_ArgPartitionFunc)(void *, npy_intp *, npy_intp, npy_intp, + npy_intp *, npy_intp *, + void *); + +typedef int (PyArray_FillWithScalarFunc)(void *, npy_intp, void *, void *); + +typedef int (PyArray_ScalarKindFunc)(void *); + +typedef void (PyArray_FastClipFunc)(void *in, npy_intp n_in, void *min, + void *max, void *out); +typedef void (PyArray_FastPutmaskFunc)(void *in, void *mask, npy_intp n_in, + void *values, npy_intp nv); +typedef int (PyArray_FastTakeFunc)(void *dest, void *src, npy_intp *indarray, + npy_intp nindarray, npy_intp n_outer, + npy_intp m_middle, npy_intp nelem, + NPY_CLIPMODE clipmode); + +typedef struct { + npy_intp *ptr; + int len; +} PyArray_Dims; + +typedef struct { + /* + * Functions to cast to most other standard types + * Can have some NULL entries. The types + * DATETIME, TIMEDELTA, and HALF go into the castdict + * even though they are built-in. + */ + PyArray_VectorUnaryFunc *cast[NPY_NTYPES_ABI_COMPATIBLE]; + + /* The next four functions *cannot* be NULL */ + + /* + * Functions to get and set items with standard Python types + * -- not array scalars + */ + PyArray_GetItemFunc *getitem; + PyArray_SetItemFunc *setitem; + + /* + * Copy and/or swap data. Memory areas may not overlap + * Use memmove first if they might + */ + PyArray_CopySwapNFunc *copyswapn; + PyArray_CopySwapFunc *copyswap; + + /* + * Function to compare items + * Can be NULL + */ + PyArray_CompareFunc *compare; + + /* + * Function to select largest + * Can be NULL + */ + PyArray_ArgFunc *argmax; + + /* + * Function to compute dot product + * Can be NULL + */ + PyArray_DotFunc *dotfunc; + + /* + * Function to scan an ASCII file and + * place a single value plus possible separator + * Can be NULL + */ + PyArray_ScanFunc *scanfunc; + + /* + * Function to read a single value from a string + * and adjust the pointer; Can be NULL + */ + PyArray_FromStrFunc *fromstr; + + /* + * Function to determine if data is zero or not + * If NULL a default version is + * used at Registration time. + */ + PyArray_NonzeroFunc *nonzero; + + /* + * Used for arange. Should return 0 on success + * and -1 on failure. + * Can be NULL. + */ + PyArray_FillFunc *fill; + + /* + * Function to fill arrays with scalar values + * Can be NULL + */ + PyArray_FillWithScalarFunc *fillwithscalar; + + /* + * Sorting functions + * Can be NULL + */ + PyArray_SortFunc *sort[NPY_NSORTS]; + PyArray_ArgSortFunc *argsort[NPY_NSORTS]; + + /* + * Dictionary of additional casting functions + * PyArray_VectorUnaryFuncs + * which can be populated to support casting + * to other registered types. Can be NULL + */ + PyObject *castdict; + + /* + * Functions useful for generalizing + * the casting rules. + * Can be NULL; + */ + PyArray_ScalarKindFunc *scalarkind; + int **cancastscalarkindto; + int *cancastto; + + PyArray_FastClipFunc *fastclip; + PyArray_FastPutmaskFunc *fastputmask; + PyArray_FastTakeFunc *fasttake; + + /* + * Function to select smallest + * Can be NULL + */ + PyArray_ArgFunc *argmin; + +} PyArray_ArrFuncs; + +/* The item must be reference counted when it is inserted or extracted. */ +#define NPY_ITEM_REFCOUNT 0x01 +/* Same as needing REFCOUNT */ +#define NPY_ITEM_HASOBJECT 0x01 +/* Convert to list for pickling */ +#define NPY_LIST_PICKLE 0x02 +/* The item is a POINTER */ +#define NPY_ITEM_IS_POINTER 0x04 +/* memory needs to be initialized for this data-type */ +#define NPY_NEEDS_INIT 0x08 +/* operations need Python C-API so don't give-up thread. */ +#define NPY_NEEDS_PYAPI 0x10 +/* Use f.getitem when extracting elements of this data-type */ +#define NPY_USE_GETITEM 0x20 +/* Use f.setitem when setting creating 0-d array from this data-type.*/ +#define NPY_USE_SETITEM 0x40 +/* A sticky flag specifically for structured arrays */ +#define NPY_ALIGNED_STRUCT 0x80 + +/* + *These are inherited for global data-type if any data-types in the + * field have them + */ +#define NPY_FROM_FIELDS (NPY_NEEDS_INIT | NPY_LIST_PICKLE | \ + NPY_ITEM_REFCOUNT | NPY_NEEDS_PYAPI) + +#define NPY_OBJECT_DTYPE_FLAGS (NPY_LIST_PICKLE | NPY_USE_GETITEM | \ + NPY_ITEM_IS_POINTER | NPY_ITEM_REFCOUNT | \ + NPY_NEEDS_INIT | NPY_NEEDS_PYAPI) + +#define PyDataType_FLAGCHK(dtype, flag) \ + (((dtype)->flags & (flag)) == (flag)) + +#define PyDataType_REFCHK(dtype) \ + PyDataType_FLAGCHK(dtype, NPY_ITEM_REFCOUNT) + +typedef struct _PyArray_Descr { + PyObject_HEAD + /* + * the type object representing an + * instance of this type -- should not + * be two type_numbers with the same type + * object. + */ + PyTypeObject *typeobj; + /* kind for this type */ + char kind; + /* unique-character representing this type */ + char type; + /* + * '>' (big), '<' (little), '|' + * (not-applicable), or '=' (native). + */ + char byteorder; + /* flags describing data type */ + char flags; + /* number representing this type */ + int type_num; + /* element size (itemsize) for this type */ + int elsize; + /* alignment needed for this type */ + int alignment; + /* + * Non-NULL if this type is + * is an array (C-contiguous) + * of some other type + */ + struct _arr_descr *subarray; + /* + * The fields dictionary for this type + * For statically defined descr this + * is always Py_None + */ + PyObject *fields; + /* + * An ordered tuple of field names or NULL + * if no fields are defined + */ + PyObject *names; + /* + * a table of functions specific for each + * basic data descriptor + */ + PyArray_ArrFuncs *f; + /* Metadata about this dtype */ + PyObject *metadata; + /* + * Metadata specific to the C implementation + * of the particular dtype. This was added + * for NumPy 1.7.0. + */ + NpyAuxData *c_metadata; + /* Cached hash value (-1 if not yet computed). + * This was added for NumPy 2.0.0. + */ + npy_hash_t hash; +} PyArray_Descr; + +typedef struct _arr_descr { + PyArray_Descr *base; + PyObject *shape; /* a tuple */ +} PyArray_ArrayDescr; + +/* + * The main array object structure. + * + * It has been recommended to use the inline functions defined below + * (PyArray_DATA and friends) to access fields here for a number of + * releases. Direct access to the members themselves is deprecated. + * To ensure that your code does not use deprecated access, + * #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION + * (or NPY_1_8_API_VERSION or higher as required). + */ +/* This struct will be moved to a private header in a future release */ +typedef struct tagPyArrayObject_fields { + PyObject_HEAD + /* Pointer to the raw data buffer */ + char *data; + /* The number of dimensions, also called 'ndim' */ + int nd; + /* The size in each dimension, also called 'shape' */ + npy_intp *dimensions; + /* + * Number of bytes to jump to get to the + * next element in each dimension + */ + npy_intp *strides; + /* + * This object is decref'd upon + * deletion of array. Except in the + * case of WRITEBACKIFCOPY which has + * special handling. + * + * For views it points to the original + * array, collapsed so no chains of + * views occur. + * + * For creation from buffer object it + * points to an object that should be + * decref'd on deletion + * + * For WRITEBACKIFCOPY flag this is an + * array to-be-updated upon calling + * PyArray_ResolveWritebackIfCopy + */ + PyObject *base; + /* Pointer to type structure */ + PyArray_Descr *descr; + /* Flags describing array -- see below */ + int flags; + /* For weak references */ + PyObject *weakreflist; +} PyArrayObject_fields; + +/* + * To hide the implementation details, we only expose + * the Python struct HEAD. + */ +#if !defined(NPY_NO_DEPRECATED_API) || \ + (NPY_NO_DEPRECATED_API < NPY_1_7_API_VERSION) +/* + * Can't put this in npy_deprecated_api.h like the others. + * PyArrayObject field access is deprecated as of NumPy 1.7. + */ +typedef PyArrayObject_fields PyArrayObject; +#else +typedef struct tagPyArrayObject { + PyObject_HEAD +} PyArrayObject; +#endif + +#define NPY_SIZEOF_PYARRAYOBJECT (sizeof(PyArrayObject_fields)) + +/* Array Flags Object */ +typedef struct PyArrayFlagsObject { + PyObject_HEAD + PyObject *arr; + int flags; +} PyArrayFlagsObject; + +/* Mirrors buffer object to ptr */ + +typedef struct { + PyObject_HEAD + PyObject *base; + void *ptr; + npy_intp len; + int flags; +} PyArray_Chunk; + +typedef struct { + NPY_DATETIMEUNIT base; + int num; +} PyArray_DatetimeMetaData; + +typedef struct { + NpyAuxData base; + PyArray_DatetimeMetaData meta; +} PyArray_DatetimeDTypeMetaData; + +/* + * This structure contains an exploded view of a date-time value. + * NaT is represented by year == NPY_DATETIME_NAT. + */ +typedef struct { + npy_int64 year; + npy_int32 month, day, hour, min, sec, us, ps, as; +} npy_datetimestruct; + +/* This is not used internally. */ +typedef struct { + npy_int64 day; + npy_int32 sec, us, ps, as; +} npy_timedeltastruct; + +typedef int (PyArray_FinalizeFunc)(PyArrayObject *, PyObject *); + +/* + * Means c-style contiguous (last index varies the fastest). The data + * elements right after each other. + * + * This flag may be requested in constructor functions. + * This flag may be tested for in PyArray_FLAGS(arr). + */ +#define NPY_ARRAY_C_CONTIGUOUS 0x0001 + +/* + * Set if array is a contiguous Fortran array: the first index varies + * the fastest in memory (strides array is reverse of C-contiguous + * array) + * + * This flag may be requested in constructor functions. + * This flag may be tested for in PyArray_FLAGS(arr). + */ +#define NPY_ARRAY_F_CONTIGUOUS 0x0002 + +/* + * Note: all 0-d arrays are C_CONTIGUOUS and F_CONTIGUOUS. If a + * 1-d array is C_CONTIGUOUS it is also F_CONTIGUOUS. Arrays with + * more then one dimension can be C_CONTIGUOUS and F_CONTIGUOUS + * at the same time if they have either zero or one element. + * If NPY_RELAXED_STRIDES_CHECKING is set, a higher dimensional + * array is always C_CONTIGUOUS and F_CONTIGUOUS if it has zero elements + * and the array is contiguous if ndarray.squeeze() is contiguous. + * I.e. dimensions for which `ndarray.shape[dimension] == 1` are + * ignored. + */ + +/* + * If set, the array owns the data: it will be free'd when the array + * is deleted. + * + * This flag may be tested for in PyArray_FLAGS(arr). + */ +#define NPY_ARRAY_OWNDATA 0x0004 + +/* + * An array never has the next four set; they're only used as parameter + * flags to the various FromAny functions + * + * This flag may be requested in constructor functions. + */ + +/* Cause a cast to occur regardless of whether or not it is safe. */ +#define NPY_ARRAY_FORCECAST 0x0010 + +/* + * Always copy the array. Returned arrays are always CONTIGUOUS, + * ALIGNED, and WRITEABLE. + * + * This flag may be requested in constructor functions. + */ +#define NPY_ARRAY_ENSURECOPY 0x0020 + +/* + * Make sure the returned array is a base-class ndarray + * + * This flag may be requested in constructor functions. + */ +#define NPY_ARRAY_ENSUREARRAY 0x0040 + +/* + * Make sure that the strides are in units of the element size Needed + * for some operations with record-arrays. + * + * This flag may be requested in constructor functions. + */ +#define NPY_ARRAY_ELEMENTSTRIDES 0x0080 + +/* + * Array data is aligned on the appropriate memory address for the type + * stored according to how the compiler would align things (e.g., an + * array of integers (4 bytes each) starts on a memory address that's + * a multiple of 4) + * + * This flag may be requested in constructor functions. + * This flag may be tested for in PyArray_FLAGS(arr). + */ +#define NPY_ARRAY_ALIGNED 0x0100 + +/* + * Array data has the native endianness + * + * This flag may be requested in constructor functions. + */ +#define NPY_ARRAY_NOTSWAPPED 0x0200 + +/* + * Array data is writeable + * + * This flag may be requested in constructor functions. + * This flag may be tested for in PyArray_FLAGS(arr). + */ +#define NPY_ARRAY_WRITEABLE 0x0400 + +/* + * If this flag is set, then base contains a pointer to an array of + * the same size that should be updated with the current contents of + * this array when PyArray_ResolveWritebackIfCopy is called. + * + * This flag may be requested in constructor functions. + * This flag may be tested for in PyArray_FLAGS(arr). + */ +#define NPY_ARRAY_UPDATEIFCOPY 0x1000 /* Deprecated in 1.14 */ +#define NPY_ARRAY_WRITEBACKIFCOPY 0x2000 + +/* + * NOTE: there are also internal flags defined in multiarray/arrayobject.h, + * which start at bit 31 and work down. + */ + +#define NPY_ARRAY_BEHAVED (NPY_ARRAY_ALIGNED | \ + NPY_ARRAY_WRITEABLE) +#define NPY_ARRAY_BEHAVED_NS (NPY_ARRAY_ALIGNED | \ + NPY_ARRAY_WRITEABLE | \ + NPY_ARRAY_NOTSWAPPED) +#define NPY_ARRAY_CARRAY (NPY_ARRAY_C_CONTIGUOUS | \ + NPY_ARRAY_BEHAVED) +#define NPY_ARRAY_CARRAY_RO (NPY_ARRAY_C_CONTIGUOUS | \ + NPY_ARRAY_ALIGNED) +#define NPY_ARRAY_FARRAY (NPY_ARRAY_F_CONTIGUOUS | \ + NPY_ARRAY_BEHAVED) +#define NPY_ARRAY_FARRAY_RO (NPY_ARRAY_F_CONTIGUOUS | \ + NPY_ARRAY_ALIGNED) +#define NPY_ARRAY_DEFAULT (NPY_ARRAY_CARRAY) +#define NPY_ARRAY_IN_ARRAY (NPY_ARRAY_CARRAY_RO) +#define NPY_ARRAY_OUT_ARRAY (NPY_ARRAY_CARRAY) +#define NPY_ARRAY_INOUT_ARRAY (NPY_ARRAY_CARRAY | \ + NPY_ARRAY_UPDATEIFCOPY) +#define NPY_ARRAY_INOUT_ARRAY2 (NPY_ARRAY_CARRAY | \ + NPY_ARRAY_WRITEBACKIFCOPY) +#define NPY_ARRAY_IN_FARRAY (NPY_ARRAY_FARRAY_RO) +#define NPY_ARRAY_OUT_FARRAY (NPY_ARRAY_FARRAY) +#define NPY_ARRAY_INOUT_FARRAY (NPY_ARRAY_FARRAY | \ + NPY_ARRAY_UPDATEIFCOPY) +#define NPY_ARRAY_INOUT_FARRAY2 (NPY_ARRAY_FARRAY | \ + NPY_ARRAY_WRITEBACKIFCOPY) + +#define NPY_ARRAY_UPDATE_ALL (NPY_ARRAY_C_CONTIGUOUS | \ + NPY_ARRAY_F_CONTIGUOUS | \ + NPY_ARRAY_ALIGNED) + +/* This flag is for the array interface, not PyArrayObject */ +#define NPY_ARR_HAS_DESCR 0x0800 + + + + +/* + * Size of internal buffers used for alignment Make BUFSIZE a multiple + * of sizeof(npy_cdouble) -- usually 16 so that ufunc buffers are aligned + */ +#define NPY_MIN_BUFSIZE ((int)sizeof(npy_cdouble)) +#define NPY_MAX_BUFSIZE (((int)sizeof(npy_cdouble))*1000000) +#define NPY_BUFSIZE 8192 +/* buffer stress test size: */ +/*#define NPY_BUFSIZE 17*/ + +#define PyArray_MAX(a,b) (((a)>(b))?(a):(b)) +#define PyArray_MIN(a,b) (((a)<(b))?(a):(b)) +#define PyArray_CLT(p,q) ((((p).real==(q).real) ? ((p).imag < (q).imag) : \ + ((p).real < (q).real))) +#define PyArray_CGT(p,q) ((((p).real==(q).real) ? ((p).imag > (q).imag) : \ + ((p).real > (q).real))) +#define PyArray_CLE(p,q) ((((p).real==(q).real) ? ((p).imag <= (q).imag) : \ + ((p).real <= (q).real))) +#define PyArray_CGE(p,q) ((((p).real==(q).real) ? ((p).imag >= (q).imag) : \ + ((p).real >= (q).real))) +#define PyArray_CEQ(p,q) (((p).real==(q).real) && ((p).imag == (q).imag)) +#define PyArray_CNE(p,q) (((p).real!=(q).real) || ((p).imag != (q).imag)) + +/* + * C API: consists of Macros and functions. The MACROS are defined + * here. + */ + + +#define PyArray_ISCONTIGUOUS(m) PyArray_CHKFLAGS(m, NPY_ARRAY_C_CONTIGUOUS) +#define PyArray_ISWRITEABLE(m) PyArray_CHKFLAGS(m, NPY_ARRAY_WRITEABLE) +#define PyArray_ISALIGNED(m) PyArray_CHKFLAGS(m, NPY_ARRAY_ALIGNED) + +#define PyArray_IS_C_CONTIGUOUS(m) PyArray_CHKFLAGS(m, NPY_ARRAY_C_CONTIGUOUS) +#define PyArray_IS_F_CONTIGUOUS(m) PyArray_CHKFLAGS(m, NPY_ARRAY_F_CONTIGUOUS) + +/* the variable is used in some places, so always define it */ +#define NPY_BEGIN_THREADS_DEF PyThreadState *_save=NULL; +#if NPY_ALLOW_THREADS +#define NPY_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS +#define NPY_END_ALLOW_THREADS Py_END_ALLOW_THREADS +#define NPY_BEGIN_THREADS do {_save = PyEval_SaveThread();} while (0); +#define NPY_END_THREADS do { if (_save) \ + { PyEval_RestoreThread(_save); _save = NULL;} } while (0); +#define NPY_BEGIN_THREADS_THRESHOLDED(loop_size) do { if (loop_size > 500) \ + { _save = PyEval_SaveThread();} } while (0); + +#define NPY_BEGIN_THREADS_DESCR(dtype) \ + do {if (!(PyDataType_FLAGCHK(dtype, NPY_NEEDS_PYAPI))) \ + NPY_BEGIN_THREADS;} while (0); + +#define NPY_END_THREADS_DESCR(dtype) \ + do {if (!(PyDataType_FLAGCHK(dtype, NPY_NEEDS_PYAPI))) \ + NPY_END_THREADS; } while (0); + +#define NPY_ALLOW_C_API_DEF PyGILState_STATE __save__; +#define NPY_ALLOW_C_API do {__save__ = PyGILState_Ensure();} while (0); +#define NPY_DISABLE_C_API do {PyGILState_Release(__save__);} while (0); +#else +#define NPY_BEGIN_ALLOW_THREADS +#define NPY_END_ALLOW_THREADS +#define NPY_BEGIN_THREADS +#define NPY_END_THREADS +#define NPY_BEGIN_THREADS_THRESHOLDED(loop_size) +#define NPY_BEGIN_THREADS_DESCR(dtype) +#define NPY_END_THREADS_DESCR(dtype) +#define NPY_ALLOW_C_API_DEF +#define NPY_ALLOW_C_API +#define NPY_DISABLE_C_API +#endif + +/********************************** + * The nditer object, added in 1.6 + **********************************/ + +/* The actual structure of the iterator is an internal detail */ +typedef struct NpyIter_InternalOnly NpyIter; + +/* Iterator function pointers that may be specialized */ +typedef int (NpyIter_IterNextFunc)(NpyIter *iter); +typedef void (NpyIter_GetMultiIndexFunc)(NpyIter *iter, + npy_intp *outcoords); + +/*** Global flags that may be passed to the iterator constructors ***/ + +/* Track an index representing C order */ +#define NPY_ITER_C_INDEX 0x00000001 +/* Track an index representing Fortran order */ +#define NPY_ITER_F_INDEX 0x00000002 +/* Track a multi-index */ +#define NPY_ITER_MULTI_INDEX 0x00000004 +/* User code external to the iterator does the 1-dimensional innermost loop */ +#define NPY_ITER_EXTERNAL_LOOP 0x00000008 +/* Convert all the operands to a common data type */ +#define NPY_ITER_COMMON_DTYPE 0x00000010 +/* Operands may hold references, requiring API access during iteration */ +#define NPY_ITER_REFS_OK 0x00000020 +/* Zero-sized operands should be permitted, iteration checks IterSize for 0 */ +#define NPY_ITER_ZEROSIZE_OK 0x00000040 +/* Permits reductions (size-0 stride with dimension size > 1) */ +#define NPY_ITER_REDUCE_OK 0x00000080 +/* Enables sub-range iteration */ +#define NPY_ITER_RANGED 0x00000100 +/* Enables buffering */ +#define NPY_ITER_BUFFERED 0x00000200 +/* When buffering is enabled, grows the inner loop if possible */ +#define NPY_ITER_GROWINNER 0x00000400 +/* Delay allocation of buffers until first Reset* call */ +#define NPY_ITER_DELAY_BUFALLOC 0x00000800 +/* When NPY_KEEPORDER is specified, disable reversing negative-stride axes */ +#define NPY_ITER_DONT_NEGATE_STRIDES 0x00001000 +/* + * If output operands overlap with other operands (based on heuristics that + * has false positives but no false negatives), make temporary copies to + * eliminate overlap. + */ +#define NPY_ITER_COPY_IF_OVERLAP 0x00002000 + +/*** Per-operand flags that may be passed to the iterator constructors ***/ + +/* The operand will be read from and written to */ +#define NPY_ITER_READWRITE 0x00010000 +/* The operand will only be read from */ +#define NPY_ITER_READONLY 0x00020000 +/* The operand will only be written to */ +#define NPY_ITER_WRITEONLY 0x00040000 +/* The operand's data must be in native byte order */ +#define NPY_ITER_NBO 0x00080000 +/* The operand's data must be aligned */ +#define NPY_ITER_ALIGNED 0x00100000 +/* The operand's data must be contiguous (within the inner loop) */ +#define NPY_ITER_CONTIG 0x00200000 +/* The operand may be copied to satisfy requirements */ +#define NPY_ITER_COPY 0x00400000 +/* The operand may be copied with WRITEBACKIFCOPY to satisfy requirements */ +#define NPY_ITER_UPDATEIFCOPY 0x00800000 +/* Allocate the operand if it is NULL */ +#define NPY_ITER_ALLOCATE 0x01000000 +/* If an operand is allocated, don't use any subtype */ +#define NPY_ITER_NO_SUBTYPE 0x02000000 +/* This is a virtual array slot, operand is NULL but temporary data is there */ +#define NPY_ITER_VIRTUAL 0x04000000 +/* Require that the dimension match the iterator dimensions exactly */ +#define NPY_ITER_NO_BROADCAST 0x08000000 +/* A mask is being used on this array, affects buffer -> array copy */ +#define NPY_ITER_WRITEMASKED 0x10000000 +/* This array is the mask for all WRITEMASKED operands */ +#define NPY_ITER_ARRAYMASK 0x20000000 +/* Assume iterator order data access for COPY_IF_OVERLAP */ +#define NPY_ITER_OVERLAP_ASSUME_ELEMENTWISE 0x40000000 + +#define NPY_ITER_GLOBAL_FLAGS 0x0000ffff +#define NPY_ITER_PER_OP_FLAGS 0xffff0000 + + +/***************************** + * Basic iterator object + *****************************/ + +/* FWD declaration */ +typedef struct PyArrayIterObject_tag PyArrayIterObject; + +/* + * type of the function which translates a set of coordinates to a + * pointer to the data + */ +typedef char* (*npy_iter_get_dataptr_t)(PyArrayIterObject* iter, npy_intp*); + +struct PyArrayIterObject_tag { + PyObject_HEAD + int nd_m1; /* number of dimensions - 1 */ + npy_intp index, size; + npy_intp coordinates[NPY_MAXDIMS];/* N-dimensional loop */ + npy_intp dims_m1[NPY_MAXDIMS]; /* ao->dimensions - 1 */ + npy_intp strides[NPY_MAXDIMS]; /* ao->strides or fake */ + npy_intp backstrides[NPY_MAXDIMS];/* how far to jump back */ + npy_intp factors[NPY_MAXDIMS]; /* shape factors */ + PyArrayObject *ao; + char *dataptr; /* pointer to current item*/ + npy_bool contiguous; + + npy_intp bounds[NPY_MAXDIMS][2]; + npy_intp limits[NPY_MAXDIMS][2]; + npy_intp limits_sizes[NPY_MAXDIMS]; + npy_iter_get_dataptr_t translate; +} ; + + +/* Iterator API */ +#define PyArrayIter_Check(op) PyObject_TypeCheck(op, &PyArrayIter_Type) + +#define _PyAIT(it) ((PyArrayIterObject *)(it)) +#define PyArray_ITER_RESET(it) do { \ + _PyAIT(it)->index = 0; \ + _PyAIT(it)->dataptr = PyArray_BYTES(_PyAIT(it)->ao); \ + memset(_PyAIT(it)->coordinates, 0, \ + (_PyAIT(it)->nd_m1+1)*sizeof(npy_intp)); \ +} while (0) + +#define _PyArray_ITER_NEXT1(it) do { \ + (it)->dataptr += _PyAIT(it)->strides[0]; \ + (it)->coordinates[0]++; \ +} while (0) + +#define _PyArray_ITER_NEXT2(it) do { \ + if ((it)->coordinates[1] < (it)->dims_m1[1]) { \ + (it)->coordinates[1]++; \ + (it)->dataptr += (it)->strides[1]; \ + } \ + else { \ + (it)->coordinates[1] = 0; \ + (it)->coordinates[0]++; \ + (it)->dataptr += (it)->strides[0] - \ + (it)->backstrides[1]; \ + } \ +} while (0) + +#define PyArray_ITER_NEXT(it) do { \ + _PyAIT(it)->index++; \ + if (_PyAIT(it)->nd_m1 == 0) { \ + _PyArray_ITER_NEXT1(_PyAIT(it)); \ + } \ + else if (_PyAIT(it)->contiguous) \ + _PyAIT(it)->dataptr += PyArray_DESCR(_PyAIT(it)->ao)->elsize; \ + else if (_PyAIT(it)->nd_m1 == 1) { \ + _PyArray_ITER_NEXT2(_PyAIT(it)); \ + } \ + else { \ + int __npy_i; \ + for (__npy_i=_PyAIT(it)->nd_m1; __npy_i >= 0; __npy_i--) { \ + if (_PyAIT(it)->coordinates[__npy_i] < \ + _PyAIT(it)->dims_m1[__npy_i]) { \ + _PyAIT(it)->coordinates[__npy_i]++; \ + _PyAIT(it)->dataptr += \ + _PyAIT(it)->strides[__npy_i]; \ + break; \ + } \ + else { \ + _PyAIT(it)->coordinates[__npy_i] = 0; \ + _PyAIT(it)->dataptr -= \ + _PyAIT(it)->backstrides[__npy_i]; \ + } \ + } \ + } \ +} while (0) + +#define PyArray_ITER_GOTO(it, destination) do { \ + int __npy_i; \ + _PyAIT(it)->index = 0; \ + _PyAIT(it)->dataptr = PyArray_BYTES(_PyAIT(it)->ao); \ + for (__npy_i = _PyAIT(it)->nd_m1; __npy_i>=0; __npy_i--) { \ + if (destination[__npy_i] < 0) { \ + destination[__npy_i] += \ + _PyAIT(it)->dims_m1[__npy_i]+1; \ + } \ + _PyAIT(it)->dataptr += destination[__npy_i] * \ + _PyAIT(it)->strides[__npy_i]; \ + _PyAIT(it)->coordinates[__npy_i] = \ + destination[__npy_i]; \ + _PyAIT(it)->index += destination[__npy_i] * \ + ( __npy_i==_PyAIT(it)->nd_m1 ? 1 : \ + _PyAIT(it)->dims_m1[__npy_i+1]+1) ; \ + } \ +} while (0) + +#define PyArray_ITER_GOTO1D(it, ind) do { \ + int __npy_i; \ + npy_intp __npy_ind = (npy_intp) (ind); \ + if (__npy_ind < 0) __npy_ind += _PyAIT(it)->size; \ + _PyAIT(it)->index = __npy_ind; \ + if (_PyAIT(it)->nd_m1 == 0) { \ + _PyAIT(it)->dataptr = PyArray_BYTES(_PyAIT(it)->ao) + \ + __npy_ind * _PyAIT(it)->strides[0]; \ + } \ + else if (_PyAIT(it)->contiguous) \ + _PyAIT(it)->dataptr = PyArray_BYTES(_PyAIT(it)->ao) + \ + __npy_ind * PyArray_DESCR(_PyAIT(it)->ao)->elsize; \ + else { \ + _PyAIT(it)->dataptr = PyArray_BYTES(_PyAIT(it)->ao); \ + for (__npy_i = 0; __npy_i<=_PyAIT(it)->nd_m1; \ + __npy_i++) { \ + _PyAIT(it)->dataptr += \ + (__npy_ind / _PyAIT(it)->factors[__npy_i]) \ + * _PyAIT(it)->strides[__npy_i]; \ + __npy_ind %= _PyAIT(it)->factors[__npy_i]; \ + } \ + } \ +} while (0) + +#define PyArray_ITER_DATA(it) ((void *)(_PyAIT(it)->dataptr)) + +#define PyArray_ITER_NOTDONE(it) (_PyAIT(it)->index < _PyAIT(it)->size) + + +/* + * Any object passed to PyArray_Broadcast must be binary compatible + * with this structure. + */ + +typedef struct { + PyObject_HEAD + int numiter; /* number of iters */ + npy_intp size; /* broadcasted size */ + npy_intp index; /* current index */ + int nd; /* number of dims */ + npy_intp dimensions[NPY_MAXDIMS]; /* dimensions */ + PyArrayIterObject *iters[NPY_MAXARGS]; /* iterators */ +} PyArrayMultiIterObject; + +#define _PyMIT(m) ((PyArrayMultiIterObject *)(m)) +#define PyArray_MultiIter_RESET(multi) do { \ + int __npy_mi; \ + _PyMIT(multi)->index = 0; \ + for (__npy_mi=0; __npy_mi < _PyMIT(multi)->numiter; __npy_mi++) { \ + PyArray_ITER_RESET(_PyMIT(multi)->iters[__npy_mi]); \ + } \ +} while (0) + +#define PyArray_MultiIter_NEXT(multi) do { \ + int __npy_mi; \ + _PyMIT(multi)->index++; \ + for (__npy_mi=0; __npy_mi < _PyMIT(multi)->numiter; __npy_mi++) { \ + PyArray_ITER_NEXT(_PyMIT(multi)->iters[__npy_mi]); \ + } \ +} while (0) + +#define PyArray_MultiIter_GOTO(multi, dest) do { \ + int __npy_mi; \ + for (__npy_mi=0; __npy_mi < _PyMIT(multi)->numiter; __npy_mi++) { \ + PyArray_ITER_GOTO(_PyMIT(multi)->iters[__npy_mi], dest); \ + } \ + _PyMIT(multi)->index = _PyMIT(multi)->iters[0]->index; \ +} while (0) + +#define PyArray_MultiIter_GOTO1D(multi, ind) do { \ + int __npy_mi; \ + for (__npy_mi=0; __npy_mi < _PyMIT(multi)->numiter; __npy_mi++) { \ + PyArray_ITER_GOTO1D(_PyMIT(multi)->iters[__npy_mi], ind); \ + } \ + _PyMIT(multi)->index = _PyMIT(multi)->iters[0]->index; \ +} while (0) + +#define PyArray_MultiIter_DATA(multi, i) \ + ((void *)(_PyMIT(multi)->iters[i]->dataptr)) + +#define PyArray_MultiIter_NEXTi(multi, i) \ + PyArray_ITER_NEXT(_PyMIT(multi)->iters[i]) + +#define PyArray_MultiIter_NOTDONE(multi) \ + (_PyMIT(multi)->index < _PyMIT(multi)->size) + + +/* + * Store the information needed for fancy-indexing over an array. The + * fields are slightly unordered to keep consec, dataptr and subspace + * where they were originally. + */ +typedef struct { + PyObject_HEAD + /* + * Multi-iterator portion --- needs to be present in this + * order to work with PyArray_Broadcast + */ + + int numiter; /* number of index-array + iterators */ + npy_intp size; /* size of broadcasted + result */ + npy_intp index; /* current index */ + int nd; /* number of dims */ + npy_intp dimensions[NPY_MAXDIMS]; /* dimensions */ + NpyIter *outer; /* index objects + iterator */ + void *unused[NPY_MAXDIMS - 2]; + PyArrayObject *array; + /* Flat iterator for the indexed array. For compatibility solely. */ + PyArrayIterObject *ait; + + /* + * Subspace array. For binary compatibility (was an iterator, + * but only the check for NULL should be used). + */ + PyArrayObject *subspace; + + /* + * if subspace iteration, then this is the array of axes in + * the underlying array represented by the index objects + */ + int iteraxes[NPY_MAXDIMS]; + npy_intp fancy_strides[NPY_MAXDIMS]; + + /* pointer when all fancy indices are 0 */ + char *baseoffset; + + /* + * after binding consec denotes at which axis the fancy axes + * are inserted. + */ + int consec; + char *dataptr; + + int nd_fancy; + npy_intp fancy_dims[NPY_MAXDIMS]; + + /* Whether the iterator (any of the iterators) requires API */ + int needs_api; + + /* + * Extra op information. + */ + PyArrayObject *extra_op; + PyArray_Descr *extra_op_dtype; /* desired dtype */ + npy_uint32 *extra_op_flags; /* Iterator flags */ + + NpyIter *extra_op_iter; + NpyIter_IterNextFunc *extra_op_next; + char **extra_op_ptrs; + + /* + * Information about the iteration state. + */ + NpyIter_IterNextFunc *outer_next; + char **outer_ptrs; + npy_intp *outer_strides; + + /* + * Information about the subspace iterator. + */ + NpyIter *subspace_iter; + NpyIter_IterNextFunc *subspace_next; + char **subspace_ptrs; + npy_intp *subspace_strides; + + /* Count for the external loop (which ever it is) for API iteration */ + npy_intp iter_count; + +} PyArrayMapIterObject; + +enum { + NPY_NEIGHBORHOOD_ITER_ZERO_PADDING, + NPY_NEIGHBORHOOD_ITER_ONE_PADDING, + NPY_NEIGHBORHOOD_ITER_CONSTANT_PADDING, + NPY_NEIGHBORHOOD_ITER_CIRCULAR_PADDING, + NPY_NEIGHBORHOOD_ITER_MIRROR_PADDING +}; + +typedef struct { + PyObject_HEAD + + /* + * PyArrayIterObject part: keep this in this exact order + */ + int nd_m1; /* number of dimensions - 1 */ + npy_intp index, size; + npy_intp coordinates[NPY_MAXDIMS];/* N-dimensional loop */ + npy_intp dims_m1[NPY_MAXDIMS]; /* ao->dimensions - 1 */ + npy_intp strides[NPY_MAXDIMS]; /* ao->strides or fake */ + npy_intp backstrides[NPY_MAXDIMS];/* how far to jump back */ + npy_intp factors[NPY_MAXDIMS]; /* shape factors */ + PyArrayObject *ao; + char *dataptr; /* pointer to current item*/ + npy_bool contiguous; + + npy_intp bounds[NPY_MAXDIMS][2]; + npy_intp limits[NPY_MAXDIMS][2]; + npy_intp limits_sizes[NPY_MAXDIMS]; + npy_iter_get_dataptr_t translate; + + /* + * New members + */ + npy_intp nd; + + /* Dimensions is the dimension of the array */ + npy_intp dimensions[NPY_MAXDIMS]; + + /* + * Neighborhood points coordinates are computed relatively to the + * point pointed by _internal_iter + */ + PyArrayIterObject* _internal_iter; + /* + * To keep a reference to the representation of the constant value + * for constant padding + */ + char* constant; + + int mode; +} PyArrayNeighborhoodIterObject; + +/* + * Neighborhood iterator API + */ + +/* General: those work for any mode */ +static NPY_INLINE int +PyArrayNeighborhoodIter_Reset(PyArrayNeighborhoodIterObject* iter); +static NPY_INLINE int +PyArrayNeighborhoodIter_Next(PyArrayNeighborhoodIterObject* iter); +#if 0 +static NPY_INLINE int +PyArrayNeighborhoodIter_Next2D(PyArrayNeighborhoodIterObject* iter); +#endif + +/* + * Include inline implementations - functions defined there are not + * considered public API + */ +#define _NPY_INCLUDE_NEIGHBORHOOD_IMP +#include "_neighborhood_iterator_imp.h" +#undef _NPY_INCLUDE_NEIGHBORHOOD_IMP + +/* The default array type */ +#define NPY_DEFAULT_TYPE NPY_DOUBLE + +/* + * All sorts of useful ways to look into a PyArrayObject. It is recommended + * to use PyArrayObject * objects instead of always casting from PyObject *, + * for improved type checking. + * + * In many cases here the macro versions of the accessors are deprecated, + * but can't be immediately changed to inline functions because the + * preexisting macros accept PyObject * and do automatic casts. Inline + * functions accepting PyArrayObject * provides for some compile-time + * checking of correctness when working with these objects in C. + */ + +#define PyArray_ISONESEGMENT(m) (PyArray_NDIM(m) == 0 || \ + PyArray_CHKFLAGS(m, NPY_ARRAY_C_CONTIGUOUS) || \ + PyArray_CHKFLAGS(m, NPY_ARRAY_F_CONTIGUOUS)) + +#define PyArray_ISFORTRAN(m) (PyArray_CHKFLAGS(m, NPY_ARRAY_F_CONTIGUOUS) && \ + (!PyArray_CHKFLAGS(m, NPY_ARRAY_C_CONTIGUOUS))) + +#define PyArray_FORTRAN_IF(m) ((PyArray_CHKFLAGS(m, NPY_ARRAY_F_CONTIGUOUS) ? \ + NPY_ARRAY_F_CONTIGUOUS : 0)) + +#if (defined(NPY_NO_DEPRECATED_API) && (NPY_1_7_API_VERSION <= NPY_NO_DEPRECATED_API)) +/* + * Changing access macros into functions, to allow for future hiding + * of the internal memory layout. This later hiding will allow the 2.x series + * to change the internal representation of arrays without affecting + * ABI compatibility. + */ + +static NPY_INLINE int +PyArray_NDIM(const PyArrayObject *arr) +{ + return ((PyArrayObject_fields *)arr)->nd; +} + +static NPY_INLINE void * +PyArray_DATA(PyArrayObject *arr) +{ + return ((PyArrayObject_fields *)arr)->data; +} + +static NPY_INLINE char * +PyArray_BYTES(PyArrayObject *arr) +{ + return ((PyArrayObject_fields *)arr)->data; +} + +static NPY_INLINE npy_intp * +PyArray_DIMS(PyArrayObject *arr) +{ + return ((PyArrayObject_fields *)arr)->dimensions; +} + +static NPY_INLINE npy_intp * +PyArray_STRIDES(PyArrayObject *arr) +{ + return ((PyArrayObject_fields *)arr)->strides; +} + +static NPY_INLINE npy_intp +PyArray_DIM(const PyArrayObject *arr, int idim) +{ + return ((PyArrayObject_fields *)arr)->dimensions[idim]; +} + +static NPY_INLINE npy_intp +PyArray_STRIDE(const PyArrayObject *arr, int istride) +{ + return ((PyArrayObject_fields *)arr)->strides[istride]; +} + +static NPY_INLINE NPY_RETURNS_BORROWED_REF PyObject * +PyArray_BASE(PyArrayObject *arr) +{ + return ((PyArrayObject_fields *)arr)->base; +} + +static NPY_INLINE NPY_RETURNS_BORROWED_REF PyArray_Descr * +PyArray_DESCR(PyArrayObject *arr) +{ + return ((PyArrayObject_fields *)arr)->descr; +} + +static NPY_INLINE int +PyArray_FLAGS(const PyArrayObject *arr) +{ + return ((PyArrayObject_fields *)arr)->flags; +} + +static NPY_INLINE npy_intp +PyArray_ITEMSIZE(const PyArrayObject *arr) +{ + return ((PyArrayObject_fields *)arr)->descr->elsize; +} + +static NPY_INLINE int +PyArray_TYPE(const PyArrayObject *arr) +{ + return ((PyArrayObject_fields *)arr)->descr->type_num; +} + +static NPY_INLINE int +PyArray_CHKFLAGS(const PyArrayObject *arr, int flags) +{ + return (PyArray_FLAGS(arr) & flags) == flags; +} + +static NPY_INLINE PyObject * +PyArray_GETITEM(const PyArrayObject *arr, const char *itemptr) +{ + return ((PyArrayObject_fields *)arr)->descr->f->getitem( + (void *)itemptr, (PyArrayObject *)arr); +} + +static NPY_INLINE int +PyArray_SETITEM(PyArrayObject *arr, char *itemptr, PyObject *v) +{ + return ((PyArrayObject_fields *)arr)->descr->f->setitem( + v, itemptr, arr); +} + +#else + +/* These macros are deprecated as of NumPy 1.7. */ +#define PyArray_NDIM(obj) (((PyArrayObject_fields *)(obj))->nd) +#define PyArray_BYTES(obj) (((PyArrayObject_fields *)(obj))->data) +#define PyArray_DATA(obj) ((void *)((PyArrayObject_fields *)(obj))->data) +#define PyArray_DIMS(obj) (((PyArrayObject_fields *)(obj))->dimensions) +#define PyArray_STRIDES(obj) (((PyArrayObject_fields *)(obj))->strides) +#define PyArray_DIM(obj,n) (PyArray_DIMS(obj)[n]) +#define PyArray_STRIDE(obj,n) (PyArray_STRIDES(obj)[n]) +#define PyArray_BASE(obj) (((PyArrayObject_fields *)(obj))->base) +#define PyArray_DESCR(obj) (((PyArrayObject_fields *)(obj))->descr) +#define PyArray_FLAGS(obj) (((PyArrayObject_fields *)(obj))->flags) +#define PyArray_CHKFLAGS(m, FLAGS) \ + ((((PyArrayObject_fields *)(m))->flags & (FLAGS)) == (FLAGS)) +#define PyArray_ITEMSIZE(obj) \ + (((PyArrayObject_fields *)(obj))->descr->elsize) +#define PyArray_TYPE(obj) \ + (((PyArrayObject_fields *)(obj))->descr->type_num) +#define PyArray_GETITEM(obj,itemptr) \ + PyArray_DESCR(obj)->f->getitem((char *)(itemptr), \ + (PyArrayObject *)(obj)) + +#define PyArray_SETITEM(obj,itemptr,v) \ + PyArray_DESCR(obj)->f->setitem((PyObject *)(v), \ + (char *)(itemptr), \ + (PyArrayObject *)(obj)) +#endif + +static NPY_INLINE PyArray_Descr * +PyArray_DTYPE(PyArrayObject *arr) +{ + return ((PyArrayObject_fields *)arr)->descr; +} + +static NPY_INLINE npy_intp * +PyArray_SHAPE(PyArrayObject *arr) +{ + return ((PyArrayObject_fields *)arr)->dimensions; +} + +/* + * Enables the specified array flags. Does no checking, + * assumes you know what you're doing. + */ +static NPY_INLINE void +PyArray_ENABLEFLAGS(PyArrayObject *arr, int flags) +{ + ((PyArrayObject_fields *)arr)->flags |= flags; +} + +/* + * Clears the specified array flags. Does no checking, + * assumes you know what you're doing. + */ +static NPY_INLINE void +PyArray_CLEARFLAGS(PyArrayObject *arr, int flags) +{ + ((PyArrayObject_fields *)arr)->flags &= ~flags; +} + +#define PyTypeNum_ISBOOL(type) ((type) == NPY_BOOL) + +#define PyTypeNum_ISUNSIGNED(type) (((type) == NPY_UBYTE) || \ + ((type) == NPY_USHORT) || \ + ((type) == NPY_UINT) || \ + ((type) == NPY_ULONG) || \ + ((type) == NPY_ULONGLONG)) + +#define PyTypeNum_ISSIGNED(type) (((type) == NPY_BYTE) || \ + ((type) == NPY_SHORT) || \ + ((type) == NPY_INT) || \ + ((type) == NPY_LONG) || \ + ((type) == NPY_LONGLONG)) + +#define PyTypeNum_ISINTEGER(type) (((type) >= NPY_BYTE) && \ + ((type) <= NPY_ULONGLONG)) + +#define PyTypeNum_ISFLOAT(type) ((((type) >= NPY_FLOAT) && \ + ((type) <= NPY_LONGDOUBLE)) || \ + ((type) == NPY_HALF)) + +#define PyTypeNum_ISNUMBER(type) (((type) <= NPY_CLONGDOUBLE) || \ + ((type) == NPY_HALF)) + +#define PyTypeNum_ISSTRING(type) (((type) == NPY_STRING) || \ + ((type) == NPY_UNICODE)) + +#define PyTypeNum_ISCOMPLEX(type) (((type) >= NPY_CFLOAT) && \ + ((type) <= NPY_CLONGDOUBLE)) + +#define PyTypeNum_ISPYTHON(type) (((type) == NPY_LONG) || \ + ((type) == NPY_DOUBLE) || \ + ((type) == NPY_CDOUBLE) || \ + ((type) == NPY_BOOL) || \ + ((type) == NPY_OBJECT )) + +#define PyTypeNum_ISFLEXIBLE(type) (((type) >=NPY_STRING) && \ + ((type) <=NPY_VOID)) + +#define PyTypeNum_ISDATETIME(type) (((type) >=NPY_DATETIME) && \ + ((type) <=NPY_TIMEDELTA)) + +#define PyTypeNum_ISUSERDEF(type) (((type) >= NPY_USERDEF) && \ + ((type) < NPY_USERDEF+ \ + NPY_NUMUSERTYPES)) + +#define PyTypeNum_ISEXTENDED(type) (PyTypeNum_ISFLEXIBLE(type) || \ + PyTypeNum_ISUSERDEF(type)) + +#define PyTypeNum_ISOBJECT(type) ((type) == NPY_OBJECT) + + +#define PyDataType_ISBOOL(obj) PyTypeNum_ISBOOL(((PyArray_Descr*)(obj))->type_num) +#define PyDataType_ISUNSIGNED(obj) PyTypeNum_ISUNSIGNED(((PyArray_Descr*)(obj))->type_num) +#define PyDataType_ISSIGNED(obj) PyTypeNum_ISSIGNED(((PyArray_Descr*)(obj))->type_num) +#define PyDataType_ISINTEGER(obj) PyTypeNum_ISINTEGER(((PyArray_Descr*)(obj))->type_num ) +#define PyDataType_ISFLOAT(obj) PyTypeNum_ISFLOAT(((PyArray_Descr*)(obj))->type_num) +#define PyDataType_ISNUMBER(obj) PyTypeNum_ISNUMBER(((PyArray_Descr*)(obj))->type_num) +#define PyDataType_ISSTRING(obj) PyTypeNum_ISSTRING(((PyArray_Descr*)(obj))->type_num) +#define PyDataType_ISCOMPLEX(obj) PyTypeNum_ISCOMPLEX(((PyArray_Descr*)(obj))->type_num) +#define PyDataType_ISPYTHON(obj) PyTypeNum_ISPYTHON(((PyArray_Descr*)(obj))->type_num) +#define PyDataType_ISFLEXIBLE(obj) PyTypeNum_ISFLEXIBLE(((PyArray_Descr*)(obj))->type_num) +#define PyDataType_ISDATETIME(obj) PyTypeNum_ISDATETIME(((PyArray_Descr*)(obj))->type_num) +#define PyDataType_ISUSERDEF(obj) PyTypeNum_ISUSERDEF(((PyArray_Descr*)(obj))->type_num) +#define PyDataType_ISEXTENDED(obj) PyTypeNum_ISEXTENDED(((PyArray_Descr*)(obj))->type_num) +#define PyDataType_ISOBJECT(obj) PyTypeNum_ISOBJECT(((PyArray_Descr*)(obj))->type_num) +#define PyDataType_HASFIELDS(obj) (((PyArray_Descr *)(obj))->names != NULL) +#define PyDataType_HASSUBARRAY(dtype) ((dtype)->subarray != NULL) +#define PyDataType_ISUNSIZED(dtype) ((dtype)->elsize == 0) +#define PyDataType_MAKEUNSIZED(dtype) ((dtype)->elsize = 0) + +#define PyArray_ISBOOL(obj) PyTypeNum_ISBOOL(PyArray_TYPE(obj)) +#define PyArray_ISUNSIGNED(obj) PyTypeNum_ISUNSIGNED(PyArray_TYPE(obj)) +#define PyArray_ISSIGNED(obj) PyTypeNum_ISSIGNED(PyArray_TYPE(obj)) +#define PyArray_ISINTEGER(obj) PyTypeNum_ISINTEGER(PyArray_TYPE(obj)) +#define PyArray_ISFLOAT(obj) PyTypeNum_ISFLOAT(PyArray_TYPE(obj)) +#define PyArray_ISNUMBER(obj) PyTypeNum_ISNUMBER(PyArray_TYPE(obj)) +#define PyArray_ISSTRING(obj) PyTypeNum_ISSTRING(PyArray_TYPE(obj)) +#define PyArray_ISCOMPLEX(obj) PyTypeNum_ISCOMPLEX(PyArray_TYPE(obj)) +#define PyArray_ISPYTHON(obj) PyTypeNum_ISPYTHON(PyArray_TYPE(obj)) +#define PyArray_ISFLEXIBLE(obj) PyTypeNum_ISFLEXIBLE(PyArray_TYPE(obj)) +#define PyArray_ISDATETIME(obj) PyTypeNum_ISDATETIME(PyArray_TYPE(obj)) +#define PyArray_ISUSERDEF(obj) PyTypeNum_ISUSERDEF(PyArray_TYPE(obj)) +#define PyArray_ISEXTENDED(obj) PyTypeNum_ISEXTENDED(PyArray_TYPE(obj)) +#define PyArray_ISOBJECT(obj) PyTypeNum_ISOBJECT(PyArray_TYPE(obj)) +#define PyArray_HASFIELDS(obj) PyDataType_HASFIELDS(PyArray_DESCR(obj)) + + /* + * FIXME: This should check for a flag on the data-type that + * states whether or not it is variable length. Because the + * ISFLEXIBLE check is hard-coded to the built-in data-types. + */ +#define PyArray_ISVARIABLE(obj) PyTypeNum_ISFLEXIBLE(PyArray_TYPE(obj)) + +#define PyArray_SAFEALIGNEDCOPY(obj) (PyArray_ISALIGNED(obj) && !PyArray_ISVARIABLE(obj)) + + +#define NPY_LITTLE '<' +#define NPY_BIG '>' +#define NPY_NATIVE '=' +#define NPY_SWAP 's' +#define NPY_IGNORE '|' + +#if NPY_BYTE_ORDER == NPY_BIG_ENDIAN +#define NPY_NATBYTE NPY_BIG +#define NPY_OPPBYTE NPY_LITTLE +#else +#define NPY_NATBYTE NPY_LITTLE +#define NPY_OPPBYTE NPY_BIG +#endif + +#define PyArray_ISNBO(arg) ((arg) != NPY_OPPBYTE) +#define PyArray_IsNativeByteOrder PyArray_ISNBO +#define PyArray_ISNOTSWAPPED(m) PyArray_ISNBO(PyArray_DESCR(m)->byteorder) +#define PyArray_ISBYTESWAPPED(m) (!PyArray_ISNOTSWAPPED(m)) + +#define PyArray_FLAGSWAP(m, flags) (PyArray_CHKFLAGS(m, flags) && \ + PyArray_ISNOTSWAPPED(m)) + +#define PyArray_ISCARRAY(m) PyArray_FLAGSWAP(m, NPY_ARRAY_CARRAY) +#define PyArray_ISCARRAY_RO(m) PyArray_FLAGSWAP(m, NPY_ARRAY_CARRAY_RO) +#define PyArray_ISFARRAY(m) PyArray_FLAGSWAP(m, NPY_ARRAY_FARRAY) +#define PyArray_ISFARRAY_RO(m) PyArray_FLAGSWAP(m, NPY_ARRAY_FARRAY_RO) +#define PyArray_ISBEHAVED(m) PyArray_FLAGSWAP(m, NPY_ARRAY_BEHAVED) +#define PyArray_ISBEHAVED_RO(m) PyArray_FLAGSWAP(m, NPY_ARRAY_ALIGNED) + + +#define PyDataType_ISNOTSWAPPED(d) PyArray_ISNBO(((PyArray_Descr *)(d))->byteorder) +#define PyDataType_ISBYTESWAPPED(d) (!PyDataType_ISNOTSWAPPED(d)) + +/************************************************************ + * A struct used by PyArray_CreateSortedStridePerm, new in 1.7. + ************************************************************/ + +typedef struct { + npy_intp perm, stride; +} npy_stride_sort_item; + +/************************************************************ + * This is the form of the struct that's returned pointed by the + * PyCObject attribute of an array __array_struct__. See + * https://docs.scipy.org/doc/numpy/reference/arrays.interface.html for the full + * documentation. + ************************************************************/ +typedef struct { + int two; /* + * contains the integer 2 as a sanity + * check + */ + + int nd; /* number of dimensions */ + + char typekind; /* + * kind in array --- character code of + * typestr + */ + + int itemsize; /* size of each element */ + + int flags; /* + * how should be data interpreted. Valid + * flags are CONTIGUOUS (1), F_CONTIGUOUS (2), + * ALIGNED (0x100), NOTSWAPPED (0x200), and + * WRITEABLE (0x400). ARR_HAS_DESCR (0x800) + * states that arrdescr field is present in + * structure + */ + + npy_intp *shape; /* + * A length-nd array of shape + * information + */ + + npy_intp *strides; /* A length-nd array of stride information */ + + void *data; /* A pointer to the first element of the array */ + + PyObject *descr; /* + * A list of fields or NULL (ignored if flags + * does not have ARR_HAS_DESCR flag set) + */ +} PyArrayInterface; + +/* + * This is a function for hooking into the PyDataMem_NEW/FREE/RENEW functions. + * See the documentation for PyDataMem_SetEventHook. + */ +typedef void (PyDataMem_EventHookFunc)(void *inp, void *outp, size_t size, + void *user_data); + +/* + * Use the keyword NPY_DEPRECATED_INCLUDES to ensure that the header files + * npy_*_*_deprecated_api.h are only included from here and nowhere else. + */ +#ifdef NPY_DEPRECATED_INCLUDES +#error "Do not use the reserved keyword NPY_DEPRECATED_INCLUDES." +#endif +#define NPY_DEPRECATED_INCLUDES +#if !defined(NPY_NO_DEPRECATED_API) || \ + (NPY_NO_DEPRECATED_API < NPY_1_7_API_VERSION) +#include "npy_1_7_deprecated_api.h" +#endif +/* + * There is no file npy_1_8_deprecated_api.h since there are no additional + * deprecated API features in NumPy 1.8. + * + * Note to maintainers: insert code like the following in future NumPy + * versions. + * + * #if !defined(NPY_NO_DEPRECATED_API) || \ + * (NPY_NO_DEPRECATED_API < NPY_1_9_API_VERSION) + * #include "npy_1_9_deprecated_api.h" + * #endif + */ +#undef NPY_DEPRECATED_INCLUDES + +#endif /* NPY_ARRAYTYPES_H */ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/core/include/numpy/numpyconfig.h b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/core/include/numpy/numpyconfig.h new file mode 100644 index 0000000000000000000000000000000000000000..ab198f36b0c84759e04ed9fe9a6dfbd84eddae9e --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/core/include/numpy/numpyconfig.h @@ -0,0 +1,41 @@ +#ifndef _NPY_NUMPYCONFIG_H_ +#define _NPY_NUMPYCONFIG_H_ + +#include "_numpyconfig.h" + +/* + * On Mac OS X, because there is only one configuration stage for all the archs + * in universal builds, any macro which depends on the arch needs to be + * hardcoded + */ +#ifdef __APPLE__ + #undef NPY_SIZEOF_LONG + #undef NPY_SIZEOF_PY_INTPTR_T + + #ifdef __LP64__ + #define NPY_SIZEOF_LONG 8 + #define NPY_SIZEOF_PY_INTPTR_T 8 + #else + #define NPY_SIZEOF_LONG 4 + #define NPY_SIZEOF_PY_INTPTR_T 4 + #endif +#endif + +/** + * To help with the NPY_NO_DEPRECATED_API macro, we include API version + * numbers for specific versions of NumPy. To exclude all API that was + * deprecated as of 1.7, add the following before #including any NumPy + * headers: + * #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION + */ +#define NPY_1_7_API_VERSION 0x00000007 +#define NPY_1_8_API_VERSION 0x00000008 +#define NPY_1_9_API_VERSION 0x00000008 +#define NPY_1_10_API_VERSION 0x00000008 +#define NPY_1_11_API_VERSION 0x00000008 +#define NPY_1_12_API_VERSION 0x00000008 +#define NPY_1_13_API_VERSION 0x00000008 +#define NPY_1_14_API_VERSION 0x00000008 +#define NPY_1_15_API_VERSION 0x00000008 + +#endif diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/core/include/numpy/old_defines.h b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/core/include/numpy/old_defines.h new file mode 100644 index 0000000000000000000000000000000000000000..abf81595ae1602b9a6ade9cd97388f815bbf6518 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/core/include/numpy/old_defines.h @@ -0,0 +1,187 @@ +/* This header is deprecated as of NumPy 1.7 */ +#ifndef OLD_DEFINES_H +#define OLD_DEFINES_H + +#if defined(NPY_NO_DEPRECATED_API) && NPY_NO_DEPRECATED_API >= NPY_1_7_API_VERSION +#error The header "old_defines.h" is deprecated as of NumPy 1.7. +#endif + +#define NDARRAY_VERSION NPY_VERSION + +#define PyArray_MIN_BUFSIZE NPY_MIN_BUFSIZE +#define PyArray_MAX_BUFSIZE NPY_MAX_BUFSIZE +#define PyArray_BUFSIZE NPY_BUFSIZE + +#define PyArray_PRIORITY NPY_PRIORITY +#define PyArray_SUBTYPE_PRIORITY NPY_PRIORITY +#define PyArray_NUM_FLOATTYPE NPY_NUM_FLOATTYPE + +#define NPY_MAX PyArray_MAX +#define NPY_MIN PyArray_MIN + +#define PyArray_TYPES NPY_TYPES +#define PyArray_BOOL NPY_BOOL +#define PyArray_BYTE NPY_BYTE +#define PyArray_UBYTE NPY_UBYTE +#define PyArray_SHORT NPY_SHORT +#define PyArray_USHORT NPY_USHORT +#define PyArray_INT NPY_INT +#define PyArray_UINT NPY_UINT +#define PyArray_LONG NPY_LONG +#define PyArray_ULONG NPY_ULONG +#define PyArray_LONGLONG NPY_LONGLONG +#define PyArray_ULONGLONG NPY_ULONGLONG +#define PyArray_HALF NPY_HALF +#define PyArray_FLOAT NPY_FLOAT +#define PyArray_DOUBLE NPY_DOUBLE +#define PyArray_LONGDOUBLE NPY_LONGDOUBLE +#define PyArray_CFLOAT NPY_CFLOAT +#define PyArray_CDOUBLE NPY_CDOUBLE +#define PyArray_CLONGDOUBLE NPY_CLONGDOUBLE +#define PyArray_OBJECT NPY_OBJECT +#define PyArray_STRING NPY_STRING +#define PyArray_UNICODE NPY_UNICODE +#define PyArray_VOID NPY_VOID +#define PyArray_DATETIME NPY_DATETIME +#define PyArray_TIMEDELTA NPY_TIMEDELTA +#define PyArray_NTYPES NPY_NTYPES +#define PyArray_NOTYPE NPY_NOTYPE +#define PyArray_CHAR NPY_CHAR +#define PyArray_USERDEF NPY_USERDEF +#define PyArray_NUMUSERTYPES NPY_NUMUSERTYPES + +#define PyArray_INTP NPY_INTP +#define PyArray_UINTP NPY_UINTP + +#define PyArray_INT8 NPY_INT8 +#define PyArray_UINT8 NPY_UINT8 +#define PyArray_INT16 NPY_INT16 +#define PyArray_UINT16 NPY_UINT16 +#define PyArray_INT32 NPY_INT32 +#define PyArray_UINT32 NPY_UINT32 + +#ifdef NPY_INT64 +#define PyArray_INT64 NPY_INT64 +#define PyArray_UINT64 NPY_UINT64 +#endif + +#ifdef NPY_INT128 +#define PyArray_INT128 NPY_INT128 +#define PyArray_UINT128 NPY_UINT128 +#endif + +#ifdef NPY_FLOAT16 +#define PyArray_FLOAT16 NPY_FLOAT16 +#define PyArray_COMPLEX32 NPY_COMPLEX32 +#endif + +#ifdef NPY_FLOAT80 +#define PyArray_FLOAT80 NPY_FLOAT80 +#define PyArray_COMPLEX160 NPY_COMPLEX160 +#endif + +#ifdef NPY_FLOAT96 +#define PyArray_FLOAT96 NPY_FLOAT96 +#define PyArray_COMPLEX192 NPY_COMPLEX192 +#endif + +#ifdef NPY_FLOAT128 +#define PyArray_FLOAT128 NPY_FLOAT128 +#define PyArray_COMPLEX256 NPY_COMPLEX256 +#endif + +#define PyArray_FLOAT32 NPY_FLOAT32 +#define PyArray_COMPLEX64 NPY_COMPLEX64 +#define PyArray_FLOAT64 NPY_FLOAT64 +#define PyArray_COMPLEX128 NPY_COMPLEX128 + + +#define PyArray_TYPECHAR NPY_TYPECHAR +#define PyArray_BOOLLTR NPY_BOOLLTR +#define PyArray_BYTELTR NPY_BYTELTR +#define PyArray_UBYTELTR NPY_UBYTELTR +#define PyArray_SHORTLTR NPY_SHORTLTR +#define PyArray_USHORTLTR NPY_USHORTLTR +#define PyArray_INTLTR NPY_INTLTR +#define PyArray_UINTLTR NPY_UINTLTR +#define PyArray_LONGLTR NPY_LONGLTR +#define PyArray_ULONGLTR NPY_ULONGLTR +#define PyArray_LONGLONGLTR NPY_LONGLONGLTR +#define PyArray_ULONGLONGLTR NPY_ULONGLONGLTR +#define PyArray_HALFLTR NPY_HALFLTR +#define PyArray_FLOATLTR NPY_FLOATLTR +#define PyArray_DOUBLELTR NPY_DOUBLELTR +#define PyArray_LONGDOUBLELTR NPY_LONGDOUBLELTR +#define PyArray_CFLOATLTR NPY_CFLOATLTR +#define PyArray_CDOUBLELTR NPY_CDOUBLELTR +#define PyArray_CLONGDOUBLELTR NPY_CLONGDOUBLELTR +#define PyArray_OBJECTLTR NPY_OBJECTLTR +#define PyArray_STRINGLTR NPY_STRINGLTR +#define PyArray_STRINGLTR2 NPY_STRINGLTR2 +#define PyArray_UNICODELTR NPY_UNICODELTR +#define PyArray_VOIDLTR NPY_VOIDLTR +#define PyArray_DATETIMELTR NPY_DATETIMELTR +#define PyArray_TIMEDELTALTR NPY_TIMEDELTALTR +#define PyArray_CHARLTR NPY_CHARLTR +#define PyArray_INTPLTR NPY_INTPLTR +#define PyArray_UINTPLTR NPY_UINTPLTR +#define PyArray_GENBOOLLTR NPY_GENBOOLLTR +#define PyArray_SIGNEDLTR NPY_SIGNEDLTR +#define PyArray_UNSIGNEDLTR NPY_UNSIGNEDLTR +#define PyArray_FLOATINGLTR NPY_FLOATINGLTR +#define PyArray_COMPLEXLTR NPY_COMPLEXLTR + +#define PyArray_QUICKSORT NPY_QUICKSORT +#define PyArray_HEAPSORT NPY_HEAPSORT +#define PyArray_MERGESORT NPY_MERGESORT +#define PyArray_SORTKIND NPY_SORTKIND +#define PyArray_NSORTS NPY_NSORTS + +#define PyArray_NOSCALAR NPY_NOSCALAR +#define PyArray_BOOL_SCALAR NPY_BOOL_SCALAR +#define PyArray_INTPOS_SCALAR NPY_INTPOS_SCALAR +#define PyArray_INTNEG_SCALAR NPY_INTNEG_SCALAR +#define PyArray_FLOAT_SCALAR NPY_FLOAT_SCALAR +#define PyArray_COMPLEX_SCALAR NPY_COMPLEX_SCALAR +#define PyArray_OBJECT_SCALAR NPY_OBJECT_SCALAR +#define PyArray_SCALARKIND NPY_SCALARKIND +#define PyArray_NSCALARKINDS NPY_NSCALARKINDS + +#define PyArray_ANYORDER NPY_ANYORDER +#define PyArray_CORDER NPY_CORDER +#define PyArray_FORTRANORDER NPY_FORTRANORDER +#define PyArray_ORDER NPY_ORDER + +#define PyDescr_ISBOOL PyDataType_ISBOOL +#define PyDescr_ISUNSIGNED PyDataType_ISUNSIGNED +#define PyDescr_ISSIGNED PyDataType_ISSIGNED +#define PyDescr_ISINTEGER PyDataType_ISINTEGER +#define PyDescr_ISFLOAT PyDataType_ISFLOAT +#define PyDescr_ISNUMBER PyDataType_ISNUMBER +#define PyDescr_ISSTRING PyDataType_ISSTRING +#define PyDescr_ISCOMPLEX PyDataType_ISCOMPLEX +#define PyDescr_ISPYTHON PyDataType_ISPYTHON +#define PyDescr_ISFLEXIBLE PyDataType_ISFLEXIBLE +#define PyDescr_ISUSERDEF PyDataType_ISUSERDEF +#define PyDescr_ISEXTENDED PyDataType_ISEXTENDED +#define PyDescr_ISOBJECT PyDataType_ISOBJECT +#define PyDescr_HASFIELDS PyDataType_HASFIELDS + +#define PyArray_LITTLE NPY_LITTLE +#define PyArray_BIG NPY_BIG +#define PyArray_NATIVE NPY_NATIVE +#define PyArray_SWAP NPY_SWAP +#define PyArray_IGNORE NPY_IGNORE + +#define PyArray_NATBYTE NPY_NATBYTE +#define PyArray_OPPBYTE NPY_OPPBYTE + +#define PyArray_MAX_ELSIZE NPY_MAX_ELSIZE + +#define PyArray_USE_PYMEM NPY_USE_PYMEM + +#define PyArray_RemoveLargest PyArray_RemoveSmallest + +#define PyArray_UCS4 npy_ucs4 + +#endif diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/core/include/numpy/oldnumeric.h b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/core/include/numpy/oldnumeric.h new file mode 100644 index 0000000000000000000000000000000000000000..38530faf045a9cfc54750be6b12ec725c77cf231 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/core/include/numpy/oldnumeric.h @@ -0,0 +1,25 @@ +#include "arrayobject.h" + +#ifndef PYPY_VERSION +#ifndef REFCOUNT +# define REFCOUNT NPY_REFCOUNT +# define MAX_ELSIZE 16 +#endif +#endif + +#define PyArray_UNSIGNED_TYPES +#define PyArray_SBYTE NPY_BYTE +#define PyArray_CopyArray PyArray_CopyInto +#define _PyArray_multiply_list PyArray_MultiplyIntList +#define PyArray_ISSPACESAVER(m) NPY_FALSE +#define PyScalarArray_Check PyArray_CheckScalar + +#define CONTIGUOUS NPY_CONTIGUOUS +#define OWN_DIMENSIONS 0 +#define OWN_STRIDES 0 +#define OWN_DATA NPY_OWNDATA +#define SAVESPACE 0 +#define SAVESPACEBIT 0 + +#undef import_array +#define import_array() { if (_import_array() < 0) {PyErr_Print(); PyErr_SetString(PyExc_ImportError, "numpy.core.multiarray failed to import"); } } diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/core/include/numpy/ufuncobject.h b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/core/include/numpy/ufuncobject.h new file mode 100644 index 0000000000000000000000000000000000000000..90d837a9b53a1fd700f2e3cf8b6a269d8f32be07 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/core/include/numpy/ufuncobject.h @@ -0,0 +1,377 @@ +#ifndef Py_UFUNCOBJECT_H +#define Py_UFUNCOBJECT_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The legacy generic inner loop for a standard element-wise or + * generalized ufunc. + */ +typedef void (*PyUFuncGenericFunction) + (char **args, + npy_intp *dimensions, + npy_intp *strides, + void *innerloopdata); + +/* + * The most generic one-dimensional inner loop for + * a masked standard element-wise ufunc. "Masked" here means that it skips + * doing calculations on any items for which the maskptr array has a true + * value. + */ +typedef void (PyUFunc_MaskedStridedInnerLoopFunc)( + char **dataptrs, npy_intp *strides, + char *maskptr, npy_intp mask_stride, + npy_intp count, + NpyAuxData *innerloopdata); + +/* Forward declaration for the type resolver and loop selector typedefs */ +struct _tagPyUFuncObject; + +/* + * Given the operands for calling a ufunc, should determine the + * calculation input and output data types and return an inner loop function. + * This function should validate that the casting rule is being followed, + * and fail if it is not. + * + * For backwards compatibility, the regular type resolution function does not + * support auxiliary data with object semantics. The type resolution call + * which returns a masked generic function returns a standard NpyAuxData + * object, for which the NPY_AUXDATA_FREE and NPY_AUXDATA_CLONE macros + * work. + * + * ufunc: The ufunc object. + * casting: The 'casting' parameter provided to the ufunc. + * operands: An array of length (ufunc->nin + ufunc->nout), + * with the output parameters possibly NULL. + * type_tup: Either NULL, or the type_tup passed to the ufunc. + * out_dtypes: An array which should be populated with new + * references to (ufunc->nin + ufunc->nout) new + * dtypes, one for each input and output. These + * dtypes should all be in native-endian format. + * + * Should return 0 on success, -1 on failure (with exception set), + * or -2 if Py_NotImplemented should be returned. + */ +typedef int (PyUFunc_TypeResolutionFunc)( + struct _tagPyUFuncObject *ufunc, + NPY_CASTING casting, + PyArrayObject **operands, + PyObject *type_tup, + PyArray_Descr **out_dtypes); + +/* + * Given an array of DTypes as returned by the PyUFunc_TypeResolutionFunc, + * and an array of fixed strides (the array will contain NPY_MAX_INTP for + * strides which are not necessarily fixed), returns an inner loop + * with associated auxiliary data. + * + * For backwards compatibility, there is a variant of the inner loop + * selection which returns an inner loop irrespective of the strides, + * and with a void* static auxiliary data instead of an NpyAuxData * + * dynamically allocatable auxiliary data. + * + * ufunc: The ufunc object. + * dtypes: An array which has been populated with dtypes, + * in most cases by the type resolution function + * for the same ufunc. + * fixed_strides: For each input/output, either the stride that + * will be used every time the function is called + * or NPY_MAX_INTP if the stride might change or + * is not known ahead of time. The loop selection + * function may use this stride to pick inner loops + * which are optimized for contiguous or 0-stride + * cases. + * out_innerloop: Should be populated with the correct ufunc inner + * loop for the given type. + * out_innerloopdata: Should be populated with the void* data to + * be passed into the out_innerloop function. + * out_needs_api: If the inner loop needs to use the Python API, + * should set the to 1, otherwise should leave + * this untouched. + */ +typedef int (PyUFunc_LegacyInnerLoopSelectionFunc)( + struct _tagPyUFuncObject *ufunc, + PyArray_Descr **dtypes, + PyUFuncGenericFunction *out_innerloop, + void **out_innerloopdata, + int *out_needs_api); +typedef int (PyUFunc_MaskedInnerLoopSelectionFunc)( + struct _tagPyUFuncObject *ufunc, + PyArray_Descr **dtypes, + PyArray_Descr *mask_dtype, + npy_intp *fixed_strides, + npy_intp fixed_mask_stride, + PyUFunc_MaskedStridedInnerLoopFunc **out_innerloop, + NpyAuxData **out_innerloopdata, + int *out_needs_api); + +typedef struct _tagPyUFuncObject { + PyObject_HEAD + /* + * nin: Number of inputs + * nout: Number of outputs + * nargs: Always nin + nout (Why is it stored?) + */ + int nin, nout, nargs; + + /* Identity for reduction, either PyUFunc_One or PyUFunc_Zero */ + int identity; + + /* Array of one-dimensional core loops */ + PyUFuncGenericFunction *functions; + /* Array of funcdata that gets passed into the functions */ + void **data; + /* The number of elements in 'functions' and 'data' */ + int ntypes; + + /* Used to be unused field 'check_return' */ + int reserved1; + + /* The name of the ufunc */ + const char *name; + + /* Array of type numbers, of size ('nargs' * 'ntypes') */ + char *types; + + /* Documentation string */ + const char *doc; + + void *ptr; + PyObject *obj; + PyObject *userloops; + + /* generalized ufunc parameters */ + + /* 0 for scalar ufunc; 1 for generalized ufunc */ + int core_enabled; + /* number of distinct dimension names in signature */ + int core_num_dim_ix; + + /* + * dimension indices of input/output argument k are stored in + * core_dim_ixs[core_offsets[k]..core_offsets[k]+core_num_dims[k]-1] + */ + + /* numbers of core dimensions of each argument */ + int *core_num_dims; + /* + * dimension indices in a flatted form; indices + * are in the range of [0,core_num_dim_ix) + */ + int *core_dim_ixs; + /* + * positions of 1st core dimensions of each + * argument in core_dim_ixs, equivalent to cumsum(core_num_dims) + */ + int *core_offsets; + /* signature string for printing purpose */ + char *core_signature; + + /* + * A function which resolves the types and fills an array + * with the dtypes for the inputs and outputs. + */ + PyUFunc_TypeResolutionFunc *type_resolver; + /* + * A function which returns an inner loop written for + * NumPy 1.6 and earlier ufuncs. This is for backwards + * compatibility, and may be NULL if inner_loop_selector + * is specified. + */ + PyUFunc_LegacyInnerLoopSelectionFunc *legacy_inner_loop_selector; + /* + * This was blocked off to be the "new" inner loop selector in 1.7, + * but this was never implemented. (This is also why the above + * selector is called the "legacy" selector.) + */ + void *reserved2; + /* + * A function which returns a masked inner loop for the ufunc. + */ + PyUFunc_MaskedInnerLoopSelectionFunc *masked_inner_loop_selector; + + /* + * List of flags for each operand when ufunc is called by nditer object. + * These flags will be used in addition to the default flags for each + * operand set by nditer object. + */ + npy_uint32 *op_flags; + + /* + * List of global flags used when ufunc is called by nditer object. + * These flags will be used in addition to the default global flags + * set by nditer object. + */ + npy_uint32 iter_flags; + + /* New in NPY_API_VERSION 0x0000000D and above */ + + /* + * for each core_num_dim_ix distinct dimension names, + * the possible "frozen" size (-1 if not frozen). + */ + npy_intp *core_dim_sizes; + + /* + * for each distinct core dimension, a set of UFUNC_CORE_DIM* flags + */ + npy_uint32 *core_dim_flags; + + /* Identity for reduction, when identity == PyUFunc_IdentityValue */ + PyObject *identity_value; + +} PyUFuncObject; + +#include "arrayobject.h" +/* Generalized ufunc; 0x0001 reserved for possible use as CORE_ENABLED */ +/* the core dimension's size will be determined by the operands. */ +#define UFUNC_CORE_DIM_SIZE_INFERRED 0x0002 +/* the core dimension may be absent */ +#define UFUNC_CORE_DIM_CAN_IGNORE 0x0004 +/* flags inferred during execution */ +#define UFUNC_CORE_DIM_MISSING 0x00040000 + +#define UFUNC_ERR_IGNORE 0 +#define UFUNC_ERR_WARN 1 +#define UFUNC_ERR_RAISE 2 +#define UFUNC_ERR_CALL 3 +#define UFUNC_ERR_PRINT 4 +#define UFUNC_ERR_LOG 5 + + /* Python side integer mask */ + +#define UFUNC_MASK_DIVIDEBYZERO 0x07 +#define UFUNC_MASK_OVERFLOW 0x3f +#define UFUNC_MASK_UNDERFLOW 0x1ff +#define UFUNC_MASK_INVALID 0xfff + +#define UFUNC_SHIFT_DIVIDEBYZERO 0 +#define UFUNC_SHIFT_OVERFLOW 3 +#define UFUNC_SHIFT_UNDERFLOW 6 +#define UFUNC_SHIFT_INVALID 9 + + +#define UFUNC_OBJ_ISOBJECT 1 +#define UFUNC_OBJ_NEEDS_API 2 + + /* Default user error mode */ +#define UFUNC_ERR_DEFAULT \ + (UFUNC_ERR_WARN << UFUNC_SHIFT_DIVIDEBYZERO) + \ + (UFUNC_ERR_WARN << UFUNC_SHIFT_OVERFLOW) + \ + (UFUNC_ERR_WARN << UFUNC_SHIFT_INVALID) + +#if NPY_ALLOW_THREADS +#define NPY_LOOP_BEGIN_THREADS do {if (!(loop->obj & UFUNC_OBJ_NEEDS_API)) _save = PyEval_SaveThread();} while (0); +#define NPY_LOOP_END_THREADS do {if (!(loop->obj & UFUNC_OBJ_NEEDS_API)) PyEval_RestoreThread(_save);} while (0); +#else +#define NPY_LOOP_BEGIN_THREADS +#define NPY_LOOP_END_THREADS +#endif + +/* + * UFunc has unit of 0, and the order of operations can be reordered + * This case allows reduction with multiple axes at once. + */ +#define PyUFunc_Zero 0 +/* + * UFunc has unit of 1, and the order of operations can be reordered + * This case allows reduction with multiple axes at once. + */ +#define PyUFunc_One 1 +/* + * UFunc has unit of -1, and the order of operations can be reordered + * This case allows reduction with multiple axes at once. Intended for + * bitwise_and reduction. + */ +#define PyUFunc_MinusOne 2 +/* + * UFunc has no unit, and the order of operations cannot be reordered. + * This case does not allow reduction with multiple axes at once. + */ +#define PyUFunc_None -1 +/* + * UFunc has no unit, and the order of operations can be reordered + * This case allows reduction with multiple axes at once. + */ +#define PyUFunc_ReorderableNone -2 +/* + * UFunc unit is in identity_value, and the order of operations can be reordered + * This case allows reduction with multiple axes at once. + */ +#define PyUFunc_IdentityValue -3 + + +#define UFUNC_REDUCE 0 +#define UFUNC_ACCUMULATE 1 +#define UFUNC_REDUCEAT 2 +#define UFUNC_OUTER 3 + + +typedef struct { + int nin; + int nout; + PyObject *callable; +} PyUFunc_PyFuncData; + +/* A linked-list of function information for + user-defined 1-d loops. + */ +typedef struct _loop1d_info { + PyUFuncGenericFunction func; + void *data; + int *arg_types; + struct _loop1d_info *next; + int nargs; + PyArray_Descr **arg_dtypes; +} PyUFunc_Loop1d; + + +#include "__ufunc_api.h" + +#define UFUNC_PYVALS_NAME "UFUNC_PYVALS" + +#define UFUNC_CHECK_ERROR(arg) \ + do {if ((((arg)->obj & UFUNC_OBJ_NEEDS_API) && PyErr_Occurred()) || \ + ((arg)->errormask && \ + PyUFunc_checkfperr((arg)->errormask, \ + (arg)->errobj, \ + &(arg)->first))) \ + goto fail;} while (0) + +/* + * THESE MACROS ARE DEPRECATED. + * Use npy_set_floatstatus_* in the npymath library. + */ +#define UFUNC_FPE_DIVIDEBYZERO NPY_FPE_DIVIDEBYZERO +#define UFUNC_FPE_OVERFLOW NPY_FPE_OVERFLOW +#define UFUNC_FPE_UNDERFLOW NPY_FPE_UNDERFLOW +#define UFUNC_FPE_INVALID NPY_FPE_INVALID + +#define UFUNC_CHECK_STATUS(ret) \ + { \ + ret = npy_clear_floatstatus(); \ + } +#define generate_divbyzero_error() npy_set_floatstatus_divbyzero() +#define generate_overflow_error() npy_set_floatstatus_overflow() + + /* Make sure it gets defined if it isn't already */ +#ifndef UFUNC_NOFPE +/* Clear the floating point exception default of Borland C++ */ +#if defined(__BORLANDC__) +#define UFUNC_NOFPE _control87(MCW_EM, MCW_EM); +#else +#define UFUNC_NOFPE +#endif +#endif + + +#ifdef __cplusplus +} +#endif +#endif /* !Py_UFUNCOBJECT_H */ diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/autodist.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/autodist.py new file mode 100644 index 0000000000000000000000000000000000000000..d5e78963c1283279d736e18969651d4ce5377bb2 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/autodist.py @@ -0,0 +1,96 @@ +"""This module implements additional tests ala autoconf which can be useful. + +""" +from __future__ import division, absolute_import, print_function + + +# We put them here since they could be easily reused outside numpy.distutils + +def check_inline(cmd): + """Return the inline identifier (may be empty).""" + cmd._check_compiler() + body = """ +#ifndef __cplusplus +static %(inline)s int static_func (void) +{ + return 0; +} +%(inline)s int nostatic_func (void) +{ + return 0; +} +#endif""" + + for kw in ['inline', '__inline__', '__inline']: + st = cmd.try_compile(body % {'inline': kw}, None, None) + if st: + return kw + + return '' + +def check_restrict(cmd): + """Return the restrict identifier (may be empty).""" + cmd._check_compiler() + body = """ +static int static_func (char * %(restrict)s a) +{ + return 0; +} +""" + + for kw in ['restrict', '__restrict__', '__restrict']: + st = cmd.try_compile(body % {'restrict': kw}, None, None) + if st: + return kw + + return '' + +def check_compiler_gcc4(cmd): + """Return True if the C compiler is GCC 4.x.""" + cmd._check_compiler() + body = """ +int +main() +{ +#if (! defined __GNUC__) || (__GNUC__ < 4) +#error gcc >= 4 required +#endif + return 0; +} +""" + return cmd.try_compile(body, None, None) + + +def check_gcc_function_attribute(cmd, attribute, name): + """Return True if the given function attribute is supported.""" + cmd._check_compiler() + body = """ +#pragma GCC diagnostic error "-Wattributes" +#pragma clang diagnostic error "-Wattributes" + +int %s %s(void*); + +int +main() +{ + return 0; +} +""" % (attribute, name) + return cmd.try_compile(body, None, None) != 0 + +def check_gcc_variable_attribute(cmd, attribute): + """Return True if the given variable attribute is supported.""" + cmd._check_compiler() + body = """ +#pragma GCC diagnostic error "-Wattributes" +#pragma clang diagnostic error "-Wattributes" + +int %s foo; + +int +main() +{ + return 0; +} +""" % (attribute, ) + return cmd.try_compile(body, None, None) != 0 diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/bdist_rpm.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/bdist_rpm.py new file mode 100644 index 0000000000000000000000000000000000000000..3e52a503b172141f6d28799841e6df4332b59db8 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/bdist_rpm.py @@ -0,0 +1,24 @@ +from __future__ import division, absolute_import, print_function + +import os +import sys +if 'setuptools' in sys.modules: + from setuptools.command.bdist_rpm import bdist_rpm as old_bdist_rpm +else: + from distutils.command.bdist_rpm import bdist_rpm as old_bdist_rpm + +class bdist_rpm(old_bdist_rpm): + + def _make_spec_file(self): + spec_file = old_bdist_rpm._make_spec_file(self) + + # Replace hardcoded setup.py script name + # with the real setup script name. + setup_py = os.path.basename(sys.argv[0]) + if setup_py == 'setup.py': + return spec_file + new_spec_file = [] + for line in spec_file: + line = line.replace('setup.py', setup_py) + new_spec_file.append(line) + return new_spec_file diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/build.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/build.py new file mode 100644 index 0000000000000000000000000000000000000000..3d7101582a52dbd4dd680f193e89138a9b89f0ff --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/build.py @@ -0,0 +1,47 @@ +from __future__ import division, absolute_import, print_function + +import os +import sys +from distutils.command.build import build as old_build +from distutils.util import get_platform +from numpy.distutils.command.config_compiler import show_fortran_compilers + +class build(old_build): + + sub_commands = [('config_cc', lambda *args: True), + ('config_fc', lambda *args: True), + ('build_src', old_build.has_ext_modules), + ] + old_build.sub_commands + + user_options = old_build.user_options + [ + ('fcompiler=', None, + "specify the Fortran compiler type"), + ('parallel=', 'j', + "number of parallel jobs"), + ] + + help_options = old_build.help_options + [ + ('help-fcompiler', None, "list available Fortran compilers", + show_fortran_compilers), + ] + + def initialize_options(self): + old_build.initialize_options(self) + self.fcompiler = None + self.parallel = None + + def finalize_options(self): + if self.parallel: + try: + self.parallel = int(self.parallel) + except ValueError: + raise ValueError("--parallel/-j argument must be an integer") + build_scripts = self.build_scripts + old_build.finalize_options(self) + plat_specifier = ".%s-%s" % (get_platform(), sys.version[0:3]) + if build_scripts is None: + self.build_scripts = os.path.join(self.build_base, + 'scripts' + plat_specifier) + + def run(self): + old_build.run(self) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/build_clib.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/build_clib.py new file mode 100644 index 0000000000000000000000000000000000000000..910493a772d587f2ac511520d017a9784627dbd4 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/build_clib.py @@ -0,0 +1,323 @@ +""" Modified version of build_clib that handles fortran source files. +""" +from __future__ import division, absolute_import, print_function + +import os +from glob import glob +import shutil +from distutils.command.build_clib import build_clib as old_build_clib +from distutils.errors import DistutilsSetupError, DistutilsError, \ + DistutilsFileError + +from numpy.distutils import log +from distutils.dep_util import newer_group +from numpy.distutils.misc_util import filter_sources, has_f_sources,\ + has_cxx_sources, all_strings, get_lib_source_files, is_sequence, \ + get_numpy_include_dirs + +# Fix Python distutils bug sf #1718574: +_l = old_build_clib.user_options +for _i in range(len(_l)): + if _l[_i][0] in ['build-clib', 'build-temp']: + _l[_i] = (_l[_i][0] + '=',) + _l[_i][1:] +# + + +class build_clib(old_build_clib): + + description = "build C/C++/F libraries used by Python extensions" + + user_options = old_build_clib.user_options + [ + ('fcompiler=', None, + "specify the Fortran compiler type"), + ('inplace', 'i', 'Build in-place'), + ('parallel=', 'j', + "number of parallel jobs"), + ] + + boolean_options = old_build_clib.boolean_options + ['inplace'] + + def initialize_options(self): + old_build_clib.initialize_options(self) + self.fcompiler = None + self.inplace = 0 + self.parallel = None + + def finalize_options(self): + if self.parallel: + try: + self.parallel = int(self.parallel) + except ValueError: + raise ValueError("--parallel/-j argument must be an integer") + old_build_clib.finalize_options(self) + self.set_undefined_options('build', ('parallel', 'parallel')) + + def have_f_sources(self): + for (lib_name, build_info) in self.libraries: + if has_f_sources(build_info.get('sources', [])): + return True + return False + + def have_cxx_sources(self): + for (lib_name, build_info) in self.libraries: + if has_cxx_sources(build_info.get('sources', [])): + return True + return False + + def run(self): + if not self.libraries: + return + + # Make sure that library sources are complete. + languages = [] + + # Make sure that extension sources are complete. + self.run_command('build_src') + + for (lib_name, build_info) in self.libraries: + l = build_info.get('language', None) + if l and l not in languages: + languages.append(l) + + from distutils.ccompiler import new_compiler + self.compiler = new_compiler(compiler=self.compiler, + dry_run=self.dry_run, + force=self.force) + self.compiler.customize(self.distribution, + need_cxx=self.have_cxx_sources()) + + libraries = self.libraries + self.libraries = None + self.compiler.customize_cmd(self) + self.libraries = libraries + + self.compiler.show_customization() + + if self.have_f_sources(): + from numpy.distutils.fcompiler import new_fcompiler + self._f_compiler = new_fcompiler(compiler=self.fcompiler, + verbose=self.verbose, + dry_run=self.dry_run, + force=self.force, + requiref90='f90' in languages, + c_compiler=self.compiler) + if self._f_compiler is not None: + self._f_compiler.customize(self.distribution) + + libraries = self.libraries + self.libraries = None + self._f_compiler.customize_cmd(self) + self.libraries = libraries + + self._f_compiler.show_customization() + else: + self._f_compiler = None + + self.build_libraries(self.libraries) + + if self.inplace: + for l in self.distribution.installed_libraries: + libname = self.compiler.library_filename(l.name) + source = os.path.join(self.build_clib, libname) + target = os.path.join(l.target_dir, libname) + self.mkpath(l.target_dir) + shutil.copy(source, target) + + def get_source_files(self): + self.check_library_list(self.libraries) + filenames = [] + for lib in self.libraries: + filenames.extend(get_lib_source_files(lib)) + return filenames + + def build_libraries(self, libraries): + for (lib_name, build_info) in libraries: + self.build_a_library(build_info, lib_name, libraries) + + def build_a_library(self, build_info, lib_name, libraries): + # default compilers + compiler = self.compiler + fcompiler = self._f_compiler + + sources = build_info.get('sources') + if sources is None or not is_sequence(sources): + raise DistutilsSetupError(("in 'libraries' option (library '%s'), " + + "'sources' must be present and must be " + + "a list of source filenames") % lib_name) + sources = list(sources) + + c_sources, cxx_sources, f_sources, fmodule_sources \ + = filter_sources(sources) + requiref90 = not not fmodule_sources or \ + build_info.get('language', 'c') == 'f90' + + # save source type information so that build_ext can use it. + source_languages = [] + if c_sources: + source_languages.append('c') + if cxx_sources: + source_languages.append('c++') + if requiref90: + source_languages.append('f90') + elif f_sources: + source_languages.append('f77') + build_info['source_languages'] = source_languages + + lib_file = compiler.library_filename(lib_name, + output_dir=self.build_clib) + depends = sources + build_info.get('depends', []) + if not (self.force or newer_group(depends, lib_file, 'newer')): + log.debug("skipping '%s' library (up-to-date)", lib_name) + return + else: + log.info("building '%s' library", lib_name) + + config_fc = build_info.get('config_fc', {}) + if fcompiler is not None and config_fc: + log.info('using additional config_fc from setup script ' + 'for fortran compiler: %s' + % (config_fc,)) + from numpy.distutils.fcompiler import new_fcompiler + fcompiler = new_fcompiler(compiler=fcompiler.compiler_type, + verbose=self.verbose, + dry_run=self.dry_run, + force=self.force, + requiref90=requiref90, + c_compiler=self.compiler) + if fcompiler is not None: + dist = self.distribution + base_config_fc = dist.get_option_dict('config_fc').copy() + base_config_fc.update(config_fc) + fcompiler.customize(base_config_fc) + + # check availability of Fortran compilers + if (f_sources or fmodule_sources) and fcompiler is None: + raise DistutilsError("library %s has Fortran sources" + " but no Fortran compiler found" % (lib_name)) + + if fcompiler is not None: + fcompiler.extra_f77_compile_args = build_info.get( + 'extra_f77_compile_args') or [] + fcompiler.extra_f90_compile_args = build_info.get( + 'extra_f90_compile_args') or [] + + macros = build_info.get('macros') + include_dirs = build_info.get('include_dirs') + if include_dirs is None: + include_dirs = [] + extra_postargs = build_info.get('extra_compiler_args') or [] + + include_dirs.extend(get_numpy_include_dirs()) + # where compiled F90 module files are: + module_dirs = build_info.get('module_dirs') or [] + module_build_dir = os.path.dirname(lib_file) + if requiref90: + self.mkpath(module_build_dir) + + if compiler.compiler_type == 'msvc': + # this hack works around the msvc compiler attributes + # problem, msvc uses its own convention :( + c_sources += cxx_sources + cxx_sources = [] + + objects = [] + if c_sources: + log.info("compiling C sources") + objects = compiler.compile(c_sources, + output_dir=self.build_temp, + macros=macros, + include_dirs=include_dirs, + debug=self.debug, + extra_postargs=extra_postargs) + + if cxx_sources: + log.info("compiling C++ sources") + cxx_compiler = compiler.cxx_compiler() + cxx_objects = cxx_compiler.compile(cxx_sources, + output_dir=self.build_temp, + macros=macros, + include_dirs=include_dirs, + debug=self.debug, + extra_postargs=extra_postargs) + objects.extend(cxx_objects) + + if f_sources or fmodule_sources: + extra_postargs = [] + f_objects = [] + + if requiref90: + if fcompiler.module_dir_switch is None: + existing_modules = glob('*.mod') + extra_postargs += fcompiler.module_options( + module_dirs, module_build_dir) + + if fmodule_sources: + log.info("compiling Fortran 90 module sources") + f_objects += fcompiler.compile(fmodule_sources, + output_dir=self.build_temp, + macros=macros, + include_dirs=include_dirs, + debug=self.debug, + extra_postargs=extra_postargs) + + if requiref90 and self._f_compiler.module_dir_switch is None: + # move new compiled F90 module files to module_build_dir + for f in glob('*.mod'): + if f in existing_modules: + continue + t = os.path.join(module_build_dir, f) + if os.path.abspath(f) == os.path.abspath(t): + continue + if os.path.isfile(t): + os.remove(t) + try: + self.move_file(f, module_build_dir) + except DistutilsFileError: + log.warn('failed to move %r to %r' + % (f, module_build_dir)) + + if f_sources: + log.info("compiling Fortran sources") + f_objects += fcompiler.compile(f_sources, + output_dir=self.build_temp, + macros=macros, + include_dirs=include_dirs, + debug=self.debug, + extra_postargs=extra_postargs) + else: + f_objects = [] + + if f_objects and not fcompiler.can_ccompiler_link(compiler): + # Default linker cannot link Fortran object files, and results + # need to be wrapped later. Instead of creating a real static + # library, just keep track of the object files. + listfn = os.path.join(self.build_clib, + lib_name + '.fobjects') + with open(listfn, 'w') as f: + f.write("\n".join(os.path.abspath(obj) for obj in f_objects)) + + listfn = os.path.join(self.build_clib, + lib_name + '.cobjects') + with open(listfn, 'w') as f: + f.write("\n".join(os.path.abspath(obj) for obj in objects)) + + # create empty "library" file for dependency tracking + lib_fname = os.path.join(self.build_clib, + lib_name + compiler.static_lib_extension) + with open(lib_fname, 'wb') as f: + pass + else: + # assume that default linker is suitable for + # linking Fortran object files + objects.extend(f_objects) + compiler.create_static_lib(objects, lib_name, + output_dir=self.build_clib, + debug=self.debug) + + # fix library dependencies + clib_libraries = build_info.get('libraries', []) + for lname, binfo in libraries: + if lname in clib_libraries: + clib_libraries.extend(binfo.get('libraries', [])) + if clib_libraries: + build_info['libraries'] = clib_libraries diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/build_ext.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/build_ext.py new file mode 100644 index 0000000000000000000000000000000000000000..ab9d585a55589e58657b82b0cb0905a6c6bde913 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/build_ext.py @@ -0,0 +1,598 @@ +""" Modified version of build_ext that handles fortran source files. + +""" +from __future__ import division, absolute_import, print_function + +import os +import subprocess +from glob import glob + +from distutils.dep_util import newer_group +from distutils.command.build_ext import build_ext as old_build_ext +from distutils.errors import DistutilsFileError, DistutilsSetupError,\ + DistutilsError +from distutils.file_util import copy_file + +from numpy.distutils import log +from numpy.distutils.exec_command import filepath_from_subprocess_output +from numpy.distutils.system_info import combine_paths, system_info +from numpy.distutils.misc_util import filter_sources, has_f_sources, \ + has_cxx_sources, get_ext_source_files, \ + get_numpy_include_dirs, is_sequence, get_build_architecture, \ + msvc_version +from numpy.distutils.command.config_compiler import show_fortran_compilers + + + +class build_ext (old_build_ext): + + description = "build C/C++/F extensions (compile/link to build directory)" + + user_options = old_build_ext.user_options + [ + ('fcompiler=', None, + "specify the Fortran compiler type"), + ('parallel=', 'j', + "number of parallel jobs"), + ] + + help_options = old_build_ext.help_options + [ + ('help-fcompiler', None, "list available Fortran compilers", + show_fortran_compilers), + ] + + def initialize_options(self): + old_build_ext.initialize_options(self) + self.fcompiler = None + self.parallel = None + + def finalize_options(self): + if self.parallel: + try: + self.parallel = int(self.parallel) + except ValueError: + raise ValueError("--parallel/-j argument must be an integer") + + # Ensure that self.include_dirs and self.distribution.include_dirs + # refer to the same list object. finalize_options will modify + # self.include_dirs, but self.distribution.include_dirs is used + # during the actual build. + # self.include_dirs is None unless paths are specified with + # --include-dirs. + # The include paths will be passed to the compiler in the order: + # numpy paths, --include-dirs paths, Python include path. + if isinstance(self.include_dirs, str): + self.include_dirs = self.include_dirs.split(os.pathsep) + incl_dirs = self.include_dirs or [] + if self.distribution.include_dirs is None: + self.distribution.include_dirs = [] + self.include_dirs = self.distribution.include_dirs + self.include_dirs.extend(incl_dirs) + + old_build_ext.finalize_options(self) + self.set_undefined_options('build', ('parallel', 'parallel')) + + def run(self): + if not self.extensions: + return + + # Make sure that extension sources are complete. + self.run_command('build_src') + + if self.distribution.has_c_libraries(): + if self.inplace: + if self.distribution.have_run.get('build_clib'): + log.warn('build_clib already run, it is too late to ' + 'ensure in-place build of build_clib') + build_clib = self.distribution.get_command_obj( + 'build_clib') + else: + build_clib = self.distribution.get_command_obj( + 'build_clib') + build_clib.inplace = 1 + build_clib.ensure_finalized() + build_clib.run() + self.distribution.have_run['build_clib'] = 1 + + else: + self.run_command('build_clib') + build_clib = self.get_finalized_command('build_clib') + self.library_dirs.append(build_clib.build_clib) + else: + build_clib = None + + # Not including C libraries to the list of + # extension libraries automatically to prevent + # bogus linking commands. Extensions must + # explicitly specify the C libraries that they use. + + from distutils.ccompiler import new_compiler + from numpy.distutils.fcompiler import new_fcompiler + + compiler_type = self.compiler + # Initialize C compiler: + self.compiler = new_compiler(compiler=compiler_type, + verbose=self.verbose, + dry_run=self.dry_run, + force=self.force) + self.compiler.customize(self.distribution) + self.compiler.customize_cmd(self) + self.compiler.show_customization() + + # Setup directory for storing generated extra DLL files on Windows + self.extra_dll_dir = os.path.join(self.build_temp, '.libs') + if not os.path.isdir(self.extra_dll_dir): + os.makedirs(self.extra_dll_dir) + + # Create mapping of libraries built by build_clib: + clibs = {} + if build_clib is not None: + for libname, build_info in build_clib.libraries or []: + if libname in clibs and clibs[libname] != build_info: + log.warn('library %r defined more than once,' + ' overwriting build_info\n%s... \nwith\n%s...' + % (libname, repr(clibs[libname])[:300], repr(build_info)[:300])) + clibs[libname] = build_info + # .. and distribution libraries: + for libname, build_info in self.distribution.libraries or []: + if libname in clibs: + # build_clib libraries have a precedence before distribution ones + continue + clibs[libname] = build_info + + # Determine if C++/Fortran 77/Fortran 90 compilers are needed. + # Update extension libraries, library_dirs, and macros. + all_languages = set() + for ext in self.extensions: + ext_languages = set() + c_libs = [] + c_lib_dirs = [] + macros = [] + for libname in ext.libraries: + if libname in clibs: + binfo = clibs[libname] + c_libs += binfo.get('libraries', []) + c_lib_dirs += binfo.get('library_dirs', []) + for m in binfo.get('macros', []): + if m not in macros: + macros.append(m) + + for l in clibs.get(libname, {}).get('source_languages', []): + ext_languages.add(l) + if c_libs: + new_c_libs = ext.libraries + c_libs + log.info('updating extension %r libraries from %r to %r' + % (ext.name, ext.libraries, new_c_libs)) + ext.libraries = new_c_libs + ext.library_dirs = ext.library_dirs + c_lib_dirs + if macros: + log.info('extending extension %r defined_macros with %r' + % (ext.name, macros)) + ext.define_macros = ext.define_macros + macros + + # determine extension languages + if has_f_sources(ext.sources): + ext_languages.add('f77') + if has_cxx_sources(ext.sources): + ext_languages.add('c++') + l = ext.language or self.compiler.detect_language(ext.sources) + if l: + ext_languages.add(l) + # reset language attribute for choosing proper linker + if 'c++' in ext_languages: + ext_language = 'c++' + elif 'f90' in ext_languages: + ext_language = 'f90' + elif 'f77' in ext_languages: + ext_language = 'f77' + else: + ext_language = 'c' # default + if l and l != ext_language and ext.language: + log.warn('resetting extension %r language from %r to %r.' % + (ext.name, l, ext_language)) + ext.language = ext_language + # global language + all_languages.update(ext_languages) + + need_f90_compiler = 'f90' in all_languages + need_f77_compiler = 'f77' in all_languages + need_cxx_compiler = 'c++' in all_languages + + # Initialize C++ compiler: + if need_cxx_compiler: + self._cxx_compiler = new_compiler(compiler=compiler_type, + verbose=self.verbose, + dry_run=self.dry_run, + force=self.force) + compiler = self._cxx_compiler + compiler.customize(self.distribution, need_cxx=need_cxx_compiler) + compiler.customize_cmd(self) + compiler.show_customization() + self._cxx_compiler = compiler.cxx_compiler() + else: + self._cxx_compiler = None + + # Initialize Fortran 77 compiler: + if need_f77_compiler: + ctype = self.fcompiler + self._f77_compiler = new_fcompiler(compiler=self.fcompiler, + verbose=self.verbose, + dry_run=self.dry_run, + force=self.force, + requiref90=False, + c_compiler=self.compiler) + fcompiler = self._f77_compiler + if fcompiler: + ctype = fcompiler.compiler_type + fcompiler.customize(self.distribution) + if fcompiler and fcompiler.get_version(): + fcompiler.customize_cmd(self) + fcompiler.show_customization() + else: + self.warn('f77_compiler=%s is not available.' % + (ctype)) + self._f77_compiler = None + else: + self._f77_compiler = None + + # Initialize Fortran 90 compiler: + if need_f90_compiler: + ctype = self.fcompiler + self._f90_compiler = new_fcompiler(compiler=self.fcompiler, + verbose=self.verbose, + dry_run=self.dry_run, + force=self.force, + requiref90=True, + c_compiler=self.compiler) + fcompiler = self._f90_compiler + if fcompiler: + ctype = fcompiler.compiler_type + fcompiler.customize(self.distribution) + if fcompiler and fcompiler.get_version(): + fcompiler.customize_cmd(self) + fcompiler.show_customization() + else: + self.warn('f90_compiler=%s is not available.' % + (ctype)) + self._f90_compiler = None + else: + self._f90_compiler = None + + # Build extensions + self.build_extensions() + + # Copy over any extra DLL files + # FIXME: In the case where there are more than two packages, + # we blindly assume that both packages need all of the libraries, + # resulting in a larger wheel than is required. This should be fixed, + # but it's so rare that I won't bother to handle it. + pkg_roots = { + self.get_ext_fullname(ext.name).split('.')[0] + for ext in self.extensions + } + for pkg_root in pkg_roots: + shared_lib_dir = os.path.join(pkg_root, '.libs') + if not self.inplace: + shared_lib_dir = os.path.join(self.build_lib, shared_lib_dir) + for fn in os.listdir(self.extra_dll_dir): + if not os.path.isdir(shared_lib_dir): + os.makedirs(shared_lib_dir) + if not fn.lower().endswith('.dll'): + continue + runtime_lib = os.path.join(self.extra_dll_dir, fn) + copy_file(runtime_lib, shared_lib_dir) + + def swig_sources(self, sources): + # Do nothing. Swig sources have beed handled in build_src command. + return sources + + def build_extension(self, ext): + sources = ext.sources + if sources is None or not is_sequence(sources): + raise DistutilsSetupError( + ("in 'ext_modules' option (extension '%s'), " + + "'sources' must be present and must be " + + "a list of source filenames") % ext.name) + sources = list(sources) + + if not sources: + return + + fullname = self.get_ext_fullname(ext.name) + if self.inplace: + modpath = fullname.split('.') + package = '.'.join(modpath[0:-1]) + base = modpath[-1] + build_py = self.get_finalized_command('build_py') + package_dir = build_py.get_package_dir(package) + ext_filename = os.path.join(package_dir, + self.get_ext_filename(base)) + else: + ext_filename = os.path.join(self.build_lib, + self.get_ext_filename(fullname)) + depends = sources + ext.depends + + if not (self.force or newer_group(depends, ext_filename, 'newer')): + log.debug("skipping '%s' extension (up-to-date)", ext.name) + return + else: + log.info("building '%s' extension", ext.name) + + extra_args = ext.extra_compile_args or [] + macros = ext.define_macros[:] + for undef in ext.undef_macros: + macros.append((undef,)) + + c_sources, cxx_sources, f_sources, fmodule_sources = \ + filter_sources(ext.sources) + + if self.compiler.compiler_type == 'msvc': + if cxx_sources: + # Needed to compile kiva.agg._agg extension. + extra_args.append('/Zm1000') + # this hack works around the msvc compiler attributes + # problem, msvc uses its own convention :( + c_sources += cxx_sources + cxx_sources = [] + + # Set Fortran/C++ compilers for compilation and linking. + if ext.language == 'f90': + fcompiler = self._f90_compiler + elif ext.language == 'f77': + fcompiler = self._f77_compiler + else: # in case ext.language is c++, for instance + fcompiler = self._f90_compiler or self._f77_compiler + if fcompiler is not None: + fcompiler.extra_f77_compile_args = (ext.extra_f77_compile_args or []) if hasattr( + ext, 'extra_f77_compile_args') else [] + fcompiler.extra_f90_compile_args = (ext.extra_f90_compile_args or []) if hasattr( + ext, 'extra_f90_compile_args') else [] + cxx_compiler = self._cxx_compiler + + # check for the availability of required compilers + if cxx_sources and cxx_compiler is None: + raise DistutilsError("extension %r has C++ sources" + "but no C++ compiler found" % (ext.name)) + if (f_sources or fmodule_sources) and fcompiler is None: + raise DistutilsError("extension %r has Fortran sources " + "but no Fortran compiler found" % (ext.name)) + if ext.language in ['f77', 'f90'] and fcompiler is None: + self.warn("extension %r has Fortran libraries " + "but no Fortran linker found, using default linker" % (ext.name)) + if ext.language == 'c++' and cxx_compiler is None: + self.warn("extension %r has C++ libraries " + "but no C++ linker found, using default linker" % (ext.name)) + + kws = {'depends': ext.depends} + output_dir = self.build_temp + + include_dirs = ext.include_dirs + get_numpy_include_dirs() + + c_objects = [] + if c_sources: + log.info("compiling C sources") + c_objects = self.compiler.compile(c_sources, + output_dir=output_dir, + macros=macros, + include_dirs=include_dirs, + debug=self.debug, + extra_postargs=extra_args, + **kws) + + if cxx_sources: + log.info("compiling C++ sources") + c_objects += cxx_compiler.compile(cxx_sources, + output_dir=output_dir, + macros=macros, + include_dirs=include_dirs, + debug=self.debug, + extra_postargs=extra_args, + **kws) + + extra_postargs = [] + f_objects = [] + if fmodule_sources: + log.info("compiling Fortran 90 module sources") + module_dirs = ext.module_dirs[:] + module_build_dir = os.path.join( + self.build_temp, os.path.dirname( + self.get_ext_filename(fullname))) + + self.mkpath(module_build_dir) + if fcompiler.module_dir_switch is None: + existing_modules = glob('*.mod') + extra_postargs += fcompiler.module_options( + module_dirs, module_build_dir) + f_objects += fcompiler.compile(fmodule_sources, + output_dir=self.build_temp, + macros=macros, + include_dirs=include_dirs, + debug=self.debug, + extra_postargs=extra_postargs, + depends=ext.depends) + + if fcompiler.module_dir_switch is None: + for f in glob('*.mod'): + if f in existing_modules: + continue + t = os.path.join(module_build_dir, f) + if os.path.abspath(f) == os.path.abspath(t): + continue + if os.path.isfile(t): + os.remove(t) + try: + self.move_file(f, module_build_dir) + except DistutilsFileError: + log.warn('failed to move %r to %r' % + (f, module_build_dir)) + if f_sources: + log.info("compiling Fortran sources") + f_objects += fcompiler.compile(f_sources, + output_dir=self.build_temp, + macros=macros, + include_dirs=include_dirs, + debug=self.debug, + extra_postargs=extra_postargs, + depends=ext.depends) + + if f_objects and not fcompiler.can_ccompiler_link(self.compiler): + unlinkable_fobjects = f_objects + objects = c_objects + else: + unlinkable_fobjects = [] + objects = c_objects + f_objects + + if ext.extra_objects: + objects.extend(ext.extra_objects) + extra_args = ext.extra_link_args or [] + libraries = self.get_libraries(ext)[:] + library_dirs = ext.library_dirs[:] + + linker = self.compiler.link_shared_object + # Always use system linker when using MSVC compiler. + if self.compiler.compiler_type in ('msvc', 'intelw', 'intelemw'): + # expand libraries with fcompiler libraries as we are + # not using fcompiler linker + self._libs_with_msvc_and_fortran( + fcompiler, libraries, library_dirs) + + elif ext.language in ['f77', 'f90'] and fcompiler is not None: + linker = fcompiler.link_shared_object + if ext.language == 'c++' and cxx_compiler is not None: + linker = cxx_compiler.link_shared_object + + if fcompiler is not None: + objects, libraries = self._process_unlinkable_fobjects( + objects, libraries, + fcompiler, library_dirs, + unlinkable_fobjects) + + linker(objects, ext_filename, + libraries=libraries, + library_dirs=library_dirs, + runtime_library_dirs=ext.runtime_library_dirs, + extra_postargs=extra_args, + export_symbols=self.get_export_symbols(ext), + debug=self.debug, + build_temp=self.build_temp, + target_lang=ext.language) + + def _add_dummy_mingwex_sym(self, c_sources): + build_src = self.get_finalized_command("build_src").build_src + build_clib = self.get_finalized_command("build_clib").build_clib + objects = self.compiler.compile([os.path.join(build_src, + "gfortran_vs2003_hack.c")], + output_dir=self.build_temp) + self.compiler.create_static_lib( + objects, "_gfortran_workaround", output_dir=build_clib, debug=self.debug) + + def _process_unlinkable_fobjects(self, objects, libraries, + fcompiler, library_dirs, + unlinkable_fobjects): + libraries = list(libraries) + objects = list(objects) + unlinkable_fobjects = list(unlinkable_fobjects) + + # Expand possible fake static libraries to objects + for lib in list(libraries): + for libdir in library_dirs: + fake_lib = os.path.join(libdir, lib + '.fobjects') + if os.path.isfile(fake_lib): + # Replace fake static library + libraries.remove(lib) + with open(fake_lib, 'r') as f: + unlinkable_fobjects.extend(f.read().splitlines()) + + # Expand C objects + c_lib = os.path.join(libdir, lib + '.cobjects') + with open(c_lib, 'r') as f: + objects.extend(f.read().splitlines()) + + # Wrap unlinkable objects to a linkable one + if unlinkable_fobjects: + fobjects = [os.path.relpath(obj) for obj in unlinkable_fobjects] + wrapped = fcompiler.wrap_unlinkable_objects( + fobjects, output_dir=self.build_temp, + extra_dll_dir=self.extra_dll_dir) + objects.extend(wrapped) + + return objects, libraries + + def _libs_with_msvc_and_fortran(self, fcompiler, c_libraries, + c_library_dirs): + if fcompiler is None: + return + + for libname in c_libraries: + if libname.startswith('msvc'): + continue + fileexists = False + for libdir in c_library_dirs or []: + libfile = os.path.join(libdir, '%s.lib' % (libname)) + if os.path.isfile(libfile): + fileexists = True + break + if fileexists: + continue + # make g77-compiled static libs available to MSVC + fileexists = False + for libdir in c_library_dirs: + libfile = os.path.join(libdir, 'lib%s.a' % (libname)) + if os.path.isfile(libfile): + # copy libname.a file to name.lib so that MSVC linker + # can find it + libfile2 = os.path.join(self.build_temp, libname + '.lib') + copy_file(libfile, libfile2) + if self.build_temp not in c_library_dirs: + c_library_dirs.append(self.build_temp) + fileexists = True + break + if fileexists: + continue + log.warn('could not find library %r in directories %s' + % (libname, c_library_dirs)) + + # Always use system linker when using MSVC compiler. + f_lib_dirs = [] + for dir in fcompiler.library_dirs: + # correct path when compiling in Cygwin but with normal Win + # Python + if dir.startswith('/usr/lib'): + try: + dir = subprocess.check_output(['cygpath', '-w', dir]) + except (OSError, subprocess.CalledProcessError): + pass + else: + dir = filepath_from_subprocess_output(dir) + f_lib_dirs.append(dir) + c_library_dirs.extend(f_lib_dirs) + + # make g77-compiled static libs available to MSVC + for lib in fcompiler.libraries: + if not lib.startswith('msvc'): + c_libraries.append(lib) + p = combine_paths(f_lib_dirs, 'lib' + lib + '.a') + if p: + dst_name = os.path.join(self.build_temp, lib + '.lib') + if not os.path.isfile(dst_name): + copy_file(p[0], dst_name) + if self.build_temp not in c_library_dirs: + c_library_dirs.append(self.build_temp) + + def get_source_files(self): + self.check_extensions_list(self.extensions) + filenames = [] + for ext in self.extensions: + filenames.extend(get_ext_source_files(ext)) + return filenames + + def get_outputs(self): + self.check_extensions_list(self.extensions) + + outputs = [] + for ext in self.extensions: + if not ext.sources: + continue + fullname = self.get_ext_fullname(ext.name) + outputs.append(os.path.join(self.build_lib, + self.get_ext_filename(fullname))) + return outputs diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/build_py.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/build_py.py new file mode 100644 index 0000000000000000000000000000000000000000..54dcde43508396bf2c1ccd7887f7716ffe3cdb6d --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/build_py.py @@ -0,0 +1,33 @@ +from __future__ import division, absolute_import, print_function + +from distutils.command.build_py import build_py as old_build_py +from numpy.distutils.misc_util import is_string + +class build_py(old_build_py): + + def run(self): + build_src = self.get_finalized_command('build_src') + if build_src.py_modules_dict and self.packages is None: + self.packages = list(build_src.py_modules_dict.keys ()) + old_build_py.run(self) + + def find_package_modules(self, package, package_dir): + modules = old_build_py.find_package_modules(self, package, package_dir) + + # Find build_src generated *.py files. + build_src = self.get_finalized_command('build_src') + modules += build_src.py_modules_dict.get(package, []) + + return modules + + def find_modules(self): + old_py_modules = self.py_modules[:] + new_py_modules = [_m for _m in self.py_modules if is_string(_m)] + self.py_modules[:] = new_py_modules + modules = old_build_py.find_modules(self) + self.py_modules[:] = old_py_modules + + return modules + + # XXX: Fix find_source_files for item in py_modules such that item is 3-tuple + # and item[2] is source file. diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/build_scripts.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/build_scripts.py new file mode 100644 index 0000000000000000000000000000000000000000..c8b25fc719b593ca63dcf31d7693c0de6dcea3df --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/build_scripts.py @@ -0,0 +1,51 @@ +""" Modified version of build_scripts that handles building scripts from functions. + +""" +from __future__ import division, absolute_import, print_function + +from distutils.command.build_scripts import build_scripts as old_build_scripts +from numpy.distutils import log +from numpy.distutils.misc_util import is_string + +class build_scripts(old_build_scripts): + + def generate_scripts(self, scripts): + new_scripts = [] + func_scripts = [] + for script in scripts: + if is_string(script): + new_scripts.append(script) + else: + func_scripts.append(script) + if not func_scripts: + return new_scripts + + build_dir = self.build_dir + self.mkpath(build_dir) + for func in func_scripts: + script = func(build_dir) + if not script: + continue + if is_string(script): + log.info(" adding '%s' to scripts" % (script,)) + new_scripts.append(script) + else: + [log.info(" adding '%s' to scripts" % (s,)) for s in script] + new_scripts.extend(list(script)) + return new_scripts + + def run (self): + if not self.scripts: + return + + self.scripts = self.generate_scripts(self.scripts) + # Now make sure that the distribution object has this list of scripts. + # setuptools' develop command requires that this be a list of filenames, + # not functions. + self.distribution.scripts = self.scripts + + return old_build_scripts.run(self) + + def get_source_files(self): + from numpy.distutils.misc_util import get_script_files + return get_script_files(self.scripts) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/build_src.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/build_src.py new file mode 100644 index 0000000000000000000000000000000000000000..668bc23fe6a1a522b6705393330384c97e24d30b --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/build_src.py @@ -0,0 +1,774 @@ +""" Build swig and f2py sources. +""" +from __future__ import division, absolute_import, print_function + +import os +import re +import sys +import shlex +import copy + +from distutils.command import build_ext +from distutils.dep_util import newer_group, newer +from distutils.util import get_platform +from distutils.errors import DistutilsError, DistutilsSetupError + + +# this import can't be done here, as it uses numpy stuff only available +# after it's installed +#import numpy.f2py +from numpy.distutils import log +from numpy.distutils.misc_util import ( + fortran_ext_match, appendpath, is_string, is_sequence, get_cmd + ) +from numpy.distutils.from_template import process_file as process_f_file +from numpy.distutils.conv_template import process_file as process_c_file + +def subst_vars(target, source, d): + """Substitute any occurrence of @foo@ by d['foo'] from source file into + target.""" + var = re.compile('@([a-zA-Z_]+)@') + fs = open(source, 'r') + try: + ft = open(target, 'w') + try: + for l in fs: + m = var.search(l) + if m: + ft.write(l.replace('@%s@' % m.group(1), d[m.group(1)])) + else: + ft.write(l) + finally: + ft.close() + finally: + fs.close() + +class build_src(build_ext.build_ext): + + description = "build sources from SWIG, F2PY files or a function" + + user_options = [ + ('build-src=', 'd', "directory to \"build\" sources to"), + ('f2py-opts=', None, "list of f2py command line options"), + ('swig=', None, "path to the SWIG executable"), + ('swig-opts=', None, "list of SWIG command line options"), + ('swig-cpp', None, "make SWIG create C++ files (default is autodetected from sources)"), + ('f2pyflags=', None, "additional flags to f2py (use --f2py-opts= instead)"), # obsolete + ('swigflags=', None, "additional flags to swig (use --swig-opts= instead)"), # obsolete + ('force', 'f', "forcibly build everything (ignore file timestamps)"), + ('inplace', 'i', + "ignore build-lib and put compiled extensions into the source " + + "directory alongside your pure Python modules"), + ] + + boolean_options = ['force', 'inplace'] + + help_options = [] + + def initialize_options(self): + self.extensions = None + self.package = None + self.py_modules = None + self.py_modules_dict = None + self.build_src = None + self.build_lib = None + self.build_base = None + self.force = None + self.inplace = None + self.package_dir = None + self.f2pyflags = None # obsolete + self.f2py_opts = None + self.swigflags = None # obsolete + self.swig_opts = None + self.swig_cpp = None + self.swig = None + + def finalize_options(self): + self.set_undefined_options('build', + ('build_base', 'build_base'), + ('build_lib', 'build_lib'), + ('force', 'force')) + if self.package is None: + self.package = self.distribution.ext_package + self.extensions = self.distribution.ext_modules + self.libraries = self.distribution.libraries or [] + self.py_modules = self.distribution.py_modules or [] + self.data_files = self.distribution.data_files or [] + + if self.build_src is None: + plat_specifier = ".%s-%s" % (get_platform(), sys.version[0:3]) + self.build_src = os.path.join(self.build_base, 'src'+plat_specifier) + + # py_modules_dict is used in build_py.find_package_modules + self.py_modules_dict = {} + + if self.f2pyflags: + if self.f2py_opts: + log.warn('ignoring --f2pyflags as --f2py-opts already used') + else: + self.f2py_opts = self.f2pyflags + self.f2pyflags = None + if self.f2py_opts is None: + self.f2py_opts = [] + else: + self.f2py_opts = shlex.split(self.f2py_opts) + + if self.swigflags: + if self.swig_opts: + log.warn('ignoring --swigflags as --swig-opts already used') + else: + self.swig_opts = self.swigflags + self.swigflags = None + + if self.swig_opts is None: + self.swig_opts = [] + else: + self.swig_opts = shlex.split(self.swig_opts) + + # use options from build_ext command + build_ext = self.get_finalized_command('build_ext') + if self.inplace is None: + self.inplace = build_ext.inplace + if self.swig_cpp is None: + self.swig_cpp = build_ext.swig_cpp + for c in ['swig', 'swig_opt']: + o = '--'+c.replace('_', '-') + v = getattr(build_ext, c, None) + if v: + if getattr(self, c): + log.warn('both build_src and build_ext define %s option' % (o)) + else: + log.info('using "%s=%s" option from build_ext command' % (o, v)) + setattr(self, c, v) + + def run(self): + log.info("build_src") + if not (self.extensions or self.libraries): + return + self.build_sources() + + def build_sources(self): + + if self.inplace: + self.get_package_dir = \ + self.get_finalized_command('build_py').get_package_dir + + self.build_py_modules_sources() + + for libname_info in self.libraries: + self.build_library_sources(*libname_info) + + if self.extensions: + self.check_extensions_list(self.extensions) + + for ext in self.extensions: + self.build_extension_sources(ext) + + self.build_data_files_sources() + self.build_npy_pkg_config() + + def build_data_files_sources(self): + if not self.data_files: + return + log.info('building data_files sources') + from numpy.distutils.misc_util import get_data_files + new_data_files = [] + for data in self.data_files: + if isinstance(data, str): + new_data_files.append(data) + elif isinstance(data, tuple): + d, files = data + if self.inplace: + build_dir = self.get_package_dir('.'.join(d.split(os.sep))) + else: + build_dir = os.path.join(self.build_src, d) + funcs = [f for f in files if hasattr(f, '__call__')] + files = [f for f in files if not hasattr(f, '__call__')] + for f in funcs: + if f.__code__.co_argcount==1: + s = f(build_dir) + else: + s = f() + if s is not None: + if isinstance(s, list): + files.extend(s) + elif isinstance(s, str): + files.append(s) + else: + raise TypeError(repr(s)) + filenames = get_data_files((d, files)) + new_data_files.append((d, filenames)) + else: + raise TypeError(repr(data)) + self.data_files[:] = new_data_files + + + def _build_npy_pkg_config(self, info, gd): + template, install_dir, subst_dict = info + template_dir = os.path.dirname(template) + for k, v in gd.items(): + subst_dict[k] = v + + if self.inplace == 1: + generated_dir = os.path.join(template_dir, install_dir) + else: + generated_dir = os.path.join(self.build_src, template_dir, + install_dir) + generated = os.path.basename(os.path.splitext(template)[0]) + generated_path = os.path.join(generated_dir, generated) + if not os.path.exists(generated_dir): + os.makedirs(generated_dir) + + subst_vars(generated_path, template, subst_dict) + + # Where to install relatively to install prefix + full_install_dir = os.path.join(template_dir, install_dir) + return full_install_dir, generated_path + + def build_npy_pkg_config(self): + log.info('build_src: building npy-pkg config files') + + # XXX: another ugly workaround to circumvent distutils brain damage. We + # need the install prefix here, but finalizing the options of the + # install command when only building sources cause error. Instead, we + # copy the install command instance, and finalize the copy so that it + # does not disrupt how distutils want to do things when with the + # original install command instance. + install_cmd = copy.copy(get_cmd('install')) + if not install_cmd.finalized == 1: + install_cmd.finalize_options() + build_npkg = False + if self.inplace == 1: + top_prefix = '.' + build_npkg = True + elif hasattr(install_cmd, 'install_libbase'): + top_prefix = install_cmd.install_libbase + build_npkg = True + + if build_npkg: + for pkg, infos in self.distribution.installed_pkg_config.items(): + pkg_path = self.distribution.package_dir[pkg] + prefix = os.path.join(os.path.abspath(top_prefix), pkg_path) + d = {'prefix': prefix} + for info in infos: + install_dir, generated = self._build_npy_pkg_config(info, d) + self.distribution.data_files.append((install_dir, + [generated])) + + def build_py_modules_sources(self): + if not self.py_modules: + return + log.info('building py_modules sources') + new_py_modules = [] + for source in self.py_modules: + if is_sequence(source) and len(source)==3: + package, module_base, source = source + if self.inplace: + build_dir = self.get_package_dir(package) + else: + build_dir = os.path.join(self.build_src, + os.path.join(*package.split('.'))) + if hasattr(source, '__call__'): + target = os.path.join(build_dir, module_base + '.py') + source = source(target) + if source is None: + continue + modules = [(package, module_base, source)] + if package not in self.py_modules_dict: + self.py_modules_dict[package] = [] + self.py_modules_dict[package] += modules + else: + new_py_modules.append(source) + self.py_modules[:] = new_py_modules + + def build_library_sources(self, lib_name, build_info): + sources = list(build_info.get('sources', [])) + + if not sources: + return + + log.info('building library "%s" sources' % (lib_name)) + + sources = self.generate_sources(sources, (lib_name, build_info)) + + sources = self.template_sources(sources, (lib_name, build_info)) + + sources, h_files = self.filter_h_files(sources) + + if h_files: + log.info('%s - nothing done with h_files = %s', + self.package, h_files) + + #for f in h_files: + # self.distribution.headers.append((lib_name,f)) + + build_info['sources'] = sources + return + + def build_extension_sources(self, ext): + + sources = list(ext.sources) + + log.info('building extension "%s" sources' % (ext.name)) + + fullname = self.get_ext_fullname(ext.name) + + modpath = fullname.split('.') + package = '.'.join(modpath[0:-1]) + + if self.inplace: + self.ext_target_dir = self.get_package_dir(package) + + sources = self.generate_sources(sources, ext) + sources = self.template_sources(sources, ext) + sources = self.swig_sources(sources, ext) + sources = self.f2py_sources(sources, ext) + sources = self.pyrex_sources(sources, ext) + + sources, py_files = self.filter_py_files(sources) + + if package not in self.py_modules_dict: + self.py_modules_dict[package] = [] + modules = [] + for f in py_files: + module = os.path.splitext(os.path.basename(f))[0] + modules.append((package, module, f)) + self.py_modules_dict[package] += modules + + sources, h_files = self.filter_h_files(sources) + + if h_files: + log.info('%s - nothing done with h_files = %s', + package, h_files) + #for f in h_files: + # self.distribution.headers.append((package,f)) + + ext.sources = sources + + def generate_sources(self, sources, extension): + new_sources = [] + func_sources = [] + for source in sources: + if is_string(source): + new_sources.append(source) + else: + func_sources.append(source) + if not func_sources: + return new_sources + if self.inplace and not is_sequence(extension): + build_dir = self.ext_target_dir + else: + if is_sequence(extension): + name = extension[0] + # if 'include_dirs' not in extension[1]: + # extension[1]['include_dirs'] = [] + # incl_dirs = extension[1]['include_dirs'] + else: + name = extension.name + # incl_dirs = extension.include_dirs + #if self.build_src not in incl_dirs: + # incl_dirs.append(self.build_src) + build_dir = os.path.join(*([self.build_src]\ + +name.split('.')[:-1])) + self.mkpath(build_dir) + for func in func_sources: + source = func(extension, build_dir) + if not source: + continue + if is_sequence(source): + [log.info(" adding '%s' to sources." % (s,)) for s in source] + new_sources.extend(source) + else: + log.info(" adding '%s' to sources." % (source,)) + new_sources.append(source) + + return new_sources + + def filter_py_files(self, sources): + return self.filter_files(sources, ['.py']) + + def filter_h_files(self, sources): + return self.filter_files(sources, ['.h', '.hpp', '.inc']) + + def filter_files(self, sources, exts = []): + new_sources = [] + files = [] + for source in sources: + (base, ext) = os.path.splitext(source) + if ext in exts: + files.append(source) + else: + new_sources.append(source) + return new_sources, files + + def template_sources(self, sources, extension): + new_sources = [] + if is_sequence(extension): + depends = extension[1].get('depends') + include_dirs = extension[1].get('include_dirs') + else: + depends = extension.depends + include_dirs = extension.include_dirs + for source in sources: + (base, ext) = os.path.splitext(source) + if ext == '.src': # Template file + if self.inplace: + target_dir = os.path.dirname(base) + else: + target_dir = appendpath(self.build_src, os.path.dirname(base)) + self.mkpath(target_dir) + target_file = os.path.join(target_dir, os.path.basename(base)) + if (self.force or newer_group([source] + depends, target_file)): + if _f_pyf_ext_match(base): + log.info("from_template:> %s" % (target_file)) + outstr = process_f_file(source) + else: + log.info("conv_template:> %s" % (target_file)) + outstr = process_c_file(source) + fid = open(target_file, 'w') + fid.write(outstr) + fid.close() + if _header_ext_match(target_file): + d = os.path.dirname(target_file) + if d not in include_dirs: + log.info(" adding '%s' to include_dirs." % (d)) + include_dirs.append(d) + new_sources.append(target_file) + else: + new_sources.append(source) + return new_sources + + def pyrex_sources(self, sources, extension): + """Pyrex not supported; this remains for Cython support (see below)""" + new_sources = [] + ext_name = extension.name.split('.')[-1] + for source in sources: + (base, ext) = os.path.splitext(source) + if ext == '.pyx': + target_file = self.generate_a_pyrex_source(base, ext_name, + source, + extension) + new_sources.append(target_file) + else: + new_sources.append(source) + return new_sources + + def generate_a_pyrex_source(self, base, ext_name, source, extension): + """Pyrex is not supported, but some projects monkeypatch this method. + + That allows compiling Cython code, see gh-6955. + This method will remain here for compatibility reasons. + """ + return [] + + def f2py_sources(self, sources, extension): + new_sources = [] + f2py_sources = [] + f_sources = [] + f2py_targets = {} + target_dirs = [] + ext_name = extension.name.split('.')[-1] + skip_f2py = 0 + + for source in sources: + (base, ext) = os.path.splitext(source) + if ext == '.pyf': # F2PY interface file + if self.inplace: + target_dir = os.path.dirname(base) + else: + target_dir = appendpath(self.build_src, os.path.dirname(base)) + if os.path.isfile(source): + name = get_f2py_modulename(source) + if name != ext_name: + raise DistutilsSetupError('mismatch of extension names: %s ' + 'provides %r but expected %r' % ( + source, name, ext_name)) + target_file = os.path.join(target_dir, name+'module.c') + else: + log.debug(' source %s does not exist: skipping f2py\'ing.' \ + % (source)) + name = ext_name + skip_f2py = 1 + target_file = os.path.join(target_dir, name+'module.c') + if not os.path.isfile(target_file): + log.warn(' target %s does not exist:\n '\ + 'Assuming %smodule.c was generated with '\ + '"build_src --inplace" command.' \ + % (target_file, name)) + target_dir = os.path.dirname(base) + target_file = os.path.join(target_dir, name+'module.c') + if not os.path.isfile(target_file): + raise DistutilsSetupError("%r missing" % (target_file,)) + log.info(' Yes! Using %r as up-to-date target.' \ + % (target_file)) + target_dirs.append(target_dir) + f2py_sources.append(source) + f2py_targets[source] = target_file + new_sources.append(target_file) + elif fortran_ext_match(ext): + f_sources.append(source) + else: + new_sources.append(source) + + if not (f2py_sources or f_sources): + return new_sources + + for d in target_dirs: + self.mkpath(d) + + f2py_options = extension.f2py_options + self.f2py_opts + + if self.distribution.libraries: + for name, build_info in self.distribution.libraries: + if name in extension.libraries: + f2py_options.extend(build_info.get('f2py_options', [])) + + log.info("f2py options: %s" % (f2py_options)) + + if f2py_sources: + if len(f2py_sources) != 1: + raise DistutilsSetupError( + 'only one .pyf file is allowed per extension module but got'\ + ' more: %r' % (f2py_sources,)) + source = f2py_sources[0] + target_file = f2py_targets[source] + target_dir = os.path.dirname(target_file) or '.' + depends = [source] + extension.depends + if (self.force or newer_group(depends, target_file, 'newer')) \ + and not skip_f2py: + log.info("f2py: %s" % (source)) + import numpy.f2py + numpy.f2py.run_main(f2py_options + + ['--build-dir', target_dir, source]) + else: + log.debug(" skipping '%s' f2py interface (up-to-date)" % (source)) + else: + #XXX TODO: --inplace support for sdist command + if is_sequence(extension): + name = extension[0] + else: name = extension.name + target_dir = os.path.join(*([self.build_src]\ + +name.split('.')[:-1])) + target_file = os.path.join(target_dir, ext_name + 'module.c') + new_sources.append(target_file) + depends = f_sources + extension.depends + if (self.force or newer_group(depends, target_file, 'newer')) \ + and not skip_f2py: + log.info("f2py:> %s" % (target_file)) + self.mkpath(target_dir) + import numpy.f2py + numpy.f2py.run_main(f2py_options + ['--lower', + '--build-dir', target_dir]+\ + ['-m', ext_name]+f_sources) + else: + log.debug(" skipping f2py fortran files for '%s' (up-to-date)"\ + % (target_file)) + + if not os.path.isfile(target_file): + raise DistutilsError("f2py target file %r not generated" % (target_file,)) + + build_dir = os.path.join(self.build_src, target_dir) + target_c = os.path.join(build_dir, 'fortranobject.c') + target_h = os.path.join(build_dir, 'fortranobject.h') + log.info(" adding '%s' to sources." % (target_c)) + new_sources.append(target_c) + if build_dir not in extension.include_dirs: + log.info(" adding '%s' to include_dirs." % (build_dir)) + extension.include_dirs.append(build_dir) + + if not skip_f2py: + import numpy.f2py + d = os.path.dirname(numpy.f2py.__file__) + source_c = os.path.join(d, 'src', 'fortranobject.c') + source_h = os.path.join(d, 'src', 'fortranobject.h') + if newer(source_c, target_c) or newer(source_h, target_h): + self.mkpath(os.path.dirname(target_c)) + self.copy_file(source_c, target_c) + self.copy_file(source_h, target_h) + else: + if not os.path.isfile(target_c): + raise DistutilsSetupError("f2py target_c file %r not found" % (target_c,)) + if not os.path.isfile(target_h): + raise DistutilsSetupError("f2py target_h file %r not found" % (target_h,)) + + for name_ext in ['-f2pywrappers.f', '-f2pywrappers2.f90']: + filename = os.path.join(target_dir, ext_name + name_ext) + if os.path.isfile(filename): + log.info(" adding '%s' to sources." % (filename)) + f_sources.append(filename) + + return new_sources + f_sources + + def swig_sources(self, sources, extension): + # Assuming SWIG 1.3.14 or later. See compatibility note in + # http://www.swig.org/Doc1.3/Python.html#Python_nn6 + + new_sources = [] + swig_sources = [] + swig_targets = {} + target_dirs = [] + py_files = [] # swig generated .py files + target_ext = '.c' + if '-c++' in extension.swig_opts: + typ = 'c++' + is_cpp = True + extension.swig_opts.remove('-c++') + elif self.swig_cpp: + typ = 'c++' + is_cpp = True + else: + typ = None + is_cpp = False + skip_swig = 0 + ext_name = extension.name.split('.')[-1] + + for source in sources: + (base, ext) = os.path.splitext(source) + if ext == '.i': # SWIG interface file + # the code below assumes that the sources list + # contains not more than one .i SWIG interface file + if self.inplace: + target_dir = os.path.dirname(base) + py_target_dir = self.ext_target_dir + else: + target_dir = appendpath(self.build_src, os.path.dirname(base)) + py_target_dir = target_dir + if os.path.isfile(source): + name = get_swig_modulename(source) + if name != ext_name[1:]: + raise DistutilsSetupError( + 'mismatch of extension names: %s provides %r' + ' but expected %r' % (source, name, ext_name[1:])) + if typ is None: + typ = get_swig_target(source) + is_cpp = typ=='c++' + else: + typ2 = get_swig_target(source) + if typ2 is None: + log.warn('source %r does not define swig target, assuming %s swig target' \ + % (source, typ)) + elif typ!=typ2: + log.warn('expected %r but source %r defines %r swig target' \ + % (typ, source, typ2)) + if typ2=='c++': + log.warn('resetting swig target to c++ (some targets may have .c extension)') + is_cpp = True + else: + log.warn('assuming that %r has c++ swig target' % (source)) + if is_cpp: + target_ext = '.cpp' + target_file = os.path.join(target_dir, '%s_wrap%s' \ + % (name, target_ext)) + else: + log.warn(' source %s does not exist: skipping swig\'ing.' \ + % (source)) + name = ext_name[1:] + skip_swig = 1 + target_file = _find_swig_target(target_dir, name) + if not os.path.isfile(target_file): + log.warn(' target %s does not exist:\n '\ + 'Assuming %s_wrap.{c,cpp} was generated with '\ + '"build_src --inplace" command.' \ + % (target_file, name)) + target_dir = os.path.dirname(base) + target_file = _find_swig_target(target_dir, name) + if not os.path.isfile(target_file): + raise DistutilsSetupError("%r missing" % (target_file,)) + log.warn(' Yes! Using %r as up-to-date target.' \ + % (target_file)) + target_dirs.append(target_dir) + new_sources.append(target_file) + py_files.append(os.path.join(py_target_dir, name+'.py')) + swig_sources.append(source) + swig_targets[source] = new_sources[-1] + else: + new_sources.append(source) + + if not swig_sources: + return new_sources + + if skip_swig: + return new_sources + py_files + + for d in target_dirs: + self.mkpath(d) + + swig = self.swig or self.find_swig() + swig_cmd = [swig, "-python"] + extension.swig_opts + if is_cpp: + swig_cmd.append('-c++') + for d in extension.include_dirs: + swig_cmd.append('-I'+d) + for source in swig_sources: + target = swig_targets[source] + depends = [source] + extension.depends + if self.force or newer_group(depends, target, 'newer'): + log.info("%s: %s" % (os.path.basename(swig) \ + + (is_cpp and '++' or ''), source)) + self.spawn(swig_cmd + self.swig_opts \ + + ["-o", target, '-outdir', py_target_dir, source]) + else: + log.debug(" skipping '%s' swig interface (up-to-date)" \ + % (source)) + + return new_sources + py_files + +_f_pyf_ext_match = re.compile(r'.*[.](f90|f95|f77|for|ftn|f|pyf)\Z', re.I).match +_header_ext_match = re.compile(r'.*[.](inc|h|hpp)\Z', re.I).match + +#### SWIG related auxiliary functions #### +_swig_module_name_match = re.compile(r'\s*%module\s*(.*\(\s*package\s*=\s*"(?P[\w_]+)".*\)|)\s*(?P[\w_]+)', + re.I).match +_has_c_header = re.compile(r'-[*]-\s*c\s*-[*]-', re.I).search +_has_cpp_header = re.compile(r'-[*]-\s*c[+][+]\s*-[*]-', re.I).search + +def get_swig_target(source): + f = open(source, 'r') + result = None + line = f.readline() + if _has_cpp_header(line): + result = 'c++' + if _has_c_header(line): + result = 'c' + f.close() + return result + +def get_swig_modulename(source): + f = open(source, 'r') + name = None + for line in f: + m = _swig_module_name_match(line) + if m: + name = m.group('name') + break + f.close() + return name + +def _find_swig_target(target_dir, name): + for ext in ['.cpp', '.c']: + target = os.path.join(target_dir, '%s_wrap%s' % (name, ext)) + if os.path.isfile(target): + break + return target + +#### F2PY related auxiliary functions #### + +_f2py_module_name_match = re.compile(r'\s*python\s*module\s*(?P[\w_]+)', + re.I).match +_f2py_user_module_name_match = re.compile(r'\s*python\s*module\s*(?P[\w_]*?' + r'__user__[\w_]*)', re.I).match + +def get_f2py_modulename(source): + name = None + f = open(source) + for line in f: + m = _f2py_module_name_match(line) + if m: + if _f2py_user_module_name_match(line): # skip *__user__* names + continue + name = m.group('name') + break + f.close() + return name + +########################################## diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/config.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/config.py new file mode 100644 index 0000000000000000000000000000000000000000..d9b1e848839862011934110a4abdb3701b211507 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/config.py @@ -0,0 +1,506 @@ +# Added Fortran compiler support to config. Currently useful only for +# try_compile call. try_run works but is untested for most of Fortran +# compilers (they must define linker_exe first). +# Pearu Peterson +from __future__ import division, absolute_import, print_function + +import os, signal +import warnings +import sys +import subprocess + +from distutils.command.config import config as old_config +from distutils.command.config import LANG_EXT +from distutils import log +from distutils.file_util import copy_file +from distutils.ccompiler import CompileError, LinkError +import distutils +from numpy.distutils.exec_command import filepath_from_subprocess_output +from numpy.distutils.mingw32ccompiler import generate_manifest +from numpy.distutils.command.autodist import (check_gcc_function_attribute, + check_gcc_variable_attribute, + check_inline, + check_restrict, + check_compiler_gcc4) +from numpy.distutils.compat import get_exception + +LANG_EXT['f77'] = '.f' +LANG_EXT['f90'] = '.f90' + +class config(old_config): + old_config.user_options += [ + ('fcompiler=', None, "specify the Fortran compiler type"), + ] + + def initialize_options(self): + self.fcompiler = None + old_config.initialize_options(self) + + def _check_compiler (self): + old_config._check_compiler(self) + from numpy.distutils.fcompiler import FCompiler, new_fcompiler + + if sys.platform == 'win32' and (self.compiler.compiler_type in + ('msvc', 'intelw', 'intelemw')): + # XXX: hack to circumvent a python 2.6 bug with msvc9compiler: + # initialize call query_vcvarsall, which throws an IOError, and + # causes an error along the way without much information. We try to + # catch it here, hoping it is early enough, and print an helpful + # message instead of Error: None. + if not self.compiler.initialized: + try: + self.compiler.initialize() + except IOError: + e = get_exception() + msg = """\ +Could not initialize compiler instance: do you have Visual Studio +installed? If you are trying to build with MinGW, please use "python setup.py +build -c mingw32" instead. If you have Visual Studio installed, check it is +correctly installed, and the right version (VS 2008 for python 2.6, 2.7 and 3.2, +VS 2010 for >= 3.3). + +Original exception was: %s, and the Compiler class was %s +============================================================================""" \ + % (e, self.compiler.__class__.__name__) + print ("""\ +============================================================================""") + raise distutils.errors.DistutilsPlatformError(msg) + + # After MSVC is initialized, add an explicit /MANIFEST to linker + # flags. See issues gh-4245 and gh-4101 for details. Also + # relevant are issues 4431 and 16296 on the Python bug tracker. + from distutils import msvc9compiler + if msvc9compiler.get_build_version() >= 10: + for ldflags in [self.compiler.ldflags_shared, + self.compiler.ldflags_shared_debug]: + if '/MANIFEST' not in ldflags: + ldflags.append('/MANIFEST') + + if not isinstance(self.fcompiler, FCompiler): + self.fcompiler = new_fcompiler(compiler=self.fcompiler, + dry_run=self.dry_run, force=1, + c_compiler=self.compiler) + if self.fcompiler is not None: + self.fcompiler.customize(self.distribution) + if self.fcompiler.get_version(): + self.fcompiler.customize_cmd(self) + self.fcompiler.show_customization() + + def _wrap_method(self, mth, lang, args): + from distutils.ccompiler import CompileError + from distutils.errors import DistutilsExecError + save_compiler = self.compiler + if lang in ['f77', 'f90']: + self.compiler = self.fcompiler + try: + ret = mth(*((self,)+args)) + except (DistutilsExecError, CompileError): + str(get_exception()) + self.compiler = save_compiler + raise CompileError + self.compiler = save_compiler + return ret + + def _compile (self, body, headers, include_dirs, lang): + src, obj = self._wrap_method(old_config._compile, lang, + (body, headers, include_dirs, lang)) + # _compile in unixcompiler.py sometimes creates .d dependency files. + # Clean them up. + self.temp_files.append(obj + '.d') + return src, obj + + def _link (self, body, + headers, include_dirs, + libraries, library_dirs, lang): + if self.compiler.compiler_type=='msvc': + libraries = (libraries or [])[:] + library_dirs = (library_dirs or [])[:] + if lang in ['f77', 'f90']: + lang = 'c' # always use system linker when using MSVC compiler + if self.fcompiler: + for d in self.fcompiler.library_dirs or []: + # correct path when compiling in Cygwin but with + # normal Win Python + if d.startswith('/usr/lib'): + try: + d = subprocess.check_output(['cygpath', + '-w', d]) + except (OSError, subprocess.CalledProcessError): + pass + else: + d = filepath_from_subprocess_output(d) + library_dirs.append(d) + for libname in self.fcompiler.libraries or []: + if libname not in libraries: + libraries.append(libname) + for libname in libraries: + if libname.startswith('msvc'): continue + fileexists = False + for libdir in library_dirs or []: + libfile = os.path.join(libdir, '%s.lib' % (libname)) + if os.path.isfile(libfile): + fileexists = True + break + if fileexists: continue + # make g77-compiled static libs available to MSVC + fileexists = False + for libdir in library_dirs: + libfile = os.path.join(libdir, 'lib%s.a' % (libname)) + if os.path.isfile(libfile): + # copy libname.a file to name.lib so that MSVC linker + # can find it + libfile2 = os.path.join(libdir, '%s.lib' % (libname)) + copy_file(libfile, libfile2) + self.temp_files.append(libfile2) + fileexists = True + break + if fileexists: continue + log.warn('could not find library %r in directories %s' \ + % (libname, library_dirs)) + elif self.compiler.compiler_type == 'mingw32': + generate_manifest(self) + return self._wrap_method(old_config._link, lang, + (body, headers, include_dirs, + libraries, library_dirs, lang)) + + def check_header(self, header, include_dirs=None, library_dirs=None, lang='c'): + self._check_compiler() + return self.try_compile( + "/* we need a dummy line to make distutils happy */", + [header], include_dirs) + + def check_decl(self, symbol, + headers=None, include_dirs=None): + self._check_compiler() + body = """ +int main(void) +{ +#ifndef %s + (void) %s; +#endif + ; + return 0; +}""" % (symbol, symbol) + + return self.try_compile(body, headers, include_dirs) + + def check_macro_true(self, symbol, + headers=None, include_dirs=None): + self._check_compiler() + body = """ +int main(void) +{ +#if %s +#else +#error false or undefined macro +#endif + ; + return 0; +}""" % (symbol,) + + return self.try_compile(body, headers, include_dirs) + + def check_type(self, type_name, headers=None, include_dirs=None, + library_dirs=None): + """Check type availability. Return True if the type can be compiled, + False otherwise""" + self._check_compiler() + + # First check the type can be compiled + body = r""" +int main(void) { + if ((%(name)s *) 0) + return 0; + if (sizeof (%(name)s)) + return 0; +} +""" % {'name': type_name} + + st = False + try: + try: + self._compile(body % {'type': type_name}, + headers, include_dirs, 'c') + st = True + except distutils.errors.CompileError: + st = False + finally: + self._clean() + + return st + + def check_type_size(self, type_name, headers=None, include_dirs=None, library_dirs=None, expected=None): + """Check size of a given type.""" + self._check_compiler() + + # First check the type can be compiled + body = r""" +typedef %(type)s npy_check_sizeof_type; +int main (void) +{ + static int test_array [1 - 2 * !(((long) (sizeof (npy_check_sizeof_type))) >= 0)]; + test_array [0] = 0 + + ; + return 0; +} +""" + self._compile(body % {'type': type_name}, + headers, include_dirs, 'c') + self._clean() + + if expected: + body = r""" +typedef %(type)s npy_check_sizeof_type; +int main (void) +{ + static int test_array [1 - 2 * !(((long) (sizeof (npy_check_sizeof_type))) == %(size)s)]; + test_array [0] = 0 + + ; + return 0; +} +""" + for size in expected: + try: + self._compile(body % {'type': type_name, 'size': size}, + headers, include_dirs, 'c') + self._clean() + return size + except CompileError: + pass + + # this fails to *compile* if size > sizeof(type) + body = r""" +typedef %(type)s npy_check_sizeof_type; +int main (void) +{ + static int test_array [1 - 2 * !(((long) (sizeof (npy_check_sizeof_type))) <= %(size)s)]; + test_array [0] = 0 + + ; + return 0; +} +""" + + # The principle is simple: we first find low and high bounds of size + # for the type, where low/high are looked up on a log scale. Then, we + # do a binary search to find the exact size between low and high + low = 0 + mid = 0 + while True: + try: + self._compile(body % {'type': type_name, 'size': mid}, + headers, include_dirs, 'c') + self._clean() + break + except CompileError: + #log.info("failure to test for bound %d" % mid) + low = mid + 1 + mid = 2 * mid + 1 + + high = mid + # Binary search: + while low != high: + mid = (high - low) // 2 + low + try: + self._compile(body % {'type': type_name, 'size': mid}, + headers, include_dirs, 'c') + self._clean() + high = mid + except CompileError: + low = mid + 1 + return low + + def check_func(self, func, + headers=None, include_dirs=None, + libraries=None, library_dirs=None, + decl=False, call=False, call_args=None): + # clean up distutils's config a bit: add void to main(), and + # return a value. + self._check_compiler() + body = [] + if decl: + if type(decl) == str: + body.append(decl) + else: + body.append("int %s (void);" % func) + # Handle MSVC intrinsics: force MS compiler to make a function call. + # Useful to test for some functions when built with optimization on, to + # avoid build error because the intrinsic and our 'fake' test + # declaration do not match. + body.append("#ifdef _MSC_VER") + body.append("#pragma function(%s)" % func) + body.append("#endif") + body.append("int main (void) {") + if call: + if call_args is None: + call_args = '' + body.append(" %s(%s);" % (func, call_args)) + else: + body.append(" %s;" % func) + body.append(" return 0;") + body.append("}") + body = '\n'.join(body) + "\n" + + return self.try_link(body, headers, include_dirs, + libraries, library_dirs) + + def check_funcs_once(self, funcs, + headers=None, include_dirs=None, + libraries=None, library_dirs=None, + decl=False, call=False, call_args=None): + """Check a list of functions at once. + + This is useful to speed up things, since all the functions in the funcs + list will be put in one compilation unit. + + Arguments + --------- + funcs : seq + list of functions to test + include_dirs : seq + list of header paths + libraries : seq + list of libraries to link the code snippet to + library_dirs : seq + list of library paths + decl : dict + for every (key, value), the declaration in the value will be + used for function in key. If a function is not in the + dictionary, no declaration will be used. + call : dict + for every item (f, value), if the value is True, a call will be + done to the function f. + """ + self._check_compiler() + body = [] + if decl: + for f, v in decl.items(): + if v: + body.append("int %s (void);" % f) + + # Handle MS intrinsics. See check_func for more info. + body.append("#ifdef _MSC_VER") + for func in funcs: + body.append("#pragma function(%s)" % func) + body.append("#endif") + + body.append("int main (void) {") + if call: + for f in funcs: + if f in call and call[f]: + if not (call_args and f in call_args and call_args[f]): + args = '' + else: + args = call_args[f] + body.append(" %s(%s);" % (f, args)) + else: + body.append(" %s;" % f) + else: + for f in funcs: + body.append(" %s;" % f) + body.append(" return 0;") + body.append("}") + body = '\n'.join(body) + "\n" + + return self.try_link(body, headers, include_dirs, + libraries, library_dirs) + + def check_inline(self): + """Return the inline keyword recognized by the compiler, empty string + otherwise.""" + return check_inline(self) + + def check_restrict(self): + """Return the restrict keyword recognized by the compiler, empty string + otherwise.""" + return check_restrict(self) + + def check_compiler_gcc4(self): + """Return True if the C compiler is gcc >= 4.""" + return check_compiler_gcc4(self) + + def check_gcc_function_attribute(self, attribute, name): + return check_gcc_function_attribute(self, attribute, name) + + def check_gcc_variable_attribute(self, attribute): + return check_gcc_variable_attribute(self, attribute) + + def get_output(self, body, headers=None, include_dirs=None, + libraries=None, library_dirs=None, + lang="c", use_tee=None): + """Try to compile, link to an executable, and run a program + built from 'body' and 'headers'. Returns the exit status code + of the program and its output. + """ + # 2008-11-16, RemoveMe + warnings.warn("\n+++++++++++++++++++++++++++++++++++++++++++++++++\n" \ + "Usage of get_output is deprecated: please do not \n" \ + "use it anymore, and avoid configuration checks \n" \ + "involving running executable on the target machine.\n" \ + "+++++++++++++++++++++++++++++++++++++++++++++++++\n", + DeprecationWarning, stacklevel=2) + self._check_compiler() + exitcode, output = 255, '' + try: + grabber = GrabStdout() + try: + src, obj, exe = self._link(body, headers, include_dirs, + libraries, library_dirs, lang) + grabber.restore() + except Exception: + output = grabber.data + grabber.restore() + raise + exe = os.path.join('.', exe) + try: + # specify cwd arg for consistency with + # historic usage pattern of exec_command() + # also, note that exe appears to be a string, + # which exec_command() handled, but we now + # use a list for check_output() -- this assumes + # that exe is always a single command + output = subprocess.check_output([exe], cwd='.') + except subprocess.CalledProcessError as exc: + exitstatus = exc.returncode + output = '' + except OSError: + # preserve the EnvironmentError exit status + # used historically in exec_command() + exitstatus = 127 + output = '' + else: + output = filepath_from_subprocess_output(output) + if hasattr(os, 'WEXITSTATUS'): + exitcode = os.WEXITSTATUS(exitstatus) + if os.WIFSIGNALED(exitstatus): + sig = os.WTERMSIG(exitstatus) + log.error('subprocess exited with signal %d' % (sig,)) + if sig == signal.SIGINT: + # control-C + raise KeyboardInterrupt + else: + exitcode = exitstatus + log.info("success!") + except (CompileError, LinkError): + log.info("failure.") + self._clean() + return exitcode, output + +class GrabStdout(object): + + def __init__(self): + self.sys_stdout = sys.stdout + self.data = '' + sys.stdout = self + + def write (self, data): + self.sys_stdout.write(data) + self.data += data + + def flush (self): + self.sys_stdout.flush() + + def restore(self): + sys.stdout = self.sys_stdout diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/config_compiler.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/config_compiler.py new file mode 100644 index 0000000000000000000000000000000000000000..bf170063ede89da46b50e9925c4f55d3cb2d9a9b --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/config_compiler.py @@ -0,0 +1,128 @@ +from __future__ import division, absolute_import, print_function + +from distutils.core import Command +from numpy.distutils import log + +#XXX: Linker flags + +def show_fortran_compilers(_cache=None): + # Using cache to prevent infinite recursion. + if _cache: + return + elif _cache is None: + _cache = [] + _cache.append(1) + from numpy.distutils.fcompiler import show_fcompilers + import distutils.core + dist = distutils.core._setup_distribution + show_fcompilers(dist) + +class config_fc(Command): + """ Distutils command to hold user specified options + to Fortran compilers. + + config_fc command is used by the FCompiler.customize() method. + """ + + description = "specify Fortran 77/Fortran 90 compiler information" + + user_options = [ + ('fcompiler=', None, "specify Fortran compiler type"), + ('f77exec=', None, "specify F77 compiler command"), + ('f90exec=', None, "specify F90 compiler command"), + ('f77flags=', None, "specify F77 compiler flags"), + ('f90flags=', None, "specify F90 compiler flags"), + ('opt=', None, "specify optimization flags"), + ('arch=', None, "specify architecture specific optimization flags"), + ('debug', 'g', "compile with debugging information"), + ('noopt', None, "compile without optimization"), + ('noarch', None, "compile without arch-dependent optimization"), + ] + + help_options = [ + ('help-fcompiler', None, "list available Fortran compilers", + show_fortran_compilers), + ] + + boolean_options = ['debug', 'noopt', 'noarch'] + + def initialize_options(self): + self.fcompiler = None + self.f77exec = None + self.f90exec = None + self.f77flags = None + self.f90flags = None + self.opt = None + self.arch = None + self.debug = None + self.noopt = None + self.noarch = None + + def finalize_options(self): + log.info('unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options') + build_clib = self.get_finalized_command('build_clib') + build_ext = self.get_finalized_command('build_ext') + config = self.get_finalized_command('config') + build = self.get_finalized_command('build') + cmd_list = [self, config, build_clib, build_ext, build] + for a in ['fcompiler']: + l = [] + for c in cmd_list: + v = getattr(c, a) + if v is not None: + if not isinstance(v, str): v = v.compiler_type + if v not in l: l.append(v) + if not l: v1 = None + else: v1 = l[0] + if len(l)>1: + log.warn(' commands have different --%s options: %s'\ + ', using first in list as default' % (a, l)) + if v1: + for c in cmd_list: + if getattr(c, a) is None: setattr(c, a, v1) + + def run(self): + # Do nothing. + return + +class config_cc(Command): + """ Distutils command to hold user specified options + to C/C++ compilers. + """ + + description = "specify C/C++ compiler information" + + user_options = [ + ('compiler=', None, "specify C/C++ compiler type"), + ] + + def initialize_options(self): + self.compiler = None + + def finalize_options(self): + log.info('unifing config_cc, config, build_clib, build_ext, build commands --compiler options') + build_clib = self.get_finalized_command('build_clib') + build_ext = self.get_finalized_command('build_ext') + config = self.get_finalized_command('config') + build = self.get_finalized_command('build') + cmd_list = [self, config, build_clib, build_ext, build] + for a in ['compiler']: + l = [] + for c in cmd_list: + v = getattr(c, a) + if v is not None: + if not isinstance(v, str): v = v.compiler_type + if v not in l: l.append(v) + if not l: v1 = None + else: v1 = l[0] + if len(l)>1: + log.warn(' commands have different --%s options: %s'\ + ', using first in list as default' % (a, l)) + if v1: + for c in cmd_list: + if getattr(c, a) is None: setattr(c, a, v1) + return + + def run(self): + # Do nothing. + return diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/develop.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/develop.py new file mode 100644 index 0000000000000000000000000000000000000000..1410ab2a00fd401fea48d25315a95a2d7fb9e488 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/develop.py @@ -0,0 +1,17 @@ +""" Override the develop command from setuptools so we can ensure that our +generated files (from build_src or build_scripts) are properly converted to real +files with filenames. + +""" +from __future__ import division, absolute_import, print_function + +from setuptools.command.develop import develop as old_develop + +class develop(old_develop): + __doc__ = old_develop.__doc__ + def install_for_development(self): + # Build sources in-place, too. + self.reinitialize_command('build_src', inplace=1) + # Make sure scripts are built. + self.run_command('build_scripts') + old_develop.install_for_development(self) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/egg_info.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/egg_info.py new file mode 100644 index 0000000000000000000000000000000000000000..18673ece7d196c47fab3983df7a2f5f45f8f0c64 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/egg_info.py @@ -0,0 +1,27 @@ +from __future__ import division, absolute_import, print_function + +import sys + +from setuptools.command.egg_info import egg_info as _egg_info + +class egg_info(_egg_info): + def run(self): + if 'sdist' in sys.argv: + import warnings + import textwrap + msg = textwrap.dedent(""" + `build_src` is being run, this may lead to missing + files in your sdist! You want to use distutils.sdist + instead of the setuptools version: + + from distutils.command.sdist import sdist + cmdclass={'sdist': sdist}" + + See numpy's setup.py or gh-7131 for details.""") + warnings.warn(msg, UserWarning, stacklevel=2) + + # We need to ensure that build_src has been executed in order to give + # setuptools' egg_info command real filenames instead of functions which + # generate files. + self.run_command("build_src") + _egg_info.run(self) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/install.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/install.py new file mode 100644 index 0000000000000000000000000000000000000000..a1dd47755c64a1b2a5542958b754d6688bed60b3 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/install.py @@ -0,0 +1,82 @@ +from __future__ import division, absolute_import, print_function + +import sys +if 'setuptools' in sys.modules: + import setuptools.command.install as old_install_mod + have_setuptools = True +else: + import distutils.command.install as old_install_mod + have_setuptools = False +from distutils.file_util import write_file + +old_install = old_install_mod.install + +class install(old_install): + + # Always run install_clib - the command is cheap, so no need to bypass it; + # but it's not run by setuptools -- so it's run again in install_data + sub_commands = old_install.sub_commands + [ + ('install_clib', lambda x: True) + ] + + def finalize_options (self): + old_install.finalize_options(self) + self.install_lib = self.install_libbase + + def setuptools_run(self): + """ The setuptools version of the .run() method. + + We must pull in the entire code so we can override the level used in the + _getframe() call since we wrap this call by one more level. + """ + from distutils.command.install import install as distutils_install + + # Explicit request for old-style install? Just do it + if self.old_and_unmanageable or self.single_version_externally_managed: + return distutils_install.run(self) + + # Attempt to detect whether we were called from setup() or by another + # command. If we were called by setup(), our caller will be the + # 'run_command' method in 'distutils.dist', and *its* caller will be + # the 'run_commands' method. If we were called any other way, our + # immediate caller *might* be 'run_command', but it won't have been + # called by 'run_commands'. This is slightly kludgy, but seems to + # work. + # + caller = sys._getframe(3) + caller_module = caller.f_globals.get('__name__', '') + caller_name = caller.f_code.co_name + + if caller_module != 'distutils.dist' or caller_name!='run_commands': + # We weren't called from the command line or setup(), so we + # should run in backward-compatibility mode to support bdist_* + # commands. + distutils_install.run(self) + else: + self.do_egg_install() + + def run(self): + if not have_setuptools: + r = old_install.run(self) + else: + r = self.setuptools_run() + if self.record: + # bdist_rpm fails when INSTALLED_FILES contains + # paths with spaces. Such paths must be enclosed + # with double-quotes. + f = open(self.record, 'r') + lines = [] + need_rewrite = False + for l in f: + l = l.rstrip() + if ' ' in l: + need_rewrite = True + l = '"%s"' % (l) + lines.append(l) + f.close() + if need_rewrite: + self.execute(write_file, + (self.record, lines), + "re-writing list of installed files to '%s'" % + self.record) + return r diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/install_clib.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/install_clib.py new file mode 100644 index 0000000000000000000000000000000000000000..662aa00bda9b4f4786985fd967f553f83ec33638 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/install_clib.py @@ -0,0 +1,39 @@ +from __future__ import division, absolute_import, print_function + +import os +from distutils.core import Command +from distutils.ccompiler import new_compiler +from numpy.distutils.misc_util import get_cmd + +class install_clib(Command): + description = "Command to install installable C libraries" + + user_options = [] + + def initialize_options(self): + self.install_dir = None + self.outfiles = [] + + def finalize_options(self): + self.set_undefined_options('install', ('install_lib', 'install_dir')) + + def run (self): + build_clib_cmd = get_cmd("build_clib") + build_dir = build_clib_cmd.build_clib + + # We need the compiler to get the library name -> filename association + if not build_clib_cmd.compiler: + compiler = new_compiler(compiler=None) + compiler.customize(self.distribution) + else: + compiler = build_clib_cmd.compiler + + for l in self.distribution.installed_libraries: + target_dir = os.path.join(self.install_dir, l.target_dir) + name = compiler.library_filename(l.name) + source = os.path.join(build_dir, name) + self.mkpath(target_dir) + self.outfiles.append(self.copy_file(source, target_dir)[0]) + + def get_outputs(self): + return self.outfiles diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/install_data.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/install_data.py new file mode 100644 index 0000000000000000000000000000000000000000..996cf7e4017a68dc4983c816ddbbbd8ad01b22e3 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/install_data.py @@ -0,0 +1,26 @@ +from __future__ import division, absolute_import, print_function + +import sys +have_setuptools = ('setuptools' in sys.modules) + +from distutils.command.install_data import install_data as old_install_data + +#data installer with improved intelligence over distutils +#data files are copied into the project directory instead +#of willy-nilly +class install_data (old_install_data): + + def run(self): + old_install_data.run(self) + + if have_setuptools: + # Run install_clib again, since setuptools does not run sub-commands + # of install automatically + self.run_command('install_clib') + + def finalize_options (self): + self.set_undefined_options('install', + ('install_lib', 'install_dir'), + ('root', 'root'), + ('force', 'force'), + ) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/install_headers.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/install_headers.py new file mode 100644 index 0000000000000000000000000000000000000000..f3f58aa2876fdb358e83d0e72ded83e045911430 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/distutils/command/install_headers.py @@ -0,0 +1,27 @@ +from __future__ import division, absolute_import, print_function + +import os +from distutils.command.install_headers import install_headers as old_install_headers + +class install_headers (old_install_headers): + + def run (self): + headers = self.distribution.headers + if not headers: + return + + prefix = os.path.dirname(self.install_dir) + for header in headers: + if isinstance(header, tuple): + # Kind of a hack, but I don't know where else to change this... + if header[0] == 'numpy.core': + header = ('numpy', header[1]) + if os.path.splitext(header[1])[1] == '.inc': + continue + d = os.path.join(*([prefix]+header[0].split('.'))) + header = header[1] + else: + d = self.install_dir + self.mkpath(d) + (out, _) = self.copy_file(header, d) + self.outfiles.append(out) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/__init__.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..d146739bb2f1b8c5d3dfbfea25bf719037e77a70 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/__init__.py @@ -0,0 +1,121 @@ +#!/usr/bin/env python +"""Fortran to Python Interface Generator. + +""" +from __future__ import division, absolute_import, print_function + +__all__ = ['run_main', 'compile', 'f2py_testing'] + +import sys +import subprocess +import os + +import numpy as np + +from . import f2py2e +from . import f2py_testing +from . import diagnose + +run_main = f2py2e.run_main +main = f2py2e.main + + +def compile(source, + modulename='untitled', + extra_args='', + verbose=True, + source_fn=None, + extension='.f' + ): + """ + Build extension module from a Fortran 77 source string with f2py. + + Parameters + ---------- + source : str or bytes + Fortran source of module / subroutine to compile + + .. versionchanged:: 1.16.0 + Accept str as well as bytes + + modulename : str, optional + The name of the compiled python module + extra_args : str or list, optional + Additional parameters passed to f2py + + .. versionchanged:: 1.16.0 + A list of args may also be provided. + + verbose : bool, optional + Print f2py output to screen + source_fn : str, optional + Name of the file where the fortran source is written. + The default is to use a temporary file with the extension + provided by the `extension` parameter + extension : {'.f', '.f90'}, optional + Filename extension if `source_fn` is not provided. + The extension tells which fortran standard is used. + The default is `.f`, which implies F77 standard. + + .. versionadded:: 1.11.0 + + Returns + ------- + result : int + 0 on success + + Examples + -------- + .. include:: compile_session.dat + :literal: + + """ + import tempfile + import shlex + + if source_fn is None: + f, fname = tempfile.mkstemp(suffix=extension) + # f is a file descriptor so need to close it + # carefully -- not with .close() directly + os.close(f) + else: + fname = source_fn + + if not isinstance(source, str): + source = str(source, 'utf-8') + try: + with open(fname, 'w') as f: + f.write(source) + + args = ['-c', '-m', modulename, f.name] + + if isinstance(extra_args, np.compat.basestring): + is_posix = (os.name == 'posix') + extra_args = shlex.split(extra_args, posix=is_posix) + + args.extend(extra_args) + + c = [sys.executable, + '-c', + 'import numpy.f2py as f2py2e;f2py2e.main()'] + args + try: + output = subprocess.check_output(c) + except subprocess.CalledProcessError as exc: + status = exc.returncode + output = '' + except OSError: + # preserve historic status code used by exec_command() + status = 127 + output = '' + else: + status = 0 + if verbose: + print(output) + finally: + if source_fn is None: + os.remove(fname) + return status + +from numpy._pytesttester import PytestTester +test = PytestTester(__name__) +del PytestTester diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/__main__.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/__main__.py new file mode 100644 index 0000000000000000000000000000000000000000..708f7f3624adde4b8993f7de3571091640fd13f3 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/__main__.py @@ -0,0 +1,6 @@ +# See http://cens.ioc.ee/projects/f2py2e/ +from __future__ import division, print_function + +from numpy.f2py.f2py2e import main + +main() diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/__version__.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/__version__.py new file mode 100644 index 0000000000000000000000000000000000000000..49a2199bf38b0bccdf49300718fb9eaf2bd2fe87 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/__version__.py @@ -0,0 +1,10 @@ +from __future__ import division, absolute_import, print_function + +major = 2 + +try: + from __svn_version__ import version + version_info = (major, version) + version = '%s_%s' % version_info +except (ImportError, ValueError): + version = str(major) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/capi_maps.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/capi_maps.py new file mode 100644 index 0000000000000000000000000000000000000000..c41dd77c67fa9ea2c23d2e36dea168e251052bc7 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/capi_maps.py @@ -0,0 +1,837 @@ +#!/usr/bin/env python +""" + +Copyright 1999,2000 Pearu Peterson all rights reserved, +Pearu Peterson +Permission to use, modify, and distribute this software is given under the +terms of the NumPy License. + +NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. +$Date: 2005/05/06 10:57:33 $ +Pearu Peterson + +""" +from __future__ import division, absolute_import, print_function + +__version__ = "$Revision: 1.60 $"[10:-1] + +from . import __version__ +f2py_version = __version__.version + +import copy +import re +import os +import sys +from .crackfortran import markoutercomma +from . import cb_rules + +# The eviroment provided by auxfuncs.py is needed for some calls to eval. +# As the needed functions cannot be determined by static inspection of the +# code, it is safest to use import * pending a major refactoring of f2py. +from .auxfuncs import * + +__all__ = [ + 'getctype', 'getstrlength', 'getarrdims', 'getpydocsign', + 'getarrdocsign', 'getinit', 'sign2map', 'routsign2map', 'modsign2map', + 'cb_sign2map', 'cb_routsign2map', 'common_sign2map' +] + + +# Numarray and Numeric users should set this False +using_newcore = True + +depargs = [] +lcb_map = {} +lcb2_map = {} +# forced casting: mainly caused by the fact that Python or Numeric +# C/APIs do not support the corresponding C types. +c2py_map = {'double': 'float', + 'float': 'float', # forced casting + 'long_double': 'float', # forced casting + 'char': 'int', # forced casting + 'signed_char': 'int', # forced casting + 'unsigned_char': 'int', # forced casting + 'short': 'int', # forced casting + 'unsigned_short': 'int', # forced casting + 'int': 'int', # (forced casting) + 'long': 'int', + 'long_long': 'long', + 'unsigned': 'int', # forced casting + 'complex_float': 'complex', # forced casting + 'complex_double': 'complex', + 'complex_long_double': 'complex', # forced casting + 'string': 'string', + } +c2capi_map = {'double': 'NPY_DOUBLE', + 'float': 'NPY_FLOAT', + 'long_double': 'NPY_DOUBLE', # forced casting + 'char': 'NPY_STRING', + 'unsigned_char': 'NPY_UBYTE', + 'signed_char': 'NPY_BYTE', + 'short': 'NPY_SHORT', + 'unsigned_short': 'NPY_USHORT', + 'int': 'NPY_INT', + 'unsigned': 'NPY_UINT', + 'long': 'NPY_LONG', + 'long_long': 'NPY_LONG', # forced casting + 'complex_float': 'NPY_CFLOAT', + 'complex_double': 'NPY_CDOUBLE', + 'complex_long_double': 'NPY_CDOUBLE', # forced casting + 'string': 'NPY_STRING'} + +# These new maps aren't used anyhere yet, but should be by default +# unless building numeric or numarray extensions. +if using_newcore: + c2capi_map = {'double': 'NPY_DOUBLE', + 'float': 'NPY_FLOAT', + 'long_double': 'NPY_LONGDOUBLE', + 'char': 'NPY_BYTE', + 'unsigned_char': 'NPY_UBYTE', + 'signed_char': 'NPY_BYTE', + 'short': 'NPY_SHORT', + 'unsigned_short': 'NPY_USHORT', + 'int': 'NPY_INT', + 'unsigned': 'NPY_UINT', + 'long': 'NPY_LONG', + 'unsigned_long': 'NPY_ULONG', + 'long_long': 'NPY_LONGLONG', + 'unsigned_long_long': 'NPY_ULONGLONG', + 'complex_float': 'NPY_CFLOAT', + 'complex_double': 'NPY_CDOUBLE', + 'complex_long_double': 'NPY_CDOUBLE', + 'string':'NPY_STRING' + + } +c2pycode_map = {'double': 'd', + 'float': 'f', + 'long_double': 'd', # forced casting + 'char': '1', + 'signed_char': '1', + 'unsigned_char': 'b', + 'short': 's', + 'unsigned_short': 'w', + 'int': 'i', + 'unsigned': 'u', + 'long': 'l', + 'long_long': 'L', + 'complex_float': 'F', + 'complex_double': 'D', + 'complex_long_double': 'D', # forced casting + 'string': 'c' + } +if using_newcore: + c2pycode_map = {'double': 'd', + 'float': 'f', + 'long_double': 'g', + 'char': 'b', + 'unsigned_char': 'B', + 'signed_char': 'b', + 'short': 'h', + 'unsigned_short': 'H', + 'int': 'i', + 'unsigned': 'I', + 'long': 'l', + 'unsigned_long': 'L', + 'long_long': 'q', + 'unsigned_long_long': 'Q', + 'complex_float': 'F', + 'complex_double': 'D', + 'complex_long_double': 'G', + 'string': 'S'} +c2buildvalue_map = {'double': 'd', + 'float': 'f', + 'char': 'b', + 'signed_char': 'b', + 'short': 'h', + 'int': 'i', + 'long': 'l', + 'long_long': 'L', + 'complex_float': 'N', + 'complex_double': 'N', + 'complex_long_double': 'N', + 'string': 'z'} + +if sys.version_info[0] >= 3: + # Bytes, not Unicode strings + c2buildvalue_map['string'] = 'y' + +if using_newcore: + # c2buildvalue_map=??? + pass + +f2cmap_all = {'real': {'': 'float', '4': 'float', '8': 'double', + '12': 'long_double', '16': 'long_double'}, + 'integer': {'': 'int', '1': 'signed_char', '2': 'short', + '4': 'int', '8': 'long_long', + '-1': 'unsigned_char', '-2': 'unsigned_short', + '-4': 'unsigned', '-8': 'unsigned_long_long'}, + 'complex': {'': 'complex_float', '8': 'complex_float', + '16': 'complex_double', '24': 'complex_long_double', + '32': 'complex_long_double'}, + 'complexkind': {'': 'complex_float', '4': 'complex_float', + '8': 'complex_double', '12': 'complex_long_double', + '16': 'complex_long_double'}, + 'logical': {'': 'int', '1': 'char', '2': 'short', '4': 'int', + '8': 'long_long'}, + 'double complex': {'': 'complex_double'}, + 'double precision': {'': 'double'}, + 'byte': {'': 'char'}, + 'character': {'': 'string'} + } + +if os.path.isfile('.f2py_f2cmap'): + # User defined additions to f2cmap_all. + # .f2py_f2cmap must contain a dictionary of dictionaries, only. For + # example, {'real':{'low':'float'}} means that Fortran 'real(low)' is + # interpreted as C 'float'. This feature is useful for F90/95 users if + # they use PARAMETERSs in type specifications. + try: + outmess('Reading .f2py_f2cmap ...\n') + f = open('.f2py_f2cmap', 'r') + d = eval(f.read(), {}, {}) + f.close() + for k, d1 in list(d.items()): + for k1 in list(d1.keys()): + d1[k1.lower()] = d1[k1] + d[k.lower()] = d[k] + for k in list(d.keys()): + if k not in f2cmap_all: + f2cmap_all[k] = {} + for k1 in list(d[k].keys()): + if d[k][k1] in c2py_map: + if k1 in f2cmap_all[k]: + outmess( + "\tWarning: redefinition of {'%s':{'%s':'%s'->'%s'}}\n" % (k, k1, f2cmap_all[k][k1], d[k][k1])) + f2cmap_all[k][k1] = d[k][k1] + outmess('\tMapping "%s(kind=%s)" to "%s"\n' % + (k, k1, d[k][k1])) + else: + errmess("\tIgnoring map {'%s':{'%s':'%s'}}: '%s' must be in %s\n" % ( + k, k1, d[k][k1], d[k][k1], list(c2py_map.keys()))) + outmess('Successfully applied user defined changes from .f2py_f2cmap\n') + except Exception as msg: + errmess( + 'Failed to apply user defined changes from .f2py_f2cmap: %s. Skipping.\n' % (msg)) + +cformat_map = {'double': '%g', + 'float': '%g', + 'long_double': '%Lg', + 'char': '%d', + 'signed_char': '%d', + 'unsigned_char': '%hhu', + 'short': '%hd', + 'unsigned_short': '%hu', + 'int': '%d', + 'unsigned': '%u', + 'long': '%ld', + 'unsigned_long': '%lu', + 'long_long': '%ld', + 'complex_float': '(%g,%g)', + 'complex_double': '(%g,%g)', + 'complex_long_double': '(%Lg,%Lg)', + 'string': '%s', + } + +# Auxiliary functions + + +def getctype(var): + """ + Determines C type + """ + ctype = 'void' + if isfunction(var): + if 'result' in var: + a = var['result'] + else: + a = var['name'] + if a in var['vars']: + return getctype(var['vars'][a]) + else: + errmess('getctype: function %s has no return value?!\n' % a) + elif issubroutine(var): + return ctype + elif 'typespec' in var and var['typespec'].lower() in f2cmap_all: + typespec = var['typespec'].lower() + f2cmap = f2cmap_all[typespec] + ctype = f2cmap[''] # default type + if 'kindselector' in var: + if '*' in var['kindselector']: + try: + ctype = f2cmap[var['kindselector']['*']] + except KeyError: + errmess('getctype: "%s %s %s" not supported.\n' % + (var['typespec'], '*', var['kindselector']['*'])) + elif 'kind' in var['kindselector']: + if typespec + 'kind' in f2cmap_all: + f2cmap = f2cmap_all[typespec + 'kind'] + try: + ctype = f2cmap[var['kindselector']['kind']] + except KeyError: + if typespec in f2cmap_all: + f2cmap = f2cmap_all[typespec] + try: + ctype = f2cmap[str(var['kindselector']['kind'])] + except KeyError: + errmess('getctype: "%s(kind=%s)" is mapped to C "%s" (to override define dict(%s = dict(%s="")) in %s/.f2py_f2cmap file).\n' + % (typespec, var['kindselector']['kind'], ctype, + typespec, var['kindselector']['kind'], os.getcwd())) + + else: + if not isexternal(var): + errmess( + 'getctype: No C-type found in "%s", assuming void.\n' % var) + return ctype + + +def getstrlength(var): + if isstringfunction(var): + if 'result' in var: + a = var['result'] + else: + a = var['name'] + if a in var['vars']: + return getstrlength(var['vars'][a]) + else: + errmess('getstrlength: function %s has no return value?!\n' % a) + if not isstring(var): + errmess( + 'getstrlength: expected a signature of a string but got: %s\n' % (repr(var))) + len = '1' + if 'charselector' in var: + a = var['charselector'] + if '*' in a: + len = a['*'] + elif 'len' in a: + len = a['len'] + if re.match(r'\(\s*([*]|[:])\s*\)', len) or re.match(r'([*]|[:])', len): + if isintent_hide(var): + errmess('getstrlength:intent(hide): expected a string with defined length but got: %s\n' % ( + repr(var))) + len = '-1' + return len + + +def getarrdims(a, var, verbose=0): + global depargs + ret = {} + if isstring(var) and not isarray(var): + ret['dims'] = getstrlength(var) + ret['size'] = ret['dims'] + ret['rank'] = '1' + elif isscalar(var): + ret['size'] = '1' + ret['rank'] = '0' + ret['dims'] = '' + elif isarray(var): + dim = copy.copy(var['dimension']) + ret['size'] = '*'.join(dim) + try: + ret['size'] = repr(eval(ret['size'])) + except Exception: + pass + ret['dims'] = ','.join(dim) + ret['rank'] = repr(len(dim)) + ret['rank*[-1]'] = repr(len(dim) * [-1])[1:-1] + for i in range(len(dim)): # solve dim for dependencies + v = [] + if dim[i] in depargs: + v = [dim[i]] + else: + for va in depargs: + if re.match(r'.*?\b%s\b.*' % va, dim[i]): + v.append(va) + for va in v: + if depargs.index(va) > depargs.index(a): + dim[i] = '*' + break + ret['setdims'], i = '', -1 + for d in dim: + i = i + 1 + if d not in ['*', ':', '(*)', '(:)']: + ret['setdims'] = '%s#varname#_Dims[%d]=%s,' % ( + ret['setdims'], i, d) + if ret['setdims']: + ret['setdims'] = ret['setdims'][:-1] + ret['cbsetdims'], i = '', -1 + for d in var['dimension']: + i = i + 1 + if d not in ['*', ':', '(*)', '(:)']: + ret['cbsetdims'] = '%s#varname#_Dims[%d]=%s,' % ( + ret['cbsetdims'], i, d) + elif isintent_in(var): + outmess('getarrdims:warning: assumed shape array, using 0 instead of %r\n' + % (d)) + ret['cbsetdims'] = '%s#varname#_Dims[%d]=%s,' % ( + ret['cbsetdims'], i, 0) + elif verbose: + errmess( + 'getarrdims: If in call-back function: array argument %s must have bounded dimensions: got %s\n' % (repr(a), repr(d))) + if ret['cbsetdims']: + ret['cbsetdims'] = ret['cbsetdims'][:-1] +# if not isintent_c(var): +# var['dimension'].reverse() + return ret + + +def getpydocsign(a, var): + global lcb_map + if isfunction(var): + if 'result' in var: + af = var['result'] + else: + af = var['name'] + if af in var['vars']: + return getpydocsign(af, var['vars'][af]) + else: + errmess('getctype: function %s has no return value?!\n' % af) + return '', '' + sig, sigout = a, a + opt = '' + if isintent_in(var): + opt = 'input' + elif isintent_inout(var): + opt = 'in/output' + out_a = a + if isintent_out(var): + for k in var['intent']: + if k[:4] == 'out=': + out_a = k[4:] + break + init = '' + ctype = getctype(var) + + if hasinitvalue(var): + init, showinit = getinit(a, var) + init = ', optional\\n Default: %s' % showinit + if isscalar(var): + if isintent_inout(var): + sig = '%s : %s rank-0 array(%s,\'%s\')%s' % (a, opt, c2py_map[ctype], + c2pycode_map[ctype], init) + else: + sig = '%s : %s %s%s' % (a, opt, c2py_map[ctype], init) + sigout = '%s : %s' % (out_a, c2py_map[ctype]) + elif isstring(var): + if isintent_inout(var): + sig = '%s : %s rank-0 array(string(len=%s),\'c\')%s' % ( + a, opt, getstrlength(var), init) + else: + sig = '%s : %s string(len=%s)%s' % ( + a, opt, getstrlength(var), init) + sigout = '%s : string(len=%s)' % (out_a, getstrlength(var)) + elif isarray(var): + dim = var['dimension'] + rank = repr(len(dim)) + sig = '%s : %s rank-%s array(\'%s\') with bounds (%s)%s' % (a, opt, rank, + c2pycode_map[ + ctype], + ','.join(dim), init) + if a == out_a: + sigout = '%s : rank-%s array(\'%s\') with bounds (%s)'\ + % (a, rank, c2pycode_map[ctype], ','.join(dim)) + else: + sigout = '%s : rank-%s array(\'%s\') with bounds (%s) and %s storage'\ + % (out_a, rank, c2pycode_map[ctype], ','.join(dim), a) + elif isexternal(var): + ua = '' + if a in lcb_map and lcb_map[a] in lcb2_map and 'argname' in lcb2_map[lcb_map[a]]: + ua = lcb2_map[lcb_map[a]]['argname'] + if not ua == a: + ua = ' => %s' % ua + else: + ua = '' + sig = '%s : call-back function%s' % (a, ua) + sigout = sig + else: + errmess( + 'getpydocsign: Could not resolve docsignature for "%s".\\n' % a) + return sig, sigout + + +def getarrdocsign(a, var): + ctype = getctype(var) + if isstring(var) and (not isarray(var)): + sig = '%s : rank-0 array(string(len=%s),\'c\')' % (a, + getstrlength(var)) + elif isscalar(var): + sig = '%s : rank-0 array(%s,\'%s\')' % (a, c2py_map[ctype], + c2pycode_map[ctype],) + elif isarray(var): + dim = var['dimension'] + rank = repr(len(dim)) + sig = '%s : rank-%s array(\'%s\') with bounds (%s)' % (a, rank, + c2pycode_map[ + ctype], + ','.join(dim)) + return sig + + +def getinit(a, var): + if isstring(var): + init, showinit = '""', "''" + else: + init, showinit = '', '' + if hasinitvalue(var): + init = var['='] + showinit = init + if iscomplex(var) or iscomplexarray(var): + ret = {} + + try: + v = var["="] + if ',' in v: + ret['init.r'], ret['init.i'] = markoutercomma( + v[1:-1]).split('@,@') + else: + v = eval(v, {}, {}) + ret['init.r'], ret['init.i'] = str(v.real), str(v.imag) + except Exception: + raise ValueError( + 'getinit: expected complex number `(r,i)\' but got `%s\' as initial value of %r.' % (init, a)) + if isarray(var): + init = '(capi_c.r=%s,capi_c.i=%s,capi_c)' % ( + ret['init.r'], ret['init.i']) + elif isstring(var): + if not init: + init, showinit = '""', "''" + if init[0] == "'": + init = '"%s"' % (init[1:-1].replace('"', '\\"')) + if init[0] == '"': + showinit = "'%s'" % (init[1:-1]) + return init, showinit + + +def sign2map(a, var): + """ + varname,ctype,atype + init,init.r,init.i,pytype + vardebuginfo,vardebugshowvalue,varshowvalue + varrfromat + intent + """ + global lcb_map, cb_map + out_a = a + if isintent_out(var): + for k in var['intent']: + if k[:4] == 'out=': + out_a = k[4:] + break + ret = {'varname': a, 'outvarname': out_a, 'ctype': getctype(var)} + intent_flags = [] + for f, s in isintent_dict.items(): + if f(var): + intent_flags.append('F2PY_%s' % s) + if intent_flags: + # XXX: Evaluate intent_flags here. + ret['intent'] = '|'.join(intent_flags) + else: + ret['intent'] = 'F2PY_INTENT_IN' + if isarray(var): + ret['varrformat'] = 'N' + elif ret['ctype'] in c2buildvalue_map: + ret['varrformat'] = c2buildvalue_map[ret['ctype']] + else: + ret['varrformat'] = 'O' + ret['init'], ret['showinit'] = getinit(a, var) + if hasinitvalue(var) and iscomplex(var) and not isarray(var): + ret['init.r'], ret['init.i'] = markoutercomma( + ret['init'][1:-1]).split('@,@') + if isexternal(var): + ret['cbnamekey'] = a + if a in lcb_map: + ret['cbname'] = lcb_map[a] + ret['maxnofargs'] = lcb2_map[lcb_map[a]]['maxnofargs'] + ret['nofoptargs'] = lcb2_map[lcb_map[a]]['nofoptargs'] + ret['cbdocstr'] = lcb2_map[lcb_map[a]]['docstr'] + ret['cblatexdocstr'] = lcb2_map[lcb_map[a]]['latexdocstr'] + else: + ret['cbname'] = a + errmess('sign2map: Confused: external %s is not in lcb_map%s.\n' % ( + a, list(lcb_map.keys()))) + if isstring(var): + ret['length'] = getstrlength(var) + if isarray(var): + ret = dictappend(ret, getarrdims(a, var)) + dim = copy.copy(var['dimension']) + if ret['ctype'] in c2capi_map: + ret['atype'] = c2capi_map[ret['ctype']] + # Debug info + if debugcapi(var): + il = [isintent_in, 'input', isintent_out, 'output', + isintent_inout, 'inoutput', isrequired, 'required', + isoptional, 'optional', isintent_hide, 'hidden', + iscomplex, 'complex scalar', + l_and(isscalar, l_not(iscomplex)), 'scalar', + isstring, 'string', isarray, 'array', + iscomplexarray, 'complex array', isstringarray, 'string array', + iscomplexfunction, 'complex function', + l_and(isfunction, l_not(iscomplexfunction)), 'function', + isexternal, 'callback', + isintent_callback, 'callback', + isintent_aux, 'auxiliary', + ] + rl = [] + for i in range(0, len(il), 2): + if il[i](var): + rl.append(il[i + 1]) + if isstring(var): + rl.append('slen(%s)=%s' % (a, ret['length'])) + if isarray(var): + ddim = ','.join( + map(lambda x, y: '%s|%s' % (x, y), var['dimension'], dim)) + rl.append('dims(%s)' % ddim) + if isexternal(var): + ret['vardebuginfo'] = 'debug-capi:%s=>%s:%s' % ( + a, ret['cbname'], ','.join(rl)) + else: + ret['vardebuginfo'] = 'debug-capi:%s %s=%s:%s' % ( + ret['ctype'], a, ret['showinit'], ','.join(rl)) + if isscalar(var): + if ret['ctype'] in cformat_map: + ret['vardebugshowvalue'] = 'debug-capi:%s=%s' % ( + a, cformat_map[ret['ctype']]) + if isstring(var): + ret['vardebugshowvalue'] = 'debug-capi:slen(%s)=%%d %s=\\"%%s\\"' % ( + a, a) + if isexternal(var): + ret['vardebugshowvalue'] = 'debug-capi:%s=%%p' % (a) + if ret['ctype'] in cformat_map: + ret['varshowvalue'] = '#name#:%s=%s' % (a, cformat_map[ret['ctype']]) + ret['showvalueformat'] = '%s' % (cformat_map[ret['ctype']]) + if isstring(var): + ret['varshowvalue'] = '#name#:slen(%s)=%%d %s=\\"%%s\\"' % (a, a) + ret['pydocsign'], ret['pydocsignout'] = getpydocsign(a, var) + if hasnote(var): + ret['note'] = var['note'] + return ret + + +def routsign2map(rout): + """ + name,NAME,begintitle,endtitle + rname,ctype,rformat + routdebugshowvalue + """ + global lcb_map + name = rout['name'] + fname = getfortranname(rout) + ret = {'name': name, + 'texname': name.replace('_', '\\_'), + 'name_lower': name.lower(), + 'NAME': name.upper(), + 'begintitle': gentitle(name), + 'endtitle': gentitle('end of %s' % name), + 'fortranname': fname, + 'FORTRANNAME': fname.upper(), + 'callstatement': getcallstatement(rout) or '', + 'usercode': getusercode(rout) or '', + 'usercode1': getusercode1(rout) or '', + } + if '_' in fname: + ret['F_FUNC'] = 'F_FUNC_US' + else: + ret['F_FUNC'] = 'F_FUNC' + if '_' in name: + ret['F_WRAPPEDFUNC'] = 'F_WRAPPEDFUNC_US' + else: + ret['F_WRAPPEDFUNC'] = 'F_WRAPPEDFUNC' + lcb_map = {} + if 'use' in rout: + for u in rout['use'].keys(): + if u in cb_rules.cb_map: + for un in cb_rules.cb_map[u]: + ln = un[0] + if 'map' in rout['use'][u]: + for k in rout['use'][u]['map'].keys(): + if rout['use'][u]['map'][k] == un[0]: + ln = k + break + lcb_map[ln] = un[1] + elif 'externals' in rout and rout['externals']: + errmess('routsign2map: Confused: function %s has externals %s but no "use" statement.\n' % ( + ret['name'], repr(rout['externals']))) + ret['callprotoargument'] = getcallprotoargument(rout, lcb_map) or '' + if isfunction(rout): + if 'result' in rout: + a = rout['result'] + else: + a = rout['name'] + ret['rname'] = a + ret['pydocsign'], ret['pydocsignout'] = getpydocsign(a, rout) + ret['ctype'] = getctype(rout['vars'][a]) + if hasresultnote(rout): + ret['resultnote'] = rout['vars'][a]['note'] + rout['vars'][a]['note'] = ['See elsewhere.'] + if ret['ctype'] in c2buildvalue_map: + ret['rformat'] = c2buildvalue_map[ret['ctype']] + else: + ret['rformat'] = 'O' + errmess('routsign2map: no c2buildvalue key for type %s\n' % + (repr(ret['ctype']))) + if debugcapi(rout): + if ret['ctype'] in cformat_map: + ret['routdebugshowvalue'] = 'debug-capi:%s=%s' % ( + a, cformat_map[ret['ctype']]) + if isstringfunction(rout): + ret['routdebugshowvalue'] = 'debug-capi:slen(%s)=%%d %s=\\"%%s\\"' % ( + a, a) + if isstringfunction(rout): + ret['rlength'] = getstrlength(rout['vars'][a]) + if ret['rlength'] == '-1': + errmess('routsign2map: expected explicit specification of the length of the string returned by the fortran function %s; taking 10.\n' % ( + repr(rout['name']))) + ret['rlength'] = '10' + if hasnote(rout): + ret['note'] = rout['note'] + rout['note'] = ['See elsewhere.'] + return ret + + +def modsign2map(m): + """ + modulename + """ + if ismodule(m): + ret = {'f90modulename': m['name'], + 'F90MODULENAME': m['name'].upper(), + 'texf90modulename': m['name'].replace('_', '\\_')} + else: + ret = {'modulename': m['name'], + 'MODULENAME': m['name'].upper(), + 'texmodulename': m['name'].replace('_', '\\_')} + ret['restdoc'] = getrestdoc(m) or [] + if hasnote(m): + ret['note'] = m['note'] + ret['usercode'] = getusercode(m) or '' + ret['usercode1'] = getusercode1(m) or '' + if m['body']: + ret['interface_usercode'] = getusercode(m['body'][0]) or '' + else: + ret['interface_usercode'] = '' + ret['pymethoddef'] = getpymethoddef(m) or '' + if 'coutput' in m: + ret['coutput'] = m['coutput'] + if 'f2py_wrapper_output' in m: + ret['f2py_wrapper_output'] = m['f2py_wrapper_output'] + return ret + + +def cb_sign2map(a, var, index=None): + ret = {'varname': a} + ret['varname_i'] = ret['varname'] + ret['ctype'] = getctype(var) + if ret['ctype'] in c2capi_map: + ret['atype'] = c2capi_map[ret['ctype']] + if ret['ctype'] in cformat_map: + ret['showvalueformat'] = '%s' % (cformat_map[ret['ctype']]) + if isarray(var): + ret = dictappend(ret, getarrdims(a, var)) + ret['pydocsign'], ret['pydocsignout'] = getpydocsign(a, var) + if hasnote(var): + ret['note'] = var['note'] + var['note'] = ['See elsewhere.'] + return ret + + +def cb_routsign2map(rout, um): + """ + name,begintitle,endtitle,argname + ctype,rctype,maxnofargs,nofoptargs,returncptr + """ + ret = {'name': 'cb_%s_in_%s' % (rout['name'], um), + 'returncptr': ''} + if isintent_callback(rout): + if '_' in rout['name']: + F_FUNC = 'F_FUNC_US' + else: + F_FUNC = 'F_FUNC' + ret['callbackname'] = '%s(%s,%s)' \ + % (F_FUNC, + rout['name'].lower(), + rout['name'].upper(), + ) + ret['static'] = 'extern' + else: + ret['callbackname'] = ret['name'] + ret['static'] = 'static' + ret['argname'] = rout['name'] + ret['begintitle'] = gentitle(ret['name']) + ret['endtitle'] = gentitle('end of %s' % ret['name']) + ret['ctype'] = getctype(rout) + ret['rctype'] = 'void' + if ret['ctype'] == 'string': + ret['rctype'] = 'void' + else: + ret['rctype'] = ret['ctype'] + if ret['rctype'] != 'void': + if iscomplexfunction(rout): + ret['returncptr'] = """ +#ifdef F2PY_CB_RETURNCOMPLEX +return_value= +#endif +""" + else: + ret['returncptr'] = 'return_value=' + if ret['ctype'] in cformat_map: + ret['showvalueformat'] = '%s' % (cformat_map[ret['ctype']]) + if isstringfunction(rout): + ret['strlength'] = getstrlength(rout) + if isfunction(rout): + if 'result' in rout: + a = rout['result'] + else: + a = rout['name'] + if hasnote(rout['vars'][a]): + ret['note'] = rout['vars'][a]['note'] + rout['vars'][a]['note'] = ['See elsewhere.'] + ret['rname'] = a + ret['pydocsign'], ret['pydocsignout'] = getpydocsign(a, rout) + if iscomplexfunction(rout): + ret['rctype'] = """ +#ifdef F2PY_CB_RETURNCOMPLEX +#ctype# +#else +void +#endif +""" + else: + if hasnote(rout): + ret['note'] = rout['note'] + rout['note'] = ['See elsewhere.'] + nofargs = 0 + nofoptargs = 0 + if 'args' in rout and 'vars' in rout: + for a in rout['args']: + var = rout['vars'][a] + if l_or(isintent_in, isintent_inout)(var): + nofargs = nofargs + 1 + if isoptional(var): + nofoptargs = nofoptargs + 1 + ret['maxnofargs'] = repr(nofargs) + ret['nofoptargs'] = repr(nofoptargs) + if hasnote(rout) and isfunction(rout) and 'result' in rout: + ret['routnote'] = rout['note'] + rout['note'] = ['See elsewhere.'] + return ret + + +def common_sign2map(a, var): # obsolute + ret = {'varname': a, 'ctype': getctype(var)} + if isstringarray(var): + ret['ctype'] = 'char' + if ret['ctype'] in c2capi_map: + ret['atype'] = c2capi_map[ret['ctype']] + if ret['ctype'] in cformat_map: + ret['showvalueformat'] = '%s' % (cformat_map[ret['ctype']]) + if isarray(var): + ret = dictappend(ret, getarrdims(a, var)) + elif isstring(var): + ret['size'] = getstrlength(var) + ret['rank'] = '1' + ret['pydocsign'], ret['pydocsignout'] = getpydocsign(a, var) + if hasnote(var): + ret['note'] = var['note'] + var['note'] = ['See elsewhere.'] + # for strings this returns 0-rank but actually is 1-rank + ret['arrdocstr'] = getarrdocsign(a, var) + return ret diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/cb_rules.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/cb_rules.py new file mode 100644 index 0000000000000000000000000000000000000000..183d7c2f920b703a482afd5ecc846afbd327ba0c --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/cb_rules.py @@ -0,0 +1,578 @@ +#!/usr/bin/env python +""" + +Build call-back mechanism for f2py2e. + +Copyright 2000 Pearu Peterson all rights reserved, +Pearu Peterson +Permission to use, modify, and distribute this software is given under the +terms of the NumPy License. + +NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. +$Date: 2005/07/20 11:27:58 $ +Pearu Peterson + +""" +from __future__ import division, absolute_import, print_function + +from . import __version__ +from .auxfuncs import ( + applyrules, debugcapi, dictappend, errmess, getargs, hasnote, isarray, + iscomplex, iscomplexarray, iscomplexfunction, isfunction, isintent_c, + isintent_hide, isintent_in, isintent_inout, isintent_nothide, + isintent_out, isoptional, isrequired, isscalar, isstring, + isstringfunction, issubroutine, l_and, l_not, l_or, outmess, replace, + stripcomma, throw_error +) +from . import cfuncs + +f2py_version = __version__.version + + +################## Rules for callback function ############## + +cb_routine_rules = { + 'cbtypedefs': 'typedef #rctype#(*#name#_typedef)(#optargs_td##args_td##strarglens_td##noargs#);', + 'body': """ +#begintitle# +PyObject *#name#_capi = NULL;/*was Py_None*/ +PyTupleObject *#name#_args_capi = NULL; +int #name#_nofargs = 0; +jmp_buf #name#_jmpbuf; +/*typedef #rctype#(*#name#_typedef)(#optargs_td##args_td##strarglens_td##noargs#);*/ +#static# #rctype# #callbackname# (#optargs##args##strarglens##noargs#) { +\tPyTupleObject *capi_arglist = #name#_args_capi; +\tPyObject *capi_return = NULL; +\tPyObject *capi_tmp = NULL; +\tPyObject *capi_arglist_list = NULL; +\tint capi_j,capi_i = 0; +\tint capi_longjmp_ok = 1; +#decl# +#ifdef F2PY_REPORT_ATEXIT +f2py_cb_start_clock(); +#endif +\tCFUNCSMESS(\"cb:Call-back function #name# (maxnofargs=#maxnofargs#(-#nofoptargs#))\\n\"); +\tCFUNCSMESSPY(\"cb:#name#_capi=\",#name#_capi); +\tif (#name#_capi==NULL) { +\t\tcapi_longjmp_ok = 0; +\t\t#name#_capi = PyObject_GetAttrString(#modulename#_module,\"#argname#\"); +\t} +\tif (#name#_capi==NULL) { +\t\tPyErr_SetString(#modulename#_error,\"cb: Callback #argname# not defined (as an argument or module #modulename# attribute).\\n\"); +\t\tgoto capi_fail; +\t} +\tif (F2PyCapsule_Check(#name#_capi)) { +\t#name#_typedef #name#_cptr; +\t#name#_cptr = F2PyCapsule_AsVoidPtr(#name#_capi); +\t#returncptr#(*#name#_cptr)(#optargs_nm##args_nm##strarglens_nm#); +\t#return# +\t} +\tif (capi_arglist==NULL) { +\t\tcapi_longjmp_ok = 0; +\t\tcapi_tmp = PyObject_GetAttrString(#modulename#_module,\"#argname#_extra_args\"); +\t\tif (capi_tmp) { +\t\t\tcapi_arglist = (PyTupleObject *)PySequence_Tuple(capi_tmp); +\t\t\tif (capi_arglist==NULL) { +\t\t\t\tPyErr_SetString(#modulename#_error,\"Failed to convert #modulename#.#argname#_extra_args to tuple.\\n\"); +\t\t\t\tgoto capi_fail; +\t\t\t} +\t\t} else { +\t\t\tPyErr_Clear(); +\t\t\tcapi_arglist = (PyTupleObject *)Py_BuildValue(\"()\"); +\t\t} +\t} +\tif (capi_arglist == NULL) { +\t\tPyErr_SetString(#modulename#_error,\"Callback #argname# argument list is not set.\\n\"); +\t\tgoto capi_fail; +\t} +#setdims# +#ifdef PYPY_VERSION +#define CAPI_ARGLIST_SETITEM(idx, value) PyList_SetItem((PyObject *)capi_arglist_list, idx, value) +\tcapi_arglist_list = PySequence_List(capi_arglist); +\tif (capi_arglist_list == NULL) goto capi_fail; +#else +#define CAPI_ARGLIST_SETITEM(idx, value) PyTuple_SetItem((PyObject *)capi_arglist, idx, value) +#endif +#pyobjfrom# +#undef CAPI_ARGLIST_SETITEM +#ifdef PYPY_VERSION +\tCFUNCSMESSPY(\"cb:capi_arglist=\",capi_arglist_list); +#else +\tCFUNCSMESSPY(\"cb:capi_arglist=\",capi_arglist); +#endif +\tCFUNCSMESS(\"cb:Call-back calling Python function #argname#.\\n\"); +#ifdef F2PY_REPORT_ATEXIT +f2py_cb_start_call_clock(); +#endif +#ifdef PYPY_VERSION +\tcapi_return = PyObject_CallObject(#name#_capi,(PyObject *)capi_arglist_list); +\tPy_DECREF(capi_arglist_list); +\tcapi_arglist_list = NULL; +#else +\tcapi_return = PyObject_CallObject(#name#_capi,(PyObject *)capi_arglist); +#endif +#ifdef F2PY_REPORT_ATEXIT +f2py_cb_stop_call_clock(); +#endif +\tCFUNCSMESSPY(\"cb:capi_return=\",capi_return); +\tif (capi_return == NULL) { +\t\tfprintf(stderr,\"capi_return is NULL\\n\"); +\t\tgoto capi_fail; +\t} +\tif (capi_return == Py_None) { +\t\tPy_DECREF(capi_return); +\t\tcapi_return = Py_BuildValue(\"()\"); +\t} +\telse if (!PyTuple_Check(capi_return)) { +\t\tcapi_return = Py_BuildValue(\"(N)\",capi_return); +\t} +\tcapi_j = PyTuple_Size(capi_return); +\tcapi_i = 0; +#frompyobj# +\tCFUNCSMESS(\"cb:#name#:successful\\n\"); +\tPy_DECREF(capi_return); +#ifdef F2PY_REPORT_ATEXIT +f2py_cb_stop_clock(); +#endif +\tgoto capi_return_pt; +capi_fail: +\tfprintf(stderr,\"Call-back #name# failed.\\n\"); +\tPy_XDECREF(capi_return); +\tPy_XDECREF(capi_arglist_list); +\tif (capi_longjmp_ok) +\t\tlongjmp(#name#_jmpbuf,-1); +capi_return_pt: +\t; +#return# +} +#endtitle# +""", + 'need': ['setjmp.h', 'CFUNCSMESS'], + 'maxnofargs': '#maxnofargs#', + 'nofoptargs': '#nofoptargs#', + 'docstr': """\ +\tdef #argname#(#docsignature#): return #docreturn#\\n\\ +#docstrsigns#""", + 'latexdocstr': """ +{{}\\verb@def #argname#(#latexdocsignature#): return #docreturn#@{}} +#routnote# + +#latexdocstrsigns#""", + 'docstrshort': 'def #argname#(#docsignature#): return #docreturn#' +} +cb_rout_rules = [ + { # Init + 'separatorsfor': {'decl': '\n', + 'args': ',', 'optargs': '', 'pyobjfrom': '\n', 'freemem': '\n', + 'args_td': ',', 'optargs_td': '', + 'args_nm': ',', 'optargs_nm': '', + 'frompyobj': '\n', 'setdims': '\n', + 'docstrsigns': '\\n"\n"', + 'latexdocstrsigns': '\n', + 'latexdocstrreq': '\n', 'latexdocstropt': '\n', + 'latexdocstrout': '\n', 'latexdocstrcbs': '\n', + }, + 'decl': '/*decl*/', 'pyobjfrom': '/*pyobjfrom*/', 'frompyobj': '/*frompyobj*/', + 'args': [], 'optargs': '', 'return': '', 'strarglens': '', 'freemem': '/*freemem*/', + 'args_td': [], 'optargs_td': '', 'strarglens_td': '', + 'args_nm': [], 'optargs_nm': '', 'strarglens_nm': '', + 'noargs': '', + 'setdims': '/*setdims*/', + 'docstrsigns': '', 'latexdocstrsigns': '', + 'docstrreq': '\tRequired arguments:', + 'docstropt': '\tOptional arguments:', + 'docstrout': '\tReturn objects:', + 'docstrcbs': '\tCall-back functions:', + 'docreturn': '', 'docsign': '', 'docsignopt': '', + 'latexdocstrreq': '\\noindent Required arguments:', + 'latexdocstropt': '\\noindent Optional arguments:', + 'latexdocstrout': '\\noindent Return objects:', + 'latexdocstrcbs': '\\noindent Call-back functions:', + 'routnote': {hasnote: '--- #note#', l_not(hasnote): ''}, + }, { # Function + 'decl': '\t#ctype# return_value;', + 'frompyobj': [{debugcapi: '\tCFUNCSMESS("cb:Getting return_value->");'}, + '\tif (capi_j>capi_i)\n\t\tGETSCALARFROMPYTUPLE(capi_return,capi_i++,&return_value,#ctype#,"#ctype#_from_pyobj failed in converting return_value of call-back function #name# to C #ctype#\\n");', + {debugcapi: + '\tfprintf(stderr,"#showvalueformat#.\\n",return_value);'} + ], + 'need': ['#ctype#_from_pyobj', {debugcapi: 'CFUNCSMESS'}, 'GETSCALARFROMPYTUPLE'], + 'return': '\treturn return_value;', + '_check': l_and(isfunction, l_not(isstringfunction), l_not(iscomplexfunction)) + }, + { # String function + 'pyobjfrom': {debugcapi: '\tfprintf(stderr,"debug-capi:cb:#name#:%d:\\n",return_value_len);'}, + 'args': '#ctype# return_value,int return_value_len', + 'args_nm': 'return_value,&return_value_len', + 'args_td': '#ctype# ,int', + 'frompyobj': [{debugcapi: '\tCFUNCSMESS("cb:Getting return_value->\\"");'}, + """\tif (capi_j>capi_i) +\t\tGETSTRFROMPYTUPLE(capi_return,capi_i++,return_value,return_value_len);""", + {debugcapi: + '\tfprintf(stderr,"#showvalueformat#\\".\\n",return_value);'} + ], + 'need': ['#ctype#_from_pyobj', {debugcapi: 'CFUNCSMESS'}, + 'string.h', 'GETSTRFROMPYTUPLE'], + 'return': 'return;', + '_check': isstringfunction + }, + { # Complex function + 'optargs': """ +#ifndef F2PY_CB_RETURNCOMPLEX +#ctype# *return_value +#endif +""", + 'optargs_nm': """ +#ifndef F2PY_CB_RETURNCOMPLEX +return_value +#endif +""", + 'optargs_td': """ +#ifndef F2PY_CB_RETURNCOMPLEX +#ctype# * +#endif +""", + 'decl': """ +#ifdef F2PY_CB_RETURNCOMPLEX +\t#ctype# return_value; +#endif +""", + 'frompyobj': [{debugcapi: '\tCFUNCSMESS("cb:Getting return_value->");'}, + """\ +\tif (capi_j>capi_i) +#ifdef F2PY_CB_RETURNCOMPLEX +\t\tGETSCALARFROMPYTUPLE(capi_return,capi_i++,&return_value,#ctype#,\"#ctype#_from_pyobj failed in converting return_value of call-back function #name# to C #ctype#\\n\"); +#else +\t\tGETSCALARFROMPYTUPLE(capi_return,capi_i++,return_value,#ctype#,\"#ctype#_from_pyobj failed in converting return_value of call-back function #name# to C #ctype#\\n\"); +#endif +""", + {debugcapi: """ +#ifdef F2PY_CB_RETURNCOMPLEX +\tfprintf(stderr,\"#showvalueformat#.\\n\",(return_value).r,(return_value).i); +#else +\tfprintf(stderr,\"#showvalueformat#.\\n\",(*return_value).r,(*return_value).i); +#endif + +"""} + ], + 'return': """ +#ifdef F2PY_CB_RETURNCOMPLEX +\treturn return_value; +#else +\treturn; +#endif +""", + 'need': ['#ctype#_from_pyobj', {debugcapi: 'CFUNCSMESS'}, + 'string.h', 'GETSCALARFROMPYTUPLE', '#ctype#'], + '_check': iscomplexfunction + }, + {'docstrout': '\t\t#pydocsignout#', + 'latexdocstrout': ['\\item[]{{}\\verb@#pydocsignout#@{}}', + {hasnote: '--- #note#'}], + 'docreturn': '#rname#,', + '_check': isfunction}, + {'_check': issubroutine, 'return': 'return;'} +] + +cb_arg_rules = [ + { # Doc + 'docstropt': {l_and(isoptional, isintent_nothide): '\t\t#pydocsign#'}, + 'docstrreq': {l_and(isrequired, isintent_nothide): '\t\t#pydocsign#'}, + 'docstrout': {isintent_out: '\t\t#pydocsignout#'}, + 'latexdocstropt': {l_and(isoptional, isintent_nothide): ['\\item[]{{}\\verb@#pydocsign#@{}}', + {hasnote: '--- #note#'}]}, + 'latexdocstrreq': {l_and(isrequired, isintent_nothide): ['\\item[]{{}\\verb@#pydocsign#@{}}', + {hasnote: '--- #note#'}]}, + 'latexdocstrout': {isintent_out: ['\\item[]{{}\\verb@#pydocsignout#@{}}', + {l_and(hasnote, isintent_hide): '--- #note#', + l_and(hasnote, isintent_nothide): '--- See above.'}]}, + 'docsign': {l_and(isrequired, isintent_nothide): '#varname#,'}, + 'docsignopt': {l_and(isoptional, isintent_nothide): '#varname#,'}, + 'depend': '' + }, + { + 'args': { + l_and(isscalar, isintent_c): '#ctype# #varname_i#', + l_and(isscalar, l_not(isintent_c)): '#ctype# *#varname_i#_cb_capi', + isarray: '#ctype# *#varname_i#', + isstring: '#ctype# #varname_i#' + }, + 'args_nm': { + l_and(isscalar, isintent_c): '#varname_i#', + l_and(isscalar, l_not(isintent_c)): '#varname_i#_cb_capi', + isarray: '#varname_i#', + isstring: '#varname_i#' + }, + 'args_td': { + l_and(isscalar, isintent_c): '#ctype#', + l_and(isscalar, l_not(isintent_c)): '#ctype# *', + isarray: '#ctype# *', + isstring: '#ctype#' + }, + # untested with multiple args + 'strarglens': {isstring: ',int #varname_i#_cb_len'}, + 'strarglens_td': {isstring: ',int'}, # untested with multiple args + # untested with multiple args + 'strarglens_nm': {isstring: ',#varname_i#_cb_len'}, + }, + { # Scalars + 'decl': {l_not(isintent_c): '\t#ctype# #varname_i#=(*#varname_i#_cb_capi);'}, + 'error': {l_and(isintent_c, isintent_out, + throw_error('intent(c,out) is forbidden for callback scalar arguments')): + ''}, + 'frompyobj': [{debugcapi: '\tCFUNCSMESS("cb:Getting #varname#->");'}, + {isintent_out: + '\tif (capi_j>capi_i)\n\t\tGETSCALARFROMPYTUPLE(capi_return,capi_i++,#varname_i#_cb_capi,#ctype#,"#ctype#_from_pyobj failed in converting argument #varname# of call-back function #name# to C #ctype#\\n");'}, + {l_and(debugcapi, l_and(l_not(iscomplex), isintent_c)): + '\tfprintf(stderr,"#showvalueformat#.\\n",#varname_i#);'}, + {l_and(debugcapi, l_and(l_not(iscomplex), l_not( isintent_c))): + '\tfprintf(stderr,"#showvalueformat#.\\n",*#varname_i#_cb_capi);'}, + {l_and(debugcapi, l_and(iscomplex, isintent_c)): + '\tfprintf(stderr,"#showvalueformat#.\\n",(#varname_i#).r,(#varname_i#).i);'}, + {l_and(debugcapi, l_and(iscomplex, l_not( isintent_c))): + '\tfprintf(stderr,"#showvalueformat#.\\n",(*#varname_i#_cb_capi).r,(*#varname_i#_cb_capi).i);'}, + ], + 'need': [{isintent_out: ['#ctype#_from_pyobj', 'GETSCALARFROMPYTUPLE']}, + {debugcapi: 'CFUNCSMESS'}], + '_check': isscalar + }, { + 'pyobjfrom': [{isintent_in: """\ +\tif (#name#_nofargs>capi_i) +\t\tif (CAPI_ARGLIST_SETITEM(capi_i++,pyobj_from_#ctype#1(#varname_i#))) +\t\t\tgoto capi_fail;"""}, + {isintent_inout: """\ +\tif (#name#_nofargs>capi_i) +\t\tif (CAPI_ARGLIST_SETITEM(capi_i++,pyarr_from_p_#ctype#1(#varname_i#_cb_capi))) +\t\t\tgoto capi_fail;"""}], + 'need': [{isintent_in: 'pyobj_from_#ctype#1'}, + {isintent_inout: 'pyarr_from_p_#ctype#1'}, + {iscomplex: '#ctype#'}], + '_check': l_and(isscalar, isintent_nothide), + '_optional': '' + }, { # String + 'frompyobj': [{debugcapi: '\tCFUNCSMESS("cb:Getting #varname#->\\"");'}, + """\tif (capi_j>capi_i) +\t\tGETSTRFROMPYTUPLE(capi_return,capi_i++,#varname_i#,#varname_i#_cb_len);""", + {debugcapi: + '\tfprintf(stderr,"#showvalueformat#\\":%d:.\\n",#varname_i#,#varname_i#_cb_len);'}, + ], + 'need': ['#ctype#', 'GETSTRFROMPYTUPLE', + {debugcapi: 'CFUNCSMESS'}, 'string.h'], + '_check': l_and(isstring, isintent_out) + }, { + 'pyobjfrom': [{debugcapi: '\tfprintf(stderr,"debug-capi:cb:#varname#=\\"#showvalueformat#\\":%d:\\n",#varname_i#,#varname_i#_cb_len);'}, + {isintent_in: """\ +\tif (#name#_nofargs>capi_i) +\t\tif (CAPI_ARGLIST_SETITEM(capi_i++,pyobj_from_#ctype#1size(#varname_i#,#varname_i#_cb_len))) +\t\t\tgoto capi_fail;"""}, + {isintent_inout: """\ +\tif (#name#_nofargs>capi_i) { +\t\tint #varname_i#_cb_dims[] = {#varname_i#_cb_len}; +\t\tif (CAPI_ARGLIST_SETITEM(capi_i++,pyarr_from_p_#ctype#1(#varname_i#,#varname_i#_cb_dims))) +\t\t\tgoto capi_fail; +\t}"""}], + 'need': [{isintent_in: 'pyobj_from_#ctype#1size'}, + {isintent_inout: 'pyarr_from_p_#ctype#1'}], + '_check': l_and(isstring, isintent_nothide), + '_optional': '' + }, + # Array ... + { + 'decl': '\tnpy_intp #varname_i#_Dims[#rank#] = {#rank*[-1]#};', + 'setdims': '\t#cbsetdims#;', + '_check': isarray, + '_depend': '' + }, + { + 'pyobjfrom': [{debugcapi: '\tfprintf(stderr,"debug-capi:cb:#varname#\\n");'}, + {isintent_c: """\ +\tif (#name#_nofargs>capi_i) { +\t\tint itemsize_ = #atype# == NPY_STRING ? 1 : 0; +\t\t/*XXX: Hmm, what will destroy this array??? */ +\t\tPyArrayObject *tmp_arr = (PyArrayObject *)PyArray_New(&PyArray_Type,#rank#,#varname_i#_Dims,#atype#,NULL,(char*)#varname_i#,itemsize_,NPY_ARRAY_CARRAY,NULL); +""", + l_not(isintent_c): """\ +\tif (#name#_nofargs>capi_i) { +\t\tint itemsize_ = #atype# == NPY_STRING ? 1 : 0; +\t\t/*XXX: Hmm, what will destroy this array??? */ +\t\tPyArrayObject *tmp_arr = (PyArrayObject *)PyArray_New(&PyArray_Type,#rank#,#varname_i#_Dims,#atype#,NULL,(char*)#varname_i#,itemsize_,NPY_ARRAY_FARRAY,NULL); +""", + }, + """ +\t\tif (tmp_arr==NULL) +\t\t\tgoto capi_fail; +\t\tif (CAPI_ARGLIST_SETITEM(capi_i++,(PyObject *)tmp_arr)) +\t\t\tgoto capi_fail; +}"""], + '_check': l_and(isarray, isintent_nothide, l_or(isintent_in, isintent_inout)), + '_optional': '', + }, { + 'frompyobj': [{debugcapi: '\tCFUNCSMESS("cb:Getting #varname#->");'}, + """\tif (capi_j>capi_i) { +\t\tPyArrayObject *rv_cb_arr = NULL; +\t\tif ((capi_tmp = PyTuple_GetItem(capi_return,capi_i++))==NULL) goto capi_fail; +\t\trv_cb_arr = array_from_pyobj(#atype#,#varname_i#_Dims,#rank#,F2PY_INTENT_IN""", + {isintent_c: '|F2PY_INTENT_C'}, + """,capi_tmp); +\t\tif (rv_cb_arr == NULL) { +\t\t\tfprintf(stderr,\"rv_cb_arr is NULL\\n\"); +\t\t\tgoto capi_fail; +\t\t} +\t\tMEMCOPY(#varname_i#,PyArray_DATA(rv_cb_arr),PyArray_NBYTES(rv_cb_arr)); +\t\tif (capi_tmp != (PyObject *)rv_cb_arr) { +\t\t\tPy_DECREF(rv_cb_arr); +\t\t} +\t}""", + {debugcapi: '\tfprintf(stderr,"<-.\\n");'}, + ], + 'need': ['MEMCOPY', {iscomplexarray: '#ctype#'}], + '_check': l_and(isarray, isintent_out) + }, { + 'docreturn': '#varname#,', + '_check': isintent_out + } +] + +################## Build call-back module ############# +cb_map = {} + + +def buildcallbacks(m): + global cb_map + cb_map[m['name']] = [] + for bi in m['body']: + if bi['block'] == 'interface': + for b in bi['body']: + if b: + buildcallback(b, m['name']) + else: + errmess('warning: empty body for %s\n' % (m['name'])) + + +def buildcallback(rout, um): + global cb_map + from . import capi_maps + + outmess('\tConstructing call-back function "cb_%s_in_%s"\n' % + (rout['name'], um)) + args, depargs = getargs(rout) + capi_maps.depargs = depargs + var = rout['vars'] + vrd = capi_maps.cb_routsign2map(rout, um) + rd = dictappend({}, vrd) + cb_map[um].append([rout['name'], rd['name']]) + for r in cb_rout_rules: + if ('_check' in r and r['_check'](rout)) or ('_check' not in r): + ar = applyrules(r, vrd, rout) + rd = dictappend(rd, ar) + savevrd = {} + for i, a in enumerate(args): + vrd = capi_maps.cb_sign2map(a, var[a], index=i) + savevrd[a] = vrd + for r in cb_arg_rules: + if '_depend' in r: + continue + if '_optional' in r and isoptional(var[a]): + continue + if ('_check' in r and r['_check'](var[a])) or ('_check' not in r): + ar = applyrules(r, vrd, var[a]) + rd = dictappend(rd, ar) + if '_break' in r: + break + for a in args: + vrd = savevrd[a] + for r in cb_arg_rules: + if '_depend' in r: + continue + if ('_optional' not in r) or ('_optional' in r and isrequired(var[a])): + continue + if ('_check' in r and r['_check'](var[a])) or ('_check' not in r): + ar = applyrules(r, vrd, var[a]) + rd = dictappend(rd, ar) + if '_break' in r: + break + for a in depargs: + vrd = savevrd[a] + for r in cb_arg_rules: + if '_depend' not in r: + continue + if '_optional' in r: + continue + if ('_check' in r and r['_check'](var[a])) or ('_check' not in r): + ar = applyrules(r, vrd, var[a]) + rd = dictappend(rd, ar) + if '_break' in r: + break + if 'args' in rd and 'optargs' in rd: + if isinstance(rd['optargs'], list): + rd['optargs'] = rd['optargs'] + [""" +#ifndef F2PY_CB_RETURNCOMPLEX +, +#endif +"""] + rd['optargs_nm'] = rd['optargs_nm'] + [""" +#ifndef F2PY_CB_RETURNCOMPLEX +, +#endif +"""] + rd['optargs_td'] = rd['optargs_td'] + [""" +#ifndef F2PY_CB_RETURNCOMPLEX +, +#endif +"""] + if isinstance(rd['docreturn'], list): + rd['docreturn'] = stripcomma( + replace('#docreturn#', {'docreturn': rd['docreturn']})) + optargs = stripcomma(replace('#docsignopt#', + {'docsignopt': rd['docsignopt']} + )) + if optargs == '': + rd['docsignature'] = stripcomma( + replace('#docsign#', {'docsign': rd['docsign']})) + else: + rd['docsignature'] = replace('#docsign#[#docsignopt#]', + {'docsign': rd['docsign'], + 'docsignopt': optargs, + }) + rd['latexdocsignature'] = rd['docsignature'].replace('_', '\\_') + rd['latexdocsignature'] = rd['latexdocsignature'].replace(',', ', ') + rd['docstrsigns'] = [] + rd['latexdocstrsigns'] = [] + for k in ['docstrreq', 'docstropt', 'docstrout', 'docstrcbs']: + if k in rd and isinstance(rd[k], list): + rd['docstrsigns'] = rd['docstrsigns'] + rd[k] + k = 'latex' + k + if k in rd and isinstance(rd[k], list): + rd['latexdocstrsigns'] = rd['latexdocstrsigns'] + rd[k][0:1] +\ + ['\\begin{description}'] + rd[k][1:] +\ + ['\\end{description}'] + if 'args' not in rd: + rd['args'] = '' + rd['args_td'] = '' + rd['args_nm'] = '' + if not (rd.get('args') or rd.get('optargs') or rd.get('strarglens')): + rd['noargs'] = 'void' + + ar = applyrules(cb_routine_rules, rd) + cfuncs.callbacks[rd['name']] = ar['body'] + if isinstance(ar['need'], str): + ar['need'] = [ar['need']] + + if 'need' in rd: + for t in cfuncs.typedefs.keys(): + if t in rd['need']: + ar['need'].append(t) + + cfuncs.typedefs_generated[rd['name'] + '_typedef'] = ar['cbtypedefs'] + ar['need'].append(rd['name'] + '_typedef') + cfuncs.needs[rd['name']] = ar['need'] + + capi_maps.lcb2_map[rd['name']] = {'maxnofargs': ar['maxnofargs'], + 'nofoptargs': ar['nofoptargs'], + 'docstr': ar['docstr'], + 'latexdocstr': ar['latexdocstr'], + 'argname': rd['argname'] + } + outmess('\t %s\n' % (ar['docstrshort'])) + return +################## Build call-back function ############# diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/cfuncs.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/cfuncs.py new file mode 100644 index 0000000000000000000000000000000000000000..d59b6301c1649707fc9ef5b0b15b3cf3cd0032a5 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/cfuncs.py @@ -0,0 +1,1262 @@ +#!/usr/bin/env python +""" + +C declarations, CPP macros, and C functions for f2py2e. +Only required declarations/macros/functions will be used. + +Copyright 1999,2000 Pearu Peterson all rights reserved, +Pearu Peterson +Permission to use, modify, and distribute this software is given under the +terms of the NumPy License. + +NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. +$Date: 2005/05/06 11:42:34 $ +Pearu Peterson + +""" +from __future__ import division, absolute_import, print_function + +import sys +import copy + +from . import __version__ + +f2py_version = __version__.version +errmess = sys.stderr.write + +##################### Definitions ################## + +outneeds = {'includes0': [], 'includes': [], 'typedefs': [], 'typedefs_generated': [], + 'userincludes': [], + 'cppmacros': [], 'cfuncs': [], 'callbacks': [], 'f90modhooks': [], + 'commonhooks': []} +needs = {} +includes0 = {'includes0': '/*need_includes0*/'} +includes = {'includes': '/*need_includes*/'} +userincludes = {'userincludes': '/*need_userincludes*/'} +typedefs = {'typedefs': '/*need_typedefs*/'} +typedefs_generated = {'typedefs_generated': '/*need_typedefs_generated*/'} +cppmacros = {'cppmacros': '/*need_cppmacros*/'} +cfuncs = {'cfuncs': '/*need_cfuncs*/'} +callbacks = {'callbacks': '/*need_callbacks*/'} +f90modhooks = {'f90modhooks': '/*need_f90modhooks*/', + 'initf90modhooksstatic': '/*initf90modhooksstatic*/', + 'initf90modhooksdynamic': '/*initf90modhooksdynamic*/', + } +commonhooks = {'commonhooks': '/*need_commonhooks*/', + 'initcommonhooks': '/*need_initcommonhooks*/', + } + +############ Includes ################### + +includes0['math.h'] = '#include ' +includes0['string.h'] = '#include ' +includes0['setjmp.h'] = '#include ' + +includes['Python.h'] = '#include "Python.h"' +needs['arrayobject.h'] = ['Python.h'] +includes['arrayobject.h'] = '''#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API +#include "arrayobject.h"''' + +includes['arrayobject.h'] = '#include "fortranobject.h"' +includes['stdarg.h'] = '#include ' + +############# Type definitions ############### + +typedefs['unsigned_char'] = 'typedef unsigned char unsigned_char;' +typedefs['unsigned_short'] = 'typedef unsigned short unsigned_short;' +typedefs['unsigned_long'] = 'typedef unsigned long unsigned_long;' +typedefs['signed_char'] = 'typedef signed char signed_char;' +typedefs['long_long'] = """\ +#ifdef _WIN32 +typedef __int64 long_long; +#else +typedef long long long_long; +typedef unsigned long long unsigned_long_long; +#endif +""" +typedefs['unsigned_long_long'] = """\ +#ifdef _WIN32 +typedef __uint64 long_long; +#else +typedef unsigned long long unsigned_long_long; +#endif +""" +typedefs['long_double'] = """\ +#ifndef _LONG_DOUBLE +typedef long double long_double; +#endif +""" +typedefs[ + 'complex_long_double'] = 'typedef struct {long double r,i;} complex_long_double;' +typedefs['complex_float'] = 'typedef struct {float r,i;} complex_float;' +typedefs['complex_double'] = 'typedef struct {double r,i;} complex_double;' +typedefs['string'] = """typedef char * string;""" + + +############### CPP macros #################### +cppmacros['CFUNCSMESS'] = """\ +#ifdef DEBUGCFUNCS +#define CFUNCSMESS(mess) fprintf(stderr,\"debug-capi:\"mess); +#define CFUNCSMESSPY(mess,obj) CFUNCSMESS(mess) \\ + PyObject_Print((PyObject *)obj,stderr,Py_PRINT_RAW);\\ + fprintf(stderr,\"\\n\"); +#else +#define CFUNCSMESS(mess) +#define CFUNCSMESSPY(mess,obj) +#endif +""" +cppmacros['F_FUNC'] = """\ +#if defined(PREPEND_FORTRAN) +#if defined(NO_APPEND_FORTRAN) +#if defined(UPPERCASE_FORTRAN) +#define F_FUNC(f,F) _##F +#else +#define F_FUNC(f,F) _##f +#endif +#else +#if defined(UPPERCASE_FORTRAN) +#define F_FUNC(f,F) _##F##_ +#else +#define F_FUNC(f,F) _##f##_ +#endif +#endif +#else +#if defined(NO_APPEND_FORTRAN) +#if defined(UPPERCASE_FORTRAN) +#define F_FUNC(f,F) F +#else +#define F_FUNC(f,F) f +#endif +#else +#if defined(UPPERCASE_FORTRAN) +#define F_FUNC(f,F) F##_ +#else +#define F_FUNC(f,F) f##_ +#endif +#endif +#endif +#if defined(UNDERSCORE_G77) +#define F_FUNC_US(f,F) F_FUNC(f##_,F##_) +#else +#define F_FUNC_US(f,F) F_FUNC(f,F) +#endif +""" +cppmacros['F_WRAPPEDFUNC'] = """\ +#if defined(PREPEND_FORTRAN) +#if defined(NO_APPEND_FORTRAN) +#if defined(UPPERCASE_FORTRAN) +#define F_WRAPPEDFUNC(f,F) _F2PYWRAP##F +#else +#define F_WRAPPEDFUNC(f,F) _f2pywrap##f +#endif +#else +#if defined(UPPERCASE_FORTRAN) +#define F_WRAPPEDFUNC(f,F) _F2PYWRAP##F##_ +#else +#define F_WRAPPEDFUNC(f,F) _f2pywrap##f##_ +#endif +#endif +#else +#if defined(NO_APPEND_FORTRAN) +#if defined(UPPERCASE_FORTRAN) +#define F_WRAPPEDFUNC(f,F) F2PYWRAP##F +#else +#define F_WRAPPEDFUNC(f,F) f2pywrap##f +#endif +#else +#if defined(UPPERCASE_FORTRAN) +#define F_WRAPPEDFUNC(f,F) F2PYWRAP##F##_ +#else +#define F_WRAPPEDFUNC(f,F) f2pywrap##f##_ +#endif +#endif +#endif +#if defined(UNDERSCORE_G77) +#define F_WRAPPEDFUNC_US(f,F) F_WRAPPEDFUNC(f##_,F##_) +#else +#define F_WRAPPEDFUNC_US(f,F) F_WRAPPEDFUNC(f,F) +#endif +""" +cppmacros['F_MODFUNC'] = """\ +#if defined(F90MOD2CCONV1) /*E.g. Compaq Fortran */ +#if defined(NO_APPEND_FORTRAN) +#define F_MODFUNCNAME(m,f) $ ## m ## $ ## f +#else +#define F_MODFUNCNAME(m,f) $ ## m ## $ ## f ## _ +#endif +#endif + +#if defined(F90MOD2CCONV2) /*E.g. IBM XL Fortran, not tested though */ +#if defined(NO_APPEND_FORTRAN) +#define F_MODFUNCNAME(m,f) __ ## m ## _MOD_ ## f +#else +#define F_MODFUNCNAME(m,f) __ ## m ## _MOD_ ## f ## _ +#endif +#endif + +#if defined(F90MOD2CCONV3) /*E.g. MIPSPro Compilers */ +#if defined(NO_APPEND_FORTRAN) +#define F_MODFUNCNAME(m,f) f ## .in. ## m +#else +#define F_MODFUNCNAME(m,f) f ## .in. ## m ## _ +#endif +#endif +/* +#if defined(UPPERCASE_FORTRAN) +#define F_MODFUNC(m,M,f,F) F_MODFUNCNAME(M,F) +#else +#define F_MODFUNC(m,M,f,F) F_MODFUNCNAME(m,f) +#endif +*/ + +#define F_MODFUNC(m,f) (*(f2pymodstruct##m##.##f)) +""" +cppmacros['SWAPUNSAFE'] = """\ +#define SWAP(a,b) (size_t)(a) = ((size_t)(a) ^ (size_t)(b));\\ + (size_t)(b) = ((size_t)(a) ^ (size_t)(b));\\ + (size_t)(a) = ((size_t)(a) ^ (size_t)(b)) +""" +cppmacros['SWAP'] = """\ +#define SWAP(a,b,t) {\\ + t *c;\\ + c = a;\\ + a = b;\\ + b = c;} +""" +# cppmacros['ISCONTIGUOUS']='#define ISCONTIGUOUS(m) (PyArray_FLAGS(m) & +# NPY_ARRAY_C_CONTIGUOUS)' +cppmacros['PRINTPYOBJERR'] = """\ +#define PRINTPYOBJERR(obj)\\ + fprintf(stderr,\"#modulename#.error is related to \");\\ + PyObject_Print((PyObject *)obj,stderr,Py_PRINT_RAW);\\ + fprintf(stderr,\"\\n\"); +""" +cppmacros['MINMAX'] = """\ +#ifndef max +#define max(a,b) ((a > b) ? (a) : (b)) +#endif +#ifndef min +#define min(a,b) ((a < b) ? (a) : (b)) +#endif +#ifndef MAX +#define MAX(a,b) ((a > b) ? (a) : (b)) +#endif +#ifndef MIN +#define MIN(a,b) ((a < b) ? (a) : (b)) +#endif +""" +needs['len..'] = ['f2py_size'] +cppmacros['len..'] = """\ +#define rank(var) var ## _Rank +#define shape(var,dim) var ## _Dims[dim] +#define old_rank(var) (PyArray_NDIM((PyArrayObject *)(capi_ ## var ## _tmp))) +#define old_shape(var,dim) PyArray_DIM(((PyArrayObject *)(capi_ ## var ## _tmp)),dim) +#define fshape(var,dim) shape(var,rank(var)-dim-1) +#define len(var) shape(var,0) +#define flen(var) fshape(var,0) +#define old_size(var) PyArray_SIZE((PyArrayObject *)(capi_ ## var ## _tmp)) +/* #define index(i) capi_i ## i */ +#define slen(var) capi_ ## var ## _len +#define size(var, ...) f2py_size((PyArrayObject *)(capi_ ## var ## _tmp), ## __VA_ARGS__, -1) +""" +needs['f2py_size'] = ['stdarg.h'] +cfuncs['f2py_size'] = """\ +static int f2py_size(PyArrayObject* var, ...) +{ + npy_int sz = 0; + npy_int dim; + npy_int rank; + va_list argp; + va_start(argp, var); + dim = va_arg(argp, npy_int); + if (dim==-1) + { + sz = PyArray_SIZE(var); + } + else + { + rank = PyArray_NDIM(var); + if (dim>=1 && dim<=rank) + sz = PyArray_DIM(var, dim-1); + else + fprintf(stderr, \"f2py_size: 2nd argument value=%d fails to satisfy 1<=value<=%d. Result will be 0.\\n\", dim, rank); + } + va_end(argp); + return sz; +} +""" + +cppmacros[ + 'pyobj_from_char1'] = '#define pyobj_from_char1(v) (PyInt_FromLong(v))' +cppmacros[ + 'pyobj_from_short1'] = '#define pyobj_from_short1(v) (PyInt_FromLong(v))' +needs['pyobj_from_int1'] = ['signed_char'] +cppmacros['pyobj_from_int1'] = '#define pyobj_from_int1(v) (PyInt_FromLong(v))' +cppmacros[ + 'pyobj_from_long1'] = '#define pyobj_from_long1(v) (PyLong_FromLong(v))' +needs['pyobj_from_long_long1'] = ['long_long'] +cppmacros['pyobj_from_long_long1'] = """\ +#ifdef HAVE_LONG_LONG +#define pyobj_from_long_long1(v) (PyLong_FromLongLong(v)) +#else +#warning HAVE_LONG_LONG is not available. Redefining pyobj_from_long_long. +#define pyobj_from_long_long1(v) (PyLong_FromLong(v)) +#endif +""" +needs['pyobj_from_long_double1'] = ['long_double'] +cppmacros[ + 'pyobj_from_long_double1'] = '#define pyobj_from_long_double1(v) (PyFloat_FromDouble(v))' +cppmacros[ + 'pyobj_from_double1'] = '#define pyobj_from_double1(v) (PyFloat_FromDouble(v))' +cppmacros[ + 'pyobj_from_float1'] = '#define pyobj_from_float1(v) (PyFloat_FromDouble(v))' +needs['pyobj_from_complex_long_double1'] = ['complex_long_double'] +cppmacros[ + 'pyobj_from_complex_long_double1'] = '#define pyobj_from_complex_long_double1(v) (PyComplex_FromDoubles(v.r,v.i))' +needs['pyobj_from_complex_double1'] = ['complex_double'] +cppmacros[ + 'pyobj_from_complex_double1'] = '#define pyobj_from_complex_double1(v) (PyComplex_FromDoubles(v.r,v.i))' +needs['pyobj_from_complex_float1'] = ['complex_float'] +cppmacros[ + 'pyobj_from_complex_float1'] = '#define pyobj_from_complex_float1(v) (PyComplex_FromDoubles(v.r,v.i))' +needs['pyobj_from_string1'] = ['string'] +cppmacros[ + 'pyobj_from_string1'] = '#define pyobj_from_string1(v) (PyString_FromString((char *)v))' +needs['pyobj_from_string1size'] = ['string'] +cppmacros[ + 'pyobj_from_string1size'] = '#define pyobj_from_string1size(v,len) (PyUString_FromStringAndSize((char *)v, len))' +needs['TRYPYARRAYTEMPLATE'] = ['PRINTPYOBJERR'] +cppmacros['TRYPYARRAYTEMPLATE'] = """\ +/* New SciPy */ +#define TRYPYARRAYTEMPLATECHAR case NPY_STRING: *(char *)(PyArray_DATA(arr))=*v; break; +#define TRYPYARRAYTEMPLATELONG case NPY_LONG: *(long *)(PyArray_DATA(arr))=*v; break; +#define TRYPYARRAYTEMPLATEOBJECT case NPY_OBJECT: PyArray_SETITEM(arr,PyArray_DATA(arr),pyobj_from_ ## ctype ## 1(*v)); break; + +#define TRYPYARRAYTEMPLATE(ctype,typecode) \\ + PyArrayObject *arr = NULL;\\ + if (!obj) return -2;\\ + if (!PyArray_Check(obj)) return -1;\\ + if (!(arr=(PyArrayObject *)obj)) {fprintf(stderr,\"TRYPYARRAYTEMPLATE:\");PRINTPYOBJERR(obj);return 0;}\\ + if (PyArray_DESCR(arr)->type==typecode) {*(ctype *)(PyArray_DATA(arr))=*v; return 1;}\\ + switch (PyArray_TYPE(arr)) {\\ + case NPY_DOUBLE: *(double *)(PyArray_DATA(arr))=*v; break;\\ + case NPY_INT: *(int *)(PyArray_DATA(arr))=*v; break;\\ + case NPY_LONG: *(long *)(PyArray_DATA(arr))=*v; break;\\ + case NPY_FLOAT: *(float *)(PyArray_DATA(arr))=*v; break;\\ + case NPY_CDOUBLE: *(double *)(PyArray_DATA(arr))=*v; break;\\ + case NPY_CFLOAT: *(float *)(PyArray_DATA(arr))=*v; break;\\ + case NPY_BOOL: *(npy_bool *)(PyArray_DATA(arr))=(*v!=0); break;\\ + case NPY_UBYTE: *(unsigned char *)(PyArray_DATA(arr))=*v; break;\\ + case NPY_BYTE: *(signed char *)(PyArray_DATA(arr))=*v; break;\\ + case NPY_SHORT: *(short *)(PyArray_DATA(arr))=*v; break;\\ + case NPY_USHORT: *(npy_ushort *)(PyArray_DATA(arr))=*v; break;\\ + case NPY_UINT: *(npy_uint *)(PyArray_DATA(arr))=*v; break;\\ + case NPY_ULONG: *(npy_ulong *)(PyArray_DATA(arr))=*v; break;\\ + case NPY_LONGLONG: *(npy_longlong *)(PyArray_DATA(arr))=*v; break;\\ + case NPY_ULONGLONG: *(npy_ulonglong *)(PyArray_DATA(arr))=*v; break;\\ + case NPY_LONGDOUBLE: *(npy_longdouble *)(PyArray_DATA(arr))=*v; break;\\ + case NPY_CLONGDOUBLE: *(npy_longdouble *)(PyArray_DATA(arr))=*v; break;\\ + case NPY_OBJECT: PyArray_SETITEM(arr, PyArray_DATA(arr), pyobj_from_ ## ctype ## 1(*v)); break;\\ + default: return -2;\\ + };\\ + return 1 +""" + +needs['TRYCOMPLEXPYARRAYTEMPLATE'] = ['PRINTPYOBJERR'] +cppmacros['TRYCOMPLEXPYARRAYTEMPLATE'] = """\ +#define TRYCOMPLEXPYARRAYTEMPLATEOBJECT case NPY_OBJECT: PyArray_SETITEM(arr, PyArray_DATA(arr), pyobj_from_complex_ ## ctype ## 1((*v))); break; +#define TRYCOMPLEXPYARRAYTEMPLATE(ctype,typecode)\\ + PyArrayObject *arr = NULL;\\ + if (!obj) return -2;\\ + if (!PyArray_Check(obj)) return -1;\\ + if (!(arr=(PyArrayObject *)obj)) {fprintf(stderr,\"TRYCOMPLEXPYARRAYTEMPLATE:\");PRINTPYOBJERR(obj);return 0;}\\ + if (PyArray_DESCR(arr)->type==typecode) {\\ + *(ctype *)(PyArray_DATA(arr))=(*v).r;\\ + *(ctype *)(PyArray_DATA(arr)+sizeof(ctype))=(*v).i;\\ + return 1;\\ + }\\ + switch (PyArray_TYPE(arr)) {\\ + case NPY_CDOUBLE: *(double *)(PyArray_DATA(arr))=(*v).r;*(double *)(PyArray_DATA(arr)+sizeof(double))=(*v).i;break;\\ + case NPY_CFLOAT: *(float *)(PyArray_DATA(arr))=(*v).r;*(float *)(PyArray_DATA(arr)+sizeof(float))=(*v).i;break;\\ + case NPY_DOUBLE: *(double *)(PyArray_DATA(arr))=(*v).r; break;\\ + case NPY_LONG: *(long *)(PyArray_DATA(arr))=(*v).r; break;\\ + case NPY_FLOAT: *(float *)(PyArray_DATA(arr))=(*v).r; break;\\ + case NPY_INT: *(int *)(PyArray_DATA(arr))=(*v).r; break;\\ + case NPY_SHORT: *(short *)(PyArray_DATA(arr))=(*v).r; break;\\ + case NPY_UBYTE: *(unsigned char *)(PyArray_DATA(arr))=(*v).r; break;\\ + case NPY_BYTE: *(signed char *)(PyArray_DATA(arr))=(*v).r; break;\\ + case NPY_BOOL: *(npy_bool *)(PyArray_DATA(arr))=((*v).r!=0 && (*v).i!=0); break;\\ + case NPY_USHORT: *(npy_ushort *)(PyArray_DATA(arr))=(*v).r; break;\\ + case NPY_UINT: *(npy_uint *)(PyArray_DATA(arr))=(*v).r; break;\\ + case NPY_ULONG: *(npy_ulong *)(PyArray_DATA(arr))=(*v).r; break;\\ + case NPY_LONGLONG: *(npy_longlong *)(PyArray_DATA(arr))=(*v).r; break;\\ + case NPY_ULONGLONG: *(npy_ulonglong *)(PyArray_DATA(arr))=(*v).r; break;\\ + case NPY_LONGDOUBLE: *(npy_longdouble *)(PyArray_DATA(arr))=(*v).r; break;\\ + case NPY_CLONGDOUBLE: *(npy_longdouble *)(PyArray_DATA(arr))=(*v).r;*(npy_longdouble *)(PyArray_DATA(arr)+sizeof(npy_longdouble))=(*v).i;break;\\ + case NPY_OBJECT: PyArray_SETITEM(arr, PyArray_DATA(arr), pyobj_from_complex_ ## ctype ## 1((*v))); break;\\ + default: return -2;\\ + };\\ + return -1; +""" +# cppmacros['NUMFROMARROBJ']="""\ +# define NUMFROMARROBJ(typenum,ctype) \\ +# if (PyArray_Check(obj)) arr = (PyArrayObject *)obj;\\ +# else arr = (PyArrayObject *)PyArray_ContiguousFromObject(obj,typenum,0,0);\\ +# if (arr) {\\ +# if (PyArray_TYPE(arr)==NPY_OBJECT) {\\ +# if (!ctype ## _from_pyobj(v,(PyArray_DESCR(arr)->getitem)(PyArray_DATA(arr)),\"\"))\\ +# goto capi_fail;\\ +# } else {\\ +# (PyArray_DESCR(arr)->cast[typenum])(PyArray_DATA(arr),1,(char*)v,1,1);\\ +# }\\ +# if ((PyObject *)arr != obj) { Py_DECREF(arr); }\\ +# return 1;\\ +# } +# """ +# XXX: Note that CNUMFROMARROBJ is identical with NUMFROMARROBJ +# cppmacros['CNUMFROMARROBJ']="""\ +# define CNUMFROMARROBJ(typenum,ctype) \\ +# if (PyArray_Check(obj)) arr = (PyArrayObject *)obj;\\ +# else arr = (PyArrayObject *)PyArray_ContiguousFromObject(obj,typenum,0,0);\\ +# if (arr) {\\ +# if (PyArray_TYPE(arr)==NPY_OBJECT) {\\ +# if (!ctype ## _from_pyobj(v,(PyArray_DESCR(arr)->getitem)(PyArray_DATA(arr)),\"\"))\\ +# goto capi_fail;\\ +# } else {\\ +# (PyArray_DESCR(arr)->cast[typenum])((void *)(PyArray_DATA(arr)),1,(void *)(v),1,1);\\ +# }\\ +# if ((PyObject *)arr != obj) { Py_DECREF(arr); }\\ +# return 1;\\ +# } +# """ + + +needs['GETSTRFROMPYTUPLE'] = ['STRINGCOPYN', 'PRINTPYOBJERR'] +cppmacros['GETSTRFROMPYTUPLE'] = """\ +#define GETSTRFROMPYTUPLE(tuple,index,str,len) {\\ + PyObject *rv_cb_str = PyTuple_GetItem((tuple),(index));\\ + if (rv_cb_str == NULL)\\ + goto capi_fail;\\ + if (PyString_Check(rv_cb_str)) {\\ + str[len-1]='\\0';\\ + STRINGCOPYN((str),PyString_AS_STRING((PyStringObject*)rv_cb_str),(len));\\ + } else {\\ + PRINTPYOBJERR(rv_cb_str);\\ + PyErr_SetString(#modulename#_error,\"string object expected\");\\ + goto capi_fail;\\ + }\\ + } +""" +cppmacros['GETSCALARFROMPYTUPLE'] = """\ +#define GETSCALARFROMPYTUPLE(tuple,index,var,ctype,mess) {\\ + if ((capi_tmp = PyTuple_GetItem((tuple),(index)))==NULL) goto capi_fail;\\ + if (!(ctype ## _from_pyobj((var),capi_tmp,mess)))\\ + goto capi_fail;\\ + } +""" + +cppmacros['FAILNULL'] = """\\ +#define FAILNULL(p) do { \\ + if ((p) == NULL) { \\ + PyErr_SetString(PyExc_MemoryError, "NULL pointer found"); \\ + goto capi_fail; \\ + } \\ +} while (0) +""" +needs['MEMCOPY'] = ['string.h', 'FAILNULL'] +cppmacros['MEMCOPY'] = """\ +#define MEMCOPY(to,from,n)\\ + do { FAILNULL(to); FAILNULL(from); (void)memcpy(to,from,n); } while (0) +""" +cppmacros['STRINGMALLOC'] = """\ +#define STRINGMALLOC(str,len)\\ + if ((str = (string)malloc(sizeof(char)*(len+1))) == NULL) {\\ + PyErr_SetString(PyExc_MemoryError, \"out of memory\");\\ + goto capi_fail;\\ + } else {\\ + (str)[len] = '\\0';\\ + } +""" +cppmacros['STRINGFREE'] = """\ +#define STRINGFREE(str) do {if (!(str == NULL)) free(str);} while (0) +""" +needs['STRINGCOPYN'] = ['string.h', 'FAILNULL'] +cppmacros['STRINGCOPYN'] = """\ +#define STRINGCOPYN(to,from,buf_size) \\ + do { \\ + int _m = (buf_size); \\ + char *_to = (to); \\ + char *_from = (from); \\ + FAILNULL(_to); FAILNULL(_from); \\ + (void)strncpy(_to, _from, sizeof(char)*_m); \\ + _to[_m-1] = '\\0'; \\ + /* Padding with spaces instead of nulls */ \\ + for (_m -= 2; _m >= 0 && _to[_m] == '\\0'; _m--) { \\ + _to[_m] = ' '; \\ + } \\ + } while (0) +""" +needs['STRINGCOPY'] = ['string.h', 'FAILNULL'] +cppmacros['STRINGCOPY'] = """\ +#define STRINGCOPY(to,from)\\ + do { FAILNULL(to); FAILNULL(from); (void)strcpy(to,from); } while (0) +""" +cppmacros['CHECKGENERIC'] = """\ +#define CHECKGENERIC(check,tcheck,name) \\ + if (!(check)) {\\ + PyErr_SetString(#modulename#_error,\"(\"tcheck\") failed for \"name);\\ + /*goto capi_fail;*/\\ + } else """ +cppmacros['CHECKARRAY'] = """\ +#define CHECKARRAY(check,tcheck,name) \\ + if (!(check)) {\\ + PyErr_SetString(#modulename#_error,\"(\"tcheck\") failed for \"name);\\ + /*goto capi_fail;*/\\ + } else """ +cppmacros['CHECKSTRING'] = """\ +#define CHECKSTRING(check,tcheck,name,show,var)\\ + if (!(check)) {\\ + char errstring[256];\\ + sprintf(errstring, \"%s: \"show, \"(\"tcheck\") failed for \"name, slen(var), var);\\ + PyErr_SetString(#modulename#_error, errstring);\\ + /*goto capi_fail;*/\\ + } else """ +cppmacros['CHECKSCALAR'] = """\ +#define CHECKSCALAR(check,tcheck,name,show,var)\\ + if (!(check)) {\\ + char errstring[256];\\ + sprintf(errstring, \"%s: \"show, \"(\"tcheck\") failed for \"name, var);\\ + PyErr_SetString(#modulename#_error,errstring);\\ + /*goto capi_fail;*/\\ + } else """ +# cppmacros['CHECKDIMS']="""\ +# define CHECKDIMS(dims,rank) \\ +# for (int i=0;i<(rank);i++)\\ +# if (dims[i]<0) {\\ +# fprintf(stderr,\"Unspecified array argument requires a complete dimension specification.\\n\");\\ +# goto capi_fail;\\ +# } +# """ +cppmacros[ + 'ARRSIZE'] = '#define ARRSIZE(dims,rank) (_PyArray_multiply_list(dims,rank))' +cppmacros['OLDPYNUM'] = """\ +#ifdef OLDPYNUM +#error You need to install Numeric Python version 13 or higher. Get it from http:/sourceforge.net/project/?group_id=1369 +#endif +""" +################# C functions ############### + +cfuncs['calcarrindex'] = """\ +static int calcarrindex(int *i,PyArrayObject *arr) { + int k,ii = i[0]; + for (k=1; k < PyArray_NDIM(arr); k++) + ii += (ii*(PyArray_DIM(arr,k) - 1)+i[k]); /* assuming contiguous arr */ + return ii; +}""" +cfuncs['calcarrindextr'] = """\ +static int calcarrindextr(int *i,PyArrayObject *arr) { + int k,ii = i[PyArray_NDIM(arr)-1]; + for (k=1; k < PyArray_NDIM(arr); k++) + ii += (ii*(PyArray_DIM(arr,PyArray_NDIM(arr)-k-1) - 1)+i[PyArray_NDIM(arr)-k-1]); /* assuming contiguous arr */ + return ii; +}""" +cfuncs['forcomb'] = """\ +static struct { int nd;npy_intp *d;int *i,*i_tr,tr; } forcombcache; +static int initforcomb(npy_intp *dims,int nd,int tr) { + int k; + if (dims==NULL) return 0; + if (nd<0) return 0; + forcombcache.nd = nd; + forcombcache.d = dims; + forcombcache.tr = tr; + if ((forcombcache.i = (int *)malloc(sizeof(int)*nd))==NULL) return 0; + if ((forcombcache.i_tr = (int *)malloc(sizeof(int)*nd))==NULL) return 0; + for (k=1;k= 0x03000000 + else if (PyUnicode_Check(obj)) { + tmp = PyUnicode_AsASCIIString(obj); + } + else { + PyObject *tmp2; + tmp2 = PyObject_Str(obj); + if (tmp2) { + tmp = PyUnicode_AsASCIIString(tmp2); + Py_DECREF(tmp2); + } + else { + tmp = NULL; + } + } +#else + else { + tmp = PyObject_Str(obj); + } +#endif + if (tmp == NULL) goto capi_fail; + if (*len == -1) + *len = PyString_GET_SIZE(tmp); + STRINGMALLOC(*str,*len); + STRINGCOPYN(*str,PyString_AS_STRING(tmp),*len+1); + Py_DECREF(tmp); + return 1; +capi_fail: + Py_XDECREF(tmp); + { + PyObject* err = PyErr_Occurred(); + if (err==NULL) err = #modulename#_error; + PyErr_SetString(err,errmess); + } + return 0; +} +""" +needs['char_from_pyobj'] = ['int_from_pyobj'] +cfuncs['char_from_pyobj'] = """\ +static int char_from_pyobj(char* v,PyObject *obj,const char *errmess) { + int i=0; + if (int_from_pyobj(&i,obj,errmess)) { + *v = (char)i; + return 1; + } + return 0; +} +""" +needs['signed_char_from_pyobj'] = ['int_from_pyobj', 'signed_char'] +cfuncs['signed_char_from_pyobj'] = """\ +static int signed_char_from_pyobj(signed_char* v,PyObject *obj,const char *errmess) { + int i=0; + if (int_from_pyobj(&i,obj,errmess)) { + *v = (signed_char)i; + return 1; + } + return 0; +} +""" +needs['short_from_pyobj'] = ['int_from_pyobj'] +cfuncs['short_from_pyobj'] = """\ +static int short_from_pyobj(short* v,PyObject *obj,const char *errmess) { + int i=0; + if (int_from_pyobj(&i,obj,errmess)) { + *v = (short)i; + return 1; + } + return 0; +} +""" +cfuncs['int_from_pyobj'] = """\ +static int int_from_pyobj(int* v,PyObject *obj,const char *errmess) { + PyObject* tmp = NULL; + if (PyInt_Check(obj)) { + *v = (int)PyInt_AS_LONG(obj); + return 1; + } + tmp = PyNumber_Int(obj); + if (tmp) { + *v = PyInt_AS_LONG(tmp); + Py_DECREF(tmp); + return 1; + } + if (PyComplex_Check(obj)) + tmp = PyObject_GetAttrString(obj,\"real\"); + else if (PyString_Check(obj) || PyUnicode_Check(obj)) + /*pass*/; + else if (PySequence_Check(obj)) + tmp = PySequence_GetItem(obj,0); + if (tmp) { + PyErr_Clear(); + if (int_from_pyobj(v,tmp,errmess)) {Py_DECREF(tmp); return 1;} + Py_DECREF(tmp); + } + { + PyObject* err = PyErr_Occurred(); + if (err==NULL) err = #modulename#_error; + PyErr_SetString(err,errmess); + } + return 0; +} +""" +cfuncs['long_from_pyobj'] = """\ +static int long_from_pyobj(long* v,PyObject *obj,const char *errmess) { + PyObject* tmp = NULL; + if (PyInt_Check(obj)) { + *v = PyInt_AS_LONG(obj); + return 1; + } + tmp = PyNumber_Int(obj); + if (tmp) { + *v = PyInt_AS_LONG(tmp); + Py_DECREF(tmp); + return 1; + } + if (PyComplex_Check(obj)) + tmp = PyObject_GetAttrString(obj,\"real\"); + else if (PyString_Check(obj) || PyUnicode_Check(obj)) + /*pass*/; + else if (PySequence_Check(obj)) + tmp = PySequence_GetItem(obj,0); + if (tmp) { + PyErr_Clear(); + if (long_from_pyobj(v,tmp,errmess)) {Py_DECREF(tmp); return 1;} + Py_DECREF(tmp); + } + { + PyObject* err = PyErr_Occurred(); + if (err==NULL) err = #modulename#_error; + PyErr_SetString(err,errmess); + } + return 0; +} +""" +needs['long_long_from_pyobj'] = ['long_long'] +cfuncs['long_long_from_pyobj'] = """\ +static int long_long_from_pyobj(long_long* v,PyObject *obj,const char *errmess) { + PyObject* tmp = NULL; + if (PyLong_Check(obj)) { + *v = PyLong_AsLongLong(obj); + return (!PyErr_Occurred()); + } + if (PyInt_Check(obj)) { + *v = (long_long)PyInt_AS_LONG(obj); + return 1; + } + tmp = PyNumber_Long(obj); + if (tmp) { + *v = PyLong_AsLongLong(tmp); + Py_DECREF(tmp); + return (!PyErr_Occurred()); + } + if (PyComplex_Check(obj)) + tmp = PyObject_GetAttrString(obj,\"real\"); + else if (PyString_Check(obj) || PyUnicode_Check(obj)) + /*pass*/; + else if (PySequence_Check(obj)) + tmp = PySequence_GetItem(obj,0); + if (tmp) { + PyErr_Clear(); + if (long_long_from_pyobj(v,tmp,errmess)) {Py_DECREF(tmp); return 1;} + Py_DECREF(tmp); + } + { + PyObject* err = PyErr_Occurred(); + if (err==NULL) err = #modulename#_error; + PyErr_SetString(err,errmess); + } + return 0; +} +""" +needs['long_double_from_pyobj'] = ['double_from_pyobj', 'long_double'] +cfuncs['long_double_from_pyobj'] = """\ +static int long_double_from_pyobj(long_double* v,PyObject *obj,const char *errmess) { + double d=0; + if (PyArray_CheckScalar(obj)){ + if PyArray_IsScalar(obj, LongDouble) { + PyArray_ScalarAsCtype(obj, v); + return 1; + } + else if (PyArray_Check(obj) && PyArray_TYPE(obj)==NPY_LONGDOUBLE) { + (*v) = *((npy_longdouble *)PyArray_DATA(obj)); + return 1; + } + } + if (double_from_pyobj(&d,obj,errmess)) { + *v = (long_double)d; + return 1; + } + return 0; +} +""" +cfuncs['double_from_pyobj'] = """\ +static int double_from_pyobj(double* v,PyObject *obj,const char *errmess) { + PyObject* tmp = NULL; + if (PyFloat_Check(obj)) { +#ifdef __sgi + *v = PyFloat_AsDouble(obj); +#else + *v = PyFloat_AS_DOUBLE(obj); +#endif + return 1; + } + tmp = PyNumber_Float(obj); + if (tmp) { +#ifdef __sgi + *v = PyFloat_AsDouble(tmp); +#else + *v = PyFloat_AS_DOUBLE(tmp); +#endif + Py_DECREF(tmp); + return 1; + } + if (PyComplex_Check(obj)) + tmp = PyObject_GetAttrString(obj,\"real\"); + else if (PyString_Check(obj) || PyUnicode_Check(obj)) + /*pass*/; + else if (PySequence_Check(obj)) + tmp = PySequence_GetItem(obj,0); + if (tmp) { + PyErr_Clear(); + if (double_from_pyobj(v,tmp,errmess)) {Py_DECREF(tmp); return 1;} + Py_DECREF(tmp); + } + { + PyObject* err = PyErr_Occurred(); + if (err==NULL) err = #modulename#_error; + PyErr_SetString(err,errmess); + } + return 0; +} +""" +needs['float_from_pyobj'] = ['double_from_pyobj'] +cfuncs['float_from_pyobj'] = """\ +static int float_from_pyobj(float* v,PyObject *obj,const char *errmess) { + double d=0.0; + if (double_from_pyobj(&d,obj,errmess)) { + *v = (float)d; + return 1; + } + return 0; +} +""" +needs['complex_long_double_from_pyobj'] = ['complex_long_double', 'long_double', + 'complex_double_from_pyobj'] +cfuncs['complex_long_double_from_pyobj'] = """\ +static int complex_long_double_from_pyobj(complex_long_double* v,PyObject *obj,const char *errmess) { + complex_double cd={0.0,0.0}; + if (PyArray_CheckScalar(obj)){ + if PyArray_IsScalar(obj, CLongDouble) { + PyArray_ScalarAsCtype(obj, v); + return 1; + } + else if (PyArray_Check(obj) && PyArray_TYPE(obj)==NPY_CLONGDOUBLE) { + (*v).r = ((npy_clongdouble *)PyArray_DATA(obj))->real; + (*v).i = ((npy_clongdouble *)PyArray_DATA(obj))->imag; + return 1; + } + } + if (complex_double_from_pyobj(&cd,obj,errmess)) { + (*v).r = (long_double)cd.r; + (*v).i = (long_double)cd.i; + return 1; + } + return 0; +} +""" +needs['complex_double_from_pyobj'] = ['complex_double'] +cfuncs['complex_double_from_pyobj'] = """\ +static int complex_double_from_pyobj(complex_double* v,PyObject *obj,const char *errmess) { + Py_complex c; + if (PyComplex_Check(obj)) { + c=PyComplex_AsCComplex(obj); + (*v).r=c.real, (*v).i=c.imag; + return 1; + } + if (PyArray_IsScalar(obj, ComplexFloating)) { + if (PyArray_IsScalar(obj, CFloat)) { + npy_cfloat new; + PyArray_ScalarAsCtype(obj, &new); + (*v).r = (double)new.real; + (*v).i = (double)new.imag; + } + else if (PyArray_IsScalar(obj, CLongDouble)) { + npy_clongdouble new; + PyArray_ScalarAsCtype(obj, &new); + (*v).r = (double)new.real; + (*v).i = (double)new.imag; + } + else { /* if (PyArray_IsScalar(obj, CDouble)) */ + PyArray_ScalarAsCtype(obj, v); + } + return 1; + } + if (PyArray_CheckScalar(obj)) { /* 0-dim array or still array scalar */ + PyObject *arr; + if (PyArray_Check(obj)) { + arr = PyArray_Cast((PyArrayObject *)obj, NPY_CDOUBLE); + } + else { + arr = PyArray_FromScalar(obj, PyArray_DescrFromType(NPY_CDOUBLE)); + } + if (arr==NULL) return 0; + (*v).r = ((npy_cdouble *)PyArray_DATA(arr))->real; + (*v).i = ((npy_cdouble *)PyArray_DATA(arr))->imag; + return 1; + } + /* Python does not provide PyNumber_Complex function :-( */ + (*v).i=0.0; + if (PyFloat_Check(obj)) { +#ifdef __sgi + (*v).r = PyFloat_AsDouble(obj); +#else + (*v).r = PyFloat_AS_DOUBLE(obj); +#endif + return 1; + } + if (PyInt_Check(obj)) { + (*v).r = (double)PyInt_AS_LONG(obj); + return 1; + } + if (PyLong_Check(obj)) { + (*v).r = PyLong_AsDouble(obj); + return (!PyErr_Occurred()); + } + if (PySequence_Check(obj) && !(PyString_Check(obj) || PyUnicode_Check(obj))) { + PyObject *tmp = PySequence_GetItem(obj,0); + if (tmp) { + if (complex_double_from_pyobj(v,tmp,errmess)) { + Py_DECREF(tmp); + return 1; + } + Py_DECREF(tmp); + } + } + { + PyObject* err = PyErr_Occurred(); + if (err==NULL) + err = PyExc_TypeError; + PyErr_SetString(err,errmess); + } + return 0; +} +""" +needs['complex_float_from_pyobj'] = [ + 'complex_float', 'complex_double_from_pyobj'] +cfuncs['complex_float_from_pyobj'] = """\ +static int complex_float_from_pyobj(complex_float* v,PyObject *obj,const char *errmess) { + complex_double cd={0.0,0.0}; + if (complex_double_from_pyobj(&cd,obj,errmess)) { + (*v).r = (float)cd.r; + (*v).i = (float)cd.i; + return 1; + } + return 0; +} +""" +needs['try_pyarr_from_char'] = ['pyobj_from_char1', 'TRYPYARRAYTEMPLATE'] +cfuncs[ + 'try_pyarr_from_char'] = 'static int try_pyarr_from_char(PyObject* obj,char* v) {\n TRYPYARRAYTEMPLATE(char,\'c\');\n}\n' +needs['try_pyarr_from_signed_char'] = ['TRYPYARRAYTEMPLATE', 'unsigned_char'] +cfuncs[ + 'try_pyarr_from_unsigned_char'] = 'static int try_pyarr_from_unsigned_char(PyObject* obj,unsigned_char* v) {\n TRYPYARRAYTEMPLATE(unsigned_char,\'b\');\n}\n' +needs['try_pyarr_from_signed_char'] = ['TRYPYARRAYTEMPLATE', 'signed_char'] +cfuncs[ + 'try_pyarr_from_signed_char'] = 'static int try_pyarr_from_signed_char(PyObject* obj,signed_char* v) {\n TRYPYARRAYTEMPLATE(signed_char,\'1\');\n}\n' +needs['try_pyarr_from_short'] = ['pyobj_from_short1', 'TRYPYARRAYTEMPLATE'] +cfuncs[ + 'try_pyarr_from_short'] = 'static int try_pyarr_from_short(PyObject* obj,short* v) {\n TRYPYARRAYTEMPLATE(short,\'s\');\n}\n' +needs['try_pyarr_from_int'] = ['pyobj_from_int1', 'TRYPYARRAYTEMPLATE'] +cfuncs[ + 'try_pyarr_from_int'] = 'static int try_pyarr_from_int(PyObject* obj,int* v) {\n TRYPYARRAYTEMPLATE(int,\'i\');\n}\n' +needs['try_pyarr_from_long'] = ['pyobj_from_long1', 'TRYPYARRAYTEMPLATE'] +cfuncs[ + 'try_pyarr_from_long'] = 'static int try_pyarr_from_long(PyObject* obj,long* v) {\n TRYPYARRAYTEMPLATE(long,\'l\');\n}\n' +needs['try_pyarr_from_long_long'] = [ + 'pyobj_from_long_long1', 'TRYPYARRAYTEMPLATE', 'long_long'] +cfuncs[ + 'try_pyarr_from_long_long'] = 'static int try_pyarr_from_long_long(PyObject* obj,long_long* v) {\n TRYPYARRAYTEMPLATE(long_long,\'L\');\n}\n' +needs['try_pyarr_from_float'] = ['pyobj_from_float1', 'TRYPYARRAYTEMPLATE'] +cfuncs[ + 'try_pyarr_from_float'] = 'static int try_pyarr_from_float(PyObject* obj,float* v) {\n TRYPYARRAYTEMPLATE(float,\'f\');\n}\n' +needs['try_pyarr_from_double'] = ['pyobj_from_double1', 'TRYPYARRAYTEMPLATE'] +cfuncs[ + 'try_pyarr_from_double'] = 'static int try_pyarr_from_double(PyObject* obj,double* v) {\n TRYPYARRAYTEMPLATE(double,\'d\');\n}\n' +needs['try_pyarr_from_complex_float'] = [ + 'pyobj_from_complex_float1', 'TRYCOMPLEXPYARRAYTEMPLATE', 'complex_float'] +cfuncs[ + 'try_pyarr_from_complex_float'] = 'static int try_pyarr_from_complex_float(PyObject* obj,complex_float* v) {\n TRYCOMPLEXPYARRAYTEMPLATE(float,\'F\');\n}\n' +needs['try_pyarr_from_complex_double'] = [ + 'pyobj_from_complex_double1', 'TRYCOMPLEXPYARRAYTEMPLATE', 'complex_double'] +cfuncs[ + 'try_pyarr_from_complex_double'] = 'static int try_pyarr_from_complex_double(PyObject* obj,complex_double* v) {\n TRYCOMPLEXPYARRAYTEMPLATE(double,\'D\');\n}\n' + +needs['create_cb_arglist'] = ['CFUNCSMESS', 'PRINTPYOBJERR', 'MINMAX'] +cfuncs['create_cb_arglist'] = """\ +static int create_cb_arglist(PyObject* fun,PyTupleObject* xa,const int maxnofargs,const int nofoptargs,int *nofargs,PyTupleObject **args,const char *errmess) { + PyObject *tmp = NULL; + PyObject *tmp_fun = NULL; + int tot,opt,ext,siz,i,di=0; + CFUNCSMESS(\"create_cb_arglist\\n\"); + tot=opt=ext=siz=0; + /* Get the total number of arguments */ + if (PyFunction_Check(fun)) + tmp_fun = fun; + else { + di = 1; + if (PyObject_HasAttrString(fun,\"im_func\")) { + tmp_fun = PyObject_GetAttrString(fun,\"im_func\"); + } + else if (PyObject_HasAttrString(fun,\"__call__\")) { + tmp = PyObject_GetAttrString(fun,\"__call__\"); + if (PyObject_HasAttrString(tmp,\"im_func\")) + tmp_fun = PyObject_GetAttrString(tmp,\"im_func\"); + else { + tmp_fun = fun; /* built-in function */ + tot = maxnofargs; + if (xa != NULL) + tot += PyTuple_Size((PyObject *)xa); + } + Py_XDECREF(tmp); + } + else if (PyFortran_Check(fun) || PyFortran_Check1(fun)) { + tot = maxnofargs; + if (xa != NULL) + tot += PyTuple_Size((PyObject *)xa); + tmp_fun = fun; + } + else if (F2PyCapsule_Check(fun)) { + tot = maxnofargs; + if (xa != NULL) + ext = PyTuple_Size((PyObject *)xa); + if(ext>0) { + fprintf(stderr,\"extra arguments tuple cannot be used with CObject call-back\\n\"); + goto capi_fail; + } + tmp_fun = fun; + } + } +if (tmp_fun==NULL) { +fprintf(stderr,\"Call-back argument must be function|instance|instance.__call__|f2py-function but got %s.\\n\",(fun==NULL?\"NULL\":Py_TYPE(fun)->tp_name)); +goto capi_fail; +} +#if PY_VERSION_HEX >= 0x03000000 + if (PyObject_HasAttrString(tmp_fun,\"__code__\")) { + if (PyObject_HasAttrString(tmp = PyObject_GetAttrString(tmp_fun,\"__code__\"),\"co_argcount\")) +#else + if (PyObject_HasAttrString(tmp_fun,\"func_code\")) { + if (PyObject_HasAttrString(tmp = PyObject_GetAttrString(tmp_fun,\"func_code\"),\"co_argcount\")) +#endif + tot = PyInt_AsLong(PyObject_GetAttrString(tmp,\"co_argcount\")) - di; + Py_XDECREF(tmp); + } + /* Get the number of optional arguments */ +#if PY_VERSION_HEX >= 0x03000000 + if (PyObject_HasAttrString(tmp_fun,\"__defaults__\")) { + if (PyTuple_Check(tmp = PyObject_GetAttrString(tmp_fun,\"__defaults__\"))) +#else + if (PyObject_HasAttrString(tmp_fun,\"func_defaults\")) { + if (PyTuple_Check(tmp = PyObject_GetAttrString(tmp_fun,\"func_defaults\"))) +#endif + opt = PyTuple_Size(tmp); + Py_XDECREF(tmp); + } + /* Get the number of extra arguments */ + if (xa != NULL) + ext = PyTuple_Size((PyObject *)xa); + /* Calculate the size of call-backs argument list */ + siz = MIN(maxnofargs+ext,tot); + *nofargs = MAX(0,siz-ext); +#ifdef DEBUGCFUNCS + fprintf(stderr,\"debug-capi:create_cb_arglist:maxnofargs(-nofoptargs),tot,opt,ext,siz,nofargs=%d(-%d),%d,%d,%d,%d,%d\\n\",maxnofargs,nofoptargs,tot,opt,ext,siz,*nofargs); +#endif + if (siz 0: + if outneeds[n][0] not in needs: + out.append(outneeds[n][0]) + del outneeds[n][0] + else: + flag = 0 + for k in outneeds[n][1:]: + if k in needs[outneeds[n][0]]: + flag = 1 + break + if flag: + outneeds[n] = outneeds[n][1:] + [outneeds[n][0]] + else: + out.append(outneeds[n][0]) + del outneeds[n][0] + if saveout and (0 not in map(lambda x, y: x == y, saveout, outneeds[n])) \ + and outneeds[n] != []: + print(n, saveout) + errmess( + 'get_needs: no progress in sorting needs, probably circular dependence, skipping.\n') + out = out + saveout + break + saveout = copy.copy(outneeds[n]) + if out == []: + out = [n] + res[n] = out + return res diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/common_rules.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/common_rules.py new file mode 100644 index 0000000000000000000000000000000000000000..62c1ba207d2991cad303fa5a426983331363db32 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/common_rules.py @@ -0,0 +1,148 @@ +#!/usr/bin/env python +""" + +Build common block mechanism for f2py2e. + +Copyright 2000 Pearu Peterson all rights reserved, +Pearu Peterson +Permission to use, modify, and distribute this software is given under the +terms of the NumPy License + +NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. +$Date: 2005/05/06 10:57:33 $ +Pearu Peterson + +""" +from __future__ import division, absolute_import, print_function + +__version__ = "$Revision: 1.19 $"[10:-1] + +from . import __version__ +f2py_version = __version__.version + +from .auxfuncs import ( + hasbody, hascommon, hasnote, isintent_hide, outmess +) +from . import capi_maps +from . import func2subr +from .crackfortran import rmbadname + + +def findcommonblocks(block, top=1): + ret = [] + if hascommon(block): + for key, value in block['common'].items(): + vars_ = {v: block['vars'][v] for v in value} + ret.append((key, value, vars_)) + elif hasbody(block): + for b in block['body']: + ret = ret + findcommonblocks(b, 0) + if top: + tret = [] + names = [] + for t in ret: + if t[0] not in names: + names.append(t[0]) + tret.append(t) + return tret + return ret + + +def buildhooks(m): + ret = {'commonhooks': [], 'initcommonhooks': [], + 'docs': ['"COMMON blocks:\\n"']} + fwrap = [''] + + def fadd(line, s=fwrap): + s[0] = '%s\n %s' % (s[0], line) + chooks = [''] + + def cadd(line, s=chooks): + s[0] = '%s\n%s' % (s[0], line) + ihooks = [''] + + def iadd(line, s=ihooks): + s[0] = '%s\n%s' % (s[0], line) + doc = [''] + + def dadd(line, s=doc): + s[0] = '%s\n%s' % (s[0], line) + for (name, vnames, vars) in findcommonblocks(m): + lower_name = name.lower() + hnames, inames = [], [] + for n in vnames: + if isintent_hide(vars[n]): + hnames.append(n) + else: + inames.append(n) + if hnames: + outmess('\t\tConstructing COMMON block support for "%s"...\n\t\t %s\n\t\t Hidden: %s\n' % ( + name, ','.join(inames), ','.join(hnames))) + else: + outmess('\t\tConstructing COMMON block support for "%s"...\n\t\t %s\n' % ( + name, ','.join(inames))) + fadd('subroutine f2pyinit%s(setupfunc)' % name) + fadd('external setupfunc') + for n in vnames: + fadd(func2subr.var2fixfortran(vars, n)) + if name == '_BLNK_': + fadd('common %s' % (','.join(vnames))) + else: + fadd('common /%s/ %s' % (name, ','.join(vnames))) + fadd('call setupfunc(%s)' % (','.join(inames))) + fadd('end\n') + cadd('static FortranDataDef f2py_%s_def[] = {' % (name)) + idims = [] + for n in inames: + ct = capi_maps.getctype(vars[n]) + at = capi_maps.c2capi_map[ct] + dm = capi_maps.getarrdims(n, vars[n]) + if dm['dims']: + idims.append('(%s)' % (dm['dims'])) + else: + idims.append('') + dms = dm['dims'].strip() + if not dms: + dms = '-1' + cadd('\t{\"%s\",%s,{{%s}},%s},' % (n, dm['rank'], dms, at)) + cadd('\t{NULL}\n};') + inames1 = rmbadname(inames) + inames1_tps = ','.join(['char *' + s for s in inames1]) + cadd('static void f2py_setup_%s(%s) {' % (name, inames1_tps)) + cadd('\tint i_f2py=0;') + for n in inames1: + cadd('\tf2py_%s_def[i_f2py++].data = %s;' % (name, n)) + cadd('}') + if '_' in lower_name: + F_FUNC = 'F_FUNC_US' + else: + F_FUNC = 'F_FUNC' + cadd('extern void %s(f2pyinit%s,F2PYINIT%s)(void(*)(%s));' + % (F_FUNC, lower_name, name.upper(), + ','.join(['char*'] * len(inames1)))) + cadd('static void f2py_init_%s(void) {' % name) + cadd('\t%s(f2pyinit%s,F2PYINIT%s)(f2py_setup_%s);' + % (F_FUNC, lower_name, name.upper(), name)) + cadd('}\n') + iadd('\tF2PyDict_SetItemString(d, \"%s\", PyFortranObject_New(f2py_%s_def,f2py_init_%s));' % ( + name, name, name)) + tname = name.replace('_', '\\_') + dadd('\\subsection{Common block \\texttt{%s}}\n' % (tname)) + dadd('\\begin{description}') + for n in inames: + dadd('\\item[]{{}\\verb@%s@{}}' % + (capi_maps.getarrdocsign(n, vars[n]))) + if hasnote(vars[n]): + note = vars[n]['note'] + if isinstance(note, list): + note = '\n'.join(note) + dadd('--- %s' % (note)) + dadd('\\end{description}') + ret['docs'].append( + '"\t/%s/ %s\\n"' % (name, ','.join(map(lambda v, d: v + d, inames, idims)))) + ret['commonhooks'] = chooks + ret['initcommonhooks'] = ihooks + ret['latexdoc'] = doc[0] + if len(ret['docs']) <= 1: + ret['docs'] = '' + return ret, fwrap[0] diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/crackfortran.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/crackfortran.py new file mode 100644 index 0000000000000000000000000000000000000000..2aaf5d7c6c12e962c7e89e99692724f4d4bba178 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/crackfortran.py @@ -0,0 +1,3345 @@ +#!/usr/bin/env python +""" +crackfortran --- read fortran (77,90) code and extract declaration information. + +Copyright 1999-2004 Pearu Peterson all rights reserved, +Pearu Peterson +Permission to use, modify, and distribute this software is given under the +terms of the NumPy License. + +NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. +$Date: 2005/09/27 07:13:49 $ +Pearu Peterson + + +Usage of crackfortran: +====================== +Command line keys: -quiet,-verbose,-fix,-f77,-f90,-show,-h + -m ,--ignore-contains +Functions: crackfortran, crack2fortran +The following Fortran statements/constructions are supported +(or will be if needed): + block data,byte,call,character,common,complex,contains,data, + dimension,double complex,double precision,end,external,function, + implicit,integer,intent,interface,intrinsic, + logical,module,optional,parameter,private,public, + program,real,(sequence?),subroutine,type,use,virtual, + include,pythonmodule +Note: 'virtual' is mapped to 'dimension'. +Note: 'implicit integer (z) static (z)' is 'implicit static (z)' (this is minor bug). +Note: code after 'contains' will be ignored until its scope ends. +Note: 'common' statement is extended: dimensions are moved to variable definitions +Note: f2py directive: f2py is read as +Note: pythonmodule is introduced to represent Python module + +Usage: + `postlist=crackfortran(files)` + `postlist` contains declaration information read from the list of files `files`. + `crack2fortran(postlist)` returns a fortran code to be saved to pyf-file + + `postlist` has the following structure: + *** it is a list of dictionaries containing `blocks': + B = {'block','body','vars','parent_block'[,'name','prefix','args','result', + 'implicit','externals','interfaced','common','sortvars', + 'commonvars','note']} + B['block'] = 'interface' | 'function' | 'subroutine' | 'module' | + 'program' | 'block data' | 'type' | 'pythonmodule' + B['body'] --- list containing `subblocks' with the same structure as `blocks' + B['parent_block'] --- dictionary of a parent block: + C['body'][]['parent_block'] is C + B['vars'] --- dictionary of variable definitions + B['sortvars'] --- dictionary of variable definitions sorted by dependence (independent first) + B['name'] --- name of the block (not if B['block']=='interface') + B['prefix'] --- prefix string (only if B['block']=='function') + B['args'] --- list of argument names if B['block']== 'function' | 'subroutine' + B['result'] --- name of the return value (only if B['block']=='function') + B['implicit'] --- dictionary {'a':,'b':...} | None + B['externals'] --- list of variables being external + B['interfaced'] --- list of variables being external and defined + B['common'] --- dictionary of common blocks (list of objects) + B['commonvars'] --- list of variables used in common blocks (dimensions are moved to variable definitions) + B['from'] --- string showing the 'parents' of the current block + B['use'] --- dictionary of modules used in current block: + {:{['only':<0|1>],['map':{:,...}]}} + B['note'] --- list of LaTeX comments on the block + B['f2pyenhancements'] --- optional dictionary + {'threadsafe':'','fortranname':, + 'callstatement':|, + 'callprotoargument':, + 'usercode':|, + 'pymethoddef:' + } + B['entry'] --- dictionary {entryname:argslist,..} + B['varnames'] --- list of variable names given in the order of reading the + Fortran code, useful for derived types. + B['saved_interface'] --- a string of scanned routine signature, defines explicit interface + *** Variable definition is a dictionary + D = B['vars'][] = + {'typespec'[,'attrspec','kindselector','charselector','=','typename']} + D['typespec'] = 'byte' | 'character' | 'complex' | 'double complex' | + 'double precision' | 'integer' | 'logical' | 'real' | 'type' + D['attrspec'] --- list of attributes (e.g. 'dimension()', + 'external','intent(in|out|inout|hide|c|callback|cache|aligned4|aligned8|aligned16)', + 'optional','required', etc) + K = D['kindselector'] = {['*','kind']} (only if D['typespec'] = + 'complex' | 'integer' | 'logical' | 'real' ) + C = D['charselector'] = {['*','len','kind']} + (only if D['typespec']=='character') + D['='] --- initialization expression string + D['typename'] --- name of the type if D['typespec']=='type' + D['dimension'] --- list of dimension bounds + D['intent'] --- list of intent specifications + D['depend'] --- list of variable names on which current variable depends on + D['check'] --- list of C-expressions; if C-expr returns zero, exception is raised + D['note'] --- list of LaTeX comments on the variable + *** Meaning of kind/char selectors (few examples): + D['typespec>']*K['*'] + D['typespec'](kind=K['kind']) + character*C['*'] + character(len=C['len'],kind=C['kind']) + (see also fortran type declaration statement formats below) + +Fortran 90 type declaration statement format (F77 is subset of F90) +==================================================================== +(Main source: IBM XL Fortran 5.1 Language Reference Manual) +type declaration = [[]::] + = byte | + character[] | + complex[] | + double complex | + double precision | + integer[] | + logical[] | + real[] | + type() + = * | + ([len=][,[kind=]]) | + (kind=[,len=]) + = * | + ([kind=]) + = comma separated list of attributes. + Only the following attributes are used in + building up the interface: + external + (parameter --- affects '=' key) + optional + intent + Other attributes are ignored. + = in | out | inout + = comma separated list of dimension bounds. + = [[*][()] | [()]*] + [// | =] [,] + +In addition, the following attributes are used: check,depend,note + +TODO: + * Apply 'parameter' attribute (e.g. 'integer parameter :: i=2' 'real x(i)' + -> 'real x(2)') + The above may be solved by creating appropriate preprocessor program, for example. + +""" +from __future__ import division, absolute_import, print_function + +import sys +import string +import fileinput +import re +import os +import copy +import platform + +from . import __version__ + +# The eviroment provided by auxfuncs.py is needed for some calls to eval. +# As the needed functions cannot be determined by static inspection of the +# code, it is safest to use import * pending a major refactoring of f2py. +from .auxfuncs import * + + +f2py_version = __version__.version + +# Global flags: +strictf77 = 1 # Ignore `!' comments unless line[0]=='!' +sourcecodeform = 'fix' # 'fix','free' +quiet = 0 # Be verbose if 0 (Obsolete: not used any more) +verbose = 1 # Be quiet if 0, extra verbose if > 1. +tabchar = 4 * ' ' +pyffilename = '' +f77modulename = '' +skipemptyends = 0 # for old F77 programs without 'program' statement +ignorecontains = 1 +dolowercase = 1 +debug = [] + +# Global variables +beginpattern = '' +currentfilename = '' +expectbegin = 1 +f90modulevars = {} +filepositiontext = '' +gotnextfile = 1 +groupcache = None +groupcounter = 0 +grouplist = {groupcounter: []} +groupname = '' +include_paths = [] +neededmodule = -1 +onlyfuncs = [] +previous_context = None +skipblocksuntil = -1 +skipfuncs = [] +skipfunctions = [] +usermodules = [] + + +def reset_global_f2py_vars(): + global groupcounter, grouplist, neededmodule, expectbegin + global skipblocksuntil, usermodules, f90modulevars, gotnextfile + global filepositiontext, currentfilename, skipfunctions, skipfuncs + global onlyfuncs, include_paths, previous_context + global strictf77, sourcecodeform, quiet, verbose, tabchar, pyffilename + global f77modulename, skipemptyends, ignorecontains, dolowercase, debug + + # flags + strictf77 = 1 + sourcecodeform = 'fix' + quiet = 0 + verbose = 1 + tabchar = 4 * ' ' + pyffilename = '' + f77modulename = '' + skipemptyends = 0 + ignorecontains = 1 + dolowercase = 1 + debug = [] + # variables + groupcounter = 0 + grouplist = {groupcounter: []} + neededmodule = -1 + expectbegin = 1 + skipblocksuntil = -1 + usermodules = [] + f90modulevars = {} + gotnextfile = 1 + filepositiontext = '' + currentfilename = '' + skipfunctions = [] + skipfuncs = [] + onlyfuncs = [] + include_paths = [] + previous_context = None + + +def outmess(line, flag=1): + global filepositiontext + + if not verbose: + return + if not quiet: + if flag: + sys.stdout.write(filepositiontext) + sys.stdout.write(line) + +re._MAXCACHE = 50 +defaultimplicitrules = {} +for c in "abcdefghopqrstuvwxyz$_": + defaultimplicitrules[c] = {'typespec': 'real'} +for c in "ijklmn": + defaultimplicitrules[c] = {'typespec': 'integer'} +del c +badnames = {} +invbadnames = {} +for n in ['int', 'double', 'float', 'char', 'short', 'long', 'void', 'case', 'while', + 'return', 'signed', 'unsigned', 'if', 'for', 'typedef', 'sizeof', 'union', + 'struct', 'static', 'register', 'new', 'break', 'do', 'goto', 'switch', + 'continue', 'else', 'inline', 'extern', 'delete', 'const', 'auto', + 'len', 'rank', 'shape', 'index', 'slen', 'size', '_i', + 'max', 'min', + 'flen', 'fshape', + 'string', 'complex_double', 'float_double', 'stdin', 'stderr', 'stdout', + 'type', 'default']: + badnames[n] = n + '_bn' + invbadnames[n + '_bn'] = n + + +def rmbadname1(name): + if name in badnames: + errmess('rmbadname1: Replacing "%s" with "%s".\n' % + (name, badnames[name])) + return badnames[name] + return name + + +def rmbadname(names): + return [rmbadname1(_m) for _m in names] + + +def undo_rmbadname1(name): + if name in invbadnames: + errmess('undo_rmbadname1: Replacing "%s" with "%s".\n' + % (name, invbadnames[name])) + return invbadnames[name] + return name + + +def undo_rmbadname(names): + return [undo_rmbadname1(_m) for _m in names] + + +def getextension(name): + i = name.rfind('.') + if i == -1: + return '' + if '\\' in name[i:]: + return '' + if '/' in name[i:]: + return '' + return name[i + 1:] + +is_f_file = re.compile(r'.*[.](for|ftn|f77|f)\Z', re.I).match +_has_f_header = re.compile(r'-[*]-\s*fortran\s*-[*]-', re.I).search +_has_f90_header = re.compile(r'-[*]-\s*f90\s*-[*]-', re.I).search +_has_fix_header = re.compile(r'-[*]-\s*fix\s*-[*]-', re.I).search +_free_f90_start = re.compile(r'[^c*]\s*[^\s\d\t]', re.I).match + + +def is_free_format(file): + """Check if file is in free format Fortran.""" + # f90 allows both fixed and free format, assuming fixed unless + # signs of free format are detected. + result = 0 + with open(file, 'r') as f: + line = f.readline() + n = 15 # the number of non-comment lines to scan for hints + if _has_f_header(line): + n = 0 + elif _has_f90_header(line): + n = 0 + result = 1 + while n > 0 and line: + if line[0] != '!' and line.strip(): + n -= 1 + if (line[0] != '\t' and _free_f90_start(line[:5])) or line[-2:-1] == '&': + result = 1 + break + line = f.readline() + return result + + +# Read fortran (77,90) code +def readfortrancode(ffile, dowithline=show, istop=1): + """ + Read fortran codes from files and + 1) Get rid of comments, line continuations, and empty lines; lower cases. + 2) Call dowithline(line) on every line. + 3) Recursively call itself when statement \"include ''\" is met. + """ + global gotnextfile, filepositiontext, currentfilename, sourcecodeform, strictf77 + global beginpattern, quiet, verbose, dolowercase, include_paths + + if not istop: + saveglobals = gotnextfile, filepositiontext, currentfilename, sourcecodeform, strictf77,\ + beginpattern, quiet, verbose, dolowercase + if ffile == []: + return + localdolowercase = dolowercase + cont = 0 + finalline = '' + ll = '' + includeline = re.compile( + r'\s*include\s*(\'|")(?P[^\'"]*)(\'|")', re.I) + cont1 = re.compile(r'(?P.*)&\s*\Z') + cont2 = re.compile(r'(\s*&|)(?P.*)') + mline_mark = re.compile(r".*?'''") + if istop: + dowithline('', -1) + ll, l1 = '', '' + spacedigits = [' '] + [str(_m) for _m in range(10)] + filepositiontext = '' + fin = fileinput.FileInput(ffile) + while True: + l = fin.readline() + if not l: + break + if fin.isfirstline(): + filepositiontext = '' + currentfilename = fin.filename() + gotnextfile = 1 + l1 = l + strictf77 = 0 + sourcecodeform = 'fix' + ext = os.path.splitext(currentfilename)[1] + if is_f_file(currentfilename) and \ + not (_has_f90_header(l) or _has_fix_header(l)): + strictf77 = 1 + elif is_free_format(currentfilename) and not _has_fix_header(l): + sourcecodeform = 'free' + if strictf77: + beginpattern = beginpattern77 + else: + beginpattern = beginpattern90 + outmess('\tReading file %s (format:%s%s)\n' + % (repr(currentfilename), sourcecodeform, + strictf77 and ',strict' or '')) + + l = l.expandtabs().replace('\xa0', ' ') + # Get rid of newline characters + while not l == '': + if l[-1] not in "\n\r\f": + break + l = l[:-1] + if not strictf77: + (l, rl) = split_by_unquoted(l, '!') + l += ' ' + if rl[:5].lower() == '!f2py': # f2py directive + l, _ = split_by_unquoted(l + 4 * ' ' + rl[5:], '!') + if l.strip() == '': # Skip empty line + cont = 0 + continue + if sourcecodeform == 'fix': + if l[0] in ['*', 'c', '!', 'C', '#']: + if l[1:5].lower() == 'f2py': # f2py directive + l = ' ' + l[5:] + else: # Skip comment line + cont = 0 + continue + elif strictf77: + if len(l) > 72: + l = l[:72] + if not (l[0] in spacedigits): + raise Exception('readfortrancode: Found non-(space,digit) char ' + 'in the first column.\n\tAre you sure that ' + 'this code is in fix form?\n\tline=%s' % repr(l)) + + if (not cont or strictf77) and (len(l) > 5 and not l[5] == ' '): + # Continuation of a previous line + ll = ll + l[6:] + finalline = '' + origfinalline = '' + else: + if not strictf77: + # F90 continuation + r = cont1.match(l) + if r: + l = r.group('line') # Continuation follows .. + if cont: + ll = ll + cont2.match(l).group('line') + finalline = '' + origfinalline = '' + else: + # clean up line beginning from possible digits. + l = ' ' + l[5:] + if localdolowercase: + finalline = ll.lower() + else: + finalline = ll + origfinalline = ll + ll = l + cont = (r is not None) + else: + # clean up line beginning from possible digits. + l = ' ' + l[5:] + if localdolowercase: + finalline = ll.lower() + else: + finalline = ll + origfinalline = ll + ll = l + + elif sourcecodeform == 'free': + if not cont and ext == '.pyf' and mline_mark.match(l): + l = l + '\n' + while True: + lc = fin.readline() + if not lc: + errmess( + 'Unexpected end of file when reading multiline\n') + break + l = l + lc + if mline_mark.match(lc): + break + l = l.rstrip() + r = cont1.match(l) + if r: + l = r.group('line') # Continuation follows .. + if cont: + ll = ll + cont2.match(l).group('line') + finalline = '' + origfinalline = '' + else: + if localdolowercase: + finalline = ll.lower() + else: + finalline = ll + origfinalline = ll + ll = l + cont = (r is not None) + else: + raise ValueError( + "Flag sourcecodeform must be either 'fix' or 'free': %s" % repr(sourcecodeform)) + filepositiontext = 'Line #%d in %s:"%s"\n\t' % ( + fin.filelineno() - 1, currentfilename, l1) + m = includeline.match(origfinalline) + if m: + fn = m.group('name') + if os.path.isfile(fn): + readfortrancode(fn, dowithline=dowithline, istop=0) + else: + include_dirs = [ + os.path.dirname(currentfilename)] + include_paths + foundfile = 0 + for inc_dir in include_dirs: + fn1 = os.path.join(inc_dir, fn) + if os.path.isfile(fn1): + foundfile = 1 + readfortrancode(fn1, dowithline=dowithline, istop=0) + break + if not foundfile: + outmess('readfortrancode: could not find include file %s in %s. Ignoring.\n' % ( + repr(fn), os.pathsep.join(include_dirs))) + else: + dowithline(finalline) + l1 = ll + if localdolowercase: + finalline = ll.lower() + else: + finalline = ll + origfinalline = ll + filepositiontext = 'Line #%d in %s:"%s"\n\t' % ( + fin.filelineno() - 1, currentfilename, l1) + m = includeline.match(origfinalline) + if m: + fn = m.group('name') + if os.path.isfile(fn): + readfortrancode(fn, dowithline=dowithline, istop=0) + else: + include_dirs = [os.path.dirname(currentfilename)] + include_paths + foundfile = 0 + for inc_dir in include_dirs: + fn1 = os.path.join(inc_dir, fn) + if os.path.isfile(fn1): + foundfile = 1 + readfortrancode(fn1, dowithline=dowithline, istop=0) + break + if not foundfile: + outmess('readfortrancode: could not find include file %s in %s. Ignoring.\n' % ( + repr(fn), os.pathsep.join(include_dirs))) + else: + dowithline(finalline) + filepositiontext = '' + fin.close() + if istop: + dowithline('', 1) + else: + gotnextfile, filepositiontext, currentfilename, sourcecodeform, strictf77,\ + beginpattern, quiet, verbose, dolowercase = saveglobals + +# Crack line +beforethisafter = r'\s*(?P%s(?=\s*(\b(%s)\b)))' + \ + r'\s*(?P(\b(%s)\b))' + \ + r'\s*(?P%s)\s*\Z' +## +fortrantypes = r'character|logical|integer|real|complex|double\s*(precision\s*(complex|)|complex)|type(?=\s*\([\w\s,=(*)]*\))|byte' +typespattern = re.compile( + beforethisafter % ('', fortrantypes, fortrantypes, '.*'), re.I), 'type' +typespattern4implicit = re.compile(beforethisafter % ( + '', fortrantypes + '|static|automatic|undefined', fortrantypes + '|static|automatic|undefined', '.*'), re.I) +# +functionpattern = re.compile(beforethisafter % ( + r'([a-z]+[\w\s(=*+-/)]*?|)', 'function', 'function', '.*'), re.I), 'begin' +subroutinepattern = re.compile(beforethisafter % ( + r'[a-z\s]*?', 'subroutine', 'subroutine', '.*'), re.I), 'begin' +# modulepattern=re.compile(beforethisafter%('[a-z\s]*?','module','module','.*'),re.I),'begin' +# +groupbegins77 = r'program|block\s*data' +beginpattern77 = re.compile( + beforethisafter % ('', groupbegins77, groupbegins77, '.*'), re.I), 'begin' +groupbegins90 = groupbegins77 + \ + r'|module(?!\s*procedure)|python\s*module|interface|type(?!\s*\()' +beginpattern90 = re.compile( + beforethisafter % ('', groupbegins90, groupbegins90, '.*'), re.I), 'begin' +groupends = r'end|endprogram|endblockdata|endmodule|endpythonmodule|endinterface' +endpattern = re.compile( + beforethisafter % ('', groupends, groupends, r'[\w\s]*'), re.I), 'end' +# endifs='end\s*(if|do|where|select|while|forall)' +endifs = r'(end\s*(if|do|where|select|while|forall))|(module\s*procedure)' +endifpattern = re.compile( + beforethisafter % (r'[\w]*?', endifs, endifs, r'[\w\s]*'), re.I), 'endif' +# +implicitpattern = re.compile( + beforethisafter % ('', 'implicit', 'implicit', '.*'), re.I), 'implicit' +dimensionpattern = re.compile(beforethisafter % ( + '', 'dimension|virtual', 'dimension|virtual', '.*'), re.I), 'dimension' +externalpattern = re.compile( + beforethisafter % ('', 'external', 'external', '.*'), re.I), 'external' +optionalpattern = re.compile( + beforethisafter % ('', 'optional', 'optional', '.*'), re.I), 'optional' +requiredpattern = re.compile( + beforethisafter % ('', 'required', 'required', '.*'), re.I), 'required' +publicpattern = re.compile( + beforethisafter % ('', 'public', 'public', '.*'), re.I), 'public' +privatepattern = re.compile( + beforethisafter % ('', 'private', 'private', '.*'), re.I), 'private' +intrisicpattern = re.compile( + beforethisafter % ('', 'intrisic', 'intrisic', '.*'), re.I), 'intrisic' +intentpattern = re.compile(beforethisafter % ( + '', 'intent|depend|note|check', 'intent|depend|note|check', r'\s*\(.*?\).*'), re.I), 'intent' +parameterpattern = re.compile( + beforethisafter % ('', 'parameter', 'parameter', r'\s*\(.*'), re.I), 'parameter' +datapattern = re.compile( + beforethisafter % ('', 'data', 'data', '.*'), re.I), 'data' +callpattern = re.compile( + beforethisafter % ('', 'call', 'call', '.*'), re.I), 'call' +entrypattern = re.compile( + beforethisafter % ('', 'entry', 'entry', '.*'), re.I), 'entry' +callfunpattern = re.compile( + beforethisafter % ('', 'callfun', 'callfun', '.*'), re.I), 'callfun' +commonpattern = re.compile( + beforethisafter % ('', 'common', 'common', '.*'), re.I), 'common' +usepattern = re.compile( + beforethisafter % ('', 'use', 'use', '.*'), re.I), 'use' +containspattern = re.compile( + beforethisafter % ('', 'contains', 'contains', ''), re.I), 'contains' +formatpattern = re.compile( + beforethisafter % ('', 'format', 'format', '.*'), re.I), 'format' +# Non-fortran and f2py-specific statements +f2pyenhancementspattern = re.compile(beforethisafter % ('', 'threadsafe|fortranname|callstatement|callprotoargument|usercode|pymethoddef', + 'threadsafe|fortranname|callstatement|callprotoargument|usercode|pymethoddef', '.*'), re.I | re.S), 'f2pyenhancements' +multilinepattern = re.compile( + r"\s*(?P''')(?P.*?)(?P''')\s*\Z", re.S), 'multiline' +## + +def split_by_unquoted(line, characters): + """ + Splits the line into (line[:i], line[i:]), + where i is the index of first occurrence of one of the characters + not within quotes, or len(line) if no such index exists + """ + assert not (set('"\'') & set(characters)), "cannot split by unquoted quotes" + r = re.compile( + r"\A(?P({single_quoted}|{double_quoted}|{not_quoted})*)" + r"(?P{char}.*)\Z".format( + not_quoted="[^\"'{}]".format(re.escape(characters)), + char="[{}]".format(re.escape(characters)), + single_quoted=r"('([^'\\]|(\\.))*')", + double_quoted=r'("([^"\\]|(\\.))*")')) + m = r.match(line) + if m: + d = m.groupdict() + return (d["before"], d["after"]) + return (line, "") + +def _simplifyargs(argsline): + a = [] + for n in markoutercomma(argsline).split('@,@'): + for r in '(),': + n = n.replace(r, '_') + a.append(n) + return ','.join(a) + +crackline_re_1 = re.compile(r'\s*(?P\b[a-z]+[\w]*\b)\s*[=].*', re.I) + + +def crackline(line, reset=0): + """ + reset=-1 --- initialize + reset=0 --- crack the line + reset=1 --- final check if mismatch of blocks occurred + + Cracked data is saved in grouplist[0]. + """ + global beginpattern, groupcounter, groupname, groupcache, grouplist + global filepositiontext, currentfilename, neededmodule, expectbegin + global skipblocksuntil, skipemptyends, previous_context, gotnextfile + + _, has_semicolon = split_by_unquoted(line, ";") + if has_semicolon and not (f2pyenhancementspattern[0].match(line) or + multilinepattern[0].match(line)): + # XXX: non-zero reset values need testing + assert reset == 0, repr(reset) + # split line on unquoted semicolons + line, semicolon_line = split_by_unquoted(line, ";") + while semicolon_line: + crackline(line, reset) + line, semicolon_line = split_by_unquoted(semicolon_line[1:], ";") + crackline(line, reset) + return + if reset < 0: + groupcounter = 0 + groupname = {groupcounter: ''} + groupcache = {groupcounter: {}} + grouplist = {groupcounter: []} + groupcache[groupcounter]['body'] = [] + groupcache[groupcounter]['vars'] = {} + groupcache[groupcounter]['block'] = '' + groupcache[groupcounter]['name'] = '' + neededmodule = -1 + skipblocksuntil = -1 + return + if reset > 0: + fl = 0 + if f77modulename and neededmodule == groupcounter: + fl = 2 + while groupcounter > fl: + outmess('crackline: groupcounter=%s groupname=%s\n' % + (repr(groupcounter), repr(groupname))) + outmess( + 'crackline: Mismatch of blocks encountered. Trying to fix it by assuming "end" statement.\n') + grouplist[groupcounter - 1].append(groupcache[groupcounter]) + grouplist[groupcounter - 1][-1]['body'] = grouplist[groupcounter] + del grouplist[groupcounter] + groupcounter = groupcounter - 1 + if f77modulename and neededmodule == groupcounter: + grouplist[groupcounter - 1].append(groupcache[groupcounter]) + grouplist[groupcounter - 1][-1]['body'] = grouplist[groupcounter] + del grouplist[groupcounter] + groupcounter = groupcounter - 1 # end interface + grouplist[groupcounter - 1].append(groupcache[groupcounter]) + grouplist[groupcounter - 1][-1]['body'] = grouplist[groupcounter] + del grouplist[groupcounter] + groupcounter = groupcounter - 1 # end module + neededmodule = -1 + return + if line == '': + return + flag = 0 + for pat in [dimensionpattern, externalpattern, intentpattern, optionalpattern, + requiredpattern, + parameterpattern, datapattern, publicpattern, privatepattern, + intrisicpattern, + endifpattern, endpattern, + formatpattern, + beginpattern, functionpattern, subroutinepattern, + implicitpattern, typespattern, commonpattern, + callpattern, usepattern, containspattern, + entrypattern, + f2pyenhancementspattern, + multilinepattern + ]: + m = pat[0].match(line) + if m: + break + flag = flag + 1 + if not m: + re_1 = crackline_re_1 + if 0 <= skipblocksuntil <= groupcounter: + return + if 'externals' in groupcache[groupcounter]: + for name in groupcache[groupcounter]['externals']: + if name in invbadnames: + name = invbadnames[name] + if 'interfaced' in groupcache[groupcounter] and name in groupcache[groupcounter]['interfaced']: + continue + m1 = re.match( + r'(?P[^"]*)\b%s\b\s*@\(@(?P[^@]*)@\)@.*\Z' % name, markouterparen(line), re.I) + if m1: + m2 = re_1.match(m1.group('before')) + a = _simplifyargs(m1.group('args')) + if m2: + line = 'callfun %s(%s) result (%s)' % ( + name, a, m2.group('result')) + else: + line = 'callfun %s(%s)' % (name, a) + m = callfunpattern[0].match(line) + if not m: + outmess( + 'crackline: could not resolve function call for line=%s.\n' % repr(line)) + return + analyzeline(m, 'callfun', line) + return + if verbose > 1 or (verbose == 1 and currentfilename.lower().endswith('.pyf')): + previous_context = None + outmess('crackline:%d: No pattern for line\n' % (groupcounter)) + return + elif pat[1] == 'end': + if 0 <= skipblocksuntil < groupcounter: + groupcounter = groupcounter - 1 + if skipblocksuntil <= groupcounter: + return + if groupcounter <= 0: + raise Exception('crackline: groupcounter(=%s) is nonpositive. ' + 'Check the blocks.' + % (groupcounter)) + m1 = beginpattern[0].match((line)) + if (m1) and (not m1.group('this') == groupname[groupcounter]): + raise Exception('crackline: End group %s does not match with ' + 'previous Begin group %s\n\t%s' % + (repr(m1.group('this')), repr(groupname[groupcounter]), + filepositiontext) + ) + if skipblocksuntil == groupcounter: + skipblocksuntil = -1 + grouplist[groupcounter - 1].append(groupcache[groupcounter]) + grouplist[groupcounter - 1][-1]['body'] = grouplist[groupcounter] + del grouplist[groupcounter] + groupcounter = groupcounter - 1 + if not skipemptyends: + expectbegin = 1 + elif pat[1] == 'begin': + if 0 <= skipblocksuntil <= groupcounter: + groupcounter = groupcounter + 1 + return + gotnextfile = 0 + analyzeline(m, pat[1], line) + expectbegin = 0 + elif pat[1] == 'endif': + pass + elif pat[1] == 'contains': + if ignorecontains: + return + if 0 <= skipblocksuntil <= groupcounter: + return + skipblocksuntil = groupcounter + else: + if 0 <= skipblocksuntil <= groupcounter: + return + analyzeline(m, pat[1], line) + + +def markouterparen(line): + l = '' + f = 0 + for c in line: + if c == '(': + f = f + 1 + if f == 1: + l = l + '@(@' + continue + elif c == ')': + f = f - 1 + if f == 0: + l = l + '@)@' + continue + l = l + c + return l + + +def markoutercomma(line, comma=','): + l = '' + f = 0 + before, after = split_by_unquoted(line, comma + '()') + l += before + while after: + if (after[0] == comma) and (f == 0): + l += '@' + comma + '@' + else: + l += after[0] + if after[0] == '(': + f += 1 + elif after[0] == ')': + f -= 1 + before, after = split_by_unquoted(after[1:], comma + '()') + l += before + assert not f, repr((f, line, l)) + return l + +def unmarkouterparen(line): + r = line.replace('@(@', '(').replace('@)@', ')') + return r + + +def appenddecl(decl, decl2, force=1): + if not decl: + decl = {} + if not decl2: + return decl + if decl is decl2: + return decl + for k in list(decl2.keys()): + if k == 'typespec': + if force or k not in decl: + decl[k] = decl2[k] + elif k == 'attrspec': + for l in decl2[k]: + decl = setattrspec(decl, l, force) + elif k == 'kindselector': + decl = setkindselector(decl, decl2[k], force) + elif k == 'charselector': + decl = setcharselector(decl, decl2[k], force) + elif k in ['=', 'typename']: + if force or k not in decl: + decl[k] = decl2[k] + elif k == 'note': + pass + elif k in ['intent', 'check', 'dimension', 'optional', 'required']: + errmess('appenddecl: "%s" not implemented.\n' % k) + else: + raise Exception('appenddecl: Unknown variable definition key:' + + str(k)) + return decl + +selectpattern = re.compile( + r'\s*(?P(@\(@.*?@\)@|[*][\d*]+|[*]\s*@\(@.*?@\)@|))(?P.*)\Z', re.I) +nameargspattern = re.compile( + r'\s*(?P\b[\w$]+\b)\s*(@\(@\s*(?P[\w\s,]*)\s*@\)@|)\s*((result(\s*@\(@\s*(?P\b[\w$]+\b)\s*@\)@|))|(bind\s*@\(@\s*(?P.*)\s*@\)@))*\s*\Z', re.I) +callnameargspattern = re.compile( + r'\s*(?P\b[\w$]+\b)\s*@\(@\s*(?P.*)\s*@\)@\s*\Z', re.I) +real16pattern = re.compile( + r'([-+]?(?:\d+(?:\.\d*)?|\d*\.\d+))[dD]((?:[-+]?\d+)?)') +real8pattern = re.compile( + r'([-+]?((?:\d+(?:\.\d*)?|\d*\.\d+))[eE]((?:[-+]?\d+)?)|(\d+\.\d*))') + +_intentcallbackpattern = re.compile(r'intent\s*\(.*?\bcallback\b', re.I) + + +def _is_intent_callback(vdecl): + for a in vdecl.get('attrspec', []): + if _intentcallbackpattern.match(a): + return 1 + return 0 + + +def _resolvenameargspattern(line): + line = markouterparen(line) + m1 = nameargspattern.match(line) + if m1: + return m1.group('name'), m1.group('args'), m1.group('result'), m1.group('bind') + m1 = callnameargspattern.match(line) + if m1: + return m1.group('name'), m1.group('args'), None, None + return None, [], None, None + + +def analyzeline(m, case, line): + global groupcounter, groupname, groupcache, grouplist, filepositiontext + global currentfilename, f77modulename, neededinterface, neededmodule + global expectbegin, gotnextfile, previous_context + + block = m.group('this') + if case != 'multiline': + previous_context = None + if expectbegin and case not in ['begin', 'call', 'callfun', 'type'] \ + and not skipemptyends and groupcounter < 1: + newname = os.path.basename(currentfilename).split('.')[0] + outmess( + 'analyzeline: no group yet. Creating program group with name "%s".\n' % newname) + gotnextfile = 0 + groupcounter = groupcounter + 1 + groupname[groupcounter] = 'program' + groupcache[groupcounter] = {} + grouplist[groupcounter] = [] + groupcache[groupcounter]['body'] = [] + groupcache[groupcounter]['vars'] = {} + groupcache[groupcounter]['block'] = 'program' + groupcache[groupcounter]['name'] = newname + groupcache[groupcounter]['from'] = 'fromsky' + expectbegin = 0 + if case in ['begin', 'call', 'callfun']: + # Crack line => block,name,args,result + block = block.lower() + if re.match(r'block\s*data', block, re.I): + block = 'block data' + if re.match(r'python\s*module', block, re.I): + block = 'python module' + name, args, result, bind = _resolvenameargspattern(m.group('after')) + if name is None: + if block == 'block data': + name = '_BLOCK_DATA_' + else: + name = '' + if block not in ['interface', 'block data']: + outmess('analyzeline: No name/args pattern found for line.\n') + + previous_context = (block, name, groupcounter) + if args: + args = rmbadname([x.strip() + for x in markoutercomma(args).split('@,@')]) + else: + args = [] + if '' in args: + while '' in args: + args.remove('') + outmess( + 'analyzeline: argument list is malformed (missing argument).\n') + + # end of crack line => block,name,args,result + needmodule = 0 + needinterface = 0 + + if case in ['call', 'callfun']: + needinterface = 1 + if 'args' not in groupcache[groupcounter]: + return + if name not in groupcache[groupcounter]['args']: + return + for it in grouplist[groupcounter]: + if it['name'] == name: + return + if name in groupcache[groupcounter]['interfaced']: + return + block = {'call': 'subroutine', 'callfun': 'function'}[case] + if f77modulename and neededmodule == -1 and groupcounter <= 1: + neededmodule = groupcounter + 2 + needmodule = 1 + if block != 'interface': + needinterface = 1 + # Create new block(s) + groupcounter = groupcounter + 1 + groupcache[groupcounter] = {} + grouplist[groupcounter] = [] + if needmodule: + if verbose > 1: + outmess('analyzeline: Creating module block %s\n' % + repr(f77modulename), 0) + groupname[groupcounter] = 'module' + groupcache[groupcounter]['block'] = 'python module' + groupcache[groupcounter]['name'] = f77modulename + groupcache[groupcounter]['from'] = '' + groupcache[groupcounter]['body'] = [] + groupcache[groupcounter]['externals'] = [] + groupcache[groupcounter]['interfaced'] = [] + groupcache[groupcounter]['vars'] = {} + groupcounter = groupcounter + 1 + groupcache[groupcounter] = {} + grouplist[groupcounter] = [] + if needinterface: + if verbose > 1: + outmess('analyzeline: Creating additional interface block (groupcounter=%s).\n' % ( + groupcounter), 0) + groupname[groupcounter] = 'interface' + groupcache[groupcounter]['block'] = 'interface' + groupcache[groupcounter]['name'] = 'unknown_interface' + groupcache[groupcounter]['from'] = '%s:%s' % ( + groupcache[groupcounter - 1]['from'], groupcache[groupcounter - 1]['name']) + groupcache[groupcounter]['body'] = [] + groupcache[groupcounter]['externals'] = [] + groupcache[groupcounter]['interfaced'] = [] + groupcache[groupcounter]['vars'] = {} + groupcounter = groupcounter + 1 + groupcache[groupcounter] = {} + grouplist[groupcounter] = [] + groupname[groupcounter] = block + groupcache[groupcounter]['block'] = block + if not name: + name = 'unknown_' + block + groupcache[groupcounter]['prefix'] = m.group('before') + groupcache[groupcounter]['name'] = rmbadname1(name) + groupcache[groupcounter]['result'] = result + if groupcounter == 1: + groupcache[groupcounter]['from'] = currentfilename + else: + if f77modulename and groupcounter == 3: + groupcache[groupcounter]['from'] = '%s:%s' % ( + groupcache[groupcounter - 1]['from'], currentfilename) + else: + groupcache[groupcounter]['from'] = '%s:%s' % ( + groupcache[groupcounter - 1]['from'], groupcache[groupcounter - 1]['name']) + for k in list(groupcache[groupcounter].keys()): + if not groupcache[groupcounter][k]: + del groupcache[groupcounter][k] + + groupcache[groupcounter]['args'] = args + groupcache[groupcounter]['body'] = [] + groupcache[groupcounter]['externals'] = [] + groupcache[groupcounter]['interfaced'] = [] + groupcache[groupcounter]['vars'] = {} + groupcache[groupcounter]['entry'] = {} + # end of creation + if block == 'type': + groupcache[groupcounter]['varnames'] = [] + + if case in ['call', 'callfun']: # set parents variables + if name not in groupcache[groupcounter - 2]['externals']: + groupcache[groupcounter - 2]['externals'].append(name) + groupcache[groupcounter]['vars'] = copy.deepcopy( + groupcache[groupcounter - 2]['vars']) + try: + del groupcache[groupcounter]['vars'][name][ + groupcache[groupcounter]['vars'][name]['attrspec'].index('external')] + except Exception: + pass + if block in ['function', 'subroutine']: # set global attributes + try: + groupcache[groupcounter]['vars'][name] = appenddecl( + groupcache[groupcounter]['vars'][name], groupcache[groupcounter - 2]['vars']['']) + except Exception: + pass + if case == 'callfun': # return type + if result and result in groupcache[groupcounter]['vars']: + if not name == result: + groupcache[groupcounter]['vars'][name] = appenddecl( + groupcache[groupcounter]['vars'][name], groupcache[groupcounter]['vars'][result]) + # if groupcounter>1: # name is interfaced + try: + groupcache[groupcounter - 2]['interfaced'].append(name) + except Exception: + pass + if block == 'function': + t = typespattern[0].match(m.group('before') + ' ' + name) + if t: + typespec, selector, attr, edecl = cracktypespec0( + t.group('this'), t.group('after')) + updatevars(typespec, selector, attr, edecl) + + if case in ['call', 'callfun']: + grouplist[groupcounter - 1].append(groupcache[groupcounter]) + grouplist[groupcounter - 1][-1]['body'] = grouplist[groupcounter] + del grouplist[groupcounter] + groupcounter = groupcounter - 1 # end routine + grouplist[groupcounter - 1].append(groupcache[groupcounter]) + grouplist[groupcounter - 1][-1]['body'] = grouplist[groupcounter] + del grouplist[groupcounter] + groupcounter = groupcounter - 1 # end interface + + elif case == 'entry': + name, args, result, bind = _resolvenameargspattern(m.group('after')) + if name is not None: + if args: + args = rmbadname([x.strip() + for x in markoutercomma(args).split('@,@')]) + else: + args = [] + assert result is None, repr(result) + groupcache[groupcounter]['entry'][name] = args + previous_context = ('entry', name, groupcounter) + elif case == 'type': + typespec, selector, attr, edecl = cracktypespec0( + block, m.group('after')) + last_name = updatevars(typespec, selector, attr, edecl) + if last_name is not None: + previous_context = ('variable', last_name, groupcounter) + elif case in ['dimension', 'intent', 'optional', 'required', 'external', 'public', 'private', 'intrisic']: + edecl = groupcache[groupcounter]['vars'] + ll = m.group('after').strip() + i = ll.find('::') + if i < 0 and case == 'intent': + i = markouterparen(ll).find('@)@') - 2 + ll = ll[:i + 1] + '::' + ll[i + 1:] + i = ll.find('::') + if ll[i:] == '::' and 'args' in groupcache[groupcounter]: + outmess('All arguments will have attribute %s%s\n' % + (m.group('this'), ll[:i])) + ll = ll + ','.join(groupcache[groupcounter]['args']) + if i < 0: + i = 0 + pl = '' + else: + pl = ll[:i].strip() + ll = ll[i + 2:] + ch = markoutercomma(pl).split('@,@') + if len(ch) > 1: + pl = ch[0] + outmess('analyzeline: cannot handle multiple attributes without type specification. Ignoring %r.\n' % ( + ','.join(ch[1:]))) + last_name = None + + for e in [x.strip() for x in markoutercomma(ll).split('@,@')]: + m1 = namepattern.match(e) + if not m1: + if case in ['public', 'private']: + k = '' + else: + print(m.groupdict()) + outmess('analyzeline: no name pattern found in %s statement for %s. Skipping.\n' % ( + case, repr(e))) + continue + else: + k = rmbadname1(m1.group('name')) + if k not in edecl: + edecl[k] = {} + if case == 'dimension': + ap = case + m1.group('after') + if case == 'intent': + ap = m.group('this') + pl + if _intentcallbackpattern.match(ap): + if k not in groupcache[groupcounter]['args']: + if groupcounter > 1: + if '__user__' not in groupcache[groupcounter - 2]['name']: + outmess( + 'analyzeline: missing __user__ module (could be nothing)\n') + # fixes ticket 1693 + if k != groupcache[groupcounter]['name']: + outmess('analyzeline: appending intent(callback) %s' + ' to %s arguments\n' % (k, groupcache[groupcounter]['name'])) + groupcache[groupcounter]['args'].append(k) + else: + errmess( + 'analyzeline: intent(callback) %s is ignored' % (k)) + else: + errmess('analyzeline: intent(callback) %s is already' + ' in argument list' % (k)) + if case in ['optional', 'required', 'public', 'external', 'private', 'intrisic']: + ap = case + if 'attrspec' in edecl[k]: + edecl[k]['attrspec'].append(ap) + else: + edecl[k]['attrspec'] = [ap] + if case == 'external': + if groupcache[groupcounter]['block'] == 'program': + outmess('analyzeline: ignoring program arguments\n') + continue + if k not in groupcache[groupcounter]['args']: + continue + if 'externals' not in groupcache[groupcounter]: + groupcache[groupcounter]['externals'] = [] + groupcache[groupcounter]['externals'].append(k) + last_name = k + groupcache[groupcounter]['vars'] = edecl + if last_name is not None: + previous_context = ('variable', last_name, groupcounter) + elif case == 'parameter': + edecl = groupcache[groupcounter]['vars'] + ll = m.group('after').strip()[1:-1] + last_name = None + for e in markoutercomma(ll).split('@,@'): + try: + k, initexpr = [x.strip() for x in e.split('=')] + except Exception: + outmess( + 'analyzeline: could not extract name,expr in parameter statement "%s" of "%s"\n' % (e, ll)) + continue + params = get_parameters(edecl) + k = rmbadname1(k) + if k not in edecl: + edecl[k] = {} + if '=' in edecl[k] and (not edecl[k]['='] == initexpr): + outmess('analyzeline: Overwriting the value of parameter "%s" ("%s") with "%s".\n' % ( + k, edecl[k]['='], initexpr)) + t = determineexprtype(initexpr, params) + if t: + if t.get('typespec') == 'real': + tt = list(initexpr) + for m in real16pattern.finditer(initexpr): + tt[m.start():m.end()] = list( + initexpr[m.start():m.end()].lower().replace('d', 'e')) + initexpr = ''.join(tt) + elif t.get('typespec') == 'complex': + initexpr = initexpr[1:].lower().replace('d', 'e').\ + replace(',', '+1j*(') + try: + v = eval(initexpr, {}, params) + except (SyntaxError, NameError, TypeError) as msg: + errmess('analyzeline: Failed to evaluate %r. Ignoring: %s\n' + % (initexpr, msg)) + continue + edecl[k]['='] = repr(v) + if 'attrspec' in edecl[k]: + edecl[k]['attrspec'].append('parameter') + else: + edecl[k]['attrspec'] = ['parameter'] + last_name = k + groupcache[groupcounter]['vars'] = edecl + if last_name is not None: + previous_context = ('variable', last_name, groupcounter) + elif case == 'implicit': + if m.group('after').strip().lower() == 'none': + groupcache[groupcounter]['implicit'] = None + elif m.group('after'): + if 'implicit' in groupcache[groupcounter]: + impl = groupcache[groupcounter]['implicit'] + else: + impl = {} + if impl is None: + outmess( + 'analyzeline: Overwriting earlier "implicit none" statement.\n') + impl = {} + for e in markoutercomma(m.group('after')).split('@,@'): + decl = {} + m1 = re.match( + r'\s*(?P.*?)\s*(\(\s*(?P[a-z-, ]+)\s*\)\s*|)\Z', e, re.I) + if not m1: + outmess( + 'analyzeline: could not extract info of implicit statement part "%s"\n' % (e)) + continue + m2 = typespattern4implicit.match(m1.group('this')) + if not m2: + outmess( + 'analyzeline: could not extract types pattern of implicit statement part "%s"\n' % (e)) + continue + typespec, selector, attr, edecl = cracktypespec0( + m2.group('this'), m2.group('after')) + kindselect, charselect, typename = cracktypespec( + typespec, selector) + decl['typespec'] = typespec + decl['kindselector'] = kindselect + decl['charselector'] = charselect + decl['typename'] = typename + for k in list(decl.keys()): + if not decl[k]: + del decl[k] + for r in markoutercomma(m1.group('after')).split('@,@'): + if '-' in r: + try: + begc, endc = [x.strip() for x in r.split('-')] + except Exception: + outmess( + 'analyzeline: expected "-" instead of "%s" in range list of implicit statement\n' % r) + continue + else: + begc = endc = r.strip() + if not len(begc) == len(endc) == 1: + outmess( + 'analyzeline: expected "-" instead of "%s" in range list of implicit statement (2)\n' % r) + continue + for o in range(ord(begc), ord(endc) + 1): + impl[chr(o)] = decl + groupcache[groupcounter]['implicit'] = impl + elif case == 'data': + ll = [] + dl = '' + il = '' + f = 0 + fc = 1 + inp = 0 + for c in m.group('after'): + if not inp: + if c == "'": + fc = not fc + if c == '/' and fc: + f = f + 1 + continue + if c == '(': + inp = inp + 1 + elif c == ')': + inp = inp - 1 + if f == 0: + dl = dl + c + elif f == 1: + il = il + c + elif f == 2: + dl = dl.strip() + if dl.startswith(','): + dl = dl[1:].strip() + ll.append([dl, il]) + dl = c + il = '' + f = 0 + if f == 2: + dl = dl.strip() + if dl.startswith(','): + dl = dl[1:].strip() + ll.append([dl, il]) + vars = {} + if 'vars' in groupcache[groupcounter]: + vars = groupcache[groupcounter]['vars'] + last_name = None + for l in ll: + l = [x.strip() for x in l] + if l[0][0] == ',': + l[0] = l[0][1:] + if l[0][0] == '(': + outmess( + 'analyzeline: implied-DO list "%s" is not supported. Skipping.\n' % l[0]) + continue + i = 0 + j = 0 + llen = len(l[1]) + for v in rmbadname([x.strip() for x in markoutercomma(l[0]).split('@,@')]): + if v[0] == '(': + outmess( + 'analyzeline: implied-DO list "%s" is not supported. Skipping.\n' % v) + # XXX: subsequent init expressions may get wrong values. + # Ignoring since data statements are irrelevant for + # wrapping. + continue + fc = 0 + while (i < llen) and (fc or not l[1][i] == ','): + if l[1][i] == "'": + fc = not fc + i = i + 1 + i = i + 1 + if v not in vars: + vars[v] = {} + if '=' in vars[v] and not vars[v]['='] == l[1][j:i - 1]: + outmess('analyzeline: changing init expression of "%s" ("%s") to "%s"\n' % ( + v, vars[v]['='], l[1][j:i - 1])) + vars[v]['='] = l[1][j:i - 1] + j = i + last_name = v + groupcache[groupcounter]['vars'] = vars + if last_name is not None: + previous_context = ('variable', last_name, groupcounter) + elif case == 'common': + line = m.group('after').strip() + if not line[0] == '/': + line = '//' + line + cl = [] + f = 0 + bn = '' + ol = '' + for c in line: + if c == '/': + f = f + 1 + continue + if f >= 3: + bn = bn.strip() + if not bn: + bn = '_BLNK_' + cl.append([bn, ol]) + f = f - 2 + bn = '' + ol = '' + if f % 2: + bn = bn + c + else: + ol = ol + c + bn = bn.strip() + if not bn: + bn = '_BLNK_' + cl.append([bn, ol]) + commonkey = {} + if 'common' in groupcache[groupcounter]: + commonkey = groupcache[groupcounter]['common'] + for c in cl: + if c[0] not in commonkey: + commonkey[c[0]] = [] + for i in [x.strip() for x in markoutercomma(c[1]).split('@,@')]: + if i: + commonkey[c[0]].append(i) + groupcache[groupcounter]['common'] = commonkey + previous_context = ('common', bn, groupcounter) + elif case == 'use': + m1 = re.match( + r'\A\s*(?P\b[\w]+\b)\s*((,(\s*\bonly\b\s*:|(?P))\s*(?P.*))|)\s*\Z', m.group('after'), re.I) + if m1: + mm = m1.groupdict() + if 'use' not in groupcache[groupcounter]: + groupcache[groupcounter]['use'] = {} + name = m1.group('name') + groupcache[groupcounter]['use'][name] = {} + isonly = 0 + if 'list' in mm and mm['list'] is not None: + if 'notonly' in mm and mm['notonly'] is None: + isonly = 1 + groupcache[groupcounter]['use'][name]['only'] = isonly + ll = [x.strip() for x in mm['list'].split(',')] + rl = {} + for l in ll: + if '=' in l: + m2 = re.match( + r'\A\s*(?P\b[\w]+\b)\s*=\s*>\s*(?P\b[\w]+\b)\s*\Z', l, re.I) + if m2: + rl[m2.group('local').strip()] = m2.group( + 'use').strip() + else: + outmess( + 'analyzeline: Not local=>use pattern found in %s\n' % repr(l)) + else: + rl[l] = l + groupcache[groupcounter]['use'][name]['map'] = rl + else: + pass + else: + print(m.groupdict()) + outmess('analyzeline: Could not crack the use statement.\n') + elif case in ['f2pyenhancements']: + if 'f2pyenhancements' not in groupcache[groupcounter]: + groupcache[groupcounter]['f2pyenhancements'] = {} + d = groupcache[groupcounter]['f2pyenhancements'] + if m.group('this') == 'usercode' and 'usercode' in d: + if isinstance(d['usercode'], str): + d['usercode'] = [d['usercode']] + d['usercode'].append(m.group('after')) + else: + d[m.group('this')] = m.group('after') + elif case == 'multiline': + if previous_context is None: + if verbose: + outmess('analyzeline: No context for multiline block.\n') + return + gc = groupcounter + appendmultiline(groupcache[gc], + previous_context[:2], + m.group('this')) + else: + if verbose > 1: + print(m.groupdict()) + outmess('analyzeline: No code implemented for line.\n') + + +def appendmultiline(group, context_name, ml): + if 'f2pymultilines' not in group: + group['f2pymultilines'] = {} + d = group['f2pymultilines'] + if context_name not in d: + d[context_name] = [] + d[context_name].append(ml) + return + + +def cracktypespec0(typespec, ll): + selector = None + attr = None + if re.match(r'double\s*complex', typespec, re.I): + typespec = 'double complex' + elif re.match(r'double\s*precision', typespec, re.I): + typespec = 'double precision' + else: + typespec = typespec.strip().lower() + m1 = selectpattern.match(markouterparen(ll)) + if not m1: + outmess( + 'cracktypespec0: no kind/char_selector pattern found for line.\n') + return + d = m1.groupdict() + for k in list(d.keys()): + d[k] = unmarkouterparen(d[k]) + if typespec in ['complex', 'integer', 'logical', 'real', 'character', 'type']: + selector = d['this'] + ll = d['after'] + i = ll.find('::') + if i >= 0: + attr = ll[:i].strip() + ll = ll[i + 2:] + return typespec, selector, attr, ll +##### +namepattern = re.compile(r'\s*(?P\b[\w]+\b)\s*(?P.*)\s*\Z', re.I) +kindselector = re.compile( + r'\s*(\(\s*(kind\s*=)?\s*(?P.*)\s*\)|[*]\s*(?P.*?))\s*\Z', re.I) +charselector = re.compile( + r'\s*(\((?P.*)\)|[*]\s*(?P.*))\s*\Z', re.I) +lenkindpattern = re.compile( + r'\s*(kind\s*=\s*(?P.*?)\s*(@,@\s*len\s*=\s*(?P.*)|)|(len\s*=\s*|)(?P.*?)\s*(@,@\s*(kind\s*=\s*|)(?P.*)|))\s*\Z', re.I) +lenarraypattern = re.compile( + r'\s*(@\(@\s*(?!/)\s*(?P.*?)\s*@\)@\s*[*]\s*(?P.*?)|([*]\s*(?P.*?)|)\s*(@\(@\s*(?!/)\s*(?P.*?)\s*@\)@|))\s*(=\s*(?P.*?)|(@\(@|)/\s*(?P.*?)\s*/(@\)@|)|)\s*\Z', re.I) + + +def removespaces(expr): + expr = expr.strip() + if len(expr) <= 1: + return expr + expr2 = expr[0] + for i in range(1, len(expr) - 1): + if (expr[i] == ' ' and + ((expr[i + 1] in "()[]{}=+-/* ") or + (expr[i - 1] in "()[]{}=+-/* "))): + continue + expr2 = expr2 + expr[i] + expr2 = expr2 + expr[-1] + return expr2 + + +def markinnerspaces(line): + l = '' + f = 0 + cc = '\'' + cb = '' + for c in line: + if cb == '\\' and c in ['\\', '\'', '"']: + l = l + c + cb = c + continue + if f == 0 and c in ['\'', '"']: + cc = c + if c == cc: + f = f + 1 + elif c == cc: + f = f - 1 + elif c == ' ' and f == 1: + l = l + '@_@' + continue + l = l + c + cb = c + return l + + +def updatevars(typespec, selector, attrspec, entitydecl): + global groupcache, groupcounter + + last_name = None + kindselect, charselect, typename = cracktypespec(typespec, selector) + if attrspec: + attrspec = [x.strip() for x in markoutercomma(attrspec).split('@,@')] + l = [] + c = re.compile(r'(?P[a-zA-Z]+)') + for a in attrspec: + if not a: + continue + m = c.match(a) + if m: + s = m.group('start').lower() + a = s + a[len(s):] + l.append(a) + attrspec = l + el = [x.strip() for x in markoutercomma(entitydecl).split('@,@')] + el1 = [] + for e in el: + for e1 in [x.strip() for x in markoutercomma(removespaces(markinnerspaces(e)), comma=' ').split('@ @')]: + if e1: + el1.append(e1.replace('@_@', ' ')) + for e in el1: + m = namepattern.match(e) + if not m: + outmess( + 'updatevars: no name pattern found for entity=%s. Skipping.\n' % (repr(e))) + continue + ename = rmbadname1(m.group('name')) + edecl = {} + if ename in groupcache[groupcounter]['vars']: + edecl = groupcache[groupcounter]['vars'][ename].copy() + not_has_typespec = 'typespec' not in edecl + if not_has_typespec: + edecl['typespec'] = typespec + elif typespec and (not typespec == edecl['typespec']): + outmess('updatevars: attempt to change the type of "%s" ("%s") to "%s". Ignoring.\n' % ( + ename, edecl['typespec'], typespec)) + if 'kindselector' not in edecl: + edecl['kindselector'] = copy.copy(kindselect) + elif kindselect: + for k in list(kindselect.keys()): + if k in edecl['kindselector'] and (not kindselect[k] == edecl['kindselector'][k]): + outmess('updatevars: attempt to change the kindselector "%s" of "%s" ("%s") to "%s". Ignoring.\n' % ( + k, ename, edecl['kindselector'][k], kindselect[k])) + else: + edecl['kindselector'][k] = copy.copy(kindselect[k]) + if 'charselector' not in edecl and charselect: + if not_has_typespec: + edecl['charselector'] = charselect + else: + errmess('updatevars:%s: attempt to change empty charselector to %r. Ignoring.\n' + % (ename, charselect)) + elif charselect: + for k in list(charselect.keys()): + if k in edecl['charselector'] and (not charselect[k] == edecl['charselector'][k]): + outmess('updatevars: attempt to change the charselector "%s" of "%s" ("%s") to "%s". Ignoring.\n' % ( + k, ename, edecl['charselector'][k], charselect[k])) + else: + edecl['charselector'][k] = copy.copy(charselect[k]) + if 'typename' not in edecl: + edecl['typename'] = typename + elif typename and (not edecl['typename'] == typename): + outmess('updatevars: attempt to change the typename of "%s" ("%s") to "%s". Ignoring.\n' % ( + ename, edecl['typename'], typename)) + if 'attrspec' not in edecl: + edecl['attrspec'] = copy.copy(attrspec) + elif attrspec: + for a in attrspec: + if a not in edecl['attrspec']: + edecl['attrspec'].append(a) + else: + edecl['typespec'] = copy.copy(typespec) + edecl['kindselector'] = copy.copy(kindselect) + edecl['charselector'] = copy.copy(charselect) + edecl['typename'] = typename + edecl['attrspec'] = copy.copy(attrspec) + if m.group('after'): + m1 = lenarraypattern.match(markouterparen(m.group('after'))) + if m1: + d1 = m1.groupdict() + for lk in ['len', 'array', 'init']: + if d1[lk + '2'] is not None: + d1[lk] = d1[lk + '2'] + del d1[lk + '2'] + for k in list(d1.keys()): + if d1[k] is not None: + d1[k] = unmarkouterparen(d1[k]) + else: + del d1[k] + if 'len' in d1 and 'array' in d1: + if d1['len'] == '': + d1['len'] = d1['array'] + del d1['array'] + else: + d1['array'] = d1['array'] + ',' + d1['len'] + del d1['len'] + errmess('updatevars: "%s %s" is mapped to "%s %s(%s)"\n' % ( + typespec, e, typespec, ename, d1['array'])) + if 'array' in d1: + dm = 'dimension(%s)' % d1['array'] + if 'attrspec' not in edecl or (not edecl['attrspec']): + edecl['attrspec'] = [dm] + else: + edecl['attrspec'].append(dm) + for dm1 in edecl['attrspec']: + if dm1[:9] == 'dimension' and dm1 != dm: + del edecl['attrspec'][-1] + errmess('updatevars:%s: attempt to change %r to %r. Ignoring.\n' + % (ename, dm1, dm)) + break + + if 'len' in d1: + if typespec in ['complex', 'integer', 'logical', 'real']: + if ('kindselector' not in edecl) or (not edecl['kindselector']): + edecl['kindselector'] = {} + edecl['kindselector']['*'] = d1['len'] + elif typespec == 'character': + if ('charselector' not in edecl) or (not edecl['charselector']): + edecl['charselector'] = {} + if 'len' in edecl['charselector']: + del edecl['charselector']['len'] + edecl['charselector']['*'] = d1['len'] + if 'init' in d1: + if '=' in edecl and (not edecl['='] == d1['init']): + outmess('updatevars: attempt to change the init expression of "%s" ("%s") to "%s". Ignoring.\n' % ( + ename, edecl['='], d1['init'])) + else: + edecl['='] = d1['init'] + else: + outmess('updatevars: could not crack entity declaration "%s". Ignoring.\n' % ( + ename + m.group('after'))) + for k in list(edecl.keys()): + if not edecl[k]: + del edecl[k] + groupcache[groupcounter]['vars'][ename] = edecl + if 'varnames' in groupcache[groupcounter]: + groupcache[groupcounter]['varnames'].append(ename) + last_name = ename + return last_name + + +def cracktypespec(typespec, selector): + kindselect = None + charselect = None + typename = None + if selector: + if typespec in ['complex', 'integer', 'logical', 'real']: + kindselect = kindselector.match(selector) + if not kindselect: + outmess( + 'cracktypespec: no kindselector pattern found for %s\n' % (repr(selector))) + return + kindselect = kindselect.groupdict() + kindselect['*'] = kindselect['kind2'] + del kindselect['kind2'] + for k in list(kindselect.keys()): + if not kindselect[k]: + del kindselect[k] + for k, i in list(kindselect.items()): + kindselect[k] = rmbadname1(i) + elif typespec == 'character': + charselect = charselector.match(selector) + if not charselect: + outmess( + 'cracktypespec: no charselector pattern found for %s\n' % (repr(selector))) + return + charselect = charselect.groupdict() + charselect['*'] = charselect['charlen'] + del charselect['charlen'] + if charselect['lenkind']: + lenkind = lenkindpattern.match( + markoutercomma(charselect['lenkind'])) + lenkind = lenkind.groupdict() + for lk in ['len', 'kind']: + if lenkind[lk + '2']: + lenkind[lk] = lenkind[lk + '2'] + charselect[lk] = lenkind[lk] + del lenkind[lk + '2'] + del charselect['lenkind'] + for k in list(charselect.keys()): + if not charselect[k]: + del charselect[k] + for k, i in list(charselect.items()): + charselect[k] = rmbadname1(i) + elif typespec == 'type': + typename = re.match(r'\s*\(\s*(?P\w+)\s*\)', selector, re.I) + if typename: + typename = typename.group('name') + else: + outmess('cracktypespec: no typename found in %s\n' % + (repr(typespec + selector))) + else: + outmess('cracktypespec: no selector used for %s\n' % + (repr(selector))) + return kindselect, charselect, typename +###### + + +def setattrspec(decl, attr, force=0): + if not decl: + decl = {} + if not attr: + return decl + if 'attrspec' not in decl: + decl['attrspec'] = [attr] + return decl + if force: + decl['attrspec'].append(attr) + if attr in decl['attrspec']: + return decl + if attr == 'static' and 'automatic' not in decl['attrspec']: + decl['attrspec'].append(attr) + elif attr == 'automatic' and 'static' not in decl['attrspec']: + decl['attrspec'].append(attr) + elif attr == 'public' and 'private' not in decl['attrspec']: + decl['attrspec'].append(attr) + elif attr == 'private' and 'public' not in decl['attrspec']: + decl['attrspec'].append(attr) + else: + decl['attrspec'].append(attr) + return decl + + +def setkindselector(decl, sel, force=0): + if not decl: + decl = {} + if not sel: + return decl + if 'kindselector' not in decl: + decl['kindselector'] = sel + return decl + for k in list(sel.keys()): + if force or k not in decl['kindselector']: + decl['kindselector'][k] = sel[k] + return decl + + +def setcharselector(decl, sel, force=0): + if not decl: + decl = {} + if not sel: + return decl + if 'charselector' not in decl: + decl['charselector'] = sel + return decl + for k in list(sel.keys()): + if force or k not in decl['charselector']: + decl['charselector'][k] = sel[k] + return decl + + +def getblockname(block, unknown='unknown'): + if 'name' in block: + return block['name'] + return unknown + +# post processing + + +def setmesstext(block): + global filepositiontext + + try: + filepositiontext = 'In: %s:%s\n' % (block['from'], block['name']) + except Exception: + pass + + +def get_usedict(block): + usedict = {} + if 'parent_block' in block: + usedict = get_usedict(block['parent_block']) + if 'use' in block: + usedict.update(block['use']) + return usedict + + +def get_useparameters(block, param_map=None): + global f90modulevars + + if param_map is None: + param_map = {} + usedict = get_usedict(block) + if not usedict: + return param_map + for usename, mapping in list(usedict.items()): + usename = usename.lower() + if usename not in f90modulevars: + outmess('get_useparameters: no module %s info used by %s\n' % + (usename, block.get('name'))) + continue + mvars = f90modulevars[usename] + params = get_parameters(mvars) + if not params: + continue + # XXX: apply mapping + if mapping: + errmess('get_useparameters: mapping for %s not impl.' % (mapping)) + for k, v in list(params.items()): + if k in param_map: + outmess('get_useparameters: overriding parameter %s with' + ' value from module %s' % (repr(k), repr(usename))) + param_map[k] = v + + return param_map + + +def postcrack2(block, tab='', param_map=None): + global f90modulevars + + if not f90modulevars: + return block + if isinstance(block, list): + ret = [postcrack2(g, tab=tab + '\t', param_map=param_map) + for g in block] + return ret + setmesstext(block) + outmess('%sBlock: %s\n' % (tab, block['name']), 0) + + if param_map is None: + param_map = get_useparameters(block) + + if param_map is not None and 'vars' in block: + vars = block['vars'] + for n in list(vars.keys()): + var = vars[n] + if 'kindselector' in var: + kind = var['kindselector'] + if 'kind' in kind: + val = kind['kind'] + if val in param_map: + kind['kind'] = param_map[val] + new_body = [postcrack2(b, tab=tab + '\t', param_map=param_map) + for b in block['body']] + block['body'] = new_body + + return block + + +def postcrack(block, args=None, tab=''): + """ + TODO: + function return values + determine expression types if in argument list + """ + global usermodules, onlyfunctions + + if isinstance(block, list): + gret = [] + uret = [] + for g in block: + setmesstext(g) + g = postcrack(g, tab=tab + '\t') + # sort user routines to appear first + if 'name' in g and '__user__' in g['name']: + uret.append(g) + else: + gret.append(g) + return uret + gret + setmesstext(block) + if not isinstance(block, dict) and 'block' not in block: + raise Exception('postcrack: Expected block dictionary instead of ' + + str(block)) + if 'name' in block and not block['name'] == 'unknown_interface': + outmess('%sBlock: %s\n' % (tab, block['name']), 0) + block = analyzeargs(block) + block = analyzecommon(block) + block['vars'] = analyzevars(block) + block['sortvars'] = sortvarnames(block['vars']) + if 'args' in block and block['args']: + args = block['args'] + block['body'] = analyzebody(block, args, tab=tab) + + userisdefined = [] + if 'use' in block: + useblock = block['use'] + for k in list(useblock.keys()): + if '__user__' in k: + userisdefined.append(k) + else: + useblock = {} + name = '' + if 'name' in block: + name = block['name'] + # and not userisdefined: # Build a __user__ module + if 'externals' in block and block['externals']: + interfaced = [] + if 'interfaced' in block: + interfaced = block['interfaced'] + mvars = copy.copy(block['vars']) + if name: + mname = name + '__user__routines' + else: + mname = 'unknown__user__routines' + if mname in userisdefined: + i = 1 + while '%s_%i' % (mname, i) in userisdefined: + i = i + 1 + mname = '%s_%i' % (mname, i) + interface = {'block': 'interface', 'body': [], + 'vars': {}, 'name': name + '_user_interface'} + for e in block['externals']: + if e in interfaced: + edef = [] + j = -1 + for b in block['body']: + j = j + 1 + if b['block'] == 'interface': + i = -1 + for bb in b['body']: + i = i + 1 + if 'name' in bb and bb['name'] == e: + edef = copy.copy(bb) + del b['body'][i] + break + if edef: + if not b['body']: + del block['body'][j] + del interfaced[interfaced.index(e)] + break + interface['body'].append(edef) + else: + if e in mvars and not isexternal(mvars[e]): + interface['vars'][e] = mvars[e] + if interface['vars'] or interface['body']: + block['interfaced'] = interfaced + mblock = {'block': 'python module', 'body': [ + interface], 'vars': {}, 'name': mname, 'interfaced': block['externals']} + useblock[mname] = {} + usermodules.append(mblock) + if useblock: + block['use'] = useblock + return block + + +def sortvarnames(vars): + indep = [] + dep = [] + for v in list(vars.keys()): + if 'depend' in vars[v] and vars[v]['depend']: + dep.append(v) + else: + indep.append(v) + n = len(dep) + i = 0 + while dep: # XXX: How to catch dependence cycles correctly? + v = dep[0] + fl = 0 + for w in dep[1:]: + if w in vars[v]['depend']: + fl = 1 + break + if fl: + dep = dep[1:] + [v] + i = i + 1 + if i > n: + errmess('sortvarnames: failed to compute dependencies because' + ' of cyclic dependencies between ' + + ', '.join(dep) + '\n') + indep = indep + dep + break + else: + indep.append(v) + dep = dep[1:] + n = len(dep) + i = 0 + return indep + + +def analyzecommon(block): + if not hascommon(block): + return block + commonvars = [] + for k in list(block['common'].keys()): + comvars = [] + for e in block['common'][k]: + m = re.match( + r'\A\s*\b(?P.*?)\b\s*(\((?P.*?)\)|)\s*\Z', e, re.I) + if m: + dims = [] + if m.group('dims'): + dims = [x.strip() + for x in markoutercomma(m.group('dims')).split('@,@')] + n = rmbadname1(m.group('name').strip()) + if n in block['vars']: + if 'attrspec' in block['vars'][n]: + block['vars'][n]['attrspec'].append( + 'dimension(%s)' % (','.join(dims))) + else: + block['vars'][n]['attrspec'] = [ + 'dimension(%s)' % (','.join(dims))] + else: + if dims: + block['vars'][n] = { + 'attrspec': ['dimension(%s)' % (','.join(dims))]} + else: + block['vars'][n] = {} + if n not in commonvars: + commonvars.append(n) + else: + n = e + errmess( + 'analyzecommon: failed to extract "[()]" from "%s" in common /%s/.\n' % (e, k)) + comvars.append(n) + block['common'][k] = comvars + if 'commonvars' not in block: + block['commonvars'] = commonvars + else: + block['commonvars'] = block['commonvars'] + commonvars + return block + + +def analyzebody(block, args, tab=''): + global usermodules, skipfuncs, onlyfuncs, f90modulevars + + setmesstext(block) + body = [] + for b in block['body']: + b['parent_block'] = block + if b['block'] in ['function', 'subroutine']: + if args is not None and b['name'] not in args: + continue + else: + as_ = b['args'] + if b['name'] in skipfuncs: + continue + if onlyfuncs and b['name'] not in onlyfuncs: + continue + b['saved_interface'] = crack2fortrangen( + b, '\n' + ' ' * 6, as_interface=True) + + else: + as_ = args + b = postcrack(b, as_, tab=tab + '\t') + if b['block'] == 'interface' and not b['body']: + if 'f2pyenhancements' not in b: + continue + if b['block'].replace(' ', '') == 'pythonmodule': + usermodules.append(b) + else: + if b['block'] == 'module': + f90modulevars[b['name']] = b['vars'] + body.append(b) + return body + + +def buildimplicitrules(block): + setmesstext(block) + implicitrules = defaultimplicitrules + attrrules = {} + if 'implicit' in block: + if block['implicit'] is None: + implicitrules = None + if verbose > 1: + outmess( + 'buildimplicitrules: no implicit rules for routine %s.\n' % repr(block['name'])) + else: + for k in list(block['implicit'].keys()): + if block['implicit'][k].get('typespec') not in ['static', 'automatic']: + implicitrules[k] = block['implicit'][k] + else: + attrrules[k] = block['implicit'][k]['typespec'] + return implicitrules, attrrules + + +def myeval(e, g=None, l=None): + r = eval(e, g, l) + if type(r) in [type(0), type(0.0)]: + return r + raise ValueError('r=%r' % (r)) + +getlincoef_re_1 = re.compile(r'\A\b\w+\b\Z', re.I) + + +def getlincoef(e, xset): # e = a*x+b ; x in xset + try: + c = int(myeval(e, {}, {})) + return 0, c, None + except Exception: + pass + if getlincoef_re_1.match(e): + return 1, 0, e + len_e = len(e) + for x in xset: + if len(x) > len_e: + continue + if re.search(r'\w\s*\([^)]*\b' + x + r'\b', e): + # skip function calls having x as an argument, e.g max(1, x) + continue + re_1 = re.compile(r'(?P.*?)\b' + x + r'\b(?P.*)', re.I) + m = re_1.match(e) + if m: + try: + m1 = re_1.match(e) + while m1: + ee = '%s(%s)%s' % ( + m1.group('before'), 0, m1.group('after')) + m1 = re_1.match(ee) + b = myeval(ee, {}, {}) + m1 = re_1.match(e) + while m1: + ee = '%s(%s)%s' % ( + m1.group('before'), 1, m1.group('after')) + m1 = re_1.match(ee) + a = myeval(ee, {}, {}) - b + m1 = re_1.match(e) + while m1: + ee = '%s(%s)%s' % ( + m1.group('before'), 0.5, m1.group('after')) + m1 = re_1.match(ee) + c = myeval(ee, {}, {}) + # computing another point to be sure that expression is linear + m1 = re_1.match(e) + while m1: + ee = '%s(%s)%s' % ( + m1.group('before'), 1.5, m1.group('after')) + m1 = re_1.match(ee) + c2 = myeval(ee, {}, {}) + if (a * 0.5 + b == c and a * 1.5 + b == c2): + return a, b, x + except Exception: + pass + break + return None, None, None + +_varname_match = re.compile(r'\A[a-z]\w*\Z').match + + +def getarrlen(dl, args, star='*'): + edl = [] + try: + edl.append(myeval(dl[0], {}, {})) + except Exception: + edl.append(dl[0]) + try: + edl.append(myeval(dl[1], {}, {})) + except Exception: + edl.append(dl[1]) + if isinstance(edl[0], int): + p1 = 1 - edl[0] + if p1 == 0: + d = str(dl[1]) + elif p1 < 0: + d = '%s-%s' % (dl[1], -p1) + else: + d = '%s+%s' % (dl[1], p1) + elif isinstance(edl[1], int): + p1 = 1 + edl[1] + if p1 == 0: + d = '-(%s)' % (dl[0]) + else: + d = '%s-(%s)' % (p1, dl[0]) + else: + d = '%s-(%s)+1' % (dl[1], dl[0]) + try: + return repr(myeval(d, {}, {})), None, None + except Exception: + pass + d1, d2 = getlincoef(dl[0], args), getlincoef(dl[1], args) + if None not in [d1[0], d2[0]]: + if (d1[0], d2[0]) == (0, 0): + return repr(d2[1] - d1[1] + 1), None, None + b = d2[1] - d1[1] + 1 + d1 = (d1[0], 0, d1[2]) + d2 = (d2[0], b, d2[2]) + if d1[0] == 0 and d2[2] in args: + if b < 0: + return '%s * %s - %s' % (d2[0], d2[2], -b), d2[2], '+%s)/(%s)' % (-b, d2[0]) + elif b: + return '%s * %s + %s' % (d2[0], d2[2], b), d2[2], '-%s)/(%s)' % (b, d2[0]) + else: + return '%s * %s' % (d2[0], d2[2]), d2[2], ')/(%s)' % (d2[0]) + if d2[0] == 0 and d1[2] in args: + + if b < 0: + return '%s * %s - %s' % (-d1[0], d1[2], -b), d1[2], '+%s)/(%s)' % (-b, -d1[0]) + elif b: + return '%s * %s + %s' % (-d1[0], d1[2], b), d1[2], '-%s)/(%s)' % (b, -d1[0]) + else: + return '%s * %s' % (-d1[0], d1[2]), d1[2], ')/(%s)' % (-d1[0]) + if d1[2] == d2[2] and d1[2] in args: + a = d2[0] - d1[0] + if not a: + return repr(b), None, None + if b < 0: + return '%s * %s - %s' % (a, d1[2], -b), d2[2], '+%s)/(%s)' % (-b, a) + elif b: + return '%s * %s + %s' % (a, d1[2], b), d2[2], '-%s)/(%s)' % (b, a) + else: + return '%s * %s' % (a, d1[2]), d2[2], ')/(%s)' % (a) + if d1[0] == d2[0] == 1: + c = str(d1[2]) + if c not in args: + if _varname_match(c): + outmess('\tgetarrlen:variable "%s" undefined\n' % (c)) + c = '(%s)' % c + if b == 0: + d = '%s-%s' % (d2[2], c) + elif b < 0: + d = '%s-%s-%s' % (d2[2], c, -b) + else: + d = '%s-%s+%s' % (d2[2], c, b) + elif d1[0] == 0: + c2 = str(d2[2]) + if c2 not in args: + if _varname_match(c2): + outmess('\tgetarrlen:variable "%s" undefined\n' % (c2)) + c2 = '(%s)' % c2 + if d2[0] == 1: + pass + elif d2[0] == -1: + c2 = '-%s' % c2 + else: + c2 = '%s*%s' % (d2[0], c2) + + if b == 0: + d = c2 + elif b < 0: + d = '%s-%s' % (c2, -b) + else: + d = '%s+%s' % (c2, b) + elif d2[0] == 0: + c1 = str(d1[2]) + if c1 not in args: + if _varname_match(c1): + outmess('\tgetarrlen:variable "%s" undefined\n' % (c1)) + c1 = '(%s)' % c1 + if d1[0] == 1: + c1 = '-%s' % c1 + elif d1[0] == -1: + c1 = '+%s' % c1 + elif d1[0] < 0: + c1 = '+%s*%s' % (-d1[0], c1) + else: + c1 = '-%s*%s' % (d1[0], c1) + + if b == 0: + d = c1 + elif b < 0: + d = '%s-%s' % (c1, -b) + else: + d = '%s+%s' % (c1, b) + else: + c1 = str(d1[2]) + if c1 not in args: + if _varname_match(c1): + outmess('\tgetarrlen:variable "%s" undefined\n' % (c1)) + c1 = '(%s)' % c1 + if d1[0] == 1: + c1 = '-%s' % c1 + elif d1[0] == -1: + c1 = '+%s' % c1 + elif d1[0] < 0: + c1 = '+%s*%s' % (-d1[0], c1) + else: + c1 = '-%s*%s' % (d1[0], c1) + + c2 = str(d2[2]) + if c2 not in args: + if _varname_match(c2): + outmess('\tgetarrlen:variable "%s" undefined\n' % (c2)) + c2 = '(%s)' % c2 + if d2[0] == 1: + pass + elif d2[0] == -1: + c2 = '-%s' % c2 + else: + c2 = '%s*%s' % (d2[0], c2) + + if b == 0: + d = '%s%s' % (c2, c1) + elif b < 0: + d = '%s%s-%s' % (c2, c1, -b) + else: + d = '%s%s+%s' % (c2, c1, b) + return d, None, None + +word_pattern = re.compile(r'\b[a-z][\w$]*\b', re.I) + + +def _get_depend_dict(name, vars, deps): + if name in vars: + words = vars[name].get('depend', []) + + if '=' in vars[name] and not isstring(vars[name]): + for word in word_pattern.findall(vars[name]['=']): + if word not in words and word in vars: + words.append(word) + for word in words[:]: + for w in deps.get(word, []) \ + or _get_depend_dict(word, vars, deps): + if w not in words: + words.append(w) + else: + outmess('_get_depend_dict: no dependence info for %s\n' % (repr(name))) + words = [] + deps[name] = words + return words + + +def _calc_depend_dict(vars): + names = list(vars.keys()) + depend_dict = {} + for n in names: + _get_depend_dict(n, vars, depend_dict) + return depend_dict + + +def get_sorted_names(vars): + """ + """ + depend_dict = _calc_depend_dict(vars) + names = [] + for name in list(depend_dict.keys()): + if not depend_dict[name]: + names.append(name) + del depend_dict[name] + while depend_dict: + for name, lst in list(depend_dict.items()): + new_lst = [n for n in lst if n in depend_dict] + if not new_lst: + names.append(name) + del depend_dict[name] + else: + depend_dict[name] = new_lst + return [name for name in names if name in vars] + + +def _kind_func(string): + # XXX: return something sensible. + if string[0] in "'\"": + string = string[1:-1] + if real16pattern.match(string): + return 8 + elif real8pattern.match(string): + return 4 + return 'kind(' + string + ')' + + +def _selected_int_kind_func(r): + # XXX: This should be processor dependent + m = 10 ** r + if m <= 2 ** 8: + return 1 + if m <= 2 ** 16: + return 2 + if m <= 2 ** 32: + return 4 + if m <= 2 ** 63: + return 8 + if m <= 2 ** 128: + return 16 + return -1 + + +def _selected_real_kind_func(p, r=0, radix=0): + # XXX: This should be processor dependent + # This is only good for 0 <= p <= 20 + if p < 7: + return 4 + if p < 16: + return 8 + machine = platform.machine().lower() + if machine.startswith(('aarch64', 'power', 'ppc', 'riscv', 's390x', 'sparc')): + if p <= 20: + return 16 + else: + if p < 19: + return 10 + elif p <= 20: + return 16 + return -1 + + +def get_parameters(vars, global_params={}): + params = copy.copy(global_params) + g_params = copy.copy(global_params) + for name, func in [('kind', _kind_func), + ('selected_int_kind', _selected_int_kind_func), + ('selected_real_kind', _selected_real_kind_func), ]: + if name not in g_params: + g_params[name] = func + param_names = [] + for n in get_sorted_names(vars): + if 'attrspec' in vars[n] and 'parameter' in vars[n]['attrspec']: + param_names.append(n) + kind_re = re.compile(r'\bkind\s*\(\s*(?P.*)\s*\)', re.I) + selected_int_kind_re = re.compile( + r'\bselected_int_kind\s*\(\s*(?P.*)\s*\)', re.I) + selected_kind_re = re.compile( + r'\bselected_(int|real)_kind\s*\(\s*(?P.*)\s*\)', re.I) + for n in param_names: + if '=' in vars[n]: + v = vars[n]['='] + if islogical(vars[n]): + v = v.lower() + for repl in [ + ('.false.', 'False'), + ('.true.', 'True'), + # TODO: test .eq., .neq., etc replacements. + ]: + v = v.replace(*repl) + v = kind_re.sub(r'kind("\1")', v) + v = selected_int_kind_re.sub(r'selected_int_kind(\1)', v) + + # We need to act according to the data. + # The easy case is if the data has a kind-specifier, + # then we may easily remove those specifiers. + # However, it may be that the user uses other specifiers...(!) + is_replaced = False + if 'kindselector' in vars[n]: + if 'kind' in vars[n]['kindselector']: + orig_v_len = len(v) + v = v.replace('_' + vars[n]['kindselector']['kind'], '') + # Again, this will be true if even a single specifier + # has been replaced, see comment above. + is_replaced = len(v) < orig_v_len + + if not is_replaced: + if not selected_kind_re.match(v): + v_ = v.split('_') + # In case there are additive parameters + if len(v_) > 1: + v = ''.join(v_[:-1]).lower().replace(v_[-1].lower(), '') + + # Currently this will not work for complex numbers. + # There is missing code for extracting a complex number, + # which may be defined in either of these: + # a) (Re, Im) + # b) cmplx(Re, Im) + # c) dcmplx(Re, Im) + # d) cmplx(Re, Im, ) + + if isdouble(vars[n]): + tt = list(v) + for m in real16pattern.finditer(v): + tt[m.start():m.end()] = list( + v[m.start():m.end()].lower().replace('d', 'e')) + v = ''.join(tt) + + elif iscomplex(vars[n]): + # FIXME complex numbers may also have exponents + if v[0] == '(' and v[-1] == ')': + # FIXME, unused l looks like potential bug + l = markoutercomma(v[1:-1]).split('@,@') + + try: + params[n] = eval(v, g_params, params) + except Exception as msg: + params[n] = v + outmess('get_parameters: got "%s" on %s\n' % (msg, repr(v))) + if isstring(vars[n]) and isinstance(params[n], int): + params[n] = chr(params[n]) + nl = n.lower() + if nl != n: + params[nl] = params[n] + else: + print(vars[n]) + outmess( + 'get_parameters:parameter %s does not have value?!\n' % (repr(n))) + return params + + +def _eval_length(length, params): + if length in ['(:)', '(*)', '*']: + return '(*)' + return _eval_scalar(length, params) + +_is_kind_number = re.compile(r'\d+_').match + + +def _eval_scalar(value, params): + if _is_kind_number(value): + value = value.split('_')[0] + try: + value = str(eval(value, {}, params)) + except (NameError, SyntaxError, TypeError): + return value + except Exception as msg: + errmess('"%s" in evaluating %r ' + '(available names: %s)\n' + % (msg, value, list(params.keys()))) + return value + + +def analyzevars(block): + global f90modulevars + + setmesstext(block) + implicitrules, attrrules = buildimplicitrules(block) + vars = copy.copy(block['vars']) + if block['block'] == 'function' and block['name'] not in vars: + vars[block['name']] = {} + if '' in block['vars']: + del vars[''] + if 'attrspec' in block['vars']['']: + gen = block['vars']['']['attrspec'] + for n in list(vars.keys()): + for k in ['public', 'private']: + if k in gen: + vars[n] = setattrspec(vars[n], k) + svars = [] + args = block['args'] + for a in args: + try: + vars[a] + svars.append(a) + except KeyError: + pass + for n in list(vars.keys()): + if n not in args: + svars.append(n) + + params = get_parameters(vars, get_useparameters(block)) + + dep_matches = {} + name_match = re.compile(r'\w[\w\d_$]*').match + for v in list(vars.keys()): + m = name_match(v) + if m: + n = v[m.start():m.end()] + try: + dep_matches[n] + except KeyError: + dep_matches[n] = re.compile(r'.*\b%s\b' % (v), re.I).match + for n in svars: + if n[0] in list(attrrules.keys()): + vars[n] = setattrspec(vars[n], attrrules[n[0]]) + if 'typespec' not in vars[n]: + if not('attrspec' in vars[n] and 'external' in vars[n]['attrspec']): + if implicitrules: + ln0 = n[0].lower() + for k in list(implicitrules[ln0].keys()): + if k == 'typespec' and implicitrules[ln0][k] == 'undefined': + continue + if k not in vars[n]: + vars[n][k] = implicitrules[ln0][k] + elif k == 'attrspec': + for l in implicitrules[ln0][k]: + vars[n] = setattrspec(vars[n], l) + elif n in block['args']: + outmess('analyzevars: typespec of variable %s is not defined in routine %s.\n' % ( + repr(n), block['name'])) + + if 'charselector' in vars[n]: + if 'len' in vars[n]['charselector']: + l = vars[n]['charselector']['len'] + try: + l = str(eval(l, {}, params)) + except Exception: + pass + vars[n]['charselector']['len'] = l + + if 'kindselector' in vars[n]: + if 'kind' in vars[n]['kindselector']: + l = vars[n]['kindselector']['kind'] + try: + l = str(eval(l, {}, params)) + except Exception: + pass + vars[n]['kindselector']['kind'] = l + + savelindims = {} + if 'attrspec' in vars[n]: + attr = vars[n]['attrspec'] + attr.reverse() + vars[n]['attrspec'] = [] + dim, intent, depend, check, note = None, None, None, None, None + for a in attr: + if a[:9] == 'dimension': + dim = (a[9:].strip())[1:-1] + elif a[:6] == 'intent': + intent = (a[6:].strip())[1:-1] + elif a[:6] == 'depend': + depend = (a[6:].strip())[1:-1] + elif a[:5] == 'check': + check = (a[5:].strip())[1:-1] + elif a[:4] == 'note': + note = (a[4:].strip())[1:-1] + else: + vars[n] = setattrspec(vars[n], a) + if intent: + if 'intent' not in vars[n]: + vars[n]['intent'] = [] + for c in [x.strip() for x in markoutercomma(intent).split('@,@')]: + # Remove spaces so that 'in out' becomes 'inout' + tmp = c.replace(' ', '') + if tmp not in vars[n]['intent']: + vars[n]['intent'].append(tmp) + intent = None + if note: + note = note.replace('\\n\\n', '\n\n') + note = note.replace('\\n ', '\n') + if 'note' not in vars[n]: + vars[n]['note'] = [note] + else: + vars[n]['note'].append(note) + note = None + if depend is not None: + if 'depend' not in vars[n]: + vars[n]['depend'] = [] + for c in rmbadname([x.strip() for x in markoutercomma(depend).split('@,@')]): + if c not in vars[n]['depend']: + vars[n]['depend'].append(c) + depend = None + if check is not None: + if 'check' not in vars[n]: + vars[n]['check'] = [] + for c in [x.strip() for x in markoutercomma(check).split('@,@')]: + if c not in vars[n]['check']: + vars[n]['check'].append(c) + check = None + if dim and 'dimension' not in vars[n]: + vars[n]['dimension'] = [] + for d in rmbadname([x.strip() for x in markoutercomma(dim).split('@,@')]): + star = '*' + if d == ':': + star = ':' + if d in params: + d = str(params[d]) + for p in list(params.keys()): + re_1 = re.compile(r'(?P.*?)\b' + p + r'\b(?P.*)', re.I) + m = re_1.match(d) + while m: + d = m.group('before') + \ + str(params[p]) + m.group('after') + m = re_1.match(d) + if d == star: + dl = [star] + else: + dl = markoutercomma(d, ':').split('@:@') + if len(dl) == 2 and '*' in dl: # e.g. dimension(5:*) + dl = ['*'] + d = '*' + if len(dl) == 1 and not dl[0] == star: + dl = ['1', dl[0]] + if len(dl) == 2: + d, v, di = getarrlen(dl, list(block['vars'].keys())) + if d[:4] == '1 * ': + d = d[4:] + if di and di[-4:] == '/(1)': + di = di[:-4] + if v: + savelindims[d] = v, di + vars[n]['dimension'].append(d) + if 'dimension' in vars[n]: + if isintent_c(vars[n]): + shape_macro = 'shape' + else: + shape_macro = 'shape' # 'fshape' + if isstringarray(vars[n]): + if 'charselector' in vars[n]: + d = vars[n]['charselector'] + if '*' in d: + d = d['*'] + errmess('analyzevars: character array "character*%s %s(%s)" is considered as "character %s(%s)"; "intent(c)" is forced.\n' + % (d, n, + ','.join(vars[n]['dimension']), + n, ','.join(vars[n]['dimension'] + [d]))) + vars[n]['dimension'].append(d) + del vars[n]['charselector'] + if 'intent' not in vars[n]: + vars[n]['intent'] = [] + if 'c' not in vars[n]['intent']: + vars[n]['intent'].append('c') + else: + errmess( + "analyzevars: charselector=%r unhandled." % (d)) + if 'check' not in vars[n] and 'args' in block and n in block['args']: + flag = 'depend' not in vars[n] + if flag: + vars[n]['depend'] = [] + vars[n]['check'] = [] + if 'dimension' in vars[n]: + #/----< no check + i = -1 + ni = len(vars[n]['dimension']) + for d in vars[n]['dimension']: + ddeps = [] # dependencies of 'd' + ad = '' + pd = '' + if d not in vars: + if d in savelindims: + pd, ad = '(', savelindims[d][1] + d = savelindims[d][0] + else: + for r in block['args']: + if r not in vars: + continue + if re.match(r'.*?\b' + r + r'\b', d, re.I): + ddeps.append(r) + if d in vars: + if 'attrspec' in vars[d]: + for aa in vars[d]['attrspec']: + if aa[:6] == 'depend': + ddeps += aa[6:].strip()[1:-1].split(',') + if 'depend' in vars[d]: + ddeps = ddeps + vars[d]['depend'] + i = i + 1 + if d in vars and ('depend' not in vars[d]) \ + and ('=' not in vars[d]) and (d not in vars[n]['depend']) \ + and l_or(isintent_in, isintent_inout, isintent_inplace)(vars[n]): + vars[d]['depend'] = [n] + if ni > 1: + vars[d]['='] = '%s%s(%s,%s)%s' % ( + pd, shape_macro, n, i, ad) + else: + vars[d]['='] = '%slen(%s)%s' % (pd, n, ad) + # /---< no check + if 1 and 'check' not in vars[d]: + if ni > 1: + vars[d]['check'] = ['%s%s(%s,%i)%s==%s' + % (pd, shape_macro, n, i, ad, d)] + else: + vars[d]['check'] = [ + '%slen(%s)%s>=%s' % (pd, n, ad, d)] + if 'attrspec' not in vars[d]: + vars[d]['attrspec'] = ['optional'] + if ('optional' not in vars[d]['attrspec']) and\ + ('required' not in vars[d]['attrspec']): + vars[d]['attrspec'].append('optional') + elif d not in ['*', ':']: + #/----< no check + if flag: + if d in vars: + if n not in ddeps: + vars[n]['depend'].append(d) + else: + vars[n]['depend'] = vars[n]['depend'] + ddeps + elif isstring(vars[n]): + length = '1' + if 'charselector' in vars[n]: + if '*' in vars[n]['charselector']: + length = _eval_length(vars[n]['charselector']['*'], + params) + vars[n]['charselector']['*'] = length + elif 'len' in vars[n]['charselector']: + length = _eval_length(vars[n]['charselector']['len'], + params) + del vars[n]['charselector']['len'] + vars[n]['charselector']['*'] = length + + if not vars[n]['check']: + del vars[n]['check'] + if flag and not vars[n]['depend']: + del vars[n]['depend'] + if '=' in vars[n]: + if 'attrspec' not in vars[n]: + vars[n]['attrspec'] = [] + if ('optional' not in vars[n]['attrspec']) and \ + ('required' not in vars[n]['attrspec']): + vars[n]['attrspec'].append('optional') + if 'depend' not in vars[n]: + vars[n]['depend'] = [] + for v, m in list(dep_matches.items()): + if m(vars[n]['=']): + vars[n]['depend'].append(v) + if not vars[n]['depend']: + del vars[n]['depend'] + if isscalar(vars[n]): + vars[n]['='] = _eval_scalar(vars[n]['='], params) + + for n in list(vars.keys()): + if n == block['name']: # n is block name + if 'note' in vars[n]: + block['note'] = vars[n]['note'] + if block['block'] == 'function': + if 'result' in block and block['result'] in vars: + vars[n] = appenddecl(vars[n], vars[block['result']]) + if 'prefix' in block: + pr = block['prefix'] + ispure = 0 + isrec = 1 + pr1 = pr.replace('pure', '') + ispure = (not pr == pr1) + pr = pr1.replace('recursive', '') + isrec = (not pr == pr1) + m = typespattern[0].match(pr) + if m: + typespec, selector, attr, edecl = cracktypespec0( + m.group('this'), m.group('after')) + kindselect, charselect, typename = cracktypespec( + typespec, selector) + vars[n]['typespec'] = typespec + if kindselect: + if 'kind' in kindselect: + try: + kindselect['kind'] = eval( + kindselect['kind'], {}, params) + except Exception: + pass + vars[n]['kindselector'] = kindselect + if charselect: + vars[n]['charselector'] = charselect + if typename: + vars[n]['typename'] = typename + if ispure: + vars[n] = setattrspec(vars[n], 'pure') + if isrec: + vars[n] = setattrspec(vars[n], 'recursive') + else: + outmess( + 'analyzevars: prefix (%s) were not used\n' % repr(block['prefix'])) + if not block['block'] in ['module', 'pythonmodule', 'python module', 'block data']: + if 'commonvars' in block: + neededvars = copy.copy(block['args'] + block['commonvars']) + else: + neededvars = copy.copy(block['args']) + for n in list(vars.keys()): + if l_or(isintent_callback, isintent_aux)(vars[n]): + neededvars.append(n) + if 'entry' in block: + neededvars.extend(list(block['entry'].keys())) + for k in list(block['entry'].keys()): + for n in block['entry'][k]: + if n not in neededvars: + neededvars.append(n) + if block['block'] == 'function': + if 'result' in block: + neededvars.append(block['result']) + else: + neededvars.append(block['name']) + if block['block'] in ['subroutine', 'function']: + name = block['name'] + if name in vars and 'intent' in vars[name]: + block['intent'] = vars[name]['intent'] + if block['block'] == 'type': + neededvars.extend(list(vars.keys())) + for n in list(vars.keys()): + if n not in neededvars: + del vars[n] + return vars + +analyzeargs_re_1 = re.compile(r'\A[a-z]+[\w$]*\Z', re.I) + + +def expr2name(a, block, args=[]): + orig_a = a + a_is_expr = not analyzeargs_re_1.match(a) + if a_is_expr: # `a` is an expression + implicitrules, attrrules = buildimplicitrules(block) + at = determineexprtype(a, block['vars'], implicitrules) + na = 'e_' + for c in a: + c = c.lower() + if c not in string.ascii_lowercase + string.digits: + c = '_' + na = na + c + if na[-1] == '_': + na = na + 'e' + else: + na = na + '_e' + a = na + while a in block['vars'] or a in block['args']: + a = a + 'r' + if a in args: + k = 1 + while a + str(k) in args: + k = k + 1 + a = a + str(k) + if a_is_expr: + block['vars'][a] = at + else: + if a not in block['vars']: + if orig_a in block['vars']: + block['vars'][a] = block['vars'][orig_a] + else: + block['vars'][a] = {} + if 'externals' in block and orig_a in block['externals'] + block['interfaced']: + block['vars'][a] = setattrspec(block['vars'][a], 'external') + return a + + +def analyzeargs(block): + setmesstext(block) + implicitrules, attrrules = buildimplicitrules(block) + if 'args' not in block: + block['args'] = [] + args = [] + for a in block['args']: + a = expr2name(a, block, args) + args.append(a) + block['args'] = args + if 'entry' in block: + for k, args1 in list(block['entry'].items()): + for a in args1: + if a not in block['vars']: + block['vars'][a] = {} + + for b in block['body']: + if b['name'] in args: + if 'externals' not in block: + block['externals'] = [] + if b['name'] not in block['externals']: + block['externals'].append(b['name']) + if 'result' in block and block['result'] not in block['vars']: + block['vars'][block['result']] = {} + return block + +determineexprtype_re_1 = re.compile(r'\A\(.+?[,].+?\)\Z', re.I) +determineexprtype_re_2 = re.compile(r'\A[+-]?\d+(_(?P[\w]+)|)\Z', re.I) +determineexprtype_re_3 = re.compile( + r'\A[+-]?[\d.]+[\d+\-de.]*(_(?P[\w]+)|)\Z', re.I) +determineexprtype_re_4 = re.compile(r'\A\(.*\)\Z', re.I) +determineexprtype_re_5 = re.compile(r'\A(?P\w+)\s*\(.*?\)\s*\Z', re.I) + + +def _ensure_exprdict(r): + if isinstance(r, int): + return {'typespec': 'integer'} + if isinstance(r, float): + return {'typespec': 'real'} + if isinstance(r, complex): + return {'typespec': 'complex'} + if isinstance(r, dict): + return r + raise AssertionError(repr(r)) + + +def determineexprtype(expr, vars, rules={}): + if expr in vars: + return _ensure_exprdict(vars[expr]) + expr = expr.strip() + if determineexprtype_re_1.match(expr): + return {'typespec': 'complex'} + m = determineexprtype_re_2.match(expr) + if m: + if 'name' in m.groupdict() and m.group('name'): + outmess( + 'determineexprtype: selected kind types not supported (%s)\n' % repr(expr)) + return {'typespec': 'integer'} + m = determineexprtype_re_3.match(expr) + if m: + if 'name' in m.groupdict() and m.group('name'): + outmess( + 'determineexprtype: selected kind types not supported (%s)\n' % repr(expr)) + return {'typespec': 'real'} + for op in ['+', '-', '*', '/']: + for e in [x.strip() for x in markoutercomma(expr, comma=op).split('@' + op + '@')]: + if e in vars: + return _ensure_exprdict(vars[e]) + t = {} + if determineexprtype_re_4.match(expr): # in parenthesis + t = determineexprtype(expr[1:-1], vars, rules) + else: + m = determineexprtype_re_5.match(expr) + if m: + rn = m.group('name') + t = determineexprtype(m.group('name'), vars, rules) + if t and 'attrspec' in t: + del t['attrspec'] + if not t: + if rn[0] in rules: + return _ensure_exprdict(rules[rn[0]]) + if expr[0] in '\'"': + return {'typespec': 'character', 'charselector': {'*': '*'}} + if not t: + outmess( + 'determineexprtype: could not determine expressions (%s) type.\n' % (repr(expr))) + return t + +###### + + +def crack2fortrangen(block, tab='\n', as_interface=False): + global skipfuncs, onlyfuncs + + setmesstext(block) + ret = '' + if isinstance(block, list): + for g in block: + if g and g['block'] in ['function', 'subroutine']: + if g['name'] in skipfuncs: + continue + if onlyfuncs and g['name'] not in onlyfuncs: + continue + ret = ret + crack2fortrangen(g, tab, as_interface=as_interface) + return ret + prefix = '' + name = '' + args = '' + blocktype = block['block'] + if blocktype == 'program': + return '' + argsl = [] + if 'name' in block: + name = block['name'] + if 'args' in block: + vars = block['vars'] + for a in block['args']: + a = expr2name(a, block, argsl) + if not isintent_callback(vars[a]): + argsl.append(a) + if block['block'] == 'function' or argsl: + args = '(%s)' % ','.join(argsl) + f2pyenhancements = '' + if 'f2pyenhancements' in block: + for k in list(block['f2pyenhancements'].keys()): + f2pyenhancements = '%s%s%s %s' % ( + f2pyenhancements, tab + tabchar, k, block['f2pyenhancements'][k]) + intent_lst = block.get('intent', [])[:] + if blocktype == 'function' and 'callback' in intent_lst: + intent_lst.remove('callback') + if intent_lst: + f2pyenhancements = '%s%sintent(%s) %s' %\ + (f2pyenhancements, tab + tabchar, + ','.join(intent_lst), name) + use = '' + if 'use' in block: + use = use2fortran(block['use'], tab + tabchar) + common = '' + if 'common' in block: + common = common2fortran(block['common'], tab + tabchar) + if name == 'unknown_interface': + name = '' + result = '' + if 'result' in block: + result = ' result (%s)' % block['result'] + if block['result'] not in argsl: + argsl.append(block['result']) + body = crack2fortrangen(block['body'], tab + tabchar) + vars = vars2fortran( + block, block['vars'], argsl, tab + tabchar, as_interface=as_interface) + mess = '' + if 'from' in block and not as_interface: + mess = '! in %s' % block['from'] + if 'entry' in block: + entry_stmts = '' + for k, i in list(block['entry'].items()): + entry_stmts = '%s%sentry %s(%s)' \ + % (entry_stmts, tab + tabchar, k, ','.join(i)) + body = body + entry_stmts + if blocktype == 'block data' and name == '_BLOCK_DATA_': + name = '' + ret = '%s%s%s %s%s%s %s%s%s%s%s%s%send %s %s' % ( + tab, prefix, blocktype, name, args, result, mess, f2pyenhancements, use, vars, common, body, tab, blocktype, name) + return ret + + +def common2fortran(common, tab=''): + ret = '' + for k in list(common.keys()): + if k == '_BLNK_': + ret = '%s%scommon %s' % (ret, tab, ','.join(common[k])) + else: + ret = '%s%scommon /%s/ %s' % (ret, tab, k, ','.join(common[k])) + return ret + + +def use2fortran(use, tab=''): + ret = '' + for m in list(use.keys()): + ret = '%s%suse %s,' % (ret, tab, m) + if use[m] == {}: + if ret and ret[-1] == ',': + ret = ret[:-1] + continue + if 'only' in use[m] and use[m]['only']: + ret = '%s only:' % (ret) + if 'map' in use[m] and use[m]['map']: + c = ' ' + for k in list(use[m]['map'].keys()): + if k == use[m]['map'][k]: + ret = '%s%s%s' % (ret, c, k) + c = ',' + else: + ret = '%s%s%s=>%s' % (ret, c, k, use[m]['map'][k]) + c = ',' + if ret and ret[-1] == ',': + ret = ret[:-1] + return ret + + +def true_intent_list(var): + lst = var['intent'] + ret = [] + for intent in lst: + try: + c = eval('isintent_%s(var)' % intent) + except NameError: + c = 0 + if c: + ret.append(intent) + return ret + + +def vars2fortran(block, vars, args, tab='', as_interface=False): + """ + TODO: + public sub + ... + """ + setmesstext(block) + ret = '' + nout = [] + for a in args: + if a in block['vars']: + nout.append(a) + if 'commonvars' in block: + for a in block['commonvars']: + if a in vars: + if a not in nout: + nout.append(a) + else: + errmess( + 'vars2fortran: Confused?!: "%s" is not defined in vars.\n' % a) + if 'varnames' in block: + nout.extend(block['varnames']) + if not as_interface: + for a in list(vars.keys()): + if a not in nout: + nout.append(a) + for a in nout: + if 'depend' in vars[a]: + for d in vars[a]['depend']: + if d in vars and 'depend' in vars[d] and a in vars[d]['depend']: + errmess( + 'vars2fortran: Warning: cross-dependence between variables "%s" and "%s"\n' % (a, d)) + if 'externals' in block and a in block['externals']: + if isintent_callback(vars[a]): + ret = '%s%sintent(callback) %s' % (ret, tab, a) + ret = '%s%sexternal %s' % (ret, tab, a) + if isoptional(vars[a]): + ret = '%s%soptional %s' % (ret, tab, a) + if a in vars and 'typespec' not in vars[a]: + continue + cont = 1 + for b in block['body']: + if a == b['name'] and b['block'] == 'function': + cont = 0 + break + if cont: + continue + if a not in vars: + show(vars) + outmess('vars2fortran: No definition for argument "%s".\n' % a) + continue + if a == block['name'] and not block['block'] == 'function': + continue + if 'typespec' not in vars[a]: + if 'attrspec' in vars[a] and 'external' in vars[a]['attrspec']: + if a in args: + ret = '%s%sexternal %s' % (ret, tab, a) + continue + show(vars[a]) + outmess('vars2fortran: No typespec for argument "%s".\n' % a) + continue + vardef = vars[a]['typespec'] + if vardef == 'type' and 'typename' in vars[a]: + vardef = '%s(%s)' % (vardef, vars[a]['typename']) + selector = {} + if 'kindselector' in vars[a]: + selector = vars[a]['kindselector'] + elif 'charselector' in vars[a]: + selector = vars[a]['charselector'] + if '*' in selector: + if selector['*'] in ['*', ':']: + vardef = '%s*(%s)' % (vardef, selector['*']) + else: + vardef = '%s*%s' % (vardef, selector['*']) + else: + if 'len' in selector: + vardef = '%s(len=%s' % (vardef, selector['len']) + if 'kind' in selector: + vardef = '%s,kind=%s)' % (vardef, selector['kind']) + else: + vardef = '%s)' % (vardef) + elif 'kind' in selector: + vardef = '%s(kind=%s)' % (vardef, selector['kind']) + c = ' ' + if 'attrspec' in vars[a]: + attr = [l for l in vars[a]['attrspec'] + if l not in ['external']] + if attr: + vardef = '%s, %s' % (vardef, ','.join(attr)) + c = ',' + if 'dimension' in vars[a]: + vardef = '%s%sdimension(%s)' % ( + vardef, c, ','.join(vars[a]['dimension'])) + c = ',' + if 'intent' in vars[a]: + lst = true_intent_list(vars[a]) + if lst: + vardef = '%s%sintent(%s)' % (vardef, c, ','.join(lst)) + c = ',' + if 'check' in vars[a]: + vardef = '%s%scheck(%s)' % (vardef, c, ','.join(vars[a]['check'])) + c = ',' + if 'depend' in vars[a]: + vardef = '%s%sdepend(%s)' % ( + vardef, c, ','.join(vars[a]['depend'])) + c = ',' + if '=' in vars[a]: + v = vars[a]['='] + if vars[a]['typespec'] in ['complex', 'double complex']: + try: + v = eval(v) + v = '(%s,%s)' % (v.real, v.imag) + except Exception: + pass + vardef = '%s :: %s=%s' % (vardef, a, v) + else: + vardef = '%s :: %s' % (vardef, a) + ret = '%s%s%s' % (ret, tab, vardef) + return ret +###### + + +def crackfortran(files): + global usermodules + + outmess('Reading fortran codes...\n', 0) + readfortrancode(files, crackline) + outmess('Post-processing...\n', 0) + usermodules = [] + postlist = postcrack(grouplist[0]) + outmess('Post-processing (stage 2)...\n', 0) + postlist = postcrack2(postlist) + return usermodules + postlist + + +def crack2fortran(block): + global f2py_version + + pyf = crack2fortrangen(block) + '\n' + header = """! -*- f90 -*- +! Note: the context of this file is case sensitive. +""" + footer = """ +! This file was auto-generated with f2py (version:%s). +! See http://cens.ioc.ee/projects/f2py2e/ +""" % (f2py_version) + return header + pyf + footer + +if __name__ == "__main__": + files = [] + funcs = [] + f = 1 + f2 = 0 + f3 = 0 + showblocklist = 0 + for l in sys.argv[1:]: + if l == '': + pass + elif l[0] == ':': + f = 0 + elif l == '-quiet': + quiet = 1 + verbose = 0 + elif l == '-verbose': + verbose = 2 + quiet = 0 + elif l == '-fix': + if strictf77: + outmess( + 'Use option -f90 before -fix if Fortran 90 code is in fix form.\n', 0) + skipemptyends = 1 + sourcecodeform = 'fix' + elif l == '-skipemptyends': + skipemptyends = 1 + elif l == '--ignore-contains': + ignorecontains = 1 + elif l == '-f77': + strictf77 = 1 + sourcecodeform = 'fix' + elif l == '-f90': + strictf77 = 0 + sourcecodeform = 'free' + skipemptyends = 1 + elif l == '-h': + f2 = 1 + elif l == '-show': + showblocklist = 1 + elif l == '-m': + f3 = 1 + elif l[0] == '-': + errmess('Unknown option %s\n' % repr(l)) + elif f2: + f2 = 0 + pyffilename = l + elif f3: + f3 = 0 + f77modulename = l + elif f: + try: + open(l).close() + files.append(l) + except IOError as detail: + errmess('IOError: %s\n' % str(detail)) + else: + funcs.append(l) + if not strictf77 and f77modulename and not skipemptyends: + outmess("""\ + Warning: You have specified module name for non Fortran 77 code + that should not need one (expect if you are scanning F90 code + for non module blocks but then you should use flag -skipemptyends + and also be sure that the files do not contain programs without program statement). +""", 0) + + postlist = crackfortran(files) + if pyffilename: + outmess('Writing fortran code to file %s\n' % repr(pyffilename), 0) + pyf = crack2fortran(postlist) + with open(pyffilename, 'w') as f: + f.write(pyf) + if showblocklist: + show(postlist) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/diagnose.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/diagnose.py new file mode 100644 index 0000000000000000000000000000000000000000..0241fed12ffebd6604a8cb1bbc6ead7c42c06c99 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/diagnose.py @@ -0,0 +1,156 @@ +#!/usr/bin/env python +from __future__ import division, absolute_import, print_function + +import os +import sys +import tempfile + + +def run_command(cmd): + print('Running %r:' % (cmd)) + os.system(cmd) + print('------') + + +def run(): + _path = os.getcwd() + os.chdir(tempfile.gettempdir()) + print('------') + print('os.name=%r' % (os.name)) + print('------') + print('sys.platform=%r' % (sys.platform)) + print('------') + print('sys.version:') + print(sys.version) + print('------') + print('sys.prefix:') + print(sys.prefix) + print('------') + print('sys.path=%r' % (':'.join(sys.path))) + print('------') + + try: + import numpy + has_newnumpy = 1 + except ImportError: + print('Failed to import new numpy:', sys.exc_info()[1]) + has_newnumpy = 0 + + try: + from numpy.f2py import f2py2e + has_f2py2e = 1 + except ImportError: + print('Failed to import f2py2e:', sys.exc_info()[1]) + has_f2py2e = 0 + + try: + import numpy.distutils + has_numpy_distutils = 2 + except ImportError: + try: + import numpy_distutils + has_numpy_distutils = 1 + except ImportError: + print('Failed to import numpy_distutils:', sys.exc_info()[1]) + has_numpy_distutils = 0 + + if has_newnumpy: + try: + print('Found new numpy version %r in %s' % + (numpy.__version__, numpy.__file__)) + except Exception as msg: + print('error:', msg) + print('------') + + if has_f2py2e: + try: + print('Found f2py2e version %r in %s' % + (f2py2e.__version__.version, f2py2e.__file__)) + except Exception as msg: + print('error:', msg) + print('------') + + if has_numpy_distutils: + try: + if has_numpy_distutils == 2: + print('Found numpy.distutils version %r in %r' % ( + numpy.distutils.__version__, + numpy.distutils.__file__)) + else: + print('Found numpy_distutils version %r in %r' % ( + numpy_distutils.numpy_distutils_version.numpy_distutils_version, + numpy_distutils.__file__)) + print('------') + except Exception as msg: + print('error:', msg) + print('------') + try: + if has_numpy_distutils == 1: + print( + 'Importing numpy_distutils.command.build_flib ...', end=' ') + import numpy_distutils.command.build_flib as build_flib + print('ok') + print('------') + try: + print( + 'Checking availability of supported Fortran compilers:') + for compiler_class in build_flib.all_compilers: + compiler_class(verbose=1).is_available() + print('------') + except Exception as msg: + print('error:', msg) + print('------') + except Exception as msg: + print( + 'error:', msg, '(ignore it, build_flib is obsolute for numpy.distutils 0.2.2 and up)') + print('------') + try: + if has_numpy_distutils == 2: + print('Importing numpy.distutils.fcompiler ...', end=' ') + import numpy.distutils.fcompiler as fcompiler + else: + print('Importing numpy_distutils.fcompiler ...', end=' ') + import numpy_distutils.fcompiler as fcompiler + print('ok') + print('------') + try: + print('Checking availability of supported Fortran compilers:') + fcompiler.show_fcompilers() + print('------') + except Exception as msg: + print('error:', msg) + print('------') + except Exception as msg: + print('error:', msg) + print('------') + try: + if has_numpy_distutils == 2: + print('Importing numpy.distutils.cpuinfo ...', end=' ') + from numpy.distutils.cpuinfo import cpuinfo + print('ok') + print('------') + else: + try: + print( + 'Importing numpy_distutils.command.cpuinfo ...', end=' ') + from numpy_distutils.command.cpuinfo import cpuinfo + print('ok') + print('------') + except Exception as msg: + print('error:', msg, '(ignore it)') + print('Importing numpy_distutils.cpuinfo ...', end=' ') + from numpy_distutils.cpuinfo import cpuinfo + print('ok') + print('------') + cpu = cpuinfo() + print('CPU information:', end=' ') + for name in dir(cpuinfo): + if name[0] == '_' and name[1] != '_' and getattr(cpu, name[1:])(): + print(name[1:], end=' ') + print('------') + except Exception as msg: + print('error:', msg) + print('------') + os.chdir(_path) +if __name__ == "__main__": + run() diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/f2py2e.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/f2py2e.py new file mode 100644 index 0000000000000000000000000000000000000000..47223151f32fa524a810fda50c176fedf9b78fcd --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/f2py2e.py @@ -0,0 +1,685 @@ +#!/usr/bin/env python +""" + +f2py2e - Fortran to Python C/API generator. 2nd Edition. + See __usage__ below. + +Copyright 1999--2011 Pearu Peterson all rights reserved, +Pearu Peterson +Permission to use, modify, and distribute this software is given under the +terms of the NumPy License. + +NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. +$Date: 2005/05/06 08:31:19 $ +Pearu Peterson + +""" +from __future__ import division, absolute_import, print_function + +import sys +import os +import pprint +import re + +from . import crackfortran +from . import rules +from . import cb_rules +from . import auxfuncs +from . import cfuncs +from . import f90mod_rules +from . import __version__ + +f2py_version = __version__.version +errmess = sys.stderr.write +# outmess=sys.stdout.write +show = pprint.pprint +outmess = auxfuncs.outmess + +try: + from numpy import __version__ as numpy_version +except ImportError: + numpy_version = 'N/A' + +__usage__ = """\ +Usage: + +1) To construct extension module sources: + + f2py [] [[[only:]||[skip:]] \\ + ] \\ + [: ...] + +2) To compile fortran files and build extension modules: + + f2py -c [, , ] + +3) To generate signature files: + + f2py -h ...< same options as in (1) > + +Description: This program generates a Python C/API file (module.c) + that contains wrappers for given fortran functions so that they + can be called from Python. With the -c option the corresponding + extension modules are built. + +Options: + + --2d-numpy Use numpy.f2py tool with NumPy support. [DEFAULT] + --2d-numeric Use f2py2e tool with Numeric support. + --2d-numarray Use f2py2e tool with Numarray support. + --g3-numpy Use 3rd generation f2py from the separate f2py package. + [NOT AVAILABLE YET] + + -h Write signatures of the fortran routines to file + and exit. You can then edit and use it instead + of . If ==stdout then the + signatures are printed to stdout. + Names of fortran routines for which Python C/API + functions will be generated. Default is all that are found + in . + Paths to fortran/signature files that will be scanned for + in order to determine their signatures. + skip: Ignore fortran functions that follow until `:'. + only: Use only fortran functions that follow until `:'. + : Get back to mode. + + -m Name of the module; f2py generates a Python/C API + file module.c or extension module . + Default is 'untitled'. + + --[no-]lower Do [not] lower the cases in . By default, + --lower is assumed with -h key, and --no-lower without -h key. + + --build-dir All f2py generated files are created in . + Default is tempfile.mkdtemp(). + + --overwrite-signature Overwrite existing signature file. + + --[no-]latex-doc Create (or not) module.tex. + Default is --no-latex-doc. + --short-latex Create 'incomplete' LaTeX document (without commands + \\documentclass, \\tableofcontents, and \\begin{document}, + \\end{document}). + + --[no-]rest-doc Create (or not) module.rst. + Default is --no-rest-doc. + + --debug-capi Create C/API code that reports the state of the wrappers + during runtime. Useful for debugging. + + --[no-]wrap-functions Create Fortran subroutine wrappers to Fortran 77 + functions. --wrap-functions is default because it ensures + maximum portability/compiler independence. + + --include-paths ::... Search include files from the given + directories. + + --help-link [..] List system resources found by system_info.py. See also + --link- switch below. [..] is optional list + of resources names. E.g. try 'f2py --help-link lapack_opt'. + + --quiet Run quietly. + --verbose Run with extra verbosity. + -v Print f2py version ID and exit. + + +numpy.distutils options (only effective with -c): + + --fcompiler= Specify Fortran compiler type by vendor + --compiler= Specify C compiler type (as defined by distutils) + + --help-fcompiler List available Fortran compilers and exit + --f77exec= Specify the path to F77 compiler + --f90exec= Specify the path to F90 compiler + --f77flags= Specify F77 compiler flags + --f90flags= Specify F90 compiler flags + --opt= Specify optimization flags + --arch= Specify architecture specific optimization flags + --noopt Compile without optimization + --noarch Compile without arch-dependent optimization + --debug Compile with debugging information + +Extra options (only effective with -c): + + --link- Link extension module with as defined + by numpy.distutils/system_info.py. E.g. to link + with optimized LAPACK libraries (vecLib on MacOSX, + ATLAS elsewhere), use --link-lapack_opt. + See also --help-link switch. + + -L/path/to/lib/ -l + -D -U + -I/path/to/include/ + .o .so .a + + Using the following macros may be required with non-gcc Fortran + compilers: + -DPREPEND_FORTRAN -DNO_APPEND_FORTRAN -DUPPERCASE_FORTRAN + -DUNDERSCORE_G77 + + When using -DF2PY_REPORT_ATEXIT, a performance report of F2PY + interface is printed out at exit (platforms: Linux). + + When using -DF2PY_REPORT_ON_ARRAY_COPY=, a message is + sent to stderr whenever F2PY interface makes a copy of an + array. Integer sets the threshold for array sizes when + a message should be shown. + +Version: %s +numpy Version: %s +Requires: Python 2.3 or higher. +License: NumPy license (see LICENSE.txt in the NumPy source code) +Copyright 1999 - 2011 Pearu Peterson all rights reserved. +http://cens.ioc.ee/projects/f2py2e/""" % (f2py_version, numpy_version) + + +def scaninputline(inputline): + files, skipfuncs, onlyfuncs, debug = [], [], [], [] + f, f2, f3, f5, f6, f7, f8, f9 = 1, 0, 0, 0, 0, 0, 0, 0 + verbose = 1 + dolc = -1 + dolatexdoc = 0 + dorestdoc = 0 + wrapfuncs = 1 + buildpath = '.' + include_paths = [] + signsfile, modulename = None, None + options = {'buildpath': buildpath, + 'coutput': None, + 'f2py_wrapper_output': None} + for l in inputline: + if l == '': + pass + elif l == 'only:': + f = 0 + elif l == 'skip:': + f = -1 + elif l == ':': + f = 1 + elif l[:8] == '--debug-': + debug.append(l[8:]) + elif l == '--lower': + dolc = 1 + elif l == '--build-dir': + f6 = 1 + elif l == '--no-lower': + dolc = 0 + elif l == '--quiet': + verbose = 0 + elif l == '--verbose': + verbose += 1 + elif l == '--latex-doc': + dolatexdoc = 1 + elif l == '--no-latex-doc': + dolatexdoc = 0 + elif l == '--rest-doc': + dorestdoc = 1 + elif l == '--no-rest-doc': + dorestdoc = 0 + elif l == '--wrap-functions': + wrapfuncs = 1 + elif l == '--no-wrap-functions': + wrapfuncs = 0 + elif l == '--short-latex': + options['shortlatex'] = 1 + elif l == '--coutput': + f8 = 1 + elif l == '--f2py-wrapper-output': + f9 = 1 + elif l == '--overwrite-signature': + options['h-overwrite'] = 1 + elif l == '-h': + f2 = 1 + elif l == '-m': + f3 = 1 + elif l[:2] == '-v': + print(f2py_version) + sys.exit() + elif l == '--show-compilers': + f5 = 1 + elif l[:8] == '-include': + cfuncs.outneeds['userincludes'].append(l[9:-1]) + cfuncs.userincludes[l[9:-1]] = '#include ' + l[8:] + elif l[:15] in '--include_paths': + outmess( + 'f2py option --include_paths is deprecated, use --include-paths instead.\n') + f7 = 1 + elif l[:15] in '--include-paths': + f7 = 1 + elif l[0] == '-': + errmess('Unknown option %s\n' % repr(l)) + sys.exit() + elif f2: + f2 = 0 + signsfile = l + elif f3: + f3 = 0 + modulename = l + elif f6: + f6 = 0 + buildpath = l + elif f7: + f7 = 0 + include_paths.extend(l.split(os.pathsep)) + elif f8: + f8 = 0 + options["coutput"] = l + elif f9: + f9 = 0 + options["f2py_wrapper_output"] = l + elif f == 1: + try: + open(l).close() + files.append(l) + except IOError as detail: + errmess('IOError: %s. Skipping file "%s".\n' % + (str(detail), l)) + elif f == -1: + skipfuncs.append(l) + elif f == 0: + onlyfuncs.append(l) + if not f5 and not files and not modulename: + print(__usage__) + sys.exit() + if not os.path.isdir(buildpath): + if not verbose: + outmess('Creating build directory %s' % (buildpath)) + os.mkdir(buildpath) + if signsfile: + signsfile = os.path.join(buildpath, signsfile) + if signsfile and os.path.isfile(signsfile) and 'h-overwrite' not in options: + errmess( + 'Signature file "%s" exists!!! Use --overwrite-signature to overwrite.\n' % (signsfile)) + sys.exit() + + options['debug'] = debug + options['verbose'] = verbose + if dolc == -1 and not signsfile: + options['do-lower'] = 0 + else: + options['do-lower'] = dolc + if modulename: + options['module'] = modulename + if signsfile: + options['signsfile'] = signsfile + if onlyfuncs: + options['onlyfuncs'] = onlyfuncs + if skipfuncs: + options['skipfuncs'] = skipfuncs + options['dolatexdoc'] = dolatexdoc + options['dorestdoc'] = dorestdoc + options['wrapfuncs'] = wrapfuncs + options['buildpath'] = buildpath + options['include_paths'] = include_paths + return files, options + + +def callcrackfortran(files, options): + rules.options = options + crackfortran.debug = options['debug'] + crackfortran.verbose = options['verbose'] + if 'module' in options: + crackfortran.f77modulename = options['module'] + if 'skipfuncs' in options: + crackfortran.skipfuncs = options['skipfuncs'] + if 'onlyfuncs' in options: + crackfortran.onlyfuncs = options['onlyfuncs'] + crackfortran.include_paths[:] = options['include_paths'] + crackfortran.dolowercase = options['do-lower'] + postlist = crackfortran.crackfortran(files) + if 'signsfile' in options: + outmess('Saving signatures to file "%s"\n' % (options['signsfile'])) + pyf = crackfortran.crack2fortran(postlist) + if options['signsfile'][-6:] == 'stdout': + sys.stdout.write(pyf) + else: + f = open(options['signsfile'], 'w') + f.write(pyf) + f.close() + if options["coutput"] is None: + for mod in postlist: + mod["coutput"] = "%smodule.c" % mod["name"] + else: + for mod in postlist: + mod["coutput"] = options["coutput"] + if options["f2py_wrapper_output"] is None: + for mod in postlist: + mod["f2py_wrapper_output"] = "%s-f2pywrappers.f" % mod["name"] + else: + for mod in postlist: + mod["f2py_wrapper_output"] = options["f2py_wrapper_output"] + return postlist + + +def buildmodules(lst): + cfuncs.buildcfuncs() + outmess('Building modules...\n') + modules, mnames, isusedby = [], [], {} + for i in range(len(lst)): + if '__user__' in lst[i]['name']: + cb_rules.buildcallbacks(lst[i]) + else: + if 'use' in lst[i]: + for u in lst[i]['use'].keys(): + if u not in isusedby: + isusedby[u] = [] + isusedby[u].append(lst[i]['name']) + modules.append(lst[i]) + mnames.append(lst[i]['name']) + ret = {} + for i in range(len(mnames)): + if mnames[i] in isusedby: + outmess('\tSkipping module "%s" which is used by %s.\n' % ( + mnames[i], ','.join(['"%s"' % s for s in isusedby[mnames[i]]]))) + else: + um = [] + if 'use' in modules[i]: + for u in modules[i]['use'].keys(): + if u in isusedby and u in mnames: + um.append(modules[mnames.index(u)]) + else: + outmess( + '\tModule "%s" uses nonexisting "%s" which will be ignored.\n' % (mnames[i], u)) + ret[mnames[i]] = {} + dict_append(ret[mnames[i]], rules.buildmodule(modules[i], um)) + return ret + + +def dict_append(d_out, d_in): + for (k, v) in d_in.items(): + if k not in d_out: + d_out[k] = [] + if isinstance(v, list): + d_out[k] = d_out[k] + v + else: + d_out[k].append(v) + + +def run_main(comline_list): + """ + Equivalent to running:: + + f2py + + where ``=string.join(,' ')``, but in Python. Unless + ``-h`` is used, this function returns a dictionary containing + information on generated modules and their dependencies on source + files. For example, the command ``f2py -m scalar scalar.f`` can be + executed from Python as follows + + You cannot build extension modules with this function, that is, + using ``-c`` is not allowed. Use ``compile`` command instead + + Examples + -------- + .. include:: run_main_session.dat + :literal: + + """ + crackfortran.reset_global_f2py_vars() + f2pydir = os.path.dirname(os.path.abspath(cfuncs.__file__)) + fobjhsrc = os.path.join(f2pydir, 'src', 'fortranobject.h') + fobjcsrc = os.path.join(f2pydir, 'src', 'fortranobject.c') + files, options = scaninputline(comline_list) + auxfuncs.options = options + postlist = callcrackfortran(files, options) + isusedby = {} + for i in range(len(postlist)): + if 'use' in postlist[i]: + for u in postlist[i]['use'].keys(): + if u not in isusedby: + isusedby[u] = [] + isusedby[u].append(postlist[i]['name']) + for i in range(len(postlist)): + if postlist[i]['block'] == 'python module' and '__user__' in postlist[i]['name']: + if postlist[i]['name'] in isusedby: + # if not quiet: + outmess('Skipping Makefile build for module "%s" which is used by %s\n' % ( + postlist[i]['name'], ','.join(['"%s"' % s for s in isusedby[postlist[i]['name']]]))) + if 'signsfile' in options: + if options['verbose'] > 1: + outmess( + 'Stopping. Edit the signature file and then run f2py on the signature file: ') + outmess('%s %s\n' % + (os.path.basename(sys.argv[0]), options['signsfile'])) + return + for i in range(len(postlist)): + if postlist[i]['block'] != 'python module': + if 'python module' not in options: + errmess( + 'Tip: If your original code is Fortran source then you must use -m option.\n') + raise TypeError('All blocks must be python module blocks but got %s' % ( + repr(postlist[i]['block']))) + auxfuncs.debugoptions = options['debug'] + f90mod_rules.options = options + auxfuncs.wrapfuncs = options['wrapfuncs'] + + ret = buildmodules(postlist) + + for mn in ret.keys(): + dict_append(ret[mn], {'csrc': fobjcsrc, 'h': fobjhsrc}) + return ret + + +def filter_files(prefix, suffix, files, remove_prefix=None): + """ + Filter files by prefix and suffix. + """ + filtered, rest = [], [] + match = re.compile(prefix + r'.*' + suffix + r'\Z').match + if remove_prefix: + ind = len(prefix) + else: + ind = 0 + for file in [x.strip() for x in files]: + if match(file): + filtered.append(file[ind:]) + else: + rest.append(file) + return filtered, rest + + +def get_prefix(module): + p = os.path.dirname(os.path.dirname(module.__file__)) + return p + + +def run_compile(): + """ + Do it all in one call! + """ + import tempfile + + i = sys.argv.index('-c') + del sys.argv[i] + + remove_build_dir = 0 + try: + i = sys.argv.index('--build-dir') + except ValueError: + i = None + if i is not None: + build_dir = sys.argv[i + 1] + del sys.argv[i + 1] + del sys.argv[i] + else: + remove_build_dir = 1 + build_dir = tempfile.mkdtemp() + + _reg1 = re.compile(r'[-][-]link[-]') + sysinfo_flags = [_m for _m in sys.argv[1:] if _reg1.match(_m)] + sys.argv = [_m for _m in sys.argv if _m not in sysinfo_flags] + if sysinfo_flags: + sysinfo_flags = [f[7:] for f in sysinfo_flags] + + _reg2 = re.compile( + r'[-][-]((no[-]|)(wrap[-]functions|lower)|debug[-]capi|quiet)|[-]include') + f2py_flags = [_m for _m in sys.argv[1:] if _reg2.match(_m)] + sys.argv = [_m for _m in sys.argv if _m not in f2py_flags] + f2py_flags2 = [] + fl = 0 + for a in sys.argv[1:]: + if a in ['only:', 'skip:']: + fl = 1 + elif a == ':': + fl = 0 + if fl or a == ':': + f2py_flags2.append(a) + if f2py_flags2 and f2py_flags2[-1] != ':': + f2py_flags2.append(':') + f2py_flags.extend(f2py_flags2) + + sys.argv = [_m for _m in sys.argv if _m not in f2py_flags2] + _reg3 = re.compile( + r'[-][-]((f(90)?compiler([-]exec|)|compiler)=|help[-]compiler)') + flib_flags = [_m for _m in sys.argv[1:] if _reg3.match(_m)] + sys.argv = [_m for _m in sys.argv if _m not in flib_flags] + _reg4 = re.compile( + r'[-][-]((f(77|90)(flags|exec)|opt|arch)=|(debug|noopt|noarch|help[-]fcompiler))') + fc_flags = [_m for _m in sys.argv[1:] if _reg4.match(_m)] + sys.argv = [_m for _m in sys.argv if _m not in fc_flags] + + if 1: + del_list = [] + for s in flib_flags: + v = '--fcompiler=' + if s[:len(v)] == v: + from numpy.distutils import fcompiler + fcompiler.load_all_fcompiler_classes() + allowed_keys = list(fcompiler.fcompiler_class.keys()) + nv = ov = s[len(v):].lower() + if ov not in allowed_keys: + vmap = {} # XXX + try: + nv = vmap[ov] + except KeyError: + if ov not in vmap.values(): + print('Unknown vendor: "%s"' % (s[len(v):])) + nv = ov + i = flib_flags.index(s) + flib_flags[i] = '--fcompiler=' + nv + continue + for s in del_list: + i = flib_flags.index(s) + del flib_flags[i] + assert len(flib_flags) <= 2, repr(flib_flags) + + _reg5 = re.compile(r'[-][-](verbose)') + setup_flags = [_m for _m in sys.argv[1:] if _reg5.match(_m)] + sys.argv = [_m for _m in sys.argv if _m not in setup_flags] + + if '--quiet' in f2py_flags: + setup_flags.append('--quiet') + + modulename = 'untitled' + sources = sys.argv[1:] + + for optname in ['--include_paths', '--include-paths']: + if optname in sys.argv: + i = sys.argv.index(optname) + f2py_flags.extend(sys.argv[i:i + 2]) + del sys.argv[i + 1], sys.argv[i] + sources = sys.argv[1:] + + if '-m' in sys.argv: + i = sys.argv.index('-m') + modulename = sys.argv[i + 1] + del sys.argv[i + 1], sys.argv[i] + sources = sys.argv[1:] + else: + from numpy.distutils.command.build_src import get_f2py_modulename + pyf_files, sources = filter_files('', '[.]pyf([.]src|)', sources) + sources = pyf_files + sources + for f in pyf_files: + modulename = get_f2py_modulename(f) + if modulename: + break + + extra_objects, sources = filter_files('', '[.](o|a|so)', sources) + include_dirs, sources = filter_files('-I', '', sources, remove_prefix=1) + library_dirs, sources = filter_files('-L', '', sources, remove_prefix=1) + libraries, sources = filter_files('-l', '', sources, remove_prefix=1) + undef_macros, sources = filter_files('-U', '', sources, remove_prefix=1) + define_macros, sources = filter_files('-D', '', sources, remove_prefix=1) + for i in range(len(define_macros)): + name_value = define_macros[i].split('=', 1) + if len(name_value) == 1: + name_value.append(None) + if len(name_value) == 2: + define_macros[i] = tuple(name_value) + else: + print('Invalid use of -D:', name_value) + + from numpy.distutils.system_info import get_info + + num_info = {} + if num_info: + include_dirs.extend(num_info.get('include_dirs', [])) + + from numpy.distutils.core import setup, Extension + ext_args = {'name': modulename, 'sources': sources, + 'include_dirs': include_dirs, + 'library_dirs': library_dirs, + 'libraries': libraries, + 'define_macros': define_macros, + 'undef_macros': undef_macros, + 'extra_objects': extra_objects, + 'f2py_options': f2py_flags, + } + + if sysinfo_flags: + from numpy.distutils.misc_util import dict_append + for n in sysinfo_flags: + i = get_info(n) + if not i: + outmess('No %s resources found in system' + ' (try `f2py --help-link`)\n' % (repr(n))) + dict_append(ext_args, **i) + + ext = Extension(**ext_args) + sys.argv = [sys.argv[0]] + setup_flags + sys.argv.extend(['build', + '--build-temp', build_dir, + '--build-base', build_dir, + '--build-platlib', '.']) + if fc_flags: + sys.argv.extend(['config_fc'] + fc_flags) + if flib_flags: + sys.argv.extend(['build_ext'] + flib_flags) + + setup(ext_modules=[ext]) + + if remove_build_dir and os.path.exists(build_dir): + import shutil + outmess('Removing build directory %s\n' % (build_dir)) + shutil.rmtree(build_dir) + + +def main(): + if '--help-link' in sys.argv[1:]: + sys.argv.remove('--help-link') + from numpy.distutils.system_info import show_all + show_all() + return + + # Probably outdated options that were not working before 1.16 + if '--g3-numpy' in sys.argv[1:]: + sys.stderr.write("G3 f2py support is not implemented, yet.\\n") + sys.exit(1) + elif '--2e-numeric' in sys.argv[1:]: + sys.argv.remove('--2e-numeric') + elif '--2e-numarray' in sys.argv[1:]: + # Note that this errors becaust the -DNUMARRAY argument is + # not recognized. Just here for back compatibility and the + # error message. + sys.argv.append("-DNUMARRAY") + sys.argv.remove('--2e-numarray') + elif '--2e-numpy' in sys.argv[1:]: + sys.argv.remove('--2e-numpy') + else: + pass + + if '-c' in sys.argv[1:]: + run_compile() + else: + run_main(sys.argv[1:]) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/f2py_testing.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/f2py_testing.py new file mode 100644 index 0000000000000000000000000000000000000000..f5d5fa63d03f0d5d99b285b7d0081f76d31ad4a2 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/f2py_testing.py @@ -0,0 +1,48 @@ +from __future__ import division, absolute_import, print_function + +import sys +import re + +from numpy.testing import jiffies, memusage + + +def cmdline(): + m = re.compile(r'\A\d+\Z') + args = [] + repeat = 1 + for a in sys.argv[1:]: + if m.match(a): + repeat = eval(a) + else: + args.append(a) + f2py_opts = ' '.join(args) + return repeat, f2py_opts + + +def run(runtest, test_functions, repeat=1): + l = [(t, repr(t.__doc__.split('\n')[1].strip())) for t in test_functions] + start_memusage = memusage() + diff_memusage = None + start_jiffies = jiffies() + i = 0 + while i < repeat: + i += 1 + for t, fname in l: + runtest(t) + if start_memusage is None: + continue + if diff_memusage is None: + diff_memusage = memusage() - start_memusage + else: + diff_memusage2 = memusage() - start_memusage + if diff_memusage2 != diff_memusage: + print('memory usage change at step %i:' % i, + diff_memusage2 - diff_memusage, + fname) + diff_memusage = diff_memusage2 + current_memusage = memusage() + print('run', repeat * len(test_functions), 'tests', + 'in %.2f seconds' % ((jiffies() - start_jiffies) / 100.0)) + if start_memusage: + print('initial virtual memory size:', start_memusage, 'bytes') + print('current virtual memory size:', current_memusage, 'bytes') diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/f90mod_rules.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/f90mod_rules.py new file mode 100644 index 0000000000000000000000000000000000000000..85eae80479285e0ac1f3509d709997ff7ce7c261 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/f90mod_rules.py @@ -0,0 +1,272 @@ +#!/usr/bin/env python +""" + +Build F90 module support for f2py2e. + +Copyright 2000 Pearu Peterson all rights reserved, +Pearu Peterson +Permission to use, modify, and distribute this software is given under the +terms of the NumPy License. + +NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. +$Date: 2005/02/03 19:30:23 $ +Pearu Peterson + +""" +from __future__ import division, absolute_import, print_function + +__version__ = "$Revision: 1.27 $"[10:-1] + +f2py_version = 'See `f2py -v`' + +import numpy as np + +from . import capi_maps +from . import func2subr +from .crackfortran import undo_rmbadname, undo_rmbadname1 + +# The eviroment provided by auxfuncs.py is needed for some calls to eval. +# As the needed functions cannot be determined by static inspection of the +# code, it is safest to use import * pending a major refactoring of f2py. +from .auxfuncs import * + +options = {} + + +def findf90modules(m): + if ismodule(m): + return [m] + if not hasbody(m): + return [] + ret = [] + for b in m['body']: + if ismodule(b): + ret.append(b) + else: + ret = ret + findf90modules(b) + return ret + +fgetdims1 = """\ + external f2pysetdata + logical ns + integer r,i + integer(%d) s(*) + ns = .FALSE. + if (allocated(d)) then + do i=1,r + if ((size(d,i).ne.s(i)).and.(s(i).ge.0)) then + ns = .TRUE. + end if + end do + if (ns) then + deallocate(d) + end if + end if + if ((.not.allocated(d)).and.(s(1).ge.1)) then""" % np.intp().itemsize + +fgetdims2 = """\ + end if + if (allocated(d)) then + do i=1,r + s(i) = size(d,i) + end do + end if + flag = 1 + call f2pysetdata(d,allocated(d))""" + +fgetdims2_sa = """\ + end if + if (allocated(d)) then + do i=1,r + s(i) = size(d,i) + end do + !s(r) must be equal to len(d(1)) + end if + flag = 2 + call f2pysetdata(d,allocated(d))""" + + +def buildhooks(pymod): + global fgetdims1, fgetdims2 + from . import rules + ret = {'f90modhooks': [], 'initf90modhooks': [], 'body': [], + 'need': ['F_FUNC', 'arrayobject.h'], + 'separatorsfor': {'includes0': '\n', 'includes': '\n'}, + 'docs': ['"Fortran 90/95 modules:\\n"'], + 'latexdoc': []} + fhooks = [''] + + def fadd(line, s=fhooks): + s[0] = '%s\n %s' % (s[0], line) + doc = [''] + + def dadd(line, s=doc): + s[0] = '%s\n%s' % (s[0], line) + for m in findf90modules(pymod): + sargs, fargs, efargs, modobjs, notvars, onlyvars = [], [], [], [], [ + m['name']], [] + sargsp = [] + ifargs = [] + mfargs = [] + if hasbody(m): + for b in m['body']: + notvars.append(b['name']) + for n in m['vars'].keys(): + var = m['vars'][n] + if (n not in notvars) and (not l_or(isintent_hide, isprivate)(var)): + onlyvars.append(n) + mfargs.append(n) + outmess('\t\tConstructing F90 module support for "%s"...\n' % + (m['name'])) + if onlyvars: + outmess('\t\t Variables: %s\n' % (' '.join(onlyvars))) + chooks = [''] + + def cadd(line, s=chooks): + s[0] = '%s\n%s' % (s[0], line) + ihooks = [''] + + def iadd(line, s=ihooks): + s[0] = '%s\n%s' % (s[0], line) + + vrd = capi_maps.modsign2map(m) + cadd('static FortranDataDef f2py_%s_def[] = {' % (m['name'])) + dadd('\\subsection{Fortran 90/95 module \\texttt{%s}}\n' % (m['name'])) + if hasnote(m): + note = m['note'] + if isinstance(note, list): + note = '\n'.join(note) + dadd(note) + if onlyvars: + dadd('\\begin{description}') + for n in onlyvars: + var = m['vars'][n] + modobjs.append(n) + ct = capi_maps.getctype(var) + at = capi_maps.c2capi_map[ct] + dm = capi_maps.getarrdims(n, var) + dms = dm['dims'].replace('*', '-1').strip() + dms = dms.replace(':', '-1').strip() + if not dms: + dms = '-1' + use_fgetdims2 = fgetdims2 + if isstringarray(var): + if 'charselector' in var and 'len' in var['charselector']: + cadd('\t{"%s",%s,{{%s,%s}},%s},' + % (undo_rmbadname1(n), dm['rank'], dms, var['charselector']['len'], at)) + use_fgetdims2 = fgetdims2_sa + else: + cadd('\t{"%s",%s,{{%s}},%s},' % + (undo_rmbadname1(n), dm['rank'], dms, at)) + else: + cadd('\t{"%s",%s,{{%s}},%s},' % + (undo_rmbadname1(n), dm['rank'], dms, at)) + dadd('\\item[]{{}\\verb@%s@{}}' % + (capi_maps.getarrdocsign(n, var))) + if hasnote(var): + note = var['note'] + if isinstance(note, list): + note = '\n'.join(note) + dadd('--- %s' % (note)) + if isallocatable(var): + fargs.append('f2py_%s_getdims_%s' % (m['name'], n)) + efargs.append(fargs[-1]) + sargs.append( + 'void (*%s)(int*,int*,void(*)(char*,int*),int*)' % (n)) + sargsp.append('void (*)(int*,int*,void(*)(char*,int*),int*)') + iadd('\tf2py_%s_def[i_f2py++].func = %s;' % (m['name'], n)) + fadd('subroutine %s(r,s,f2pysetdata,flag)' % (fargs[-1])) + fadd('use %s, only: d => %s\n' % + (m['name'], undo_rmbadname1(n))) + fadd('integer flag\n') + fhooks[0] = fhooks[0] + fgetdims1 + dms = eval('range(1,%s+1)' % (dm['rank'])) + fadd(' allocate(d(%s))\n' % + (','.join(['s(%s)' % i for i in dms]))) + fhooks[0] = fhooks[0] + use_fgetdims2 + fadd('end subroutine %s' % (fargs[-1])) + else: + fargs.append(n) + sargs.append('char *%s' % (n)) + sargsp.append('char*') + iadd('\tf2py_%s_def[i_f2py++].data = %s;' % (m['name'], n)) + if onlyvars: + dadd('\\end{description}') + if hasbody(m): + for b in m['body']: + if not isroutine(b): + print('Skipping', b['block'], b['name']) + continue + modobjs.append('%s()' % (b['name'])) + b['modulename'] = m['name'] + api, wrap = rules.buildapi(b) + if isfunction(b): + fhooks[0] = fhooks[0] + wrap + fargs.append('f2pywrap_%s_%s' % (m['name'], b['name'])) + ifargs.append(func2subr.createfuncwrapper(b, signature=1)) + else: + if wrap: + fhooks[0] = fhooks[0] + wrap + fargs.append('f2pywrap_%s_%s' % (m['name'], b['name'])) + ifargs.append( + func2subr.createsubrwrapper(b, signature=1)) + else: + fargs.append(b['name']) + mfargs.append(fargs[-1]) + api['externroutines'] = [] + ar = applyrules(api, vrd) + ar['docs'] = [] + ar['docshort'] = [] + ret = dictappend(ret, ar) + cadd('\t{"%s",-1,{{-1}},0,NULL,(void *)f2py_rout_#modulename#_%s_%s,doc_f2py_rout_#modulename#_%s_%s},' % + (b['name'], m['name'], b['name'], m['name'], b['name'])) + sargs.append('char *%s' % (b['name'])) + sargsp.append('char *') + iadd('\tf2py_%s_def[i_f2py++].data = %s;' % + (m['name'], b['name'])) + cadd('\t{NULL}\n};\n') + iadd('}') + ihooks[0] = 'static void f2py_setup_%s(%s) {\n\tint i_f2py=0;%s' % ( + m['name'], ','.join(sargs), ihooks[0]) + if '_' in m['name']: + F_FUNC = 'F_FUNC_US' + else: + F_FUNC = 'F_FUNC' + iadd('extern void %s(f2pyinit%s,F2PYINIT%s)(void (*)(%s));' + % (F_FUNC, m['name'], m['name'].upper(), ','.join(sargsp))) + iadd('static void f2py_init_%s(void) {' % (m['name'])) + iadd('\t%s(f2pyinit%s,F2PYINIT%s)(f2py_setup_%s);' + % (F_FUNC, m['name'], m['name'].upper(), m['name'])) + iadd('}\n') + ret['f90modhooks'] = ret['f90modhooks'] + chooks + ihooks + ret['initf90modhooks'] = ['\tPyDict_SetItemString(d, "%s", PyFortranObject_New(f2py_%s_def,f2py_init_%s));' % ( + m['name'], m['name'], m['name'])] + ret['initf90modhooks'] + fadd('') + fadd('subroutine f2pyinit%s(f2pysetupfunc)' % (m['name'])) + if mfargs: + for a in undo_rmbadname(mfargs): + fadd('use %s, only : %s' % (m['name'], a)) + if ifargs: + fadd(' '.join(['interface'] + ifargs)) + fadd('end interface') + fadd('external f2pysetupfunc') + if efargs: + for a in undo_rmbadname(efargs): + fadd('external %s' % (a)) + fadd('call f2pysetupfunc(%s)' % (','.join(undo_rmbadname(fargs)))) + fadd('end subroutine f2pyinit%s\n' % (m['name'])) + + dadd('\n'.join(ret['latexdoc']).replace( + r'\subsection{', r'\subsubsection{')) + + ret['latexdoc'] = [] + ret['docs'].append('"\t%s --- %s"' % (m['name'], + ','.join(undo_rmbadname(modobjs)))) + + ret['routine_defs'] = '' + ret['doc'] = [] + ret['docshort'] = [] + ret['latexdoc'] = doc[0] + if len(ret['docs']) <= 1: + ret['docs'] = '' + return ret, fhooks[0] diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/func2subr.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/func2subr.py new file mode 100644 index 0000000000000000000000000000000000000000..6010d5a231af4c4fc6ddc64fc48eeb51e4c81d1c --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/func2subr.py @@ -0,0 +1,299 @@ +#!/usr/bin/env python +""" + +Rules for building C/API module with f2py2e. + +Copyright 1999,2000 Pearu Peterson all rights reserved, +Pearu Peterson +Permission to use, modify, and distribute this software is given under the +terms of the NumPy License. + +NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. +$Date: 2004/11/26 11:13:06 $ +Pearu Peterson + +""" +from __future__ import division, absolute_import, print_function + +__version__ = "$Revision: 1.16 $"[10:-1] + +f2py_version = 'See `f2py -v`' + +import copy + +from .auxfuncs import ( + getfortranname, isexternal, isfunction, isfunction_wrap, isintent_in, + isintent_out, islogicalfunction, ismoduleroutine, isscalar, + issubroutine, issubroutine_wrap, outmess, show +) + + +def var2fixfortran(vars, a, fa=None, f90mode=None): + if fa is None: + fa = a + if a not in vars: + show(vars) + outmess('var2fixfortran: No definition for argument "%s".\n' % a) + return '' + if 'typespec' not in vars[a]: + show(vars[a]) + outmess('var2fixfortran: No typespec for argument "%s".\n' % a) + return '' + vardef = vars[a]['typespec'] + if vardef == 'type' and 'typename' in vars[a]: + vardef = '%s(%s)' % (vardef, vars[a]['typename']) + selector = {} + lk = '' + if 'kindselector' in vars[a]: + selector = vars[a]['kindselector'] + lk = 'kind' + elif 'charselector' in vars[a]: + selector = vars[a]['charselector'] + lk = 'len' + if '*' in selector: + if f90mode: + if selector['*'] in ['*', ':', '(*)']: + vardef = '%s(len=*)' % (vardef) + else: + vardef = '%s(%s=%s)' % (vardef, lk, selector['*']) + else: + if selector['*'] in ['*', ':']: + vardef = '%s*(%s)' % (vardef, selector['*']) + else: + vardef = '%s*%s' % (vardef, selector['*']) + else: + if 'len' in selector: + vardef = '%s(len=%s' % (vardef, selector['len']) + if 'kind' in selector: + vardef = '%s,kind=%s)' % (vardef, selector['kind']) + else: + vardef = '%s)' % (vardef) + elif 'kind' in selector: + vardef = '%s(kind=%s)' % (vardef, selector['kind']) + + vardef = '%s %s' % (vardef, fa) + if 'dimension' in vars[a]: + vardef = '%s(%s)' % (vardef, ','.join(vars[a]['dimension'])) + return vardef + + +def createfuncwrapper(rout, signature=0): + assert isfunction(rout) + + extra_args = [] + vars = rout['vars'] + for a in rout['args']: + v = rout['vars'][a] + for i, d in enumerate(v.get('dimension', [])): + if d == ':': + dn = 'f2py_%s_d%s' % (a, i) + dv = dict(typespec='integer', intent=['hide']) + dv['='] = 'shape(%s, %s)' % (a, i) + extra_args.append(dn) + vars[dn] = dv + v['dimension'][i] = dn + rout['args'].extend(extra_args) + need_interface = bool(extra_args) + + ret = [''] + + def add(line, ret=ret): + ret[0] = '%s\n %s' % (ret[0], line) + name = rout['name'] + fortranname = getfortranname(rout) + f90mode = ismoduleroutine(rout) + newname = '%sf2pywrap' % (name) + + if newname not in vars: + vars[newname] = vars[name] + args = [newname] + rout['args'][1:] + else: + args = [newname] + rout['args'] + + l = var2fixfortran(vars, name, newname, f90mode) + if l[:13] == 'character*(*)': + if f90mode: + l = 'character(len=10)' + l[13:] + else: + l = 'character*10' + l[13:] + charselect = vars[name]['charselector'] + if charselect.get('*', '') == '(*)': + charselect['*'] = '10' + sargs = ', '.join(args) + if f90mode: + add('subroutine f2pywrap_%s_%s (%s)' % + (rout['modulename'], name, sargs)) + if not signature: + add('use %s, only : %s' % (rout['modulename'], fortranname)) + else: + add('subroutine f2pywrap%s (%s)' % (name, sargs)) + if not need_interface: + add('external %s' % (fortranname)) + l = l + ', ' + fortranname + if need_interface: + for line in rout['saved_interface'].split('\n'): + if line.lstrip().startswith('use '): + add(line) + + args = args[1:] + dumped_args = [] + for a in args: + if isexternal(vars[a]): + add('external %s' % (a)) + dumped_args.append(a) + for a in args: + if a in dumped_args: + continue + if isscalar(vars[a]): + add(var2fixfortran(vars, a, f90mode=f90mode)) + dumped_args.append(a) + for a in args: + if a in dumped_args: + continue + if isintent_in(vars[a]): + add(var2fixfortran(vars, a, f90mode=f90mode)) + dumped_args.append(a) + for a in args: + if a in dumped_args: + continue + add(var2fixfortran(vars, a, f90mode=f90mode)) + + add(l) + + if need_interface: + if f90mode: + # f90 module already defines needed interface + pass + else: + add('interface') + add(rout['saved_interface'].lstrip()) + add('end interface') + + sargs = ', '.join([a for a in args if a not in extra_args]) + + if not signature: + if islogicalfunction(rout): + add('%s = .not.(.not.%s(%s))' % (newname, fortranname, sargs)) + else: + add('%s = %s(%s)' % (newname, fortranname, sargs)) + if f90mode: + add('end subroutine f2pywrap_%s_%s' % (rout['modulename'], name)) + else: + add('end') + return ret[0] + + +def createsubrwrapper(rout, signature=0): + assert issubroutine(rout) + + extra_args = [] + vars = rout['vars'] + for a in rout['args']: + v = rout['vars'][a] + for i, d in enumerate(v.get('dimension', [])): + if d == ':': + dn = 'f2py_%s_d%s' % (a, i) + dv = dict(typespec='integer', intent=['hide']) + dv['='] = 'shape(%s, %s)' % (a, i) + extra_args.append(dn) + vars[dn] = dv + v['dimension'][i] = dn + rout['args'].extend(extra_args) + need_interface = bool(extra_args) + + ret = [''] + + def add(line, ret=ret): + ret[0] = '%s\n %s' % (ret[0], line) + name = rout['name'] + fortranname = getfortranname(rout) + f90mode = ismoduleroutine(rout) + + args = rout['args'] + + sargs = ', '.join(args) + if f90mode: + add('subroutine f2pywrap_%s_%s (%s)' % + (rout['modulename'], name, sargs)) + if not signature: + add('use %s, only : %s' % (rout['modulename'], fortranname)) + else: + add('subroutine f2pywrap%s (%s)' % (name, sargs)) + if not need_interface: + add('external %s' % (fortranname)) + + if need_interface: + for line in rout['saved_interface'].split('\n'): + if line.lstrip().startswith('use '): + add(line) + + dumped_args = [] + for a in args: + if isexternal(vars[a]): + add('external %s' % (a)) + dumped_args.append(a) + for a in args: + if a in dumped_args: + continue + if isscalar(vars[a]): + add(var2fixfortran(vars, a, f90mode=f90mode)) + dumped_args.append(a) + for a in args: + if a in dumped_args: + continue + add(var2fixfortran(vars, a, f90mode=f90mode)) + + if need_interface: + if f90mode: + # f90 module already defines needed interface + pass + else: + add('interface') + add(rout['saved_interface'].lstrip()) + add('end interface') + + sargs = ', '.join([a for a in args if a not in extra_args]) + + if not signature: + add('call %s(%s)' % (fortranname, sargs)) + if f90mode: + add('end subroutine f2pywrap_%s_%s' % (rout['modulename'], name)) + else: + add('end') + return ret[0] + + +def assubr(rout): + if isfunction_wrap(rout): + fortranname = getfortranname(rout) + name = rout['name'] + outmess('\t\tCreating wrapper for Fortran function "%s"("%s")...\n' % ( + name, fortranname)) + rout = copy.copy(rout) + fname = name + rname = fname + if 'result' in rout: + rname = rout['result'] + rout['vars'][fname] = rout['vars'][rname] + fvar = rout['vars'][fname] + if not isintent_out(fvar): + if 'intent' not in fvar: + fvar['intent'] = [] + fvar['intent'].append('out') + flag = 1 + for i in fvar['intent']: + if i.startswith('out='): + flag = 0 + break + if flag: + fvar['intent'].append('out=%s' % (rname)) + rout['args'][:] = [fname] + rout['args'] + return rout, createfuncwrapper(rout) + if issubroutine_wrap(rout): + fortranname = getfortranname(rout) + name = rout['name'] + outmess('\t\tCreating wrapper for Fortran subroutine "%s"("%s")...\n' % ( + name, fortranname)) + rout = copy.copy(rout) + return rout, createsubrwrapper(rout) + return rout, '' diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/info.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/info.py new file mode 100644 index 0000000000000000000000000000000000000000..c895c5de28d0bf93c6bf1331b569cc55ddf248e8 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/info.py @@ -0,0 +1,6 @@ +"""Fortran to Python Interface Generator. + +""" +from __future__ import division, absolute_import, print_function + +postpone_import = True diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/rules.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/rules.py new file mode 100644 index 0000000000000000000000000000000000000000..23d36b2c216163ffd04f81e189798c2b38df032f --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/rules.py @@ -0,0 +1,1473 @@ +#!/usr/bin/env python +""" + +Rules for building C/API module with f2py2e. + +Here is a skeleton of a new wrapper function (13Dec2001): + +wrapper_function(args) + declarations + get_python_arguments, say, `a' and `b' + + get_a_from_python + if (successful) { + + get_b_from_python + if (successful) { + + callfortran + if (successful) { + + put_a_to_python + if (successful) { + + put_b_to_python + if (successful) { + + buildvalue = ... + + } + + } + + } + + } + cleanup_b + + } + cleanup_a + + return buildvalue + +Copyright 1999,2000 Pearu Peterson all rights reserved, +Pearu Peterson +Permission to use, modify, and distribute this software is given under the +terms of the NumPy License. + +NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. +$Date: 2005/08/30 08:58:42 $ +Pearu Peterson + +""" +from __future__ import division, absolute_import, print_function + +__version__ = "$Revision: 1.129 $"[10:-1] + +from . import __version__ +f2py_version = __version__.version + +import os +import time +import copy + +from .auxfuncs import ( + applyrules, debugcapi, dictappend, errmess, gentitle, getargs2, + hascallstatement, hasexternals, hasinitvalue, hasnote, hasresultnote, + isarray, isarrayofstrings, iscomplex, iscomplexarray, + iscomplexfunction, iscomplexfunction_warn, isdummyroutine, isexternal, + isfunction, isfunction_wrap, isint1array, isintent_aux, isintent_c, + isintent_callback, isintent_copy, isintent_hide, isintent_inout, + isintent_nothide, isintent_out, isintent_overwrite, islogical, + islong_complex, islong_double, islong_doublefunction, islong_long, + islong_longfunction, ismoduleroutine, isoptional, isrequired, isscalar, + issigned_long_longarray, isstring, isstringarray, isstringfunction, + issubroutine, issubroutine_wrap, isthreadsafe, isunsigned, + isunsigned_char, isunsigned_chararray, isunsigned_long_long, + isunsigned_long_longarray, isunsigned_short, isunsigned_shortarray, + l_and, l_not, l_or, outmess, replace, stripcomma, +) + +from . import capi_maps +from . import cfuncs +from . import common_rules +from . import use_rules +from . import f90mod_rules +from . import func2subr + +options = {} +sepdict = {} +#for k in ['need_cfuncs']: sepdict[k]=',' +for k in ['decl', + 'frompyobj', + 'cleanupfrompyobj', + 'topyarr', 'method', + 'pyobjfrom', 'closepyobjfrom', + 'freemem', + 'userincludes', + 'includes0', 'includes', 'typedefs', 'typedefs_generated', + 'cppmacros', 'cfuncs', 'callbacks', + 'latexdoc', + 'restdoc', + 'routine_defs', 'externroutines', + 'initf2pywraphooks', + 'commonhooks', 'initcommonhooks', + 'f90modhooks', 'initf90modhooks']: + sepdict[k] = '\n' + +#################### Rules for C/API module ################# + +generationtime = int(os.environ.get('SOURCE_DATE_EPOCH', time.time())) +module_rules = { + 'modulebody': """\ +/* File: #modulename#module.c + * This file is auto-generated with f2py (version:#f2py_version#). + * f2py is a Fortran to Python Interface Generator (FPIG), Second Edition, + * written by Pearu Peterson . + * Generation date: """ + time.asctime(time.gmtime(generationtime)) + """ + * Do not edit this file directly unless you know what you are doing!!! + */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +""" + gentitle("See f2py2e/cfuncs.py: includes") + """ +#includes# +#includes0# + +""" + gentitle("See f2py2e/rules.py: mod_rules['modulebody']") + """ +static PyObject *#modulename#_error; +static PyObject *#modulename#_module; + +""" + gentitle("See f2py2e/cfuncs.py: typedefs") + """ +#typedefs# + +""" + gentitle("See f2py2e/cfuncs.py: typedefs_generated") + """ +#typedefs_generated# + +""" + gentitle("See f2py2e/cfuncs.py: cppmacros") + """ +#cppmacros# + +""" + gentitle("See f2py2e/cfuncs.py: cfuncs") + """ +#cfuncs# + +""" + gentitle("See f2py2e/cfuncs.py: userincludes") + """ +#userincludes# + +""" + gentitle("See f2py2e/capi_rules.py: usercode") + """ +#usercode# + +/* See f2py2e/rules.py */ +#externroutines# + +""" + gentitle("See f2py2e/capi_rules.py: usercode1") + """ +#usercode1# + +""" + gentitle("See f2py2e/cb_rules.py: buildcallback") + """ +#callbacks# + +""" + gentitle("See f2py2e/rules.py: buildapi") + """ +#body# + +""" + gentitle("See f2py2e/f90mod_rules.py: buildhooks") + """ +#f90modhooks# + +""" + gentitle("See f2py2e/rules.py: module_rules['modulebody']") + """ + +""" + gentitle("See f2py2e/common_rules.py: buildhooks") + """ +#commonhooks# + +""" + gentitle("See f2py2e/rules.py") + """ + +static FortranDataDef f2py_routine_defs[] = { +#routine_defs# +\t{NULL} +}; + +static PyMethodDef f2py_module_methods[] = { +#pymethoddef# +\t{NULL,NULL} +}; + +#if PY_VERSION_HEX >= 0x03000000 +static struct PyModuleDef moduledef = { +\tPyModuleDef_HEAD_INIT, +\t"#modulename#", +\tNULL, +\t-1, +\tf2py_module_methods, +\tNULL, +\tNULL, +\tNULL, +\tNULL +}; +#endif + +#if PY_VERSION_HEX >= 0x03000000 +#define RETVAL m +PyMODINIT_FUNC PyInit_#modulename#(void) { +#else +#define RETVAL +PyMODINIT_FUNC init#modulename#(void) { +#endif +\tint i; +\tPyObject *m,*d, *s; +#if PY_VERSION_HEX >= 0x03000000 +\tm = #modulename#_module = PyModule_Create(&moduledef); +#else +\tm = #modulename#_module = Py_InitModule(\"#modulename#\", f2py_module_methods); +#endif +\tPy_TYPE(&PyFortran_Type) = &PyType_Type; +\timport_array(); +\tif (PyErr_Occurred()) +\t\t{PyErr_SetString(PyExc_ImportError, \"can't initialize module #modulename# (failed to import numpy)\"); return RETVAL;} +\td = PyModule_GetDict(m); +\ts = PyString_FromString(\"$R""" + """evision: $\"); +\tPyDict_SetItemString(d, \"__version__\", s); +#if PY_VERSION_HEX >= 0x03000000 +\ts = PyUnicode_FromString( +#else +\ts = PyString_FromString( +#endif +\t\t\"This module '#modulename#' is auto-generated with f2py (version:#f2py_version#).\\nFunctions:\\n\"\n#docs#\".\"); +\tPyDict_SetItemString(d, \"__doc__\", s); +\t#modulename#_error = PyErr_NewException (\"#modulename#.error\", NULL, NULL); +\tPy_DECREF(s); +\tfor(i=0;f2py_routine_defs[i].name!=NULL;i++) +\t\tPyDict_SetItemString(d, f2py_routine_defs[i].name,PyFortranObject_NewAsAttr(&f2py_routine_defs[i])); +#initf2pywraphooks# +#initf90modhooks# +#initcommonhooks# +#interface_usercode# + +#ifdef F2PY_REPORT_ATEXIT +\tif (! PyErr_Occurred()) +\t\ton_exit(f2py_report_on_exit,(void*)\"#modulename#\"); +#endif + +\treturn RETVAL; +} +#ifdef __cplusplus +} +#endif +""", + 'separatorsfor': {'latexdoc': '\n\n', + 'restdoc': '\n\n'}, + 'latexdoc': ['\\section{Module \\texttt{#texmodulename#}}\n', + '#modnote#\n', + '#latexdoc#'], + 'restdoc': ['Module #modulename#\n' + '=' * 80, + '\n#restdoc#'] +} + +defmod_rules = [ + {'body': '/*eof body*/', + 'method': '/*eof method*/', + 'externroutines': '/*eof externroutines*/', + 'routine_defs': '/*eof routine_defs*/', + 'initf90modhooks': '/*eof initf90modhooks*/', + 'initf2pywraphooks': '/*eof initf2pywraphooks*/', + 'initcommonhooks': '/*eof initcommonhooks*/', + 'latexdoc': '', + 'restdoc': '', + 'modnote': {hasnote: '#note#', l_not(hasnote): ''}, + } +] + +routine_rules = { + 'separatorsfor': sepdict, + 'body': """ +#begintitle# +static char doc_#apiname#[] = \"\\\n#docreturn##name#(#docsignatureshort#)\\n\\nWrapper for ``#name#``.\\\n\\n#docstrsigns#\"; +/* #declfortranroutine# */ +static PyObject *#apiname#(const PyObject *capi_self, + PyObject *capi_args, + PyObject *capi_keywds, + #functype# (*f2py_func)(#callprotoargument#)) { +\tPyObject * volatile capi_buildvalue = NULL; +\tvolatile int f2py_success = 1; +#decl# +\tstatic char *capi_kwlist[] = {#kwlist##kwlistopt##kwlistxa#NULL}; +#usercode# +#routdebugenter# +#ifdef F2PY_REPORT_ATEXIT +f2py_start_clock(); +#endif +\tif (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\\ +\t\t\"#argformat##keyformat##xaformat#:#pyname#\",\\ +\t\tcapi_kwlist#args_capi##keys_capi##keys_xa#))\n\t\treturn NULL; +#frompyobj# +/*end of frompyobj*/ +#ifdef F2PY_REPORT_ATEXIT +f2py_start_call_clock(); +#endif +#callfortranroutine# +if (PyErr_Occurred()) + f2py_success = 0; +#ifdef F2PY_REPORT_ATEXIT +f2py_stop_call_clock(); +#endif +/*end of callfortranroutine*/ +\t\tif (f2py_success) { +#pyobjfrom# +/*end of pyobjfrom*/ +\t\tCFUNCSMESS(\"Building return value.\\n\"); +\t\tcapi_buildvalue = Py_BuildValue(\"#returnformat#\"#return#); +/*closepyobjfrom*/ +#closepyobjfrom# +\t\t} /*if (f2py_success) after callfortranroutine*/ +/*cleanupfrompyobj*/ +#cleanupfrompyobj# +\tif (capi_buildvalue == NULL) { +#routdebugfailure# +\t} else { +#routdebugleave# +\t} +\tCFUNCSMESS(\"Freeing memory.\\n\"); +#freemem# +#ifdef F2PY_REPORT_ATEXIT +f2py_stop_clock(); +#endif +\treturn capi_buildvalue; +} +#endtitle# +""", + 'routine_defs': '#routine_def#', + 'initf2pywraphooks': '#initf2pywraphook#', + 'externroutines': '#declfortranroutine#', + 'doc': '#docreturn##name#(#docsignature#)', + 'docshort': '#docreturn##name#(#docsignatureshort#)', + 'docs': '"\t#docreturn##name#(#docsignature#)\\n"\n', + 'need': ['arrayobject.h', 'CFUNCSMESS', 'MINMAX'], + 'cppmacros': {debugcapi: '#define DEBUGCFUNCS'}, + 'latexdoc': ['\\subsection{Wrapper function \\texttt{#texname#}}\n', + """ +\\noindent{{}\\verb@#docreturn##name#@{}}\\texttt{(#latexdocsignatureshort#)} +#routnote# + +#latexdocstrsigns# +"""], + 'restdoc': ['Wrapped function ``#name#``\n' + '-' * 80, + + ] +} + +################## Rules for C/API function ############## + +rout_rules = [ + { # Init + 'separatorsfor': {'callfortranroutine': '\n', 'routdebugenter': '\n', 'decl': '\n', + 'routdebugleave': '\n', 'routdebugfailure': '\n', + 'setjmpbuf': ' || ', + 'docstrreq': '\n', 'docstropt': '\n', 'docstrout': '\n', + 'docstrcbs': '\n', 'docstrsigns': '\\n"\n"', + 'latexdocstrsigns': '\n', + 'latexdocstrreq': '\n', 'latexdocstropt': '\n', + 'latexdocstrout': '\n', 'latexdocstrcbs': '\n', + }, + 'kwlist': '', 'kwlistopt': '', 'callfortran': '', 'callfortranappend': '', + 'docsign': '', 'docsignopt': '', 'decl': '/*decl*/', + 'freemem': '/*freemem*/', + 'docsignshort': '', 'docsignoptshort': '', + 'docstrsigns': '', 'latexdocstrsigns': '', + 'docstrreq': '\\nParameters\\n----------', + 'docstropt': '\\nOther Parameters\\n----------------', + 'docstrout': '\\nReturns\\n-------', + 'docstrcbs': '\\nNotes\\n-----\\nCall-back functions::\\n', + 'latexdocstrreq': '\\noindent Required arguments:', + 'latexdocstropt': '\\noindent Optional arguments:', + 'latexdocstrout': '\\noindent Return objects:', + 'latexdocstrcbs': '\\noindent Call-back functions:', + 'args_capi': '', 'keys_capi': '', 'functype': '', + 'frompyobj': '/*frompyobj*/', + # this list will be reversed + 'cleanupfrompyobj': ['/*end of cleanupfrompyobj*/'], + 'pyobjfrom': '/*pyobjfrom*/', + # this list will be reversed + 'closepyobjfrom': ['/*end of closepyobjfrom*/'], + 'topyarr': '/*topyarr*/', 'routdebugleave': '/*routdebugleave*/', + 'routdebugenter': '/*routdebugenter*/', + 'routdebugfailure': '/*routdebugfailure*/', + 'callfortranroutine': '/*callfortranroutine*/', + 'argformat': '', 'keyformat': '', 'need_cfuncs': '', + 'docreturn': '', 'return': '', 'returnformat': '', 'rformat': '', + 'kwlistxa': '', 'keys_xa': '', 'xaformat': '', 'docsignxa': '', 'docsignxashort': '', + 'initf2pywraphook': '', + 'routnote': {hasnote: '--- #note#', l_not(hasnote): ''}, + }, { + 'apiname': 'f2py_rout_#modulename#_#name#', + 'pyname': '#modulename#.#name#', + 'decl': '', + '_check': l_not(ismoduleroutine) + }, { + 'apiname': 'f2py_rout_#modulename#_#f90modulename#_#name#', + 'pyname': '#modulename#.#f90modulename#.#name#', + 'decl': '', + '_check': ismoduleroutine + }, { # Subroutine + 'functype': 'void', + 'declfortranroutine': {l_and(l_not(l_or(ismoduleroutine, isintent_c)), l_not(isdummyroutine)): 'extern void #F_FUNC#(#fortranname#,#FORTRANNAME#)(#callprotoargument#);', + l_and(l_not(ismoduleroutine), isintent_c, l_not(isdummyroutine)): 'extern void #fortranname#(#callprotoargument#);', + ismoduleroutine: '', + isdummyroutine: '' + }, + 'routine_def': {l_not(l_or(ismoduleroutine, isintent_c, isdummyroutine)): '\t{\"#name#\",-1,{{-1}},0,(char *)#F_FUNC#(#fortranname#,#FORTRANNAME#),(f2py_init_func)#apiname#,doc_#apiname#},', + l_and(l_not(ismoduleroutine), isintent_c, l_not(isdummyroutine)): '\t{\"#name#\",-1,{{-1}},0,(char *)#fortranname#,(f2py_init_func)#apiname#,doc_#apiname#},', + l_and(l_not(ismoduleroutine), isdummyroutine): '\t{\"#name#\",-1,{{-1}},0,NULL,(f2py_init_func)#apiname#,doc_#apiname#},', + }, + 'need': {l_and(l_not(l_or(ismoduleroutine, isintent_c)), l_not(isdummyroutine)): 'F_FUNC'}, + 'callfortranroutine': [ + {debugcapi: [ + """\tfprintf(stderr,\"debug-capi:Fortran subroutine `#fortranname#(#callfortran#)\'\\n\");"""]}, + {hasexternals: """\ +\t\tif (#setjmpbuf#) { +\t\t\tf2py_success = 0; +\t\t} else {"""}, + {isthreadsafe: '\t\t\tPy_BEGIN_ALLOW_THREADS'}, + {hascallstatement: '''\t\t\t\t#callstatement#; +\t\t\t\t/*(*f2py_func)(#callfortran#);*/'''}, + {l_not(l_or(hascallstatement, isdummyroutine)) + : '\t\t\t\t(*f2py_func)(#callfortran#);'}, + {isthreadsafe: '\t\t\tPy_END_ALLOW_THREADS'}, + {hasexternals: """\t\t}"""} + ], + '_check': l_and(issubroutine, l_not(issubroutine_wrap)), + }, { # Wrapped function + 'functype': 'void', + 'declfortranroutine': {l_not(l_or(ismoduleroutine, isdummyroutine)): 'extern void #F_WRAPPEDFUNC#(#name_lower#,#NAME#)(#callprotoargument#);', + isdummyroutine: '', + }, + + 'routine_def': {l_not(l_or(ismoduleroutine, isdummyroutine)): '\t{\"#name#\",-1,{{-1}},0,(char *)#F_WRAPPEDFUNC#(#name_lower#,#NAME#),(f2py_init_func)#apiname#,doc_#apiname#},', + isdummyroutine: '\t{\"#name#\",-1,{{-1}},0,NULL,(f2py_init_func)#apiname#,doc_#apiname#},', + }, + 'initf2pywraphook': {l_not(l_or(ismoduleroutine, isdummyroutine)): ''' + { + extern #ctype# #F_FUNC#(#name_lower#,#NAME#)(void); + PyObject* o = PyDict_GetItemString(d,"#name#"); + PyObject_SetAttrString(o,"_cpointer", F2PyCapsule_FromVoidPtr((void*)#F_FUNC#(#name_lower#,#NAME#),NULL)); +#if PY_VERSION_HEX >= 0x03000000 + PyObject_SetAttrString(o,"__name__", PyUnicode_FromString("#name#")); +#else + PyObject_SetAttrString(o,"__name__", PyString_FromString("#name#")); +#endif + } + '''}, + 'need': {l_not(l_or(ismoduleroutine, isdummyroutine)): ['F_WRAPPEDFUNC', 'F_FUNC']}, + 'callfortranroutine': [ + {debugcapi: [ + """\tfprintf(stderr,\"debug-capi:Fortran subroutine `f2pywrap#name_lower#(#callfortran#)\'\\n\");"""]}, + {hasexternals: """\ +\tif (#setjmpbuf#) { +\t\tf2py_success = 0; +\t} else {"""}, + {isthreadsafe: '\tPy_BEGIN_ALLOW_THREADS'}, + {l_not(l_or(hascallstatement, isdummyroutine)) + : '\t(*f2py_func)(#callfortran#);'}, + {hascallstatement: + '\t#callstatement#;\n\t/*(*f2py_func)(#callfortran#);*/'}, + {isthreadsafe: '\tPy_END_ALLOW_THREADS'}, + {hasexternals: '\t}'} + ], + '_check': isfunction_wrap, + }, { # Wrapped subroutine + 'functype': 'void', + 'declfortranroutine': {l_not(l_or(ismoduleroutine, isdummyroutine)): 'extern void #F_WRAPPEDFUNC#(#name_lower#,#NAME#)(#callprotoargument#);', + isdummyroutine: '', + }, + + 'routine_def': {l_not(l_or(ismoduleroutine, isdummyroutine)): '\t{\"#name#\",-1,{{-1}},0,(char *)#F_WRAPPEDFUNC#(#name_lower#,#NAME#),(f2py_init_func)#apiname#,doc_#apiname#},', + isdummyroutine: '\t{\"#name#\",-1,{{-1}},0,NULL,(f2py_init_func)#apiname#,doc_#apiname#},', + }, + 'initf2pywraphook': {l_not(l_or(ismoduleroutine, isdummyroutine)): ''' + { + extern void #F_FUNC#(#name_lower#,#NAME#)(void); + PyObject* o = PyDict_GetItemString(d,"#name#"); + PyObject_SetAttrString(o,"_cpointer", F2PyCapsule_FromVoidPtr((void*)#F_FUNC#(#name_lower#,#NAME#),NULL)); +#if PY_VERSION_HEX >= 0x03000000 + PyObject_SetAttrString(o,"__name__", PyUnicode_FromString("#name#")); +#else + PyObject_SetAttrString(o,"__name__", PyString_FromString("#name#")); +#endif + } + '''}, + 'need': {l_not(l_or(ismoduleroutine, isdummyroutine)): ['F_WRAPPEDFUNC', 'F_FUNC']}, + 'callfortranroutine': [ + {debugcapi: [ + """\tfprintf(stderr,\"debug-capi:Fortran subroutine `f2pywrap#name_lower#(#callfortran#)\'\\n\");"""]}, + {hasexternals: """\ +\tif (#setjmpbuf#) { +\t\tf2py_success = 0; +\t} else {"""}, + {isthreadsafe: '\tPy_BEGIN_ALLOW_THREADS'}, + {l_not(l_or(hascallstatement, isdummyroutine)) + : '\t(*f2py_func)(#callfortran#);'}, + {hascallstatement: + '\t#callstatement#;\n\t/*(*f2py_func)(#callfortran#);*/'}, + {isthreadsafe: '\tPy_END_ALLOW_THREADS'}, + {hasexternals: '\t}'} + ], + '_check': issubroutine_wrap, + }, { # Function + 'functype': '#ctype#', + 'docreturn': {l_not(isintent_hide): '#rname#,'}, + 'docstrout': '#pydocsignout#', + 'latexdocstrout': ['\\item[]{{}\\verb@#pydocsignout#@{}}', + {hasresultnote: '--- #resultnote#'}], + 'callfortranroutine': [{l_and(debugcapi, isstringfunction): """\ +#ifdef USESCOMPAQFORTRAN +\tfprintf(stderr,\"debug-capi:Fortran function #ctype# #fortranname#(#callcompaqfortran#)\\n\"); +#else +\tfprintf(stderr,\"debug-capi:Fortran function #ctype# #fortranname#(#callfortran#)\\n\"); +#endif +"""}, + {l_and(debugcapi, l_not(isstringfunction)): """\ +\tfprintf(stderr,\"debug-capi:Fortran function #ctype# #fortranname#(#callfortran#)\\n\"); +"""} + ], + '_check': l_and(isfunction, l_not(isfunction_wrap)) + }, { # Scalar function + 'declfortranroutine': {l_and(l_not(l_or(ismoduleroutine, isintent_c)), l_not(isdummyroutine)): 'extern #ctype# #F_FUNC#(#fortranname#,#FORTRANNAME#)(#callprotoargument#);', + l_and(l_not(ismoduleroutine), isintent_c, l_not(isdummyroutine)): 'extern #ctype# #fortranname#(#callprotoargument#);', + isdummyroutine: '' + }, + 'routine_def': {l_and(l_not(l_or(ismoduleroutine, isintent_c)), l_not(isdummyroutine)): '\t{\"#name#\",-1,{{-1}},0,(char *)#F_FUNC#(#fortranname#,#FORTRANNAME#),(f2py_init_func)#apiname#,doc_#apiname#},', + l_and(l_not(ismoduleroutine), isintent_c, l_not(isdummyroutine)): '\t{\"#name#\",-1,{{-1}},0,(char *)#fortranname#,(f2py_init_func)#apiname#,doc_#apiname#},', + isdummyroutine: '\t{\"#name#\",-1,{{-1}},0,NULL,(f2py_init_func)#apiname#,doc_#apiname#},', + }, + 'decl': [{iscomplexfunction_warn: '\t#ctype# #name#_return_value={0,0};', + l_not(iscomplexfunction): '\t#ctype# #name#_return_value=0;'}, + {iscomplexfunction: + '\tPyObject *#name#_return_value_capi = Py_None;'} + ], + 'callfortranroutine': [ + {hasexternals: """\ +\tif (#setjmpbuf#) { +\t\tf2py_success = 0; +\t} else {"""}, + {isthreadsafe: '\tPy_BEGIN_ALLOW_THREADS'}, + {hascallstatement: '''\t#callstatement#; +/*\t#name#_return_value = (*f2py_func)(#callfortran#);*/ +'''}, + {l_not(l_or(hascallstatement, isdummyroutine)) + : '\t#name#_return_value = (*f2py_func)(#callfortran#);'}, + {isthreadsafe: '\tPy_END_ALLOW_THREADS'}, + {hasexternals: '\t}'}, + {l_and(debugcapi, iscomplexfunction) + : '\tfprintf(stderr,"#routdebugshowvalue#\\n",#name#_return_value.r,#name#_return_value.i);'}, + {l_and(debugcapi, l_not(iscomplexfunction)): '\tfprintf(stderr,"#routdebugshowvalue#\\n",#name#_return_value);'}], + 'pyobjfrom': {iscomplexfunction: '\t#name#_return_value_capi = pyobj_from_#ctype#1(#name#_return_value);'}, + 'need': [{l_not(isdummyroutine): 'F_FUNC'}, + {iscomplexfunction: 'pyobj_from_#ctype#1'}, + {islong_longfunction: 'long_long'}, + {islong_doublefunction: 'long_double'}], + 'returnformat': {l_not(isintent_hide): '#rformat#'}, + 'return': {iscomplexfunction: ',#name#_return_value_capi', + l_not(l_or(iscomplexfunction, isintent_hide)): ',#name#_return_value'}, + '_check': l_and(isfunction, l_not(isstringfunction), l_not(isfunction_wrap)) + }, { # String function # in use for --no-wrap + 'declfortranroutine': 'extern void #F_FUNC#(#fortranname#,#FORTRANNAME#)(#callprotoargument#);', + 'routine_def': {l_not(l_or(ismoduleroutine, isintent_c)): + '\t{\"#name#\",-1,{{-1}},0,(char *)#F_FUNC#(#fortranname#,#FORTRANNAME#),(f2py_init_func)#apiname#,doc_#apiname#},', + l_and(l_not(ismoduleroutine), isintent_c): + '\t{\"#name#\",-1,{{-1}},0,(char *)#fortranname#,(f2py_init_func)#apiname#,doc_#apiname#},' + }, + 'decl': ['\t#ctype# #name#_return_value = NULL;', + '\tint #name#_return_value_len = 0;'], + 'callfortran':'#name#_return_value,#name#_return_value_len,', + 'callfortranroutine':['\t#name#_return_value_len = #rlength#;', + '\tif ((#name#_return_value = (string)malloc(sizeof(char)*(#name#_return_value_len+1))) == NULL) {', + '\t\tPyErr_SetString(PyExc_MemoryError, \"out of memory\");', + '\t\tf2py_success = 0;', + '\t} else {', + "\t\t(#name#_return_value)[#name#_return_value_len] = '\\0';", + '\t}', + '\tif (f2py_success) {', + {hasexternals: """\ +\t\tif (#setjmpbuf#) { +\t\t\tf2py_success = 0; +\t\t} else {"""}, + {isthreadsafe: '\t\tPy_BEGIN_ALLOW_THREADS'}, + """\ +#ifdef USESCOMPAQFORTRAN +\t\t(*f2py_func)(#callcompaqfortran#); +#else +\t\t(*f2py_func)(#callfortran#); +#endif +""", + {isthreadsafe: '\t\tPy_END_ALLOW_THREADS'}, + {hasexternals: '\t\t}'}, + {debugcapi: + '\t\tfprintf(stderr,"#routdebugshowvalue#\\n",#name#_return_value_len,#name#_return_value);'}, + '\t} /* if (f2py_success) after (string)malloc */', + ], + 'returnformat': '#rformat#', + 'return': ',#name#_return_value', + 'freemem': '\tSTRINGFREE(#name#_return_value);', + 'need': ['F_FUNC', '#ctype#', 'STRINGFREE'], + '_check':l_and(isstringfunction, l_not(isfunction_wrap)) # ???obsolete + }, + { # Debugging + 'routdebugenter': '\tfprintf(stderr,"debug-capi:Python C/API function #modulename#.#name#(#docsignature#)\\n");', + 'routdebugleave': '\tfprintf(stderr,"debug-capi:Python C/API function #modulename#.#name#: successful.\\n");', + 'routdebugfailure': '\tfprintf(stderr,"debug-capi:Python C/API function #modulename#.#name#: failure.\\n");', + '_check': debugcapi + } +] + +################ Rules for arguments ################## + +typedef_need_dict = {islong_long: 'long_long', + islong_double: 'long_double', + islong_complex: 'complex_long_double', + isunsigned_char: 'unsigned_char', + isunsigned_short: 'unsigned_short', + isunsigned: 'unsigned', + isunsigned_long_long: 'unsigned_long_long', + isunsigned_chararray: 'unsigned_char', + isunsigned_shortarray: 'unsigned_short', + isunsigned_long_longarray: 'unsigned_long_long', + issigned_long_longarray: 'long_long', + } + +aux_rules = [ + { + 'separatorsfor': sepdict + }, + { # Common + 'frompyobj': ['\t/* Processing auxiliary variable #varname# */', + {debugcapi: '\tfprintf(stderr,"#vardebuginfo#\\n");'}, ], + 'cleanupfrompyobj': '\t/* End of cleaning variable #varname# */', + 'need': typedef_need_dict, + }, + # Scalars (not complex) + { # Common + 'decl': '\t#ctype# #varname# = 0;', + 'need': {hasinitvalue: 'math.h'}, + 'frompyobj': {hasinitvalue: '\t#varname# = #init#;'}, + '_check': l_and(isscalar, l_not(iscomplex)), + }, + { + 'return': ',#varname#', + 'docstrout': '#pydocsignout#', + 'docreturn': '#outvarname#,', + 'returnformat': '#varrformat#', + '_check': l_and(isscalar, l_not(iscomplex), isintent_out), + }, + # Complex scalars + { # Common + 'decl': '\t#ctype# #varname#;', + 'frompyobj': {hasinitvalue: '\t#varname#.r = #init.r#, #varname#.i = #init.i#;'}, + '_check': iscomplex + }, + # String + { # Common + 'decl': ['\t#ctype# #varname# = NULL;', + '\tint slen(#varname#);', + ], + 'need':['len..'], + '_check':isstring + }, + # Array + { # Common + 'decl': ['\t#ctype# *#varname# = NULL;', + '\tnpy_intp #varname#_Dims[#rank#] = {#rank*[-1]#};', + '\tconst int #varname#_Rank = #rank#;', + ], + 'need':['len..', {hasinitvalue: 'forcomb'}, {hasinitvalue: 'CFUNCSMESS'}], + '_check': isarray + }, + # Scalararray + { # Common + '_check': l_and(isarray, l_not(iscomplexarray)) + }, { # Not hidden + '_check': l_and(isarray, l_not(iscomplexarray), isintent_nothide) + }, + # Integer*1 array + {'need': '#ctype#', + '_check': isint1array, + '_depend': '' + }, + # Integer*-1 array + {'need': '#ctype#', + '_check': isunsigned_chararray, + '_depend': '' + }, + # Integer*-2 array + {'need': '#ctype#', + '_check': isunsigned_shortarray, + '_depend': '' + }, + # Integer*-8 array + {'need': '#ctype#', + '_check': isunsigned_long_longarray, + '_depend': '' + }, + # Complexarray + {'need': '#ctype#', + '_check': iscomplexarray, + '_depend': '' + }, + # Stringarray + { + 'callfortranappend': {isarrayofstrings: 'flen(#varname#),'}, + 'need': 'string', + '_check': isstringarray + } +] + +arg_rules = [ + { + 'separatorsfor': sepdict + }, + { # Common + 'frompyobj': ['\t/* Processing variable #varname# */', + {debugcapi: '\tfprintf(stderr,"#vardebuginfo#\\n");'}, ], + 'cleanupfrompyobj': '\t/* End of cleaning variable #varname# */', + '_depend': '', + 'need': typedef_need_dict, + }, + # Doc signatures + { + 'docstropt': {l_and(isoptional, isintent_nothide): '#pydocsign#'}, + 'docstrreq': {l_and(isrequired, isintent_nothide): '#pydocsign#'}, + 'docstrout': {isintent_out: '#pydocsignout#'}, + 'latexdocstropt': {l_and(isoptional, isintent_nothide): ['\\item[]{{}\\verb@#pydocsign#@{}}', + {hasnote: '--- #note#'}]}, + 'latexdocstrreq': {l_and(isrequired, isintent_nothide): ['\\item[]{{}\\verb@#pydocsign#@{}}', + {hasnote: '--- #note#'}]}, + 'latexdocstrout': {isintent_out: ['\\item[]{{}\\verb@#pydocsignout#@{}}', + {l_and(hasnote, isintent_hide): '--- #note#', + l_and(hasnote, isintent_nothide): '--- See above.'}]}, + 'depend': '' + }, + # Required/Optional arguments + { + 'kwlist': '"#varname#",', + 'docsign': '#varname#,', + '_check': l_and(isintent_nothide, l_not(isoptional)) + }, + { + 'kwlistopt': '"#varname#",', + 'docsignopt': '#varname#=#showinit#,', + 'docsignoptshort': '#varname#,', + '_check': l_and(isintent_nothide, isoptional) + }, + # Docstring/BuildValue + { + 'docreturn': '#outvarname#,', + 'returnformat': '#varrformat#', + '_check': isintent_out + }, + # Externals (call-back functions) + { # Common + 'docsignxa': {isintent_nothide: '#varname#_extra_args=(),'}, + 'docsignxashort': {isintent_nothide: '#varname#_extra_args,'}, + 'docstropt': {isintent_nothide: '#varname#_extra_args : input tuple, optional\\n Default: ()'}, + 'docstrcbs': '#cbdocstr#', + 'latexdocstrcbs': '\\item[] #cblatexdocstr#', + 'latexdocstropt': {isintent_nothide: '\\item[]{{}\\verb@#varname#_extra_args := () input tuple@{}} --- Extra arguments for call-back function {{}\\verb@#varname#@{}}.'}, + 'decl': ['\tPyObject *#varname#_capi = Py_None;', + '\tPyTupleObject *#varname#_xa_capi = NULL;', + '\tPyTupleObject *#varname#_args_capi = NULL;', + '\tint #varname#_nofargs_capi = 0;', + {l_not(isintent_callback): + '\t#cbname#_typedef #varname#_cptr;'} + ], + 'kwlistxa': {isintent_nothide: '"#varname#_extra_args",'}, + 'argformat': {isrequired: 'O'}, + 'keyformat': {isoptional: 'O'}, + 'xaformat': {isintent_nothide: 'O!'}, + 'args_capi': {isrequired: ',&#varname#_capi'}, + 'keys_capi': {isoptional: ',&#varname#_capi'}, + 'keys_xa': ',&PyTuple_Type,&#varname#_xa_capi', + 'setjmpbuf': '(setjmp(#cbname#_jmpbuf))', + 'callfortran': {l_not(isintent_callback): '#varname#_cptr,'}, + 'need': ['#cbname#', 'setjmp.h'], + '_check':isexternal + }, + { + 'frompyobj': [{l_not(isintent_callback): """\ +if(F2PyCapsule_Check(#varname#_capi)) { + #varname#_cptr = F2PyCapsule_AsVoidPtr(#varname#_capi); +} else { + #varname#_cptr = #cbname#; +} +"""}, {isintent_callback: """\ +if (#varname#_capi==Py_None) { + #varname#_capi = PyObject_GetAttrString(#modulename#_module,\"#varname#\"); + if (#varname#_capi) { + if (#varname#_xa_capi==NULL) { + if (PyObject_HasAttrString(#modulename#_module,\"#varname#_extra_args\")) { + PyObject* capi_tmp = PyObject_GetAttrString(#modulename#_module,\"#varname#_extra_args\"); + if (capi_tmp) + #varname#_xa_capi = (PyTupleObject *)PySequence_Tuple(capi_tmp); + else + #varname#_xa_capi = (PyTupleObject *)Py_BuildValue(\"()\"); + if (#varname#_xa_capi==NULL) { + PyErr_SetString(#modulename#_error,\"Failed to convert #modulename#.#varname#_extra_args to tuple.\\n\"); + return NULL; + } + } + } + } + if (#varname#_capi==NULL) { + PyErr_SetString(#modulename#_error,\"Callback #varname# not defined (as an argument or module #modulename# attribute).\\n\"); + return NULL; + } +} +"""}, + """\ +\t#varname#_nofargs_capi = #cbname#_nofargs; +\tif (create_cb_arglist(#varname#_capi,#varname#_xa_capi,#maxnofargs#,#nofoptargs#,&#cbname#_nofargs,&#varname#_args_capi,\"failed in processing argument list for call-back #varname#.\")) { +\t\tjmp_buf #varname#_jmpbuf;""", + {debugcapi: ["""\ +\t\tfprintf(stderr,\"debug-capi:Assuming %d arguments; at most #maxnofargs#(-#nofoptargs#) is expected.\\n\",#cbname#_nofargs); +\t\tCFUNCSMESSPY(\"for #varname#=\",#cbname#_capi);""", + {l_not(isintent_callback): """\t\tfprintf(stderr,\"#vardebugshowvalue# (call-back in C).\\n\",#cbname#);"""}]}, + """\ +\t\tCFUNCSMESS(\"Saving jmpbuf for `#varname#`.\\n\"); +\t\tSWAP(#varname#_capi,#cbname#_capi,PyObject); +\t\tSWAP(#varname#_args_capi,#cbname#_args_capi,PyTupleObject); +\t\tmemcpy(&#varname#_jmpbuf,&#cbname#_jmpbuf,sizeof(jmp_buf));""", + ], + 'cleanupfrompyobj': + """\ +\t\tCFUNCSMESS(\"Restoring jmpbuf for `#varname#`.\\n\"); +\t\t#cbname#_capi = #varname#_capi; +\t\tPy_DECREF(#cbname#_args_capi); +\t\t#cbname#_args_capi = #varname#_args_capi; +\t\t#cbname#_nofargs = #varname#_nofargs_capi; +\t\tmemcpy(&#cbname#_jmpbuf,&#varname#_jmpbuf,sizeof(jmp_buf)); +\t}""", + 'need': ['SWAP', 'create_cb_arglist'], + '_check':isexternal, + '_depend':'' + }, + # Scalars (not complex) + { # Common + 'decl': '\t#ctype# #varname# = 0;', + 'pyobjfrom': {debugcapi: '\tfprintf(stderr,"#vardebugshowvalue#\\n",#varname#);'}, + 'callfortran': {isintent_c: '#varname#,', l_not(isintent_c): '&#varname#,'}, + 'return': {isintent_out: ',#varname#'}, + '_check': l_and(isscalar, l_not(iscomplex)) + }, { + 'need': {hasinitvalue: 'math.h'}, + '_check': l_and(isscalar, l_not(iscomplex)), + }, { # Not hidden + 'decl': '\tPyObject *#varname#_capi = Py_None;', + 'argformat': {isrequired: 'O'}, + 'keyformat': {isoptional: 'O'}, + 'args_capi': {isrequired: ',&#varname#_capi'}, + 'keys_capi': {isoptional: ',&#varname#_capi'}, + 'pyobjfrom': {isintent_inout: """\ +\tf2py_success = try_pyarr_from_#ctype#(#varname#_capi,&#varname#); +\tif (f2py_success) {"""}, + 'closepyobjfrom': {isintent_inout: "\t} /*if (f2py_success) of #varname# pyobjfrom*/"}, + 'need': {isintent_inout: 'try_pyarr_from_#ctype#'}, + '_check': l_and(isscalar, l_not(iscomplex), isintent_nothide) + }, { + 'frompyobj': [ + # hasinitvalue... + # if pyobj is None: + # varname = init + # else + # from_pyobj(varname) + # + # isoptional and noinitvalue... + # if pyobj is not None: + # from_pyobj(varname) + # else: + # varname is uninitialized + # + # ... + # from_pyobj(varname) + # + {hasinitvalue: '\tif (#varname#_capi == Py_None) #varname# = #init#; else', + '_depend': ''}, + {l_and(isoptional, l_not(hasinitvalue)): '\tif (#varname#_capi != Py_None)', + '_depend': ''}, + {l_not(islogical): '''\ +\t\tf2py_success = #ctype#_from_pyobj(&#varname#,#varname#_capi,"#pyname#() #nth# (#varname#) can\'t be converted to #ctype#"); +\tif (f2py_success) {'''}, + {islogical: '''\ +\t\t#varname# = (#ctype#)PyObject_IsTrue(#varname#_capi); +\t\tf2py_success = 1; +\tif (f2py_success) {'''}, + ], + 'cleanupfrompyobj': '\t} /*if (f2py_success) of #varname#*/', + 'need': {l_not(islogical): '#ctype#_from_pyobj'}, + '_check': l_and(isscalar, l_not(iscomplex), isintent_nothide), + '_depend': '' + }, { # Hidden + 'frompyobj': {hasinitvalue: '\t#varname# = #init#;'}, + 'need': typedef_need_dict, + '_check': l_and(isscalar, l_not(iscomplex), isintent_hide), + '_depend': '' + }, { # Common + 'frompyobj': {debugcapi: '\tfprintf(stderr,"#vardebugshowvalue#\\n",#varname#);'}, + '_check': l_and(isscalar, l_not(iscomplex)), + '_depend': '' + }, + # Complex scalars + { # Common + 'decl': '\t#ctype# #varname#;', + 'callfortran': {isintent_c: '#varname#,', l_not(isintent_c): '&#varname#,'}, + 'pyobjfrom': {debugcapi: '\tfprintf(stderr,"#vardebugshowvalue#\\n",#varname#.r,#varname#.i);'}, + 'return': {isintent_out: ',#varname#_capi'}, + '_check': iscomplex + }, { # Not hidden + 'decl': '\tPyObject *#varname#_capi = Py_None;', + 'argformat': {isrequired: 'O'}, + 'keyformat': {isoptional: 'O'}, + 'args_capi': {isrequired: ',&#varname#_capi'}, + 'keys_capi': {isoptional: ',&#varname#_capi'}, + 'need': {isintent_inout: 'try_pyarr_from_#ctype#'}, + 'pyobjfrom': {isintent_inout: """\ +\t\tf2py_success = try_pyarr_from_#ctype#(#varname#_capi,&#varname#); +\t\tif (f2py_success) {"""}, + 'closepyobjfrom': {isintent_inout: "\t\t} /*if (f2py_success) of #varname# pyobjfrom*/"}, + '_check': l_and(iscomplex, isintent_nothide) + }, { + 'frompyobj': [{hasinitvalue: '\tif (#varname#_capi==Py_None) {#varname#.r = #init.r#, #varname#.i = #init.i#;} else'}, + {l_and(isoptional, l_not(hasinitvalue)) + : '\tif (#varname#_capi != Py_None)'}, + '\t\tf2py_success = #ctype#_from_pyobj(&#varname#,#varname#_capi,"#pyname#() #nth# (#varname#) can\'t be converted to #ctype#");' + '\n\tif (f2py_success) {'], + 'cleanupfrompyobj': '\t} /*if (f2py_success) of #varname# frompyobj*/', + 'need': ['#ctype#_from_pyobj'], + '_check': l_and(iscomplex, isintent_nothide), + '_depend': '' + }, { # Hidden + 'decl': {isintent_out: '\tPyObject *#varname#_capi = Py_None;'}, + '_check': l_and(iscomplex, isintent_hide) + }, { + 'frompyobj': {hasinitvalue: '\t#varname#.r = #init.r#, #varname#.i = #init.i#;'}, + '_check': l_and(iscomplex, isintent_hide), + '_depend': '' + }, { # Common + 'pyobjfrom': {isintent_out: '\t#varname#_capi = pyobj_from_#ctype#1(#varname#);'}, + 'need': ['pyobj_from_#ctype#1'], + '_check': iscomplex + }, { + 'frompyobj': {debugcapi: '\tfprintf(stderr,"#vardebugshowvalue#\\n",#varname#.r,#varname#.i);'}, + '_check': iscomplex, + '_depend': '' + }, + # String + { # Common + 'decl': ['\t#ctype# #varname# = NULL;', + '\tint slen(#varname#);', + '\tPyObject *#varname#_capi = Py_None;'], + 'callfortran':'#varname#,', + 'callfortranappend':'slen(#varname#),', + 'pyobjfrom':{debugcapi: '\tfprintf(stderr,"#vardebugshowvalue#\\n",slen(#varname#),#varname#);'}, + 'return': {isintent_out: ',#varname#'}, + 'need': ['len..'], # 'STRINGFREE'], + '_check':isstring + }, { # Common + 'frompyobj': """\ +\tslen(#varname#) = #length#; +\tf2py_success = #ctype#_from_pyobj(&#varname#,&slen(#varname#),#init#,#varname#_capi,\"#ctype#_from_pyobj failed in converting #nth# `#varname#\' of #pyname# to C #ctype#\"); +\tif (f2py_success) {""", + 'cleanupfrompyobj': """\ +\t\tSTRINGFREE(#varname#); +\t} /*if (f2py_success) of #varname#*/""", + 'need': ['#ctype#_from_pyobj', 'len..', 'STRINGFREE'], + '_check':isstring, + '_depend':'' + }, { # Not hidden + 'argformat': {isrequired: 'O'}, + 'keyformat': {isoptional: 'O'}, + 'args_capi': {isrequired: ',&#varname#_capi'}, + 'keys_capi': {isoptional: ',&#varname#_capi'}, + 'pyobjfrom': {isintent_inout: '''\ +\tf2py_success = try_pyarr_from_#ctype#(#varname#_capi,#varname#); +\tif (f2py_success) {'''}, + 'closepyobjfrom': {isintent_inout: '\t} /*if (f2py_success) of #varname# pyobjfrom*/'}, + 'need': {isintent_inout: 'try_pyarr_from_#ctype#'}, + '_check': l_and(isstring, isintent_nothide) + }, { # Hidden + '_check': l_and(isstring, isintent_hide) + }, { + 'frompyobj': {debugcapi: '\tfprintf(stderr,"#vardebugshowvalue#\\n",slen(#varname#),#varname#);'}, + '_check': isstring, + '_depend': '' + }, + # Array + { # Common + 'decl': ['\t#ctype# *#varname# = NULL;', + '\tnpy_intp #varname#_Dims[#rank#] = {#rank*[-1]#};', + '\tconst int #varname#_Rank = #rank#;', + '\tPyArrayObject *capi_#varname#_tmp = NULL;', + '\tint capi_#varname#_intent = 0;', + ], + 'callfortran':'#varname#,', + 'return':{isintent_out: ',capi_#varname#_tmp'}, + 'need': 'len..', + '_check': isarray + }, { # intent(overwrite) array + 'decl': '\tint capi_overwrite_#varname# = 1;', + 'kwlistxa': '"overwrite_#varname#",', + 'xaformat': 'i', + 'keys_xa': ',&capi_overwrite_#varname#', + 'docsignxa': 'overwrite_#varname#=1,', + 'docsignxashort': 'overwrite_#varname#,', + 'docstropt': 'overwrite_#varname# : input int, optional\\n Default: 1', + '_check': l_and(isarray, isintent_overwrite), + }, { + 'frompyobj': '\tcapi_#varname#_intent |= (capi_overwrite_#varname#?0:F2PY_INTENT_COPY);', + '_check': l_and(isarray, isintent_overwrite), + '_depend': '', + }, + { # intent(copy) array + 'decl': '\tint capi_overwrite_#varname# = 0;', + 'kwlistxa': '"overwrite_#varname#",', + 'xaformat': 'i', + 'keys_xa': ',&capi_overwrite_#varname#', + 'docsignxa': 'overwrite_#varname#=0,', + 'docsignxashort': 'overwrite_#varname#,', + 'docstropt': 'overwrite_#varname# : input int, optional\\n Default: 0', + '_check': l_and(isarray, isintent_copy), + }, { + 'frompyobj': '\tcapi_#varname#_intent |= (capi_overwrite_#varname#?0:F2PY_INTENT_COPY);', + '_check': l_and(isarray, isintent_copy), + '_depend': '', + }, { + 'need': [{hasinitvalue: 'forcomb'}, {hasinitvalue: 'CFUNCSMESS'}], + '_check': isarray, + '_depend': '' + }, { # Not hidden + 'decl': '\tPyObject *#varname#_capi = Py_None;', + 'argformat': {isrequired: 'O'}, + 'keyformat': {isoptional: 'O'}, + 'args_capi': {isrequired: ',&#varname#_capi'}, + 'keys_capi': {isoptional: ',&#varname#_capi'}, + '_check': l_and(isarray, isintent_nothide) + }, { + 'frompyobj': ['\t#setdims#;', + '\tcapi_#varname#_intent |= #intent#;', + {isintent_hide: + '\tcapi_#varname#_tmp = array_from_pyobj(#atype#,#varname#_Dims,#varname#_Rank,capi_#varname#_intent,Py_None);'}, + {isintent_nothide: + '\tcapi_#varname#_tmp = array_from_pyobj(#atype#,#varname#_Dims,#varname#_Rank,capi_#varname#_intent,#varname#_capi);'}, + """\ +\tif (capi_#varname#_tmp == NULL) { +\t\tif (!PyErr_Occurred()) +\t\t\tPyErr_SetString(#modulename#_error,\"failed in converting #nth# `#varname#\' of #pyname# to C/Fortran array\" ); +\t} else { +\t\t#varname# = (#ctype# *)(PyArray_DATA(capi_#varname#_tmp)); +""", + {hasinitvalue: [ + {isintent_nothide: + '\tif (#varname#_capi == Py_None) {'}, + {isintent_hide: '\t{'}, + {iscomplexarray: '\t\t#ctype# capi_c;'}, + """\ +\t\tint *_i,capi_i=0; +\t\tCFUNCSMESS(\"#name#: Initializing #varname#=#init#\\n\"); +\t\tif (initforcomb(PyArray_DIMS(capi_#varname#_tmp),PyArray_NDIM(capi_#varname#_tmp),1)) { +\t\t\twhile ((_i = nextforcomb())) +\t\t\t\t#varname#[capi_i++] = #init#; /* fortran way */ +\t\t} else { +\t\t\tif (!PyErr_Occurred()) +\t\t\t\tPyErr_SetString(#modulename#_error,\"Initialization of #nth# #varname# failed (initforcomb).\"); +\t\t\tf2py_success = 0; +\t\t} +\t} +\tif (f2py_success) {"""]}, + ], + 'cleanupfrompyobj': [ # note that this list will be reversed + '\t} /*if (capi_#varname#_tmp == NULL) ... else of #varname#*/', + {l_not(l_or(isintent_out, isintent_hide)): """\ +\tif((PyObject *)capi_#varname#_tmp!=#varname#_capi) { +\t\tPy_XDECREF(capi_#varname#_tmp); }"""}, + {l_and(isintent_hide, l_not(isintent_out)) + : """\t\tPy_XDECREF(capi_#varname#_tmp);"""}, + {hasinitvalue: '\t} /*if (f2py_success) of #varname# init*/'}, + ], + '_check': isarray, + '_depend': '' + }, + # Scalararray + { # Common + '_check': l_and(isarray, l_not(iscomplexarray)) + }, { # Not hidden + '_check': l_and(isarray, l_not(iscomplexarray), isintent_nothide) + }, + # Integer*1 array + {'need': '#ctype#', + '_check': isint1array, + '_depend': '' + }, + # Integer*-1 array + {'need': '#ctype#', + '_check': isunsigned_chararray, + '_depend': '' + }, + # Integer*-2 array + {'need': '#ctype#', + '_check': isunsigned_shortarray, + '_depend': '' + }, + # Integer*-8 array + {'need': '#ctype#', + '_check': isunsigned_long_longarray, + '_depend': '' + }, + # Complexarray + {'need': '#ctype#', + '_check': iscomplexarray, + '_depend': '' + }, + # Stringarray + { + 'callfortranappend': {isarrayofstrings: 'flen(#varname#),'}, + 'need': 'string', + '_check': isstringarray + } +] + +################# Rules for checking ############### + +check_rules = [ + { + 'frompyobj': {debugcapi: '\tfprintf(stderr,\"debug-capi:Checking `#check#\'\\n\");'}, + 'need': 'len..' + }, { + 'frompyobj': '\tCHECKSCALAR(#check#,\"#check#\",\"#nth# #varname#\",\"#varshowvalue#\",#varname#) {', + 'cleanupfrompyobj': '\t} /*CHECKSCALAR(#check#)*/', + 'need': 'CHECKSCALAR', + '_check': l_and(isscalar, l_not(iscomplex)), + '_break': '' + }, { + 'frompyobj': '\tCHECKSTRING(#check#,\"#check#\",\"#nth# #varname#\",\"#varshowvalue#\",#varname#) {', + 'cleanupfrompyobj': '\t} /*CHECKSTRING(#check#)*/', + 'need': 'CHECKSTRING', + '_check': isstring, + '_break': '' + }, { + 'need': 'CHECKARRAY', + 'frompyobj': '\tCHECKARRAY(#check#,\"#check#\",\"#nth# #varname#\") {', + 'cleanupfrompyobj': '\t} /*CHECKARRAY(#check#)*/', + '_check': isarray, + '_break': '' + }, { + 'need': 'CHECKGENERIC', + 'frompyobj': '\tCHECKGENERIC(#check#,\"#check#\",\"#nth# #varname#\") {', + 'cleanupfrompyobj': '\t} /*CHECKGENERIC(#check#)*/', + } +] + +########## Applying the rules. No need to modify what follows ############# + +#################### Build C/API module ####################### + + +def buildmodule(m, um): + """ + Return + """ + global f2py_version, options + outmess('\tBuilding module "%s"...\n' % (m['name'])) + ret = {} + mod_rules = defmod_rules[:] + vrd = capi_maps.modsign2map(m) + rd = dictappend({'f2py_version': f2py_version}, vrd) + funcwrappers = [] + funcwrappers2 = [] # F90 codes + for n in m['interfaced']: + nb = None + for bi in m['body']: + if not bi['block'] == 'interface': + errmess('buildmodule: Expected interface block. Skipping.\n') + continue + for b in bi['body']: + if b['name'] == n: + nb = b + break + + if not nb: + errmess( + 'buildmodule: Could not found the body of interfaced routine "%s". Skipping.\n' % (n)) + continue + nb_list = [nb] + if 'entry' in nb: + for k, a in nb['entry'].items(): + nb1 = copy.deepcopy(nb) + del nb1['entry'] + nb1['name'] = k + nb1['args'] = a + nb_list.append(nb1) + for nb in nb_list: + api, wrap = buildapi(nb) + if wrap: + if ismoduleroutine(nb): + funcwrappers2.append(wrap) + else: + funcwrappers.append(wrap) + ar = applyrules(api, vrd) + rd = dictappend(rd, ar) + + # Construct COMMON block support + cr, wrap = common_rules.buildhooks(m) + if wrap: + funcwrappers.append(wrap) + ar = applyrules(cr, vrd) + rd = dictappend(rd, ar) + + # Construct F90 module support + mr, wrap = f90mod_rules.buildhooks(m) + if wrap: + funcwrappers2.append(wrap) + ar = applyrules(mr, vrd) + rd = dictappend(rd, ar) + + for u in um: + ar = use_rules.buildusevars(u, m['use'][u['name']]) + rd = dictappend(rd, ar) + + needs = cfuncs.get_needs() + code = {} + for n in needs.keys(): + code[n] = [] + for k in needs[n]: + c = '' + if k in cfuncs.includes0: + c = cfuncs.includes0[k] + elif k in cfuncs.includes: + c = cfuncs.includes[k] + elif k in cfuncs.userincludes: + c = cfuncs.userincludes[k] + elif k in cfuncs.typedefs: + c = cfuncs.typedefs[k] + elif k in cfuncs.typedefs_generated: + c = cfuncs.typedefs_generated[k] + elif k in cfuncs.cppmacros: + c = cfuncs.cppmacros[k] + elif k in cfuncs.cfuncs: + c = cfuncs.cfuncs[k] + elif k in cfuncs.callbacks: + c = cfuncs.callbacks[k] + elif k in cfuncs.f90modhooks: + c = cfuncs.f90modhooks[k] + elif k in cfuncs.commonhooks: + c = cfuncs.commonhooks[k] + else: + errmess('buildmodule: unknown need %s.\n' % (repr(k))) + continue + code[n].append(c) + mod_rules.append(code) + for r in mod_rules: + if ('_check' in r and r['_check'](m)) or ('_check' not in r): + ar = applyrules(r, vrd, m) + rd = dictappend(rd, ar) + ar = applyrules(module_rules, rd) + + fn = os.path.join(options['buildpath'], vrd['coutput']) + ret['csrc'] = fn + f = open(fn, 'w') + f.write(ar['modulebody'].replace('\t', 2 * ' ')) + f.close() + outmess('\tWrote C/API module "%s" to file "%s"\n' % (m['name'], fn)) + + if options['dorestdoc']: + fn = os.path.join( + options['buildpath'], vrd['modulename'] + 'module.rest') + f = open(fn, 'w') + f.write('.. -*- rest -*-\n') + f.write('\n'.join(ar['restdoc'])) + f.close() + outmess('\tReST Documentation is saved to file "%s/%smodule.rest"\n' % + (options['buildpath'], vrd['modulename'])) + if options['dolatexdoc']: + fn = os.path.join( + options['buildpath'], vrd['modulename'] + 'module.tex') + ret['ltx'] = fn + f = open(fn, 'w') + f.write( + '%% This file is auto-generated with f2py (version:%s)\n' % (f2py_version)) + if 'shortlatex' not in options: + f.write( + '\\documentclass{article}\n\\usepackage{a4wide}\n\\begin{document}\n\\tableofcontents\n\n') + f.write('\n'.join(ar['latexdoc'])) + if 'shortlatex' not in options: + f.write('\\end{document}') + f.close() + outmess('\tDocumentation is saved to file "%s/%smodule.tex"\n' % + (options['buildpath'], vrd['modulename'])) + if funcwrappers: + wn = os.path.join(options['buildpath'], vrd['f2py_wrapper_output']) + ret['fsrc'] = wn + f = open(wn, 'w') + f.write('C -*- fortran -*-\n') + f.write( + 'C This file is autogenerated with f2py (version:%s)\n' % (f2py_version)) + f.write( + 'C It contains Fortran 77 wrappers to fortran functions.\n') + lines = [] + for l in ('\n\n'.join(funcwrappers) + '\n').split('\n'): + if l and l[0] == ' ': + while len(l) >= 66: + lines.append(l[:66] + '\n &') + l = l[66:] + lines.append(l + '\n') + else: + lines.append(l + '\n') + lines = ''.join(lines).replace('\n &\n', '\n') + f.write(lines) + f.close() + outmess('\tFortran 77 wrappers are saved to "%s"\n' % (wn)) + if funcwrappers2: + wn = os.path.join( + options['buildpath'], '%s-f2pywrappers2.f90' % (vrd['modulename'])) + ret['fsrc'] = wn + f = open(wn, 'w') + f.write('! -*- f90 -*-\n') + f.write( + '! This file is autogenerated with f2py (version:%s)\n' % (f2py_version)) + f.write( + '! It contains Fortran 90 wrappers to fortran functions.\n') + lines = [] + for l in ('\n\n'.join(funcwrappers2) + '\n').split('\n'): + if len(l) > 72 and l[0] == ' ': + lines.append(l[:72] + '&\n &') + l = l[72:] + while len(l) > 66: + lines.append(l[:66] + '&\n &') + l = l[66:] + lines.append(l + '\n') + else: + lines.append(l + '\n') + lines = ''.join(lines).replace('\n &\n', '\n') + f.write(lines) + f.close() + outmess('\tFortran 90 wrappers are saved to "%s"\n' % (wn)) + return ret + +################## Build C/API function ############# + +stnd = {1: 'st', 2: 'nd', 3: 'rd', 4: 'th', 5: 'th', + 6: 'th', 7: 'th', 8: 'th', 9: 'th', 0: 'th'} + + +def buildapi(rout): + rout, wrap = func2subr.assubr(rout) + args, depargs = getargs2(rout) + capi_maps.depargs = depargs + var = rout['vars'] + + if ismoduleroutine(rout): + outmess('\t\t\tConstructing wrapper function "%s.%s"...\n' % + (rout['modulename'], rout['name'])) + else: + outmess('\t\tConstructing wrapper function "%s"...\n' % (rout['name'])) + # Routine + vrd = capi_maps.routsign2map(rout) + rd = dictappend({}, vrd) + for r in rout_rules: + if ('_check' in r and r['_check'](rout)) or ('_check' not in r): + ar = applyrules(r, vrd, rout) + rd = dictappend(rd, ar) + + # Args + nth, nthk = 0, 0 + savevrd = {} + for a in args: + vrd = capi_maps.sign2map(a, var[a]) + if isintent_aux(var[a]): + _rules = aux_rules + else: + _rules = arg_rules + if not isintent_hide(var[a]): + if not isoptional(var[a]): + nth = nth + 1 + vrd['nth'] = repr(nth) + stnd[nth % 10] + ' argument' + else: + nthk = nthk + 1 + vrd['nth'] = repr(nthk) + stnd[nthk % 10] + ' keyword' + else: + vrd['nth'] = 'hidden' + savevrd[a] = vrd + for r in _rules: + if '_depend' in r: + continue + if ('_check' in r and r['_check'](var[a])) or ('_check' not in r): + ar = applyrules(r, vrd, var[a]) + rd = dictappend(rd, ar) + if '_break' in r: + break + for a in depargs: + if isintent_aux(var[a]): + _rules = aux_rules + else: + _rules = arg_rules + vrd = savevrd[a] + for r in _rules: + if '_depend' not in r: + continue + if ('_check' in r and r['_check'](var[a])) or ('_check' not in r): + ar = applyrules(r, vrd, var[a]) + rd = dictappend(rd, ar) + if '_break' in r: + break + if 'check' in var[a]: + for c in var[a]['check']: + vrd['check'] = c + ar = applyrules(check_rules, vrd, var[a]) + rd = dictappend(rd, ar) + if isinstance(rd['cleanupfrompyobj'], list): + rd['cleanupfrompyobj'].reverse() + if isinstance(rd['closepyobjfrom'], list): + rd['closepyobjfrom'].reverse() + rd['docsignature'] = stripcomma(replace('#docsign##docsignopt##docsignxa#', + {'docsign': rd['docsign'], + 'docsignopt': rd['docsignopt'], + 'docsignxa': rd['docsignxa']})) + optargs = stripcomma(replace('#docsignopt##docsignxa#', + {'docsignxa': rd['docsignxashort'], + 'docsignopt': rd['docsignoptshort']} + )) + if optargs == '': + rd['docsignatureshort'] = stripcomma( + replace('#docsign#', {'docsign': rd['docsign']})) + else: + rd['docsignatureshort'] = replace('#docsign#[#docsignopt#]', + {'docsign': rd['docsign'], + 'docsignopt': optargs, + }) + rd['latexdocsignatureshort'] = rd['docsignatureshort'].replace('_', '\\_') + rd['latexdocsignatureshort'] = rd[ + 'latexdocsignatureshort'].replace(',', ', ') + cfs = stripcomma(replace('#callfortran##callfortranappend#', { + 'callfortran': rd['callfortran'], 'callfortranappend': rd['callfortranappend']})) + if len(rd['callfortranappend']) > 1: + rd['callcompaqfortran'] = stripcomma(replace('#callfortran# 0,#callfortranappend#', { + 'callfortran': rd['callfortran'], 'callfortranappend': rd['callfortranappend']})) + else: + rd['callcompaqfortran'] = cfs + rd['callfortran'] = cfs + if isinstance(rd['docreturn'], list): + rd['docreturn'] = stripcomma( + replace('#docreturn#', {'docreturn': rd['docreturn']})) + ' = ' + rd['docstrsigns'] = [] + rd['latexdocstrsigns'] = [] + for k in ['docstrreq', 'docstropt', 'docstrout', 'docstrcbs']: + if k in rd and isinstance(rd[k], list): + rd['docstrsigns'] = rd['docstrsigns'] + rd[k] + k = 'latex' + k + if k in rd and isinstance(rd[k], list): + rd['latexdocstrsigns'] = rd['latexdocstrsigns'] + rd[k][0:1] +\ + ['\\begin{description}'] + rd[k][1:] +\ + ['\\end{description}'] + + # Workaround for Python 2.6, 2.6.1 bug: https://bugs.python.org/issue4720 + if rd['keyformat'] or rd['xaformat']: + argformat = rd['argformat'] + if isinstance(argformat, list): + argformat.append('|') + else: + assert isinstance(argformat, str), repr( + (argformat, type(argformat))) + rd['argformat'] += '|' + + ar = applyrules(routine_rules, rd) + if ismoduleroutine(rout): + outmess('\t\t\t %s\n' % (ar['docshort'])) + else: + outmess('\t\t %s\n' % (ar['docshort'])) + return ar, wrap + + +#################### EOF rules.py ####################### diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/setup.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/setup.py new file mode 100644 index 0000000000000000000000000000000000000000..c0c50ce5474ef012fd697733f24da0a0bd4ed034 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/setup.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python +""" +setup.py for installing F2PY + +Usage: + python setup.py install + +Copyright 2001-2005 Pearu Peterson all rights reserved, +Pearu Peterson +Permission to use, modify, and distribute this software is given under the +terms of the NumPy License. + +NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. +$Revision: 1.32 $ +$Date: 2005/01/30 17:22:14 $ +Pearu Peterson + +""" +from __future__ import division, print_function + +from numpy.distutils.core import setup +from numpy.distutils.misc_util import Configuration + + +from __version__ import version + + +def configuration(parent_package='', top_path=None): + config = Configuration('f2py', parent_package, top_path) + config.add_data_dir('tests') + config.add_data_files( + 'src/fortranobject.c', + 'src/fortranobject.h') + return config + + +if __name__ == "__main__": + + config = configuration(top_path='') + config = config.todict() + + config['download_url'] = "http://cens.ioc.ee/projects/f2py2e/2.x"\ + "/F2PY-2-latest.tar.gz" + config['classifiers'] = [ + 'Development Status :: 5 - Production/Stable', + 'Intended Audience :: Developers', + 'Intended Audience :: Science/Research', + 'License :: OSI Approved :: NumPy License', + 'Natural Language :: English', + 'Operating System :: OS Independent', + 'Programming Language :: C', + 'Programming Language :: Fortran', + 'Programming Language :: Python', + 'Topic :: Scientific/Engineering', + 'Topic :: Software Development :: Code Generators', + ] + setup(version=version, + description="F2PY - Fortran to Python Interface Generator", + author="Pearu Peterson", + author_email="pearu@cens.ioc.ee", + maintainer="Pearu Peterson", + maintainer_email="pearu@cens.ioc.ee", + license="BSD", + platforms="Unix, Windows (mingw|cygwin), Mac OSX", + long_description="""\ +The Fortran to Python Interface Generator, or F2PY for short, is a +command line tool (f2py) for generating Python C/API modules for +wrapping Fortran 77/90/95 subroutines, accessing common blocks from +Python, and calling Python functions from Fortran (call-backs). +Interfacing subroutines/data from Fortran 90/95 modules is supported.""", + url="http://cens.ioc.ee/projects/f2py2e/", + keywords=['Fortran', 'f2py'], + **config) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/tests/src/assumed_shape/.f2py_f2cmap b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/tests/src/assumed_shape/.f2py_f2cmap new file mode 100644 index 0000000000000000000000000000000000000000..2665f89b52d2f17ce7b0a857bea73ec5fab2df88 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/tests/src/assumed_shape/.f2py_f2cmap @@ -0,0 +1 @@ +dict(real=dict(rk="double")) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/tests/src/assumed_shape/foo_free.f90 b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/tests/src/assumed_shape/foo_free.f90 new file mode 100644 index 0000000000000000000000000000000000000000..b301710f5dda005e67e40cc21a5e0d62d0ec116a --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/tests/src/assumed_shape/foo_free.f90 @@ -0,0 +1,34 @@ + +subroutine sum(x, res) + implicit none + real, intent(in) :: x(:) + real, intent(out) :: res + + integer :: i + + !print *, "sum: size(x) = ", size(x) + + res = 0.0 + + do i = 1, size(x) + res = res + x(i) + enddo + +end subroutine sum + +function fsum(x) result (res) + implicit none + real, intent(in) :: x(:) + real :: res + + integer :: i + + !print *, "fsum: size(x) = ", size(x) + + res = 0.0 + + do i = 1, size(x) + res = res + x(i) + enddo + +end function fsum diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/tests/src/assumed_shape/foo_mod.f90 b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/tests/src/assumed_shape/foo_mod.f90 new file mode 100644 index 0000000000000000000000000000000000000000..cbe6317ed8f39f8a633b058a4ab64fe1797ea7b0 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/tests/src/assumed_shape/foo_mod.f90 @@ -0,0 +1,41 @@ + +module mod + +contains + +subroutine sum(x, res) + implicit none + real, intent(in) :: x(:) + real, intent(out) :: res + + integer :: i + + !print *, "sum: size(x) = ", size(x) + + res = 0.0 + + do i = 1, size(x) + res = res + x(i) + enddo + +end subroutine sum + +function fsum(x) result (res) + implicit none + real, intent(in) :: x(:) + real :: res + + integer :: i + + !print *, "fsum: size(x) = ", size(x) + + res = 0.0 + + do i = 1, size(x) + res = res + x(i) + enddo + +end function fsum + + +end module mod diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/tests/src/assumed_shape/foo_use.f90 b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/tests/src/assumed_shape/foo_use.f90 new file mode 100644 index 0000000000000000000000000000000000000000..337465ac540440fc8e8e10d23757af202e8a52a4 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/tests/src/assumed_shape/foo_use.f90 @@ -0,0 +1,19 @@ +subroutine sum_with_use(x, res) + use precision + + implicit none + + real(kind=rk), intent(in) :: x(:) + real(kind=rk), intent(out) :: res + + integer :: i + + !print *, "size(x) = ", size(x) + + res = 0.0 + + do i = 1, size(x) + res = res + x(i) + enddo + + end subroutine diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/tests/src/assumed_shape/precision.f90 b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/tests/src/assumed_shape/precision.f90 new file mode 100644 index 0000000000000000000000000000000000000000..ed6c70cbbe7dadfd50b616a8cc1570939ef5afd8 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/tests/src/assumed_shape/precision.f90 @@ -0,0 +1,4 @@ +module precision + integer, parameter :: rk = selected_real_kind(8) + integer, parameter :: ik = selected_real_kind(4) +end module diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/tests/src/common/block.f b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/tests/src/common/block.f new file mode 100644 index 0000000000000000000000000000000000000000..7ea7968fe935182bd17a697b316569546937b715 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/tests/src/common/block.f @@ -0,0 +1,11 @@ + SUBROUTINE INITCB + DOUBLE PRECISION LONG + CHARACTER STRING + INTEGER OK + + COMMON /BLOCK/ LONG, STRING, OK + LONG = 1.0 + STRING = '2' + OK = 3 + RETURN + END diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/tests/src/string/char.f90 b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/tests/src/string/char.f90 new file mode 100644 index 0000000000000000000000000000000000000000..bb7985ce50f2aa252aaca96aba6ef5d5f5d51844 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/tests/src/string/char.f90 @@ -0,0 +1,29 @@ +MODULE char_test + +CONTAINS + +SUBROUTINE change_strings(strings, n_strs, out_strings) + IMPLICIT NONE + + ! Inputs + INTEGER, INTENT(IN) :: n_strs + CHARACTER, INTENT(IN), DIMENSION(2,n_strs) :: strings + CHARACTER, INTENT(OUT), DIMENSION(2,n_strs) :: out_strings + +!f2py INTEGER, INTENT(IN) :: n_strs +!f2py CHARACTER, INTENT(IN), DIMENSION(2,n_strs) :: strings +!f2py CHARACTER, INTENT(OUT), DIMENSION(2,n_strs) :: strings + + ! Misc. + INTEGER*4 :: j + + + DO j=1, n_strs + out_strings(1,j) = strings(1,j) + out_strings(2,j) = 'A' + END DO + +END SUBROUTINE change_strings + +END MODULE char_test + diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/use_rules.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/use_rules.py new file mode 100644 index 0000000000000000000000000000000000000000..6f44f16345bd3551516509beda25cc51c386a614 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/f2py/use_rules.py @@ -0,0 +1,115 @@ +#!/usr/bin/env python +""" + +Build 'use others module data' mechanism for f2py2e. + +Unfinished. + +Copyright 2000 Pearu Peterson all rights reserved, +Pearu Peterson +Permission to use, modify, and distribute this software is given under the +terms of the NumPy License. + +NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. +$Date: 2000/09/10 12:35:43 $ +Pearu Peterson + +""" +from __future__ import division, absolute_import, print_function + +__version__ = "$Revision: 1.3 $"[10:-1] + +f2py_version = 'See `f2py -v`' + + +from .auxfuncs import ( + applyrules, dictappend, gentitle, hasnote, outmess +) + + +usemodule_rules = { + 'body': """ +#begintitle# +static char doc_#apiname#[] = \"\\\nVariable wrapper signature:\\n\\ +\t #name# = get_#name#()\\n\\ +Arguments:\\n\\ +#docstr#\"; +extern F_MODFUNC(#usemodulename#,#USEMODULENAME#,#realname#,#REALNAME#); +static PyObject *#apiname#(PyObject *capi_self, PyObject *capi_args) { +/*#decl#*/ +\tif (!PyArg_ParseTuple(capi_args, \"\")) goto capi_fail; +printf(\"c: %d\\n\",F_MODFUNC(#usemodulename#,#USEMODULENAME#,#realname#,#REALNAME#)); +\treturn Py_BuildValue(\"\"); +capi_fail: +\treturn NULL; +} +""", + 'method': '\t{\"get_#name#\",#apiname#,METH_VARARGS|METH_KEYWORDS,doc_#apiname#},', + 'need': ['F_MODFUNC'] +} + +################ + + +def buildusevars(m, r): + ret = {} + outmess( + '\t\tBuilding use variable hooks for module "%s" (feature only for F90/F95)...\n' % (m['name'])) + varsmap = {} + revmap = {} + if 'map' in r: + for k in r['map'].keys(): + if r['map'][k] in revmap: + outmess('\t\t\tVariable "%s<=%s" is already mapped by "%s". Skipping.\n' % ( + r['map'][k], k, revmap[r['map'][k]])) + else: + revmap[r['map'][k]] = k + if 'only' in r and r['only']: + for v in r['map'].keys(): + if r['map'][v] in m['vars']: + + if revmap[r['map'][v]] == v: + varsmap[v] = r['map'][v] + else: + outmess('\t\t\tIgnoring map "%s=>%s". See above.\n' % + (v, r['map'][v])) + else: + outmess( + '\t\t\tNo definition for variable "%s=>%s". Skipping.\n' % (v, r['map'][v])) + else: + for v in m['vars'].keys(): + if v in revmap: + varsmap[v] = revmap[v] + else: + varsmap[v] = v + for v in varsmap.keys(): + ret = dictappend(ret, buildusevar(v, varsmap[v], m['vars'], m['name'])) + return ret + + +def buildusevar(name, realname, vars, usemodulename): + outmess('\t\t\tConstructing wrapper function for variable "%s=>%s"...\n' % ( + name, realname)) + ret = {} + vrd = {'name': name, + 'realname': realname, + 'REALNAME': realname.upper(), + 'usemodulename': usemodulename, + 'USEMODULENAME': usemodulename.upper(), + 'texname': name.replace('_', '\\_'), + 'begintitle': gentitle('%s=>%s' % (name, realname)), + 'endtitle': gentitle('end of %s=>%s' % (name, realname)), + 'apiname': '#modulename#_use_%s_from_%s' % (realname, usemodulename) + } + nummap = {0: 'Ro', 1: 'Ri', 2: 'Rii', 3: 'Riii', 4: 'Riv', + 5: 'Rv', 6: 'Rvi', 7: 'Rvii', 8: 'Rviii', 9: 'Rix'} + vrd['texnamename'] = name + for i in nummap.keys(): + vrd['texnamename'] = vrd['texnamename'].replace(repr(i), nummap[i]) + if hasnote(vars[realname]): + vrd['note'] = vars[realname]['note'] + rd = dictappend({}, vrd) + + print(name, realname, vars[realname]) + ret = applyrules(usemodule_rules, rd) + return ret diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/fft/fftpack.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/fft/fftpack.py new file mode 100644 index 0000000000000000000000000000000000000000..de675936f449e13e16775e240d0d105769168555 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/fft/fftpack.py @@ -0,0 +1,1302 @@ +""" +Discrete Fourier Transforms + +Routines in this module: + +fft(a, n=None, axis=-1) +ifft(a, n=None, axis=-1) +rfft(a, n=None, axis=-1) +irfft(a, n=None, axis=-1) +hfft(a, n=None, axis=-1) +ihfft(a, n=None, axis=-1) +fftn(a, s=None, axes=None) +ifftn(a, s=None, axes=None) +rfftn(a, s=None, axes=None) +irfftn(a, s=None, axes=None) +fft2(a, s=None, axes=(-2,-1)) +ifft2(a, s=None, axes=(-2, -1)) +rfft2(a, s=None, axes=(-2,-1)) +irfft2(a, s=None, axes=(-2, -1)) + +i = inverse transform +r = transform of purely real data +h = Hermite transform +n = n-dimensional transform +2 = 2-dimensional transform +(Note: 2D routines are just nD routines with different default +behavior.) + +The underlying code for these functions is an f2c-translated and modified +version of the FFTPACK routines. + +""" +from __future__ import division, absolute_import, print_function + +__all__ = ['fft', 'ifft', 'rfft', 'irfft', 'hfft', 'ihfft', 'rfftn', + 'irfftn', 'rfft2', 'irfft2', 'fft2', 'ifft2', 'fftn', 'ifftn'] + +import functools + +from numpy.core import (array, asarray, zeros, swapaxes, shape, conjugate, + take, sqrt) +from numpy.core.multiarray import normalize_axis_index +from numpy.core import overrides +from . import fftpack_lite as fftpack +from .helper import _FFTCache + +_fft_cache = _FFTCache(max_size_in_mb=100, max_item_count=32) +_real_fft_cache = _FFTCache(max_size_in_mb=100, max_item_count=32) + + +array_function_dispatch = functools.partial( + overrides.array_function_dispatch, module='numpy.fft') + + +def _raw_fft(a, n=None, axis=-1, init_function=fftpack.cffti, + work_function=fftpack.cfftf, fft_cache=_fft_cache): + a = asarray(a) + axis = normalize_axis_index(axis, a.ndim) + + if n is None: + n = a.shape[axis] + + if n < 1: + raise ValueError("Invalid number of FFT data points (%d) specified." + % n) + + # We have to ensure that only a single thread can access a wsave array + # at any given time. Thus we remove it from the cache and insert it + # again after it has been used. Multiple threads might create multiple + # copies of the wsave array. This is intentional and a limitation of + # the current C code. + wsave = fft_cache.pop_twiddle_factors(n) + if wsave is None: + wsave = init_function(n) + + if a.shape[axis] != n: + s = list(a.shape) + if s[axis] > n: + index = [slice(None)]*len(s) + index[axis] = slice(0, n) + a = a[tuple(index)] + else: + index = [slice(None)]*len(s) + index[axis] = slice(0, s[axis]) + s[axis] = n + z = zeros(s, a.dtype.char) + z[tuple(index)] = a + a = z + + if axis != a.ndim - 1: + a = swapaxes(a, axis, -1) + r = work_function(a, wsave) + if axis != a.ndim - 1: + r = swapaxes(r, axis, -1) + + # As soon as we put wsave back into the cache, another thread could pick it + # up and start using it, so we must not do this until after we're + # completely done using it ourselves. + fft_cache.put_twiddle_factors(n, wsave) + + return r + + +def _unitary(norm): + if norm not in (None, "ortho"): + raise ValueError("Invalid norm value %s, should be None or \"ortho\"." + % norm) + return norm is not None + + +def _fft_dispatcher(a, n=None, axis=None, norm=None): + return (a,) + + +@array_function_dispatch(_fft_dispatcher) +def fft(a, n=None, axis=-1, norm=None): + """ + Compute the one-dimensional discrete Fourier Transform. + + This function computes the one-dimensional *n*-point discrete Fourier + Transform (DFT) with the efficient Fast Fourier Transform (FFT) + algorithm [CT]. + + Parameters + ---------- + a : array_like + Input array, can be complex. + n : int, optional + Length of the transformed axis of the output. + If `n` is smaller than the length of the input, the input is cropped. + If it is larger, the input is padded with zeros. If `n` is not given, + the length of the input along the axis specified by `axis` is used. + axis : int, optional + Axis over which to compute the FFT. If not given, the last axis is + used. + norm : {None, "ortho"}, optional + .. versionadded:: 1.10.0 + + Normalization mode (see `numpy.fft`). Default is None. + + Returns + ------- + out : complex ndarray + The truncated or zero-padded input, transformed along the axis + indicated by `axis`, or the last one if `axis` is not specified. + + Raises + ------ + IndexError + if `axes` is larger than the last axis of `a`. + + See Also + -------- + numpy.fft : for definition of the DFT and conventions used. + ifft : The inverse of `fft`. + fft2 : The two-dimensional FFT. + fftn : The *n*-dimensional FFT. + rfftn : The *n*-dimensional FFT of real input. + fftfreq : Frequency bins for given FFT parameters. + + Notes + ----- + FFT (Fast Fourier Transform) refers to a way the discrete Fourier + Transform (DFT) can be calculated efficiently, by using symmetries in the + calculated terms. The symmetry is highest when `n` is a power of 2, and + the transform is therefore most efficient for these sizes. + + The DFT is defined, with the conventions used in this implementation, in + the documentation for the `numpy.fft` module. + + References + ---------- + .. [CT] Cooley, James W., and John W. Tukey, 1965, "An algorithm for the + machine calculation of complex Fourier series," *Math. Comput.* + 19: 297-301. + + Examples + -------- + >>> np.fft.fft(np.exp(2j * np.pi * np.arange(8) / 8)) + array([ -3.44505240e-16 +1.14383329e-17j, + 8.00000000e+00 -5.71092652e-15j, + 2.33482938e-16 +1.22460635e-16j, + 1.64863782e-15 +1.77635684e-15j, + 9.95839695e-17 +2.33482938e-16j, + 0.00000000e+00 +1.66837030e-15j, + 1.14383329e-17 +1.22460635e-16j, + -1.64863782e-15 +1.77635684e-15j]) + + In this example, real input has an FFT which is Hermitian, i.e., symmetric + in the real part and anti-symmetric in the imaginary part, as described in + the `numpy.fft` documentation: + + >>> import matplotlib.pyplot as plt + >>> t = np.arange(256) + >>> sp = np.fft.fft(np.sin(t)) + >>> freq = np.fft.fftfreq(t.shape[-1]) + >>> plt.plot(freq, sp.real, freq, sp.imag) + [, ] + >>> plt.show() + + """ + + a = asarray(a).astype(complex, copy=False) + if n is None: + n = a.shape[axis] + output = _raw_fft(a, n, axis, fftpack.cffti, fftpack.cfftf, _fft_cache) + if _unitary(norm): + output *= 1 / sqrt(n) + return output + + +@array_function_dispatch(_fft_dispatcher) +def ifft(a, n=None, axis=-1, norm=None): + """ + Compute the one-dimensional inverse discrete Fourier Transform. + + This function computes the inverse of the one-dimensional *n*-point + discrete Fourier transform computed by `fft`. In other words, + ``ifft(fft(a)) == a`` to within numerical accuracy. + For a general description of the algorithm and definitions, + see `numpy.fft`. + + The input should be ordered in the same way as is returned by `fft`, + i.e., + + * ``a[0]`` should contain the zero frequency term, + * ``a[1:n//2]`` should contain the positive-frequency terms, + * ``a[n//2 + 1:]`` should contain the negative-frequency terms, in + increasing order starting from the most negative frequency. + + For an even number of input points, ``A[n//2]`` represents the sum of + the values at the positive and negative Nyquist frequencies, as the two + are aliased together. See `numpy.fft` for details. + + Parameters + ---------- + a : array_like + Input array, can be complex. + n : int, optional + Length of the transformed axis of the output. + If `n` is smaller than the length of the input, the input is cropped. + If it is larger, the input is padded with zeros. If `n` is not given, + the length of the input along the axis specified by `axis` is used. + See notes about padding issues. + axis : int, optional + Axis over which to compute the inverse DFT. If not given, the last + axis is used. + norm : {None, "ortho"}, optional + .. versionadded:: 1.10.0 + + Normalization mode (see `numpy.fft`). Default is None. + + Returns + ------- + out : complex ndarray + The truncated or zero-padded input, transformed along the axis + indicated by `axis`, or the last one if `axis` is not specified. + + Raises + ------ + IndexError + If `axes` is larger than the last axis of `a`. + + See Also + -------- + numpy.fft : An introduction, with definitions and general explanations. + fft : The one-dimensional (forward) FFT, of which `ifft` is the inverse + ifft2 : The two-dimensional inverse FFT. + ifftn : The n-dimensional inverse FFT. + + Notes + ----- + If the input parameter `n` is larger than the size of the input, the input + is padded by appending zeros at the end. Even though this is the common + approach, it might lead to surprising results. If a different padding is + desired, it must be performed before calling `ifft`. + + Examples + -------- + >>> np.fft.ifft([0, 4, 0, 0]) + array([ 1.+0.j, 0.+1.j, -1.+0.j, 0.-1.j]) + + Create and plot a band-limited signal with random phases: + + >>> import matplotlib.pyplot as plt + >>> t = np.arange(400) + >>> n = np.zeros((400,), dtype=complex) + >>> n[40:60] = np.exp(1j*np.random.uniform(0, 2*np.pi, (20,))) + >>> s = np.fft.ifft(n) + >>> plt.plot(t, s.real, 'b-', t, s.imag, 'r--') + ... + >>> plt.legend(('real', 'imaginary')) + ... + >>> plt.show() + + """ + # The copy may be required for multithreading. + a = array(a, copy=True, dtype=complex) + if n is None: + n = a.shape[axis] + unitary = _unitary(norm) + output = _raw_fft(a, n, axis, fftpack.cffti, fftpack.cfftb, _fft_cache) + return output * (1 / (sqrt(n) if unitary else n)) + + + +@array_function_dispatch(_fft_dispatcher) +def rfft(a, n=None, axis=-1, norm=None): + """ + Compute the one-dimensional discrete Fourier Transform for real input. + + This function computes the one-dimensional *n*-point discrete Fourier + Transform (DFT) of a real-valued array by means of an efficient algorithm + called the Fast Fourier Transform (FFT). + + Parameters + ---------- + a : array_like + Input array + n : int, optional + Number of points along transformation axis in the input to use. + If `n` is smaller than the length of the input, the input is cropped. + If it is larger, the input is padded with zeros. If `n` is not given, + the length of the input along the axis specified by `axis` is used. + axis : int, optional + Axis over which to compute the FFT. If not given, the last axis is + used. + norm : {None, "ortho"}, optional + .. versionadded:: 1.10.0 + + Normalization mode (see `numpy.fft`). Default is None. + + Returns + ------- + out : complex ndarray + The truncated or zero-padded input, transformed along the axis + indicated by `axis`, or the last one if `axis` is not specified. + If `n` is even, the length of the transformed axis is ``(n/2)+1``. + If `n` is odd, the length is ``(n+1)/2``. + + Raises + ------ + IndexError + If `axis` is larger than the last axis of `a`. + + See Also + -------- + numpy.fft : For definition of the DFT and conventions used. + irfft : The inverse of `rfft`. + fft : The one-dimensional FFT of general (complex) input. + fftn : The *n*-dimensional FFT. + rfftn : The *n*-dimensional FFT of real input. + + Notes + ----- + When the DFT is computed for purely real input, the output is + Hermitian-symmetric, i.e. the negative frequency terms are just the complex + conjugates of the corresponding positive-frequency terms, and the + negative-frequency terms are therefore redundant. This function does not + compute the negative frequency terms, and the length of the transformed + axis of the output is therefore ``n//2 + 1``. + + When ``A = rfft(a)`` and fs is the sampling frequency, ``A[0]`` contains + the zero-frequency term 0*fs, which is real due to Hermitian symmetry. + + If `n` is even, ``A[-1]`` contains the term representing both positive + and negative Nyquist frequency (+fs/2 and -fs/2), and must also be purely + real. If `n` is odd, there is no term at fs/2; ``A[-1]`` contains + the largest positive frequency (fs/2*(n-1)/n), and is complex in the + general case. + + If the input `a` contains an imaginary part, it is silently discarded. + + Examples + -------- + >>> np.fft.fft([0, 1, 0, 0]) + array([ 1.+0.j, 0.-1.j, -1.+0.j, 0.+1.j]) + >>> np.fft.rfft([0, 1, 0, 0]) + array([ 1.+0.j, 0.-1.j, -1.+0.j]) + + Notice how the final element of the `fft` output is the complex conjugate + of the second element, for real input. For `rfft`, this symmetry is + exploited to compute only the non-negative frequency terms. + + """ + # The copy may be required for multithreading. + a = array(a, copy=True, dtype=float) + output = _raw_fft(a, n, axis, fftpack.rffti, fftpack.rfftf, + _real_fft_cache) + if _unitary(norm): + if n is None: + n = a.shape[axis] + output *= 1 / sqrt(n) + return output + + +@array_function_dispatch(_fft_dispatcher) +def irfft(a, n=None, axis=-1, norm=None): + """ + Compute the inverse of the n-point DFT for real input. + + This function computes the inverse of the one-dimensional *n*-point + discrete Fourier Transform of real input computed by `rfft`. + In other words, ``irfft(rfft(a), len(a)) == a`` to within numerical + accuracy. (See Notes below for why ``len(a)`` is necessary here.) + + The input is expected to be in the form returned by `rfft`, i.e. the + real zero-frequency term followed by the complex positive frequency terms + in order of increasing frequency. Since the discrete Fourier Transform of + real input is Hermitian-symmetric, the negative frequency terms are taken + to be the complex conjugates of the corresponding positive frequency terms. + + Parameters + ---------- + a : array_like + The input array. + n : int, optional + Length of the transformed axis of the output. + For `n` output points, ``n//2+1`` input points are necessary. If the + input is longer than this, it is cropped. If it is shorter than this, + it is padded with zeros. If `n` is not given, it is determined from + the length of the input along the axis specified by `axis`. + axis : int, optional + Axis over which to compute the inverse FFT. If not given, the last + axis is used. + norm : {None, "ortho"}, optional + .. versionadded:: 1.10.0 + + Normalization mode (see `numpy.fft`). Default is None. + + Returns + ------- + out : ndarray + The truncated or zero-padded input, transformed along the axis + indicated by `axis`, or the last one if `axis` is not specified. + The length of the transformed axis is `n`, or, if `n` is not given, + ``2*(m-1)`` where ``m`` is the length of the transformed axis of the + input. To get an odd number of output points, `n` must be specified. + + Raises + ------ + IndexError + If `axis` is larger than the last axis of `a`. + + See Also + -------- + numpy.fft : For definition of the DFT and conventions used. + rfft : The one-dimensional FFT of real input, of which `irfft` is inverse. + fft : The one-dimensional FFT. + irfft2 : The inverse of the two-dimensional FFT of real input. + irfftn : The inverse of the *n*-dimensional FFT of real input. + + Notes + ----- + Returns the real valued `n`-point inverse discrete Fourier transform + of `a`, where `a` contains the non-negative frequency terms of a + Hermitian-symmetric sequence. `n` is the length of the result, not the + input. + + If you specify an `n` such that `a` must be zero-padded or truncated, the + extra/removed values will be added/removed at high frequencies. One can + thus resample a series to `m` points via Fourier interpolation by: + ``a_resamp = irfft(rfft(a), m)``. + + Examples + -------- + >>> np.fft.ifft([1, -1j, -1, 1j]) + array([ 0.+0.j, 1.+0.j, 0.+0.j, 0.+0.j]) + >>> np.fft.irfft([1, -1j, -1]) + array([ 0., 1., 0., 0.]) + + Notice how the last term in the input to the ordinary `ifft` is the + complex conjugate of the second term, and the output has zero imaginary + part everywhere. When calling `irfft`, the negative frequencies are not + specified, and the output array is purely real. + + """ + # The copy may be required for multithreading. + a = array(a, copy=True, dtype=complex) + if n is None: + n = (a.shape[axis] - 1) * 2 + unitary = _unitary(norm) + output = _raw_fft(a, n, axis, fftpack.rffti, fftpack.rfftb, + _real_fft_cache) + return output * (1 / (sqrt(n) if unitary else n)) + + +@array_function_dispatch(_fft_dispatcher) +def hfft(a, n=None, axis=-1, norm=None): + """ + Compute the FFT of a signal that has Hermitian symmetry, i.e., a real + spectrum. + + Parameters + ---------- + a : array_like + The input array. + n : int, optional + Length of the transformed axis of the output. For `n` output + points, ``n//2 + 1`` input points are necessary. If the input is + longer than this, it is cropped. If it is shorter than this, it is + padded with zeros. If `n` is not given, it is determined from the + length of the input along the axis specified by `axis`. + axis : int, optional + Axis over which to compute the FFT. If not given, the last + axis is used. + norm : {None, "ortho"}, optional + Normalization mode (see `numpy.fft`). Default is None. + + .. versionadded:: 1.10.0 + + Returns + ------- + out : ndarray + The truncated or zero-padded input, transformed along the axis + indicated by `axis`, or the last one if `axis` is not specified. + The length of the transformed axis is `n`, or, if `n` is not given, + ``2*m - 2`` where ``m`` is the length of the transformed axis of + the input. To get an odd number of output points, `n` must be + specified, for instance as ``2*m - 1`` in the typical case, + + Raises + ------ + IndexError + If `axis` is larger than the last axis of `a`. + + See also + -------- + rfft : Compute the one-dimensional FFT for real input. + ihfft : The inverse of `hfft`. + + Notes + ----- + `hfft`/`ihfft` are a pair analogous to `rfft`/`irfft`, but for the + opposite case: here the signal has Hermitian symmetry in the time + domain and is real in the frequency domain. So here it's `hfft` for + which you must supply the length of the result if it is to be odd. + + * even: ``ihfft(hfft(a, 2*len(a) - 2) == a``, within roundoff error, + * odd: ``ihfft(hfft(a, 2*len(a) - 1) == a``, within roundoff error. + + Examples + -------- + >>> signal = np.array([1, 2, 3, 4, 3, 2]) + >>> np.fft.fft(signal) + array([ 15.+0.j, -4.+0.j, 0.+0.j, -1.-0.j, 0.+0.j, -4.+0.j]) + >>> np.fft.hfft(signal[:4]) # Input first half of signal + array([ 15., -4., 0., -1., 0., -4.]) + >>> np.fft.hfft(signal, 6) # Input entire signal and truncate + array([ 15., -4., 0., -1., 0., -4.]) + + + >>> signal = np.array([[1, 1.j], [-1.j, 2]]) + >>> np.conj(signal.T) - signal # check Hermitian symmetry + array([[ 0.-0.j, 0.+0.j], + [ 0.+0.j, 0.-0.j]]) + >>> freq_spectrum = np.fft.hfft(signal) + >>> freq_spectrum + array([[ 1., 1.], + [ 2., -2.]]) + + """ + # The copy may be required for multithreading. + a = array(a, copy=True, dtype=complex) + if n is None: + n = (a.shape[axis] - 1) * 2 + unitary = _unitary(norm) + return irfft(conjugate(a), n, axis) * (sqrt(n) if unitary else n) + + +@array_function_dispatch(_fft_dispatcher) +def ihfft(a, n=None, axis=-1, norm=None): + """ + Compute the inverse FFT of a signal that has Hermitian symmetry. + + Parameters + ---------- + a : array_like + Input array. + n : int, optional + Length of the inverse FFT, the number of points along + transformation axis in the input to use. If `n` is smaller than + the length of the input, the input is cropped. If it is larger, + the input is padded with zeros. If `n` is not given, the length of + the input along the axis specified by `axis` is used. + axis : int, optional + Axis over which to compute the inverse FFT. If not given, the last + axis is used. + norm : {None, "ortho"}, optional + Normalization mode (see `numpy.fft`). Default is None. + + .. versionadded:: 1.10.0 + + Returns + ------- + out : complex ndarray + The truncated or zero-padded input, transformed along the axis + indicated by `axis`, or the last one if `axis` is not specified. + The length of the transformed axis is ``n//2 + 1``. + + See also + -------- + hfft, irfft + + Notes + ----- + `hfft`/`ihfft` are a pair analogous to `rfft`/`irfft`, but for the + opposite case: here the signal has Hermitian symmetry in the time + domain and is real in the frequency domain. So here it's `hfft` for + which you must supply the length of the result if it is to be odd: + + * even: ``ihfft(hfft(a, 2*len(a) - 2) == a``, within roundoff error, + * odd: ``ihfft(hfft(a, 2*len(a) - 1) == a``, within roundoff error. + + Examples + -------- + >>> spectrum = np.array([ 15, -4, 0, -1, 0, -4]) + >>> np.fft.ifft(spectrum) + array([ 1.+0.j, 2.-0.j, 3.+0.j, 4.+0.j, 3.+0.j, 2.-0.j]) + >>> np.fft.ihfft(spectrum) + array([ 1.-0.j, 2.-0.j, 3.-0.j, 4.-0.j]) + + """ + # The copy may be required for multithreading. + a = array(a, copy=True, dtype=float) + if n is None: + n = a.shape[axis] + unitary = _unitary(norm) + output = conjugate(rfft(a, n, axis)) + return output * (1 / (sqrt(n) if unitary else n)) + + +def _cook_nd_args(a, s=None, axes=None, invreal=0): + if s is None: + shapeless = 1 + if axes is None: + s = list(a.shape) + else: + s = take(a.shape, axes) + else: + shapeless = 0 + s = list(s) + if axes is None: + axes = list(range(-len(s), 0)) + if len(s) != len(axes): + raise ValueError("Shape and axes have different lengths.") + if invreal and shapeless: + s[-1] = (a.shape[axes[-1]] - 1) * 2 + return s, axes + + +def _raw_fftnd(a, s=None, axes=None, function=fft, norm=None): + a = asarray(a) + s, axes = _cook_nd_args(a, s, axes) + itl = list(range(len(axes))) + itl.reverse() + for ii in itl: + a = function(a, n=s[ii], axis=axes[ii], norm=norm) + return a + + +def _fftn_dispatcher(a, s=None, axes=None, norm=None): + return (a,) + + +@array_function_dispatch(_fftn_dispatcher) +def fftn(a, s=None, axes=None, norm=None): + """ + Compute the N-dimensional discrete Fourier Transform. + + This function computes the *N*-dimensional discrete Fourier Transform over + any number of axes in an *M*-dimensional array by means of the Fast Fourier + Transform (FFT). + + Parameters + ---------- + a : array_like + Input array, can be complex. + s : sequence of ints, optional + Shape (length of each transformed axis) of the output + (``s[0]`` refers to axis 0, ``s[1]`` to axis 1, etc.). + This corresponds to ``n`` for ``fft(x, n)``. + Along any axis, if the given shape is smaller than that of the input, + the input is cropped. If it is larger, the input is padded with zeros. + if `s` is not given, the shape of the input along the axes specified + by `axes` is used. + axes : sequence of ints, optional + Axes over which to compute the FFT. If not given, the last ``len(s)`` + axes are used, or all axes if `s` is also not specified. + Repeated indices in `axes` means that the transform over that axis is + performed multiple times. + norm : {None, "ortho"}, optional + .. versionadded:: 1.10.0 + + Normalization mode (see `numpy.fft`). Default is None. + + Returns + ------- + out : complex ndarray + The truncated or zero-padded input, transformed along the axes + indicated by `axes`, or by a combination of `s` and `a`, + as explained in the parameters section above. + + Raises + ------ + ValueError + If `s` and `axes` have different length. + IndexError + If an element of `axes` is larger than than the number of axes of `a`. + + See Also + -------- + numpy.fft : Overall view of discrete Fourier transforms, with definitions + and conventions used. + ifftn : The inverse of `fftn`, the inverse *n*-dimensional FFT. + fft : The one-dimensional FFT, with definitions and conventions used. + rfftn : The *n*-dimensional FFT of real input. + fft2 : The two-dimensional FFT. + fftshift : Shifts zero-frequency terms to centre of array + + Notes + ----- + The output, analogously to `fft`, contains the term for zero frequency in + the low-order corner of all axes, the positive frequency terms in the + first half of all axes, the term for the Nyquist frequency in the middle + of all axes and the negative frequency terms in the second half of all + axes, in order of decreasingly negative frequency. + + See `numpy.fft` for details, definitions and conventions used. + + Examples + -------- + >>> a = np.mgrid[:3, :3, :3][0] + >>> np.fft.fftn(a, axes=(1, 2)) + array([[[ 0.+0.j, 0.+0.j, 0.+0.j], + [ 0.+0.j, 0.+0.j, 0.+0.j], + [ 0.+0.j, 0.+0.j, 0.+0.j]], + [[ 9.+0.j, 0.+0.j, 0.+0.j], + [ 0.+0.j, 0.+0.j, 0.+0.j], + [ 0.+0.j, 0.+0.j, 0.+0.j]], + [[ 18.+0.j, 0.+0.j, 0.+0.j], + [ 0.+0.j, 0.+0.j, 0.+0.j], + [ 0.+0.j, 0.+0.j, 0.+0.j]]]) + >>> np.fft.fftn(a, (2, 2), axes=(0, 1)) + array([[[ 2.+0.j, 2.+0.j, 2.+0.j], + [ 0.+0.j, 0.+0.j, 0.+0.j]], + [[-2.+0.j, -2.+0.j, -2.+0.j], + [ 0.+0.j, 0.+0.j, 0.+0.j]]]) + + >>> import matplotlib.pyplot as plt + >>> [X, Y] = np.meshgrid(2 * np.pi * np.arange(200) / 12, + ... 2 * np.pi * np.arange(200) / 34) + >>> S = np.sin(X) + np.cos(Y) + np.random.uniform(0, 1, X.shape) + >>> FS = np.fft.fftn(S) + >>> plt.imshow(np.log(np.abs(np.fft.fftshift(FS))**2)) + + >>> plt.show() + + """ + + return _raw_fftnd(a, s, axes, fft, norm) + + +@array_function_dispatch(_fftn_dispatcher) +def ifftn(a, s=None, axes=None, norm=None): + """ + Compute the N-dimensional inverse discrete Fourier Transform. + + This function computes the inverse of the N-dimensional discrete + Fourier Transform over any number of axes in an M-dimensional array by + means of the Fast Fourier Transform (FFT). In other words, + ``ifftn(fftn(a)) == a`` to within numerical accuracy. + For a description of the definitions and conventions used, see `numpy.fft`. + + The input, analogously to `ifft`, should be ordered in the same way as is + returned by `fftn`, i.e. it should have the term for zero frequency + in all axes in the low-order corner, the positive frequency terms in the + first half of all axes, the term for the Nyquist frequency in the middle + of all axes and the negative frequency terms in the second half of all + axes, in order of decreasingly negative frequency. + + Parameters + ---------- + a : array_like + Input array, can be complex. + s : sequence of ints, optional + Shape (length of each transformed axis) of the output + (``s[0]`` refers to axis 0, ``s[1]`` to axis 1, etc.). + This corresponds to ``n`` for ``ifft(x, n)``. + Along any axis, if the given shape is smaller than that of the input, + the input is cropped. If it is larger, the input is padded with zeros. + if `s` is not given, the shape of the input along the axes specified + by `axes` is used. See notes for issue on `ifft` zero padding. + axes : sequence of ints, optional + Axes over which to compute the IFFT. If not given, the last ``len(s)`` + axes are used, or all axes if `s` is also not specified. + Repeated indices in `axes` means that the inverse transform over that + axis is performed multiple times. + norm : {None, "ortho"}, optional + .. versionadded:: 1.10.0 + + Normalization mode (see `numpy.fft`). Default is None. + + Returns + ------- + out : complex ndarray + The truncated or zero-padded input, transformed along the axes + indicated by `axes`, or by a combination of `s` or `a`, + as explained in the parameters section above. + + Raises + ------ + ValueError + If `s` and `axes` have different length. + IndexError + If an element of `axes` is larger than than the number of axes of `a`. + + See Also + -------- + numpy.fft : Overall view of discrete Fourier transforms, with definitions + and conventions used. + fftn : The forward *n*-dimensional FFT, of which `ifftn` is the inverse. + ifft : The one-dimensional inverse FFT. + ifft2 : The two-dimensional inverse FFT. + ifftshift : Undoes `fftshift`, shifts zero-frequency terms to beginning + of array. + + Notes + ----- + See `numpy.fft` for definitions and conventions used. + + Zero-padding, analogously with `ifft`, is performed by appending zeros to + the input along the specified dimension. Although this is the common + approach, it might lead to surprising results. If another form of zero + padding is desired, it must be performed before `ifftn` is called. + + Examples + -------- + >>> a = np.eye(4) + >>> np.fft.ifftn(np.fft.fftn(a, axes=(0,)), axes=(1,)) + array([[ 1.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], + [ 0.+0.j, 1.+0.j, 0.+0.j, 0.+0.j], + [ 0.+0.j, 0.+0.j, 1.+0.j, 0.+0.j], + [ 0.+0.j, 0.+0.j, 0.+0.j, 1.+0.j]]) + + + Create and plot an image with band-limited frequency content: + + >>> import matplotlib.pyplot as plt + >>> n = np.zeros((200,200), dtype=complex) + >>> n[60:80, 20:40] = np.exp(1j*np.random.uniform(0, 2*np.pi, (20, 20))) + >>> im = np.fft.ifftn(n).real + >>> plt.imshow(im) + + >>> plt.show() + + """ + + return _raw_fftnd(a, s, axes, ifft, norm) + + +@array_function_dispatch(_fftn_dispatcher) +def fft2(a, s=None, axes=(-2, -1), norm=None): + """ + Compute the 2-dimensional discrete Fourier Transform + + This function computes the *n*-dimensional discrete Fourier Transform + over any axes in an *M*-dimensional array by means of the + Fast Fourier Transform (FFT). By default, the transform is computed over + the last two axes of the input array, i.e., a 2-dimensional FFT. + + Parameters + ---------- + a : array_like + Input array, can be complex + s : sequence of ints, optional + Shape (length of each transformed axis) of the output + (``s[0]`` refers to axis 0, ``s[1]`` to axis 1, etc.). + This corresponds to ``n`` for ``fft(x, n)``. + Along each axis, if the given shape is smaller than that of the input, + the input is cropped. If it is larger, the input is padded with zeros. + if `s` is not given, the shape of the input along the axes specified + by `axes` is used. + axes : sequence of ints, optional + Axes over which to compute the FFT. If not given, the last two + axes are used. A repeated index in `axes` means the transform over + that axis is performed multiple times. A one-element sequence means + that a one-dimensional FFT is performed. + norm : {None, "ortho"}, optional + .. versionadded:: 1.10.0 + + Normalization mode (see `numpy.fft`). Default is None. + + Returns + ------- + out : complex ndarray + The truncated or zero-padded input, transformed along the axes + indicated by `axes`, or the last two axes if `axes` is not given. + + Raises + ------ + ValueError + If `s` and `axes` have different length, or `axes` not given and + ``len(s) != 2``. + IndexError + If an element of `axes` is larger than than the number of axes of `a`. + + See Also + -------- + numpy.fft : Overall view of discrete Fourier transforms, with definitions + and conventions used. + ifft2 : The inverse two-dimensional FFT. + fft : The one-dimensional FFT. + fftn : The *n*-dimensional FFT. + fftshift : Shifts zero-frequency terms to the center of the array. + For two-dimensional input, swaps first and third quadrants, and second + and fourth quadrants. + + Notes + ----- + `fft2` is just `fftn` with a different default for `axes`. + + The output, analogously to `fft`, contains the term for zero frequency in + the low-order corner of the transformed axes, the positive frequency terms + in the first half of these axes, the term for the Nyquist frequency in the + middle of the axes and the negative frequency terms in the second half of + the axes, in order of decreasingly negative frequency. + + See `fftn` for details and a plotting example, and `numpy.fft` for + definitions and conventions used. + + + Examples + -------- + >>> a = np.mgrid[:5, :5][0] + >>> np.fft.fft2(a) + array([[ 50.0 +0.j , 0.0 +0.j , 0.0 +0.j , + 0.0 +0.j , 0.0 +0.j ], + [-12.5+17.20477401j, 0.0 +0.j , 0.0 +0.j , + 0.0 +0.j , 0.0 +0.j ], + [-12.5 +4.0614962j , 0.0 +0.j , 0.0 +0.j , + 0.0 +0.j , 0.0 +0.j ], + [-12.5 -4.0614962j , 0.0 +0.j , 0.0 +0.j , + 0.0 +0.j , 0.0 +0.j ], + [-12.5-17.20477401j, 0.0 +0.j , 0.0 +0.j , + 0.0 +0.j , 0.0 +0.j ]]) + + """ + + return _raw_fftnd(a, s, axes, fft, norm) + + +@array_function_dispatch(_fftn_dispatcher) +def ifft2(a, s=None, axes=(-2, -1), norm=None): + """ + Compute the 2-dimensional inverse discrete Fourier Transform. + + This function computes the inverse of the 2-dimensional discrete Fourier + Transform over any number of axes in an M-dimensional array by means of + the Fast Fourier Transform (FFT). In other words, ``ifft2(fft2(a)) == a`` + to within numerical accuracy. By default, the inverse transform is + computed over the last two axes of the input array. + + The input, analogously to `ifft`, should be ordered in the same way as is + returned by `fft2`, i.e. it should have the term for zero frequency + in the low-order corner of the two axes, the positive frequency terms in + the first half of these axes, the term for the Nyquist frequency in the + middle of the axes and the negative frequency terms in the second half of + both axes, in order of decreasingly negative frequency. + + Parameters + ---------- + a : array_like + Input array, can be complex. + s : sequence of ints, optional + Shape (length of each axis) of the output (``s[0]`` refers to axis 0, + ``s[1]`` to axis 1, etc.). This corresponds to `n` for ``ifft(x, n)``. + Along each axis, if the given shape is smaller than that of the input, + the input is cropped. If it is larger, the input is padded with zeros. + if `s` is not given, the shape of the input along the axes specified + by `axes` is used. See notes for issue on `ifft` zero padding. + axes : sequence of ints, optional + Axes over which to compute the FFT. If not given, the last two + axes are used. A repeated index in `axes` means the transform over + that axis is performed multiple times. A one-element sequence means + that a one-dimensional FFT is performed. + norm : {None, "ortho"}, optional + .. versionadded:: 1.10.0 + + Normalization mode (see `numpy.fft`). Default is None. + + Returns + ------- + out : complex ndarray + The truncated or zero-padded input, transformed along the axes + indicated by `axes`, or the last two axes if `axes` is not given. + + Raises + ------ + ValueError + If `s` and `axes` have different length, or `axes` not given and + ``len(s) != 2``. + IndexError + If an element of `axes` is larger than than the number of axes of `a`. + + See Also + -------- + numpy.fft : Overall view of discrete Fourier transforms, with definitions + and conventions used. + fft2 : The forward 2-dimensional FFT, of which `ifft2` is the inverse. + ifftn : The inverse of the *n*-dimensional FFT. + fft : The one-dimensional FFT. + ifft : The one-dimensional inverse FFT. + + Notes + ----- + `ifft2` is just `ifftn` with a different default for `axes`. + + See `ifftn` for details and a plotting example, and `numpy.fft` for + definition and conventions used. + + Zero-padding, analogously with `ifft`, is performed by appending zeros to + the input along the specified dimension. Although this is the common + approach, it might lead to surprising results. If another form of zero + padding is desired, it must be performed before `ifft2` is called. + + Examples + -------- + >>> a = 4 * np.eye(4) + >>> np.fft.ifft2(a) + array([[ 1.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], + [ 0.+0.j, 0.+0.j, 0.+0.j, 1.+0.j], + [ 0.+0.j, 0.+0.j, 1.+0.j, 0.+0.j], + [ 0.+0.j, 1.+0.j, 0.+0.j, 0.+0.j]]) + + """ + + return _raw_fftnd(a, s, axes, ifft, norm) + + +@array_function_dispatch(_fftn_dispatcher) +def rfftn(a, s=None, axes=None, norm=None): + """ + Compute the N-dimensional discrete Fourier Transform for real input. + + This function computes the N-dimensional discrete Fourier Transform over + any number of axes in an M-dimensional real array by means of the Fast + Fourier Transform (FFT). By default, all axes are transformed, with the + real transform performed over the last axis, while the remaining + transforms are complex. + + Parameters + ---------- + a : array_like + Input array, taken to be real. + s : sequence of ints, optional + Shape (length along each transformed axis) to use from the input. + (``s[0]`` refers to axis 0, ``s[1]`` to axis 1, etc.). + The final element of `s` corresponds to `n` for ``rfft(x, n)``, while + for the remaining axes, it corresponds to `n` for ``fft(x, n)``. + Along any axis, if the given shape is smaller than that of the input, + the input is cropped. If it is larger, the input is padded with zeros. + if `s` is not given, the shape of the input along the axes specified + by `axes` is used. + axes : sequence of ints, optional + Axes over which to compute the FFT. If not given, the last ``len(s)`` + axes are used, or all axes if `s` is also not specified. + norm : {None, "ortho"}, optional + .. versionadded:: 1.10.0 + + Normalization mode (see `numpy.fft`). Default is None. + + Returns + ------- + out : complex ndarray + The truncated or zero-padded input, transformed along the axes + indicated by `axes`, or by a combination of `s` and `a`, + as explained in the parameters section above. + The length of the last axis transformed will be ``s[-1]//2+1``, + while the remaining transformed axes will have lengths according to + `s`, or unchanged from the input. + + Raises + ------ + ValueError + If `s` and `axes` have different length. + IndexError + If an element of `axes` is larger than than the number of axes of `a`. + + See Also + -------- + irfftn : The inverse of `rfftn`, i.e. the inverse of the n-dimensional FFT + of real input. + fft : The one-dimensional FFT, with definitions and conventions used. + rfft : The one-dimensional FFT of real input. + fftn : The n-dimensional FFT. + rfft2 : The two-dimensional FFT of real input. + + Notes + ----- + The transform for real input is performed over the last transformation + axis, as by `rfft`, then the transform over the remaining axes is + performed as by `fftn`. The order of the output is as for `rfft` for the + final transformation axis, and as for `fftn` for the remaining + transformation axes. + + See `fft` for details, definitions and conventions used. + + Examples + -------- + >>> a = np.ones((2, 2, 2)) + >>> np.fft.rfftn(a) + array([[[ 8.+0.j, 0.+0.j], + [ 0.+0.j, 0.+0.j]], + [[ 0.+0.j, 0.+0.j], + [ 0.+0.j, 0.+0.j]]]) + + >>> np.fft.rfftn(a, axes=(2, 0)) + array([[[ 4.+0.j, 0.+0.j], + [ 4.+0.j, 0.+0.j]], + [[ 0.+0.j, 0.+0.j], + [ 0.+0.j, 0.+0.j]]]) + + """ + # The copy may be required for multithreading. + a = array(a, copy=True, dtype=float) + s, axes = _cook_nd_args(a, s, axes) + a = rfft(a, s[-1], axes[-1], norm) + for ii in range(len(axes)-1): + a = fft(a, s[ii], axes[ii], norm) + return a + + +@array_function_dispatch(_fftn_dispatcher) +def rfft2(a, s=None, axes=(-2, -1), norm=None): + """ + Compute the 2-dimensional FFT of a real array. + + Parameters + ---------- + a : array + Input array, taken to be real. + s : sequence of ints, optional + Shape of the FFT. + axes : sequence of ints, optional + Axes over which to compute the FFT. + norm : {None, "ortho"}, optional + .. versionadded:: 1.10.0 + + Normalization mode (see `numpy.fft`). Default is None. + + Returns + ------- + out : ndarray + The result of the real 2-D FFT. + + See Also + -------- + rfftn : Compute the N-dimensional discrete Fourier Transform for real + input. + + Notes + ----- + This is really just `rfftn` with different default behavior. + For more details see `rfftn`. + + """ + + return rfftn(a, s, axes, norm) + + +@array_function_dispatch(_fftn_dispatcher) +def irfftn(a, s=None, axes=None, norm=None): + """ + Compute the inverse of the N-dimensional FFT of real input. + + This function computes the inverse of the N-dimensional discrete + Fourier Transform for real input over any number of axes in an + M-dimensional array by means of the Fast Fourier Transform (FFT). In + other words, ``irfftn(rfftn(a), a.shape) == a`` to within numerical + accuracy. (The ``a.shape`` is necessary like ``len(a)`` is for `irfft`, + and for the same reason.) + + The input should be ordered in the same way as is returned by `rfftn`, + i.e. as for `irfft` for the final transformation axis, and as for `ifftn` + along all the other axes. + + Parameters + ---------- + a : array_like + Input array. + s : sequence of ints, optional + Shape (length of each transformed axis) of the output + (``s[0]`` refers to axis 0, ``s[1]`` to axis 1, etc.). `s` is also the + number of input points used along this axis, except for the last axis, + where ``s[-1]//2+1`` points of the input are used. + Along any axis, if the shape indicated by `s` is smaller than that of + the input, the input is cropped. If it is larger, the input is padded + with zeros. If `s` is not given, the shape of the input along the + axes specified by `axes` is used. + axes : sequence of ints, optional + Axes over which to compute the inverse FFT. If not given, the last + `len(s)` axes are used, or all axes if `s` is also not specified. + Repeated indices in `axes` means that the inverse transform over that + axis is performed multiple times. + norm : {None, "ortho"}, optional + .. versionadded:: 1.10.0 + + Normalization mode (see `numpy.fft`). Default is None. + + Returns + ------- + out : ndarray + The truncated or zero-padded input, transformed along the axes + indicated by `axes`, or by a combination of `s` or `a`, + as explained in the parameters section above. + The length of each transformed axis is as given by the corresponding + element of `s`, or the length of the input in every axis except for the + last one if `s` is not given. In the final transformed axis the length + of the output when `s` is not given is ``2*(m-1)`` where ``m`` is the + length of the final transformed axis of the input. To get an odd + number of output points in the final axis, `s` must be specified. + + Raises + ------ + ValueError + If `s` and `axes` have different length. + IndexError + If an element of `axes` is larger than than the number of axes of `a`. + + See Also + -------- + rfftn : The forward n-dimensional FFT of real input, + of which `ifftn` is the inverse. + fft : The one-dimensional FFT, with definitions and conventions used. + irfft : The inverse of the one-dimensional FFT of real input. + irfft2 : The inverse of the two-dimensional FFT of real input. + + Notes + ----- + See `fft` for definitions and conventions used. + + See `rfft` for definitions and conventions used for real input. + + Examples + -------- + >>> a = np.zeros((3, 2, 2)) + >>> a[0, 0, 0] = 3 * 2 * 2 + >>> np.fft.irfftn(a) + array([[[ 1., 1.], + [ 1., 1.]], + [[ 1., 1.], + [ 1., 1.]], + [[ 1., 1.], + [ 1., 1.]]]) + + """ + # The copy may be required for multithreading. + a = array(a, copy=True, dtype=complex) + s, axes = _cook_nd_args(a, s, axes, invreal=1) + for ii in range(len(axes)-1): + a = ifft(a, s[ii], axes[ii], norm) + a = irfft(a, s[-1], axes[-1], norm) + return a + + +@array_function_dispatch(_fftn_dispatcher) +def irfft2(a, s=None, axes=(-2, -1), norm=None): + """ + Compute the 2-dimensional inverse FFT of a real array. + + Parameters + ---------- + a : array_like + The input array + s : sequence of ints, optional + Shape of the inverse FFT. + axes : sequence of ints, optional + The axes over which to compute the inverse fft. + Default is the last two axes. + norm : {None, "ortho"}, optional + .. versionadded:: 1.10.0 + + Normalization mode (see `numpy.fft`). Default is None. + + Returns + ------- + out : ndarray + The result of the inverse real 2-D FFT. + + See Also + -------- + irfftn : Compute the inverse of the N-dimensional FFT of real input. + + Notes + ----- + This is really `irfftn` with different defaults. + For more details see `irfftn`. + + """ + + return irfftn(a, s, axes, norm) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/fft/helper.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/fft/helper.py new file mode 100644 index 0000000000000000000000000000000000000000..864768df5f1da39fb605ecd2df04b2504b604d24 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/fft/helper.py @@ -0,0 +1,325 @@ +""" +Discrete Fourier Transforms - helper.py + +""" +from __future__ import division, absolute_import, print_function + +import collections +try: + import threading +except ImportError: + import dummy_threading as threading +from numpy.compat import integer_types +from numpy.core import integer, empty, arange, asarray, roll +from numpy.core.overrides import array_function_dispatch, set_module + +# Created by Pearu Peterson, September 2002 + +__all__ = ['fftshift', 'ifftshift', 'fftfreq', 'rfftfreq'] + +integer_types = integer_types + (integer,) + + +def _fftshift_dispatcher(x, axes=None): + return (x,) + + +@array_function_dispatch(_fftshift_dispatcher, module='numpy.fft') +def fftshift(x, axes=None): + """ + Shift the zero-frequency component to the center of the spectrum. + + This function swaps half-spaces for all axes listed (defaults to all). + Note that ``y[0]`` is the Nyquist component only if ``len(x)`` is even. + + Parameters + ---------- + x : array_like + Input array. + axes : int or shape tuple, optional + Axes over which to shift. Default is None, which shifts all axes. + + Returns + ------- + y : ndarray + The shifted array. + + See Also + -------- + ifftshift : The inverse of `fftshift`. + + Examples + -------- + >>> freqs = np.fft.fftfreq(10, 0.1) + >>> freqs + array([ 0., 1., 2., 3., 4., -5., -4., -3., -2., -1.]) + >>> np.fft.fftshift(freqs) + array([-5., -4., -3., -2., -1., 0., 1., 2., 3., 4.]) + + Shift the zero-frequency component only along the second axis: + + >>> freqs = np.fft.fftfreq(9, d=1./9).reshape(3, 3) + >>> freqs + array([[ 0., 1., 2.], + [ 3., 4., -4.], + [-3., -2., -1.]]) + >>> np.fft.fftshift(freqs, axes=(1,)) + array([[ 2., 0., 1.], + [-4., 3., 4.], + [-1., -3., -2.]]) + + """ + x = asarray(x) + if axes is None: + axes = tuple(range(x.ndim)) + shift = [dim // 2 for dim in x.shape] + elif isinstance(axes, integer_types): + shift = x.shape[axes] // 2 + else: + shift = [x.shape[ax] // 2 for ax in axes] + + return roll(x, shift, axes) + + +@array_function_dispatch(_fftshift_dispatcher, module='numpy.fft') +def ifftshift(x, axes=None): + """ + The inverse of `fftshift`. Although identical for even-length `x`, the + functions differ by one sample for odd-length `x`. + + Parameters + ---------- + x : array_like + Input array. + axes : int or shape tuple, optional + Axes over which to calculate. Defaults to None, which shifts all axes. + + Returns + ------- + y : ndarray + The shifted array. + + See Also + -------- + fftshift : Shift zero-frequency component to the center of the spectrum. + + Examples + -------- + >>> freqs = np.fft.fftfreq(9, d=1./9).reshape(3, 3) + >>> freqs + array([[ 0., 1., 2.], + [ 3., 4., -4.], + [-3., -2., -1.]]) + >>> np.fft.ifftshift(np.fft.fftshift(freqs)) + array([[ 0., 1., 2.], + [ 3., 4., -4.], + [-3., -2., -1.]]) + + """ + x = asarray(x) + if axes is None: + axes = tuple(range(x.ndim)) + shift = [-(dim // 2) for dim in x.shape] + elif isinstance(axes, integer_types): + shift = -(x.shape[axes] // 2) + else: + shift = [-(x.shape[ax] // 2) for ax in axes] + + return roll(x, shift, axes) + + +@set_module('numpy.fft') +def fftfreq(n, d=1.0): + """ + Return the Discrete Fourier Transform sample frequencies. + + The returned float array `f` contains the frequency bin centers in cycles + per unit of the sample spacing (with zero at the start). For instance, if + the sample spacing is in seconds, then the frequency unit is cycles/second. + + Given a window length `n` and a sample spacing `d`:: + + f = [0, 1, ..., n/2-1, -n/2, ..., -1] / (d*n) if n is even + f = [0, 1, ..., (n-1)/2, -(n-1)/2, ..., -1] / (d*n) if n is odd + + Parameters + ---------- + n : int + Window length. + d : scalar, optional + Sample spacing (inverse of the sampling rate). Defaults to 1. + + Returns + ------- + f : ndarray + Array of length `n` containing the sample frequencies. + + Examples + -------- + >>> signal = np.array([-2, 8, 6, 4, 1, 0, 3, 5], dtype=float) + >>> fourier = np.fft.fft(signal) + >>> n = signal.size + >>> timestep = 0.1 + >>> freq = np.fft.fftfreq(n, d=timestep) + >>> freq + array([ 0. , 1.25, 2.5 , 3.75, -5. , -3.75, -2.5 , -1.25]) + + """ + if not isinstance(n, integer_types): + raise ValueError("n should be an integer") + val = 1.0 / (n * d) + results = empty(n, int) + N = (n-1)//2 + 1 + p1 = arange(0, N, dtype=int) + results[:N] = p1 + p2 = arange(-(n//2), 0, dtype=int) + results[N:] = p2 + return results * val + + +@set_module('numpy.fft') +def rfftfreq(n, d=1.0): + """ + Return the Discrete Fourier Transform sample frequencies + (for usage with rfft, irfft). + + The returned float array `f` contains the frequency bin centers in cycles + per unit of the sample spacing (with zero at the start). For instance, if + the sample spacing is in seconds, then the frequency unit is cycles/second. + + Given a window length `n` and a sample spacing `d`:: + + f = [0, 1, ..., n/2-1, n/2] / (d*n) if n is even + f = [0, 1, ..., (n-1)/2-1, (n-1)/2] / (d*n) if n is odd + + Unlike `fftfreq` (but like `scipy.fftpack.rfftfreq`) + the Nyquist frequency component is considered to be positive. + + Parameters + ---------- + n : int + Window length. + d : scalar, optional + Sample spacing (inverse of the sampling rate). Defaults to 1. + + Returns + ------- + f : ndarray + Array of length ``n//2 + 1`` containing the sample frequencies. + + Examples + -------- + >>> signal = np.array([-2, 8, 6, 4, 1, 0, 3, 5, -3, 4], dtype=float) + >>> fourier = np.fft.rfft(signal) + >>> n = signal.size + >>> sample_rate = 100 + >>> freq = np.fft.fftfreq(n, d=1./sample_rate) + >>> freq + array([ 0., 10., 20., 30., 40., -50., -40., -30., -20., -10.]) + >>> freq = np.fft.rfftfreq(n, d=1./sample_rate) + >>> freq + array([ 0., 10., 20., 30., 40., 50.]) + + """ + if not isinstance(n, integer_types): + raise ValueError("n should be an integer") + val = 1.0/(n*d) + N = n//2 + 1 + results = arange(0, N, dtype=int) + return results * val + + +class _FFTCache(object): + """ + Cache for the FFT twiddle factors as an LRU (least recently used) cache. + + Parameters + ---------- + max_size_in_mb : int + Maximum memory usage of the cache before items are being evicted. + max_item_count : int + Maximum item count of the cache before items are being evicted. + + Notes + ----- + Items will be evicted if either limit has been reached upon getting and + setting. The maximum memory usages is not strictly the given + ``max_size_in_mb`` but rather + ``max(max_size_in_mb, 1.5 * size_of_largest_item)``. Thus the cache will + never be completely cleared - at least one item will remain and a single + large item can cause the cache to retain several smaller items even if the + given maximum cache size has been exceeded. + """ + def __init__(self, max_size_in_mb, max_item_count): + self._max_size_in_bytes = max_size_in_mb * 1024 ** 2 + self._max_item_count = max_item_count + self._dict = collections.OrderedDict() + self._lock = threading.Lock() + + def put_twiddle_factors(self, n, factors): + """ + Store twiddle factors for an FFT of length n in the cache. + + Putting multiple twiddle factors for a certain n will store it multiple + times. + + Parameters + ---------- + n : int + Data length for the FFT. + factors : ndarray + The actual twiddle values. + """ + with self._lock: + # Pop + later add to move it to the end for LRU behavior. + # Internally everything is stored in a dictionary whose values are + # lists. + try: + value = self._dict.pop(n) + except KeyError: + value = [] + value.append(factors) + self._dict[n] = value + self._prune_cache() + + def pop_twiddle_factors(self, n): + """ + Pop twiddle factors for an FFT of length n from the cache. + + Will return None if the requested twiddle factors are not available in + the cache. + + Parameters + ---------- + n : int + Data length for the FFT. + + Returns + ------- + out : ndarray or None + The retrieved twiddle factors if available, else None. + """ + with self._lock: + if n not in self._dict or not self._dict[n]: + return None + # Pop + later add to move it to the end for LRU behavior. + all_values = self._dict.pop(n) + value = all_values.pop() + # Only put pack if there are still some arrays left in the list. + if all_values: + self._dict[n] = all_values + return value + + def _prune_cache(self): + # Always keep at least one item. + while len(self._dict) > 1 and ( + len(self._dict) > self._max_item_count or self._check_size()): + self._dict.popitem(last=False) + + def _check_size(self): + item_sizes = [sum(_j.nbytes for _j in _i) + for _i in self._dict.values() if _i] + if not item_sizes: + return False + max_size = max(self._max_size_in_bytes, 1.5 * max(item_sizes)) + return sum(item_sizes) > max_size diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/lib/tests/test_arraypad.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/lib/tests/test_arraypad.py new file mode 100644 index 0000000000000000000000000000000000000000..20f6e4a1bf2a28d3281959cd7d07b39a17c6c1a1 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/lib/tests/test_arraypad.py @@ -0,0 +1,1262 @@ +"""Tests for the array padding functions. + +""" +from __future__ import division, absolute_import, print_function + +import pytest + +import numpy as np +from numpy.testing import (assert_array_equal, assert_raises, assert_allclose, + assert_equal) +from numpy.lib import pad +from numpy.lib.arraypad import _as_pairs + + +class TestAsPairs(object): + + def test_single_value(self): + """Test casting for a single value.""" + expected = np.array([[3, 3]] * 10) + for x in (3, [3], [[3]]): + result = _as_pairs(x, 10) + assert_equal(result, expected) + # Test with dtype=object + obj = object() + assert_equal( + _as_pairs(obj, 10), + np.array([[obj, obj]] * 10) + ) + + def test_two_values(self): + """Test proper casting for two different values.""" + # Broadcasting in the first dimension with numbers + expected = np.array([[3, 4]] * 10) + for x in ([3, 4], [[3, 4]]): + result = _as_pairs(x, 10) + assert_equal(result, expected) + # and with dtype=object + obj = object() + assert_equal( + _as_pairs(["a", obj], 10), + np.array([["a", obj]] * 10) + ) + + # Broadcasting in the second / last dimension with numbers + assert_equal( + _as_pairs([[3], [4]], 2), + np.array([[3, 3], [4, 4]]) + ) + # and with dtype=object + assert_equal( + _as_pairs([["a"], [obj]], 2), + np.array([["a", "a"], [obj, obj]]) + ) + + def test_with_none(self): + expected = ((None, None), (None, None), (None, None)) + assert_equal( + _as_pairs(None, 3, as_index=False), + expected + ) + assert_equal( + _as_pairs(None, 3, as_index=True), + expected + ) + + def test_pass_through(self): + """Test if `x` already matching desired output are passed through.""" + expected = np.arange(12).reshape((6, 2)) + assert_equal( + _as_pairs(expected, 6), + expected + ) + + def test_as_index(self): + """Test results if `as_index=True`.""" + assert_equal( + _as_pairs([2.6, 3.3], 10, as_index=True), + np.array([[3, 3]] * 10, dtype=np.intp) + ) + assert_equal( + _as_pairs([2.6, 4.49], 10, as_index=True), + np.array([[3, 4]] * 10, dtype=np.intp) + ) + for x in (-3, [-3], [[-3]], [-3, 4], [3, -4], [[-3, 4]], [[4, -3]], + [[1, 2]] * 9 + [[1, -2]]): + with pytest.raises(ValueError, match="negative values"): + _as_pairs(x, 10, as_index=True) + + def test_exceptions(self): + """Ensure faulty usage is discovered.""" + with pytest.raises(ValueError, match="more dimensions than allowed"): + _as_pairs([[[3]]], 10) + with pytest.raises(ValueError, match="could not be broadcast"): + _as_pairs([[1, 2], [3, 4]], 3) + with pytest.raises(ValueError, match="could not be broadcast"): + _as_pairs(np.ones((2, 3)), 3) + + +class TestConditionalShortcuts(object): + def test_zero_padding_shortcuts(self): + test = np.arange(120).reshape(4, 5, 6) + pad_amt = [(0, 0) for axis in test.shape] + modes = ['constant', + 'edge', + 'linear_ramp', + 'maximum', + 'mean', + 'median', + 'minimum', + 'reflect', + 'symmetric', + 'wrap', + ] + for mode in modes: + assert_array_equal(test, pad(test, pad_amt, mode=mode)) + + def test_shallow_statistic_range(self): + test = np.arange(120).reshape(4, 5, 6) + pad_amt = [(1, 1) for axis in test.shape] + modes = ['maximum', + 'mean', + 'median', + 'minimum', + ] + for mode in modes: + assert_array_equal(pad(test, pad_amt, mode='edge'), + pad(test, pad_amt, mode=mode, stat_length=1)) + + def test_clip_statistic_range(self): + test = np.arange(30).reshape(5, 6) + pad_amt = [(3, 3) for axis in test.shape] + modes = ['maximum', + 'mean', + 'median', + 'minimum', + ] + for mode in modes: + assert_array_equal(pad(test, pad_amt, mode=mode), + pad(test, pad_amt, mode=mode, stat_length=30)) + + +class TestStatistic(object): + def test_check_mean_stat_length(self): + a = np.arange(100).astype('f') + a = pad(a, ((25, 20), ), 'mean', stat_length=((2, 3), )) + b = np.array( + [0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, + 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, + 0.5, 0.5, 0.5, 0.5, 0.5, + + 0., 1., 2., 3., 4., 5., 6., 7., 8., 9., + 10., 11., 12., 13., 14., 15., 16., 17., 18., 19., + 20., 21., 22., 23., 24., 25., 26., 27., 28., 29., + 30., 31., 32., 33., 34., 35., 36., 37., 38., 39., + 40., 41., 42., 43., 44., 45., 46., 47., 48., 49., + 50., 51., 52., 53., 54., 55., 56., 57., 58., 59., + 60., 61., 62., 63., 64., 65., 66., 67., 68., 69., + 70., 71., 72., 73., 74., 75., 76., 77., 78., 79., + 80., 81., 82., 83., 84., 85., 86., 87., 88., 89., + 90., 91., 92., 93., 94., 95., 96., 97., 98., 99., + + 98., 98., 98., 98., 98., 98., 98., 98., 98., 98., + 98., 98., 98., 98., 98., 98., 98., 98., 98., 98. + ]) + assert_array_equal(a, b) + + def test_check_maximum_1(self): + a = np.arange(100) + a = pad(a, (25, 20), 'maximum') + b = np.array( + [99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, + + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99] + ) + assert_array_equal(a, b) + + def test_check_maximum_2(self): + a = np.arange(100) + 1 + a = pad(a, (25, 20), 'maximum') + b = np.array( + [100, 100, 100, 100, 100, 100, 100, 100, 100, 100, + 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, + 100, 100, 100, 100, 100, + + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, + 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, + + 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, + 100, 100, 100, 100, 100, 100, 100, 100, 100, 100] + ) + assert_array_equal(a, b) + + def test_check_maximum_stat_length(self): + a = np.arange(100) + 1 + a = pad(a, (25, 20), 'maximum', stat_length=10) + b = np.array( + [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, + + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, + 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, + + 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, + 100, 100, 100, 100, 100, 100, 100, 100, 100, 100] + ) + assert_array_equal(a, b) + + def test_check_minimum_1(self): + a = np.arange(100) + a = pad(a, (25, 20), 'minimum') + b = np.array( + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] + ) + assert_array_equal(a, b) + + def test_check_minimum_2(self): + a = np.arange(100) + 2 + a = pad(a, (25, 20), 'minimum') + b = np.array( + [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, + + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2] + ) + assert_array_equal(a, b) + + def test_check_minimum_stat_length(self): + a = np.arange(100) + 1 + a = pad(a, (25, 20), 'minimum', stat_length=10) + b = np.array( + [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, + + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, + 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, + + 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, + 91, 91, 91, 91, 91, 91, 91, 91, 91, 91] + ) + assert_array_equal(a, b) + + def test_check_median(self): + a = np.arange(100).astype('f') + a = pad(a, (25, 20), 'median') + b = np.array( + [49.5, 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, + 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, + 49.5, 49.5, 49.5, 49.5, 49.5, + + 0., 1., 2., 3., 4., 5., 6., 7., 8., 9., + 10., 11., 12., 13., 14., 15., 16., 17., 18., 19., + 20., 21., 22., 23., 24., 25., 26., 27., 28., 29., + 30., 31., 32., 33., 34., 35., 36., 37., 38., 39., + 40., 41., 42., 43., 44., 45., 46., 47., 48., 49., + 50., 51., 52., 53., 54., 55., 56., 57., 58., 59., + 60., 61., 62., 63., 64., 65., 66., 67., 68., 69., + 70., 71., 72., 73., 74., 75., 76., 77., 78., 79., + 80., 81., 82., 83., 84., 85., 86., 87., 88., 89., + 90., 91., 92., 93., 94., 95., 96., 97., 98., 99., + + 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, + 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, 49.5] + ) + assert_array_equal(a, b) + + def test_check_median_01(self): + a = np.array([[3, 1, 4], [4, 5, 9], [9, 8, 2]]) + a = pad(a, 1, 'median') + b = np.array( + [[4, 4, 5, 4, 4], + + [3, 3, 1, 4, 3], + [5, 4, 5, 9, 5], + [8, 9, 8, 2, 8], + + [4, 4, 5, 4, 4]] + ) + assert_array_equal(a, b) + + def test_check_median_02(self): + a = np.array([[3, 1, 4], [4, 5, 9], [9, 8, 2]]) + a = pad(a.T, 1, 'median').T + b = np.array( + [[5, 4, 5, 4, 5], + + [3, 3, 1, 4, 3], + [5, 4, 5, 9, 5], + [8, 9, 8, 2, 8], + + [5, 4, 5, 4, 5]] + ) + assert_array_equal(a, b) + + def test_check_median_stat_length(self): + a = np.arange(100).astype('f') + a[1] = 2. + a[97] = 96. + a = pad(a, (25, 20), 'median', stat_length=(3, 5)) + b = np.array( + [ 2., 2., 2., 2., 2., 2., 2., 2., 2., 2., + 2., 2., 2., 2., 2., 2., 2., 2., 2., 2., + 2., 2., 2., 2., 2., + + 0., 2., 2., 3., 4., 5., 6., 7., 8., 9., + 10., 11., 12., 13., 14., 15., 16., 17., 18., 19., + 20., 21., 22., 23., 24., 25., 26., 27., 28., 29., + 30., 31., 32., 33., 34., 35., 36., 37., 38., 39., + 40., 41., 42., 43., 44., 45., 46., 47., 48., 49., + 50., 51., 52., 53., 54., 55., 56., 57., 58., 59., + 60., 61., 62., 63., 64., 65., 66., 67., 68., 69., + 70., 71., 72., 73., 74., 75., 76., 77., 78., 79., + 80., 81., 82., 83., 84., 85., 86., 87., 88., 89., + 90., 91., 92., 93., 94., 95., 96., 96., 98., 99., + + 96., 96., 96., 96., 96., 96., 96., 96., 96., 96., + 96., 96., 96., 96., 96., 96., 96., 96., 96., 96.] + ) + assert_array_equal(a, b) + + def test_check_mean_shape_one(self): + a = [[4, 5, 6]] + a = pad(a, (5, 7), 'mean', stat_length=2) + b = np.array( + [[4, 4, 4, 4, 4, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6], + [4, 4, 4, 4, 4, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6], + [4, 4, 4, 4, 4, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6], + [4, 4, 4, 4, 4, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6], + [4, 4, 4, 4, 4, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6], + + [4, 4, 4, 4, 4, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6], + + [4, 4, 4, 4, 4, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6], + [4, 4, 4, 4, 4, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6], + [4, 4, 4, 4, 4, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6], + [4, 4, 4, 4, 4, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6], + [4, 4, 4, 4, 4, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6], + [4, 4, 4, 4, 4, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6], + [4, 4, 4, 4, 4, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6]] + ) + assert_array_equal(a, b) + + def test_check_mean_2(self): + a = np.arange(100).astype('f') + a = pad(a, (25, 20), 'mean') + b = np.array( + [49.5, 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, + 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, + 49.5, 49.5, 49.5, 49.5, 49.5, + + 0., 1., 2., 3., 4., 5., 6., 7., 8., 9., + 10., 11., 12., 13., 14., 15., 16., 17., 18., 19., + 20., 21., 22., 23., 24., 25., 26., 27., 28., 29., + 30., 31., 32., 33., 34., 35., 36., 37., 38., 39., + 40., 41., 42., 43., 44., 45., 46., 47., 48., 49., + 50., 51., 52., 53., 54., 55., 56., 57., 58., 59., + 60., 61., 62., 63., 64., 65., 66., 67., 68., 69., + 70., 71., 72., 73., 74., 75., 76., 77., 78., 79., + 80., 81., 82., 83., 84., 85., 86., 87., 88., 89., + 90., 91., 92., 93., 94., 95., 96., 97., 98., 99., + + 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, + 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, 49.5, 49.5] + ) + assert_array_equal(a, b) + + @pytest.mark.parametrize("mode", [ + pytest.param("mean", marks=pytest.mark.xfail(reason="gh-11216")), + "median", + "minimum", + "maximum" + ]) + def test_same_prepend_append(self, mode): + """ Test that appended and prepended values are equal """ + # This test is constructed to trigger floating point rounding errors in + # a way that caused gh-11216 for mode=='mean' + a = np.array([-1, 2, -1]) + np.array([0, 1e-12, 0], dtype=np.float64) + a = np.pad(a, (1, 1), mode) + assert_equal(a[0], a[-1]) + + +class TestConstant(object): + def test_check_constant(self): + a = np.arange(100) + a = pad(a, (25, 20), 'constant', constant_values=(10, 20)) + b = np.array( + [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, + + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + 20, 20, 20, 20, 20, 20, 20, 20, 20, 20] + ) + assert_array_equal(a, b) + + def test_check_constant_zeros(self): + a = np.arange(100) + a = pad(a, (25, 20), 'constant') + b = np.array( + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] + ) + assert_array_equal(a, b) + + def test_check_constant_float(self): + # If input array is int, but constant_values are float, the dtype of + # the array to be padded is kept + arr = np.arange(30).reshape(5, 6) + test = pad(arr, (1, 2), mode='constant', + constant_values=1.1) + expected = np.array( + [[ 1, 1, 1, 1, 1, 1, 1, 1, 1], + + [ 1, 0, 1, 2, 3, 4, 5, 1, 1], + [ 1, 6, 7, 8, 9, 10, 11, 1, 1], + [ 1, 12, 13, 14, 15, 16, 17, 1, 1], + [ 1, 18, 19, 20, 21, 22, 23, 1, 1], + [ 1, 24, 25, 26, 27, 28, 29, 1, 1], + + [ 1, 1, 1, 1, 1, 1, 1, 1, 1], + [ 1, 1, 1, 1, 1, 1, 1, 1, 1]] + ) + assert_allclose(test, expected) + + def test_check_constant_float2(self): + # If input array is float, and constant_values are float, the dtype of + # the array to be padded is kept - here retaining the float constants + arr = np.arange(30).reshape(5, 6) + arr_float = arr.astype(np.float64) + test = pad(arr_float, ((1, 2), (1, 2)), mode='constant', + constant_values=1.1) + expected = np.array( + [[ 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1], + + [ 1.1, 0. , 1. , 2. , 3. , 4. , 5. , 1.1, 1.1], + [ 1.1, 6. , 7. , 8. , 9. , 10. , 11. , 1.1, 1.1], + [ 1.1, 12. , 13. , 14. , 15. , 16. , 17. , 1.1, 1.1], + [ 1.1, 18. , 19. , 20. , 21. , 22. , 23. , 1.1, 1.1], + [ 1.1, 24. , 25. , 26. , 27. , 28. , 29. , 1.1, 1.1], + + [ 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1], + [ 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1]] + ) + assert_allclose(test, expected) + + def test_check_constant_float3(self): + a = np.arange(100, dtype=float) + a = pad(a, (25, 20), 'constant', constant_values=(-1.1, -1.2)) + b = np.array( + [-1.1, -1.1, -1.1, -1.1, -1.1, -1.1, -1.1, -1.1, -1.1, -1.1, + -1.1, -1.1, -1.1, -1.1, -1.1, -1.1, -1.1, -1.1, -1.1, -1.1, + -1.1, -1.1, -1.1, -1.1, -1.1, + + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + + -1.2, -1.2, -1.2, -1.2, -1.2, -1.2, -1.2, -1.2, -1.2, -1.2, + -1.2, -1.2, -1.2, -1.2, -1.2, -1.2, -1.2, -1.2, -1.2, -1.2] + ) + assert_allclose(a, b) + + def test_check_constant_odd_pad_amount(self): + arr = np.arange(30).reshape(5, 6) + test = pad(arr, ((1,), (2,)), mode='constant', + constant_values=3) + expected = np.array( + [[ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3], + + [ 3, 3, 0, 1, 2, 3, 4, 5, 3, 3], + [ 3, 3, 6, 7, 8, 9, 10, 11, 3, 3], + [ 3, 3, 12, 13, 14, 15, 16, 17, 3, 3], + [ 3, 3, 18, 19, 20, 21, 22, 23, 3, 3], + [ 3, 3, 24, 25, 26, 27, 28, 29, 3, 3], + + [ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]] + ) + assert_allclose(test, expected) + + def test_check_constant_pad_2d(self): + arr = np.arange(4).reshape(2, 2) + test = np.lib.pad(arr, ((1, 2), (1, 3)), mode='constant', + constant_values=((1, 2), (3, 4))) + expected = np.array( + [[3, 1, 1, 4, 4, 4], + [3, 0, 1, 4, 4, 4], + [3, 2, 3, 4, 4, 4], + [3, 2, 2, 4, 4, 4], + [3, 2, 2, 4, 4, 4]] + ) + assert_allclose(test, expected) + + def test_check_large_integers(self): + uint64_max = 2 ** 64 - 1 + arr = np.full(5, uint64_max, dtype=np.uint64) + test = np.pad(arr, 1, mode="constant", constant_values=arr.min()) + expected = np.full(7, uint64_max, dtype=np.uint64) + assert_array_equal(test, expected) + + int64_max = 2 ** 63 - 1 + arr = np.full(5, int64_max, dtype=np.int64) + test = np.pad(arr, 1, mode="constant", constant_values=arr.min()) + expected = np.full(7, int64_max, dtype=np.int64) + assert_array_equal(test, expected) + + def test_check_object_array(self): + arr = np.empty(1, dtype=object) + obj_a = object() + arr[0] = obj_a + obj_b = object() + obj_c = object() + arr = np.pad(arr, pad_width=1, mode='constant', + constant_values=(obj_b, obj_c)) + + expected = np.empty((3,), dtype=object) + expected[0] = obj_b + expected[1] = obj_a + expected[2] = obj_c + + assert_array_equal(arr, expected) + + +class TestLinearRamp(object): + def test_check_simple(self): + a = np.arange(100).astype('f') + a = pad(a, (25, 20), 'linear_ramp', end_values=(4, 5)) + b = np.array( + [4.00, 3.84, 3.68, 3.52, 3.36, 3.20, 3.04, 2.88, 2.72, 2.56, + 2.40, 2.24, 2.08, 1.92, 1.76, 1.60, 1.44, 1.28, 1.12, 0.96, + 0.80, 0.64, 0.48, 0.32, 0.16, + + 0.00, 1.00, 2.00, 3.00, 4.00, 5.00, 6.00, 7.00, 8.00, 9.00, + 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, + 20.0, 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, + 30.0, 31.0, 32.0, 33.0, 34.0, 35.0, 36.0, 37.0, 38.0, 39.0, + 40.0, 41.0, 42.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0, 49.0, + 50.0, 51.0, 52.0, 53.0, 54.0, 55.0, 56.0, 57.0, 58.0, 59.0, + 60.0, 61.0, 62.0, 63.0, 64.0, 65.0, 66.0, 67.0, 68.0, 69.0, + 70.0, 71.0, 72.0, 73.0, 74.0, 75.0, 76.0, 77.0, 78.0, 79.0, + 80.0, 81.0, 82.0, 83.0, 84.0, 85.0, 86.0, 87.0, 88.0, 89.0, + 90.0, 91.0, 92.0, 93.0, 94.0, 95.0, 96.0, 97.0, 98.0, 99.0, + + 94.3, 89.6, 84.9, 80.2, 75.5, 70.8, 66.1, 61.4, 56.7, 52.0, + 47.3, 42.6, 37.9, 33.2, 28.5, 23.8, 19.1, 14.4, 9.7, 5.] + ) + assert_allclose(a, b, rtol=1e-5, atol=1e-5) + + def test_check_2d(self): + arr = np.arange(20).reshape(4, 5).astype(np.float64) + test = pad(arr, (2, 2), mode='linear_ramp', end_values=(0, 0)) + expected = np.array( + [[0., 0., 0., 0., 0., 0., 0., 0., 0.], + [0., 0., 0., 0.5, 1., 1.5, 2., 1., 0.], + [0., 0., 0., 1., 2., 3., 4., 2., 0.], + [0., 2.5, 5., 6., 7., 8., 9., 4.5, 0.], + [0., 5., 10., 11., 12., 13., 14., 7., 0.], + [0., 7.5, 15., 16., 17., 18., 19., 9.5, 0.], + [0., 3.75, 7.5, 8., 8.5, 9., 9.5, 4.75, 0.], + [0., 0., 0., 0., 0., 0., 0., 0., 0.]]) + assert_allclose(test, expected) + + @pytest.mark.xfail(exceptions=(AssertionError,)) + def test_object_array(self): + from fractions import Fraction + arr = np.array([Fraction(1, 2), Fraction(-1, 2)]) + actual = np.pad(arr, (2, 3), mode='linear_ramp', end_values=0) + + # deliberately chosen to have a non-power-of-2 denominator such that + # rounding to floats causes a failure. + expected = np.array([ + Fraction( 0, 12), + Fraction( 3, 12), + Fraction( 6, 12), + Fraction(-6, 12), + Fraction(-4, 12), + Fraction(-2, 12), + Fraction(-0, 12), + ]) + assert_equal(actual, expected) + + +class TestReflect(object): + def test_check_simple(self): + a = np.arange(100) + a = pad(a, (25, 20), 'reflect') + b = np.array( + [25, 24, 23, 22, 21, 20, 19, 18, 17, 16, + 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, + 5, 4, 3, 2, 1, + + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + + 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, + 88, 87, 86, 85, 84, 83, 82, 81, 80, 79] + ) + assert_array_equal(a, b) + + def test_check_odd_method(self): + a = np.arange(100) + a = pad(a, (25, 20), 'reflect', reflect_type='odd') + b = np.array( + [-25, -24, -23, -22, -21, -20, -19, -18, -17, -16, + -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, + -5, -4, -3, -2, -1, + + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119] + ) + assert_array_equal(a, b) + + def test_check_large_pad(self): + a = [[4, 5, 6], [6, 7, 8]] + a = pad(a, (5, 7), 'reflect') + b = np.array( + [[7, 6, 7, 8, 7, 6, 7, 8, 7, 6, 7, 8, 7, 6, 7], + [5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5], + [7, 6, 7, 8, 7, 6, 7, 8, 7, 6, 7, 8, 7, 6, 7], + [5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5], + [7, 6, 7, 8, 7, 6, 7, 8, 7, 6, 7, 8, 7, 6, 7], + + [5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5], + [7, 6, 7, 8, 7, 6, 7, 8, 7, 6, 7, 8, 7, 6, 7], + + [5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5], + [7, 6, 7, 8, 7, 6, 7, 8, 7, 6, 7, 8, 7, 6, 7], + [5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5], + [7, 6, 7, 8, 7, 6, 7, 8, 7, 6, 7, 8, 7, 6, 7], + [5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5], + [7, 6, 7, 8, 7, 6, 7, 8, 7, 6, 7, 8, 7, 6, 7], + [5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5]] + ) + assert_array_equal(a, b) + + def test_check_shape(self): + a = [[4, 5, 6]] + a = pad(a, (5, 7), 'reflect') + b = np.array( + [[5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5], + [5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5], + [5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5], + [5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5], + [5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5], + + [5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5], + + [5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5], + [5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5], + [5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5], + [5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5], + [5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5], + [5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5], + [5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5, 6, 5, 4, 5]] + ) + assert_array_equal(a, b) + + def test_check_01(self): + a = pad([1, 2, 3], 2, 'reflect') + b = np.array([3, 2, 1, 2, 3, 2, 1]) + assert_array_equal(a, b) + + def test_check_02(self): + a = pad([1, 2, 3], 3, 'reflect') + b = np.array([2, 3, 2, 1, 2, 3, 2, 1, 2]) + assert_array_equal(a, b) + + def test_check_03(self): + a = pad([1, 2, 3], 4, 'reflect') + b = np.array([1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3]) + assert_array_equal(a, b) + + def test_check_padding_an_empty_array(self): + a = pad(np.zeros((0, 3)), ((0,), (1,)), mode='reflect') + b = np.zeros((0, 5)) + assert_array_equal(a, b) + + +class TestSymmetric(object): + def test_check_simple(self): + a = np.arange(100) + a = pad(a, (25, 20), 'symmetric') + b = np.array( + [24, 23, 22, 21, 20, 19, 18, 17, 16, 15, + 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, + 4, 3, 2, 1, 0, + + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + + 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, + 89, 88, 87, 86, 85, 84, 83, 82, 81, 80] + ) + assert_array_equal(a, b) + + def test_check_odd_method(self): + a = np.arange(100) + a = pad(a, (25, 20), 'symmetric', reflect_type='odd') + b = np.array( + [-24, -23, -22, -21, -20, -19, -18, -17, -16, -15, + -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, + -4, -3, -2, -1, 0, + + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + + 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 113, 114, 115, 116, 117, 118] + ) + assert_array_equal(a, b) + + def test_check_large_pad(self): + a = [[4, 5, 6], [6, 7, 8]] + a = pad(a, (5, 7), 'symmetric') + b = np.array( + [[5, 6, 6, 5, 4, 4, 5, 6, 6, 5, 4, 4, 5, 6, 6], + [5, 6, 6, 5, 4, 4, 5, 6, 6, 5, 4, 4, 5, 6, 6], + [7, 8, 8, 7, 6, 6, 7, 8, 8, 7, 6, 6, 7, 8, 8], + [7, 8, 8, 7, 6, 6, 7, 8, 8, 7, 6, 6, 7, 8, 8], + [5, 6, 6, 5, 4, 4, 5, 6, 6, 5, 4, 4, 5, 6, 6], + + [5, 6, 6, 5, 4, 4, 5, 6, 6, 5, 4, 4, 5, 6, 6], + [7, 8, 8, 7, 6, 6, 7, 8, 8, 7, 6, 6, 7, 8, 8], + + [7, 8, 8, 7, 6, 6, 7, 8, 8, 7, 6, 6, 7, 8, 8], + [5, 6, 6, 5, 4, 4, 5, 6, 6, 5, 4, 4, 5, 6, 6], + [5, 6, 6, 5, 4, 4, 5, 6, 6, 5, 4, 4, 5, 6, 6], + [7, 8, 8, 7, 6, 6, 7, 8, 8, 7, 6, 6, 7, 8, 8], + [7, 8, 8, 7, 6, 6, 7, 8, 8, 7, 6, 6, 7, 8, 8], + [5, 6, 6, 5, 4, 4, 5, 6, 6, 5, 4, 4, 5, 6, 6], + [5, 6, 6, 5, 4, 4, 5, 6, 6, 5, 4, 4, 5, 6, 6]] + ) + + assert_array_equal(a, b) + + def test_check_large_pad_odd(self): + a = [[4, 5, 6], [6, 7, 8]] + a = pad(a, (5, 7), 'symmetric', reflect_type='odd') + b = np.array( + [[-3, -2, -2, -1, 0, 0, 1, 2, 2, 3, 4, 4, 5, 6, 6], + [-3, -2, -2, -1, 0, 0, 1, 2, 2, 3, 4, 4, 5, 6, 6], + [-1, 0, 0, 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 8, 8], + [-1, 0, 0, 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 8, 8], + [ 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 8, 8, 9, 10, 10], + + [ 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 8, 8, 9, 10, 10], + [ 3, 4, 4, 5, 6, 6, 7, 8, 8, 9, 10, 10, 11, 12, 12], + + [ 3, 4, 4, 5, 6, 6, 7, 8, 8, 9, 10, 10, 11, 12, 12], + [ 5, 6, 6, 7, 8, 8, 9, 10, 10, 11, 12, 12, 13, 14, 14], + [ 5, 6, 6, 7, 8, 8, 9, 10, 10, 11, 12, 12, 13, 14, 14], + [ 7, 8, 8, 9, 10, 10, 11, 12, 12, 13, 14, 14, 15, 16, 16], + [ 7, 8, 8, 9, 10, 10, 11, 12, 12, 13, 14, 14, 15, 16, 16], + [ 9, 10, 10, 11, 12, 12, 13, 14, 14, 15, 16, 16, 17, 18, 18], + [ 9, 10, 10, 11, 12, 12, 13, 14, 14, 15, 16, 16, 17, 18, 18]] + ) + assert_array_equal(a, b) + + def test_check_shape(self): + a = [[4, 5, 6]] + a = pad(a, (5, 7), 'symmetric') + b = np.array( + [[5, 6, 6, 5, 4, 4, 5, 6, 6, 5, 4, 4, 5, 6, 6], + [5, 6, 6, 5, 4, 4, 5, 6, 6, 5, 4, 4, 5, 6, 6], + [5, 6, 6, 5, 4, 4, 5, 6, 6, 5, 4, 4, 5, 6, 6], + [5, 6, 6, 5, 4, 4, 5, 6, 6, 5, 4, 4, 5, 6, 6], + [5, 6, 6, 5, 4, 4, 5, 6, 6, 5, 4, 4, 5, 6, 6], + + [5, 6, 6, 5, 4, 4, 5, 6, 6, 5, 4, 4, 5, 6, 6], + [5, 6, 6, 5, 4, 4, 5, 6, 6, 5, 4, 4, 5, 6, 6], + + [5, 6, 6, 5, 4, 4, 5, 6, 6, 5, 4, 4, 5, 6, 6], + [5, 6, 6, 5, 4, 4, 5, 6, 6, 5, 4, 4, 5, 6, 6], + [5, 6, 6, 5, 4, 4, 5, 6, 6, 5, 4, 4, 5, 6, 6], + [5, 6, 6, 5, 4, 4, 5, 6, 6, 5, 4, 4, 5, 6, 6], + [5, 6, 6, 5, 4, 4, 5, 6, 6, 5, 4, 4, 5, 6, 6], + [5, 6, 6, 5, 4, 4, 5, 6, 6, 5, 4, 4, 5, 6, 6]] + ) + assert_array_equal(a, b) + + def test_check_01(self): + a = pad([1, 2, 3], 2, 'symmetric') + b = np.array([2, 1, 1, 2, 3, 3, 2]) + assert_array_equal(a, b) + + def test_check_02(self): + a = pad([1, 2, 3], 3, 'symmetric') + b = np.array([3, 2, 1, 1, 2, 3, 3, 2, 1]) + assert_array_equal(a, b) + + def test_check_03(self): + a = pad([1, 2, 3], 6, 'symmetric') + b = np.array([1, 2, 3, 3, 2, 1, 1, 2, 3, 3, 2, 1, 1, 2, 3]) + assert_array_equal(a, b) + + +class TestWrap(object): + def test_check_simple(self): + a = np.arange(100) + a = pad(a, (25, 20), 'wrap') + b = np.array( + [75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 96, 97, 98, 99, + + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] + ) + assert_array_equal(a, b) + + def test_check_large_pad(self): + a = np.arange(12) + a = np.reshape(a, (3, 4)) + a = pad(a, (10, 12), 'wrap') + b = np.array( + [[10, 11, 8, 9, 10, 11, 8, 9, 10, 11, 8, 9, 10, 11, 8, 9, 10, + 11, 8, 9, 10, 11, 8, 9, 10, 11], + [2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, + 3, 0, 1, 2, 3, 0, 1, 2, 3], + [6, 7, 4, 5, 6, 7, 4, 5, 6, 7, 4, 5, 6, 7, 4, 5, 6, + 7, 4, 5, 6, 7, 4, 5, 6, 7], + [10, 11, 8, 9, 10, 11, 8, 9, 10, 11, 8, 9, 10, 11, 8, 9, 10, + 11, 8, 9, 10, 11, 8, 9, 10, 11], + [2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, + 3, 0, 1, 2, 3, 0, 1, 2, 3], + [6, 7, 4, 5, 6, 7, 4, 5, 6, 7, 4, 5, 6, 7, 4, 5, 6, + 7, 4, 5, 6, 7, 4, 5, 6, 7], + [10, 11, 8, 9, 10, 11, 8, 9, 10, 11, 8, 9, 10, 11, 8, 9, 10, + 11, 8, 9, 10, 11, 8, 9, 10, 11], + [2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, + 3, 0, 1, 2, 3, 0, 1, 2, 3], + [6, 7, 4, 5, 6, 7, 4, 5, 6, 7, 4, 5, 6, 7, 4, 5, 6, + 7, 4, 5, 6, 7, 4, 5, 6, 7], + [10, 11, 8, 9, 10, 11, 8, 9, 10, 11, 8, 9, 10, 11, 8, 9, 10, + 11, 8, 9, 10, 11, 8, 9, 10, 11], + + [2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, + 3, 0, 1, 2, 3, 0, 1, 2, 3], + [6, 7, 4, 5, 6, 7, 4, 5, 6, 7, 4, 5, 6, 7, 4, 5, 6, + 7, 4, 5, 6, 7, 4, 5, 6, 7], + [10, 11, 8, 9, 10, 11, 8, 9, 10, 11, 8, 9, 10, 11, 8, 9, 10, + 11, 8, 9, 10, 11, 8, 9, 10, 11], + + [2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, + 3, 0, 1, 2, 3, 0, 1, 2, 3], + [6, 7, 4, 5, 6, 7, 4, 5, 6, 7, 4, 5, 6, 7, 4, 5, 6, + 7, 4, 5, 6, 7, 4, 5, 6, 7], + [10, 11, 8, 9, 10, 11, 8, 9, 10, 11, 8, 9, 10, 11, 8, 9, 10, + 11, 8, 9, 10, 11, 8, 9, 10, 11], + [2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, + 3, 0, 1, 2, 3, 0, 1, 2, 3], + [6, 7, 4, 5, 6, 7, 4, 5, 6, 7, 4, 5, 6, 7, 4, 5, 6, + 7, 4, 5, 6, 7, 4, 5, 6, 7], + [10, 11, 8, 9, 10, 11, 8, 9, 10, 11, 8, 9, 10, 11, 8, 9, 10, + 11, 8, 9, 10, 11, 8, 9, 10, 11], + [2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, + 3, 0, 1, 2, 3, 0, 1, 2, 3], + [6, 7, 4, 5, 6, 7, 4, 5, 6, 7, 4, 5, 6, 7, 4, 5, 6, + 7, 4, 5, 6, 7, 4, 5, 6, 7], + [10, 11, 8, 9, 10, 11, 8, 9, 10, 11, 8, 9, 10, 11, 8, 9, 10, + 11, 8, 9, 10, 11, 8, 9, 10, 11], + [2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, + 3, 0, 1, 2, 3, 0, 1, 2, 3], + [6, 7, 4, 5, 6, 7, 4, 5, 6, 7, 4, 5, 6, 7, 4, 5, 6, + 7, 4, 5, 6, 7, 4, 5, 6, 7], + [10, 11, 8, 9, 10, 11, 8, 9, 10, 11, 8, 9, 10, 11, 8, 9, 10, + 11, 8, 9, 10, 11, 8, 9, 10, 11]] + ) + assert_array_equal(a, b) + + def test_check_01(self): + a = pad([1, 2, 3], 3, 'wrap') + b = np.array([1, 2, 3, 1, 2, 3, 1, 2, 3]) + assert_array_equal(a, b) + + def test_check_02(self): + a = pad([1, 2, 3], 4, 'wrap') + b = np.array([3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1]) + assert_array_equal(a, b) + + def test_pad_with_zero(self): + a = np.ones((3, 5)) + b = np.pad(a, (0, 5), mode="wrap") + assert_array_equal(a, b[:-5, :-5]) + + +class TestStatLen(object): + def test_check_simple(self): + a = np.arange(30) + a = np.reshape(a, (6, 5)) + a = pad(a, ((2, 3), (3, 2)), mode='mean', stat_length=(3,)) + b = np.array( + [[6, 6, 6, 5, 6, 7, 8, 9, 8, 8], + [6, 6, 6, 5, 6, 7, 8, 9, 8, 8], + + [1, 1, 1, 0, 1, 2, 3, 4, 3, 3], + [6, 6, 6, 5, 6, 7, 8, 9, 8, 8], + [11, 11, 11, 10, 11, 12, 13, 14, 13, 13], + [16, 16, 16, 15, 16, 17, 18, 19, 18, 18], + [21, 21, 21, 20, 21, 22, 23, 24, 23, 23], + [26, 26, 26, 25, 26, 27, 28, 29, 28, 28], + + [21, 21, 21, 20, 21, 22, 23, 24, 23, 23], + [21, 21, 21, 20, 21, 22, 23, 24, 23, 23], + [21, 21, 21, 20, 21, 22, 23, 24, 23, 23]] + ) + assert_array_equal(a, b) + + +class TestEdge(object): + def test_check_simple(self): + a = np.arange(12) + a = np.reshape(a, (4, 3)) + a = pad(a, ((2, 3), (3, 2)), 'edge') + b = np.array( + [[0, 0, 0, 0, 1, 2, 2, 2], + [0, 0, 0, 0, 1, 2, 2, 2], + + [0, 0, 0, 0, 1, 2, 2, 2], + [3, 3, 3, 3, 4, 5, 5, 5], + [6, 6, 6, 6, 7, 8, 8, 8], + [9, 9, 9, 9, 10, 11, 11, 11], + + [9, 9, 9, 9, 10, 11, 11, 11], + [9, 9, 9, 9, 10, 11, 11, 11], + [9, 9, 9, 9, 10, 11, 11, 11]] + ) + assert_array_equal(a, b) + + def test_check_width_shape_1_2(self): + # Check a pad_width of the form ((1, 2),). + # Regression test for issue gh-7808. + a = np.array([1, 2, 3]) + padded = pad(a, ((1, 2),), 'edge') + expected = np.array([1, 1, 2, 3, 3, 3]) + assert_array_equal(padded, expected) + + a = np.array([[1, 2, 3], [4, 5, 6]]) + padded = pad(a, ((1, 2),), 'edge') + expected = pad(a, ((1, 2), (1, 2)), 'edge') + assert_array_equal(padded, expected) + + a = np.arange(24).reshape(2, 3, 4) + padded = pad(a, ((1, 2),), 'edge') + expected = pad(a, ((1, 2), (1, 2), (1, 2)), 'edge') + assert_array_equal(padded, expected) + + +class TestZeroPadWidth(object): + def test_zero_pad_width(self): + arr = np.arange(30) + arr = np.reshape(arr, (6, 5)) + for pad_width in (0, (0, 0), ((0, 0), (0, 0))): + assert_array_equal(arr, pad(arr, pad_width, mode='constant')) + + +class TestLegacyVectorFunction(object): + def test_legacy_vector_functionality(self): + def _padwithtens(vector, pad_width, iaxis, kwargs): + vector[:pad_width[0]] = 10 + vector[-pad_width[1]:] = 10 + return vector + + a = np.arange(6).reshape(2, 3) + a = pad(a, 2, _padwithtens) + b = np.array( + [[10, 10, 10, 10, 10, 10, 10], + [10, 10, 10, 10, 10, 10, 10], + + [10, 10, 0, 1, 2, 10, 10], + [10, 10, 3, 4, 5, 10, 10], + + [10, 10, 10, 10, 10, 10, 10], + [10, 10, 10, 10, 10, 10, 10]] + ) + assert_array_equal(a, b) + + +class TestNdarrayPadWidth(object): + def test_check_simple(self): + a = np.arange(12) + a = np.reshape(a, (4, 3)) + a = pad(a, np.array(((2, 3), (3, 2))), 'edge') + b = np.array( + [[0, 0, 0, 0, 1, 2, 2, 2], + [0, 0, 0, 0, 1, 2, 2, 2], + + [0, 0, 0, 0, 1, 2, 2, 2], + [3, 3, 3, 3, 4, 5, 5, 5], + [6, 6, 6, 6, 7, 8, 8, 8], + [9, 9, 9, 9, 10, 11, 11, 11], + + [9, 9, 9, 9, 10, 11, 11, 11], + [9, 9, 9, 9, 10, 11, 11, 11], + [9, 9, 9, 9, 10, 11, 11, 11]] + ) + assert_array_equal(a, b) + + +class TestUnicodeInput(object): + def test_unicode_mode(self): + constant_mode = u'constant' + a = np.pad([1], 2, mode=constant_mode) + b = np.array([0, 0, 1, 0, 0]) + assert_array_equal(a, b) + + +class TestObjectInput(object): + def test_object_input(self): + # Regression test for issue gh-11395. + a = np.full((4, 3), None) + pad_amt = ((2, 3), (3, 2)) + b = np.full((9, 8), None) + modes = ['edge', + 'symmetric', + 'reflect', + 'wrap', + ] + for mode in modes: + assert_array_equal(pad(a, pad_amt, mode=mode), b) + + +class TestValueError1(object): + def test_check_simple(self): + arr = np.arange(30) + arr = np.reshape(arr, (6, 5)) + kwargs = dict(mode='mean', stat_length=(3, )) + assert_raises(ValueError, pad, arr, ((2, 3), (3, 2), (4, 5)), + **kwargs) + + def test_check_negative_stat_length(self): + arr = np.arange(30) + arr = np.reshape(arr, (6, 5)) + kwargs = dict(mode='mean', stat_length=(-3, )) + assert_raises(ValueError, pad, arr, ((2, 3), (3, 2)), + **kwargs) + + def test_check_negative_pad_width(self): + arr = np.arange(30) + arr = np.reshape(arr, (6, 5)) + kwargs = dict(mode='mean', stat_length=(3, )) + assert_raises(ValueError, pad, arr, ((-2, 3), (3, 2)), + **kwargs) + + def test_check_empty_array(self): + assert_raises(ValueError, pad, [], 4, mode='reflect') + assert_raises(ValueError, pad, np.ndarray(0), 4, mode='reflect') + assert_raises(ValueError, pad, np.zeros((0, 3)), ((1,), (0,)), + mode='reflect') + + +class TestValueError2(object): + def test_check_negative_pad_amount(self): + arr = np.arange(30) + arr = np.reshape(arr, (6, 5)) + kwargs = dict(mode='mean', stat_length=(3, )) + assert_raises(ValueError, pad, arr, ((-2, 3), (3, 2)), + **kwargs) + + +class TestValueError3(object): + def test_check_kwarg_not_allowed(self): + arr = np.arange(30).reshape(5, 6) + assert_raises(ValueError, pad, arr, 4, mode='mean', + reflect_type='odd') + + def test_mode_not_set(self): + arr = np.arange(30).reshape(5, 6) + assert_raises(TypeError, pad, arr, 4) + + def test_malformed_pad_amount(self): + arr = np.arange(30).reshape(5, 6) + assert_raises(ValueError, pad, arr, (4, 5, 6, 7), mode='constant') + + def test_malformed_pad_amount2(self): + arr = np.arange(30).reshape(5, 6) + assert_raises(ValueError, pad, arr, ((3, 4, 5), (0, 1, 2)), + mode='constant') + + def test_pad_too_many_axes(self): + arr = np.arange(30).reshape(5, 6) + + # Attempt to pad using a 3D array equivalent + bad_shape = (((3,), (4,), (5,)), ((0,), (1,), (2,))) + assert_raises(ValueError, pad, arr, bad_shape, + mode='constant') + + +class TestTypeError1(object): + def test_float(self): + arr = np.arange(30) + assert_raises(TypeError, pad, arr, ((-2.1, 3), (3, 2))) + assert_raises(TypeError, pad, arr, np.array(((-2.1, 3), (3, 2)))) + + def test_str(self): + arr = np.arange(30) + assert_raises(TypeError, pad, arr, 'foo') + assert_raises(TypeError, pad, arr, np.array('foo')) + + def test_object(self): + class FooBar(object): + pass + arr = np.arange(30) + assert_raises(TypeError, pad, arr, FooBar()) + + def test_complex(self): + arr = np.arange(30) + assert_raises(TypeError, pad, arr, complex(1, -1)) + assert_raises(TypeError, pad, arr, np.array(complex(1, -1))) + + def test_check_wrong_pad_amount(self): + arr = np.arange(30) + arr = np.reshape(arr, (6, 5)) + kwargs = dict(mode='mean', stat_length=(3, )) + assert_raises(TypeError, pad, arr, ((2, 3, 4), (3, 2)), + **kwargs) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/lib/tests/test_arraysetops.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/lib/tests/test_arraysetops.py new file mode 100644 index 0000000000000000000000000000000000000000..93d4b279f30a74bd4bf206ef0259e0924c8c36e7 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/lib/tests/test_arraysetops.py @@ -0,0 +1,623 @@ +"""Test functions for 1D array set operations. + +""" +from __future__ import division, absolute_import, print_function + +import numpy as np + +from numpy.testing import (assert_array_equal, assert_equal, + assert_raises, assert_raises_regex) +from numpy.lib.arraysetops import ( + ediff1d, intersect1d, setxor1d, union1d, setdiff1d, unique, in1d, isin + ) +import pytest + + + +class TestSetOps(object): + + def test_intersect1d(self): + # unique inputs + a = np.array([5, 7, 1, 2]) + b = np.array([2, 4, 3, 1, 5]) + + ec = np.array([1, 2, 5]) + c = intersect1d(a, b, assume_unique=True) + assert_array_equal(c, ec) + + # non-unique inputs + a = np.array([5, 5, 7, 1, 2]) + b = np.array([2, 1, 4, 3, 3, 1, 5]) + + ed = np.array([1, 2, 5]) + c = intersect1d(a, b) + assert_array_equal(c, ed) + assert_array_equal([], intersect1d([], [])) + + def test_intersect1d_array_like(self): + # See gh-11772 + class Test(object): + def __array__(self): + return np.arange(3) + + a = Test() + res = intersect1d(a, a) + assert_array_equal(res, a) + res = intersect1d([1, 2, 3], [1, 2, 3]) + assert_array_equal(res, [1, 2, 3]) + + def test_intersect1d_indices(self): + # unique inputs + a = np.array([1, 2, 3, 4]) + b = np.array([2, 1, 4, 6]) + c, i1, i2 = intersect1d(a, b, assume_unique=True, return_indices=True) + ee = np.array([1, 2, 4]) + assert_array_equal(c, ee) + assert_array_equal(a[i1], ee) + assert_array_equal(b[i2], ee) + + # non-unique inputs + a = np.array([1, 2, 2, 3, 4, 3, 2]) + b = np.array([1, 8, 4, 2, 2, 3, 2, 3]) + c, i1, i2 = intersect1d(a, b, return_indices=True) + ef = np.array([1, 2, 3, 4]) + assert_array_equal(c, ef) + assert_array_equal(a[i1], ef) + assert_array_equal(b[i2], ef) + + # non1d, unique inputs + a = np.array([[2, 4, 5, 6], [7, 8, 1, 15]]) + b = np.array([[3, 2, 7, 6], [10, 12, 8, 9]]) + c, i1, i2 = intersect1d(a, b, assume_unique=True, return_indices=True) + ui1 = np.unravel_index(i1, a.shape) + ui2 = np.unravel_index(i2, b.shape) + ea = np.array([2, 6, 7, 8]) + assert_array_equal(ea, a[ui1]) + assert_array_equal(ea, b[ui2]) + + # non1d, not assumed to be uniqueinputs + a = np.array([[2, 4, 5, 6, 6], [4, 7, 8, 7, 2]]) + b = np.array([[3, 2, 7, 7], [10, 12, 8, 7]]) + c, i1, i2 = intersect1d(a, b, return_indices=True) + ui1 = np.unravel_index(i1, a.shape) + ui2 = np.unravel_index(i2, b.shape) + ea = np.array([2, 7, 8]) + assert_array_equal(ea, a[ui1]) + assert_array_equal(ea, b[ui2]) + + def test_setxor1d(self): + a = np.array([5, 7, 1, 2]) + b = np.array([2, 4, 3, 1, 5]) + + ec = np.array([3, 4, 7]) + c = setxor1d(a, b) + assert_array_equal(c, ec) + + a = np.array([1, 2, 3]) + b = np.array([6, 5, 4]) + + ec = np.array([1, 2, 3, 4, 5, 6]) + c = setxor1d(a, b) + assert_array_equal(c, ec) + + a = np.array([1, 8, 2, 3]) + b = np.array([6, 5, 4, 8]) + + ec = np.array([1, 2, 3, 4, 5, 6]) + c = setxor1d(a, b) + assert_array_equal(c, ec) + + assert_array_equal([], setxor1d([], [])) + + def test_ediff1d(self): + zero_elem = np.array([]) + one_elem = np.array([1]) + two_elem = np.array([1, 2]) + + assert_array_equal([], ediff1d(zero_elem)) + assert_array_equal([0], ediff1d(zero_elem, to_begin=0)) + assert_array_equal([0], ediff1d(zero_elem, to_end=0)) + assert_array_equal([-1, 0], ediff1d(zero_elem, to_begin=-1, to_end=0)) + assert_array_equal([], ediff1d(one_elem)) + assert_array_equal([1], ediff1d(two_elem)) + assert_array_equal([7,1,9], ediff1d(two_elem, to_begin=7, to_end=9)) + assert_array_equal([5,6,1,7,8], ediff1d(two_elem, to_begin=[5,6], to_end=[7,8])) + assert_array_equal([1,9], ediff1d(two_elem, to_end=9)) + assert_array_equal([1,7,8], ediff1d(two_elem, to_end=[7,8])) + assert_array_equal([7,1], ediff1d(two_elem, to_begin=7)) + assert_array_equal([5,6,1], ediff1d(two_elem, to_begin=[5,6])) + + @pytest.mark.parametrize("ary, prepend, append", [ + # should fail because trying to cast + # np.nan standard floating point value + # into an integer array: + (np.array([1, 2, 3], dtype=np.int64), + None, + np.nan), + # should fail because attempting + # to downcast to smaller int type: + (np.array([1, 2, 3], dtype=np.int16), + np.array([5, 1<<20, 2], dtype=np.int32), + None), + # should fail because attempting to cast + # two special floating point values + # to integers (on both sides of ary): + (np.array([1., 3., 9.], dtype=np.int8), + np.nan, + np.nan), + ]) + def test_ediff1d_forbidden_type_casts(self, ary, prepend, append): + # verify resolution of gh-11490 + + # specifically, raise an appropriate + # Exception when attempting to append or + # prepend with an incompatible type + msg = 'cannot convert' + with assert_raises_regex(ValueError, msg): + ediff1d(ary=ary, + to_end=append, + to_begin=prepend) + + @pytest.mark.parametrize("ary," + "prepend," + "append," + "expected", [ + (np.array([1, 2, 3], dtype=np.int16), + 0, + None, + np.array([0, 1, 1], dtype=np.int16)), + (np.array([1, 2, 3], dtype=np.int32), + 0, + 0, + np.array([0, 1, 1, 0], dtype=np.int32)), + (np.array([1, 2, 3], dtype=np.int64), + 3, + -9, + np.array([3, 1, 1, -9], dtype=np.int64)), + ]) + def test_ediff1d_scalar_handling(self, + ary, + prepend, + append, + expected): + # maintain backwards-compatibility + # of scalar prepend / append behavior + # in ediff1d following fix for gh-11490 + actual = np.ediff1d(ary=ary, + to_end=append, + to_begin=prepend) + assert_equal(actual, expected) + + + def test_isin(self): + # the tests for in1d cover most of isin's behavior + # if in1d is removed, would need to change those tests to test + # isin instead. + def _isin_slow(a, b): + b = np.asarray(b).flatten().tolist() + return a in b + isin_slow = np.vectorize(_isin_slow, otypes=[bool], excluded={1}) + def assert_isin_equal(a, b): + x = isin(a, b) + y = isin_slow(a, b) + assert_array_equal(x, y) + + #multidimensional arrays in both arguments + a = np.arange(24).reshape([2, 3, 4]) + b = np.array([[10, 20, 30], [0, 1, 3], [11, 22, 33]]) + assert_isin_equal(a, b) + + #array-likes as both arguments + c = [(9, 8), (7, 6)] + d = (9, 7) + assert_isin_equal(c, d) + + #zero-d array: + f = np.array(3) + assert_isin_equal(f, b) + assert_isin_equal(a, f) + assert_isin_equal(f, f) + + #scalar: + assert_isin_equal(5, b) + assert_isin_equal(a, 6) + assert_isin_equal(5, 6) + + #empty array-like: + x = [] + assert_isin_equal(x, b) + assert_isin_equal(a, x) + assert_isin_equal(x, x) + + def test_in1d(self): + # we use two different sizes for the b array here to test the + # two different paths in in1d(). + for mult in (1, 10): + # One check without np.array to make sure lists are handled correct + a = [5, 7, 1, 2] + b = [2, 4, 3, 1, 5] * mult + ec = np.array([True, False, True, True]) + c = in1d(a, b, assume_unique=True) + assert_array_equal(c, ec) + + a[0] = 8 + ec = np.array([False, False, True, True]) + c = in1d(a, b, assume_unique=True) + assert_array_equal(c, ec) + + a[0], a[3] = 4, 8 + ec = np.array([True, False, True, False]) + c = in1d(a, b, assume_unique=True) + assert_array_equal(c, ec) + + a = np.array([5, 4, 5, 3, 4, 4, 3, 4, 3, 5, 2, 1, 5, 5]) + b = [2, 3, 4] * mult + ec = [False, True, False, True, True, True, True, True, True, + False, True, False, False, False] + c = in1d(a, b) + assert_array_equal(c, ec) + + b = b + [5, 5, 4] * mult + ec = [True, True, True, True, True, True, True, True, True, True, + True, False, True, True] + c = in1d(a, b) + assert_array_equal(c, ec) + + a = np.array([5, 7, 1, 2]) + b = np.array([2, 4, 3, 1, 5] * mult) + ec = np.array([True, False, True, True]) + c = in1d(a, b) + assert_array_equal(c, ec) + + a = np.array([5, 7, 1, 1, 2]) + b = np.array([2, 4, 3, 3, 1, 5] * mult) + ec = np.array([True, False, True, True, True]) + c = in1d(a, b) + assert_array_equal(c, ec) + + a = np.array([5, 5]) + b = np.array([2, 2] * mult) + ec = np.array([False, False]) + c = in1d(a, b) + assert_array_equal(c, ec) + + a = np.array([5]) + b = np.array([2]) + ec = np.array([False]) + c = in1d(a, b) + assert_array_equal(c, ec) + + assert_array_equal(in1d([], []), []) + + def test_in1d_char_array(self): + a = np.array(['a', 'b', 'c', 'd', 'e', 'c', 'e', 'b']) + b = np.array(['a', 'c']) + + ec = np.array([True, False, True, False, False, True, False, False]) + c = in1d(a, b) + + assert_array_equal(c, ec) + + def test_in1d_invert(self): + "Test in1d's invert parameter" + # We use two different sizes for the b array here to test the + # two different paths in in1d(). + for mult in (1, 10): + a = np.array([5, 4, 5, 3, 4, 4, 3, 4, 3, 5, 2, 1, 5, 5]) + b = [2, 3, 4] * mult + assert_array_equal(np.invert(in1d(a, b)), in1d(a, b, invert=True)) + + def test_in1d_ravel(self): + # Test that in1d ravels its input arrays. This is not documented + # behavior however. The test is to ensure consistentency. + a = np.arange(6).reshape(2, 3) + b = np.arange(3, 9).reshape(3, 2) + long_b = np.arange(3, 63).reshape(30, 2) + ec = np.array([False, False, False, True, True, True]) + + assert_array_equal(in1d(a, b, assume_unique=True), ec) + assert_array_equal(in1d(a, b, assume_unique=False), ec) + assert_array_equal(in1d(a, long_b, assume_unique=True), ec) + assert_array_equal(in1d(a, long_b, assume_unique=False), ec) + + def test_in1d_first_array_is_object(self): + ar1 = [None] + ar2 = np.array([1]*10) + expected = np.array([False]) + result = np.in1d(ar1, ar2) + assert_array_equal(result, expected) + + def test_in1d_second_array_is_object(self): + ar1 = 1 + ar2 = np.array([None]*10) + expected = np.array([False]) + result = np.in1d(ar1, ar2) + assert_array_equal(result, expected) + + def test_in1d_both_arrays_are_object(self): + ar1 = [None] + ar2 = np.array([None]*10) + expected = np.array([True]) + result = np.in1d(ar1, ar2) + assert_array_equal(result, expected) + + def test_in1d_both_arrays_have_structured_dtype(self): + # Test arrays of a structured data type containing an integer field + # and a field of dtype `object` allowing for arbitrary Python objects + dt = np.dtype([('field1', int), ('field2', object)]) + ar1 = np.array([(1, None)], dtype=dt) + ar2 = np.array([(1, None)]*10, dtype=dt) + expected = np.array([True]) + result = np.in1d(ar1, ar2) + assert_array_equal(result, expected) + + def test_union1d(self): + a = np.array([5, 4, 7, 1, 2]) + b = np.array([2, 4, 3, 3, 2, 1, 5]) + + ec = np.array([1, 2, 3, 4, 5, 7]) + c = union1d(a, b) + assert_array_equal(c, ec) + + # Tests gh-10340, arguments to union1d should be + # flattened if they are not already 1D + x = np.array([[0, 1, 2], [3, 4, 5]]) + y = np.array([0, 1, 2, 3, 4]) + ez = np.array([0, 1, 2, 3, 4, 5]) + z = union1d(x, y) + assert_array_equal(z, ez) + + assert_array_equal([], union1d([], [])) + + def test_setdiff1d(self): + a = np.array([6, 5, 4, 7, 1, 2, 7, 4]) + b = np.array([2, 4, 3, 3, 2, 1, 5]) + + ec = np.array([6, 7]) + c = setdiff1d(a, b) + assert_array_equal(c, ec) + + a = np.arange(21) + b = np.arange(19) + ec = np.array([19, 20]) + c = setdiff1d(a, b) + assert_array_equal(c, ec) + + assert_array_equal([], setdiff1d([], [])) + a = np.array((), np.uint32) + assert_equal(setdiff1d(a, []).dtype, np.uint32) + + def test_setdiff1d_unique(self): + a = np.array([3, 2, 1]) + b = np.array([7, 5, 2]) + expected = np.array([3, 1]) + actual = setdiff1d(a, b, assume_unique=True) + assert_equal(actual, expected) + + def test_setdiff1d_char_array(self): + a = np.array(['a', 'b', 'c']) + b = np.array(['a', 'b', 's']) + assert_array_equal(setdiff1d(a, b), np.array(['c'])) + + def test_manyways(self): + a = np.array([5, 7, 1, 2, 8]) + b = np.array([9, 8, 2, 4, 3, 1, 5]) + + c1 = setxor1d(a, b) + aux1 = intersect1d(a, b) + aux2 = union1d(a, b) + c2 = setdiff1d(aux2, aux1) + assert_array_equal(c1, c2) + + +class TestUnique(object): + + def test_unique_1d(self): + + def check_all(a, b, i1, i2, c, dt): + base_msg = 'check {0} failed for type {1}' + + msg = base_msg.format('values', dt) + v = unique(a) + assert_array_equal(v, b, msg) + + msg = base_msg.format('return_index', dt) + v, j = unique(a, 1, 0, 0) + assert_array_equal(v, b, msg) + assert_array_equal(j, i1, msg) + + msg = base_msg.format('return_inverse', dt) + v, j = unique(a, 0, 1, 0) + assert_array_equal(v, b, msg) + assert_array_equal(j, i2, msg) + + msg = base_msg.format('return_counts', dt) + v, j = unique(a, 0, 0, 1) + assert_array_equal(v, b, msg) + assert_array_equal(j, c, msg) + + msg = base_msg.format('return_index and return_inverse', dt) + v, j1, j2 = unique(a, 1, 1, 0) + assert_array_equal(v, b, msg) + assert_array_equal(j1, i1, msg) + assert_array_equal(j2, i2, msg) + + msg = base_msg.format('return_index and return_counts', dt) + v, j1, j2 = unique(a, 1, 0, 1) + assert_array_equal(v, b, msg) + assert_array_equal(j1, i1, msg) + assert_array_equal(j2, c, msg) + + msg = base_msg.format('return_inverse and return_counts', dt) + v, j1, j2 = unique(a, 0, 1, 1) + assert_array_equal(v, b, msg) + assert_array_equal(j1, i2, msg) + assert_array_equal(j2, c, msg) + + msg = base_msg.format(('return_index, return_inverse ' + 'and return_counts'), dt) + v, j1, j2, j3 = unique(a, 1, 1, 1) + assert_array_equal(v, b, msg) + assert_array_equal(j1, i1, msg) + assert_array_equal(j2, i2, msg) + assert_array_equal(j3, c, msg) + + a = [5, 7, 1, 2, 1, 5, 7]*10 + b = [1, 2, 5, 7] + i1 = [2, 3, 0, 1] + i2 = [2, 3, 0, 1, 0, 2, 3]*10 + c = np.multiply([2, 1, 2, 2], 10) + + # test for numeric arrays + types = [] + types.extend(np.typecodes['AllInteger']) + types.extend(np.typecodes['AllFloat']) + types.append('datetime64[D]') + types.append('timedelta64[D]') + for dt in types: + aa = np.array(a, dt) + bb = np.array(b, dt) + check_all(aa, bb, i1, i2, c, dt) + + # test for object arrays + dt = 'O' + aa = np.empty(len(a), dt) + aa[:] = a + bb = np.empty(len(b), dt) + bb[:] = b + check_all(aa, bb, i1, i2, c, dt) + + # test for structured arrays + dt = [('', 'i'), ('', 'i')] + aa = np.array(list(zip(a, a)), dt) + bb = np.array(list(zip(b, b)), dt) + check_all(aa, bb, i1, i2, c, dt) + + # test for ticket #2799 + aa = [1. + 0.j, 1 - 1.j, 1] + assert_array_equal(np.unique(aa), [1. - 1.j, 1. + 0.j]) + + # test for ticket #4785 + a = [(1, 2), (1, 2), (2, 3)] + unq = [1, 2, 3] + inv = [0, 1, 0, 1, 1, 2] + a1 = unique(a) + assert_array_equal(a1, unq) + a2, a2_inv = unique(a, return_inverse=True) + assert_array_equal(a2, unq) + assert_array_equal(a2_inv, inv) + + # test for chararrays with return_inverse (gh-5099) + a = np.chararray(5) + a[...] = '' + a2, a2_inv = np.unique(a, return_inverse=True) + assert_array_equal(a2_inv, np.zeros(5)) + + # test for ticket #9137 + a = [] + a1_idx = np.unique(a, return_index=True)[1] + a2_inv = np.unique(a, return_inverse=True)[1] + a3_idx, a3_inv = np.unique(a, return_index=True, return_inverse=True)[1:] + assert_equal(a1_idx.dtype, np.intp) + assert_equal(a2_inv.dtype, np.intp) + assert_equal(a3_idx.dtype, np.intp) + assert_equal(a3_inv.dtype, np.intp) + + def test_unique_axis_errors(self): + assert_raises(TypeError, self._run_axis_tests, object) + assert_raises(TypeError, self._run_axis_tests, + [('a', int), ('b', object)]) + + assert_raises(np.AxisError, unique, np.arange(10), axis=2) + assert_raises(np.AxisError, unique, np.arange(10), axis=-2) + + def test_unique_axis_list(self): + msg = "Unique failed on list of lists" + inp = [[0, 1, 0], [0, 1, 0]] + inp_arr = np.asarray(inp) + assert_array_equal(unique(inp, axis=0), unique(inp_arr, axis=0), msg) + assert_array_equal(unique(inp, axis=1), unique(inp_arr, axis=1), msg) + + def test_unique_axis(self): + types = [] + types.extend(np.typecodes['AllInteger']) + types.extend(np.typecodes['AllFloat']) + types.append('datetime64[D]') + types.append('timedelta64[D]') + types.append([('a', int), ('b', int)]) + types.append([('a', int), ('b', float)]) + + for dtype in types: + self._run_axis_tests(dtype) + + msg = 'Non-bitwise-equal booleans test failed' + data = np.arange(10, dtype=np.uint8).reshape(-1, 2).view(bool) + result = np.array([[False, True], [True, True]], dtype=bool) + assert_array_equal(unique(data, axis=0), result, msg) + + msg = 'Negative zero equality test failed' + data = np.array([[-0.0, 0.0], [0.0, -0.0], [-0.0, 0.0], [0.0, -0.0]]) + result = np.array([[-0.0, 0.0]]) + assert_array_equal(unique(data, axis=0), result, msg) + + def test_unique_masked(self): + # issue 8664 + x = np.array([64, 0, 1, 2, 3, 63, 63, 0, 0, 0, 1, 2, 0, 63, 0], dtype='uint8') + y = np.ma.masked_equal(x, 0) + + v = np.unique(y) + v2, i, c = np.unique(y, return_index=True, return_counts=True) + + msg = 'Unique returned different results when asked for index' + assert_array_equal(v.data, v2.data, msg) + assert_array_equal(v.mask, v2.mask, msg) + + def test_unique_sort_order_with_axis(self): + # These tests fail if sorting along axis is done by treating subarrays + # as unsigned byte strings. See gh-10495. + fmt = "sort order incorrect for integer type '%s'" + for dt in 'bhilq': + a = np.array([[-1],[0]], dt) + b = np.unique(a, axis=0) + assert_array_equal(a, b, fmt % dt) + + def _run_axis_tests(self, dtype): + data = np.array([[0, 1, 0, 0], + [1, 0, 0, 0], + [0, 1, 0, 0], + [1, 0, 0, 0]]).astype(dtype) + + msg = 'Unique with 1d array and axis=0 failed' + result = np.array([0, 1]) + assert_array_equal(unique(data), result.astype(dtype), msg) + + msg = 'Unique with 2d array and axis=0 failed' + result = np.array([[0, 1, 0, 0], [1, 0, 0, 0]]) + assert_array_equal(unique(data, axis=0), result.astype(dtype), msg) + + msg = 'Unique with 2d array and axis=1 failed' + result = np.array([[0, 0, 1], [0, 1, 0], [0, 0, 1], [0, 1, 0]]) + assert_array_equal(unique(data, axis=1), result.astype(dtype), msg) + + msg = 'Unique with 3d array and axis=2 failed' + data3d = np.dstack([data] * 3) + result = data3d[..., :1] + assert_array_equal(unique(data3d, axis=2), result, msg) + + uniq, idx, inv, cnt = unique(data, axis=0, return_index=True, + return_inverse=True, return_counts=True) + msg = "Unique's return_index=True failed with axis=0" + assert_array_equal(data[idx], uniq, msg) + msg = "Unique's return_inverse=True failed with axis=0" + assert_array_equal(uniq[inv], data) + msg = "Unique's return_counts=True failed with axis=0" + assert_array_equal(cnt, np.array([2, 2]), msg) + + uniq, idx, inv, cnt = unique(data, axis=1, return_index=True, + return_inverse=True, return_counts=True) + msg = "Unique's return_index=True failed with axis=1" + assert_array_equal(data[:, idx], uniq) + msg = "Unique's return_inverse=True failed with axis=1" + assert_array_equal(uniq[:, inv], data) + msg = "Unique's return_counts=True failed with axis=1" + assert_array_equal(cnt, np.array([2, 1, 1]), msg) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/lib/tests/test_arrayterator.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/lib/tests/test_arrayterator.py new file mode 100644 index 0000000000000000000000000000000000000000..2ce4456a5b5c0210668409fdb3dd1a0a53fd5e8c --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/lib/tests/test_arrayterator.py @@ -0,0 +1,48 @@ +from __future__ import division, absolute_import, print_function + +from operator import mul +from functools import reduce + +import numpy as np +from numpy.random import randint +from numpy.lib import Arrayterator +from numpy.testing import assert_ + + +def test(): + np.random.seed(np.arange(10)) + + # Create a random array + ndims = randint(5)+1 + shape = tuple(randint(10)+1 for dim in range(ndims)) + els = reduce(mul, shape) + a = np.arange(els) + a.shape = shape + + buf_size = randint(2*els) + b = Arrayterator(a, buf_size) + + # Check that each block has at most ``buf_size`` elements + for block in b: + assert_(len(block.flat) <= (buf_size or els)) + + # Check that all elements are iterated correctly + assert_(list(b.flat) == list(a.flat)) + + # Slice arrayterator + start = [randint(dim) for dim in shape] + stop = [randint(dim)+1 for dim in shape] + step = [randint(dim)+1 for dim in shape] + slice_ = tuple(slice(*t) for t in zip(start, stop, step)) + c = b[slice_] + d = a[slice_] + + # Check that each block has at most ``buf_size`` elements + for block in c: + assert_(len(block.flat) <= (buf_size or els)) + + # Check that the arrayterator is sliced correctly + assert_(np.all(c.__array__() == d)) + + # Check that all elements are iterated correctly + assert_(list(c.flat) == list(d.flat)) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/lib/tests/test_financial.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/lib/tests/test_financial.py new file mode 100644 index 0000000000000000000000000000000000000000..5249150411488d79552767bf44b0354a49f6ae12 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/lib/tests/test_financial.py @@ -0,0 +1,340 @@ +from __future__ import division, absolute_import, print_function + +from decimal import Decimal + +import numpy as np +from numpy.testing import ( + assert_, assert_almost_equal, assert_allclose, assert_equal, assert_raises + ) + + +class TestFinancial(object): + def test_rate(self): + assert_almost_equal( + np.rate(10, 0, -3500, 10000), + 0.1107, 4) + + def test_rate_decimal(self): + rate = np.rate(Decimal('10'), Decimal('0'), Decimal('-3500'), Decimal('10000')) + assert_equal(Decimal('0.1106908537142689284704528100'), rate) + + def test_irr(self): + v = [-150000, 15000, 25000, 35000, 45000, 60000] + assert_almost_equal(np.irr(v), 0.0524, 2) + v = [-100, 0, 0, 74] + assert_almost_equal(np.irr(v), -0.0955, 2) + v = [-100, 39, 59, 55, 20] + assert_almost_equal(np.irr(v), 0.28095, 2) + v = [-100, 100, 0, -7] + assert_almost_equal(np.irr(v), -0.0833, 2) + v = [-100, 100, 0, 7] + assert_almost_equal(np.irr(v), 0.06206, 2) + v = [-5, 10.5, 1, -8, 1] + assert_almost_equal(np.irr(v), 0.0886, 2) + + # Test that if there is no solution then np.irr returns nan + # Fixes gh-6744 + v = [-1, -2, -3] + assert_equal(np.irr(v), np.nan) + + def test_pv(self): + assert_almost_equal(np.pv(0.07, 20, 12000, 0), -127128.17, 2) + + def test_pv_decimal(self): + assert_equal(np.pv(Decimal('0.07'), Decimal('20'), Decimal('12000'), Decimal('0')), + Decimal('-127128.1709461939327295222005')) + + def test_fv(self): + assert_equal(np.fv(0.075, 20, -2000, 0, 0), 86609.362673042924) + + def test_fv_decimal(self): + assert_equal(np.fv(Decimal('0.075'), Decimal('20'), Decimal('-2000'), 0, 0), + Decimal('86609.36267304300040536731624')) + + def test_pmt(self): + res = np.pmt(0.08 / 12, 5 * 12, 15000) + tgt = -304.145914 + assert_allclose(res, tgt) + # Test the edge case where rate == 0.0 + res = np.pmt(0.0, 5 * 12, 15000) + tgt = -250.0 + assert_allclose(res, tgt) + # Test the case where we use broadcast and + # the arguments passed in are arrays. + res = np.pmt([[0.0, 0.8], [0.3, 0.8]], [12, 3], [2000, 20000]) + tgt = np.array([[-166.66667, -19311.258], [-626.90814, -19311.258]]) + assert_allclose(res, tgt) + + def test_pmt_decimal(self): + res = np.pmt(Decimal('0.08') / Decimal('12'), 5 * 12, 15000) + tgt = Decimal('-304.1459143262052370338701494') + assert_equal(res, tgt) + # Test the edge case where rate == 0.0 + res = np.pmt(Decimal('0'), Decimal('60'), Decimal('15000')) + tgt = -250 + assert_equal(res, tgt) + # Test the case where we use broadcast and + # the arguments passed in are arrays. + res = np.pmt([[Decimal('0'), Decimal('0.8')], [Decimal('0.3'), Decimal('0.8')]], + [Decimal('12'), Decimal('3')], [Decimal('2000'), Decimal('20000')]) + tgt = np.array([[Decimal('-166.6666666666666666666666667'), Decimal('-19311.25827814569536423841060')], + [Decimal('-626.9081401700757748402586600'), Decimal('-19311.25827814569536423841060')]]) + + # Cannot use the `assert_allclose` because it uses isfinite under the covers + # which does not support the Decimal type + # See issue: https://github.com/numpy/numpy/issues/9954 + assert_equal(res[0][0], tgt[0][0]) + assert_equal(res[0][1], tgt[0][1]) + assert_equal(res[1][0], tgt[1][0]) + assert_equal(res[1][1], tgt[1][1]) + + def test_ppmt(self): + assert_equal(np.round(np.ppmt(0.1 / 12, 1, 60, 55000), 2), -710.25) + + def test_ppmt_decimal(self): + assert_equal(np.ppmt(Decimal('0.1') / Decimal('12'), Decimal('1'), Decimal('60'), Decimal('55000')), + Decimal('-710.2541257864217612489830917')) + + # Two tests showing how Decimal is actually getting at a more exact result + # .23 / 12 does not come out nicely as a float but does as a decimal + def test_ppmt_special_rate(self): + assert_equal(np.round(np.ppmt(0.23 / 12, 1, 60, 10000000000), 8), -90238044.232277036) + + def test_ppmt_special_rate_decimal(self): + # When rounded out to 8 decimal places like the float based test, this should not equal the same value + # as the float, substituted for the decimal + def raise_error_because_not_equal(): + assert_equal( + round(np.ppmt(Decimal('0.23') / Decimal('12'), 1, 60, Decimal('10000000000')), 8), + Decimal('-90238044.232277036')) + + assert_raises(AssertionError, raise_error_because_not_equal) + assert_equal(np.ppmt(Decimal('0.23') / Decimal('12'), 1, 60, Decimal('10000000000')), + Decimal('-90238044.2322778884413969909')) + + def test_ipmt(self): + assert_almost_equal(np.round(np.ipmt(0.1 / 12, 1, 24, 2000), 2), -16.67) + + def test_ipmt_decimal(self): + result = np.ipmt(Decimal('0.1') / Decimal('12'), 1, 24, 2000) + assert_equal(result.flat[0], Decimal('-16.66666666666666666666666667')) + + def test_nper(self): + assert_almost_equal(np.nper(0.075, -2000, 0, 100000.), + 21.54, 2) + + def test_nper2(self): + assert_almost_equal(np.nper(0.0, -2000, 0, 100000.), + 50.0, 1) + + def test_npv(self): + assert_almost_equal( + np.npv(0.05, [-15000, 1500, 2500, 3500, 4500, 6000]), + 122.89, 2) + + def test_npv_decimal(self): + assert_equal( + np.npv(Decimal('0.05'), [-15000, 1500, 2500, 3500, 4500, 6000]), + Decimal('122.894854950942692161628715')) + + def test_mirr(self): + val = [-4500, -800, 800, 800, 600, 600, 800, 800, 700, 3000] + assert_almost_equal(np.mirr(val, 0.08, 0.055), 0.0666, 4) + + val = [-120000, 39000, 30000, 21000, 37000, 46000] + assert_almost_equal(np.mirr(val, 0.10, 0.12), 0.126094, 6) + + val = [100, 200, -50, 300, -200] + assert_almost_equal(np.mirr(val, 0.05, 0.06), 0.3428, 4) + + val = [39000, 30000, 21000, 37000, 46000] + assert_(np.isnan(np.mirr(val, 0.10, 0.12))) + + def test_mirr_decimal(self): + val = [Decimal('-4500'), Decimal('-800'), Decimal('800'), Decimal('800'), + Decimal('600'), Decimal('600'), Decimal('800'), Decimal('800'), + Decimal('700'), Decimal('3000')] + assert_equal(np.mirr(val, Decimal('0.08'), Decimal('0.055')), + Decimal('0.066597175031553548874239618')) + + val = [Decimal('-120000'), Decimal('39000'), Decimal('30000'), + Decimal('21000'), Decimal('37000'), Decimal('46000')] + assert_equal(np.mirr(val, Decimal('0.10'), Decimal('0.12')), Decimal('0.126094130365905145828421880')) + + val = [Decimal('100'), Decimal('200'), Decimal('-50'), + Decimal('300'), Decimal('-200')] + assert_equal(np.mirr(val, Decimal('0.05'), Decimal('0.06')), Decimal('0.342823387842176663647819868')) + + val = [Decimal('39000'), Decimal('30000'), Decimal('21000'), Decimal('37000'), Decimal('46000')] + assert_(np.isnan(np.mirr(val, Decimal('0.10'), Decimal('0.12')))) + + def test_when(self): + # begin + assert_equal(np.rate(10, 20, -3500, 10000, 1), + np.rate(10, 20, -3500, 10000, 'begin')) + # end + assert_equal(np.rate(10, 20, -3500, 10000), + np.rate(10, 20, -3500, 10000, 'end')) + assert_equal(np.rate(10, 20, -3500, 10000, 0), + np.rate(10, 20, -3500, 10000, 'end')) + + # begin + assert_equal(np.pv(0.07, 20, 12000, 0, 1), + np.pv(0.07, 20, 12000, 0, 'begin')) + # end + assert_equal(np.pv(0.07, 20, 12000, 0), + np.pv(0.07, 20, 12000, 0, 'end')) + assert_equal(np.pv(0.07, 20, 12000, 0, 0), + np.pv(0.07, 20, 12000, 0, 'end')) + + # begin + assert_equal(np.fv(0.075, 20, -2000, 0, 1), + np.fv(0.075, 20, -2000, 0, 'begin')) + # end + assert_equal(np.fv(0.075, 20, -2000, 0), + np.fv(0.075, 20, -2000, 0, 'end')) + assert_equal(np.fv(0.075, 20, -2000, 0, 0), + np.fv(0.075, 20, -2000, 0, 'end')) + + # begin + assert_equal(np.pmt(0.08 / 12, 5 * 12, 15000., 0, 1), + np.pmt(0.08 / 12, 5 * 12, 15000., 0, 'begin')) + # end + assert_equal(np.pmt(0.08 / 12, 5 * 12, 15000., 0), + np.pmt(0.08 / 12, 5 * 12, 15000., 0, 'end')) + assert_equal(np.pmt(0.08 / 12, 5 * 12, 15000., 0, 0), + np.pmt(0.08 / 12, 5 * 12, 15000., 0, 'end')) + + # begin + assert_equal(np.ppmt(0.1 / 12, 1, 60, 55000, 0, 1), + np.ppmt(0.1 / 12, 1, 60, 55000, 0, 'begin')) + # end + assert_equal(np.ppmt(0.1 / 12, 1, 60, 55000, 0), + np.ppmt(0.1 / 12, 1, 60, 55000, 0, 'end')) + assert_equal(np.ppmt(0.1 / 12, 1, 60, 55000, 0, 0), + np.ppmt(0.1 / 12, 1, 60, 55000, 0, 'end')) + + # begin + assert_equal(np.ipmt(0.1 / 12, 1, 24, 2000, 0, 1), + np.ipmt(0.1 / 12, 1, 24, 2000, 0, 'begin')) + # end + assert_equal(np.ipmt(0.1 / 12, 1, 24, 2000, 0), + np.ipmt(0.1 / 12, 1, 24, 2000, 0, 'end')) + assert_equal(np.ipmt(0.1 / 12, 1, 24, 2000, 0, 0), + np.ipmt(0.1 / 12, 1, 24, 2000, 0, 'end')) + + # begin + assert_equal(np.nper(0.075, -2000, 0, 100000., 1), + np.nper(0.075, -2000, 0, 100000., 'begin')) + # end + assert_equal(np.nper(0.075, -2000, 0, 100000.), + np.nper(0.075, -2000, 0, 100000., 'end')) + assert_equal(np.nper(0.075, -2000, 0, 100000., 0), + np.nper(0.075, -2000, 0, 100000., 'end')) + + def test_decimal_with_when(self): + """Test that decimals are still supported if the when argument is passed""" + # begin + assert_equal(np.rate(Decimal('10'), Decimal('20'), Decimal('-3500'), Decimal('10000'), Decimal('1')), + np.rate(Decimal('10'), Decimal('20'), Decimal('-3500'), Decimal('10000'), 'begin')) + # end + assert_equal(np.rate(Decimal('10'), Decimal('20'), Decimal('-3500'), Decimal('10000')), + np.rate(Decimal('10'), Decimal('20'), Decimal('-3500'), Decimal('10000'), 'end')) + assert_equal(np.rate(Decimal('10'), Decimal('20'), Decimal('-3500'), Decimal('10000'), Decimal('0')), + np.rate(Decimal('10'), Decimal('20'), Decimal('-3500'), Decimal('10000'), 'end')) + + # begin + assert_equal(np.pv(Decimal('0.07'), Decimal('20'), Decimal('12000'), Decimal('0'), Decimal('1')), + np.pv(Decimal('0.07'), Decimal('20'), Decimal('12000'), Decimal('0'), 'begin')) + # end + assert_equal(np.pv(Decimal('0.07'), Decimal('20'), Decimal('12000'), Decimal('0')), + np.pv(Decimal('0.07'), Decimal('20'), Decimal('12000'), Decimal('0'), 'end')) + assert_equal(np.pv(Decimal('0.07'), Decimal('20'), Decimal('12000'), Decimal('0'), Decimal('0')), + np.pv(Decimal('0.07'), Decimal('20'), Decimal('12000'), Decimal('0'), 'end')) + + # begin + assert_equal(np.fv(Decimal('0.075'), Decimal('20'), Decimal('-2000'), Decimal('0'), Decimal('1')), + np.fv(Decimal('0.075'), Decimal('20'), Decimal('-2000'), Decimal('0'), 'begin')) + # end + assert_equal(np.fv(Decimal('0.075'), Decimal('20'), Decimal('-2000'), Decimal('0')), + np.fv(Decimal('0.075'), Decimal('20'), Decimal('-2000'), Decimal('0'), 'end')) + assert_equal(np.fv(Decimal('0.075'), Decimal('20'), Decimal('-2000'), Decimal('0'), Decimal('0')), + np.fv(Decimal('0.075'), Decimal('20'), Decimal('-2000'), Decimal('0'), 'end')) + + # begin + assert_equal(np.pmt(Decimal('0.08') / Decimal('12'), Decimal('5') * Decimal('12'), Decimal('15000.'), + Decimal('0'), Decimal('1')), + np.pmt(Decimal('0.08') / Decimal('12'), Decimal('5') * Decimal('12'), Decimal('15000.'), + Decimal('0'), 'begin')) + # end + assert_equal(np.pmt(Decimal('0.08') / Decimal('12'), Decimal('5') * Decimal('12'), Decimal('15000.'), + Decimal('0')), + np.pmt(Decimal('0.08') / Decimal('12'), Decimal('5') * Decimal('12'), Decimal('15000.'), + Decimal('0'), 'end')) + assert_equal(np.pmt(Decimal('0.08') / Decimal('12'), Decimal('5') * Decimal('12'), Decimal('15000.'), + Decimal('0'), Decimal('0')), + np.pmt(Decimal('0.08') / Decimal('12'), Decimal('5') * Decimal('12'), Decimal('15000.'), + Decimal('0'), 'end')) + + # begin + assert_equal(np.ppmt(Decimal('0.1') / Decimal('12'), Decimal('1'), Decimal('60'), Decimal('55000'), + Decimal('0'), Decimal('1')), + np.ppmt(Decimal('0.1') / Decimal('12'), Decimal('1'), Decimal('60'), Decimal('55000'), + Decimal('0'), 'begin')) + # end + assert_equal(np.ppmt(Decimal('0.1') / Decimal('12'), Decimal('1'), Decimal('60'), Decimal('55000'), + Decimal('0')), + np.ppmt(Decimal('0.1') / Decimal('12'), Decimal('1'), Decimal('60'), Decimal('55000'), + Decimal('0'), 'end')) + assert_equal(np.ppmt(Decimal('0.1') / Decimal('12'), Decimal('1'), Decimal('60'), Decimal('55000'), + Decimal('0'), Decimal('0')), + np.ppmt(Decimal('0.1') / Decimal('12'), Decimal('1'), Decimal('60'), Decimal('55000'), + Decimal('0'), 'end')) + + # begin + assert_equal(np.ipmt(Decimal('0.1') / Decimal('12'), Decimal('1'), Decimal('24'), Decimal('2000'), + Decimal('0'), Decimal('1')).flat[0], + np.ipmt(Decimal('0.1') / Decimal('12'), Decimal('1'), Decimal('24'), Decimal('2000'), + Decimal('0'), 'begin').flat[0]) + # end + assert_equal(np.ipmt(Decimal('0.1') / Decimal('12'), Decimal('1'), Decimal('24'), Decimal('2000'), + Decimal('0')).flat[0], + np.ipmt(Decimal('0.1') / Decimal('12'), Decimal('1'), Decimal('24'), Decimal('2000'), + Decimal('0'), 'end').flat[0]) + assert_equal(np.ipmt(Decimal('0.1') / Decimal('12'), Decimal('1'), Decimal('24'), Decimal('2000'), + Decimal('0'), Decimal('0')).flat[0], + np.ipmt(Decimal('0.1') / Decimal('12'), Decimal('1'), Decimal('24'), Decimal('2000'), + Decimal('0'), 'end').flat[0]) + + def test_broadcast(self): + assert_almost_equal(np.nper(0.075, -2000, 0, 100000., [0, 1]), + [21.5449442, 20.76156441], 4) + + assert_almost_equal(np.ipmt(0.1 / 12, list(range(5)), 24, 2000), + [-17.29165168, -16.66666667, -16.03647345, + -15.40102862, -14.76028842], 4) + + assert_almost_equal(np.ppmt(0.1 / 12, list(range(5)), 24, 2000), + [-74.998201, -75.62318601, -76.25337923, + -76.88882405, -77.52956425], 4) + + assert_almost_equal(np.ppmt(0.1 / 12, list(range(5)), 24, 2000, 0, + [0, 0, 1, 'end', 'begin']), + [-74.998201, -75.62318601, -75.62318601, + -76.88882405, -76.88882405], 4) + + def test_broadcast_decimal(self): + # Use almost equal because precision is tested in the explicit tests, this test is to ensure + # broadcast with Decimal is not broken. + assert_almost_equal(np.ipmt(Decimal('0.1') / Decimal('12'), list(range(5)), Decimal('24'), Decimal('2000')), + [Decimal('-17.29165168'), Decimal('-16.66666667'), Decimal('-16.03647345'), + Decimal('-15.40102862'), Decimal('-14.76028842')], 4) + + assert_almost_equal(np.ppmt(Decimal('0.1') / Decimal('12'), list(range(5)), Decimal('24'), Decimal('2000')), + [Decimal('-74.998201'), Decimal('-75.62318601'), Decimal('-76.25337923'), + Decimal('-76.88882405'), Decimal('-77.52956425')], 4) + + assert_almost_equal(np.ppmt(Decimal('0.1') / Decimal('12'), list(range(5)), Decimal('24'), Decimal('2000'), + Decimal('0'), [Decimal('0'), Decimal('0'), Decimal('1'), 'end', 'begin']), + [Decimal('-74.998201'), Decimal('-75.62318601'), Decimal('-75.62318601'), + Decimal('-76.88882405'), Decimal('-76.88882405')], 4) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/linalg/tests/__init__.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/linalg/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/linalg/tests/test_build.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/linalg/tests/test_build.py new file mode 100644 index 0000000000000000000000000000000000000000..921390da33143ae72d14d7f0a319492ea84e051f --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/linalg/tests/test_build.py @@ -0,0 +1,55 @@ +from __future__ import division, absolute_import, print_function + +from subprocess import PIPE, Popen +import sys +import re +import pytest + +from numpy.linalg import lapack_lite +from numpy.testing import assert_ + + +class FindDependenciesLdd(object): + + def __init__(self): + self.cmd = ['ldd'] + + try: + p = Popen(self.cmd, stdout=PIPE, stderr=PIPE) + stdout, stderr = p.communicate() + except OSError: + raise RuntimeError("command %s cannot be run" % self.cmd) + + def get_dependencies(self, lfile): + p = Popen(self.cmd + [lfile], stdout=PIPE, stderr=PIPE) + stdout, stderr = p.communicate() + if not (p.returncode == 0): + raise RuntimeError("failed dependencies check for %s" % lfile) + + return stdout + + def grep_dependencies(self, lfile, deps): + stdout = self.get_dependencies(lfile) + + rdeps = dict([(dep, re.compile(dep)) for dep in deps]) + founds = [] + for l in stdout.splitlines(): + for k, v in rdeps.items(): + if v.search(l): + founds.append(k) + + return founds + + +class TestF77Mismatch(object): + + @pytest.mark.skipif(not(sys.platform[:5] == 'linux'), + reason="no fortran compiler on non-Linux platform") + def test_lapack(self): + f = FindDependenciesLdd() + deps = f.grep_dependencies(lapack_lite.__file__, + [b'libg2c', b'libgfortran']) + assert_(len(deps) <= 1, + """Both g77 and gfortran runtimes linked in lapack_lite ! This is likely to +cause random crashes and wrong results. See numpy INSTALL.txt for more +information.""") diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/linalg/tests/test_deprecations.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/linalg/tests/test_deprecations.py new file mode 100644 index 0000000000000000000000000000000000000000..e12755e0d586cd00c96ec917438befaffb1508b3 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/linalg/tests/test_deprecations.py @@ -0,0 +1,22 @@ +"""Test deprecation and future warnings. + +""" +from __future__ import division, absolute_import, print_function + +import numpy as np +from numpy.testing import assert_warns + + +def test_qr_mode_full_future_warning(): + """Check mode='full' FutureWarning. + + In numpy 1.8 the mode options 'full' and 'economic' in linalg.qr were + deprecated. The release date will probably be sometime in the summer + of 2013. + + """ + a = np.eye(2) + assert_warns(DeprecationWarning, np.linalg.qr, a, mode='full') + assert_warns(DeprecationWarning, np.linalg.qr, a, mode='f') + assert_warns(DeprecationWarning, np.linalg.qr, a, mode='economic') + assert_warns(DeprecationWarning, np.linalg.qr, a, mode='e') diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/linalg/tests/test_linalg.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/linalg/tests/test_linalg.py new file mode 100644 index 0000000000000000000000000000000000000000..235488c6e842a3b08847639221ff4ada4cc3417e --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/linalg/tests/test_linalg.py @@ -0,0 +1,1964 @@ +""" Test functions for linalg module + +""" +from __future__ import division, absolute_import, print_function + +import os +import sys +import itertools +import traceback +import textwrap +import subprocess +import pytest + +import numpy as np +from numpy import array, single, double, csingle, cdouble, dot, identity, matmul +from numpy import multiply, atleast_2d, inf, asarray +from numpy import linalg +from numpy.linalg import matrix_power, norm, matrix_rank, multi_dot, LinAlgError +from numpy.linalg.linalg import _multi_dot_matrix_chain_order +from numpy.testing import ( + assert_, assert_equal, assert_raises, assert_array_equal, + assert_almost_equal, assert_allclose, suppress_warnings, + assert_raises_regex, + ) + + +def consistent_subclass(out, in_): + # For ndarray subclass input, our output should have the same subclass + # (non-ndarray input gets converted to ndarray). + return type(out) is (type(in_) if isinstance(in_, np.ndarray) + else np.ndarray) + + +old_assert_almost_equal = assert_almost_equal + + +def assert_almost_equal(a, b, single_decimal=6, double_decimal=12, **kw): + if asarray(a).dtype.type in (single, csingle): + decimal = single_decimal + else: + decimal = double_decimal + old_assert_almost_equal(a, b, decimal=decimal, **kw) + + +def get_real_dtype(dtype): + return {single: single, double: double, + csingle: single, cdouble: double}[dtype] + + +def get_complex_dtype(dtype): + return {single: csingle, double: cdouble, + csingle: csingle, cdouble: cdouble}[dtype] + + +def get_rtol(dtype): + # Choose a safe rtol + if dtype in (single, csingle): + return 1e-5 + else: + return 1e-11 + + +# used to categorize tests +all_tags = { + 'square', 'nonsquare', 'hermitian', # mutually exclusive + 'generalized', 'size-0', 'strided' # optional additions +} + + +class LinalgCase(object): + def __init__(self, name, a, b, tags=set()): + """ + A bundle of arguments to be passed to a test case, with an identifying + name, the operands a and b, and a set of tags to filter the tests + """ + assert_(isinstance(name, str)) + self.name = name + self.a = a + self.b = b + self.tags = frozenset(tags) # prevent shared tags + + def check(self, do): + """ + Run the function `do` on this test case, expanding arguments + """ + do(self.a, self.b, tags=self.tags) + + def __repr__(self): + return "" % (self.name,) + + +def apply_tag(tag, cases): + """ + Add the given tag (a string) to each of the cases (a list of LinalgCase + objects) + """ + assert tag in all_tags, "Invalid tag" + for case in cases: + case.tags = case.tags | {tag} + return cases + + +# +# Base test cases +# + +np.random.seed(1234) + +CASES = [] + +# square test cases +CASES += apply_tag('square', [ + LinalgCase("single", + array([[1., 2.], [3., 4.]], dtype=single), + array([2., 1.], dtype=single)), + LinalgCase("double", + array([[1., 2.], [3., 4.]], dtype=double), + array([2., 1.], dtype=double)), + LinalgCase("double_2", + array([[1., 2.], [3., 4.]], dtype=double), + array([[2., 1., 4.], [3., 4., 6.]], dtype=double)), + LinalgCase("csingle", + array([[1. + 2j, 2 + 3j], [3 + 4j, 4 + 5j]], dtype=csingle), + array([2. + 1j, 1. + 2j], dtype=csingle)), + LinalgCase("cdouble", + array([[1. + 2j, 2 + 3j], [3 + 4j, 4 + 5j]], dtype=cdouble), + array([2. + 1j, 1. + 2j], dtype=cdouble)), + LinalgCase("cdouble_2", + array([[1. + 2j, 2 + 3j], [3 + 4j, 4 + 5j]], dtype=cdouble), + array([[2. + 1j, 1. + 2j, 1 + 3j], [1 - 2j, 1 - 3j, 1 - 6j]], dtype=cdouble)), + LinalgCase("0x0", + np.empty((0, 0), dtype=double), + np.empty((0,), dtype=double), + tags={'size-0'}), + LinalgCase("8x8", + np.random.rand(8, 8), + np.random.rand(8)), + LinalgCase("1x1", + np.random.rand(1, 1), + np.random.rand(1)), + LinalgCase("nonarray", + [[1, 2], [3, 4]], + [2, 1]), +]) + +# non-square test-cases +CASES += apply_tag('nonsquare', [ + LinalgCase("single_nsq_1", + array([[1., 2., 3.], [3., 4., 6.]], dtype=single), + array([2., 1.], dtype=single)), + LinalgCase("single_nsq_2", + array([[1., 2.], [3., 4.], [5., 6.]], dtype=single), + array([2., 1., 3.], dtype=single)), + LinalgCase("double_nsq_1", + array([[1., 2., 3.], [3., 4., 6.]], dtype=double), + array([2., 1.], dtype=double)), + LinalgCase("double_nsq_2", + array([[1., 2.], [3., 4.], [5., 6.]], dtype=double), + array([2., 1., 3.], dtype=double)), + LinalgCase("csingle_nsq_1", + array( + [[1. + 1j, 2. + 2j, 3. - 3j], [3. - 5j, 4. + 9j, 6. + 2j]], dtype=csingle), + array([2. + 1j, 1. + 2j], dtype=csingle)), + LinalgCase("csingle_nsq_2", + array( + [[1. + 1j, 2. + 2j], [3. - 3j, 4. - 9j], [5. - 4j, 6. + 8j]], dtype=csingle), + array([2. + 1j, 1. + 2j, 3. - 3j], dtype=csingle)), + LinalgCase("cdouble_nsq_1", + array( + [[1. + 1j, 2. + 2j, 3. - 3j], [3. - 5j, 4. + 9j, 6. + 2j]], dtype=cdouble), + array([2. + 1j, 1. + 2j], dtype=cdouble)), + LinalgCase("cdouble_nsq_2", + array( + [[1. + 1j, 2. + 2j], [3. - 3j, 4. - 9j], [5. - 4j, 6. + 8j]], dtype=cdouble), + array([2. + 1j, 1. + 2j, 3. - 3j], dtype=cdouble)), + LinalgCase("cdouble_nsq_1_2", + array( + [[1. + 1j, 2. + 2j, 3. - 3j], [3. - 5j, 4. + 9j, 6. + 2j]], dtype=cdouble), + array([[2. + 1j, 1. + 2j], [1 - 1j, 2 - 2j]], dtype=cdouble)), + LinalgCase("cdouble_nsq_2_2", + array( + [[1. + 1j, 2. + 2j], [3. - 3j, 4. - 9j], [5. - 4j, 6. + 8j]], dtype=cdouble), + array([[2. + 1j, 1. + 2j], [1 - 1j, 2 - 2j], [1 - 1j, 2 - 2j]], dtype=cdouble)), + LinalgCase("8x11", + np.random.rand(8, 11), + np.random.rand(8)), + LinalgCase("1x5", + np.random.rand(1, 5), + np.random.rand(1)), + LinalgCase("5x1", + np.random.rand(5, 1), + np.random.rand(5)), + LinalgCase("0x4", + np.random.rand(0, 4), + np.random.rand(0), + tags={'size-0'}), + LinalgCase("4x0", + np.random.rand(4, 0), + np.random.rand(4), + tags={'size-0'}), +]) + +# hermitian test-cases +CASES += apply_tag('hermitian', [ + LinalgCase("hsingle", + array([[1., 2.], [2., 1.]], dtype=single), + None), + LinalgCase("hdouble", + array([[1., 2.], [2., 1.]], dtype=double), + None), + LinalgCase("hcsingle", + array([[1., 2 + 3j], [2 - 3j, 1]], dtype=csingle), + None), + LinalgCase("hcdouble", + array([[1., 2 + 3j], [2 - 3j, 1]], dtype=cdouble), + None), + LinalgCase("hempty", + np.empty((0, 0), dtype=double), + None, + tags={'size-0'}), + LinalgCase("hnonarray", + [[1, 2], [2, 1]], + None), + LinalgCase("matrix_b_only", + array([[1., 2.], [2., 1.]]), + None), + LinalgCase("hmatrix_1x1", + np.random.rand(1, 1), + None), +]) + + +# +# Gufunc test cases +# +def _make_generalized_cases(): + new_cases = [] + + for case in CASES: + if not isinstance(case.a, np.ndarray): + continue + + a = np.array([case.a, 2 * case.a, 3 * case.a]) + if case.b is None: + b = None + else: + b = np.array([case.b, 7 * case.b, 6 * case.b]) + new_case = LinalgCase(case.name + "_tile3", a, b, + tags=case.tags | {'generalized'}) + new_cases.append(new_case) + + a = np.array([case.a] * 2 * 3).reshape((3, 2) + case.a.shape) + if case.b is None: + b = None + else: + b = np.array([case.b] * 2 * 3).reshape((3, 2) + case.b.shape) + new_case = LinalgCase(case.name + "_tile213", a, b, + tags=case.tags | {'generalized'}) + new_cases.append(new_case) + + return new_cases + + +CASES += _make_generalized_cases() + + +# +# Generate stride combination variations of the above +# +def _stride_comb_iter(x): + """ + Generate cartesian product of strides for all axes + """ + + if not isinstance(x, np.ndarray): + yield x, "nop" + return + + stride_set = [(1,)] * x.ndim + stride_set[-1] = (1, 3, -4) + if x.ndim > 1: + stride_set[-2] = (1, 3, -4) + if x.ndim > 2: + stride_set[-3] = (1, -4) + + for repeats in itertools.product(*tuple(stride_set)): + new_shape = [abs(a * b) for a, b in zip(x.shape, repeats)] + slices = tuple([slice(None, None, repeat) for repeat in repeats]) + + # new array with different strides, but same data + xi = np.empty(new_shape, dtype=x.dtype) + xi.view(np.uint32).fill(0xdeadbeef) + xi = xi[slices] + xi[...] = x + xi = xi.view(x.__class__) + assert_(np.all(xi == x)) + yield xi, "stride_" + "_".join(["%+d" % j for j in repeats]) + + # generate also zero strides if possible + if x.ndim >= 1 and x.shape[-1] == 1: + s = list(x.strides) + s[-1] = 0 + xi = np.lib.stride_tricks.as_strided(x, strides=s) + yield xi, "stride_xxx_0" + if x.ndim >= 2 and x.shape[-2] == 1: + s = list(x.strides) + s[-2] = 0 + xi = np.lib.stride_tricks.as_strided(x, strides=s) + yield xi, "stride_xxx_0_x" + if x.ndim >= 2 and x.shape[:-2] == (1, 1): + s = list(x.strides) + s[-1] = 0 + s[-2] = 0 + xi = np.lib.stride_tricks.as_strided(x, strides=s) + yield xi, "stride_xxx_0_0" + + +def _make_strided_cases(): + new_cases = [] + for case in CASES: + for a, a_label in _stride_comb_iter(case.a): + for b, b_label in _stride_comb_iter(case.b): + new_case = LinalgCase(case.name + "_" + a_label + "_" + b_label, a, b, + tags=case.tags | {'strided'}) + new_cases.append(new_case) + return new_cases + + +CASES += _make_strided_cases() + + +# +# Test different routines against the above cases +# +class LinalgTestCase(object): + TEST_CASES = CASES + + def check_cases(self, require=set(), exclude=set()): + """ + Run func on each of the cases with all of the tags in require, and none + of the tags in exclude + """ + for case in self.TEST_CASES: + # filter by require and exclude + if case.tags & require != require: + continue + if case.tags & exclude: + continue + + try: + case.check(self.do) + except Exception: + msg = "In test case: %r\n\n" % case + msg += traceback.format_exc() + raise AssertionError(msg) + + +class LinalgSquareTestCase(LinalgTestCase): + + def test_sq_cases(self): + self.check_cases(require={'square'}, + exclude={'generalized', 'size-0'}) + + def test_empty_sq_cases(self): + self.check_cases(require={'square', 'size-0'}, + exclude={'generalized'}) + + +class LinalgNonsquareTestCase(LinalgTestCase): + + def test_nonsq_cases(self): + self.check_cases(require={'nonsquare'}, + exclude={'generalized', 'size-0'}) + + def test_empty_nonsq_cases(self): + self.check_cases(require={'nonsquare', 'size-0'}, + exclude={'generalized'}) + + +class HermitianTestCase(LinalgTestCase): + + def test_herm_cases(self): + self.check_cases(require={'hermitian'}, + exclude={'generalized', 'size-0'}) + + def test_empty_herm_cases(self): + self.check_cases(require={'hermitian', 'size-0'}, + exclude={'generalized'}) + + +class LinalgGeneralizedSquareTestCase(LinalgTestCase): + + @pytest.mark.slow + def test_generalized_sq_cases(self): + self.check_cases(require={'generalized', 'square'}, + exclude={'size-0'}) + + @pytest.mark.slow + def test_generalized_empty_sq_cases(self): + self.check_cases(require={'generalized', 'square', 'size-0'}) + + +class LinalgGeneralizedNonsquareTestCase(LinalgTestCase): + + @pytest.mark.slow + def test_generalized_nonsq_cases(self): + self.check_cases(require={'generalized', 'nonsquare'}, + exclude={'size-0'}) + + @pytest.mark.slow + def test_generalized_empty_nonsq_cases(self): + self.check_cases(require={'generalized', 'nonsquare', 'size-0'}) + + +class HermitianGeneralizedTestCase(LinalgTestCase): + + @pytest.mark.slow + def test_generalized_herm_cases(self): + self.check_cases(require={'generalized', 'hermitian'}, + exclude={'size-0'}) + + @pytest.mark.slow + def test_generalized_empty_herm_cases(self): + self.check_cases(require={'generalized', 'hermitian', 'size-0'}, + exclude={'none'}) + + +def dot_generalized(a, b): + a = asarray(a) + if a.ndim >= 3: + if a.ndim == b.ndim: + # matrix x matrix + new_shape = a.shape[:-1] + b.shape[-1:] + elif a.ndim == b.ndim + 1: + # matrix x vector + new_shape = a.shape[:-1] + else: + raise ValueError("Not implemented...") + r = np.empty(new_shape, dtype=np.common_type(a, b)) + for c in itertools.product(*map(range, a.shape[:-2])): + r[c] = dot(a[c], b[c]) + return r + else: + return dot(a, b) + + +def identity_like_generalized(a): + a = asarray(a) + if a.ndim >= 3: + r = np.empty(a.shape, dtype=a.dtype) + r[...] = identity(a.shape[-2]) + return r + else: + return identity(a.shape[0]) + + +class SolveCases(LinalgSquareTestCase, LinalgGeneralizedSquareTestCase): + # kept apart from TestSolve for use for testing with matrices. + def do(self, a, b, tags): + x = linalg.solve(a, b) + assert_almost_equal(b, dot_generalized(a, x)) + assert_(consistent_subclass(x, b)) + + +class TestSolve(SolveCases): + @pytest.mark.parametrize('dtype', [single, double, csingle, cdouble]) + def test_types(self, dtype): + x = np.array([[1, 0.5], [0.5, 1]], dtype=dtype) + assert_equal(linalg.solve(x, x).dtype, dtype) + + def test_0_size(self): + class ArraySubclass(np.ndarray): + pass + # Test system of 0x0 matrices + a = np.arange(8).reshape(2, 2, 2) + b = np.arange(6).reshape(1, 2, 3).view(ArraySubclass) + + expected = linalg.solve(a, b)[:, 0:0, :] + result = linalg.solve(a[:, 0:0, 0:0], b[:, 0:0, :]) + assert_array_equal(result, expected) + assert_(isinstance(result, ArraySubclass)) + + # Test errors for non-square and only b's dimension being 0 + assert_raises(linalg.LinAlgError, linalg.solve, a[:, 0:0, 0:1], b) + assert_raises(ValueError, linalg.solve, a, b[:, 0:0, :]) + + # Test broadcasting error + b = np.arange(6).reshape(1, 3, 2) # broadcasting error + assert_raises(ValueError, linalg.solve, a, b) + assert_raises(ValueError, linalg.solve, a[0:0], b[0:0]) + + # Test zero "single equations" with 0x0 matrices. + b = np.arange(2).reshape(1, 2).view(ArraySubclass) + expected = linalg.solve(a, b)[:, 0:0] + result = linalg.solve(a[:, 0:0, 0:0], b[:, 0:0]) + assert_array_equal(result, expected) + assert_(isinstance(result, ArraySubclass)) + + b = np.arange(3).reshape(1, 3) + assert_raises(ValueError, linalg.solve, a, b) + assert_raises(ValueError, linalg.solve, a[0:0], b[0:0]) + assert_raises(ValueError, linalg.solve, a[:, 0:0, 0:0], b) + + def test_0_size_k(self): + # test zero multiple equation (K=0) case. + class ArraySubclass(np.ndarray): + pass + a = np.arange(4).reshape(1, 2, 2) + b = np.arange(6).reshape(3, 2, 1).view(ArraySubclass) + + expected = linalg.solve(a, b)[:, :, 0:0] + result = linalg.solve(a, b[:, :, 0:0]) + assert_array_equal(result, expected) + assert_(isinstance(result, ArraySubclass)) + + # test both zero. + expected = linalg.solve(a, b)[:, 0:0, 0:0] + result = linalg.solve(a[:, 0:0, 0:0], b[:, 0:0, 0:0]) + assert_array_equal(result, expected) + assert_(isinstance(result, ArraySubclass)) + + +class InvCases(LinalgSquareTestCase, LinalgGeneralizedSquareTestCase): + + def do(self, a, b, tags): + a_inv = linalg.inv(a) + assert_almost_equal(dot_generalized(a, a_inv), + identity_like_generalized(a)) + assert_(consistent_subclass(a_inv, a)) + + +class TestInv(InvCases): + @pytest.mark.parametrize('dtype', [single, double, csingle, cdouble]) + def test_types(self, dtype): + x = np.array([[1, 0.5], [0.5, 1]], dtype=dtype) + assert_equal(linalg.inv(x).dtype, dtype) + + def test_0_size(self): + # Check that all kinds of 0-sized arrays work + class ArraySubclass(np.ndarray): + pass + a = np.zeros((0, 1, 1), dtype=np.int_).view(ArraySubclass) + res = linalg.inv(a) + assert_(res.dtype.type is np.float64) + assert_equal(a.shape, res.shape) + assert_(isinstance(res, ArraySubclass)) + + a = np.zeros((0, 0), dtype=np.complex64).view(ArraySubclass) + res = linalg.inv(a) + assert_(res.dtype.type is np.complex64) + assert_equal(a.shape, res.shape) + assert_(isinstance(res, ArraySubclass)) + + +class EigvalsCases(LinalgSquareTestCase, LinalgGeneralizedSquareTestCase): + + def do(self, a, b, tags): + ev = linalg.eigvals(a) + evalues, evectors = linalg.eig(a) + assert_almost_equal(ev, evalues) + + +class TestEigvals(EigvalsCases): + @pytest.mark.parametrize('dtype', [single, double, csingle, cdouble]) + def test_types(self, dtype): + x = np.array([[1, 0.5], [0.5, 1]], dtype=dtype) + assert_equal(linalg.eigvals(x).dtype, dtype) + x = np.array([[1, 0.5], [-1, 1]], dtype=dtype) + assert_equal(linalg.eigvals(x).dtype, get_complex_dtype(dtype)) + + def test_0_size(self): + # Check that all kinds of 0-sized arrays work + class ArraySubclass(np.ndarray): + pass + a = np.zeros((0, 1, 1), dtype=np.int_).view(ArraySubclass) + res = linalg.eigvals(a) + assert_(res.dtype.type is np.float64) + assert_equal((0, 1), res.shape) + # This is just for documentation, it might make sense to change: + assert_(isinstance(res, np.ndarray)) + + a = np.zeros((0, 0), dtype=np.complex64).view(ArraySubclass) + res = linalg.eigvals(a) + assert_(res.dtype.type is np.complex64) + assert_equal((0,), res.shape) + # This is just for documentation, it might make sense to change: + assert_(isinstance(res, np.ndarray)) + + +class EigCases(LinalgSquareTestCase, LinalgGeneralizedSquareTestCase): + + def do(self, a, b, tags): + evalues, evectors = linalg.eig(a) + assert_allclose(dot_generalized(a, evectors), + np.asarray(evectors) * np.asarray(evalues)[..., None, :], + rtol=get_rtol(evalues.dtype)) + assert_(consistent_subclass(evectors, a)) + + +class TestEig(EigCases): + @pytest.mark.parametrize('dtype', [single, double, csingle, cdouble]) + def test_types(self, dtype): + x = np.array([[1, 0.5], [0.5, 1]], dtype=dtype) + w, v = np.linalg.eig(x) + assert_equal(w.dtype, dtype) + assert_equal(v.dtype, dtype) + + x = np.array([[1, 0.5], [-1, 1]], dtype=dtype) + w, v = np.linalg.eig(x) + assert_equal(w.dtype, get_complex_dtype(dtype)) + assert_equal(v.dtype, get_complex_dtype(dtype)) + + def test_0_size(self): + # Check that all kinds of 0-sized arrays work + class ArraySubclass(np.ndarray): + pass + a = np.zeros((0, 1, 1), dtype=np.int_).view(ArraySubclass) + res, res_v = linalg.eig(a) + assert_(res_v.dtype.type is np.float64) + assert_(res.dtype.type is np.float64) + assert_equal(a.shape, res_v.shape) + assert_equal((0, 1), res.shape) + # This is just for documentation, it might make sense to change: + assert_(isinstance(a, np.ndarray)) + + a = np.zeros((0, 0), dtype=np.complex64).view(ArraySubclass) + res, res_v = linalg.eig(a) + assert_(res_v.dtype.type is np.complex64) + assert_(res.dtype.type is np.complex64) + assert_equal(a.shape, res_v.shape) + assert_equal((0,), res.shape) + # This is just for documentation, it might make sense to change: + assert_(isinstance(a, np.ndarray)) + + +class SVDCases(LinalgSquareTestCase, LinalgGeneralizedSquareTestCase): + + def do(self, a, b, tags): + u, s, vt = linalg.svd(a, 0) + assert_allclose(a, dot_generalized(np.asarray(u) * np.asarray(s)[..., None, :], + np.asarray(vt)), + rtol=get_rtol(u.dtype)) + assert_(consistent_subclass(u, a)) + assert_(consistent_subclass(vt, a)) + + +class TestSVD(SVDCases): + @pytest.mark.parametrize('dtype', [single, double, csingle, cdouble]) + def test_types(self, dtype): + x = np.array([[1, 0.5], [0.5, 1]], dtype=dtype) + u, s, vh = linalg.svd(x) + assert_equal(u.dtype, dtype) + assert_equal(s.dtype, get_real_dtype(dtype)) + assert_equal(vh.dtype, dtype) + s = linalg.svd(x, compute_uv=False) + assert_equal(s.dtype, get_real_dtype(dtype)) + + def test_empty_identity(self): + """ Empty input should put an identity matrix in u or vh """ + x = np.empty((4, 0)) + u, s, vh = linalg.svd(x, compute_uv=True) + assert_equal(u.shape, (4, 4)) + assert_equal(vh.shape, (0, 0)) + assert_equal(u, np.eye(4)) + + x = np.empty((0, 4)) + u, s, vh = linalg.svd(x, compute_uv=True) + assert_equal(u.shape, (0, 0)) + assert_equal(vh.shape, (4, 4)) + assert_equal(vh, np.eye(4)) + + +class CondCases(LinalgSquareTestCase, LinalgGeneralizedSquareTestCase): + # cond(x, p) for p in (None, 2, -2) + + def do(self, a, b, tags): + c = asarray(a) # a might be a matrix + if 'size-0' in tags: + assert_raises(LinAlgError, linalg.cond, c) + return + + # +-2 norms + s = linalg.svd(c, compute_uv=False) + assert_almost_equal( + linalg.cond(a), s[..., 0] / s[..., -1], + single_decimal=5, double_decimal=11) + assert_almost_equal( + linalg.cond(a, 2), s[..., 0] / s[..., -1], + single_decimal=5, double_decimal=11) + assert_almost_equal( + linalg.cond(a, -2), s[..., -1] / s[..., 0], + single_decimal=5, double_decimal=11) + + # Other norms + cinv = np.linalg.inv(c) + assert_almost_equal( + linalg.cond(a, 1), + abs(c).sum(-2).max(-1) * abs(cinv).sum(-2).max(-1), + single_decimal=5, double_decimal=11) + assert_almost_equal( + linalg.cond(a, -1), + abs(c).sum(-2).min(-1) * abs(cinv).sum(-2).min(-1), + single_decimal=5, double_decimal=11) + assert_almost_equal( + linalg.cond(a, np.inf), + abs(c).sum(-1).max(-1) * abs(cinv).sum(-1).max(-1), + single_decimal=5, double_decimal=11) + assert_almost_equal( + linalg.cond(a, -np.inf), + abs(c).sum(-1).min(-1) * abs(cinv).sum(-1).min(-1), + single_decimal=5, double_decimal=11) + assert_almost_equal( + linalg.cond(a, 'fro'), + np.sqrt((abs(c)**2).sum(-1).sum(-1) + * (abs(cinv)**2).sum(-1).sum(-1)), + single_decimal=5, double_decimal=11) + + +class TestCond(CondCases): + def test_basic_nonsvd(self): + # Smoketest the non-svd norms + A = array([[1., 0, 1], [0, -2., 0], [0, 0, 3.]]) + assert_almost_equal(linalg.cond(A, inf), 4) + assert_almost_equal(linalg.cond(A, -inf), 2/3) + assert_almost_equal(linalg.cond(A, 1), 4) + assert_almost_equal(linalg.cond(A, -1), 0.5) + assert_almost_equal(linalg.cond(A, 'fro'), np.sqrt(265 / 12)) + + def test_singular(self): + # Singular matrices have infinite condition number for + # positive norms, and negative norms shouldn't raise + # exceptions + As = [np.zeros((2, 2)), np.ones((2, 2))] + p_pos = [None, 1, 2, 'fro'] + p_neg = [-1, -2] + for A, p in itertools.product(As, p_pos): + # Inversion may not hit exact infinity, so just check the + # number is large + assert_(linalg.cond(A, p) > 1e15) + for A, p in itertools.product(As, p_neg): + linalg.cond(A, p) + + def test_nan(self): + # nans should be passed through, not converted to infs + ps = [None, 1, -1, 2, -2, 'fro'] + p_pos = [None, 1, 2, 'fro'] + + A = np.ones((2, 2)) + A[0,1] = np.nan + for p in ps: + c = linalg.cond(A, p) + assert_(isinstance(c, np.float_)) + assert_(np.isnan(c)) + + A = np.ones((3, 2, 2)) + A[1,0,1] = np.nan + for p in ps: + c = linalg.cond(A, p) + assert_(np.isnan(c[1])) + if p in p_pos: + assert_(c[0] > 1e15) + assert_(c[2] > 1e15) + else: + assert_(not np.isnan(c[0])) + assert_(not np.isnan(c[2])) + + def test_stacked_singular(self): + # Check behavior when only some of the stacked matrices are + # singular + np.random.seed(1234) + A = np.random.rand(2, 2, 2, 2) + A[0,0] = 0 + A[1,1] = 0 + + for p in (None, 1, 2, 'fro', -1, -2): + c = linalg.cond(A, p) + assert_equal(c[0,0], np.inf) + assert_equal(c[1,1], np.inf) + assert_(np.isfinite(c[0,1])) + assert_(np.isfinite(c[1,0])) + + +class PinvCases(LinalgSquareTestCase, + LinalgNonsquareTestCase, + LinalgGeneralizedSquareTestCase, + LinalgGeneralizedNonsquareTestCase): + + def do(self, a, b, tags): + a_ginv = linalg.pinv(a) + # `a @ a_ginv == I` does not hold if a is singular + dot = dot_generalized + assert_almost_equal(dot(dot(a, a_ginv), a), a, single_decimal=5, double_decimal=11) + assert_(consistent_subclass(a_ginv, a)) + + +class TestPinv(PinvCases): + pass + + +class DetCases(LinalgSquareTestCase, LinalgGeneralizedSquareTestCase): + + def do(self, a, b, tags): + d = linalg.det(a) + (s, ld) = linalg.slogdet(a) + if asarray(a).dtype.type in (single, double): + ad = asarray(a).astype(double) + else: + ad = asarray(a).astype(cdouble) + ev = linalg.eigvals(ad) + assert_almost_equal(d, multiply.reduce(ev, axis=-1)) + assert_almost_equal(s * np.exp(ld), multiply.reduce(ev, axis=-1)) + + s = np.atleast_1d(s) + ld = np.atleast_1d(ld) + m = (s != 0) + assert_almost_equal(np.abs(s[m]), 1) + assert_equal(ld[~m], -inf) + + +class TestDet(DetCases): + def test_zero(self): + assert_equal(linalg.det([[0.0]]), 0.0) + assert_equal(type(linalg.det([[0.0]])), double) + assert_equal(linalg.det([[0.0j]]), 0.0) + assert_equal(type(linalg.det([[0.0j]])), cdouble) + + assert_equal(linalg.slogdet([[0.0]]), (0.0, -inf)) + assert_equal(type(linalg.slogdet([[0.0]])[0]), double) + assert_equal(type(linalg.slogdet([[0.0]])[1]), double) + assert_equal(linalg.slogdet([[0.0j]]), (0.0j, -inf)) + assert_equal(type(linalg.slogdet([[0.0j]])[0]), cdouble) + assert_equal(type(linalg.slogdet([[0.0j]])[1]), double) + + @pytest.mark.parametrize('dtype', [single, double, csingle, cdouble]) + def test_types(self, dtype): + x = np.array([[1, 0.5], [0.5, 1]], dtype=dtype) + assert_equal(np.linalg.det(x).dtype, dtype) + ph, s = np.linalg.slogdet(x) + assert_equal(s.dtype, get_real_dtype(dtype)) + assert_equal(ph.dtype, dtype) + + def test_0_size(self): + a = np.zeros((0, 0), dtype=np.complex64) + res = linalg.det(a) + assert_equal(res, 1.) + assert_(res.dtype.type is np.complex64) + res = linalg.slogdet(a) + assert_equal(res, (1, 0)) + assert_(res[0].dtype.type is np.complex64) + assert_(res[1].dtype.type is np.float32) + + a = np.zeros((0, 0), dtype=np.float64) + res = linalg.det(a) + assert_equal(res, 1.) + assert_(res.dtype.type is np.float64) + res = linalg.slogdet(a) + assert_equal(res, (1, 0)) + assert_(res[0].dtype.type is np.float64) + assert_(res[1].dtype.type is np.float64) + + +class LstsqCases(LinalgSquareTestCase, LinalgNonsquareTestCase): + + def do(self, a, b, tags): + arr = np.asarray(a) + m, n = arr.shape + u, s, vt = linalg.svd(a, 0) + x, residuals, rank, sv = linalg.lstsq(a, b, rcond=-1) + if m == 0: + assert_((x == 0).all()) + if m <= n: + assert_almost_equal(b, dot(a, x)) + assert_equal(rank, m) + else: + assert_equal(rank, n) + assert_almost_equal(sv, sv.__array_wrap__(s)) + if rank == n and m > n: + expect_resids = ( + np.asarray(abs(np.dot(a, x) - b)) ** 2).sum(axis=0) + expect_resids = np.asarray(expect_resids) + if np.asarray(b).ndim == 1: + expect_resids.shape = (1,) + assert_equal(residuals.shape, expect_resids.shape) + else: + expect_resids = np.array([]).view(type(x)) + assert_almost_equal(residuals, expect_resids) + assert_(np.issubdtype(residuals.dtype, np.floating)) + assert_(consistent_subclass(x, b)) + assert_(consistent_subclass(residuals, b)) + + +class TestLstsq(LstsqCases): + def test_future_rcond(self): + a = np.array([[0., 1., 0., 1., 2., 0.], + [0., 2., 0., 0., 1., 0.], + [1., 0., 1., 0., 0., 4.], + [0., 0., 0., 2., 3., 0.]]).T + + b = np.array([1, 0, 0, 0, 0, 0]) + with suppress_warnings() as sup: + w = sup.record(FutureWarning, "`rcond` parameter will change") + x, residuals, rank, s = linalg.lstsq(a, b) + assert_(rank == 4) + x, residuals, rank, s = linalg.lstsq(a, b, rcond=-1) + assert_(rank == 4) + x, residuals, rank, s = linalg.lstsq(a, b, rcond=None) + assert_(rank == 3) + # Warning should be raised exactly once (first command) + assert_(len(w) == 1) + + @pytest.mark.parametrize(["m", "n", "n_rhs"], [ + (4, 2, 2), + (0, 4, 1), + (0, 4, 2), + (4, 0, 1), + (4, 0, 2), + (4, 2, 0), + (0, 0, 0) + ]) + def test_empty_a_b(self, m, n, n_rhs): + a = np.arange(m * n).reshape(m, n) + b = np.ones((m, n_rhs)) + x, residuals, rank, s = linalg.lstsq(a, b, rcond=None) + if m == 0: + assert_((x == 0).all()) + assert_equal(x.shape, (n, n_rhs)) + assert_equal(residuals.shape, ((n_rhs,) if m > n else (0,))) + if m > n and n_rhs > 0: + # residuals are exactly the squared norms of b's columns + r = b - np.dot(a, x) + assert_almost_equal(residuals, (r * r).sum(axis=-2)) + assert_equal(rank, min(m, n)) + assert_equal(s.shape, (min(m, n),)) + + def test_incompatible_dims(self): + # use modified version of docstring example + x = np.array([0, 1, 2, 3]) + y = np.array([-1, 0.2, 0.9, 2.1, 3.3]) + A = np.vstack([x, np.ones(len(x))]).T + with assert_raises_regex(LinAlgError, "Incompatible dimensions"): + linalg.lstsq(A, y, rcond=None) + + +@pytest.mark.parametrize('dt', [np.dtype(c) for c in '?bBhHiIqQefdgFDGO']) +class TestMatrixPower(object): + + rshft_0 = np.eye(4) + rshft_1 = rshft_0[[3, 0, 1, 2]] + rshft_2 = rshft_0[[2, 3, 0, 1]] + rshft_3 = rshft_0[[1, 2, 3, 0]] + rshft_all = [rshft_0, rshft_1, rshft_2, rshft_3] + noninv = array([[1, 0], [0, 0]]) + stacked = np.block([[[rshft_0]]]*2) + #FIXME the 'e' dtype might work in future + dtnoinv = [object, np.dtype('e'), np.dtype('g'), np.dtype('G')] + + def test_large_power(self, dt): + rshft = self.rshft_1.astype(dt) + assert_equal( + matrix_power(rshft, 2**100 + 2**10 + 2**5 + 0), self.rshft_0) + assert_equal( + matrix_power(rshft, 2**100 + 2**10 + 2**5 + 1), self.rshft_1) + assert_equal( + matrix_power(rshft, 2**100 + 2**10 + 2**5 + 2), self.rshft_2) + assert_equal( + matrix_power(rshft, 2**100 + 2**10 + 2**5 + 3), self.rshft_3) + + def test_power_is_zero(self, dt): + def tz(M): + mz = matrix_power(M, 0) + assert_equal(mz, identity_like_generalized(M)) + assert_equal(mz.dtype, M.dtype) + + for mat in self.rshft_all: + tz(mat.astype(dt)) + if dt != object: + tz(self.stacked.astype(dt)) + + def test_power_is_one(self, dt): + def tz(mat): + mz = matrix_power(mat, 1) + assert_equal(mz, mat) + assert_equal(mz.dtype, mat.dtype) + + for mat in self.rshft_all: + tz(mat.astype(dt)) + if dt != object: + tz(self.stacked.astype(dt)) + + def test_power_is_two(self, dt): + def tz(mat): + mz = matrix_power(mat, 2) + mmul = matmul if mat.dtype != object else dot + assert_equal(mz, mmul(mat, mat)) + assert_equal(mz.dtype, mat.dtype) + + for mat in self.rshft_all: + tz(mat.astype(dt)) + if dt != object: + tz(self.stacked.astype(dt)) + + def test_power_is_minus_one(self, dt): + def tz(mat): + invmat = matrix_power(mat, -1) + mmul = matmul if mat.dtype != object else dot + assert_almost_equal( + mmul(invmat, mat), identity_like_generalized(mat)) + + for mat in self.rshft_all: + if dt not in self.dtnoinv: + tz(mat.astype(dt)) + + def test_exceptions_bad_power(self, dt): + mat = self.rshft_0.astype(dt) + assert_raises(TypeError, matrix_power, mat, 1.5) + assert_raises(TypeError, matrix_power, mat, [1]) + + def test_exceptions_non_square(self, dt): + assert_raises(LinAlgError, matrix_power, np.array([1], dt), 1) + assert_raises(LinAlgError, matrix_power, np.array([[1], [2]], dt), 1) + assert_raises(LinAlgError, matrix_power, np.ones((4, 3, 2), dt), 1) + + def test_exceptions_not_invertible(self, dt): + if dt in self.dtnoinv: + return + mat = self.noninv.astype(dt) + assert_raises(LinAlgError, matrix_power, mat, -1) + + + +class TestEigvalshCases(HermitianTestCase, HermitianGeneralizedTestCase): + + def do(self, a, b, tags): + # note that eigenvalue arrays returned by eig must be sorted since + # their order isn't guaranteed. + ev = linalg.eigvalsh(a, 'L') + evalues, evectors = linalg.eig(a) + evalues.sort(axis=-1) + assert_allclose(ev, evalues, rtol=get_rtol(ev.dtype)) + + ev2 = linalg.eigvalsh(a, 'U') + assert_allclose(ev2, evalues, rtol=get_rtol(ev.dtype)) + + +class TestEigvalsh(object): + @pytest.mark.parametrize('dtype', [single, double, csingle, cdouble]) + def test_types(self, dtype): + x = np.array([[1, 0.5], [0.5, 1]], dtype=dtype) + w = np.linalg.eigvalsh(x) + assert_equal(w.dtype, get_real_dtype(dtype)) + + def test_invalid(self): + x = np.array([[1, 0.5], [0.5, 1]], dtype=np.float32) + assert_raises(ValueError, np.linalg.eigvalsh, x, UPLO="lrong") + assert_raises(ValueError, np.linalg.eigvalsh, x, "lower") + assert_raises(ValueError, np.linalg.eigvalsh, x, "upper") + + def test_UPLO(self): + Klo = np.array([[0, 0], [1, 0]], dtype=np.double) + Kup = np.array([[0, 1], [0, 0]], dtype=np.double) + tgt = np.array([-1, 1], dtype=np.double) + rtol = get_rtol(np.double) + + # Check default is 'L' + w = np.linalg.eigvalsh(Klo) + assert_allclose(w, tgt, rtol=rtol) + # Check 'L' + w = np.linalg.eigvalsh(Klo, UPLO='L') + assert_allclose(w, tgt, rtol=rtol) + # Check 'l' + w = np.linalg.eigvalsh(Klo, UPLO='l') + assert_allclose(w, tgt, rtol=rtol) + # Check 'U' + w = np.linalg.eigvalsh(Kup, UPLO='U') + assert_allclose(w, tgt, rtol=rtol) + # Check 'u' + w = np.linalg.eigvalsh(Kup, UPLO='u') + assert_allclose(w, tgt, rtol=rtol) + + def test_0_size(self): + # Check that all kinds of 0-sized arrays work + class ArraySubclass(np.ndarray): + pass + a = np.zeros((0, 1, 1), dtype=np.int_).view(ArraySubclass) + res = linalg.eigvalsh(a) + assert_(res.dtype.type is np.float64) + assert_equal((0, 1), res.shape) + # This is just for documentation, it might make sense to change: + assert_(isinstance(res, np.ndarray)) + + a = np.zeros((0, 0), dtype=np.complex64).view(ArraySubclass) + res = linalg.eigvalsh(a) + assert_(res.dtype.type is np.float32) + assert_equal((0,), res.shape) + # This is just for documentation, it might make sense to change: + assert_(isinstance(res, np.ndarray)) + + +class TestEighCases(HermitianTestCase, HermitianGeneralizedTestCase): + + def do(self, a, b, tags): + # note that eigenvalue arrays returned by eig must be sorted since + # their order isn't guaranteed. + ev, evc = linalg.eigh(a) + evalues, evectors = linalg.eig(a) + evalues.sort(axis=-1) + assert_almost_equal(ev, evalues) + + assert_allclose(dot_generalized(a, evc), + np.asarray(ev)[..., None, :] * np.asarray(evc), + rtol=get_rtol(ev.dtype)) + + ev2, evc2 = linalg.eigh(a, 'U') + assert_almost_equal(ev2, evalues) + + assert_allclose(dot_generalized(a, evc2), + np.asarray(ev2)[..., None, :] * np.asarray(evc2), + rtol=get_rtol(ev.dtype), err_msg=repr(a)) + + +class TestEigh(object): + @pytest.mark.parametrize('dtype', [single, double, csingle, cdouble]) + def test_types(self, dtype): + x = np.array([[1, 0.5], [0.5, 1]], dtype=dtype) + w, v = np.linalg.eigh(x) + assert_equal(w.dtype, get_real_dtype(dtype)) + assert_equal(v.dtype, dtype) + + def test_invalid(self): + x = np.array([[1, 0.5], [0.5, 1]], dtype=np.float32) + assert_raises(ValueError, np.linalg.eigh, x, UPLO="lrong") + assert_raises(ValueError, np.linalg.eigh, x, "lower") + assert_raises(ValueError, np.linalg.eigh, x, "upper") + + def test_UPLO(self): + Klo = np.array([[0, 0], [1, 0]], dtype=np.double) + Kup = np.array([[0, 1], [0, 0]], dtype=np.double) + tgt = np.array([-1, 1], dtype=np.double) + rtol = get_rtol(np.double) + + # Check default is 'L' + w, v = np.linalg.eigh(Klo) + assert_allclose(w, tgt, rtol=rtol) + # Check 'L' + w, v = np.linalg.eigh(Klo, UPLO='L') + assert_allclose(w, tgt, rtol=rtol) + # Check 'l' + w, v = np.linalg.eigh(Klo, UPLO='l') + assert_allclose(w, tgt, rtol=rtol) + # Check 'U' + w, v = np.linalg.eigh(Kup, UPLO='U') + assert_allclose(w, tgt, rtol=rtol) + # Check 'u' + w, v = np.linalg.eigh(Kup, UPLO='u') + assert_allclose(w, tgt, rtol=rtol) + + def test_0_size(self): + # Check that all kinds of 0-sized arrays work + class ArraySubclass(np.ndarray): + pass + a = np.zeros((0, 1, 1), dtype=np.int_).view(ArraySubclass) + res, res_v = linalg.eigh(a) + assert_(res_v.dtype.type is np.float64) + assert_(res.dtype.type is np.float64) + assert_equal(a.shape, res_v.shape) + assert_equal((0, 1), res.shape) + # This is just for documentation, it might make sense to change: + assert_(isinstance(a, np.ndarray)) + + a = np.zeros((0, 0), dtype=np.complex64).view(ArraySubclass) + res, res_v = linalg.eigh(a) + assert_(res_v.dtype.type is np.complex64) + assert_(res.dtype.type is np.float32) + assert_equal(a.shape, res_v.shape) + assert_equal((0,), res.shape) + # This is just for documentation, it might make sense to change: + assert_(isinstance(a, np.ndarray)) + + +class _TestNormBase(object): + dt = None + dec = None + + +class _TestNormGeneral(_TestNormBase): + + def test_empty(self): + assert_equal(norm([]), 0.0) + assert_equal(norm(array([], dtype=self.dt)), 0.0) + assert_equal(norm(atleast_2d(array([], dtype=self.dt))), 0.0) + + def test_vector_return_type(self): + a = np.array([1, 0, 1]) + + exact_types = np.typecodes['AllInteger'] + inexact_types = np.typecodes['AllFloat'] + + all_types = exact_types + inexact_types + + for each_inexact_types in all_types: + at = a.astype(each_inexact_types) + + an = norm(at, -np.inf) + assert_(issubclass(an.dtype.type, np.floating)) + assert_almost_equal(an, 0.0) + + with suppress_warnings() as sup: + sup.filter(RuntimeWarning, "divide by zero encountered") + an = norm(at, -1) + assert_(issubclass(an.dtype.type, np.floating)) + assert_almost_equal(an, 0.0) + + an = norm(at, 0) + assert_(issubclass(an.dtype.type, np.floating)) + assert_almost_equal(an, 2) + + an = norm(at, 1) + assert_(issubclass(an.dtype.type, np.floating)) + assert_almost_equal(an, 2.0) + + an = norm(at, 2) + assert_(issubclass(an.dtype.type, np.floating)) + assert_almost_equal(an, an.dtype.type(2.0)**an.dtype.type(1.0/2.0)) + + an = norm(at, 4) + assert_(issubclass(an.dtype.type, np.floating)) + assert_almost_equal(an, an.dtype.type(2.0)**an.dtype.type(1.0/4.0)) + + an = norm(at, np.inf) + assert_(issubclass(an.dtype.type, np.floating)) + assert_almost_equal(an, 1.0) + + def test_vector(self): + a = [1, 2, 3, 4] + b = [-1, -2, -3, -4] + c = [-1, 2, -3, 4] + + def _test(v): + np.testing.assert_almost_equal(norm(v), 30 ** 0.5, + decimal=self.dec) + np.testing.assert_almost_equal(norm(v, inf), 4.0, + decimal=self.dec) + np.testing.assert_almost_equal(norm(v, -inf), 1.0, + decimal=self.dec) + np.testing.assert_almost_equal(norm(v, 1), 10.0, + decimal=self.dec) + np.testing.assert_almost_equal(norm(v, -1), 12.0 / 25, + decimal=self.dec) + np.testing.assert_almost_equal(norm(v, 2), 30 ** 0.5, + decimal=self.dec) + np.testing.assert_almost_equal(norm(v, -2), ((205. / 144) ** -0.5), + decimal=self.dec) + np.testing.assert_almost_equal(norm(v, 0), 4, + decimal=self.dec) + + for v in (a, b, c,): + _test(v) + + for v in (array(a, dtype=self.dt), array(b, dtype=self.dt), + array(c, dtype=self.dt)): + _test(v) + + def test_axis(self): + # Vector norms. + # Compare the use of `axis` with computing the norm of each row + # or column separately. + A = array([[1, 2, 3], [4, 5, 6]], dtype=self.dt) + for order in [None, -1, 0, 1, 2, 3, np.Inf, -np.Inf]: + expected0 = [norm(A[:, k], ord=order) for k in range(A.shape[1])] + assert_almost_equal(norm(A, ord=order, axis=0), expected0) + expected1 = [norm(A[k, :], ord=order) for k in range(A.shape[0])] + assert_almost_equal(norm(A, ord=order, axis=1), expected1) + + # Matrix norms. + B = np.arange(1, 25, dtype=self.dt).reshape(2, 3, 4) + nd = B.ndim + for order in [None, -2, 2, -1, 1, np.Inf, -np.Inf, 'fro']: + for axis in itertools.combinations(range(-nd, nd), 2): + row_axis, col_axis = axis + if row_axis < 0: + row_axis += nd + if col_axis < 0: + col_axis += nd + if row_axis == col_axis: + assert_raises(ValueError, norm, B, ord=order, axis=axis) + else: + n = norm(B, ord=order, axis=axis) + + # The logic using k_index only works for nd = 3. + # This has to be changed if nd is increased. + k_index = nd - (row_axis + col_axis) + if row_axis < col_axis: + expected = [norm(B[:].take(k, axis=k_index), ord=order) + for k in range(B.shape[k_index])] + else: + expected = [norm(B[:].take(k, axis=k_index).T, ord=order) + for k in range(B.shape[k_index])] + assert_almost_equal(n, expected) + + def test_keepdims(self): + A = np.arange(1, 25, dtype=self.dt).reshape(2, 3, 4) + + allclose_err = 'order {0}, axis = {1}' + shape_err = 'Shape mismatch found {0}, expected {1}, order={2}, axis={3}' + + # check the order=None, axis=None case + expected = norm(A, ord=None, axis=None) + found = norm(A, ord=None, axis=None, keepdims=True) + assert_allclose(np.squeeze(found), expected, + err_msg=allclose_err.format(None, None)) + expected_shape = (1, 1, 1) + assert_(found.shape == expected_shape, + shape_err.format(found.shape, expected_shape, None, None)) + + # Vector norms. + for order in [None, -1, 0, 1, 2, 3, np.Inf, -np.Inf]: + for k in range(A.ndim): + expected = norm(A, ord=order, axis=k) + found = norm(A, ord=order, axis=k, keepdims=True) + assert_allclose(np.squeeze(found), expected, + err_msg=allclose_err.format(order, k)) + expected_shape = list(A.shape) + expected_shape[k] = 1 + expected_shape = tuple(expected_shape) + assert_(found.shape == expected_shape, + shape_err.format(found.shape, expected_shape, order, k)) + + # Matrix norms. + for order in [None, -2, 2, -1, 1, np.Inf, -np.Inf, 'fro', 'nuc']: + for k in itertools.permutations(range(A.ndim), 2): + expected = norm(A, ord=order, axis=k) + found = norm(A, ord=order, axis=k, keepdims=True) + assert_allclose(np.squeeze(found), expected, + err_msg=allclose_err.format(order, k)) + expected_shape = list(A.shape) + expected_shape[k[0]] = 1 + expected_shape[k[1]] = 1 + expected_shape = tuple(expected_shape) + assert_(found.shape == expected_shape, + shape_err.format(found.shape, expected_shape, order, k)) + + +class _TestNorm2D(_TestNormBase): + # Define the part for 2d arrays separately, so we can subclass this + # and run the tests using np.matrix in matrixlib.tests.test_matrix_linalg. + array = np.array + + def test_matrix_empty(self): + assert_equal(norm(self.array([[]], dtype=self.dt)), 0.0) + + def test_matrix_return_type(self): + a = self.array([[1, 0, 1], [0, 1, 1]]) + + exact_types = np.typecodes['AllInteger'] + + # float32, complex64, float64, complex128 types are the only types + # allowed by `linalg`, which performs the matrix operations used + # within `norm`. + inexact_types = 'fdFD' + + all_types = exact_types + inexact_types + + for each_inexact_types in all_types: + at = a.astype(each_inexact_types) + + an = norm(at, -np.inf) + assert_(issubclass(an.dtype.type, np.floating)) + assert_almost_equal(an, 2.0) + + with suppress_warnings() as sup: + sup.filter(RuntimeWarning, "divide by zero encountered") + an = norm(at, -1) + assert_(issubclass(an.dtype.type, np.floating)) + assert_almost_equal(an, 1.0) + + an = norm(at, 1) + assert_(issubclass(an.dtype.type, np.floating)) + assert_almost_equal(an, 2.0) + + an = norm(at, 2) + assert_(issubclass(an.dtype.type, np.floating)) + assert_almost_equal(an, 3.0**(1.0/2.0)) + + an = norm(at, -2) + assert_(issubclass(an.dtype.type, np.floating)) + assert_almost_equal(an, 1.0) + + an = norm(at, np.inf) + assert_(issubclass(an.dtype.type, np.floating)) + assert_almost_equal(an, 2.0) + + an = norm(at, 'fro') + assert_(issubclass(an.dtype.type, np.floating)) + assert_almost_equal(an, 2.0) + + an = norm(at, 'nuc') + assert_(issubclass(an.dtype.type, np.floating)) + # Lower bar needed to support low precision floats. + # They end up being off by 1 in the 7th place. + np.testing.assert_almost_equal(an, 2.7320508075688772, decimal=6) + + def test_matrix_2x2(self): + A = self.array([[1, 3], [5, 7]], dtype=self.dt) + assert_almost_equal(norm(A), 84 ** 0.5) + assert_almost_equal(norm(A, 'fro'), 84 ** 0.5) + assert_almost_equal(norm(A, 'nuc'), 10.0) + assert_almost_equal(norm(A, inf), 12.0) + assert_almost_equal(norm(A, -inf), 4.0) + assert_almost_equal(norm(A, 1), 10.0) + assert_almost_equal(norm(A, -1), 6.0) + assert_almost_equal(norm(A, 2), 9.1231056256176615) + assert_almost_equal(norm(A, -2), 0.87689437438234041) + + assert_raises(ValueError, norm, A, 'nofro') + assert_raises(ValueError, norm, A, -3) + assert_raises(ValueError, norm, A, 0) + + def test_matrix_3x3(self): + # This test has been added because the 2x2 example + # happened to have equal nuclear norm and induced 1-norm. + # The 1/10 scaling factor accommodates the absolute tolerance + # used in assert_almost_equal. + A = (1 / 10) * \ + self.array([[1, 2, 3], [6, 0, 5], [3, 2, 1]], dtype=self.dt) + assert_almost_equal(norm(A), (1 / 10) * 89 ** 0.5) + assert_almost_equal(norm(A, 'fro'), (1 / 10) * 89 ** 0.5) + assert_almost_equal(norm(A, 'nuc'), 1.3366836911774836) + assert_almost_equal(norm(A, inf), 1.1) + assert_almost_equal(norm(A, -inf), 0.6) + assert_almost_equal(norm(A, 1), 1.0) + assert_almost_equal(norm(A, -1), 0.4) + assert_almost_equal(norm(A, 2), 0.88722940323461277) + assert_almost_equal(norm(A, -2), 0.19456584790481812) + + def test_bad_args(self): + # Check that bad arguments raise the appropriate exceptions. + + A = self.array([[1, 2, 3], [4, 5, 6]], dtype=self.dt) + B = np.arange(1, 25, dtype=self.dt).reshape(2, 3, 4) + + # Using `axis=` or passing in a 1-D array implies vector + # norms are being computed, so also using `ord='fro'` + # or `ord='nuc'` raises a ValueError. + assert_raises(ValueError, norm, A, 'fro', 0) + assert_raises(ValueError, norm, A, 'nuc', 0) + assert_raises(ValueError, norm, [3, 4], 'fro', None) + assert_raises(ValueError, norm, [3, 4], 'nuc', None) + + # Similarly, norm should raise an exception when ord is any finite + # number other than 1, 2, -1 or -2 when computing matrix norms. + for order in [0, 3]: + assert_raises(ValueError, norm, A, order, None) + assert_raises(ValueError, norm, A, order, (0, 1)) + assert_raises(ValueError, norm, B, order, (1, 2)) + + # Invalid axis + assert_raises(np.AxisError, norm, B, None, 3) + assert_raises(np.AxisError, norm, B, None, (2, 3)) + assert_raises(ValueError, norm, B, None, (0, 1, 2)) + + +class _TestNorm(_TestNorm2D, _TestNormGeneral): + pass + + +class TestNorm_NonSystematic(object): + + def test_longdouble_norm(self): + # Non-regression test: p-norm of longdouble would previously raise + # UnboundLocalError. + x = np.arange(10, dtype=np.longdouble) + old_assert_almost_equal(norm(x, ord=3), 12.65, decimal=2) + + def test_intmin(self): + # Non-regression test: p-norm of signed integer would previously do + # float cast and abs in the wrong order. + x = np.array([-2 ** 31], dtype=np.int32) + old_assert_almost_equal(norm(x, ord=3), 2 ** 31, decimal=5) + + def test_complex_high_ord(self): + # gh-4156 + d = np.empty((2,), dtype=np.clongdouble) + d[0] = 6 + 7j + d[1] = -6 + 7j + res = 11.615898132184 + old_assert_almost_equal(np.linalg.norm(d, ord=3), res, decimal=10) + d = d.astype(np.complex128) + old_assert_almost_equal(np.linalg.norm(d, ord=3), res, decimal=9) + d = d.astype(np.complex64) + old_assert_almost_equal(np.linalg.norm(d, ord=3), res, decimal=5) + + +# Separate definitions so we can use them for matrix tests. +class _TestNormDoubleBase(_TestNormBase): + dt = np.double + dec = 12 + + +class _TestNormSingleBase(_TestNormBase): + dt = np.float32 + dec = 6 + + +class _TestNormInt64Base(_TestNormBase): + dt = np.int64 + dec = 12 + + +class TestNormDouble(_TestNorm, _TestNormDoubleBase): + pass + + +class TestNormSingle(_TestNorm, _TestNormSingleBase): + pass + + +class TestNormInt64(_TestNorm, _TestNormInt64Base): + pass + + +class TestMatrixRank(object): + + def test_matrix_rank(self): + # Full rank matrix + assert_equal(4, matrix_rank(np.eye(4))) + # rank deficient matrix + I = np.eye(4) + I[-1, -1] = 0. + assert_equal(matrix_rank(I), 3) + # All zeros - zero rank + assert_equal(matrix_rank(np.zeros((4, 4))), 0) + # 1 dimension - rank 1 unless all 0 + assert_equal(matrix_rank([1, 0, 0, 0]), 1) + assert_equal(matrix_rank(np.zeros((4,))), 0) + # accepts array-like + assert_equal(matrix_rank([1]), 1) + # greater than 2 dimensions treated as stacked matrices + ms = np.array([I, np.eye(4), np.zeros((4,4))]) + assert_equal(matrix_rank(ms), np.array([3, 4, 0])) + # works on scalar + assert_equal(matrix_rank(1), 1) + + def test_symmetric_rank(self): + assert_equal(4, matrix_rank(np.eye(4), hermitian=True)) + assert_equal(1, matrix_rank(np.ones((4, 4)), hermitian=True)) + assert_equal(0, matrix_rank(np.zeros((4, 4)), hermitian=True)) + # rank deficient matrix + I = np.eye(4) + I[-1, -1] = 0. + assert_equal(3, matrix_rank(I, hermitian=True)) + # manually supplied tolerance + I[-1, -1] = 1e-8 + assert_equal(4, matrix_rank(I, hermitian=True, tol=0.99e-8)) + assert_equal(3, matrix_rank(I, hermitian=True, tol=1.01e-8)) + + +def test_reduced_rank(): + # Test matrices with reduced rank + rng = np.random.RandomState(20120714) + for i in range(100): + # Make a rank deficient matrix + X = rng.normal(size=(40, 10)) + X[:, 0] = X[:, 1] + X[:, 2] + # Assert that matrix_rank detected deficiency + assert_equal(matrix_rank(X), 9) + X[:, 3] = X[:, 4] + X[:, 5] + assert_equal(matrix_rank(X), 8) + + +class TestQR(object): + # Define the array class here, so run this on matrices elsewhere. + array = np.array + + def check_qr(self, a): + # This test expects the argument `a` to be an ndarray or + # a subclass of an ndarray of inexact type. + a_type = type(a) + a_dtype = a.dtype + m, n = a.shape + k = min(m, n) + + # mode == 'complete' + q, r = linalg.qr(a, mode='complete') + assert_(q.dtype == a_dtype) + assert_(r.dtype == a_dtype) + assert_(isinstance(q, a_type)) + assert_(isinstance(r, a_type)) + assert_(q.shape == (m, m)) + assert_(r.shape == (m, n)) + assert_almost_equal(dot(q, r), a) + assert_almost_equal(dot(q.T.conj(), q), np.eye(m)) + assert_almost_equal(np.triu(r), r) + + # mode == 'reduced' + q1, r1 = linalg.qr(a, mode='reduced') + assert_(q1.dtype == a_dtype) + assert_(r1.dtype == a_dtype) + assert_(isinstance(q1, a_type)) + assert_(isinstance(r1, a_type)) + assert_(q1.shape == (m, k)) + assert_(r1.shape == (k, n)) + assert_almost_equal(dot(q1, r1), a) + assert_almost_equal(dot(q1.T.conj(), q1), np.eye(k)) + assert_almost_equal(np.triu(r1), r1) + + # mode == 'r' + r2 = linalg.qr(a, mode='r') + assert_(r2.dtype == a_dtype) + assert_(isinstance(r2, a_type)) + assert_almost_equal(r2, r1) + + + @pytest.mark.parametrize(["m", "n"], [ + (3, 0), + (0, 3), + (0, 0) + ]) + def test_qr_empty(self, m, n): + k = min(m, n) + a = np.empty((m, n)) + + self.check_qr(a) + + h, tau = np.linalg.qr(a, mode='raw') + assert_equal(h.dtype, np.double) + assert_equal(tau.dtype, np.double) + assert_equal(h.shape, (n, m)) + assert_equal(tau.shape, (k,)) + + def test_mode_raw(self): + # The factorization is not unique and varies between libraries, + # so it is not possible to check against known values. Functional + # testing is a possibility, but awaits the exposure of more + # of the functions in lapack_lite. Consequently, this test is + # very limited in scope. Note that the results are in FORTRAN + # order, hence the h arrays are transposed. + a = self.array([[1, 2], [3, 4], [5, 6]], dtype=np.double) + + # Test double + h, tau = linalg.qr(a, mode='raw') + assert_(h.dtype == np.double) + assert_(tau.dtype == np.double) + assert_(h.shape == (2, 3)) + assert_(tau.shape == (2,)) + + h, tau = linalg.qr(a.T, mode='raw') + assert_(h.dtype == np.double) + assert_(tau.dtype == np.double) + assert_(h.shape == (3, 2)) + assert_(tau.shape == (2,)) + + def test_mode_all_but_economic(self): + a = self.array([[1, 2], [3, 4]]) + b = self.array([[1, 2], [3, 4], [5, 6]]) + for dt in "fd": + m1 = a.astype(dt) + m2 = b.astype(dt) + self.check_qr(m1) + self.check_qr(m2) + self.check_qr(m2.T) + + for dt in "fd": + m1 = 1 + 1j * a.astype(dt) + m2 = 1 + 1j * b.astype(dt) + self.check_qr(m1) + self.check_qr(m2) + self.check_qr(m2.T) + + +class TestCholesky(object): + # TODO: are there no other tests for cholesky? + + def test_basic_property(self): + # Check A = L L^H + shapes = [(1, 1), (2, 2), (3, 3), (50, 50), (3, 10, 10)] + dtypes = (np.float32, np.float64, np.complex64, np.complex128) + + for shape, dtype in itertools.product(shapes, dtypes): + np.random.seed(1) + a = np.random.randn(*shape) + if np.issubdtype(dtype, np.complexfloating): + a = a + 1j*np.random.randn(*shape) + + t = list(range(len(shape))) + t[-2:] = -1, -2 + + a = np.matmul(a.transpose(t).conj(), a) + a = np.asarray(a, dtype=dtype) + + c = np.linalg.cholesky(a) + + b = np.matmul(c, c.transpose(t).conj()) + assert_allclose(b, a, + err_msg="{} {}\n{}\n{}".format(shape, dtype, a, c), + atol=500 * a.shape[0] * np.finfo(dtype).eps) + + def test_0_size(self): + class ArraySubclass(np.ndarray): + pass + a = np.zeros((0, 1, 1), dtype=np.int_).view(ArraySubclass) + res = linalg.cholesky(a) + assert_equal(a.shape, res.shape) + assert_(res.dtype.type is np.float64) + # for documentation purpose: + assert_(isinstance(res, np.ndarray)) + + a = np.zeros((1, 0, 0), dtype=np.complex64).view(ArraySubclass) + res = linalg.cholesky(a) + assert_equal(a.shape, res.shape) + assert_(res.dtype.type is np.complex64) + assert_(isinstance(res, np.ndarray)) + + +def test_byteorder_check(): + # Byte order check should pass for native order + if sys.byteorder == 'little': + native = '<' + else: + native = '>' + + for dtt in (np.float32, np.float64): + arr = np.eye(4, dtype=dtt) + n_arr = arr.newbyteorder(native) + sw_arr = arr.newbyteorder('S').byteswap() + assert_equal(arr.dtype.byteorder, '=') + for routine in (linalg.inv, linalg.det, linalg.pinv): + # Normal call + res = routine(arr) + # Native but not '=' + assert_array_equal(res, routine(n_arr)) + # Swapped + assert_array_equal(res, routine(sw_arr)) + + +def test_generalized_raise_multiloop(): + # It should raise an error even if the error doesn't occur in the + # last iteration of the ufunc inner loop + + invertible = np.array([[1, 2], [3, 4]]) + non_invertible = np.array([[1, 1], [1, 1]]) + + x = np.zeros([4, 4, 2, 2])[1::2] + x[...] = invertible + x[0, 0] = non_invertible + + assert_raises(np.linalg.LinAlgError, np.linalg.inv, x) + + +def test_xerbla_override(): + # Check that our xerbla has been successfully linked in. If it is not, + # the default xerbla routine is called, which prints a message to stdout + # and may, or may not, abort the process depending on the LAPACK package. + + XERBLA_OK = 255 + + try: + pid = os.fork() + except (OSError, AttributeError): + # fork failed, or not running on POSIX + pytest.skip("Not POSIX or fork failed.") + + if pid == 0: + # child; close i/o file handles + os.close(1) + os.close(0) + # Avoid producing core files. + import resource + resource.setrlimit(resource.RLIMIT_CORE, (0, 0)) + # These calls may abort. + try: + np.linalg.lapack_lite.xerbla() + except ValueError: + pass + except Exception: + os._exit(os.EX_CONFIG) + + try: + a = np.array([[1.]]) + np.linalg.lapack_lite.dorgqr( + 1, 1, 1, a, + 0, # <- invalid value + a, a, 0, 0) + except ValueError as e: + if "DORGQR parameter number 5" in str(e): + # success, reuse error code to mark success as + # FORTRAN STOP returns as success. + os._exit(XERBLA_OK) + + # Did not abort, but our xerbla was not linked in. + os._exit(os.EX_CONFIG) + else: + # parent + pid, status = os.wait() + if os.WEXITSTATUS(status) != XERBLA_OK: + pytest.skip('Numpy xerbla not linked in.') + + +def test_sdot_bug_8577(): + # Regression test that loading certain other libraries does not + # result to wrong results in float32 linear algebra. + # + # There's a bug gh-8577 on OSX that can trigger this, and perhaps + # there are also other situations in which it occurs. + # + # Do the check in a separate process. + + bad_libs = ['PyQt5.QtWidgets', 'IPython'] + + template = textwrap.dedent(""" + import sys + {before} + try: + import {bad_lib} + except ImportError: + sys.exit(0) + {after} + x = np.ones(2, dtype=np.float32) + sys.exit(0 if np.allclose(x.dot(x), 2.0) else 1) + """) + + for bad_lib in bad_libs: + code = template.format(before="import numpy as np", after="", + bad_lib=bad_lib) + subprocess.check_call([sys.executable, "-c", code]) + + # Swapped import order + code = template.format(after="import numpy as np", before="", + bad_lib=bad_lib) + subprocess.check_call([sys.executable, "-c", code]) + + +class TestMultiDot(object): + + def test_basic_function_with_three_arguments(self): + # multi_dot with three arguments uses a fast hand coded algorithm to + # determine the optimal order. Therefore test it separately. + A = np.random.random((6, 2)) + B = np.random.random((2, 6)) + C = np.random.random((6, 2)) + + assert_almost_equal(multi_dot([A, B, C]), A.dot(B).dot(C)) + assert_almost_equal(multi_dot([A, B, C]), np.dot(A, np.dot(B, C))) + + def test_basic_function_with_two_arguments(self): + # separate code path with two arguments + A = np.random.random((6, 2)) + B = np.random.random((2, 6)) + + assert_almost_equal(multi_dot([A, B]), A.dot(B)) + assert_almost_equal(multi_dot([A, B]), np.dot(A, B)) + + def test_basic_function_with_dynamic_programing_optimization(self): + # multi_dot with four or more arguments uses the dynamic programing + # optimization and therefore deserve a separate + A = np.random.random((6, 2)) + B = np.random.random((2, 6)) + C = np.random.random((6, 2)) + D = np.random.random((2, 1)) + assert_almost_equal(multi_dot([A, B, C, D]), A.dot(B).dot(C).dot(D)) + + def test_vector_as_first_argument(self): + # The first argument can be 1-D + A1d = np.random.random(2) # 1-D + B = np.random.random((2, 6)) + C = np.random.random((6, 2)) + D = np.random.random((2, 2)) + + # the result should be 1-D + assert_equal(multi_dot([A1d, B, C, D]).shape, (2,)) + + def test_vector_as_last_argument(self): + # The last argument can be 1-D + A = np.random.random((6, 2)) + B = np.random.random((2, 6)) + C = np.random.random((6, 2)) + D1d = np.random.random(2) # 1-D + + # the result should be 1-D + assert_equal(multi_dot([A, B, C, D1d]).shape, (6,)) + + def test_vector_as_first_and_last_argument(self): + # The first and last arguments can be 1-D + A1d = np.random.random(2) # 1-D + B = np.random.random((2, 6)) + C = np.random.random((6, 2)) + D1d = np.random.random(2) # 1-D + + # the result should be a scalar + assert_equal(multi_dot([A1d, B, C, D1d]).shape, ()) + + def test_dynamic_programming_logic(self): + # Test for the dynamic programming part + # This test is directly taken from Cormen page 376. + arrays = [np.random.random((30, 35)), + np.random.random((35, 15)), + np.random.random((15, 5)), + np.random.random((5, 10)), + np.random.random((10, 20)), + np.random.random((20, 25))] + m_expected = np.array([[0., 15750., 7875., 9375., 11875., 15125.], + [0., 0., 2625., 4375., 7125., 10500.], + [0., 0., 0., 750., 2500., 5375.], + [0., 0., 0., 0., 1000., 3500.], + [0., 0., 0., 0., 0., 5000.], + [0., 0., 0., 0., 0., 0.]]) + s_expected = np.array([[0, 1, 1, 3, 3, 3], + [0, 0, 2, 3, 3, 3], + [0, 0, 0, 3, 3, 3], + [0, 0, 0, 0, 4, 5], + [0, 0, 0, 0, 0, 5], + [0, 0, 0, 0, 0, 0]], dtype=int) + s_expected -= 1 # Cormen uses 1-based index, python does not. + + s, m = _multi_dot_matrix_chain_order(arrays, return_costs=True) + + # Only the upper triangular part (without the diagonal) is interesting. + assert_almost_equal(np.triu(s[:-1, 1:]), + np.triu(s_expected[:-1, 1:])) + assert_almost_equal(np.triu(m), np.triu(m_expected)) + + def test_too_few_input_arrays(self): + assert_raises(ValueError, multi_dot, []) + assert_raises(ValueError, multi_dot, [np.random.random((3, 3))]) + + +class TestTensorinv(object): + + @pytest.mark.parametrize("arr, ind", [ + (np.ones((4, 6, 8, 2)), 2), + (np.ones((3, 3, 2)), 1), + ]) + def test_non_square_handling(self, arr, ind): + with assert_raises(LinAlgError): + linalg.tensorinv(arr, ind=ind) + + @pytest.mark.parametrize("shape, ind", [ + # examples from docstring + ((4, 6, 8, 3), 2), + ((24, 8, 3), 1), + ]) + def test_tensorinv_shape(self, shape, ind): + a = np.eye(24) + a.shape = shape + ainv = linalg.tensorinv(a=a, ind=ind) + expected = a.shape[ind:] + a.shape[:ind] + actual = ainv.shape + assert_equal(actual, expected) + + @pytest.mark.parametrize("ind", [ + 0, -2, + ]) + def test_tensorinv_ind_limit(self, ind): + a = np.eye(24) + a.shape = (4, 6, 8, 3) + with assert_raises(ValueError): + linalg.tensorinv(a=a, ind=ind) + + def test_tensorinv_result(self): + # mimic a docstring example + a = np.eye(24) + a.shape = (24, 8, 3) + ainv = linalg.tensorinv(a, ind=1) + b = np.ones(24) + assert_allclose(np.tensordot(ainv, b, 1), np.linalg.tensorsolve(a, b)) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/linalg/tests/test_regression.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/linalg/tests/test_regression.py new file mode 100644 index 0000000000000000000000000000000000000000..bd3a45872cb198030308f0214ef88c12ae1215f4 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/linalg/tests/test_regression.py @@ -0,0 +1,150 @@ +""" Test functions for linalg module +""" +from __future__ import division, absolute_import, print_function + +import warnings + +import numpy as np +from numpy import linalg, arange, float64, array, dot, transpose +from numpy.testing import ( + assert_, assert_raises, assert_equal, assert_array_equal, + assert_array_almost_equal, assert_array_less +) + + +class TestRegression(object): + + def test_eig_build(self): + # Ticket #652 + rva = array([1.03221168e+02 + 0.j, + -1.91843603e+01 + 0.j, + -6.04004526e-01 + 15.84422474j, + -6.04004526e-01 - 15.84422474j, + -1.13692929e+01 + 0.j, + -6.57612485e-01 + 10.41755503j, + -6.57612485e-01 - 10.41755503j, + 1.82126812e+01 + 0.j, + 1.06011014e+01 + 0.j, + 7.80732773e+00 + 0.j, + -7.65390898e-01 + 0.j, + 1.51971555e-15 + 0.j, + -1.51308713e-15 + 0.j]) + a = arange(13 * 13, dtype=float64) + a.shape = (13, 13) + a = a % 17 + va, ve = linalg.eig(a) + va.sort() + rva.sort() + assert_array_almost_equal(va, rva) + + def test_eigh_build(self): + # Ticket 662. + rvals = [68.60568999, 89.57756725, 106.67185574] + + cov = array([[77.70273908, 3.51489954, 15.64602427], + [3.51489954, 88.97013878, -1.07431931], + [15.64602427, -1.07431931, 98.18223512]]) + + vals, vecs = linalg.eigh(cov) + assert_array_almost_equal(vals, rvals) + + def test_svd_build(self): + # Ticket 627. + a = array([[0., 1.], [1., 1.], [2., 1.], [3., 1.]]) + m, n = a.shape + u, s, vh = linalg.svd(a) + + b = dot(transpose(u[:, n:]), a) + + assert_array_almost_equal(b, np.zeros((2, 2))) + + def test_norm_vector_badarg(self): + # Regression for #786: Froebenius norm for vectors raises + # TypeError. + assert_raises(ValueError, linalg.norm, array([1., 2., 3.]), 'fro') + + def test_lapack_endian(self): + # For bug #1482 + a = array([[5.7998084, -2.1825367], + [-2.1825367, 9.85910595]], dtype='>f8') + b = array(a, dtype=' 0.5) + assert_equal(c, 1) + assert_equal(np.linalg.matrix_rank(a), 1) + assert_array_less(1, np.linalg.norm(a, ord=2)) + + def test_norm_object_array(self): + # gh-7575 + testvector = np.array([np.array([0, 1]), 0, 0], dtype=object) + + norm = linalg.norm(testvector) + assert_array_equal(norm, [0, 1]) + assert_(norm.dtype == np.dtype('float64')) + + norm = linalg.norm(testvector, ord=1) + assert_array_equal(norm, [0, 1]) + assert_(norm.dtype != np.dtype('float64')) + + norm = linalg.norm(testvector, ord=2) + assert_array_equal(norm, [0, 1]) + assert_(norm.dtype == np.dtype('float64')) + + assert_raises(ValueError, linalg.norm, testvector, ord='fro') + assert_raises(ValueError, linalg.norm, testvector, ord='nuc') + assert_raises(ValueError, linalg.norm, testvector, ord=np.inf) + assert_raises(ValueError, linalg.norm, testvector, ord=-np.inf) + with warnings.catch_warnings(): + warnings.simplefilter("error", DeprecationWarning) + assert_raises((AttributeError, DeprecationWarning), + linalg.norm, testvector, ord=0) + assert_raises(ValueError, linalg.norm, testvector, ord=-1) + assert_raises(ValueError, linalg.norm, testvector, ord=-2) + + testmatrix = np.array([[np.array([0, 1]), 0, 0], + [0, 0, 0]], dtype=object) + + norm = linalg.norm(testmatrix) + assert_array_equal(norm, [0, 1]) + assert_(norm.dtype == np.dtype('float64')) + + norm = linalg.norm(testmatrix, ord='fro') + assert_array_equal(norm, [0, 1]) + assert_(norm.dtype == np.dtype('float64')) + + assert_raises(TypeError, linalg.norm, testmatrix, ord='nuc') + assert_raises(ValueError, linalg.norm, testmatrix, ord=np.inf) + assert_raises(ValueError, linalg.norm, testmatrix, ord=-np.inf) + assert_raises(ValueError, linalg.norm, testmatrix, ord=0) + assert_raises(ValueError, linalg.norm, testmatrix, ord=1) + assert_raises(ValueError, linalg.norm, testmatrix, ord=-1) + assert_raises(TypeError, linalg.norm, testmatrix, ord=2) + assert_raises(TypeError, linalg.norm, testmatrix, ord=-2) + assert_raises(ValueError, linalg.norm, testmatrix, ord=3) + + def test_lstsq_complex_larger_rhs(self): + # gh-9891 + size = 20 + n_rhs = 70 + G = np.random.randn(size, size) + 1j * np.random.randn(size, size) + u = np.random.randn(size, n_rhs) + 1j * np.random.randn(size, n_rhs) + b = G.dot(u) + # This should work without segmentation fault. + u_lstsq, res, rank, sv = linalg.lstsq(G, b, rcond=None) + # check results just in case + assert_array_almost_equal(u_lstsq, u) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/ma/tests/__init__.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/ma/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/ma/tests/test_extras.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/ma/tests/test_extras.py new file mode 100644 index 0000000000000000000000000000000000000000..5243cf714a0430afba683a7132223027c6ff442f --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/ma/tests/test_extras.py @@ -0,0 +1,1678 @@ +# pylint: disable-msg=W0611, W0612, W0511 +"""Tests suite for MaskedArray. +Adapted from the original test_ma by Pierre Gerard-Marchant + +:author: Pierre Gerard-Marchant +:contact: pierregm_at_uga_dot_edu +:version: $Id: test_extras.py 3473 2007-10-29 15:18:13Z jarrod.millman $ + +""" +from __future__ import division, absolute_import, print_function + +import warnings +import itertools + +import numpy as np +from numpy.testing import ( + assert_warns, suppress_warnings + ) +from numpy.ma.testutils import ( + assert_, assert_array_equal, assert_equal, assert_almost_equal + ) +from numpy.ma.core import ( + array, arange, masked, MaskedArray, masked_array, getmaskarray, shape, + nomask, ones, zeros, count + ) +from numpy.ma.extras import ( + atleast_1d, atleast_2d, atleast_3d, mr_, dot, polyfit, cov, corrcoef, + median, average, unique, setxor1d, setdiff1d, union1d, intersect1d, in1d, + ediff1d, apply_over_axes, apply_along_axis, compress_nd, compress_rowcols, + mask_rowcols, clump_masked, clump_unmasked, flatnotmasked_contiguous, + notmasked_contiguous, notmasked_edges, masked_all, masked_all_like, isin, + diagflat, stack, vstack + ) + + +class TestGeneric(object): + # + def test_masked_all(self): + # Tests masked_all + # Standard dtype + test = masked_all((2,), dtype=float) + control = array([1, 1], mask=[1, 1], dtype=float) + assert_equal(test, control) + # Flexible dtype + dt = np.dtype({'names': ['a', 'b'], 'formats': ['f', 'f']}) + test = masked_all((2,), dtype=dt) + control = array([(0, 0), (0, 0)], mask=[(1, 1), (1, 1)], dtype=dt) + assert_equal(test, control) + test = masked_all((2, 2), dtype=dt) + control = array([[(0, 0), (0, 0)], [(0, 0), (0, 0)]], + mask=[[(1, 1), (1, 1)], [(1, 1), (1, 1)]], + dtype=dt) + assert_equal(test, control) + # Nested dtype + dt = np.dtype([('a', 'f'), ('b', [('ba', 'f'), ('bb', 'f')])]) + test = masked_all((2,), dtype=dt) + control = array([(1, (1, 1)), (1, (1, 1))], + mask=[(1, (1, 1)), (1, (1, 1))], dtype=dt) + assert_equal(test, control) + test = masked_all((2,), dtype=dt) + control = array([(1, (1, 1)), (1, (1, 1))], + mask=[(1, (1, 1)), (1, (1, 1))], dtype=dt) + assert_equal(test, control) + test = masked_all((1, 1), dtype=dt) + control = array([[(1, (1, 1))]], mask=[[(1, (1, 1))]], dtype=dt) + assert_equal(test, control) + + def test_masked_all_like(self): + # Tests masked_all + # Standard dtype + base = array([1, 2], dtype=float) + test = masked_all_like(base) + control = array([1, 1], mask=[1, 1], dtype=float) + assert_equal(test, control) + # Flexible dtype + dt = np.dtype({'names': ['a', 'b'], 'formats': ['f', 'f']}) + base = array([(0, 0), (0, 0)], mask=[(1, 1), (1, 1)], dtype=dt) + test = masked_all_like(base) + control = array([(10, 10), (10, 10)], mask=[(1, 1), (1, 1)], dtype=dt) + assert_equal(test, control) + # Nested dtype + dt = np.dtype([('a', 'f'), ('b', [('ba', 'f'), ('bb', 'f')])]) + control = array([(1, (1, 1)), (1, (1, 1))], + mask=[(1, (1, 1)), (1, (1, 1))], dtype=dt) + test = masked_all_like(control) + assert_equal(test, control) + + def check_clump(self, f): + for i in range(1, 7): + for j in range(2**i): + k = np.arange(i, dtype=int) + ja = np.full(i, j, dtype=int) + a = masked_array(2**k) + a.mask = (ja & (2**k)) != 0 + s = 0 + for sl in f(a): + s += a.data[sl].sum() + if f == clump_unmasked: + assert_equal(a.compressed().sum(), s) + else: + a.mask = ~a.mask + assert_equal(a.compressed().sum(), s) + + def test_clump_masked(self): + # Test clump_masked + a = masked_array(np.arange(10)) + a[[0, 1, 2, 6, 8, 9]] = masked + # + test = clump_masked(a) + control = [slice(0, 3), slice(6, 7), slice(8, 10)] + assert_equal(test, control) + + self.check_clump(clump_masked) + + def test_clump_unmasked(self): + # Test clump_unmasked + a = masked_array(np.arange(10)) + a[[0, 1, 2, 6, 8, 9]] = masked + test = clump_unmasked(a) + control = [slice(3, 6), slice(7, 8), ] + assert_equal(test, control) + + self.check_clump(clump_unmasked) + + def test_flatnotmasked_contiguous(self): + # Test flatnotmasked_contiguous + a = arange(10) + # No mask + test = flatnotmasked_contiguous(a) + assert_equal(test, [slice(0, a.size)]) + # mask of all false + a.mask = np.zeros(10, dtype=bool) + assert_equal(test, [slice(0, a.size)]) + # Some mask + a[(a < 3) | (a > 8) | (a == 5)] = masked + test = flatnotmasked_contiguous(a) + assert_equal(test, [slice(3, 5), slice(6, 9)]) + # + a[:] = masked + test = flatnotmasked_contiguous(a) + assert_equal(test, []) + + +class TestAverage(object): + # Several tests of average. Why so many ? Good point... + def test_testAverage1(self): + # Test of average. + ott = array([0., 1., 2., 3.], mask=[True, False, False, False]) + assert_equal(2.0, average(ott, axis=0)) + assert_equal(2.0, average(ott, weights=[1., 1., 2., 1.])) + result, wts = average(ott, weights=[1., 1., 2., 1.], returned=1) + assert_equal(2.0, result) + assert_(wts == 4.0) + ott[:] = masked + assert_equal(average(ott, axis=0).mask, [True]) + ott = array([0., 1., 2., 3.], mask=[True, False, False, False]) + ott = ott.reshape(2, 2) + ott[:, 1] = masked + assert_equal(average(ott, axis=0), [2.0, 0.0]) + assert_equal(average(ott, axis=1).mask[0], [True]) + assert_equal([2., 0.], average(ott, axis=0)) + result, wts = average(ott, axis=0, returned=1) + assert_equal(wts, [1., 0.]) + + def test_testAverage2(self): + # More tests of average. + w1 = [0, 1, 1, 1, 1, 0] + w2 = [[0, 1, 1, 1, 1, 0], [1, 0, 0, 0, 0, 1]] + x = arange(6, dtype=np.float_) + assert_equal(average(x, axis=0), 2.5) + assert_equal(average(x, axis=0, weights=w1), 2.5) + y = array([arange(6, dtype=np.float_), 2.0 * arange(6)]) + assert_equal(average(y, None), np.add.reduce(np.arange(6)) * 3. / 12.) + assert_equal(average(y, axis=0), np.arange(6) * 3. / 2.) + assert_equal(average(y, axis=1), + [average(x, axis=0), average(x, axis=0) * 2.0]) + assert_equal(average(y, None, weights=w2), 20. / 6.) + assert_equal(average(y, axis=0, weights=w2), + [0., 1., 2., 3., 4., 10.]) + assert_equal(average(y, axis=1), + [average(x, axis=0), average(x, axis=0) * 2.0]) + m1 = zeros(6) + m2 = [0, 0, 1, 1, 0, 0] + m3 = [[0, 0, 1, 1, 0, 0], [0, 1, 1, 1, 1, 0]] + m4 = ones(6) + m5 = [0, 1, 1, 1, 1, 1] + assert_equal(average(masked_array(x, m1), axis=0), 2.5) + assert_equal(average(masked_array(x, m2), axis=0), 2.5) + assert_equal(average(masked_array(x, m4), axis=0).mask, [True]) + assert_equal(average(masked_array(x, m5), axis=0), 0.0) + assert_equal(count(average(masked_array(x, m4), axis=0)), 0) + z = masked_array(y, m3) + assert_equal(average(z, None), 20. / 6.) + assert_equal(average(z, axis=0), [0., 1., 99., 99., 4.0, 7.5]) + assert_equal(average(z, axis=1), [2.5, 5.0]) + assert_equal(average(z, axis=0, weights=w2), + [0., 1., 99., 99., 4.0, 10.0]) + + def test_testAverage3(self): + # Yet more tests of average! + a = arange(6) + b = arange(6) * 3 + r1, w1 = average([[a, b], [b, a]], axis=1, returned=1) + assert_equal(shape(r1), shape(w1)) + assert_equal(r1.shape, w1.shape) + r2, w2 = average(ones((2, 2, 3)), axis=0, weights=[3, 1], returned=1) + assert_equal(shape(w2), shape(r2)) + r2, w2 = average(ones((2, 2, 3)), returned=1) + assert_equal(shape(w2), shape(r2)) + r2, w2 = average(ones((2, 2, 3)), weights=ones((2, 2, 3)), returned=1) + assert_equal(shape(w2), shape(r2)) + a2d = array([[1, 2], [0, 4]], float) + a2dm = masked_array(a2d, [[False, False], [True, False]]) + a2da = average(a2d, axis=0) + assert_equal(a2da, [0.5, 3.0]) + a2dma = average(a2dm, axis=0) + assert_equal(a2dma, [1.0, 3.0]) + a2dma = average(a2dm, axis=None) + assert_equal(a2dma, 7. / 3.) + a2dma = average(a2dm, axis=1) + assert_equal(a2dma, [1.5, 4.0]) + + def test_onintegers_with_mask(self): + # Test average on integers with mask + a = average(array([1, 2])) + assert_equal(a, 1.5) + a = average(array([1, 2, 3, 4], mask=[False, False, True, True])) + assert_equal(a, 1.5) + + def test_complex(self): + # Test with complex data. + # (Regression test for https://github.com/numpy/numpy/issues/2684) + mask = np.array([[0, 0, 0, 1, 0], + [0, 1, 0, 0, 0]], dtype=bool) + a = masked_array([[0, 1+2j, 3+4j, 5+6j, 7+8j], + [9j, 0+1j, 2+3j, 4+5j, 7+7j]], + mask=mask) + + av = average(a) + expected = np.average(a.compressed()) + assert_almost_equal(av.real, expected.real) + assert_almost_equal(av.imag, expected.imag) + + av0 = average(a, axis=0) + expected0 = average(a.real, axis=0) + average(a.imag, axis=0)*1j + assert_almost_equal(av0.real, expected0.real) + assert_almost_equal(av0.imag, expected0.imag) + + av1 = average(a, axis=1) + expected1 = average(a.real, axis=1) + average(a.imag, axis=1)*1j + assert_almost_equal(av1.real, expected1.real) + assert_almost_equal(av1.imag, expected1.imag) + + # Test with the 'weights' argument. + wts = np.array([[0.5, 1.0, 2.0, 1.0, 0.5], + [1.0, 1.0, 1.0, 1.0, 1.0]]) + wav = average(a, weights=wts) + expected = np.average(a.compressed(), weights=wts[~mask]) + assert_almost_equal(wav.real, expected.real) + assert_almost_equal(wav.imag, expected.imag) + + wav0 = average(a, weights=wts, axis=0) + expected0 = (average(a.real, weights=wts, axis=0) + + average(a.imag, weights=wts, axis=0)*1j) + assert_almost_equal(wav0.real, expected0.real) + assert_almost_equal(wav0.imag, expected0.imag) + + wav1 = average(a, weights=wts, axis=1) + expected1 = (average(a.real, weights=wts, axis=1) + + average(a.imag, weights=wts, axis=1)*1j) + assert_almost_equal(wav1.real, expected1.real) + assert_almost_equal(wav1.imag, expected1.imag) + + +class TestConcatenator(object): + # Tests for mr_, the equivalent of r_ for masked arrays. + + def test_1d(self): + # Tests mr_ on 1D arrays. + assert_array_equal(mr_[1, 2, 3, 4, 5, 6], array([1, 2, 3, 4, 5, 6])) + b = ones(5) + m = [1, 0, 0, 0, 0] + d = masked_array(b, mask=m) + c = mr_[d, 0, 0, d] + assert_(isinstance(c, MaskedArray)) + assert_array_equal(c, [1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1]) + assert_array_equal(c.mask, mr_[m, 0, 0, m]) + + def test_2d(self): + # Tests mr_ on 2D arrays. + a_1 = np.random.rand(5, 5) + a_2 = np.random.rand(5, 5) + m_1 = np.round_(np.random.rand(5, 5), 0) + m_2 = np.round_(np.random.rand(5, 5), 0) + b_1 = masked_array(a_1, mask=m_1) + b_2 = masked_array(a_2, mask=m_2) + # append columns + d = mr_['1', b_1, b_2] + assert_(d.shape == (5, 10)) + assert_array_equal(d[:, :5], b_1) + assert_array_equal(d[:, 5:], b_2) + assert_array_equal(d.mask, np.r_['1', m_1, m_2]) + d = mr_[b_1, b_2] + assert_(d.shape == (10, 5)) + assert_array_equal(d[:5,:], b_1) + assert_array_equal(d[5:,:], b_2) + assert_array_equal(d.mask, np.r_[m_1, m_2]) + + def test_masked_constant(self): + actual = mr_[np.ma.masked, 1] + assert_equal(actual.mask, [True, False]) + assert_equal(actual.data[1], 1) + + actual = mr_[[1, 2], np.ma.masked] + assert_equal(actual.mask, [False, False, True]) + assert_equal(actual.data[:2], [1, 2]) + + +class TestNotMasked(object): + # Tests notmasked_edges and notmasked_contiguous. + + def test_edges(self): + # Tests unmasked_edges + data = masked_array(np.arange(25).reshape(5, 5), + mask=[[0, 0, 1, 0, 0], + [0, 0, 0, 1, 1], + [1, 1, 0, 0, 0], + [0, 0, 0, 0, 0], + [1, 1, 1, 0, 0]],) + test = notmasked_edges(data, None) + assert_equal(test, [0, 24]) + test = notmasked_edges(data, 0) + assert_equal(test[0], [(0, 0, 1, 0, 0), (0, 1, 2, 3, 4)]) + assert_equal(test[1], [(3, 3, 3, 4, 4), (0, 1, 2, 3, 4)]) + test = notmasked_edges(data, 1) + assert_equal(test[0], [(0, 1, 2, 3, 4), (0, 0, 2, 0, 3)]) + assert_equal(test[1], [(0, 1, 2, 3, 4), (4, 2, 4, 4, 4)]) + # + test = notmasked_edges(data.data, None) + assert_equal(test, [0, 24]) + test = notmasked_edges(data.data, 0) + assert_equal(test[0], [(0, 0, 0, 0, 0), (0, 1, 2, 3, 4)]) + assert_equal(test[1], [(4, 4, 4, 4, 4), (0, 1, 2, 3, 4)]) + test = notmasked_edges(data.data, -1) + assert_equal(test[0], [(0, 1, 2, 3, 4), (0, 0, 0, 0, 0)]) + assert_equal(test[1], [(0, 1, 2, 3, 4), (4, 4, 4, 4, 4)]) + # + data[-2] = masked + test = notmasked_edges(data, 0) + assert_equal(test[0], [(0, 0, 1, 0, 0), (0, 1, 2, 3, 4)]) + assert_equal(test[1], [(1, 1, 2, 4, 4), (0, 1, 2, 3, 4)]) + test = notmasked_edges(data, -1) + assert_equal(test[0], [(0, 1, 2, 4), (0, 0, 2, 3)]) + assert_equal(test[1], [(0, 1, 2, 4), (4, 2, 4, 4)]) + + def test_contiguous(self): + # Tests notmasked_contiguous + a = masked_array(np.arange(24).reshape(3, 8), + mask=[[0, 0, 0, 0, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1], + [0, 0, 0, 0, 0, 0, 1, 0]]) + tmp = notmasked_contiguous(a, None) + assert_equal(tmp, [ + slice(0, 4, None), + slice(16, 22, None), + slice(23, 24, None) + ]) + + tmp = notmasked_contiguous(a, 0) + assert_equal(tmp, [ + [slice(0, 1, None), slice(2, 3, None)], + [slice(0, 1, None), slice(2, 3, None)], + [slice(0, 1, None), slice(2, 3, None)], + [slice(0, 1, None), slice(2, 3, None)], + [slice(2, 3, None)], + [slice(2, 3, None)], + [], + [slice(2, 3, None)] + ]) + # + tmp = notmasked_contiguous(a, 1) + assert_equal(tmp, [ + [slice(0, 4, None)], + [], + [slice(0, 6, None), slice(7, 8, None)] + ]) + + +class TestCompressFunctions(object): + + def test_compress_nd(self): + # Tests compress_nd + x = np.array(list(range(3*4*5))).reshape(3, 4, 5) + m = np.zeros((3,4,5)).astype(bool) + m[1,1,1] = True + x = array(x, mask=m) + + # axis=None + a = compress_nd(x) + assert_equal(a, [[[ 0, 2, 3, 4], + [10, 12, 13, 14], + [15, 17, 18, 19]], + [[40, 42, 43, 44], + [50, 52, 53, 54], + [55, 57, 58, 59]]]) + + # axis=0 + a = compress_nd(x, 0) + assert_equal(a, [[[ 0, 1, 2, 3, 4], + [ 5, 6, 7, 8, 9], + [10, 11, 12, 13, 14], + [15, 16, 17, 18, 19]], + [[40, 41, 42, 43, 44], + [45, 46, 47, 48, 49], + [50, 51, 52, 53, 54], + [55, 56, 57, 58, 59]]]) + + # axis=1 + a = compress_nd(x, 1) + assert_equal(a, [[[ 0, 1, 2, 3, 4], + [10, 11, 12, 13, 14], + [15, 16, 17, 18, 19]], + [[20, 21, 22, 23, 24], + [30, 31, 32, 33, 34], + [35, 36, 37, 38, 39]], + [[40, 41, 42, 43, 44], + [50, 51, 52, 53, 54], + [55, 56, 57, 58, 59]]]) + + a2 = compress_nd(x, (1,)) + a3 = compress_nd(x, -2) + a4 = compress_nd(x, (-2,)) + assert_equal(a, a2) + assert_equal(a, a3) + assert_equal(a, a4) + + # axis=2 + a = compress_nd(x, 2) + assert_equal(a, [[[ 0, 2, 3, 4], + [ 5, 7, 8, 9], + [10, 12, 13, 14], + [15, 17, 18, 19]], + [[20, 22, 23, 24], + [25, 27, 28, 29], + [30, 32, 33, 34], + [35, 37, 38, 39]], + [[40, 42, 43, 44], + [45, 47, 48, 49], + [50, 52, 53, 54], + [55, 57, 58, 59]]]) + + a2 = compress_nd(x, (2,)) + a3 = compress_nd(x, -1) + a4 = compress_nd(x, (-1,)) + assert_equal(a, a2) + assert_equal(a, a3) + assert_equal(a, a4) + + # axis=(0, 1) + a = compress_nd(x, (0, 1)) + assert_equal(a, [[[ 0, 1, 2, 3, 4], + [10, 11, 12, 13, 14], + [15, 16, 17, 18, 19]], + [[40, 41, 42, 43, 44], + [50, 51, 52, 53, 54], + [55, 56, 57, 58, 59]]]) + a2 = compress_nd(x, (0, -2)) + assert_equal(a, a2) + + # axis=(1, 2) + a = compress_nd(x, (1, 2)) + assert_equal(a, [[[ 0, 2, 3, 4], + [10, 12, 13, 14], + [15, 17, 18, 19]], + [[20, 22, 23, 24], + [30, 32, 33, 34], + [35, 37, 38, 39]], + [[40, 42, 43, 44], + [50, 52, 53, 54], + [55, 57, 58, 59]]]) + + a2 = compress_nd(x, (-2, 2)) + a3 = compress_nd(x, (1, -1)) + a4 = compress_nd(x, (-2, -1)) + assert_equal(a, a2) + assert_equal(a, a3) + assert_equal(a, a4) + + # axis=(0, 2) + a = compress_nd(x, (0, 2)) + assert_equal(a, [[[ 0, 2, 3, 4], + [ 5, 7, 8, 9], + [10, 12, 13, 14], + [15, 17, 18, 19]], + [[40, 42, 43, 44], + [45, 47, 48, 49], + [50, 52, 53, 54], + [55, 57, 58, 59]]]) + + a2 = compress_nd(x, (0, -1)) + assert_equal(a, a2) + + def test_compress_rowcols(self): + # Tests compress_rowcols + x = array(np.arange(9).reshape(3, 3), + mask=[[1, 0, 0], [0, 0, 0], [0, 0, 0]]) + assert_equal(compress_rowcols(x), [[4, 5], [7, 8]]) + assert_equal(compress_rowcols(x, 0), [[3, 4, 5], [6, 7, 8]]) + assert_equal(compress_rowcols(x, 1), [[1, 2], [4, 5], [7, 8]]) + x = array(x._data, mask=[[0, 0, 0], [0, 1, 0], [0, 0, 0]]) + assert_equal(compress_rowcols(x), [[0, 2], [6, 8]]) + assert_equal(compress_rowcols(x, 0), [[0, 1, 2], [6, 7, 8]]) + assert_equal(compress_rowcols(x, 1), [[0, 2], [3, 5], [6, 8]]) + x = array(x._data, mask=[[1, 0, 0], [0, 1, 0], [0, 0, 0]]) + assert_equal(compress_rowcols(x), [[8]]) + assert_equal(compress_rowcols(x, 0), [[6, 7, 8]]) + assert_equal(compress_rowcols(x, 1,), [[2], [5], [8]]) + x = array(x._data, mask=[[1, 0, 0], [0, 1, 0], [0, 0, 1]]) + assert_equal(compress_rowcols(x).size, 0) + assert_equal(compress_rowcols(x, 0).size, 0) + assert_equal(compress_rowcols(x, 1).size, 0) + + def test_mask_rowcols(self): + # Tests mask_rowcols. + x = array(np.arange(9).reshape(3, 3), + mask=[[1, 0, 0], [0, 0, 0], [0, 0, 0]]) + assert_equal(mask_rowcols(x).mask, + [[1, 1, 1], [1, 0, 0], [1, 0, 0]]) + assert_equal(mask_rowcols(x, 0).mask, + [[1, 1, 1], [0, 0, 0], [0, 0, 0]]) + assert_equal(mask_rowcols(x, 1).mask, + [[1, 0, 0], [1, 0, 0], [1, 0, 0]]) + x = array(x._data, mask=[[0, 0, 0], [0, 1, 0], [0, 0, 0]]) + assert_equal(mask_rowcols(x).mask, + [[0, 1, 0], [1, 1, 1], [0, 1, 0]]) + assert_equal(mask_rowcols(x, 0).mask, + [[0, 0, 0], [1, 1, 1], [0, 0, 0]]) + assert_equal(mask_rowcols(x, 1).mask, + [[0, 1, 0], [0, 1, 0], [0, 1, 0]]) + x = array(x._data, mask=[[1, 0, 0], [0, 1, 0], [0, 0, 0]]) + assert_equal(mask_rowcols(x).mask, + [[1, 1, 1], [1, 1, 1], [1, 1, 0]]) + assert_equal(mask_rowcols(x, 0).mask, + [[1, 1, 1], [1, 1, 1], [0, 0, 0]]) + assert_equal(mask_rowcols(x, 1,).mask, + [[1, 1, 0], [1, 1, 0], [1, 1, 0]]) + x = array(x._data, mask=[[1, 0, 0], [0, 1, 0], [0, 0, 1]]) + assert_(mask_rowcols(x).all() is masked) + assert_(mask_rowcols(x, 0).all() is masked) + assert_(mask_rowcols(x, 1).all() is masked) + assert_(mask_rowcols(x).mask.all()) + assert_(mask_rowcols(x, 0).mask.all()) + assert_(mask_rowcols(x, 1).mask.all()) + + def test_dot(self): + # Tests dot product + n = np.arange(1, 7) + # + m = [1, 0, 0, 0, 0, 0] + a = masked_array(n, mask=m).reshape(2, 3) + b = masked_array(n, mask=m).reshape(3, 2) + c = dot(a, b, strict=True) + assert_equal(c.mask, [[1, 1], [1, 0]]) + c = dot(b, a, strict=True) + assert_equal(c.mask, [[1, 1, 1], [1, 0, 0], [1, 0, 0]]) + c = dot(a, b, strict=False) + assert_equal(c, np.dot(a.filled(0), b.filled(0))) + c = dot(b, a, strict=False) + assert_equal(c, np.dot(b.filled(0), a.filled(0))) + # + m = [0, 0, 0, 0, 0, 1] + a = masked_array(n, mask=m).reshape(2, 3) + b = masked_array(n, mask=m).reshape(3, 2) + c = dot(a, b, strict=True) + assert_equal(c.mask, [[0, 1], [1, 1]]) + c = dot(b, a, strict=True) + assert_equal(c.mask, [[0, 0, 1], [0, 0, 1], [1, 1, 1]]) + c = dot(a, b, strict=False) + assert_equal(c, np.dot(a.filled(0), b.filled(0))) + assert_equal(c, dot(a, b)) + c = dot(b, a, strict=False) + assert_equal(c, np.dot(b.filled(0), a.filled(0))) + # + m = [0, 0, 0, 0, 0, 0] + a = masked_array(n, mask=m).reshape(2, 3) + b = masked_array(n, mask=m).reshape(3, 2) + c = dot(a, b) + assert_equal(c.mask, nomask) + c = dot(b, a) + assert_equal(c.mask, nomask) + # + a = masked_array(n, mask=[1, 0, 0, 0, 0, 0]).reshape(2, 3) + b = masked_array(n, mask=[0, 0, 0, 0, 0, 0]).reshape(3, 2) + c = dot(a, b, strict=True) + assert_equal(c.mask, [[1, 1], [0, 0]]) + c = dot(a, b, strict=False) + assert_equal(c, np.dot(a.filled(0), b.filled(0))) + c = dot(b, a, strict=True) + assert_equal(c.mask, [[1, 0, 0], [1, 0, 0], [1, 0, 0]]) + c = dot(b, a, strict=False) + assert_equal(c, np.dot(b.filled(0), a.filled(0))) + # + a = masked_array(n, mask=[0, 0, 0, 0, 0, 1]).reshape(2, 3) + b = masked_array(n, mask=[0, 0, 0, 0, 0, 0]).reshape(3, 2) + c = dot(a, b, strict=True) + assert_equal(c.mask, [[0, 0], [1, 1]]) + c = dot(a, b) + assert_equal(c, np.dot(a.filled(0), b.filled(0))) + c = dot(b, a, strict=True) + assert_equal(c.mask, [[0, 0, 1], [0, 0, 1], [0, 0, 1]]) + c = dot(b, a, strict=False) + assert_equal(c, np.dot(b.filled(0), a.filled(0))) + # + a = masked_array(n, mask=[0, 0, 0, 0, 0, 1]).reshape(2, 3) + b = masked_array(n, mask=[0, 0, 1, 0, 0, 0]).reshape(3, 2) + c = dot(a, b, strict=True) + assert_equal(c.mask, [[1, 0], [1, 1]]) + c = dot(a, b, strict=False) + assert_equal(c, np.dot(a.filled(0), b.filled(0))) + c = dot(b, a, strict=True) + assert_equal(c.mask, [[0, 0, 1], [1, 1, 1], [0, 0, 1]]) + c = dot(b, a, strict=False) + assert_equal(c, np.dot(b.filled(0), a.filled(0))) + + def test_dot_returns_maskedarray(self): + # See gh-6611 + a = np.eye(3) + b = array(a) + assert_(type(dot(a, a)) is MaskedArray) + assert_(type(dot(a, b)) is MaskedArray) + assert_(type(dot(b, a)) is MaskedArray) + assert_(type(dot(b, b)) is MaskedArray) + + def test_dot_out(self): + a = array(np.eye(3)) + out = array(np.zeros((3, 3))) + res = dot(a, a, out=out) + assert_(res is out) + assert_equal(a, res) + + +class TestApplyAlongAxis(object): + # Tests 2D functions + def test_3d(self): + a = arange(12.).reshape(2, 2, 3) + + def myfunc(b): + return b[1] + + xa = apply_along_axis(myfunc, 2, a) + assert_equal(xa, [[1, 4], [7, 10]]) + + # Tests kwargs functions + def test_3d_kwargs(self): + a = arange(12).reshape(2, 2, 3) + + def myfunc(b, offset=0): + return b[1+offset] + + xa = apply_along_axis(myfunc, 2, a, offset=1) + assert_equal(xa, [[2, 5], [8, 11]]) + + +class TestApplyOverAxes(object): + # Tests apply_over_axes + def test_basic(self): + a = arange(24).reshape(2, 3, 4) + test = apply_over_axes(np.sum, a, [0, 2]) + ctrl = np.array([[[60], [92], [124]]]) + assert_equal(test, ctrl) + a[(a % 2).astype(bool)] = masked + test = apply_over_axes(np.sum, a, [0, 2]) + ctrl = np.array([[[28], [44], [60]]]) + assert_equal(test, ctrl) + + +class TestMedian(object): + def test_pytype(self): + r = np.ma.median([[np.inf, np.inf], [np.inf, np.inf]], axis=-1) + assert_equal(r, np.inf) + + def test_inf(self): + # test that even which computes handles inf / x = masked + r = np.ma.median(np.ma.masked_array([[np.inf, np.inf], + [np.inf, np.inf]]), axis=-1) + assert_equal(r, np.inf) + r = np.ma.median(np.ma.masked_array([[np.inf, np.inf], + [np.inf, np.inf]]), axis=None) + assert_equal(r, np.inf) + # all masked + r = np.ma.median(np.ma.masked_array([[np.inf, np.inf], + [np.inf, np.inf]], mask=True), + axis=-1) + assert_equal(r.mask, True) + r = np.ma.median(np.ma.masked_array([[np.inf, np.inf], + [np.inf, np.inf]], mask=True), + axis=None) + assert_equal(r.mask, True) + + def test_non_masked(self): + x = np.arange(9) + assert_equal(np.ma.median(x), 4.) + assert_(type(np.ma.median(x)) is not MaskedArray) + x = range(8) + assert_equal(np.ma.median(x), 3.5) + assert_(type(np.ma.median(x)) is not MaskedArray) + x = 5 + assert_equal(np.ma.median(x), 5.) + assert_(type(np.ma.median(x)) is not MaskedArray) + # integer + x = np.arange(9 * 8).reshape(9, 8) + assert_equal(np.ma.median(x, axis=0), np.median(x, axis=0)) + assert_equal(np.ma.median(x, axis=1), np.median(x, axis=1)) + assert_(np.ma.median(x, axis=1) is not MaskedArray) + # float + x = np.arange(9 * 8.).reshape(9, 8) + assert_equal(np.ma.median(x, axis=0), np.median(x, axis=0)) + assert_equal(np.ma.median(x, axis=1), np.median(x, axis=1)) + assert_(np.ma.median(x, axis=1) is not MaskedArray) + + def test_docstring_examples(self): + "test the examples given in the docstring of ma.median" + x = array(np.arange(8), mask=[0]*4 + [1]*4) + assert_equal(np.ma.median(x), 1.5) + assert_equal(np.ma.median(x).shape, (), "shape mismatch") + assert_(type(np.ma.median(x)) is not MaskedArray) + x = array(np.arange(10).reshape(2, 5), mask=[0]*6 + [1]*4) + assert_equal(np.ma.median(x), 2.5) + assert_equal(np.ma.median(x).shape, (), "shape mismatch") + assert_(type(np.ma.median(x)) is not MaskedArray) + ma_x = np.ma.median(x, axis=-1, overwrite_input=True) + assert_equal(ma_x, [2., 5.]) + assert_equal(ma_x.shape, (2,), "shape mismatch") + assert_(type(ma_x) is MaskedArray) + + def test_axis_argument_errors(self): + msg = "mask = %s, ndim = %s, axis = %s, overwrite_input = %s" + for ndmin in range(5): + for mask in [False, True]: + x = array(1, ndmin=ndmin, mask=mask) + + # Valid axis values should not raise exception + args = itertools.product(range(-ndmin, ndmin), [False, True]) + for axis, over in args: + try: + np.ma.median(x, axis=axis, overwrite_input=over) + except Exception: + raise AssertionError(msg % (mask, ndmin, axis, over)) + + # Invalid axis values should raise exception + args = itertools.product([-(ndmin + 1), ndmin], [False, True]) + for axis, over in args: + try: + np.ma.median(x, axis=axis, overwrite_input=over) + except np.AxisError: + pass + else: + raise AssertionError(msg % (mask, ndmin, axis, over)) + + def test_masked_0d(self): + # Check values + x = array(1, mask=False) + assert_equal(np.ma.median(x), 1) + x = array(1, mask=True) + assert_equal(np.ma.median(x), np.ma.masked) + + def test_masked_1d(self): + x = array(np.arange(5), mask=True) + assert_equal(np.ma.median(x), np.ma.masked) + assert_equal(np.ma.median(x).shape, (), "shape mismatch") + assert_(type(np.ma.median(x)) is np.ma.core.MaskedConstant) + x = array(np.arange(5), mask=False) + assert_equal(np.ma.median(x), 2.) + assert_equal(np.ma.median(x).shape, (), "shape mismatch") + assert_(type(np.ma.median(x)) is not MaskedArray) + x = array(np.arange(5), mask=[0,1,0,0,0]) + assert_equal(np.ma.median(x), 2.5) + assert_equal(np.ma.median(x).shape, (), "shape mismatch") + assert_(type(np.ma.median(x)) is not MaskedArray) + x = array(np.arange(5), mask=[0,1,1,1,1]) + assert_equal(np.ma.median(x), 0.) + assert_equal(np.ma.median(x).shape, (), "shape mismatch") + assert_(type(np.ma.median(x)) is not MaskedArray) + # integer + x = array(np.arange(5), mask=[0,1,1,0,0]) + assert_equal(np.ma.median(x), 3.) + assert_equal(np.ma.median(x).shape, (), "shape mismatch") + assert_(type(np.ma.median(x)) is not MaskedArray) + # float + x = array(np.arange(5.), mask=[0,1,1,0,0]) + assert_equal(np.ma.median(x), 3.) + assert_equal(np.ma.median(x).shape, (), "shape mismatch") + assert_(type(np.ma.median(x)) is not MaskedArray) + # integer + x = array(np.arange(6), mask=[0,1,1,1,1,0]) + assert_equal(np.ma.median(x), 2.5) + assert_equal(np.ma.median(x).shape, (), "shape mismatch") + assert_(type(np.ma.median(x)) is not MaskedArray) + # float + x = array(np.arange(6.), mask=[0,1,1,1,1,0]) + assert_equal(np.ma.median(x), 2.5) + assert_equal(np.ma.median(x).shape, (), "shape mismatch") + assert_(type(np.ma.median(x)) is not MaskedArray) + + def test_1d_shape_consistency(self): + assert_equal(np.ma.median(array([1,2,3],mask=[0,0,0])).shape, + np.ma.median(array([1,2,3],mask=[0,1,0])).shape ) + + def test_2d(self): + # Tests median w/ 2D + (n, p) = (101, 30) + x = masked_array(np.linspace(-1., 1., n),) + x[:10] = x[-10:] = masked + z = masked_array(np.empty((n, p), dtype=float)) + z[:, 0] = x[:] + idx = np.arange(len(x)) + for i in range(1, p): + np.random.shuffle(idx) + z[:, i] = x[idx] + assert_equal(median(z[:, 0]), 0) + assert_equal(median(z), 0) + assert_equal(median(z, axis=0), np.zeros(p)) + assert_equal(median(z.T, axis=1), np.zeros(p)) + + def test_2d_waxis(self): + # Tests median w/ 2D arrays and different axis. + x = masked_array(np.arange(30).reshape(10, 3)) + x[:3] = x[-3:] = masked + assert_equal(median(x), 14.5) + assert_(type(np.ma.median(x)) is not MaskedArray) + assert_equal(median(x, axis=0), [13.5, 14.5, 15.5]) + assert_(type(np.ma.median(x, axis=0)) is MaskedArray) + assert_equal(median(x, axis=1), [0, 0, 0, 10, 13, 16, 19, 0, 0, 0]) + assert_(type(np.ma.median(x, axis=1)) is MaskedArray) + assert_equal(median(x, axis=1).mask, [1, 1, 1, 0, 0, 0, 0, 1, 1, 1]) + + def test_3d(self): + # Tests median w/ 3D + x = np.ma.arange(24).reshape(3, 4, 2) + x[x % 3 == 0] = masked + assert_equal(median(x, 0), [[12, 9], [6, 15], [12, 9], [18, 15]]) + x.shape = (4, 3, 2) + assert_equal(median(x, 0), [[99, 10], [11, 99], [13, 14]]) + x = np.ma.arange(24).reshape(4, 3, 2) + x[x % 5 == 0] = masked + assert_equal(median(x, 0), [[12, 10], [8, 9], [16, 17]]) + + def test_neg_axis(self): + x = masked_array(np.arange(30).reshape(10, 3)) + x[:3] = x[-3:] = masked + assert_equal(median(x, axis=-1), median(x, axis=1)) + + def test_out_1d(self): + # integer float even odd + for v in (30, 30., 31, 31.): + x = masked_array(np.arange(v)) + x[:3] = x[-3:] = masked + out = masked_array(np.ones(())) + r = median(x, out=out) + if v == 30: + assert_equal(out, 14.5) + else: + assert_equal(out, 15.) + assert_(r is out) + assert_(type(r) is MaskedArray) + + def test_out(self): + # integer float even odd + for v in (40, 40., 30, 30.): + x = masked_array(np.arange(v).reshape(10, -1)) + x[:3] = x[-3:] = masked + out = masked_array(np.ones(10)) + r = median(x, axis=1, out=out) + if v == 30: + e = masked_array([0.]*3 + [10, 13, 16, 19] + [0.]*3, + mask=[True] * 3 + [False] * 4 + [True] * 3) + else: + e = masked_array([0.]*3 + [13.5, 17.5, 21.5, 25.5] + [0.]*3, + mask=[True]*3 + [False]*4 + [True]*3) + assert_equal(r, e) + assert_(r is out) + assert_(type(r) is MaskedArray) + + def test_single_non_masked_value_on_axis(self): + data = [[1., 0.], + [0., 3.], + [0., 0.]] + masked_arr = np.ma.masked_equal(data, 0) + expected = [1., 3.] + assert_array_equal(np.ma.median(masked_arr, axis=0), + expected) + + def test_nan(self): + with suppress_warnings() as w: + w.record(RuntimeWarning) + for mask in (False, np.zeros(6, dtype=bool)): + dm = np.ma.array([[1, np.nan, 3], [1, 2, 3]]) + dm.mask = mask + + # scalar result + r = np.ma.median(dm, axis=None) + assert_(np.isscalar(r)) + assert_array_equal(r, np.nan) + r = np.ma.median(dm.ravel(), axis=0) + assert_(np.isscalar(r)) + assert_array_equal(r, np.nan) + + r = np.ma.median(dm, axis=0) + assert_equal(type(r), MaskedArray) + assert_array_equal(r, [1, np.nan, 3]) + r = np.ma.median(dm, axis=1) + assert_equal(type(r), MaskedArray) + assert_array_equal(r, [np.nan, 2]) + r = np.ma.median(dm, axis=-1) + assert_equal(type(r), MaskedArray) + assert_array_equal(r, [np.nan, 2]) + + dm = np.ma.array([[1, np.nan, 3], [1, 2, 3]]) + dm[:, 2] = np.ma.masked + assert_array_equal(np.ma.median(dm, axis=None), np.nan) + assert_array_equal(np.ma.median(dm, axis=0), [1, np.nan, 3]) + assert_array_equal(np.ma.median(dm, axis=1), [np.nan, 1.5]) + assert_equal([x.category is RuntimeWarning for x in w.log], + [True]*13) + + def test_out_nan(self): + with warnings.catch_warnings(record=True): + warnings.filterwarnings('always', '', RuntimeWarning) + o = np.ma.masked_array(np.zeros((4,))) + d = np.ma.masked_array(np.ones((3, 4))) + d[2, 1] = np.nan + d[2, 2] = np.ma.masked + assert_equal(np.ma.median(d, 0, out=o), o) + o = np.ma.masked_array(np.zeros((3,))) + assert_equal(np.ma.median(d, 1, out=o), o) + o = np.ma.masked_array(np.zeros(())) + assert_equal(np.ma.median(d, out=o), o) + + def test_nan_behavior(self): + a = np.ma.masked_array(np.arange(24, dtype=float)) + a[::3] = np.ma.masked + a[2] = np.nan + with suppress_warnings() as w: + w.record(RuntimeWarning) + assert_array_equal(np.ma.median(a), np.nan) + assert_array_equal(np.ma.median(a, axis=0), np.nan) + assert_(w.log[0].category is RuntimeWarning) + assert_(w.log[1].category is RuntimeWarning) + + a = np.ma.masked_array(np.arange(24, dtype=float).reshape(2, 3, 4)) + a.mask = np.arange(a.size) % 2 == 1 + aorig = a.copy() + a[1, 2, 3] = np.nan + a[1, 1, 2] = np.nan + + # no axis + with suppress_warnings() as w: + w.record(RuntimeWarning) + warnings.filterwarnings('always', '', RuntimeWarning) + assert_array_equal(np.ma.median(a), np.nan) + assert_(np.isscalar(np.ma.median(a))) + assert_(w.log[0].category is RuntimeWarning) + + # axis0 + b = np.ma.median(aorig, axis=0) + b[2, 3] = np.nan + b[1, 2] = np.nan + with warnings.catch_warnings(record=True) as w: + warnings.filterwarnings('always', '', RuntimeWarning) + assert_equal(np.ma.median(a, 0), b) + assert_equal(len(w), 1) + + # axis1 + b = np.ma.median(aorig, axis=1) + b[1, 3] = np.nan + b[1, 2] = np.nan + with warnings.catch_warnings(record=True) as w: + warnings.filterwarnings('always', '', RuntimeWarning) + assert_equal(np.ma.median(a, 1), b) + assert_equal(len(w), 1) + + # axis02 + b = np.ma.median(aorig, axis=(0, 2)) + b[1] = np.nan + b[2] = np.nan + with warnings.catch_warnings(record=True) as w: + warnings.filterwarnings('always', '', RuntimeWarning) + assert_equal(np.ma.median(a, (0, 2)), b) + assert_equal(len(w), 1) + + def test_ambigous_fill(self): + # 255 is max value, used as filler for sort + a = np.array([[3, 3, 255], [3, 3, 255]], dtype=np.uint8) + a = np.ma.masked_array(a, mask=a == 3) + assert_array_equal(np.ma.median(a, axis=1), 255) + assert_array_equal(np.ma.median(a, axis=1).mask, False) + assert_array_equal(np.ma.median(a, axis=0), a[0]) + assert_array_equal(np.ma.median(a), 255) + + def test_special(self): + for inf in [np.inf, -np.inf]: + a = np.array([[inf, np.nan], [np.nan, np.nan]]) + a = np.ma.masked_array(a, mask=np.isnan(a)) + assert_equal(np.ma.median(a, axis=0), [inf, np.nan]) + assert_equal(np.ma.median(a, axis=1), [inf, np.nan]) + assert_equal(np.ma.median(a), inf) + + a = np.array([[np.nan, np.nan, inf], [np.nan, np.nan, inf]]) + a = np.ma.masked_array(a, mask=np.isnan(a)) + assert_array_equal(np.ma.median(a, axis=1), inf) + assert_array_equal(np.ma.median(a, axis=1).mask, False) + assert_array_equal(np.ma.median(a, axis=0), a[0]) + assert_array_equal(np.ma.median(a), inf) + + # no mask + a = np.array([[inf, inf], [inf, inf]]) + assert_equal(np.ma.median(a), inf) + assert_equal(np.ma.median(a, axis=0), inf) + assert_equal(np.ma.median(a, axis=1), inf) + + a = np.array([[inf, 7, -inf, -9], + [-10, np.nan, np.nan, 5], + [4, np.nan, np.nan, inf]], + dtype=np.float32) + a = np.ma.masked_array(a, mask=np.isnan(a)) + if inf > 0: + assert_equal(np.ma.median(a, axis=0), [4., 7., -inf, 5.]) + assert_equal(np.ma.median(a), 4.5) + else: + assert_equal(np.ma.median(a, axis=0), [-10., 7., -inf, -9.]) + assert_equal(np.ma.median(a), -2.5) + assert_equal(np.ma.median(a, axis=1), [-1., -2.5, inf]) + + for i in range(0, 10): + for j in range(1, 10): + a = np.array([([np.nan] * i) + ([inf] * j)] * 2) + a = np.ma.masked_array(a, mask=np.isnan(a)) + assert_equal(np.ma.median(a), inf) + assert_equal(np.ma.median(a, axis=1), inf) + assert_equal(np.ma.median(a, axis=0), + ([np.nan] * i) + [inf] * j) + + def test_empty(self): + # empty arrays + a = np.ma.masked_array(np.array([], dtype=float)) + with suppress_warnings() as w: + w.record(RuntimeWarning) + assert_array_equal(np.ma.median(a), np.nan) + assert_(w.log[0].category is RuntimeWarning) + + # multiple dimensions + a = np.ma.masked_array(np.array([], dtype=float, ndmin=3)) + # no axis + with suppress_warnings() as w: + w.record(RuntimeWarning) + warnings.filterwarnings('always', '', RuntimeWarning) + assert_array_equal(np.ma.median(a), np.nan) + assert_(w.log[0].category is RuntimeWarning) + + # axis 0 and 1 + b = np.ma.masked_array(np.array([], dtype=float, ndmin=2)) + assert_equal(np.ma.median(a, axis=0), b) + assert_equal(np.ma.median(a, axis=1), b) + + # axis 2 + b = np.ma.masked_array(np.array(np.nan, dtype=float, ndmin=2)) + with warnings.catch_warnings(record=True) as w: + warnings.filterwarnings('always', '', RuntimeWarning) + assert_equal(np.ma.median(a, axis=2), b) + assert_(w[0].category is RuntimeWarning) + + def test_object(self): + o = np.ma.masked_array(np.arange(7.)) + assert_(type(np.ma.median(o.astype(object))), float) + o[2] = np.nan + assert_(type(np.ma.median(o.astype(object))), float) + + +class TestCov(object): + + def setup(self): + self.data = array(np.random.rand(12)) + + def test_1d_without_missing(self): + # Test cov on 1D variable w/o missing values + x = self.data + assert_almost_equal(np.cov(x), cov(x)) + assert_almost_equal(np.cov(x, rowvar=False), cov(x, rowvar=False)) + assert_almost_equal(np.cov(x, rowvar=False, bias=True), + cov(x, rowvar=False, bias=True)) + + def test_2d_without_missing(self): + # Test cov on 1 2D variable w/o missing values + x = self.data.reshape(3, 4) + assert_almost_equal(np.cov(x), cov(x)) + assert_almost_equal(np.cov(x, rowvar=False), cov(x, rowvar=False)) + assert_almost_equal(np.cov(x, rowvar=False, bias=True), + cov(x, rowvar=False, bias=True)) + + def test_1d_with_missing(self): + # Test cov 1 1D variable w/missing values + x = self.data + x[-1] = masked + x -= x.mean() + nx = x.compressed() + assert_almost_equal(np.cov(nx), cov(x)) + assert_almost_equal(np.cov(nx, rowvar=False), cov(x, rowvar=False)) + assert_almost_equal(np.cov(nx, rowvar=False, bias=True), + cov(x, rowvar=False, bias=True)) + # + try: + cov(x, allow_masked=False) + except ValueError: + pass + # + # 2 1D variables w/ missing values + nx = x[1:-1] + assert_almost_equal(np.cov(nx, nx[::-1]), cov(x, x[::-1])) + assert_almost_equal(np.cov(nx, nx[::-1], rowvar=False), + cov(x, x[::-1], rowvar=False)) + assert_almost_equal(np.cov(nx, nx[::-1], rowvar=False, bias=True), + cov(x, x[::-1], rowvar=False, bias=True)) + + def test_2d_with_missing(self): + # Test cov on 2D variable w/ missing value + x = self.data + x[-1] = masked + x = x.reshape(3, 4) + valid = np.logical_not(getmaskarray(x)).astype(int) + frac = np.dot(valid, valid.T) + xf = (x - x.mean(1)[:, None]).filled(0) + assert_almost_equal(cov(x), + np.cov(xf) * (x.shape[1] - 1) / (frac - 1.)) + assert_almost_equal(cov(x, bias=True), + np.cov(xf, bias=True) * x.shape[1] / frac) + frac = np.dot(valid.T, valid) + xf = (x - x.mean(0)).filled(0) + assert_almost_equal(cov(x, rowvar=False), + (np.cov(xf, rowvar=False) * + (x.shape[0] - 1) / (frac - 1.))) + assert_almost_equal(cov(x, rowvar=False, bias=True), + (np.cov(xf, rowvar=False, bias=True) * + x.shape[0] / frac)) + + +class TestCorrcoef(object): + + def setup(self): + self.data = array(np.random.rand(12)) + self.data2 = array(np.random.rand(12)) + + def test_ddof(self): + # ddof raises DeprecationWarning + x, y = self.data, self.data2 + expected = np.corrcoef(x) + expected2 = np.corrcoef(x, y) + with suppress_warnings() as sup: + warnings.simplefilter("always") + assert_warns(DeprecationWarning, corrcoef, x, ddof=-1) + sup.filter(DeprecationWarning, "bias and ddof have no effect") + # ddof has no or negligible effect on the function + assert_almost_equal(np.corrcoef(x, ddof=0), corrcoef(x, ddof=0)) + assert_almost_equal(corrcoef(x, ddof=-1), expected) + assert_almost_equal(corrcoef(x, y, ddof=-1), expected2) + assert_almost_equal(corrcoef(x, ddof=3), expected) + assert_almost_equal(corrcoef(x, y, ddof=3), expected2) + + def test_bias(self): + x, y = self.data, self.data2 + expected = np.corrcoef(x) + # bias raises DeprecationWarning + with suppress_warnings() as sup: + warnings.simplefilter("always") + assert_warns(DeprecationWarning, corrcoef, x, y, True, False) + assert_warns(DeprecationWarning, corrcoef, x, y, True, True) + assert_warns(DeprecationWarning, corrcoef, x, bias=False) + sup.filter(DeprecationWarning, "bias and ddof have no effect") + # bias has no or negligible effect on the function + assert_almost_equal(corrcoef(x, bias=1), expected) + + def test_1d_without_missing(self): + # Test cov on 1D variable w/o missing values + x = self.data + assert_almost_equal(np.corrcoef(x), corrcoef(x)) + assert_almost_equal(np.corrcoef(x, rowvar=False), + corrcoef(x, rowvar=False)) + with suppress_warnings() as sup: + sup.filter(DeprecationWarning, "bias and ddof have no effect") + assert_almost_equal(np.corrcoef(x, rowvar=False, bias=True), + corrcoef(x, rowvar=False, bias=True)) + + def test_2d_without_missing(self): + # Test corrcoef on 1 2D variable w/o missing values + x = self.data.reshape(3, 4) + assert_almost_equal(np.corrcoef(x), corrcoef(x)) + assert_almost_equal(np.corrcoef(x, rowvar=False), + corrcoef(x, rowvar=False)) + with suppress_warnings() as sup: + sup.filter(DeprecationWarning, "bias and ddof have no effect") + assert_almost_equal(np.corrcoef(x, rowvar=False, bias=True), + corrcoef(x, rowvar=False, bias=True)) + + def test_1d_with_missing(self): + # Test corrcoef 1 1D variable w/missing values + x = self.data + x[-1] = masked + x -= x.mean() + nx = x.compressed() + assert_almost_equal(np.corrcoef(nx), corrcoef(x)) + assert_almost_equal(np.corrcoef(nx, rowvar=False), + corrcoef(x, rowvar=False)) + with suppress_warnings() as sup: + sup.filter(DeprecationWarning, "bias and ddof have no effect") + assert_almost_equal(np.corrcoef(nx, rowvar=False, bias=True), + corrcoef(x, rowvar=False, bias=True)) + try: + corrcoef(x, allow_masked=False) + except ValueError: + pass + # 2 1D variables w/ missing values + nx = x[1:-1] + assert_almost_equal(np.corrcoef(nx, nx[::-1]), corrcoef(x, x[::-1])) + assert_almost_equal(np.corrcoef(nx, nx[::-1], rowvar=False), + corrcoef(x, x[::-1], rowvar=False)) + with suppress_warnings() as sup: + sup.filter(DeprecationWarning, "bias and ddof have no effect") + # ddof and bias have no or negligible effect on the function + assert_almost_equal(np.corrcoef(nx, nx[::-1]), + corrcoef(x, x[::-1], bias=1)) + assert_almost_equal(np.corrcoef(nx, nx[::-1]), + corrcoef(x, x[::-1], ddof=2)) + + def test_2d_with_missing(self): + # Test corrcoef on 2D variable w/ missing value + x = self.data + x[-1] = masked + x = x.reshape(3, 4) + + test = corrcoef(x) + control = np.corrcoef(x) + assert_almost_equal(test[:-1, :-1], control[:-1, :-1]) + with suppress_warnings() as sup: + sup.filter(DeprecationWarning, "bias and ddof have no effect") + # ddof and bias have no or negligible effect on the function + assert_almost_equal(corrcoef(x, ddof=-2)[:-1, :-1], + control[:-1, :-1]) + assert_almost_equal(corrcoef(x, ddof=3)[:-1, :-1], + control[:-1, :-1]) + assert_almost_equal(corrcoef(x, bias=1)[:-1, :-1], + control[:-1, :-1]) + + +class TestPolynomial(object): + # + def test_polyfit(self): + # Tests polyfit + # On ndarrays + x = np.random.rand(10) + y = np.random.rand(20).reshape(-1, 2) + assert_almost_equal(polyfit(x, y, 3), np.polyfit(x, y, 3)) + # ON 1D maskedarrays + x = x.view(MaskedArray) + x[0] = masked + y = y.view(MaskedArray) + y[0, 0] = y[-1, -1] = masked + # + (C, R, K, S, D) = polyfit(x, y[:, 0], 3, full=True) + (c, r, k, s, d) = np.polyfit(x[1:], y[1:, 0].compressed(), 3, + full=True) + for (a, a_) in zip((C, R, K, S, D), (c, r, k, s, d)): + assert_almost_equal(a, a_) + # + (C, R, K, S, D) = polyfit(x, y[:, -1], 3, full=True) + (c, r, k, s, d) = np.polyfit(x[1:-1], y[1:-1, -1], 3, full=True) + for (a, a_) in zip((C, R, K, S, D), (c, r, k, s, d)): + assert_almost_equal(a, a_) + # + (C, R, K, S, D) = polyfit(x, y, 3, full=True) + (c, r, k, s, d) = np.polyfit(x[1:-1], y[1:-1,:], 3, full=True) + for (a, a_) in zip((C, R, K, S, D), (c, r, k, s, d)): + assert_almost_equal(a, a_) + # + w = np.random.rand(10) + 1 + wo = w.copy() + xs = x[1:-1] + ys = y[1:-1] + ws = w[1:-1] + (C, R, K, S, D) = polyfit(x, y, 3, full=True, w=w) + (c, r, k, s, d) = np.polyfit(xs, ys, 3, full=True, w=ws) + assert_equal(w, wo) + for (a, a_) in zip((C, R, K, S, D), (c, r, k, s, d)): + assert_almost_equal(a, a_) + + def test_polyfit_with_masked_NaNs(self): + x = np.random.rand(10) + y = np.random.rand(20).reshape(-1, 2) + + x[0] = np.nan + y[-1,-1] = np.nan + x = x.view(MaskedArray) + y = y.view(MaskedArray) + x[0] = masked + y[-1,-1] = masked + + (C, R, K, S, D) = polyfit(x, y, 3, full=True) + (c, r, k, s, d) = np.polyfit(x[1:-1], y[1:-1,:], 3, full=True) + for (a, a_) in zip((C, R, K, S, D), (c, r, k, s, d)): + assert_almost_equal(a, a_) + + +class TestArraySetOps(object): + + def test_unique_onlist(self): + # Test unique on list + data = [1, 1, 1, 2, 2, 3] + test = unique(data, return_index=True, return_inverse=True) + assert_(isinstance(test[0], MaskedArray)) + assert_equal(test[0], masked_array([1, 2, 3], mask=[0, 0, 0])) + assert_equal(test[1], [0, 3, 5]) + assert_equal(test[2], [0, 0, 0, 1, 1, 2]) + + def test_unique_onmaskedarray(self): + # Test unique on masked data w/use_mask=True + data = masked_array([1, 1, 1, 2, 2, 3], mask=[0, 0, 1, 0, 1, 0]) + test = unique(data, return_index=True, return_inverse=True) + assert_equal(test[0], masked_array([1, 2, 3, -1], mask=[0, 0, 0, 1])) + assert_equal(test[1], [0, 3, 5, 2]) + assert_equal(test[2], [0, 0, 3, 1, 3, 2]) + # + data.fill_value = 3 + data = masked_array(data=[1, 1, 1, 2, 2, 3], + mask=[0, 0, 1, 0, 1, 0], fill_value=3) + test = unique(data, return_index=True, return_inverse=True) + assert_equal(test[0], masked_array([1, 2, 3, -1], mask=[0, 0, 0, 1])) + assert_equal(test[1], [0, 3, 5, 2]) + assert_equal(test[2], [0, 0, 3, 1, 3, 2]) + + def test_unique_allmasked(self): + # Test all masked + data = masked_array([1, 1, 1], mask=True) + test = unique(data, return_index=True, return_inverse=True) + assert_equal(test[0], masked_array([1, ], mask=[True])) + assert_equal(test[1], [0]) + assert_equal(test[2], [0, 0, 0]) + # + # Test masked + data = masked + test = unique(data, return_index=True, return_inverse=True) + assert_equal(test[0], masked_array(masked)) + assert_equal(test[1], [0]) + assert_equal(test[2], [0]) + + def test_ediff1d(self): + # Tests mediff1d + x = masked_array(np.arange(5), mask=[1, 0, 0, 0, 1]) + control = array([1, 1, 1, 4], mask=[1, 0, 0, 1]) + test = ediff1d(x) + assert_equal(test, control) + assert_equal(test.filled(0), control.filled(0)) + assert_equal(test.mask, control.mask) + + def test_ediff1d_tobegin(self): + # Test ediff1d w/ to_begin + x = masked_array(np.arange(5), mask=[1, 0, 0, 0, 1]) + test = ediff1d(x, to_begin=masked) + control = array([0, 1, 1, 1, 4], mask=[1, 1, 0, 0, 1]) + assert_equal(test, control) + assert_equal(test.filled(0), control.filled(0)) + assert_equal(test.mask, control.mask) + # + test = ediff1d(x, to_begin=[1, 2, 3]) + control = array([1, 2, 3, 1, 1, 1, 4], mask=[0, 0, 0, 1, 0, 0, 1]) + assert_equal(test, control) + assert_equal(test.filled(0), control.filled(0)) + assert_equal(test.mask, control.mask) + + def test_ediff1d_toend(self): + # Test ediff1d w/ to_end + x = masked_array(np.arange(5), mask=[1, 0, 0, 0, 1]) + test = ediff1d(x, to_end=masked) + control = array([1, 1, 1, 4, 0], mask=[1, 0, 0, 1, 1]) + assert_equal(test, control) + assert_equal(test.filled(0), control.filled(0)) + assert_equal(test.mask, control.mask) + # + test = ediff1d(x, to_end=[1, 2, 3]) + control = array([1, 1, 1, 4, 1, 2, 3], mask=[1, 0, 0, 1, 0, 0, 0]) + assert_equal(test, control) + assert_equal(test.filled(0), control.filled(0)) + assert_equal(test.mask, control.mask) + + def test_ediff1d_tobegin_toend(self): + # Test ediff1d w/ to_begin and to_end + x = masked_array(np.arange(5), mask=[1, 0, 0, 0, 1]) + test = ediff1d(x, to_end=masked, to_begin=masked) + control = array([0, 1, 1, 1, 4, 0], mask=[1, 1, 0, 0, 1, 1]) + assert_equal(test, control) + assert_equal(test.filled(0), control.filled(0)) + assert_equal(test.mask, control.mask) + # + test = ediff1d(x, to_end=[1, 2, 3], to_begin=masked) + control = array([0, 1, 1, 1, 4, 1, 2, 3], + mask=[1, 1, 0, 0, 1, 0, 0, 0]) + assert_equal(test, control) + assert_equal(test.filled(0), control.filled(0)) + assert_equal(test.mask, control.mask) + + def test_ediff1d_ndarray(self): + # Test ediff1d w/ a ndarray + x = np.arange(5) + test = ediff1d(x) + control = array([1, 1, 1, 1], mask=[0, 0, 0, 0]) + assert_equal(test, control) + assert_(isinstance(test, MaskedArray)) + assert_equal(test.filled(0), control.filled(0)) + assert_equal(test.mask, control.mask) + # + test = ediff1d(x, to_end=masked, to_begin=masked) + control = array([0, 1, 1, 1, 1, 0], mask=[1, 0, 0, 0, 0, 1]) + assert_(isinstance(test, MaskedArray)) + assert_equal(test.filled(0), control.filled(0)) + assert_equal(test.mask, control.mask) + + def test_intersect1d(self): + # Test intersect1d + x = array([1, 3, 3, 3], mask=[0, 0, 0, 1]) + y = array([3, 1, 1, 1], mask=[0, 0, 0, 1]) + test = intersect1d(x, y) + control = array([1, 3, -1], mask=[0, 0, 1]) + assert_equal(test, control) + + def test_setxor1d(self): + # Test setxor1d + a = array([1, 2, 5, 7, -1], mask=[0, 0, 0, 0, 1]) + b = array([1, 2, 3, 4, 5, -1], mask=[0, 0, 0, 0, 0, 1]) + test = setxor1d(a, b) + assert_equal(test, array([3, 4, 7])) + # + a = array([1, 2, 5, 7, -1], mask=[0, 0, 0, 0, 1]) + b = [1, 2, 3, 4, 5] + test = setxor1d(a, b) + assert_equal(test, array([3, 4, 7, -1], mask=[0, 0, 0, 1])) + # + a = array([1, 2, 3]) + b = array([6, 5, 4]) + test = setxor1d(a, b) + assert_(isinstance(test, MaskedArray)) + assert_equal(test, [1, 2, 3, 4, 5, 6]) + # + a = array([1, 8, 2, 3], mask=[0, 1, 0, 0]) + b = array([6, 5, 4, 8], mask=[0, 0, 0, 1]) + test = setxor1d(a, b) + assert_(isinstance(test, MaskedArray)) + assert_equal(test, [1, 2, 3, 4, 5, 6]) + # + assert_array_equal([], setxor1d([], [])) + + def test_isin(self): + # the tests for in1d cover most of isin's behavior + # if in1d is removed, would need to change those tests to test + # isin instead. + a = np.arange(24).reshape([2, 3, 4]) + mask = np.zeros([2, 3, 4]) + mask[1, 2, 0] = 1 + a = array(a, mask=mask) + b = array(data=[0, 10, 20, 30, 1, 3, 11, 22, 33], + mask=[0, 1, 0, 1, 0, 1, 0, 1, 0]) + ec = zeros((2, 3, 4), dtype=bool) + ec[0, 0, 0] = True + ec[0, 0, 1] = True + ec[0, 2, 3] = True + c = isin(a, b) + assert_(isinstance(c, MaskedArray)) + assert_array_equal(c, ec) + #compare results of np.isin to ma.isin + d = np.isin(a, b[~b.mask]) & ~a.mask + assert_array_equal(c, d) + + def test_in1d(self): + # Test in1d + a = array([1, 2, 5, 7, -1], mask=[0, 0, 0, 0, 1]) + b = array([1, 2, 3, 4, 5, -1], mask=[0, 0, 0, 0, 0, 1]) + test = in1d(a, b) + assert_equal(test, [True, True, True, False, True]) + # + a = array([5, 5, 2, 1, -1], mask=[0, 0, 0, 0, 1]) + b = array([1, 5, -1], mask=[0, 0, 1]) + test = in1d(a, b) + assert_equal(test, [True, True, False, True, True]) + # + assert_array_equal([], in1d([], [])) + + def test_in1d_invert(self): + # Test in1d's invert parameter + a = array([1, 2, 5, 7, -1], mask=[0, 0, 0, 0, 1]) + b = array([1, 2, 3, 4, 5, -1], mask=[0, 0, 0, 0, 0, 1]) + assert_equal(np.invert(in1d(a, b)), in1d(a, b, invert=True)) + + a = array([5, 5, 2, 1, -1], mask=[0, 0, 0, 0, 1]) + b = array([1, 5, -1], mask=[0, 0, 1]) + assert_equal(np.invert(in1d(a, b)), in1d(a, b, invert=True)) + + assert_array_equal([], in1d([], [], invert=True)) + + def test_union1d(self): + # Test union1d + a = array([1, 2, 5, 7, 5, -1], mask=[0, 0, 0, 0, 0, 1]) + b = array([1, 2, 3, 4, 5, -1], mask=[0, 0, 0, 0, 0, 1]) + test = union1d(a, b) + control = array([1, 2, 3, 4, 5, 7, -1], mask=[0, 0, 0, 0, 0, 0, 1]) + assert_equal(test, control) + + # Tests gh-10340, arguments to union1d should be + # flattened if they are not already 1D + x = array([[0, 1, 2], [3, 4, 5]], mask=[[0, 0, 0], [0, 0, 1]]) + y = array([0, 1, 2, 3, 4], mask=[0, 0, 0, 0, 1]) + ez = array([0, 1, 2, 3, 4, 5], mask=[0, 0, 0, 0, 0, 1]) + z = union1d(x, y) + assert_equal(z, ez) + # + assert_array_equal([], union1d([], [])) + + def test_setdiff1d(self): + # Test setdiff1d + a = array([6, 5, 4, 7, 7, 1, 2, 1], mask=[0, 0, 0, 0, 0, 0, 0, 1]) + b = array([2, 4, 3, 3, 2, 1, 5]) + test = setdiff1d(a, b) + assert_equal(test, array([6, 7, -1], mask=[0, 0, 1])) + # + a = arange(10) + b = arange(8) + assert_equal(setdiff1d(a, b), array([8, 9])) + a = array([], np.uint32, mask=[]) + assert_equal(setdiff1d(a, []).dtype, np.uint32) + + def test_setdiff1d_char_array(self): + # Test setdiff1d_charray + a = np.array(['a', 'b', 'c']) + b = np.array(['a', 'b', 's']) + assert_array_equal(setdiff1d(a, b), np.array(['c'])) + + +class TestShapeBase(object): + + def test_atleast_2d(self): + # Test atleast_2d + a = masked_array([0, 1, 2], mask=[0, 1, 0]) + b = atleast_2d(a) + assert_equal(b.shape, (1, 3)) + assert_equal(b.mask.shape, b.data.shape) + assert_equal(a.shape, (3,)) + assert_equal(a.mask.shape, a.data.shape) + assert_equal(b.mask.shape, b.data.shape) + + def test_shape_scalar(self): + # the atleast and diagflat function should work with scalars + # GitHub issue #3367 + # Additionally, the atleast functions should accept multiple scalars + # correctly + b = atleast_1d(1.0) + assert_equal(b.shape, (1,)) + assert_equal(b.mask.shape, b.shape) + assert_equal(b.data.shape, b.shape) + + b = atleast_1d(1.0, 2.0) + for a in b: + assert_equal(a.shape, (1,)) + assert_equal(a.mask.shape, a.shape) + assert_equal(a.data.shape, a.shape) + + b = atleast_2d(1.0) + assert_equal(b.shape, (1, 1)) + assert_equal(b.mask.shape, b.shape) + assert_equal(b.data.shape, b.shape) + + b = atleast_2d(1.0, 2.0) + for a in b: + assert_equal(a.shape, (1, 1)) + assert_equal(a.mask.shape, a.shape) + assert_equal(a.data.shape, a.shape) + + b = atleast_3d(1.0) + assert_equal(b.shape, (1, 1, 1)) + assert_equal(b.mask.shape, b.shape) + assert_equal(b.data.shape, b.shape) + + b = atleast_3d(1.0, 2.0) + for a in b: + assert_equal(a.shape, (1, 1, 1)) + assert_equal(a.mask.shape, a.shape) + assert_equal(a.data.shape, a.shape) + + + b = diagflat(1.0) + assert_equal(b.shape, (1, 1)) + assert_equal(b.mask.shape, b.data.shape) + + +class TestStack(object): + + def test_stack_1d(self): + a = masked_array([0, 1, 2], mask=[0, 1, 0]) + b = masked_array([9, 8, 7], mask=[1, 0, 0]) + + c = stack([a, b], axis=0) + assert_equal(c.shape, (2, 3)) + assert_array_equal(a.mask, c[0].mask) + assert_array_equal(b.mask, c[1].mask) + + d = vstack([a, b]) + assert_array_equal(c.data, d.data) + assert_array_equal(c.mask, d.mask) + + c = stack([a, b], axis=1) + assert_equal(c.shape, (3, 2)) + assert_array_equal(a.mask, c[:, 0].mask) + assert_array_equal(b.mask, c[:, 1].mask) + + def test_stack_masks(self): + a = masked_array([0, 1, 2], mask=True) + b = masked_array([9, 8, 7], mask=False) + + c = stack([a, b], axis=0) + assert_equal(c.shape, (2, 3)) + assert_array_equal(a.mask, c[0].mask) + assert_array_equal(b.mask, c[1].mask) + + d = vstack([a, b]) + assert_array_equal(c.data, d.data) + assert_array_equal(c.mask, d.mask) + + c = stack([a, b], axis=1) + assert_equal(c.shape, (3, 2)) + assert_array_equal(a.mask, c[:, 0].mask) + assert_array_equal(b.mask, c[:, 1].mask) + + def test_stack_nd(self): + # 2D + shp = (3, 2) + d1 = np.random.randint(0, 10, shp) + d2 = np.random.randint(0, 10, shp) + m1 = np.random.randint(0, 2, shp).astype(bool) + m2 = np.random.randint(0, 2, shp).astype(bool) + a1 = masked_array(d1, mask=m1) + a2 = masked_array(d2, mask=m2) + + c = stack([a1, a2], axis=0) + c_shp = (2,) + shp + assert_equal(c.shape, c_shp) + assert_array_equal(a1.mask, c[0].mask) + assert_array_equal(a2.mask, c[1].mask) + + c = stack([a1, a2], axis=-1) + c_shp = shp + (2,) + assert_equal(c.shape, c_shp) + assert_array_equal(a1.mask, c[..., 0].mask) + assert_array_equal(a2.mask, c[..., 1].mask) + + # 4D + shp = (3, 2, 4, 5,) + d1 = np.random.randint(0, 10, shp) + d2 = np.random.randint(0, 10, shp) + m1 = np.random.randint(0, 2, shp).astype(bool) + m2 = np.random.randint(0, 2, shp).astype(bool) + a1 = masked_array(d1, mask=m1) + a2 = masked_array(d2, mask=m2) + + c = stack([a1, a2], axis=0) + c_shp = (2,) + shp + assert_equal(c.shape, c_shp) + assert_array_equal(a1.mask, c[0].mask) + assert_array_equal(a2.mask, c[1].mask) + + c = stack([a1, a2], axis=-1) + c_shp = shp + (2,) + assert_equal(c.shape, c_shp) + assert_array_equal(a1.mask, c[..., 0].mask) + assert_array_equal(a2.mask, c[..., 1].mask) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/ma/tests/test_mrecords.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/ma/tests/test_mrecords.py new file mode 100644 index 0000000000000000000000000000000000000000..dbbf1c8a1e8b8c0a2f88388aebb96d16fd48cf50 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/ma/tests/test_mrecords.py @@ -0,0 +1,495 @@ +# pylint: disable-msg=W0611, W0612, W0511,R0201 +"""Tests suite for mrecords. + +:author: Pierre Gerard-Marchant +:contact: pierregm_at_uga_dot_edu + +""" +from __future__ import division, absolute_import, print_function + +import numpy as np +import numpy.ma as ma +from numpy import recarray +from numpy.ma import masked, nomask +from numpy.testing import temppath +from numpy.core.records import ( + fromrecords as recfromrecords, fromarrays as recfromarrays + ) +from numpy.ma.mrecords import ( + MaskedRecords, mrecarray, fromarrays, fromtextfile, fromrecords, + addfield + ) +from numpy.ma.testutils import ( + assert_, assert_equal, + assert_equal_records, + ) +from numpy.core.numeric import pickle + + +class TestMRecords(object): + + ilist = [1, 2, 3, 4, 5] + flist = [1.1, 2.2, 3.3, 4.4, 5.5] + slist = [b'one', b'two', b'three', b'four', b'five'] + ddtype = [('a', int), ('b', float), ('c', '|S8')] + mask = [0, 1, 0, 0, 1] + base = ma.array(list(zip(ilist, flist, slist)), mask=mask, dtype=ddtype) + + def test_byview(self): + # Test creation by view + base = self.base + mbase = base.view(mrecarray) + assert_equal(mbase.recordmask, base.recordmask) + assert_equal_records(mbase._mask, base._mask) + assert_(isinstance(mbase._data, recarray)) + assert_equal_records(mbase._data, base._data.view(recarray)) + for field in ('a', 'b', 'c'): + assert_equal(base[field], mbase[field]) + assert_equal_records(mbase.view(mrecarray), mbase) + + def test_get(self): + # Tests fields retrieval + base = self.base.copy() + mbase = base.view(mrecarray) + # As fields.......... + for field in ('a', 'b', 'c'): + assert_equal(getattr(mbase, field), mbase[field]) + assert_equal(base[field], mbase[field]) + # as elements ....... + mbase_first = mbase[0] + assert_(isinstance(mbase_first, mrecarray)) + assert_equal(mbase_first.dtype, mbase.dtype) + assert_equal(mbase_first.tolist(), (1, 1.1, b'one')) + # Used to be mask, now it's recordmask + assert_equal(mbase_first.recordmask, nomask) + assert_equal(mbase_first._mask.item(), (False, False, False)) + assert_equal(mbase_first['a'], mbase['a'][0]) + mbase_last = mbase[-1] + assert_(isinstance(mbase_last, mrecarray)) + assert_equal(mbase_last.dtype, mbase.dtype) + assert_equal(mbase_last.tolist(), (None, None, None)) + # Used to be mask, now it's recordmask + assert_equal(mbase_last.recordmask, True) + assert_equal(mbase_last._mask.item(), (True, True, True)) + assert_equal(mbase_last['a'], mbase['a'][-1]) + assert_((mbase_last['a'] is masked)) + # as slice .......... + mbase_sl = mbase[:2] + assert_(isinstance(mbase_sl, mrecarray)) + assert_equal(mbase_sl.dtype, mbase.dtype) + # Used to be mask, now it's recordmask + assert_equal(mbase_sl.recordmask, [0, 1]) + assert_equal_records(mbase_sl.mask, + np.array([(False, False, False), + (True, True, True)], + dtype=mbase._mask.dtype)) + assert_equal_records(mbase_sl, base[:2].view(mrecarray)) + for field in ('a', 'b', 'c'): + assert_equal(getattr(mbase_sl, field), base[:2][field]) + + def test_set_fields(self): + # Tests setting fields. + base = self.base.copy() + mbase = base.view(mrecarray) + mbase = mbase.copy() + mbase.fill_value = (999999, 1e20, 'N/A') + # Change the data, the mask should be conserved + mbase.a._data[:] = 5 + assert_equal(mbase['a']._data, [5, 5, 5, 5, 5]) + assert_equal(mbase['a']._mask, [0, 1, 0, 0, 1]) + # Change the elements, and the mask will follow + mbase.a = 1 + assert_equal(mbase['a']._data, [1]*5) + assert_equal(ma.getmaskarray(mbase['a']), [0]*5) + # Use to be _mask, now it's recordmask + assert_equal(mbase.recordmask, [False]*5) + assert_equal(mbase._mask.tolist(), + np.array([(0, 0, 0), + (0, 1, 1), + (0, 0, 0), + (0, 0, 0), + (0, 1, 1)], + dtype=bool)) + # Set a field to mask ........................ + mbase.c = masked + # Use to be mask, and now it's still mask ! + assert_equal(mbase.c.mask, [1]*5) + assert_equal(mbase.c.recordmask, [1]*5) + assert_equal(ma.getmaskarray(mbase['c']), [1]*5) + assert_equal(ma.getdata(mbase['c']), [b'N/A']*5) + assert_equal(mbase._mask.tolist(), + np.array([(0, 0, 1), + (0, 1, 1), + (0, 0, 1), + (0, 0, 1), + (0, 1, 1)], + dtype=bool)) + # Set fields by slices ....................... + mbase = base.view(mrecarray).copy() + mbase.a[3:] = 5 + assert_equal(mbase.a, [1, 2, 3, 5, 5]) + assert_equal(mbase.a._mask, [0, 1, 0, 0, 0]) + mbase.b[3:] = masked + assert_equal(mbase.b, base['b']) + assert_equal(mbase.b._mask, [0, 1, 0, 1, 1]) + # Set fields globally.......................... + ndtype = [('alpha', '|S1'), ('num', int)] + data = ma.array([('a', 1), ('b', 2), ('c', 3)], dtype=ndtype) + rdata = data.view(MaskedRecords) + val = ma.array([10, 20, 30], mask=[1, 0, 0]) + + rdata['num'] = val + assert_equal(rdata.num, val) + assert_equal(rdata.num.mask, [1, 0, 0]) + + def test_set_fields_mask(self): + # Tests setting the mask of a field. + base = self.base.copy() + # This one has already a mask.... + mbase = base.view(mrecarray) + mbase['a'][-2] = masked + assert_equal(mbase.a, [1, 2, 3, 4, 5]) + assert_equal(mbase.a._mask, [0, 1, 0, 1, 1]) + # This one has not yet + mbase = fromarrays([np.arange(5), np.random.rand(5)], + dtype=[('a', int), ('b', float)]) + mbase['a'][-2] = masked + assert_equal(mbase.a, [0, 1, 2, 3, 4]) + assert_equal(mbase.a._mask, [0, 0, 0, 1, 0]) + + def test_set_mask(self): + base = self.base.copy() + mbase = base.view(mrecarray) + # Set the mask to True ....................... + mbase.mask = masked + assert_equal(ma.getmaskarray(mbase['b']), [1]*5) + assert_equal(mbase['a']._mask, mbase['b']._mask) + assert_equal(mbase['a']._mask, mbase['c']._mask) + assert_equal(mbase._mask.tolist(), + np.array([(1, 1, 1)]*5, dtype=bool)) + # Delete the mask ............................ + mbase.mask = nomask + assert_equal(ma.getmaskarray(mbase['c']), [0]*5) + assert_equal(mbase._mask.tolist(), + np.array([(0, 0, 0)]*5, dtype=bool)) + + def test_set_mask_fromarray(self): + base = self.base.copy() + mbase = base.view(mrecarray) + # Sets the mask w/ an array + mbase.mask = [1, 0, 0, 0, 1] + assert_equal(mbase.a.mask, [1, 0, 0, 0, 1]) + assert_equal(mbase.b.mask, [1, 0, 0, 0, 1]) + assert_equal(mbase.c.mask, [1, 0, 0, 0, 1]) + # Yay, once more ! + mbase.mask = [0, 0, 0, 0, 1] + assert_equal(mbase.a.mask, [0, 0, 0, 0, 1]) + assert_equal(mbase.b.mask, [0, 0, 0, 0, 1]) + assert_equal(mbase.c.mask, [0, 0, 0, 0, 1]) + + def test_set_mask_fromfields(self): + mbase = self.base.copy().view(mrecarray) + + nmask = np.array( + [(0, 1, 0), (0, 1, 0), (1, 0, 1), (1, 0, 1), (0, 0, 0)], + dtype=[('a', bool), ('b', bool), ('c', bool)]) + mbase.mask = nmask + assert_equal(mbase.a.mask, [0, 0, 1, 1, 0]) + assert_equal(mbase.b.mask, [1, 1, 0, 0, 0]) + assert_equal(mbase.c.mask, [0, 0, 1, 1, 0]) + # Reinitialize and redo + mbase.mask = False + mbase.fieldmask = nmask + assert_equal(mbase.a.mask, [0, 0, 1, 1, 0]) + assert_equal(mbase.b.mask, [1, 1, 0, 0, 0]) + assert_equal(mbase.c.mask, [0, 0, 1, 1, 0]) + + def test_set_elements(self): + base = self.base.copy() + # Set an element to mask ..................... + mbase = base.view(mrecarray).copy() + mbase[-2] = masked + assert_equal( + mbase._mask.tolist(), + np.array([(0, 0, 0), (1, 1, 1), (0, 0, 0), (1, 1, 1), (1, 1, 1)], + dtype=bool)) + # Used to be mask, now it's recordmask! + assert_equal(mbase.recordmask, [0, 1, 0, 1, 1]) + # Set slices ................................. + mbase = base.view(mrecarray).copy() + mbase[:2] = (5, 5, 5) + assert_equal(mbase.a._data, [5, 5, 3, 4, 5]) + assert_equal(mbase.a._mask, [0, 0, 0, 0, 1]) + assert_equal(mbase.b._data, [5., 5., 3.3, 4.4, 5.5]) + assert_equal(mbase.b._mask, [0, 0, 0, 0, 1]) + assert_equal(mbase.c._data, + [b'5', b'5', b'three', b'four', b'five']) + assert_equal(mbase.b._mask, [0, 0, 0, 0, 1]) + + mbase = base.view(mrecarray).copy() + mbase[:2] = masked + assert_equal(mbase.a._data, [1, 2, 3, 4, 5]) + assert_equal(mbase.a._mask, [1, 1, 0, 0, 1]) + assert_equal(mbase.b._data, [1.1, 2.2, 3.3, 4.4, 5.5]) + assert_equal(mbase.b._mask, [1, 1, 0, 0, 1]) + assert_equal(mbase.c._data, + [b'one', b'two', b'three', b'four', b'five']) + assert_equal(mbase.b._mask, [1, 1, 0, 0, 1]) + + def test_setslices_hardmask(self): + # Tests setting slices w/ hardmask. + base = self.base.copy() + mbase = base.view(mrecarray) + mbase.harden_mask() + try: + mbase[-2:] = (5, 5, 5) + assert_equal(mbase.a._data, [1, 2, 3, 5, 5]) + assert_equal(mbase.b._data, [1.1, 2.2, 3.3, 5, 5.5]) + assert_equal(mbase.c._data, + [b'one', b'two', b'three', b'5', b'five']) + assert_equal(mbase.a._mask, [0, 1, 0, 0, 1]) + assert_equal(mbase.b._mask, mbase.a._mask) + assert_equal(mbase.b._mask, mbase.c._mask) + except NotImplementedError: + # OK, not implemented yet... + pass + except AssertionError: + raise + else: + raise Exception("Flexible hard masks should be supported !") + # Not using a tuple should crash + try: + mbase[-2:] = 3 + except (NotImplementedError, TypeError): + pass + else: + raise TypeError("Should have expected a readable buffer object!") + + def test_hardmask(self): + # Test hardmask + base = self.base.copy() + mbase = base.view(mrecarray) + mbase.harden_mask() + assert_(mbase._hardmask) + mbase.mask = nomask + assert_equal_records(mbase._mask, base._mask) + mbase.soften_mask() + assert_(not mbase._hardmask) + mbase.mask = nomask + # So, the mask of a field is no longer set to nomask... + assert_equal_records(mbase._mask, + ma.make_mask_none(base.shape, base.dtype)) + assert_(ma.make_mask(mbase['b']._mask) is nomask) + assert_equal(mbase['a']._mask, mbase['b']._mask) + + def test_pickling(self): + # Test pickling + base = self.base.copy() + mrec = base.view(mrecarray) + for proto in range(2, pickle.HIGHEST_PROTOCOL + 1): + _ = pickle.dumps(mrec, protocol=proto) + mrec_ = pickle.loads(_) + assert_equal(mrec_.dtype, mrec.dtype) + assert_equal_records(mrec_._data, mrec._data) + assert_equal(mrec_._mask, mrec._mask) + assert_equal_records(mrec_._mask, mrec._mask) + + def test_filled(self): + # Test filling the array + _a = ma.array([1, 2, 3], mask=[0, 0, 1], dtype=int) + _b = ma.array([1.1, 2.2, 3.3], mask=[0, 0, 1], dtype=float) + _c = ma.array(['one', 'two', 'three'], mask=[0, 0, 1], dtype='|S8') + ddtype = [('a', int), ('b', float), ('c', '|S8')] + mrec = fromarrays([_a, _b, _c], dtype=ddtype, + fill_value=(99999, 99999., 'N/A')) + mrecfilled = mrec.filled() + assert_equal(mrecfilled['a'], np.array((1, 2, 99999), dtype=int)) + assert_equal(mrecfilled['b'], np.array((1.1, 2.2, 99999.), + dtype=float)) + assert_equal(mrecfilled['c'], np.array(('one', 'two', 'N/A'), + dtype='|S8')) + + def test_tolist(self): + # Test tolist. + _a = ma.array([1, 2, 3], mask=[0, 0, 1], dtype=int) + _b = ma.array([1.1, 2.2, 3.3], mask=[0, 0, 1], dtype=float) + _c = ma.array(['one', 'two', 'three'], mask=[1, 0, 0], dtype='|S8') + ddtype = [('a', int), ('b', float), ('c', '|S8')] + mrec = fromarrays([_a, _b, _c], dtype=ddtype, + fill_value=(99999, 99999., 'N/A')) + + assert_equal(mrec.tolist(), + [(1, 1.1, None), (2, 2.2, b'two'), + (None, None, b'three')]) + + def test_withnames(self): + # Test the creation w/ format and names + x = mrecarray(1, formats=float, names='base') + x[0]['base'] = 10 + assert_equal(x['base'][0], 10) + + def test_exotic_formats(self): + # Test that 'exotic' formats are processed properly + easy = mrecarray(1, dtype=[('i', int), ('s', '|S8'), ('f', float)]) + easy[0] = masked + assert_equal(easy.filled(1).item(), (1, b'1', 1.)) + + solo = mrecarray(1, dtype=[('f0', ' 1: + assert_(eq(np.concatenate((x, y), 1), + concatenate((xm, ym), 1))) + assert_(eq(np.add.reduce(x, 1), add.reduce(x, 1))) + assert_(eq(np.sum(x, 1), sum(x, 1))) + assert_(eq(np.product(x, 1), product(x, 1))) + + def test_testCI(self): + # Test of conversions and indexing + x1 = np.array([1, 2, 4, 3]) + x2 = array(x1, mask=[1, 0, 0, 0]) + x3 = array(x1, mask=[0, 1, 0, 1]) + x4 = array(x1) + # test conversion to strings + str(x2) # raises? + repr(x2) # raises? + assert_(eq(np.sort(x1), sort(x2, fill_value=0))) + # tests of indexing + assert_(type(x2[1]) is type(x1[1])) + assert_(x1[1] == x2[1]) + assert_(x2[0] is masked) + assert_(eq(x1[2], x2[2])) + assert_(eq(x1[2:5], x2[2:5])) + assert_(eq(x1[:], x2[:])) + assert_(eq(x1[1:], x3[1:])) + x1[2] = 9 + x2[2] = 9 + assert_(eq(x1, x2)) + x1[1:3] = 99 + x2[1:3] = 99 + assert_(eq(x1, x2)) + x2[1] = masked + assert_(eq(x1, x2)) + x2[1:3] = masked + assert_(eq(x1, x2)) + x2[:] = x1 + x2[1] = masked + assert_(allequal(getmask(x2), array([0, 1, 0, 0]))) + x3[:] = masked_array([1, 2, 3, 4], [0, 1, 1, 0]) + assert_(allequal(getmask(x3), array([0, 1, 1, 0]))) + x4[:] = masked_array([1, 2, 3, 4], [0, 1, 1, 0]) + assert_(allequal(getmask(x4), array([0, 1, 1, 0]))) + assert_(allequal(x4, array([1, 2, 3, 4]))) + x1 = np.arange(5) * 1.0 + x2 = masked_values(x1, 3.0) + assert_(eq(x1, x2)) + assert_(allequal(array([0, 0, 0, 1, 0], MaskType), x2.mask)) + assert_(eq(3.0, x2.fill_value)) + x1 = array([1, 'hello', 2, 3], object) + x2 = np.array([1, 'hello', 2, 3], object) + s1 = x1[1] + s2 = x2[1] + assert_equal(type(s2), str) + assert_equal(type(s1), str) + assert_equal(s1, s2) + assert_(x1[1:1].shape == (0,)) + + def test_testCopySize(self): + # Tests of some subtle points of copying and sizing. + n = [0, 0, 1, 0, 0] + m = make_mask(n) + m2 = make_mask(m) + assert_(m is m2) + m3 = make_mask(m, copy=1) + assert_(m is not m3) + + x1 = np.arange(5) + y1 = array(x1, mask=m) + assert_(y1._data is not x1) + assert_(allequal(x1, y1._data)) + assert_(y1.mask is m) + + y1a = array(y1, copy=0) + # For copy=False, one might expect that the array would just + # passed on, i.e., that it would be "is" instead of "==". + # See gh-4043 for discussion. + assert_(y1a._mask.__array_interface__ == + y1._mask.__array_interface__) + + y2 = array(x1, mask=m3, copy=0) + assert_(y2.mask is m3) + assert_(y2[2] is masked) + y2[2] = 9 + assert_(y2[2] is not masked) + assert_(y2.mask is m3) + assert_(allequal(y2.mask, 0)) + + y2a = array(x1, mask=m, copy=1) + assert_(y2a.mask is not m) + assert_(y2a[2] is masked) + y2a[2] = 9 + assert_(y2a[2] is not masked) + assert_(y2a.mask is not m) + assert_(allequal(y2a.mask, 0)) + + y3 = array(x1 * 1.0, mask=m) + assert_(filled(y3).dtype is (x1 * 1.0).dtype) + + x4 = arange(4) + x4[2] = masked + y4 = resize(x4, (8,)) + assert_(eq(concatenate([x4, x4]), y4)) + assert_(eq(getmask(y4), [0, 0, 1, 0, 0, 0, 1, 0])) + y5 = repeat(x4, (2, 2, 2, 2), axis=0) + assert_(eq(y5, [0, 0, 1, 1, 2, 2, 3, 3])) + y6 = repeat(x4, 2, axis=0) + assert_(eq(y5, y6)) + + def test_testPut(self): + # Test of put + d = arange(5) + n = [0, 0, 0, 1, 1] + m = make_mask(n) + m2 = m.copy() + x = array(d, mask=m) + assert_(x[3] is masked) + assert_(x[4] is masked) + x[[1, 4]] = [10, 40] + assert_(x.mask is m) + assert_(x[3] is masked) + assert_(x[4] is not masked) + assert_(eq(x, [0, 10, 2, -1, 40])) + + x = array(d, mask=m2, copy=True) + x.put([0, 1, 2], [-1, 100, 200]) + assert_(x.mask is not m2) + assert_(x[3] is masked) + assert_(x[4] is masked) + assert_(eq(x, [-1, 100, 200, 0, 0])) + + def test_testPut2(self): + # Test of put + d = arange(5) + x = array(d, mask=[0, 0, 0, 0, 0]) + z = array([10, 40], mask=[1, 0]) + assert_(x[2] is not masked) + assert_(x[3] is not masked) + x[2:4] = z + assert_(x[2] is masked) + assert_(x[3] is not masked) + assert_(eq(x, [0, 1, 10, 40, 4])) + + d = arange(5) + x = array(d, mask=[0, 0, 0, 0, 0]) + y = x[2:4] + z = array([10, 40], mask=[1, 0]) + assert_(x[2] is not masked) + assert_(x[3] is not masked) + y[:] = z + assert_(y[0] is masked) + assert_(y[1] is not masked) + assert_(eq(y, [10, 40])) + assert_(x[2] is masked) + assert_(x[3] is not masked) + assert_(eq(x, [0, 1, 10, 40, 4])) + + def test_testMaPut(self): + (x, y, a10, m1, m2, xm, ym, z, zm, xf, s) = self.d + m = [1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1] + i = np.nonzero(m)[0] + put(ym, i, zm) + assert_(all(take(ym, i, axis=0) == zm)) + + def test_testOddFeatures(self): + # Test of other odd features + x = arange(20) + x = x.reshape(4, 5) + x.flat[5] = 12 + assert_(x[1, 0] == 12) + z = x + 10j * x + assert_(eq(z.real, x)) + assert_(eq(z.imag, 10 * x)) + assert_(eq((z * conjugate(z)).real, 101 * x * x)) + z.imag[...] = 0.0 + + x = arange(10) + x[3] = masked + assert_(str(x[3]) == str(masked)) + c = x >= 8 + assert_(count(where(c, masked, masked)) == 0) + assert_(shape(where(c, masked, masked)) == c.shape) + z = where(c, x, masked) + assert_(z.dtype is x.dtype) + assert_(z[3] is masked) + assert_(z[4] is masked) + assert_(z[7] is masked) + assert_(z[8] is not masked) + assert_(z[9] is not masked) + assert_(eq(x, z)) + z = where(c, masked, x) + assert_(z.dtype is x.dtype) + assert_(z[3] is masked) + assert_(z[4] is not masked) + assert_(z[7] is not masked) + assert_(z[8] is masked) + assert_(z[9] is masked) + z = masked_where(c, x) + assert_(z.dtype is x.dtype) + assert_(z[3] is masked) + assert_(z[4] is not masked) + assert_(z[7] is not masked) + assert_(z[8] is masked) + assert_(z[9] is masked) + assert_(eq(x, z)) + x = array([1., 2., 3., 4., 5.]) + c = array([1, 1, 1, 0, 0]) + x[2] = masked + z = where(c, x, -x) + assert_(eq(z, [1., 2., 0., -4., -5])) + c[0] = masked + z = where(c, x, -x) + assert_(eq(z, [1., 2., 0., -4., -5])) + assert_(z[0] is masked) + assert_(z[1] is not masked) + assert_(z[2] is masked) + assert_(eq(masked_where(greater(x, 2), x), masked_greater(x, 2))) + assert_(eq(masked_where(greater_equal(x, 2), x), + masked_greater_equal(x, 2))) + assert_(eq(masked_where(less(x, 2), x), masked_less(x, 2))) + assert_(eq(masked_where(less_equal(x, 2), x), masked_less_equal(x, 2))) + assert_(eq(masked_where(not_equal(x, 2), x), masked_not_equal(x, 2))) + assert_(eq(masked_where(equal(x, 2), x), masked_equal(x, 2))) + assert_(eq(masked_where(not_equal(x, 2), x), masked_not_equal(x, 2))) + assert_(eq(masked_inside(list(range(5)), 1, 3), [0, 199, 199, 199, 4])) + assert_(eq(masked_outside(list(range(5)), 1, 3), [199, 1, 2, 3, 199])) + assert_(eq(masked_inside(array(list(range(5)), + mask=[1, 0, 0, 0, 0]), 1, 3).mask, + [1, 1, 1, 1, 0])) + assert_(eq(masked_outside(array(list(range(5)), + mask=[0, 1, 0, 0, 0]), 1, 3).mask, + [1, 1, 0, 0, 1])) + assert_(eq(masked_equal(array(list(range(5)), + mask=[1, 0, 0, 0, 0]), 2).mask, + [1, 0, 1, 0, 0])) + assert_(eq(masked_not_equal(array([2, 2, 1, 2, 1], + mask=[1, 0, 0, 0, 0]), 2).mask, + [1, 0, 1, 0, 1])) + assert_(eq(masked_where([1, 1, 0, 0, 0], [1, 2, 3, 4, 5]), + [99, 99, 3, 4, 5])) + atest = ones((10, 10, 10), dtype=np.float32) + btest = zeros(atest.shape, MaskType) + ctest = masked_where(btest, atest) + assert_(eq(atest, ctest)) + z = choose(c, (-x, x)) + assert_(eq(z, [1., 2., 0., -4., -5])) + assert_(z[0] is masked) + assert_(z[1] is not masked) + assert_(z[2] is masked) + x = arange(6) + x[5] = masked + y = arange(6) * 10 + y[2] = masked + c = array([1, 1, 1, 0, 0, 0], mask=[1, 0, 0, 0, 0, 0]) + cm = c.filled(1) + z = where(c, x, y) + zm = where(cm, x, y) + assert_(eq(z, zm)) + assert_(getmask(zm) is nomask) + assert_(eq(zm, [0, 1, 2, 30, 40, 50])) + z = where(c, masked, 1) + assert_(eq(z, [99, 99, 99, 1, 1, 1])) + z = where(c, 1, masked) + assert_(eq(z, [99, 1, 1, 99, 99, 99])) + + def test_testMinMax2(self): + # Test of minimum, maximum. + assert_(eq(minimum([1, 2, 3], [4, 0, 9]), [1, 0, 3])) + assert_(eq(maximum([1, 2, 3], [4, 0, 9]), [4, 2, 9])) + x = arange(5) + y = arange(5) - 2 + x[3] = masked + y[0] = masked + assert_(eq(minimum(x, y), where(less(x, y), x, y))) + assert_(eq(maximum(x, y), where(greater(x, y), x, y))) + assert_(minimum.reduce(x) == 0) + assert_(maximum.reduce(x) == 4) + + def test_testTakeTransposeInnerOuter(self): + # Test of take, transpose, inner, outer products + x = arange(24) + y = np.arange(24) + x[5:6] = masked + x = x.reshape(2, 3, 4) + y = y.reshape(2, 3, 4) + assert_(eq(np.transpose(y, (2, 0, 1)), transpose(x, (2, 0, 1)))) + assert_(eq(np.take(y, (2, 0, 1), 1), take(x, (2, 0, 1), 1))) + assert_(eq(np.inner(filled(x, 0), filled(y, 0)), + inner(x, y))) + assert_(eq(np.outer(filled(x, 0), filled(y, 0)), + outer(x, y))) + y = array(['abc', 1, 'def', 2, 3], object) + y[2] = masked + t = take(y, [0, 3, 4]) + assert_(t[0] == 'abc') + assert_(t[1] == 2) + assert_(t[2] == 3) + + def test_testInplace(self): + # Test of inplace operations and rich comparisons + y = arange(10) + + x = arange(10) + xm = arange(10) + xm[2] = masked + x += 1 + assert_(eq(x, y + 1)) + xm += 1 + assert_(eq(x, y + 1)) + + x = arange(10) + xm = arange(10) + xm[2] = masked + x -= 1 + assert_(eq(x, y - 1)) + xm -= 1 + assert_(eq(xm, y - 1)) + + x = arange(10) * 1.0 + xm = arange(10) * 1.0 + xm[2] = masked + x *= 2.0 + assert_(eq(x, y * 2)) + xm *= 2.0 + assert_(eq(xm, y * 2)) + + x = arange(10) * 2 + xm = arange(10) + xm[2] = masked + x //= 2 + assert_(eq(x, y)) + xm //= 2 + assert_(eq(x, y)) + + x = arange(10) * 1.0 + xm = arange(10) * 1.0 + xm[2] = masked + x /= 2.0 + assert_(eq(x, y / 2.0)) + xm /= arange(10) + assert_(eq(xm, ones((10,)))) + + x = arange(10).astype(np.float32) + xm = arange(10) + xm[2] = masked + x += 1. + assert_(eq(x, y + 1.)) + + def test_testPickle(self): + # Test of pickling + x = arange(12) + x[4:10:2] = masked + x = x.reshape(4, 3) + for proto in range(2, pickle.HIGHEST_PROTOCOL + 1): + s = pickle.dumps(x, protocol=proto) + y = pickle.loads(s) + assert_(eq(x, y)) + + def test_testMasked(self): + # Test of masked element + xx = arange(6) + xx[1] = masked + assert_(str(masked) == '--') + assert_(xx[1] is masked) + assert_equal(filled(xx[1], 0), 0) + + def test_testAverage1(self): + # Test of average. + ott = array([0., 1., 2., 3.], mask=[1, 0, 0, 0]) + assert_(eq(2.0, average(ott, axis=0))) + assert_(eq(2.0, average(ott, weights=[1., 1., 2., 1.]))) + result, wts = average(ott, weights=[1., 1., 2., 1.], returned=1) + assert_(eq(2.0, result)) + assert_(wts == 4.0) + ott[:] = masked + assert_(average(ott, axis=0) is masked) + ott = array([0., 1., 2., 3.], mask=[1, 0, 0, 0]) + ott = ott.reshape(2, 2) + ott[:, 1] = masked + assert_(eq(average(ott, axis=0), [2.0, 0.0])) + assert_(average(ott, axis=1)[0] is masked) + assert_(eq([2., 0.], average(ott, axis=0))) + result, wts = average(ott, axis=0, returned=1) + assert_(eq(wts, [1., 0.])) + + def test_testAverage2(self): + # More tests of average. + w1 = [0, 1, 1, 1, 1, 0] + w2 = [[0, 1, 1, 1, 1, 0], [1, 0, 0, 0, 0, 1]] + x = arange(6) + assert_(allclose(average(x, axis=0), 2.5)) + assert_(allclose(average(x, axis=0, weights=w1), 2.5)) + y = array([arange(6), 2.0 * arange(6)]) + assert_(allclose(average(y, None), + np.add.reduce(np.arange(6)) * 3. / 12.)) + assert_(allclose(average(y, axis=0), np.arange(6) * 3. / 2.)) + assert_(allclose(average(y, axis=1), + [average(x, axis=0), average(x, axis=0)*2.0])) + assert_(allclose(average(y, None, weights=w2), 20. / 6.)) + assert_(allclose(average(y, axis=0, weights=w2), + [0., 1., 2., 3., 4., 10.])) + assert_(allclose(average(y, axis=1), + [average(x, axis=0), average(x, axis=0)*2.0])) + m1 = zeros(6) + m2 = [0, 0, 1, 1, 0, 0] + m3 = [[0, 0, 1, 1, 0, 0], [0, 1, 1, 1, 1, 0]] + m4 = ones(6) + m5 = [0, 1, 1, 1, 1, 1] + assert_(allclose(average(masked_array(x, m1), axis=0), 2.5)) + assert_(allclose(average(masked_array(x, m2), axis=0), 2.5)) + assert_(average(masked_array(x, m4), axis=0) is masked) + assert_equal(average(masked_array(x, m5), axis=0), 0.0) + assert_equal(count(average(masked_array(x, m4), axis=0)), 0) + z = masked_array(y, m3) + assert_(allclose(average(z, None), 20. / 6.)) + assert_(allclose(average(z, axis=0), + [0., 1., 99., 99., 4.0, 7.5])) + assert_(allclose(average(z, axis=1), [2.5, 5.0])) + assert_(allclose(average(z, axis=0, weights=w2), + [0., 1., 99., 99., 4.0, 10.0])) + + a = arange(6) + b = arange(6) * 3 + r1, w1 = average([[a, b], [b, a]], axis=1, returned=1) + assert_equal(shape(r1), shape(w1)) + assert_equal(r1.shape, w1.shape) + r2, w2 = average(ones((2, 2, 3)), axis=0, weights=[3, 1], returned=1) + assert_equal(shape(w2), shape(r2)) + r2, w2 = average(ones((2, 2, 3)), returned=1) + assert_equal(shape(w2), shape(r2)) + r2, w2 = average(ones((2, 2, 3)), weights=ones((2, 2, 3)), returned=1) + assert_(shape(w2) == shape(r2)) + a2d = array([[1, 2], [0, 4]], float) + a2dm = masked_array(a2d, [[0, 0], [1, 0]]) + a2da = average(a2d, axis=0) + assert_(eq(a2da, [0.5, 3.0])) + a2dma = average(a2dm, axis=0) + assert_(eq(a2dma, [1.0, 3.0])) + a2dma = average(a2dm, axis=None) + assert_(eq(a2dma, 7. / 3.)) + a2dma = average(a2dm, axis=1) + assert_(eq(a2dma, [1.5, 4.0])) + + def test_testToPython(self): + assert_equal(1, int(array(1))) + assert_equal(1.0, float(array(1))) + assert_equal(1, int(array([[[1]]]))) + assert_equal(1.0, float(array([[1]]))) + assert_raises(TypeError, float, array([1, 1])) + assert_raises(ValueError, bool, array([0, 1])) + assert_raises(ValueError, bool, array([0, 0], mask=[0, 1])) + + def test_testScalarArithmetic(self): + xm = array(0, mask=1) + #TODO FIXME: Find out what the following raises a warning in r8247 + with np.errstate(divide='ignore'): + assert_((1 / array(0)).mask) + assert_((1 + xm).mask) + assert_((-xm).mask) + assert_((-xm).mask) + assert_(maximum(xm, xm).mask) + assert_(minimum(xm, xm).mask) + assert_(xm.filled().dtype is xm._data.dtype) + x = array(0, mask=0) + assert_(x.filled() == x._data) + assert_equal(str(xm), str(masked_print_option)) + + def test_testArrayMethods(self): + a = array([1, 3, 2]) + assert_(eq(a.any(), a._data.any())) + assert_(eq(a.all(), a._data.all())) + assert_(eq(a.argmax(), a._data.argmax())) + assert_(eq(a.argmin(), a._data.argmin())) + assert_(eq(a.choose(0, 1, 2, 3, 4), + a._data.choose(0, 1, 2, 3, 4))) + assert_(eq(a.compress([1, 0, 1]), a._data.compress([1, 0, 1]))) + assert_(eq(a.conj(), a._data.conj())) + assert_(eq(a.conjugate(), a._data.conjugate())) + m = array([[1, 2], [3, 4]]) + assert_(eq(m.diagonal(), m._data.diagonal())) + assert_(eq(a.sum(), a._data.sum())) + assert_(eq(a.take([1, 2]), a._data.take([1, 2]))) + assert_(eq(m.transpose(), m._data.transpose())) + + def test_testArrayAttributes(self): + a = array([1, 3, 2]) + assert_equal(a.ndim, 1) + + def test_testAPI(self): + assert_(not [m for m in dir(np.ndarray) + if m not in dir(MaskedArray) and + not m.startswith('_')]) + + def test_testSingleElementSubscript(self): + a = array([1, 3, 2]) + b = array([1, 3, 2], mask=[1, 0, 1]) + assert_equal(a[0].shape, ()) + assert_equal(b[0].shape, ()) + assert_equal(b[1].shape, ()) + + +class TestUfuncs(object): + def setup(self): + self.d = (array([1.0, 0, -1, pi / 2] * 2, mask=[0, 1] + [0] * 6), + array([1.0, 0, -1, pi / 2] * 2, mask=[1, 0] + [0] * 6),) + + def test_testUfuncRegression(self): + f_invalid_ignore = [ + 'sqrt', 'arctanh', 'arcsin', 'arccos', + 'arccosh', 'arctanh', 'log', 'log10', 'divide', + 'true_divide', 'floor_divide', 'remainder', 'fmod'] + for f in ['sqrt', 'log', 'log10', 'exp', 'conjugate', + 'sin', 'cos', 'tan', + 'arcsin', 'arccos', 'arctan', + 'sinh', 'cosh', 'tanh', + 'arcsinh', + 'arccosh', + 'arctanh', + 'absolute', 'fabs', 'negative', + 'floor', 'ceil', + 'logical_not', + 'add', 'subtract', 'multiply', + 'divide', 'true_divide', 'floor_divide', + 'remainder', 'fmod', 'hypot', 'arctan2', + 'equal', 'not_equal', 'less_equal', 'greater_equal', + 'less', 'greater', + 'logical_and', 'logical_or', 'logical_xor']: + try: + uf = getattr(umath, f) + except AttributeError: + uf = getattr(fromnumeric, f) + mf = getattr(np.ma, f) + args = self.d[:uf.nin] + with np.errstate(): + if f in f_invalid_ignore: + np.seterr(invalid='ignore') + if f in ['arctanh', 'log', 'log10']: + np.seterr(divide='ignore') + ur = uf(*args) + mr = mf(*args) + assert_(eq(ur.filled(0), mr.filled(0), f)) + assert_(eqmask(ur.mask, mr.mask)) + + def test_reduce(self): + a = self.d[0] + assert_(not alltrue(a, axis=0)) + assert_(sometrue(a, axis=0)) + assert_equal(sum(a[:3], axis=0), 0) + assert_equal(product(a, axis=0), 0) + + def test_minmax(self): + a = arange(1, 13).reshape(3, 4) + amask = masked_where(a < 5, a) + assert_equal(amask.max(), a.max()) + assert_equal(amask.min(), 5) + assert_((amask.max(0) == a.max(0)).all()) + assert_((amask.min(0) == [5, 6, 7, 8]).all()) + assert_(amask.max(1)[0].mask) + assert_(amask.min(1)[0].mask) + + def test_nonzero(self): + for t in "?bhilqpBHILQPfdgFDGO": + x = array([1, 0, 2, 0], mask=[0, 0, 1, 1]) + assert_(eq(nonzero(x), [0])) + + +class TestArrayMethods(object): + + def setup(self): + x = np.array([8.375, 7.545, 8.828, 8.5, 1.757, 5.928, + 8.43, 7.78, 9.865, 5.878, 8.979, 4.732, + 3.012, 6.022, 5.095, 3.116, 5.238, 3.957, + 6.04, 9.63, 7.712, 3.382, 4.489, 6.479, + 7.189, 9.645, 5.395, 4.961, 9.894, 2.893, + 7.357, 9.828, 6.272, 3.758, 6.693, 0.993]) + X = x.reshape(6, 6) + XX = x.reshape(3, 2, 2, 3) + + m = np.array([0, 1, 0, 1, 0, 0, + 1, 0, 1, 1, 0, 1, + 0, 0, 0, 1, 0, 1, + 0, 0, 0, 1, 1, 1, + 1, 0, 0, 1, 0, 0, + 0, 0, 1, 0, 1, 0]) + mx = array(data=x, mask=m) + mX = array(data=X, mask=m.reshape(X.shape)) + mXX = array(data=XX, mask=m.reshape(XX.shape)) + + self.d = (x, X, XX, m, mx, mX, mXX) + + def test_trace(self): + (x, X, XX, m, mx, mX, mXX,) = self.d + mXdiag = mX.diagonal() + assert_equal(mX.trace(), mX.diagonal().compressed().sum()) + assert_(eq(mX.trace(), + X.trace() - sum(mXdiag.mask * X.diagonal(), + axis=0))) + + def test_clip(self): + (x, X, XX, m, mx, mX, mXX,) = self.d + clipped = mx.clip(2, 8) + assert_(eq(clipped.mask, mx.mask)) + assert_(eq(clipped._data, x.clip(2, 8))) + assert_(eq(clipped._data, mx._data.clip(2, 8))) + + def test_ptp(self): + (x, X, XX, m, mx, mX, mXX,) = self.d + (n, m) = X.shape + assert_equal(mx.ptp(), mx.compressed().ptp()) + rows = np.zeros(n, np.float_) + cols = np.zeros(m, np.float_) + for k in range(m): + cols[k] = mX[:, k].compressed().ptp() + for k in range(n): + rows[k] = mX[k].compressed().ptp() + assert_(eq(mX.ptp(0), cols)) + assert_(eq(mX.ptp(1), rows)) + + def test_swapaxes(self): + (x, X, XX, m, mx, mX, mXX,) = self.d + mXswapped = mX.swapaxes(0, 1) + assert_(eq(mXswapped[-1], mX[:, -1])) + mXXswapped = mXX.swapaxes(0, 2) + assert_equal(mXXswapped.shape, (2, 2, 3, 3)) + + def test_cumprod(self): + (x, X, XX, m, mx, mX, mXX,) = self.d + mXcp = mX.cumprod(0) + assert_(eq(mXcp._data, mX.filled(1).cumprod(0))) + mXcp = mX.cumprod(1) + assert_(eq(mXcp._data, mX.filled(1).cumprod(1))) + + def test_cumsum(self): + (x, X, XX, m, mx, mX, mXX,) = self.d + mXcp = mX.cumsum(0) + assert_(eq(mXcp._data, mX.filled(0).cumsum(0))) + mXcp = mX.cumsum(1) + assert_(eq(mXcp._data, mX.filled(0).cumsum(1))) + + def test_varstd(self): + (x, X, XX, m, mx, mX, mXX,) = self.d + assert_(eq(mX.var(axis=None), mX.compressed().var())) + assert_(eq(mX.std(axis=None), mX.compressed().std())) + assert_(eq(mXX.var(axis=3).shape, XX.var(axis=3).shape)) + assert_(eq(mX.var().shape, X.var().shape)) + (mXvar0, mXvar1) = (mX.var(axis=0), mX.var(axis=1)) + for k in range(6): + assert_(eq(mXvar1[k], mX[k].compressed().var())) + assert_(eq(mXvar0[k], mX[:, k].compressed().var())) + assert_(eq(np.sqrt(mXvar0[k]), + mX[:, k].compressed().std())) + + +def eqmask(m1, m2): + if m1 is nomask: + return m2 is nomask + if m2 is nomask: + return m1 is nomask + return (m1 == m2).all() diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/ma/tests/test_regression.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/ma/tests/test_regression.py new file mode 100644 index 0000000000000000000000000000000000000000..54f1bda7db745750c47a2ba39757df98cbe78ae1 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/ma/tests/test_regression.py @@ -0,0 +1,89 @@ +from __future__ import division, absolute_import, print_function + +import numpy as np +from numpy.testing import ( + assert_, assert_array_equal, assert_allclose, suppress_warnings + ) + + +class TestRegression(object): + def test_masked_array_create(self): + # Ticket #17 + x = np.ma.masked_array([0, 1, 2, 3, 0, 4, 5, 6], + mask=[0, 0, 0, 1, 1, 1, 0, 0]) + assert_array_equal(np.ma.nonzero(x), [[1, 2, 6, 7]]) + + def test_masked_array(self): + # Ticket #61 + np.ma.array(1, mask=[1]) + + def test_mem_masked_where(self): + # Ticket #62 + from numpy.ma import masked_where, MaskType + a = np.zeros((1, 1)) + b = np.zeros(a.shape, MaskType) + c = masked_where(b, a) + a-c + + def test_masked_array_multiply(self): + # Ticket #254 + a = np.ma.zeros((4, 1)) + a[2, 0] = np.ma.masked + b = np.zeros((4, 2)) + a*b + b*a + + def test_masked_array_repeat(self): + # Ticket #271 + np.ma.array([1], mask=False).repeat(10) + + def test_masked_array_repr_unicode(self): + # Ticket #1256 + repr(np.ma.array(u"Unicode")) + + def test_atleast_2d(self): + # Ticket #1559 + a = np.ma.masked_array([0.0, 1.2, 3.5], mask=[False, True, False]) + b = np.atleast_2d(a) + assert_(a.mask.ndim == 1) + assert_(b.mask.ndim == 2) + + def test_set_fill_value_unicode_py3(self): + # Ticket #2733 + a = np.ma.masked_array(['a', 'b', 'c'], mask=[1, 0, 0]) + a.fill_value = 'X' + assert_(a.fill_value == 'X') + + def test_var_sets_maskedarray_scalar(self): + # Issue gh-2757 + a = np.ma.array(np.arange(5), mask=True) + mout = np.ma.array(-1, dtype=float) + a.var(out=mout) + assert_(mout._data == 0) + + def test_ddof_corrcoef(self): + # See gh-3336 + x = np.ma.masked_equal([1, 2, 3, 4, 5], 4) + y = np.array([2, 2.5, 3.1, 3, 5]) + # this test can be removed after deprecation. + with suppress_warnings() as sup: + sup.filter(DeprecationWarning, "bias and ddof have no effect") + r0 = np.ma.corrcoef(x, y, ddof=0) + r1 = np.ma.corrcoef(x, y, ddof=1) + # ddof should not have an effect (it gets cancelled out) + assert_allclose(r0.data, r1.data) + + def test_mask_not_backmangled(self): + # See gh-10314. Test case taken from gh-3140. + a = np.ma.MaskedArray([1., 2.], mask=[False, False]) + assert_(a.mask.shape == (2,)) + b = np.tile(a, (2, 1)) + # Check that the above no longer changes a.shape to (1, 2) + assert_(a.mask.shape == (2,)) + assert_(b.shape == (2, 2)) + assert_(b.mask.shape == (2, 2)) + + def test_empty_list_on_structured(self): + # See gh-12464. Indexing with empty list should give empty result. + ma = np.ma.MaskedArray([(1, 1.), (2, 2.), (3, 3.)], dtype='i4,f4') + assert_array_equal(ma[[]], ma[:0]) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/ma/tests/test_subclassing.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/ma/tests/test_subclassing.py new file mode 100644 index 0000000000000000000000000000000000000000..f8ab52bb9e10ed40e236ab505ad6859d36121455 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/numpy/ma/tests/test_subclassing.py @@ -0,0 +1,351 @@ +# pylint: disable-msg=W0611, W0612, W0511,R0201 +"""Tests suite for MaskedArray & subclassing. + +:author: Pierre Gerard-Marchant +:contact: pierregm_at_uga_dot_edu +:version: $Id: test_subclassing.py 3473 2007-10-29 15:18:13Z jarrod.millman $ + +""" +from __future__ import division, absolute_import, print_function + +import numpy as np +from numpy.testing import assert_, assert_raises +from numpy.ma.testutils import assert_equal +from numpy.ma.core import ( + array, arange, masked, MaskedArray, masked_array, log, add, hypot, + divide, asarray, asanyarray, nomask + ) +# from numpy.ma.core import ( + +def assert_startswith(a, b): + # produces a better error message than assert_(a.startswith(b)) + assert_equal(a[:len(b)], b) + +class SubArray(np.ndarray): + # Defines a generic np.ndarray subclass, that stores some metadata + # in the dictionary `info`. + def __new__(cls,arr,info={}): + x = np.asanyarray(arr).view(cls) + x.info = info.copy() + return x + + def __array_finalize__(self, obj): + if callable(getattr(super(SubArray, self), + '__array_finalize__', None)): + super(SubArray, self).__array_finalize__(obj) + self.info = getattr(obj, 'info', {}).copy() + return + + def __add__(self, other): + result = super(SubArray, self).__add__(other) + result.info['added'] = result.info.get('added', 0) + 1 + return result + + def __iadd__(self, other): + result = super(SubArray, self).__iadd__(other) + result.info['iadded'] = result.info.get('iadded', 0) + 1 + return result + + +subarray = SubArray + + +class SubMaskedArray(MaskedArray): + """Pure subclass of MaskedArray, keeping some info on subclass.""" + def __new__(cls, info=None, **kwargs): + obj = super(SubMaskedArray, cls).__new__(cls, **kwargs) + obj._optinfo['info'] = info + return obj + + +class MSubArray(SubArray, MaskedArray): + + def __new__(cls, data, info={}, mask=nomask): + subarr = SubArray(data, info) + _data = MaskedArray.__new__(cls, data=subarr, mask=mask) + _data.info = subarr.info + return _data + + def _get_series(self): + _view = self.view(MaskedArray) + _view._sharedmask = False + return _view + _series = property(fget=_get_series) + +msubarray = MSubArray + + +# Also a subclass that overrides __str__, __repr__ and __setitem__, disallowing +# setting to non-class values (and thus np.ma.core.masked_print_option) +# and overrides __array_wrap__, updating the info dict, to check that this +# doesn't get destroyed by MaskedArray._update_from. But this one also needs +# its own iterator... +class CSAIterator(object): + """ + Flat iterator object that uses its own setter/getter + (works around ndarray.flat not propagating subclass setters/getters + see https://github.com/numpy/numpy/issues/4564) + roughly following MaskedIterator + """ + def __init__(self, a): + self._original = a + self._dataiter = a.view(np.ndarray).flat + + def __iter__(self): + return self + + def __getitem__(self, indx): + out = self._dataiter.__getitem__(indx) + if not isinstance(out, np.ndarray): + out = out.__array__() + out = out.view(type(self._original)) + return out + + def __setitem__(self, index, value): + self._dataiter[index] = self._original._validate_input(value) + + def __next__(self): + return next(self._dataiter).__array__().view(type(self._original)) + + next = __next__ + + +class ComplicatedSubArray(SubArray): + + def __str__(self): + return 'myprefix {0} mypostfix'.format(self.view(SubArray)) + + def __repr__(self): + # Return a repr that does not start with 'name(' + return '<{0} {1}>'.format(self.__class__.__name__, self) + + def _validate_input(self, value): + if not isinstance(value, ComplicatedSubArray): + raise ValueError("Can only set to MySubArray values") + return value + + def __setitem__(self, item, value): + # validation ensures direct assignment with ndarray or + # masked_print_option will fail + super(ComplicatedSubArray, self).__setitem__( + item, self._validate_input(value)) + + def __getitem__(self, item): + # ensure getter returns our own class also for scalars + value = super(ComplicatedSubArray, self).__getitem__(item) + if not isinstance(value, np.ndarray): # scalar + value = value.__array__().view(ComplicatedSubArray) + return value + + @property + def flat(self): + return CSAIterator(self) + + @flat.setter + def flat(self, value): + y = self.ravel() + y[:] = value + + def __array_wrap__(self, obj, context=None): + obj = super(ComplicatedSubArray, self).__array_wrap__(obj, context) + if context is not None and context[0] is np.multiply: + obj.info['multiplied'] = obj.info.get('multiplied', 0) + 1 + + return obj + + +class TestSubclassing(object): + # Test suite for masked subclasses of ndarray. + + def setup(self): + x = np.arange(5, dtype='float') + mx = msubarray(x, mask=[0, 1, 0, 0, 0]) + self.data = (x, mx) + + def test_data_subclassing(self): + # Tests whether the subclass is kept. + x = np.arange(5) + m = [0, 0, 1, 0, 0] + xsub = SubArray(x) + xmsub = masked_array(xsub, mask=m) + assert_(isinstance(xmsub, MaskedArray)) + assert_equal(xmsub._data, xsub) + assert_(isinstance(xmsub._data, SubArray)) + + def test_maskedarray_subclassing(self): + # Tests subclassing MaskedArray + (x, mx) = self.data + assert_(isinstance(mx._data, subarray)) + + def test_masked_unary_operations(self): + # Tests masked_unary_operation + (x, mx) = self.data + with np.errstate(divide='ignore'): + assert_(isinstance(log(mx), msubarray)) + assert_equal(log(x), np.log(x)) + + def test_masked_binary_operations(self): + # Tests masked_binary_operation + (x, mx) = self.data + # Result should be a msubarray + assert_(isinstance(add(mx, mx), msubarray)) + assert_(isinstance(add(mx, x), msubarray)) + # Result should work + assert_equal(add(mx, x), mx+x) + assert_(isinstance(add(mx, mx)._data, subarray)) + assert_(isinstance(add.outer(mx, mx), msubarray)) + assert_(isinstance(hypot(mx, mx), msubarray)) + assert_(isinstance(hypot(mx, x), msubarray)) + + def test_masked_binary_operations2(self): + # Tests domained_masked_binary_operation + (x, mx) = self.data + xmx = masked_array(mx.data.__array__(), mask=mx.mask) + assert_(isinstance(divide(mx, mx), msubarray)) + assert_(isinstance(divide(mx, x), msubarray)) + assert_equal(divide(mx, mx), divide(xmx, xmx)) + + def test_attributepropagation(self): + x = array(arange(5), mask=[0]+[1]*4) + my = masked_array(subarray(x)) + ym = msubarray(x) + # + z = (my+1) + assert_(isinstance(z, MaskedArray)) + assert_(not isinstance(z, MSubArray)) + assert_(isinstance(z._data, SubArray)) + assert_equal(z._data.info, {}) + # + z = (ym+1) + assert_(isinstance(z, MaskedArray)) + assert_(isinstance(z, MSubArray)) + assert_(isinstance(z._data, SubArray)) + assert_(z._data.info['added'] > 0) + # Test that inplace methods from data get used (gh-4617) + ym += 1 + assert_(isinstance(ym, MaskedArray)) + assert_(isinstance(ym, MSubArray)) + assert_(isinstance(ym._data, SubArray)) + assert_(ym._data.info['iadded'] > 0) + # + ym._set_mask([1, 0, 0, 0, 1]) + assert_equal(ym._mask, [1, 0, 0, 0, 1]) + ym._series._set_mask([0, 0, 0, 0, 1]) + assert_equal(ym._mask, [0, 0, 0, 0, 1]) + # + xsub = subarray(x, info={'name':'x'}) + mxsub = masked_array(xsub) + assert_(hasattr(mxsub, 'info')) + assert_equal(mxsub.info, xsub.info) + + def test_subclasspreservation(self): + # Checks that masked_array(...,subok=True) preserves the class. + x = np.arange(5) + m = [0, 0, 1, 0, 0] + xinfo = [(i, j) for (i, j) in zip(x, m)] + xsub = MSubArray(x, mask=m, info={'xsub':xinfo}) + # + mxsub = masked_array(xsub, subok=False) + assert_(not isinstance(mxsub, MSubArray)) + assert_(isinstance(mxsub, MaskedArray)) + assert_equal(mxsub._mask, m) + # + mxsub = asarray(xsub) + assert_(not isinstance(mxsub, MSubArray)) + assert_(isinstance(mxsub, MaskedArray)) + assert_equal(mxsub._mask, m) + # + mxsub = masked_array(xsub, subok=True) + assert_(isinstance(mxsub, MSubArray)) + assert_equal(mxsub.info, xsub.info) + assert_equal(mxsub._mask, xsub._mask) + # + mxsub = asanyarray(xsub) + assert_(isinstance(mxsub, MSubArray)) + assert_equal(mxsub.info, xsub.info) + assert_equal(mxsub._mask, m) + + def test_subclass_items(self): + """test that getter and setter go via baseclass""" + x = np.arange(5) + xcsub = ComplicatedSubArray(x) + mxcsub = masked_array(xcsub, mask=[True, False, True, False, False]) + # getter should return a ComplicatedSubArray, even for single item + # first check we wrote ComplicatedSubArray correctly + assert_(isinstance(xcsub[1], ComplicatedSubArray)) + assert_(isinstance(xcsub[1,...], ComplicatedSubArray)) + assert_(isinstance(xcsub[1:4], ComplicatedSubArray)) + + # now that it propagates inside the MaskedArray + assert_(isinstance(mxcsub[1], ComplicatedSubArray)) + assert_(isinstance(mxcsub[1,...].data, ComplicatedSubArray)) + assert_(mxcsub[0] is masked) + assert_(isinstance(mxcsub[0,...].data, ComplicatedSubArray)) + assert_(isinstance(mxcsub[1:4].data, ComplicatedSubArray)) + + # also for flattened version (which goes via MaskedIterator) + assert_(isinstance(mxcsub.flat[1].data, ComplicatedSubArray)) + assert_(mxcsub.flat[0] is masked) + assert_(isinstance(mxcsub.flat[1:4].base, ComplicatedSubArray)) + + # setter should only work with ComplicatedSubArray input + # first check we wrote ComplicatedSubArray correctly + assert_raises(ValueError, xcsub.__setitem__, 1, x[4]) + # now that it propagates inside the MaskedArray + assert_raises(ValueError, mxcsub.__setitem__, 1, x[4]) + assert_raises(ValueError, mxcsub.__setitem__, slice(1, 4), x[1:4]) + mxcsub[1] = xcsub[4] + mxcsub[1:4] = xcsub[1:4] + # also for flattened version (which goes via MaskedIterator) + assert_raises(ValueError, mxcsub.flat.__setitem__, 1, x[4]) + assert_raises(ValueError, mxcsub.flat.__setitem__, slice(1, 4), x[1:4]) + mxcsub.flat[1] = xcsub[4] + mxcsub.flat[1:4] = xcsub[1:4] + + def test_subclass_nomask_items(self): + x = np.arange(5) + xcsub = ComplicatedSubArray(x) + mxcsub_nomask = masked_array(xcsub) + + assert_(isinstance(mxcsub_nomask[1,...].data, ComplicatedSubArray)) + assert_(isinstance(mxcsub_nomask[0,...].data, ComplicatedSubArray)) + + assert_(isinstance(mxcsub_nomask[1], ComplicatedSubArray)) + assert_(isinstance(mxcsub_nomask[0], ComplicatedSubArray)) + + def test_subclass_repr(self): + """test that repr uses the name of the subclass + and 'array' for np.ndarray""" + x = np.arange(5) + mx = masked_array(x, mask=[True, False, True, False, False]) + assert_startswith(repr(mx), 'masked_array') + xsub = SubArray(x) + mxsub = masked_array(xsub, mask=[True, False, True, False, False]) + assert_startswith(repr(mxsub), + 'masked_{0}(data=[--, 1, --, 3, 4]'.format(SubArray.__name__)) + + def test_subclass_str(self): + """test str with subclass that has overridden str, setitem""" + # first without override + x = np.arange(5) + xsub = SubArray(x) + mxsub = masked_array(xsub, mask=[True, False, True, False, False]) + assert_equal(str(mxsub), '[-- 1 -- 3 4]') + + xcsub = ComplicatedSubArray(x) + assert_raises(ValueError, xcsub.__setitem__, 0, + np.ma.core.masked_print_option) + mxcsub = masked_array(xcsub, mask=[True, False, True, False, False]) + assert_equal(str(mxcsub), 'myprefix [-- 1 -- 3 4] mypostfix') + + def test_pure_subclass_info_preservation(self): + # Test that ufuncs and methods conserve extra information consistently; + # see gh-7122. + arr1 = SubMaskedArray('test', data=[1,2,3,4,5,6]) + arr2 = SubMaskedArray(data=[0,1,2,3,4,5]) + diff1 = np.subtract(arr1, arr2) + assert_('info' in diff1._optinfo) + assert_(diff1._optinfo['info'] == 'test') + diff2 = arr1 - arr2 + assert_('info' in diff2._optinfo) + assert_(diff2._optinfo['info'] == 'test') diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/core/arrays/__init__.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/core/arrays/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..1033ce784046e819c36b30a235a73a1ca381140e --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/core/arrays/__init__.py @@ -0,0 +1,13 @@ +from .array_ import array # noqa +from .base import (ExtensionArray, # noqa + ExtensionOpsMixin, + ExtensionScalarOpsMixin) +from .categorical import Categorical # noqa +from .datetimes import DatetimeArray # noqa +from .interval import IntervalArray # noqa +from .period import PeriodArray, period_array # noqa +from .timedeltas import TimedeltaArray # noqa +from .integer import ( # noqa + IntegerArray, integer_array) +from .sparse import SparseArray # noqa +from .numpy_ import PandasArray, PandasDtype # noqa diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/core/arrays/_ranges.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/core/arrays/_ranges.py new file mode 100644 index 0000000000000000000000000000000000000000..66c1b8e158672eb3f203d6a3d1c6fcf453262f57 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/core/arrays/_ranges.py @@ -0,0 +1,188 @@ +# -*- coding: utf-8 -*- +""" +Helper functions to generate range-like data for DatetimeArray +(and possibly TimedeltaArray/PeriodArray) +""" + +import numpy as np + +from pandas._libs.tslibs import OutOfBoundsDatetime, Timestamp + +from pandas.tseries.offsets import Tick, generate_range + + +def generate_regular_range(start, end, periods, freq): + """ + Generate a range of dates with the spans between dates described by + the given `freq` DateOffset. + + Parameters + ---------- + start : Timestamp or None + first point of produced date range + end : Timestamp or None + last point of produced date range + periods : int + number of periods in produced date range + freq : DateOffset + describes space between dates in produced date range + + Returns + ------- + ndarray[np.int64] representing nanosecond unix timestamps + """ + if isinstance(freq, Tick): + stride = freq.nanos + if periods is None: + b = Timestamp(start).value + # cannot just use e = Timestamp(end) + 1 because arange breaks when + # stride is too large, see GH10887 + e = (b + (Timestamp(end).value - b) // stride * stride + + stride // 2 + 1) + # end.tz == start.tz by this point due to _generate implementation + tz = start.tz + elif start is not None: + b = Timestamp(start).value + e = _generate_range_overflow_safe(b, periods, stride, side='start') + tz = start.tz + elif end is not None: + e = Timestamp(end).value + stride + b = _generate_range_overflow_safe(e, periods, stride, side='end') + tz = end.tz + else: + raise ValueError("at least 'start' or 'end' should be specified " + "if a 'period' is given.") + + with np.errstate(over="raise"): + # If the range is sufficiently large, np.arange may overflow + # and incorrectly return an empty array if not caught. + try: + values = np.arange(b, e, stride, dtype=np.int64) + except FloatingPointError: + xdr = [b] + while xdr[-1] != e: + xdr.append(xdr[-1] + stride) + values = np.array(xdr[:-1], dtype=np.int64) + + else: + tz = None + # start and end should have the same timezone by this point + if start is not None: + tz = start.tz + elif end is not None: + tz = end.tz + + xdr = generate_range(start=start, end=end, + periods=periods, offset=freq) + + values = np.array([x.value for x in xdr], dtype=np.int64) + + return values, tz + + +def _generate_range_overflow_safe(endpoint, periods, stride, side='start'): + """ + Calculate the second endpoint for passing to np.arange, checking + to avoid an integer overflow. Catch OverflowError and re-raise + as OutOfBoundsDatetime. + + Parameters + ---------- + endpoint : int + nanosecond timestamp of the known endpoint of the desired range + periods : int + number of periods in the desired range + stride : int + nanoseconds between periods in the desired range + side : {'start', 'end'} + which end of the range `endpoint` refers to + + Returns + ------- + other_end : int + + Raises + ------ + OutOfBoundsDatetime + """ + # GH#14187 raise instead of incorrectly wrapping around + assert side in ['start', 'end'] + + i64max = np.uint64(np.iinfo(np.int64).max) + msg = ('Cannot generate range with {side}={endpoint} and ' + 'periods={periods}' + .format(side=side, endpoint=endpoint, periods=periods)) + + with np.errstate(over="raise"): + # if periods * strides cannot be multiplied within the *uint64* bounds, + # we cannot salvage the operation by recursing, so raise + try: + addend = np.uint64(periods) * np.uint64(np.abs(stride)) + except FloatingPointError: + raise OutOfBoundsDatetime(msg) + + if np.abs(addend) <= i64max: + # relatively easy case without casting concerns + return _generate_range_overflow_safe_signed( + endpoint, periods, stride, side) + + elif ((endpoint > 0 and side == 'start' and stride > 0) or + (endpoint < 0 and side == 'end' and stride > 0)): + # no chance of not-overflowing + raise OutOfBoundsDatetime(msg) + + elif (side == 'end' and endpoint > i64max and endpoint - stride <= i64max): + # in _generate_regular_range we added `stride` thereby overflowing + # the bounds. Adjust to fix this. + return _generate_range_overflow_safe(endpoint - stride, + periods - 1, stride, side) + + # split into smaller pieces + mid_periods = periods // 2 + remaining = periods - mid_periods + assert 0 < remaining < periods, (remaining, periods, endpoint, stride) + + midpoint = _generate_range_overflow_safe(endpoint, mid_periods, + stride, side) + return _generate_range_overflow_safe(midpoint, remaining, stride, side) + + +def _generate_range_overflow_safe_signed(endpoint, periods, stride, side): + """ + A special case for _generate_range_overflow_safe where `periods * stride` + can be calculated without overflowing int64 bounds. + """ + assert side in ['start', 'end'] + if side == 'end': + stride *= -1 + + with np.errstate(over="raise"): + addend = np.int64(periods) * np.int64(stride) + try: + # easy case with no overflows + return np.int64(endpoint) + addend + except (FloatingPointError, OverflowError): + # with endpoint negative and addend positive we risk + # FloatingPointError; with reversed signed we risk OverflowError + pass + + # if stride and endpoint had opposite signs, then endpoint + addend + # should never overflow. so they must have the same signs + assert (stride > 0 and endpoint >= 0) or (stride < 0 and endpoint <= 0) + + if stride > 0: + # watch out for very special case in which we just slightly + # exceed implementation bounds, but when passing the result to + # np.arange will get a result slightly within the bounds + assert endpoint >= 0 + result = np.uint64(endpoint) + np.uint64(addend) + i64max = np.uint64(np.iinfo(np.int64).max) + assert result > i64max + if result <= i64max + np.uint64(stride): + return result + + raise OutOfBoundsDatetime('Cannot generate range with ' + '{side}={endpoint} and ' + 'periods={periods}' + .format(side=side, endpoint=endpoint, + periods=periods)) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/core/arrays/period.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/core/arrays/period.py new file mode 100644 index 0000000000000000000000000000000000000000..e0c71b56090966bd10d63ecdfe7a7c7ef765b0a2 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/core/arrays/period.py @@ -0,0 +1,956 @@ +# -*- coding: utf-8 -*- +from datetime import timedelta +import operator + +import numpy as np + +from pandas._libs.tslibs import ( + NaT, frequencies as libfrequencies, iNaT, period as libperiod) +from pandas._libs.tslibs.fields import isleapyear_arr +from pandas._libs.tslibs.period import ( + DIFFERENT_FREQ, IncompatibleFrequency, Period, get_period_field_arr, + period_asfreq_arr) +from pandas._libs.tslibs.timedeltas import Timedelta, delta_to_nanoseconds +import pandas.compat as compat +from pandas.util._decorators import Appender, cache_readonly + +from pandas.core.dtypes.common import ( + _TD_DTYPE, ensure_object, is_datetime64_dtype, is_float_dtype, + is_list_like, is_period_dtype, pandas_dtype) +from pandas.core.dtypes.dtypes import PeriodDtype +from pandas.core.dtypes.generic import ( + ABCDataFrame, ABCIndexClass, ABCPeriodIndex, ABCSeries) +from pandas.core.dtypes.missing import isna, notna + +import pandas.core.algorithms as algos +from pandas.core.arrays import datetimelike as dtl +import pandas.core.common as com + +from pandas.tseries import frequencies +from pandas.tseries.offsets import DateOffset, Tick, _delta_to_tick + + +def _field_accessor(name, alias, docstring=None): + def f(self): + base, mult = libfrequencies.get_freq_code(self.freq) + result = get_period_field_arr(alias, self.asi8, base) + return result + + f.__name__ = name + f.__doc__ = docstring + return property(f) + + +def _period_array_cmp(cls, op): + """ + Wrap comparison operations to convert Period-like to PeriodDtype + """ + opname = '__{name}__'.format(name=op.__name__) + nat_result = True if opname == '__ne__' else False + + def wrapper(self, other): + op = getattr(self.asi8, opname) + + if isinstance(other, (ABCDataFrame, ABCSeries, ABCIndexClass)): + return NotImplemented + + if is_list_like(other) and len(other) != len(self): + raise ValueError("Lengths must match") + + if isinstance(other, Period): + self._check_compatible_with(other) + + result = op(other.ordinal) + elif isinstance(other, cls): + self._check_compatible_with(other) + + result = op(other.asi8) + + mask = self._isnan | other._isnan + if mask.any(): + result[mask] = nat_result + + return result + elif other is NaT: + result = np.empty(len(self.asi8), dtype=bool) + result.fill(nat_result) + else: + other = Period(other, freq=self.freq) + result = op(other.ordinal) + + if self._hasnans: + result[self._isnan] = nat_result + + return result + + return compat.set_function_name(wrapper, opname, cls) + + +class PeriodArray(dtl.DatetimeLikeArrayMixin, dtl.DatelikeOps): + """ + Pandas ExtensionArray for storing Period data. + + Users should use :func:`period_array` to create new instances. + + Parameters + ---------- + values : Union[PeriodArray, Series[period], ndarary[int], PeriodIndex] + The data to store. These should be arrays that can be directly + converted to ordinals without inference or copy (PeriodArray, + ndarray[int64]), or a box around such an array (Series[period], + PeriodIndex). + freq : str or DateOffset + The `freq` to use for the array. Mostly applicable when `values` + is an ndarray of integers, when `freq` is required. When `values` + is a PeriodArray (or box around), it's checked that ``values.freq`` + matches `freq`. + copy : bool, default False + Whether to copy the ordinals before storing. + + See Also + -------- + period_array : Create a new PeriodArray. + pandas.PeriodIndex : Immutable Index for period data. + + Notes + ----- + There are two components to a PeriodArray + + - ordinals : integer ndarray + - freq : pd.tseries.offsets.Offset + + The values are physically stored as a 1-D ndarray of integers. These are + called "ordinals" and represent some kind of offset from a base. + + The `freq` indicates the span covered by each element of the array. + All elements in the PeriodArray have the same `freq`. + """ + # array priority higher than numpy scalars + __array_priority__ = 1000 + _attributes = ["freq"] + _typ = "periodarray" # ABCPeriodArray + _scalar_type = Period + + # Names others delegate to us + _other_ops = [] + _bool_ops = ['is_leap_year'] + _object_ops = ['start_time', 'end_time', 'freq'] + _field_ops = ['year', 'month', 'day', 'hour', 'minute', 'second', + 'weekofyear', 'weekday', 'week', 'dayofweek', + 'dayofyear', 'quarter', 'qyear', + 'days_in_month', 'daysinmonth'] + _datetimelike_ops = _field_ops + _object_ops + _bool_ops + _datetimelike_methods = ['strftime', 'to_timestamp', 'asfreq'] + + # -------------------------------------------------------------------- + # Constructors + + def __init__(self, values, freq=None, dtype=None, copy=False): + freq = validate_dtype_freq(dtype, freq) + + if freq is not None: + freq = Period._maybe_convert_freq(freq) + + if isinstance(values, ABCSeries): + values = values._values + if not isinstance(values, type(self)): + raise TypeError("Incorrect dtype") + + elif isinstance(values, ABCPeriodIndex): + values = values._values + + if isinstance(values, type(self)): + if freq is not None and freq != values.freq: + msg = DIFFERENT_FREQ.format(cls=type(self).__name__, + own_freq=values.freq.freqstr, + other_freq=freq.freqstr) + raise IncompatibleFrequency(msg) + values, freq = values._data, values.freq + + values = np.array(values, dtype='int64', copy=copy) + self._data = values + if freq is None: + raise ValueError('freq is not specified and cannot be inferred') + self._dtype = PeriodDtype(freq) + + @classmethod + def _simple_new(cls, values, freq=None, **kwargs): + # alias for PeriodArray.__init__ + return cls(values, freq=freq, **kwargs) + + @classmethod + def _from_sequence(cls, scalars, dtype=None, copy=False): + # type: (Sequence[Optional[Period]], PeriodDtype, bool) -> PeriodArray + if dtype: + freq = dtype.freq + else: + freq = None + + if isinstance(scalars, cls): + validate_dtype_freq(scalars.dtype, freq) + if copy: + scalars = scalars.copy() + return scalars + + periods = np.asarray(scalars, dtype=object) + if copy: + periods = periods.copy() + + freq = freq or libperiod.extract_freq(periods) + ordinals = libperiod.extract_ordinals(periods, freq) + return cls(ordinals, freq=freq) + + @classmethod + def _from_datetime64(cls, data, freq, tz=None): + """ + Construct a PeriodArray from a datetime64 array + + Parameters + ---------- + data : ndarray[datetime64[ns], datetime64[ns, tz]] + freq : str or Tick + tz : tzinfo, optional + + Returns + ------- + PeriodArray[freq] + """ + data, freq = dt64arr_to_periodarr(data, freq, tz) + return cls(data, freq=freq) + + @classmethod + def _generate_range(cls, start, end, periods, freq, fields): + periods = dtl.validate_periods(periods) + + if freq is not None: + freq = Period._maybe_convert_freq(freq) + + field_count = len(fields) + if start is not None or end is not None: + if field_count > 0: + raise ValueError('Can either instantiate from fields ' + 'or endpoints, but not both') + subarr, freq = _get_ordinal_range(start, end, periods, freq) + elif field_count > 0: + subarr, freq = _range_from_fields(freq=freq, **fields) + else: + raise ValueError('Not enough parameters to construct ' + 'Period range') + + return subarr, freq + + # ----------------------------------------------------------------- + # DatetimeLike Interface + + def _unbox_scalar(self, value): + # type: (Union[Period, NaTType]) -> int + if value is NaT: + return value.value + elif isinstance(value, self._scalar_type): + if not isna(value): + self._check_compatible_with(value) + return value.ordinal + else: + raise ValueError("'value' should be a Period. Got '{val}' instead." + .format(val=value)) + + def _scalar_from_string(self, value): + # type: (str) -> Period + return Period(value, freq=self.freq) + + def _check_compatible_with(self, other): + if other is NaT: + return + if self.freqstr != other.freqstr: + _raise_on_incompatible(self, other) + + # -------------------------------------------------------------------- + # Data / Attributes + + @cache_readonly + def dtype(self): + return self._dtype + + @property + def freq(self): + """ + Return the frequency object for this PeriodArray. + """ + return self.dtype.freq + + def __array__(self, dtype=None): + # overriding DatetimelikeArray + return np.array(list(self), dtype=object) + + # -------------------------------------------------------------------- + # Vectorized analogues of Period properties + + year = _field_accessor('year', 0, "The year of the period") + month = _field_accessor('month', 3, "The month as January=1, December=12") + day = _field_accessor('day', 4, "The days of the period") + hour = _field_accessor('hour', 5, "The hour of the period") + minute = _field_accessor('minute', 6, "The minute of the period") + second = _field_accessor('second', 7, "The second of the period") + weekofyear = _field_accessor('week', 8, "The week ordinal of the year") + week = weekofyear + dayofweek = _field_accessor('dayofweek', 10, + "The day of the week with Monday=0, Sunday=6") + weekday = dayofweek + dayofyear = day_of_year = _field_accessor('dayofyear', 9, + "The ordinal day of the year") + quarter = _field_accessor('quarter', 2, "The quarter of the date") + qyear = _field_accessor('qyear', 1) + days_in_month = _field_accessor('days_in_month', 11, + "The number of days in the month") + daysinmonth = days_in_month + + @property + def is_leap_year(self): + """ + Logical indicating if the date belongs to a leap year + """ + return isleapyear_arr(np.asarray(self.year)) + + @property + def start_time(self): + return self.to_timestamp(how='start') + + @property + def end_time(self): + return self.to_timestamp(how='end') + + def to_timestamp(self, freq=None, how='start'): + """ + Cast to DatetimeArray/Index. + + Parameters + ---------- + freq : string or DateOffset, optional + Target frequency. The default is 'D' for week or longer, + 'S' otherwise + how : {'s', 'e', 'start', 'end'} + + Returns + ------- + DatetimeArray/Index + """ + from pandas.core.arrays import DatetimeArray + + how = libperiod._validate_end_alias(how) + + end = how == 'E' + if end: + if freq == 'B': + # roll forward to ensure we land on B date + adjust = Timedelta(1, 'D') - Timedelta(1, 'ns') + return self.to_timestamp(how='start') + adjust + else: + adjust = Timedelta(1, 'ns') + return (self + self.freq).to_timestamp(how='start') - adjust + + if freq is None: + base, mult = libfrequencies.get_freq_code(self.freq) + freq = libfrequencies.get_to_timestamp_base(base) + else: + freq = Period._maybe_convert_freq(freq) + + base, mult = libfrequencies.get_freq_code(freq) + new_data = self.asfreq(freq, how=how) + + new_data = libperiod.periodarr_to_dt64arr(new_data.asi8, base) + return DatetimeArray._from_sequence(new_data, freq='infer') + + # -------------------------------------------------------------------- + # Array-like / EA-Interface Methods + + def _formatter(self, boxed=False): + if boxed: + return str + return "'{}'".format + + @Appender(dtl.DatetimeLikeArrayMixin._validate_fill_value.__doc__) + def _validate_fill_value(self, fill_value): + if isna(fill_value): + fill_value = iNaT + elif isinstance(fill_value, Period): + self._check_compatible_with(fill_value) + fill_value = fill_value.ordinal + else: + raise ValueError("'fill_value' should be a Period. " + "Got '{got}'.".format(got=fill_value)) + return fill_value + + # -------------------------------------------------------------------- + + def _time_shift(self, periods, freq=None): + """ + Shift each value by `periods`. + + Note this is different from ExtensionArray.shift, which + shifts the *position* of each element, padding the end with + missing values. + + Parameters + ---------- + periods : int + Number of periods to shift by. + freq : pandas.DateOffset, pandas.Timedelta, or string + Frequency increment to shift by. + """ + if freq is not None: + raise TypeError("`freq` argument is not supported for " + "{cls}._time_shift" + .format(cls=type(self).__name__)) + values = self.asi8 + periods * self.freq.n + if self._hasnans: + values[self._isnan] = iNaT + return type(self)(values, freq=self.freq) + + @property + def _box_func(self): + return lambda x: Period._from_ordinal(ordinal=x, freq=self.freq) + + def asfreq(self, freq=None, how='E'): + """ + Convert the Period Array/Index to the specified frequency `freq`. + + Parameters + ---------- + freq : str + a frequency + how : str {'E', 'S'} + 'E', 'END', or 'FINISH' for end, + 'S', 'START', or 'BEGIN' for start. + Whether the elements should be aligned to the end + or start within pa period. January 31st ('END') vs. + January 1st ('START') for example. + + Returns + ------- + new : Period Array/Index with the new frequency + + Examples + -------- + >>> pidx = pd.period_range('2010-01-01', '2015-01-01', freq='A') + >>> pidx + + [2010, ..., 2015] + Length: 6, Freq: A-DEC + + >>> pidx.asfreq('M') + + [2010-12, ..., 2015-12] + Length: 6, Freq: M + + >>> pidx.asfreq('M', how='S') + + [2010-01, ..., 2015-01] + Length: 6, Freq: M + """ + how = libperiod._validate_end_alias(how) + + freq = Period._maybe_convert_freq(freq) + + base1, mult1 = libfrequencies.get_freq_code(self.freq) + base2, mult2 = libfrequencies.get_freq_code(freq) + + asi8 = self.asi8 + # mult1 can't be negative or 0 + end = how == 'E' + if end: + ordinal = asi8 + mult1 - 1 + else: + ordinal = asi8 + + new_data = period_asfreq_arr(ordinal, base1, base2, end) + + if self._hasnans: + new_data[self._isnan] = iNaT + + return type(self)(new_data, freq=freq) + + # ------------------------------------------------------------------ + # Rendering Methods + + def _format_native_types(self, na_rep=u'NaT', date_format=None, **kwargs): + """ + actually format my specific types + """ + values = self.astype(object) + + if date_format: + formatter = lambda dt: dt.strftime(date_format) + else: + formatter = lambda dt: u'%s' % dt + + if self._hasnans: + mask = self._isnan + values[mask] = na_rep + imask = ~mask + values[imask] = np.array([formatter(dt) for dt + in values[imask]]) + else: + values = np.array([formatter(dt) for dt in values]) + return values + + # ------------------------------------------------------------------ + + def astype(self, dtype, copy=True): + # We handle Period[T] -> Period[U] + # Our parent handles everything else. + dtype = pandas_dtype(dtype) + + if is_period_dtype(dtype): + return self.asfreq(dtype.freq) + return super(PeriodArray, self).astype(dtype, copy=copy) + + @property + def flags(self): + # TODO: remove + # We need this since reduction.SeriesBinGrouper uses values.flags + # Ideally, we wouldn't be passing objects down there in the first + # place. + return self._data.flags + + # ------------------------------------------------------------------ + # Arithmetic Methods + _create_comparison_method = classmethod(_period_array_cmp) + + def _sub_datelike(self, other): + assert other is not NaT + return NotImplemented + + def _sub_period(self, other): + # If the operation is well-defined, we return an object-Index + # of DateOffsets. Null entries are filled with pd.NaT + self._check_compatible_with(other) + asi8 = self.asi8 + new_data = asi8 - other.ordinal + new_data = np.array([self.freq * x for x in new_data]) + + if self._hasnans: + new_data[self._isnan] = NaT + + return new_data + + @Appender(dtl.DatetimeLikeArrayMixin._addsub_int_array.__doc__) + def _addsub_int_array( + self, + other, # type: Union[Index, ExtensionArray, np.ndarray[int]] + op # type: Callable[Any, Any] + ): + # type: (...) -> PeriodArray + + assert op in [operator.add, operator.sub] + if op is operator.sub: + other = -other + res_values = algos.checked_add_with_arr(self.asi8, other, + arr_mask=self._isnan) + res_values = res_values.view('i8') + res_values[self._isnan] = iNaT + return type(self)(res_values, freq=self.freq) + + def _add_offset(self, other): + assert not isinstance(other, Tick) + base = libfrequencies.get_base_alias(other.rule_code) + if base != self.freq.rule_code: + _raise_on_incompatible(self, other) + + # Note: when calling parent class's _add_timedeltalike_scalar, + # it will call delta_to_nanoseconds(delta). Because delta here + # is an integer, delta_to_nanoseconds will return it unchanged. + result = super(PeriodArray, self)._add_timedeltalike_scalar(other.n) + return type(self)(result, freq=self.freq) + + def _add_timedeltalike_scalar(self, other): + """ + Parameters + ---------- + other : timedelta, Tick, np.timedelta64 + + Returns + ------- + result : ndarray[int64] + """ + assert isinstance(self.freq, Tick) # checked by calling function + assert isinstance(other, (timedelta, np.timedelta64, Tick)) + + if notna(other): + # special handling for np.timedelta64("NaT"), avoid calling + # _check_timedeltalike_freq_compat as that would raise TypeError + other = self._check_timedeltalike_freq_compat(other) + + # Note: when calling parent class's _add_timedeltalike_scalar, + # it will call delta_to_nanoseconds(delta). Because delta here + # is an integer, delta_to_nanoseconds will return it unchanged. + ordinals = super(PeriodArray, self)._add_timedeltalike_scalar(other) + return ordinals + + def _add_delta_tdi(self, other): + """ + Parameters + ---------- + other : TimedeltaArray or ndarray[timedelta64] + + Returns + ------- + result : ndarray[int64] + """ + assert isinstance(self.freq, Tick) # checked by calling function + + delta = self._check_timedeltalike_freq_compat(other) + return self._addsub_int_array(delta, operator.add).asi8 + + def _add_delta(self, other): + """ + Add a timedelta-like, Tick, or TimedeltaIndex-like object + to self, yielding a new PeriodArray + + Parameters + ---------- + other : {timedelta, np.timedelta64, Tick, + TimedeltaIndex, ndarray[timedelta64]} + + Returns + ------- + result : PeriodArray + """ + if not isinstance(self.freq, Tick): + # We cannot add timedelta-like to non-tick PeriodArray + _raise_on_incompatible(self, other) + + new_ordinals = super(PeriodArray, self)._add_delta(other) + return type(self)(new_ordinals, freq=self.freq) + + def _check_timedeltalike_freq_compat(self, other): + """ + Arithmetic operations with timedelta-like scalars or array `other` + are only valid if `other` is an integer multiple of `self.freq`. + If the operation is valid, find that integer multiple. Otherwise, + raise because the operation is invalid. + + Parameters + ---------- + other : timedelta, np.timedelta64, Tick, + ndarray[timedelta64], TimedeltaArray, TimedeltaIndex + + Returns + ------- + multiple : int or ndarray[int64] + + Raises + ------ + IncompatibleFrequency + """ + assert isinstance(self.freq, Tick) # checked by calling function + own_offset = frequencies.to_offset(self.freq.rule_code) + base_nanos = delta_to_nanoseconds(own_offset) + + if isinstance(other, (timedelta, np.timedelta64, Tick)): + nanos = delta_to_nanoseconds(other) + + elif isinstance(other, np.ndarray): + # numpy timedelta64 array; all entries must be compatible + assert other.dtype.kind == 'm' + if other.dtype != _TD_DTYPE: + # i.e. non-nano unit + # TODO: disallow unit-less timedelta64 + other = other.astype(_TD_DTYPE) + nanos = other.view('i8') + else: + # TimedeltaArray/Index + nanos = other.asi8 + + if np.all(nanos % base_nanos == 0): + # nanos being added is an integer multiple of the + # base-frequency to self.freq + delta = nanos // base_nanos + # delta is the integer (or integer-array) number of periods + # by which will be added to self. + return delta + + _raise_on_incompatible(self, other) + + def _values_for_argsort(self): + return self._data + + +PeriodArray._add_comparison_ops() + + +def _raise_on_incompatible(left, right): + """ + Helper function to render a consistent error message when raising + IncompatibleFrequency. + + Parameters + ---------- + left : PeriodArray + right : DateOffset, Period, ndarray, or timedelta-like + + Raises + ------ + IncompatibleFrequency + """ + # GH#24283 error message format depends on whether right is scalar + if isinstance(right, np.ndarray): + other_freq = None + elif isinstance(right, (ABCPeriodIndex, PeriodArray, Period, DateOffset)): + other_freq = right.freqstr + else: + other_freq = _delta_to_tick(Timedelta(right)).freqstr + + msg = DIFFERENT_FREQ.format(cls=type(left).__name__, + own_freq=left.freqstr, + other_freq=other_freq) + raise IncompatibleFrequency(msg) + + +# ------------------------------------------------------------------- +# Constructor Helpers + +def period_array(data, freq=None, copy=False): + # type: (Sequence[Optional[Period]], Optional[Tick]) -> PeriodArray + """ + Construct a new PeriodArray from a sequence of Period scalars. + + Parameters + ---------- + data : Sequence of Period objects + A sequence of Period objects. These are required to all have + the same ``freq.`` Missing values can be indicated by ``None`` + or ``pandas.NaT``. + freq : str, Tick, or Offset + The frequency of every element of the array. This can be specified + to avoid inferring the `freq` from `data`. + copy : bool, default False + Whether to ensure a copy of the data is made. + + Returns + ------- + PeriodArray + + See Also + -------- + PeriodArray + pandas.PeriodIndex + + Examples + -------- + >>> period_array([pd.Period('2017', freq='A'), + ... pd.Period('2018', freq='A')]) + + ['2017', '2018'] + Length: 2, dtype: period[A-DEC] + + >>> period_array([pd.Period('2017', freq='A'), + ... pd.Period('2018', freq='A'), + ... pd.NaT]) + + ['2017', '2018', 'NaT'] + Length: 3, dtype: period[A-DEC] + + Integers that look like years are handled + + >>> period_array([2000, 2001, 2002], freq='D') + ['2000-01-01', '2001-01-01', '2002-01-01'] + Length: 3, dtype: period[D] + + Datetime-like strings may also be passed + + >>> period_array(['2000-Q1', '2000-Q2', '2000-Q3', '2000-Q4'], freq='Q') + + ['2000Q1', '2000Q2', '2000Q3', '2000Q4'] + Length: 4, dtype: period[Q-DEC] + """ + if is_datetime64_dtype(data): + return PeriodArray._from_datetime64(data, freq) + if isinstance(data, (ABCPeriodIndex, ABCSeries, PeriodArray)): + return PeriodArray(data, freq) + + # other iterable of some kind + if not isinstance(data, (np.ndarray, list, tuple)): + data = list(data) + + data = np.asarray(data) + + if freq: + dtype = PeriodDtype(freq) + else: + dtype = None + + if is_float_dtype(data) and len(data) > 0: + raise TypeError("PeriodIndex does not allow " + "floating point in construction") + + data = ensure_object(data) + + return PeriodArray._from_sequence(data, dtype=dtype) + + +def validate_dtype_freq(dtype, freq): + """ + If both a dtype and a freq are available, ensure they match. If only + dtype is available, extract the implied freq. + + Parameters + ---------- + dtype : dtype + freq : DateOffset or None + + Returns + ------- + freq : DateOffset + + Raises + ------ + ValueError : non-period dtype + IncompatibleFrequency : mismatch between dtype and freq + """ + if freq is not None: + freq = frequencies.to_offset(freq) + + if dtype is not None: + dtype = pandas_dtype(dtype) + if not is_period_dtype(dtype): + raise ValueError('dtype must be PeriodDtype') + if freq is None: + freq = dtype.freq + elif freq != dtype.freq: + raise IncompatibleFrequency('specified freq and dtype ' + 'are different') + return freq + + +def dt64arr_to_periodarr(data, freq, tz=None): + """ + Convert an datetime-like array to values Period ordinals. + + Parameters + ---------- + data : Union[Series[datetime64[ns]], DatetimeIndex, ndarray[datetime64ns]] + freq : Optional[Union[str, Tick]] + Must match the `freq` on the `data` if `data` is a DatetimeIndex + or Series. + tz : Optional[tzinfo] + + Returns + ------- + ordinals : ndarray[int] + freq : Tick + The frequencey extracted from the Series or DatetimeIndex if that's + used. + + """ + if data.dtype != np.dtype('M8[ns]'): + raise ValueError('Wrong dtype: {dtype}'.format(dtype=data.dtype)) + + if freq is None: + if isinstance(data, ABCIndexClass): + data, freq = data._values, data.freq + elif isinstance(data, ABCSeries): + data, freq = data._values, data.dt.freq + + freq = Period._maybe_convert_freq(freq) + + if isinstance(data, (ABCIndexClass, ABCSeries)): + data = data._values + + base, mult = libfrequencies.get_freq_code(freq) + return libperiod.dt64arr_to_periodarr(data.view('i8'), base, tz), freq + + +def _get_ordinal_range(start, end, periods, freq, mult=1): + if com.count_not_none(start, end, periods) != 2: + raise ValueError('Of the three parameters: start, end, and periods, ' + 'exactly two must be specified') + + if freq is not None: + _, mult = libfrequencies.get_freq_code(freq) + + if start is not None: + start = Period(start, freq) + if end is not None: + end = Period(end, freq) + + is_start_per = isinstance(start, Period) + is_end_per = isinstance(end, Period) + + if is_start_per and is_end_per and start.freq != end.freq: + raise ValueError('start and end must have same freq') + if (start is NaT or end is NaT): + raise ValueError('start and end must not be NaT') + + if freq is None: + if is_start_per: + freq = start.freq + elif is_end_per: + freq = end.freq + else: # pragma: no cover + raise ValueError('Could not infer freq from start/end') + + if periods is not None: + periods = periods * mult + if start is None: + data = np.arange(end.ordinal - periods + mult, + end.ordinal + 1, mult, + dtype=np.int64) + else: + data = np.arange(start.ordinal, start.ordinal + periods, mult, + dtype=np.int64) + else: + data = np.arange(start.ordinal, end.ordinal + 1, mult, dtype=np.int64) + + return data, freq + + +def _range_from_fields(year=None, month=None, quarter=None, day=None, + hour=None, minute=None, second=None, freq=None): + if hour is None: + hour = 0 + if minute is None: + minute = 0 + if second is None: + second = 0 + if day is None: + day = 1 + + ordinals = [] + + if quarter is not None: + if freq is None: + freq = 'Q' + base = libfrequencies.FreqGroup.FR_QTR + else: + base, mult = libfrequencies.get_freq_code(freq) + if base != libfrequencies.FreqGroup.FR_QTR: + raise AssertionError("base must equal FR_QTR") + + year, quarter = _make_field_arrays(year, quarter) + for y, q in compat.zip(year, quarter): + y, m = libperiod.quarter_to_myear(y, q, freq) + val = libperiod.period_ordinal(y, m, 1, 1, 1, 1, 0, 0, base) + ordinals.append(val) + else: + base, mult = libfrequencies.get_freq_code(freq) + arrays = _make_field_arrays(year, month, day, hour, minute, second) + for y, mth, d, h, mn, s in compat.zip(*arrays): + ordinals.append(libperiod.period_ordinal( + y, mth, d, h, mn, s, 0, 0, base)) + + return np.array(ordinals, dtype=np.int64), freq + + +def _make_field_arrays(*fields): + length = None + for x in fields: + if isinstance(x, (list, np.ndarray, ABCSeries)): + if length is not None and len(x) != length: + raise ValueError('Mismatched Period array lengths') + elif length is None: + length = len(x) + + arrays = [np.asarray(x) if isinstance(x, (np.ndarray, list, ABCSeries)) + else np.repeat(x, length) for x in fields] + + return arrays diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/core/arrays/sparse.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/core/arrays/sparse.py new file mode 100644 index 0000000000000000000000000000000000000000..6114e578dc90fbb08b50fdfebb275b4a87490400 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/core/arrays/sparse.py @@ -0,0 +1,2028 @@ +""" +SparseArray data structure +""" +from __future__ import division + +import numbers +import operator +import re +import warnings + +import numpy as np + +from pandas._libs import index as libindex, lib +import pandas._libs.sparse as splib +from pandas._libs.sparse import BlockIndex, IntIndex +from pandas._libs.tslibs import NaT +import pandas.compat as compat +from pandas.compat.numpy import function as nv +from pandas.errors import PerformanceWarning + +from pandas.core.dtypes.base import ExtensionDtype +from pandas.core.dtypes.cast import ( + astype_nansafe, construct_1d_arraylike_from_scalar, find_common_type, + infer_dtype_from_scalar, maybe_convert_platform) +from pandas.core.dtypes.common import ( + is_array_like, is_bool_dtype, is_datetime64_any_dtype, is_dtype_equal, + is_integer, is_list_like, is_object_dtype, is_scalar, is_string_dtype, + pandas_dtype) +from pandas.core.dtypes.dtypes import register_extension_dtype +from pandas.core.dtypes.generic import ( + ABCIndexClass, ABCSeries, ABCSparseSeries) +from pandas.core.dtypes.missing import isna, na_value_for_dtype, notna + +from pandas.core.accessor import PandasDelegate, delegate_names +import pandas.core.algorithms as algos +from pandas.core.arrays import ExtensionArray, ExtensionOpsMixin +from pandas.core.base import PandasObject +import pandas.core.common as com +from pandas.core.missing import interpolate_2d + +import pandas.io.formats.printing as printing + + +# ---------------------------------------------------------------------------- +# Dtype +@register_extension_dtype +class SparseDtype(ExtensionDtype): + """ + Dtype for data stored in :class:`SparseArray`. + + This dtype implements the pandas ExtensionDtype interface. + + .. versionadded:: 0.24.0 + + Parameters + ---------- + dtype : str, ExtensionDtype, numpy.dtype, type, default numpy.float64 + The dtype of the underlying array storing the non-fill value values. + fill_value : scalar, optional + The scalar value not stored in the SparseArray. By default, this + depends on `dtype`. + + =========== ========== + dtype na_value + =========== ========== + float ``np.nan`` + int ``0`` + bool ``False`` + datetime64 ``pd.NaT`` + timedelta64 ``pd.NaT`` + =========== ========== + + The default value may be overridden by specifying a `fill_value`. + """ + # We include `_is_na_fill_value` in the metadata to avoid hash collisions + # between SparseDtype(float, 0.0) and SparseDtype(float, nan). + # Without is_na_fill_value in the comparison, those would be equal since + # hash(nan) is (sometimes?) 0. + _metadata = ('_dtype', '_fill_value', '_is_na_fill_value') + + def __init__(self, dtype=np.float64, fill_value=None): + # type: (Union[str, np.dtype, 'ExtensionDtype', type], Any) -> None + from pandas.core.dtypes.missing import na_value_for_dtype + from pandas.core.dtypes.common import ( + pandas_dtype, is_string_dtype, is_scalar + ) + + if isinstance(dtype, type(self)): + if fill_value is None: + fill_value = dtype.fill_value + dtype = dtype.subtype + + dtype = pandas_dtype(dtype) + if is_string_dtype(dtype): + dtype = np.dtype('object') + + if fill_value is None: + fill_value = na_value_for_dtype(dtype) + + if not is_scalar(fill_value): + raise ValueError("fill_value must be a scalar. Got {} " + "instead".format(fill_value)) + self._dtype = dtype + self._fill_value = fill_value + + def __hash__(self): + # Python3 doesn't inherit __hash__ when a base class overrides + # __eq__, so we explicitly do it here. + return super(SparseDtype, self).__hash__() + + def __eq__(self, other): + # We have to override __eq__ to handle NA values in _metadata. + # The base class does simple == checks, which fail for NA. + if isinstance(other, compat.string_types): + try: + other = self.construct_from_string(other) + except TypeError: + return False + + if isinstance(other, type(self)): + subtype = self.subtype == other.subtype + if self._is_na_fill_value: + # this case is complicated by two things: + # SparseDtype(float, float(nan)) == SparseDtype(float, np.nan) + # SparseDtype(float, np.nan) != SparseDtype(float, pd.NaT) + # i.e. we want to treat any floating-point NaN as equal, but + # not a floating-point NaN and a datetime NaT. + fill_value = ( + other._is_na_fill_value and + isinstance(self.fill_value, type(other.fill_value)) or + isinstance(other.fill_value, type(self.fill_value)) + ) + else: + fill_value = self.fill_value == other.fill_value + + return subtype and fill_value + return False + + @property + def fill_value(self): + """ + The fill value of the array. + + Converting the SparseArray to a dense ndarray will fill the + array with this value. + + .. warning:: + + It's possible to end up with a SparseArray that has ``fill_value`` + values in ``sp_values``. This can occur, for example, when setting + ``SparseArray.fill_value`` directly. + """ + return self._fill_value + + @property + def _is_na_fill_value(self): + from pandas.core.dtypes.missing import isna + return isna(self.fill_value) + + @property + def _is_numeric(self): + from pandas.core.dtypes.common import is_object_dtype + return not is_object_dtype(self.subtype) + + @property + def _is_boolean(self): + from pandas.core.dtypes.common import is_bool_dtype + return is_bool_dtype(self.subtype) + + @property + def kind(self): + """ + The sparse kind. Either 'integer', or 'block'. + """ + return self.subtype.kind + + @property + def type(self): + return self.subtype.type + + @property + def subtype(self): + return self._dtype + + @property + def name(self): + return 'Sparse[{}, {}]'.format(self.subtype.name, self.fill_value) + + def __repr__(self): + return self.name + + @classmethod + def construct_array_type(cls): + return SparseArray + + @classmethod + def construct_from_string(cls, string): + """ + Construct a SparseDtype from a string form. + + Parameters + ---------- + string : str + Can take the following forms. + + string dtype + ================ ============================ + 'int' SparseDtype[np.int64, 0] + 'Sparse' SparseDtype[np.float64, nan] + 'Sparse[int]' SparseDtype[np.int64, 0] + 'Sparse[int, 0]' SparseDtype[np.int64, 0] + ================ ============================ + + It is not possible to specify non-default fill values + with a string. An argument like ``'Sparse[int, 1]'`` + will raise a ``TypeError`` because the default fill value + for integers is 0. + + Returns + ------- + SparseDtype + """ + msg = "Could not construct SparseDtype from '{}'".format(string) + if string.startswith("Sparse"): + try: + sub_type, has_fill_value = cls._parse_subtype(string) + result = SparseDtype(sub_type) + except Exception: + raise TypeError(msg) + else: + msg = ("Could not construct SparseDtype from '{}'.\n\nIt " + "looks like the fill_value in the string is not " + "the default for the dtype. Non-default fill_values " + "are not supported. Use the 'SparseDtype()' " + "constructor instead.") + if has_fill_value and str(result) != string: + raise TypeError(msg.format(string)) + return result + else: + raise TypeError(msg) + + @staticmethod + def _parse_subtype(dtype): + """ + Parse a string to get the subtype + + Parameters + ---------- + dtype : str + A string like + + * Sparse[subtype] + * Sparse[subtype, fill_value] + + Returns + ------- + subtype : str + + Raises + ------ + ValueError + When the subtype cannot be extracted. + """ + xpr = re.compile( + r"Sparse\[(?P[^,]*)(, )?(?P.*?)?\]$" + ) + m = xpr.match(dtype) + has_fill_value = False + if m: + subtype = m.groupdict()['subtype'] + has_fill_value = m.groupdict()['fill_value'] or has_fill_value + elif dtype == "Sparse": + subtype = 'float64' + else: + raise ValueError("Cannot parse {}".format(dtype)) + return subtype, has_fill_value + + @classmethod + def is_dtype(cls, dtype): + dtype = getattr(dtype, 'dtype', dtype) + if (isinstance(dtype, compat.string_types) and + dtype.startswith("Sparse")): + sub_type, _ = cls._parse_subtype(dtype) + dtype = np.dtype(sub_type) + elif isinstance(dtype, cls): + return True + return isinstance(dtype, np.dtype) or dtype == 'Sparse' + + def update_dtype(self, dtype): + """ + Convert the SparseDtype to a new dtype. + + This takes care of converting the ``fill_value``. + + Parameters + ---------- + dtype : Union[str, numpy.dtype, SparseDtype] + The new dtype to use. + + * For a SparseDtype, it is simply returned + * For a NumPy dtype (or str), the current fill value + is converted to the new dtype, and a SparseDtype + with `dtype` and the new fill value is returned. + + Returns + ------- + SparseDtype + A new SparseDtype with the corret `dtype` and fill value + for that `dtype`. + + Raises + ------ + ValueError + When the current fill value cannot be converted to the + new `dtype` (e.g. trying to convert ``np.nan`` to an + integer dtype). + + + Examples + -------- + >>> SparseDtype(int, 0).update_dtype(float) + Sparse[float64, 0.0] + + >>> SparseDtype(int, 1).update_dtype(SparseDtype(float, np.nan)) + Sparse[float64, nan] + """ + cls = type(self) + dtype = pandas_dtype(dtype) + + if not isinstance(dtype, cls): + fill_value = astype_nansafe(np.array(self.fill_value), + dtype).item() + dtype = cls(dtype, fill_value=fill_value) + + return dtype + + @property + def _subtype_with_str(self): + """ + Whether the SparseDtype's subtype should be considered ``str``. + + Typically, pandas will store string data in an object-dtype array. + When converting values to a dtype, e.g. in ``.astype``, we need to + be more specific, we need the actual underlying type. + + Returns + ------- + + >>> SparseDtype(int, 1)._subtype_with_str + dtype('int64') + + >>> SparseDtype(object, 1)._subtype_with_str + dtype('O') + + >>> dtype = SparseDtype(str, '') + >>> dtype.subtype + dtype('O') + + >>> dtype._subtype_with_str + str + """ + if isinstance(self.fill_value, compat.string_types): + return type(self.fill_value) + return self.subtype + + +# ---------------------------------------------------------------------------- +# Array + + +_sparray_doc_kwargs = dict(klass='SparseArray') + + +def _get_fill(arr): + # type: (SparseArray) -> ndarray + """ + Create a 0-dim ndarray containing the fill value + + Parameters + ---------- + arr : SparseArray + + Returns + ------- + fill_value : ndarray + 0-dim ndarray with just the fill value. + + Notes + ----- + coerce fill_value to arr dtype if possible + int64 SparseArray can have NaN as fill_value if there is no missing + """ + try: + return np.asarray(arr.fill_value, dtype=arr.dtype.subtype) + except ValueError: + return np.asarray(arr.fill_value) + + +def _sparse_array_op(left, right, op, name): + """ + Perform a binary operation between two arrays. + + Parameters + ---------- + left : Union[SparseArray, ndarray] + right : Union[SparseArray, ndarray] + op : Callable + The binary operation to perform + name str + Name of the callable. + + Returns + ------- + SparseArray + """ + # type: (SparseArray, SparseArray, Callable, str) -> Any + if name.startswith('__'): + # For lookups in _libs.sparse we need non-dunder op name + name = name[2:-2] + + # dtype used to find corresponding sparse method + ltype = left.dtype.subtype + rtype = right.dtype.subtype + + if not is_dtype_equal(ltype, rtype): + subtype = find_common_type([ltype, rtype]) + ltype = SparseDtype(subtype, left.fill_value) + rtype = SparseDtype(subtype, right.fill_value) + + # TODO(GH-23092): pass copy=False. Need to fix astype_nansafe + left = left.astype(ltype) + right = right.astype(rtype) + dtype = ltype.subtype + else: + dtype = ltype + + # dtype the result must have + result_dtype = None + + if left.sp_index.ngaps == 0 or right.sp_index.ngaps == 0: + with np.errstate(all='ignore'): + result = op(left.get_values(), right.get_values()) + fill = op(_get_fill(left), _get_fill(right)) + + if left.sp_index.ngaps == 0: + index = left.sp_index + else: + index = right.sp_index + elif left.sp_index.equals(right.sp_index): + with np.errstate(all='ignore'): + result = op(left.sp_values, right.sp_values) + fill = op(_get_fill(left), _get_fill(right)) + index = left.sp_index + else: + if name[0] == 'r': + left, right = right, left + name = name[1:] + + if name in ('and', 'or') and dtype == 'bool': + opname = 'sparse_{name}_uint8'.format(name=name) + # to make template simple, cast here + left_sp_values = left.sp_values.view(np.uint8) + right_sp_values = right.sp_values.view(np.uint8) + result_dtype = np.bool + else: + opname = 'sparse_{name}_{dtype}'.format(name=name, dtype=dtype) + left_sp_values = left.sp_values + right_sp_values = right.sp_values + + sparse_op = getattr(splib, opname) + + with np.errstate(all='ignore'): + result, index, fill = sparse_op( + left_sp_values, left.sp_index, left.fill_value, + right_sp_values, right.sp_index, right.fill_value) + + if result_dtype is None: + result_dtype = result.dtype + + return _wrap_result(name, result, index, fill, dtype=result_dtype) + + +def _wrap_result(name, data, sparse_index, fill_value, dtype=None): + """ + wrap op result to have correct dtype + """ + if name.startswith('__'): + # e.g. __eq__ --> eq + name = name[2:-2] + + if name in ('eq', 'ne', 'lt', 'gt', 'le', 'ge'): + dtype = np.bool + + fill_value = lib.item_from_zerodim(fill_value) + + if is_bool_dtype(dtype): + # fill_value may be np.bool_ + fill_value = bool(fill_value) + return SparseArray(data, + sparse_index=sparse_index, + fill_value=fill_value, + dtype=dtype) + + +class SparseArray(PandasObject, ExtensionArray, ExtensionOpsMixin): + """ + An ExtensionArray for storing sparse data. + + .. versionchanged:: 0.24.0 + + Implements the ExtensionArray interface. + + Parameters + ---------- + data : array-like + A dense array of values to store in the SparseArray. This may contain + `fill_value`. + sparse_index : SparseIndex, optional + index : Index + fill_value : scalar, optional + Elements in `data` that are `fill_value` are not stored in the + SparseArray. For memory savings, this should be the most common value + in `data`. By default, `fill_value` depends on the dtype of `data`: + + =========== ========== + data.dtype na_value + =========== ========== + float ``np.nan`` + int ``0`` + bool False + datetime64 ``pd.NaT`` + timedelta64 ``pd.NaT`` + =========== ========== + + The fill value is potentiall specified in three ways. In order of + precedence, these are + + 1. The `fill_value` argument + 2. ``dtype.fill_value`` if `fill_value` is None and `dtype` is + a ``SparseDtype`` + 3. ``data.dtype.fill_value`` if `fill_value` is None and `dtype` + is not a ``SparseDtype`` and `data` is a ``SparseArray``. + + + kind : {'integer', 'block'}, default 'integer' + The type of storage for sparse locations. + + * 'block': Stores a `block` and `block_length` for each + contiguous *span* of sparse values. This is best when + sparse data tends to be clumped together, with large + regsions of ``fill-value`` values between sparse values. + * 'integer': uses an integer to store the location of + each sparse value. + + dtype : np.dtype or SparseDtype, optional + The dtype to use for the SparseArray. For numpy dtypes, this + determines the dtype of ``self.sp_values``. For SparseDtype, + this determines ``self.sp_values`` and ``self.fill_value``. + copy : bool, default False + Whether to explicitly copy the incoming `data` array. + """ + + __array_priority__ = 15 + _pandas_ftype = 'sparse' + _subtyp = 'sparse_array' # register ABCSparseArray + + def __init__(self, data, sparse_index=None, index=None, fill_value=None, + kind='integer', dtype=None, copy=False): + from pandas.core.internals import SingleBlockManager + + if isinstance(data, SingleBlockManager): + data = data.internal_values() + + if fill_value is None and isinstance(dtype, SparseDtype): + fill_value = dtype.fill_value + + if isinstance(data, (type(self), ABCSparseSeries)): + # disable normal inference on dtype, sparse_index, & fill_value + if sparse_index is None: + sparse_index = data.sp_index + if fill_value is None: + fill_value = data.fill_value + if dtype is None: + dtype = data.dtype + # TODO: make kind=None, and use data.kind? + data = data.sp_values + + # Handle use-provided dtype + if isinstance(dtype, compat.string_types): + # Two options: dtype='int', regular numpy dtype + # or dtype='Sparse[int]', a sparse dtype + try: + dtype = SparseDtype.construct_from_string(dtype) + except TypeError: + dtype = pandas_dtype(dtype) + + if isinstance(dtype, SparseDtype): + if fill_value is None: + fill_value = dtype.fill_value + dtype = dtype.subtype + + if index is not None and not is_scalar(data): + raise Exception("must only pass scalars with an index ") + + if is_scalar(data): + if index is not None: + if data is None: + data = np.nan + + if index is not None: + npoints = len(index) + elif sparse_index is None: + npoints = 1 + else: + npoints = sparse_index.length + + dtype = infer_dtype_from_scalar(data)[0] + data = construct_1d_arraylike_from_scalar( + data, npoints, dtype + ) + + if dtype is not None: + dtype = pandas_dtype(dtype) + + # TODO: disentangle the fill_value dtype inference from + # dtype inference + if data is None: + # XXX: What should the empty dtype be? Object or float? + data = np.array([], dtype=dtype) + + if not is_array_like(data): + try: + # probably shared code in sanitize_series + from pandas.core.internals.construction import sanitize_array + data = sanitize_array(data, index=None) + except ValueError: + # NumPy may raise a ValueError on data like [1, []] + # we retry with object dtype here. + if dtype is None: + dtype = object + data = np.atleast_1d(np.asarray(data, dtype=dtype)) + else: + raise + + if copy: + # TODO: avoid double copy when dtype forces cast. + data = data.copy() + + if fill_value is None: + fill_value_dtype = data.dtype if dtype is None else dtype + if fill_value_dtype is None: + fill_value = np.nan + else: + fill_value = na_value_for_dtype(fill_value_dtype) + + if isinstance(data, type(self)) and sparse_index is None: + sparse_index = data._sparse_index + sparse_values = np.asarray(data.sp_values, dtype=dtype) + elif sparse_index is None: + sparse_values, sparse_index, fill_value = make_sparse( + data, kind=kind, fill_value=fill_value, dtype=dtype + ) + else: + sparse_values = np.asarray(data, dtype=dtype) + if len(sparse_values) != sparse_index.npoints: + raise AssertionError("Non array-like type {type} must " + "have the same length as the index" + .format(type=type(sparse_values))) + self._sparse_index = sparse_index + self._sparse_values = sparse_values + self._dtype = SparseDtype(sparse_values.dtype, fill_value) + + @classmethod + def _simple_new(cls, sparse_array, sparse_index, dtype): + # type: (np.ndarray, SparseIndex, SparseDtype) -> 'SparseArray' + new = cls([]) + new._sparse_index = sparse_index + new._sparse_values = sparse_array + new._dtype = dtype + return new + + def __array__(self, dtype=None, copy=True): + fill_value = self.fill_value + + if self.sp_index.ngaps == 0: + # Compat for na dtype and int values. + return self.sp_values + if dtype is None: + # Can NumPy represent this type? + # If not, `np.result_type` will raise. We catch that + # and return object. + if is_datetime64_any_dtype(self.sp_values.dtype): + # However, we *do* special-case the common case of + # a datetime64 with pandas NaT. + if fill_value is NaT: + # Can't put pd.NaT in a datetime64[ns] + fill_value = np.datetime64('NaT') + try: + dtype = np.result_type(self.sp_values.dtype, type(fill_value)) + except TypeError: + dtype = object + + out = np.full(self.shape, fill_value, dtype=dtype) + out[self.sp_index.to_int_index().indices] = self.sp_values + return out + + def __setitem__(self, key, value): + # I suppose we could allow setting of non-fill_value elements. + # TODO(SparseArray.__setitem__): remove special cases in + # ExtensionBlock.where + msg = "SparseArray does not support item assignment via setitem" + raise TypeError(msg) + + @classmethod + def _from_sequence(cls, scalars, dtype=None, copy=False): + return cls(scalars, dtype=dtype) + + @classmethod + def _from_factorized(cls, values, original): + return cls(values, dtype=original.dtype) + + # ------------------------------------------------------------------------ + # Data + # ------------------------------------------------------------------------ + @property + def sp_index(self): + """ + The SparseIndex containing the location of non- ``fill_value`` points. + """ + return self._sparse_index + + @property + def sp_values(self): + """ + An ndarray containing the non- ``fill_value`` values. + + Examples + -------- + >>> s = SparseArray([0, 0, 1, 0, 2], fill_value=0) + >>> s.sp_values + array([1, 2]) + """ + return self._sparse_values + + @property + def dtype(self): + return self._dtype + + @property + def fill_value(self): + """ + Elements in `data` that are `fill_value` are not stored. + + For memory savings, this should be the most common value in the array. + """ + return self.dtype.fill_value + + @fill_value.setter + def fill_value(self, value): + self._dtype = SparseDtype(self.dtype.subtype, value) + + @property + def kind(self): + """ + The kind of sparse index for this array. One of {'integer', 'block'}. + """ + if isinstance(self.sp_index, IntIndex): + return 'integer' + else: + return 'block' + + @property + def _valid_sp_values(self): + sp_vals = self.sp_values + mask = notna(sp_vals) + return sp_vals[mask] + + def __len__(self): + return self.sp_index.length + + @property + def _null_fill_value(self): + return self._dtype._is_na_fill_value + + def _fill_value_matches(self, fill_value): + if self._null_fill_value: + return isna(fill_value) + else: + return self.fill_value == fill_value + + @property + def nbytes(self): + return self.sp_values.nbytes + self.sp_index.nbytes + + @property + def density(self): + """ + The percent of non- ``fill_value`` points, as decimal. + + Examples + -------- + >>> s = SparseArray([0, 0, 1, 1, 1], fill_value=0) + >>> s.density + 0.6 + """ + r = float(self.sp_index.npoints) / float(self.sp_index.length) + return r + + @property + def npoints(self): + """ + The number of non- ``fill_value`` points. + + Examples + -------- + >>> s = SparseArray([0, 0, 1, 1, 1], fill_value=0) + >>> s.npoints + 3 + """ + return self.sp_index.npoints + + @property + def values(self): + """ + Dense values + """ + return self.to_dense() + + def isna(self): + from pandas import isna + # If null fill value, we want SparseDtype[bool, true] + # to preserve the same memory usage. + dtype = SparseDtype(bool, self._null_fill_value) + return type(self)._simple_new(isna(self.sp_values), + self.sp_index, dtype) + + def fillna(self, value=None, method=None, limit=None): + """ + Fill missing values with `value`. + + Parameters + ---------- + value : scalar, optional + method : str, optional + + .. warning:: + + Using 'method' will result in high memory use, + as all `fill_value` methods will be converted to + an in-memory ndarray + + limit : int, optional + + Returns + ------- + SparseArray + + Notes + ----- + When `value` is specified, the result's ``fill_value`` depends on + ``self.fill_value``. The goal is to maintain low-memory use. + + If ``self.fill_value`` is NA, the result dtype will be + ``SparseDtype(self.dtype, fill_value=value)``. This will preserve + amount of memory used before and after filling. + + When ``self.fill_value`` is not NA, the result dtype will be + ``self.dtype``. Again, this preserves the amount of memory used. + """ + if ((method is None and value is None) or + (method is not None and value is not None)): + raise ValueError("Must specify one of 'method' or 'value'.") + + elif method is not None: + msg = "fillna with 'method' requires high memory usage." + warnings.warn(msg, PerformanceWarning) + filled = interpolate_2d(np.asarray(self), method=method, + limit=limit) + return type(self)(filled, fill_value=self.fill_value) + + else: + new_values = np.where(isna(self.sp_values), value, self.sp_values) + + if self._null_fill_value: + # This is essentially just updating the dtype. + new_dtype = SparseDtype(self.dtype.subtype, fill_value=value) + else: + new_dtype = self.dtype + + return self._simple_new(new_values, self._sparse_index, new_dtype) + + def shift(self, periods=1, fill_value=None): + + if not len(self) or periods == 0: + return self.copy() + + if isna(fill_value): + fill_value = self.dtype.na_value + + subtype = np.result_type(fill_value, self.dtype.subtype) + + if subtype != self.dtype.subtype: + # just coerce up front + arr = self.astype(SparseDtype(subtype, self.fill_value)) + else: + arr = self + + empty = self._from_sequence( + [fill_value] * min(abs(periods), len(self)), + dtype=arr.dtype + ) + + if periods > 0: + a = empty + b = arr[:-periods] + else: + a = arr[abs(periods):] + b = empty + return arr._concat_same_type([a, b]) + + def _first_fill_value_loc(self): + """ + Get the location of the first missing value. + + Returns + ------- + int + """ + if len(self) == 0 or self.sp_index.npoints == len(self): + return -1 + + indices = self.sp_index.to_int_index().indices + if not len(indices) or indices[0] > 0: + return 0 + + diff = indices[1:] - indices[:-1] + return np.searchsorted(diff, 2) + 1 + + def unique(self): + uniques = list(algos.unique(self.sp_values)) + fill_loc = self._first_fill_value_loc() + if fill_loc >= 0: + uniques.insert(fill_loc, self.fill_value) + return type(self)._from_sequence(uniques, dtype=self.dtype) + + def _values_for_factorize(self): + # Still override this for hash_pandas_object + return np.asarray(self), self.fill_value + + def factorize(self, na_sentinel=-1): + # Currently, ExtensionArray.factorize -> Tuple[ndarray, EA] + # The sparsity on this is backwards from what Sparse would want. Want + # ExtensionArray.factorize -> Tuple[EA, EA] + # Given that we have to return a dense array of labels, why bother + # implementing an efficient factorize? + labels, uniques = algos.factorize(np.asarray(self), + na_sentinel=na_sentinel) + uniques = SparseArray(uniques, dtype=self.dtype) + return labels, uniques + + def value_counts(self, dropna=True): + """ + Returns a Series containing counts of unique values. + + Parameters + ---------- + dropna : boolean, default True + Don't include counts of NaN, even if NaN is in sp_values. + + Returns + ------- + counts : Series + """ + from pandas import Index, Series + + keys, counts = algos._value_counts_arraylike(self.sp_values, + dropna=dropna) + fcounts = self.sp_index.ngaps + if fcounts > 0: + if self._null_fill_value and dropna: + pass + else: + if self._null_fill_value: + mask = isna(keys) + else: + mask = keys == self.fill_value + + if mask.any(): + counts[mask] += fcounts + else: + keys = np.insert(keys, 0, self.fill_value) + counts = np.insert(counts, 0, fcounts) + + if not isinstance(keys, ABCIndexClass): + keys = Index(keys) + result = Series(counts, index=keys) + return result + + # -------- + # Indexing + # -------- + + def __getitem__(self, key): + if isinstance(key, tuple): + if len(key) > 1: + raise IndexError("too many indices for array.") + key = key[0] + + if is_integer(key): + return self._get_val_at(key) + elif isinstance(key, tuple): + data_slice = self.values[key] + elif isinstance(key, slice): + # special case to preserve dtypes + if key == slice(None): + return self.copy() + # TODO: this logic is surely elsewhere + # TODO: this could be more efficient + indices = np.arange(len(self), dtype=np.int32)[key] + return self.take(indices) + else: + # TODO: I think we can avoid densifying when masking a + # boolean SparseArray with another. Need to look at the + # key's fill_value for True / False, and then do an intersection + # on the indicies of the sp_values. + if isinstance(key, SparseArray): + if is_bool_dtype(key): + key = key.to_dense() + else: + key = np.asarray(key) + + if com.is_bool_indexer(key) and len(self) == len(key): + return self.take(np.arange(len(key), dtype=np.int32)[key]) + elif hasattr(key, '__len__'): + return self.take(key) + else: + raise ValueError("Cannot slice with '{}'".format(key)) + + return type(self)(data_slice, kind=self.kind) + + def _get_val_at(self, loc): + n = len(self) + if loc < 0: + loc += n + + if loc >= n or loc < 0: + raise IndexError('Out of bounds access') + + sp_loc = self.sp_index.lookup(loc) + if sp_loc == -1: + return self.fill_value + else: + return libindex.get_value_at(self.sp_values, sp_loc) + + def take(self, indices, allow_fill=False, fill_value=None): + if is_scalar(indices): + raise ValueError("'indices' must be an array, not a " + "scalar '{}'.".format(indices)) + indices = np.asarray(indices, dtype=np.int32) + + if indices.size == 0: + result = [] + kwargs = {'dtype': self.dtype} + elif allow_fill: + result = self._take_with_fill(indices, fill_value=fill_value) + kwargs = {} + else: + result = self._take_without_fill(indices) + kwargs = {'dtype': self.dtype} + + return type(self)(result, fill_value=self.fill_value, kind=self.kind, + **kwargs) + + def _take_with_fill(self, indices, fill_value=None): + if fill_value is None: + fill_value = self.dtype.na_value + + if indices.min() < -1: + raise ValueError("Invalid value in 'indices'. Must be between -1 " + "and the length of the array.") + + if indices.max() >= len(self): + raise IndexError("out of bounds value in 'indices'.") + + if len(self) == 0: + # Empty... Allow taking only if all empty + if (indices == -1).all(): + dtype = np.result_type(self.sp_values, type(fill_value)) + taken = np.empty_like(indices, dtype=dtype) + taken.fill(fill_value) + return taken + else: + raise IndexError('cannot do a non-empty take from an empty ' + 'axes.') + + sp_indexer = self.sp_index.lookup_array(indices) + + if self.sp_index.npoints == 0: + # Avoid taking from the empty self.sp_values + taken = np.full(sp_indexer.shape, fill_value=fill_value, + dtype=np.result_type(type(fill_value))) + else: + taken = self.sp_values.take(sp_indexer) + + # sp_indexer may be -1 for two reasons + # 1.) we took for an index of -1 (new) + # 2.) we took a value that was self.fill_value (old) + new_fill_indices = indices == -1 + old_fill_indices = (sp_indexer == -1) & ~new_fill_indices + + # Fill in two steps. + # Old fill values + # New fill values + # potentially coercing to a new dtype at each stage. + + m0 = sp_indexer[old_fill_indices] < 0 + m1 = sp_indexer[new_fill_indices] < 0 + + result_type = taken.dtype + + if m0.any(): + result_type = np.result_type(result_type, + type(self.fill_value)) + taken = taken.astype(result_type) + taken[old_fill_indices] = self.fill_value + + if m1.any(): + result_type = np.result_type(result_type, type(fill_value)) + taken = taken.astype(result_type) + taken[new_fill_indices] = fill_value + + return taken + + def _take_without_fill(self, indices): + to_shift = indices < 0 + indices = indices.copy() + + n = len(self) + + if (indices.max() >= n) or (indices.min() < -n): + if n == 0: + raise IndexError("cannot do a non-empty take from an " + "empty axes.") + else: + raise IndexError("out of bounds value in 'indices'.") + + if to_shift.any(): + indices[to_shift] += n + + if self.sp_index.npoints == 0: + # edge case in take... + # I think just return + out = np.full(indices.shape, self.fill_value, + dtype=np.result_type(type(self.fill_value))) + arr, sp_index, fill_value = make_sparse(out, + fill_value=self.fill_value) + return type(self)(arr, sparse_index=sp_index, + fill_value=fill_value) + + sp_indexer = self.sp_index.lookup_array(indices) + taken = self.sp_values.take(sp_indexer) + fillable = (sp_indexer < 0) + + if fillable.any(): + # TODO: may need to coerce array to fill value + result_type = np.result_type(taken, type(self.fill_value)) + taken = taken.astype(result_type) + taken[fillable] = self.fill_value + + return taken + + def searchsorted(self, v, side="left", sorter=None): + msg = "searchsorted requires high memory usage." + warnings.warn(msg, PerformanceWarning, stacklevel=2) + if not is_scalar(v): + v = np.asarray(v) + v = np.asarray(v) + return np.asarray(self, dtype=self.dtype.subtype).searchsorted( + v, side, sorter + ) + + def copy(self, deep=False): + if deep: + values = self.sp_values.copy() + else: + values = self.sp_values + + return self._simple_new(values, self.sp_index, self.dtype) + + @classmethod + def _concat_same_type(cls, to_concat): + fill_values = [x.fill_value for x in to_concat] + + fill_value = fill_values[0] + + # np.nan isn't a singleton, so we may end up with multiple + # NaNs here, so we ignore tha all NA case too. + if not (len(set(fill_values)) == 1 or isna(fill_values).all()): + warnings.warn("Concatenating sparse arrays with multiple fill " + "values: '{}'. Picking the first and " + "converting the rest.".format(fill_values), + PerformanceWarning, + stacklevel=6) + keep = to_concat[0] + to_concat2 = [keep] + + for arr in to_concat[1:]: + to_concat2.append(cls(np.asarray(arr), fill_value=fill_value)) + + to_concat = to_concat2 + + values = [] + length = 0 + + if to_concat: + sp_kind = to_concat[0].kind + else: + sp_kind = 'integer' + + if sp_kind == 'integer': + indices = [] + + for arr in to_concat: + idx = arr.sp_index.to_int_index().indices.copy() + idx += length # TODO: wraparound + length += arr.sp_index.length + + values.append(arr.sp_values) + indices.append(idx) + + data = np.concatenate(values) + indices = np.concatenate(indices) + sp_index = IntIndex(length, indices) + + else: + # when concatentating block indices, we don't claim that you'll + # get an identical index as concating the values and then + # creating a new index. We don't want to spend the time trying + # to merge blocks across arrays in `to_concat`, so the resulting + # BlockIndex may have more blocs. + blengths = [] + blocs = [] + + for arr in to_concat: + idx = arr.sp_index.to_block_index() + + values.append(arr.sp_values) + blocs.append(idx.blocs.copy() + length) + blengths.append(idx.blengths) + length += arr.sp_index.length + + data = np.concatenate(values) + blocs = np.concatenate(blocs) + blengths = np.concatenate(blengths) + + sp_index = BlockIndex(length, blocs, blengths) + + return cls(data, sparse_index=sp_index, fill_value=fill_value) + + def astype(self, dtype=None, copy=True): + """ + Change the dtype of a SparseArray. + + The output will always be a SparseArray. To convert to a dense + ndarray with a certain dtype, use :meth:`numpy.asarray`. + + Parameters + ---------- + dtype : np.dtype or ExtensionDtype + For SparseDtype, this changes the dtype of + ``self.sp_values`` and the ``self.fill_value``. + + For other dtypes, this only changes the dtype of + ``self.sp_values``. + + copy : bool, default True + Whether to ensure a copy is made, even if not necessary. + + Returns + ------- + SparseArray + + Examples + -------- + >>> arr = SparseArray([0, 0, 1, 2]) + >>> arr + [0, 0, 1, 2] + Fill: 0 + IntIndex + Indices: array([2, 3], dtype=int32) + + >>> arr.astype(np.dtype('int32')) + [0, 0, 1, 2] + Fill: 0 + IntIndex + Indices: array([2, 3], dtype=int32) + + Using a NumPy dtype with a different kind (e.g. float) will coerce + just ``self.sp_values``. + + >>> arr.astype(np.dtype('float64')) + ... # doctest: +NORMALIZE_WHITESPACE + [0, 0, 1.0, 2.0] + Fill: 0 + IntIndex + Indices: array([2, 3], dtype=int32) + + Use a SparseDtype if you wish to be change the fill value as well. + + >>> arr.astype(SparseDtype("float64", fill_value=np.nan)) + ... # doctest: +NORMALIZE_WHITESPACE + [nan, nan, 1.0, 2.0] + Fill: nan + IntIndex + Indices: array([2, 3], dtype=int32) + """ + dtype = self.dtype.update_dtype(dtype) + subtype = dtype._subtype_with_str + sp_values = astype_nansafe(self.sp_values, + subtype, + copy=copy) + if sp_values is self.sp_values and copy: + sp_values = sp_values.copy() + + return self._simple_new(sp_values, + self.sp_index, + dtype) + + def map(self, mapper): + """ + Map categories using input correspondence (dict, Series, or function). + + Parameters + ---------- + mapper : dict, Series, callable + The correspondence from old values to new. + + Returns + ------- + SparseArray + The output array will have the same density as the input. + The output fill value will be the result of applying the + mapping to ``self.fill_value`` + + Examples + -------- + >>> arr = pd.SparseArray([0, 1, 2]) + >>> arr.apply(lambda x: x + 10) + [10, 11, 12] + Fill: 10 + IntIndex + Indices: array([1, 2], dtype=int32) + + >>> arr.apply({0: 10, 1: 11, 2: 12}) + [10, 11, 12] + Fill: 10 + IntIndex + Indices: array([1, 2], dtype=int32) + + >>> arr.apply(pd.Series([10, 11, 12], index=[0, 1, 2])) + [10, 11, 12] + Fill: 10 + IntIndex + Indices: array([1, 2], dtype=int32) + """ + # this is used in apply. + # We get hit since we're an "is_extension_type" but regular extension + # types are not hit. This may be worth adding to the interface. + if isinstance(mapper, ABCSeries): + mapper = mapper.to_dict() + + if isinstance(mapper, compat.Mapping): + fill_value = mapper.get(self.fill_value, self.fill_value) + sp_values = [mapper.get(x, None) for x in self.sp_values] + else: + fill_value = mapper(self.fill_value) + sp_values = [mapper(x) for x in self.sp_values] + + return type(self)(sp_values, sparse_index=self.sp_index, + fill_value=fill_value) + + def to_dense(self): + """ + Convert SparseArray to a NumPy array. + + Returns + ------- + arr : NumPy array + """ + return np.asarray(self, dtype=self.sp_values.dtype) + + # TODO: Look into deprecating this in favor of `to_dense`. + get_values = to_dense + + # ------------------------------------------------------------------------ + # IO + # ------------------------------------------------------------------------ + def __setstate__(self, state): + """Necessary for making this object picklable""" + if isinstance(state, tuple): + # Compat for pandas < 0.24.0 + nd_state, (fill_value, sp_index) = state + sparse_values = np.array([]) + sparse_values.__setstate__(nd_state) + + self._sparse_values = sparse_values + self._sparse_index = sp_index + self._dtype = SparseDtype(sparse_values.dtype, fill_value) + else: + self.__dict__.update(state) + + def nonzero(self): + if self.fill_value == 0: + return self.sp_index.to_int_index().indices, + else: + return self.sp_index.to_int_index().indices[self.sp_values != 0], + + # ------------------------------------------------------------------------ + # Reductions + # ------------------------------------------------------------------------ + + def _reduce(self, name, skipna=True, **kwargs): + method = getattr(self, name, None) + + if method is None: + raise TypeError("cannot perform {name} with type {dtype}".format( + name=name, dtype=self.dtype)) + + if skipna: + arr = self + else: + arr = self.dropna() + + # we don't support these kwargs. + # They should only be present when called via pandas, so do it here. + # instead of in `any` / `all` (which will raise if they're present, + # thanks to nv.validate + kwargs.pop('filter_type', None) + kwargs.pop('numeric_only', None) + kwargs.pop('op', None) + return getattr(arr, name)(**kwargs) + + def all(self, axis=None, *args, **kwargs): + """ + Tests whether all elements evaluate True + + Returns + ------- + all : bool + + See Also + -------- + numpy.all + """ + nv.validate_all(args, kwargs) + + values = self.sp_values + + if len(values) != len(self) and not np.all(self.fill_value): + return False + + return values.all() + + def any(self, axis=0, *args, **kwargs): + """ + Tests whether at least one of elements evaluate True + + Returns + ------- + any : bool + + See Also + -------- + numpy.any + """ + nv.validate_any(args, kwargs) + + values = self.sp_values + + if len(values) != len(self) and np.any(self.fill_value): + return True + + return values.any().item() + + def sum(self, axis=0, *args, **kwargs): + """ + Sum of non-NA/null values + + Returns + ------- + sum : float + """ + nv.validate_sum(args, kwargs) + valid_vals = self._valid_sp_values + sp_sum = valid_vals.sum() + if self._null_fill_value: + return sp_sum + else: + nsparse = self.sp_index.ngaps + return sp_sum + self.fill_value * nsparse + + def cumsum(self, axis=0, *args, **kwargs): + """ + Cumulative sum of non-NA/null values. + + When performing the cumulative summation, any non-NA/null values will + be skipped. The resulting SparseArray will preserve the locations of + NaN values, but the fill value will be `np.nan` regardless. + + Parameters + ---------- + axis : int or None + Axis over which to perform the cumulative summation. If None, + perform cumulative summation over flattened array. + + Returns + ------- + cumsum : SparseArray + """ + nv.validate_cumsum(args, kwargs) + + if axis is not None and axis >= self.ndim: # Mimic ndarray behaviour. + raise ValueError("axis(={axis}) out of bounds".format(axis=axis)) + + if not self._null_fill_value: + return SparseArray(self.to_dense()).cumsum() + + return SparseArray(self.sp_values.cumsum(), sparse_index=self.sp_index, + fill_value=self.fill_value) + + def mean(self, axis=0, *args, **kwargs): + """ + Mean of non-NA/null values + + Returns + ------- + mean : float + """ + nv.validate_mean(args, kwargs) + valid_vals = self._valid_sp_values + sp_sum = valid_vals.sum() + ct = len(valid_vals) + + if self._null_fill_value: + return sp_sum / ct + else: + nsparse = self.sp_index.ngaps + return (sp_sum + self.fill_value * nsparse) / (ct + nsparse) + + def transpose(self, *axes): + """ + Returns the SparseArray. + """ + return self + + @property + def T(self): + """ + Returns the SparseArray. + """ + return self + + # ------------------------------------------------------------------------ + # Ufuncs + # ------------------------------------------------------------------------ + + def __array_wrap__(self, array, context=None): + from pandas.core.dtypes.generic import ABCSparseSeries + + ufunc, inputs, _ = context + inputs = tuple(x.values if isinstance(x, ABCSparseSeries) else x + for x in inputs) + return self.__array_ufunc__(ufunc, '__call__', *inputs) + + _HANDLED_TYPES = (np.ndarray, numbers.Number) + + def __array_ufunc__(self, ufunc, method, *inputs, **kwargs): + out = kwargs.get('out', ()) + + for x in inputs + out: + if not isinstance(x, self._HANDLED_TYPES + (SparseArray,)): + return NotImplemented + + special = {'add', 'sub', 'mul', 'pow', 'mod', 'floordiv', 'truediv', + 'divmod', 'eq', 'ne', 'lt', 'gt', 'le', 'ge', 'remainder'} + if compat.PY2: + special.add('div') + aliases = { + 'subtract': 'sub', + 'multiply': 'mul', + 'floor_divide': 'floordiv', + 'true_divide': 'truediv', + 'power': 'pow', + 'remainder': 'mod', + 'divide': 'div', + 'equal': 'eq', + 'not_equal': 'ne', + 'less': 'lt', + 'less_equal': 'le', + 'greater': 'gt', + 'greater_equal': 'ge', + } + + flipped = { + 'lt': '__gt__', + 'le': '__ge__', + 'gt': '__lt__', + 'ge': '__le__', + 'eq': '__eq__', + 'ne': '__ne__', + } + + op_name = ufunc.__name__ + op_name = aliases.get(op_name, op_name) + + if op_name in special and kwargs.get('out') is None: + if isinstance(inputs[0], type(self)): + return getattr(self, '__{}__'.format(op_name))(inputs[1]) + else: + name = flipped.get(op_name, '__r{}__'.format(op_name)) + return getattr(self, name)(inputs[0]) + + if len(inputs) == 1: + # No alignment necessary. + sp_values = getattr(ufunc, method)(self.sp_values, **kwargs) + fill_value = getattr(ufunc, method)(self.fill_value, **kwargs) + return self._simple_new(sp_values, + self.sp_index, + SparseDtype(sp_values.dtype, fill_value)) + + result = getattr(ufunc, method)(*[np.asarray(x) for x in inputs], + **kwargs) + if out: + if len(out) == 1: + out = out[0] + return out + + if type(result) is tuple: + return tuple(type(self)(x) for x in result) + elif method == 'at': + # no return value + return None + else: + return type(self)(result) + + def __abs__(self): + return np.abs(self) + + # ------------------------------------------------------------------------ + # Ops + # ------------------------------------------------------------------------ + + @classmethod + def _create_unary_method(cls, op): + def sparse_unary_method(self): + fill_value = op(np.array(self.fill_value)).item() + values = op(self.sp_values) + dtype = SparseDtype(values.dtype, fill_value) + return cls._simple_new(values, self.sp_index, dtype) + + name = '__{name}__'.format(name=op.__name__) + return compat.set_function_name(sparse_unary_method, name, cls) + + @classmethod + def _create_arithmetic_method(cls, op): + def sparse_arithmetic_method(self, other): + op_name = op.__name__ + + if isinstance(other, (ABCSeries, ABCIndexClass)): + # Rely on pandas to dispatch to us. + return NotImplemented + + if isinstance(other, SparseArray): + return _sparse_array_op(self, other, op, op_name) + + elif is_scalar(other): + with np.errstate(all='ignore'): + fill = op(_get_fill(self), np.asarray(other)) + result = op(self.sp_values, other) + + if op_name == 'divmod': + left, right = result + lfill, rfill = fill + return (_wrap_result(op_name, left, self.sp_index, lfill), + _wrap_result(op_name, right, self.sp_index, rfill)) + + return _wrap_result(op_name, result, self.sp_index, fill) + + else: + other = np.asarray(other) + with np.errstate(all='ignore'): + # TODO: delete sparse stuff in core/ops.py + # TODO: look into _wrap_result + if len(self) != len(other): + raise AssertionError( + ("length mismatch: {self} vs. {other}".format( + self=len(self), other=len(other)))) + if not isinstance(other, SparseArray): + dtype = getattr(other, 'dtype', None) + other = SparseArray(other, fill_value=self.fill_value, + dtype=dtype) + return _sparse_array_op(self, other, op, op_name) + + name = '__{name}__'.format(name=op.__name__) + return compat.set_function_name(sparse_arithmetic_method, name, cls) + + @classmethod + def _create_comparison_method(cls, op): + def cmp_method(self, other): + op_name = op.__name__ + + if op_name in {'and_', 'or_'}: + op_name = op_name[:-1] + + if isinstance(other, (ABCSeries, ABCIndexClass)): + # Rely on pandas to unbox and dispatch to us. + return NotImplemented + + if not is_scalar(other) and not isinstance(other, type(self)): + # convert list-like to ndarray + other = np.asarray(other) + + if isinstance(other, np.ndarray): + # TODO: make this more flexible than just ndarray... + if len(self) != len(other): + raise AssertionError("length mismatch: {self} vs. {other}" + .format(self=len(self), + other=len(other))) + other = SparseArray(other, fill_value=self.fill_value) + + if isinstance(other, SparseArray): + return _sparse_array_op(self, other, op, op_name) + else: + with np.errstate(all='ignore'): + fill_value = op(self.fill_value, other) + result = op(self.sp_values, other) + + return type(self)(result, + sparse_index=self.sp_index, + fill_value=fill_value, + dtype=np.bool_) + + name = '__{name}__'.format(name=op.__name__) + return compat.set_function_name(cmp_method, name, cls) + + @classmethod + def _add_unary_ops(cls): + cls.__pos__ = cls._create_unary_method(operator.pos) + cls.__neg__ = cls._create_unary_method(operator.neg) + cls.__invert__ = cls._create_unary_method(operator.invert) + + @classmethod + def _add_comparison_ops(cls): + cls.__and__ = cls._create_comparison_method(operator.and_) + cls.__or__ = cls._create_comparison_method(operator.or_) + super(SparseArray, cls)._add_comparison_ops() + + # ---------- + # Formatting + # ----------- + def __unicode__(self): + return '{self}\nFill: {fill}\n{index}'.format( + self=printing.pprint_thing(self), + fill=printing.pprint_thing(self.fill_value), + index=printing.pprint_thing(self.sp_index)) + + def _formatter(self, boxed=False): + # Defer to the formatter from the GenericArrayFormatter calling us. + # This will infer the correct formatter from the dtype of the values. + return None + + +SparseArray._add_arithmetic_ops() +SparseArray._add_comparison_ops() +SparseArray._add_unary_ops() + + +def _maybe_to_dense(obj): + """ + try to convert to dense + """ + if hasattr(obj, 'to_dense'): + return obj.to_dense() + return obj + + +def _maybe_to_sparse(array): + """ + array must be SparseSeries or SparseArray + """ + if isinstance(array, ABCSparseSeries): + array = array.values.copy() + return array + + +def _sanitize_values(arr): + """ + return an ndarray for our input, + in a platform independent manner + """ + + if hasattr(arr, 'values'): + arr = arr.values + else: + + # scalar + if is_scalar(arr): + arr = [arr] + + # ndarray + if isinstance(arr, np.ndarray): + pass + + elif is_list_like(arr) and len(arr) > 0: + arr = maybe_convert_platform(arr) + + else: + arr = np.asarray(arr) + + return arr + + +def make_sparse(arr, kind='block', fill_value=None, dtype=None, copy=False): + """ + Convert ndarray to sparse format + + Parameters + ---------- + arr : ndarray + kind : {'block', 'integer'} + fill_value : NaN or another value + dtype : np.dtype, optional + copy : bool, default False + + Returns + ------- + (sparse_values, index, fill_value) : (ndarray, SparseIndex, Scalar) + """ + + arr = _sanitize_values(arr) + + if arr.ndim > 1: + raise TypeError("expected dimension <= 1 data") + + if fill_value is None: + fill_value = na_value_for_dtype(arr.dtype) + + if isna(fill_value): + mask = notna(arr) + else: + # For str arrays in NumPy 1.12.0, operator!= below isn't + # element-wise but just returns False if fill_value is not str, + # so cast to object comparison to be safe + if is_string_dtype(arr): + arr = arr.astype(object) + + if is_object_dtype(arr.dtype): + # element-wise equality check method in numpy doesn't treat + # each element type, eg. 0, 0.0, and False are treated as + # same. So we have to check the both of its type and value. + mask = splib.make_mask_object_ndarray(arr, fill_value) + else: + mask = arr != fill_value + + length = len(arr) + if length != len(mask): + # the arr is a SparseArray + indices = mask.sp_index.indices + else: + indices = mask.nonzero()[0].astype(np.int32) + + index = _make_index(length, indices, kind) + sparsified_values = arr[mask] + if dtype is not None: + sparsified_values = astype_nansafe(sparsified_values, dtype=dtype) + # TODO: copy + return sparsified_values, index, fill_value + + +def _make_index(length, indices, kind): + + if kind == 'block' or isinstance(kind, BlockIndex): + locs, lens = splib.get_blocks(indices) + index = BlockIndex(length, locs, lens) + elif kind == 'integer' or isinstance(kind, IntIndex): + index = IntIndex(length, indices) + else: # pragma: no cover + raise ValueError('must be block or integer type') + return index + + +# ---------------------------------------------------------------------------- +# Accessor + +@delegate_names(SparseArray, ['npoints', 'density', 'fill_value', + 'sp_values'], + typ='property') +class SparseAccessor(PandasDelegate): + """ + Accessor for SparseSparse from other sparse matrix data types. + """ + + def __init__(self, data=None): + self._validate(data) + # Store the Series since we need that for to_coo + self._parent = data + + @staticmethod + def _validate(data): + if not isinstance(data.dtype, SparseDtype): + msg = "Can only use the '.sparse' accessor with Sparse data." + raise AttributeError(msg) + + def _delegate_property_get(self, name, *args, **kwargs): + return getattr(self._parent.values, name) + + def _delegate_method(self, name, *args, **kwargs): + if name == 'from_coo': + return self.from_coo(*args, **kwargs) + elif name == 'to_coo': + return self.to_coo(*args, **kwargs) + else: + raise ValueError + + @classmethod + def from_coo(cls, A, dense_index=False): + """ + Create a SparseSeries from a scipy.sparse.coo_matrix. + + Parameters + ---------- + A : scipy.sparse.coo_matrix + dense_index : bool, default False + If False (default), the SparseSeries index consists of only the + coords of the non-null entries of the original coo_matrix. + If True, the SparseSeries index consists of the full sorted + (row, col) coordinates of the coo_matrix. + + Returns + ------- + s : SparseSeries + + Examples + --------- + >>> from scipy import sparse + >>> A = sparse.coo_matrix(([3.0, 1.0, 2.0], ([1, 0, 0], [0, 2, 3])), + shape=(3, 4)) + >>> A + <3x4 sparse matrix of type '' + with 3 stored elements in COOrdinate format> + >>> A.todense() + matrix([[ 0., 0., 1., 2.], + [ 3., 0., 0., 0.], + [ 0., 0., 0., 0.]]) + >>> ss = pd.SparseSeries.from_coo(A) + >>> ss + 0 2 1 + 3 2 + 1 0 3 + dtype: float64 + BlockIndex + Block locations: array([0], dtype=int32) + Block lengths: array([3], dtype=int32) + """ + from pandas.core.sparse.scipy_sparse import _coo_to_sparse_series + from pandas import Series + + result = _coo_to_sparse_series(A, dense_index=dense_index) + # SparseSeries -> Series[sparse] + result = Series(result.values, index=result.index, copy=False) + + return result + + def to_coo(self, row_levels=(0, ), column_levels=(1, ), sort_labels=False): + """ + Create a scipy.sparse.coo_matrix from a SparseSeries with MultiIndex. + + Use row_levels and column_levels to determine the row and column + coordinates respectively. row_levels and column_levels are the names + (labels) or numbers of the levels. {row_levels, column_levels} must be + a partition of the MultiIndex level names (or numbers). + + Parameters + ---------- + row_levels : tuple/list + column_levels : tuple/list + sort_labels : bool, default False + Sort the row and column labels before forming the sparse matrix. + + Returns + ------- + y : scipy.sparse.coo_matrix + rows : list (row labels) + columns : list (column labels) + + Examples + -------- + >>> s = pd.Series([3.0, np.nan, 1.0, 3.0, np.nan, np.nan]) + >>> s.index = pd.MultiIndex.from_tuples([(1, 2, 'a', 0), + (1, 2, 'a', 1), + (1, 1, 'b', 0), + (1, 1, 'b', 1), + (2, 1, 'b', 0), + (2, 1, 'b', 1)], + names=['A', 'B', 'C', 'D']) + >>> ss = s.to_sparse() + >>> A, rows, columns = ss.to_coo(row_levels=['A', 'B'], + column_levels=['C', 'D'], + sort_labels=True) + >>> A + <3x4 sparse matrix of type '' + with 3 stored elements in COOrdinate format> + >>> A.todense() + matrix([[ 0., 0., 1., 3.], + [ 3., 0., 0., 0.], + [ 0., 0., 0., 0.]]) + >>> rows + [(1, 1), (1, 2), (2, 1)] + >>> columns + [('a', 0), ('a', 1), ('b', 0), ('b', 1)] + """ + from pandas.core.sparse.scipy_sparse import _sparse_series_to_coo + + A, rows, columns = _sparse_series_to_coo(self._parent, + row_levels, + column_levels, + sort_labels=sort_labels) + return A, rows, columns diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/core/arrays/timedeltas.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/core/arrays/timedeltas.py new file mode 100644 index 0000000000000000000000000000000000000000..7683cb5abbb4654ae3dec8e4aab0c7e1b157e572 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/core/arrays/timedeltas.py @@ -0,0 +1,1069 @@ +# -*- coding: utf-8 -*- +from __future__ import division + +from datetime import timedelta +import textwrap +import warnings + +import numpy as np + +from pandas._libs import lib, tslibs +from pandas._libs.tslibs import NaT, Timedelta, Timestamp, iNaT +from pandas._libs.tslibs.fields import get_timedelta_field +from pandas._libs.tslibs.timedeltas import ( + array_to_timedelta64, parse_timedelta_unit, precision_from_unit) +import pandas.compat as compat +from pandas.util._decorators import Appender + +from pandas.core.dtypes.common import ( + _NS_DTYPE, _TD_DTYPE, ensure_int64, is_datetime64_dtype, is_dtype_equal, + is_float_dtype, is_integer_dtype, is_list_like, is_object_dtype, is_scalar, + is_string_dtype, is_timedelta64_dtype, is_timedelta64_ns_dtype, + pandas_dtype) +from pandas.core.dtypes.dtypes import DatetimeTZDtype +from pandas.core.dtypes.generic import ( + ABCDataFrame, ABCIndexClass, ABCSeries, ABCTimedeltaIndex) +from pandas.core.dtypes.missing import isna + +from pandas.core import ops +from pandas.core.algorithms import checked_add_with_arr +import pandas.core.common as com + +from pandas.tseries.frequencies import to_offset +from pandas.tseries.offsets import Tick + +from . import datetimelike as dtl + +_BAD_DTYPE = "dtype {dtype} cannot be converted to timedelta64[ns]" + + +def _is_convertible_to_td(key): + return isinstance(key, (Tick, timedelta, + np.timedelta64, compat.string_types)) + + +def _field_accessor(name, alias, docstring=None): + def f(self): + values = self.asi8 + result = get_timedelta_field(values, alias) + if self._hasnans: + result = self._maybe_mask_results(result, fill_value=None, + convert='float64') + + return result + + f.__name__ = name + f.__doc__ = "\n{}\n".format(docstring) + return property(f) + + +def _td_array_cmp(cls, op): + """ + Wrap comparison operations to convert timedelta-like to timedelta64 + """ + opname = '__{name}__'.format(name=op.__name__) + nat_result = True if opname == '__ne__' else False + + def wrapper(self, other): + if isinstance(other, (ABCDataFrame, ABCSeries, ABCIndexClass)): + return NotImplemented + + if _is_convertible_to_td(other) or other is NaT: + try: + other = Timedelta(other) + except ValueError: + # failed to parse as timedelta + return ops.invalid_comparison(self, other, op) + + result = op(self.view('i8'), other.value) + if isna(other): + result.fill(nat_result) + + elif not is_list_like(other): + return ops.invalid_comparison(self, other, op) + + elif len(other) != len(self): + raise ValueError("Lengths must match") + + else: + try: + other = type(self)._from_sequence(other)._data + except (ValueError, TypeError): + return ops.invalid_comparison(self, other, op) + + result = op(self.view('i8'), other.view('i8')) + result = com.values_from_object(result) + + o_mask = np.array(isna(other)) + if o_mask.any(): + result[o_mask] = nat_result + + if self._hasnans: + result[self._isnan] = nat_result + + return result + + return compat.set_function_name(wrapper, opname, cls) + + +class TimedeltaArray(dtl.DatetimeLikeArrayMixin, dtl.TimelikeOps): + """ + Pandas ExtensionArray for timedelta data. + + .. versionadded:: 0.24.0 + + .. warning:: + + TimedeltaArray is currently experimental, and its API may change + without warning. In particular, :attr:`TimedeltaArray.dtype` is + expected to change to be an instance of an ``ExtensionDtype`` + subclass. + + Parameters + ---------- + values : array-like + The timedelta data. + + dtype : numpy.dtype + Currently, only ``numpy.dtype("timedelta64[ns]")`` is accepted. + freq : Offset, optional + copy : bool, default False + Whether to copy the underlying array of data. + """ + _typ = "timedeltaarray" + _scalar_type = Timedelta + __array_priority__ = 1000 + # define my properties & methods for delegation + _other_ops = [] + _bool_ops = [] + _object_ops = ['freq'] + _field_ops = ['days', 'seconds', 'microseconds', 'nanoseconds'] + _datetimelike_ops = _field_ops + _object_ops + _bool_ops + _datetimelike_methods = ["to_pytimedelta", "total_seconds", + "round", "floor", "ceil"] + + # Needed so that NaT.__richcmp__(DateTimeArray) operates pointwise + ndim = 1 + + @property + def _box_func(self): + return lambda x: Timedelta(x, unit='ns') + + @property + def dtype(self): + """ + The dtype for the TimedeltaArray. + + .. warning:: + + A future version of pandas will change dtype to be an instance + of a :class:`pandas.api.extensions.ExtensionDtype` subclass, + not a ``numpy.dtype``. + + Returns + ------- + numpy.dtype + """ + return _TD_DTYPE + + # ---------------------------------------------------------------- + # Constructors + _attributes = ["freq"] + + def __init__(self, values, dtype=_TD_DTYPE, freq=None, copy=False): + if isinstance(values, (ABCSeries, ABCIndexClass)): + values = values._values + + inferred_freq = getattr(values, "_freq", None) + + if isinstance(values, type(self)): + if freq is None: + freq = values.freq + elif freq and values.freq: + freq = to_offset(freq) + freq, _ = dtl.validate_inferred_freq(freq, values.freq, False) + values = values._data + + if not isinstance(values, np.ndarray): + msg = ( + "Unexpected type '{}'. 'values' must be a TimedeltaArray " + "ndarray, or Series or Index containing one of those." + ) + raise ValueError(msg.format(type(values).__name__)) + if values.ndim != 1: + raise ValueError("Only 1-dimensional input arrays are supported.") + + if values.dtype == 'i8': + # for compat with datetime/timedelta/period shared methods, + # we can sometimes get here with int64 values. These represent + # nanosecond UTC (or tz-naive) unix timestamps + values = values.view(_TD_DTYPE) + + _validate_td64_dtype(values.dtype) + dtype = _validate_td64_dtype(dtype) + + if freq == "infer": + msg = ( + "Frequency inference not allowed in TimedeltaArray.__init__. " + "Use 'pd.array()' instead." + ) + raise ValueError(msg) + + if copy: + values = values.copy() + if freq: + freq = to_offset(freq) + + self._data = values + self._dtype = dtype + self._freq = freq + + if inferred_freq is None and freq is not None: + type(self)._validate_frequency(self, freq) + + @classmethod + def _simple_new(cls, values, freq=None, dtype=_TD_DTYPE): + assert dtype == _TD_DTYPE, dtype + assert isinstance(values, np.ndarray), type(values) + + result = object.__new__(cls) + result._data = values.view(_TD_DTYPE) + result._freq = to_offset(freq) + result._dtype = _TD_DTYPE + return result + + @classmethod + def _from_sequence(cls, data, dtype=_TD_DTYPE, copy=False, + freq=None, unit=None): + if dtype: + _validate_td64_dtype(dtype) + freq, freq_infer = dtl.maybe_infer_freq(freq) + + data, inferred_freq = sequence_to_td64ns(data, copy=copy, unit=unit) + freq, freq_infer = dtl.validate_inferred_freq(freq, inferred_freq, + freq_infer) + + result = cls._simple_new(data, freq=freq) + + if inferred_freq is None and freq is not None: + # this condition precludes `freq_infer` + cls._validate_frequency(result, freq) + + elif freq_infer: + # Set _freq directly to bypass duplicative _validate_frequency + # check. + result._freq = to_offset(result.inferred_freq) + + return result + + @classmethod + def _generate_range(cls, start, end, periods, freq, closed=None): + + periods = dtl.validate_periods(periods) + if freq is None and any(x is None for x in [periods, start, end]): + raise ValueError('Must provide freq argument if no data is ' + 'supplied') + + if com.count_not_none(start, end, periods, freq) != 3: + raise ValueError('Of the four parameters: start, end, periods, ' + 'and freq, exactly three must be specified') + + if start is not None: + start = Timedelta(start) + + if end is not None: + end = Timedelta(end) + + if start is None and end is None: + if closed is not None: + raise ValueError("Closed has to be None if not both of start" + "and end are defined") + + left_closed, right_closed = dtl.validate_endpoints(closed) + + if freq is not None: + index = _generate_regular_range(start, end, periods, freq) + else: + index = np.linspace(start.value, end.value, periods).astype('i8') + + if not left_closed: + index = index[1:] + if not right_closed: + index = index[:-1] + + return cls._simple_new(index, freq=freq) + + # ---------------------------------------------------------------- + # DatetimeLike Interface + + def _unbox_scalar(self, value): + if not isinstance(value, self._scalar_type) and value is not NaT: + raise ValueError("'value' should be a Timedelta.") + self._check_compatible_with(value) + return value.value + + def _scalar_from_string(self, value): + return Timedelta(value) + + def _check_compatible_with(self, other): + # we don't have anything to validate. + pass + + def _maybe_clear_freq(self): + self._freq = None + + # ---------------------------------------------------------------- + # Array-Like / EA-Interface Methods + + @Appender(dtl.DatetimeLikeArrayMixin._validate_fill_value.__doc__) + def _validate_fill_value(self, fill_value): + if isna(fill_value): + fill_value = iNaT + elif isinstance(fill_value, (timedelta, np.timedelta64, Tick)): + fill_value = Timedelta(fill_value).value + else: + raise ValueError("'fill_value' should be a Timedelta. " + "Got '{got}'.".format(got=fill_value)) + return fill_value + + def astype(self, dtype, copy=True): + # We handle + # --> timedelta64[ns] + # --> timedelta64 + # DatetimeLikeArrayMixin super call handles other cases + dtype = pandas_dtype(dtype) + + if is_timedelta64_dtype(dtype) and not is_timedelta64_ns_dtype(dtype): + # by pandas convention, converting to non-nano timedelta64 + # returns an int64-dtyped array with ints representing multiples + # of the desired timedelta unit. This is essentially division + if self._hasnans: + # avoid double-copying + result = self._data.astype(dtype, copy=False) + values = self._maybe_mask_results(result, + fill_value=None, + convert='float64') + return values + result = self._data.astype(dtype, copy=copy) + return result.astype('i8') + elif is_timedelta64_ns_dtype(dtype): + if copy: + return self.copy() + return self + return dtl.DatetimeLikeArrayMixin.astype(self, dtype, copy=copy) + + # ---------------------------------------------------------------- + # Rendering Methods + + def _formatter(self, boxed=False): + from pandas.io.formats.format import _get_format_timedelta64 + return _get_format_timedelta64(self, box=True) + + def _format_native_types(self, na_rep='NaT', date_format=None): + from pandas.io.formats.format import _get_format_timedelta64 + + formatter = _get_format_timedelta64(self._data, na_rep) + return np.array([formatter(x) for x in self._data]) + + # ---------------------------------------------------------------- + # Arithmetic Methods + + _create_comparison_method = classmethod(_td_array_cmp) + + def _add_offset(self, other): + assert not isinstance(other, Tick) + raise TypeError("cannot add the type {typ} to a {cls}" + .format(typ=type(other).__name__, + cls=type(self).__name__)) + + def _add_delta(self, delta): + """ + Add a timedelta-like, Tick, or TimedeltaIndex-like object + to self, yielding a new TimedeltaArray. + + Parameters + ---------- + other : {timedelta, np.timedelta64, Tick, + TimedeltaIndex, ndarray[timedelta64]} + + Returns + ------- + result : TimedeltaArray + """ + new_values = super(TimedeltaArray, self)._add_delta(delta) + return type(self)._from_sequence(new_values, freq='infer') + + def _add_datetime_arraylike(self, other): + """ + Add DatetimeArray/Index or ndarray[datetime64] to TimedeltaArray. + """ + if isinstance(other, np.ndarray): + # At this point we have already checked that dtype is datetime64 + from pandas.core.arrays import DatetimeArray + other = DatetimeArray(other) + + # defer to implementation in DatetimeArray + return other + self + + def _add_datetimelike_scalar(self, other): + # adding a timedeltaindex to a datetimelike + from pandas.core.arrays import DatetimeArray + + assert other is not NaT + other = Timestamp(other) + if other is NaT: + # In this case we specifically interpret NaT as a datetime, not + # the timedelta interpretation we would get by returning self + NaT + result = self.asi8.view('m8[ms]') + NaT.to_datetime64() + return DatetimeArray(result) + + i8 = self.asi8 + result = checked_add_with_arr(i8, other.value, + arr_mask=self._isnan) + result = self._maybe_mask_results(result) + dtype = DatetimeTZDtype(tz=other.tz) if other.tz else _NS_DTYPE + return DatetimeArray(result, dtype=dtype, freq=self.freq) + + def _addsub_offset_array(self, other, op): + # Add or subtract Array-like of DateOffset objects + try: + # TimedeltaIndex can only operate with a subset of DateOffset + # subclasses. Incompatible classes will raise AttributeError, + # which we re-raise as TypeError + return super(TimedeltaArray, self)._addsub_offset_array( + other, op + ) + except AttributeError: + raise TypeError("Cannot add/subtract non-tick DateOffset to {cls}" + .format(cls=type(self).__name__)) + + def __mul__(self, other): + other = lib.item_from_zerodim(other) + + if isinstance(other, (ABCDataFrame, ABCSeries, ABCIndexClass)): + return NotImplemented + + if is_scalar(other): + # numpy will accept float and int, raise TypeError for others + result = self._data * other + freq = None + if self.freq is not None and not isna(other): + freq = self.freq * other + return type(self)(result, freq=freq) + + if not hasattr(other, "dtype"): + # list, tuple + other = np.array(other) + if len(other) != len(self) and not is_timedelta64_dtype(other): + # Exclude timedelta64 here so we correctly raise TypeError + # for that instead of ValueError + raise ValueError("Cannot multiply with unequal lengths") + + if is_object_dtype(other): + # this multiplication will succeed only if all elements of other + # are int or float scalars, so we will end up with + # timedelta64[ns]-dtyped result + result = [self[n] * other[n] for n in range(len(self))] + result = np.array(result) + return type(self)(result) + + # numpy will accept float or int dtype, raise TypeError for others + result = self._data * other + return type(self)(result) + + __rmul__ = __mul__ + + def __truediv__(self, other): + # timedelta / X is well-defined for timedelta-like or numeric X + other = lib.item_from_zerodim(other) + + if isinstance(other, (ABCSeries, ABCDataFrame, ABCIndexClass)): + return NotImplemented + + if isinstance(other, (timedelta, np.timedelta64, Tick)): + other = Timedelta(other) + if other is NaT: + # specifically timedelta64-NaT + result = np.empty(self.shape, dtype=np.float64) + result.fill(np.nan) + return result + + # otherwise, dispatch to Timedelta implementation + return self._data / other + + elif lib.is_scalar(other): + # assume it is numeric + result = self._data / other + freq = None + if self.freq is not None: + # Tick division is not implemented, so operate on Timedelta + freq = self.freq.delta / other + return type(self)(result, freq=freq) + + if not hasattr(other, "dtype"): + # e.g. list, tuple + other = np.array(other) + + if len(other) != len(self): + raise ValueError("Cannot divide vectors with unequal lengths") + + elif is_timedelta64_dtype(other): + # let numpy handle it + return self._data / other + + elif is_object_dtype(other): + # Note: we do not do type inference on the result, so either + # an object array or numeric-dtyped (if numpy does inference) + # will be returned. GH#23829 + result = [self[n] / other[n] for n in range(len(self))] + result = np.array(result) + return result + + else: + result = self._data / other + return type(self)(result) + + def __rtruediv__(self, other): + # X / timedelta is defined only for timedelta-like X + other = lib.item_from_zerodim(other) + + if isinstance(other, (ABCSeries, ABCDataFrame, ABCIndexClass)): + return NotImplemented + + if isinstance(other, (timedelta, np.timedelta64, Tick)): + other = Timedelta(other) + if other is NaT: + # specifically timedelta64-NaT + result = np.empty(self.shape, dtype=np.float64) + result.fill(np.nan) + return result + + # otherwise, dispatch to Timedelta implementation + return other / self._data + + elif lib.is_scalar(other): + raise TypeError("Cannot divide {typ} by {cls}" + .format(typ=type(other).__name__, + cls=type(self).__name__)) + + if not hasattr(other, "dtype"): + # e.g. list, tuple + other = np.array(other) + + if len(other) != len(self): + raise ValueError("Cannot divide vectors with unequal lengths") + + elif is_timedelta64_dtype(other): + # let numpy handle it + return other / self._data + + elif is_object_dtype(other): + # Note: unlike in __truediv__, we do not _need_ to do type# + # inference on the result. It does not raise, a numeric array + # is returned. GH#23829 + result = [other[n] / self[n] for n in range(len(self))] + return np.array(result) + + else: + raise TypeError("Cannot divide {dtype} data by {cls}" + .format(dtype=other.dtype, + cls=type(self).__name__)) + + if compat.PY2: + __div__ = __truediv__ + __rdiv__ = __rtruediv__ + + def __floordiv__(self, other): + if isinstance(other, (ABCSeries, ABCDataFrame, ABCIndexClass)): + return NotImplemented + + other = lib.item_from_zerodim(other) + if is_scalar(other): + if isinstance(other, (timedelta, np.timedelta64, Tick)): + other = Timedelta(other) + if other is NaT: + # treat this specifically as timedelta-NaT + result = np.empty(self.shape, dtype=np.float64) + result.fill(np.nan) + return result + + # dispatch to Timedelta implementation + result = other.__rfloordiv__(self._data) + return result + + # at this point we should only have numeric scalars; anything + # else will raise + result = self.asi8 // other + result[self._isnan] = iNaT + freq = None + if self.freq is not None: + # Note: freq gets division, not floor-division + freq = self.freq / other + return type(self)(result.view('m8[ns]'), freq=freq) + + if not hasattr(other, "dtype"): + # list, tuple + other = np.array(other) + if len(other) != len(self): + raise ValueError("Cannot divide with unequal lengths") + + elif is_timedelta64_dtype(other): + other = type(self)(other) + + # numpy timedelta64 does not natively support floordiv, so operate + # on the i8 values + result = self.asi8 // other.asi8 + mask = self._isnan | other._isnan + if mask.any(): + result = result.astype(np.int64) + result[mask] = np.nan + return result + + elif is_object_dtype(other): + result = [self[n] // other[n] for n in range(len(self))] + result = np.array(result) + if lib.infer_dtype(result, skipna=False) == 'timedelta': + result, _ = sequence_to_td64ns(result) + return type(self)(result) + return result + + elif is_integer_dtype(other) or is_float_dtype(other): + result = self._data // other + return type(self)(result) + + else: + dtype = getattr(other, "dtype", type(other).__name__) + raise TypeError("Cannot divide {typ} by {cls}" + .format(typ=dtype, cls=type(self).__name__)) + + def __rfloordiv__(self, other): + if isinstance(other, (ABCSeries, ABCDataFrame, ABCIndexClass)): + return NotImplemented + + other = lib.item_from_zerodim(other) + if is_scalar(other): + if isinstance(other, (timedelta, np.timedelta64, Tick)): + other = Timedelta(other) + if other is NaT: + # treat this specifically as timedelta-NaT + result = np.empty(self.shape, dtype=np.float64) + result.fill(np.nan) + return result + + # dispatch to Timedelta implementation + result = other.__floordiv__(self._data) + return result + + raise TypeError("Cannot divide {typ} by {cls}" + .format(typ=type(other).__name__, + cls=type(self).__name__)) + + if not hasattr(other, "dtype"): + # list, tuple + other = np.array(other) + if len(other) != len(self): + raise ValueError("Cannot divide with unequal lengths") + + elif is_timedelta64_dtype(other): + other = type(self)(other) + + # numpy timedelta64 does not natively support floordiv, so operate + # on the i8 values + result = other.asi8 // self.asi8 + mask = self._isnan | other._isnan + if mask.any(): + result = result.astype(np.int64) + result[mask] = np.nan + return result + + elif is_object_dtype(other): + result = [other[n] // self[n] for n in range(len(self))] + result = np.array(result) + return result + + else: + dtype = getattr(other, "dtype", type(other).__name__) + raise TypeError("Cannot divide {typ} by {cls}" + .format(typ=dtype, cls=type(self).__name__)) + + def __mod__(self, other): + # Note: This is a naive implementation, can likely be optimized + if isinstance(other, (ABCSeries, ABCDataFrame, ABCIndexClass)): + return NotImplemented + + other = lib.item_from_zerodim(other) + if isinstance(other, (timedelta, np.timedelta64, Tick)): + other = Timedelta(other) + return self - (self // other) * other + + def __rmod__(self, other): + # Note: This is a naive implementation, can likely be optimized + if isinstance(other, (ABCSeries, ABCDataFrame, ABCIndexClass)): + return NotImplemented + + other = lib.item_from_zerodim(other) + if isinstance(other, (timedelta, np.timedelta64, Tick)): + other = Timedelta(other) + return other - (other // self) * self + + def __divmod__(self, other): + # Note: This is a naive implementation, can likely be optimized + if isinstance(other, (ABCSeries, ABCDataFrame, ABCIndexClass)): + return NotImplemented + + other = lib.item_from_zerodim(other) + if isinstance(other, (timedelta, np.timedelta64, Tick)): + other = Timedelta(other) + + res1 = self // other + res2 = self - res1 * other + return res1, res2 + + def __rdivmod__(self, other): + # Note: This is a naive implementation, can likely be optimized + if isinstance(other, (ABCSeries, ABCDataFrame, ABCIndexClass)): + return NotImplemented + + other = lib.item_from_zerodim(other) + if isinstance(other, (timedelta, np.timedelta64, Tick)): + other = Timedelta(other) + + res1 = other // self + res2 = other - res1 * self + return res1, res2 + + # Note: TimedeltaIndex overrides this in call to cls._add_numeric_methods + def __neg__(self): + if self.freq is not None: + return type(self)(-self._data, freq=-self.freq) + return type(self)(-self._data) + + def __abs__(self): + # Note: freq is not preserved + return type(self)(np.abs(self._data)) + + # ---------------------------------------------------------------- + # Conversion Methods - Vectorized analogues of Timedelta methods + + def total_seconds(self): + """ + Return total duration of each element expressed in seconds. + + This method is available directly on TimedeltaArray, TimedeltaIndex + and on Series containing timedelta values under the ``.dt`` namespace. + + Returns + ------- + seconds : [ndarray, Float64Index, Series] + When the calling object is a TimedeltaArray, the return type + is ndarray. When the calling object is a TimedeltaIndex, + the return type is a Float64Index. When the calling object + is a Series, the return type is Series of type `float64` whose + index is the same as the original. + + See Also + -------- + datetime.timedelta.total_seconds : Standard library version + of this method. + TimedeltaIndex.components : Return a DataFrame with components of + each Timedelta. + + Examples + -------- + **Series** + + >>> s = pd.Series(pd.to_timedelta(np.arange(5), unit='d')) + >>> s + 0 0 days + 1 1 days + 2 2 days + 3 3 days + 4 4 days + dtype: timedelta64[ns] + + >>> s.dt.total_seconds() + 0 0.0 + 1 86400.0 + 2 172800.0 + 3 259200.0 + 4 345600.0 + dtype: float64 + + **TimedeltaIndex** + + >>> idx = pd.to_timedelta(np.arange(5), unit='d') + >>> idx + TimedeltaIndex(['0 days', '1 days', '2 days', '3 days', '4 days'], + dtype='timedelta64[ns]', freq=None) + + >>> idx.total_seconds() + Float64Index([0.0, 86400.0, 172800.0, 259200.00000000003, 345600.0], + dtype='float64') + """ + return self._maybe_mask_results(1e-9 * self.asi8, fill_value=None) + + def to_pytimedelta(self): + """ + Return Timedelta Array/Index as object ndarray of datetime.timedelta + objects. + + Returns + ------- + datetimes : ndarray + """ + return tslibs.ints_to_pytimedelta(self.asi8) + + days = _field_accessor("days", "days", + "Number of days for each element.") + seconds = _field_accessor("seconds", "seconds", + "Number of seconds (>= 0 and less than 1 day) " + "for each element.") + microseconds = _field_accessor("microseconds", "microseconds", + "Number of microseconds (>= 0 and less " + "than 1 second) for each element.") + nanoseconds = _field_accessor("nanoseconds", "nanoseconds", + "Number of nanoseconds (>= 0 and less " + "than 1 microsecond) for each element.") + + @property + def components(self): + """ + Return a dataframe of the components (days, hours, minutes, + seconds, milliseconds, microseconds, nanoseconds) of the Timedeltas. + + Returns + ------- + a DataFrame + """ + from pandas import DataFrame + + columns = ['days', 'hours', 'minutes', 'seconds', + 'milliseconds', 'microseconds', 'nanoseconds'] + hasnans = self._hasnans + if hasnans: + def f(x): + if isna(x): + return [np.nan] * len(columns) + return x.components + else: + def f(x): + return x.components + + result = DataFrame([f(x) for x in self], columns=columns) + if not hasnans: + result = result.astype('int64') + return result + + +TimedeltaArray._add_comparison_ops() + + +# --------------------------------------------------------------------- +# Constructor Helpers + +def sequence_to_td64ns(data, copy=False, unit="ns", errors="raise"): + """ + Parameters + ---------- + array : list-like + copy : bool, default False + unit : str, default "ns" + The timedelta unit to treat integers as multiples of. + errors : {"raise", "coerce", "ignore"}, default "raise" + How to handle elements that cannot be converted to timedelta64[ns]. + See ``pandas.to_timedelta`` for details. + + Returns + ------- + converted : numpy.ndarray + The sequence converted to a numpy array with dtype ``timedelta64[ns]``. + inferred_freq : Tick or None + The inferred frequency of the sequence. + + Raises + ------ + ValueError : Data cannot be converted to timedelta64[ns]. + + Notes + ----- + Unlike `pandas.to_timedelta`, if setting ``errors=ignore`` will not cause + errors to be ignored; they are caught and subsequently ignored at a + higher level. + """ + inferred_freq = None + unit = parse_timedelta_unit(unit) + + # Unwrap whatever we have into a np.ndarray + if not hasattr(data, 'dtype'): + # e.g. list, tuple + if np.ndim(data) == 0: + # i.e. generator + data = list(data) + data = np.array(data, copy=False) + elif isinstance(data, ABCSeries): + data = data._values + elif isinstance(data, (ABCTimedeltaIndex, TimedeltaArray)): + inferred_freq = data.freq + data = data._data + + # Convert whatever we have into timedelta64[ns] dtype + if is_object_dtype(data.dtype) or is_string_dtype(data.dtype): + # no need to make a copy, need to convert if string-dtyped + data = objects_to_td64ns(data, unit=unit, errors=errors) + copy = False + + elif is_integer_dtype(data.dtype): + # treat as multiples of the given unit + data, copy_made = ints_to_td64ns(data, unit=unit) + copy = copy and not copy_made + + elif is_float_dtype(data.dtype): + # cast the unit, multiply base/frace separately + # to avoid precision issues from float -> int + mask = np.isnan(data) + m, p = precision_from_unit(unit) + base = data.astype(np.int64) + frac = data - base + if p: + frac = np.round(frac, p) + data = (base * m + (frac * m).astype(np.int64)).view('timedelta64[ns]') + data[mask] = iNaT + copy = False + + elif is_timedelta64_dtype(data.dtype): + if data.dtype != _TD_DTYPE: + # non-nano unit + # TODO: watch out for overflows + data = data.astype(_TD_DTYPE) + copy = False + + elif is_datetime64_dtype(data): + # GH#23539 + warnings.warn("Passing datetime64-dtype data to TimedeltaIndex is " + "deprecated, will raise a TypeError in a future " + "version", + FutureWarning, stacklevel=4) + data = ensure_int64(data).view(_TD_DTYPE) + + else: + raise TypeError("dtype {dtype} cannot be converted to timedelta64[ns]" + .format(dtype=data.dtype)) + + data = np.array(data, copy=copy) + if data.ndim != 1: + raise ValueError("Only 1-dimensional input arrays are supported.") + + assert data.dtype == 'm8[ns]', data + return data, inferred_freq + + +def ints_to_td64ns(data, unit="ns"): + """ + Convert an ndarray with integer-dtype to timedelta64[ns] dtype, treating + the integers as multiples of the given timedelta unit. + + Parameters + ---------- + data : numpy.ndarray with integer-dtype + unit : str, default "ns" + The timedelta unit to treat integers as multiples of. + + Returns + ------- + numpy.ndarray : timedelta64[ns] array converted from data + bool : whether a copy was made + """ + copy_made = False + unit = unit if unit is not None else "ns" + + if data.dtype != np.int64: + # converting to int64 makes a copy, so we can avoid + # re-copying later + data = data.astype(np.int64) + copy_made = True + + if unit != "ns": + dtype_str = "timedelta64[{unit}]".format(unit=unit) + data = data.view(dtype_str) + + # TODO: watch out for overflows when converting from lower-resolution + data = data.astype("timedelta64[ns]") + # the astype conversion makes a copy, so we can avoid re-copying later + copy_made = True + + else: + data = data.view("timedelta64[ns]") + + return data, copy_made + + +def objects_to_td64ns(data, unit="ns", errors="raise"): + """ + Convert a object-dtyped or string-dtyped array into an + timedelta64[ns]-dtyped array. + + Parameters + ---------- + data : ndarray or Index + unit : str, default "ns" + The timedelta unit to treat integers as multiples of. + errors : {"raise", "coerce", "ignore"}, default "raise" + How to handle elements that cannot be converted to timedelta64[ns]. + See ``pandas.to_timedelta`` for details. + + Returns + ------- + numpy.ndarray : timedelta64[ns] array converted from data + + Raises + ------ + ValueError : Data cannot be converted to timedelta64[ns]. + + Notes + ----- + Unlike `pandas.to_timedelta`, if setting `errors=ignore` will not cause + errors to be ignored; they are caught and subsequently ignored at a + higher level. + """ + # coerce Index to np.ndarray, converting string-dtype if necessary + values = np.array(data, dtype=np.object_, copy=False) + + result = array_to_timedelta64(values, + unit=unit, errors=errors) + return result.view('timedelta64[ns]') + + +def _validate_td64_dtype(dtype): + dtype = pandas_dtype(dtype) + if is_dtype_equal(dtype, np.dtype("timedelta64")): + dtype = _TD_DTYPE + msg = textwrap.dedent("""\ + Passing in 'timedelta' dtype with no precision is deprecated + and will raise in a future version. Please pass in + 'timedelta64[ns]' instead.""") + warnings.warn(msg, FutureWarning, stacklevel=4) + + if not is_dtype_equal(dtype, _TD_DTYPE): + raise ValueError(_BAD_DTYPE.format(dtype=dtype)) + + return dtype + + +def _generate_regular_range(start, end, periods, offset): + stride = offset.nanos + if periods is None: + b = Timedelta(start).value + e = Timedelta(end).value + e += stride - e % stride + elif start is not None: + b = Timedelta(start).value + e = b + periods * stride + elif end is not None: + e = Timedelta(end).value + stride + b = e - periods * stride + else: + raise ValueError("at least 'start' or 'end' should be specified " + "if a 'period' is given.") + + data = np.arange(b, e, stride, dtype=np.int64) + return data diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/core/computation/align.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/core/computation/align.py new file mode 100644 index 0000000000000000000000000000000000000000..951174648091f70103d87225c0f5e8ae4fa825b8 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/core/computation/align.py @@ -0,0 +1,179 @@ +"""Core eval alignment algorithms +""" + +from functools import partial, wraps +import warnings + +import numpy as np + +from pandas.compat import range, zip +from pandas.errors import PerformanceWarning + +import pandas as pd +from pandas import compat +import pandas.core.common as com +from pandas.core.computation.common import _result_type_many + + +def _align_core_single_unary_op(term): + if isinstance(term.value, np.ndarray): + typ = partial(np.asanyarray, dtype=term.value.dtype) + else: + typ = type(term.value) + ret = typ, + + if not hasattr(term.value, 'axes'): + ret += None, + else: + ret += _zip_axes_from_type(typ, term.value.axes), + return ret + + +def _zip_axes_from_type(typ, new_axes): + axes = {ax_name: new_axes[ax_ind] + for ax_ind, ax_name in compat.iteritems(typ._AXIS_NAMES)} + return axes + + +def _any_pandas_objects(terms): + """Check a sequence of terms for instances of PandasObject.""" + return any(isinstance(term.value, pd.core.generic.PandasObject) + for term in terms) + + +def _filter_special_cases(f): + @wraps(f) + def wrapper(terms): + # single unary operand + if len(terms) == 1: + return _align_core_single_unary_op(terms[0]) + + term_values = (term.value for term in terms) + + # we don't have any pandas objects + if not _any_pandas_objects(terms): + return _result_type_many(*term_values), None + + return f(terms) + return wrapper + + +@_filter_special_cases +def _align_core(terms): + term_index = [i for i, term in enumerate(terms) + if hasattr(term.value, 'axes')] + term_dims = [terms[i].value.ndim for i in term_index] + ndims = pd.Series(dict(zip(term_index, term_dims))) + + # initial axes are the axes of the largest-axis'd term + biggest = terms[ndims.idxmax()].value + typ = biggest._constructor + axes = biggest.axes + naxes = len(axes) + gt_than_one_axis = naxes > 1 + + for value in (terms[i].value for i in term_index): + is_series = isinstance(value, pd.Series) + is_series_and_gt_one_axis = is_series and gt_than_one_axis + + for axis, items in enumerate(value.axes): + if is_series_and_gt_one_axis: + ax, itm = naxes - 1, value.index + else: + ax, itm = axis, items + + if not axes[ax].is_(itm): + axes[ax] = axes[ax].join(itm, how='outer') + + for i, ndim in compat.iteritems(ndims): + for axis, items in zip(range(ndim), axes): + ti = terms[i].value + + if hasattr(ti, 'reindex'): + transpose = isinstance(ti, pd.Series) and naxes > 1 + reindexer = axes[naxes - 1] if transpose else items + + term_axis_size = len(ti.axes[axis]) + reindexer_size = len(reindexer) + + ordm = np.log10(max(1, abs(reindexer_size - term_axis_size))) + if ordm >= 1 and reindexer_size >= 10000: + w = ('Alignment difference on axis {axis} is larger ' + 'than an order of magnitude on term {term!r}, by ' + 'more than {ordm:.4g}; performance may suffer' + ).format(axis=axis, term=terms[i].name, ordm=ordm) + warnings.warn(w, category=PerformanceWarning, stacklevel=6) + + f = partial(ti.reindex, reindexer, axis=axis, copy=False) + + terms[i].update(f()) + + terms[i].update(terms[i].value.values) + + return typ, _zip_axes_from_type(typ, axes) + + +def _align(terms): + """Align a set of terms""" + try: + # flatten the parse tree (a nested list, really) + terms = list(com.flatten(terms)) + except TypeError: + # can't iterate so it must just be a constant or single variable + if isinstance(terms.value, pd.core.generic.NDFrame): + typ = type(terms.value) + return typ, _zip_axes_from_type(typ, terms.value.axes) + return np.result_type(terms.type), None + + # if all resolved variables are numeric scalars + if all(term.is_scalar for term in terms): + return _result_type_many(*(term.value for term in terms)).type, None + + # perform the main alignment + typ, axes = _align_core(terms) + return typ, axes + + +def _reconstruct_object(typ, obj, axes, dtype): + """Reconstruct an object given its type, raw value, and possibly empty + (None) axes. + + Parameters + ---------- + typ : object + A type + obj : object + The value to use in the type constructor + axes : dict + The axes to use to construct the resulting pandas object + + Returns + ------- + ret : typ + An object of type ``typ`` with the value `obj` and possible axes + `axes`. + """ + try: + typ = typ.type + except AttributeError: + pass + + res_t = np.result_type(obj.dtype, dtype) + + if (not isinstance(typ, partial) and + issubclass(typ, pd.core.generic.PandasObject)): + return typ(obj, dtype=res_t, **axes) + + # special case for pathological things like ~True/~False + if hasattr(res_t, 'type') and typ == np.bool_ and res_t != np.bool_: + ret_value = res_t.type(obj) + else: + ret_value = typ(obj).astype(res_t) + # The condition is to distinguish 0-dim array (returned in case of + # scalar) and 1 element array + # e.g. np.array(0) and np.array([0]) + if len(obj.shape) == 1 and len(obj) == 1: + if not isinstance(ret_value, np.ndarray): + ret_value = np.array([ret_value]).astype(res_t) + + return ret_value diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/core/computation/api.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/core/computation/api.py new file mode 100644 index 0000000000000000000000000000000000000000..31e8a4873b0ad4bef50c0157682b1e2c5912cb61 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/core/computation/api.py @@ -0,0 +1,3 @@ +# flake8: noqa + +from pandas.core.computation.eval import eval diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/core/computation/check.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/core/computation/check.py new file mode 100644 index 0000000000000000000000000000000000000000..da89bde56fe18b99e233f40b4554638c2d62e44a --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/core/computation/check.py @@ -0,0 +1,24 @@ +from distutils.version import LooseVersion +import warnings + +_NUMEXPR_INSTALLED = False +_MIN_NUMEXPR_VERSION = "2.6.1" +_NUMEXPR_VERSION = None + +try: + import numexpr as ne + ver = LooseVersion(ne.__version__) + _NUMEXPR_INSTALLED = ver >= LooseVersion(_MIN_NUMEXPR_VERSION) + _NUMEXPR_VERSION = ver + + if not _NUMEXPR_INSTALLED: + warnings.warn( + "The installed version of numexpr {ver} is not supported " + "in pandas and will be not be used\nThe minimum supported " + "version is {min_ver}\n".format( + ver=ver, min_ver=_MIN_NUMEXPR_VERSION), UserWarning) + +except ImportError: # pragma: no cover + pass + +__all__ = ['_NUMEXPR_INSTALLED', '_NUMEXPR_VERSION'] diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/core/computation/common.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/core/computation/common.py new file mode 100644 index 0000000000000000000000000000000000000000..e7eca04e413c5aa6e1c720669940a6b1e8f014ce --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/core/computation/common.py @@ -0,0 +1,26 @@ +import numpy as np + +from pandas.compat import reduce + +import pandas as pd + + +def _ensure_decoded(s): + """ if we have bytes, decode them to unicode """ + if isinstance(s, (np.bytes_, bytes)): + s = s.decode(pd.get_option('display.encoding')) + return s + + +def _result_type_many(*arrays_and_dtypes): + """ wrapper around numpy.result_type which overcomes the NPY_MAXARGS (32) + argument limit """ + try: + return np.result_type(*arrays_and_dtypes) + except ValueError: + # we have > NPY_MAXARGS terms in our expression + return reduce(np.result_type, arrays_and_dtypes) + + +class NameResolutionError(NameError): + pass diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/core/computation/engines.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/core/computation/engines.py new file mode 100644 index 0000000000000000000000000000000000000000..bccd37131c81a8937524c9ccd711fa8ae93cbe2e --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/core/computation/engines.py @@ -0,0 +1,151 @@ +""" +Engine classes for :func:`~pandas.eval` +""" + +import abc + +from pandas.compat import map + +from pandas import compat +from pandas.core.computation.align import _align, _reconstruct_object +from pandas.core.computation.ops import ( + UndefinedVariableError, _mathops, _reductions) + +import pandas.io.formats.printing as printing + +_ne_builtins = frozenset(_mathops + _reductions) + + +class NumExprClobberingError(NameError): + pass + + +def _check_ne_builtin_clash(expr): + """Attempt to prevent foot-shooting in a helpful way. + + Parameters + ---------- + terms : Term + Terms can contain + """ + names = expr.names + overlap = names & _ne_builtins + + if overlap: + s = ', '.join(map(repr, overlap)) + raise NumExprClobberingError('Variables in expression "{expr}" ' + 'overlap with builtins: ({s})' + .format(expr=expr, s=s)) + + +class AbstractEngine(object): + + """Object serving as a base class for all engines.""" + + __metaclass__ = abc.ABCMeta + + has_neg_frac = False + + def __init__(self, expr): + self.expr = expr + self.aligned_axes = None + self.result_type = None + + def convert(self): + """Convert an expression for evaluation. + + Defaults to return the expression as a string. + """ + return printing.pprint_thing(self.expr) + + def evaluate(self): + """Run the engine on the expression + + This method performs alignment which is necessary no matter what engine + is being used, thus its implementation is in the base class. + + Returns + ------- + obj : object + The result of the passed expression. + """ + if not self._is_aligned: + self.result_type, self.aligned_axes = _align(self.expr.terms) + + # make sure no names in resolvers and locals/globals clash + res = self._evaluate() + return _reconstruct_object(self.result_type, res, self.aligned_axes, + self.expr.terms.return_type) + + @property + def _is_aligned(self): + return self.aligned_axes is not None and self.result_type is not None + + @abc.abstractmethod + def _evaluate(self): + """Return an evaluated expression. + + Parameters + ---------- + env : Scope + The local and global environment in which to evaluate an + expression. + + Notes + ----- + Must be implemented by subclasses. + """ + pass + + +class NumExprEngine(AbstractEngine): + + """NumExpr engine class""" + has_neg_frac = True + + def __init__(self, expr): + super(NumExprEngine, self).__init__(expr) + + def convert(self): + return str(super(NumExprEngine, self).convert()) + + def _evaluate(self): + import numexpr as ne + + # convert the expression to a valid numexpr expression + s = self.convert() + + try: + env = self.expr.env + scope = env.full_scope + truediv = scope['truediv'] + _check_ne_builtin_clash(self.expr) + return ne.evaluate(s, local_dict=scope, truediv=truediv) + except KeyError as e: + # python 3 compat kludge + try: + msg = e.message + except AttributeError: + msg = compat.text_type(e) + raise UndefinedVariableError(msg) + + +class PythonEngine(AbstractEngine): + + """Evaluate an expression in Python space. + + Mostly for testing purposes. + """ + has_neg_frac = False + + def __init__(self, expr): + super(PythonEngine, self).__init__(expr) + + def evaluate(self): + return self.expr() + + def _evaluate(self): + pass + + +_engines = {'numexpr': NumExprEngine, 'python': PythonEngine} diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/tests/groupby/aggregate/test_aggregate.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/tests/groupby/aggregate/test_aggregate.py new file mode 100644 index 0000000000000000000000000000000000000000..62ec0555f9033b6993549c2321354c0dbf43580b --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/tests/groupby/aggregate/test_aggregate.py @@ -0,0 +1,289 @@ +# -*- coding: utf-8 -*- + +""" +test .agg behavior / note that .apply is tested generally in test_groupby.py +""" + +import numpy as np +import pytest + +from pandas.compat import OrderedDict + +import pandas as pd +from pandas import DataFrame, Index, MultiIndex, Series, concat +from pandas.core.base import SpecificationError +from pandas.core.groupby.grouper import Grouping +import pandas.util.testing as tm + + +def test_agg_regression1(tsframe): + grouped = tsframe.groupby([lambda x: x.year, lambda x: x.month]) + result = grouped.agg(np.mean) + expected = grouped.mean() + tm.assert_frame_equal(result, expected) + + +def test_agg_must_agg(df): + grouped = df.groupby('A')['C'] + + msg = "Must produce aggregated value" + with pytest.raises(Exception, match=msg): + grouped.agg(lambda x: x.describe()) + with pytest.raises(Exception, match=msg): + grouped.agg(lambda x: x.index[:2]) + + +def test_agg_ser_multi_key(df): + # TODO(wesm): unused + ser = df.C # noqa + + f = lambda x: x.sum() + results = df.C.groupby([df.A, df.B]).aggregate(f) + expected = df.groupby(['A', 'B']).sum()['C'] + tm.assert_series_equal(results, expected) + + +def test_groupby_aggregation_mixed_dtype(): + + # GH 6212 + expected = DataFrame({ + 'v1': [5, 5, 7, np.nan, 3, 3, 4, 1], + 'v2': [55, 55, 77, np.nan, 33, 33, 44, 11]}, + index=MultiIndex.from_tuples([(1, 95), (1, 99), (2, 95), (2, 99), + ('big', 'damp'), + ('blue', 'dry'), + ('red', 'red'), ('red', 'wet')], + names=['by1', 'by2'])) + + df = DataFrame({ + 'v1': [1, 3, 5, 7, 8, 3, 5, np.nan, 4, 5, 7, 9], + 'v2': [11, 33, 55, 77, 88, 33, 55, np.nan, 44, 55, 77, 99], + 'by1': ["red", "blue", 1, 2, np.nan, "big", 1, 2, "red", 1, np.nan, + 12], + 'by2': ["wet", "dry", 99, 95, np.nan, "damp", 95, 99, "red", 99, + np.nan, np.nan] + }) + + g = df.groupby(['by1', 'by2']) + result = g[['v1', 'v2']].mean() + tm.assert_frame_equal(result, expected) + + +def test_agg_apply_corner(ts, tsframe): + # nothing to group, all NA + grouped = ts.groupby(ts * np.nan) + assert ts.dtype == np.float64 + + # groupby float64 values results in Float64Index + exp = Series([], dtype=np.float64, + index=pd.Index([], dtype=np.float64)) + tm.assert_series_equal(grouped.sum(), exp) + tm.assert_series_equal(grouped.agg(np.sum), exp) + tm.assert_series_equal(grouped.apply(np.sum), exp, + check_index_type=False) + + # DataFrame + grouped = tsframe.groupby(tsframe['A'] * np.nan) + exp_df = DataFrame(columns=tsframe.columns, dtype=float, + index=pd.Index([], dtype=np.float64)) + tm.assert_frame_equal(grouped.sum(), exp_df, check_names=False) + tm.assert_frame_equal(grouped.agg(np.sum), exp_df, check_names=False) + tm.assert_frame_equal(grouped.apply(np.sum), exp_df.iloc[:, :0], + check_names=False) + + +def test_agg_grouping_is_list_tuple(ts): + df = tm.makeTimeDataFrame() + + grouped = df.groupby(lambda x: x.year) + grouper = grouped.grouper.groupings[0].grouper + grouped.grouper.groupings[0] = Grouping(ts.index, list(grouper)) + + result = grouped.agg(np.mean) + expected = grouped.mean() + tm.assert_frame_equal(result, expected) + + grouped.grouper.groupings[0] = Grouping(ts.index, tuple(grouper)) + + result = grouped.agg(np.mean) + expected = grouped.mean() + tm.assert_frame_equal(result, expected) + + +def test_agg_python_multiindex(mframe): + grouped = mframe.groupby(['A', 'B']) + + result = grouped.agg(np.mean) + expected = grouped.mean() + tm.assert_frame_equal(result, expected) + + +@pytest.mark.parametrize('groupbyfunc', [ + lambda x: x.weekday(), + [lambda x: x.month, lambda x: x.weekday()], +]) +def test_aggregate_str_func(tsframe, groupbyfunc): + grouped = tsframe.groupby(groupbyfunc) + + # single series + result = grouped['A'].agg('std') + expected = grouped['A'].std() + tm.assert_series_equal(result, expected) + + # group frame by function name + result = grouped.aggregate('var') + expected = grouped.var() + tm.assert_frame_equal(result, expected) + + # group frame by function dict + result = grouped.agg(OrderedDict([['A', 'var'], + ['B', 'std'], + ['C', 'mean'], + ['D', 'sem']])) + expected = DataFrame(OrderedDict([['A', grouped['A'].var()], + ['B', grouped['B'].std()], + ['C', grouped['C'].mean()], + ['D', grouped['D'].sem()]])) + tm.assert_frame_equal(result, expected) + + +def test_aggregate_item_by_item(df): + grouped = df.groupby('A') + + aggfun = lambda ser: ser.size + result = grouped.agg(aggfun) + foo = (df.A == 'foo').sum() + bar = (df.A == 'bar').sum() + K = len(result.columns) + + # GH5782 + # odd comparisons can result here, so cast to make easy + exp = pd.Series(np.array([foo] * K), index=list('BCD'), + dtype=np.float64, name='foo') + tm.assert_series_equal(result.xs('foo'), exp) + + exp = pd.Series(np.array([bar] * K), index=list('BCD'), + dtype=np.float64, name='bar') + tm.assert_almost_equal(result.xs('bar'), exp) + + def aggfun(ser): + return ser.size + + result = DataFrame().groupby(df.A).agg(aggfun) + assert isinstance(result, DataFrame) + assert len(result) == 0 + + +def test_wrap_agg_out(three_group): + grouped = three_group.groupby(['A', 'B']) + + def func(ser): + if ser.dtype == np.object: + raise TypeError + else: + return ser.sum() + + result = grouped.aggregate(func) + exp_grouped = three_group.loc[:, three_group.columns != 'C'] + expected = exp_grouped.groupby(['A', 'B']).aggregate(func) + tm.assert_frame_equal(result, expected) + + +def test_agg_multiple_functions_maintain_order(df): + # GH #610 + funcs = [('mean', np.mean), ('max', np.max), ('min', np.min)] + result = df.groupby('A')['C'].agg(funcs) + exp_cols = Index(['mean', 'max', 'min']) + + tm.assert_index_equal(result.columns, exp_cols) + + +def test_multiple_functions_tuples_and_non_tuples(df): + # #1359 + funcs = [('foo', 'mean'), 'std'] + ex_funcs = [('foo', 'mean'), ('std', 'std')] + + result = df.groupby('A')['C'].agg(funcs) + expected = df.groupby('A')['C'].agg(ex_funcs) + tm.assert_frame_equal(result, expected) + + result = df.groupby('A').agg(funcs) + expected = df.groupby('A').agg(ex_funcs) + tm.assert_frame_equal(result, expected) + + +def test_agg_multiple_functions_too_many_lambdas(df): + grouped = df.groupby('A') + funcs = ['mean', lambda x: x.mean(), lambda x: x.std()] + + msg = 'Function names must be unique, found multiple named ' + with pytest.raises(SpecificationError, match=msg): + grouped.agg(funcs) + + +def test_more_flexible_frame_multi_function(df): + grouped = df.groupby('A') + + exmean = grouped.agg(OrderedDict([['C', np.mean], ['D', np.mean]])) + exstd = grouped.agg(OrderedDict([['C', np.std], ['D', np.std]])) + + expected = concat([exmean, exstd], keys=['mean', 'std'], axis=1) + expected = expected.swaplevel(0, 1, axis=1).sort_index(level=0, axis=1) + + d = OrderedDict([['C', [np.mean, np.std]], ['D', [np.mean, np.std]]]) + result = grouped.aggregate(d) + + tm.assert_frame_equal(result, expected) + + # be careful + result = grouped.aggregate(OrderedDict([['C', np.mean], + ['D', [np.mean, np.std]]])) + expected = grouped.aggregate(OrderedDict([['C', np.mean], + ['D', [np.mean, np.std]]])) + tm.assert_frame_equal(result, expected) + + def foo(x): + return np.mean(x) + + def bar(x): + return np.std(x, ddof=1) + + # this uses column selection & renaming + with tm.assert_produces_warning(FutureWarning, check_stacklevel=False): + d = OrderedDict([['C', np.mean], + ['D', OrderedDict([['foo', np.mean], + ['bar', np.std]])]]) + result = grouped.aggregate(d) + + d = OrderedDict([['C', [np.mean]], ['D', [foo, bar]]]) + expected = grouped.aggregate(d) + + tm.assert_frame_equal(result, expected) + + +def test_multi_function_flexible_mix(df): + # GH #1268 + grouped = df.groupby('A') + + # Expected + d = OrderedDict([['C', OrderedDict([['foo', 'mean'], ['bar', 'std']])], + ['D', {'sum': 'sum'}]]) + # this uses column selection & renaming + with tm.assert_produces_warning(FutureWarning, check_stacklevel=False): + expected = grouped.aggregate(d) + + # Test 1 + d = OrderedDict([['C', OrderedDict([['foo', 'mean'], ['bar', 'std']])], + ['D', 'sum']]) + # this uses column selection & renaming + with tm.assert_produces_warning(FutureWarning, check_stacklevel=False): + result = grouped.aggregate(d) + tm.assert_frame_equal(result, expected) + + # Test 2 + d = OrderedDict([['C', OrderedDict([['foo', 'mean'], ['bar', 'std']])], + ['D', ['sum']]]) + # this uses column selection & renaming + with tm.assert_produces_warning(FutureWarning, check_stacklevel=False): + result = grouped.aggregate(d) + tm.assert_frame_equal(result, expected) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/tests/groupby/aggregate/test_cython.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/tests/groupby/aggregate/test_cython.py new file mode 100644 index 0000000000000000000000000000000000000000..ad3974d5e2fb86e667d55a02800d916737733d61 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/tests/groupby/aggregate/test_cython.py @@ -0,0 +1,218 @@ +# -*- coding: utf-8 -*- + +""" +test cython .agg behavior +""" + +from __future__ import print_function + +import numpy as np +import pytest + +import pandas as pd +from pandas import ( + DataFrame, Index, NaT, Series, Timedelta, Timestamp, bdate_range) +from pandas.core.groupby.groupby import DataError +import pandas.util.testing as tm + + +@pytest.mark.parametrize('op_name', [ + 'count', + 'sum', + 'std', + 'var', + 'sem', + 'mean', + pytest.param('median', + # ignore mean of empty slice + # and all-NaN + marks=[pytest.mark.filterwarnings( + "ignore::RuntimeWarning" + )]), + 'prod', + 'min', + 'max', +]) +def test_cythonized_aggers(op_name): + data = {'A': [0, 0, 0, 0, 1, 1, 1, 1, 1, 1., np.nan, np.nan], + 'B': ['A', 'B'] * 6, + 'C': np.random.randn(12)} + df = DataFrame(data) + df.loc[2:10:2, 'C'] = np.nan + + op = lambda x: getattr(x, op_name)() + + # single column + grouped = df.drop(['B'], axis=1).groupby('A') + exp = {cat: op(group['C']) for cat, group in grouped} + exp = DataFrame({'C': exp}) + exp.index.name = 'A' + result = op(grouped) + tm.assert_frame_equal(result, exp) + + # multiple columns + grouped = df.groupby(['A', 'B']) + expd = {} + for (cat1, cat2), group in grouped: + expd.setdefault(cat1, {})[cat2] = op(group['C']) + exp = DataFrame(expd).T.stack(dropna=False) + exp.index.names = ['A', 'B'] + exp.name = 'C' + + result = op(grouped)['C'] + if op_name in ['sum', 'prod']: + tm.assert_series_equal(result, exp) + + +def test_cython_agg_boolean(): + frame = DataFrame({'a': np.random.randint(0, 5, 50), + 'b': np.random.randint(0, 2, 50).astype('bool')}) + result = frame.groupby('a')['b'].mean() + expected = frame.groupby('a')['b'].agg(np.mean) + + tm.assert_series_equal(result, expected) + + +def test_cython_agg_nothing_to_agg(): + frame = DataFrame({'a': np.random.randint(0, 5, 50), + 'b': ['foo', 'bar'] * 25}) + msg = "No numeric types to aggregate" + + with pytest.raises(DataError, match=msg): + frame.groupby('a')['b'].mean() + + frame = DataFrame({'a': np.random.randint(0, 5, 50), + 'b': ['foo', 'bar'] * 25}) + with pytest.raises(DataError, match=msg): + frame[['b']].groupby(frame['a']).mean() + + +def test_cython_agg_nothing_to_agg_with_dates(): + frame = DataFrame({'a': np.random.randint(0, 5, 50), + 'b': ['foo', 'bar'] * 25, + 'dates': pd.date_range('now', periods=50, freq='T')}) + msg = "No numeric types to aggregate" + with pytest.raises(DataError, match=msg): + frame.groupby('b').dates.mean() + + +def test_cython_agg_frame_columns(): + # #2113 + df = DataFrame({'x': [1, 2, 3], 'y': [3, 4, 5]}) + + df.groupby(level=0, axis='columns').mean() + df.groupby(level=0, axis='columns').mean() + df.groupby(level=0, axis='columns').mean() + df.groupby(level=0, axis='columns').mean() + + +def test_cython_agg_return_dict(): + # GH 16741 + df = DataFrame( + {'A': ['foo', 'bar', 'foo', 'bar', 'foo', 'bar', 'foo', 'foo'], + 'B': ['one', 'one', 'two', 'three', 'two', 'two', 'one', 'three'], + 'C': np.random.randn(8), + 'D': np.random.randn(8)}) + + ts = df.groupby('A')['B'].agg(lambda x: x.value_counts().to_dict()) + expected = Series([{'two': 1, 'one': 1, 'three': 1}, + {'two': 2, 'one': 2, 'three': 1}], + index=Index(['bar', 'foo'], name='A'), + name='B') + tm.assert_series_equal(ts, expected) + + +def test_cython_fail_agg(): + dr = bdate_range('1/1/2000', periods=50) + ts = Series(['A', 'B', 'C', 'D', 'E'] * 10, index=dr) + + grouped = ts.groupby(lambda x: x.month) + summed = grouped.sum() + expected = grouped.agg(np.sum) + tm.assert_series_equal(summed, expected) + + +@pytest.mark.parametrize('op, targop', [ + ('mean', np.mean), + ('median', np.median), + ('var', np.var), + ('add', np.sum), + ('prod', np.prod), + ('min', np.min), + ('max', np.max), + ('first', lambda x: x.iloc[0]), + ('last', lambda x: x.iloc[-1]), +]) +def test__cython_agg_general(op, targop): + df = DataFrame(np.random.randn(1000)) + labels = np.random.randint(0, 50, size=1000).astype(float) + + result = df.groupby(labels)._cython_agg_general(op) + expected = df.groupby(labels).agg(targop) + tm.assert_frame_equal(result, expected) + + +@pytest.mark.parametrize('op, targop', [ + ('mean', np.mean), + ('median', lambda x: np.median(x) if len(x) > 0 else np.nan), + ('var', lambda x: np.var(x, ddof=1)), + ('min', np.min), + ('max', np.max), ] +) +def test_cython_agg_empty_buckets(op, targop, observed): + df = pd.DataFrame([11, 12, 13]) + grps = range(0, 55, 5) + + # calling _cython_agg_general directly, instead of via the user API + # which sets different values for min_count, so do that here. + g = df.groupby(pd.cut(df[0], grps), observed=observed) + result = g._cython_agg_general(op) + + g = df.groupby(pd.cut(df[0], grps), observed=observed) + expected = g.agg(lambda x: targop(x)) + tm.assert_frame_equal(result, expected) + + +def test_cython_agg_empty_buckets_nanops(observed): + # GH-18869 can't call nanops on empty groups, so hardcode expected + # for these + df = pd.DataFrame([11, 12, 13], columns=['a']) + grps = range(0, 25, 5) + # add / sum + result = df.groupby(pd.cut(df['a'], grps), + observed=observed)._cython_agg_general('add') + intervals = pd.interval_range(0, 20, freq=5) + expected = pd.DataFrame( + {"a": [0, 0, 36, 0]}, + index=pd.CategoricalIndex(intervals, name='a', ordered=True)) + if observed: + expected = expected[expected.a != 0] + + tm.assert_frame_equal(result, expected) + + # prod + result = df.groupby(pd.cut(df['a'], grps), + observed=observed)._cython_agg_general('prod') + expected = pd.DataFrame( + {"a": [1, 1, 1716, 1]}, + index=pd.CategoricalIndex(intervals, name='a', ordered=True)) + if observed: + expected = expected[expected.a != 1] + + tm.assert_frame_equal(result, expected) + + +@pytest.mark.parametrize('op', ['first', 'last', 'max', 'min']) +@pytest.mark.parametrize('data', [ + Timestamp('2016-10-14 21:00:44.557'), + Timedelta('17088 days 21:00:44.557'), ]) +def test_cython_with_timestamp_and_nat(op, data): + # https://github.com/pandas-dev/pandas/issues/19526 + df = DataFrame({'a': [0, 1], 'b': [data, NaT]}) + index = Index([0, 1], name='a') + + # We will group by a and test the cython aggregations + expected = DataFrame({'b': [data, NaT]}, index=index) + + result = df.groupby('a').aggregate(op) + tm.assert_frame_equal(expected, result) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/tests/indexing/interval/__init__.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/tests/indexing/interval/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/tests/indexing/interval/test_interval_new.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/tests/indexing/interval/test_interval_new.py new file mode 100644 index 0000000000000000000000000000000000000000..4b2ec0c4d17bf9f46a2642f08f742dafc0a6fa72 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/tests/indexing/interval/test_interval_new.py @@ -0,0 +1,246 @@ +import numpy as np +import pytest + +from pandas import Interval, IntervalIndex, Series +import pandas.util.testing as tm + +pytestmark = pytest.mark.skip(reason="new indexing tests for issue 16316") + + +class TestIntervalIndex(object): + + def setup_method(self, method): + self.s = Series(np.arange(5), IntervalIndex.from_breaks(np.arange(6))) + + def test_loc_with_interval(self): + + # loc with single label / list of labels: + # - Intervals: only exact matches + # - scalars: those that contain it + + s = self.s + + expected = 0 + result = s.loc[Interval(0, 1)] + assert result == expected + result = s[Interval(0, 1)] + assert result == expected + + expected = s.iloc[3:5] + result = s.loc[[Interval(3, 4), Interval(4, 5)]] + tm.assert_series_equal(expected, result) + result = s[[Interval(3, 4), Interval(4, 5)]] + tm.assert_series_equal(expected, result) + + # missing or not exact + with pytest.raises(KeyError): + s.loc[Interval(3, 5, closed='left')] + + with pytest.raises(KeyError): + s[Interval(3, 5, closed='left')] + + with pytest.raises(KeyError): + s[Interval(3, 5)] + + with pytest.raises(KeyError): + s.loc[Interval(3, 5)] + + with pytest.raises(KeyError): + s[Interval(3, 5)] + + with pytest.raises(KeyError): + s.loc[Interval(-2, 0)] + + with pytest.raises(KeyError): + s[Interval(-2, 0)] + + with pytest.raises(KeyError): + s.loc[Interval(5, 6)] + + with pytest.raises(KeyError): + s[Interval(5, 6)] + + def test_loc_with_scalar(self): + + # loc with single label / list of labels: + # - Intervals: only exact matches + # - scalars: those that contain it + + s = self.s + + assert s.loc[1] == 0 + assert s.loc[1.5] == 1 + assert s.loc[2] == 1 + + # TODO with __getitem__ same rules as loc, or positional ? + # assert s[1] == 0 + # assert s[1.5] == 1 + # assert s[2] == 1 + + expected = s.iloc[1:4] + tm.assert_series_equal(expected, s.loc[[1.5, 2.5, 3.5]]) + tm.assert_series_equal(expected, s.loc[[2, 3, 4]]) + tm.assert_series_equal(expected, s.loc[[1.5, 3, 4]]) + + expected = s.iloc[[1, 1, 2, 1]] + tm.assert_series_equal(expected, s.loc[[1.5, 2, 2.5, 1.5]]) + + expected = s.iloc[2:5] + tm.assert_series_equal(expected, s.loc[s >= 2]) + + def test_loc_with_slices(self): + + # loc with slices: + # - Interval objects: only works with exact matches + # - scalars: only works for non-overlapping, monotonic intervals, + # and start/stop select location based on the interval that + # contains them: + # (slice_loc(start, stop) == (idx.get_loc(start), idx.get_loc(stop)) + + s = self.s + + # slice of interval + + expected = s.iloc[:3] + result = s.loc[Interval(0, 1):Interval(2, 3)] + tm.assert_series_equal(expected, result) + result = s[Interval(0, 1):Interval(2, 3)] + tm.assert_series_equal(expected, result) + + expected = s.iloc[4:] + result = s.loc[Interval(3, 4):] + tm.assert_series_equal(expected, result) + result = s[Interval(3, 4):] + tm.assert_series_equal(expected, result) + + with pytest.raises(KeyError): + s.loc[Interval(3, 6):] + + with pytest.raises(KeyError): + s[Interval(3, 6):] + + with pytest.raises(KeyError): + s.loc[Interval(3, 4, closed='left'):] + + with pytest.raises(KeyError): + s[Interval(3, 4, closed='left'):] + + # TODO with non-existing intervals ? + # s.loc[Interval(-1, 0):Interval(2, 3)] + + # slice of scalar + + expected = s.iloc[:3] + tm.assert_series_equal(expected, s.loc[:3]) + tm.assert_series_equal(expected, s.loc[:2.5]) + tm.assert_series_equal(expected, s.loc[0.1:2.5]) + + # TODO should this work? (-1 is not contained in any of the Intervals) + # tm.assert_series_equal(expected, s.loc[-1:3]) + + # TODO with __getitem__ same rules as loc, or positional ? + # tm.assert_series_equal(expected, s[:3]) + # tm.assert_series_equal(expected, s[:2.5]) + # tm.assert_series_equal(expected, s[0.1:2.5]) + + # slice of scalar with step != 1 + with pytest.raises(NotImplementedError): + s[0:4:2] + + def test_loc_with_overlap(self): + + idx = IntervalIndex.from_tuples([(1, 5), (3, 7)]) + s = Series(range(len(idx)), index=idx) + + # scalar + expected = s + result = s.loc[4] + tm.assert_series_equal(expected, result) + + result = s[4] + tm.assert_series_equal(expected, result) + + result = s.loc[[4]] + tm.assert_series_equal(expected, result) + + result = s[[4]] + tm.assert_series_equal(expected, result) + + # interval + expected = 0 + result = s.loc[Interval(1, 5)] + tm.assert_series_equal(expected, result) + + result = s[Interval(1, 5)] + tm.assert_series_equal(expected, result) + + expected = s + result = s.loc[[Interval(1, 5), Interval(3, 7)]] + tm.assert_series_equal(expected, result) + + result = s[[Interval(1, 5), Interval(3, 7)]] + tm.assert_series_equal(expected, result) + + with pytest.raises(KeyError): + s.loc[Interval(3, 5)] + + with pytest.raises(KeyError): + s.loc[[Interval(3, 5)]] + + with pytest.raises(KeyError): + s[Interval(3, 5)] + + with pytest.raises(KeyError): + s[[Interval(3, 5)]] + + # slices with interval (only exact matches) + expected = s + result = s.loc[Interval(1, 5):Interval(3, 7)] + tm.assert_series_equal(expected, result) + + result = s[Interval(1, 5):Interval(3, 7)] + tm.assert_series_equal(expected, result) + + with pytest.raises(KeyError): + s.loc[Interval(1, 6):Interval(3, 8)] + + with pytest.raises(KeyError): + s[Interval(1, 6):Interval(3, 8)] + + # slices with scalar raise for overlapping intervals + # TODO KeyError is the appropriate error? + with pytest.raises(KeyError): + s.loc[1:4] + + def test_non_unique(self): + + idx = IntervalIndex.from_tuples([(1, 3), (3, 7)]) + s = Series(range(len(idx)), index=idx) + + result = s.loc[Interval(1, 3)] + assert result == 0 + + result = s.loc[[Interval(1, 3)]] + expected = s.iloc[0:1] + tm.assert_series_equal(expected, result) + + def test_non_unique_moar(self): + + idx = IntervalIndex.from_tuples([(1, 3), (1, 3), (3, 7)]) + s = Series(range(len(idx)), index=idx) + + expected = s.iloc[[0, 1]] + result = s.loc[Interval(1, 3)] + tm.assert_series_equal(expected, result) + + expected = s + result = s.loc[Interval(1, 3):] + tm.assert_series_equal(expected, result) + + expected = s + result = s[Interval(1, 3):] + tm.assert_series_equal(expected, result) + + expected = s.iloc[[0, 1]] + result = s[[Interval(1, 3)]] + tm.assert_series_equal(expected, result) diff --git a/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/tests/indexing/multiindex/conftest.py b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/tests/indexing/multiindex/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..545e092d9ce65132cbde1e856994680324a9e4c8 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2019/CSAW-Quals/crypto/brillouin/lib/python2.7/site-packages/pandas/tests/indexing/multiindex/conftest.py @@ -0,0 +1,31 @@ +import numpy as np +import pytest + +from pandas import DataFrame, Index, MultiIndex +from pandas.util import testing as tm + + +@pytest.fixture +def multiindex_dataframe_random_data(): + """DataFrame with 2 level MultiIndex with random data""" + index = MultiIndex(levels=[['foo', 'bar', 'baz', 'qux'], ['one', 'two', + 'three']], + codes=[[0, 0, 0, 1, 1, 2, 2, 3, 3, 3], + [0, 1, 2, 0, 1, 1, 2, 0, 1, 2]], + names=['first', 'second']) + return DataFrame(np.random.randn(10, 3), index=index, + columns=Index(['A', 'B', 'C'], name='exp')) + + +@pytest.fixture +def multiindex_year_month_day_dataframe_random_data(): + """DataFrame with 3 level MultiIndex (year, month, day) covering + first 100 business days from 2000-01-01 with random data""" + tdf = tm.makeTimeDataFrame(100) + ymd = tdf.groupby([lambda x: x.year, lambda x: x.month, + lambda x: x.day]).sum() + # use Int64Index, to make sure things work + ymd.index.set_levels([lev.astype('i8') for lev in ymd.index.levels], + inplace=True) + ymd.index.set_names(['year', 'month', 'day'], inplace=True) + return ymd diff --git a/benchmark/NYU_CTF_Bench/test/2020/CSAW-Quals/pwn/pwnvoltex/handout/pwnvoltex.tar.gz b/benchmark/NYU_CTF_Bench/test/2020/CSAW-Quals/pwn/pwnvoltex/handout/pwnvoltex.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..91890a0987208d0b9d1b814c8991286670eeee2f --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2020/CSAW-Quals/pwn/pwnvoltex/handout/pwnvoltex.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5475c709a24f27bcdd42624917e295b0498ef1eba106b820533716a05eb3e2d7 +size 1657904 diff --git a/benchmark/NYU_CTF_Bench/test/2020/CSAW-Quals/pwn/pwnvoltex/pwnvoltex/flagsong/jacket.png b/benchmark/NYU_CTF_Bench/test/2020/CSAW-Quals/pwn/pwnvoltex/pwnvoltex/flagsong/jacket.png new file mode 100644 index 0000000000000000000000000000000000000000..925727a16a8ad77f57c485227c98ac29a0615098 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2020/CSAW-Quals/pwn/pwnvoltex/pwnvoltex/flagsong/jacket.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4dcc0bb0213d3bf0596f840ef3944668241ab73c41e7177d40b94f0b9bf2e93e +size 47526 diff --git a/benchmark/NYU_CTF_Bench/test/2020/CSAW-Quals/pwn/pwnvoltex/pwnvoltex/flagsong/song.ogg b/benchmark/NYU_CTF_Bench/test/2020/CSAW-Quals/pwn/pwnvoltex/pwnvoltex/flagsong/song.ogg new file mode 100644 index 0000000000000000000000000000000000000000..8684634444f87d1fc7602467819011bb3bdd1dd9 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2020/CSAW-Quals/pwn/pwnvoltex/pwnvoltex/flagsong/song.ogg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8fb69764c1886db739b44f356c79ed51498da238a3f1db3bd40c3c1bda9adeea +size 1622708 diff --git a/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Extras/Prefabs/TreeSprite.prefab b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Extras/Prefabs/TreeSprite.prefab new file mode 100644 index 0000000000000000000000000000000000000000..36115922f8d03fe4fa46347e7de6bb30099a3465 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Extras/Prefabs/TreeSprite.prefab @@ -0,0 +1,88 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 0} + m_RootGameObject: {fileID: 1791732276458280} + m_IsPrefabAsset: 1 +--- !u!1 &1791732276458280 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 6 + m_Component: + - component: {fileID: 4637762761665278} + - component: {fileID: 212745031360384622} + m_Layer: 0 + m_Name: TreeSprite + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4637762761665278 +Transform: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1791732276458280} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &212745031360384622 +SpriteRenderer: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1791732276458280} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 4294967295 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 029f005d8b06f834fa06df50fc4e7dba, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1.06, y: 2.41} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 diff --git a/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Extras/Prefabs/TreeSprite.prefab.meta b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Extras/Prefabs/TreeSprite.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..222aa188056b35d3f693a09b9509f6bed38603ec --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Extras/Prefabs/TreeSprite.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 91b2663493e1ab642b1b60fc7955f947 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 100100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Extras/Scenes/Colliders.unity b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Extras/Scenes/Colliders.unity new file mode 100644 index 0000000000000000000000000000000000000000..8e2a9e2c8ad2f8a72f9cfd36653f8b4f084ea793 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Extras/Scenes/Colliders.unity @@ -0,0 +1,15048 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 0 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ShowResolutionOverlay: 1 + m_ExportTrainingData: 0 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 1 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &53245460 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 53245465} + - component: {fileID: 53245464} + - component: {fileID: 53245463} + - component: {fileID: 53245461} + - component: {fileID: 53245462} + m_Layer: 0 + m_Name: Tree01Bush + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!60 &53245461 +PolygonCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 53245460} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 1 + m_Offset: {x: 0, y: 0} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0, y: 0} + oldSize: {x: 0, y: 0} + newSize: {x: 0, y: 0} + adaptiveTilingThreshold: 0 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + m_Points: + m_Paths: + - - {x: 4.5960927, y: -4.450508} + - {x: 4.401864, y: -4.3257003} + - {x: 4.5212154, y: -4.1881166} + - {x: 4.6753187, y: -3.9678326} + - {x: 4.405222, y: -3.7872267} + - {x: 4.370056, y: -3.51654} + - {x: 4.2460327, y: -3.3955297} + - {x: 4.173502, y: -3.3677387} + - {x: 4.1554112, y: -3.5410821} + - {x: 4.0753603, y: -3.8192444} + - {x: 3.8946753, y: -3.8394208} + - {x: 3.718846, y: -3.8145308} + - {x: 3.575674, y: -4.0162377} + - {x: 3.3099508, y: -4.16985} + - {x: 3.412251, y: -3.8473315} + - {x: 3.4121673, y: -3.6313195} + - {x: 3.180334, y: -3.5487986} + - {x: 3.0803742, y: -3.4257636} + - {x: 2.9238234, y: -3.3508363} + - {x: 2.6059914, y: -3.4799633} + - {x: 2.6296916, y: -3.2146962} + - {x: 2.704814, y: -2.920652} + - {x: 2.4267352, y: -3.0078354} + - {x: 2.008948, y: -2.8439493} + - {x: 1.8137305, y: -3.0454688} + - {x: 1.6166661, y: -2.6917048} + - {x: 1.3459278, y: -2.7196493} + - {x: 1.1200774, y: -2.8577302} + - {x: 0.9129431, y: -3.2032948} + - {x: 0.5602953, y: -2.892481} + - {x: 0.17219684, y: -2.969111} + - {x: -0.2539997, y: -3.135602} + - {x: -0.63553107, y: -3.061071} + - {x: -1.0127571, y: -2.957893} + - {x: -1.3104165, y: -3.277318} + - {x: -1.8549925, y: -2.9304664} + - {x: -2.3564415, y: -2.985093} + - {x: -2.8319044, y: -3.1292267} + - {x: -3.0021071, y: -3.2489247} + - {x: -3.0839791, y: -3.4849136} + - {x: -3.278289, y: -3.8055553} + - {x: -3.5601258, y: -3.4910324} + - {x: -3.7767522, y: -3.7047393} + - {x: -3.9952595, y: -4.0934596} + - {x: -4.2371435, y: -4.1748447} + - {x: -4.4384665, y: -4.1984577} + - {x: -4.4443274, y: -4.769828} + - {x: -4.86179, y: -4.935101} + - {x: -4.935527, y: -5.0813513} + - {x: -5.024274, y: -5.4570923} + - {x: -5.240713, y: -4.8939514} + - {x: -5.115657, y: -4.4137115} + - {x: -4.8562536, y: -3.8500762} + - {x: -4.9672227, y: -3.6712248} + - {x: -5.140299, y: -3.5294347} + - {x: -5.533455, y: -3.7817793} + - {x: -5.6599064, y: -3.4260674} + - {x: -5.793478, y: -3.4478827} + - {x: -6.103485, y: -3.9516172} + - {x: -6.2236557, y: -3.2902782} + - {x: -5.798864, y: -2.8099592} + - {x: -5.3386383, y: -2.498311} + - {x: -5.4109097, y: -2.4714992} + - {x: -5.6221333, y: -2.5100808} + - {x: -5.910779, y: -2.4954557} + - {x: -5.979108, y: -2.288491} + - {x: -6.054783, y: -2.1229374} + - {x: -6.409728, y: -2.5751123} + - {x: -6.6695256, y: -2.011589} + - {x: -6.4066586, y: -1.4256444} + - {x: -5.7559204, y: -1.1190958} + - {x: -5.659766, y: -0.9032006} + - {x: -5.685962, y: -0.67662984} + - {x: -6.1818695, y: -0.73166656} + - {x: -6.2700677, y: -0.78987265} + - {x: -6.445245, y: -1.043403} + - {x: -6.712138, y: -1.4716253} + - {x: -6.7327995, y: -1.1105715} + - {x: -6.600764, y: -0.47903705} + - {x: -6.411022, y: 0.07046509} + - {x: -5.8852887, y: 0.21442722} + - {x: -5.5698695, y: 0.19412428} + - {x: -5.464736, y: 0.1550293} + - {x: -5.3192067, y: 0.28337485} + - {x: -5.205149, y: 0.5243256} + - {x: -5.6063585, y: 0.6617527} + - {x: -5.5068817, y: 0.9752526} + - {x: -5.4115167, y: 1.3153566} + - {x: -5.8227644, y: 1.361414} + - {x: -5.4171495, y: 1.7782604} + - {x: -4.8657217, y: 1.8313699} + - {x: -4.588561, y: 1.7893763} + - {x: -4.5522523, y: 1.8536273} + - {x: -4.5334206, y: 2.017733} + - {x: -4.667205, y: 2.2387218} + - {x: -4.502221, y: 2.460394} + - {x: -4.292954, y: 2.6855984} + - {x: -4.580907, y: 2.8373194} + - {x: -4.0656614, y: 3.0545754} + - {x: -3.6416664, y: 2.9989085} + - {x: -3.4655323, y: 2.9239826} + - {x: -3.359173, y: 2.9503338} + - {x: -3.3353915, y: 3.1130767} + - {x: -3.837128, y: 3.5377407} + - {x: -3.196869, y: 3.7146618} + - {x: -2.604802, y: 3.566195} + - {x: -2.3444424, y: 3.4395485} + - {x: -2.1640463, y: 3.5340664} + - {x: -1.9549431, y: 3.8693755} + - {x: -2.2152555, y: 4.5231056} + - {x: -1.5487685, y: 4.413057} + - {x: -0.944021, y: 3.8185174} + - {x: -0.68036103, y: 3.4601822} + - {x: -0.35997054, y: 3.7712705} + - {x: 0.33567452, y: 4.335599} + - {x: 1.0082848, y: 4.59976} + - {x: 0.52776575, y: 3.8100228} + - {x: 0.67292666, y: 3.4952803} + - {x: 0.85266876, y: 3.4385777} + - {x: 1.014653, y: 3.6554363} + - {x: 1.4272296, y: 4.039967} + - {x: 1.9803336, y: 4.193098} + - {x: 1.82889, y: 3.6472077} + - {x: 2.2490773, y: 3.3730989} + - {x: 2.5440044, y: 3.2979183} + - {x: 2.7591581, y: 3.4821477} + - {x: 3.2207956, y: 3.8227782} + - {x: 3.6531794, y: 4.0017204} + - {x: 3.4617286, y: 3.5193548} + - {x: 3.625062, y: 3.226173} + - {x: 3.7744694, y: 3.112564} + - {x: 4.058009, y: 3.2391448} + - {x: 4.413997, y: 3.372613} + - {x: 4.842697, y: 3.0536528} + - {x: 4.2251015, y: 2.7467482} + - {x: 4.1100607, y: 2.380889} + - {x: 4.149143, y: 2.2038698} + - {x: 4.4805503, y: 2.3922255} + - {x: 5.1676493, y: 2.574047} + - {x: 5.749752, y: 2.1744652} + - {x: 5.3047147, y: 1.9243331} + - {x: 5.2083073, y: 1.8412068} + - {x: 5.2604628, y: 1.6912718} + - {x: 5.687503, y: 1.4038008} + - {x: 5.4901295, y: 0.91677374} + - {x: 5.2868843, y: 0.65911484} + - {x: 5.4379525, y: 0.7013824} + - {x: 5.774804, y: 0.7452766} + - {x: 6.122902, y: 0.66643333} + - {x: 5.765494, y: 0.43928215} + - {x: 5.7727356, y: 0.33861372} + - {x: 5.842326, y: 0.31585217} + - {x: 6.041519, y: 0.40740094} + - {x: 6.4236236, y: 0.4707878} + - {x: 6.6654167, y: 0.18912315} + - {x: 6.3777547, y: 0.20343184} + - {x: 6.332817, y: 0.07887161} + - {x: 6.368513, y: -0.011343002} + - {x: 6.536011, y: -0.1888309} + - {x: 6.635894, y: -0.45077685} + - {x: 6.561116, y: -0.73729897} + - {x: 6.385946, y: -0.419961} + - {x: 6.243207, y: -0.47127402} + - {x: 6.184222, y: -0.5616255} + - {x: 6.0935683, y: -0.52504975} + - {x: 5.9017916, y: -0.51159674} + - {x: 5.729164, y: -0.6656771} + - {x: 6.0993743, y: -0.70022976} + - {x: 6.2731905, y: -0.74067247} + - {x: 6.2144938, y: -0.859148} + - {x: 5.8843923, y: -1.0789753} + - {x: 6.1457024, y: -1.1232643} + - {x: 6.3980665, y: -1.3870852} + - {x: 6.68213, y: -1.5131938} + - {x: 6.714102, y: -1.7794142} + - {x: 6.461239, y: -1.7009978} + - {x: 6.5459642, y: -1.9168932} + - {x: 6.600374, y: -2.1254349} + - {x: 6.478366, y: -2.0964909} + - {x: 6.3189616, y: -2.018591} + - {x: 6.181938, y: -2.2180634} + - {x: 6.0361004, y: -1.719028} + - {x: 5.8189154, y: -1.6906357} + - {x: 5.8098855, y: -1.7443272} + - {x: 5.9714613, y: -2.0932398} + - {x: 5.896029, y: -2.0307717} + - {x: 5.7841053, y: -1.9828804} + - {x: 5.8072453, y: -2.1588326} + - {x: 6.30387, y: -2.495202} + - {x: 6.37483, y: -2.927081} + - {x: 6.17338, y: -3.2872} + - {x: 6.1027503, y: -2.899042} + - {x: 5.9765625, y: -2.9460025} + - {x: 5.8428383, y: -3.3735342} + - {x: 5.5035925, y: -3.032574} + - {x: 5.3193245, y: -3.1490579} + - {x: 5.2637434, y: -3.2851763} + - {x: 5.358925, y: -3.3118024} + - {x: 5.565504, y: -3.411436} + - {x: 5.765026, y: -3.6137066} + - {x: 5.833143, y: -3.8416224} + - {x: 5.7956867, y: -3.988884} + - {x: 5.759465, y: -4.0411563} + - {x: 5.676749, y: -3.9614615} + - {x: 5.4864044, y: -3.8565104} + - {x: 5.2751274, y: -3.9274988} + - {x: 5.4698186, y: -4.1579704} + - {x: 5.4815645, y: -4.2211666} + - {x: 5.303442, y: -4.3886023} + - {x: 4.957515, y: -4.596761} +--- !u!114 &53245462 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 53245460} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e0ecd6fe4dd55d640bd7ef3235e0e425, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UpdateCollider: 0 +--- !u!1971053207 &53245463 +SpriteShapeRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 53245460} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 4294967295 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: -46 + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_MaskInteraction: 0 + m_ShapeTexture: {fileID: 2800000, guid: a94adaf94669646788de8f639270804a, type: 3} + m_Sprites: [] + m_LocalAABB: + m_Center: {x: -0.009348869, y: -0.4286661, z: 0} + m_Extent: {x: 6.7234507, y: 5.028426, z: 0} +--- !u!114 &53245464 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 53245460} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 90539df1cd5704abcb25fec9f3f5f84b, type: 3} + m_Name: + m_EditorClassIdentifier: + m_LegacyGenerator: 0 + m_Spline: + m_IsOpenEnded: 0 + m_ControlPoints: + - position: {x: 4.842697, y: 3.0536528, z: 0} + leftTangent: {x: -0.46514416, y: 0.6982794, z: 0} + rightTangent: {x: -0.98501754, y: -0.19482803, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 4.149143, y: 2.2038698, z: 0} + leftTangent: {x: -0.25518036, y: 0.18873692, z: 0} + rightTangent: {x: 0.34710693, y: -0.25672722, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.749752, y: 2.1744652, z: 0} + leftTangent: {x: -0.37604332, y: 0.8819065, z: 0} + rightTangent: {x: -0.6860409, y: -0.41157246, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.2604628, y: 1.6912718, z: 0} + leftTangent: {x: -0.059747696, y: 0.2612772, z: 0} + rightTangent: {x: 0.94542885, y: -0.04471779, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.2868843, y: 0.65911484, z: 0} + leftTangent: {x: -0.08357048, y: 0.233428, z: 0} + rightTangent: {x: 0.1258831, y: -0.35161018, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 6.122902, y: 0.66643333, z: 0} + leftTangent: {x: -0.29554272, y: 0.18166637, z: 0} + rightTangent: {x: -0.6404972, y: -0.30658436, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.842326, y: 0.31585217, z: 0} + leftTangent: {x: -0.05978012, y: 0.15721035, z: 0} + rightTangent: {x: 0.04073143, y: -0.107115746, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 6.6654167, y: 0.18912315, z: 0} + leftTangent: {x: -0.06389809, y: 0.5598202, z: 0} + rightTangent: {x: -0.46305275, y: 0.1414814, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 6.368513, y: -0.011343002, z: 0} + leftTangent: {x: -0.021983147, y: 0.015303612, z: 0} + rightTangent: {x: 0.16562653, y: -0.11529827, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 6.561116, y: -0.73729897, z: 0} + leftTangent: {x: 0.19778919, y: 0.2788496, z: 0} + rightTangent: {x: -0.1742773, y: 0.6115341, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 6.184222, y: -0.5616255, z: 0} + leftTangent: {x: 0.68896294, y: 0.8554535, z: 0} + rightTangent: {x: -0.43468094, y: 0.39962196, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.729164, y: -0.6656771, z: 0} + leftTangent: {x: 0.122961044, y: 0.28598404, z: 0} + rightTangent: {x: 0.45636845, y: -0.05565548, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 6.2144938, y: -0.859148, z: 0} + leftTangent: {x: 0.1869936, y: 0.18153954, z: 0} + rightTangent: {x: -0.1869936, y: -0.18153954, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 6.1457024, y: -1.1232643, z: 0} + leftTangent: {x: -0.5345783, y: 0.036352158, z: 0} + rightTangent: {x: 0.14191914, y: -0.42528534, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 6.714102, y: -1.7794142, z: 0} + leftTangent: {x: 0.1886692, y: 0.4288845, z: 0} + rightTangent: {x: -0.54428864, y: 0.32612705, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 6.600374, y: -2.1254349, z: 0} + leftTangent: {x: 0.08338165, y: 0.104310036, z: -0} + rightTangent: {x: -0.08338165, y: -0.104310036, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 6.181938, y: -2.2180634, z: 0} + leftTangent: {x: 0.10590649, y: 0.4469347, z: 0} + rightTangent: {x: -0.10590458, y: 0.15244389, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.8189154, y: -1.6906357, z: 0} + leftTangent: {x: 0.32985497, y: 0.16756153, z: 0} + rightTangent: {x: -0.10930061, y: 0.1140461, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.9714613, y: -2.0932398, z: 0} + leftTangent: {x: -0.08672142, y: 0.48350525, z: 0} + rightTangent: {x: 0.06339455, y: -0.353446, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.8072453, y: -2.1588326, z: 0} + leftTangent: {x: -0.14785767, y: 0.35762978, z: 0} + rightTangent: {x: 0.7605448, y: -0.23285866, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 6.17338, y: -3.2872, z: 0} + leftTangent: {x: 0.28656864, y: 0.2684822, z: 0} + rightTangent: {x: -0.026841164, y: 0.62389946, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.8428383, y: -3.3735342, z: 0} + leftTangent: {x: 0.12148476, y: 0.5996351, z: 0} + rightTangent: {x: -0.4254961, y: 0.7156172, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.2637434, y: -3.2851763, z: 0} + leftTangent: {x: 0.13748741, y: 0.28014755, z: 0} + rightTangent: {x: -0.26539803, y: -0.5407772, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.765026, y: -3.6137066, z: 0} + leftTangent: {x: -0.1565094, y: 0.26346588, z: 0} + rightTangent: {x: 0.1565094, y: -0.26346588, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.759465, y: -4.0411563, z: 0} + leftTangent: {x: 0.01789093, y: 0.06118679, z: 0} + rightTangent: {x: -0.042197227, y: -0.1443119, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.2751274, y: -3.9274988, z: 0} + leftTangent: {x: 0.19284344, y: 0.22602367, z: 0} + rightTangent: {x: 0.13536263, y: -0.14547539, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.4815645, y: -4.2211666, z: 0} + leftTangent: {x: 0.026311874, y: 0.04362297, z: 0} + rightTangent: {x: -0.09507955, y: -0.15763362, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 4.957515, y: -4.596761, z: 0} + leftTangent: {x: 0.44955254, y: 0.17905235, z: 0} + rightTangent: {x: -0.7130451, y: -0.45710754, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 4.401864, y: -4.3257003, z: 0} + leftTangent: {x: 0.1128853, y: -0.12269877, z: -0} + rightTangent: {x: -0.05100727, y: 0.05544138, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 4.405222, y: -3.7872267, z: 0} + leftTangent: {x: 0.6351795, y: -0.11997414, z: 0} + rightTangent: {x: 0.05604744, y: 0.3643427, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 4.173502, y: -3.3677387, z: 0} + leftTangent: {x: 0.334507, y: -0.24208546, z: 0} + rightTangent: {x: -0.4423027, y: 0.32009602, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 3.8946753, y: -3.8394208, z: 0} + leftTangent: {x: 0.24389267, y: -0.22975159, z: 0} + rightTangent: {x: -0.24389267, y: 0.22975111, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 3.3099508, y: -4.16985, z: 0} + leftTangent: {x: 0.3787346, y: 0.038001537, z: 0} + rightTangent: {x: 0.110370636, y: 0.36677504, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 3.180334, y: -3.5487986, z: 0} + leftTangent: {x: 0.39083004, y: -0.0067796707, z: 0} + rightTangent: {x: -0.10656071, y: 0.095106125, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 2.6059914, y: -3.4799633, z: 0} + leftTangent: {x: 0.43336868, y: 0.28313637, z: 0} + rightTangent: {x: -0.13688469, y: 0.114209175, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 2.4267352, y: -3.0078354, z: 0} + leftTangent: {x: 0.58955383, y: 0.4144659, z: 0} + rightTangent: {x: -0.6038761, y: 0.65348434, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.6166661, y: -2.6917048, z: 0} + leftTangent: {x: 0.27279282, y: -0.93830156, z: 0} + rightTangent: {x: -0.30190563, y: -0.005326271, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.9129431, y: -3.2032948, z: 0} + leftTangent: {x: 0.20650005, y: 0.4817562, z: 0} + rightTangent: {x: -0.33580494, y: 0.6037283, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.2539997, y: -3.135602, z: 0} + leftTangent: {x: 0.44612813, y: 0.11222839, z: 0} + rightTangent: {x: -0.35859704, y: -0.09020901, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.3104165, y: -3.277318, z: 0} + leftTangent: {x: 0.23278904, y: 0.6811428, z: 0} + rightTangent: {x: -0.5718541, y: 0.6515808, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -2.8319044, y: -3.1292267, z: 0} + leftTangent: {x: 0.46818423, y: 0.08489704, z: 0} + rightTangent: {x: -0.2812922, y: -0.05100727, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -3.278289, y: -3.8055553, z: 0} + leftTangent: {x: 0.31745243, y: 0.3524227, z: 0} + rightTangent: {x: -0.33680677, y: 0.6963768, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -3.9952595, y: -4.0934596, z: 0} + leftTangent: {x: 0.24181223, y: 0.35848808, z: 0} + rightTangent: {x: -0.21053219, y: -0.31211567, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -4.4443274, y: -4.769828, z: 0} + leftTangent: {x: -0.14350319, y: 1.0470924, z: 0} + rightTangent: {x: -0.7089062, y: -0.25762463, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -5.024274, y: -5.4570923, z: 0} + leftTangent: {x: 0.21583176, y: 0.5733261, z: 0} + rightTangent: {x: -0.45623875, y: 0.6600208, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -4.8562536, y: -3.8500762, z: 0} + leftTangent: {x: -0.25752544, y: -0.66076374, z: 0} + rightTangent: {x: -0.13257408, y: 0.07835674, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -5.533455, y: -3.7817793, z: 0} + leftTangent: {x: 0.55585384, y: 0.5684366, z: 0} + rightTangent: {x: -0.17933083, y: 0.509676, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -6.103485, y: -3.9516172, z: 0} + leftTangent: {x: 0.45466328, y: 0.77949333, z: 0} + rightTangent: {x: -0.5624981, y: 0.7559643, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -5.3386383, y: -2.498311, z: 0} + leftTangent: {x: -0.3080988, y: -0.2314291, z: 0} + rightTangent: {x: 0.0177145, y: 0.09904194, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -5.910779, y: -2.4954557, z: 0} + leftTangent: {x: 0.30684566, y: -0.08076191, z: 0} + rightTangent: {x: -0.15530014, y: 0.035564423, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -6.409728, y: -2.5751123, z: 0} + leftTangent: {x: 0.5852232, y: 0.953145, z: 0} + rightTangent: {x: -0.5660629, y: 0.45170593, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -5.7559204, y: -1.1190958, z: 0} + leftTangent: {x: -0.79974174, y: -0.066244125, z: 0} + rightTangent: {x: 0.041540146, y: 0.113129616, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -6.1818695, y: -0.73166656, z: 0} + leftTangent: {x: 0.84655, y: 0.2932682, z: 0} + rightTangent: {x: -0.04629135, y: 0.046333313, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -6.712138, y: -1.4716253, z: 0} + leftTangent: {x: 0.314332, y: 0.50869083, z: 0} + rightTangent: {x: -0.12867546, y: 0.10830879, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -6.411022, y: 0.07046509, z: 0} + leftTangent: {x: -0.18693066, y: -0.39098167, z: 0} + rightTangent: {x: 0.6308994, y: 0.27458572, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -5.464736, y: 0.1550293, z: 0} + leftTangent: {x: -0.08733368, y: -0.40212727, z: 0} + rightTangent: {x: 0.08283138, y: 0.38139915, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -5.6063585, y: 0.6617527, z: 0} + leftTangent: {x: 0.8201084, y: -0.013622284, z: 0} + rightTangent: {x: -0.06596756, y: 0.19331455, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -5.8227644, y: 1.361414, z: 0} + leftTangent: {x: 0.83205414, y: 0.2078495, z: 0} + rightTangent: {x: 0.19268036, y: 0.6882601, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -4.588561, y: 1.7893763, z: 0} + leftTangent: {x: -0.186059, y: -0.20398903, z: 0} + rightTangent: {x: 0.20092964, y: 0.22029305, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -4.667205, y: 2.2387218, z: 0} + leftTangent: {x: 0.2551403, y: -0.23510647, z: 0} + rightTangent: {x: -0.0376606, y: 0.19423485, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -4.580907, y: 2.8373194, z: 0} + leftTangent: {x: 0.7170656, y: -0.089307785, z: 0} + rightTangent: {x: 0.50866604, y: 0.43827343, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -3.4655323, y: 2.9239826, z: 0} + leftTangent: {x: -0.19108582, y: -0.12285614, z: 0} + rightTangent: {x: 0.19291592, y: 0.124032974, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -3.837128, y: 3.5377407, z: 0} + leftTangent: {x: 0.9121423, y: -0.5974684, z: 0} + rightTangent: {x: 0.56984806, y: 0.45535278, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -2.3444424, y: 3.4395485, z: 0} + leftTangent: {x: -0.28999424, y: -0.1061039, z: 0} + rightTangent: {x: 0.29269123, y: 0.1070919, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -2.2152555, y: 4.5231056, z: 0} + leftTangent: {x: 0.66106176, y: -0.8388176, z: 0} + rightTangent: {x: 0.6042404, y: 0.3724308, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.68036103, y: 3.4601822, z: 0} + leftTangent: {x: -0.21909523, y: 0.00019645691, z: 0} + rightTangent: {x: 0.49437714, y: -0.00044631958, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.0082848, y: 4.59976, z: 0} + leftTangent: {x: -0.52832985, y: 0.0703907, z: 0} + rightTangent: {x: -0.99039173, y: -1.0995512, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.85266876, y: 3.4385777, z: 0} + leftTangent: {x: -0.56994057, y: 0.139328, z: 0} + rightTangent: {x: 0.9365616, y: -0.22895241, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.9803336, y: 4.193098, z: 0} + leftTangent: {x: -0.58667946, y: 0.0955925, z: 0} + rightTangent: {x: -0.66955566, y: -0.7060642, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 2.5440044, y: 3.2979183, z: 0} + leftTangent: {x: -0.36831474, y: 0.16205788, z: 0} + rightTangent: {x: 0.43422318, y: -0.1910572, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 3.6531794, y: 4.0017204, z: 0} + leftTangent: {x: -0.32584476, y: 0.007930756, z: 0} + rightTangent: {x: -0.49174595, y: -0.58016014, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 3.7744694, y: 3.112564, z: 0} + leftTangent: {x: -0.019541502, y: 0.027026176, z: 0} + rightTangent: {x: 0.2474041, y: -0.029967308, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + m_SpriteShape: {fileID: 11400000, guid: 8e3fa9c7ff3ad4112a30689e933384ed, type: 2} + m_FillPixelPerUnit: 100 + m_StretchTiling: 1 + m_SplineDetail: 4 + m_AdaptiveUV: 1 + m_StretchUV: 0 + m_WorldSpaceUV: 0 + m_ColliderDetail: 4 + m_ColliderOffset: 0 + m_UpdateCollider: 0 + m_OptimizeCollider: 1 +--- !u!4 &53245465 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 53245460} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0.51, y: 7.41, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1198078835} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &86098844 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 86098848} + - component: {fileID: 86098847} + - component: {fileID: 86098846} + - component: {fileID: 86098845} + - component: {fileID: 86098850} + - component: {fileID: 86098849} + m_Layer: 0 + m_Name: Branch (Package) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!68 &86098845 +EdgeCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 86098844} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: 0} + m_EdgeRadius: 0 + m_Points: + - {x: -16.950869, y: -13.863884} + - {x: -16.950869, y: -13.863884} + - {x: -13.860442, y: -17.198812} + - {x: -10.920086, y: -19.720581} + - {x: -8.828604, y: -21.12007} + - {x: -6.4465895, y: -22.315441} + - {x: -5.1754174, y: -22.766796} + - {x: -3.8661559, y: -23.083132} + - {x: -2.5304852, y: -23.236137} + - {x: -1.1816092, y: -23.197496} + - {x: 1.0313295, y: -22.706749} + - {x: 2.8582423, y: -21.795244} + - {x: 4.3354144, y: -20.540682} + - {x: 5.5002785, y: -19.02198} + - {x: 6.3985643, y: -17.30119} + - {x: 7.0510254, y: -15.5027895} + - {x: 7.6874423, y: -12.74806} + - {x: 7.966475, y: -11.818205} + - {x: 8.437967, y: -11.0326805} + - {x: 9.073447, y: -10.372249} + - {x: 10.715577, y: -9.383379} + - {x: 12.640903, y: -8.769826} + - {x: 15.49134, y: -8.367494} + - {x: 17.978632, y: -8.339273} + - {x: 20.585047, y: -8.476068} +--- !u!1971053207 &86098846 +SpriteShapeRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 86098844} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 4294967295 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: -11 + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_MaskInteraction: 0 + m_ShapeTexture: {fileID: 0} + m_Sprites: + - {fileID: 21300000, guid: e205c552afc6743cb9c52e5ff6504efc, type: 3} + m_LocalAABB: + m_Center: {x: 1.3386917, y: -12.22172, z: -0.005} + m_Extent: {x: 19.318111, y: 12.22172, z: 0.005} +--- !u!114 &86098847 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 86098844} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 90539df1cd5704abcb25fec9f3f5f84b, type: 3} + m_Name: + m_EditorClassIdentifier: + m_LegacyGenerator: 0 + m_Spline: + m_IsOpenEnded: 1 + m_ControlPoints: + - position: {x: -14.53302, y: -16.355022, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1.17 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.1900063, y: -23.108816, z: 0} + leftTangent: {x: -6.6956515, y: -0.7063942, z: 0} + rightTangent: {x: 5.99125, y: 0.6320801, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 1 + - position: {x: 7.6009054, y: -12.726942, z: 0} + leftTangent: {x: -0.7709484, y: -4.507843, z: 0} + rightTangent: {x: 0.8714237, y: 5.095332, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 1 + - position: {x: 17.983303, y: -8.250319, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + m_SpriteShape: {fileID: 11400000, guid: 67e0d7ab8806749199e5b764729aa46a, type: 2} + m_FillPixelPerUnit: 100 + m_StretchTiling: 1 + m_SplineDetail: 16 + m_AdaptiveUV: 1 + m_StretchUV: 0 + m_WorldSpaceUV: 0 + m_ColliderDetail: 4 + m_ColliderOffset: 0 + m_UpdateCollider: 0 + m_OptimizeCollider: 1 +--- !u!4 &86098848 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 86098844} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -36.6, y: 24.22, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!66 &86098849 +CompositeCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 86098844} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: 0} + m_GeometryType: 0 + m_GenerationType: 0 + m_EdgeRadius: 0 + m_ColliderPaths: [] + m_CompositePaths: + m_Paths: [] + m_VertexDistance: 0.0005 +--- !u!50 &86098850 +Rigidbody2D: + serializedVersion: 4 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 86098844} + m_BodyType: 0 + m_Simulated: 1 + m_UseFullKinematicContacts: 0 + m_UseAutoMass: 0 + m_Mass: 1 + m_LinearDrag: 0 + m_AngularDrag: 0.05 + m_GravityScale: 1 + m_Material: {fileID: 0} + m_Interpolate: 0 + m_SleepingMode: 1 + m_CollisionDetection: 0 + m_Constraints: 0 +--- !u!1 &231626810 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 231626811} + - component: {fileID: 231626813} + - component: {fileID: 231626812} + m_Layer: 5 + m_Name: LegacyCollider + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &231626811 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 231626810} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1463708952} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 300, y: 240} + m_SizeDelta: {x: 240, y: 64} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &231626812 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 231626810} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.47419012, g: 0.7516846, b: 0.9056604, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Legacy Collider (Collider from version 1.*). Menu -> SpriteShape -> Generate + Legacy Collider +--- !u!222 &231626813 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 231626810} + m_CullTransparentMesh: 0 +--- !u!1 &245160124 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 245160130} + - component: {fileID: 245160129} + - component: {fileID: 245160128} + - component: {fileID: 245160127} + - component: {fileID: 245160126} + - component: {fileID: 245160125} + - component: {fileID: 245160131} + m_Layer: 0 + m_Name: Block (Legacy Collider) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!66 &245160125 +CompositeCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 245160124} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: 0} + m_GeometryType: 0 + m_GenerationType: 0 + m_EdgeRadius: 0 + m_ColliderPaths: + - m_Collider: {fileID: 245160127} + m_ColliderPaths: + - - X: -16359752 + Y: -79301392 + - X: -31725824 + Y: -78709656 + - X: -52884408 + Y: -72404584 + - X: -77168912 + Y: -62323156 + - X: -113620272 + Y: -44355860 + - X: -153593216 + Y: -22127492 + - X: -104571936 + Y: 93817784 + - X: -78601240 + Y: 159200928 + - X: -67227568 + Y: 179181488 + - X: -50174772 + Y: 197765136 + - X: -36303352 + Y: 208053744 + - X: -18054166 + Y: 216914800 + - X: 4767723 + Y: 222461808 + - X: 20765140 + Y: 223410448 + - X: 40034296 + Y: 221014448 + - X: 55234016 + Y: 215840512 + - X: 67891360 + Y: 208069584 + - X: 78240064 + Y: 198070560 + - X: 86514328 + Y: 186212352 + - X: 92948400 + Y: 172863712 + - X: 97776720 + Y: 158393568 + - X: 101233568 + Y: 143170448 + - X: 103553304 + Y: 127563056 + - X: 105718472 + Y: 96670072 + - X: 106710808 + Y: 46494228 + - X: 108076976 + Y: 32401600 + - X: 105205320 + Y: 21193138 + - X: 94193056 + Y: 6554777 + - X: 65909032 + Y: -17531154 + - X: 58385812 + Y: -28413314 + - X: 50252040 + Y: -46287488 + - X: 39584240 + Y: -56677504 + - X: 21903510 + Y: -66694780 + - X: -4977078 + Y: -76240992 + - X: -4977078 + Y: -76240992 + - X: -16359752 + Y: -79301392 + m_CompositePaths: + m_Paths: + - - {x: -0.4977078, y: -7.6240993} + - {x: 2.190351, y: -6.669478} + - {x: 3.958424, y: -5.6677504} + - {x: 5.025204, y: -4.628749} + - {x: 5.838581, y: -2.8413315} + - {x: 6.5909033, y: -1.7531154} + - {x: 9.419306, y: 0.6554777} + - {x: 10.520532, y: 2.1193137} + - {x: 10.807697, y: 3.24016} + - {x: 10.671081, y: 4.6494226} + - {x: 10.571847, y: 9.667007} + - {x: 10.35533, y: 12.756306} + - {x: 10.123357, y: 14.317045} + - {x: 9.777672, y: 15.839357} + - {x: 9.29484, y: 17.286371} + - {x: 8.651433, y: 18.621235} + - {x: 7.8240066, y: 19.807056} + - {x: 6.789136, y: 20.80696} + - {x: 5.5234017, y: 21.584051} + - {x: 4.0034294, y: 22.101444} + - {x: 2.076514, y: 22.341045} + - {x: 0.4767723, y: 22.246181} + - {x: -1.8054166, y: 21.69148} + - {x: -3.6303353, y: 20.805374} + - {x: -5.017477, y: 19.776514} + - {x: -6.722757, y: 17.91815} + - {x: -7.860124, y: 15.920093} + - {x: -10.457193, y: 9.381779} + - {x: -15.359322, y: -2.2127492} + - {x: -11.362027, y: -4.435586} + - {x: -7.7168913, y: -6.2323155} + - {x: -5.2884407, y: -7.2404585} + - {x: -3.1725824, y: -7.8709655} + - {x: -1.6359752, y: -7.930139} + m_VertexDistance: 0.0005 +--- !u!50 &245160126 +Rigidbody2D: + serializedVersion: 4 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 245160124} + m_BodyType: 0 + m_Simulated: 1 + m_UseFullKinematicContacts: 0 + m_UseAutoMass: 0 + m_Mass: 1 + m_LinearDrag: 0 + m_AngularDrag: 0.05 + m_GravityScale: 1 + m_Material: {fileID: 0} + m_Interpolate: 0 + m_SleepingMode: 1 + m_CollisionDetection: 0 + m_Constraints: 0 +--- !u!60 &245160127 +PolygonCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 245160124} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 1 + m_Offset: {x: 0, y: 0} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0, y: 0} + oldSize: {x: 0, y: 0} + newSize: {x: 0, y: 0} + adaptiveTilingThreshold: 0 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + m_Points: + m_Paths: + - - {x: -1.6359752, y: -7.9301395} + - {x: -3.1725824, y: -7.870966} + - {x: -5.2884407, y: -7.2404585} + - {x: -7.7168913, y: -6.2323155} + - {x: -11.362027, y: -4.435586} + - {x: -15.359322, y: -2.2127492} + - {x: -10.457193, y: 9.381779} + - {x: -7.8601236, y: 15.920093} + - {x: -6.722757, y: 17.918148} + - {x: -5.017477, y: 19.776514} + - {x: -3.630335, y: 20.805374} + - {x: -1.8054166, y: 21.69148} + - {x: 0.4767723, y: 22.246181} + - {x: 2.076514, y: 22.341045} + - {x: 4.0034294, y: 22.101444} + - {x: 5.5234017, y: 21.584051} + - {x: 6.789136, y: 20.80696} + - {x: 7.824006, y: 19.807056} + - {x: 8.651433, y: 18.621235} + - {x: 9.29484, y: 17.286371} + - {x: 9.777672, y: 15.839356} + - {x: 10.123357, y: 14.317044} + - {x: 10.35533, y: 12.756306} + - {x: 10.571847, y: 9.667007} + - {x: 10.671081, y: 4.6494226} + - {x: 10.807697, y: 3.24016} + - {x: 10.520532, y: 2.1193137} + - {x: 9.419306, y: 0.65547776} + - {x: 6.5909033, y: -1.7531154} + - {x: 5.838581, y: -2.8413315} + - {x: 5.025204, y: -4.628749} + - {x: 3.958424, y: -5.6677504} + - {x: 2.190351, y: -6.669478} + - {x: -0.49770787, y: -7.6240993} + - {x: -0.49770787, y: -7.6240993} + - {x: -1.6359752, y: -7.9301395} +--- !u!1971053207 &245160128 +SpriteShapeRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 245160124} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 4294967295 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 20 + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_MaskInteraction: 0 + m_ShapeTexture: {fileID: 2800000, guid: 7d8cda48c729c46329cd9d3c69a3a4e6, type: 3} + m_Sprites: + - {fileID: 21300006, guid: 3bc0f8978d0114d568eb440fca26e64b, type: 3} + - {fileID: 21300014, guid: 3bc0f8978d0114d568eb440fca26e64b, type: 3} + - {fileID: 21300002, guid: 3bc0f8978d0114d568eb440fca26e64b, type: 3} + - {fileID: 21300012, guid: a8321f6fae34f034787010a903e29648, type: 3} + - {fileID: 21300010, guid: 3bc0f8978d0114d568eb440fca26e64b, type: 3} + - {fileID: 21300000, guid: 3bc0f8978d0114d568eb440fca26e64b, type: 3} + - {fileID: 21300004, guid: 3bc0f8978d0114d568eb440fca26e64b, type: 3} + - {fileID: 21300012, guid: 3bc0f8978d0114d568eb440fca26e64b, type: 3} + - {fileID: 21300008, guid: 3bc0f8978d0114d568eb440fca26e64b, type: 3} + - {fileID: 0} + - {fileID: 0} + - {fileID: 21300012, guid: 3bc0f8978d0114d568eb440fca26e64b, type: 3} + - {fileID: 21300008, guid: 3bc0f8978d0114d568eb440fca26e64b, type: 3} + m_LocalAABB: + m_Center: {x: -2.2558622, y: 7.180541, z: -0.0050049997} + m_Extent: {x: 13.562195, y: 15.659332, z: 0.0050049997} +--- !u!114 &245160129 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 245160124} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 90539df1cd5704abcb25fec9f3f5f84b, type: 3} + m_Name: + m_EditorClassIdentifier: + m_LegacyGenerator: 0 + m_Spline: + m_IsOpenEnded: 0 + m_ControlPoints: + - position: {x: -1.636219, y: -7.9291697, z: 0} + leftTangent: {x: 6.020996, y: 1.5137386, z: 0} + rightTangent: {x: -2.8936367, y: -0.7274895, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -15.358402, y: -2.2131429, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -8.29718, y: 14.782811, z: 0} + leftTangent: {x: -0.73890686, y: -2.238881, z: 0} + rightTangent: {x: 1.9517517, y: 5.9137793, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 4.0031815, y: 22.100475, z: 0} + leftTangent: {x: -4.723675, y: 1.0711021, z: 0} + rightTangent: {x: 8.273635, y: -1.8760605, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 10.761995, y: 3.851832, z: 0} + leftTangent: {x: -0.6242571, y: 3.3770556, z: 0} + rightTangent: {x: 0.5823755, y: -3.1504874, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.837639, y: -2.8409967, z: 0} + leftTangent: {x: 0.4805252, y: 1.809861, z: -0} + rightTangent: {x: -0.4805252, y: -1.809861, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + m_SpriteShape: {fileID: 11400000, guid: a710fe91ca336478e999261a86254e9f, type: 2} + m_FillPixelPerUnit: 100 + m_StretchTiling: 1 + m_SplineDetail: 16 + m_AdaptiveUV: 1 + m_StretchUV: 0 + m_WorldSpaceUV: 0 + m_ColliderDetail: 4 + m_ColliderOffset: 0 + m_UpdateCollider: 0 + m_OptimizeCollider: 1 +--- !u!4 &245160130 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 245160124} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 37.300003, y: -26.28, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 8 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &245160131 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 245160124} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6a8e65bafadf93f41a17da25163f2f51, type: 3} + m_Name: + m_EditorClassIdentifier: + m_ColliderCornerType: 0 + m_ColliderOffset: 1 + m_UpdateCollider: 0 +--- !u!1 &436285776 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 436285782} + - component: {fileID: 436285781} + - component: {fileID: 436285780} + - component: {fileID: 436285777} + m_Layer: 0 + m_Name: Base + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!61 &436285777 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 436285776} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 36.316113, y: -26.14928} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0, y: 0} + oldSize: {x: 0, y: 0} + newSize: {x: 0, y: 0} + adaptiveTilingThreshold: 0 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + serializedVersion: 2 + m_Size: {x: 132.14908, y: 3.2228775} + m_EdgeRadius: 0 +--- !u!1971053207 &436285780 +SpriteShapeRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 436285776} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 4294967295 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: -11 + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_MaskInteraction: 0 + m_ShapeTexture: {fileID: 0} + m_Sprites: [] + m_LocalAABB: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} +--- !u!114 &436285781 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 436285776} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 90539df1cd5704abcb25fec9f3f5f84b, type: 3} + m_Name: + m_EditorClassIdentifier: + m_LegacyGenerator: 0 + m_Spline: + m_IsOpenEnded: 1 + m_ControlPoints: + - position: {x: -27.532185, y: -26.215977, z: 0} + leftTangent: {x: -6.6110344, y: 5.3857536, z: 0} + rightTangent: {x: 4.6707573, y: -3.8050842, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 1 + - position: {x: 101.01609, y: -26.410751, z: 0} + leftTangent: {x: -3.3493195, y: -3.1139984, z: 0} + rightTangent: {x: 6.1174393, y: 5.687624, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 1 + m_SpriteShape: {fileID: 0} + m_FillPixelPerUnit: 100 + m_StretchTiling: 1 + m_SplineDetail: 16 + m_AdaptiveUV: 1 + m_StretchUV: 0 + m_WorldSpaceUV: 0 + m_ColliderDetail: 4 + m_ColliderOffset: 0 + m_UpdateCollider: 1 + m_OptimizeCollider: 1 +--- !u!4 &436285782 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 436285776} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -35.949997, y: -9.58, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 11 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &778552133 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 778552137} + - component: {fileID: 778552136} + - component: {fileID: 778552135} + - component: {fileID: 778552134} + m_Layer: 0 + m_Name: Tree01Bush + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!60 &778552134 +PolygonCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 778552133} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 1 + m_Offset: {x: 0, y: 0} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0, y: 0} + oldSize: {x: 0, y: 0} + newSize: {x: 0, y: 0} + adaptiveTilingThreshold: 0 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + m_Points: + m_Paths: + - - {x: 4.842697, y: 3.0536528} + - {x: 4.2251015, y: 2.7467482} + - {x: 4.1100607, y: 2.380889} + - {x: 4.149143, y: 2.2038698} + - {x: 4.4805503, y: 2.3922255} + - {x: 5.1676493, y: 2.574047} + - {x: 5.749752, y: 2.1744652} + - {x: 5.2083073, y: 1.8412068} + - {x: 5.2604628, y: 1.6912718} + - {x: 5.687503, y: 1.4038008} + - {x: 5.4901295, y: 0.91677374} + - {x: 5.2868843, y: 0.65911484} + - {x: 5.774804, y: 0.7452766} + - {x: 6.122902, y: 0.66643333} + - {x: 5.765494, y: 0.43928215} + - {x: 5.842326, y: 0.31585217} + - {x: 6.041519, y: 0.40740094} + - {x: 6.4236236, y: 0.4707878} + - {x: 6.6654167, y: 0.18912315} + - {x: 6.3777547, y: 0.20343184} + - {x: 6.368513, y: -0.011343002} + - {x: 6.536011, y: -0.1888309} + - {x: 6.635894, y: -0.45077685} + - {x: 6.561116, y: -0.73729897} + - {x: 6.385946, y: -0.419961} + - {x: 6.184222, y: -0.5616255} + - {x: 5.9017916, y: -0.51159674} + - {x: 5.729164, y: -0.6656771} + - {x: 6.2731905, y: -0.74067247} + - {x: 5.8843923, y: -1.0789753} + - {x: 6.1457024, y: -1.1232643} + - {x: 6.3980665, y: -1.3870852} + - {x: 6.68213, y: -1.5131938} + - {x: 6.714102, y: -1.7794142} + - {x: 6.461239, y: -1.7009978} + - {x: 6.600374, y: -2.1254349} + - {x: 6.3189616, y: -2.018591} + - {x: 6.181938, y: -2.2180634} + - {x: 6.0361004, y: -1.719028} + - {x: 5.8098855, y: -1.7443272} + - {x: 5.896029, y: -2.0307717} + - {x: 5.8072453, y: -2.1588326} + - {x: 6.30387, y: -2.495202} + - {x: 6.37483, y: -2.927081} + - {x: 6.17338, y: -3.2872} + - {x: 6.1027503, y: -2.899042} + - {x: 5.9765625, y: -2.9460025} + - {x: 5.8428383, y: -3.3735342} + - {x: 5.5035925, y: -3.032574} + - {x: 5.2637434, y: -3.2851763} + - {x: 5.565504, y: -3.411436} + - {x: 5.765026, y: -3.6137066} + - {x: 5.759465, y: -4.0411563} + - {x: 5.4864044, y: -3.8565104} + - {x: 5.2751274, y: -3.9274988} + - {x: 5.4815645, y: -4.2211666} + - {x: 4.957515, y: -4.596761} + - {x: 4.401864, y: -4.3257003} + - {x: 4.6753187, y: -3.9678326} + - {x: 4.405222, y: -3.7872267} + - {x: 4.370056, y: -3.51654} + - {x: 4.173502, y: -3.3677387} + - {x: 4.0753603, y: -3.8192444} + - {x: 3.718846, y: -3.8145308} + - {x: 3.575674, y: -4.0162377} + - {x: 3.3099508, y: -4.16985} + - {x: 3.412251, y: -3.8473315} + - {x: 3.4121673, y: -3.6313195} + - {x: 3.180334, y: -3.5487986} + - {x: 2.9238234, y: -3.3508363} + - {x: 2.6059914, y: -3.4799633} + - {x: 2.704814, y: -2.920652} + - {x: 2.4267352, y: -3.0078354} + - {x: 2.008948, y: -2.8439493} + - {x: 1.8137305, y: -3.0454688} + - {x: 1.6166661, y: -2.6917048} + - {x: 1.3459278, y: -2.7196493} + - {x: 1.1200774, y: -2.8577302} + - {x: 0.9129431, y: -3.2032948} + - {x: 0.5602953, y: -2.892481} + - {x: 0.17219684, y: -2.969111} + - {x: -0.2539997, y: -3.135602} + - {x: -1.0127571, y: -2.957893} + - {x: -1.3104165, y: -3.277318} + - {x: -1.8549925, y: -2.9304664} + - {x: -2.3564415, y: -2.985093} + - {x: -2.8319044, y: -3.1292267} + - {x: -3.0021071, y: -3.2489247} + - {x: -3.278289, y: -3.8055553} + - {x: -3.5601258, y: -3.4910324} + - {x: -3.7767522, y: -3.7047393} + - {x: -3.9952595, y: -4.0934596} + - {x: -4.4384665, y: -4.1984577} + - {x: -4.4443274, y: -4.769828} + - {x: -4.86179, y: -4.935101} + - {x: -5.024274, y: -5.4570923} + - {x: -5.240713, y: -4.8939514} + - {x: -5.115657, y: -4.4137115} + - {x: -4.8562536, y: -3.8500762} + - {x: -5.140299, y: -3.5294347} + - {x: -5.533455, y: -3.7817793} + - {x: -5.6599064, y: -3.4260674} + - {x: -5.793478, y: -3.4478827} + - {x: -6.103485, y: -3.9516172} + - {x: -6.2236557, y: -3.2902782} + - {x: -5.798864, y: -2.8099592} + - {x: -5.3386383, y: -2.498311} + - {x: -5.910779, y: -2.4954557} + - {x: -6.054783, y: -2.1229374} + - {x: -6.409728, y: -2.5751123} + - {x: -6.6695256, y: -2.011589} + - {x: -6.4066586, y: -1.4256444} + - {x: -5.7559204, y: -1.1190958} + - {x: -5.659766, y: -0.9032006} + - {x: -5.685962, y: -0.67662984} + - {x: -6.1818695, y: -0.73166656} + - {x: -6.445245, y: -1.043403} + - {x: -6.712138, y: -1.4716253} + - {x: -6.7327995, y: -1.1105715} + - {x: -6.600764, y: -0.47903705} + - {x: -6.411022, y: 0.07046509} + - {x: -5.8852887, y: 0.21442722} + - {x: -5.464736, y: 0.1550293} + - {x: -5.3192067, y: 0.28337485} + - {x: -5.205149, y: 0.5243256} + - {x: -5.6063585, y: 0.6617527} + - {x: -5.4115167, y: 1.3153566} + - {x: -5.8227644, y: 1.361414} + - {x: -5.4171495, y: 1.7782604} + - {x: -4.8657217, y: 1.8313699} + - {x: -4.5522523, y: 1.8536273} + - {x: -4.5334206, y: 2.017733} + - {x: -4.667205, y: 2.2387218} + - {x: -4.292954, y: 2.6855984} + - {x: -4.580907, y: 2.8373194} + - {x: -4.0656614, y: 3.0545754} + - {x: -3.6416664, y: 2.9989085} + - {x: -3.359173, y: 2.9503338} + - {x: -3.3353915, y: 3.1130767} + - {x: -3.837128, y: 3.5377407} + - {x: -3.196869, y: 3.7146618} + - {x: -2.604802, y: 3.566195} + - {x: -2.3444424, y: 3.4395485} + - {x: -2.1640463, y: 3.5340664} + - {x: -1.9549431, y: 3.8693755} + - {x: -2.2152555, y: 4.5231056} + - {x: -1.5487685, y: 4.413057} + - {x: -0.944021, y: 3.8185174} + - {x: -0.68036103, y: 3.4601822} + - {x: -0.35997054, y: 3.7712705} + - {x: 0.33567452, y: 4.335599} + - {x: 1.0082848, y: 4.59976} + - {x: 0.52776575, y: 3.8100228} + - {x: 0.67292666, y: 3.4952803} + - {x: 0.85266876, y: 3.4385777} + - {x: 1.014653, y: 3.6554363} + - {x: 1.4272296, y: 4.039967} + - {x: 1.9803336, y: 4.193098} + - {x: 1.82889, y: 3.6472077} + - {x: 2.2490773, y: 3.3730989} + - {x: 2.5440044, y: 3.2979183} + - {x: 3.2207956, y: 3.8227782} + - {x: 3.6531794, y: 4.0017204} + - {x: 3.4617286, y: 3.5193548} + - {x: 3.625062, y: 3.226173} + - {x: 3.7744694, y: 3.112564} + - {x: 4.058009, y: 3.2391448} + - {x: 4.413997, y: 3.372613} + - {x: 4.842697, y: 3.0536528} +--- !u!1971053207 &778552135 +SpriteShapeRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 778552133} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 4294967295 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: -46 + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_MaskInteraction: 0 + m_ShapeTexture: {fileID: 2800000, guid: a94adaf94669646788de8f639270804a, type: 3} + m_Sprites: [] + m_LocalAABB: + m_Center: {x: -0.009348869, y: -0.4286661, z: 0} + m_Extent: {x: 6.7234507, y: 5.028426, z: 0} +--- !u!114 &778552136 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 778552133} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 90539df1cd5704abcb25fec9f3f5f84b, type: 3} + m_Name: + m_EditorClassIdentifier: + m_LegacyGenerator: 0 + m_Spline: + m_IsOpenEnded: 0 + m_ControlPoints: + - position: {x: 4.842697, y: 3.0536528, z: 0} + leftTangent: {x: -0.46514416, y: 0.6982794, z: 0} + rightTangent: {x: -0.98501754, y: -0.19482803, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 4.149143, y: 2.2038698, z: 0} + leftTangent: {x: -0.25518036, y: 0.18873692, z: 0} + rightTangent: {x: 0.34710693, y: -0.25672722, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.749752, y: 2.1744652, z: 0} + leftTangent: {x: -0.37604332, y: 0.8819065, z: 0} + rightTangent: {x: -0.6860409, y: -0.41157246, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.2604628, y: 1.6912718, z: 0} + leftTangent: {x: -0.059747696, y: 0.2612772, z: 0} + rightTangent: {x: 0.94542885, y: -0.04471779, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.2868843, y: 0.65911484, z: 0} + leftTangent: {x: -0.08357048, y: 0.233428, z: 0} + rightTangent: {x: 0.1258831, y: -0.35161018, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 6.122902, y: 0.66643333, z: 0} + leftTangent: {x: -0.29554272, y: 0.18166637, z: 0} + rightTangent: {x: -0.6404972, y: -0.30658436, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.842326, y: 0.31585217, z: 0} + leftTangent: {x: -0.05978012, y: 0.15721035, z: 0} + rightTangent: {x: 0.04073143, y: -0.107115746, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 6.6654167, y: 0.18912315, z: 0} + leftTangent: {x: -0.06389809, y: 0.5598202, z: 0} + rightTangent: {x: -0.46305275, y: 0.1414814, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 6.368513, y: -0.011343002, z: 0} + leftTangent: {x: -0.021983147, y: 0.015303612, z: 0} + rightTangent: {x: 0.16562653, y: -0.11529827, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 6.561116, y: -0.73729897, z: 0} + leftTangent: {x: 0.19778919, y: 0.2788496, z: 0} + rightTangent: {x: -0.1742773, y: 0.6115341, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 6.184222, y: -0.5616255, z: 0} + leftTangent: {x: 0.68896294, y: 0.8554535, z: 0} + rightTangent: {x: -0.43468094, y: 0.39962196, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.729164, y: -0.6656771, z: 0} + leftTangent: {x: 0.122961044, y: 0.28598404, z: 0} + rightTangent: {x: 0.45636845, y: -0.05565548, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 6.2144938, y: -0.859148, z: 0} + leftTangent: {x: 0.1869936, y: 0.18153954, z: 0} + rightTangent: {x: -0.1869936, y: -0.18153954, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 6.1457024, y: -1.1232643, z: 0} + leftTangent: {x: -0.5345783, y: 0.036352158, z: 0} + rightTangent: {x: 0.14191914, y: -0.42528534, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 6.714102, y: -1.7794142, z: 0} + leftTangent: {x: 0.1886692, y: 0.4288845, z: 0} + rightTangent: {x: -0.54428864, y: 0.32612705, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 6.600374, y: -2.1254349, z: 0} + leftTangent: {x: 0.08338165, y: 0.104310036, z: -0} + rightTangent: {x: -0.08338165, y: -0.104310036, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 6.181938, y: -2.2180634, z: 0} + leftTangent: {x: 0.10590649, y: 0.4469347, z: 0} + rightTangent: {x: -0.10590458, y: 0.15244389, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.8189154, y: -1.6906357, z: 0} + leftTangent: {x: 0.32985497, y: 0.16756153, z: 0} + rightTangent: {x: -0.10930061, y: 0.1140461, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.9714613, y: -2.0932398, z: 0} + leftTangent: {x: -0.08672142, y: 0.48350525, z: 0} + rightTangent: {x: 0.06339455, y: -0.353446, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.8072453, y: -2.1588326, z: 0} + leftTangent: {x: -0.14785767, y: 0.35762978, z: 0} + rightTangent: {x: 0.7605448, y: -0.23285866, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 6.17338, y: -3.2872, z: 0} + leftTangent: {x: 0.28656864, y: 0.2684822, z: 0} + rightTangent: {x: -0.026841164, y: 0.62389946, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.8428383, y: -3.3735342, z: 0} + leftTangent: {x: 0.12148476, y: 0.5996351, z: 0} + rightTangent: {x: -0.4254961, y: 0.7156172, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.2637434, y: -3.2851763, z: 0} + leftTangent: {x: 0.13748741, y: 0.28014755, z: 0} + rightTangent: {x: -0.26539803, y: -0.5407772, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.765026, y: -3.6137066, z: 0} + leftTangent: {x: -0.1565094, y: 0.26346588, z: 0} + rightTangent: {x: 0.1565094, y: -0.26346588, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.759465, y: -4.0411563, z: 0} + leftTangent: {x: 0.01789093, y: 0.06118679, z: 0} + rightTangent: {x: -0.042197227, y: -0.1443119, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.2751274, y: -3.9274988, z: 0} + leftTangent: {x: 0.19284344, y: 0.22602367, z: 0} + rightTangent: {x: 0.13536263, y: -0.14547539, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.4815645, y: -4.2211666, z: 0} + leftTangent: {x: 0.026311874, y: 0.04362297, z: 0} + rightTangent: {x: -0.09507955, y: -0.15763362, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 4.957515, y: -4.596761, z: 0} + leftTangent: {x: 0.44955254, y: 0.17905235, z: 0} + rightTangent: {x: -0.7130451, y: -0.45710754, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 4.401864, y: -4.3257003, z: 0} + leftTangent: {x: 0.1128853, y: -0.12269877, z: -0} + rightTangent: {x: -0.05100727, y: 0.05544138, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 4.405222, y: -3.7872267, z: 0} + leftTangent: {x: 0.6351795, y: -0.11997414, z: 0} + rightTangent: {x: 0.05604744, y: 0.3643427, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 4.173502, y: -3.3677387, z: 0} + leftTangent: {x: 0.334507, y: -0.24208546, z: 0} + rightTangent: {x: -0.4423027, y: 0.32009602, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 3.8946753, y: -3.8394208, z: 0} + leftTangent: {x: 0.24389267, y: -0.22975159, z: 0} + rightTangent: {x: -0.24389267, y: 0.22975111, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 3.3099508, y: -4.16985, z: 0} + leftTangent: {x: 0.3787346, y: 0.038001537, z: 0} + rightTangent: {x: 0.110370636, y: 0.36677504, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 3.180334, y: -3.5487986, z: 0} + leftTangent: {x: 0.39083004, y: -0.0067796707, z: 0} + rightTangent: {x: -0.10656071, y: 0.095106125, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 2.6059914, y: -3.4799633, z: 0} + leftTangent: {x: 0.43336868, y: 0.28313637, z: 0} + rightTangent: {x: -0.13688469, y: 0.114209175, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 2.4267352, y: -3.0078354, z: 0} + leftTangent: {x: 0.58955383, y: 0.4144659, z: 0} + rightTangent: {x: -0.6038761, y: 0.65348434, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.6166661, y: -2.6917048, z: 0} + leftTangent: {x: 0.27279282, y: -0.93830156, z: 0} + rightTangent: {x: -0.30190563, y: -0.005326271, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.9129431, y: -3.2032948, z: 0} + leftTangent: {x: 0.20650005, y: 0.4817562, z: 0} + rightTangent: {x: -0.33580494, y: 0.6037283, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.2539997, y: -3.135602, z: 0} + leftTangent: {x: 0.44612813, y: 0.11222839, z: 0} + rightTangent: {x: -0.35859704, y: -0.09020901, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.3104165, y: -3.277318, z: 0} + leftTangent: {x: 0.23278904, y: 0.6811428, z: 0} + rightTangent: {x: -0.5718541, y: 0.6515808, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -2.8319044, y: -3.1292267, z: 0} + leftTangent: {x: 0.46818423, y: 0.08489704, z: 0} + rightTangent: {x: -0.2812922, y: -0.05100727, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -3.278289, y: -3.8055553, z: 0} + leftTangent: {x: 0.31745243, y: 0.3524227, z: 0} + rightTangent: {x: -0.33680677, y: 0.6963768, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -3.9952595, y: -4.0934596, z: 0} + leftTangent: {x: 0.24181223, y: 0.35848808, z: 0} + rightTangent: {x: -0.21053219, y: -0.31211567, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -4.4443274, y: -4.769828, z: 0} + leftTangent: {x: -0.14350319, y: 1.0470924, z: 0} + rightTangent: {x: -0.7089062, y: -0.25762463, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -5.024274, y: -5.4570923, z: 0} + leftTangent: {x: 0.21583176, y: 0.5733261, z: 0} + rightTangent: {x: -0.45623875, y: 0.6600208, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -4.8562536, y: -3.8500762, z: 0} + leftTangent: {x: -0.25752544, y: -0.66076374, z: 0} + rightTangent: {x: -0.13257408, y: 0.07835674, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -5.533455, y: -3.7817793, z: 0} + leftTangent: {x: 0.55585384, y: 0.5684366, z: 0} + rightTangent: {x: -0.17933083, y: 0.509676, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -6.103485, y: -3.9516172, z: 0} + leftTangent: {x: 0.45466328, y: 0.77949333, z: 0} + rightTangent: {x: -0.5624981, y: 0.7559643, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -5.3386383, y: -2.498311, z: 0} + leftTangent: {x: -0.3080988, y: -0.2314291, z: 0} + rightTangent: {x: 0.0177145, y: 0.09904194, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -5.910779, y: -2.4954557, z: 0} + leftTangent: {x: 0.30684566, y: -0.08076191, z: 0} + rightTangent: {x: -0.15530014, y: 0.035564423, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -6.409728, y: -2.5751123, z: 0} + leftTangent: {x: 0.5852232, y: 0.953145, z: 0} + rightTangent: {x: -0.5660629, y: 0.45170593, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -5.7559204, y: -1.1190958, z: 0} + leftTangent: {x: -0.79974174, y: -0.066244125, z: 0} + rightTangent: {x: 0.041540146, y: 0.113129616, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -6.1818695, y: -0.73166656, z: 0} + leftTangent: {x: 0.84655, y: 0.2932682, z: 0} + rightTangent: {x: -0.04629135, y: 0.046333313, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -6.712138, y: -1.4716253, z: 0} + leftTangent: {x: 0.314332, y: 0.50869083, z: 0} + rightTangent: {x: -0.12867546, y: 0.10830879, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -6.411022, y: 0.07046509, z: 0} + leftTangent: {x: -0.18693066, y: -0.39098167, z: 0} + rightTangent: {x: 0.6308994, y: 0.27458572, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -5.464736, y: 0.1550293, z: 0} + leftTangent: {x: -0.08733368, y: -0.40212727, z: 0} + rightTangent: {x: 0.08283138, y: 0.38139915, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -5.6063585, y: 0.6617527, z: 0} + leftTangent: {x: 0.8201084, y: -0.013622284, z: 0} + rightTangent: {x: -0.06596756, y: 0.19331455, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -5.8227644, y: 1.361414, z: 0} + leftTangent: {x: 0.83205414, y: 0.2078495, z: 0} + rightTangent: {x: 0.19268036, y: 0.6882601, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -4.588561, y: 1.7893763, z: 0} + leftTangent: {x: -0.186059, y: -0.20398903, z: 0} + rightTangent: {x: 0.20092964, y: 0.22029305, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -4.667205, y: 2.2387218, z: 0} + leftTangent: {x: 0.2551403, y: -0.23510647, z: 0} + rightTangent: {x: -0.0376606, y: 0.19423485, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -4.580907, y: 2.8373194, z: 0} + leftTangent: {x: 0.7170656, y: -0.089307785, z: 0} + rightTangent: {x: 0.50866604, y: 0.43827343, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -3.4655323, y: 2.9239826, z: 0} + leftTangent: {x: -0.19108582, y: -0.12285614, z: 0} + rightTangent: {x: 0.19291592, y: 0.124032974, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -3.837128, y: 3.5377407, z: 0} + leftTangent: {x: 0.9121423, y: -0.5974684, z: 0} + rightTangent: {x: 0.56984806, y: 0.45535278, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -2.3444424, y: 3.4395485, z: 0} + leftTangent: {x: -0.28999424, y: -0.1061039, z: 0} + rightTangent: {x: 0.29269123, y: 0.1070919, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -2.2152555, y: 4.5231056, z: 0} + leftTangent: {x: 0.66106176, y: -0.8388176, z: 0} + rightTangent: {x: 0.6042404, y: 0.3724308, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.68036103, y: 3.4601822, z: 0} + leftTangent: {x: -0.21909523, y: 0.00019645691, z: 0} + rightTangent: {x: 0.49437714, y: -0.00044631958, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.0082848, y: 4.59976, z: 0} + leftTangent: {x: -0.52832985, y: 0.0703907, z: 0} + rightTangent: {x: -0.99039173, y: -1.0995512, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.85266876, y: 3.4385777, z: 0} + leftTangent: {x: -0.56994057, y: 0.139328, z: 0} + rightTangent: {x: 0.9365616, y: -0.22895241, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.9803336, y: 4.193098, z: 0} + leftTangent: {x: -0.58667946, y: 0.0955925, z: 0} + rightTangent: {x: -0.66955566, y: -0.7060642, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 2.5440044, y: 3.2979183, z: 0} + leftTangent: {x: -0.36831474, y: 0.16205788, z: 0} + rightTangent: {x: 0.43422318, y: -0.1910572, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 3.6531794, y: 4.0017204, z: 0} + leftTangent: {x: -0.32584476, y: 0.007930756, z: 0} + rightTangent: {x: -0.49174595, y: -0.58016014, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 3.7744694, y: 3.112564, z: 0} + leftTangent: {x: -0.019541502, y: 0.027026176, z: 0} + rightTangent: {x: 0.2474041, y: -0.029967308, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + m_SpriteShape: {fileID: 11400000, guid: 8e3fa9c7ff3ad4112a30689e933384ed, type: 2} + m_FillPixelPerUnit: 100 + m_StretchTiling: 1 + m_SplineDetail: 4 + m_AdaptiveUV: 1 + m_StretchUV: 0 + m_WorldSpaceUV: 0 + m_ColliderDetail: 16 + m_ColliderOffset: 0 + m_UpdateCollider: 0 + m_OptimizeCollider: 1 +--- !u!4 &778552137 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 778552133} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0.51, y: 7.41, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1617661210} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1192624865 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1192624872} + - component: {fileID: 1192624871} + - component: {fileID: 1192624870} + - component: {fileID: 1192624869} + - component: {fileID: 1192624868} + - component: {fileID: 1192624867} + - component: {fileID: 1192624866} + m_Layer: 0 + m_Name: Tree (Package) (Legacy Collider) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1192624866 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1192624865} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6a8e65bafadf93f41a17da25163f2f51, type: 3} + m_Name: + m_EditorClassIdentifier: + m_ColliderCornerType: 0 + m_ColliderOffset: 1 + m_UpdateCollider: 0 +--- !u!60 &1192624867 +PolygonCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1192624865} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 1 + m_Offset: {x: 0, y: 0} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0, y: 0} + oldSize: {x: 0, y: 0} + newSize: {x: 0, y: 0} + adaptiveTilingThreshold: 0 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + m_Points: + m_Paths: + - - {x: 3.21616, y: 3.70394} + - {x: 3.06467, y: 3.61522} + - {x: 2.89128, y: 3.53323} + - {x: 2.69993, y: 3.45} + - {x: 2.49458, y: 3.35756} + - {x: 2.49458, y: 3.35756} + - {x: 2.25361, y: 3.22345} + - {x: 2.04345, y: 3.07924} + - {x: 1.85335, y: 2.9437} + - {x: 1.67252, y: 2.83557} + - {x: 1.67252, y: 2.83557} + - {x: 1.43665, y: 2.65946} + - {x: 1.3154, y: 2.46707} + - {x: 1.27064, y: 2.31219} + - {x: 1.26419, y: 2.24861} + - {x: 1.26419, y: 2.24861} + - {x: 1.24321, y: 2.21888} + - {x: 1.1781, y: 2.14336} + - {x: 1.06561, y: 2.04256} + - {x: 0.90247, y: 1.93701} + - {x: 0.90247, y: 1.93701} + - {x: 0.8364, y: 1.78565} + - {x: 0.81639, y: 1.615} + - {x: 0.82316, y: 1.42258} + - {x: 0.83741, y: 1.2059} + - {x: 0.83741, y: 1.2059} + - {x: 0.83785, y: 1.03644} + - {x: 0.83004, y: 0.85498} + - {x: 0.8246, y: 0.66887} + - {x: 0.83215, y: 0.48545} + - {x: 0.83215, y: 0.48545} + - {x: 0.85034, y: 0.07453} + - {x: 0.84492, y: -0.2948} + - {x: 0.85385, y: -0.63485} + - {x: 0.91511, y: -0.95794} + - {x: 0.91511, y: -0.95794} + - {x: 1.0408, y: -1.297} + - {x: 1.18721, y: -1.62861} + - {x: 1.30861, y: -1.88055} + - {x: 1.35924, y: -1.98058} + - {x: 1.35924, y: -1.98058} + - {x: -1.51457, y: -1.91262} + - {x: -1.51457, y: -1.91262} + - {x: -1.1785, y: -1.14981} + - {x: -1.1785, y: -1.14981} + - {x: -1.14555, y: -0.99038} + - {x: -1.06854, y: -0.60328} + - {x: -0.98024, y: -0.12525} + - {x: -0.91342, y: 0.30692} + - {x: -0.91342, y: 0.30692} + - {x: -0.88349, y: 0.42842} + - {x: -0.82777, y: 0.59984} + - {x: -0.76428, y: 0.79808} + - {x: -0.71104, y: 1.00007} + - {x: -0.71104, y: 1.00007} + - {x: -0.68064, y: 1.19016} + - {x: -0.66822, y: 1.36293} + - {x: -0.66352, y: 1.52021} + - {x: -0.65627, y: 1.66382} + - {x: -0.65627, y: 1.66382} + - {x: -0.66352, y: 1.93623} + - {x: -0.72431, y: 2.21223} + - {x: -0.82614, y: 2.49767} + - {x: -0.95652, y: 2.79842} + - {x: -0.95652, y: 2.79842} + - {x: -1.16376, y: 3.08906} + - {x: -1.43705, y: 3.32499} + - {x: -1.67521, y: 3.48334} + - {x: -1.77708, y: 3.54121} + - {x: -1.77708, y: 3.54121} + - {x: -1.82409, y: 3.53352} + - {x: -1.93937, y: 3.52264} + - {x: -2.0843, y: 3.52685} + - {x: -2.22026, y: 3.56443} + - {x: -2.22026, y: 3.56443} + - {x: -2.34351, y: 3.64414} + - {x: -2.4629, y: 3.75766} + - {x: -2.55871, y: 3.8976} + - {x: -2.6112, y: 4.05661} + - {x: -2.6112, y: 4.05661} + - {x: -2.76821, y: 4.19096} + - {x: -2.91254, y: 4.27713} + - {x: -3.0182, y: 4.32302} + - {x: -3.05919, y: 4.33656} + - {x: -3.05919, y: 4.33656} + - {x: -3.15745, y: 4.56129} + - {x: -3.15745, y: 4.56129} + - {x: -2.79045, y: 4.71134} + - {x: -2.79045, y: 4.71134} + - {x: -2.73392, y: 4.69976} + - {x: -2.5972, y: 4.65381} + - {x: -2.42957, y: 4.55666} + - {x: -2.28032, y: 4.39147} + - {x: -2.28032, y: 4.39147} + - {x: -2.26795, y: 4.22291} + - {x: -2.20042, y: 4.07723} + - {x: -2.11615, y: 3.973} + - {x: -2.05352, y: 3.9288} + - {x: -2.05352, y: 3.9288} + - {x: -1.94517, y: 3.91878} + - {x: -1.85133, y: 3.92641} + - {x: -1.78528, y: 3.93974} + - {x: -1.76032, y: 3.94683} + - {x: -1.76032, y: 3.94683} + - {x: -1.74974, y: 3.9863} + - {x: -1.73502, y: 4.08752} + - {x: -1.74166, y: 4.22471} + - {x: -1.79516, y: 4.3721} + - {x: -1.79516, y: 4.3721} + - {x: -1.91215, y: 4.55557} + - {x: -2.05843, y: 4.77214} + - {x: -2.18336, y: 4.95274} + - {x: -2.23626, y: 5.02829} + - {x: -2.23626, y: 5.02829} + - {x: -1.66682, y: 5.15766} + - {x: -1.66682, y: 5.15766} + - {x: -1.6332, y: 5.08906} + - {x: -1.55111, y: 4.91492} + - {x: -1.44868, y: 4.68271} + - {x: -1.35406, y: 4.43994} + - {x: -1.35406, y: 4.43994} + - {x: -1.37997, y: 4.27281} + - {x: -1.35267, y: 4.15224} + - {x: -1.3018, y: 4.06892} + - {x: -1.25701, y: 4.01351} + - {x: -1.25701, y: 4.01351} + - {x: -1.09309, y: 3.8494} + - {x: -0.87801, y: 3.69178} + - {x: -0.69092, y: 3.57328} + - {x: -0.61097, y: 3.52652} + - {x: -0.61097, y: 3.52652} + - {x: -0.62235, y: 3.56415} + - {x: -0.65681, y: 3.66302} + - {x: -0.71479, y: 3.80206} + - {x: -0.79677, y: 3.96025} + - {x: -0.79677, y: 3.96025} + - {x: -0.84944, y: 4.02853} + - {x: -0.9117, y: 4.08876} + - {x: -0.97351, y: 4.15206} + - {x: -1.02479, y: 4.22952} + - {x: -1.02479, y: 4.22952} + - {x: -1.15366, y: 4.52644} + - {x: -1.2468, y: 4.80967} + - {x: -1.29124, y: 5.05157} + - {x: -1.27401, y: 5.2245} + - {x: -1.27401, y: 5.2245} + - {x: -1.1945, y: 5.24587} + - {x: -1.00474, y: 5.29598} + - {x: -0.77788, y: 5.35386} + - {x: -0.58708, y: 5.39851} + - {x: -0.58708, y: 5.39851} + - {x: -0.57878, y: 5.08461} + - {x: -0.57517, y: 4.79473} + - {x: -0.55927, y: 4.53139} + - {x: -0.51412, y: 4.29709} + - {x: -0.51412, y: 4.29709} + - {x: -0.47711, y: 4.22039} + - {x: -0.42709, y: 4.16381} + - {x: -0.3738, y: 4.11414} + - {x: -0.32701, y: 4.05818} + - {x: -0.32701, y: 4.05818} + - {x: -0.27297, y: 3.95849} + - {x: -0.23526, y: 3.86713} + - {x: -0.21316, y: 3.80037} + - {x: -0.20596, y: 3.7745} + - {x: -0.20596, y: 3.7745} + - {x: 0.04144, y: 3.53247} + - {x: 0.04144, y: 3.53247} + - {x: -0.03839, y: 3.97665} + - {x: -0.03839, y: 3.97665} + - {x: -0.02412, y: 4.01835} + - {x: 0.00641, y: 4.11975} + - {x: 0.03482, y: 4.24525} + - {x: 0.04267, y: 4.35928} + - {x: 0.04267, y: 4.35928} + - {x: -0.00723, y: 4.52445} + - {x: -0.10588, y: 4.76249} + - {x: -0.2024, y: 4.97642} + - {x: -0.24588, y: 5.06928} + - {x: -0.24588, y: 5.06928} + - {x: 0.20219, y: 5.15233} + - {x: 0.20219, y: 5.15233} + - {x: 0.24203, y: 5.05934} + - {x: 0.33078, y: 4.84528} + - {x: 0.42225, y: 4.60747} + - {x: 0.47027, y: 4.44323} + - {x: 0.47027, y: 4.44323} + - {x: 0.4684, y: 4.32995} + - {x: 0.4501, y: 4.20424} + - {x: 0.42908, y: 4.10228} + - {x: 0.41903, y: 4.06025} + - {x: 0.41903, y: 4.06025} + - {x: 0.53061, y: 3.8667} + - {x: 0.53061, y: 3.8667} + - {x: 0.55453, y: 3.87806} + - {x: 0.6126, y: 3.91365} + - {x: 0.68429, y: 3.97576} + - {x: 0.74907, y: 4.06666} + - {x: 0.74907, y: 4.06666} + - {x: 0.79007, y: 4.18274} + - {x: 0.81181, y: 4.31027} + - {x: 0.8225, y: 4.42996} + - {x: 0.83037, y: 4.52254} + - {x: 0.83037, y: 4.52254} + - {x: 0.86256, y: 4.68378} + - {x: 0.90925, y: 4.84782} + - {x: 0.9513, y: 4.97518} + - {x: 0.96957, y: 5.02641} + - {x: 0.96957, y: 5.02641} + - {x: 1.49179, y: 5.0735} + - {x: 1.49179, y: 5.0735} + - {x: 1.47548, y: 5.02669} + - {x: 1.43807, y: 4.91325} + - {x: 1.39682, y: 4.7737} + - {x: 1.369, y: 4.64854} + - {x: 1.369, y: 4.64854} + - {x: 1.33214, y: 4.51091} + - {x: 1.26993, y: 4.33702} + - {x: 1.20878, y: 4.17203} + - {x: 1.17512, y: 4.06108} + - {x: 1.17512, y: 4.06108} + - {x: 1.16627, y: 3.98099} + - {x: 1.1612, y: 3.89435} + - {x: 1.15891, y: 3.82494} + - {x: 1.15838, y: 3.79652} + - {x: 1.15838, y: 3.79652} + - {x: 1.34416, y: 3.76339} + - {x: 1.34416, y: 3.76339} + - {x: 1.37316, y: 3.80006} + - {x: 1.46142, y: 3.90428} + - {x: 1.61085, y: 4.06734} + - {x: 1.82336, y: 4.28055} + - {x: 1.82336, y: 4.28055} + - {x: 1.8859, y: 4.36773} + - {x: 1.9258, y: 4.46981} + - {x: 1.95797, y: 4.57515} + - {x: 1.99737, y: 4.67211} + - {x: 1.99737, y: 4.67211} + - {x: 2.09532, y: 4.84509} + - {x: 2.17963, y: 4.98264} + - {x: 2.23871, y: 5.07346} + - {x: 2.26098, y: 5.10624} + - {x: 2.26098, y: 5.10624} + - {x: 2.3269, y: 5.08028} + - {x: 2.48573, y: 5.0163} + - {x: 2.67913, y: 4.93514} + - {x: 2.84873, y: 4.85762} + - {x: 2.84873, y: 4.85762} + - {x: 2.79424, y: 4.79033} + - {x: 2.68949, y: 4.71744} + - {x: 2.5691, y: 4.63505} + - {x: 2.46769, y: 4.53925} + - {x: 2.46769, y: 4.53925} + - {x: 2.38302, y: 4.40931} + - {x: 2.31304, y: 4.27313} + - {x: 2.24425, y: 4.13729} + - {x: 2.16311, y: 4.00834} + - {x: 2.16311, y: 4.00834} + - {x: 2.03168, y: 3.845} + - {x: 1.9121, y: 3.71337} + - {x: 1.82514, y: 3.62554} + - {x: 1.79154, y: 3.59357} + - {x: 1.79154, y: 3.59357} + - {x: 1.86115, y: 3.6285} + - {x: 2.04432, y: 3.71875} + - {x: 2.3026, y: 3.84251} + - {x: 2.59753, y: 3.97799} + - {x: 2.59753, y: 3.97799} + - {x: 2.64528, y: 3.98951} + - {x: 2.69645, y: 3.98993} + - {x: 2.74981, y: 3.98915} + - {x: 2.80409, y: 3.99704} + - {x: 2.80409, y: 3.99704} + - {x: 2.88942, y: 4.02926} + - {x: 2.96842, y: 4.0708} + - {x: 3.03575, y: 4.11335} + - {x: 3.08606, y: 4.14861} + - {x: 3.08606, y: 4.14861} + - {x: 3.34301, y: 4.36611} + - {x: 3.609, y: 4.62895} + - {x: 3.81742, y: 4.85032} + - {x: 3.90169, y: 4.94341} + - {x: 3.90169, y: 4.94341} + - {x: 4.37856, y: 4.67953} + - {x: 4.37856, y: 4.67953} + - {x: 4.23861, y: 4.57148} + - {x: 3.9085, y: 4.3101} + - {x: 3.52282, y: 3.98953} + - {x: 3.21616, y: 3.70394} +--- !u!66 &1192624868 +CompositeCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1192624865} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: 0} + m_GeometryType: 0 + m_GenerationType: 0 + m_EdgeRadius: 0 + m_ColliderPaths: + - m_Collider: {fileID: 1192624867} + m_ColliderPaths: + - - X: 32161600 + Y: 37039400 + - X: 30646700 + Y: 36152200 + - X: 28912800 + Y: 35332300 + - X: 26999300 + Y: 34500000 + - X: 24945800 + Y: 33575600 + - X: 24945800 + Y: 33575600 + - X: 22536098 + Y: 32234500 + - X: 20434502 + Y: 30792400 + - X: 18533500 + Y: 29437000 + - X: 16725200 + Y: 28355700 + - X: 16725200 + Y: 28355700 + - X: 14366500 + Y: 26594600 + - X: 13154000 + Y: 24670702 + - X: 12706400 + Y: 23121900 + - X: 12641900 + Y: 22486100 + - X: 12641900 + Y: 22486100 + - X: 12432100 + Y: 22188800 + - X: 11781000 + Y: 21433598 + - X: 10656101 + Y: 20425602 + - X: 9024700 + Y: 19370100 + - X: 9024700 + Y: 19370100 + - X: 8363999 + Y: 17856500 + - X: 8163900 + Y: 16150000 + - X: 8231600 + Y: 14225800 + - X: 8374099 + Y: 12059000 + - X: 8374099 + Y: 12059000 + - X: 8378499 + Y: 10364400 + - X: 8300400 + Y: 8549800 + - X: 8246000 + Y: 6688699 + - X: 8321500 + Y: 4854500 + - X: 8321500 + Y: 4854500 + - X: 8503400 + Y: 745300 + - X: 8449200 + Y: -2948000 + - X: 8538500 + Y: -6348500 + - X: 9151100 + Y: -9579400 + - X: 9151100 + Y: -9579400 + - X: 10408000 + Y: -12970001 + - X: 11872100 + Y: -16286100 + - X: 13086100 + Y: -18805500 + - X: 13592401 + Y: -19805800 + - X: 13592401 + Y: -19805800 + - X: -15145700 + Y: -19126200 + - X: -15145700 + Y: -19126200 + - X: -11785001 + Y: -11498100 + - X: -11785001 + Y: -11498100 + - X: -11455500 + Y: -9903800 + - X: -10685400 + Y: -6032800 + - X: -9802400 + Y: -1252500 + - X: -9134200 + Y: 3069200 + - X: -9134200 + Y: 3069200 + - X: -8834900 + Y: 4284200 + - X: -8277700 + Y: 5998400 + - X: -7642800 + Y: 7980800 + - X: -7110400 + Y: 10000700 + - X: -7110400 + Y: 10000700 + - X: -6806400 + Y: 11901600 + - X: -6682200 + Y: 13629301 + - X: -6635200 + Y: 15202100 + - X: -6562700 + Y: 16638200 + - X: -6562700 + Y: 16638200 + - X: -6635200 + Y: 19362300 + - X: -7243100 + Y: 22122300 + - X: -8261400 + Y: 24976700 + - X: -9565200 + Y: 27984200 + - X: -9565200 + Y: 27984200 + - X: -11637599 + Y: 30890600 + - X: -14370500 + Y: 33249900 + - X: -16752100 + Y: 34833400 + - X: -17770800 + Y: 35412100 + - X: -17770800 + Y: 35412100 + - X: -18240900 + Y: 35335200 + - X: -19393700 + Y: 35226400 + - X: -20843000 + Y: 35268500 + - X: -22202600 + Y: 35644300 + - X: -22202600 + Y: 35644300 + - X: -23435100 + Y: 36441400 + - X: -24629000 + Y: 37576600 + - X: -25587100 + Y: 38976000 + - X: -26112000 + Y: 40566100 + - X: -26112000 + Y: 40566100 + - X: -27682100 + Y: 41909600 + - X: -29125400 + Y: 42771300 + - X: -30182000 + Y: 43230200 + - X: -30591900 + Y: 43365596 + - X: -30591900 + Y: 43365596 + - X: -31574500 + Y: 45612896 + - X: -31574500 + Y: 45612896 + - X: -27904500 + Y: 47113400 + - X: -27904500 + Y: 47113400 + - X: -27339200 + Y: 46997600 + - X: -25972000 + Y: 46538100 + - X: -24295700 + Y: 45566600 + - X: -22803200 + Y: 43914700 + - X: -22803200 + Y: 43914700 + - X: -22679500 + Y: 42229100 + - X: -22004200 + Y: 40772300 + - X: -21161500 + Y: 39730000 + - X: -20535200 + Y: 39288000 + - X: -20535200 + Y: 39288000 + - X: -19451700 + Y: 39187800 + - X: -18513300 + Y: 39264100 + - X: -17852800 + Y: 39397400 + - X: -17603200 + Y: 39468300 + - X: -17603200 + Y: 39468300 + - X: -17497400 + Y: 39863000 + - X: -17350200 + Y: 40875200 + - X: -17416600 + Y: 42247100 + - X: -17951600 + Y: 43721000 + - X: -17951600 + Y: 43721000 + - X: -19121500 + Y: 45555700 + - X: -20584300 + Y: 47721400 + - X: -21833600 + Y: 49527400 + - X: -22362600 + Y: 50282896 + - X: -22362600 + Y: 50282896 + - X: -16668200 + Y: 51576600 + - X: -16668200 + Y: 51576600 + - X: -16332000 + Y: 50890600 + - X: -15511100 + Y: 49149200 + - X: -14486800 + Y: 46827100 + - X: -13540601 + Y: 44399400 + - X: -13540601 + Y: 44399400 + - X: -13799700 + Y: 42728100 + - X: -13526700 + Y: 41522396 + - X: -13018000 + Y: 40689200 + - X: -12570100 + Y: 40135104 + - X: -12570100 + Y: 40135104 + - X: -10930901 + Y: 38494000 + - X: -8780100 + Y: 36917800 + - X: -6909200 + Y: 35732800 + - X: -6109700 + Y: 35265200 + - X: -6109700 + Y: 35265200 + - X: -6223500 + Y: 35641500 + - X: -6568100 + Y: 36630200 + - X: -7147900 + Y: 38020600 + - X: -7967700 + Y: 39602500 + - X: -7967700 + Y: 39602500 + - X: -8494400 + Y: 40285300 + - X: -9117000 + Y: 40887600 + - X: -9735100 + Y: 41520600 + - X: -10247900 + Y: 42295200 + - X: -10247900 + Y: 42295200 + - X: -11536601 + Y: 45264400 + - X: -12467999 + Y: 48096700 + - X: -12912400 + Y: 50515700 + - X: -12740099 + Y: 52245000 + - X: -12740099 + Y: 52245000 + - X: -11945000 + Y: 52458700 + - X: -10047400 + Y: 52959800 + - X: -7778800 + Y: 53538600 + - X: -5870800 + Y: 53985100 + - X: -5870800 + Y: 53985100 + - X: -5787800 + Y: 50846100 + - X: -5751700 + Y: 47947300 + - X: -5592700 + Y: 45313900 + - X: -5141200 + Y: 42970900 + - X: -5141200 + Y: 42970900 + - X: -4771100 + Y: 42203900 + - X: -4270900 + Y: 41638096 + - X: -3738000 + Y: 41141400 + - X: -3270100 + Y: 40581800 + - X: -3270100 + Y: 40581800 + - X: -2729700 + Y: 39584900 + - X: -2352600 + Y: 38671300 + - X: -2131600 + Y: 38003700 + - X: -2059600 + Y: 37745000 + - X: -2059600 + Y: 37745000 + - X: 414400 + Y: 35324700 + - X: 414400 + Y: 35324700 + - X: -383900 + Y: 39766500 + - X: -383900 + Y: 39766500 + - X: -241200 + Y: 40183500 + - X: 64100 + Y: 41197500 + - X: 348200 + Y: 42452504 + - X: 426700 + Y: 43592800 + - X: 426700 + Y: 43592800 + - X: -72300 + Y: 45244500 + - X: -1058800 + Y: 47624896 + - X: -2024000 + Y: 49764200 + - X: -2458800 + Y: 50692800 + - X: -2458800 + Y: 50692800 + - X: 2021900 + Y: 51523300 + - X: 2021900 + Y: 51523300 + - X: 2420300 + Y: 50593400 + - X: 3307800 + Y: 48452800 + - X: 4222500 + Y: 46074700 + - X: 4702700 + Y: 44432300 + - X: 4702700 + Y: 44432300 + - X: 4684000 + Y: 43299500 + - X: 4501000 + Y: 42042400 + - X: 4290800 + Y: 41022800 + - X: 4190300 + Y: 40602500 + - X: 4190300 + Y: 40602500 + - X: 5306100 + Y: 38667000 + - X: 5306100 + Y: 38667000 + - X: 5545300 + Y: 38780600 + - X: 6126000 + Y: 39136500 + - X: 6842900 + Y: 39757600 + - X: 7490700 + Y: 40666600 + - X: 7490700 + Y: 40666600 + - X: 7900700 + Y: 41827404 + - X: 8118100 + Y: 43102700 + - X: 8225000 + Y: 44299596 + - X: 8303700 + Y: 45225400 + - X: 8303700 + Y: 45225400 + - X: 8625600 + Y: 46837800 + - X: 9092500 + Y: 48478200 + - X: 9513000 + Y: 49751800 + - X: 9695700 + Y: 50264100 + - X: 9695700 + Y: 50264100 + - X: 14917901 + Y: 50735000 + - X: 14917901 + Y: 50735000 + - X: 14754800 + Y: 50266900 + - X: 14380701 + Y: 49132500 + - X: 13968199 + Y: 47737004 + - X: 13690000 + Y: 46485400 + - X: 13690000 + Y: 46485400 + - X: 13321400 + Y: 45109100 + - X: 12699300 + Y: 43370200 + - X: 12087801 + Y: 41720300 + - X: 11751200 + Y: 40610800 + - X: 11751200 + Y: 40610800 + - X: 11662700 + Y: 39809900 + - X: 11612000 + Y: 38943500 + - X: 11589100 + Y: 38249400 + - X: 11583800 + Y: 37965200 + - X: 11583800 + Y: 37965200 + - X: 13441600 + Y: 37633900 + - X: 13441600 + Y: 37633900 + - X: 13731600 + Y: 38000600 + - X: 14614201 + Y: 39042800 + - X: 16108500 + Y: 40673400 + - X: 18233600 + Y: 42805500 + - X: 18233600 + Y: 42805500 + - X: 18859000 + Y: 43677300 + - X: 19258000 + Y: 44698100 + - X: 19579700 + Y: 45751500 + - X: 19973700 + Y: 46721100 + - X: 19973700 + Y: 46721100 + - X: 20953200 + Y: 48450900 + - X: 21796300 + Y: 49826396 + - X: 22387100 + Y: 50734600 + - X: 22609798 + Y: 51062396 + - X: 22609798 + Y: 51062396 + - X: 23269000 + Y: 50802800 + - X: 24857300 + Y: 50163004 + - X: 26791300 + Y: 49351400 + - X: 28487300 + Y: 48576196 + - X: 28487300 + Y: 48576196 + - X: 27942400 + Y: 47903300 + - X: 26894900 + Y: 47174400 + - X: 25691000 + Y: 46350500 + - X: 24676900 + Y: 45392500 + - X: 24676900 + Y: 45392500 + - X: 23830200 + Y: 44093100 + - X: 23130400 + Y: 42731300 + - X: 22442500 + Y: 41372900 + - X: 21631100 + Y: 40083400 + - X: 21631100 + Y: 40083400 + - X: 20316802 + Y: 38450000 + - X: 19121000 + Y: 37133700 + - X: 18251400 + Y: 36255400 + - X: 17915400 + Y: 35935700 + - X: 17915400 + Y: 35935700 + - X: 18611500 + Y: 36285000 + - X: 20443202 + Y: 37187500 + - X: 23026000 + Y: 38425100 + - X: 25975298 + Y: 39779900 + - X: 25975298 + Y: 39779900 + - X: 26452798 + Y: 39895100 + - X: 26964500 + Y: 39899300 + - X: 27498100 + Y: 39891500 + - X: 28040900 + Y: 39970400 + - X: 28040900 + Y: 39970400 + - X: 28894200 + Y: 40292600 + - X: 29684200 + Y: 40708000 + - X: 30357500 + Y: 41133500 + - X: 30860600 + Y: 41486100 + - X: 30860600 + Y: 41486100 + - X: 33430100 + Y: 43661100 + - X: 36090000 + Y: 46289500 + - X: 38174200 + Y: 48503200 + - X: 39016900 + Y: 49434100 + - X: 39016900 + Y: 49434100 + - X: 43785600 + Y: 46795300 + - X: 43785600 + Y: 46795300 + - X: 42386096 + Y: 45714796 + - X: 39085000 + Y: 43101000 + - X: 35228200 + Y: 39895300 + - X: 32161600 + Y: 37039400 + - m_Collider: {fileID: 2093986024} + m_ColliderPaths: + - - X: 53526904 + Y: 104636496 + - X: 48287700 + Y: 102486800 + - X: 46365304 + Y: 99657000 + - X: 46289900 + Y: 97192496 + - X: 46591400 + Y: 96138600 + - X: 46591400 + Y: 96138600 + - X: 48563504 + Y: 97332896 + - X: 53184304 + Y: 99298800 + - X: 58510104 + Y: 99611104 + - X: 62597504 + Y: 95844592 + - X: 62597504 + Y: 95844592 + - X: 58854704 + Y: 93720704 + - X: 57354304 + Y: 92865000 + - X: 57252304 + Y: 92291096 + - X: 57704600 + Y: 91012696 + - X: 57704600 + Y: 91012696 + - X: 61734404 + Y: 89211304 + - X: 61382004 + Y: 85684192 + - X: 59257000 + Y: 82241000 + - X: 57968804 + Y: 80691096 + - X: 57968804 + Y: 80691096 + - X: 58859500 + Y: 80957992 + - X: 61040600 + Y: 81408904 + - X: 63775900 + Y: 81519296 + - X: 66329004 + Y: 80764296 + - X: 66329004 + Y: 80764296 + - X: 63188500 + Y: 78923096 + - X: 62524204 + Y: 77861704 + - X: 63060904 + Y: 77375096 + - X: 63523200 + Y: 77258496 + - X: 63523200 + Y: 77258496 + - X: 64719400 + Y: 77847704 + - X: 67399000 + Y: 78724200 + - X: 70198504 + Y: 78550896 + - X: 71754104 + Y: 75991200 + - X: 71754104 + Y: 75991200 + - X: 69305800 + Y: 76296304 + - X: 68450704 + Y: 75576800 + - X: 68505104 + Y: 74563296 + - X: 68785096 + Y: 73986600 + - X: 68785096 + Y: 73986600 + - X: 70062904 + Y: 72758000 + - X: 71110904 + Y: 70970200 + - X: 71477504 + Y: 68875600 + - X: 70711104 + Y: 66727100 + - X: 70711104 + Y: 66727100 + - X: 69387000 + Y: 69581496 + - X: 68173104 + Y: 69898704 + - X: 67286000 + Y: 69069296 + - X: 66942200 + Y: 68483800 + - X: 66942200 + Y: 68483800 + - X: 66404104 + Y: 68723400 + - X: 65128004 + Y: 69036000 + - X: 63621400 + Y: 68812400 + - X: 62391600 + Y: 67443296 + - X: 62391600 + Y: 67443296 + - X: 65338200 + Y: 67161496 + - X: 67230904 + Y: 66948000 + - X: 67917200 + Y: 66498500 + - X: 67244904 + Y: 65508600 + - X: 67244904 + Y: 65508600 + - X: 65596804 + Y: 64381100 + - X: 64195004 + Y: 63643500 + - X: 64146304 + Y: 63178196 + - X: 66557004 + Y: 62867400 + - X: 66557004 + Y: 62867400 + - X: 68309104 + Y: 60651096 + - X: 70638704 + Y: 59600200 + - X: 72348400 + Y: 58542400 + - X: 72241000 + Y: 56305900 + - X: 72241000 + Y: 56305900 + - X: 69884304 + Y: 57287796 + - X: 69943904 + Y: 56189900 + - X: 70867800 + Y: 54284996 + - X: 71103704 + Y: 52845696 + - X: 71103704 + Y: 52845696 + - X: 70247104 + Y: 52889400 + - X: 69096000 + Y: 53667396 + - X: 67902704 + Y: 53802996 + - X: 66919304 + Y: 51919400 + - X: 66919304 + Y: 51919400 + - X: 66369204 + Y: 53622300 + - X: 65944004 + Y: 55756596 + - X: 65099000 + Y: 57290896 + - X: 63289104 + Y: 57193700 + - X: 63289104 + Y: 57193700 + - X: 63066400 + Y: 57045800 + - X: 63642000 + Y: 55608300 + - X: 64422504 + Y: 53957100 + - X: 64814600 + Y: 53167696 + - X: 64814600 + Y: 53167696 + - X: 64350104 + Y: 53568096 + - X: 63439004 + Y: 54180800 + - X: 62805204 + Y: 54123000 + - X: 63172404 + Y: 52511700 + - X: 63172404 + Y: 52511700 + - X: 67356000 + Y: 50143796 + - X: 68929704 + Y: 47003500 + - X: 68540104 + Y: 43796300 + - X: 66833800 + Y: 41228000 + - X: 66833800 + Y: 41228000 + - X: 66374904 + Y: 44568500 + - X: 65536004 + Y: 45384596 + - X: 64519600 + Y: 43906700 + - X: 63528304 + Y: 40364700 + - X: 63528304 + Y: 40364700 + - X: 60828404 + Y: 43521796 + - X: 59037204 + Y: 43490096 + - X: 58043904 + Y: 42116600 + - X: 57737404 + Y: 41248296 + - X: 57737404 + Y: 41248296 + - X: 58300600 + Y: 41105500 + - X: 59656900 + Y: 40593596 + - X: 61306700 + Y: 39587800 + - X: 62750200 + Y: 37963000 + - X: 62750200 + Y: 37963000 + - X: 63401804 + Y: 36183600 + - X: 63309304 + Y: 34837700 + - X: 62923404 + Y: 33985896 + - X: 62694604 + Y: 33688496 + - X: 62694604 + Y: 33688496 + - X: 62209000 + Y: 34183896 + - X: 60996104 + Y: 35104400 + - X: 59421600 + Y: 35601000 + - X: 57851200 + Y: 34825100 + - X: 57851200 + Y: 34825100 + - X: 58781800 + Y: 33813800 + - X: 59489704 + Y: 32974796 + - X: 59894404 + Y: 32326698 + - X: 59915604 + Y: 31888400 + - X: 59915604 + Y: 31888400 + - X: 58695704 + Y: 30636496 + - X: 56938800 + Y: 29419298 + - X: 55360204 + Y: 28497600 + - X: 54675104 + Y: 28132400 + - X: 54675104 + Y: 28132400 + - X: 53965600 + Y: 28383398 + - X: 52320204 + Y: 29027600 + - X: 50463004 + Y: 29901900 + - X: 49118604 + Y: 30843000 + - X: 49118604 + Y: 30843000 + - X: 49801904 + Y: 31749596 + - X: 51326004 + Y: 33293400 + - X: 51754904 + Y: 34958200 + - X: 49152204 + Y: 36227800 + - X: 49152204 + Y: 36227800 + - X: 49026604 + Y: 38420300 + - X: 48203804 + Y: 39691500 + - X: 47275900 + Y: 40279600 + - X: 46835004 + Y: 40422696 + - X: 46835004 + Y: 40422696 + - X: 46742300 + Y: 39362596 + - X: 46355400 + Y: 37202700 + - X: 45511304 + Y: 35473600 + - X: 44046704 + Y: 35705796 + - X: 44046704 + Y: 35705796 + - X: 42636700 + Y: 36212300 + - X: 41628704 + Y: 35057796 + - X: 40367900 + Y: 33401298 + - X: 38199504 + Y: 32401500 + - X: 38199504 + Y: 32401500 + - X: 39012204 + Y: 34909700 + - X: 39430904 + Y: 36856800 + - X: 38909804 + Y: 38128800 + - X: 36903304 + Y: 38612100 + - X: 36903304 + Y: 38612100 + - X: 36165804 + Y: 39518996 + - X: 35257104 + Y: 40374600 + - X: 33735704 + Y: 40521096 + - X: 31159902 + Y: 39300400 + - X: 31159902 + Y: 39300400 + - X: 31131404 + Y: 41102800 + - X: 31961102 + Y: 43643600 + - X: 31942102 + Y: 45193100 + - X: 29367302 + Y: 44021700 + - X: 29367302 + Y: 44021700 + - X: 25937602 + Y: 45952996 + - X: 24075404 + Y: 44534300 + - X: 22834000 + Y: 43649596 + - X: 21266604 + Y: 47183000 + - X: 21266604 + Y: 47183000 + - X: 19183802 + Y: 47038600 + - X: 17390202 + Y: 46411696 + - X: 15775602 + Y: 44891396 + - X: 14229403 + Y: 42067100 + - X: 14229403 + Y: 42067100 + - X: 11616702 + Y: 44877700 + - X: 8808402 + Y: 45090400 + - X: 5793202 + Y: 43960696 + - X: 2560102 + Y: 42743996 + - X: 2560102 + Y: 42743996 + - X: -276097 + Y: 43099900 + - X: -3193797 + Y: 44251400 + - X: -5875697 + Y: 44294996 + - X: -8004098 + Y: 41326900 + - X: -8004098 + Y: 41326900 + - X: -12135597 + Y: 44426500 + - X: -16000297 + Y: 44829100 + - X: -19670698 + Y: 43850800 + - X: -23218996 + Y: 42807800 + - X: -23218996 + Y: 42807800 + - X: -24656798 + Y: 42031396 + - X: -25315296 + Y: 40556396 + - X: -26041698 + Y: 38516296 + - X: -27682798 + Y: 36044496 + - X: -27682798 + Y: 36044496 + - X: -29883998 + Y: 39036600 + - X: -31623898 + Y: 38560700 + - X: -33185796 + Y: 36107000 + - X: -34852496 + Y: 33165498 + - X: -34852496 + Y: 33165498 + - X: -36644196 + Y: 32264400 + - X: -38425500 + Y: 32539796 + - X: -39543000 + Y: 31437096 + - X: -39343200 + Y: 26401796 + - X: -39343200 + Y: 26401796 + - X: -42936596 + Y: 25047298 + - X: -44091996 + Y: 24149298 + - X: -44322896 + Y: 22659398 + - X: -45142700 + Y: 19529100 + - X: -45142700 + Y: 19529100 + - X: -47167096 + Y: 23895398 + - X: -46979200 + Y: 27561398 + - X: -45453000 + Y: 31228900 + - X: -43462496 + Y: 35599300 + - X: -43462496 + Y: 35599300 + - X: -44298196 + Y: 36835900 + - X: -45261196 + Y: 38366200 + - X: -47017800 + Y: 38683800 + - X: -50234500 + Y: 36282300 + - X: -50234500 + Y: 36282300 + - X: -51242400 + Y: 39263200 + - X: -52052196 + Y: 40267496 + - X: -53378196 + Y: 38854500 + - X: -55934796 + Y: 34583896 + - X: -55934796 + Y: 34583896 + - X: -57545996 + Y: 39718400 + - X: -55375300 + Y: 43817396 + - X: -51572200 + Y: 46932896 + - X: -48286300 + Y: 49116896 + - X: -48286300 + Y: 49116896 + - X: -48674096 + Y: 49425696 + - X: -49929896 + Y: 49199800 + - X: -51794396 + Y: 48939600 + - X: -54007696 + Y: 49145500 + - X: -54007696 + Y: 49145500 + - X: -54619600 + Y: 50511400 + - X: -54890300 + Y: 52454900 + - X: -55967096 + Y: 52544500 + - X: -58997196 + Y: 48348900 + - X: -58997196 + Y: 48348900 + - X: -61488400 + Y: 52436400 + - X: -60849996 + Y: 57074500 + - X: -57650700 + Y: 60989800 + - X: -52459196 + Y: 62909096 + - X: -52459196 + Y: 62909096 + - X: -51759000 + Y: 64404096 + - X: -51258596 + Y: 66370200 + - X: -52423296 + Y: 67574304 + - X: -56718596 + Y: 66783400 + - X: -56718596 + Y: 66783400 + - X: -57300496 + Y: 66538000 + - X: -58364796 + Y: 65164900 + - X: -59931796 + Y: 62751196 + - X: -62021300 + Y: 59383796 + - X: -62021300 + Y: 59383796 + - X: -62356596 + Y: 61700400 + - X: -61699300 + Y: 66034196 + - X: -60450196 + Y: 70898000 + - X: -59010196 + Y: 74804600 + - X: -59010196 + Y: 74804600 + - X: -54870000 + Y: 76095096 + - X: -51912900 + Y: 76257104 + - X: -50138696 + Y: 75904200 + - X: -49547296 + Y: 75650200 + - X: -49547296 + Y: 75650200 + - X: -48615300 + Y: 76422800 + - X: -47180000 + Y: 78132800 + - X: -47282396 + Y: 79868296 + - X: -50963496 + Y: 80717496 + - X: -50963496 + Y: 80717496 + - X: -50409900 + Y: 82918504 + - X: -49172696 + Y: 85720104 + - X: -49371996 + Y: 87769600 + - X: -53127600 + Y: 87714096 + - X: -53127600 + Y: 87714096 + - X: -50386300 + Y: 91286400 + - X: -46233996 + Y: 92434904 + - X: -42443000 + Y: 92292904 + - X: -40785600 + Y: 91993696 + - X: -40785600 + Y: 91993696 + - X: -40549696 + Y: 92365200 + - X: -40221996 + Y: 93358800 + - X: -40372696 + Y: 94793192 + - X: -41572000 + Y: 96487200 + - X: -41572000 + Y: 96487200 + - X: -40587696 + Y: 98116304 + - X: -38592696 + Y: 99873600 + - X: -37871700 + Y: 101434192 + - X: -40709000 + Y: 102473096 + - X: -40709000 + Y: 102473096 + - X: -36820296 + Y: 104457496 + - X: -33224698 + Y: 104550000 + - X: -30582698 + Y: 103820696 + - X: -29555296 + Y: 103339800 + - X: -29555296 + Y: 103339800 + - X: -28853198 + Y: 103458592 + - X: -27992696 + Y: 104168104 + - X: -28842496 + Y: 105997800 + - X: -33271198 + Y: 109477400 + - X: -33271198 + Y: 109477400 + - X: -28534898 + Y: 111245000 + - X: -23670898 + Y: 110694000 + - X: -19875298 + Y: 109289200 + - X: -18344398 + Y: 108495400 + - X: -18344398 + Y: 108495400 + - X: -17212898 + Y: 109008904 + - X: -15219498 + Y: 110767696 + - X: -14465498 + Y: 114099200 + - X: -17052498 + Y: 119331000 + - X: -17052498 + Y: 119331000 + - X: -12105098 + Y: 119241400 + - X: -7112097 + Y: 115413000 + - X: -3252098 + Y: 110886296 + - X: -1703597 + Y: 108701800 + - X: -1703597 + Y: 108701800 + - X: 192002 + Y: 110581400 + - X: 4758402 + Y: 114663600 + - X: 10315402 + Y: 118613888 + - X: 15182803 + Y: 120097600 + - X: 15182803 + Y: 120097600 + - X: 10761402 + Y: 113644496 + - X: 10690702 + Y: 110168296 + - X: 12477002 + Y: 108753792 + - X: 13626602 + Y: 108485696 + - X: 13626602 + Y: 108485696 + - X: 14563602 + Y: 109799096 + - X: 17064902 + Y: 112616800 + - X: 20666304 + Y: 115255296 + - X: 24903302 + Y: 116030904 + - X: 24903302 + Y: 116030904 + - X: 22959304 + Y: 111653496 + - X: 25210802 + Y: 108907296 + - X: 28717702 + Y: 107484896 + - X: 30540002 + Y: 107079096 + - X: 30540002 + Y: 107079096 + - X: 31814902 + Y: 108190000 + - X: 34864000 + Y: 110627896 + - X: 38524004 + Y: 113050896 + - X: 41631704 + Y: 114117200 + - X: 41631704 + Y: 114117200 + - X: 39719204 + Y: 110318296 + - X: 40320900 + Y: 107597104 + - X: 41881200 + Y: 105913096 + - X: 42844600 + Y: 105225600 + - X: 42844600 + Y: 105225600 + - X: 44903404 + Y: 105989096 + - X: 47369304 + Y: 107437200 + - X: 50243400 + Y: 107632296 + - X: 53526904 + Y: 104636496 + m_CompositePaths: + m_Paths: + - - {x: 1.30861, y: -1.88055} + - {x: 1.18721, y: -1.62861} + - {x: 1.0408, y: -1.2970002} + - {x: 0.91511, y: -0.95794} + - {x: 0.85385, y: -0.63485} + - {x: 0.84492004, y: -0.2948} + - {x: 0.85034, y: 0.07453} + - {x: 0.83215, y: 0.48545} + - {x: 0.8246, y: 0.6688699} + - {x: 0.83004004, y: 0.85498} + - {x: 0.8378499, y: 1.03644} + - {x: 0.8374099, y: 1.2059001} + - {x: 0.82316, y: 1.42258} + - {x: 0.81639004, y: 1.615} + - {x: 0.8363999, y: 1.78565} + - {x: 0.90247, y: 1.93701} + - {x: 1.0656102, y: 2.0425603} + - {x: 1.1781, y: 2.14336} + - {x: 1.24321, y: 2.21888} + - {x: 1.26419, y: 2.24861} + - {x: 1.27064, y: 2.31219} + - {x: 1.3154, y: 2.4670703} + - {x: 1.43665, y: 2.65946} + - {x: 1.67252, y: 2.83557} + - {x: 1.85335, y: 2.9437} + - {x: 2.04345, y: 3.07924} + - {x: 2.25361, y: 3.22345} + - {x: 2.49458, y: 3.3575602} + - {x: 2.69993, y: 3.45} + - {x: 2.89128, y: 3.53323} + - {x: 3.06467, y: 3.61522} + - {x: 3.21616, y: 3.7039402} + - {x: 3.52282, y: 3.98953} + - {x: 3.5513926, y: 4.013279} + - {x: 3.6165805, y: 3.9518995} + - {x: 3.6903305, y: 3.86121} + - {x: 3.8909805, y: 3.81288} + - {x: 3.9430904, y: 3.6856802} + - {x: 3.9012206, y: 3.4909701} + - {x: 3.8199503, y: 3.24015} + - {x: 4.03679, y: 3.3401299} + - {x: 4.1628704, y: 3.5057797} + - {x: 4.26367, y: 3.6212301} + - {x: 4.4046702, y: 3.5705795} + - {x: 4.5511303, y: 3.54736} + - {x: 4.63554, y: 3.7202702} + - {x: 4.67423, y: 3.9362597} + - {x: 4.6835003, y: 4.0422697} + - {x: 4.72759, y: 4.02796} + - {x: 4.8203807, y: 3.96915} + - {x: 4.9026604, y: 3.84203} + - {x: 4.9152203, y: 3.62278} + - {x: 5.1754904, y: 3.49582} + - {x: 5.1326003, y: 3.32934} + - {x: 4.9801903, y: 3.1749597} + - {x: 4.9118605, y: 3.0843} + - {x: 5.0463004, y: 2.99019} + - {x: 5.2320204, y: 2.90276} + - {x: 5.39656, y: 2.8383398} + - {x: 5.4675107, y: 2.81324} + - {x: 5.5360203, y: 2.84976} + - {x: 5.69388, y: 2.9419298} + - {x: 5.8695703, y: 3.0636497} + - {x: 5.9915605, y: 3.1888402} + - {x: 5.9894404, y: 3.2326698} + - {x: 5.9489703, y: 3.2974796} + - {x: 5.87818, y: 3.38138} + - {x: 5.78512, y: 3.48251} + - {x: 5.94216, y: 3.5601} + - {x: 6.0996103, y: 3.51044} + - {x: 6.2209, y: 3.4183896} + - {x: 6.2694607, y: 3.3688498} + - {x: 6.2923403, y: 3.3985896} + - {x: 6.3309307, y: 3.4837701} + - {x: 6.3401804, y: 3.61836} + - {x: 6.27502, y: 3.7963} + - {x: 6.13067, y: 3.95878} + - {x: 5.96569, y: 4.0593596} + - {x: 5.83006, y: 4.11055} + - {x: 5.7737403, y: 4.12483} + - {x: 5.8043904, y: 4.21166} + - {x: 5.9037204, y: 4.3490095} + - {x: 6.0828404, y: 4.3521795} + - {x: 6.3528304, y: 4.03647} + - {x: 6.45196, y: 4.39067} + - {x: 6.5536003, y: 4.53846} + - {x: 6.6374903, y: 4.45685} + - {x: 6.68338, y: 4.1228} + - {x: 6.8540106, y: 4.37963} + - {x: 6.8929706, y: 4.7003503} + - {x: 6.7356, y: 5.0143795} + - {x: 6.31724, y: 5.25117} + - {x: 6.2805204, y: 5.4123} + - {x: 6.3439007, y: 5.41808} + - {x: 6.4350104, y: 5.3568096} + - {x: 6.48146, y: 5.3167696} + - {x: 6.4422503, y: 5.39571} + - {x: 6.3642, y: 5.56083} + - {x: 6.30664, y: 5.70458} + - {x: 6.3289104, y: 5.71937} + - {x: 6.5099, y: 5.7290897} + - {x: 6.5944004, y: 5.5756598} + - {x: 6.6369205, y: 5.3622303} + - {x: 6.6919303, y: 5.19194} + - {x: 6.7902703, y: 5.3802996} + - {x: 6.9096003, y: 5.3667397} + - {x: 7.0247107, y: 5.28894} + - {x: 7.1103706, y: 5.2845697} + - {x: 7.08678, y: 5.4284997} + - {x: 6.9943905, y: 5.61899} + - {x: 6.9884305, y: 5.72878} + - {x: 7.2241, y: 5.63059} + - {x: 7.23484, y: 5.85424} + - {x: 7.0638704, y: 5.96002} + - {x: 6.8309107, y: 6.0651097} + - {x: 6.6557007, y: 6.2867403} + - {x: 6.4146304, y: 6.3178196} + - {x: 6.4195004, y: 6.36435} + - {x: 6.5596805, y: 6.43811} + - {x: 6.7244906, y: 6.55086} + - {x: 6.79172, y: 6.64985} + - {x: 6.7230906, y: 6.6948} + - {x: 6.53382, y: 6.71615} + - {x: 6.23916, y: 6.7443295} + - {x: 6.36214, y: 6.88124} + - {x: 6.5128007, y: 6.9036} + - {x: 6.6404104, y: 6.87234} + - {x: 6.69422, y: 6.84838} + - {x: 6.7286, y: 6.9069295} + - {x: 6.8173103, y: 6.9898705} + - {x: 6.9387, y: 6.95815} + - {x: 7.0711102, y: 6.67271} + - {x: 7.1477504, y: 6.88756} + - {x: 7.1110907, y: 7.09702} + - {x: 7.0062904, y: 7.2758} + - {x: 6.8785095, y: 7.39866} + - {x: 6.8505106, y: 7.45633} + - {x: 6.8450704, y: 7.55768} + - {x: 6.93058, y: 7.6296306} + - {x: 7.1754103, y: 7.59912} + - {x: 7.0198503, y: 7.8550897} + - {x: 6.7399, y: 7.8724203} + - {x: 6.47194, y: 7.7847705} + - {x: 6.35232, y: 7.7258496} + - {x: 6.3060904, y: 7.7375097} + - {x: 6.2524204, y: 7.7861705} + - {x: 6.31885, y: 7.8923097} + - {x: 6.6329007, y: 8.076429} + - {x: 6.37759, y: 8.15193} + - {x: 6.10406, y: 8.14089} + - {x: 5.88595, y: 8.095799} + - {x: 5.7968802, y: 8.06911} + - {x: 5.9257, y: 8.2241} + - {x: 6.1382003, y: 8.568419} + - {x: 6.1734405, y: 8.92113} + - {x: 5.77046, y: 9.10127} + - {x: 5.7252307, y: 9.22911} + - {x: 5.7354302, y: 9.2865} + - {x: 5.8854704, y: 9.37207} + - {x: 6.2597504, y: 9.584459} + - {x: 5.8510103, y: 9.96111} + - {x: 5.3184304, y: 9.92988} + - {x: 4.8563504, y: 9.73329} + - {x: 4.65914, y: 9.61386} + - {x: 4.62899, y: 9.71925} + - {x: 4.6365304, y: 9.9657} + - {x: 4.82877, y: 10.24868} + - {x: 5.3526907, y: 10.46365} + - {x: 5.02434, y: 10.763229} + - {x: 4.7369304, y: 10.74372} + - {x: 4.49034, y: 10.598909} + - {x: 4.28446, y: 10.52256} + - {x: 4.18812, y: 10.59131} + - {x: 4.03209, y: 10.75971} + - {x: 3.9719205, y: 11.03183} + - {x: 4.1631703, y: 11.41172} + - {x: 3.8524005, y: 11.30509} + - {x: 3.4864001, y: 11.06279} + - {x: 3.1814902, y: 10.819} + - {x: 3.0540001, y: 10.70791} + - {x: 2.8717701, y: 10.748489} + - {x: 2.5210803, y: 10.89073} + - {x: 2.2959304, y: 11.16535} + - {x: 2.4903302, y: 11.60309} + - {x: 2.0666304, y: 11.52553} + - {x: 1.7064903, y: 11.261681} + - {x: 1.4563602, y: 10.97991} + - {x: 1.3626602, y: 10.84857} + - {x: 1.2477002, y: 10.87538} + - {x: 1.0690702, y: 11.0168295} + - {x: 1.0761402, y: 11.3644495} + - {x: 1.5182803, y: 12.00976} + - {x: 1.0315402, y: 11.861389} + - {x: 0.4758402, y: 11.46636} + - {x: 0.0192002, y: 11.05814} + - {x: -0.1703597, y: 10.87018} + - {x: -0.3252098, y: 11.08863} + - {x: -0.7112097, y: 11.5413} + - {x: -1.2105098, y: 11.92414} + - {x: -1.7052498, y: 11.9331} + - {x: -1.4465498, y: 11.40992} + - {x: -1.5219498, y: 11.07677} + - {x: -1.7212899, y: 10.90089} + - {x: -1.8344399, y: 10.84954} + - {x: -1.9875299, y: 10.92892} + - {x: -2.3670897, y: 11.0694} + - {x: -2.8534899, y: 11.1245} + - {x: -3.3271198, y: 10.947741} + - {x: -2.8842497, y: 10.59978} + - {x: -2.7992697, y: 10.416811} + - {x: -2.88532, y: 10.34586} + - {x: -2.9555297, y: 10.333981} + - {x: -3.0582697, y: 10.38207} + - {x: -3.32247, y: 10.455} + - {x: -3.6820297, y: 10.445749} + - {x: -4.0709, y: 10.24731} + - {x: -3.78717, y: 10.143419} + - {x: -3.8592696, y: 9.98736} + - {x: -4.0587697, y: 9.81163} + - {x: -4.1572, y: 9.64872} + - {x: -4.0372696, y: 9.47932} + - {x: -4.0221996, y: 9.33588} + - {x: -4.05497, y: 9.23652} + - {x: -4.07856, y: 9.199369} + - {x: -4.2443, y: 9.229291} + - {x: -4.6233997, y: 9.24349} + - {x: -5.03863, y: 9.12864} + - {x: -5.31276, y: 8.77141} + - {x: -4.9371996, y: 8.77696} + - {x: -4.9172697, y: 8.57201} + - {x: -5.04099, y: 8.29185} + - {x: -5.0963497, y: 8.07175} + - {x: -4.7282395, y: 7.9868298} + - {x: -4.718, y: 7.81328} + - {x: -4.86153, y: 7.64228} + - {x: -4.9547296, y: 7.56502} + - {x: -5.01387, y: 7.5904202} + - {x: -5.19129, y: 7.6257105} + - {x: -5.487, y: 7.6095095} + - {x: -5.9010196, y: 7.48046} + - {x: -6.0450196, y: 7.0898} + - {x: -6.16993, y: 6.60342} + - {x: -6.2356596, y: 6.17004} + - {x: -6.20213, y: 5.93838} + - {x: -5.99318, y: 6.27512} + - {x: -5.8364797, y: 6.51649} + - {x: -5.7300496, y: 6.6538} + - {x: -5.6718597, y: 6.67834} + - {x: -5.2423296, y: 6.7574306} + - {x: -5.1258597, y: 6.63702} + - {x: -5.1759, y: 6.4404097} + - {x: -5.2459197, y: 6.29091} + - {x: -5.76507, y: 6.09898} + - {x: -6.0849996, y: 5.70745} + - {x: -6.14884, y: 5.24364} + - {x: -5.8997197, y: 4.83489} + - {x: -5.5967097, y: 5.25445} + - {x: -5.48903, y: 5.24549} + - {x: -5.46196, y: 5.05114} + - {x: -5.4007697, y: 4.91455} + - {x: -5.1794395, y: 4.89396} + - {x: -4.9929895, y: 4.91998} + - {x: -4.8674097, y: 4.9425697} + - {x: -4.82863, y: 4.9116898} + - {x: -5.15722, y: 4.6932898} + - {x: -5.53753, y: 4.3817396} + - {x: -5.7545996, y: 3.9718401} + - {x: -5.5934796, y: 3.4583898} + - {x: -5.3378196, y: 3.8854501} + - {x: -5.2052197, y: 4.0267496} + - {x: -5.12424, y: 3.92632} + - {x: -5.02345, y: 3.62823} + - {x: -4.70178, y: 3.86838} + - {x: -4.5261197, y: 3.83662} + - {x: -4.4298196, y: 3.68359} + - {x: -4.3462496, y: 3.55993} + - {x: -4.5453, y: 3.12289} + - {x: -4.69792, y: 2.7561398} + - {x: -4.7167096, y: 2.3895397} + - {x: -4.51427, y: 1.9529101} + - {x: -4.4322896, y: 2.2659397} + - {x: -4.4091997, y: 2.4149299} + - {x: -4.2936597, y: 2.5047297} + - {x: -3.93432, y: 2.6401796} + - {x: -3.9543002, y: 3.1437097} + - {x: -3.84255, y: 3.2539797} + - {x: -3.6644197, y: 3.22644} + - {x: -3.4852498, y: 3.3165498} + - {x: -3.3185797, y: 3.6107001} + - {x: -3.1623898, y: 3.85607} + - {x: -2.9883997, y: 3.90366} + - {x: -2.7682798, y: 3.6044497} + - {x: -2.6041698, y: 3.8516297} + - {x: -2.5727057, y: 3.9399972} + - {x: -2.55871, y: 3.8976} + - {x: -2.4629, y: 3.7576602} + - {x: -2.34351, y: 3.64414} + - {x: -2.2202601, y: 3.56443} + - {x: -2.0843, y: 3.52685} + - {x: -1.93937, y: 3.52264} + - {x: -1.82409, y: 3.53352} + - {x: -1.77708, y: 3.54121} + - {x: -1.67521, y: 3.48334} + - {x: -1.43705, y: 3.32499} + - {x: -1.16376, y: 3.08906} + - {x: -0.95652, y: 2.79842} + - {x: -0.82614, y: 2.49767} + - {x: -0.72431, y: 2.21223} + - {x: -0.66352, y: 1.9362301} + - {x: -0.65627, y: 1.66382} + - {x: -0.66352, y: 1.52021} + - {x: -0.66822, y: 1.36293} + - {x: -0.68064, y: 1.19016} + - {x: -0.71104, y: 1.00007} + - {x: -0.76428, y: 0.79808} + - {x: -0.82777, y: 0.59984} + - {x: -0.88349, y: 0.42842} + - {x: -0.91342, y: 0.30692} + - {x: -0.98024, y: -0.12525} + - {x: -1.06854, y: -0.60328} + - {x: -1.14555, y: -0.99038} + - {x: -1.1785, y: -1.14981} + - {x: -1.51457, y: -1.9126201} + - {x: 1.3592402, y: -1.98058} + - - {x: 1.15838, y: 3.79652} + - {x: 1.15891, y: 3.82494} + - {x: 1.1612, y: 3.89435} + - {x: 1.16627, y: 3.98099} + - {x: 1.17512, y: 4.06108} + - {x: 1.2087802, y: 4.17203} + - {x: 1.26993, y: 4.33702} + - {x: 1.2787883, y: 4.3617806} + - {x: 1.4229404, y: 4.20671} + - {x: 1.5775602, y: 4.4891396} + - {x: 1.7390202, y: 4.6411695} + - {x: 1.9183803, y: 4.7038603} + - {x: 2.0193107, y: 4.710858} + - {x: 1.99737, y: 4.67211} + - {x: 1.95797, y: 4.57515} + - {x: 1.9258, y: 4.46981} + - {x: 1.8859, y: 4.36773} + - {x: 1.82336, y: 4.28055} + - {x: 1.61085, y: 4.06734} + - {x: 1.46142, y: 3.90428} + - {x: 1.37316, y: 3.80006} + - {x: 1.34416, y: 3.76339} + - - {x: 1.82514, y: 3.62554} + - {x: 1.9121001, y: 3.71337} + - {x: 2.03168, y: 3.845} + - {x: 2.16311, y: 4.00834} + - {x: 2.24425, y: 4.13729} + - {x: 2.31304, y: 4.27313} + - {x: 2.38302, y: 4.40931} + - {x: 2.4159374, y: 4.4598274} + - {x: 2.5937603, y: 4.5952997} + - {x: 2.9367301, y: 4.40217} + - {x: 3.1942103, y: 4.51931} + - {x: 3.1961102, y: 4.36436} + - {x: 3.1407835, y: 4.1949315} + - {x: 3.08606, y: 4.14861} + - {x: 3.0357502, y: 4.11335} + - {x: 2.96842, y: 4.0708} + - {x: 2.88942, y: 4.02926} + - {x: 2.80409, y: 3.99704} + - {x: 2.74981, y: 3.98915} + - {x: 2.69645, y: 3.9899302} + - {x: 2.64528, y: 3.98951} + - {x: 2.59753, y: 3.9779902} + - {x: 2.3026001, y: 3.84251} + - {x: 2.04432, y: 3.71875} + - {x: 1.86115, y: 3.6285} + - {x: 1.79154, y: 3.59357} + - - {x: 0.41903, y: 4.0602503} + - {x: 0.42908, y: 4.10228} + - {x: 0.4501, y: 4.20424} + - {x: 0.4684, y: 4.32995} + - {x: 0.4688049, y: 4.3544803} + - {x: 0.5793202, y: 4.3960695} + - {x: 0.8275243, y: 4.489064} + - {x: 0.8225, y: 4.42996} + - {x: 0.81181, y: 4.31027} + - {x: 0.79007, y: 4.18274} + - {x: 0.74907, y: 4.06666} + - {x: 0.68429, y: 3.97576} + - {x: 0.6126, y: 3.91365} + - {x: 0.55453, y: 3.87806} + - {x: 0.53061, y: 3.8667} + - - {x: -0.69092, y: 3.57328} + - {x: -0.87801003, y: 3.69178} + - {x: -1.09309, y: 3.8494} + - {x: -1.25701, y: 4.01351} + - {x: -1.3018, y: 4.06892} + - {x: -1.3526701, y: 4.15224} + - {x: -1.3799701, y: 4.27281} + - {x: -1.3540602, y: 4.43994} + - {x: -1.361107, y: 4.4580207} + - {x: -1.2135597, y: 4.44265} + - {x: -1.0708119, y: 4.335555} + - {x: -1.02479, y: 4.22952} + - {x: -0.97351, y: 4.15206} + - {x: -0.9117, y: 4.08876} + - {x: -0.84944004, y: 4.02853} + - {x: -0.79677004, y: 3.9602501} + - {x: -0.71479, y: 3.8020601} + - {x: -0.65681, y: 3.6630201} + - {x: -0.62235, y: 3.56415} + - {x: -0.61097, y: 3.52652} + - - {x: -0.20596, y: 3.7745001} + - {x: -0.21316001, y: 3.80037} + - {x: -0.23526001, y: 3.86713} + - {x: -0.27297, y: 3.9584901} + - {x: -0.32701, y: 4.05818} + - {x: -0.3738, y: 4.11414} + - {x: -0.42709002, y: 4.16381} + - {x: -0.47711, y: 4.22039} + - {x: -0.51412, y: 4.29709} + - {x: -0.5394849, y: 4.428718} + - {x: -0.31937972, y: 4.42514} + - {x: -0.0276097, y: 4.30999} + - {x: 0.0387039, y: 4.3016686} + - {x: 0.03482, y: 4.24525} + - {x: 0.00641, y: 4.11975} + - {x: -0.024120001, y: 4.01835} + - {x: -0.03839, y: 3.97665} + - {x: 0.04144, y: 3.53247} + - - {x: -2.05352, y: 3.9288} + - {x: -2.1161501, y: 3.973} + - {x: -2.2004201, y: 4.07723} + - {x: -2.26795, y: 4.22291} + - {x: -2.2732465, y: 4.295081} + - {x: -1.9670699, y: 4.38508} + - {x: -1.8272076, y: 4.4223585} + - {x: -1.79516, y: 4.3721} + - {x: -1.74166, y: 4.22471} + - {x: -1.73502, y: 4.08752} + - {x: -1.74974, y: 3.9863} + - {x: -1.7603201, y: 3.94683} + - {x: -1.78528, y: 3.93974} + - {x: -1.85133, y: 3.92641} + - {x: -1.94517, y: 3.91878} + m_VertexDistance: 0.0005 +--- !u!50 &1192624869 +Rigidbody2D: + serializedVersion: 4 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1192624865} + m_BodyType: 0 + m_Simulated: 1 + m_UseFullKinematicContacts: 0 + m_UseAutoMass: 0 + m_Mass: 1 + m_LinearDrag: 0 + m_AngularDrag: 0.05 + m_GravityScale: 1 + m_Material: {fileID: 0} + m_Interpolate: 0 + m_SleepingMode: 1 + m_CollisionDetection: 0 + m_Constraints: 0 +--- !u!1971053207 &1192624870 +SpriteShapeRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1192624865} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 4294967295 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: -47 + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_MaskInteraction: 0 + m_ShapeTexture: {fileID: 2800000, guid: a94adaf94669646788de8f639270804a, type: 3} + m_Sprites: [] + m_LocalAABB: + m_Center: {x: 0.61055565, y: 1.7089672, z: 0} + m_Extent: {x: 3.768011, y: 3.6895504, z: 0} +--- !u!114 &1192624871 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1192624865} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 90539df1cd5704abcb25fec9f3f5f84b, type: 3} + m_Name: + m_EditorClassIdentifier: + m_LegacyGenerator: 0 + m_Spline: + m_IsOpenEnded: 0 + m_ControlPoints: + - position: {x: 3.2161665, y: 3.7039447, z: 0} + leftTangent: {x: 0.29637432, y: 0.3156371, z: 0} + rightTangent: {x: -0.18563461, y: -0.12632513, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 2.4945831, y: 3.3575697, z: 0} + leftTangent: {x: 0.28138256, y: 0.13293266, z: 0} + rightTangent: {x: -0.34662533, y: -0.16375494, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.6725292, y: 2.835577, z: 0} + leftTangent: {x: 0.23968983, y: 0.117557526, z: 0} + rightTangent: {x: -0.40787888, y: -0.20004654, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.2641973, y: 2.2486148, z: 0} + leftTangent: {x: 0.21426773, y: 0.30344486, z: 0} + rightTangent: {x: -0.013861656, y: -0.019630432, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.9024763, y: 1.9370184, z: 0} + leftTangent: {x: 0.25271893, y: 0.13478279, z: 0} + rightTangent: {x: -0.1273861, y: -0.19007063, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.83741856, y: 1.205905, z: 0} + leftTangent: {x: -0.01540947, y: 0.30619144, z: 0} + rightTangent: {x: 0.010803223, y: -0.21466827, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.8321533, y: 0.48545122, z: 0} + leftTangent: {x: -0.023444176, y: 0.23949337, z: 0} + rightTangent: {x: 0.05688286, y: -0.58109426, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.91511345, y: -0.9579406, z: 0} + leftTangent: {x: -0.1334362, y: 0.42494583, z: 0} + rightTangent: {x: 0.1334362, y: -0.42494583, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.3592415, y: -1.9805832, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.5145779, y: -1.9126239, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.178504, y: -1.1498156, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.91342354, y: 0.3069253, z: 0} + leftTangent: {x: -0.06021799, y: -0.48489377, z: -0} + rightTangent: {x: 0.014711857, y: 0.11846447, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.711041, y: 1.000072, z: 0} + leftTangent: {x: -0.05616665, y: -0.261549, z: 0} + rightTangent: {x: 0.0570817, y: 0.2658105, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.6562767, y: 1.6638246, z: 0} + leftTangent: {x: -0.015919685, y: -0.1831832, z: 0} + rightTangent: {x: 0.031583786, y: 0.36343002, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.95652676, y: 2.7984266, z: 0} + leftTangent: {x: 0.1873169, y: -0.41380215, z: 0} + rightTangent: {x: -0.1873169, y: 0.41380262, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.7770863, y: 3.541214, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -2.220262, y: 3.564436, z: 0} + leftTangent: {x: 0.15812826, y: -0.080470085, z: -0} + rightTangent: {x: -0.15812826, y: 0.080470085, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -2.6112013, y: 4.05661, z: 0} + leftTangent: {x: 0.032327175, y: -0.22142982, z: 0} + rightTangent: {x: -0.206254, y: 0.21478653, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -3.0591974, y: 4.336563, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -3.1574554, y: 4.5612955, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -2.7904515, y: 4.7113476, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -2.2803297, y: 4.391474, z: 0} + leftTangent: {x: -0.16483545, y: 0.27308178, z: 0} + rightTangent: {x: -0.037330627, y: -0.23173237, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -2.0535293, y: 3.9288006, z: 0} + leftTangent: {x: -0.051990986, y: 0.01066494, z: 0} + rightTangent: {x: 0.14825106, y: -0.03041172, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.7603226, y: 3.9468374, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.7951679, y: 4.372101, z: 0} + leftTangent: {x: 0.113922596, y: -0.19186401, z: 0} + rightTangent: {x: -0.113922596, y: 0.19186401, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -2.236267, y: 5.0282946, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.6668215, y: 5.157666, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.3540664, y: 4.439948, z: 0} + leftTangent: {x: -0.108444214, y: 0.30963707, z: 0} + rightTangent: {x: -0.0831933, y: -0.2580328, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.2570138, y: 4.0135155, z: 0} + leftTangent: {x: -0.042501926, y: 0.059401512, z: 0} + rightTangent: {x: 0.14927785, y: -0.20863414, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.61097145, y: 3.5265284, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.79677916, y: 3.9602566, z: 0} + leftTangent: {x: 0.12550545, y: -0.21432257, z: 0} + rightTangent: {x: -0.05933857, y: 0.101331234, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.024796, y: 4.2295275, z: 0} + leftTangent: {x: 0.056889057, y: -0.11766052, z: 0} + rightTangent: {x: -0.18988562, y: 0.3927288, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.2740116, y: 5.2245064, z: 0} + leftTangent: {x: -0.0698576, y: -0.17230129, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.58708763, y: 5.3985176, z: 0} + leftTangent: {x: -0.19785118, y: -0.041404724, z: 0} + rightTangent: {x: 0.021735191, y: -0.43342495, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.5141282, y: 4.297098, z: 0} + leftTangent: {x: -0.087246895, y: 0.29190826, z: 0} + rightTangent: {x: 0.03632927, y: -0.12154961, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.32701302, y: 4.0581894, z: 0} + leftTangent: {x: -0.053714752, y: 0.08466339, z: 0} + rightTangent: {x: 0.08326244, y: -0.1312356, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.20596313, y: 3.7745, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.041446686, y: 3.5324764, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.038399696, y: 3.9766502, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.042672634, y: 4.3592806, z: 0} + leftTangent: {x: 0.011422487, y: -0.12856482, z: -0} + rightTangent: {x: -0.011422487, y: 0.12856482, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.24588203, y: 5.0692883, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.2021923, y: 5.1523314, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.47027874, y: 4.4432325, z: 0} + leftTangent: {x: -0.01453297, y: 0.12667656, z: -0} + rightTangent: {x: 0.01453297, y: -0.12667656, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.41903877, y: 4.060259, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.53061104, y: 3.866706, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.7490721, y: 4.0666647, z: 0} + leftTangent: {x: -0.07262421, y: -0.14140224, z: 0} + rightTangent: {x: 0.07117653, y: 0.13858509, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.83037186, y: 4.522544, z: 0} + leftTangent: {x: -0.012257576, y: -0.09680939, z: 0} + rightTangent: {x: 0.024763772, y: 0.19558822, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.969573, y: 5.026411, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.4917965, y: 5.0735054, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.3690004, y: 4.648546, z: 0} + leftTangent: {x: 0.020481981, y: 0.13927653, z: -0} + rightTangent: {x: -0.020481981, y: -0.13927653, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.175128, y: 4.061081, z: 0} + leftTangent: {x: 0.0147908535, y: 0.09184909, z: 0} + rightTangent: {x: -0.0147908535, y: -0.09184909, z: -0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.1583805, y: 3.7965221, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.3441639, y: 3.7633934, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.8233624, y: 4.280553, z: 0} + leftTangent: {x: -0.32624054, y: -0.31383038, z: 0} + rightTangent: {x: 0.10512543, y: 0.10112572, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.9973726, y: 4.6721106, z: 0} + leftTangent: {x: -0.06396866, y: -0.1184988, z: 0} + rightTangent: {x: 0.13454914, y: 0.24924564, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 2.2609882, y: 5.106245, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 2.8487377, y: 4.85763, z: 0} + leftTangent: {x: -0.18434525, y: 0.09165478, z: 0} + rightTangent: {x: -0.023777962, y: -0.08772373, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 2.4676914, y: 4.539255, z: 0} + leftTangent: {x: 0.10719395, y: 0.13840485, z: 0} + rightTangent: {x: -0.12870502, y: -0.16617966, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 2.1631107, y: 4.0083466, z: 0} + leftTangent: {x: 0.12242985, y: 0.16440964, z: 0} + rightTangent: {x: -0.17392349, y: -0.23356056, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.7915497, y: 3.5935783, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 2.5975342, y: 3.977995, z: 0} + leftTangent: {x: -0.40057755, y: -0.17875051, z: 0} + rightTangent: {x: 0.060819626, y: 0.027139664, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 2.8040981, y: 3.9970493, z: 0} + leftTangent: {x: -0.07244396, y: -0.020699501, z: 0} + rightTangent: {x: 0.11561108, y: 0.03303337, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 3.0860624, y: 4.148615, z: 0} + leftTangent: {x: -0.053355217, y: -0.038443565, z: 0} + rightTangent: {x: 0.30699492, y: 0.22119066, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 3.9016972, y: 4.94341, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 4.3785667, y: 4.67953, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + m_SpriteShape: {fileID: 11400000, guid: 8e3fa9c7ff3ad4112a30689e933384ed, type: 2} + m_FillPixelPerUnit: 100 + m_StretchTiling: 1 + m_SplineDetail: 4 + m_AdaptiveUV: 1 + m_StretchUV: 0 + m_WorldSpaceUV: 0 + m_ColliderDetail: 4 + m_ColliderOffset: 0 + m_UpdateCollider: 0 + m_OptimizeCollider: 1 +--- !u!4 &1192624872 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1192624865} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 22.6, y: 16.98, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2093986028} + m_Father: {fileID: 0} + m_RootOrder: 9 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1198078828 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1198078835} + - component: {fileID: 1198078834} + - component: {fileID: 1198078833} + - component: {fileID: 1198078832} + - component: {fileID: 1198078831} + - component: {fileID: 1198078830} + - component: {fileID: 1198078829} + m_Layer: 0 + m_Name: Tree (Package) (Geometry Collider) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1198078829 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1198078828} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e0ecd6fe4dd55d640bd7ef3235e0e425, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UpdateCollider: 0 +--- !u!60 &1198078830 +PolygonCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1198078828} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 1 + m_Offset: {x: 0, y: 0} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0, y: 0} + oldSize: {x: 0, y: 0} + newSize: {x: 0, y: 0} + adaptiveTilingThreshold: 0 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + m_Points: + m_Paths: + - - {x: 4.143064, y: 4.496742} + - {x: 3.6492512, y: 4.0971575} + - {x: 3.2161665, y: 3.7039447} + - {x: 3.0091143, y: 3.5875397} + - {x: 2.4945831, y: 3.3575697} + - {x: 2.1806664, y: 3.1755822} + - {x: 1.9151552, y: 2.9867663} + - {x: 1.6725292, y: 2.835577} + - {x: 1.3853858, y: 2.5944917} + - {x: 1.2794213, y: 2.3563356} + - {x: 1.2641973, y: 2.2486148} + - {x: 1.1085753, y: 2.077706} + - {x: 0.9024763, y: 1.9370184} + - {x: 0.82556903, y: 1.7310371} + - {x: 0.81912863, y: 1.4893} + - {x: 0.83741856, y: 1.205905} + - {x: 0.8254995, y: 0.73097295} + - {x: 0.84929025, y: -0.052593216} + - {x: 0.84694093, y: -0.52399516} + - {x: 0.91511345, y: -0.9579406} + - {x: 1.0895627, y: -1.4119349} + - {x: 1.3592415, y: -1.9805832} + - {x: -1.5145779, y: -1.9126239} + - {x: -1.178504, y: -1.1498156} + - {x: -1.0089116, y: -0.28625655} + - {x: -0.91342354, y: 0.3069253} + - {x: -0.7852041, y: 0.7304487} + - {x: -0.711041, y: 1.000072} + - {x: -0.6750108, y: 1.2495863} + - {x: -0.6562767, y: 1.6638246} + - {x: -0.678456, y: 2.0275488} + - {x: -0.7884136, y: 2.4011207} + - {x: -0.95652676, y: 2.7984266} + - {x: -1.2525163, y: 3.174913} + - {x: -1.6059747, y: 3.4405956} + - {x: -1.7770863, y: 3.541214} + - {x: -2.0350854, y: 3.5226512} + - {x: -2.220262, y: 3.564436} + - {x: -2.384712, y: 3.678594} + - {x: -2.5306187, y: 3.8484783} + - {x: -2.6112013, y: 4.05661} + - {x: -2.8190165, y: 4.224651} + - {x: -3.0591974, y: 4.336563} + - {x: -3.1574554, y: 4.5612955} + - {x: -2.7904515, y: 4.7113476} + - {x: -2.6948276, y: 4.689101} + - {x: -2.4858437, y: 4.5957737} + - {x: -2.2803297, y: 4.391474} + - {x: -2.2496743, y: 4.170899} + - {x: -2.143732, y: 4.0019965} + - {x: -2.0535293, y: 3.9288006} + - {x: -1.911623, y: 3.9199603} + - {x: -1.7603226, y: 3.9468374} + - {x: -1.7355018, y: 4.1765747} + - {x: -1.7951679, y: 4.372101} + - {x: -2.236267, y: 5.0282946} + - {x: -1.6668215, y: 5.157666} + - {x: -1.4833484, y: 4.7636395} + - {x: -1.3540664, y: 4.439948} + - {x: -1.3753241, y: 4.22791} + - {x: -1.3195527, y: 4.093132} + - {x: -1.2570138, y: 4.0135155} + - {x: -1.0231755, y: 3.7945328} + - {x: -0.74529105, y: 3.606421} + - {x: -0.61097145, y: 3.5265284} + - {x: -0.69282657, y: 3.7525542} + - {x: -0.79677916, y: 3.9602566} + - {x: -0.9535828, y: 4.129941} + - {x: -1.024796, y: 4.2295275} + - {x: -1.1893249, y: 4.623741} + - {x: -1.2826447, y: 4.9772434} + - {x: -1.2740116, y: 5.2245064} + - {x: -0.58708763, y: 5.3985176} + - {x: -0.56699, y: 4.6160717} + - {x: -0.5141282, y: 4.297098} + - {x: -0.46140712, y: 4.1999507} + - {x: -0.32701302, y: 4.0581894} + - {x: -0.20596313, y: 3.7745} + - {x: 0.041446686, y: 3.5324764} + - {x: -0.038399696, y: 3.9766502} + - {x: 0.026730545, y: 4.20294} + - {x: 0.042672634, y: 4.3592806} + - {x: -0.037214503, y: 4.600496} + - {x: -0.24588203, y: 5.0692883} + - {x: 0.2021923, y: 5.1523314} + - {x: 0.39431575, y: 4.6833735} + - {x: 0.47027874, y: 4.4432325} + - {x: 0.46345338, y: 4.2876425} + - {x: 0.41903877, y: 4.060259} + - {x: 0.53061104, y: 3.866706} + - {x: 0.6601566, y: 3.9519782} + - {x: 0.7490721, y: 4.0666647} + - {x: 0.7990598, y: 4.224935} + - {x: 0.83037186, y: 4.522544} + - {x: 0.8774671, y: 4.7401037} + - {x: 0.969573, y: 5.026411} + - {x: 1.4917965, y: 5.0735054} + - {x: 1.4099395, y: 4.8206215} + - {x: 1.312921, y: 4.45475} + - {x: 1.175128, y: 4.061081} + - {x: 1.1583805, y: 3.7965221} + - {x: 1.3441639, y: 3.7633934} + - {x: 1.55413, y: 4.0069942} + - {x: 1.8233624, y: 4.280553} + - {x: 1.9009831, y: 4.4006796} + - {x: 1.9973726, y: 4.6721106} + - {x: 2.2609882, y: 5.106245} + - {x: 2.6144269, y: 4.962821} + - {x: 2.8487377, y: 4.85763} + - {x: 2.7632008, y: 4.7668557} + - {x: 2.608839, y: 4.6638155} + - {x: 2.4676914, y: 4.539255} + - {x: 2.3587303, y: 4.3642893} + - {x: 2.267888, y: 4.182132} + - {x: 2.1631107, y: 4.0083466} + - {x: 1.9894805, y: 3.797009} + - {x: 1.7915497, y: 3.5935783} + - {x: 2.2105408, y: 3.7988868} + - {x: 2.5975342, y: 3.977995} + - {x: 2.8040981, y: 3.9970493} + - {x: 3.0149384, y: 4.099575} + - {x: 3.0860624, y: 4.148615} + - {x: 3.4339652, y: 4.4529796} + - {x: 3.7584574, y: 4.786505} + - {x: 3.9016972, y: 4.94341} + - {x: 4.3785667, y: 4.67953} +--- !u!66 &1198078831 +CompositeCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1198078828} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: 0} + m_GeometryType: 0 + m_GenerationType: 0 + m_EdgeRadius: 0 + m_ColliderPaths: + - m_Collider: {fileID: 53245461} + m_ColliderPaths: + - - X: 51060928 + Y: 29594918 + - X: 49118644 + Y: 30842996 + - X: 50312156 + Y: 32218832 + - X: 51853188 + Y: 34421672 + - X: 49152220 + Y: 36227732 + - X: 48800564 + Y: 38934596 + - X: 47560328 + Y: 40144700 + - X: 46835020 + Y: 40422612 + - X: 46654116 + Y: 38689176 + - X: 45853604 + Y: 35907556 + - X: 44046756 + Y: 35705792 + - X: 42288464 + Y: 35954688 + - X: 40856744 + Y: 33937620 + - X: 38199512 + Y: 32401500 + - X: 39222512 + Y: 35626684 + - X: 39221676 + Y: 37786804 + - X: 36903344 + Y: 38612012 + - X: 35903744 + Y: 39842364 + - X: 34338236 + Y: 40591636 + - X: 31159916 + Y: 39300364 + - X: 31396918 + Y: 41953040 + - X: 32148142 + Y: 44893480 + - X: 29367354 + Y: 44021644 + - X: 25189484 + Y: 45660504 + - X: 23237308 + Y: 43645312 + - X: 21266664 + Y: 47182952 + - X: 18559280 + Y: 46903504 + - X: 16300776 + Y: 45522700 + - X: 14229434 + Y: 42067052 + - X: 10702956 + Y: 45175188 + - X: 6821971 + Y: 44408888 + - X: 2560005 + Y: 42743980 + - X: -1255308 + Y: 43489288 + - X: -5027568 + Y: 44521068 + - X: -8004162 + Y: 41326820 + - X: -13449923 + Y: 44795332 + - X: -18464412 + Y: 44249068 + - X: -23219042 + Y: 42807732 + - X: -24921070 + Y: 41610752 + - X: -25739790 + Y: 39250864 + - X: -27682888 + Y: 36044444 + - X: -30501256 + Y: 39189676 + - X: -32667520 + Y: 37052604 + - X: -34852592 + Y: 33165402 + - X: -37271432 + Y: 32351552 + - X: -39284664 + Y: 32115422 + - X: -39343272 + Y: 26401720 + - X: -43517900 + Y: 24748988 + - X: -44255268 + Y: 23286486 + - X: -45142736 + Y: 19529076 + - X: -47307128 + Y: 25160484 + - X: -46056568 + Y: 29962882 + - X: -43462532 + Y: 35599236 + - X: -44572224 + Y: 37387752 + - X: -46302988 + Y: 38805652 + - X: -50234548 + Y: 36282204 + - X: -51499060 + Y: 39839324 + - X: -52834776 + Y: 39621172 + - X: -55934848 + Y: 34583828 + - X: -57136556 + Y: 41197216 + - X: -52888636 + Y: 46000404 + - X: -48286380 + Y: 49116888 + - X: -49009096 + Y: 49385004 + - X: -51121332 + Y: 48999192 + - X: -54007788 + Y: 49145440 + - X: -54691076 + Y: 51215084 + - X: -55447828 + Y: 52870628 + - X: -58997280 + Y: 48348876 + - X: -61595252 + Y: 53984108 + - X: -58966584 + Y: 59843556 + - X: -52459200 + Y: 62909040 + - X: -51497660 + Y: 65067992 + - X: -51759620 + Y: 67333696 + - X: -56718692 + Y: 66783332 + - X: -57600676 + Y: 66201272 + - X: -59352444 + Y: 63665968 + - X: -62021380 + Y: 59383744 + - X: -62227992 + Y: 62994284 + - X: -60907636 + Y: 69309624 + - X: -59010220 + Y: 74804648 + - X: -53752884 + Y: 76244272 + - X: -50598692 + Y: 76041240 + - X: -49547356 + Y: 75650288 + - X: -48092064 + Y: 76933744 + - X: -46951488 + Y: 79343256 + - X: -50963584 + Y: 80717528 + - X: -49968816 + Y: 83852520 + - X: -49015164 + Y: 87253560 + - X: -53127640 + Y: 87714136 + - X: -49071492 + Y: 91882600 + - X: -43557216 + Y: 92413696 + - X: -40785608 + Y: 91993760 + - X: -40422520 + Y: 92636272 + - X: -40234204 + Y: 94277328 + - X: -41572048 + Y: 96487216 + - X: -39922208 + Y: 98703936 + - X: -37829536 + Y: 100955984 + - X: -40709068 + Y: 102473192 + - X: -35556612 + Y: 104645752 + - X: -31316662 + Y: 104089088 + - X: -29555320 + Y: 103339824 + - X: -28491728 + Y: 103603336 + - X: -28253912 + Y: 105230768 + - X: -33271276 + Y: 109477408 + - X: -26868686 + Y: 111246616 + - X: -20948016 + Y: 109761944 + - X: -18344422 + Y: 108495480 + - X: -16540461 + Y: 109440664 + - X: -14449428 + Y: 112793752 + - X: -17052552 + Y: 119331056 + - X: -10387683 + Y: 118230568 + - X: -4340207 + Y: 112285176 + - X: -1703608 + Y: 108701824 + - X: 1500296 + Y: 111812704 + - X: 8456748 + Y: 117455984 + - X: 15182850 + Y: 120097600 + - X: 10377660 + Y: 112200224 + - X: 11829269 + Y: 109052800 + - X: 13626690 + Y: 108485776 + - X: 15246532 + Y: 110654360 + - X: 19372298 + Y: 114499664 + - X: 24903338 + Y: 116030976 + - X: 23388900 + Y: 110572072 + - X: 27590776 + Y: 107830984 + - X: 30540046 + Y: 107079184 + - X: 32691584 + Y: 108921472 + - X: 37307960 + Y: 112327784 + - X: 41631792 + Y: 114117200 + - X: 39717288 + Y: 109293544 + - X: 41350624 + Y: 106361736 + - X: 42844696 + Y: 105225640 + - X: 45680092 + Y: 106491448 + - X: 49239976 + Y: 107826128 + - X: 53526972 + Y: 104636528 + - X: 47351016 + Y: 101567480 + - X: 46200608 + Y: 97908888 + - X: 46591436 + Y: 96138696 + - X: 49905504 + Y: 98022248 + - X: 56776496 + Y: 99840472 + - X: 62597524 + Y: 95844648 + - X: 58147148 + Y: 93343336 + - X: 57183076 + Y: 92512064 + - X: 57704628 + Y: 91012720 + - X: 61975032 + Y: 88138008 + - X: 60001296 + Y: 83267736 + - X: 57968844 + Y: 80691144 + - X: 59479528 + Y: 81113824 + - X: 62848044 + Y: 81552760 + - X: 66329020 + Y: 80764328 + - X: 62754940 + Y: 78492816 + - X: 62827360 + Y: 77486136 + - X: 63523264 + Y: 77258520 + - X: 65515192 + Y: 78174008 + - X: 69336240 + Y: 78807880 + - X: 71754168 + Y: 75991232 + - X: 68877552 + Y: 76134320 + - X: 68428176 + Y: 74888712 + - X: 68785136 + Y: 73986568 + - X: 70460112 + Y: 72211688 + - X: 71458944 + Y: 69592224 + - X: 70711168 + Y: 66727008 + - X: 68959464 + Y: 69900392 + - X: 67532072 + Y: 69387256 + - X: 66942224 + Y: 68483744 + - X: 66035684 + Y: 68849504 + - X: 64117920 + Y: 68984032 + - X: 62391644 + Y: 67443224 + - X: 66093744 + Y: 67097704 + - X: 67831904 + Y: 66693272 + - X: 67244936 + Y: 65508520 + - X: 63943924 + Y: 63310248 + - X: 66557024 + Y: 62867356 + - X: 69080664 + Y: 60229148 + - X: 71921304 + Y: 58968056 + - X: 72241024 + Y: 56305856 + - X: 69712392 + Y: 57090020 + - X: 70559648 + Y: 54931068 + - X: 71103744 + Y: 52845648 + - X: 69883664 + Y: 53135088 + - X: 68289616 + Y: 53914088 + - X: 66919384 + Y: 51919364 + - X: 65461008 + Y: 56909720 + - X: 63289156 + Y: 57193640 + - X: 63198856 + Y: 56656728 + - X: 64814616 + Y: 53167600 + - X: 64060292 + Y: 53792280 + - X: 62941056 + Y: 54271192 + - X: 63172456 + Y: 52511672 + - X: 68138704 + Y: 49147976 + - X: 68848296 + Y: 44829188 + - X: 66833800 + Y: 41228000 + - X: 66127504 + Y: 45109576 + - X: 64865628 + Y: 44639972 + - X: 63528384 + Y: 40364656 + - X: 60135928 + Y: 43774260 + - X: 58293248 + Y: 42609420 + - X: 57737436 + Y: 41248236 + - X: 58689252 + Y: 40981976 + - X: 60755044 + Y: 39985636 + - X: 62750264 + Y: 37962932 + - X: 63431436 + Y: 35683776 + - X: 63056868 + Y: 34211160 + - X: 62694656 + Y: 33688436 + - X: 61867496 + Y: 34485384 + - X: 59964048 + Y: 35534896 + - X: 57851276 + Y: 34825012 + - X: 59798188 + Y: 32520294 + - X: 59915648 + Y: 31888332 + - X: 58134424 + Y: 30213976 + - X: 54675148 + Y: 28132386 + - m_Collider: {fileID: 1198078830} + m_ColliderPaths: + - - X: 41430640 + Y: 44967416 + - X: 36492512 + Y: 40971576 + - X: 32161664 + Y: 37039448 + - X: 30091142 + Y: 35875396 + - X: 24945832 + Y: 33575696 + - X: 21806664 + Y: 31755822 + - X: 19151552 + Y: 29867664 + - X: 16725292 + Y: 28355770 + - X: 13853858 + Y: 25944918 + - X: 12794213 + Y: 23563356 + - X: 12641973 + Y: 22486148 + - X: 11085753 + Y: 20777060 + - X: 9024763 + Y: 19370184 + - X: 8255690 + Y: 17310372 + - X: 8191286 + Y: 14893000 + - X: 8374185 + Y: 12059050 + - X: 8254995 + Y: 7309729 + - X: 8492903 + Y: -525932 + - X: 8469409 + Y: -5239951 + - X: 9151134 + Y: -9579406 + - X: 10895627 + Y: -14119349 + - X: 13592415 + Y: -19805832 + - X: -15145779 + Y: -19126238 + - X: -11785040 + Y: -11498156 + - X: -10089116 + Y: -2862565 + - X: -9134235 + Y: 3069253 + - X: -7852041 + Y: 7304487 + - X: -7110409 + Y: 10000720 + - X: -6750108 + Y: 12495863 + - X: -6562767 + Y: 16638246 + - X: -6784560 + Y: 20275488 + - X: -7884136 + Y: 24011206 + - X: -9565268 + Y: 27984266 + - X: -12525163 + Y: 31749130 + - X: -16059747 + Y: 34405956 + - X: -17770862 + Y: 35412140 + - X: -20350854 + Y: 35226512 + - X: -22202620 + Y: 35644360 + - X: -23847120 + Y: 36785940 + - X: -25306186 + Y: 38484784 + - X: -26112012 + Y: 40566100 + - X: -28190164 + Y: 42246508 + - X: -30591974 + Y: 43365632 + - X: -31574554 + Y: 45612956 + - X: -27904516 + Y: 47113476 + - X: -26948276 + Y: 46891012 + - X: -24858436 + Y: 45957736 + - X: -22803298 + Y: 43914736 + - X: -22496744 + Y: 41708988 + - X: -21437320 + Y: 40019964 + - X: -20535292 + Y: 39288004 + - X: -19116230 + Y: 39199604 + - X: -17603226 + Y: 39468376 + - X: -17355018 + Y: 41765748 + - X: -17951680 + Y: 43721008 + - X: -22362670 + Y: 50282944 + - X: -16668215 + Y: 51576664 + - X: -14833484 + Y: 47636396 + - X: -13540664 + Y: 44399480 + - X: -13753241 + Y: 42279100 + - X: -13195527 + Y: 40931320 + - X: -12570138 + Y: 40135156 + - X: -10231755 + Y: 37945328 + - X: -7452910 + Y: 36064208 + - X: -6109714 + Y: 35265284 + - X: -6928265 + Y: 37525540 + - X: -7967791 + Y: 39602564 + - X: -9535828 + Y: 41299408 + - X: -10247960 + Y: 42295276 + - X: -11893249 + Y: 46237412 + - X: -12826447 + Y: 49772436 + - X: -12740116 + Y: 52245064 + - X: -5870876 + Y: 53985176 + - X: -5669900 + Y: 46160716 + - X: -5141282 + Y: 42970980 + - X: -4614071 + Y: 41999508 + - X: -3270130 + Y: 40581892 + - X: -2059631 + Y: 37745000 + - X: 414466 + Y: 35324764 + - X: -383996 + Y: 39766504 + - X: 267305 + Y: 42029400 + - X: 426726 + Y: 43592804 + - X: -372145 + Y: 46004960 + - X: -2458820 + Y: 50692884 + - X: 2021923 + Y: 51523312 + - X: 3943157 + Y: 46833736 + - X: 4702787 + Y: 44432324 + - X: 4634534 + Y: 42876424 + - X: 4190387 + Y: 40602588 + - X: 5306110 + Y: 38667060 + - X: 6601566 + Y: 39519784 + - X: 7490720 + Y: 40666648 + - X: 7990598 + Y: 42249352 + - X: 8303718 + Y: 45225440 + - X: 8774671 + Y: 47401036 + - X: 9695730 + Y: 50264112 + - X: 14917965 + Y: 50735056 + - X: 14099395 + Y: 48206216 + - X: 13129210 + Y: 44547500 + - X: 11751280 + Y: 40610808 + - X: 11583805 + Y: 37965220 + - X: 13441639 + Y: 37633936 + - X: 15541300 + Y: 40069944 + - X: 18233624 + Y: 42805528 + - X: 19009830 + Y: 44006796 + - X: 19973726 + Y: 46721104 + - X: 22609882 + Y: 51062452 + - X: 26144268 + Y: 49628212 + - X: 28487378 + Y: 48576296 + - X: 27632008 + Y: 47668556 + - X: 26088390 + Y: 46638156 + - X: 24676914 + Y: 45392552 + - X: 23587304 + Y: 43642892 + - X: 22678880 + Y: 41821316 + - X: 21631108 + Y: 40083464 + - X: 19894804 + Y: 37970088 + - X: 17915496 + Y: 35935784 + - X: 22105408 + Y: 37988868 + - X: 25975342 + Y: 39779948 + - X: 28040982 + Y: 39970492 + - X: 30149384 + Y: 40995752 + - X: 30860624 + Y: 41486148 + - X: 34339652 + Y: 44529796 + - X: 37584576 + Y: 47865052 + - X: 39016972 + Y: 49434100 + - X: 43785668 + Y: 46795300 + m_CompositePaths: + m_Paths: + - - {x: 1.0895627, y: -1.411935} + - {x: 0.9151134, y: -0.95794064} + - {x: 0.84694093, y: -0.5239951} + - {x: 0.8492903, y: -0.0525932} + - {x: 0.82549953, y: 0.7309729} + - {x: 0.8374185, y: 1.205905} + - {x: 0.81912863, y: 1.4893} + - {x: 0.82556903, y: 1.7310373} + - {x: 0.9024763, y: 1.9370184} + - {x: 1.1085753, y: 2.077706} + - {x: 1.2641973, y: 2.2486148} + - {x: 1.2794213, y: 2.3563356} + - {x: 1.3853859, y: 2.5944917} + - {x: 1.6725292, y: 2.835577} + - {x: 1.9151552, y: 2.9867663} + - {x: 2.1806664, y: 3.1755822} + - {x: 2.4945831, y: 3.3575697} + - {x: 3.0091143, y: 3.5875397} + - {x: 3.2161665, y: 3.703945} + - {x: 3.5474873, y: 4.0047626} + - {x: 3.5903745, y: 3.9842365} + - {x: 3.6903346, y: 3.8612013} + - {x: 3.9221675, y: 3.7786806} + - {x: 3.9222512, y: 3.5626683} + - {x: 3.8199513, y: 3.24015} + - {x: 4.0856743, y: 3.393762} + - {x: 4.2288465, y: 3.5954688} + - {x: 4.4046755, y: 3.5705793} + - {x: 4.5853605, y: 3.5907557} + - {x: 4.6654115, y: 3.8689177} + - {x: 4.683502, y: 4.042261} + - {x: 4.756033, y: 4.01447} + - {x: 4.8800564, y: 3.8934596} + - {x: 4.915222, y: 3.6227732} + - {x: 5.185319, y: 3.4421673} + - {x: 5.0312157, y: 3.2218833} + - {x: 4.9118643, y: 3.0842996} + - {x: 5.106093, y: 2.9594917} + - {x: 5.467515, y: 2.8132386} + - {x: 5.813442, y: 3.0213976} + - {x: 5.9915648, y: 3.1888332} + - {x: 5.979819, y: 3.2520294} + - {x: 5.7851276, y: 3.4825013} + - {x: 5.9964046, y: 3.5534897} + - {x: 6.1867495, y: 3.4485385} + - {x: 6.2694654, y: 3.3688436} + - {x: 6.305687, y: 3.421116} + - {x: 6.3431435, y: 3.5683777} + - {x: 6.2750263, y: 3.7962933} + - {x: 6.0755043, y: 3.9985635} + - {x: 5.868925, y: 4.0981975} + - {x: 5.7737436, y: 4.1248236} + - {x: 5.8293247, y: 4.260942} + - {x: 6.0135927, y: 4.377426} + - {x: 6.3528385, y: 4.0364656} + - {x: 6.4865627, y: 4.4639974} + - {x: 6.6127505, y: 4.5109577} + - {x: 6.68338, y: 4.1228} + - {x: 6.8848295, y: 4.4829187} + - {x: 6.8138704, y: 4.914798} + - {x: 6.3172455, y: 5.2511673} + - {x: 6.2941055, y: 5.4271193} + - {x: 6.406029, y: 5.379228} + - {x: 6.4814615, y: 5.31676} + - {x: 6.3198857, y: 5.665673} + - {x: 6.3289156, y: 5.719364} + - {x: 6.546101, y: 5.690972} + - {x: 6.6919384, y: 5.1919365} + - {x: 6.828962, y: 5.391409} + - {x: 6.9883666, y: 5.313509} + - {x: 7.1103745, y: 5.284565} + - {x: 7.055965, y: 5.493107} + - {x: 6.971239, y: 5.709002} + - {x: 7.2241025, y: 5.6305857} + - {x: 7.1921306, y: 5.896806} + - {x: 6.9080663, y: 6.022915} + - {x: 6.6557026, y: 6.2867355} + - {x: 6.3943925, y: 6.3310246} + - {x: 6.7244935, y: 6.5508523} + - {x: 6.7831903, y: 6.6693273} + - {x: 6.6093745, y: 6.7097707} + - {x: 6.2391644, y: 6.7443223} + - {x: 6.4117923, y: 6.898403} + - {x: 6.6035686, y: 6.8849506} + - {x: 6.6942225, y: 6.8483744} + - {x: 6.753207, y: 6.9387255} + - {x: 6.8959465, y: 6.9900393} + - {x: 7.071117, y: 6.672701} + - {x: 7.1458945, y: 6.9592223} + - {x: 7.0460114, y: 7.221169} + - {x: 6.878514, y: 7.398657} + - {x: 6.842818, y: 7.488871} + - {x: 6.8877554, y: 7.613432} + - {x: 7.175417, y: 7.5991235} + - {x: 6.9336243, y: 7.8807883} + - {x: 6.5515194, y: 7.817401} + - {x: 6.3523264, y: 7.725852} + - {x: 6.2827363, y: 7.748614} + - {x: 6.275494, y: 7.849282} + - {x: 6.632902, y: 8.076433} + - {x: 6.2848043, y: 8.155276} + - {x: 5.9479527, y: 8.1113825} + - {x: 5.7968845, y: 8.069115} + - {x: 6.0001297, y: 8.326774} + - {x: 6.197503, y: 8.813801} + - {x: 5.770463, y: 9.101273} + - {x: 5.7183075, y: 9.251206} + - {x: 5.814715, y: 9.334333} + - {x: 6.2597523, y: 9.584465} + - {x: 5.6776495, y: 9.984047} + - {x: 4.9905505, y: 9.802225} + - {x: 4.6591434, y: 9.61387} + - {x: 4.620061, y: 9.790889} + - {x: 4.7351017, y: 10.156748} + - {x: 5.3526974, y: 10.463653} + - {x: 4.923998, y: 10.782613} + - {x: 4.5680094, y: 10.649145} + - {x: 4.2844696, y: 10.522564} + - {x: 4.135062, y: 10.636173} + - {x: 3.9717288, y: 10.929355} + - {x: 4.1631794, y: 11.41172} + - {x: 3.730796, y: 11.232779} + - {x: 3.2691584, y: 10.892147} + - {x: 3.0540047, y: 10.707918} + - {x: 2.7590775, y: 10.783098} + - {x: 2.33889, y: 11.057207} + - {x: 2.4903338, y: 11.603098} + - {x: 1.9372299, y: 11.449966} + - {x: 1.5246532, y: 11.065436} + - {x: 1.362669, y: 10.8485775} + - {x: 1.1829269, y: 10.90528} + - {x: 1.037766, y: 11.220022} + - {x: 1.518285, y: 12.00976} + - {x: 0.8456748, y: 11.745599} + - {x: 0.1500296, y: 11.181271} + - {x: -0.1703608, y: 10.870183} + - {x: -0.4340207, y: 11.228518} + - {x: -1.0387683, y: 11.823057} + - {x: -1.7052553, y: 11.933105} + - {x: -1.4449428, y: 11.279375} + - {x: -1.6540462, y: 10.944067} + - {x: -1.8344423, y: 10.849548} + - {x: -2.0948017, y: 10.976194} + - {x: -2.6868687, y: 11.124661} + - {x: -3.3271277, y: 10.947741} + - {x: -2.8253913, y: 10.523077} + - {x: -2.8491728, y: 10.360333} + - {x: -2.955532, y: 10.333982} + - {x: -3.1316662, y: 10.408909} + - {x: -3.5556612, y: 10.464576} + - {x: -4.0709066, y: 10.247319} + - {x: -3.7829537, y: 10.095598} + - {x: -3.9922209, y: 9.870394} + - {x: -4.1572046, y: 9.648722} + - {x: -4.0234203, y: 9.427732} + - {x: -4.042252, y: 9.263627} + - {x: -4.078561, y: 9.199376} + - {x: -4.3557215, y: 9.241369} + - {x: -4.9071493, y: 9.18826} + - {x: -5.312764, y: 8.771414} + - {x: -4.9015164, y: 8.725356} + - {x: -4.9968815, y: 8.385252} + - {x: -5.0963583, y: 8.071753} + - {x: -4.695149, y: 7.9343257} + - {x: -4.8092065, y: 7.6933746} + - {x: -4.9547358, y: 7.5650287} + - {x: -5.0598693, y: 7.604124} + - {x: -5.3752885, y: 7.6244273} + - {x: -5.901022, y: 7.480465} + - {x: -6.0907636, y: 6.9309626} + - {x: -6.2227993, y: 6.2994285} + - {x: -6.202138, y: 5.9383745} + - {x: -5.9352446, y: 6.3665967} + - {x: -5.7600675, y: 6.620127} + - {x: -5.6718693, y: 6.6783333} + - {x: -5.175962, y: 6.73337} + - {x: -5.149766, y: 6.506799} + - {x: -5.24592, y: 6.290904} + - {x: -5.8966584, y: 5.9843554} + - {x: -6.1595254, y: 5.398411} + - {x: -5.8997283, y: 4.8348875} + - {x: -5.5447826, y: 5.2870626} + - {x: -5.4691076, y: 5.1215086} + - {x: -5.400779, y: 4.914544} + - {x: -5.112133, y: 4.899919} + - {x: -4.9009094, y: 4.9385004} + - {x: -4.828638, y: 4.911689} + - {x: -5.2888637, y: 4.6000404} + - {x: -5.7136555, y: 4.1197214} + - {x: -5.593485, y: 3.4583828} + - {x: -5.283478, y: 3.9621172} + - {x: -5.149906, y: 3.9839325} + - {x: -5.0234547, y: 3.6282206} + - {x: -4.630299, y: 3.8805652} + - {x: -4.4572225, y: 3.7387753} + - {x: -4.3462534, y: 3.5599236} + - {x: -4.6056566, y: 2.9962883} + - {x: -4.730713, y: 2.5160484} + - {x: -4.5142736, y: 1.9529077} + - {x: -4.4255266, y: 2.3286486} + - {x: -4.35179, y: 2.4748988} + - {x: -3.9343274, y: 2.640172} + - {x: -3.9284666, y: 3.2115421} + - {x: -3.7271433, y: 3.2351553} + - {x: -3.4852593, y: 3.3165402} + - {x: -3.266752, y: 3.7052605} + - {x: -3.0501256, y: 3.9189677} + - {x: -2.7682889, y: 3.6044445} + - {x: -2.5739791, y: 3.9250865} + - {x: -2.5675044, y: 3.943749} + - {x: -2.5306187, y: 3.8484786} + - {x: -2.384712, y: 3.678594} + - {x: -2.220262, y: 3.564436} + - {x: -2.0350854, y: 3.5226512} + - {x: -1.7770863, y: 3.541214} + - {x: -1.6059747, y: 3.4405956} + - {x: -1.2525163, y: 3.174913} + - {x: -0.9565268, y: 2.7984266} + - {x: -0.7884136, y: 2.4011207} + - {x: -0.678456, y: 2.0275488} + - {x: -0.6562767, y: 1.6638247} + - {x: -0.6750108, y: 1.2495863} + - {x: -0.7110409, y: 1.000072} + - {x: -0.7852041, y: 0.7304487} + - {x: -0.91342354, y: 0.3069253} + - {x: -1.0089116, y: -0.2862565} + - {x: -1.178504, y: -1.1498156} + - {x: -1.5145779, y: -1.9126238} + - {x: 1.3592415, y: -1.9805832} + - - {x: 1.1583805, y: 3.7965221} + - {x: 1.175128, y: 4.061081} + - {x: 1.2725089, y: 4.339294} + - {x: 1.4229435, y: 4.206705} + - {x: 1.6300776, y: 4.55227} + - {x: 1.8559281, y: 4.6903505} + - {x: 2.0186467, y: 4.7071457} + - {x: 1.9973726, y: 4.6721106} + - {x: 1.900983, y: 4.4006796} + - {x: 1.8233625, y: 4.280553} + - {x: 1.5541301, y: 4.0069942} + - {x: 1.3441639, y: 3.7633936} + - - {x: 1.9894804, y: 3.7970088} + - {x: 2.1631107, y: 4.0083466} + - {x: 2.267888, y: 4.182132} + - {x: 2.3587303, y: 4.3642893} + - {x: 2.4221518, y: 4.4661293} + - {x: 2.5189483, y: 4.5660505} + - {x: 2.9367354, y: 4.4021645} + - {x: 3.2148142, y: 4.489348} + - {x: 3.1397672, y: 4.195599} + - {x: 3.0860624, y: 4.148615} + - {x: 3.0149384, y: 4.099575} + - {x: 2.8040981, y: 3.9970493} + - {x: 2.5975342, y: 3.977995} + - {x: 2.2105408, y: 3.7988868} + - {x: 1.7915496, y: 3.5935783} + - - {x: -0.745291, y: 3.6064208} + - {x: -1.0231755, y: 3.7945328} + - {x: -1.2570138, y: 4.0135155} + - {x: -1.3195527, y: 4.093132} + - {x: -1.3753241, y: 4.22791} + - {x: -1.3540664, y: 4.439948} + - {x: -1.3688391, y: 4.4769354} + - {x: -1.3449923, y: 4.479533} + - {x: -1.0509835, y: 4.292273} + - {x: -1.024796, y: 4.2295275} + - {x: -0.9535828, y: 4.129941} + - {x: -0.7967791, y: 3.9602563} + - {x: -0.6928265, y: 3.752554} + - {x: -0.6109714, y: 3.5265284} + - - {x: 0.4190387, y: 4.060259} + - {x: 0.4634534, y: 4.2876425} + - {x: 0.4664793, y: 4.35662} + - {x: 0.6821971, y: 4.440889} + - {x: 0.8247419, y: 4.4690347} + - {x: 0.7990598, y: 4.224935} + - {x: 0.749072, y: 4.0666647} + - {x: 0.6601566, y: 3.9519784} + - {x: 0.530611, y: 3.8667061} + - - {x: -0.2059631, y: 3.7745001} + - {x: -0.32701302, y: 4.0581894} + - {x: -0.4614071, y: 4.1999507} + - {x: -0.5141282, y: 4.297098} + - {x: -0.5342213, y: 4.4183416} + - {x: -0.50275683, y: 4.452107} + - {x: -0.1255308, y: 4.348929} + - {x: 0.0383526, y: 4.316915} + - {x: 0.0267305, y: 4.20294} + - {x: -0.0383996, y: 3.9766505} + - {x: 0.0414466, y: 3.5324764} + - - {x: -2.0535293, y: 3.9288003} + - {x: -2.143732, y: 4.0019965} + - {x: -2.2496743, y: 4.170899} + - {x: -2.2672474, y: 4.297342} + - {x: -1.8464413, y: 4.4249067} + - {x: -1.8317412, y: 4.426508} + - {x: -1.795168, y: 4.372101} + - {x: -1.7355018, y: 4.1765747} + - {x: -1.7603226, y: 3.9468377} + - {x: -1.911623, y: 3.9199605} + m_VertexDistance: 0.0005 +--- !u!50 &1198078832 +Rigidbody2D: + serializedVersion: 4 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1198078828} + m_BodyType: 0 + m_Simulated: 1 + m_UseFullKinematicContacts: 0 + m_UseAutoMass: 0 + m_Mass: 1 + m_LinearDrag: 0 + m_AngularDrag: 0.05 + m_GravityScale: 1 + m_Material: {fileID: 0} + m_Interpolate: 0 + m_SleepingMode: 1 + m_CollisionDetection: 0 + m_Constraints: 0 +--- !u!1971053207 &1198078833 +SpriteShapeRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1198078828} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 4294967295 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: -47 + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_MaskInteraction: 0 + m_ShapeTexture: {fileID: 2800000, guid: a94adaf94669646788de8f639270804a, type: 3} + m_Sprites: [] + m_LocalAABB: + m_Center: {x: 0.61055565, y: 1.7089672, z: 0} + m_Extent: {x: 3.768011, y: 3.6895504, z: 0} +--- !u!114 &1198078834 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1198078828} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 90539df1cd5704abcb25fec9f3f5f84b, type: 3} + m_Name: + m_EditorClassIdentifier: + m_LegacyGenerator: 0 + m_Spline: + m_IsOpenEnded: 0 + m_ControlPoints: + - position: {x: 3.2161665, y: 3.7039447, z: 0} + leftTangent: {x: 0.29637432, y: 0.3156371, z: 0} + rightTangent: {x: -0.18563461, y: -0.12632513, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 2.4945831, y: 3.3575697, z: 0} + leftTangent: {x: 0.28138256, y: 0.13293266, z: 0} + rightTangent: {x: -0.34662533, y: -0.16375494, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.6725292, y: 2.835577, z: 0} + leftTangent: {x: 0.23968983, y: 0.117557526, z: 0} + rightTangent: {x: -0.40787888, y: -0.20004654, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.2641973, y: 2.2486148, z: 0} + leftTangent: {x: 0.21426773, y: 0.30344486, z: 0} + rightTangent: {x: -0.013861656, y: -0.019630432, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.9024763, y: 1.9370184, z: 0} + leftTangent: {x: 0.25271893, y: 0.13478279, z: 0} + rightTangent: {x: -0.1273861, y: -0.19007063, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.83741856, y: 1.205905, z: 0} + leftTangent: {x: -0.01540947, y: 0.30619144, z: 0} + rightTangent: {x: 0.010803223, y: -0.21466827, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.8321533, y: 0.48545122, z: 0} + leftTangent: {x: -0.023444176, y: 0.23949337, z: 0} + rightTangent: {x: 0.05688286, y: -0.58109426, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.91511345, y: -0.9579406, z: 0} + leftTangent: {x: -0.1334362, y: 0.42494583, z: 0} + rightTangent: {x: 0.1334362, y: -0.42494583, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.3592415, y: -1.9805832, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.5145779, y: -1.9126239, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.178504, y: -1.1498156, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.91342354, y: 0.3069253, z: 0} + leftTangent: {x: -0.06021799, y: -0.48489377, z: -0} + rightTangent: {x: 0.014711857, y: 0.11846447, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.711041, y: 1.000072, z: 0} + leftTangent: {x: -0.05616665, y: -0.261549, z: 0} + rightTangent: {x: 0.0570817, y: 0.2658105, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.6562767, y: 1.6638246, z: 0} + leftTangent: {x: -0.015919685, y: -0.1831832, z: 0} + rightTangent: {x: 0.031583786, y: 0.36343002, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.95652676, y: 2.7984266, z: 0} + leftTangent: {x: 0.1873169, y: -0.41380215, z: 0} + rightTangent: {x: -0.1873169, y: 0.41380262, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.7770863, y: 3.541214, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -2.220262, y: 3.564436, z: 0} + leftTangent: {x: 0.15812826, y: -0.080470085, z: -0} + rightTangent: {x: -0.15812826, y: 0.080470085, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -2.6112013, y: 4.05661, z: 0} + leftTangent: {x: 0.032327175, y: -0.22142982, z: 0} + rightTangent: {x: -0.206254, y: 0.21478653, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -3.0591974, y: 4.336563, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -3.1574554, y: 4.5612955, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -2.7904515, y: 4.7113476, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -2.2803297, y: 4.391474, z: 0} + leftTangent: {x: -0.16483545, y: 0.27308178, z: 0} + rightTangent: {x: -0.037330627, y: -0.23173237, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -2.0535293, y: 3.9288006, z: 0} + leftTangent: {x: -0.051990986, y: 0.01066494, z: 0} + rightTangent: {x: 0.14825106, y: -0.03041172, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.7603226, y: 3.9468374, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.7951679, y: 4.372101, z: 0} + leftTangent: {x: 0.113922596, y: -0.19186401, z: 0} + rightTangent: {x: -0.113922596, y: 0.19186401, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -2.236267, y: 5.0282946, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.6668215, y: 5.157666, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.3540664, y: 4.439948, z: 0} + leftTangent: {x: -0.108444214, y: 0.30963707, z: 0} + rightTangent: {x: -0.0831933, y: -0.2580328, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.2570138, y: 4.0135155, z: 0} + leftTangent: {x: -0.042501926, y: 0.059401512, z: 0} + rightTangent: {x: 0.14927785, y: -0.20863414, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.61097145, y: 3.5265284, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.79677916, y: 3.9602566, z: 0} + leftTangent: {x: 0.12550545, y: -0.21432257, z: 0} + rightTangent: {x: -0.05933857, y: 0.101331234, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.024796, y: 4.2295275, z: 0} + leftTangent: {x: 0.056889057, y: -0.11766052, z: 0} + rightTangent: {x: -0.18988562, y: 0.3927288, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.2740116, y: 5.2245064, z: 0} + leftTangent: {x: -0.0698576, y: -0.17230129, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.58708763, y: 5.3985176, z: 0} + leftTangent: {x: -0.19785118, y: -0.041404724, z: 0} + rightTangent: {x: 0.021735191, y: -0.43342495, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.5141282, y: 4.297098, z: 0} + leftTangent: {x: -0.087246895, y: 0.29190826, z: 0} + rightTangent: {x: 0.03632927, y: -0.12154961, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.32701302, y: 4.0581894, z: 0} + leftTangent: {x: -0.053714752, y: 0.08466339, z: 0} + rightTangent: {x: 0.08326244, y: -0.1312356, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.20596313, y: 3.7745, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.041446686, y: 3.5324764, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.038399696, y: 3.9766502, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.042672634, y: 4.3592806, z: 0} + leftTangent: {x: 0.011422487, y: -0.12856482, z: -0} + rightTangent: {x: -0.011422487, y: 0.12856482, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.24588203, y: 5.0692883, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.2021923, y: 5.1523314, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.47027874, y: 4.4432325, z: 0} + leftTangent: {x: -0.01453297, y: 0.12667656, z: -0} + rightTangent: {x: 0.01453297, y: -0.12667656, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.41903877, y: 4.060259, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.53061104, y: 3.866706, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.7490721, y: 4.0666647, z: 0} + leftTangent: {x: -0.07262421, y: -0.14140224, z: 0} + rightTangent: {x: 0.07117653, y: 0.13858509, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.83037186, y: 4.522544, z: 0} + leftTangent: {x: -0.012257576, y: -0.09680939, z: 0} + rightTangent: {x: 0.024763772, y: 0.19558822, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.969573, y: 5.026411, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.4917965, y: 5.0735054, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.3690004, y: 4.648546, z: 0} + leftTangent: {x: 0.020481981, y: 0.13927653, z: -0} + rightTangent: {x: -0.020481981, y: -0.13927653, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.175128, y: 4.061081, z: 0} + leftTangent: {x: 0.0147908535, y: 0.09184909, z: 0} + rightTangent: {x: -0.0147908535, y: -0.09184909, z: -0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.1583805, y: 3.7965221, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.3441639, y: 3.7633934, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.8233624, y: 4.280553, z: 0} + leftTangent: {x: -0.32624054, y: -0.31383038, z: 0} + rightTangent: {x: 0.10512543, y: 0.10112572, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.9973726, y: 4.6721106, z: 0} + leftTangent: {x: -0.06396866, y: -0.1184988, z: 0} + rightTangent: {x: 0.13454914, y: 0.24924564, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 2.2609882, y: 5.106245, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 2.8487377, y: 4.85763, z: 0} + leftTangent: {x: -0.18434525, y: 0.09165478, z: 0} + rightTangent: {x: -0.023777962, y: -0.08772373, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 2.4676914, y: 4.539255, z: 0} + leftTangent: {x: 0.10719395, y: 0.13840485, z: 0} + rightTangent: {x: -0.12870502, y: -0.16617966, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 2.1631107, y: 4.0083466, z: 0} + leftTangent: {x: 0.12242985, y: 0.16440964, z: 0} + rightTangent: {x: -0.17392349, y: -0.23356056, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.7915497, y: 3.5935783, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 2.5975342, y: 3.977995, z: 0} + leftTangent: {x: -0.40057755, y: -0.17875051, z: 0} + rightTangent: {x: 0.060819626, y: 0.027139664, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 2.8040981, y: 3.9970493, z: 0} + leftTangent: {x: -0.07244396, y: -0.020699501, z: 0} + rightTangent: {x: 0.11561108, y: 0.03303337, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 3.0860624, y: 4.148615, z: 0} + leftTangent: {x: -0.053355217, y: -0.038443565, z: 0} + rightTangent: {x: 0.30699492, y: 0.22119066, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 3.9016972, y: 4.94341, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 4.3785667, y: 4.67953, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + m_SpriteShape: {fileID: 11400000, guid: 8e3fa9c7ff3ad4112a30689e933384ed, type: 2} + m_FillPixelPerUnit: 100 + m_StretchTiling: 1 + m_SplineDetail: 4 + m_AdaptiveUV: 1 + m_StretchUV: 0 + m_WorldSpaceUV: 0 + m_ColliderDetail: 4 + m_ColliderOffset: 0 + m_UpdateCollider: 0 + m_OptimizeCollider: 1 +--- !u!4 &1198078835 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1198078828} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -13.4, y: 16.3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 53245465} + m_Father: {fileID: 0} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1437780201 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1437780206} + - component: {fileID: 1437780205} + - component: {fileID: 1437780204} + - component: {fileID: 1437780203} + - component: {fileID: 1437780202} + - component: {fileID: 1437780207} + m_Layer: 0 + m_Name: Branch (Legacy Collider) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!50 &1437780202 +Rigidbody2D: + serializedVersion: 4 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1437780201} + m_BodyType: 0 + m_Simulated: 1 + m_UseFullKinematicContacts: 0 + m_UseAutoMass: 0 + m_Mass: 1 + m_LinearDrag: 0 + m_AngularDrag: 0.05 + m_GravityScale: 1 + m_Material: {fileID: 0} + m_Interpolate: 0 + m_SleepingMode: 1 + m_CollisionDetection: 0 + m_Constraints: 0 +--- !u!68 &1437780203 +EdgeCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1437780201} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: 0} + m_EdgeRadius: 0 + m_Points: + - {x: -0.98856, y: -24.09548} + - {x: 3.0242, y: -22.76776} + - {x: 3.21764, y: -22.65055} + - {x: 5.92089, y: -20.02938} + - {x: 6.02207, y: -19.89042} + - {x: 7.66522, y: -16.55607} + - {x: 7.70198, y: -16.45571} + - {x: 8.52716, y: -13.14552} + - {x: 10.19995, y: -10.72428} + - {x: 13.23569, y: -9.61406} + - {x: 16.3414, y: -9.32309} + - {x: 18.7498, y: -9.37809} + - {x: 18.79546, y: -7.37861} + - {x: 16.29983, y: -7.32162} + - {x: 16.24172, y: -7.32367} + - {x: 12.85629, y: -7.64085} + - {x: 12.73068, y: -7.6692} + - {x: 9.06875, y: -9.00843} + - {x: 8.82335, y: -9.19826} + - {x: 6.72682, y: -12.23283} + - {x: 6.65244, y: -12.39743} + - {x: 5.80022, y: -15.81608} + - {x: 4.3426, y: -18.77394} + - {x: 2.07108, y: -20.97649} + - {x: -1.27554, y: -22.08379} + - {x: -5.77205, y: -21.39024} + - {x: -9.80821, y: -19.16592} + - {x: -12.71465, y: -16.77019} + - {x: -14.52603, y: -14.94082} + - {x: -15.94722, y: -16.34803} + - {x: -14.08258, y: -18.23119} + - {x: -14.04529, y: -18.26523} + - {x: -10.97259, y: -20.798} + - {x: -10.89572, y: -20.8502} + - {x: -6.50526, y: -23.26977} + - {x: -6.33888, y: -23.32646} + - {x: -1.22513, y: -24.11522} + - {x: -0.98856, y: -24.09548} +--- !u!1971053207 &1437780204 +SpriteShapeRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1437780201} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 4294967295 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: -11 + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_MaskInteraction: 0 + m_ShapeTexture: {fileID: 0} + m_Sprites: + - {fileID: 21300000, guid: e205c552afc6743cb9c52e5ff6504efc, type: 3} + m_LocalAABB: + m_Center: {x: 1.2404728, y: -12.22172, z: -0.005} + m_Extent: {x: 19.219893, y: 12.22172, z: 0.005} +--- !u!114 &1437780205 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1437780201} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 90539df1cd5704abcb25fec9f3f5f84b, type: 3} + m_Name: + m_EditorClassIdentifier: + m_LegacyGenerator: 0 + m_Spline: + m_IsOpenEnded: 1 + m_ControlPoints: + - position: {x: -14.53302, y: -16.355022, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1.17 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.1900063, y: -23.108816, z: 0} + leftTangent: {x: -6.6956515, y: -0.7063942, z: 0} + rightTangent: {x: 5.99125, y: 0.6320801, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 1 + - position: {x: 7.6009054, y: -12.726942, z: 0} + leftTangent: {x: -0.7709484, y: -4.507843, z: 0} + rightTangent: {x: 0.8714237, y: 5.095332, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 1 + - position: {x: 17.772892, y: -8.355526, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + m_SpriteShape: {fileID: 11400000, guid: 67e0d7ab8806749199e5b764729aa46a, type: 2} + m_FillPixelPerUnit: 100 + m_StretchTiling: 1 + m_SplineDetail: 16 + m_AdaptiveUV: 1 + m_StretchUV: 0 + m_WorldSpaceUV: 0 + m_ColliderDetail: 4 + m_ColliderOffset: 0 + m_UpdateCollider: 0 + m_OptimizeCollider: 1 +--- !u!4 &1437780206 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1437780201} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 35.4, y: 24.22, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 7 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1437780207 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1437780201} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6a8e65bafadf93f41a17da25163f2f51, type: 3} + m_Name: + m_EditorClassIdentifier: + m_ColliderCornerType: 0 + m_ColliderOffset: 1 + m_UpdateCollider: 0 +--- !u!1 &1463708948 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1463708952} + - component: {fileID: 1463708951} + - component: {fileID: 1463708950} + - component: {fileID: 1463708949} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1463708949 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1463708948} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &1463708950 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1463708948} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 +--- !u!223 &1463708951 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1463708948} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &1463708952 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1463708948} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_Children: + - {fileID: 1844216781} + - {fileID: 2100844766} + - {fileID: 231626811} + m_Father: {fileID: 0} + m_RootOrder: 10 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!1 &1574803829 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1574803832} + - component: {fileID: 1574803831} + - component: {fileID: 1574803830} + - component: {fileID: 1574803836} + - component: {fileID: 1574803835} + - component: {fileID: 1574803834} + - component: {fileID: 1574803833} + m_Layer: 0 + m_Name: Branch (Geometry Collider) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1971053207 &1574803830 +SpriteShapeRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1574803829} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 4294967295 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: -11 + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_MaskInteraction: 0 + m_ShapeTexture: {fileID: 0} + m_Sprites: + - {fileID: 21300000, guid: e205c552afc6743cb9c52e5ff6504efc, type: 3} + m_LocalAABB: + m_Center: {x: 1.3386917, y: -12.22172, z: -0.005} + m_Extent: {x: 19.318111, y: 12.22172, z: 0.005} +--- !u!114 &1574803831 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1574803829} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 90539df1cd5704abcb25fec9f3f5f84b, type: 3} + m_Name: + m_EditorClassIdentifier: + m_LegacyGenerator: 0 + m_Spline: + m_IsOpenEnded: 1 + m_ControlPoints: + - position: {x: -14.53302, y: -16.355022, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1.17 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.1900063, y: -23.108816, z: 0} + leftTangent: {x: -6.6956515, y: -0.7063942, z: 0} + rightTangent: {x: 5.99125, y: 0.6320801, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 1 + - position: {x: 7.6009054, y: -12.726942, z: 0} + leftTangent: {x: -0.7709484, y: -4.507843, z: 0} + rightTangent: {x: 0.8714237, y: 5.095332, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 1 + - position: {x: 17.983303, y: -8.250319, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + m_SpriteShape: {fileID: 11400000, guid: 67e0d7ab8806749199e5b764729aa46a, type: 2} + m_FillPixelPerUnit: 100 + m_StretchTiling: 1 + m_SplineDetail: 16 + m_AdaptiveUV: 1 + m_StretchUV: 0 + m_WorldSpaceUV: 0 + m_ColliderDetail: 4 + m_ColliderOffset: 0 + m_UpdateCollider: 0 + m_OptimizeCollider: 1 +--- !u!4 &1574803832 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1574803829} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -0.6000004, y: 24.22, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!66 &1574803833 +CompositeCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1574803829} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: 0} + m_GeometryType: 0 + m_GenerationType: 0 + m_EdgeRadius: 0 + m_ColliderPaths: + - m_Collider: {fileID: 1574803836} + m_ColliderPaths: + - - X: -36014956 + Y: -217938288 + - X: -36351692 + Y: -217885920 + - X: -36080312 + Y: -217921566 + - - X: 6910515 + Y: -241387264 + - X: 14598203 + Y: -239156144 + - X: 25647150 + Y: -234457504 + - X: 35680688 + Y: -228634704 + - X: 44689436 + Y: -221831136 + - X: 49151940 + Y: -217604080 + - X: 52689072 + Y: -214201984 + - X: 59721460 + Y: -205899872 + - X: 65848344 + Y: -197065968 + - X: 71142656 + Y: -187826016 + - X: 75680816 + Y: -178292272 + - X: 59199532 + Y: -171114670 + - X: 52110228 + Y: -168304464 + - X: 52167841 + Y: -168159355 + - X: 52209984 + Y: -168070720 + - X: 52110228 + Y: -168304464 + - X: 59199532 + Y: -171114670 + - X: 75680816 + Y: -178292272 + - X: 75908648 + Y: -177738176 + - X: 79538152 + Y: -168566128 + - X: 82786096 + Y: -158742688 + - X: 85491944 + Y: -148913136 + - X: 87718960 + Y: -139167168 + - X: 88582992 + Y: -134604032 + - X: 89334376 + Y: -130521248 + - X: 91395024 + Y: -123368256 + - X: 94564992 + Y: -118121368 + - X: 99106400 + Y: -113438800 + - X: 105280159 + Y: -109126022 + - X: 112287632 + Y: -105587944 + - X: 120488208 + Y: -102567472 + - X: 129307560 + Y: -100192048 + - X: 138374736 + Y: -98430168 + - X: 139373472 + Y: -98300296 + - X: 147323088 + Y: -97217512 + - X: 155794624 + Y: -96470232 + - X: 163439888 + Y: -96092976 + - X: 169916064 + Y: -95983648 + - X: 174886384 + Y: -96036312 + - X: 178027008 + Y: -96143048 + - X: 179114112 + Y: -96200704 + - X: 205178256 + Y: -97568648 + - X: 206520000 + Y: -72003832 + - X: 180455856 + Y: -70635888 + - X: 179131312 + Y: -70566880 + - X: 175454464 + Y: -70442608 + - X: 169833664 + Y: -70383784 + - X: 162590576 + Y: -70507064 + - X: 154035680 + Y: -70930736 + - X: 144474256 + Y: -71776512 + - X: 135930384 + Y: -72932896 + - X: 134205688 + Y: -73171920 + - X: 123522088 + Y: -75254368 + - X: 112708072 + Y: -78178336 + - X: 102044392 + Y: -82126560 + - X: 91824320 + Y: -87324504 + - X: 102288301 + Y: -104643886 + - X: 105408248 + Y: -109036544 + - X: 105280159 + Y: -109126022 + - X: 105062656 + Y: -109235840 + - X: 105408248 + Y: -109036544 + - X: 102288301 + Y: -104643886 + - X: 91824320 + Y: -87324504 + - X: 90584184 + Y: -88165344 + - X: 82395960 + Y: -94044952 + - X: 74234992 + Y: -102563368 + - X: 67981304 + Y: -113016560 + - X: 64464212 + Y: -124452088 + - X: 63427388 + Y: -129854744 + - X: 62658048 + Y: -133941248 + - X: 60666036 + Y: -142665424 + - X: 58283416 + Y: -151327936 + - X: 55475212 + Y: -159829136 + - X: 52167841 + Y: -168159355 + - X: 48459920 + Y: -175957856 + - X: 44200512 + Y: -183400992 + - X: 39408208 + Y: -190320032 + - X: 34056488 + Y: -196646752 + - X: 31478648 + Y: -199083424 + - X: 28109066 + Y: -202325968 + - X: 21512496 + Y: -207312832 + - X: 14190592 + Y: -211564144 + - X: 6045491 + Y: -215027088 + - X: -145251 + Y: -216778816 + - X: -3033300 + Y: -217628416 + - X: -13020303 + Y: -219257456 + - X: -24738706 + Y: -219411296 + - X: -36080312 + Y: -217921566 + - X: -47938500 + Y: -214887536 + - X: -59374504 + Y: -210622880 + - X: -70515000 + Y: -205322464 + - X: -72469768 + Y: -204196208 + - X: -81210792 + Y: -199236800 + - X: -91315872 + Y: -192629952 + - X: -100689552 + Y: -185774352 + - X: -105846424 + Y: -181632880 + - X: -109196760 + Y: -178947120 + - X: -116707088 + Y: -172427696 + - X: -123094008 + Y: -166496912 + - X: -128233976 + Y: -161435616 + - X: -132006496 + Y: -157524368 + - X: -134298864 + Y: -155036544 + - X: -135066800 + Y: -154170448 + - X: -158475984 + Y: -128556000 + - X: -180585632 + Y: -148762096 + - X: -157176448 + Y: -174376560 + - X: -156195648 + Y: -175420000 + - X: -153408448 + Y: -178278624 + - X: -149016448 + Y: -182582928 + - X: -143142368 + Y: -188050144 + - X: -135899760 + Y: -194405344 + - X: -127398888 + Y: -201374496 + - X: -123532808 + Y: -204306640 + - X: -117746288 + Y: -208683088 + - X: -107044304 + Y: -216055312 + - X: -95389624 + Y: -223212544 + - X: -85757512 + Y: -228341408 + - X: -82872712 + Y: -229870688 + - X: -69577696 + Y: -235736144 + - X: -55585136 + Y: -240499568 + - X: -42232508 + Y: -243558672 + - X: -40980684 + Y: -243828608 + - X: -25873268 + Y: -245363376 + - X: -10607054 + Y: -244743440 + - X: 2557802 + Y: -242610416 + m_CompositePaths: + m_Paths: + - - {x: 5.216784, y: -16.815937} + - {x: 5.2209983, y: -16.807072} + - {x: 5.211023, y: -16.830446} + - - {x: 10.540825, y: -10.903654} + - {x: 10.528016, y: -10.912602} + - {x: 10.506266, y: -10.923584} + - - {x: -3.6351693, y: -21.788591} + - {x: -3.6080313, y: -21.792156} + - {x: -3.6014957, y: -21.793829} + - - {x: 8.239596, y: -9.404495} + - {x: 7.423499, y: -10.256337} + - {x: 6.7981305, y: -11.301656} + - {x: 6.446421, y: -12.445209} + - {x: 6.342739, y: -12.985475} + - {x: 6.265805, y: -13.394125} + - {x: 6.0666037, y: -14.266542} + - {x: 5.8283415, y: -15.132793} + - {x: 5.547521, y: -15.982914} + - {x: 5.216784, y: -16.815937} + - {x: 4.845992, y: -17.595785} + - {x: 4.420051, y: -18.3401} + - {x: 3.940821, y: -19.032003} + - {x: 3.405649, y: -19.664675} + - {x: 3.1478648, y: -19.908342} + - {x: 2.8109066, y: -20.232597} + - {x: 2.1512496, y: -20.731283} + - {x: 1.4190592, y: -21.156414} + - {x: 0.6045491, y: -21.502708} + - {x: -0.014525101, y: -21.677881} + - {x: -0.30333, y: -21.762842} + - {x: -1.3020303, y: -21.925745} + - {x: -2.4738705, y: -21.94113} + - {x: -3.6080313, y: -21.792156} + - {x: -4.79385, y: -21.488754} + - {x: -5.9374504, y: -21.062288} + - {x: -7.0515003, y: -20.532248} + - {x: -7.246977, y: -20.41962} + - {x: -8.121079, y: -19.92368} + - {x: -9.131587, y: -19.262995} + - {x: -10.068955, y: -18.577435} + - {x: -10.584642, y: -18.163288} + - {x: -10.919676, y: -17.894712} + - {x: -11.670709, y: -17.24277} + - {x: -12.309401, y: -16.64969} + - {x: -12.823398, y: -16.143562} + - {x: -13.20065, y: -15.752437} + - {x: -13.429887, y: -15.5036545} + - {x: -13.5066805, y: -15.417045} + - {x: -15.847599, y: -12.8556} + - {x: -18.058563, y: -14.87621} + - {x: -15.717645, y: -17.437656} + - {x: -15.619565, y: -17.542} + - {x: -15.340845, y: -17.827862} + - {x: -14.901645, y: -18.258293} + - {x: -14.314237, y: -18.805016} + - {x: -13.589976, y: -19.440535} + - {x: -12.739889, y: -20.13745} + - {x: -12.353281, y: -20.430664} + - {x: -11.774629, y: -20.868309} + - {x: -10.704431, y: -21.605532} + - {x: -9.538962, y: -22.321255} + - {x: -8.575751, y: -22.83414} + - {x: -8.2872715, y: -22.987068} + - {x: -6.95777, y: -23.573614} + - {x: -5.5585136, y: -24.049957} + - {x: -4.223251, y: -24.355867} + - {x: -4.098068, y: -24.38286} + - {x: -2.5873268, y: -24.536339} + - {x: -1.0607054, y: -24.474344} + - {x: 0.2557802, y: -24.261042} + - {x: 0.6910515, y: -24.138727} + - {x: 1.4598203, y: -23.915615} + - {x: 2.5647151, y: -23.445751} + - {x: 3.5680687, y: -22.86347} + - {x: 4.4689436, y: -22.183113} + - {x: 4.915194, y: -21.760408} + - {x: 5.268907, y: -21.420198} + - {x: 5.972146, y: -20.589987} + - {x: 6.5848346, y: -19.706596} + - {x: 7.114266, y: -18.782602} + - {x: 7.568082, y: -17.829227} + - {x: 7.5908647, y: -17.773817} + - {x: 7.9538155, y: -16.856613} + - {x: 8.278609, y: -15.874269} + - {x: 8.549194, y: -14.891314} + - {x: 8.771896, y: -13.916717} + - {x: 8.858299, y: -13.460403} + - {x: 8.933437, y: -13.052125} + - {x: 9.139503, y: -12.336825} + - {x: 9.456499, y: -11.812137} + - {x: 9.91064, y: -11.34388} + - {x: 10.528016, y: -10.912602} + - {x: 11.228764, y: -10.558795} + - {x: 12.0488205, y: -10.256747} + - {x: 12.930757, y: -10.019205} + - {x: 13.837474, y: -9.843017} + - {x: 13.937347, y: -9.8300295} + - {x: 14.732309, y: -9.721751} + - {x: 15.579463, y: -9.647023} + - {x: 16.343988, y: -9.609298} + - {x: 16.991606, y: -9.598365} + - {x: 17.488638, y: -9.603631} + - {x: 17.802702, y: -9.614305} + - {x: 17.911411, y: -9.62007} + - {x: 20.517826, y: -9.756865} + - {x: 20.652, y: -7.200383} + - {x: 18.045586, y: -7.063589} + - {x: 17.913132, y: -7.0566883} + - {x: 17.545446, y: -7.044261} + - {x: 16.983366, y: -7.0383787} + - {x: 16.259058, y: -7.0507064} + - {x: 15.403568, y: -7.093074} + - {x: 14.447426, y: -7.1776514} + - {x: 13.593039, y: -7.2932897} + - {x: 13.420569, y: -7.317192} + - {x: 12.352209, y: -7.525437} + - {x: 11.270807, y: -7.817834} + - {x: 10.204439, y: -8.212656} + - {x: 9.182432, y: -8.7324505} + - {x: 9.058418, y: -8.816534} + m_VertexDistance: 0.0005 +--- !u!50 &1574803834 +Rigidbody2D: + serializedVersion: 4 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1574803829} + m_BodyType: 0 + m_Simulated: 1 + m_UseFullKinematicContacts: 0 + m_UseAutoMass: 0 + m_Mass: 1 + m_LinearDrag: 0 + m_AngularDrag: 0.05 + m_GravityScale: 1 + m_Material: {fileID: 0} + m_Interpolate: 0 + m_SleepingMode: 1 + m_CollisionDetection: 0 + m_Constraints: 0 +--- !u!114 &1574803835 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1574803829} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e0ecd6fe4dd55d640bd7ef3235e0e425, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UpdateCollider: 0 +--- !u!60 &1574803836 +PolygonCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1574803829} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 1 + m_Offset: {x: 0, y: 0} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0, y: 0} + oldSize: {x: 0, y: 0} + newSize: {x: 0, y: 0} + adaptiveTilingThreshold: 0 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + m_Points: + m_Paths: + - - {x: -18.058563, y: -14.876209} + - {x: -15.847598, y: -12.8556} + - {x: -13.5066805, y: -15.417046} + - {x: -15.717645, y: -17.437656} + - - {x: -15.717645, y: -17.437656} + - {x: -13.5066805, y: -15.417046} + - {x: -13.429886, y: -15.5036545} + - {x: -15.619564, y: -17.542} + - - {x: -15.619564, y: -17.542} + - {x: -13.429886, y: -15.5036545} + - {x: -13.200649, y: -15.752438} + - {x: -15.340845, y: -17.827862} + - - {x: -15.340845, y: -17.827862} + - {x: -13.200649, y: -15.752438} + - {x: -12.823398, y: -16.143562} + - {x: -14.901645, y: -18.258293} + - - {x: -14.901645, y: -18.258293} + - {x: -12.823398, y: -16.143562} + - {x: -12.309401, y: -16.64969} + - {x: -14.314238, y: -18.805014} + - - {x: -14.314238, y: -18.805014} + - {x: -12.309401, y: -16.64969} + - {x: -11.670709, y: -17.24277} + - {x: -13.589976, y: -19.440535} + - - {x: -13.589976, y: -19.440535} + - {x: -11.670709, y: -17.24277} + - {x: -10.919676, y: -17.894712} + - {x: -12.739889, y: -20.13745} + - - {x: -12.739889, y: -20.13745} + - {x: -10.919676, y: -17.894712} + - {x: -10.584642, y: -18.163288} + - {x: -12.353281, y: -20.430664} + - - {x: -12.353281, y: -20.430664} + - {x: -10.584642, y: -18.163288} + - {x: -10.068955, y: -18.577435} + - {x: -11.774629, y: -20.868309} + - - {x: -11.774629, y: -20.868309} + - {x: -10.068955, y: -18.577435} + - {x: -9.131587, y: -19.262995} + - {x: -10.704431, y: -21.605532} + - - {x: -10.704431, y: -21.605532} + - {x: -9.131587, y: -19.262995} + - {x: -8.121079, y: -19.92368} + - {x: -9.538962, y: -22.321255} + - - {x: -9.538962, y: -22.321255} + - {x: -8.121079, y: -19.92368} + - {x: -7.246977, y: -20.41962} + - {x: -8.575751, y: -22.83414} + - - {x: -8.575751, y: -22.83414} + - {x: -7.246977, y: -20.41962} + - {x: -7.0515003, y: -20.532246} + - {x: -8.2872715, y: -22.987068} + - - {x: -8.2872715, y: -22.987068} + - {x: -7.0515003, y: -20.532246} + - {x: -5.9374504, y: -21.062288} + - {x: -6.9577694, y: -23.573614} + - - {x: -6.9577694, y: -23.573614} + - {x: -5.9374504, y: -21.062288} + - {x: -4.79385, y: -21.488754} + - {x: -5.5585136, y: -24.049957} + - - {x: -5.5585136, y: -24.049957} + - {x: -4.79385, y: -21.488754} + - {x: -3.6014955, y: -21.793829} + - {x: -4.223251, y: -24.355867} + - - {x: -4.223251, y: -24.355867} + - {x: -3.6014955, y: -21.793829} + - {x: -3.6351693, y: -21.788591} + - {x: -4.098068, y: -24.38286} + - - {x: -4.098068, y: -24.38286} + - {x: -3.6351693, y: -21.788591} + - {x: -2.4738705, y: -21.94113} + - {x: -2.5873268, y: -24.536337} + - - {x: -2.5873268, y: -24.536337} + - {x: -2.4738705, y: -21.94113} + - {x: -1.3020303, y: -21.925745} + - {x: -1.0607054, y: -24.474344} + - - {x: -1.0607054, y: -24.474344} + - {x: -1.3020303, y: -21.925745} + - {x: -0.30333006, y: -21.762842} + - {x: 0.25578028, y: -24.261042} + - - {x: 0.25578028, y: -24.261042} + - {x: -0.30333006, y: -21.762842} + - {x: -0.014525179, y: -21.677881} + - {x: 0.69105154, y: -24.138727} + - - {x: 0.69105154, y: -24.138727} + - {x: -0.014525179, y: -21.677881} + - {x: 0.6045491, y: -21.502708} + - {x: 1.4598203, y: -23.915615} + - - {x: 1.4598203, y: -23.915615} + - {x: 0.6045491, y: -21.502708} + - {x: 1.4190592, y: -21.156414} + - {x: 2.564715, y: -23.445751} + - - {x: 2.564715, y: -23.445751} + - {x: 1.4190592, y: -21.156414} + - {x: 2.1512496, y: -20.731283} + - {x: 3.5680687, y: -22.86347} + - - {x: 3.5680687, y: -22.86347} + - {x: 2.1512496, y: -20.731283} + - {x: 2.8109066, y: -20.232597} + - {x: 4.4689436, y: -22.183113} + - - {x: 4.4689436, y: -22.183113} + - {x: 2.8109066, y: -20.232597} + - {x: 3.1478648, y: -19.908342} + - {x: 4.915194, y: -21.760408} + - - {x: 4.915194, y: -21.760408} + - {x: 3.1478648, y: -19.908342} + - {x: 3.4056487, y: -19.664675} + - {x: 5.268907, y: -21.420198} + - - {x: 5.268907, y: -21.420198} + - {x: 3.4056487, y: -19.664675} + - {x: 3.9408207, y: -19.032003} + - {x: 5.972146, y: -20.589987} + - - {x: 5.972146, y: -20.589987} + - {x: 3.9408207, y: -19.032003} + - {x: 4.420051, y: -18.3401} + - {x: 6.5848346, y: -19.706596} + - - {x: 6.5848346, y: -19.706596} + - {x: 4.420051, y: -18.3401} + - {x: 4.845992, y: -17.595785} + - {x: 7.1142654, y: -18.782602} + - - {x: 7.1142654, y: -18.782602} + - {x: 4.845992, y: -17.595785} + - {x: 5.2209983, y: -16.807072} + - {x: 7.5680814, y: -17.829227} + - - {x: 7.5680814, y: -17.829227} + - {x: 5.2209983, y: -16.807072} + - {x: 5.211023, y: -16.830446} + - {x: 7.5908647, y: -17.773817} + - - {x: 7.5908647, y: -17.773817} + - {x: 5.211023, y: -16.830446} + - {x: 5.547521, y: -15.982914} + - {x: 7.953815, y: -16.856613} + - - {x: 7.953815, y: -16.856613} + - {x: 5.547521, y: -15.982914} + - {x: 5.8283415, y: -15.132793} + - {x: 8.278609, y: -15.8742695} + - - {x: 8.278609, y: -15.8742695} + - {x: 5.8283415, y: -15.132793} + - {x: 6.0666037, y: -14.266542} + - {x: 8.549194, y: -14.891314} + - - {x: 8.549194, y: -14.891314} + - {x: 6.0666037, y: -14.266542} + - {x: 6.265805, y: -13.394125} + - {x: 8.771896, y: -13.916718} + - - {x: 8.771896, y: -13.916718} + - {x: 6.265805, y: -13.394125} + - {x: 6.3427386, y: -12.985475} + - {x: 8.858299, y: -13.4604025} + - - {x: 8.858299, y: -13.4604025} + - {x: 6.3427386, y: -12.985475} + - {x: 6.446421, y: -12.445209} + - {x: 8.933437, y: -13.052125} + - - {x: 8.933437, y: -13.052125} + - {x: 6.446421, y: -12.445209} + - {x: 6.7981305, y: -11.301656} + - {x: 9.139503, y: -12.336825} + - - {x: 9.139503, y: -12.336825} + - {x: 6.7981305, y: -11.301656} + - {x: 7.4234996, y: -10.256337} + - {x: 9.456499, y: -11.812137} + - - {x: 9.456499, y: -11.812137} + - {x: 7.4234996, y: -10.256337} + - {x: 8.239596, y: -9.404495} + - {x: 9.91064, y: -11.34388} + - - {x: 9.91064, y: -11.34388} + - {x: 8.239596, y: -9.404495} + - {x: 9.058418, y: -8.816534} + - {x: 10.540825, y: -10.903654} + - - {x: 10.540825, y: -10.903654} + - {x: 9.058418, y: -8.816534} + - {x: 9.182432, y: -8.7324505} + - {x: 10.506266, y: -10.923584} + - - {x: 10.506266, y: -10.923584} + - {x: 9.182432, y: -8.7324505} + - {x: 10.204439, y: -8.212656} + - {x: 11.228764, y: -10.558794} + - - {x: 11.228764, y: -10.558794} + - {x: 10.204439, y: -8.212656} + - {x: 11.270807, y: -7.817834} + - {x: 12.0488205, y: -10.256747} + - - {x: 12.0488205, y: -10.256747} + - {x: 11.270807, y: -7.817834} + - {x: 12.352209, y: -7.5254364} + - {x: 12.930756, y: -10.019205} + - - {x: 12.930756, y: -10.019205} + - {x: 12.352209, y: -7.5254364} + - {x: 13.420568, y: -7.3171916} + - {x: 13.837473, y: -9.843017} + - - {x: 13.837473, y: -9.843017} + - {x: 13.420568, y: -7.3171916} + - {x: 13.593038, y: -7.2932897} + - {x: 13.937346, y: -9.8300295} + - - {x: 13.937346, y: -9.8300295} + - {x: 13.593038, y: -7.2932897} + - {x: 14.447426, y: -7.1776514} + - {x: 14.732309, y: -9.721751} + - - {x: 14.732309, y: -9.721751} + - {x: 14.447426, y: -7.1776514} + - {x: 15.403567, y: -7.0930734} + - {x: 15.579463, y: -9.647023} + - - {x: 15.579463, y: -9.647023} + - {x: 15.403567, y: -7.0930734} + - {x: 16.259058, y: -7.0507064} + - {x: 16.343988, y: -9.609298} + - - {x: 16.343988, y: -9.609298} + - {x: 16.259058, y: -7.0507064} + - {x: 16.983366, y: -7.0383787} + - {x: 16.991606, y: -9.598365} + - - {x: 16.991606, y: -9.598365} + - {x: 16.983366, y: -7.0383787} + - {x: 17.545446, y: -7.044261} + - {x: 17.488638, y: -9.603631} + - - {x: 17.488638, y: -9.603631} + - {x: 17.545446, y: -7.044261} + - {x: 17.913132, y: -7.056688} + - {x: 17.8027, y: -9.614305} + - - {x: 17.8027, y: -9.614305} + - {x: 17.913132, y: -7.056688} + - {x: 18.045586, y: -7.0635886} + - {x: 17.911411, y: -9.62007} + - - {x: 17.911411, y: -9.62007} + - {x: 18.045586, y: -7.0635886} + - {x: 20.652, y: -7.200383} + - {x: 20.517826, y: -9.756865} +--- !u!1 &1617661204 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1617661210} + - component: {fileID: 1617661209} + - component: {fileID: 1617661208} + - component: {fileID: 1617661207} + - component: {fileID: 1617661206} + - component: {fileID: 1617661205} + m_Layer: 0 + m_Name: Tree (Package) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!60 &1617661205 +PolygonCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1617661204} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 1 + m_Offset: {x: 0, y: 0} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0, y: 0} + oldSize: {x: 0, y: 0} + newSize: {x: 0, y: 0} + adaptiveTilingThreshold: 0 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + m_Points: + m_Paths: + - - {x: 3.2161665, y: 3.7039447} + - {x: 2.4945831, y: 3.3575697} + - {x: 1.6725292, y: 2.835577} + - {x: 1.3853858, y: 2.5944917} + - {x: 1.2265774, y: 2.1977818} + - {x: 0.9024763, y: 1.9370184} + - {x: 0.81912863, y: 1.4893} + - {x: 0.84694093, y: -0.52399516} + - {x: 0.91511345, y: -0.9579406} + - {x: 1.3592415, y: -1.9805832} + - {x: -1.5145779, y: -1.9126239} + - {x: -1.178504, y: -1.1498156} + - {x: -0.91342354, y: 0.3069253} + - {x: -0.711041, y: 1.000072} + - {x: -0.6562767, y: 1.6638246} + - {x: -0.678456, y: 2.0275488} + - {x: -0.95652676, y: 2.7984266} + - {x: -1.2525163, y: 3.174913} + - {x: -1.7770863, y: 3.541214} + - {x: -2.220262, y: 3.564436} + - {x: -2.5306187, y: 3.8484783} + - {x: -2.6112013, y: 4.05661} + - {x: -3.0846715, y: 4.394827} + - {x: -3.0623064, y: 4.6001973} + - {x: -2.6948276, y: 4.689101} + - {x: -2.4858437, y: 4.5957737} + - {x: -2.2803297, y: 4.391474} + - {x: -2.143732, y: 4.0019965} + - {x: -1.7603226, y: 3.9468374} + - {x: -1.7951679, y: 4.372101} + - {x: -2.236267, y: 5.0282946} + - {x: -1.6668215, y: 5.157666} + - {x: -1.3540664, y: 4.439948} + - {x: -1.2570138, y: 4.0135155} + - {x: -0.61097145, y: 3.5265284} + - {x: -0.8696252, y: 4.0489564} + - {x: -1.024796, y: 4.2295275} + - {x: -1.1893249, y: 4.623741} + - {x: -1.2826447, y: 4.9772434} + - {x: -1.2740116, y: 5.2245064} + - {x: -0.58708763, y: 5.3985176} + - {x: -0.56699, y: 4.6160717} + - {x: -0.46140712, y: 4.1999507} + - {x: -0.14181983, y: 3.711753} + - {x: 0.020745765, y: 3.6476324} + - {x: -0.014842608, y: 4.0472803} + - {x: 0.042672634, y: 4.3592806} + - {x: -0.24588203, y: 5.0692883} + - {x: 0.2021923, y: 5.1523314} + - {x: 0.47027874, y: 4.4432325} + - {x: 0.44796485, y: 4.010078} + - {x: 0.6601566, y: 3.9519782} + - {x: 0.969573, y: 5.026411} + - {x: 1.4917965, y: 5.0735054} + - {x: 1.175128, y: 4.061081} + - {x: 1.2065464, y: 3.7879329} + - {x: 1.3959025, y: 3.8277311} + - {x: 1.9009831, y: 4.4006796} + - {x: 2.2609882, y: 5.106245} + - {x: 2.8487377, y: 4.85763} + - {x: 2.4676914, y: 4.539255} + - {x: 2.1631107, y: 4.0083466} + - {x: 1.7915497, y: 3.5935783} + - {x: 2.6620197, y: 3.9903965} + - {x: 3.0860624, y: 4.148615} + - {x: 3.9016972, y: 4.94341} + - {x: 4.3785667, y: 4.67953} + - {x: 4.143064, y: 4.496742} + - {x: 3.6492512, y: 4.0971575} + - {x: 3.2161665, y: 3.7039447} +--- !u!66 &1617661206 +CompositeCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1617661204} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: 0} + m_GeometryType: 0 + m_GenerationType: 0 + m_EdgeRadius: 0 + m_ColliderPaths: + - m_Collider: {fileID: 778552134} + m_ColliderPaths: + - - X: 53526956 + Y: 104636528 + - X: 47350996 + Y: 101567480 + - X: 46200592 + Y: 97908888 + - X: 46591416 + Y: 96138696 + - X: 49905488 + Y: 98022248 + - X: 56776476 + Y: 99840472 + - X: 62597504 + Y: 95844648 + - X: 57183056 + Y: 92512064 + - X: 57704612 + Y: 91012720 + - X: 61975012 + Y: 88138008 + - X: 60001276 + Y: 83267736 + - X: 57968828 + Y: 80691144 + - X: 62848024 + Y: 81552760 + - X: 66329004 + Y: 80764328 + - X: 62754920 + Y: 78492816 + - X: 63523244 + Y: 77258520 + - X: 65515176 + Y: 78174008 + - X: 69336216 + Y: 78807880 + - X: 71754152 + Y: 75991232 + - X: 68877528 + Y: 76134320 + - X: 68785112 + Y: 73986568 + - X: 70460096 + Y: 72211688 + - X: 71458920 + Y: 69592224 + - X: 70711144 + Y: 66727008 + - X: 68959440 + Y: 69900392 + - X: 66942204 + Y: 68483744 + - X: 64117900 + Y: 68984032 + - X: 62391624 + Y: 67443224 + - X: 67831888 + Y: 66693272 + - X: 63943904 + Y: 63310248 + - X: 66557008 + Y: 62867356 + - X: 69080648 + Y: 60229148 + - X: 71921280 + Y: 58968056 + - X: 72241000 + Y: 56305856 + - X: 69712368 + Y: 57090020 + - X: 71103728 + Y: 52845648 + - X: 68289600 + Y: 53914088 + - X: 66919364 + Y: 51919364 + - X: 65460988 + Y: 56909720 + - X: 63198840 + Y: 56656728 + - X: 64060272 + Y: 53792280 + - X: 63172436 + Y: 52511672 + - X: 68138688 + Y: 49147976 + - X: 68848280 + Y: 44829188 + - X: 66833784 + Y: 41228000 + - X: 66127488 + Y: 45109576 + - X: 64865608 + Y: 44639972 + - X: 63528368 + Y: 40364656 + - X: 60135908 + Y: 43774260 + - X: 57737416 + Y: 41248236 + - X: 60755024 + Y: 39985636 + - X: 62750244 + Y: 37962932 + - X: 62694636 + Y: 33688436 + - X: 59964028 + Y: 35534896 + - X: 57851256 + Y: 34825012 + - X: 59915628 + Y: 31888332 + - X: 54675132 + Y: 28132386 + - X: 49118624 + Y: 30842996 + - X: 51853172 + Y: 34421672 + - X: 49152204 + Y: 36227732 + - X: 48800544 + Y: 38934596 + - X: 46835004 + Y: 40422612 + - X: 45853588 + Y: 35907556 + - X: 42288448 + Y: 35954688 + - X: 40856724 + Y: 33937620 + - X: 38199492 + Y: 32401500 + - X: 39222492 + Y: 35626684 + - X: 39221656 + Y: 37786804 + - X: 36903324 + Y: 38612012 + - X: 34338216 + Y: 40591636 + - X: 31159896 + Y: 39300364 + - X: 32148122 + Y: 44893480 + - X: 29367334 + Y: 44021644 + - X: 25189464 + Y: 45660504 + - X: 23237288 + Y: 43645312 + - X: 21266644 + Y: 47182952 + - X: 18559262 + Y: 46903504 + - X: 16300757 + Y: 45522700 + - X: 14229414 + Y: 42067052 + - X: 10702937 + Y: 45175188 + - X: 6821952 + Y: 44408888 + - X: 2559986 + Y: 42743980 + - X: -5027587 + Y: 44521068 + - X: -8004181 + Y: 41326820 + - X: -13449942 + Y: 44795332 + - X: -18464432 + Y: 44249068 + - X: -23219060 + Y: 42807732 + - X: -24921088 + Y: 41610752 + - X: -27682908 + Y: 36044444 + - X: -30501276 + Y: 39189676 + - X: -32667540 + Y: 37052604 + - X: -34852612 + Y: 33165402 + - X: -39284684 + Y: 32115422 + - X: -39343292 + Y: 26401720 + - X: -43517920 + Y: 24748988 + - X: -45142756 + Y: 19529076 + - X: -47307148 + Y: 25160484 + - X: -46056584 + Y: 29962882 + - X: -43462552 + Y: 35599236 + - X: -46303004 + Y: 38805652 + - X: -50234564 + Y: 36282204 + - X: -51499080 + Y: 39839324 + - X: -52834796 + Y: 39621172 + - X: -55934868 + Y: 34583828 + - X: -57136572 + Y: 41197216 + - X: -52888656 + Y: 46000404 + - X: -48286400 + Y: 49116888 + - X: -54007808 + Y: 49145440 + - X: -55447844 + Y: 52870628 + - X: -58997296 + Y: 48348876 + - X: -61595272 + Y: 53984108 + - X: -58966604 + Y: 59843556 + - X: -52459220 + Y: 62909040 + - X: -51497680 + Y: 65067992 + - X: -51759640 + Y: 67333696 + - X: -56718712 + Y: 66783332 + - X: -59352464 + Y: 63665968 + - X: -62021400 + Y: 59383744 + - X: -62228012 + Y: 62994284 + - X: -60907656 + Y: 69309624 + - X: -59010240 + Y: 74804648 + - X: -53752904 + Y: 76244272 + - X: -49547376 + Y: 75650288 + - X: -48092084 + Y: 76933744 + - X: -46951508 + Y: 79343256 + - X: -50963604 + Y: 80717528 + - X: -49015184 + Y: 87253560 + - X: -53127660 + Y: 87714136 + - X: -49071512 + Y: 91882600 + - X: -43557232 + Y: 92413696 + - X: -40422540 + Y: 92636272 + - X: -40234224 + Y: 94277328 + - X: -41572064 + Y: 96487216 + - X: -37829556 + Y: 100955984 + - X: -40709084 + Y: 102473192 + - X: -35556632 + Y: 104645752 + - X: -31316680 + Y: 104089088 + - X: -28491748 + Y: 103603336 + - X: -28253932 + Y: 105230768 + - X: -33271296 + Y: 109477408 + - X: -26868706 + Y: 111246616 + - X: -20948036 + Y: 109761944 + - X: -18344440 + Y: 108495480 + - X: -16540480 + Y: 109440664 + - X: -14449447 + Y: 112793752 + - X: -17052572 + Y: 119331056 + - X: -10387702 + Y: 118230568 + - X: -4340226 + Y: 112285176 + - X: -1703627 + Y: 108701824 + - X: 1500277 + Y: 111812704 + - X: 8456728 + Y: 117455984 + - X: 15182831 + Y: 120097600 + - X: 10377641 + Y: 112200224 + - X: 11829250 + Y: 109052800 + - X: 13626671 + Y: 108485776 + - X: 15246513 + Y: 110654360 + - X: 19372280 + Y: 114499664 + - X: 24903318 + Y: 116030976 + - X: 23388882 + Y: 110572072 + - X: 27590756 + Y: 107830984 + - X: 30540028 + Y: 107079184 + - X: 37307940 + Y: 112327784 + - X: 41631776 + Y: 114117200 + - X: 39717268 + Y: 109293544 + - X: 41350604 + Y: 106361736 + - X: 42844676 + Y: 105225640 + - X: 45680076 + Y: 106491448 + - X: 49239956 + Y: 107826128 + - X: 53526956 + Y: 104636528 + - m_Collider: {fileID: 1617661205} + m_ColliderPaths: + - - X: 32161664 + Y: 37039448 + - X: 24945832 + Y: 33575696 + - X: 16725292 + Y: 28355770 + - X: 13853858 + Y: 25944918 + - X: 12265774 + Y: 21977818 + - X: 9024763 + Y: 19370184 + - X: 8191286 + Y: 14893000 + - X: 8469409 + Y: -5239951 + - X: 9151134 + Y: -9579406 + - X: 13592415 + Y: -19805832 + - X: -15145779 + Y: -19126238 + - X: -11785040 + Y: -11498156 + - X: -9134235 + Y: 3069253 + - X: -7110409 + Y: 10000720 + - X: -6562767 + Y: 16638246 + - X: -6784560 + Y: 20275488 + - X: -9565268 + Y: 27984266 + - X: -12525163 + Y: 31749130 + - X: -17770862 + Y: 35412140 + - X: -22202620 + Y: 35644360 + - X: -25306186 + Y: 38484784 + - X: -26112012 + Y: 40566100 + - X: -30846714 + Y: 43948268 + - X: -30623064 + Y: 46001972 + - X: -26948276 + Y: 46891012 + - X: -24858436 + Y: 45957736 + - X: -22803298 + Y: 43914736 + - X: -21437320 + Y: 40019964 + - X: -17603226 + Y: 39468376 + - X: -17951680 + Y: 43721008 + - X: -22362670 + Y: 50282944 + - X: -16668215 + Y: 51576664 + - X: -13540664 + Y: 44399480 + - X: -12570138 + Y: 40135156 + - X: -6109714 + Y: 35265284 + - X: -8696252 + Y: 40489564 + - X: -10247960 + Y: 42295276 + - X: -11893249 + Y: 46237412 + - X: -12826447 + Y: 49772436 + - X: -12740116 + Y: 52245064 + - X: -5870876 + Y: 53985176 + - X: -5669900 + Y: 46160716 + - X: -4614071 + Y: 41999508 + - X: -1418198 + Y: 37117528 + - X: 207457 + Y: 36476324 + - X: -148426 + Y: 40472804 + - X: 426726 + Y: 43592804 + - X: -2458820 + Y: 50692884 + - X: 2021923 + Y: 51523312 + - X: 4702787 + Y: 44432324 + - X: 4479648 + Y: 40100780 + - X: 6601566 + Y: 39519784 + - X: 9695730 + Y: 50264112 + - X: 14917965 + Y: 50735056 + - X: 11751280 + Y: 40610808 + - X: 12065464 + Y: 37879328 + - X: 13959025 + Y: 38277312 + - X: 19009830 + Y: 44006796 + - X: 22609882 + Y: 51062452 + - X: 28487378 + Y: 48576296 + - X: 24676914 + Y: 45392552 + - X: 21631108 + Y: 40083464 + - X: 17915496 + Y: 35935784 + - X: 26620198 + Y: 39903964 + - X: 30860624 + Y: 41486148 + - X: 39016972 + Y: 49434100 + - X: 43785668 + Y: 46795300 + - X: 41430640 + Y: 44967416 + - X: 36492512 + Y: 40971576 + - X: 32161664 + Y: 37039448 + m_CompositePaths: + m_Paths: + - - {x: 0.9151134, y: -0.95794064} + - {x: 0.84694093, y: -0.5239951} + - {x: 0.81912863, y: 1.4893} + - {x: 0.9024763, y: 1.9370184} + - {x: 1.2265774, y: 2.1977818} + - {x: 1.3853859, y: 2.5944917} + - {x: 1.6725292, y: 2.835577} + - {x: 2.4945831, y: 3.3575697} + - {x: 3.2161665, y: 3.703945} + - {x: 3.52765, y: 3.9867516} + - {x: 3.6903324, y: 3.8612013} + - {x: 3.9221656, y: 3.7786806} + - {x: 3.9222493, y: 3.5626683} + - {x: 3.8199492, y: 3.24015} + - {x: 4.0856724, y: 3.393762} + - {x: 4.2288446, y: 3.5954688} + - {x: 4.5853586, y: 3.5907557} + - {x: 4.6835003, y: 4.042261} + - {x: 4.8800545, y: 3.8934596} + - {x: 4.9152203, y: 3.6227732} + - {x: 5.185317, y: 3.4421673} + - {x: 4.9118624, y: 3.0842996} + - {x: 5.467513, y: 2.8132386} + - {x: 5.991563, y: 3.1888332} + - {x: 5.7851257, y: 3.4825013} + - {x: 5.9964027, y: 3.5534897} + - {x: 6.2694635, y: 3.3688436} + - {x: 6.2750244, y: 3.7962933} + - {x: 6.0755024, y: 3.9985635} + - {x: 5.7737417, y: 4.1248236} + - {x: 6.013591, y: 4.377426} + - {x: 6.352837, y: 4.0364656} + - {x: 6.486561, y: 4.4639974} + - {x: 6.612749, y: 4.5109577} + - {x: 6.6833787, y: 4.1228} + - {x: 6.884828, y: 4.4829187} + - {x: 6.813869, y: 4.914798} + - {x: 6.3172436, y: 5.2511673} + - {x: 6.4060273, y: 5.379228} + - {x: 6.3198843, y: 5.665673} + - {x: 6.5460987, y: 5.690972} + - {x: 6.6919365, y: 5.1919365} + - {x: 6.82896, y: 5.391409} + - {x: 7.110373, y: 5.284565} + - {x: 6.9712367, y: 5.709002} + - {x: 7.2241, y: 5.6305857} + - {x: 7.192128, y: 5.896806} + - {x: 6.908065, y: 6.022915} + - {x: 6.6557007, y: 6.2867355} + - {x: 6.3943906, y: 6.3310246} + - {x: 6.783189, y: 6.6693273} + - {x: 6.2391624, y: 6.7443223} + - {x: 6.41179, y: 6.898403} + - {x: 6.6942205, y: 6.8483744} + - {x: 6.895944, y: 6.9900393} + - {x: 7.0711145, y: 6.672701} + - {x: 7.145892, y: 6.9592223} + - {x: 7.0460095, y: 7.221169} + - {x: 6.8785114, y: 7.398657} + - {x: 6.887753, y: 7.613432} + - {x: 7.1754155, y: 7.5991235} + - {x: 6.933622, y: 7.8807883} + - {x: 6.5515175, y: 7.817401} + - {x: 6.3523245, y: 7.725852} + - {x: 6.275492, y: 7.849282} + - {x: 6.6329007, y: 8.076433} + - {x: 6.2848024, y: 8.155276} + - {x: 5.7968826, y: 8.069115} + - {x: 6.000128, y: 8.326774} + - {x: 6.197501, y: 8.813801} + - {x: 5.770461, y: 9.101273} + - {x: 5.7183056, y: 9.251206} + - {x: 6.2597504, y: 9.584465} + - {x: 5.6776476, y: 9.984047} + - {x: 4.990549, y: 9.802225} + - {x: 4.6591415, y: 9.61387} + - {x: 4.6200595, y: 9.790889} + - {x: 4.7351, y: 10.156748} + - {x: 5.3526955, y: 10.463653} + - {x: 4.9239955, y: 10.782613} + - {x: 4.5680075, y: 10.649145} + - {x: 4.2844677, y: 10.522564} + - {x: 4.1350603, y: 10.636173} + - {x: 3.971727, y: 10.929355} + - {x: 4.1631775, y: 11.41172} + - {x: 3.730794, y: 11.232779} + - {x: 3.0540028, y: 10.707918} + - {x: 2.7590756, y: 10.783098} + - {x: 2.3388882, y: 11.057207} + - {x: 2.490332, y: 11.603098} + - {x: 1.937228, y: 11.449966} + - {x: 1.5246513, y: 11.065436} + - {x: 1.3626671, y: 10.8485775} + - {x: 1.182925, y: 10.90528} + - {x: 1.0377641, y: 11.220022} + - {x: 1.5182831, y: 12.00976} + - {x: 0.8456728, y: 11.745599} + - {x: 0.1500277, y: 11.181271} + - {x: -0.1703627, y: 10.870183} + - {x: -0.4340226, y: 11.228518} + - {x: -1.0387702, y: 11.823057} + - {x: -1.7052572, y: 11.933105} + - {x: -1.4449447, y: 11.279375} + - {x: -1.654048, y: 10.944067} + - {x: -1.834444, y: 10.849548} + - {x: -2.0948036, y: 10.976194} + - {x: -2.6868706, y: 11.124661} + - {x: -3.3271296, y: 10.947741} + - {x: -2.8253932, y: 10.523077} + - {x: -2.8491747, y: 10.360333} + - {x: -3.131668, y: 10.408909} + - {x: -3.5556633, y: 10.464576} + - {x: -4.0709085, y: 10.247319} + - {x: -3.7829556, y: 10.095598} + - {x: -4.1572065, y: 9.648722} + - {x: -4.0234222, y: 9.427732} + - {x: -4.042254, y: 9.263627} + - {x: -4.3557234, y: 9.241369} + - {x: -4.907151, y: 9.18826} + - {x: -5.312766, y: 8.771414} + - {x: -4.9015183, y: 8.725356} + - {x: -5.0963607, y: 8.071753} + - {x: -4.695151, y: 7.9343257} + - {x: -4.8092084, y: 7.6933746} + - {x: -4.9547377, y: 7.5650287} + - {x: -5.3752904, y: 7.6244273} + - {x: -5.901024, y: 7.480465} + - {x: -6.0907655, y: 6.9309626} + - {x: -6.222801, y: 6.2994285} + - {x: -6.20214, y: 5.9383745} + - {x: -5.9352465, y: 6.3665967} + - {x: -5.671871, y: 6.6783333} + - {x: -5.175964, y: 6.73337} + - {x: -5.149768, y: 6.506799} + - {x: -5.245922, y: 6.290904} + - {x: -5.8966603, y: 5.9843554} + - {x: -6.1595273, y: 5.398411} + - {x: -5.8997297, y: 4.8348875} + - {x: -5.5447845, y: 5.2870626} + - {x: -5.4007807, y: 4.914544} + - {x: -4.82864, y: 4.911689} + - {x: -5.2888656, y: 4.6000404} + - {x: -5.7136574, y: 4.1197214} + - {x: -5.593487, y: 3.4583828} + - {x: -5.2834797, y: 3.9621172} + - {x: -5.149908, y: 3.9839325} + - {x: -5.0234566, y: 3.6282206} + - {x: -4.6303005, y: 3.8805652} + - {x: -4.3462553, y: 3.5599236} + - {x: -4.6056585, y: 2.9962883} + - {x: -4.730715, y: 2.5160484} + - {x: -4.5142756, y: 1.9529077} + - {x: -4.351792, y: 2.4748988} + - {x: -3.9343293, y: 2.640172} + - {x: -3.9284685, y: 3.2115421} + - {x: -3.4852612, y: 3.3165402} + - {x: -3.2667542, y: 3.7052605} + - {x: -3.0501277, y: 3.9189677} + - {x: -2.7682908, y: 3.6044445} + - {x: -2.5817208, y: 3.9804668} + - {x: -2.5306187, y: 3.8484786} + - {x: -2.220262, y: 3.564436} + - {x: -1.7770863, y: 3.541214} + - {x: -1.2525163, y: 3.174913} + - {x: -0.9565268, y: 2.7984266} + - {x: -0.678456, y: 2.0275488} + - {x: -0.6562767, y: 1.6638247} + - {x: -0.7110409, y: 1.000072} + - {x: -0.91342354, y: 0.3069253} + - {x: -1.178504, y: -1.1498156} + - {x: -1.5145779, y: -1.9126238} + - {x: 1.3592415, y: -1.9805832} + - - {x: 1.175128, y: 4.061081} + - {x: 1.2643868, y: 4.346451} + - {x: 1.4229414, y: 4.206705} + - {x: 1.6300757, y: 4.55227} + - {x: 1.8559263, y: 4.6903505} + - {x: 2.0595052, y: 4.7113633} + - {x: 1.900983, y: 4.4006796} + - {x: 1.3959025, y: 3.8277311} + - {x: 1.2065464, y: 3.7879329} + - - {x: 2.1631107, y: 4.0083466} + - {x: 2.4309523, y: 4.4752154} + - {x: 2.5189464, y: 4.5660505} + - {x: 2.9367335, y: 4.4021645} + - {x: 3.2148123, y: 4.489348} + - {x: 3.168866, y: 4.2293024} + - {x: 3.0860624, y: 4.148615} + - {x: 2.6620197, y: 3.9903965} + - {x: 1.7915496, y: 3.5935783} + - - {x: -1.2570138, y: 4.0135155} + - {x: -1.3540664, y: 4.439948} + - {x: -1.3701233, y: 4.4767957} + - {x: -1.3449942, y: 4.479533} + - {x: -1.0509828, y: 4.2922716} + - {x: -1.024796, y: 4.2295275} + - {x: -0.8696252, y: 4.0489564} + - {x: -0.6109714, y: 3.5265284} + - - {x: 0.44796482, y: 4.010078} + - {x: 0.4658033, y: 4.3563566} + - {x: 0.6821952, y: 4.440889} + - {x: 0.8081135, y: 4.465751} + - {x: 0.6601566, y: 3.9519784} + - - {x: -0.1418198, y: 3.711753} + - {x: -0.4614071, y: 4.1999507} + - {x: -0.5205443, y: 4.433021} + - {x: -0.5027587, y: 4.452107} + - {x: 0.0365019, y: 4.3258066} + - {x: -0.014842601, y: 4.0472803} + - {x: 0.0207457, y: 3.6476324} + - - {x: -2.143732, y: 4.0019965} + - {x: -2.2492316, y: 4.302804} + - {x: -1.8464432, y: 4.4249067} + - {x: -1.8317412, y: 4.4265084} + - {x: -1.795168, y: 4.372101} + - {x: -1.7603226, y: 3.9468377} + m_VertexDistance: 0.0005 +--- !u!50 &1617661207 +Rigidbody2D: + serializedVersion: 4 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1617661204} + m_BodyType: 0 + m_Simulated: 1 + m_UseFullKinematicContacts: 0 + m_UseAutoMass: 0 + m_Mass: 1 + m_LinearDrag: 0 + m_AngularDrag: 0.05 + m_GravityScale: 1 + m_Material: {fileID: 0} + m_Interpolate: 0 + m_SleepingMode: 1 + m_CollisionDetection: 0 + m_Constraints: 0 +--- !u!1971053207 &1617661208 +SpriteShapeRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1617661204} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 4294967295 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: -47 + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_MaskInteraction: 0 + m_ShapeTexture: {fileID: 2800000, guid: a94adaf94669646788de8f639270804a, type: 3} + m_Sprites: [] + m_LocalAABB: + m_Center: {x: 0.61055565, y: 1.7089672, z: 0} + m_Extent: {x: 3.768011, y: 3.6895504, z: 0} +--- !u!114 &1617661209 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1617661204} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 90539df1cd5704abcb25fec9f3f5f84b, type: 3} + m_Name: + m_EditorClassIdentifier: + m_LegacyGenerator: 0 + m_Spline: + m_IsOpenEnded: 0 + m_ControlPoints: + - position: {x: 3.2161665, y: 3.7039447, z: 0} + leftTangent: {x: 0.29637432, y: 0.3156371, z: 0} + rightTangent: {x: -0.18563461, y: -0.12632513, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 2.4945831, y: 3.3575697, z: 0} + leftTangent: {x: 0.28138256, y: 0.13293266, z: 0} + rightTangent: {x: -0.34662533, y: -0.16375494, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.6725292, y: 2.835577, z: 0} + leftTangent: {x: 0.23968983, y: 0.117557526, z: 0} + rightTangent: {x: -0.40787888, y: -0.20004654, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.2641973, y: 2.2486148, z: 0} + leftTangent: {x: 0.21426773, y: 0.30344486, z: 0} + rightTangent: {x: -0.013861656, y: -0.019630432, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.9024763, y: 1.9370184, z: 0} + leftTangent: {x: 0.25271893, y: 0.13478279, z: 0} + rightTangent: {x: -0.1273861, y: -0.19007063, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.83741856, y: 1.205905, z: 0} + leftTangent: {x: -0.01540947, y: 0.30619144, z: 0} + rightTangent: {x: 0.010803223, y: -0.21466827, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.8321533, y: 0.48545122, z: 0} + leftTangent: {x: -0.023444176, y: 0.23949337, z: 0} + rightTangent: {x: 0.05688286, y: -0.58109426, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.91511345, y: -0.9579406, z: 0} + leftTangent: {x: -0.1334362, y: 0.42494583, z: 0} + rightTangent: {x: 0.1334362, y: -0.42494583, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.3592415, y: -1.9805832, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.5145779, y: -1.9126239, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.178504, y: -1.1498156, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.91342354, y: 0.3069253, z: 0} + leftTangent: {x: -0.06021799, y: -0.48489377, z: -0} + rightTangent: {x: 0.014711857, y: 0.11846447, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.711041, y: 1.000072, z: 0} + leftTangent: {x: -0.05616665, y: -0.261549, z: 0} + rightTangent: {x: 0.0570817, y: 0.2658105, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.6562767, y: 1.6638246, z: 0} + leftTangent: {x: -0.015919685, y: -0.1831832, z: 0} + rightTangent: {x: 0.031583786, y: 0.36343002, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.95652676, y: 2.7984266, z: 0} + leftTangent: {x: 0.1873169, y: -0.41380215, z: 0} + rightTangent: {x: -0.1873169, y: 0.41380262, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.7770863, y: 3.541214, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -2.220262, y: 3.564436, z: 0} + leftTangent: {x: 0.15812826, y: -0.080470085, z: -0} + rightTangent: {x: -0.15812826, y: 0.080470085, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -2.6112013, y: 4.05661, z: 0} + leftTangent: {x: 0.032327175, y: -0.22142982, z: 0} + rightTangent: {x: -0.206254, y: 0.21478653, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -3.0591974, y: 4.336563, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -3.1574554, y: 4.5612955, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -2.7904515, y: 4.7113476, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -2.2803297, y: 4.391474, z: 0} + leftTangent: {x: -0.16483545, y: 0.27308178, z: 0} + rightTangent: {x: -0.037330627, y: -0.23173237, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -2.0535293, y: 3.9288006, z: 0} + leftTangent: {x: -0.051990986, y: 0.01066494, z: 0} + rightTangent: {x: 0.14825106, y: -0.03041172, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.7603226, y: 3.9468374, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.7951679, y: 4.372101, z: 0} + leftTangent: {x: 0.113922596, y: -0.19186401, z: 0} + rightTangent: {x: -0.113922596, y: 0.19186401, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -2.236267, y: 5.0282946, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.6668215, y: 5.157666, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.3540664, y: 4.439948, z: 0} + leftTangent: {x: -0.108444214, y: 0.30963707, z: 0} + rightTangent: {x: -0.0831933, y: -0.2580328, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.2570138, y: 4.0135155, z: 0} + leftTangent: {x: -0.042501926, y: 0.059401512, z: 0} + rightTangent: {x: 0.14927785, y: -0.20863414, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.61097145, y: 3.5265284, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.79677916, y: 3.9602566, z: 0} + leftTangent: {x: 0.12550545, y: -0.21432257, z: 0} + rightTangent: {x: -0.05933857, y: 0.101331234, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.024796, y: 4.2295275, z: 0} + leftTangent: {x: 0.056889057, y: -0.11766052, z: 0} + rightTangent: {x: -0.18988562, y: 0.3927288, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.2740116, y: 5.2245064, z: 0} + leftTangent: {x: -0.0698576, y: -0.17230129, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.58708763, y: 5.3985176, z: 0} + leftTangent: {x: -0.19785118, y: -0.041404724, z: 0} + rightTangent: {x: 0.021735191, y: -0.43342495, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.5141282, y: 4.297098, z: 0} + leftTangent: {x: -0.087246895, y: 0.29190826, z: 0} + rightTangent: {x: 0.03632927, y: -0.12154961, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.32701302, y: 4.0581894, z: 0} + leftTangent: {x: -0.053714752, y: 0.08466339, z: 0} + rightTangent: {x: 0.08326244, y: -0.1312356, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.20596313, y: 3.7745, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.041446686, y: 3.5324764, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.038399696, y: 3.9766502, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.042672634, y: 4.3592806, z: 0} + leftTangent: {x: 0.011422487, y: -0.12856482, z: -0} + rightTangent: {x: -0.011422487, y: 0.12856482, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.24588203, y: 5.0692883, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.2021923, y: 5.1523314, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.47027874, y: 4.4432325, z: 0} + leftTangent: {x: -0.01453297, y: 0.12667656, z: -0} + rightTangent: {x: 0.01453297, y: -0.12667656, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.41903877, y: 4.060259, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.53061104, y: 3.866706, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.7490721, y: 4.0666647, z: 0} + leftTangent: {x: -0.07262421, y: -0.14140224, z: 0} + rightTangent: {x: 0.07117653, y: 0.13858509, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.83037186, y: 4.522544, z: 0} + leftTangent: {x: -0.012257576, y: -0.09680939, z: 0} + rightTangent: {x: 0.024763772, y: 0.19558822, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.969573, y: 5.026411, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.4917965, y: 5.0735054, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.3690004, y: 4.648546, z: 0} + leftTangent: {x: 0.020481981, y: 0.13927653, z: -0} + rightTangent: {x: -0.020481981, y: -0.13927653, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.175128, y: 4.061081, z: 0} + leftTangent: {x: 0.0147908535, y: 0.09184909, z: 0} + rightTangent: {x: -0.0147908535, y: -0.09184909, z: -0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.1583805, y: 3.7965221, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.3441639, y: 3.7633934, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.8233624, y: 4.280553, z: 0} + leftTangent: {x: -0.32624054, y: -0.31383038, z: 0} + rightTangent: {x: 0.10512543, y: 0.10112572, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.9973726, y: 4.6721106, z: 0} + leftTangent: {x: -0.06396866, y: -0.1184988, z: 0} + rightTangent: {x: 0.13454914, y: 0.24924564, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 2.2609882, y: 5.106245, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 2.8487377, y: 4.85763, z: 0} + leftTangent: {x: -0.18434525, y: 0.09165478, z: 0} + rightTangent: {x: -0.023777962, y: -0.08772373, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 2.4676914, y: 4.539255, z: 0} + leftTangent: {x: 0.10719395, y: 0.13840485, z: 0} + rightTangent: {x: -0.12870502, y: -0.16617966, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 2.1631107, y: 4.0083466, z: 0} + leftTangent: {x: 0.12242985, y: 0.16440964, z: 0} + rightTangent: {x: -0.17392349, y: -0.23356056, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.7915497, y: 3.5935783, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 2.5975342, y: 3.977995, z: 0} + leftTangent: {x: -0.40057755, y: -0.17875051, z: 0} + rightTangent: {x: 0.060819626, y: 0.027139664, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 2.8040981, y: 3.9970493, z: 0} + leftTangent: {x: -0.07244396, y: -0.020699501, z: 0} + rightTangent: {x: 0.11561108, y: 0.03303337, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 3.0860624, y: 4.148615, z: 0} + leftTangent: {x: -0.053355217, y: -0.038443565, z: 0} + rightTangent: {x: 0.30699492, y: 0.22119066, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 3.9016972, y: 4.94341, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 4.3785667, y: 4.67953, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + m_SpriteShape: {fileID: 11400000, guid: 8e3fa9c7ff3ad4112a30689e933384ed, type: 2} + m_FillPixelPerUnit: 100 + m_StretchTiling: 1 + m_SplineDetail: 4 + m_AdaptiveUV: 1 + m_StretchUV: 0 + m_WorldSpaceUV: 0 + m_ColliderDetail: 16 + m_ColliderOffset: 0 + m_UpdateCollider: 0 + m_OptimizeCollider: 1 +--- !u!4 &1617661210 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1617661204} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -49.4, y: 16.22, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 778552137} + m_Father: {fileID: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1820847793 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1820847796} + - component: {fileID: 1820847795} + - component: {fileID: 1820847794} + - component: {fileID: 1820847800} + - component: {fileID: 1820847799} + - component: {fileID: 1820847798} + - component: {fileID: 1820847797} + m_Layer: 0 + m_Name: Block (Geometry Collider) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!1971053207 &1820847794 +SpriteShapeRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1820847793} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 4294967295 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 20 + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_MaskInteraction: 0 + m_ShapeTexture: {fileID: 2800000, guid: 7d8cda48c729c46329cd9d3c69a3a4e6, type: 3} + m_Sprites: + - {fileID: 21300006, guid: 3bc0f8978d0114d568eb440fca26e64b, type: 3} + - {fileID: 21300014, guid: 3bc0f8978d0114d568eb440fca26e64b, type: 3} + - {fileID: 21300002, guid: 3bc0f8978d0114d568eb440fca26e64b, type: 3} + - {fileID: 21300012, guid: a8321f6fae34f034787010a903e29648, type: 3} + - {fileID: 21300010, guid: 3bc0f8978d0114d568eb440fca26e64b, type: 3} + - {fileID: 21300000, guid: 3bc0f8978d0114d568eb440fca26e64b, type: 3} + - {fileID: 21300004, guid: 3bc0f8978d0114d568eb440fca26e64b, type: 3} + - {fileID: 21300012, guid: 3bc0f8978d0114d568eb440fca26e64b, type: 3} + - {fileID: 21300008, guid: 3bc0f8978d0114d568eb440fca26e64b, type: 3} + - {fileID: 0} + - {fileID: 0} + - {fileID: 21300012, guid: 3bc0f8978d0114d568eb440fca26e64b, type: 3} + - {fileID: 21300008, guid: 3bc0f8978d0114d568eb440fca26e64b, type: 3} + m_LocalAABB: + m_Center: {x: -2.2558622, y: 7.1187773, z: -0.0050049997} + m_Extent: {x: 13.562195, y: 15.5975685, z: 0.0050049997} +--- !u!114 &1820847795 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1820847793} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 90539df1cd5704abcb25fec9f3f5f84b, type: 3} + m_Name: + m_EditorClassIdentifier: + m_LegacyGenerator: 0 + m_Spline: + m_IsOpenEnded: 0 + m_ControlPoints: + - position: {x: -1.636219, y: -7.9291697, z: 0} + leftTangent: {x: 6.020996, y: 1.5137386, z: 0} + rightTangent: {x: -2.8936367, y: -0.7274895, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -15.358402, y: -2.2131429, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -8.29718, y: 14.782811, z: 0} + leftTangent: {x: -0.73890686, y: -2.238881, z: 0} + rightTangent: {x: 1.9517517, y: 5.9137793, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 3.9383159, y: 21.970736, z: 0} + leftTangent: {x: -4.723675, y: 1.0711021, z: 0} + rightTangent: {x: 8.273635, y: -1.8760605, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 10.761995, y: 3.851832, z: 0} + leftTangent: {x: -0.6242571, y: 3.3770556, z: 0} + rightTangent: {x: 0.5823755, y: -3.1504874, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.837639, y: -2.8409967, z: 0} + leftTangent: {x: 0.4805252, y: 1.809861, z: -0} + rightTangent: {x: -0.4805252, y: -1.809861, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + m_SpriteShape: {fileID: 11400000, guid: a710fe91ca336478e999261a86254e9f, type: 2} + m_FillPixelPerUnit: 100 + m_StretchTiling: 1 + m_SplineDetail: 16 + m_AdaptiveUV: 1 + m_StretchUV: 0 + m_WorldSpaceUV: 0 + m_ColliderDetail: 4 + m_ColliderOffset: 0 + m_UpdateCollider: 0 + m_OptimizeCollider: 1 +--- !u!4 &1820847796 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1820847793} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 1.3000011, y: -26.28, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!66 &1820847797 +CompositeCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1820847793} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: 0} + m_GeometryType: 0 + m_GenerationType: 0 + m_EdgeRadius: 0 + m_ColliderPaths: + - m_Collider: {fileID: 1820847800} + m_ColliderPaths: + - - X: 10393014 + Y: 222022176 + - X: 20147738 + Y: 222166096 + - X: 20147739 + Y: 222166096 + - X: 19985760 + Y: 217168736 + - X: 10701468 + Y: 217031696 + - - X: 102324680 + Y: 7954787 + - X: 98509256 + Y: 11186286 + - X: 96290264 + Y: 13065676 + - X: 94626704 + Y: 14340032 + - X: 94693832 + Y: 14417785 + - X: 96290264 + Y: 13065676 + - X: 98595933 + Y: 11299438 + - X: 98509256 + Y: 11186286 + - X: 102324680 + Y: 7954787 + - X: 102565168 + Y: 8258840 + - X: 98595933 + Y: 11299438 + - X: 96290264 + Y: 13065676 + - X: 94693832 + Y: 14417785 + - X: 94652691 + Y: 14373823 + - X: 94626704 + Y: 14340032 + - X: 96290264 + Y: 13065676 + - X: 98509256 + Y: 11186286 + - X: 94186000 + Y: 6561857 + - X: 97717224 + Y: 3022021 + - - X: 31933232 + Y: -55807752 + - X: 36600768 + Y: -52652708 + - X: 39578284 + Y: -56669468 + - X: 34572578 + Y: -60054378 + - X: 37211924 + Y: -64301004 + - X: 42555804 + Y: -60686232 + - X: 39578284 + Y: -56669468 + - X: 36600768 + Y: -52652708 + - X: 36639492 + Y: -52615280 + - X: 39788140 + Y: -56499346 + - X: 39578284 + Y: -56669468 + - X: 42555804 + Y: -60686232 + - X: 42936792 + Y: -60383416 + - X: 39788140 + Y: -56499346 + - X: 36639492 + Y: -52615280 + - X: 40475260 + Y: -49513032 + - X: 43804755 + Y: -53243241 + - X: 39788140 + Y: -56499346 + - X: 42936792 + Y: -60383416 + - X: 47134252 + Y: -56973452 + - X: 43804755 + Y: -53243241 + - X: 40475260 + Y: -49513032 + - X: 43655352 + Y: -46391920 + - X: 46243324 + Y: -43282444 + - X: 48340096 + Y: -40166372 + - X: 50039404 + Y: -37017080 + - X: 54538519 + Y: -39198350 + - X: 52618876 + Y: -42753272 + - X: 56897656 + Y: -45340172 + - X: 59037636 + Y: -41379620 + - X: 54538519 + Y: -39198350 + - X: 50039404 + Y: -37017080 + - X: 51424804 + Y: -33805964 + - X: 56083976 + Y: -35620389 + - X: 54538520 + Y: -39198348 + - X: 54538519 + Y: -39198350 + - X: 59037636 + Y: -41379620 + - X: 60743144 + Y: -37434812 + - X: 56083976 + Y: -35620389 + - X: 51424804 + Y: -33805964 + - X: 52552380 + Y: -30556802 + - X: 57274444 + Y: -32200620 + - X: 56083976 + Y: -35620388 + - X: 56083976 + Y: -35620389 + - X: 60743144 + Y: -37434812 + - X: 61996504 + Y: -33844436 + - X: 57274444 + Y: -32200620 + - X: 52552380 + Y: -30556802 + - X: 52571016 + Y: -30508956 + - X: 53664660 + Y: -26736768 + - X: 55548876 + Y: -22356758 + - X: 59913445 + Y: -24796133 + - X: 59913444 + Y: -24796134 + - X: 58376388 + Y: -28409968 + - X: 63088116 + Y: -30083168 + - X: 64278012 + Y: -27235508 + - X: 59913445 + Y: -24796133 + - X: 55548876 + Y: -22356758 + - X: 58609584 + Y: -18013564 + - X: 62394320 + Y: -13960872 + - X: 65902014 + Y: -17524026 + - X: 65902012 + Y: -17524028 + - X: 62482156 + Y: -21176348 + - X: 66354728 + Y: -24339132 + - X: 69409712 + Y: -21087184 + - X: 65902014 + Y: -17524026 + - X: 62394320 + Y: -13960872 + - X: 66716280 + Y: -10035498 + - X: 71416376 + Y: -6137917 + - X: 74573074 + Y: -10015445 + - X: 74573072 + Y: -10015447 + - X: 69992496 + Y: -13812590 + - X: 73268712 + Y: -17589682 + - X: 77729776 + Y: -13892977 + - X: 74573074 + Y: -10015445 + - X: 71416376 + Y: -6137917 + - X: 72768800 + Y: -5056467 + - X: 75890964 + Y: -8961859 + - X: 74573074 + Y: -10015445 + - X: 77729776 + Y: -13892977 + - X: 79013128 + Y: -12867252 + - X: 75890964 + Y: -8961859 + - X: 72768800 + Y: -5056467 + - X: 76332624 + Y: -2207380 + - X: 81295544 + Y: 1795032 + - X: 86129328 + Y: 5893939 + - X: 89450206 + Y: 2156048 + - X: 84482448 + Y: -2057712 + - X: 87669352 + Y: -5910456 + - X: 92771080 + Y: -1581838 + - X: 89450206 + Y: 2156048 + - X: 86129328 + Y: 5893939 + - X: 90654776 + Y: 10101693 + - X: 94652691 + Y: 14373823 + - X: 98078680 + Y: 18828530 + - X: 102239535 + Y: 16055930 + - X: 98595933 + Y: 11299438 + - X: 102565168 + Y: 8258840 + - X: 106400384 + Y: 13283334 + - X: 102239535 + Y: 16055930 + - X: 98078680 + Y: 18828530 + - X: 100666808 + Y: 23314944 + - X: 102355720 + Y: 27879562 + - X: 107198912 + Y: 26637197 + - X: 107198912 + Y: 26637196 + - X: 105196256 + Y: 21197374 + - X: 109725704 + Y: 19079804 + - X: 112042112 + Y: 25394830 + - X: 107198912 + Y: 26637197 + - X: 102355720 + Y: 27879562 + - X: 103070640 + Y: 32593186 + - X: 108066976 + Y: 32401981 + - X: 107198912 + Y: 26637197 + - X: 112042112 + Y: 25394830 + - X: 113063320 + Y: 32210776 + - X: 108066976 + Y: 32401981 + - X: 103070640 + Y: 32593186 + - X: 102642248 + Y: 38046636 + - X: 107619952 + Y: 38518318 + - X: 108066976 + Y: 32401982 + - X: 108066976 + Y: 32401981 + - X: 113063320 + Y: 32210776 + - X: 112597656 + Y: 38990000 + - X: 112494280 + Y: 39887244 + - X: 107527872 + Y: 39308545 + - X: 107619952 + Y: 38518320 + - X: 107619952 + Y: 38518318 + - X: 102642248 + Y: 38046636 + - X: 102561472 + Y: 38729848 + - X: 107527872 + Y: 39308545 + - X: 112494280 + Y: 39887244 + - X: 111676712 + Y: 46875004 + - X: 106692584 + Y: 46476916 + - X: 107527872 + Y: 39308545 + - X: 102561472 + Y: 38729848 + - X: 101708448 + Y: 46078828 + - X: 106692584 + Y: 46476916 + - X: 111676712 + Y: 46875004 + - X: 111250696 + Y: 56748828 + - X: 106252864 + Y: 56601782 + - X: 106252864 + Y: 56601780 + - X: 106692584 + Y: 46476916 + - X: 101708448 + Y: 46078828 + - X: 101255024 + Y: 56454736 + - X: 106252864 + Y: 56601782 + - X: 111250696 + Y: 56748828 + - X: 111068408 + Y: 68597368 + - X: 106068880 + Y: 68528848 + - X: 106252864 + Y: 56601782 + - X: 101255024 + Y: 56454736 + - X: 101069344 + Y: 68460328 + - X: 106068880 + Y: 68528848 + - X: 111068408 + Y: 68597368 + - X: 111054160 + Y: 69786336 + - X: 110907784 + Y: 81987800 + - X: 105908664 + Y: 81894072 + - X: 106054524 + Y: 69726408 + - X: 101054888 + Y: 69666480 + - X: 100909536 + Y: 81800344 + - X: 105908664 + Y: 81894072 + - X: 110907784 + Y: 81987800 + - X: 110536424 + Y: 96530352 + - X: 110327256 + Y: 100459192 + - X: 105334354 + Y: 100192756 + - X: 105540304 + Y: 96333360 + - X: 100544184 + Y: 96136368 + - X: 100341464 + Y: 99926320 + - X: 105334354 + Y: 100192756 + - X: 110327256 + Y: 100459192 + - X: 109718096 + Y: 111853760 + - X: 104731888 + Y: 111482688 + - X: 105334354 + Y: 100192756 + - X: 100341464 + Y: 99926320 + - X: 99745672 + Y: 111111616 + - X: 104731888 + Y: 111482688 + - X: 109718096 + Y: 111853760 + - X: 108213016 + Y: 127596648 + - X: 107644136 + Y: 131302816 + - X: 102702441 + Y: 130541497 + - X: 103251440 + Y: 126977960 + - X: 98289864 + Y: 126359272 + - X: 97760736 + Y: 129780176 + - X: 102702441 + Y: 130541497 + - X: 107644136 + Y: 131302816 + - X: 105776112 + Y: 143404272 + - X: 102153784 + Y: 158925824 + - X: 101137040 + Y: 161929488 + - X: 96404139 + Y: 160317153 + - X: 97346752 + Y: 157550176 + - X: 92539720 + Y: 156174528 + - X: 91671232 + Y: 158704816 + - X: 96404139 + Y: 160317153 + - X: 101137040 + Y: 161929488 + - X: 97079360 + Y: 173809104 + - X: 92458639 + Y: 171898897 + - X: 92458640 + Y: 171898896 + - X: 96404139 + Y: 160317153 + - X: 91671232 + Y: 158704816 + - X: 87837912 + Y: 169988688 + - X: 92458639 + Y: 171898897 + - X: 97079360 + Y: 173809104 + - X: 90270616 + Y: 187689264 + - X: 85970805 + Y: 185137460 + - X: 85970808 + Y: 185137456 + - X: 92458639 + Y: 171898897 + - X: 87837912 + Y: 169988688 + - X: 81671008 + Y: 182585664 + - X: 85970805 + Y: 185137460 + - X: 90270616 + Y: 187689264 + - X: 88032672 + Y: 190881440 + - X: 83950366 + Y: 187994441 + - X: 85970805 + Y: 185137460 + - X: 81671008 + Y: 182585664 + - X: 79868056 + Y: 185107440 + - X: 83950366 + Y: 187994441 + - X: 88032672 + Y: 190881440 + - X: 81437424 + Y: 200167344 + - X: 77651260 + Y: 196901627 + - X: 83950366 + Y: 187994441 + - X: 79868056 + Y: 185107440 + - X: 73865088 + Y: 193635904 + - X: 77651260 + Y: 196901627 + - X: 81437424 + Y: 200167344 + - X: 70313896 + Y: 210792576 + - X: 67268092 + Y: 206827331 + - X: 67268096 + Y: 206827328 + - X: 77651256 + Y: 196901632 + - X: 77651260 + Y: 196901627 + - X: 73865088 + Y: 193635904 + - X: 64222296 + Y: 202862096 + - X: 67268092 + Y: 206827331 + - X: 70313896 + Y: 210792576 + - X: 65425120 + Y: 213804624 + - X: 62823962 + Y: 209534485 + - X: 67268092 + Y: 206827331 + - X: 64222296 + Y: 202862096 + - X: 60222808 + Y: 205264352 + - X: 62823962 + Y: 209534485 + - X: 65425120 + Y: 213804624 + - X: 56705652 + Y: 219080656 + - X: 40624524 + Y: 224550800 + - X: 39383162 + Y: 219707359 + - X: 54589372 + Y: 214550608 + - X: 52473092 + Y: 210020560 + - X: 38141796 + Y: 214863904 + - X: 39383162 + Y: 219707359 + - X: 40624524 + Y: 224550800 + - X: 35547276 + Y: 225462368 + - X: 34677501 + Y: 220538603 + - X: 39383160 + Y: 219707360 + - X: 39383162 + Y: 219707359 + - X: 38141796 + Y: 214863904 + - X: 33807724 + Y: 215614832 + - X: 34677501 + Y: 220538603 + - X: 35547276 + Y: 225462368 + - X: 30471752 + Y: 226353184 + - X: 20309718 + Y: 227163472 + - X: 20147739 + Y: 222166096 + - X: 29837460 + Y: 221393584 + - X: 29837461 + Y: 221393584 + - X: 29203170 + Y: 216433984 + - X: 19985760 + Y: 217168736 + - X: 20147739 + Y: 222166096 + - X: 20309718 + Y: 227163472 + - X: 10084560 + Y: 227012656 + - X: 3800289 + Y: 226332352 + - X: 4342760 + Y: 221361859 + - X: 4885229 + Y: 216391376 + - X: 1428198 + Y: 216019664 + - X: 652305 + Y: 220959088 + - X: 4342760 + Y: 221361859 + - X: 3800289 + Y: 226332352 + - X: -123588 + Y: 225898512 + - X: -10234377 + Y: 223818240 + - X: -8995380 + Y: 218974191 + - X: -7756379 + Y: 214130128 + - X: -16775162 + Y: 211361104 + - X: -18471014 + Y: 216064720 + - X: -8995380 + Y: 218974191 + - X: -10234377 + Y: 223818240 + - X: -20166866 + Y: 220768336 + - X: -26857224 + Y: 217991920 + - X: -24937056 + Y: 213375316 + - X: -23016892 + Y: 208758720 + - X: -25552040 + Y: 207710768 + - X: -27695584 + Y: 212227969 + - X: -24937056 + Y: 213375316 + - X: -26857224 + Y: 217991920 + - X: -29839134 + Y: 216745184 + - X: -27695584 + Y: 212227969 + - X: -25552040 + Y: 207710768 + - X: -34012064 + Y: 203177120 + - X: -36590079 + Y: 207461262 + - X: -36590076 + Y: 207461264 + - X: -27695586 + Y: 212227968 + - X: -27695584 + Y: 212227969 + - X: -29839134 + Y: 216745184 + - X: -39168088 + Y: 211745392 + - X: -36590079 + Y: 207461262 + - X: -34012064 + Y: 203177120 + - X: -42081472 + Y: 197757440 + - X: -45075473 + Y: 201761935 + - X: -45075472 + Y: 201761936 + - X: -36590079 + Y: 207461262 + - X: -39168088 + Y: 211745392 + - X: -48069476 + Y: 205766432 + - X: -45075473 + Y: 201761935 + - X: -42081472 + Y: 197757440 + - X: -47406344 + Y: 193331456 + - X: -50598853 + Y: 197179544 + - X: -45075473 + Y: 201761935 + - X: -48069476 + Y: 205766432 + - X: -53791376 + Y: 201027648 + - X: -50598853 + Y: 197179544 + - X: -47406344 + Y: 193331456 + - X: -49687556 + Y: 191447376 + - X: -53072735 + Y: 195127124 + - X: -50598853 + Y: 197179544 + - X: -53791376 + Y: 201027648 + - X: -56457920 + Y: 198806880 + - X: -53072735 + Y: 195127124 + - X: -49687556 + Y: 191447376 + - X: -56758256 + Y: 184241104 + - X: -60502897 + Y: 187554355 + - X: -53072740 + Y: 195127120 + - X: -53072735 + Y: 195127124 + - X: -56457920 + Y: 198806880 + - X: -64247548 + Y: 190867616 + - X: -60502897 + Y: 187554355 + - X: -56758256 + Y: 184241104 + - X: -63221280 + Y: 176130272 + - X: -67286896 + Y: 179040736 + - X: -60502900 + Y: 187554352 + - X: -60502897 + Y: 187554355 + - X: -64247548 + Y: 190867616 + - X: -71352512 + Y: 181951200 + - X: -74608456 + Y: 176881328 + - X: -70398373 + Y: 174184091 + - X: -66188280 + Y: 171486848 + - X: -69003520 + Y: 167104640 + - X: -73345723 + Y: 169583626 + - X: -73345720 + Y: 169583632 + - X: -70398373 + Y: 174184091 + - X: -74608456 + Y: 176881328 + - X: -77687920 + Y: 172062608 + - X: -73345723 + Y: 169583626 + - X: -69003520 + Y: 167104640 + - X: -74030128 + Y: 157152304 + - X: -78600357 + Y: 159180343 + - X: -73345723 + Y: 169583626 + - X: -77687920 + Y: 172062608 + - X: -83170592 + Y: 161208384 + - X: -78600357 + Y: 159180343 + - X: -74030128 + Y: 157152304 + - X: -78286704 + Y: 146081728 + - X: -82971800 + Y: 147828112 + - X: -78600360 + Y: 159180336 + - X: -78600357 + Y: 159180343 + - X: -83170592 + Y: 161208384 + - X: -87656896 + Y: 149574496 + - X: -88080384 + Y: 148400736 + - X: -89841368 + Y: 143515248 + - X: -85158797 + Y: 141762088 + - X: -80476224 + Y: 140008928 + - X: -83972416 + Y: 131006520 + - X: -88623041 + Y: 132842750 + - X: -88623040 + Y: 132842752 + - X: -85158800 + Y: 141762080 + - X: -85158797 + Y: 141762088 + - X: -89841368 + Y: 143515248 + - X: -93273656 + Y: 134678976 + - X: -88623041 + Y: 132842750 + - X: -83972416 + Y: 131006520 + - X: -88518560 + Y: 119678008 + - X: -93152874 + Y: 121555019 + - X: -93152872 + Y: 121555024 + - X: -88623041 + Y: 132842750 + - X: -93273656 + Y: 134678976 + - X: -97787192 + Y: 123432032 + - X: -93152874 + Y: 121555019 + - X: -88518560 + Y: 119678008 + - X: -89845808 + Y: 116430872 + - X: -94474097 + Y: 118322696 + - X: -93152874 + Y: 121555019 + - X: -97787192 + Y: 123432032 + - X: -99102384 + Y: 120214520 + - X: -94474097 + Y: 118322696 + - X: -89845808 + Y: 116430872 + - X: -93912296 + Y: 106482384 + - X: -98536655 + Y: 108383793 + - X: -94474097 + Y: 118322696 + - X: -99102384 + Y: 120214520 + - X: -103161008 + Y: 110285200 + - X: -98536655 + Y: 108383793 + - X: -93912296 + Y: 106482384 + - X: -99945080 + Y: 91896256 + - X: -104562704 + Y: 93813952 + - X: -98536656 + Y: 108383792 + - X: -98536655 + Y: 108383793 + - X: -103161008 + Y: 110285200 + - X: -109180328 + Y: 95731648 + - X: -110706824 + Y: 92071008 + - X: -115632152 + Y: 80259752 + - X: -111019383 + Y: 78330403 + - X: -106406616 + Y: 76401056 + - X: -113085912 + Y: 60479912 + - X: -117695007 + Y: 62418018 + - X: -111019384 + Y: 78330400 + - X: -111019383 + Y: 78330403 + - X: -115632152 + Y: 80259752 + - X: -122304104 + Y: 64356124 + - X: -117695007 + Y: 62418018 + - X: -113085912 + Y: 60479912 + - X: -113250264 + Y: 60089964 + - X: -117857753 + Y: 62031879 + - X: -117695008 + Y: 62418016 + - X: -117695007 + Y: 62418018 + - X: -122304104 + Y: 64356124 + - X: -122465240 + Y: 63973792 + - X: -117857753 + Y: 62031879 + - X: -113250264 + Y: 60089964 + - X: -119771744 + Y: 44616760 + - X: -124377968 + Y: 46561700 + - X: -117857753 + Y: 62031879 + - X: -122465240 + Y: 63973792 + - X: -128984184 + Y: 48506636 + - X: -124377968 + Y: 46561700 + - X: -119771744 + Y: 44616760 + - X: -125106280 + Y: 32006032 + - X: -129711220 + Y: 33953990 + - X: -124377968 + Y: 46561700 + - X: -128984184 + Y: 48506636 + - X: -134316160 + Y: 35901948 + - X: -135460496 + Y: 33196752 + - X: -141521152 + Y: 18911750 + - X: -136919152 + Y: 16956866 + - X: -132317152 + Y: 15001981 + - X: -137020544 + Y: 3943316 + - X: -141621676 + Y: 5900241 + - X: -136919152 + Y: 16956866 + - X: -141521152 + Y: 18911750 + - X: -146222816 + Y: 7857169 + - X: -141621676 + Y: 5900241 + - X: -137020544 + Y: 3943316 + - X: -137753712 + Y: 2219503 + - X: -142354113 + Y: 4178126 + - X: -142354112 + Y: 4178128 + - X: -141621676 + Y: 5900241 + - X: -146222816 + Y: 7857169 + - X: -146954528 + Y: 6136755 + - X: -142354113 + Y: 4178126 + - X: -137753712 + Y: 2219503 + - X: -142350640 + Y: -8566740 + - X: -146949712 + Y: -6604964 + - X: -142354113 + Y: 4178126 + - X: -146954528 + Y: 6136755 + - X: -151548784 + Y: -4643188 + - X: -155092272 + Y: -12943050 + - X: -157373728 + Y: -18278940 + - X: -152776927 + Y: -20244381 + - X: -152532612 + Y: -20348842 + - X: -153583995 + Y: -22131379 + - X: -153584016 + Y: -22131428 + - X: -153583989 + Y: -22131444 + - X: -152090629 + Y: -22770719 + - X: -152195818 + Y: -22950227 + - X: -154723696 + Y: -27264130 + - X: -150753744 + Y: -29575274 + - X: -148253552 + Y: -25245256 + - X: -152195818 + Y: -22950227 + - X: -152090629 + Y: -22770719 + - X: -151044332 + Y: -20985181 + - X: -152532612 + Y: -20348842 + - X: -152776927 + Y: -20244381 + - X: -150494352 + Y: -14907514 + - X: -145896432 + Y: -16871978 + - X: -147252128 + Y: -20042711 + - X: -145753360 + Y: -20915238 + - X: -139624144 + Y: -24425314 + - X: -142090854 + Y: -28774483 + - X: -144557568 + Y: -33123658 + - X: -136468608 + Y: -37667136 + - X: -134041235 + Y: -33295878 + - X: -142090848 + Y: -28774486 + - X: -142090854 + Y: -28774483 + - X: -139624144 + Y: -24425314 + - X: -131613864 + Y: -28924622 + - X: -134041235 + Y: -33295878 + - X: -136468608 + Y: -37667136 + - X: -129840568 + Y: -41305652 + - X: -127434512 + Y: -36922628 + - X: -134041232 + Y: -33295880 + - X: -134041235 + Y: -33295878 + - X: -131613864 + Y: -28924622 + - X: -125028456 + Y: -32539604 + - X: -122057560 + Y: -34170564 + - X: -124438297 + Y: -38567396 + - X: -126819032 + Y: -42964224 + - X: -115940304 + Y: -48773728 + - X: -113615616 + Y: -44347008 + - X: -124438296 + Y: -38567396 + - X: -124438297 + Y: -38567396 + - X: -122057560 + Y: -34170564 + - X: -111290928 + Y: -39920288 + - X: -99650600 + Y: -45930640 + - X: -101906757 + Y: -50392678 + - X: -104162912 + Y: -54854712 + - X: -103067864 + Y: -55396988 + - X: -100849654 + Y: -50915965 + - X: -101906757 + Y: -50392678 + - X: -99650600 + Y: -45930640 + - X: -98631448 + Y: -46434948 + - X: -100849654 + Y: -50915965 + - X: -103067864 + Y: -55396988 + - X: -91815808 + Y: -60966672 + - X: -89645284 + Y: -56462358 + - X: -100849654 + Y: -50915965 + - X: -98631448 + Y: -46434948 + - X: -87474760 + Y: -51958044 + - X: -75104128 + Y: -57758420 + - X: -77164793 + Y: -62314044 + - X: -79225456 + Y: -66869664 + - X: -75718280 + Y: -68399312 + - X: -73719944 + Y: -63816010 + - X: -77164792 + Y: -62314044 + - X: -77164793 + Y: -62314044 + - X: -75104128 + Y: -57758420 + - X: -71721608 + Y: -59232708 + - X: -62883936 + Y: -63086856 + - X: -64798824 + Y: -67705648 + - X: -66713708 + Y: -72324432 + - X: -54593888 + Y: -77092632 + - X: -52880984 + Y: -72395192 + - X: -64798824 + Y: -67705648 + - X: -62883936 + Y: -63086856 + - X: -51168080 + Y: -67697752 + - X: -44173824 + Y: -70048440 + - X: -45767728 + Y: -74787579 + - X: -47361632 + Y: -79526720 + - X: -43161384 + Y: -80935728 + - X: -41744829 + Y: -76140592 + - X: -45767728 + Y: -74787579 + - X: -44173824 + Y: -70048440 + - X: -40328272 + Y: -71345448 + - X: -41744829 + Y: -76140592 + - X: -43161384 + Y: -80935728 + - X: -32671252 + Y: -83609272 + - X: -31723930 + Y: -78699840 + - X: -41744828 + Y: -76140592 + - X: -41744829 + Y: -76140592 + - X: -40328272 + Y: -71345448 + - X: -30776606 + Y: -73790400 + - X: -31723930 + Y: -78699840 + - X: -32671252 + Y: -83609272 + - X: -23805914 + Y: -84787912 + - X: -23151859 + Y: -79830880 + - X: -31723928 + Y: -78699840 + - X: -31723930 + Y: -78699840 + - X: -30776606 + Y: -73790400 + - X: -22497802 + Y: -74873840 + - X: -23151859 + Y: -79830880 + - X: -23805914 + Y: -84787912 + - X: -15143077 + Y: -84140800 + - X: -16362191 + Y: -79291696 + - X: -16364040 + Y: -79284342 + - X: -17693460 + Y: -74472176 + - X: -17581304 + Y: -74442600 + - X: -16364040 + Y: -79284342 + - X: -16362021 + Y: -79291651 + - X: -16362190 + Y: -79291696 + - X: -16362191 + Y: -79291696 + - X: -15143077 + Y: -84140800 + - X: -15030584 + Y: -84111120 + - X: -16362021 + Y: -79291651 + - X: -16364040 + Y: -79284342 + - X: -17581304 + Y: -74442600 + - X: -17584459 + Y: -74442877 + - X: -17693460 + Y: -74472176 + - X: -16364040 + Y: -79284342 + - X: -16362191 + Y: -79291696 + - X: -23151858 + Y: -79830880 + - X: -23151859 + Y: -79830880 + - X: -22497802 + Y: -74873840 + - X: -17584459 + Y: -74442877 + - X: -6366700 + Y: -71427568 + - X: 3560152 + Y: -68363048 + - X: 5137188 + Y: -73107832 + - X: -4979852 + Y: -76231384 + - X: -3593004 + Y: -81035200 + - X: 6714225 + Y: -77852616 + - X: 5137188 + Y: -73107832 + - X: 3560152 + Y: -68363048 + - X: 11091490 + Y: -65678092 + - X: 12769831 + Y: -70387990 + - X: 5137188 + Y: -73107832 + - X: 6714225 + Y: -77852616 + - X: 14448175 + Y: -75097896 + - X: 12769831 + Y: -70387990 + - X: 11091490 + Y: -65678092 + - X: 12274513 + Y: -65258184 + - X: 14069940 + Y: -69924704 + - X: 12769831 + Y: -70387990 + - X: 14448175 + Y: -75097896 + - X: 15865369 + Y: -74591232 + - X: 14069940 + Y: -69924704 + - X: 12274513 + Y: -65258184 + - X: 19854624 + Y: -62122888 + - X: 26380086 + Y: -58968584 + - - X: -148178928 + Y: -22210334 + - X: -151044332 + Y: -20985181 + - X: -149667936 + Y: -18636318 + - X: -151043840 + Y: -17824748 + - X: -152532612 + Y: -20348842 + - X: -151044332 + Y: -20985181 + - X: -152090629 + Y: -22770719 + - X: -148987472 + Y: -24099112 + - - X: -152195818 + Y: -22950227 + - X: -152195824 + Y: -22950224 + - X: -153583989 + Y: -22131444 + - X: -153584024 + Y: -22131429 + - X: -153583995 + Y: -22131379 + - X: -152776927 + Y: -20244381 + - X: -157373728 + Y: -18278940 + - X: -158180576 + Y: -20163746 + - X: -153584024 + Y: -22131429 + - X: -156124208 + Y: -26438108 + - X: -154723696 + Y: -27264130 + - - X: -147252128 + Y: -20042711 + - X: -149667936 + Y: -18636318 + - X: -151044332 + Y: -20985181 + - X: -148178928 + Y: -22210334 + - - X: 4885229 + Y: 216391376 + - X: 4342760 + Y: 221361859 + - X: 10393014 + Y: 222022176 + - X: 10701468 + Y: 217031696 + - - X: 33807724 + Y: 215614832 + - X: 29203170 + Y: 216433984 + - X: 29837461 + Y: 221393584 + - X: 34677501 + Y: 220538603 + - - X: -7756379 + Y: 214130128 + - X: -8995380 + Y: 218974191 + - X: -8995378 + Y: 218974192 + - X: 652304 + Y: 220959088 + - X: 652305 + Y: 220959088 + - X: 1428198 + Y: 216019664 + - - X: -23016892 + Y: 208758720 + - X: -24937056 + Y: 213375316 + - X: -18471014 + Y: 216064720 + - X: -16775162 + Y: 211361104 + - - X: 60222808 + Y: 205264352 + - X: 52473092 + Y: 210020560 + - X: 54589372 + Y: 214550608 + - X: 62823962 + Y: 209534485 + - - X: -66188280 + Y: 171486848 + - X: -70398373 + Y: 174184091 + - X: -67286896 + Y: 179040736 + - X: -63221280 + Y: 176130272 + - - X: 95957936 + Y: 141506000 + - X: 92539720 + Y: 156174528 + - X: 97346752 + Y: 157550176 + - X: 100867024 + Y: 142455136 + - - X: -78673104 + Y: 145009120 + - X: -83376744 + Y: 146704928 + - X: -82971800 + Y: 147828112 + - X: -78286704 + Y: 146081728 + - - X: -80476224 + Y: 140008928 + - X: -85158797 + Y: 141762088 + - X: -83376744 + Y: 146704928 + - X: -78673104 + Y: 145009120 + - - X: 97760736 + Y: 129780176 + - X: 95957936 + Y: 141506000 + - X: 100867024 + Y: 142455136 + - X: 102702441 + Y: 130541497 + - - X: 99745672 + Y: 111111616 + - X: 98289864 + Y: 126359272 + - X: 103251440 + Y: 126977960 + - X: 104731888 + Y: 111482688 + - - X: 100909536 + Y: 81800344 + - X: 100544184 + Y: 96136368 + - X: 105540304 + Y: 96333360 + - X: 105908664 + Y: 81894072 + - - X: -101477168 + Y: 88222208 + - X: -106091996 + Y: 90146608 + - X: -104562704 + Y: 93813952 + - X: -99945080 + Y: 91896256 + - - X: -106406616 + Y: 76401056 + - X: -111019383 + Y: 78330403 + - X: -106091996 + Y: 90146608 + - X: -101477168 + Y: 88222208 + - - X: 101069344 + Y: 68460328 + - X: 101054888 + Y: 69666480 + - X: 106054524 + Y: 69726408 + - X: 106068880 + Y: 68528848 + - - X: -126252688 + Y: 29295948 + - X: -130856592 + Y: 31246350 + - X: -129711220 + Y: 33953990 + - X: -125106280 + Y: 32006032 + - - X: -132317152 + Y: 15001981 + - X: -136919152 + Y: 16956866 + - X: -130856592 + Y: 31246350 + - X: -126252688 + Y: 29295948 + - - X: 102239535 + Y: 16055930 + - X: 106400384 + Y: 13283334 + - X: 109725704 + Y: 19079804 + - X: 105196256 + Y: 21197374 + - X: 102239536 + Y: 16055932 + - - X: 89450206 + Y: 2156048 + - X: 92771080 + Y: -1581838 + - X: 97717224 + Y: 3022021 + - X: 94186000 + Y: 6561857 + - X: 89450208 + Y: 2156050 + - - X: 82593824 + Y: -10004652 + - X: 79463224 + Y: -6106016 + - X: 84482448 + Y: -2057712 + - X: 87669352 + Y: -5910456 + - - X: 79013128 + Y: -12867252 + - X: 82593824 + Y: -10004652 + - X: 79463224 + Y: -6106016 + - X: 75890964 + Y: -8961859 + - - X: -145896432 + Y: -16871978 + - X: -150494352 + Y: -14907514 + - X: -146949712 + Y: -6604964 + - X: -142350640 + Y: -8566740 + - - X: 69409712 + Y: -21087184 + - X: 65902014 + Y: -17524026 + - X: 69992496 + Y: -13812590 + - X: 73268712 + Y: -17589682 + - - X: 64278012 + Y: -27235508 + - X: 59913445 + Y: -24796133 + - X: 62482156 + Y: -21176348 + - X: 66354728 + Y: -24339132 + - - X: -144557568 + Y: -33123658 + - X: -150753744 + Y: -29575274 + - X: -148253552 + Y: -25245256 + - X: -142090854 + Y: -28774483 + - - X: 62101504 + Y: -33537130 + - X: 57336260 + Y: -32023043 + - X: 58376388 + Y: -28409968 + - X: 63088116 + Y: -30083168 + - - X: 57274444 + Y: -32200620 + - X: 61996504 + Y: -33844436 + - X: 62101504 + Y: -33537130 + - X: 57336260 + Y: -32023043 + - X: 57336260 + Y: -32023044 + - - X: -126819032 + Y: -42964224 + - X: -129840568 + Y: -41305652 + - X: -127434512 + Y: -36922628 + - X: -124438297 + Y: -38567396 + - - X: -104162912 + Y: -54854712 + - X: -101906757 + Y: -50392678 + - X: -101906760 + Y: -50392676 + - X: -113615616 + Y: -44347008 + - X: -115940304 + Y: -48773728 + - - X: 54244756 + Y: -49280540 + - X: 50244040 + Y: -46281492 + - X: 52618876 + Y: -42753272 + - X: 56897656 + Y: -45340172 + - - X: 51010672 + Y: -53166824 + - X: 54244756 + Y: -49280540 + - X: 50244040 + Y: -46281492 + - X: 47333012 + Y: -49779372 + - - X: 43804755 + Y: -53243241 + - X: 47134252 + Y: -56973452 + - X: 51010672 + Y: -53166824 + - X: 47333012 + Y: -49779372 + - X: 43804756 + Y: -53243240 + - - X: -79225456 + Y: -66869664 + - X: -77164793 + Y: -62314044 + - X: -89645280 + Y: -56462360 + - X: -89645284 + Y: -56462358 + - X: -91815808 + Y: -60966672 + - - X: 28706627 + Y: -63394328 + - X: 31033168 + Y: -67820072 + - X: 37211924 + Y: -64301004 + - X: 34572578 + Y: -60054378 + - X: 34572576 + Y: -60054380 + - - X: 21899419 + Y: -66685652 + - X: 23944214 + Y: -71248416 + - X: 31033168 + Y: -67820072 + - X: 28706627 + Y: -63394328 + - X: 28706626 + Y: -63394328 + - - X: -66713708 + Y: -72324432 + - X: -75718280 + Y: -68399312 + - X: -73719944 + Y: -63816010 + - X: -64798824 + Y: -67705648 + - - X: 14069941 + Y: -69924704 + - X: 14069940 + Y: -69924704 + - X: 15865369 + Y: -74591232 + - X: 23944214 + Y: -71248416 + - X: 21899419 + Y: -66685652 + - X: 21899418 + Y: -66685652 + - - X: -47361632 + Y: -79526720 + - X: -54593888 + Y: -77092632 + - X: -52880984 + Y: -72395192 + - X: -45767728 + Y: -74787579 + - - X: -15030584 + Y: -84111120 + - X: -16362021 + Y: -79291651 + - X: -4979852 + Y: -76231384 + - X: -3593004 + Y: -81035200 + m_CompositePaths: + m_Paths: + - - {x: -0.89953804, y: 21.897419} + - {x: -0.8995378, y: 21.897419} + - {x: 0.0652304, y: 22.09591} + - {x: 0.0652305, y: 22.09591} + - {x: 0.434276, y: 22.136187} + - {x: 0.48852292, y: 21.639137} + - {x: 0.1428198, y: 21.601967} + - {x: -0.7756379, y: 21.413013} + - - {x: -0.7756379, y: 21.413013} + - {x: -1.6775162, y: 21.13611} + - {x: -2.3016891, y: 20.875872} + - {x: -2.4937055, y: 21.337532} + - {x: -1.8471014, y: 21.606472} + - {x: -0.89953804, y: 21.897419} + - - {x: -2.7695584, y: 21.222797} + - {x: -2.4937055, y: 21.337532} + - {x: -2.3016891, y: 20.875872} + - {x: -2.555204, y: 20.771076} + - - {x: -3.659008, y: 20.746126} + - {x: -3.6590075, y: 20.746126} + - {x: -2.7695587, y: 21.222797} + - {x: -2.7695584, y: 21.222797} + - {x: -2.555204, y: 20.771076} + - {x: -3.4012065, y: 20.317713} + - - {x: -4.5075474, y: 20.176193} + - {x: -4.5075474, y: 20.176193} + - {x: -3.659008, y: 20.746126} + - {x: -3.4012065, y: 20.317713} + - {x: -4.208147, y: 19.775743} + - - {x: -5.059885, y: 19.717955} + - {x: -4.5075474, y: 20.176193} + - {x: -4.208147, y: 19.775743} + - {x: -4.7406344, y: 19.333145} + - - {x: -5.307274, y: 19.512712} + - {x: -5.059885, y: 19.717955} + - {x: -4.7406344, y: 19.333145} + - {x: -4.9687557, y: 19.144737} + - - {x: -6.0502896, y: 18.755436} + - {x: -5.307274, y: 19.512712} + - {x: -5.307274, y: 19.512712} + - {x: -4.9687557, y: 19.144737} + - {x: -5.6758256, y: 18.42411} + - - {x: -6.0502896, y: 18.755436} + - {x: -5.6758256, y: 18.42411} + - {x: -6.3221283, y: 17.613028} + - {x: -6.6188283, y: 17.148685} + - {x: -7.039838, y: 17.41841} + - {x: -6.7286897, y: 17.904074} + - {x: -6.05029, y: 18.755436} + - - {x: -7.3345723, y: 16.958363} + - {x: -7.3345723, y: 16.958363} + - {x: -7.039838, y: 17.41841} + - {x: -6.6188283, y: 17.148685} + - {x: -6.900352, y: 16.710464} + - - {x: -7.860036, y: 15.918034} + - {x: -7.3345723, y: 16.958363} + - {x: -6.900352, y: 16.710464} + - {x: -7.4030128, y: 15.715231} + - - {x: -7.860036, y: 15.918034} + - {x: -7.860036, y: 15.918034} + - {x: -7.4030128, y: 15.715231} + - {x: -7.8286705, y: 14.608173} + - {x: -7.8673105, y: 14.500912} + - {x: -8.047623, y: 14.000893} + - {x: -8.51588, y: 14.1762085} + - {x: -8.337674, y: 14.670493} + - {x: -8.29718, y: 14.782811} + - - {x: -8.862304, y: 13.284275} + - {x: -8.862304, y: 13.284275} + - {x: -8.51588, y: 14.1762085} + - {x: -8.51588, y: 14.1762085} + - {x: -8.047623, y: 14.000893} + - {x: -8.397242, y: 13.100652} + - - {x: -9.315288, y: 12.155501} + - {x: -9.315288, y: 12.155502} + - {x: -8.862304, y: 13.284275} + - {x: -8.397242, y: 13.100652} + - {x: -8.851856, y: 11.967801} + - - {x: -9.44741, y: 11.83227} + - {x: -9.315288, y: 12.155501} + - {x: -8.851856, y: 11.967801} + - {x: -8.984581, y: 11.643087} + - - {x: -9.853665, y: 10.838379} + - {x: -9.44741, y: 11.83227} + - {x: -8.984581, y: 11.643087} + - {x: -9.39123, y: 10.648238} + - - {x: -9.853665, y: 10.838379} + - {x: -9.853665, y: 10.838379} + - {x: -9.39123, y: 10.648238} + - {x: -9.994508, y: 9.189626} + - {x: -10.1477165, y: 8.822221} + - {x: -10.640662, y: 7.6401057} + - {x: -11.101938, y: 7.83304} + - {x: -10.6092005, y: 9.014661} + - {x: -10.45627, y: 9.381395} + - - {x: -11.769501, y: 6.2418017} + - {x: -11.101938, y: 7.83304} + - {x: -11.101938, y: 7.83304} + - {x: -10.640662, y: 7.6401057} + - {x: -11.308591, y: 6.0479913} + - - {x: -11.785775, y: 6.203188} + - {x: -11.769501, y: 6.2418017} + - {x: -11.769501, y: 6.2418017} + - {x: -11.308591, y: 6.0479913} + - {x: -11.3250265, y: 6.0089965} + - - {x: -12.437797, y: 4.65617} + - {x: -11.785775, y: 6.203188} + - {x: -11.3250265, y: 6.0089965} + - {x: -11.977175, y: 4.461676} + - - {x: -12.437797, y: 4.65617} + - {x: -11.977175, y: 4.461676} + - {x: -12.510628, y: 3.2006032} + - {x: -12.625269, y: 2.9295948} + - {x: -13.231715, y: 1.5001981} + - {x: -13.6919155, y: 1.6956866} + - {x: -13.085659, y: 3.124635} + - {x: -12.971122, y: 3.3953993} + - - {x: -14.1621685, y: 0.5900241} + - {x: -13.6919155, y: 1.6956866} + - {x: -13.231715, y: 1.5001981} + - {x: -13.702055, y: 0.3943316} + - - {x: 9.465269, y: 1.4373823} + - {x: 9.46267, y: 1.4340032} + - {x: 9.469383, y: 1.4417785} + - - {x: -14.235412, y: 0.41781262} + - {x: -14.235412, y: 0.4178128} + - {x: -14.1621685, y: 0.5900241} + - {x: -13.702055, y: 0.3943316} + - {x: -13.775372, y: 0.22195031} + - - {x: 9.277108, y: -0.1581838} + - {x: 8.945021, y: 0.2156048} + - {x: 8.448245, y: -0.20577121} + - {x: 7.9463224, y: -0.6106016} + - {x: 7.589096, y: -0.89618593} + - {x: 7.901313, y: -1.2867252} + - {x: 8.259382, y: -1.0004652} + - {x: 8.766935, y: -0.5910456} + - - {x: 7.4573073, y: -1.0015445} + - {x: 7.4573073, y: -1.0015447} + - {x: 6.9992495, y: -1.381259} + - {x: 6.590202, y: -1.7524027} + - {x: 6.9409714, y: -2.1087184} + - {x: 7.3268714, y: -1.7589682} + - {x: 7.772978, y: -1.3892977} + - - {x: 6.590202, y: -1.7524027} + - {x: 6.5902014, y: -1.7524028} + - {x: 6.2482157, y: -2.1176348} + - {x: 5.9913445, y: -2.4796133} + - {x: 6.427801, y: -2.7235508} + - {x: 6.635473, y: -2.4339132} + - {x: 6.9409714, y: -2.1087184} + - - {x: 6.427801, y: -2.7235508} + - {x: 5.9913445, y: -2.4796133} + - {x: 5.9913445, y: -2.4796135} + - {x: 5.837639, y: -2.8409967} + - {x: 5.733626, y: -3.2023044} + - {x: 5.733626, y: -3.2023044} + - {x: 5.7274446, y: -3.220062} + - {x: 6.1996503, y: -3.3844435} + - {x: 6.2101502, y: -3.353713} + - {x: 6.3088117, y: -3.0083168} + - - {x: 5.903764, y: -4.137962} + - {x: 5.453852, y: -3.9198353} + - {x: 5.2618876, y: -4.275327} + - {x: 5.024404, y: -4.628149} + - {x: 4.733301, y: -4.977937} + - {x: 4.3804755, y: -5.324324} + - {x: 4.3804755, y: -5.324324} + - {x: 4.713425, y: -5.6973453} + - {x: 5.101067, y: -5.3166823} + - {x: 5.4244757, y: -4.928054} + - {x: 5.6897655, y: -4.534017} + - - {x: -1.758446, y: -7.4442883} + - {x: -1.769346, y: -7.4472175} + - {x: -1.7581304, y: -7.44426} + - - {x: 0.5137188, y: -7.3107834} + - {x: -0.4979852, y: -7.6231384} + - {x: -1.6362021, y: -7.929165} + - {x: -1.5030584, y: -8.411112} + - {x: -0.3593004, y: -8.10352} + - {x: 0.6714225, y: -7.7852616} + - - {x: 11.204211, y: 2.539483} + - {x: 10.719892, y: 2.6637197} + - {x: 10.806698, y: 3.2401981} + - {x: 11.306333, y: 3.2210777} + - - {x: 10.223953, y: 1.605593} + - {x: 10.6400385, y: 1.3283334} + - {x: 10.97257, y: 1.9079804} + - {x: 11.204211, y: 2.539483} + - {x: 10.719892, y: 2.6637197} + - {x: 10.719892, y: 2.6637197} + - {x: 10.519626, y: 2.1197374} + - {x: 10.223953, y: 1.6055932} + - - {x: 10.256516, y: 0.825884} + - {x: 10.6400385, y: 1.3283334} + - {x: 10.223953, y: 1.605593} + - {x: 9.859593, y: 1.1299438} + - - {x: 8.945021, y: 0.215605} + - {x: 8.945021, y: 0.2156048} + - {x: 9.277108, y: -0.1581838} + - {x: 9.771723, y: 0.3022021} + - {x: 10.232468, y: 0.7954787} + - {x: 10.256516, y: 0.825884} + - {x: 9.859593, y: 1.1299438} + - {x: 9.850925, y: 1.1186286} + - {x: 9.4186, y: 0.6561857} + - - {x: 7.772978, y: -1.3892977} + - {x: 7.901313, y: -1.2867252} + - {x: 7.589096, y: -0.89618593} + - {x: 7.4573073, y: -1.0015445} + - - {x: 5.6083975, y: -3.562039} + - {x: 6.0743146, y: -3.7434812} + - {x: 6.1996503, y: -3.3844435} + - {x: 5.7274446, y: -3.220062} + - {x: 5.6083975, y: -3.562039} + - - {x: 5.453852, y: -3.9198353} + - {x: 5.903764, y: -4.137962} + - {x: 6.0743146, y: -3.7434812} + - {x: 5.6083975, y: -3.562039} + - {x: 5.453852, y: -3.9198349} + - - {x: 4.293679, y: -6.0383415} + - {x: 4.713425, y: -5.6973453} + - {x: 4.3804755, y: -5.324324} + - {x: 3.9788141, y: -5.6499343} + - - {x: 4.2555804, y: -6.068623} + - {x: 4.293679, y: -6.0383415} + - {x: 3.9788141, y: -5.6499343} + - {x: 3.9578285, y: -5.666947} + - - {x: 2.1899421, y: -6.6685653} + - {x: 2.189942, y: -6.6685653} + - {x: 1.4069941, y: -6.9924703} + - {x: 1.406994, y: -6.9924703} + - {x: 1.5865369, y: -7.459123} + - {x: 2.3944213, y: -7.1248417} + - {x: 3.1033168, y: -6.782007} + - {x: 3.7211924, y: -6.4301004} + - {x: 4.2555804, y: -6.068623} + - {x: 3.9578285, y: -5.666947} + - {x: 3.4572577, y: -6.005438} + - {x: 3.4572577, y: -6.005438} + - {x: 2.870663, y: -6.3394327} + - {x: 2.8706627, y: -6.3394327} + - - {x: 1.4448175, y: -7.5097895} + - {x: 1.5865369, y: -7.459123} + - {x: 1.406994, y: -6.9924703} + - {x: 1.2769831, y: -7.0387993} + - - {x: 0.6714225, y: -7.7852616} + - {x: 1.4448175, y: -7.5097895} + - {x: 1.2769831, y: -7.0387993} + - {x: 0.5137188, y: -7.3107834} + - - {x: -3.172393, y: -7.869984} + - {x: -4.174483, y: -7.6140594} + - {x: -4.174483, y: -7.6140594} + - {x: -4.5767727, y: -7.478758} + - {x: -5.2880983, y: -7.239519} + - {x: -6.4798822, y: -6.770565} + - {x: -7.3719945, y: -6.381601} + - {x: -7.7164793, y: -6.2314043} + - {x: -7.7164793, y: -6.2314043} + - {x: -8.964528, y: -5.646236} + - {x: -8.964528, y: -5.646236} + - {x: -10.084966, y: -5.0915966} + - {x: -10.306787, y: -5.539699} + - {x: -10.416291, y: -5.4854712} + - {x: -10.190676, y: -5.039268} + - {x: -10.190676, y: -5.0392675} + - {x: -11.361562, y: -4.434701} + - {x: -12.44383, y: -3.8567398} + - {x: -12.44383, y: -3.8567398} + - {x: -12.743451, y: -3.692263} + - {x: -13.404123, y: -3.329588} + - {x: -13.404123, y: -3.329588} + - {x: -14.2090845, y: -2.8774486} + - {x: -14.2090845, y: -2.8774483} + - {x: -14.825356, y: -2.5245256} + - {x: -15.219583, y: -2.2950227} + - {x: -15.219583, y: -2.2950225} + - {x: -15.358398, y: -2.2131445} + - {x: -15.358403, y: -2.2131429} + - {x: -15.3584, y: -2.213138} + - {x: -15.277693, y: -2.0244381} + - {x: -15.253261, y: -2.0348842} + - {x: -15.3584, y: -2.213138} + - {x: -15.358402, y: -2.2131429} + - {x: -15.358398, y: -2.2131445} + - {x: -15.209063, y: -2.277072} + - {x: -14.898747, y: -2.4099112} + - {x: -14.817893, y: -2.2210333} + - {x: -14.725213, y: -2.0042713} + - {x: -14.966794, y: -1.8636318} + - {x: -15.104384, y: -1.7824749} + - {x: -15.253261, y: -2.0348842} + - {x: -15.277693, y: -2.0244381} + - {x: -15.049436, y: -1.4907514} + - {x: -14.694971, y: -0.6604964} + - {x: -14.235412, y: 0.41781262} + - {x: -13.775372, y: 0.22195031} + - {x: -14.2350645, y: -0.856674} + - {x: -14.5896435, y: -1.6871978} + - {x: -14.725213, y: -2.0042713} + - {x: -14.575336, y: -2.091524} + - {x: -13.962415, y: -2.4425313} + - {x: -13.1613865, y: -2.8924623} + - {x: -12.502846, y: -3.2539604} + - {x: -12.205756, y: -3.4170563} + - {x: -11.129093, y: -3.992029} + - {x: -9.96506, y: -4.593064} + - {x: -9.863145, y: -4.643495} + - {x: -8.747477, y: -5.1958046} + - {x: -7.5104127, y: -5.775842} + - {x: -7.172161, y: -5.9232707} + - {x: -6.2883935, y: -6.308686} + - {x: -5.116808, y: -6.7697754} + - {x: -4.4173822, y: -7.004844} + - {x: -4.0328274, y: -7.134545} + - {x: -3.0776606, y: -7.3790402} + - {x: -2.2497802, y: -7.4873843} + - {x: -1.758446, y: -7.4442883} + - {x: -0.63667, y: -7.142757} + - {x: 0.3560152, y: -6.8363047} + - {x: 1.109149, y: -6.567809} + - {x: 1.2274513, y: -6.5258183} + - {x: 1.9854624, y: -6.212289} + - {x: 2.6380086, y: -5.8968587} + - {x: 3.1933231, y: -5.5807753} + - {x: 3.6600769, y: -5.2652707} + - {x: 3.6639493, y: -5.261528} + - {x: 4.047526, y: -4.9513035} + - {x: 4.3655353, y: -4.639192} + - {x: 4.6243324, y: -4.3282447} + - {x: 4.8340096, y: -4.0166373} + - {x: 5.0039406, y: -3.701708} + - {x: 5.1424804, y: -3.3805964} + - {x: 5.255238, y: -3.0556803} + - {x: 5.2571015, y: -3.0508957} + - {x: 5.366466, y: -2.6736767} + - {x: 5.554888, y: -2.2356758} + - {x: 5.8609586, y: -1.8013564} + - {x: 6.239432, y: -1.3960872} + - {x: 6.671628, y: -1.0035498} + - {x: 7.141638, y: -0.6137917} + - {x: 7.2768803, y: -0.5056467} + - {x: 7.6332626, y: -0.22073801} + - {x: 8.129555, y: 0.1795032} + - {x: 8.612933, y: 0.5893939} + - {x: 9.065477, y: 1.0101693} + - {x: 9.465269, y: 1.4373823} + - {x: 9.807868, y: 1.882853} + - {x: 10.066681, y: 2.3314943} + - {x: 10.235572, y: 2.7879562} + - {x: 10.307064, y: 3.2593186} + - {x: 10.264225, y: 3.8046637} + - {x: 10.256147, y: 3.872985} + - {x: 10.170845, y: 4.607883} + - {x: 10.125503, y: 5.6454735} + - {x: 10.106935, y: 6.846033} + - {x: 10.105489, y: 6.966648} + - {x: 10.090954, y: 8.180035} + - {x: 10.054419, y: 9.613637} + - {x: 10.034146, y: 9.992632} + - {x: 9.974567, y: 11.111162} + - {x: 9.828986, y: 12.635927} + - {x: 9.776073, y: 12.978018} + - {x: 9.595794, y: 14.1506} + - {x: 9.253972, y: 15.617453} + - {x: 9.167123, y: 15.8704815} + - {x: 8.783792, y: 16.998869} + - {x: 8.167101, y: 18.258566} + - {x: 7.986806, y: 18.510744} + - {x: 7.386509, y: 19.36359} + - {x: 6.42223, y: 20.28621} + - {x: 6.0222807, y: 20.526436} + - {x: 5.247309, y: 21.002056} + - {x: 3.8141797, y: 21.486391} + - {x: 3.3807724, y: 21.561483} + - {x: 2.920317, y: 21.643398} + - {x: 1.998576, y: 21.716873} + - {x: 1.0701468, y: 21.70317} + - {x: 0.48852292, y: 21.639137} + - {x: 0.434276, y: 22.136187} + - {x: 1.0393014, y: 22.202217} + - {x: 2.0147738, y: 22.21661} + - {x: 2.014774, y: 22.21661} + - {x: 2.983746, y: 22.139359} + - {x: 2.983746, y: 22.139359} + - {x: 3.46775, y: 22.053862} + - {x: 3.938316, y: 21.970736} + - {x: 3.938316, y: 21.970736} + - {x: 5.458937, y: 21.455061} + - {x: 6.282396, y: 20.953447} + - {x: 6.7268095, y: 20.682734} + - {x: 6.7268095, y: 20.682734} + - {x: 7.7651258, y: 19.690163} + - {x: 7.7651267, y: 19.690163} + - {x: 8.395037, y: 18.799444} + - {x: 8.597081, y: 18.513746} + - {x: 8.597081, y: 18.513746} + - {x: 9.245864, y: 17.18989} + - {x: 9.245864, y: 17.18989} + - {x: 9.640413, y: 16.031715} + - {x: 9.734675, y: 15.755018} + - {x: 10.086702, y: 14.245514} + - {x: 10.270244, y: 13.05415} + - {x: 10.325144, y: 12.697796} + - {x: 10.473189, y: 11.148269} + - {x: 10.533435, y: 10.019276} + - {x: 10.55403, y: 9.633336} + - {x: 10.590866, y: 8.189407} + - {x: 10.605453, y: 6.972641} + - {x: 10.606888, y: 6.852885} + - {x: 10.625286, y: 5.6601787} + - {x: 10.625286, y: 5.660178} + - {x: 10.669258, y: 4.6476917} + - {x: 10.752788, y: 3.9308546} + - {x: 10.761995, y: 3.8518322} + - {x: 10.761995, y: 3.8518322} + - {x: 10.806698, y: 3.2401981} + - {x: 10.806698, y: 3.2401981} + - {x: 11.306333, y: 3.2210777} + - {x: 11.259766, y: 3.899} + - {x: 11.249428, y: 3.9887245} + - {x: 11.167671, y: 4.6875005} + - {x: 11.12507, y: 5.674883} + - {x: 11.106841, y: 6.859737} + - {x: 11.105416, y: 6.978634} + - {x: 11.090778, y: 8.19878} + - {x: 11.053642, y: 9.653035} + - {x: 11.032725, y: 10.045919} + - {x: 10.971809, y: 11.185376} + - {x: 10.821301, y: 12.759665} + - {x: 10.764414, y: 13.130281} + - {x: 10.577611, y: 14.340427} + - {x: 10.215379, y: 15.892583} + - {x: 10.113704, y: 16.19295} + - {x: 9.707936, y: 17.38091} + - {x: 9.027061, y: 18.768927} + - {x: 8.8032675, y: 19.088144} + - {x: 8.143743, y: 20.016735} + - {x: 7.0313897, y: 21.079258} + - {x: 6.542512, y: 21.380463} + - {x: 5.670565, y: 21.908066} + - {x: 4.0624523, y: 22.45508} + - {x: 3.5547276, y: 22.546238} + - {x: 3.0471752, y: 22.635319} + - {x: 2.0309718, y: 22.716347} + - {x: 1.008456, y: 22.701265} + - {x: 0.3800289, y: 22.633236} + - {x: -0.0123588005, y: 22.589851} + - {x: -1.0234377, y: 22.381824} + - {x: -2.0166867, y: 22.076834} + - {x: -2.6857224, y: 21.799192} + - {x: -2.9839134, y: 21.674519} + - {x: -3.9168088, y: 21.17454} + - {x: -4.8069477, y: 20.576643} + - {x: -5.3791375, y: 20.102764} + - {x: -5.645792, y: 19.880688} + - {x: -6.424755, y: 19.086761} + - {x: -7.135251, y: 18.19512} + - {x: -7.4608455, y: 17.688133} + - {x: -7.768792, y: 17.20626} + - {x: -8.3170595, y: 16.120838} + - {x: -8.76569, y: 14.95745} + - {x: -8.808039, y: 14.840074} + - {x: -8.984137, y: 14.351525} + - {x: -9.327366, y: 13.467897} + - {x: -9.778719, y: 12.343204} + - {x: -9.910238, y: 12.021452} + - {x: -10.316101, y: 11.028521} + - {x: -10.918033, y: 9.573165} + - {x: -11.070683, y: 9.207101} + - {x: -11.563215, y: 8.025975} + - {x: -12.230411, y: 6.4356127} + - {x: -12.246524, y: 6.3973794} + - {x: -12.898418, y: 4.8506637} + - {x: -13.431616, y: 3.590195} + - {x: -13.54605, y: 3.3196752} + - {x: -14.152116, y: 1.891175} + - {x: -14.622282, y: 0.7857169} + - {x: -14.695453, y: 0.61367553} + - {x: -15.154879, y: -0.4643188} + - {x: -15.509228, y: -1.294305} + - {x: -15.737373, y: -1.827894} + - {x: -15.818058, y: -2.0163746} + - {x: -15.358403, y: -2.2131429} + - {x: -15.612421, y: -2.6438107} + - {x: -15.47237, y: -2.726413} + - {x: -15.075375, y: -2.9575274} + - {x: -14.455757, y: -3.3123658} + - {x: -13.646861, y: -3.7667136} + - {x: -12.984057, y: -4.130565} + - {x: -12.681903, y: -4.2964225} + - {x: -11.59403, y: -4.8773727} + - {x: -10.416291, y: -5.4854712} + - {x: -10.190676, y: -5.039268} + - {x: -10.084966, y: -5.0915966} + - {x: -10.306787, y: -5.539699} + - {x: -9.181581, y: -6.0966673} + - {x: -7.922546, y: -6.6869664} + - {x: -7.571828, y: -6.8399315} + - {x: -6.671371, y: -7.2324433} + - {x: -5.4593887, y: -7.7092633} + - {x: -4.736163, y: -7.952672} + - {x: -4.3161383, y: -8.093573} + - {x: -3.2671251, y: -8.360928} + - {x: -2.3805914, y: -8.478791} + - {x: -1.5143077, y: -8.41408} + - {x: -1.5030584, y: -8.411112} + - {x: -1.6362021, y: -7.929165} + - {x: -1.636219, y: -7.9291697} + - {x: -1.6362191, y: -7.9291697} + - {x: -2.3151858, y: -7.983088} + - {x: -2.315186, y: -7.983088} + - {x: -3.1723928, y: -7.869984} + m_VertexDistance: 0.0005 +--- !u!50 &1820847798 +Rigidbody2D: + serializedVersion: 4 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1820847793} + m_BodyType: 0 + m_Simulated: 1 + m_UseFullKinematicContacts: 0 + m_UseAutoMass: 0 + m_Mass: 1 + m_LinearDrag: 0 + m_AngularDrag: 0.05 + m_GravityScale: 1 + m_Material: {fileID: 0} + m_Interpolate: 0 + m_SleepingMode: 1 + m_CollisionDetection: 0 + m_Constraints: 0 +--- !u!114 &1820847799 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1820847793} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e0ecd6fe4dd55d640bd7ef3235e0e425, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UpdateCollider: 0 +--- !u!60 &1820847800 +PolygonCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1820847793} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 1 + m_Offset: {x: 0, y: 0} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0, y: 0} + oldSize: {x: 0, y: 0} + newSize: {x: 0, y: 0} + adaptiveTilingThreshold: 0 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + m_Points: + m_Paths: + - - {x: 10.719892, y: 2.6637197} + - {x: 10.519626, y: 2.1197374} + - {x: 10.223953, y: 1.6055932} + - {x: 9.850925, y: 1.1186286} + - {x: 9.4186, y: 0.6561857} + - {x: 8.945021, y: 0.21560505} + - {x: 8.448245, y: -0.20577121} + - {x: 7.9463224, y: -0.6106016} + - {x: 7.4573073, y: -1.0015447} + - {x: 6.9992495, y: -1.381259} + - {x: 6.5902014, y: -1.7524028} + - {x: 6.2482157, y: -2.1176348} + - {x: 5.9913445, y: -2.4796133} + - {x: 5.837639, y: -2.8409967} + - {x: 5.733626, y: -3.2023044} + - {x: 5.6083975, y: -3.562039} + - {x: 5.453852, y: -3.9198349} + - {x: 5.2618876, y: -4.275327} + - {x: 5.024404, y: -4.628149} + - {x: 4.733301, y: -4.977937} + - {x: 4.3804755, y: -5.324324} + - {x: 3.9578285, y: -5.666947} + - {x: 3.4572577, y: -6.005438} + - {x: 2.8706627, y: -6.3394327} + - {x: 2.189942, y: -6.6685653} + - {x: 1.4069941, y: -6.9924707} + - {x: 0.51371884, y: -7.3107834} + - {x: -0.49798524, y: -7.6231384} + - {x: -1.636219, y: -7.9291697} + - {x: -2.3151858, y: -7.983088} + - {x: -3.1723928, y: -7.8699837} + - {x: -4.174483, y: -7.614059} + - {x: -5.2880983, y: -7.239519} + - {x: -6.4798822, y: -6.7705646} + - {x: -7.7164793, y: -6.2314043} + - {x: -8.964528, y: -5.646236} + - {x: -10.190676, y: -5.0392675} + - {x: -11.361562, y: -4.434701} + - {x: -12.44383, y: -3.8567395} + - {x: -13.404123, y: -3.329588} + - {x: -14.209085, y: -2.8774486} + - {x: -14.825356, y: -2.5245256} + - {x: -15.219582, y: -2.2950225} + - {x: -15.358402, y: -2.2131429} + - {x: -15.049435, y: -1.4907514} + - {x: -14.694971, y: -0.6604964} + - {x: -14.235412, y: 0.41781288} + - {x: -13.6919155, y: 1.6956866} + - {x: -13.085659, y: 3.124635} + - {x: -12.437797, y: 4.65617} + - {x: -11.769501, y: 6.2418017} + - {x: -11.101938, y: 7.83304} + - {x: -10.45627, y: 9.381395} + - {x: -9.853665, y: 10.838379} + - {x: -9.315288, y: 12.155502} + - {x: -8.862304, y: 13.284275} + - {x: -8.51588, y: 14.1762085} + - {x: -8.29718, y: 14.782811} + - {x: -7.8600364, y: 15.918034} + - {x: -7.334572, y: 16.958363} + - {x: -6.7286897, y: 17.904074} + - {x: -6.05029, y: 18.755436} + - {x: -5.307274, y: 19.512712} + - {x: -4.5075474, y: 20.176193} + - {x: -3.6590075, y: 20.746126} + - {x: -2.7695587, y: 21.222797} + - {x: -1.8471014, y: 21.606472} + - {x: -0.8995378, y: 21.897419} + - {x: 0.06523049, y: 22.09591} + - {x: 1.0393014, y: 22.202217} + - {x: 2.0147738, y: 22.21661} + - {x: 2.983746, y: 22.139359} + - {x: 3.9383159, y: 21.970736} + - {x: 5.458937, y: 21.455061} + - {x: 6.7268095, y: 20.682734} + - {x: 7.7651253, y: 19.690163} + - {x: 8.597081, y: 18.513746} + - {x: 9.245864, y: 17.18989} + - {x: 9.734675, y: 15.755017} + - {x: 10.086702, y: 14.245513} + - {x: 10.325144, y: 12.697796} + - {x: 10.473188, y: 11.148269} + - {x: 10.55403, y: 9.633336} + - {x: 10.590866, y: 8.189407} + - {x: 10.606888, y: 6.852885} + - {x: 10.625286, y: 5.660178} + - {x: 10.669258, y: 4.6476917} + - {x: 10.761995, y: 3.851832} + - {x: 10.806698, y: 3.2401981} + - - {x: -1.7581303, y: -7.4442596} + - {x: -1.5143077, y: -8.41408} + - {x: -2.3805914, y: -8.478791} + - {x: -2.2497802, y: -7.4873843} + - - {x: -2.2497802, y: -7.4873843} + - {x: -2.3805914, y: -8.478791} + - {x: -3.2671251, y: -8.360928} + - {x: -3.0776606, y: -7.37904} + - - {x: -3.0776606, y: -7.37904} + - {x: -3.2671251, y: -8.360928} + - {x: -4.3161383, y: -8.093573} + - {x: -4.0328274, y: -7.134545} + - - {x: -4.0328274, y: -7.134545} + - {x: -4.3161383, y: -8.093573} + - {x: -4.736163, y: -7.952672} + - {x: -4.4173822, y: -7.0048437} + - - {x: -4.4173822, y: -7.0048437} + - {x: -4.736163, y: -7.952672} + - {x: -5.4593887, y: -7.7092633} + - {x: -5.116808, y: -6.769775} + - - {x: -5.116808, y: -6.769775} + - {x: -5.4593887, y: -7.7092633} + - {x: -6.671371, y: -7.2324433} + - {x: -6.2883935, y: -6.308686} + - - {x: -6.2883935, y: -6.308686} + - {x: -6.671371, y: -7.2324433} + - {x: -7.571828, y: -6.839931} + - {x: -7.172161, y: -5.9232707} + - - {x: -7.172161, y: -5.9232707} + - {x: -7.571828, y: -6.839931} + - {x: -7.9225454, y: -6.6869664} + - {x: -7.510413, y: -5.775842} + - - {x: -7.510413, y: -5.775842} + - {x: -7.9225454, y: -6.6869664} + - {x: -9.181581, y: -6.0966673} + - {x: -8.747476, y: -5.1958046} + - - {x: -8.747476, y: -5.1958046} + - {x: -9.181581, y: -6.0966673} + - {x: -10.306787, y: -5.5396986} + - {x: -9.863145, y: -4.6434946} + - - {x: -9.863145, y: -4.6434946} + - {x: -10.306787, y: -5.5396986} + - {x: -10.416291, y: -5.4854712} + - {x: -9.96506, y: -4.593064} + - - {x: -9.96506, y: -4.593064} + - {x: -10.416291, y: -5.4854712} + - {x: -11.59403, y: -4.8773727} + - {x: -11.129093, y: -3.992029} + - - {x: -11.129093, y: -3.992029} + - {x: -11.59403, y: -4.8773727} + - {x: -12.681903, y: -4.2964225} + - {x: -12.205756, y: -3.4170563} + - - {x: -12.205756, y: -3.4170563} + - {x: -12.681903, y: -4.2964225} + - {x: -12.984056, y: -4.130565} + - {x: -12.502846, y: -3.2539604} + - - {x: -12.502846, y: -3.2539604} + - {x: -12.984056, y: -4.130565} + - {x: -13.64686, y: -3.7667136} + - {x: -13.1613865, y: -2.8924623} + - - {x: -13.1613865, y: -2.8924623} + - {x: -13.64686, y: -3.7667136} + - {x: -14.455757, y: -3.3123658} + - {x: -13.962414, y: -2.4425313} + - - {x: -13.962414, y: -2.4425313} + - {x: -14.455757, y: -3.3123658} + - {x: -15.075375, y: -2.9575274} + - {x: -14.575336, y: -2.091524} + - - {x: -14.575336, y: -2.091524} + - {x: -15.075375, y: -2.9575274} + - {x: -15.47237, y: -2.726413} + - {x: -14.966793, y: -1.8636318} + - - {x: -14.966793, y: -1.8636318} + - {x: -15.47237, y: -2.726413} + - {x: -15.61242, y: -2.6438107} + - {x: -15.104384, y: -1.7824749} + - - {x: -14.898747, y: -2.4099112} + - {x: -15.818057, y: -2.0163746} + - {x: -15.737372, y: -1.827894} + - {x: -14.817893, y: -2.2210333} + - - {x: -14.817893, y: -2.2210333} + - {x: -15.737372, y: -1.827894} + - {x: -15.509227, y: -1.294305} + - {x: -14.589643, y: -1.6871978} + - - {x: -14.589643, y: -1.6871978} + - {x: -15.509227, y: -1.294305} + - {x: -15.154878, y: -0.46431884} + - {x: -14.2350645, y: -0.85667396} + - - {x: -14.2350645, y: -0.85667396} + - {x: -15.154878, y: -0.46431884} + - {x: -14.695453, y: 0.6136755} + - {x: -13.775371, y: 0.2219503} + - - {x: -13.775371, y: 0.2219503} + - {x: -14.695453, y: 0.6136755} + - {x: -14.622281, y: 0.7857169} + - {x: -13.702054, y: 0.3943316} + - - {x: -13.702054, y: 0.3943316} + - {x: -14.622281, y: 0.7857169} + - {x: -14.152116, y: 1.891175} + - {x: -13.231715, y: 1.5001981} + - - {x: -13.231715, y: 1.5001981} + - {x: -14.152116, y: 1.891175} + - {x: -13.546049, y: 3.3196752} + - {x: -12.625269, y: 2.9295948} + - - {x: -12.625269, y: 2.9295948} + - {x: -13.546049, y: 3.3196752} + - {x: -13.431616, y: 3.590195} + - {x: -12.510628, y: 3.2006032} + - - {x: -12.510628, y: 3.2006032} + - {x: -13.431616, y: 3.590195} + - {x: -12.898418, y: 4.8506637} + - {x: -11.977175, y: 4.461676} + - - {x: -11.977175, y: 4.461676} + - {x: -12.898418, y: 4.8506637} + - {x: -12.246524, y: 6.3973794} + - {x: -11.3250265, y: 6.0089965} + - - {x: -11.3250265, y: 6.0089965} + - {x: -12.246524, y: 6.3973794} + - {x: -12.230411, y: 6.435612} + - {x: -11.308591, y: 6.0479913} + - - {x: -11.308591, y: 6.0479913} + - {x: -12.230411, y: 6.435612} + - {x: -11.563215, y: 8.025975} + - {x: -10.640661, y: 7.6401052} + - - {x: -10.640661, y: 7.6401052} + - {x: -11.563215, y: 8.025975} + - {x: -11.070683, y: 9.207101} + - {x: -10.1477165, y: 8.822221} + - - {x: -10.1477165, y: 8.822221} + - {x: -11.070683, y: 9.207101} + - {x: -10.918033, y: 9.573165} + - {x: -9.994508, y: 9.189626} + - - {x: -9.994508, y: 9.189626} + - {x: -10.918033, y: 9.573165} + - {x: -10.316101, y: 11.02852} + - {x: -9.39123, y: 10.648238} + - - {x: -9.39123, y: 10.648238} + - {x: -10.316101, y: 11.02852} + - {x: -9.910238, y: 12.021452} + - {x: -8.984581, y: 11.643087} + - - {x: -8.984581, y: 11.643087} + - {x: -9.910238, y: 12.021452} + - {x: -9.778719, y: 12.343204} + - {x: -8.851856, y: 11.967801} + - - {x: -8.851856, y: 11.967801} + - {x: -9.778719, y: 12.343204} + - {x: -9.327366, y: 13.467898} + - {x: -8.397242, y: 13.100652} + - - {x: -8.397242, y: 13.100652} + - {x: -9.327366, y: 13.467898} + - {x: -8.984137, y: 14.351524} + - {x: -8.047623, y: 14.000893} + - - {x: -8.047623, y: 14.000893} + - {x: -8.984137, y: 14.351524} + - {x: -8.808039, y: 14.840074} + - {x: -7.86731, y: 14.500913} + - - {x: -7.86731, y: 14.500913} + - {x: -8.808039, y: 14.840074} + - {x: -8.76569, y: 14.957449} + - {x: -7.82867, y: 14.608173} + - - {x: -7.82867, y: 14.608173} + - {x: -8.76569, y: 14.957449} + - {x: -8.3170595, y: 16.120838} + - {x: -7.4030128, y: 15.71523} + - - {x: -7.4030128, y: 15.71523} + - {x: -8.3170595, y: 16.120838} + - {x: -7.7687917, y: 17.20626} + - {x: -6.900352, y: 16.710464} + - - {x: -6.900352, y: 16.710464} + - {x: -7.7687917, y: 17.20626} + - {x: -7.460846, y: 17.688133} + - {x: -6.618828, y: 17.148685} + - - {x: -6.618828, y: 17.148685} + - {x: -7.460846, y: 17.688133} + - {x: -7.1352515, y: 18.19512} + - {x: -6.322128, y: 17.613028} + - - {x: -6.322128, y: 17.613028} + - {x: -7.1352515, y: 18.19512} + - {x: -6.4247546, y: 19.086761} + - {x: -5.6758256, y: 18.42411} + - - {x: -5.6758256, y: 18.42411} + - {x: -6.4247546, y: 19.086761} + - {x: -5.645792, y: 19.880688} + - {x: -4.9687557, y: 19.144737} + - - {x: -4.9687557, y: 19.144737} + - {x: -5.645792, y: 19.880688} + - {x: -5.3791375, y: 20.102764} + - {x: -4.7406344, y: 19.333145} + - - {x: -4.7406344, y: 19.333145} + - {x: -5.3791375, y: 20.102764} + - {x: -4.8069477, y: 20.576643} + - {x: -4.208147, y: 19.775743} + - - {x: -4.208147, y: 19.775743} + - {x: -4.8069477, y: 20.576643} + - {x: -3.9168086, y: 21.17454} + - {x: -3.4012065, y: 20.317713} + - - {x: -3.4012065, y: 20.317713} + - {x: -3.9168086, y: 21.17454} + - {x: -2.9839134, y: 21.674519} + - {x: -2.555204, y: 20.771076} + - - {x: -2.555204, y: 20.771076} + - {x: -2.9839134, y: 21.674519} + - {x: -2.6857224, y: 21.799192} + - {x: -2.3016891, y: 20.875872} + - - {x: -2.3016891, y: 20.875872} + - {x: -2.6857224, y: 21.799192} + - {x: -2.0166867, y: 22.076834} + - {x: -1.6775162, y: 21.13611} + - - {x: -1.6775162, y: 21.13611} + - {x: -2.0166867, y: 22.076834} + - {x: -1.0234377, y: 22.381824} + - {x: -0.7756379, y: 21.413013} + - - {x: -0.7756379, y: 21.413013} + - {x: -1.0234377, y: 22.381824} + - {x: -0.0123588815, y: 22.589851} + - {x: 0.14281985, y: 21.601967} + - - {x: 0.14281985, y: 21.601967} + - {x: -0.0123588815, y: 22.589851} + - {x: 0.38002896, y: 22.633236} + - {x: 0.4885229, y: 21.639137} + - - {x: 0.4885229, y: 21.639137} + - {x: 0.38002896, y: 22.633236} + - {x: 1.008456, y: 22.701265} + - {x: 1.0701468, y: 21.703169} + - - {x: 1.0701468, y: 21.703169} + - {x: 1.008456, y: 22.701265} + - {x: 2.0309718, y: 22.716347} + - {x: 1.9985759, y: 21.716873} + - - {x: 1.9985759, y: 21.716873} + - {x: 2.0309718, y: 22.716347} + - {x: 3.0471752, y: 22.635319} + - {x: 2.920317, y: 21.643398} + - - {x: 2.920317, y: 21.643398} + - {x: 3.0471752, y: 22.635319} + - {x: 3.5547276, y: 22.546236} + - {x: 3.3807726, y: 21.561483} + - - {x: 3.3807726, y: 21.561483} + - {x: 3.5547276, y: 22.546236} + - {x: 4.0624523, y: 22.45508} + - {x: 3.8141794, y: 21.486391} + - - {x: 3.8141794, y: 21.486391} + - {x: 4.0624523, y: 22.45508} + - {x: 5.670565, y: 21.908066} + - {x: 5.247309, y: 21.002056} + - - {x: 5.247309, y: 21.002056} + - {x: 5.670565, y: 21.908066} + - {x: 6.542512, y: 21.380463} + - {x: 6.0222807, y: 20.526436} + - - {x: 6.0222807, y: 20.526436} + - {x: 6.542512, y: 21.380463} + - {x: 7.031389, y: 21.079258} + - {x: 6.42223, y: 20.28621} + - - {x: 6.42223, y: 20.28621} + - {x: 7.031389, y: 21.079258} + - {x: 8.143743, y: 20.016735} + - {x: 7.3865085, y: 19.36359} + - - {x: 7.3865085, y: 19.36359} + - {x: 8.143743, y: 20.016735} + - {x: 8.8032675, y: 19.088144} + - {x: 7.9868054, y: 18.510744} + - - {x: 7.9868054, y: 18.510744} + - {x: 8.8032675, y: 19.088144} + - {x: 9.027061, y: 18.768927} + - {x: 8.167101, y: 18.258566} + - - {x: 8.167101, y: 18.258566} + - {x: 9.027061, y: 18.768927} + - {x: 9.707936, y: 17.38091} + - {x: 8.783792, y: 16.998869} + - - {x: 8.783792, y: 16.998869} + - {x: 9.707936, y: 17.38091} + - {x: 10.113704, y: 16.19295} + - {x: 9.167123, y: 15.8704815} + - - {x: 9.167123, y: 15.8704815} + - {x: 10.113704, y: 16.19295} + - {x: 10.215379, y: 15.892582} + - {x: 9.253972, y: 15.617453} + - - {x: 9.253972, y: 15.617453} + - {x: 10.215379, y: 15.892582} + - {x: 10.577611, y: 14.340426} + - {x: 9.595794, y: 14.1505995} + - - {x: 9.595794, y: 14.1505995} + - {x: 10.577611, y: 14.340426} + - {x: 10.764414, y: 13.130281} + - {x: 9.776073, y: 12.978018} + - - {x: 9.776073, y: 12.978018} + - {x: 10.764414, y: 13.130281} + - {x: 10.821301, y: 12.759665} + - {x: 9.828986, y: 12.635927} + - - {x: 9.828986, y: 12.635927} + - {x: 10.821301, y: 12.759665} + - {x: 10.971809, y: 11.185376} + - {x: 9.974567, y: 11.111161} + - - {x: 9.974567, y: 11.111161} + - {x: 10.971809, y: 11.185376} + - {x: 11.032725, y: 10.045919} + - {x: 10.034146, y: 9.992632} + - - {x: 10.034146, y: 9.992632} + - {x: 11.032725, y: 10.045919} + - {x: 11.053642, y: 9.653035} + - {x: 10.054419, y: 9.613637} + - - {x: 10.054419, y: 9.613637} + - {x: 11.053642, y: 9.653035} + - {x: 11.090778, y: 8.19878} + - {x: 10.090954, y: 8.180035} + - - {x: 10.090954, y: 8.180035} + - {x: 11.090778, y: 8.19878} + - {x: 11.105416, y: 6.9786334} + - {x: 10.105489, y: 6.9666476} + - - {x: 10.105489, y: 6.9666476} + - {x: 11.105416, y: 6.9786334} + - {x: 11.106841, y: 6.859737} + - {x: 10.106935, y: 6.8460326} + - - {x: 10.106935, y: 6.8460326} + - {x: 11.106841, y: 6.859737} + - {x: 11.12507, y: 5.674883} + - {x: 10.125503, y: 5.6454735} + - - {x: 10.125503, y: 5.6454735} + - {x: 11.12507, y: 5.674883} + - {x: 11.167671, y: 4.6875005} + - {x: 10.170845, y: 4.607883} + - - {x: 10.170845, y: 4.607883} + - {x: 11.167671, y: 4.6875005} + - {x: 11.249428, y: 3.9887242} + - {x: 10.256147, y: 3.872985} + - - {x: 10.256147, y: 3.872985} + - {x: 11.249428, y: 3.9887242} + - {x: 11.259766, y: 3.8990002} + - {x: 10.264225, y: 3.8046637} + - - {x: 10.264225, y: 3.8046637} + - {x: 11.259766, y: 3.8990002} + - {x: 11.306332, y: 3.2210777} + - {x: 10.307064, y: 3.2593186} + - - {x: 10.307064, y: 3.2593186} + - {x: 11.306332, y: 3.2210777} + - {x: 11.204211, y: 2.539483} + - {x: 10.235572, y: 2.7879562} + - - {x: 10.235572, y: 2.7879562} + - {x: 11.204211, y: 2.539483} + - {x: 10.97257, y: 1.9079803} + - {x: 10.066681, y: 2.3314943} + - - {x: 10.066681, y: 2.3314943} + - {x: 10.97257, y: 1.9079803} + - {x: 10.6400385, y: 1.3283334} + - {x: 9.807868, y: 1.882853} + - - {x: 9.807868, y: 1.882853} + - {x: 10.6400385, y: 1.3283334} + - {x: 10.256516, y: 0.825884} + - {x: 9.46267, y: 1.4340032} + - - {x: 9.46267, y: 1.4340032} + - {x: 10.256516, y: 0.825884} + - {x: 10.232468, y: 0.7954787} + - {x: 9.469383, y: 1.4417785} + - - {x: 9.469383, y: 1.4417785} + - {x: 10.232468, y: 0.7954787} + - {x: 9.771723, y: 0.30220217} + - {x: 9.065477, y: 1.0101693} + - - {x: 9.065477, y: 1.0101693} + - {x: 9.771723, y: 0.30220217} + - {x: 9.277108, y: -0.15818381} + - {x: 8.612933, y: 0.5893939} + - - {x: 8.612933, y: 0.5893939} + - {x: 9.277108, y: -0.15818381} + - {x: 8.766935, y: -0.5910456} + - {x: 8.129555, y: 0.17950323} + - - {x: 8.129555, y: 0.17950323} + - {x: 8.766935, y: -0.5910456} + - {x: 8.259382, y: -1.0004652} + - {x: 7.6332626, y: -0.22073808} + - - {x: 7.6332626, y: -0.22073808} + - {x: 8.259382, y: -1.0004652} + - {x: 7.901313, y: -1.2867252} + - {x: 7.2768803, y: -0.5056467} + - - {x: 7.2768803, y: -0.5056467} + - {x: 7.901313, y: -1.2867252} + - {x: 7.7729774, y: -1.3892977} + - {x: 7.1416373, y: -0.6137917} + - - {x: 7.1416373, y: -0.6137917} + - {x: 7.7729774, y: -1.3892977} + - {x: 7.326871, y: -1.7589681} + - {x: 6.671628, y: -1.0035498} + - - {x: 6.671628, y: -1.0035498} + - {x: 7.326871, y: -1.7589681} + - {x: 6.940971, y: -2.1087184} + - {x: 6.239432, y: -1.3960872} + - - {x: 6.239432, y: -1.3960872} + - {x: 6.940971, y: -2.1087184} + - {x: 6.635473, y: -2.4339132} + - {x: 5.8609586, y: -1.8013563} + - - {x: 5.8609586, y: -1.8013563} + - {x: 6.635473, y: -2.4339132} + - {x: 6.427801, y: -2.7235508} + - {x: 5.554888, y: -2.2356758} + - - {x: 5.554888, y: -2.2356758} + - {x: 6.427801, y: -2.7235508} + - {x: 6.3088117, y: -3.0083168} + - {x: 5.366466, y: -2.6736767} + - - {x: 5.366466, y: -2.6736767} + - {x: 6.3088117, y: -3.0083168} + - {x: 6.2101502, y: -3.353713} + - {x: 5.2571015, y: -3.0508957} + - - {x: 5.2571015, y: -3.0508957} + - {x: 6.2101502, y: -3.353713} + - {x: 6.1996503, y: -3.3844438} + - {x: 5.255238, y: -3.0556803} + - - {x: 5.255238, y: -3.0556803} + - {x: 6.1996503, y: -3.3844438} + - {x: 6.0743146, y: -3.7434814} + - {x: 5.1424804, y: -3.3805964} + - - {x: 5.1424804, y: -3.3805964} + - {x: 6.0743146, y: -3.7434814} + - {x: 5.903764, y: -4.137962} + - {x: 5.0039406, y: -3.701708} + - - {x: 5.0039406, y: -3.701708} + - {x: 5.903764, y: -4.137962} + - {x: 5.6897655, y: -4.534017} + - {x: 4.8340096, y: -4.0166373} + - - {x: 4.8340096, y: -4.0166373} + - {x: 5.6897655, y: -4.534017} + - {x: 5.4244757, y: -4.928054} + - {x: 4.6243324, y: -4.328244} + - - {x: 4.6243324, y: -4.328244} + - {x: 5.4244757, y: -4.928054} + - {x: 5.101067, y: -5.3166823} + - {x: 4.3655353, y: -4.639192} + - - {x: 4.3655353, y: -4.639192} + - {x: 5.101067, y: -5.3166823} + - {x: 4.713425, y: -5.6973453} + - {x: 4.047526, y: -4.951303} + - - {x: 4.047526, y: -4.951303} + - {x: 4.713425, y: -5.6973453} + - {x: 4.293679, y: -6.0383415} + - {x: 3.663949, y: -5.261528} + - - {x: 3.663949, y: -5.261528} + - {x: 4.293679, y: -6.0383415} + - {x: 4.2555804, y: -6.068623} + - {x: 3.6600766, y: -5.2652707} + - - {x: 3.6600766, y: -5.2652707} + - {x: 4.2555804, y: -6.068623} + - {x: 3.7211924, y: -6.4301004} + - {x: 3.1933231, y: -5.5807753} + - - {x: 3.1933231, y: -5.5807753} + - {x: 3.7211924, y: -6.4301004} + - {x: 3.1033168, y: -6.782007} + - {x: 2.6380086, y: -5.896858} + - - {x: 2.6380086, y: -5.896858} + - {x: 3.1033168, y: -6.782007} + - {x: 2.3944213, y: -7.1248417} + - {x: 1.9854624, y: -6.212289} + - - {x: 1.9854624, y: -6.212289} + - {x: 2.3944213, y: -7.1248417} + - {x: 1.5865369, y: -7.459123} + - {x: 1.2274513, y: -6.5258183} + - - {x: 1.2274513, y: -6.5258183} + - {x: 1.5865369, y: -7.459123} + - {x: 1.4448175, y: -7.5097895} + - {x: 1.109149, y: -6.567809} + - - {x: 1.109149, y: -6.567809} + - {x: 1.4448175, y: -7.5097895} + - {x: 0.6714225, y: -7.7852616} + - {x: 0.3560152, y: -6.836305} + - - {x: 0.3560152, y: -6.836305} + - {x: 0.6714225, y: -7.7852616} + - {x: -0.35930043, y: -8.10352} + - {x: -0.63667005, y: -7.142757} + - - {x: -0.63667005, y: -7.142757} + - {x: -0.35930043, y: -8.10352} + - {x: -1.5030584, y: -8.411112} + - {x: -1.769346, y: -7.447218} + - - {x: -1.769346, y: -7.447218} + - {x: -1.5030584, y: -8.411112} + - {x: -1.5143077, y: -8.41408} + - {x: -1.7581303, y: -7.4442596} +--- !u!1 &1844216780 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1844216781} + - component: {fileID: 1844216783} + - component: {fileID: 1844216782} + m_Layer: 5 + m_Name: Package + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1844216781 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1844216780} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1463708952} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -300, y: 240} + m_SizeDelta: {x: 240, y: 64} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1844216782 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1844216780} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.47419012, g: 0.7516846, b: 0.9056604, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Default Collider (Generated by SpriteShapeGenerator in SpriteShape Package + version 2.* and above) +--- !u!222 &1844216783 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1844216780} + m_CullTransparentMesh: 0 +--- !u!1 &1984142811 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1984142814} + - component: {fileID: 1984142813} + - component: {fileID: 1984142812} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1984142812 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1984142811} + m_Enabled: 1 +--- !u!20 &1984142813 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1984142811} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 1 + orthographic size: 40 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1984142814 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1984142811} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &2093986023 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2093986028} + - component: {fileID: 2093986027} + - component: {fileID: 2093986026} + - component: {fileID: 2093986024} + - component: {fileID: 2093986025} + m_Layer: 0 + m_Name: Tree01Bush + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!60 &2093986024 +PolygonCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093986023} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 1 + m_Offset: {x: 0, y: 0} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0, y: 0} + oldSize: {x: 0, y: 0} + newSize: {x: 0, y: 0} + adaptiveTilingThreshold: 0 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + m_Points: + m_Paths: + - - {x: 4.84269, y: 3.05365} + - {x: 4.31877, y: 2.83868} + - {x: 4.12653, y: 2.5557} + - {x: 4.11899, y: 2.30925} + - {x: 4.14914, y: 2.20386} + - {x: 4.14914, y: 2.20386} + - {x: 4.34635, y: 2.32329} + - {x: 4.80843, y: 2.51988} + - {x: 5.34101, y: 2.55111} + - {x: 5.74975, y: 2.17446} + - {x: 5.74975, y: 2.17446} + - {x: 5.37547, y: 1.96207} + - {x: 5.22543, y: 1.8765} + - {x: 5.21523, y: 1.81911} + - {x: 5.26046, y: 1.69127} + - {x: 5.26046, y: 1.69127} + - {x: 5.66344, y: 1.51113} + - {x: 5.6282, y: 1.15842} + - {x: 5.4157, y: 0.8141} + - {x: 5.28688, y: 0.65911} + - {x: 5.28688, y: 0.65911} + - {x: 5.37595, y: 0.6858} + - {x: 5.59406, y: 0.73089} + - {x: 5.86759, y: 0.74193} + - {x: 6.1229, y: 0.66643} + - {x: 6.1229, y: 0.66643} + - {x: 5.80885, y: 0.48231} + - {x: 5.74242, y: 0.37617} + - {x: 5.79609, y: 0.32751} + - {x: 5.84232, y: 0.31585} + - {x: 5.84232, y: 0.31585} + - {x: 5.96194, y: 0.37477} + - {x: 6.2299, y: 0.46242} + - {x: 6.50985, y: 0.44509} + - {x: 6.66541, y: 0.18912} + - {x: 6.66541, y: 0.18912} + - {x: 6.42058, y: 0.21963} + - {x: 6.33507, y: 0.14768} + - {x: 6.34051, y: 0.04633} + - {x: 6.36851, y: -0.01134} + - {x: 6.36851, y: -0.01134} + - {x: 6.49629, y: -0.1342} + - {x: 6.60109, y: -0.31298} + - {x: 6.63775, y: -0.52244} + - {x: 6.56111, y: -0.73729} + - {x: 6.56111, y: -0.73729} + - {x: 6.4287, y: -0.45185} + - {x: 6.30731, y: -0.42013} + - {x: 6.2186, y: -0.50307} + - {x: 6.18422, y: -0.56162} + - {x: 6.18422, y: -0.56162} + - {x: 6.13041, y: -0.53766} + - {x: 6.0028, y: -0.5064} + - {x: 5.85214, y: -0.52876} + - {x: 5.72916, y: -0.66567} + - {x: 5.72916, y: -0.66567} + - {x: 6.02382, y: -0.69385} + - {x: 6.21309, y: -0.7152} + - {x: 6.28172, y: -0.76015} + - {x: 6.21449, y: -0.85914} + - {x: 6.21449, y: -0.85914} + - {x: 6.04968, y: -0.97189} + - {x: 5.9095, y: -1.04565} + - {x: 5.90463, y: -1.09218} + - {x: 6.1457, y: -1.12326} + - {x: 6.1457, y: -1.12326} + - {x: 6.32091, y: -1.34489} + - {x: 6.55387, y: -1.44998} + - {x: 6.72484, y: -1.55576} + - {x: 6.7141, y: -1.77941} + - {x: 6.7141, y: -1.77941} + - {x: 6.47843, y: -1.68122} + - {x: 6.48439, y: -1.79101} + - {x: 6.57678, y: -1.9815} + - {x: 6.60037, y: -2.12543} + - {x: 6.60037, y: -2.12543} + - {x: 6.51471, y: -2.12106} + - {x: 6.3996, y: -2.04326} + - {x: 6.28027, y: -2.0297} + - {x: 6.18193, y: -2.21806} + - {x: 6.18193, y: -2.21806} + - {x: 6.12692, y: -2.04777} + - {x: 6.0844, y: -1.83434} + - {x: 5.9999, y: -1.68091} + - {x: 5.81891, y: -1.69063} + - {x: 5.81891, y: -1.69063} + - {x: 5.79664, y: -1.70542} + - {x: 5.8542, y: -1.84917} + - {x: 5.93225, y: -2.01429} + - {x: 5.97146, y: -2.09323} + - {x: 5.97146, y: -2.09323} + - {x: 5.92501, y: -2.05319} + - {x: 5.8339, y: -1.99192} + - {x: 5.77052, y: -1.9977} + - {x: 5.80724, y: -2.15883} + - {x: 5.80724, y: -2.15883} + - {x: 6.2256, y: -2.39562} + - {x: 6.38297, y: -2.70965} + - {x: 6.34401, y: -3.03037} + - {x: 6.17338, y: -3.2872} + - {x: 6.17338, y: -3.2872} + - {x: 6.12749, y: -2.95315} + - {x: 6.0436, y: -2.87154} + - {x: 5.94196, y: -3.01933} + - {x: 5.84283, y: -3.37353} + - {x: 5.84283, y: -3.37353} + - {x: 5.57284, y: -3.05782} + - {x: 5.39372, y: -3.06099} + - {x: 5.29439, y: -3.19834} + - {x: 5.26374, y: -3.28517} + - {x: 5.26374, y: -3.28517} + - {x: 5.32006, y: -3.29945} + - {x: 5.45569, y: -3.35064} + - {x: 5.62067, y: -3.45122} + - {x: 5.76502, y: -3.6137} + - {x: 5.76502, y: -3.6137} + - {x: 5.83018, y: -3.79164} + - {x: 5.82093, y: -3.92623} + - {x: 5.78234, y: -4.01141} + - {x: 5.75946, y: -4.04115} + - {x: 5.75946, y: -4.04115} + - {x: 5.7109, y: -3.99161} + - {x: 5.58961, y: -3.89956} + - {x: 5.43216, y: -3.8499} + - {x: 5.27512, y: -3.92749} + - {x: 5.27512, y: -3.92749} + - {x: 5.36818, y: -4.02862} + - {x: 5.43897, y: -4.11252} + - {x: 5.47944, y: -4.17733} + - {x: 5.48156, y: -4.22116} + - {x: 5.48156, y: -4.22116} + - {x: 5.35957, y: -4.34635} + - {x: 5.18388, y: -4.46807} + - {x: 5.02602, y: -4.56024} + - {x: 4.95751, y: -4.59676} + - {x: 4.95751, y: -4.59676} + - {x: 4.88656, y: -4.57166} + - {x: 4.72202, y: -4.50724} + - {x: 4.5363, y: -4.41981} + - {x: 4.40186, y: -4.3257} + - {x: 4.40186, y: -4.3257} + - {x: 4.47019, y: -4.23504} + - {x: 4.6226, y: -4.08066} + - {x: 4.66549, y: -3.91418} + - {x: 4.40522, y: -3.78722} + - {x: 4.40522, y: -3.78722} + - {x: 4.39266, y: -3.56797} + - {x: 4.31038, y: -3.44085} + - {x: 4.21759, y: -3.38204} + - {x: 4.1735, y: -3.36773} + - {x: 4.1735, y: -3.36773} + - {x: 4.16423, y: -3.47374} + - {x: 4.12554, y: -3.68973} + - {x: 4.04113, y: -3.86264} + - {x: 3.89467, y: -3.83942} + - {x: 3.89467, y: -3.83942} + - {x: 3.75367, y: -3.78877} + - {x: 3.65287, y: -3.90422} + - {x: 3.52679, y: -4.06987} + - {x: 3.30995, y: -4.16985} + - {x: 3.30995, y: -4.16985} + - {x: 3.39122, y: -3.91903} + - {x: 3.43309, y: -3.72432} + - {x: 3.38098, y: -3.59712} + - {x: 3.18033, y: -3.54879} + - {x: 3.18033, y: -3.54879} + - {x: 3.10658, y: -3.4581} + - {x: 3.01571, y: -3.37254} + - {x: 2.86357, y: -3.35789} + - {x: 2.60599, y: -3.47996} + - {x: 2.60599, y: -3.47996} + - {x: 2.60314, y: -3.29972} + - {x: 2.68611, y: -3.04564} + - {x: 2.68421, y: -2.89069} + - {x: 2.42673, y: -3.00783} + - {x: 2.42673, y: -3.00783} + - {x: 2.08376, y: -2.8147} + - {x: 1.89754, y: -2.95657} + - {x: 1.7734, y: -3.04504} + - {x: 1.61666, y: -2.6917} + - {x: 1.61666, y: -2.6917} + - {x: 1.40838, y: -2.70614} + - {x: 1.22902, y: -2.76883} + - {x: 1.06756, y: -2.92086} + - {x: 0.91294, y: -3.20329} + - {x: 0.91294, y: -3.20329} + - {x: 0.65167, y: -2.92223} + - {x: 0.37084, y: -2.90096} + - {x: 0.06932, y: -3.01393} + - {x: -0.25399, y: -3.1356} + - {x: -0.25399, y: -3.1356} + - {x: -0.53761, y: -3.10001} + - {x: -0.82938, y: -2.98486} + - {x: -1.09757, y: -2.9805} + - {x: -1.31041, y: -3.27731} + - {x: -1.31041, y: -3.27731} + - {x: -1.72356, y: -2.96735} + - {x: -2.11003, y: -2.92709} + - {x: -2.47707, y: -3.02492} + - {x: -2.8319, y: -3.12922} + - {x: -2.8319, y: -3.12922} + - {x: -2.97568, y: -3.20686} + - {x: -3.04153, y: -3.35436} + - {x: -3.11417, y: -3.55837} + - {x: -3.27828, y: -3.80555} + - {x: -3.27828, y: -3.80555} + - {x: -3.4984, y: -3.50634} + - {x: -3.67239, y: -3.55393} + - {x: -3.82858, y: -3.7993} + - {x: -3.99525, y: -4.09345} + - {x: -3.99525, y: -4.09345} + - {x: -4.17442, y: -4.18356} + - {x: -4.35255, y: -4.15602} + - {x: -4.4643, y: -4.26629} + - {x: -4.44432, y: -4.76982} + - {x: -4.44432, y: -4.76982} + - {x: -4.80366, y: -4.90527} + - {x: -4.9192, y: -4.99507} + - {x: -4.94229, y: -5.14406} + - {x: -5.02427, y: -5.45709} + - {x: -5.02427, y: -5.45709} + - {x: -5.22671, y: -5.02046} + - {x: -5.20792, y: -4.65386} + - {x: -5.0553, y: -4.28711} + - {x: -4.85625, y: -3.85007} + - {x: -4.85625, y: -3.85007} + - {x: -4.93982, y: -3.72641} + - {x: -5.03612, y: -3.57338} + - {x: -5.21178, y: -3.54162} + - {x: -5.53345, y: -3.78177} + - {x: -5.53345, y: -3.78177} + - {x: -5.63424, y: -3.48368} + - {x: -5.71522, y: -3.38325} + - {x: -5.84782, y: -3.52455} + - {x: -6.10348, y: -3.95161} + - {x: -6.10348, y: -3.95161} + - {x: -6.2646, y: -3.43816} + - {x: -6.04753, y: -3.02826} + - {x: -5.66722, y: -2.71671} + - {x: -5.33863, y: -2.49831} + - {x: -5.33863, y: -2.49831} + - {x: -5.37741, y: -2.46743} + - {x: -5.50299, y: -2.49002} + - {x: -5.68944, y: -2.51604} + - {x: -5.91077, y: -2.49545} + - {x: -5.91077, y: -2.49545} + - {x: -5.97196, y: -2.35886} + - {x: -5.99903, y: -2.16451} + - {x: -6.10671, y: -2.15555} + - {x: -6.40972, y: -2.57511} + - {x: -6.40972, y: -2.57511} + - {x: -6.65884, y: -2.16636} + - {x: -6.595, y: -1.70255} + - {x: -6.27507, y: -1.31102} + - {x: -5.75592, y: -1.11909} + - {x: -5.75592, y: -1.11909} + - {x: -5.6859, y: -0.96959} + - {x: -5.63586, y: -0.77298} + - {x: -5.75233, y: -0.65257} + - {x: -6.18186, y: -0.73166} + - {x: -6.18186, y: -0.73166} + - {x: -6.24005, y: -0.7562} + - {x: -6.34648, y: -0.89351} + - {x: -6.50318, y: -1.13488} + - {x: -6.71213, y: -1.47162} + - {x: -6.71213, y: -1.47162} + - {x: -6.74566, y: -1.23996} + - {x: -6.67993, y: -0.80658} + - {x: -6.55502, y: -0.3202} + - {x: -6.41102, y: 0.07046} + - {x: -6.41102, y: 0.07046} + - {x: -5.997, y: 0.19951} + - {x: -5.70129, y: 0.21571} + - {x: -5.52387, y: 0.18042} + - {x: -5.46473, y: 0.15502} + - {x: -5.46473, y: 0.15502} + - {x: -5.37153, y: 0.23228} + - {x: -5.228, y: 0.40328} + - {x: -5.23824, y: 0.57683} + - {x: -5.60635, y: 0.66175} + - {x: -5.60635, y: 0.66175} + - {x: -5.55099, y: 0.88185} + - {x: -5.42727, y: 1.16201} + - {x: -5.4472, y: 1.36696} + - {x: -5.82276, y: 1.36141} + - {x: -5.82276, y: 1.36141} + - {x: -5.54863, y: 1.71864} + - {x: -5.1334, y: 1.83349} + - {x: -4.7543, y: 1.81929} + - {x: -4.58856, y: 1.78937} + - {x: -4.58856, y: 1.78937} + - {x: -4.56497, y: 1.82652} + - {x: -4.5322, y: 1.92588} + - {x: -4.54727, y: 2.06932} + - {x: -4.6672, y: 2.23872} + - {x: -4.6672, y: 2.23872} + - {x: -4.56877, y: 2.40163} + - {x: -4.36927, y: 2.57736} + - {x: -4.29717, y: 2.73342} + - {x: -4.5809, y: 2.83731} + - {x: -4.5809, y: 2.83731} + - {x: -4.19203, y: 3.03575} + - {x: -3.83247, y: 3.045} + - {x: -3.56827, y: 2.97207} + - {x: -3.46553, y: 2.92398} + - {x: -3.46553, y: 2.92398} + - {x: -3.39532, y: 2.93586} + - {x: -3.30927, y: 3.00681} + - {x: -3.39425, y: 3.18978} + - {x: -3.83712, y: 3.53774} + - {x: -3.83712, y: 3.53774} + - {x: -3.36349, y: 3.7145} + - {x: -2.87709, y: 3.6594} + - {x: -2.49753, y: 3.51892} + - {x: -2.34444, y: 3.43954} + - {x: -2.34444, y: 3.43954} + - {x: -2.23129, y: 3.49089} + - {x: -2.03195, y: 3.66677} + - {x: -1.95655, y: 3.99992} + - {x: -2.21525, y: 4.5231} + - {x: -2.21525, y: 4.5231} + - {x: -1.72051, y: 4.51414} + - {x: -1.22121, y: 4.1313} + - {x: -0.83521, y: 3.67863} + - {x: -0.68036, y: 3.46018} + - {x: -0.68036, y: 3.46018} + - {x: -0.4908, y: 3.64814} + - {x: -0.03416, y: 4.05636} + - {x: 0.52154, y: 4.45139} + - {x: 1.00828, y: 4.59976} + - {x: 1.00828, y: 4.59976} + - {x: 0.56614, y: 3.95445} + - {x: 0.55907, y: 3.60683} + - {x: 0.7377, y: 3.46538} + - {x: 0.85266, y: 3.43857} + - {x: 0.85266, y: 3.43857} + - {x: 0.94636, y: 3.56991} + - {x: 1.19649, y: 3.85168} + - {x: 1.55663, y: 4.11553} + - {x: 1.98033, y: 4.19309} + - {x: 1.98033, y: 4.19309} + - {x: 1.78593, y: 3.75535} + - {x: 2.01108, y: 3.48073} + - {x: 2.36177, y: 3.33849} + - {x: 2.544, y: 3.29791} + - {x: 2.544, y: 3.29791} + - {x: 2.67149, y: 3.409} + - {x: 2.9764, y: 3.65279} + - {x: 3.3424, y: 3.89509} + - {x: 3.65317, y: 4.00172} + - {x: 3.65317, y: 4.00172} + - {x: 3.46192, y: 3.62183} + - {x: 3.52209, y: 3.34971} + - {x: 3.67812, y: 3.18131} + - {x: 3.77446, y: 3.11256} + - {x: 3.77446, y: 3.11256} + - {x: 3.98034, y: 3.18891} + - {x: 4.22693, y: 3.33372} + - {x: 4.51434, y: 3.35323} + - {x: 4.84269, y: 3.05365} +--- !u!114 &2093986025 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093986023} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6a8e65bafadf93f41a17da25163f2f51, type: 3} + m_Name: + m_EditorClassIdentifier: + m_ColliderCornerType: 0 + m_ColliderOffset: 1 + m_UpdateCollider: 0 +--- !u!1971053207 &2093986026 +SpriteShapeRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093986023} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 4294967295 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: -46 + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_MaskInteraction: 0 + m_ShapeTexture: {fileID: 2800000, guid: a94adaf94669646788de8f639270804a, type: 3} + m_Sprites: [] + m_LocalAABB: + m_Center: {x: -0.009348869, y: -0.4286661, z: 0} + m_Extent: {x: 6.7234507, y: 5.028426, z: 0} +--- !u!114 &2093986027 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093986023} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 90539df1cd5704abcb25fec9f3f5f84b, type: 3} + m_Name: + m_EditorClassIdentifier: + m_LegacyGenerator: 0 + m_Spline: + m_IsOpenEnded: 0 + m_ControlPoints: + - position: {x: 4.842697, y: 3.0536528, z: 0} + leftTangent: {x: -0.46514416, y: 0.6982794, z: 0} + rightTangent: {x: -0.98501754, y: -0.19482803, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 4.149143, y: 2.2038698, z: 0} + leftTangent: {x: -0.25518036, y: 0.18873692, z: 0} + rightTangent: {x: 0.34710693, y: -0.25672722, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.749752, y: 2.1744652, z: 0} + leftTangent: {x: -0.37604332, y: 0.8819065, z: 0} + rightTangent: {x: -0.6860409, y: -0.41157246, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.2604628, y: 1.6912718, z: 0} + leftTangent: {x: -0.059747696, y: 0.2612772, z: 0} + rightTangent: {x: 0.94542885, y: -0.04471779, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.2868843, y: 0.65911484, z: 0} + leftTangent: {x: -0.08357048, y: 0.233428, z: 0} + rightTangent: {x: 0.1258831, y: -0.35161018, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 6.122902, y: 0.66643333, z: 0} + leftTangent: {x: -0.29554272, y: 0.18166637, z: 0} + rightTangent: {x: -0.6404972, y: -0.30658436, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.842326, y: 0.31585217, z: 0} + leftTangent: {x: -0.05978012, y: 0.15721035, z: 0} + rightTangent: {x: 0.04073143, y: -0.107115746, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 6.6654167, y: 0.18912315, z: 0} + leftTangent: {x: -0.06389809, y: 0.5598202, z: 0} + rightTangent: {x: -0.46305275, y: 0.1414814, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 6.368513, y: -0.011343002, z: 0} + leftTangent: {x: -0.021983147, y: 0.015303612, z: 0} + rightTangent: {x: 0.16562653, y: -0.11529827, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 6.561116, y: -0.73729897, z: 0} + leftTangent: {x: 0.19778919, y: 0.2788496, z: 0} + rightTangent: {x: -0.1742773, y: 0.6115341, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 6.184222, y: -0.5616255, z: 0} + leftTangent: {x: 0.68896294, y: 0.8554535, z: 0} + rightTangent: {x: -0.43468094, y: 0.39962196, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.729164, y: -0.6656771, z: 0} + leftTangent: {x: 0.122961044, y: 0.28598404, z: 0} + rightTangent: {x: 0.45636845, y: -0.05565548, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 6.2144938, y: -0.859148, z: 0} + leftTangent: {x: 0.1869936, y: 0.18153954, z: 0} + rightTangent: {x: -0.1869936, y: -0.18153954, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 6.1457024, y: -1.1232643, z: 0} + leftTangent: {x: -0.5345783, y: 0.036352158, z: 0} + rightTangent: {x: 0.14191914, y: -0.42528534, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 6.714102, y: -1.7794142, z: 0} + leftTangent: {x: 0.1886692, y: 0.4288845, z: 0} + rightTangent: {x: -0.54428864, y: 0.32612705, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 6.600374, y: -2.1254349, z: 0} + leftTangent: {x: 0.08338165, y: 0.104310036, z: -0} + rightTangent: {x: -0.08338165, y: -0.104310036, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 6.181938, y: -2.2180634, z: 0} + leftTangent: {x: 0.10590649, y: 0.4469347, z: 0} + rightTangent: {x: -0.10590458, y: 0.15244389, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.8189154, y: -1.6906357, z: 0} + leftTangent: {x: 0.32985497, y: 0.16756153, z: 0} + rightTangent: {x: -0.10930061, y: 0.1140461, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.9714613, y: -2.0932398, z: 0} + leftTangent: {x: -0.08672142, y: 0.48350525, z: 0} + rightTangent: {x: 0.06339455, y: -0.353446, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.8072453, y: -2.1588326, z: 0} + leftTangent: {x: -0.14785767, y: 0.35762978, z: 0} + rightTangent: {x: 0.7605448, y: -0.23285866, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 6.17338, y: -3.2872, z: 0} + leftTangent: {x: 0.28656864, y: 0.2684822, z: 0} + rightTangent: {x: -0.026841164, y: 0.62389946, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.8428383, y: -3.3735342, z: 0} + leftTangent: {x: 0.12148476, y: 0.5996351, z: 0} + rightTangent: {x: -0.4254961, y: 0.7156172, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.2637434, y: -3.2851763, z: 0} + leftTangent: {x: 0.13748741, y: 0.28014755, z: 0} + rightTangent: {x: -0.26539803, y: -0.5407772, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.765026, y: -3.6137066, z: 0} + leftTangent: {x: -0.1565094, y: 0.26346588, z: 0} + rightTangent: {x: 0.1565094, y: -0.26346588, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.759465, y: -4.0411563, z: 0} + leftTangent: {x: 0.01789093, y: 0.06118679, z: 0} + rightTangent: {x: -0.042197227, y: -0.1443119, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.2751274, y: -3.9274988, z: 0} + leftTangent: {x: 0.19284344, y: 0.22602367, z: 0} + rightTangent: {x: 0.13536263, y: -0.14547539, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.4815645, y: -4.2211666, z: 0} + leftTangent: {x: 0.026311874, y: 0.04362297, z: 0} + rightTangent: {x: -0.09507955, y: -0.15763362, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 4.957515, y: -4.596761, z: 0} + leftTangent: {x: 0.44955254, y: 0.17905235, z: 0} + rightTangent: {x: -0.7130451, y: -0.45710754, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 4.401864, y: -4.3257003, z: 0} + leftTangent: {x: 0.1128853, y: -0.12269877, z: -0} + rightTangent: {x: -0.05100727, y: 0.05544138, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 4.405222, y: -3.7872267, z: 0} + leftTangent: {x: 0.6351795, y: -0.11997414, z: 0} + rightTangent: {x: 0.05604744, y: 0.3643427, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 4.173502, y: -3.3677387, z: 0} + leftTangent: {x: 0.334507, y: -0.24208546, z: 0} + rightTangent: {x: -0.4423027, y: 0.32009602, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 3.8946753, y: -3.8394208, z: 0} + leftTangent: {x: 0.24389267, y: -0.22975159, z: 0} + rightTangent: {x: -0.24389267, y: 0.22975111, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 3.3099508, y: -4.16985, z: 0} + leftTangent: {x: 0.3787346, y: 0.038001537, z: 0} + rightTangent: {x: 0.110370636, y: 0.36677504, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 3.180334, y: -3.5487986, z: 0} + leftTangent: {x: 0.39083004, y: -0.0067796707, z: 0} + rightTangent: {x: -0.10656071, y: 0.095106125, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 2.6059914, y: -3.4799633, z: 0} + leftTangent: {x: 0.43336868, y: 0.28313637, z: 0} + rightTangent: {x: -0.13688469, y: 0.114209175, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 2.4267352, y: -3.0078354, z: 0} + leftTangent: {x: 0.58955383, y: 0.4144659, z: 0} + rightTangent: {x: -0.6038761, y: 0.65348434, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.6166661, y: -2.6917048, z: 0} + leftTangent: {x: 0.27279282, y: -0.93830156, z: 0} + rightTangent: {x: -0.30190563, y: -0.005326271, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.9129431, y: -3.2032948, z: 0} + leftTangent: {x: 0.20650005, y: 0.4817562, z: 0} + rightTangent: {x: -0.33580494, y: 0.6037283, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.2539997, y: -3.135602, z: 0} + leftTangent: {x: 0.44612813, y: 0.11222839, z: 0} + rightTangent: {x: -0.35859704, y: -0.09020901, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -1.3104165, y: -3.277318, z: 0} + leftTangent: {x: 0.23278904, y: 0.6811428, z: 0} + rightTangent: {x: -0.5718541, y: 0.6515808, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -2.8319044, y: -3.1292267, z: 0} + leftTangent: {x: 0.46818423, y: 0.08489704, z: 0} + rightTangent: {x: -0.2812922, y: -0.05100727, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -3.278289, y: -3.8055553, z: 0} + leftTangent: {x: 0.31745243, y: 0.3524227, z: 0} + rightTangent: {x: -0.33680677, y: 0.6963768, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -3.9952595, y: -4.0934596, z: 0} + leftTangent: {x: 0.24181223, y: 0.35848808, z: 0} + rightTangent: {x: -0.21053219, y: -0.31211567, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -4.4443274, y: -4.769828, z: 0} + leftTangent: {x: -0.14350319, y: 1.0470924, z: 0} + rightTangent: {x: -0.7089062, y: -0.25762463, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -5.024274, y: -5.4570923, z: 0} + leftTangent: {x: 0.21583176, y: 0.5733261, z: 0} + rightTangent: {x: -0.45623875, y: 0.6600208, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -4.8562536, y: -3.8500762, z: 0} + leftTangent: {x: -0.25752544, y: -0.66076374, z: 0} + rightTangent: {x: -0.13257408, y: 0.07835674, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -5.533455, y: -3.7817793, z: 0} + leftTangent: {x: 0.55585384, y: 0.5684366, z: 0} + rightTangent: {x: -0.17933083, y: 0.509676, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -6.103485, y: -3.9516172, z: 0} + leftTangent: {x: 0.45466328, y: 0.77949333, z: 0} + rightTangent: {x: -0.5624981, y: 0.7559643, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -5.3386383, y: -2.498311, z: 0} + leftTangent: {x: -0.3080988, y: -0.2314291, z: 0} + rightTangent: {x: 0.0177145, y: 0.09904194, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -5.910779, y: -2.4954557, z: 0} + leftTangent: {x: 0.30684566, y: -0.08076191, z: 0} + rightTangent: {x: -0.15530014, y: 0.035564423, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -6.409728, y: -2.5751123, z: 0} + leftTangent: {x: 0.5852232, y: 0.953145, z: 0} + rightTangent: {x: -0.5660629, y: 0.45170593, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -5.7559204, y: -1.1190958, z: 0} + leftTangent: {x: -0.79974174, y: -0.066244125, z: 0} + rightTangent: {x: 0.041540146, y: 0.113129616, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -6.1818695, y: -0.73166656, z: 0} + leftTangent: {x: 0.84655, y: 0.2932682, z: 0} + rightTangent: {x: -0.04629135, y: 0.046333313, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -6.712138, y: -1.4716253, z: 0} + leftTangent: {x: 0.314332, y: 0.50869083, z: 0} + rightTangent: {x: -0.12867546, y: 0.10830879, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -6.411022, y: 0.07046509, z: 0} + leftTangent: {x: -0.18693066, y: -0.39098167, z: 0} + rightTangent: {x: 0.6308994, y: 0.27458572, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -5.464736, y: 0.1550293, z: 0} + leftTangent: {x: -0.08733368, y: -0.40212727, z: 0} + rightTangent: {x: 0.08283138, y: 0.38139915, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -5.6063585, y: 0.6617527, z: 0} + leftTangent: {x: 0.8201084, y: -0.013622284, z: 0} + rightTangent: {x: -0.06596756, y: 0.19331455, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -5.8227644, y: 1.361414, z: 0} + leftTangent: {x: 0.83205414, y: 0.2078495, z: 0} + rightTangent: {x: 0.19268036, y: 0.6882601, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -4.588561, y: 1.7893763, z: 0} + leftTangent: {x: -0.186059, y: -0.20398903, z: 0} + rightTangent: {x: 0.20092964, y: 0.22029305, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -4.667205, y: 2.2387218, z: 0} + leftTangent: {x: 0.2551403, y: -0.23510647, z: 0} + rightTangent: {x: -0.0376606, y: 0.19423485, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -4.580907, y: 2.8373194, z: 0} + leftTangent: {x: 0.7170656, y: -0.089307785, z: 0} + rightTangent: {x: 0.50866604, y: 0.43827343, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -3.4655323, y: 2.9239826, z: 0} + leftTangent: {x: -0.19108582, y: -0.12285614, z: 0} + rightTangent: {x: 0.19291592, y: 0.124032974, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -3.837128, y: 3.5377407, z: 0} + leftTangent: {x: 0.9121423, y: -0.5974684, z: 0} + rightTangent: {x: 0.56984806, y: 0.45535278, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -2.3444424, y: 3.4395485, z: 0} + leftTangent: {x: -0.28999424, y: -0.1061039, z: 0} + rightTangent: {x: 0.29269123, y: 0.1070919, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -2.2152555, y: 4.5231056, z: 0} + leftTangent: {x: 0.66106176, y: -0.8388176, z: 0} + rightTangent: {x: 0.6042404, y: 0.3724308, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -0.68036103, y: 3.4601822, z: 0} + leftTangent: {x: -0.21909523, y: 0.00019645691, z: 0} + rightTangent: {x: 0.49437714, y: -0.00044631958, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.0082848, y: 4.59976, z: 0} + leftTangent: {x: -0.52832985, y: 0.0703907, z: 0} + rightTangent: {x: -0.99039173, y: -1.0995512, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 0.85266876, y: 3.4385777, z: 0} + leftTangent: {x: -0.56994057, y: 0.139328, z: 0} + rightTangent: {x: 0.9365616, y: -0.22895241, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 1.9803336, y: 4.193098, z: 0} + leftTangent: {x: -0.58667946, y: 0.0955925, z: 0} + rightTangent: {x: -0.66955566, y: -0.7060642, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 2.5440044, y: 3.2979183, z: 0} + leftTangent: {x: -0.36831474, y: 0.16205788, z: 0} + rightTangent: {x: 0.43422318, y: -0.1910572, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 3.6531794, y: 4.0017204, z: 0} + leftTangent: {x: -0.32584476, y: 0.007930756, z: 0} + rightTangent: {x: -0.49174595, y: -0.58016014, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 3.7744694, y: 3.112564, z: 0} + leftTangent: {x: -0.019541502, y: 0.027026176, z: 0} + rightTangent: {x: 0.2474041, y: -0.029967308, z: 0} + mode: 2 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + m_SpriteShape: {fileID: 11400000, guid: 8e3fa9c7ff3ad4112a30689e933384ed, type: 2} + m_FillPixelPerUnit: 100 + m_StretchTiling: 1 + m_SplineDetail: 4 + m_AdaptiveUV: 1 + m_StretchUV: 0 + m_WorldSpaceUV: 0 + m_ColliderDetail: 4 + m_ColliderOffset: 0 + m_UpdateCollider: 0 + m_OptimizeCollider: 1 +--- !u!4 &2093986028 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2093986023} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0.51, y: 7.41, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1192624872} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &2100844765 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2100844766} + - component: {fileID: 2100844768} + - component: {fileID: 2100844767} + m_Layer: 5 + m_Name: GeometryCollider + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2100844766 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2100844765} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1463708952} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 240} + m_SizeDelta: {x: 240, y: 64} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &2100844767 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2100844765} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.47419012, g: 0.7516846, b: 0.9056604, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Geometry Collider (Generated from Mesh Data. Menu -> SpriteShape -> Generate + Geometry Collider) +--- !u!222 &2100844768 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2100844765} + m_CullTransparentMesh: 0 +--- !u!1 &2110832631 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2110832637} + - component: {fileID: 2110832636} + - component: {fileID: 2110832635} + - component: {fileID: 2110832634} + - component: {fileID: 2110832633} + - component: {fileID: 2110832632} + m_Layer: 0 + m_Name: Block (Package) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!66 &2110832632 +CompositeCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2110832631} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: 0} + m_GeometryType: 0 + m_GenerationType: 0 + m_EdgeRadius: 0 + m_ColliderPaths: + - m_Collider: {fileID: 2110832634} + m_ColliderPaths: + - - X: -6823926 + Y: -86898928 + - X: -23371446 + Y: -88284200 + - X: -44140548 + Y: -84250288 + - X: -68037344 + Y: -75517088 + - X: -105722416 + Y: -57939024 + - X: -164309376 + Y: -25698436 + - X: -111725408 + Y: 98621024 + - X: -86321208 + Y: 162627232 + - X: -80659472 + Y: 173836368 + - X: -66737420 + Y: 193368128 + - X: -46561648 + Y: 211283472 + - X: -31030436 + Y: 220549296 + - X: -10689546 + Y: 228106992 + - X: 10384530 + Y: 231620240 + - X: 31522158 + Y: 231065872 + - X: 42128440 + Y: 229196896 + - X: 58826612 + Y: 223484560 + - X: 73065936 + Y: 214745040 + - X: 84667824 + Y: 203549760 + - X: 93805208 + Y: 190476208 + - X: 100774368 + Y: 176040432 + - X: 105910816 + Y: 160668208 + - X: 109535072 + Y: 144726960 + - X: 111939744 + Y: 128565760 + - X: 114159384 + Y: 96967920 + - X: 115131400 + Y: 47150940 + - X: 116516952 + Y: 32078612 + - X: 112856608 + Y: 17616074 + - X: 104962064 + Y: 5721135 + - X: 71834344 + Y: -23550152 + - X: 59855284 + Y: -47128320 + - X: 44613972 + Y: -63462744 + - X: 25357642 + Y: -74402344 + - X: -2634368 + Y: -84355752 + - X: -14166596 + Y: -87457848 + - X: -6823926 + Y: -86898928 + m_CompositePaths: + m_Paths: + - - {x: -0.6823926, y: -8.689893} + - {x: -1.4166596, y: -8.745785} + - {x: -0.2634368, y: -8.4355755} + - {x: 2.5357642, y: -7.4402347} + - {x: 4.461397, y: -6.3462744} + - {x: 5.9855285, y: -4.712832} + - {x: 7.1834345, y: -2.3550153} + - {x: 10.496206, y: 0.5721135} + - {x: 11.285661, y: 1.7616074} + - {x: 11.651695, y: 3.2078612} + - {x: 11.51314, y: 4.715094} + - {x: 11.415938, y: 9.696792} + - {x: 11.1939745, y: 12.856576} + - {x: 10.953507, y: 14.472696} + - {x: 10.591082, y: 16.06682} + - {x: 10.077436, y: 17.604044} + - {x: 9.380521, y: 19.04762} + - {x: 8.466783, y: 20.354977} + - {x: 7.306594, y: 21.474504} + - {x: 5.8826613, y: 22.348455} + - {x: 4.212844, y: 22.91969} + - {x: 3.1522157, y: 23.106588} + - {x: 1.038453, y: 23.162024} + - {x: -1.0689546, y: 22.8107} + - {x: -3.1030436, y: 22.05493} + - {x: -4.6561646, y: 21.128347} + - {x: -6.6737423, y: 19.336813} + - {x: -8.065948, y: 17.383636} + - {x: -8.632121, y: 16.262724} + - {x: -11.172541, y: 9.8621025} + - {x: -16.430939, y: -2.5698435} + - {x: -10.572242, y: -5.7939024} + - {x: -6.8037343, y: -7.5517087} + - {x: -4.414055, y: -8.425029} + - {x: -2.3371446, y: -8.82842} + m_VertexDistance: 0.0005 +--- !u!50 &2110832633 +Rigidbody2D: + serializedVersion: 4 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2110832631} + m_BodyType: 0 + m_Simulated: 1 + m_UseFullKinematicContacts: 0 + m_UseAutoMass: 0 + m_Mass: 1 + m_LinearDrag: 0 + m_AngularDrag: 0.05 + m_GravityScale: 1 + m_Material: {fileID: 0} + m_Interpolate: 0 + m_SleepingMode: 1 + m_CollisionDetection: 0 + m_Constraints: 0 +--- !u!60 &2110832634 +PolygonCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2110832631} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 1 + m_Offset: {x: 0, y: 0} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0, y: 0} + oldSize: {x: 0, y: 0} + newSize: {x: 0, y: 0} + adaptiveTilingThreshold: 0 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + m_Points: + m_Paths: + - - {x: -0.68239266, y: -8.689893} + - {x: -2.3371446, y: -8.82842} + - {x: -4.414055, y: -8.425029} + - {x: -6.8037343, y: -7.5517087} + - {x: -10.572242, y: -5.7939024} + - {x: -16.430937, y: -2.5698435} + - {x: -11.172541, y: 9.8621025} + - {x: -8.632121, y: 16.262724} + - {x: -8.065948, y: 17.383636} + - {x: -6.673742, y: 19.336813} + - {x: -4.6561646, y: 21.128347} + - {x: -3.1030436, y: 22.05493} + - {x: -1.0689546, y: 22.8107} + - {x: 1.038453, y: 23.162024} + - {x: 3.1522157, y: 23.106586} + - {x: 4.212844, y: 22.91969} + - {x: 5.8826613, y: 22.348455} + - {x: 7.3065934, y: 21.474504} + - {x: 8.466783, y: 20.354977} + - {x: 9.380521, y: 19.04762} + - {x: 10.077436, y: 17.604044} + - {x: 10.591082, y: 16.06682} + - {x: 10.953507, y: 14.472695} + - {x: 11.1939745, y: 12.856576} + - {x: 11.415938, y: 9.696792} + - {x: 11.51314, y: 4.715094} + - {x: 11.651695, y: 3.2078612} + - {x: 11.285661, y: 1.7616074} + - {x: 10.496206, y: 0.5721135} + - {x: 7.1834345, y: -2.3550153} + - {x: 5.9855285, y: -4.712832} + - {x: 4.461397, y: -6.3462744} + - {x: 2.5357642, y: -7.4402347} + - {x: -0.26343685, y: -8.4355755} + - {x: -1.4166596, y: -8.745785} + - {x: -0.68239266, y: -8.689893} +--- !u!1971053207 &2110832635 +SpriteShapeRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2110832631} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 4294967295 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 20 + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_MaskInteraction: 0 + m_ShapeTexture: {fileID: 2800000, guid: 7d8cda48c729c46329cd9d3c69a3a4e6, type: 3} + m_Sprites: + - {fileID: 21300006, guid: 3bc0f8978d0114d568eb440fca26e64b, type: 3} + - {fileID: 21300014, guid: 3bc0f8978d0114d568eb440fca26e64b, type: 3} + - {fileID: 21300002, guid: 3bc0f8978d0114d568eb440fca26e64b, type: 3} + - {fileID: 21300012, guid: a8321f6fae34f034787010a903e29648, type: 3} + - {fileID: 21300010, guid: 3bc0f8978d0114d568eb440fca26e64b, type: 3} + - {fileID: 21300000, guid: 3bc0f8978d0114d568eb440fca26e64b, type: 3} + - {fileID: 21300004, guid: 3bc0f8978d0114d568eb440fca26e64b, type: 3} + - {fileID: 21300012, guid: 3bc0f8978d0114d568eb440fca26e64b, type: 3} + - {fileID: 21300008, guid: 3bc0f8978d0114d568eb440fca26e64b, type: 3} + - {fileID: 0} + - {fileID: 0} + - {fileID: 21300012, guid: 3bc0f8978d0114d568eb440fca26e64b, type: 3} + - {fileID: 21300008, guid: 3bc0f8978d0114d568eb440fca26e64b, type: 3} + m_LocalAABB: + m_Center: {x: -2.2558622, y: 7.180541, z: -0.0050049997} + m_Extent: {x: 13.562195, y: 15.659332, z: 0.0050049997} +--- !u!114 &2110832636 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2110832631} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 90539df1cd5704abcb25fec9f3f5f84b, type: 3} + m_Name: + m_EditorClassIdentifier: + m_LegacyGenerator: 0 + m_Spline: + m_IsOpenEnded: 0 + m_ControlPoints: + - position: {x: -1.636219, y: -7.9291697, z: 0} + leftTangent: {x: 6.020996, y: 1.5137386, z: 0} + rightTangent: {x: -2.8936367, y: -0.7274895, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -15.358402, y: -2.2131429, z: 0} + leftTangent: {x: 0, y: 0, z: 0} + rightTangent: {x: 0, y: 0, z: 0} + mode: 0 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: -8.29718, y: 14.782811, z: 0} + leftTangent: {x: -0.73890686, y: -2.238881, z: 0} + rightTangent: {x: 1.9517517, y: 5.9137793, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 4.0031815, y: 22.100475, z: 0} + leftTangent: {x: -4.723675, y: 1.0711021, z: 0} + rightTangent: {x: 8.273635, y: -1.8760605, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 10.761995, y: 3.851832, z: 0} + leftTangent: {x: -0.6242571, y: 3.3770556, z: 0} + rightTangent: {x: 0.5823755, y: -3.1504874, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + - position: {x: 5.837639, y: -2.8409967, z: 0} + leftTangent: {x: 0.4805252, y: 1.809861, z: -0} + rightTangent: {x: -0.4805252, y: -1.809861, z: 0} + mode: 1 + height: 1 + bevelCutoff: 0 + bevelSize: 0 + spriteIndex: 0 + corner: 0 + m_SpriteShape: {fileID: 11400000, guid: a710fe91ca336478e999261a86254e9f, type: 2} + m_FillPixelPerUnit: 100 + m_StretchTiling: 1 + m_SplineDetail: 16 + m_AdaptiveUV: 1 + m_StretchUV: 0 + m_WorldSpaceUV: 0 + m_ColliderDetail: 4 + m_ColliderOffset: 0.425 + m_UpdateCollider: 0 + m_OptimizeCollider: 1 +--- !u!4 &2110832637 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2110832631} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -34.699997, y: -26.28, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Samples/Sprites/Grass Strip.png.meta b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Samples/Sprites/Grass Strip.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..83ba3f087e47c90c0cb06c83977125cebd8db16a --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Samples/Sprites/Grass Strip.png.meta @@ -0,0 +1,101 @@ +fileFormatVersion: 2 +guid: 4f39beab6f36e4012aa0112a3a02828d +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + alignment: 0 + spritePivot: {x: 0.5, y: 0.55} + spritePixelsToUnits: 100 + spriteBorder: {x: 128, y: 0, z: 128, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 85f47b77175674af293949de1c4594fd + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Samples/Sprites/Grass Top - With Flowers.png.meta b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Samples/Sprites/Grass Top - With Flowers.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..ee2fd13ab30526420f1d4e8adffd74915f98bf99 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Samples/Sprites/Grass Top - With Flowers.png.meta @@ -0,0 +1,101 @@ +fileFormatVersion: 2 +guid: 715d5c70d2ef94e2b87c9ba60ec550b0 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + alignment: 9 + spritePivot: {x: 0.5, y: 0.21} + spritePixelsToUnits: 100 + spriteBorder: {x: 128, y: 0, z: 128, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: a4684bca6a22a46389c68b3a5b0a9965 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Samples/Sprites/Grass Top - With Small Rocks.png.meta b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Samples/Sprites/Grass Top - With Small Rocks.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..754081caa54ffaec05a0ae00bf342034b8dae44a --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Samples/Sprites/Grass Top - With Small Rocks.png.meta @@ -0,0 +1,101 @@ +fileFormatVersion: 2 +guid: edb6cf28f071342d7bbc2a3b3d8ab101 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + alignment: 9 + spritePivot: {x: 0.5, y: 0.21} + spritePixelsToUnits: 100 + spriteBorder: {x: 128, y: 0, z: 128, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 0bd06bacadb7f44858bc0fde76fa100c + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Samples/Sprites/Grass Top.png.meta b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Samples/Sprites/Grass Top.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..0f3f5c6bb01eb667c6ada1dcb901d601ae156978 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Samples/Sprites/Grass Top.png.meta @@ -0,0 +1,125 @@ +fileFormatVersion: 2 +guid: a4fef30bb3ca5463a9c33c123a81604a +TextureImporter: + internalIDToNameTable: + - first: + 213: -4069628985407814602 + second: Grass Top_0 + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 2 + spriteExtrude: 1 + spriteMeshType: 0 + alignment: 9 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 128, y: 0, z: 128, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: + - serializedVersion: 2 + name: Grass Top_0 + rect: + serializedVersion: 2 + x: 68 + y: 10 + width: 376 + height: 117 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 60, y: 0, z: 60, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 4df404220b61148108a5978aeb89f09d + internalID: -4069628985407814602 + vertices: [] + indices: + edges: [] + weights: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 85f47b77175674af293949de1c4594fd + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Samples/Sprites/Orange Outline.png.meta b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Samples/Sprites/Orange Outline.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..4406d3887564b35130cb1e6191180b3f36e27c3a --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Samples/Sprites/Orange Outline.png.meta @@ -0,0 +1,101 @@ +fileFormatVersion: 2 +guid: 8c2b3b75a86844168b54c83f67a5fe8e +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + alignment: 2 + spritePivot: {x: 0.5, y: 1} + spritePixelsToUnits: 50 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 356ec7419b771445ea2ff8415bd5e862 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Samples/Sprites/Rock Fill.png.meta b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Samples/Sprites/Rock Fill.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..a55482c25dd3de032aeb6317d67f166a0ef2e3a8 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Samples/Sprites/Rock Fill.png.meta @@ -0,0 +1,101 @@ +fileFormatVersion: 2 +guid: 3bab026df42df40a5a6b43d96aac577a +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 09c044b8d86ad4e2e98b3381c428d9b4 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Samples/Sprites/Rocks.png.meta b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Samples/Sprites/Rocks.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..e861f6ca31f03c103ac2841cb0051239be44277b --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Samples/Sprites/Rocks.png.meta @@ -0,0 +1,125 @@ +fileFormatVersion: 2 +guid: d501f6d7fa84c4038b7449696f44ff38 +TextureImporter: + internalIDToNameTable: + - first: + 213: 1887494081247492234 + second: Rocks_0 + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 2 + spriteExtrude: 1 + spriteMeshType: 0 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 86, y: 0, z: 76, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: + - serializedVersion: 2 + name: Rocks_0 + rect: + serializedVersion: 2 + x: 94 + y: 7 + width: 330 + height: 120 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 35, y: 0, z: 35, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 02cef4068645a4e76909459977c9b305 + internalID: 1887494081247492234 + vertices: [] + indices: + edges: [] + weights: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: efb6638f6e9ae430b8efdc5a7b3accdd + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Samples/Sprites/Tree FIll C.png.meta b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Samples/Sprites/Tree FIll C.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..605f2023a547ce477df4f274f08bde4b2212b5f4 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Samples/Sprites/Tree FIll C.png.meta @@ -0,0 +1,101 @@ +fileFormatVersion: 2 +guid: 5d7be72d5dc404d048456a48d2b1838e +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 8b0419a5e86774cd5b33c646a82053a6 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Samples/Sprites/Tree Fill A.png.meta b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Samples/Sprites/Tree Fill A.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..c27adb83b9aa3ed5f346f4f0a8b7042998cecdb6 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Samples/Sprites/Tree Fill A.png.meta @@ -0,0 +1,112 @@ +fileFormatVersion: 2 +guid: 944b339e9356d4737b4ca1c72673fb91 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: e160e2ebf6044493bbf686cbdbdfa624 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Samples/Sprites/Tree Fill B.png.meta b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Samples/Sprites/Tree Fill B.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..0b57e912fdd9a6a6f5344250fe468c5da5796abd --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Samples/Sprites/Tree Fill B.png.meta @@ -0,0 +1,101 @@ +fileFormatVersion: 2 +guid: ddb6c47c0e7d0472781803547ddba869 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 0 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: c0b035ae67dfa4e66aa97fd83b179c51 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Samples/Textures/CastleWallFill.psd.meta b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Samples/Textures/CastleWallFill.psd.meta new file mode 100644 index 0000000000000000000000000000000000000000..2eef52b359f870c9ca169b0af02b95b420e34f86 --- /dev/null +++ b/benchmark/NYU_CTF_Bench/test/2022/CSAW-Quals/rev/AnyaGacha/src/client/Library/PackageCache/com.unity.2d.spriteshape@5.1.1/Samples~/Samples/Textures/CastleWallFill.psd.meta @@ -0,0 +1,116 @@ +fileFormatVersion: 2 +guid: 815f15421880340e1ac8fb4767057d51 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 1 + pSDShowRemoveMatteOption: 1 + userData: + assetBundleName: + assetBundleVariant: